add_fireEvent.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="uni-container uni-container-bg">
  3. <view class="example container" :style="'height: ' + (screenHeight - wheight - 75) + 'px'">
  4. <view class="event">
  5. <view class="event-title">事件时间</view>
  6. <uni-datetime-picker class="time-item-check" type="date" :clear-icon="false":disabled="isview" v-model="eventTime"
  7. @maskClick="startMaskClick" placeholder="请选择事件时间" />
  8. <view class="content">
  9. <view class="event-title">出动人数</view>
  10. <u-input v-model="eventPeples" placeholder="请输入出动人数" :maxlength="1000" :disabled="isview" count height="150">
  11. </u-input>
  12. </view>
  13. <view class="content">
  14. <view class="event-title">燃烧面积</view>
  15. <u-input v-model="burnArea" placeholder="请输入燃烧面积" :maxlength="1000" :disabled="isview" count height="150">
  16. </u-input>
  17. </view>
  18. <view class="content">
  19. <view class="event-title">过火面积</view>
  20. <u-input v-model="fireArea" placeholder="请输入过火面积" :maxlength="1000" :disabled="isview" count height="150">
  21. </u-input>
  22. </view>
  23. <view class="content" style="margin-bottom: 60rpx;">
  24. <view class="event-title">事件内容</view>
  25. <u--textarea v-model="eventContent" placeholder="请输入内容" :disabled="isview" :maxlength="1000" count height="150">
  26. </u--textarea >
  27. </view>
  28. </view>
  29. </view>
  30. <view class="bottons heigthButton" v-if="!isview">
  31. <view class="buttons-item">
  32. <u-button shape="circle" type="primary" text="取消"
  33. :custom-style="{color:'#4CB2B6',backgroundColor: '#fff',border:'1px solid #fff',marginRight:'10px'}"
  34. @click="cancel">
  35. </u-button>
  36. <u-button shape="circle" type="primary" color="#4CB2B6" text="保存" @click="submit">
  37. </u-button>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import riliicon from '@/static/images/riliicon.png'
  44. import {
  45. createStationEvent,
  46. getOneMicrostation, //编辑获取
  47. updateOrgReport
  48. } from '@/api/fire_station/index';
  49. export default {
  50. data() {
  51. return {
  52. screenHeight: this.$screenHeight,
  53. wheight: '',
  54. eventContent: '',
  55. eventTime: '',
  56. riliicon: riliicon,
  57. isEditId: false,
  58. eventPeples:'',//出动人数
  59. burnArea:"",//燃烧面积
  60. fireArea:'',//过火面积
  61. runId:'',
  62. isview:false
  63. }
  64. },
  65. onLoad: function(option) {
  66. if(option.isview=="isview"){
  67. this.isview=true
  68. }
  69. this.runId=option.runId
  70. if (option.id) {
  71. this.isEditId = option.id
  72. getOneMicrostation({
  73. id: option.id
  74. }).then(reponse => {
  75. this.eventTime = reponse.data.eventTime
  76. this.eventContent = reponse.data.eventContent
  77. this.eventPeples=reponse.data.eventPeples,//出动人数
  78. this.burnArea=reponse.data.burnArea,//燃烧面积
  79. this.fireArea=reponse.data.fireArea,//过火面积
  80. console.log(reponse, 'opt');
  81. })
  82. }
  83. },
  84. mounted() {
  85. uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(data => {
  86. this.wheight = data.height
  87. }).exec()
  88. },
  89. methods: {
  90. submit() {
  91. console.log(this.runId,'this.runIdthis.runId');
  92. const that = this
  93. if (!this.eventContent) {
  94. return this.$modal.msgError('请填写事件内容')
  95. }
  96. if (!this.eventTime) {
  97. return this.$modal.msgError('请选择事件时间')
  98. }
  99. if (!this.isEditId) {
  100. createStationEvent({
  101. eventContent: this.eventContent,
  102. eventTime: this.eventTime + '',
  103. eventPeples:this.eventPeples,//出动人数
  104. burnArea:this.burnArea,//燃烧面积
  105. fireArea:this.fireArea,//过火面积
  106. microstationid:this.runId
  107. }).then(reponse => {
  108. that.$modal.msg('保存成功')
  109. setTimeout(() => {
  110. uni.navigateBack()
  111. }, 400)
  112. }).catch(err => {})
  113. } else {
  114. updateOrgReport({
  115. eventContent: this.eventContent,
  116. eventTime: this.eventTime + '',
  117. id: this.isEditId,
  118. eventPeples:this.eventPeples,//出动人数
  119. burnArea:this.burnArea,//燃烧面积
  120. fireArea:this.fireArea,//过火面积
  121. microstationid:this.runId
  122. }).then(reponse => {
  123. that.$modal.msg('编辑成功')
  124. setTimeout(() => {
  125. uni.navigateBack()
  126. }, 400)
  127. }).catch(err => {})
  128. }
  129. },
  130. cancel() {
  131. uni.navigateBack()
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. body {
  138. background-color: #f5f7f9;
  139. }
  140. page {
  141. background-color: #f5f7f9 !important;
  142. }
  143. .uni-container {
  144. height: 100%
  145. }
  146. .event {
  147. margin-top: 40rpx;
  148. background-color: #F5F7F9;
  149. .content {
  150. margin-top: 40rpx
  151. }
  152. .event-title {
  153. color: #274647;
  154. font-size: 28rpx;
  155. margin-bottom: 28rpx
  156. }
  157. }
  158. /deep/ .uniui-calendar:before {
  159. display: inline-block;
  160. content: url('~@/static/images/riliicon.png');
  161. width: 40rpx;
  162. height: 40rpx;
  163. position: absolute;
  164. left: 14rpx;
  165. top: 16rpx
  166. }
  167. /deep/ .uni-input-placeholder {
  168. left: 44rpx !important;
  169. }
  170. /deep/.uni-input-input {
  171. margin-left: 40rpx;
  172. }
  173. /deep/ .uni-date-x[data-v-6e13d7e2],
  174. /deep/ .uni-date-x {
  175. height: 72rpx
  176. }
  177. .bottons {
  178. .buttons-item {
  179. display: flex;
  180. justify-content: space-between;
  181. width: 90%;
  182. margin-left: 5%
  183. }
  184. .u-button {
  185. width: 45%
  186. }
  187. position: fixed;
  188. left: 0;
  189. bottom: 30rpx;
  190. right: 0;
  191. }
  192. /deep/ .u-input{
  193. background: #fff;
  194. }
  195. .example {
  196. overflow-y: auto;
  197. }
  198. </style>