detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='故障报修'></cus-header>
  4. <div class="box">
  5. <div class="b_title">
  6. 故障信息
  7. <div class="b_status" :class="{'djj':dto.status===0,'yjj':dto.status===1}">{{dto.status===1?'已解决':'未解决'}}</div>
  8. </div>
  9. <div class="bs_item">
  10. <div class="left">项目订单号</div>
  11. <div class="right">{{dto.orderNo2||''}}</div>
  12. </div>
  13. <div class="bs_item">
  14. <div class="left">报修地点</div>
  15. <div class="right">{{dto.customer||''}}</div>
  16. </div>
  17. <div class="bs_item">
  18. <div class="left">产品名称</div>
  19. <div class="right">{{dto.itemName||''}}</div>
  20. </div>
  21. <div class="bs_item">
  22. <div class="left">产品编号</div>
  23. <div class="right">{{dto.serialnumber||''}}</div>
  24. </div>
  25. <div class="bs_item">
  26. <div class="left">故障发生时间</div>
  27. <div class="right">{{dto.happenDate||''}}</div>
  28. </div>
  29. <div class="bs_item">
  30. <div class="left">故障类型</div>
  31. <div class="right">{{dto.typeName||''}}</div>
  32. </div>
  33. <div class="bs_item">
  34. <div class="left">报修人员</div>
  35. <div class="right">{{dto.optUser||''}}</div>
  36. </div>
  37. <div class="bs_item">
  38. <div class="left">报修时间</div>
  39. <div class="right">{{dto.createDate||''}}</div>
  40. </div>
  41. <div class="bs_item">
  42. <div class="left">故障描述</div>
  43. <div class="right">{{dto.repairDesc||''}}</div>
  44. </div>
  45. </div>
  46. <div class="box">
  47. <div class="b_title">故障照片</div>
  48. <div style="padding-top: 24rpx;">
  49. <!-- <template v-if="yjj"> -->
  50. <div class="imgs">
  51. <image :src="img" v-for="(img,idx) in imgList" :key="idx"></image>
  52. </div>
  53. <!-- </template> -->
  54. <!-- <template v-else>
  55. <u-upload width="180" height="180"
  56. :fileList="fileList"
  57. @afterRead="afterRead"
  58. @delete="deletePic"
  59. multiple
  60. :maxCount="5"
  61. ></u-upload>
  62. </template> -->
  63. </div>
  64. </div>
  65. <div class="box">
  66. <div class="b_title">故障处理</div>
  67. <div class="b_item">
  68. <div class="left">问题状态</div>
  69. <div class="right">
  70. <template v-if="yjj">
  71. 已解决
  72. </template>
  73. <template v-else>
  74. <u-radio-group v-model="dto.status" :size="30" :iconSize="30">
  75. <u-radio :labelSize="26" :label="1" :name="1">已解决</u-radio>
  76. <u-radio :labelSize="26" :label="0" :name="0">未解决</u-radio>
  77. </u-radio-group>
  78. </template>
  79. </div>
  80. </div>
  81. <div class="b_item">
  82. <div class="left">故障原因</div>
  83. <div class="right">
  84. <template v-if="yjj">
  85. {{dto.faultCause||""}}
  86. </template>
  87. <template v-else>
  88. <input type="text" placeholder="请输入故障原因" placeholder-class="inp_ph" v-model="dto.faultCause">
  89. </template>
  90. </div>
  91. </div>
  92. <div class="b_item">
  93. <div class="left">维修开始时间</div>
  94. <div class="right" v-if="yjj">
  95. {{dto.repairStartTime||''}}
  96. </div>
  97. <div class="right select" @tap="handleSelect(1)" v-else>
  98. <text>{{startDateText}}</text>
  99. <image :src="imgBase+'operation/arrow_right.png'" mode="widthFix"></image>
  100. </div>
  101. </div>
  102. <div class="b_item">
  103. <div class="left">维修结束时间</div>
  104. <div class="right" v-if="yjj">
  105. {{dto.repairEndTime||''}}
  106. </div>
  107. <div class="right select" @tap="handleSelect(2)" v-else>
  108. <text>{{endDateText}}</text>
  109. <image :src="imgBase+'operation/arrow_right.png'" mode="widthFix"></image>
  110. </div>
  111. </div>
  112. <div class="b_item">
  113. <div class="left">维修人员</div>
  114. <div class="right">
  115. <template v-if="yjj">
  116. {{dto.maintainer||""}}
  117. </template>
  118. <template v-else>
  119. <input type="text" placeholder="请输入维修人员" placeholder-class="inp_ph" v-model="dto.maintainer">
  120. </template>
  121. </div>
  122. </div>
  123. <div class="b_item2">
  124. <div class="top">维修描述</div>
  125. <div class="bottom">
  126. <template v-if="yjj">
  127. {{dto.remark||""}}
  128. </template>
  129. <template v-else>
  130. <u--textarea v-model="dto.remark" placeholder="请输入维修描述" placeholder-class="inp_ph2" border="none" height="110"></u--textarea>
  131. </template>
  132. </div>
  133. </div>
  134. </div>
  135. <div class="bottom_btn">
  136. <div class="btn" @tap="submit" v-if="!yjj">提交</div>
  137. <div class="btn" @tap="back" v-else>返回</div>
  138. </div>
  139. <u-datetime-picker :itemHeight="88" :show="show1" v-model="dto.repairStartTime" mode="datetime" title="维修开始时间"
  140. @cancel="show1=false" @confirm="e=>confirm(e,1,'repairStartTime','startDateText')" :immediateChange="true" :minDate="minDate" :maxDate="maxDate"></u-datetime-picker>
  141. <u-datetime-picker :itemHeight="88" :show="show2" v-model="dto.repairEndTime" mode="datetime" title="维修结束时间"
  142. @cancel="show2=false" @confirm="e=>confirm(e,2,'repairEndTime','endDateText')" :immediateChange="true" :minDate="minDate" :maxDate="maxDate"></u-datetime-picker>
  143. </view>
  144. </template>
  145. <script>
  146. export default {
  147. data(){
  148. return {
  149. id:'',
  150. dto:{},
  151. fileList:[],
  152. show1:false,
  153. show2:false,
  154. startDateText:'请输入维修开始时间',
  155. endDateText:'请输入维修结束时间',
  156. minDate:'',
  157. maxDate:'',
  158. projectList:[],
  159. typeList:[],
  160. imgList:[],
  161. yjj:false,
  162. rules:[
  163. {key:'status',tip:'请选择状态'},
  164. {key:'faultCause',tip:'请输入故障原因'},
  165. {key:'repairStartTime',tip:'请选择维修开始时间'},
  166. {key:'repairEndTime',tip:'请选择维修结束时间'},
  167. {key:'maintainer',tip:'请输入维修人员'},
  168. {key:'remark',tip:'请输入维修描述'}
  169. ]
  170. }
  171. },
  172. mounted() {
  173. let d = new Date();
  174. this.minDate = new Date(d.getFullYear()-1,d.getMonth()+1,d.getDate()).getTime();
  175. this.maxDate = new Date().getTime();
  176. },
  177. async onLoad(option) {
  178. this.id = option.id;
  179. await this.getOrderList();
  180. await this.getTypeList();
  181. this.getDetail();
  182. },
  183. methods:{
  184. getOrderList(){
  185. return new Promise((resolve,reject)=>{
  186. this.$api.get('/wms/project/getOrderPage',{page:1,limit:-1}).then(res=>{
  187. if(res.data.code===0){
  188. this.projectList = res.data.data.list;
  189. resolve();
  190. }else this.$showToast(res.data.msg)
  191. })
  192. })
  193. },
  194. getTypeList(){
  195. return new Promise((resolve,reject)=>{
  196. this.$api.get('/sys/dict/data/getListByType/wms_operation_category').then(res=>{
  197. if(res.data.code===0){
  198. this.typeList = res.data.data;
  199. resolve();
  200. }else this.$showToast(res.data.msg)
  201. })
  202. })
  203. },
  204. getDetail(){
  205. this.$api.get('/wms/order/operation/'+this.id).then(res=>{
  206. if(res.data.code!==0) return this.$showToast(res.data.msg)
  207. this.dto = res.data.data;
  208. this.dto.orderNo2 = this.projectList.find(p=>p.id==this.dto.orderId)?.orderNo||'';
  209. this.dto.typeName = this.typeList.find(t=>t.dictValue==this.dto.optCategory)?.dictLabel||'';
  210. this.imgList = this.dto.faultFile.split(';');
  211. this.yjj = this.dto.status==1?true:false;
  212. })
  213. },
  214. handleSelect(type){
  215. this['show'+type] = true;
  216. },
  217. confirm(e,type,key,param){
  218. this[param] = new Date(e.value).Format('yyyy-MM-dd hh:mm:ss');
  219. this.dto[key] = new Date(e.value).Format('yyyy-MM-dd hh:mm:ss');
  220. this['show'+type] = false;
  221. },
  222. submit(){
  223. let idx = this.rules.findIndex(r=>!this.dto[r.key]==true);
  224. if(idx>-1) return this.$showToast(this.rules[idx].tip)
  225. let dto = JSON.parse(JSON.stringify(this.dto))
  226. this.dto.repairStartTime = new Date(dto.repairStartTime).Format('yyyy-MM-dd hh:mm:ss');
  227. this.dto.repairEndTime = new Date(dto.repairEndTime).Format('yyyy-MM-dd hh:mm:ss');
  228. this.$api.put('/wms/order/operation',this.dto).then(res=>{
  229. if(res.data.code!==0) return this.$showToast(res.data.msg)
  230. this.$showToast('处理成功')
  231. setTimeout(()=>{
  232. uni.navigateBack()
  233. },1500)
  234. })
  235. },
  236. back(){
  237. uni.navigateBack()
  238. },
  239. // 删除图片
  240. deletePic(event) {
  241. this.fileList.splice(event.index, 1);
  242. },
  243. // 新增图片
  244. async afterRead(event) {
  245. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  246. let lists = [].concat(event.file);
  247. let fileListLen = this.fileList.length;
  248. lists.map((item) => {
  249. this.fileList.push({
  250. ...item,
  251. status: "uploading",
  252. message: "上传中",
  253. });
  254. });
  255. for (let i = 0; i < lists.length; i++) {
  256. const result = await this.uploadFilePromise(lists[i].url);
  257. let item = this.fileList[fileListLen];
  258. this.fileList.splice(
  259. fileListLen,
  260. 1,
  261. Object.assign(item, {
  262. status: "success",
  263. message: "",
  264. url: result,
  265. })
  266. );
  267. fileListLen++;
  268. }
  269. },
  270. uploadFilePromise(url) {
  271. return new Promise((resolve, reject) => {
  272. let a = uni.uploadFile({
  273. url: "http://192.168.2.21:7001/upload", // 仅为示例,非真实的接口地址
  274. filePath: url,
  275. name: "file",
  276. formData: {
  277. user: "test",
  278. },
  279. success: (res) => {
  280. setTimeout(() => {
  281. resolve(res.data.data);
  282. }, 1000);
  283. },
  284. });
  285. });
  286. },
  287. }
  288. }
  289. </script>
  290. <style>
  291. .inp_ph{
  292. font-family: PingFangSC, PingFang SC;
  293. font-weight: 400;
  294. font-size: 28rpx;
  295. color: #B9C0C8;
  296. line-height: 40rpx;
  297. text-align: right;
  298. }
  299. .inp_ph2{
  300. font-family: PingFangSC, PingFang SC;
  301. font-weight: 400;
  302. font-size: 28rpx;
  303. color: #B9C0C8;
  304. line-height: 40rpx;
  305. text-align: left;
  306. }
  307. </style>
  308. <style scoped lang="less">
  309. ::v-deep .u-radio:last-child{
  310. margin-left: 93rpx !important;
  311. }
  312. ::v-deep .u-upload__button .u-icon__icon{
  313. font-size: 48rpx !important;
  314. }
  315. .page{
  316. padding:0 24rpx 168rpx;
  317. background: #F4F8FB;
  318. .box{
  319. background: #FFFFFF;
  320. border-radius: 16rpx;
  321. margin-top: 20rpx;
  322. padding: 36rpx 24rpx;
  323. .b_title{
  324. padding-left: 16rpx;
  325. position: relative;
  326. font-family: PingFang-SC, PingFang-SC;
  327. font-weight: bold;
  328. font-size: 32rpx;
  329. color: #1D2129;
  330. line-height: 32rpx;
  331. &::before{
  332. content: '';
  333. width: 6rpx;
  334. height: 32rpx;
  335. background: #2E69EB;
  336. position: absolute;
  337. left: 0;
  338. top: 50%;
  339. margin-top: -16rpx;
  340. }
  341. .b_status{
  342. width: 104rpx;
  343. height: 48rpx;
  344. border-radius: 6rpx;
  345. font-family: PingFangSC, PingFang SC;
  346. font-weight: 400;
  347. font-size: 26rpx;
  348. line-height: 48rpx;
  349. text-align: center;
  350. position: absolute;
  351. left: 168rpx;
  352. top: 50%;
  353. margin-top: -24rpx;
  354. &.djj{
  355. color: #FEA400;
  356. background: rgba(254,164,0,0.08);
  357. }
  358. &.yjj{
  359. color: #05C17F;
  360. background: rgba(20,204,140,0.08);
  361. }
  362. }
  363. }
  364. .imgs{
  365. display: flex;
  366. justify-content: space-evenly;
  367. flex-wrap: wrap;
  368. margin-top: -20rpx;
  369. image{
  370. width: 180rpx;
  371. height: 180rpx;
  372. margin-top: 20rpx;
  373. }
  374. }
  375. .bs_item{
  376. display: flex;
  377. align-items: center;
  378. justify-content: space-between;
  379. margin-top: 36rpx;
  380. .left{
  381. width: 180rpx;
  382. font-family: PingFangSC, PingFang SC;
  383. font-weight: 400;
  384. font-size: 26rpx;
  385. color: #86909C;
  386. line-height: 26rpx;
  387. }
  388. .right{
  389. width: calc(100% - 180rpx);
  390. font-family: PingFangSC, PingFang SC;
  391. font-weight: 400;
  392. font-size: 26rpx;
  393. color: #1D2129;
  394. line-height: 26rpx;
  395. text-align: right;
  396. word-wrap: break-word;
  397. }
  398. }
  399. .b_item{
  400. display: flex;
  401. align-items: center;
  402. justify-content: space-between;
  403. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECEEF5;
  404. padding: 24rpx 0;
  405. .left{
  406. font-family: PingFangSC, PingFang SC;
  407. font-weight: 400;
  408. font-size: 30rpx;
  409. color: #1D2129;
  410. line-height: 42rpx;
  411. }
  412. .right{
  413. input{
  414. font-family: PingFangSC, PingFang SC;
  415. font-weight: 400;
  416. font-size: 28rpx;
  417. color: #4E5969;
  418. line-height: 40rpx;
  419. text-align: right;
  420. }
  421. &.select{
  422. display: flex;
  423. align-items: center;
  424. text{
  425. font-family: PingFangSC, PingFang SC;
  426. font-weight: 400;
  427. font-size: 28rpx;
  428. color: #B9C0C8;
  429. line-height: 40rpx;
  430. }
  431. image{
  432. width: 24rpx;
  433. height: 24rpx;
  434. margin-left: 10rpx;
  435. }
  436. }
  437. }
  438. }
  439. .b_item2{
  440. .top{
  441. font-family: PingFangSC, PingFang SC;
  442. font-weight: 400;
  443. font-size: 30rpx;
  444. color: #1D2129;
  445. line-height: 42rpx;
  446. padding-top: 24rpx;
  447. }
  448. .bottom{
  449. padding-bottom: 24rpx;
  450. input{
  451. font-family: PingFangSC, PingFang SC;
  452. font-weight: 400;
  453. font-size: 28rpx;
  454. color: #4E5969;
  455. line-height: 40rpx;
  456. }
  457. }
  458. }
  459. }
  460. .bottom_btn{
  461. width: 100%;
  462. height: 148rpx;
  463. padding: 20rpx 48rpx;
  464. box-sizing: border-box;
  465. background: #FFFFFF;
  466. position: fixed;
  467. bottom: 0;
  468. left: 0;
  469. z-index: 9;
  470. .btn{
  471. width: 100%;
  472. height: 88rpx;
  473. background: #2E69EB;
  474. border-radius: 16rpx;
  475. font-family: PingFang-SC, PingFang-SC;
  476. font-weight: bold;
  477. font-size: 32rpx;
  478. color: #FFFFFF;
  479. line-height: 88rpx;
  480. text-align: center;
  481. }
  482. }
  483. }
  484. </style>