add_fireEvent.vue 5.4 KB

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