From 1833dd6d7cac01c35840af52fadc1199821e5805 Mon Sep 17 00:00:00 2001 From: Houjie <714924425@qq.com> Date: 星期四, 15 五月 2025 09:28:16 +0800 Subject: [PATCH] 提交优化项 --- pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue | 793 ++++++++++++++++++++++++++++++++------------------------ 1 files changed, 454 insertions(+), 339 deletions(-) diff --git a/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue b/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue index dcbebf3..a953048 100644 --- a/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue +++ b/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue @@ -9,7 +9,8 @@ <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鍩烘湰淇℃伅</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item :label-width="80" name="num" label="宸ュ崟鍙�:"> <uni-easyinput v-model="formData.orderNum" :disabled="true" /> </uni-forms-item> @@ -28,24 +29,15 @@ <uni-easyinput v-model="formData.remark" :disabled="true" /> </uni-forms-item> <uni-forms-item :label-width="80" name="outNum" label="淇濆吇鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" + :sourceType="sourceType" @select="select" @progress="progress" @success="success" + @fail="fail" @delete="deletea" :readonly="readonly" /> </uni-forms-item> + </uni-group> </uni-forms> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> - + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> + <view class="divider"><text>淇濆吇椤逛俊鎭�</text></view> <uni-collapse> <uni-collapse-item :show-animation="true" :accordion="true" title="鏌ョ湅淇濆吇椤�" :border="false" title-border="none"> @@ -65,31 +57,42 @@ </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">瀛愪繚鍏婚」:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" - v-if="item.subItemName!=null && item.subItemName.length>10"> - {{(item.subItemName).toString().substr(0,10)+'...'}} - </view> - - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> {{item.subItemName}} </view> + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" + v-if="item.subItemName!=null && item.subItemName.length>10"> + {{(item.subItemName).toString().substr(0,10)+'...'}} + </view> --> + + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + {{item.subItemName}} + </view> --> </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">淇濆吇瑕佹眰:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" - v-if="item.itemDemand!=null && item.itemDemand.length>10"> - {{(item.itemDemand).toString().substr(0,10)+'...'}} - </view> - - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> {{item.itemDemand}} </view> + <!-- <zb-tooltip placement="left" ref="tooltip7" > + <view slot="content"> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> + {{item.itemDemand}} + </view> + </view> + <view > + <button size="mini">鏇村</button > + </view> + </zb-tooltip> --> + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + {{item.itemDemand}} + </view> --> </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鏄惁鎶ヤ慨:</view> <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> - <uni-data-select :localdata="item.type" v-model="item.reportFlag" - :disabled="item.istrue" /> + <uni-data-select :localdata="item.type" @change="handType($event, index)" + v-model="item.reportFlag" :disabled="item.istrue" /> </view> </view> <view class="flex"> @@ -113,12 +116,13 @@ <uni-forms ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂彮缁勯暱纭淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> - <uni-forms-item :label-width="80" required name="typeName" label="澶勭悊绫诲瀷:"> + <view class="divider"><text>鐝粍闀跨‘璁や俊鎭�</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂彮缁勯暱纭淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> + <uni-forms-item :label-width="80" required name="typeName" label="纭绫诲瀷:"> <uni-data-select v-model="ScanData.typeName" :localdata="ScanData.handlingType" @change="changehandlingType" placeholder="璇烽�夋嫨" :disabled="isShowSure" /> </uni-forms-item> - <uni-forms-item :label-width="80" required name="handlingSuggestion" label="澶勭悊鎰忚:"> + <uni-forms-item :label-width="80" required name="handlingSuggestion" label="纭鎰忚:"> <uni-easyinput type="textarea" v-model="ScanData.handlingSuggestion" :disabled="isShowSure" /> </uni-forms-item> @@ -127,52 +131,40 @@ <uni-forms v-show="isHideFist" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斿垵楠屾敹淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鍒濋獙鏀朵俊鎭�</text></view> + <uni-forms-item :label-width="80" required name="initialAcceptanceComment" label="鍒濆鎰忚:"> <uni-easyinput type="textarea" v-model="ScanData.initialAcceptanceComment" placeholder="璇疯緭鍏ユ剰瑙�" :disabled="isShowLast" /> </uni-forms-item> - + <uni-forms-item :label-width="80" required name="randomInspectionFlag" label="鎶芥鏍囪:"> + <uni-data-select v-model="ScanData.InspectionFlagName" + :localdata="ScanData.randomInspectionFlagList" @change="changehandlingInspectionFlag" + placeholder="璇烽�夋嫨" :disabled="isShowSure" /> + </uni-forms-item> <uni-forms-item :label-width="80" name="outNum" label="鍒濋獙鏀堕檮浠�:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgListinitialAccept" :key="index" - @tap="ViewImageFile" :data-url="imgListinitialAccept[index]"> - <image :src="imgListinitialAccept[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImgFile" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" @click="ChooseImageFile()" v-if="imgListinitialAccept.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileList" :image-styles="imageStyles" + :sourceType="sourceType" @select="selectFirst" @progress="progress" @success="success" + @fail="fail" @delete="deleteFirst" :readonly="readonlyFirst" /> </uni-forms-item> </uni-group> </uni-forms> <uni-forms v-show="isHideLast" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂粓楠屾敹淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>缁堥獙鏀朵俊鎭�</text></view> <uni-forms-item :label-width="80" required name="finalAcceptanceComment" label="缁堥獙鏀舵剰瑙�:"> <uni-easyinput type="textarea" v-model="ScanData.finalAcceptanceComment" placeholder="璇疯緭鍏ユ剰瑙�" :disabled="isfinal" /> </uni-forms-item> + <uni-forms-item :label-width="80" required name="finalFlagName" label="鎶芥鏍囪:"> + <uni-data-select v-model="ScanData.finalFlagName" :localdata="ScanData.finalInspectionFlagList" + @change="changehandlingFinalFlag" placeholder="璇烽�夋嫨" :disabled="isfinal" /> + </uni-forms-item> <uni-forms-item :label-width="80" name="outNum" label="缁堥獙鏀堕檮浠�:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgListfinalAcceptanceFilesResult" :key="index" - @tap="ViewImageFinal" :data-url="imgListfinalAcceptanceFilesResult[index]"> - <image :src="imgListfinalAcceptanceFilesResult[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImgFinal" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" @click="ChooseImageFinal()" - v-if="imgListfinalAcceptanceFilesResult.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileListFanl" :image-styles="imageStyles" + :sourceType="sourceType" @select="selectFirstFanl" @progress="progress" @success="success" + @fail="fail" @delete="deleteFanl" :readonly="readonlyFirstFanl" /> </uni-forms-item> </uni-group> </uni-forms> @@ -192,6 +184,20 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { + readonly: false, + readonlyFirstFanl: false, + readonlyFirst: false, + // 鍥剧墖鍥炴樉 + fileLists: [], + fileList: [], + fileListFanl: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + // uni.chooseImage鍊硷紝浠庣浉鍐岄�夋嫨锛屾媿鎽� + sourceType: ['album', 'camera'], title: '', isShowBtn: true, isHideLast: false, @@ -206,6 +212,8 @@ equipmentList: [], uploadUrl: "/sys/common/upload", ScanData: { + InspectionFlagName: '', + finalFlagName: '', typeName: '', initialAcceptanceComment: '', handlingType: [{ @@ -217,12 +225,32 @@ value: "2" } ], + randomInspectionFlagList: [{ + text: "鍚�", + value: '0' + }, + { + text: "鏄�", + value: '1' + } + ], + finalInspectionFlagList: [{ + text: "鍚�", + value: '0' + }, + { + text: "鏄�", + value: '1' + } + ], handlingSuggestion: '' }, formData: { avatar: [], avatarFile: [], avatarFinal: [], + initialAcceptanceFiles: [], + finalAcceptanceFiles: [], id: '', maintenanceStatus: '' }, @@ -233,8 +261,7 @@ url: { upload: "/eam/sysFiles/batch_upload", stallList: "/eam/weekMaintenanceOrder/queryById", - // getEquipmentList: "eam/equipment/asyncLoadEquipment", - getEquipmentList:'eam/equipment/list', + getEquipmentList: 'eam/equipment/list', BaoList: '/eam/weekMaintenanceOrderDetail/queryList', approval: 'eam/weekMaintenanceOrder/approval' }, @@ -265,8 +292,11 @@ msg1Title: "", procInstId: '', values: '', + flag: '', imageFiles: '', + imageObjectInIt: [], imageFilesList: [], + imageObjectFinal: [], imageFilesnitialAcceptList: [] } }, @@ -283,6 +313,8 @@ }, onLoad(options) { const annItem = JSON.parse(decodeURIComponent(options.item)); + this.flag = options.flag + console.log(this.flag) this.variables = annItem.variables this.id = annItem.dataId this.taskId = annItem.id @@ -296,8 +328,19 @@ }, methods: { + + changehandlingFinalFlag(e) { + this.ScanData.finalFlagName = e; + }, changehandlingType(e) { this.ScanData.typeName = e; + }, + changehandlingInspectionFlag(e) { + this.ScanData.InspectionFlagName = e; + }, + handType(e, index) { + console.log(e) + }, ProductionTask() { if (this.formData.maintenanceStatus == 'WAIT_FINAL_ACCEPTANCE') { @@ -326,27 +369,33 @@ return false; } } + if (this.formData.maintenanceStatus == 'WAIT_CONFIRM' && this.flag != 'task') { + if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData.typeName == + '') { - if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData.typeName == - '') { + uni.showToast({ + icon: 'none', + title: '纭绫诲瀷涓嶈兘涓虹┖' + }); + return false; + } + if (this.ScanData.handlingSuggestion == undefined || this.ScanData.handlingSuggestion == null || this + .ScanData.handlingSuggestion == + '') { - uni.showToast({ - icon: 'none', - title: '澶勭悊绫诲瀷涓嶈兘涓虹┖' - }); - return false; + uni.showToast({ + icon: 'none', + title: '纭鎰忚涓嶈兘涓虹┖' + }); + return false; + } + } - if (this.ScanData.handlingSuggestion == undefined || this.ScanData.handlingSuggestion == null || this - .ScanData.handlingSuggestion == - '') { - - uni.showToast({ - icon: 'none', - title: '澶勭悊鎰忚涓嶈兘涓虹┖' - }); - return false; - } + uni.showLoading({ + mask: true, + title: "鍔犺浇涓�....", + }) this.$http.put(this.url.approval, { finalAcceptanceFilesResult: this.formData.avatarFinal, finalAcceptanceComment: this.ScanData.finalAcceptanceComment, @@ -356,10 +405,12 @@ confirmDealType: this.ScanData.typeName, id: this.formData.id, dataId: this.id, + randomInspectionFlag: this.ScanData.InspectionFlagName, instanceId: this.procInstId, tableDetailList: this.partTakeAdviceDetailList, taskId: this.taskId, userId: this.assignee, + finalRandomInspectionFlag: this.ScanData.finalFlagName, maintenanceDate: this.formData.maintenanceDate, equipmentId: this.formData.num, imageFilesResult: this.imageFilesList, @@ -367,8 +418,7 @@ standardId: this.formData.standardId, standardName: this.formData.standardName }).then(res => { - console.log(res) - this.$tip.loaded(); + uni.hideLoading() if (res.data.success) { uni.showToast({ icon: "success", @@ -404,48 +454,32 @@ this.partTakeAdviceDetailList[index].istrue = true; } }, - // getEquipment() { - // this.$http.get(this.url.getEquipmentList).then(res => { - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // this.equipmentList = res.data.result - // } else { - // uni.showToast({ - // icon: "error", - // title: res.data.message, - // duration: 2000 - // }); - // } - // }).catch(() => { - // this.$tip.error("鑱旂綉澶辫触") - // }) - // }, - getEquipment() { - this.$http.get(this.url.getEquipmentList, { - params: { - pageNo: 1, - pageSize: 9999, - order: 'desc', - column: 'createTime' - }, - - }).then(res => { - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - this.equipmentList = res.data.result.records - } else { - uni.showToast({ - icon: "error", - title: res.data.message, - duration: 2000 - }); - - } - }).catch(() => { - this.$tip.error("鑱旂綉澶辫触") - }) - }, + getEquipment() { + this.$http.get(this.url.getEquipmentList, { + params: { + pageNo: 1, + pageSize: 9999, + order: 'desc', + column: 'createTime' + }, + + }).then(res => { + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + this.equipmentList = res.data.result.records + } else { + uni.showToast({ + icon: "error", + title: res.data.message, + duration: 2000 + }); + + } + }).catch(() => { + this.$tip.error("鑱旂綉澶辫触") + }) + }, getList() { this.$http.get(this.url.BaoList, { params: { @@ -467,11 +501,11 @@ ]; // 鏂板瓧娈碉紝鍊间负涓�涓┖鏁扮粍 item.type = [{ text: "鍚�", - value: 0 + value: '0' }, { text: "鏄�", - value: 1 + value: '1' } ]; // 鏂板瓧娈碉紝鍊间负涓�涓┖鏁扮粍 item.istrue = true; @@ -487,201 +521,143 @@ }) }, - ChooseImageFinal() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgListfinalAcceptanceFilesResult = res.tempFilePaths; - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatarFinal = []; - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatarFinal.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatarFinal); + selectFirst(e) { + const tempFilePaths = e.tempFilePaths; + uni.showLoading({ + title: '涓婁紶涓�...' + }); + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); - } - }); - }, - - ChooseImageFile() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgListinitialAccept = res.tempFilePaths; - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatarFile = []; - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatarFile.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatarFile); + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatarFile.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); }); - } + }); }); - }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatar = []; - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatar.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触111', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); + }, + selectFirstFanl(e) { + const tempFilePaths = e.tempFilePaths; + uni.showLoading({ + title: '涓婁紶涓�...' + }); + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatarFinal.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all + }) + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); }); - } + }); }); + + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' + }); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触222', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); }, - ViewImageFinal(e) { - uni.previewImage({ - urls: this.imgListfinalAcceptanceFilesResult, - current: e.currentTarget.dataset.url + select(e) { + const tempFilePaths = e.tempFilePaths; + uni.showLoading({ + title: '涓婁紶涓�...' }); - }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' + }) + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatar.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all + }) + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); + }); + }); }); - }, - ViewImageFile(e) { - uni.previewImage({ - urls: this.imgListinitialAccept, - current: e.currentTarget.dataset.url - }); - }, - DelImgFinal(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgListfinalAcceptanceFilesResult.splice(e.currentTarget.dataset.index, 1) - } - } - }) - }, - DelImgFile(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgListinitialAccept.splice(e.currentTarget.dataset.index, 1) - } - } - }) - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) - } - } - }) + + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' + }); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); }, + // 鍒犻櫎 + deletea(e) { + console.log('鍒犻櫎鍥剧墖', e); + }, + + // 鍒犻櫎 + deleteFirst(e) { + console.log('鍒犻櫎鍥剧墖', e); + }, + + deleteFanl(e) { + console.log('鍒犻櫎鍥剧墖', e); + }, upCallback() { console.log(configService.staticURL) this.$http.get(this.url.stallList, { @@ -701,35 +677,83 @@ this.formData.maintenanceDate = this.announcement1.maintenanceDate this.formData.remark = this.announcement1.remark this.ScanData.finalAcceptanceComment = this.announcement1.finalAcceptanceComment + if (this.announcement1.randomInspectionFlag != null) { + this.ScanData.InspectionFlagName = this.announcement1.randomInspectionFlag + } + + if (this.announcement1.finalRandomInspectionFlag != null) { + this.ScanData.finalFlagName = this.announcement1.finalRandomInspectionFlag + } this.formData.maintenanceStatus = this.announcement1.maintenanceStatus + switch (this.formData.maintenanceStatus) { /** * 鍒濇 */ case 'WAIT_INITIAL_ACCEPTANCE': - this.title = '鍒濇' - this.isShowSure = true; - this.isHideFist = true; + if (this.flag == 'task') { + this.title = '璇︽儏' + this.readonly = true; + this.readonlyFirst = true; + this.isShowSure = true; + this.isHideFist = true; + this.isShowLast = true; + this.isShowBtn = false; + } else { + this.title = '鍒濇' + this.readonly = true + this.isShowSure = true; + this.isHideFist = true; + } + break /** * 缁堥獙 */ case 'WAIT_FINAL_ACCEPTANCE': - this.title = '缁堥獙' - this.isHideFist = true; - this.isShowLast = true; - this.isShowSure = true; - this.isHideLast = true; + if (this.flag == 'task') { + this.title = '缁堥獙' + this.readonly = true + this.readonlyFirst = true + this.isHideFist = true; + this.isShowLast = true; + this.isShowSure = true; + this.isHideLast = true; + this.isShowBtn = false; + this.isfinal = true; + this.readonlyFirstFanl = true; + } else { + this.title = '璁捐兘閮ㄧ粓楠�' + this.readonly = true + this.readonlyFirst = true + this.isHideFist = true; + this.isShowLast = true; + this.isShowSure = true; + this.isHideLast = true; + } + break /** * 鎵ц */ case 'WAIT_CONFIRM': - this.title = '鎵ц' - this.isHideLast = false - this.isHideFist = false - this.isShowBtn=false - this.isShowSure=true + + if (this.flag == 'task') { + this.title = '璇︽儏' + this.readonly = true + this.isHideLast = false + this.isHideFist = false + this.isShowBtn = false + this.isShowSure = true + } else { + this.title = '鐝粍闀跨‘璁�' + this.isHideLast = false + this.readonly = true + this.isHideFist = false + this.isShowBtn = true + this.isShowSure = false + } + break case 'COMPLETE': this.isShowSure = true; @@ -737,6 +761,9 @@ this.isHideFist = true this.isShowLast = true this.isfinal = true + this.readonlyFirst = true + this.readonly = true + this.readonlyFirstFanl = true this.isShowBtn = false this.title = '璇︽儏' break @@ -745,31 +772,94 @@ this.ScanData.typeName = this.announcement1.confirmDealType this.formData.id = this.announcement1.id this.ScanData.handlingSuggestion = this.announcement1.confirmComment - this.formData.avatar = this.announcement1.imageFiles - this.imageFilesList = JSON.parse(this.formData.avatar) - const imageObjects = JSON.parse(this.formData.avatar); - // 鎻愬彇 filePath 骞舵嫾鎺� IP 鍜岀鍙� - this.imgList = imageObjects.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }); - this.formData.avatarFile = this.announcement1.initialAcceptanceFiles, - this.imageFilesnitialAcceptList = JSON.parse(this.formData.avatarFile) - const imageObjectInIt = JSON.parse(this.formData.avatarFile); - // 鎻愬彇 filePath 骞舵嫾鎺� IP 鍜岀鍙� - this.imgListinitialAccept = imageObjectInIt.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }); + if (this.announcement1.imageFiles) { + try { + const parsedDataFile = JSON.parse(this.announcement1.imageFiles); + this.imageFilesList = parsedDataFile; - this.formData.avatarFinal = this.announcement1.finalAcceptanceFiles, - this.imageObjectFinal = JSON.parse(this.formData.avatarFinal) - const imageObjectFinal = JSON.parse(this.formData.avatarFinal); - // 鎻愬彇 filePath 骞舵嫾鎺� IP 鍜岀鍙� - this.imgListfinalAcceptanceFilesResult = imageObjectFinal.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }); + this.imgList = parsedDataFile.map(imageObj => { + return `${this.ipAndPort}${imageObj.filePath}`; + }); + + this.fileLists = this.imgList.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); + } catch (error) { + console.error('JSON 瑙f瀽澶辫触:', error); + this.imageObjectFinal = []; + this.imgListfinalAcceptanceFilesResult = []; + this.fileListFanl = []; + } + } else { + // 褰撳�间负 null 鎴栫┖瀛楃涓叉椂鍒濆鍖栦负绌烘暟缁� + this.imageObjectFinal = []; + this.imgListfinalAcceptanceFilesResult = []; + this.fileListFanl = []; + } + + + if (this.announcement1.initialAcceptanceFiles) { + try { + const parsedDataIn = JSON.parse(this.announcement1.initialAcceptanceFiles); + this.imageObjectInIt = parsedDataIn; + + this.imgListinitialAccept = parsedDataIn.map(imageObj => { + return `${this.ipAndPort}${imageObj.filePath}`; + }); + + this.fileList = this.imgListinitialAccept.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); + } catch (error) { + console.error('JSON 瑙f瀽澶辫触:', error); + this.imageObjectInIt = []; + this.imgListinitialAccept = []; + this.fileList = []; + } + } else { + // 澶勭悊绌哄�兼儏鍐� + this.imageObjectInIt = []; + this.imgListinitialAccept = []; + this.fileList = []; + } + + + console.log('finalAcceptanceFiles:', this.announcement1.finalAcceptanceFiles); + + // 鍒ゆ柇鏄惁涓� null 鎴� 绌哄瓧绗︿覆 + if (this.announcement1.finalAcceptanceFiles) { + try { + const parsedData = JSON.parse(this.announcement1.finalAcceptanceFiles); + this.imageObjectFinal = parsedData; + + this.imgListfinalAcceptanceFilesResult = parsedData.map(imageObj => { + return `${this.ipAndPort}${imageObj.filePath}`; + }); + + this.fileListFanl = this.imgListfinalAcceptanceFilesResult.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); + } catch (error) { + console.error('JSON 瑙f瀽澶辫触:', error); + this.imageObjectFinal = []; + this.imgListfinalAcceptanceFilesResult = []; + this.fileListFanl = []; + } + } else { + // 褰撳�间负 null 鎴栫┖瀛楃涓叉椂鍒濆鍖栦负绌烘暟缁� + this.imageObjectFinal = []; + this.imgListfinalAcceptanceFilesResult = []; + this.fileListFanl = []; + } } }).catch(() => { @@ -848,4 +938,29 @@ margin-top: 85px; height: auto; } + + .divider { + display: flex; + align-items: center; + text-align: center; + color: gray; + /* 鏂囧瓧棰滆壊 */ + margin: 20px 0; + /* 涓婁笅闂磋窛 */ + } + + .divider::before, + .divider::after { + content: ''; + flex: 1; + border-bottom: 1px solid gray; + /* 妯嚎棰滆壊 */ + margin: 0 16px; + /* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */ + } + + .divider text { + white-space: nowrap; + /* 闃叉鏂囧瓧鎹㈣ */ + } </style> \ No newline at end of file -- Gitblit v1.9.3