fault-handle.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="home">
  3. <view class="device-info">
  4. <i class="iconfont icon-shebei"></i>设备故障信息
  5. </view>
  6. <view class="info-area">
  7. <u--form
  8. labelPosition="left"
  9. :model="model1"
  10. ref="form1"
  11. :labelWidth="100"
  12. labelAlign="center"
  13. >
  14. <u-form-item
  15. label="设备编码"
  16. prop="assetBarCode"
  17. borderBottom
  18. ref="item2"
  19. >
  20. {{model1.assetBarCode}}
  21. </u-form-item>
  22. <u-form-item
  23. label="上报工号"
  24. prop="username"
  25. borderBottom
  26. ref="item1"
  27. >
  28. {{model1.username}}
  29. </u-form-item>
  30. <u-form-item
  31. label="上报人"
  32. prop="username"
  33. borderBottom
  34. ref="item1"
  35. >
  36. {{model1.nickname}}
  37. </u-form-item>
  38. <u-form-item
  39. label="联系电话"
  40. prop="tel"
  41. borderBottom
  42. ref="item2"
  43. >
  44. {{model1.tel}}
  45. </u-form-item>
  46. <u-form-item
  47. label="上报位置"
  48. prop="placeName.placeName"
  49. borderBottom
  50. ref="item1"
  51. >
  52. {{model1.tbAsset.placeName}}
  53. </u-form-item>
  54. <u-form-item
  55. label="上报时间"
  56. prop="reportDate"
  57. borderBottom
  58. ref="item1"
  59. >
  60. {{model1.reportDate}}
  61. </u-form-item>
  62. <u-form-item
  63. label="处理状态"
  64. prop="processState"
  65. borderBottom
  66. ref="item2"
  67. >
  68. {{model1.processState==='0'?'未处理':'已处理'}}
  69. </u-form-item>
  70. </u--form>
  71. </view>
  72. <view class="type-head">
  73. <i class="iconfont icon-dingwei"></i>故障现象
  74. </view>
  75. <view class="type-area">
  76. <u--textarea
  77. border="none"
  78. v-model="model1.faultPhenomenon"
  79. autoHeight
  80. disabled
  81. maxlength="-1">
  82. </u--textarea>
  83. </view>
  84. <view class="type-head">
  85. <i class="iconfont icon-dingwei"></i>处理结果
  86. </view>
  87. <view class="type-area">
  88. <u--textarea
  89. border="none"
  90. v-model="model1.processResult"
  91. placeholder="请输入处理结果"
  92. :disabled="model1.processState==='0'?false:true"
  93. autoHeight
  94. maxlength="-1"></u--textarea>
  95. </view>
  96. <view v-if="model1.processState==='0'?true:false">
  97. <view class="type-head">
  98. <i class="iconfont icon-dingwei"></i>设备状态反馈
  99. </view>
  100. <view class="type-area">
  101. <u-radio-group
  102. v-model="radiovalue1"
  103. placement="row"
  104. >
  105. <u-radio
  106. :customStyle="{margin: '8px 8px 8px 0' }"
  107. v-for="(item, index) in radiolist1"
  108. :key="index"
  109. :label="item.name"
  110. :name="item.name"
  111. >
  112. </u-radio>
  113. </u-radio-group>
  114. </view>
  115. </view>
  116. <view class="btn-area" v-if="model1.processState==='0'?true:false">
  117. <u-button color="#67C23A" size="small" @click="toSaveProcess">保存</u-button>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. import { getFaultDetail,handleFaultReport } from '@/api/asset.js'
  123. export default {
  124. data() {
  125. return {
  126. id:null,
  127. model1:{
  128. assetBarCode: "00170000488047",
  129. createBy: null,
  130. createTime: null,
  131. faultPhenomenon: "aaaaaaa",
  132. id: "1640988534091284485",
  133. params:{},
  134. processResult: null,
  135. processState: "0",
  136. remark: null,
  137. reportDate: "2023-03-31 10:27:09",
  138. searchValue: null,
  139. tel: "15788998899",
  140. updateBy: null,
  141. updateTime: null,
  142. userId: "1",
  143. username: "admin",
  144. tbAsset: {}
  145. },
  146. radiolist1: [
  147. {
  148. name: '正常',
  149. disabled: false
  150. },
  151. {
  152. name: '报废',
  153. disabled: false
  154. }
  155. ],
  156. radiovalue1: '正常',
  157. };
  158. },
  159. methods:{
  160. init(id){
  161. getFaultDetail(id).then(res=>{
  162. this.model1 = res
  163. })
  164. },
  165. toSaveProcess(){
  166. // uni.showLoading({
  167. // title: "正在保存中",
  168. // mask: true,
  169. // });
  170. let fault = this.model1.processResult
  171. if(fault==""){
  172. uni.showToast({
  173. icon:'error',
  174. title:"请填写处理结果"
  175. })
  176. // uni.$u.toast("请填写故障处理结果")
  177. return;
  178. }
  179. let data = {
  180. tbFaultReportId:this.model1.id,
  181. processResult:this.model1.processResult,
  182. feedbackStatus:this.radiovalue1==="正常"?1:0
  183. }
  184. handleFaultReport(data).then(res=>{
  185. this.model1 = res
  186. })
  187. }
  188. },
  189. onLoad:function(option){
  190. this.id = option.id
  191. this.init(option.id)
  192. }
  193. }
  194. </script>
  195. <style lang="scss">
  196. page{
  197. background-color: #f5f6fa;
  198. }
  199. .home{
  200. // padding: 20rpx 0;
  201. }
  202. .device-info,.type-head{
  203. display: flex;
  204. align-items: center;
  205. padding:20rpx;
  206. .iconfont{
  207. font-size: 40rpx;
  208. margin-right: 10rpx;
  209. }
  210. }
  211. .info-area,.type-area{
  212. background-color: #fff;
  213. }
  214. .type-area{
  215. padding: 0 20rpx;
  216. /deep/.u-textarea--disabled{
  217. background-color: #fff !important;
  218. }
  219. }
  220. .btn-area{
  221. // padding: 20rpx 20rpx 20rpx 500rpx;
  222. margin-top: 120rpx;
  223. padding: 0 250rpx;
  224. }
  225. </style>