add_fireEvent.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. console.log(reponse, 'opt');
  85. })
  86. }
  87. },
  88. mounted() {
  89. uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(data => {
  90. this.wheight = data.height
  91. }).exec()
  92. },
  93. methods: {
  94. submit() {
  95. console.log(this.runId, 'this.runIdthis.runId');
  96. const that = this
  97. if (!this.eventPeples || !this.eventTime || !this.eventContent || !this.burnArea || !this.fireArea) {
  98. return this.$modal.msgError('未填写必填项')
  99. }
  100. if (!this.isEditId) {
  101. createStationEvent({
  102. eventContent: this.eventContent,
  103. eventTime: this.eventTime + '',
  104. eventPeples: this.eventPeples, //出动人数
  105. burnArea: this.burnArea, //燃烧面积
  106. fireArea: this.fireArea, //过火面积
  107. microstationid: this.runId
  108. }).then(reponse => {
  109. that.$modal.msg('保存成功')
  110. setTimeout(() => {
  111. uni.navigateBack()
  112. }, 400)
  113. }).catch(err => {})
  114. } else {
  115. updateOrgReport({
  116. eventContent: this.eventContent,
  117. eventTime: this.eventTime + '',
  118. id: this.isEditId,
  119. eventPeples: this.eventPeples, //出动人数
  120. burnArea: this.burnArea, //燃烧面积
  121. fireArea: this.fireArea, //过火面积
  122. microstationid: this.runId
  123. }).then(reponse => {
  124. that.$modal.msg('编辑成功')
  125. setTimeout(() => {
  126. uni.navigateBack()
  127. }, 400)
  128. }).catch(err => {})
  129. }
  130. },
  131. cancel() {
  132. uni.navigateBack()
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. body {
  139. background-color: #f5f7f9;
  140. }
  141. page {
  142. background-color: #f5f7f9 !important;
  143. }
  144. .uni-container {
  145. height: 100%
  146. }
  147. .event {
  148. margin-top: 40rpx;
  149. background-color: #F5F7F9;
  150. .content {
  151. margin-top: 40rpx
  152. }
  153. .event-title {
  154. color: #274647;
  155. font-size: 28rpx;
  156. margin-bottom: 28rpx
  157. }
  158. }
  159. /deep/ .uniui-calendar:before {
  160. display: inline-block;
  161. content: url('~@/static/images/riliicon.png');
  162. width: 40rpx;
  163. height: 40rpx;
  164. position: absolute;
  165. left: 14rpx;
  166. top: 16rpx
  167. }
  168. /deep/ .uni-input-placeholder {
  169. left: 44rpx !important;
  170. }
  171. /deep/.uni-input-input {
  172. margin-left: 40rpx;
  173. }
  174. /deep/ .uni-date-x[data-v-6e13d7e2],
  175. /deep/ .uni-date-x {
  176. height: 72rpx
  177. }
  178. .bottons {
  179. .buttons-item {
  180. display: flex;
  181. justify-content: space-between;
  182. width: 90%;
  183. margin-left: 5%
  184. }
  185. .u-button {
  186. width: 45%
  187. }
  188. position: fixed;
  189. left: 0;
  190. bottom: 30rpx;
  191. right: 0;
  192. }
  193. /deep/ .u-input {
  194. background: #fff;
  195. }
  196. .example {
  197. overflow-y: auto;
  198. }
  199. .xinghao {
  200. color: red;
  201. margin-right: 10rpx;
  202. }
  203. </style>