From 2527a643d7ac70c7a4742b297972d46c8b1495a4 Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期二, 12 十一月 2024 10:50:09 +0800 Subject: [PATCH] 问题审核bug修改 --- src/views/fysp/check/components/CompProblemAddOrUpd.vue | 279 ++++++++++++++++++++++++++++++------------------------- 1 files changed, 153 insertions(+), 126 deletions(-) diff --git a/src/views/fysp/check/components/CompProblemAddOrUpd.vue b/src/views/fysp/check/components/CompProblemAddOrUpd.vue index 00f7751..30db7f7 100644 --- a/src/views/fysp/check/components/CompProblemAddOrUpd.vue +++ b/src/views/fysp/check/components/CompProblemAddOrUpd.vue @@ -2,7 +2,12 @@ <div class="main-container"> <el-form :model="problem" label-width="auto" style="max-width: 95%"> <el-form-item label="闂绫诲瀷" prop="proType"> - <el-select v-model="proType" @change="onProTypeChange" class="row" :disabled="readonly"> + <el-select + v-model="proType" + @change="onProTypeChange" + class="row" + :disabled="readonly" + > <el-option v-for="item in problemTypeOptions" :key="item.typeid" @@ -22,7 +27,7 @@ v-for="item in descriptionOptions" :key="item.guid" :label="item.description" - :value="item.guid" + :value="item.description" /> </el-select> </el-form-item> @@ -42,7 +47,11 @@ </el-select> </el-form-item> <el-form-item label="闂寤鸿" prop="advise"> - <el-select v-model="deepCopyProblem.advise" class="row" :disabled="readonly"> + <el-select + v-model="deepCopyProblem.advise" + class="row" + :disabled="readonly" + > <el-option v-for="item in adviseOptions" :key="item.adGuid" @@ -63,10 +72,18 @@ <div class="t-card_item"> 闂鍥剧墖 <div> - <el-button @click="chosePicFromAnyPic" v-show="!readonly">浠庝换鎰忓浘鐗囬�夊彇</el-button> - <el-button @click="chosePicFromDevicePic" v-show="!readonly">浠庤澶囧浘鐗囬�夊彇</el-button> - <el-button @click="chosePicFromLedgerPic" v-show="!readonly">浠庡彴璐﹂�夊彇</el-button> - <el-button @click="choseChangePic" v-show="!readonly">浠庢枃浠跺す閫夊彇</el-button> + <el-button @click="chosePicFromAnyPic" v-show="!readonly" + >浠庡満鏅浘鐗囬�夊彇</el-button + > + <el-button @click="chosePicFromDevicePic" v-show="!readonly" + >浠庤澶囧浘鐗囬�夊彇</el-button + > + <el-button @click="chosePicFromLedgerPic" v-show="!readonly" + >浠庡彴璐﹂�夊彇</el-button + > + <el-button @click="choseChangePic" v-show="!readonly" + >浠庢枃浠跺す閫夊彇</el-button + > </div> </div> <el-upload @@ -82,33 +99,37 @@ :disabled="readonly" accept="image/*" > - <el-button type="primary" id="uploadBtnId" style="display: none"></el-button> - <el-icon> + <el-button + type="primary" + id="uploadBtnId" + style="display: none" + ></el-button> + <el-icon v-show="fileList.length != 3"> <Plus /> </el-icon> </el-upload> <el-form-item> - <el-button type="primary" @click="onSubmit" v-show="!readonly">淇濆瓨</el-button> - <el-button @click="this.$emit('submited', false)" v-show="!readonly">鍙栨秷</el-button> + <el-button type="primary" @click="onSubmit" v-show="!readonly" + >淇濆瓨</el-button + > + <el-button @click="this.$emit('submited', false)" v-show="!readonly" + >鍙栨秷</el-button + > </el-form-item> </el-form> - <el-dialog - title="浠绘剰鍥剧墖" - width="80%" - v-model="anyPhotoDialog" - :before-close="beforeAnyPhotoDialogclose" - class="dialog_style" + + <ArbitraryPhoto + :max-select="3" + v-if="anyPhotoDialog" + v-model:dialog-visible="anyPhotoDialog" + @selectByAnyPhonoEvent="handleSelectedAnyPhono" + :subtask="subtask" + :defaultFile="fileList" + ref="arbitraryPhotoRef" > - <ArbitraryPhoto - v-if="anyPhotoDialog" - @selectByAnyPhonoEvent="handleSelectedAnyPhono" - :subtask="subtask" - :defaultFile="fileList" - ref="arbitraryPhotoRef" - > - </ArbitraryPhoto> - </el-dialog> + </ArbitraryPhoto> <el-dialog + title="鍙拌处鍥剧墖" width="80%" v-model="ledgerPicDialog" :before-close="beforeLedgerPicDialogclose" @@ -141,7 +162,7 @@ </CompDevicePhono> </el-dialog> <el-dialog v-model="previewDialogVisible"> - <img w-full :src="previewDialogImageUrl" alt="棰勮" class="preview-pic"/> + <img w-full :src="previewDialogImageUrl" alt="棰勮" class="preview-pic" /> </el-dialog> </div> </template> @@ -153,7 +174,7 @@ import { $fysp } from '@/api/index.js'; import fileUtil from '@/utils/fileUtils.js'; -import { useCloned } from '@vueuse/core'; +import { get, useCloned } from '@vueuse/core'; import { ElMessage } from 'element-plus'; import deviceApi from '@/api/fysp/deviceApi'; export default { @@ -215,11 +236,31 @@ month: -1, ledgerPicDialog: false, rules: { - proType: { required: true, message: '闂绫诲瀷涓嶈兘涓虹┖', trigger: 'change' }, - description: { required: true, message: '闂鎻忚堪涓嶈兘涓虹┖', trigger: 'change' }, - locationid: { required: true, message: '闂浣嶇疆涓嶈兘涓虹┖', trigger: 'change' }, - advise: { required: true, message: '闂寤鸿涓嶈兘涓虹┖', trigger: 'change' }, - proRemark: { required: true, message: '琛ュ厖璇存槑涓嶈兘涓虹┖', trigger: 'change' } + proType: { + required: true, + message: '闂绫诲瀷涓嶈兘涓虹┖', + trigger: 'change' + }, + description: { + required: true, + message: '闂鎻忚堪涓嶈兘涓虹┖', + trigger: 'change' + }, + locationid: { + required: true, + message: '闂浣嶇疆涓嶈兘涓虹┖', + trigger: 'change' + }, + advise: { + required: true, + message: '闂寤鸿涓嶈兘涓虹┖', + trigger: 'change' + }, + proRemark: { + required: true, + message: '琛ュ厖璇存槑涓嶈兘涓虹┖', + trigger: 'change' + } }, deviceTopTypes: [ { id: 0, label: '鐩戞帶璁惧' }, @@ -231,7 +272,6 @@ watch: { fileList: { handler(newFileList, oldFileList) { - console.log('newFileList', newFileList); // 鍥剧墖鏍¢獙 this.pictureValidate(); }, @@ -241,11 +281,13 @@ computed: { descriptionOptions() { const descriptions = []; + this.problemTypeList.forEach((item) => { if (item.typename == this.proType) { descriptions.push(item); } }); + return descriptions; }, problemTypeOptions() { @@ -258,9 +300,10 @@ }, []); }, adviseOptions() { - var array = this.suggestions.filter((item) => item.adProblemtypeguid == this.currProTypeGuid); - console.log('adName', array); - + var problemGuid = this.currProTypeGuid || this.problem.guid; + var array = this.suggestions.filter( + (item) => item.adProblemtypeguid == problemGuid + ); return array; } }, @@ -281,18 +324,16 @@ // 灏嗕竴涓猨s瀵硅薄涓墍鏈塪i锛寃i锛宲i寮�澶寸殑灞炴�у叏閮ㄦ敼鎴愬幓鎺夎繖浜涘墠缂�骞朵笖閲嶆柊鍙樹负椹煎嘲寮忓懡鍚� const newObj = {}; for (const key in obj) { - if (obj.hasOwnProperty(key)) { - let newKey = key; - if (key.startsWith('di')) { - newKey = key.substring(2); - } else if (key.startsWith('wi')) { - newKey = key.substring(2); - } else if (key.startsWith('pi')) { - newKey = key.substring(2); - } - newKey = newKey.charAt(0).toLowerCase() + newKey.slice(1); - newObj[newKey] = obj[key]; + let newKey = key; + if (key.startsWith('di')) { + newKey = key.substring(2); + } else if (key.startsWith('wi')) { + newKey = key.substring(2); + } else if (key.startsWith('pi')) { + newKey = key.substring(2); } + newKey = newKey.charAt(0).toLowerCase() + newKey.slice(1); + newObj[newKey] = obj[key]; } return newObj; }, @@ -315,51 +356,50 @@ this.deviceImgObjList = []; for (const deviceTopTypeElement of this.deviceTopTypes) { const topTypeId = deviceTopTypeElement.id; - await deviceApi.fetchDevices(this.subtask.sceneId, topTypeId).then((result) => { - // 鏍囧噯鍖栧睘鎬у悕 - for (let i = 0; i < result.data.length; i++) { - var element = this.convertKeys(result.data[i]); - // 鑾峰彇璁惧鐘舵�佷俊鎭� - let data = { - deviceId: element.id, - sceneId: element.sceneGuid, - deviceTypeId: topTypeId - }; - deviceApi - .fetchDeviceStatus(data) - .then((status) => { - var statusData = status.data; - var imgPaths = []; + await deviceApi + .fetchDevices(this.subtask.sceneId, topTypeId) + .then((result) => { + // 鏍囧噯鍖栧睘鎬у悕 + for (let i = 0; i < result.data.length; i++) { + var element = this.convertKeys(result.data[i]); + // 鑾峰彇璁惧鐘舵�佷俊鎭� + let data = { + deviceId: element.id, + sceneId: element.sceneGuid, + deviceTypeId: topTypeId + }; + deviceApi + .fetchDeviceStatus(data) + .then((status) => { + var statusData = status.data; + var imgPaths = []; - if (statusData) { - if (statusData.length == 0) { - this.deviceImgObjList.push(element); - return; - } - element = this.convertKeys(result.data[i]); - for (let j = 0; j < statusData.length; j++) { - // 澶嶅埗鍑轰竴涓澶囧璞� - var newDevice = useCloned(element).cloned.value; - const statusItem = statusData[j]; - // 璁惧瀵硅薄娣诲姞涓�涓睘鎬у垪琛ㄥ睘鎬х敤鏉ヤ繚瀛樿澶囩姸鎬� - this.saveStatus(newDevice, statusItem); - newDevice.dlLocation = statusItem.dlLocation; - newDevice.topTypeId = topTypeId; - console.log('newDevice.topTypeId', newDevice.topTypeId); - console.log('newDevice', newDevice); + if (statusData) { + if (statusData.length == 0) { + this.deviceImgObjList.push(element); + return; + } + element = this.convertKeys(result.data[i]); + for (let j = 0; j < statusData.length; j++) { + // 澶嶅埗鍑轰竴涓澶囧璞� + var newDevice = useCloned(element).cloned.value; + const statusItem = statusData[j]; + // 璁惧瀵硅薄娣诲姞涓�涓睘鎬у垪琛ㄥ睘鎬х敤鏉ヤ繚瀛樿澶囩姸鎬� + this.saveStatus(newDevice, statusItem); + newDevice.dlLocation = statusItem.dlLocation; + newDevice.topTypeId = topTypeId; - this.deviceImgObjList.push(newDevice); + this.deviceImgObjList.push(newDevice); + } } - } - }) - .catch((err) => {}); - } - }); + }) + .catch((err) => {}); + } + }); } }, initOptions() { if (this.problem == undefined || this.problem == null) { - this.problem = {}; this.deepCopyProblem = {}; } else { this.deepCopyProblem = useCloned(this.problem).cloned.value; @@ -389,7 +429,10 @@ this.deepCopyProblem.description = currDescription; this.proRemark = ''; } else { - currDescription = currProName.substring(0, currProName.lastIndexOf('(')); + currDescription = currProName.substring( + 0, + currProName.lastIndexOf('(') + ); this.problemTypeList.forEach((item) => { if (item.description === currDescription) { @@ -422,10 +465,6 @@ // 闂寤鸿 problemApi.getSuggestion().then((res) => { this.suggestions = res.data; - // 濉厖褰撳墠闂寤鸿 - this.deepCopyProblem.advise = this.suggestions.filter( - (item) => item.adProblemtypeguid == this.deepCopyProblem.guid - )[0].adName; }); // 闂浣嶇疆 @@ -443,7 +482,7 @@ this.oldFileList.filter((item) => item.url != file.url); } }, - handleLedgerPicPhono() { + handleLedgerPicPhono(data) { this.beforeLedgerPicDialogclose(); let isExist = false; for (const item of data) { @@ -461,9 +500,6 @@ isExist = false; } }, - beforeLedgerPicDialogclose() { - this.ledgerPicDialog = false; - }, findProTypeByGuid(guid) { let result; this.problemTypeList.forEach((item) => { @@ -474,7 +510,7 @@ return result; }, changeProblemname() { - if (this.proRemark == null || this.proRemark == '') { + if (!this.proRemark || this.proRemark == null || this.proRemark == '') { this.deepCopyProblem.problemname = this.deepCopyProblem.description; } else { this.deepCopyProblem.problemname = @@ -488,15 +524,26 @@ this.deepCopyProblem.description = ''; this.deepCopyProblem.advise = ''; }, + findProByProDesName(name) { + let result; + this.problemTypeList.forEach((item) => { + if (item.description == name) { + result = item; + } + }); + return result; + }, onProDesChange(value) { - let currPro = this.findProTypeByGuid(value); + let currPro = this.findProByProDesName(value); this.deepCopyProblem.advise = ''; - this.currProTypeGuid = value; - this.deepCopyProblem.description = currPro.description; + this.currProTypeGuid = currPro.guid; + // this.deepCopyProblem.description = currPro.description; this.changeProblemname(); this.deepCopyProblem.advise = ''; - this.deepCopyProblem.advise = this.adviseOptions[0].adName; + var adName = + this.adviseOptions.length == 0 ? '' : this.adviseOptions[0].adName; + this.deepCopyProblem.advise = adName; }, onProLocationChange(value) { this.posList.forEach((item) => { @@ -550,7 +597,6 @@ } exclude = false; // picUrls.push(item) - } else { } }); if (this.type == 1) { @@ -569,13 +615,14 @@ const deepCopySubTask = useCloned(this.subtask).cloned.value; const that = this; fileUtil.getImageFiles(picUrls, function (files) { - console.log('deepCopySubTask', deepCopySubTask); deepCopyPro.insGuid = deepCopySubTask.insGuid; delete deepCopyPro['advise']; delete deepCopyPro['description']; deepCopyPro.proName = deepCopyPro.problemname; delete deepCopyPro['problemname']; - deepCopyPro.ptGuid = that.findProTypeByGuid(that.currProTypeGuid).guid; + deepCopyPro.ptGuid = that.findProTypeByGuid( + that.currProTypeGuid + ).guid; deepCopyPro.locationId = deepCopyPro.locationid; delete deepCopyPro['locationid']; data.append('problemVo', JSON.stringify(deepCopyPro)); @@ -622,25 +669,6 @@ } isExist = false; } - }, - handleLedgerPicPhono(data) { - let isExist = false; - for (const item of data) { - for (const already of this.fileList) { - if (item.url == already.url) { - isExist = true; - } - } - if (!isExist) { - this.fileList.push({ - url: item.url, - name: '1' - }); - } - isExist = false; - } - - this.beforeAnyPhotoDialogclose(); }, chosePicFromAnyPic() { this.anyPhotoDialog = true; @@ -705,10 +733,6 @@ .row { width: 100%; } - -::v-deep .el-dialog__body { - width: 95%; -} ::v-deep .el-upload-list--picture-card .el-upload-list__item-thumbnail { object-fit: cover !important; } @@ -717,4 +741,7 @@ width: 100%; height: 100%; } +::v-deep .el-upload--picture-card { + border: 0 !important; +} </style> -- Gitblit v1.9.3