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/ToDoListCheckSure/ToDoListCheckSure.vue | 362 +++++++++++++++++++++++++++++++-------------------- 1 files changed, 218 insertions(+), 144 deletions(-) diff --git a/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue b/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue index 4baac9a..f123279 100644 --- a/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue +++ b/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue @@ -5,11 +5,23 @@ <block slot="content">{{title}}</block> </cu-custom> <view class="container"> + <template> + <!-- 娴獥閬僵灞� --> + <view v-if="showPreview" class="overlay" @tap.stop="closePreview"> + <view class="modal"> + <!-- 鍏抽棴鎸夐挳 --> + <text class="close-btn" @tap.stop="showPreview = false">×</text> + <!-- 鍥剧墖灞曠ず --> + <image :src="previewImageSrc" mode="aspectFit" class="preview-image" /> + </view> + </view> + </template> <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> @@ -25,24 +37,18 @@ <uni-easyinput v-model="formData.operator" :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-forms-item name="outNum" :label-width="80" label="浣滀笟鎸囧:"> + <button class="cu-btn bg-blue" @tap="showPreview = true">鏌ョ湅</button> </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"> @@ -63,13 +69,24 @@ <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" + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> + {{item.itemDemand}} + </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> {{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.restle" v-model="item.inspectionResult" + @change="handleCode($event, index)" :disabled="item.istrue" /> </view> </view> <view class="flex"> @@ -79,13 +96,7 @@ :disabled="item.istrue" /> </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.restle" v-model="item.inspectionResult" - @change="handleCode($event, index)" :disabled="item.istrue" /> - </view> - </view> + <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">寮傚父鎻忚堪:</view> @@ -98,9 +109,11 @@ </uni-collapse> - <uni-forms v-show="isShowTeam" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> + <uni-forms v-show="isShowTeam" 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> + <!-- <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="isTouch" /> @@ -128,9 +141,19 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { - isShowTeam:false, + showPreview: false, + readonly: false, + // 鍥剧墖鍥炴樉 + fileLists: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + sourceType: ['album', 'camera'], + isShowTeam: false, isShowBtn: true, - title: '鐝粍闀跨‘璁�', + title: '', isTouch: false, scrollLeft: 0, searchValue: '', @@ -165,7 +188,7 @@ url: { upload: "/eam/sysFiles/batch_upload", stallList: "/eam/eamInspectionOrder/queryById", - // getEquipmentList: "eam/equipment/asyncLoadEquipment", + getStandardFile: "eam/maintenanceStandard/queryById", getEquipmentList: 'eam/equipment/list', BaoList: 'eam/eamInspectionOrderDetail/queryList', approval: 'eam/eamInspectionOrder/approval' @@ -196,7 +219,10 @@ msg2Count: 0, msg1Title: "", procInstId: '', - values: '' + values: '', + flag: '', + standardId: '', + previewImageSrc: '' } @@ -214,11 +240,13 @@ }, onLoad(options) { const annItem = JSON.parse(decodeURIComponent(options.item)); - this.id = annItem.dataId, - this.taskId = annItem.id, - this.procInstId = annItem.procInstId, - this.values = annItem.values, - this.assignee = annItem.assignee + this.flag = options.flag + console.log(this.flag) + this.id = annItem.dataId + this.taskId = annItem.id + this.procInstId = annItem.procInstId + this.values = annItem.values + this.assignee = annItem.assignee }, created() { @@ -231,27 +259,39 @@ changehandlingType(e) { this.ScanData.typeName = e; }, + closePreview() { + this.showPreview = false; + }, ProductionTask() { if (this.hasInspectionDateArrived()) { - if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData.typeName == - '') { + if (this.formData.inspectionStatus == 'WAIT_CONFIRM' && this.flag != 'task') { + 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; + } + 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; + } } + + uni.showLoading({ + mask: true, + title: "鍔犺浇涓�....", + }) this.$http.post(this.url.approval, { /** * 纭鎰忚 @@ -269,8 +309,7 @@ userId: this.assignee, values: this.values }).then(res => { - console.log(res) - this.$tip.loaded(); + uni.hideLoading(); if (res.data.success) { uni.showToast({ icon: "success", @@ -342,23 +381,6 @@ this.$tip.error("鑱旂綉澶辫触") }) }, - // 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("鑱旂綉澶辫触") - // }) - // }, getList() { this.$http.get(this.url.BaoList, { params: { @@ -399,76 +421,37 @@ //鑱旂綉澶辫触, 缁撴潫鍔犺浇 }) }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - - - // 鍒濆鍖� 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); - console.log(this.formData.avatar) - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); - }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); + getStandardFile() { + this.$http.get(this.url.getStandardFile, { + params: { + id: this.standardId } - }); - }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url - }); - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) + }).then(res => { + if (res.data.success) { + console.log("res", res.data.result); + const referenceFileStr = res.data.result.referenceFile; + + // 鍒ゆ柇鏄惁瀛樺湪 referenceFile 骞惰繘琛岃В鏋� + if (referenceFileStr) { + try { + const referenceFileObj = JSON.parse(referenceFileStr); + const filePath = `${this.ipAndPort}${referenceFileObj.filePath}`; + this.previewImageSrc = filePath; + console.log('previewImageSrc:', this.previewImageSrc); + } catch (e) { + console.error("referenceFile 瑙f瀽澶辫触", e); + this.previewImageSrc = ''; + } + } else { + console.warn("referenceFile 涓嶅瓨鍦�"); + this.previewImageSrc = ''; } } - }) + }).catch(err => { + console.error("缃戠粶璇锋眰澶辫触", err); + // 鑱旂綉澶辫触, 缁撴潫鍔犺浇 + }); }, - upCallback() { this.$http.get(this.url.stallList, { params: { @@ -489,17 +472,39 @@ this.ScanData.typeName = this.announcement1.confirmDealType this.formData.confirmComment = this.announcement1.confirmDealType_dictText this.ScanData.handlingSuggestion = this.announcement1.confirmComment - + if (this.announcement1.standardId !== null) { + this.standardId = this.announcement1.standardId + this.getStandardFile() + } if (this.formData.inspectionStatus == 'COMPLETE') { - this.title = '璇︽儏' - this.isTouch = true - this.isShowTeam=true - this.isShowBtn = false + if (this.flag == 'task') { + this.title = '鐝粍闀跨‘璁�' + this.isTouch = true + this.readonly = true + this.isShowTeam = true + this.isShowBtn = false + } } else if (this.formData.inspectionStatus == 'WAIT_CONFIRM') { - this.title = '鐐规寮�濮�'; - this.isShowTeam=true - this.isTouch=true - this.isShowBtn=false + if (this.flag == 'task') { + this.title = '鐐规鎵ц'; + this.readonly = true + this.isShowTeam = true + this.isTouch = true + this.isShowBtn = false + } else { + this.title = '鐐规寮�濮�'; + this.isShowTeam = true + this.isTouch = false + this.readonly = true + this.isShowBtn = true + } + + } else if (this.formData.inspectionStatus == 'UNDER_INSPECTION') { + if (this.flag == 'task') { + this.title = '鐐规寮�濮�'; + this.isShowBtn = false; + + } } this.formData.avatar = this.announcement1.imageFiles this.imageFilesList = JSON.parse(this.formData.avatar) @@ -507,6 +512,13 @@ this.imgList = imageObjects.map(imageObj => { return `${this.ipAndPort}${imageObj.filePath}`; }); + + // 鏍规嵁 imgList 鏋勯�� fileLists + this.fileLists = this.imgList.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); this.hasInspectionDateArrived(); } }).catch(() => { @@ -594,4 +606,66 @@ 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; + /* 闃叉鏂囧瓧鎹㈣ */ + } + + .overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.7); + display: flex; + align-items: center; + justify-content: center; + z-index: 999; + } + + .modal { + position: relative; + width: 90%; + max-width: 600px; + background: #fff; + border-radius: 12rpx; + padding: 20rpx; + box-sizing: border-box; + } + + .preview-image { + width: 100%; + max-height: 80vh; + object-fit: contain; + } + + .close-btn { + position: absolute; + top: 10rpx; + right: 20rpx; + font-size: 40rpx; + color: #333; + } </style> \ No newline at end of file -- Gitblit v1.9.3