equipment-status.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="mx3" style="padding-bottom: 100rpx">
  3. <u-toast ref="uToast" />
  4. <view class="main-color-bg" style="height: 100rpx; margin: 0 -30rpx"></view>
  5. <view
  6. class="p3 bg-color-white"
  7. style="margin-top: -50rpx; border-radius: 20rpx"
  8. >
  9. <u-form :model="form" ref="uForm" >
  10. <view class="main-color-text f-size-32 f-weight-6 mt-2">设备信息</view>
  11. <u-form-item label="设备名称" :label-width="150">
  12. <u-input v-model="form.sbName" disabled />
  13. </u-form-item>
  14. <u-form-item label="设备编号" :label-width="150">
  15. <u-input v-model="form.sbNo" disabled />
  16. </u-form-item>
  17. <view class="main-color-text f-size-32 f-weight-6 mt-2">变更信息</view>
  18. <u-form-item label="变更时间" required :label-width="150">
  19. <u-input v-model="form.changeTime" @click="handleClick" :cursor-spacing="cursorSpacing" />
  20. </u-form-item>
  21. <u-form-item label="变更原因" :label-width="150">
  22. <u-input v-model="form.changeReason" :cursor-spacing="cursorSpacing" />
  23. </u-form-item>
  24. <u-form-item label="变更人" required :label-width="150">
  25. <u-input v-model="form.actualUser" :cursor-spacing="cursorSpacing" />
  26. </u-form-item>
  27. <u-form-item label="变更前状态" required :label-width="150">
  28. <text class="f-size-26 mr-3 state-r">{{ statusMap[form.preStatus] }}</text>
  29. </u-form-item>
  30. <u-form-item label="变更后状态" required :label-width="150">
  31. <text class="f-size-26 mr-3 state-r">{{ statusMap[form.afterStatus] }}</text>
  32. </u-form-item>
  33. </u-form>
  34. <u-picker @confirm="confirm" @cancel="cancel" mode="time" v-model="isShow" :params="pickerParams"></u-picker>
  35. <!-- <button class="main-color-bg text-color-white" @tap='handleSubmit'>提交</button> -->
  36. <view class="p-fixed d-flex j-around a-center footer">
  37. <view
  38. class="main-color-bg text-color-white common"
  39. @tap="handleSubmit"
  40. >提交</view
  41. >
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import BaseTool from '../../utils/tool';
  48. export default {
  49. data() {
  50. return {
  51. isShow: false,
  52. form: {
  53. sbId: '',
  54. sbNo: '',
  55. sbName: '',
  56. changeUserId: '',
  57. actualUser: '',
  58. preStatus: '',
  59. afterStatus: '',
  60. changeTime: '',
  61. changeReason: '',
  62. remarks: ''
  63. },
  64. pickerParams: {
  65. year: true,
  66. month: true,
  67. day: true,
  68. hour: true,
  69. minute: true,
  70. second: true,
  71. timestamp: true
  72. },
  73. statusMap: {},
  74. // #ifdef MP-WEIXIN
  75. cursorSpacing: 50,
  76. // #endif
  77. // #ifndef MP-WEIXIN
  78. cursorSpacing: 0,
  79. // #endif
  80. sbBackId: '',
  81. aShow: false,
  82. address: '',
  83. sbId: null,
  84. aList: [
  85. ]
  86. };
  87. },
  88. onShow() {
  89. },
  90. onLoad(options) {
  91. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  92. this.$DictCache.TYPE.SB_INFO_STATUS
  93. );
  94. if (options && options.sbId) {
  95. this.sbId = options.sbId;
  96. this.form.sbNo = options.sbNo;
  97. this.form.sbName = options.sbName;
  98. this.form.preStatus = options.preStatus;
  99. this.form.afterStatus = options.afterStatus;
  100. this.form.actualUser = this.$BaseTool.UserUtil.getUserInfo().realName;
  101. }
  102. },
  103. onReady() {
  104. },
  105. methods: {
  106. handleClick() {
  107. this.isShow = !this.isShow
  108. },
  109. confirm(values) {
  110. console.log(values)
  111. this.form.changeTime = values.year + '-' + values.month + '-' + values.day + ' ' + values.hour + ':' + values.minute + ':' + values.second
  112. console.log(this.form.changeTime)
  113. },
  114. cancel(values) {
  115. console.log(values)
  116. this.form.changeTime = null
  117. },
  118. handleSubmit() {
  119. console.log('点击')
  120. let time = null;
  121. if (this.form.changeTime != null) {
  122. time = this.$BaseTool.Date.formatter(this.form.changeTime, BaseTool.Date.PICKER_NORM_DATETIME_PATTERN);
  123. }
  124. const params = {
  125. sbId: this.form.sbId,
  126. actualUser: this.form.actualUser,
  127. preStatus: this.form.preStatus,
  128. afterStatus: this.form.afterStatus,
  129. changeTime: time,
  130. remarks: this.form.remarks,
  131. changeReason: this.form.changeReason
  132. };
  133. // this.form.photo = a.join(',');
  134. var that = this;
  135. this.$refs.uForm.validate((valid) => {
  136. console.log(valid)
  137. if (valid) {
  138. this.$Http.addSbStatusLogIgnores(params).then((res) => {
  139. uni.showToast({ icon: 'none', title: '变更记录已提交!', duration: 2000 });
  140. setTimeout(function () {
  141. uni.navigateTo({
  142. url: '/pages/equipment-detail/equipment-detail?detailId=' + that.form.sbId
  143. });
  144. }, 2000)
  145. });
  146. } else {
  147. console.log(valid)
  148. }
  149. });
  150. }
  151. }
  152. };
  153. </script>
  154. <style lang="less">
  155. .footer {
  156. bottom: 0;
  157. left: 0;
  158. right: 0;
  159. background-color: #fff;
  160. z-index: 10000;
  161. border-top: 1rpx solid #f4f4f4;
  162. height: 100rpx;
  163. .common {
  164. padding: 15rpx 200rpx;
  165. border-radius: 30rpx;
  166. background-color: #0082ff;
  167. color: #fff;
  168. }
  169. }
  170. </style>