orderprocessreport.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <!--
  2. * @Title:
  3. * @Description: 维修任务填报提交页
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <view class="container">
  11. <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
  12. @clickLeft="toBack">
  13. <view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
  14. <text style="color: white;font-size: 1rem;">{{title}}</text>
  15. </view>
  16. </uni-nav-bar>
  17. <uni-forms ref="baseForm" :model="formData">
  18. <uni-section title="故障现象描述" ftitleFontSize="0.8rem" type="circle">
  19. <view style="padding-top: 10px;padding-bottom: 0px;padding-left: 15px;padding-right: 15px;">
  20. <uni-forms-item name='networkPayer' required>
  21. <uni-easyinput :styles="styles" type="textarea" v-model="formData.failureCheckDesc"
  22. placeholder="录入故障现象描述" />
  23. </uni-forms-item>
  24. </view>
  25. </uni-section>
  26. <uni-section title="解决措施说明" ftitleFontSize="0.8rem" type="circle">
  27. <view style="padding-top: 10px;padding-bottom: 10px;padding-left: 15px;padding-right: 15px;">
  28. <uni-forms-item required>
  29. <uni-easyinput type="textarea" v-model="formData.processDesc" placeholder="请录入解决方案说明" />
  30. </uni-forms-item>
  31. <!-- <uni-card title="拍摄照片" extra="点击下方按钮开始拍摄" :is-shadow="false">
  32. <view class="view-flex-rs-flex-wrap">
  33. <view v-for="(item, index) in failureProcessPhotos" :key="index" class="view-flex-cc"
  34. style="width: 80px;">
  35. <view class="img-container">
  36. <view class="note-image-box">
  37. <view class="note-image-item">
  38. <view class="close-icon" @click="onPhotoDel(index)">
  39. <uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
  40. </view>
  41. <view class="image-box">
  42. <image :src="toOss(item)" mode="widthFix">
  43. </image>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="view-flex-cc" style="width: 80px;">
  50. <view class="img-container">
  51. <view class="note-image-box">
  52. <view class="note-image-item" @click="onCheckPhotoAdd()">
  53. <view class="image-box">
  54. <uni-icons type="plusempty" size="50" color="#eee"></uni-icons>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </uni-card> -->
  62. </view>
  63. </uni-section>
  64. <uni-section title="拍摄照片" ftitleFontSize="0.8rem" type="circle">
  65. <template v-slot:right>
  66. <view style="color:grey">
  67. 点击下方按钮开始拍摄
  68. </view>
  69. </template>
  70. <view style="padding-top: 10px;padding-bottom: 10px;padding-left: 15px;padding-right: 15px;">
  71. <!-- <uni-forms-item required>
  72. <uni-easyinput type="textarea" v-model="formData.processDesc" placeholder="请录入解决方案说明" />
  73. </uni-forms-item> -->
  74. <!-- <uni-card title="拍摄照片" extra="点击下方按钮开始拍摄" :is-shadow="false"> -->
  75. <view class="view-flex-rs-flex-wrap">
  76. <view v-for="(item, index) in failureProcessPhotos" :key="index" class="view-flex-cc"
  77. style="width: 80px;">
  78. <view class="img-container">
  79. <view class="note-image-box">
  80. <view class="note-image-item">
  81. <view class="close-icon" @click="onPhotoDel(index)">
  82. <uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
  83. </view>
  84. <view class="image-box">
  85. <image :src="toOss(item)" mode="widthFix">
  86. </image>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="view-flex-cc" style="width: 80px;">
  93. <view class="img-container">
  94. <view class="note-image-box">
  95. <view class="note-image-item" @click="onCheckPhotoAdd()">
  96. <view class="image-box">
  97. <uni-icons type="plusempty" size="50" color="#eee"></uni-icons>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <!-- </uni-card> -->
  105. </view>
  106. </uni-section>
  107. <!-- <uni-section v-if="orderType ==1" title="费用申报" ftitleFontSize="0.8rem" type="circle">
  108. <view style="padding-top: 10px;padding-bottom: 10px;padding-left: 15px;padding-right: 15px;">
  109. <uni-forms-item label="是否产生费用" label-width="130px" required>
  110. <uni-data-checkbox v-model="formData.costsReport"
  111. :localdata="costsReportItems.items"></uni-data-checkbox>
  112. </uni-forms-item>
  113. <uni-forms-item v-if="formData.costsReport==2">
  114. <uni-easyinput type="textarea" v-model="formData.costsReportDesc" placeholder="请录入费用说明" />
  115. </uni-forms-item>
  116. </view>
  117. </uni-section> -->
  118. </uni-forms>
  119. <view class="footer">
  120. <view class="control">
  121. <view class="view-flex-rc">
  122. <view class="block"
  123. style="width: 160px;height:32px;margin-left: 10px;margin-right: 10px;border-radius:7px;background-color:lightsalmon"
  124. @click="toSubmit()">
  125. <view class="view-flex-cc">
  126. <uni-icons class="input-uni-icon" type="checkmarkempty" size="18" color="#999" />
  127. </view>
  128. <view class="view-flex-cc" style="padding-left:5px;">
  129. <text style="color:black;font-size:0.7rem">立即提交</text>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. </template>
  137. <script>
  138. import http from '@/http/api.js';
  139. import {
  140. pathToBase64,
  141. base64ToPath
  142. } from '@/js_sdk/mmmm-image-tools/index.js';
  143. import {
  144. oss,
  145. devUrl,
  146. prodUrl
  147. } from '@/common/setting';
  148. export default {
  149. components: {},
  150. data() {
  151. return {
  152. styles: {
  153. color: '#333',
  154. borderColor: '#e5e5e5',
  155. disableColor: '#FFFFFF'
  156. },
  157. rules: {
  158. failureCheckDesc: {
  159. rules: [{
  160. required: true,
  161. errorMessage: '必填项',
  162. }]
  163. },
  164. failureSolutionDesc: {
  165. rules: [{
  166. required: true,
  167. errorMessage: '必填项',
  168. }, ]
  169. },
  170. },
  171. skipPage: 1,
  172. costsApprove: 0,
  173. orderId: 0,
  174. orderType: 1,
  175. formData: {
  176. failureCheckDesc: '',
  177. processDesc: '',
  178. costsReport: 1,
  179. costsReportDesc: '',
  180. },
  181. failureProcessPhotos: [],
  182. pattern: {
  183. color: '#7A7E83',
  184. backgroundColor: '#fff',
  185. selectedColor: '#007AFF',
  186. buttonColor: '#007AFF',
  187. iconColor: '#fff'
  188. },
  189. baseURL: '',
  190. baseOSS: '',
  191. costsReportItems: {
  192. items: [{
  193. 'value': 1,
  194. 'text': '否'
  195. }, {
  196. 'value': 2,
  197. 'text': '是'
  198. }],
  199. current: 1,
  200. },
  201. title: '工单处理',
  202. desc: '',
  203. failureCheckTitle: '',
  204. failureCheckPlaceholder: '',
  205. }
  206. },
  207. computed: {},
  208. onLoad(options) {
  209. this.skipPage = options.skipPage;
  210. //this.costsApprove = options.costsApprove;
  211. //this.orderProcessId = options.orderProcessId;
  212. this.orderId = options.orderId;
  213. // this.orderType = options.orderType;
  214. // console.log("order type "+this.orderType);
  215. // if (this.orderType == 1) {
  216. //this.failureCheckTitle = '故障问题描述';
  217. //this.failureCheckPlaceholder = '录入故障现象描述';
  218. // } else if (this.orderType == 2) {
  219. // this.failureCheckTitle = '服务内容描述';
  220. // this.failureCheckPlaceholder = '请录入服务内容';
  221. // }
  222. this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
  223. this.baseOSS = oss;
  224. //if (this.costsApprove == '2') {
  225. this.getDetail();
  226. //}
  227. },
  228. onReady() {
  229. console.log("onReady++++++++++++++")
  230. // 需要在onReady中设置规则
  231. this.$refs.baseForm.setRules(this.rules)
  232. },
  233. onShow() {},
  234. methods: {
  235. toBack() {
  236. uni.navigateBack({
  237. delta: Number(this.skipPage)
  238. })
  239. },
  240. toOss(path) {
  241. let url = this.baseOSS + path;
  242. //console.log("tooss " + url)
  243. return url;
  244. },
  245. getDetail() {
  246. let that = this;
  247. let postData = {};
  248. postData['id'] = this.orderId;
  249. http.request({
  250. url: '/galaxy-business/order/detail',
  251. method: 'GET',
  252. data: postData
  253. }).then(res => {
  254. console.log(res)
  255. if (res.data != null) {
  256. //that.orderInfo = res.data;
  257. that.formData.failureCheckDesc = res.data.orderDesc;
  258. }
  259. }).catch(err => {
  260. console.log(err)
  261. })
  262. // let that = this;
  263. // let postData = {};
  264. // postData['orderId'] = this.orderId;
  265. // http.request({
  266. // url: '/galaxy-business/order/process/last/report',
  267. // method: 'GET',
  268. // data: postData
  269. // }).then(res => {
  270. // if (res.data != null) {
  271. // console.log(JSON.stringify(res.data))
  272. // that.formData.processDesc = res.data.processDesc;
  273. // that.formData.failureCheckDesc = res.data.processDesc;
  274. // if (res.data.failureProcessPhotoList != null) {
  275. // that.failureProcessPhotos = res.data.failureProcessPhotoList;
  276. // }
  277. // }
  278. // }).catch(err => {
  279. // console.log(err)
  280. // })
  281. },
  282. onCheckPhotoAdd() {
  283. let that = this;
  284. uni.chooseImage({
  285. sourceType: ['album ', 'camera'],
  286. sizeType: ['compressed'],
  287. success: (res) => {
  288. const len = res.tempFilePaths.length;
  289. if (len === 1) {
  290. res.tempFilePaths.forEach(path => {
  291. that.uploadPhoto(path);
  292. })
  293. } else {
  294. uni.showModal({
  295. content: '只能选择一张图片,请确认!',
  296. showCancel: false
  297. });
  298. }
  299. }
  300. })
  301. },
  302. uploadPhoto(imagePath) {
  303. let that = this;
  304. uni.showLoading({
  305. title: '上传中'
  306. });
  307. uni.uploadFile({
  308. url: this.baseURL + '/galaxy-resource/oss/endpoint/put-file-attach?Blade-Auth=' +
  309. uni.getStorageSync('accessToken'),
  310. fileType: 'image',
  311. filePath: imagePath,
  312. name: 'file',
  313. success: (uploadFileRes) => {
  314. if (uploadFileRes.statusCode == 200) {
  315. let data = JSON.parse(uploadFileRes.data);
  316. if (data.success) {
  317. let path = data.data['name'];
  318. that.failureProcessPhotos.push(path);
  319. }
  320. }
  321. },
  322. fail: (err) => {
  323. console.log(err);
  324. reject('err')
  325. },
  326. complete() {
  327. uni.hideLoading()
  328. }
  329. });
  330. },
  331. onPhotoDel(index) {
  332. this.failureProcessPhotos.splice(index, 1);
  333. },
  334. toSubmit() {
  335. console.log('表单提交');
  336. let that = this;
  337. this.$refs.baseForm.validate().then(res => {
  338. that.submitData();
  339. }).catch(err => {
  340. console.log('表单错误信息:', err);
  341. uni.showModal({
  342. content: "内容填报错误,请根据提示信息检查录入内容!",
  343. showCancel: false,
  344. success(res) {
  345. if (res.confirm) {
  346. //that.$refs.baseForm.clearValidate();
  347. }
  348. }
  349. });
  350. })
  351. },
  352. submitData() {
  353. let formdata = this.formData;
  354. formdata['orderId'] = this.orderId;
  355. if (this.failureProcessPhotos.length > 0) {
  356. let photos = '';
  357. for (let i = 0; i < this.failureProcessPhotos.length; i++) {
  358. if (photos.length > 0) {
  359. photos = photos + ',';
  360. }
  361. photos = photos + this.failureProcessPhotos[i];
  362. }
  363. formdata['failureProcessPhotos'] = photos;
  364. }
  365. let that = this;
  366. http.request({
  367. url: '/galaxy-business/order/process/xjgd/save',
  368. method: 'POST',
  369. data: formdata
  370. }).then(res => {
  371. if (res.success) {
  372. uni.showModal({
  373. content: '已成功提交',
  374. showCancel: false,
  375. success(res) {
  376. if (res.confirm) {
  377. that.toBack();
  378. }
  379. }
  380. });
  381. } else {
  382. uni.showModal({
  383. content: '' + res.msg,
  384. showCancel: false
  385. });
  386. }
  387. }).catch(err => {
  388. console.log(err)
  389. })
  390. },
  391. formReset: function(e) {
  392. console.log('清空数据')
  393. },
  394. }
  395. }
  396. </script>
  397. <style>
  398. /* page {
  399. background-color: rgb(240, 242, 244);
  400. } */
  401. </style>
  402. <style lang="scss" scoped>
  403. .cell-hover-class {
  404. background-color: rgb(235, 237, 238);
  405. }
  406. .view-flex-rs {
  407. display: flex;
  408. flex-direction: row;
  409. justify-content: flex-start;
  410. align-items: center;
  411. }
  412. .view-flex-rc {
  413. display: flex;
  414. flex-direction: row;
  415. justify-content: center;
  416. align-items: center;
  417. }
  418. .view-flex-re {
  419. display: flex;
  420. flex-direction: row;
  421. justify-content: flex-end;
  422. align-items: center;
  423. }
  424. .view-flex-cs {
  425. display: flex;
  426. flex-direction: column;
  427. justify-content: flex-start;
  428. }
  429. .view-flex-cc {
  430. display: flex;
  431. flex-direction: column;
  432. justify-content: center;
  433. }
  434. .view-flex-ce {
  435. display: flex;
  436. flex-direction: column;
  437. justify-content: flex-end;
  438. }
  439. .line-body {
  440. padding-left: 10px;
  441. padding-right: 10px;
  442. }
  443. .required-star {
  444. color: #FF0000;
  445. font-size: 15px;
  446. width: 20px;
  447. text-align: center;
  448. padding-left: 0px;
  449. padding-right: 2px;
  450. }
  451. .item-title {
  452. color: #909399;
  453. font-size: 15px;
  454. }
  455. .mline-text {
  456. padding-left: 2px;
  457. width: 100%;
  458. /* background-color:#909399; */
  459. height: 70px;
  460. border: 1px solid #FF5A5F;
  461. border-radius: 5px;
  462. }
  463. .footer {
  464. position: fixed;
  465. bottom: 0;
  466. left: 0;
  467. right: 0;
  468. z-index: 1;
  469. height: 100rpx;
  470. padding: 20rpx;
  471. box-sizing: border-box;
  472. display: flex;
  473. align-items: center;
  474. justify-content: flex-end;
  475. background-color: whitesmoke;
  476. .ipt {
  477. width: 380rpx;
  478. height: 77rpx;
  479. background: #f7f7f7;
  480. border-radius: 38px;
  481. padding: 0 37rpx;
  482. box-sizing: border-box;
  483. margin-right: 20rpx;
  484. }
  485. .control {
  486. flex: 1;
  487. display: flex;
  488. align-items: center;
  489. justify-content: flex-end;
  490. .block {
  491. display: flex;
  492. align-items: center;
  493. justify-content: center;
  494. flex: 1;
  495. }
  496. .icon {
  497. height: auto;
  498. }
  499. .c {
  500. width: 41rpx;
  501. margin-right: 10rpx;
  502. }
  503. .s {
  504. width: 36rpx;
  505. }
  506. .t {
  507. width: 31rpx;
  508. }
  509. }
  510. }
  511. .container {
  512. padding: 0 0 100rpx;
  513. }
  514. .img-container {
  515. margin-bottom: 0px;
  516. width: 80px;
  517. height: 80px;
  518. .note-image-box {
  519. margin-top: 5px;
  520. display: flex;
  521. flex-wrap: wrap;
  522. padding: 0px;
  523. .note-image-item {
  524. position: relative;
  525. width: 100%;
  526. height: 0;
  527. padding-top: 100%;
  528. box-sizing: border-box;
  529. // background-color: #18B566;
  530. .close-icon {
  531. display: flex;
  532. justify-content: center;
  533. align-items: center;
  534. position: absolute;
  535. right: 0px;
  536. top: 0px;
  537. width: 22px;
  538. height: 22px;
  539. border-radius: 50%;
  540. background-color: #d5d5d5;
  541. z-index: 2;
  542. }
  543. .image-box {
  544. display: flex;
  545. justify-content: center;
  546. align-items: center;
  547. position: absolute;
  548. top: 0px;
  549. right: 0px;
  550. border: 0px;
  551. left: 0px;
  552. border: 1px #eee solid;
  553. border-radius: 5px;
  554. overflow: hidden;
  555. width: 98%;
  556. height: 98%;
  557. }
  558. }
  559. }
  560. }
  561. .input-body {
  562. background-color: #fff;
  563. padding: 10px;
  564. }
  565. .mb-10 {
  566. margin-top: 0px;
  567. margin-bottom: 0px;
  568. }
  569. .decoration {
  570. width: 6px;
  571. height: 6px;
  572. margin-right: 4px;
  573. border-radius: 50%;
  574. background-color: cadetblue;
  575. }
  576. </style>