From f37d45b8998ea08a42002579ecc103244bdac17b Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 21 十一月 2024 11:06:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'supervisionVue/hc-dataproduct-v1112' into lsf-dataproduct-1024 --- src/views/fysp/check/components/ArbitraryPhoto.vue | 28 src/components/FYImageSelectDialog.vue | 3 src/views/fysp/check/components/CompGenericWrapper.vue | 67 ++ src/views/fysp/check/ProCheck.vue | 115 +-- src/components.d.ts | 4 src/views/fysp/check/components/CompProblemAddOrUpd.vue | 674 ++++++++++------------ src/views/fysp/check/components/CompProRecent.vue | 130 ++-- src/views/fysp/check/components/ComChangeEdit.vue | 220 ++---- src/views/fysp/check/components/CompDeviceShowTest.vue | 318 +++++----- src/views/fysp/check/components/CompLedgerPhoto.vue | 1 src/views/fysp/check/components/CompProblemCard.vue | 149 ++--- 11 files changed, 814 insertions(+), 895 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index e76e42c..6228984 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -24,6 +24,7 @@ ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElContainer: typeof import('element-plus/es')['ElContainer'] + ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] ElDialog: typeof import('element-plus/es')['ElDialog'] @@ -34,6 +35,7 @@ ElHeader: typeof import('element-plus/es')['ElHeader'] ElIcon: typeof import('element-plus/es')['ElIcon'] ElImage: typeof import('element-plus/es')['ElImage'] + ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElInput: typeof import('element-plus/es')['ElInput'] ElMain: typeof import('element-plus/es')['ElMain'] ElMenu: typeof import('element-plus/es')['ElMenu'] @@ -41,6 +43,8 @@ ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup'] ElOption: typeof import('element-plus/es')['ElOption'] ElPopover: typeof import('element-plus/es')['ElPopover'] + ElRadio: typeof import('element-plus/es')['ElRadio'] + ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] diff --git a/src/components/FYImageSelectDialog.vue b/src/components/FYImageSelectDialog.vue index 279ddca..99397d4 100644 --- a/src/components/FYImageSelectDialog.vue +++ b/src/components/FYImageSelectDialog.vue @@ -1,6 +1,5 @@ <template> <el-dialog - :title="title" :model-value="dialogVisible" @opened="$emit('update:dialogVisible', true)" @closed="$emit('update:dialogVisible', false)" @@ -62,8 +61,6 @@ import { ref, watch, computed } from 'vue'; const props = defineProps({ - // 鏍囬 - title: String, dialogVisible: Boolean, /** * 鍥剧墖鍒嗙被 diff --git a/src/views/fysp/check/ProCheck.vue b/src/views/fysp/check/ProCheck.vue index 68d5b0c..f35f1e0 100644 --- a/src/views/fysp/check/ProCheck.vue +++ b/src/views/fysp/check/ProCheck.vue @@ -26,36 +26,29 @@ class="el-scrollbar" v-loading="mainLoading" > - <template v-if="compProblemCardVisible"> - <CompProblemCard - :key="i" - v-for="(p, i) in curProList" - :index="i + 1" - :problem="p" - :subtask="curSubtask.data" - :topTask="topTask" - @updated="onProSubmited" - @submit="updateSubtask" - ></CompProblemCard> - </template> + <CompProblemCard + :key="i" + v-for="(p, i) in curProList" + :index="i + 1" + :problem="p" + :subtask="curSubtask.data" + :topTask="topTask" + @submit="updateSubtask" + ></CompProblemCard> </el-scrollbar> <el-empty v-else description="鏆傛棤璁板綍" v-loading="mainLoading" /> </template> </BaseContentLayout> - <el-dialog - v-model="proAddOrUpdDialogVisible" - :before-close="proAddOrUpdDialogClose" - width="50%" + <CompProblemAddOrUpd title="鏂板闂" - > - <CompProblemAddOrUpd - v-if="proAddOrUpdDialogVisible" - :subtask="curSubtask.data" - :topTask="topTask" - ref="compProblemAddOrUpdRef" - @submited="newProSubmit" - /> - </el-dialog> + v-if="proAddOrUpdDialogVisible" + v-model:visible="proAddOrUpdDialogVisible" + :subtask="curSubtask.data" + :topTask="topTask" + ref="compProblemAddOrUpdRef" + @cancel="onAddProCanceled" + @submit="updateSubtask" + /> <ArbitraryPhoto v-if="anyPhotoDialog" v-model:dialog-visible="anyPhotoDialog" @@ -63,16 +56,13 @@ :subtask="curSubtask.data" ref="arbitraryPhotoRef" ></ArbitraryPhoto> - <el-drawer - direction="ltr" - v-model="deviceShowDialog" - :before-close="beforeDeviceShowDialogclose" + <CompDeviceShowTest title="璁炬柦璁惧" - size="45%" + v-model:visible="deviceShowDialog" + v-if="deviceShowDialog" + ref="deviceShowRef" > - <CompDeviceShowTest v-if="deviceShowDialog" ref="deviceShowRef"> - </CompDeviceShowTest> - </el-drawer> + </CompDeviceShowTest> </template> <script> @@ -93,7 +83,6 @@ }, data() { return { - compProblemCardVisible: true, // 璁惧鍥� deviceShowDialog: false, // 浠绘剰鍥� @@ -232,21 +221,6 @@ this.$refs.deviceShowRef.init(this.curSubtask.data.scene); }); }, - // 鍏抽棴璁惧鍥惧脊绐� - beforeDeviceShowDialogclose(done) { - // this.deviceShowDialog = false; - done(); - }, - // 鍏抽棴浠绘剰鍥剧墖寮圭獥 - beforeAnyPhotoDialogclose() { - this.anyPhotoDialog = false; - }, - handleCloseCheckAnyPhono() { - this.beforeAnyPhotoDialogclose(); - }, - proAddOrUpdDialogClose() { - this.proAddOrUpdDialogVisible = false; - }, //鏌ヨ瀛愪换鍔$粺璁′俊鎭� search(formSearch) { this.topTask = formSearch.topTask; @@ -325,43 +299,44 @@ this.mainLoading = false; }); }, + onAddProCanceled() { + this.proAddOrUpdDialogVisible = false; + }, // 闂鍗$墖缁勪欢涓诲姩鍙戣捣鍒锋柊鐖剁粍浠舵暟鎹� - updateSubtask(refresh = true) { + updateSubtask(refresh = false) { this.curSubtask.data.proCheckedNum++; this.curSubtask.type = this.getSubtaskType(this.curSubtask.data); - if (refresh) { - this.refreshCurrSubtask(); + if (this.proAddOrUpdDialogVisible) { + this.proAddOrUpdDialogVisible = false; } - }, - onProSubmited(isOk) { - this.proAddOrUpdDialogClose(); - if (!isOk) { - return; - } - this.updateSubtask(); - }, - newProSubmit(isOk) { - this.proAddOrUpdDialogVisible = false; - if (!isOk) { - return; - } - this.refreshCurrSubtask(); + this.refreshCurrSubtask(refresh); }, // 鍒锋柊褰撳墠閫変腑瀛愪换鍔� - refreshCurrSubtask() { - this.compProblemCardVisible = false; + refreshCurrSubtask(refresh) { this.sideLoading = false; this.mainLoading = true; setTimeout(() => { taskApi .getProBySubtask(this.curSubtask.data.stGuid) .then((res) => { - this.curProList = res; + if (refresh) { + this.curProList = res; + return; + } + const currProLen = this.curProList.length; + // 涓嶆敼鍙樻暟缁勫鍍忓紩鐢ㄧ殑鍓嶆彁涓嬮噸鏂拌祴鍊� + for (let index = 0; index < res.length; index++) { + const element = res[index]; + if (currProLen < index + 1) { + this.curProList.push(element); + } else { + this.curProList[index] = element; + } + } // this.curSubtask = s; }) .finally(() => { this.mainLoading = false; - this.compProblemCardVisible = true; }); }, 150); } diff --git a/src/views/fysp/check/components/ArbitraryPhoto.vue b/src/views/fysp/check/components/ArbitraryPhoto.vue index 46b1c88..4593d21 100644 --- a/src/views/fysp/check/components/ArbitraryPhoto.vue +++ b/src/views/fysp/check/components/ArbitraryPhoto.vue @@ -19,7 +19,7 @@ return { // 鏃犳暟鎹� typesList: [], - typesMap: new Map(), + typesMap: new Map() }; }, mounted() { @@ -31,19 +31,6 @@ mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => { let typeList = []; let typeMap = new Map(); - function hasThisTypeName(typeName) { - return typeList.map((item) => item.typeName).indexOf(typeName) != -1; - } - function addNewType(typeId, typeName, img) { - typeList.push({ - typeId: typeId, - typeName: typeName - }); - typeMap.set(typeId, [img]); - } - function addToThisType(typeId, img) { - typeMap.get(typeId).push(img); - } const data = res.data; for (const e of data) { let img = { @@ -51,13 +38,18 @@ }; const businesstype = e.businesstype; const businesstypeid = e.businesstypeid; - if (hasThisTypeName(businesstype)) { - addToThisType(businesstypeid, img); + if ( + typeList.find((item) => item.typeName == businesstype) != undefined + ) { + typeMap.get(businesstypeid).push(img); } else { - addNewType(businesstypeid, businesstype, img); + typeList.push({ + typeId: businesstypeid, + typeName: businesstype + }); + typeMap.set(businesstypeid, [img]); } } - this.typesList = typeList; this.typesMap = typeMap; }); diff --git a/src/views/fysp/check/components/ComChangeEdit.vue b/src/views/fysp/check/components/ComChangeEdit.vue index d456860..293da55 100644 --- a/src/views/fysp/check/components/ComChangeEdit.vue +++ b/src/views/fysp/check/components/ComChangeEdit.vue @@ -1,88 +1,84 @@ <template> - <div> - <div class="t-card_item"> - 鏁存敼鍥剧墖 - <div> - <el-button @click="choseChangePic" :disabled="fileList.length >= 3">浠庢枃浠跺す閫夊彇</el-button> + <CompGenericWrapper type="dialog"> + <template #content> + <el-row> + <el-col> + <el-form-item label="鏁存敼鍥剧墖"> + <el-button @click="choseChangePic" :disabled="fileList.length >= 3" + >浠庢枃浠跺す閫夊彇</el-button + > + </el-form-item> + </el-col> + <el-col v-if="!fileList || fileList.length <= 0"> + <el-empty style="height: 145px" description="璇锋坊鍔犲浘鐗�" /> + </el-col> + <el-col> + <el-upload + class="img-upload" + ref="uploadRef" + v-model:file-list="fileList" + list-type="picture-card" + multiple + :auto-upload="false" + crossorigin="Anonymous" + :before-remove="beforeRemoveFile" + :on-preview="handlePictureCardPreview" + :disabled="readonly" + accept="image/*" + > + <template #trigger v-if="fileList.length < 3 && !readonly"> + <el-button + v-if="fileList.length < 3" + type="primary" + id="uploadBtnId" + style="display: none" + ></el-button> + <el-icon> + <Plus /> + </el-icon> + </template> + <template #tip> + <div style="color: #f56c6c"> + 鏈�灏戜笂浼犱竴寮犲浘鐗囷紝鏈�澶氶�夋嫨涓夊紶鍥剧墖 + </div> + </template> + </el-upload> + </el-col> + </el-row> + <div class="flex-div"> + <el-button type="primary" @click="onSubmit">淇濆瓨</el-button> + <el-button @click="onCancel">鍙栨秷</el-button> </div> - </div> - <el-upload - class="img-upload" - ref="uploadRef" - v-model:file-list="fileList" - list-type="picture-card" - multiple - :auto-upload="false" - crossorigin="Anonymous" - :before-remove="beforeRemoveFile" - :on-preview="handlePictureCardPreview" - :disabled="readonly" - accept="image/*" - > - <template #trigger v-if="fileList.length < 3 && !readonly"> - <el-button - v-if="fileList.length < 3" - type="primary" - id="uploadBtnId" - style="display: none" - ></el-button> - <el-icon> - <Plus /> - </el-icon> - </template> - <template #tip> - <div style="color: #f56c6c">鏈�灏戜笂浼犱竴寮犲浘鐗囷紝鏈�澶氶�夋嫨涓夊紶鍥剧墖</div> - </template> - </el-upload> - <div class="flex-div"> - <el-button type="primary" @click="onSubmit">淇濆瓨</el-button> - <el-button @click="this.$emit('submited', false)">鍙栨秷</el-button> - </div> - <ArbitraryPhoto - :max-select="maxSelectImgCount - fileList.length" - v-if="anyPhotoDialog" - v-model:dialog-visible="anyPhotoDialog" - @submit="handleSelectedAnyPhono" - :subtask="subtask" - :defaultFile="fileList" - ref="arbitraryPhotoRef" - > - </ArbitraryPhoto> - <el-dialog - title="鍙拌处鍥剧墖" - width="80%" - v-model="ledgerPicDialog" - :before-close="beforeLedgerPicDialogclose" - > - <LedgerPic - v-if="ledgerPicDialog" - @selectByLedgerPicEvent="handleLedgerPicPhono" - :month="month" - :subtask="subtask" - ref="ledgerPicRef" - > - </LedgerPic> - </el-dialog> - </div> - <el-dialog v-model="previewDialogVisible"> - <img w-full :src="previewDialogImageUrl" alt="棰勮" class="preview-pic" /> - </el-dialog> + <el-image-viewer + v-if="previewDialogVisible" + :url-list="fileList.map((item) => item.url)" + :initial-index="initialIndex" + @close="previewDialogVisible = false" + alt="棰勮" + class="preview-pic" + /> + </template> + </CompGenericWrapper> </template> <script> -import ArbitraryPhoto from './ArbitraryPhoto.vue'; -import LedgerPic from './CompLedgerPic.vue'; import problemApi from '@/api/fysp/problemApi.js'; - +import CompGenericWrapper from './CompGenericWrapper.vue'; import { $fysp } from '@/api/index.js'; import fileUtil from '@/utils/fileUtils.js'; import { useCloned } from '@vueuse/core'; import { ElMessage } from 'element-plus'; export default { + emits: ['submit', 'cancel'], components: { - ArbitraryPhoto, - LedgerPic + CompGenericWrapper }, watch: { + oldChangeFileList: { + handler(nv, ov) { + this.initParams(); + }, + immediate: true + }, fileList: { handler(newFileList, oldFileList) { this.pictureValidate(); @@ -112,6 +108,8 @@ }, data() { return { + // 鍒濆鍥剧墖棰勮index + initialIndex: -1, // 鍥剧墖閫夋嫨鏈�澶ф暟閲� maxSelectImgCount: 3, previewDialogImageUrl: '', @@ -124,9 +122,7 @@ anyPhotoDialog: false }; }, - mounted() { - this.initParams(); - }, + mounted() {}, methods: { pictureValidate() { if (this.changeType == 1 && this.fileList.length < 1) { @@ -146,7 +142,7 @@ return true; }, initParams() { - if (this.changeType == 0) { + if (!this.changeType || this.changeType == 0) { return; } let beforeEditImgList = []; @@ -165,6 +161,9 @@ ); this.fileList = useCloned(beforeEditImgList).cloned.value; this.oldFileList = useCloned(beforeEditImgList).cloned.value; + }, + onCancel() { + this.$emit("cancel") }, onSubmit() { if (!this.pictureValidate()) { @@ -205,7 +204,7 @@ problemApi.updateChange(data).then((res) => {}); }); - that.$emit('submited', true); + that.$emit('submit', true); } else { fileUtil.getImageFiles(picUrls, function (files) { data.append('problemId', that.problemId); @@ -213,7 +212,7 @@ data.append('images', image); }); problemApi.changeProblem(data).then((res) => {}); - that.$emit('submited', true); + that.$emit('submit', true); }); } }, @@ -224,48 +223,9 @@ } }, handlePictureCardPreview(uploadFile) { + this.initialIndex = this.fileList.indexOf(uploadFile) this.previewDialogVisible = true; this.previewDialogImageUrl = uploadFile.url; - }, - handleSelectedAnyPhono(data) { - this.beforeAnyPhotoDialogclose(); - 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; - } - }, - 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; }, // 浠庢枃浠跺す涓� choseChangePic() { @@ -276,24 +236,6 @@ // 瑙﹀彂鐐瑰嚮浜嬩欢 btnElement.click(); } - }, - chosePicFromLedgerPic() { - // 浣跨敤Date瀵硅薄瑙f瀽鏃ユ湡瀛楃涓� - var date = new Date(this.subtask.subtask.planstarttime.splice(0, 7)); - // 鑾峰彇鏈堜唤淇℃伅锛屾湀浠芥槸浠�0寮�濮嬬殑锛屾墍浠ラ渶瑕佸姞1 - this.month = date.getMonth() + 1; - if (String(this.month).length == 1) { - this.month = `0${this.month}`; - } - var year = date.getFullYear(); - this.month = `${year}-${this.month}`; - this.ledgerPicDialog = true; - }, - beforeAnyPhotoDialogclose() { - this.anyPhotoDialog = false; - }, - beforeLedgerPicDialogclose() { - this.ledgerPicDialog = false; } } }; @@ -323,6 +265,10 @@ height: 100%; } ::v-deep .el-upload--picture-card { - border: 0 !important; + display: none; +} +/* 闅愯棌el-upload涓婁紶鎴愬姛缁勪欢 */ +::v-deep .el-upload-list__item-status-label { + display: none !important; } </style> diff --git a/src/views/fysp/check/components/CompDeviceShowTest.vue b/src/views/fysp/check/components/CompDeviceShowTest.vue index 2a250e1..7011936 100644 --- a/src/views/fysp/check/components/CompDeviceShowTest.vue +++ b/src/views/fysp/check/components/CompDeviceShowTest.vue @@ -1,171 +1,179 @@ <template> - <div> - <!-- 閫夐」 --> - <!-- 璁惧绫诲瀷 --> - <el-row> - <el-col> - <el-tabs - class="child_select" - placeholder="璁惧绫诲瀷" - v-model="currSelect.topDeviceTypeId" - > - <el-tab-pane - v-for="item in deviceTopTypes" - :key="item.id" - :name="item.id" + <CompGenericWrapper type="drawer"> + <template #content> + <!-- 閫夐」 --> + <!-- 璁惧绫诲瀷 --> + <el-row> + <el-col> + <el-tabs + class="child_select" + placeholder="璁惧绫诲瀷" + v-model="currSelect.topDeviceTypeId" > - <template #label> - <el-badge - :value="item.count" - :type="item.count == 0 ? 'danger' : 'primary'" - > - <span class="custom-tabs-label"> - <span>{{ item.label }}</span> - </span> - </el-badge> - </template> - </el-tab-pane> - </el-tabs> - </el-col> - </el-row> - <el-collapse v-model="activeNames" style="border: 4px"> - <el-collapse-item - v-for="item in formInfo" - :key="item.id" - :name="item.id" - class="collapse-item-class" - > - <template #title> - <div - style="display: flex; width: 100%; justify-content: space-between" - > - <div style=""> - <el-descriptions style="" :column="3" size="small" border> - <el-descriptions-item width="64px" :label="currSelect.topDeviceTypeId == 0 ? '绔欑偣鍚嶇О' : '璁惧鍚嶇О'" :span="3">{{ - item.name || '鏃�' - }}</el-descriptions-item> - <el-descriptions-item label="渚涘簲鍟�">{{ - item.supplier || '鏃�' - }}</el-descriptions-item> - <el-descriptions-item label="杩愮淮鍟�">{{ - item.maintainer || '鏃�' - }}</el-descriptions-item> - <el-descriptions-item label="杩愮淮棰戞"> - <el-select - v-model="item.maintainFrequency" - :disabled="isDisabled" - style="width: 150px" - > - <el-option - v-for="frequency of maintainFrequencysArray" - :key="frequency.key" - :label="frequency.value" - :value="frequency.key" - ></el-option> - </el-select> - </el-descriptions-item> - <el-descriptions-item label="杩愮淮浜哄憳">{{ - item.maintainStaff || '鏃�' - }}</el-descriptions-item> - <el-descriptions-item label="杩愮淮鑱旂郴鏂瑰紡">{{ - item.maintainTel || '鏃�' - }}</el-descriptions-item> - <el-descriptions-item label="鍝佺墝鍨嬪彿">{{ - item.brandModel || '鏃�' - }}</el-descriptions-item> - <el-descriptions-item label="杩愯鐘舵��"> - <el-select - v-model="item.runningStatus" - :disabled="isDisabled" - style="width: 150px" - > - <el-option - v-for="status of runStatusArray" - :key="status.key" - :label="status.value" - :value="status.key" - ></el-option> - </el-select> - </el-descriptions-item> - <el-descriptions-item label="绫诲瀷"> - {{ item._typename || '鏃�' }} - </el-descriptions-item> - </el-descriptions> - </div> - - <div style="display: flex"> - <!-- <div class="sub-title">{{ item.name }}</div> --> - <!-- 鍥剧墖 --> - <div class="image-container"> - <div - class="block-div" - @click="onClickPic($event)" - v-for="(status, index) in item._statusList" - :key="index" + <el-tab-pane + v-for="item in deviceTopTypes" + :key="item.id" + :name="item.id" + > + <template #label> + <el-badge + :value="item.count" + :type="item.count == 0 ? 'danger' : 'primary'" > - <el-image - v-if="index == 0" - fit="cover" - class="pic-style" - :src="status._picUrl" - :preview-src-list="Array.of(status._picUrl)" - /> - <span class="abstract_pic_text" v-if="index == 0">{{ - `鏈�鏂扮姸鎬佸浘鐗� ${status.dlCreateTime.slice(0, 10)}` - }}</span> + <span class="custom-tabs-label"> + <span>{{ item.label }}</span> + </span> + </el-badge> + </template> + </el-tab-pane> + </el-tabs> + </el-col> + </el-row> + <el-collapse v-model="activeNames" style="border: 4px"> + <el-collapse-item + v-for="item in formInfo" + :key="item.id" + :name="item.id" + class="collapse-item-class" + > + <template #title> + <div + style="display: flex; width: 100%; justify-content: space-between" + > + <div style=""> + <el-descriptions style="" :column="3" size="small" border> + <el-descriptions-item + width="64px" + :label=" + currSelect.topDeviceTypeId == 0 ? '绔欑偣鍚嶇О' : '璁惧鍚嶇О' + " + :span="3" + >{{ item.name || '鏃�' }}</el-descriptions-item + > + <el-descriptions-item label="渚涘簲鍟�">{{ + item.supplier || '鏃�' + }}</el-descriptions-item> + <el-descriptions-item label="杩愮淮鍟�">{{ + item.maintainer || '鏃�' + }}</el-descriptions-item> + <el-descriptions-item label="杩愮淮棰戞"> + <el-select + v-model="item.maintainFrequency" + :disabled="isDisabled" + style="width: 150px" + > + <el-option + v-for="frequency of maintainFrequencysArray" + :key="frequency.key" + :label="frequency.value" + :value="frequency.key" + ></el-option> + </el-select> + </el-descriptions-item> + <el-descriptions-item label="杩愮淮浜哄憳">{{ + item.maintainStaff || '鏃�' + }}</el-descriptions-item> + <el-descriptions-item label="杩愮淮鑱旂郴鏂瑰紡">{{ + item.maintainTel || '鏃�' + }}</el-descriptions-item> + <el-descriptions-item label="鍝佺墝鍨嬪彿">{{ + item.brandModel || '鏃�' + }}</el-descriptions-item> + <el-descriptions-item label="杩愯鐘舵��"> + <el-select + v-model="item.runningStatus" + :disabled="isDisabled" + style="width: 150px" + > + <el-option + v-for="status of runStatusArray" + :key="status.key" + :label="status.value" + :value="status.key" + ></el-option> + </el-select> + </el-descriptions-item> + <el-descriptions-item label="绫诲瀷"> + {{ item._typename || '鏃�' }} + </el-descriptions-item> + </el-descriptions> + </div> + + <div style="display: flex"> + <!-- <div class="sub-title">{{ item.name }}</div> --> + <!-- 鍥剧墖 --> + <div class="image-container"> + <div + class="block-div" + @click="onClickPic($event)" + v-for="(status, index) in item._statusList" + :key="index" + > + <el-image + v-if="index == 0" + fit="cover" + class="pic-style" + :src="status._picUrl" + :preview-src-list="Array.of(status._picUrl)" + /> + <span class="abstract_pic_text" v-if="index == 0">{{ + `鏈�鏂扮姸鎬佸浘鐗� ${status.dlCreateTime.slice(0, 10)}` + }}</span> + </div> </div> </div> </div> - </div> - </template> - <!-- 璇︾粏鍐呭寮�濮� --> - <el-form :model="item" class="form_class"> - <el-form-item label="鐘舵��"> - <el-tabs tab-position="top"> - <el-tab-pane - v-for="(status, i) in item._statusList" - :label="status.dlCreateTime.slice(0, 10)" - :key="i" - > - <el-form :model="status" class="form-class"> - <el-form-item label="浣嶇疆" style="margin-bottom: 10px"> - {{ status.dlLocation }} - </el-form-item> - <el-form-item label="鍥剧墖"> - <!-- 鍥剧墖 --> - <el-space> - <div v-if="status._paths && status._paths.length > 0"> - <el-image - v-for="(path, i) in status._paths" - fit="cover" - class="pic-style" - :src="path" - :preview-src-list="Array.of(path)" - :key="i" - /> - </div> - <el-empty v-else></el-empty> - </el-space> - </el-form-item> - </el-form> - </el-tab-pane> - </el-tabs> - </el-form-item> - </el-form> - <!-- 璇︾粏鍐呭缁撴潫 --> - </el-collapse-item> - </el-collapse> - <!-- 绌虹姸鎬� --> - <el-empty v-if="isEmpty" /> - </div> + </template> + <!-- 璇︾粏鍐呭寮�濮� --> + <el-form :model="item" class="form_class"> + <el-form-item label="鐘舵��"> + <el-tabs tab-position="top"> + <el-tab-pane + v-for="(status, i) in item._statusList" + :label="status.dlCreateTime.slice(0, 10)" + :key="i" + > + <el-form :model="status" class="form-class"> + <el-form-item label="浣嶇疆" style="margin-bottom: 10px"> + {{ status.dlLocation }} + </el-form-item> + <el-form-item label="鍥剧墖"> + <!-- 鍥剧墖 --> + <el-space> + <div v-if="status._paths && status._paths.length > 0"> + <el-image + v-for="(path, i) in status._paths" + fit="cover" + class="pic-style" + :src="path" + :preview-src-list="Array.of(path)" + :key="i" + /> + </div> + <el-empty v-else></el-empty> + </el-space> + </el-form-item> + </el-form> + </el-tab-pane> + </el-tabs> + </el-form-item> + </el-form> + <!-- 璇︾粏鍐呭缁撴潫 --> + </el-collapse-item> + </el-collapse> + <!-- 绌虹姸鎬� --> + <el-empty v-if="isEmpty" + /></template> + </CompGenericWrapper> </template> <script> +import CompGenericWrapper from './CompGenericWrapper.vue'; import deviceApi from '@/api/fysp/deviceApi'; import { $fysp } from '@/api/index'; import { toLabel } from '@/enum/device/device'; export default { - components: {}, + components: { CompGenericWrapper }, watch: { // 閫夋嫨鏀瑰彉鐩戝惉 currSelect: { diff --git a/src/views/fysp/check/components/CompGenericWrapper.vue b/src/views/fysp/check/components/CompGenericWrapper.vue new file mode 100644 index 0000000..586c837 --- /dev/null +++ b/src/views/fysp/check/components/CompGenericWrapper.vue @@ -0,0 +1,67 @@ +<template> + <!-- dialog鍖呰9 --> + <div v-if="currType == 'dialog'"> + <el-dialog + :title="title" + :model-value="visible" + @opened="$emit('update:visible', true)" + @closed="$emit('update:visible', false)" + destroy-on-close + > + <div v-if="visible"> + <slot name="content"></slot> + </div> + </el-dialog> + </div> + <!-- drawer鍖呰9 --> + <div v-if="currType == 'drawer'"> + <el-drawer + :title="title" + size="45%" + direction="ltr" + :model-value="visible" + @opened="$emit('update:visible', true)" + @closed="$emit('update:visible', false)" + destroy-on-close + > + <slot name="content"></slot> + </el-drawer> + </div> + <!-- 榛樿鏃犲寘瑁� --> + <div v-if="currType == 'normal'"> + <slot></slot> + </div> +</template> +<script setup> +import { ref, defineEmits, watch } from 'vue'; +const props = defineProps({ + visible: Boolean, + title: String, + type: { + type: String, + default: 'normal' + } +}); +const typeOptions = ref([ + { id: '0', label: 'dialog' }, + { id: '1', label: 'drawer' }, + { id: '10', label: '' } +]); +const currType = ref(''); +const emit = defineEmits(['update:visible']); +watch( + () => props.type, + (nValue) => { + currType.value = nValue; + }, + { immediate: true } +); +</script> +<style scoped> +::v-deep .el-drawer__body { + padding-top: 0; +} +::v-deep .el-drawer__header { + margin-bottom: 16px; +} +</style> diff --git a/src/views/fysp/check/components/CompLedgerPhoto.vue b/src/views/fysp/check/components/CompLedgerPhoto.vue index 5d60c8c..c42b372 100644 --- a/src/views/fysp/check/components/CompLedgerPhoto.vue +++ b/src/views/fysp/check/components/CompLedgerPhoto.vue @@ -11,7 +11,6 @@ import userApi from '@/api/fysp/userApi.js'; import { svToTz } from '@/enum/scene'; import { $fytz } from '@/api/index'; -import { useCloned } from '@vueuse/core'; const props = defineProps({ // 灞曠ず妯″紡 mode: { diff --git a/src/views/fysp/check/components/CompProRecent.vue b/src/views/fysp/check/components/CompProRecent.vue index bb037b4..8d31232 100644 --- a/src/views/fysp/check/components/CompProRecent.vue +++ b/src/views/fysp/check/components/CompProRecent.vue @@ -1,15 +1,24 @@ <template> - <div> - <el-tabs v-model="activeName" type="card"> - <el-tab-pane v-for="(item, i) in ranges" :key="i" :label="item" :name="item"> </el-tab-pane> - </el-tabs> - <div class="proList"> - <el-card class="card-style" shadow="hover"> - <el-descriptions v-loading="loading"> - <el-descriptions-item label="鎬诲嚭鐜版鏁�">{{ curProList.length }}</el-descriptions-item> - <!-- <el-descriptions-item label="澶嶇幇鐜�">{{ repeteRate }}%</el-descriptions-item> --> - </el-descriptions> - <!-- <el-descriptions v-loading="loading" column="3"> + <CompGenericWrapper type="dialog"> + <template #content> + <el-tabs v-model="activeName" type="card"> + <el-tab-pane + v-for="(item, i) in ranges" + :key="i" + :label="item" + :name="item" + > + </el-tab-pane> + </el-tabs> + <div class="proList"> + <el-card class="card-style" shadow="hover" v-loading="loading"> + <el-descriptions> + <el-descriptions-item label="鎬诲嚭鐜版鏁�">{{ + curProList.length + }}</el-descriptions-item> + <!-- <el-descriptions-item label="澶嶇幇鐜�">{{ repeteRate }}%</el-descriptions-item> --> + </el-descriptions> + <!-- <el-descriptions v-loading="loading" column="3"> <div v-for="pro in curProList"> <el-descriptions-item>{{ pro.problemname }}</el-descriptions-item> <el-descriptions-item label="浠诲姟鍚嶇О">{{ pro._stName }}</el-descriptions-item> @@ -18,43 +27,42 @@ </el-descriptions-item> </div> </el-descriptions> --> - <el-table :data="curProList" style="width: 100%"> - <el-table-column type="index" width="50" /> - <el-table-column prop="problemname" label="闂"/> - <el-table-column prop="_time" label="鏃堕棿" width="250" /> - <el-table-column label="鎿嶄綔" width="180"> - <template v-slot="scope"> - <el-button link type="primary" @click="info(scope.row)">璇︽儏</el-button> - </template> - </el-table-column> - </el-table> - </el-card> - <el-dialog + <el-table :data="curProList" style="width: 100%"> + <el-table-column type="index" width="50" /> + <el-table-column prop="problemname" label="闂" /> + <el-table-column prop="_time" label="鏃堕棿" width="250" /> + <el-table-column label="鎿嶄綔" width="180"> + <template v-slot="scope"> + <el-button link type="primary" @click="info(scope.row)" + >璇︽儏</el-button + > + </template> + </el-table-column> + </el-table> + </el-card> + </div> + <CompProblemAddOrUpd + v-model:visible="proAddOrUpdDialogVisible" title="棰勮" - v-model="proAddOrUpdDialogVisible" - :before-close="proAddOrUpdDialogClose" - width="80%" - > - <CompProblemAddOrUpd - v-if="proAddOrUpdDialogVisible" - :subtask="subtask" - :topTask="topTask" - :problem="previewPro" - :readonly="true" - ref="compProblemAddOrUpdRef" - /> - </el-dialog> - </div> - </div> + :subtask="subtask" + :topTask="topTask" + :problem="previewPro" + :readonly="true" + ref="compProblemAddOrUpdRef" + /> + <el-dialog destroy-on-close> </el-dialog> + </template> + </CompGenericWrapper> </template> <script> +import CompGenericWrapper from './CompGenericWrapper.vue'; import CompProblemAddOrUpd from './CompProblemAddOrUpd.vue'; import taskApi from '@/api/fysp/taskApi'; import { useCloned } from '@vueuse/core'; export default { computed: { // repeteRate() { - // return this.curProList.length !== 0 ? (this.curProList.length - 1) / this.subtaskCount * 1.0 : 0 + // return this.curProList.length !== 0 ? (this.curProList.length - 1) / this.subtaskCount * 1.0 : 0 // }, }, props: { @@ -80,16 +88,20 @@ handler(newObj, oldObj) { this.handleClick(); } + }, + problem: { + handler(nv, ov) { + this.deepCopyPro = useCloned(this.problem).cloned.value; + this.getRecentPros(); + }, + immediate: true } }, components: { - CompProblemAddOrUpd + CompProblemAddOrUpd, + CompGenericWrapper }, - mounted() { - - this.deepCopyPro = useCloned(this.problem).cloned.value; - this.getRecentPros(); - }, + mounted() {}, data() { return { proAddOrUpdDialogVisible: false, @@ -114,10 +126,6 @@ info(pro) { this.previewPro = pro; this.proAddOrUpdDialogVisible = true; - }, - // 鍏抽棴璇︽儏寮圭獥 - proAddOrUpdDialogClose() { - this.proAddOrUpdDialogVisible = false; }, // 鍒囨崲鏃堕棿鑼冨洿 handleClick() { @@ -153,17 +161,19 @@ * */ async getRecentPros() { this.loading = true; - this.subtaskCount = 0 + this.subtaskCount = 0; // 鑾峰彇瀛愪换鍔″垪琛� - await taskApi.getSubtaskByScene(this.generateQueryParam()).then((subtasks) => { - this.curProList = []; - if (subtasks) { - subtasks.forEach((subtask) => { - // 鑾峰彇闂鍒楄〃 - this.getProBySubtask(subtask); - }); - } - }); + await taskApi + .getSubtaskByScene(this.generateQueryParam()) + .then((subtasks) => { + this.curProList = []; + if (subtasks) { + subtasks.forEach((subtask) => { + // 鑾峰彇闂鍒楄〃 + this.getProBySubtask(subtask); + }); + } + }); // 棰濆澶勭悊 this.curProList.sort((o1, o2) => o2.getDate() - o1.getDate()); this.loading = false; @@ -175,7 +185,7 @@ pros.forEach((pro) => { if (pro.ptguid == this.deepCopyPro.ptguid) { pro._stName = subtask.stName; - pro._time = this.$fm.formatYMD(subtask.stPlanTime) + pro._time = this.$fm.formatYMD(subtask.stPlanTime); this.curProList.push(pro); } }); diff --git a/src/views/fysp/check/components/CompProblemAddOrUpd.vue b/src/views/fysp/check/components/CompProblemAddOrUpd.vue index 91ba7d2..2f58db3 100644 --- a/src/views/fysp/check/components/CompProblemAddOrUpd.vue +++ b/src/views/fysp/check/components/CompProblemAddOrUpd.vue @@ -1,210 +1,238 @@ <template> - <div class="main-container"> - <el-form :model="problem" label-width="auto" style="max-width: 95%"> - <el-form-item label="闂浣嶇疆" prop="locationid"> - <el-select - v-model="deepCopyProblem.locationid" - @change="onProLocationChange" - class="row" - :disabled="readonly" + <CompGenericWrapper type="dialog"> + <template #content> + <div class="main-container"> + <el-form + :rules="rules" + :model="deepCopyProblem" + label-width="auto" + style="max-width: 95%" + ref="formRef" > - <el-option - v-for="item in posList" - :key="item.index" - :label="item.text" - :value="item.index" - /> - </el-select> - </el-form-item> - <el-form-item label="闂绫诲瀷" prop="proType"> - <el-select - v-model="proType" - @change="onProTypeChange" - class="row" - :disabled="readonly" + <el-form-item label="闂浣嶇疆" prop="locationid"> + <el-select + v-model="deepCopyProblem.locationid" + @change="onProLocationChange" + class="row" + :disabled="readonly" + > + <el-option + v-for="item in posList" + :key="item.index" + :label="item.text" + :value="item.index" + /> + </el-select> + </el-form-item> + <el-form-item label="闂绫诲瀷" prop="_proType"> + <el-select + v-model="deepCopyProblem._proType" + @change="onProTypeChange" + class="row" + :disabled="readonly" + > + <el-option + v-for="item in problemTypeOptions" + :key="item.typeid" + :label="item.typename" + :value="item.typename" + /> + </el-select> + </el-form-item> + <el-form-item label="闂鎻忚堪" prop="description"> + <el-select + v-model="deepCopyProblem.description" + @change="onProDesChange" + class="row" + :disabled="readonly" + > + <el-option + v-for="item in descriptionOptions" + :key="item.guid" + :label="item.description" + :value="item.description" + /> + </el-select> + </el-form-item> + <el-form-item label="琛ュ厖璇存槑" :disabled="readonly" prop="proRemark"> + <el-input + v-model="proRemark" + type="textarea" + @change="onProRemarkChange" + class="row" + placeholder="璇疯緭鍏�" + :disabled="readonly" + /> + </el-form-item> + <el-form-item label="闂寤鸿" prop="advice"> + <el-select + v-model="deepCopyProblem.advice" + class="row" + :disabled="readonly" + @change="onProAdviseChange" + > + <el-option + v-for="item in adviseOptions" + :key="item.adGuid" + :label="item.adName" + :value="item.adName" + /> + </el-select> + </el-form-item> + <el-form-item + label="闂寤鸿淇" + prop="_adviseEdit" + :disabled="false" + > + <el-input + v-model="deepCopyProblem._adviseEdit" + type="textarea" + @change="onProAdviseEditChange" + class="row" + placeholder="璇疯緭鍏ラ棶棰樺缓璁慨姝�" + :disabled="readonly" + /> + </el-form-item> + <el-form-item label="闂鍥剧墖"> + <el-row> + <el-col> + <el-button + @click="chosePicFromAnyPic" + v-show="!readonly" + :disabled="fileList.length >= 3" + >浠庡満鏅浘鐗囬�夊彇</el-button + > + <el-button + @click="chosePicFromDevicePic" + v-show="!readonly" + :disabled="fileList.length >= 3" + >浠庤澶囧浘鐗囬�夊彇</el-button + > + <el-button + @click="chosePicFromLedgerPic" + v-show="!readonly" + :disabled="fileList.length >= 3" + >浠庡彴璐﹂�夊彇</el-button + > + <el-button + @click="choseChangePic" + v-show="!readonly" + :disabled="fileList.length >= 3" + >浠庢枃浠跺す閫夊彇</el-button + > + </el-col> + <el-col v-if="!fileList || fileList.length <= 0"> + <el-empty + style="height: 145px" + class="img-upload" + description="璇锋坊鍔犲浘鐗�" + /> + </el-col> + <el-col> + <el-upload + v-show="fileList && fileList.length > 0" + class="img-upload" + ref="uploadRef" + v-model:file-list="fileList" + list-type="picture-card" + multiple + :auto-upload="false" + crossorigin="Anonymous" + :before-remove="beforeRemoveFile" + :on-preview="handlePictureCardPreview" + :disabled="readonly" + accept="image/*" + > + <template #trigger v-if="fileList.length < 3 && !readonly"> + <el-button + v-if="fileList.length < 3" + type="primary" + id="uploadBtnId" + style="display: none" + ></el-button> + <el-icon> + <Plus /> + </el-icon> + </template> + <template #tip> + <div style="color: #f56c6c"> + 鏈�灏戜笂浼犱竴寮犲浘鐗囷紝鏈�澶氶�夋嫨涓夊紶鍥剧墖 + </div> + </template> + </el-upload> + </el-col> + </el-row> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="onSubmit" v-show="!readonly" + >淇濆瓨</el-button + > + <el-button @click="onCancel" v-show="!readonly" + >鍙栨秷</el-button + > + </el-form-item> + </el-form> + <ArbitraryPhoto + :max-select="maxSelectImgCount - fileList.length" + v-model:dialog-visible="anyPhotoDialog" + @submit="handleSelectedAnyPhono" + :subtask="subtask" + :defaultFile="fileList" + ref="arbitraryPhotoRef" > - <el-option - v-for="item in problemTypeOptions" - :key="item.typeid" - :label="item.typename" - :value="item.typename" - /> - </el-select> - </el-form-item> - <el-form-item label="闂鎻忚堪" prop="description"> - <el-select - v-model="deepCopyProblem.description" - @change="onProDesChange" - class="row" - :disabled="readonly" + </ArbitraryPhoto> + <CompLedgerPhoto + :max-select="maxSelectImgCount - fileList.length" + v-model:dialog-visible="ledgerPicDialog" + @submit="handleLedgerPicPhono" + :subtask="subtask" + :defaultFile="fileList" + ref="ledgerPhotoRef" + ></CompLedgerPhoto> + <CompDevicePhoto + :max-select="maxSelectImgCount - fileList.length" + v-model:dialog-visible="deiveceImgDialog" + @submit="handleSelectedDevicePhono" + :subtask="subtask" + :defaultFile="fileList" + ref="deiveceImgDialogRef" > - <el-option - v-for="item in descriptionOptions" - :key="item.guid" - :label="item.description" - :value="item.description" - /> - </el-select> - </el-form-item> - <el-form-item label="琛ュ厖璇存槑" :disabled="readonly" prop="proRemark"> - <el-input - v-model="proRemark" - type="textarea" - @change="onProRemarkChange" - class="row" - placeholder="璇疯緭鍏�" - :disabled="readonly" + </CompDevicePhoto> + <el-image-viewer + v-if="previewDialogVisible" + :url-list="fileList.map((item) => item.url)" + :initial-index="initialIndex" + @close="previewDialogVisible = false" + alt="棰勮" + class="preview-pic" /> - </el-form-item> - <el-form-item label="闂寤鸿" prop="advise"> - <el-select - v-model="deepCopyProblem.advise" - class="row" - :disabled="readonly" - @change="onProAdviseChange" - > - <el-option - v-for="item in adviseOptions" - :key="item.adGuid" - :label="item.adName" - :value="item.adName" - /> - </el-select> - </el-form-item> - <el-form-item - v-show="deepCopyProblem.advise && deepCopyProblem.advise != ''" - label="闂寤鸿淇" - prop="_adviseEdit" - :disabled="false" - > - <el-input - v-model="deepCopyProblem._adviseEdit" - type="textarea" - @change="onProAdviseEditChange" - class="row" - placeholder="璇疯緭鍏ラ棶棰樺缓璁慨姝�" - :disabled="readonly" - /> - </el-form-item> - <div class="t-card_item"> - 闂鍥剧墖 - <div> - <el-button - @click="chosePicFromAnyPic" - v-show="!readonly" - :disabled="fileList.length >= 3" - >浠庡満鏅浘鐗囬�夊彇</el-button - > - <el-button - @click="chosePicFromDevicePic" - v-show="!readonly" - :disabled="fileList.length >= 3" - >浠庤澶囧浘鐗囬�夊彇</el-button - > - <el-button - @click="chosePicFromLedgerPic" - v-show="!readonly" - :disabled="fileList.length >= 3" - >浠庡彴璐﹂�夊彇</el-button - > - <el-button - @click="choseChangePic" - v-show="!readonly" - :disabled="fileList.length >= 3" - >浠庢枃浠跺す閫夊彇</el-button - > - </div> + <!-- <el-dialog v-model="previewDialogVisible"> + + </el-dialog> --> </div> - <el-upload - class="img-upload" - ref="uploadRef" - v-model:file-list="fileList" - list-type="picture-card" - multiple - :auto-upload="false" - crossorigin="Anonymous" - :before-remove="beforeRemoveFile" - :on-preview="handlePictureCardPreview" - :disabled="readonly" - accept="image/*" - > - <template #trigger v-if="fileList.length < 3 && !readonly"> - <el-button - v-if="fileList.length < 3" - type="primary" - id="uploadBtnId" - style="display: none" - ></el-button> - <el-icon> - <Plus /> - </el-icon> - </template> - <template #tip> - <div style="color: #f56c6c">鏈�灏戜笂浼犱竴寮犲浘鐗囷紝鏈�澶氶�夋嫨涓夊紶鍥剧墖</div> - </template> - </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-form-item> - </el-form> - - <ArbitraryPhoto - :max-select="maxSelectImgCount - fileList.length" - v-if="anyPhotoDialog" - v-model:dialog-visible="anyPhotoDialog" - @submit="handleSelectedAnyPhono" - :subtask="subtask" - :defaultFile="fileList" - ref="arbitraryPhotoRef" - > - </ArbitraryPhoto> - <CompLedgerPhoto - :max-select="maxSelectImgCount - fileList.length" - v-if="ledgerPicDialog" - v-model:dialog-visible="ledgerPicDialog" - @submit="handleLedgerPicPhono" - :subtask="subtask" - :defaultFile="fileList" - ref="ledgerPhotoRef" - ></CompLedgerPhoto> - <CompDevicePhoto - :max-select="maxSelectImgCount - fileList.length" - v-if="deiveceImgDialog" - v-model:dialog-visible="deiveceImgDialog" - @submit="handleSelectedDevicePhono" - :subtask="subtask" - :defaultFile="fileList" - ref="deiveceImgDialogRef" - > - </CompDevicePhoto> - - <el-dialog v-model="previewDialogVisible"> - <img w-full :src="previewDialogImageUrl" alt="棰勮" class="preview-pic" /> - </el-dialog> - </div> + </template> + </CompGenericWrapper> </template> <script> +import CompGenericWrapper from './CompGenericWrapper.vue'; import ArbitraryPhoto from './ArbitraryPhoto.vue'; -import LedgerPic from './CompLedgerPic.vue'; import CompLedgerPhoto from './CompLedgerPhoto.vue'; import CompDevicePhoto from './CompDevicePhoto.vue'; import problemApi from '@/api/fysp/problemApi.js'; import { $fysp } from '@/api/index.js'; import fileUtil from '@/utils/fileUtils.js'; -import { useCloned } from '@vueuse/core'; +import { useCloned } from '@vueuse/core'; import { ElMessage } from 'element-plus'; import deviceApi from '@/api/fysp/deviceApi'; +import { useFormConfirm } from '@/composables/formConfirm'; export default { + emits: ['submit', 'cancel'], components: { ArbitraryPhoto, CompDevicePhoto, - CompLedgerPhoto + CompLedgerPhoto, + CompGenericWrapper }, props: { readonly: { @@ -235,6 +263,8 @@ }, data() { return { + // 鍒濆棰勮鍥剧墖index + initialIndex: -1, // 鍥剧墖閫夋嫨鏈�澶ф暟閲� maxSelectImgCount: 3, previewDialogVisible: false, @@ -261,7 +291,7 @@ month: -1, ledgerPicDialog: false, rules: { - proType: { + _proType: { required: true, message: '闂绫诲瀷涓嶈兘涓虹┖', trigger: 'change' @@ -276,14 +306,9 @@ message: '闂浣嶇疆涓嶈兘涓虹┖', trigger: 'change' }, - advise: { + advice: { required: true, message: '闂寤鸿涓嶈兘涓虹┖', - trigger: 'change' - }, - proRemark: { - required: true, - message: '琛ュ厖璇存槑涓嶈兘涓虹┖', trigger: 'change' } }, @@ -302,13 +327,10 @@ }, deep: true }, - // 褰撻棶棰樺缓璁敼鍙樻椂闂寤鸿淇璺熺潃鏀瑰彉 - deepCopyProblem: { + problem: { handler(nv, ov) { - // 鍥剧墖鏍¢獙 - nv._adviseEdit = ov.advise; - }, - deep: true + this.initOptions(); + } } }, computed: { @@ -316,7 +338,7 @@ const descriptions = []; this.problemTypeList.forEach((item) => { - if (item.typename == this.proType) { + if (item.typename == this.deepCopyProblem._proType) { descriptions.push(item); } }); @@ -333,123 +355,39 @@ }, []); }, adviseOptions() { - console.log(this.currProTypeGuid, this.problem.guid, this.suggestions); - let problemGuid = this.currProTypeGuid || this.problem.guid; let array = this.suggestions.filter( (item) => item.adProblemtypeguid == problemGuid ); - console.log( - this.suggestions.filter( - (item) => item.adProblemtypeguid == problemGuid - ), - this.adviseOptions - ); - return array; } }, mounted() { this.initOptions(); - this.getDeviceImgList(); }, methods: { onProAdviseChange(value) { - this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advise; + this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice; }, handlePictureCardPreview(uploadFile) { + this.initialIndex = this.fileList.indexOf(uploadFile) this.previewDialogVisible = true; this.previewDialogImageUrl = uploadFile.url; }, beforeDeiveceImgDialogclose() { this.deiveceImgDialog = false; }, - // 鏍囧噯鍖栧睘鎬у悕 - convertKeys(obj) { - // 灏嗕竴涓猨s瀵硅薄涓墍鏈塪i锛寃i锛宲i寮�澶寸殑灞炴�у叏閮ㄦ敼鎴愬幓鎺夎繖浜涘墠缂�骞朵笖閲嶆柊鍙樹负椹煎嘲寮忓懡鍚� - const newObj = {}; - for (const key in obj) { - 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; - }, - // 淇濆瓨鐘舵�佷俊鎭� - saveStatus(device, status) { - var _picUrl = $fysp.imgUrl + status.dlPicUrl; - device._picUrl = _picUrl; - status._picUrl = _picUrl; - if ('_statusList' in device) { - device._statusList.push(status); - } else { - device._statusList = Array.of(status); - } - // 鎺掑簭 - device._statusList.sort(function (x, y) { - return new Date(x.dlCreateTime) - new Date(y.dlCreateTime); // 闄嶅簭锛屽崌搴忓垯鍙嶄箣 - }); - }, - async getDeviceImgList() { - 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 = []; - - 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); - } - } - }) - .catch((err) => {}); - } - }); - } - }, initOptions() { + if (!this.problem || !this.subtask || !this.topTask) { + return; + } if (this.problem == undefined || this.problem == null) { this.deepCopyProblem = {}; } else { this.deepCopyProblem = useCloned(this.problem).cloned.value; this.currProTypeGuid = this.problem.guid; - this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advise; + this.deepCopyProblem.advice = this.deepCopyProblem.advise; + this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice; } this.type = 'guid' in this.deepCopyProblem ? 1 : 0; @@ -471,7 +409,7 @@ currDescription = currProName; this.problemTypeList.forEach((item) => { if (item.description == currDescription) { - this.proType = item.typename; + this.deepCopyProblem._proType = item.typename; } }); this.deepCopyProblem.description = currDescription; @@ -484,7 +422,7 @@ this.problemTypeList.forEach((item) => { if (item.description === currDescription) { - this.proType = item.typename; + this.deepCopyProblem._proType = item.typename; } }); this.deepCopyProblem.description = currDescription; @@ -531,6 +469,7 @@ } }, handleLedgerPicPhono(data) { + this.beforeLedgerPicDialogclose(); let isExist = false; for (const item of data) { for (const already of this.fileList) { @@ -572,8 +511,9 @@ // 榛樿闂鎻忚堪鍜岄棶棰樺缓璁负绗竴涓� this.currProTypeGuid = this.descriptionOptions[0].guid; this.deepCopyProblem.description = this.descriptionOptions[0].description; - this.deepCopyProblem.advise = this.adviseOptions[0].adName; - this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advise; + this.onProDesChange(this.deepCopyProblem.description); + this.deepCopyProblem.advice = this.adviseOptions[0].adName; + this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice; }, findProByProDesName(name) { let result; @@ -586,15 +526,15 @@ }, onProDesChange(value) { let currPro = this.findProByProDesName(value); - this.deepCopyProblem.advise = ''; this.currProTypeGuid = currPro.guid; // this.deepCopyProblem.description = currPro.description; this.changeProblemname(); - this.deepCopyProblem.advise = ''; - var adName = this.adviseOptions.length == 0 ? '' : this.adviseOptions[0].adName; - this.deepCopyProblem.advise = adName; + this.deepCopyProblem.advice = adName; + this.$nextTick(() => { + this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice; + }); }, onProLocationChange(value) { this.posList.forEach((item) => { @@ -620,70 +560,77 @@ } return true; }, - // TODO - validateForm() {}, + onCancel() { + this.$emit("cancel") + }, onSubmit() { - this.validateForm(); - // 鍥剧墖鏍¢獙 - if (!this.pictureValidate()) { - return; - } - // 鏁版嵁鍑嗗 - let deepCopyPro = useCloned(this.deepCopyProblem).cloned.value; - let data = new FormData(); - var picUrls = []; - this.fileList.forEach((item) => { - if (!('guid' in item)) { - // 鏂扮殑 - let exclude = false; - for (let index = 0; index < this.oldFileList.length; index++) { - const element = this.oldFileList[index]; - if (item.url == element.url) { - exclude = true; - break; + this.$refs.formRef.validate((valid) => { + if (valid && this.pictureValidate()) { + // 鏁版嵁鍑嗗 + let deepCopyPro = useCloned(this.deepCopyProblem).cloned.value; + let data = new FormData(); + var picUrls = []; + this.fileList.forEach((item) => { + if (!('guid' in item)) { + // 鏂扮殑 + let exclude = false; + for (let index = 0; index < this.oldFileList.length; index++) { + const element = this.oldFileList[index]; + if (item.url == element.url) { + exclude = true; + break; + } + } + if (!exclude) { + picUrls.push(item.url); + } + exclude = false; + // picUrls.push(item) } + }); + if (this.type == 1) { + let deleteImgCopy = this.deleteImg; + fileUtil.getImageFiles(picUrls, function (files) { + data.append('deleteImg', deleteImgCopy); + deepCopyPro.advise = deepCopyPro.advice; + delete deepCopyPro['advice']; + delete deepCopyPro['mediafileList']; + delete deepCopyPro['description']; + delete deepCopyPro['_adviseEdit']; + delete deepCopyPro['_proType']; + delete deepCopyPro['proType']; + data.append('problem', JSON.stringify(deepCopyPro)); + files.forEach((image) => { + data.append('images', image); + }); + problemApi.updateProblem(data).then((res) => {}); + }); + this.$emit('submit', false); + } else { + const deepCopySubTask = useCloned(this.subtask).cloned.value; + const that = this; + fileUtil.getImageFiles(picUrls, function (files) { + deepCopyPro.insGuid = deepCopySubTask.insGuid; + delete deepCopyPro['description']; + deepCopyPro.proName = deepCopyPro.problemname; + delete deepCopyPro['problemname']; + deepCopyPro.ptGuid = that.findProTypeByGuid( + that.currProTypeGuid + ).guid; + deepCopyPro.locationId = deepCopyPro.locationid; + delete deepCopyPro['locationid']; + delete deepCopyPro['_adviseEdit']; + delete deepCopyPro['_proType']; + data.append('problemVo', JSON.stringify(deepCopyPro)); + files.forEach((image) => { + data.append('images', image); + }); + problemApi.newProblem(data).then((res) => {}); + }); + this.$emit('submit', true); } - if (!exclude) { - picUrls.push(item.url); - } - exclude = false; - // picUrls.push(item) } }); - if (this.type == 1) { - let deleteImgCopy = this.deleteImg; - fileUtil.getImageFiles(picUrls, function (files) { - data.append('deleteImg', deleteImgCopy); - delete deepCopyPro['mediafileList']; - delete deepCopyPro['description']; - data.append('problem', JSON.stringify(deepCopyPro)); - files.forEach((image) => { - data.append('images', image); - }); - problemApi.updateProblem(data).then((res) => {}); - }); - } else { - const deepCopySubTask = useCloned(this.subtask).cloned.value; - const that = this; - fileUtil.getImageFiles(picUrls, function (files) { - 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.locationId = deepCopyPro.locationid; - delete deepCopyPro['locationid']; - data.append('problemVo', JSON.stringify(deepCopyPro)); - files.forEach((image) => { - data.append('images', image); - }); - problemApi.newProblem(data).then((res) => {}); - }); - } - this.$emit('submited', true); }, handleSelectedAnyPhono(data) { this.beforeAnyPhotoDialogclose(); @@ -753,10 +700,6 @@ }, beforeLedgerPicDialogclose() { this.ledgerPicDialog = false; - }, - - destoryMyself() { - this.$destroy(); } } }; @@ -778,7 +721,6 @@ .img-upload { margin-top: 30px; margin-bottom: 30px; - margin-left: 63px; } .row { width: 100%; @@ -792,6 +734,10 @@ height: 100%; } ::v-deep .el-upload--picture-card { - border: 0 !important; + display: none; +} +/* 闅愯棌el-upload涓婁紶鎴愬姛缁勪欢 */ +::v-deep .el-upload-list__item-status-label { + display: none !important; } </style> diff --git a/src/views/fysp/check/components/CompProblemCard.vue b/src/views/fysp/check/components/CompProblemCard.vue index 9ab31b5..d97b17b 100644 --- a/src/views/fysp/check/components/CompProblemCard.vue +++ b/src/views/fysp/check/components/CompProblemCard.vue @@ -93,13 +93,15 @@ >鍒犻櫎</el-button > <el-button + v-if="proStatus.name.indexOf('涓嶉�氳繃') != -1" type="danger" size="small" - @click="beforePro" + @click="revokePro" :disabled="proStatus.checkable" - >鎾ら攢</el-button + >鎾ら攢椹冲洖</el-button > <el-button + v-else type="warning" size="small" @click="rejectPro" @@ -107,6 +109,18 @@ >椹冲洖</el-button > <el-button + v-if=" + proStatus.name.indexOf('涓嶉�氳繃') == -1 && + proStatus.name.indexOf('閫氳繃') != -1 + " + type="danger" + size="small" + @click="revokePro" + :disabled="proStatus.checkable" + >鎾ら攢閫氳繃</el-button + > + <el-button + v-else type="success" size="small" @click="passPro" @@ -117,63 +131,39 @@ </el-col> </el-row> </el-card> - <div class="dialog-wrapper"> - <el-dialog - title="闂鏇存" - width="50%" - v-model="proAddOrUpdDialogVisible" - :before-close="proAddOrUpdDialogClose" - > - <CompProblemAddOrUpd - v-if="proAddOrUpdDialogVisible" - :problem="deepCopyPro" - :subtask="deepCopySubtask" - :topTask="deepCopyTopTask" - ref="compProblemAddOrUpdRef" - @submited="onProSubmited" - /> - </el-dialog> - </div> - <el-dialog width="80%" title="鏁存敼鎻愪氦" v-model="addChangeDialogVisible"> - <ComChangeEdit - :changeType="0" - v-if="addChangeDialogVisible" - :problemId="problem.guid" - :subtask="subtask" - :month="month" - @submited="onAddChangeSubmited" - /> - </el-dialog> - <el-dialog - width="50%" - title="鏁存敼妫�楠�" - v-model="changeEditDialogVisible" - :before-close="changeEditDialogClose" - > - <ComChangeEdit - :changeType="1" - v-if="changeEditDialogVisible" - :problemId="problem.guid" - :oldChangeFileList="problem.mediafileList" - :subtask="subtask" - :month="month" - @submited="onChangeSubmited" - /> - </el-dialog> + <CompProblemAddOrUpd + title="闂鏇存" + v-if="proAddOrUpdDialogVisible" + v-model:visible="proAddOrUpdDialogVisible" + :problem="deepCopyPro" + :subtask="subtask" + :topTask="topTask" + ref="compProblemAddOrUpdRef" + @cancel="onProCanceled" + @submit="onProSubmited" + /> + <!-- 鏁存敼 --> + <ComChangeEdit + :title="changeType == 1 ? '鏁存敼妫�楠�' : '鏁存敼鎻愪氦'" + v-if="changeDialogVisible" + v-model:visible="changeDialogVisible" + :changeType="changeType" + :problemId="problem.guid" + :subtask="subtask" + :month="month" + :oldChangeFileList="problem.mediafileList" + @cancel="onChangeCanceled" + @submit="onChangeSubmited" + /> <!-- 闂澶嶇幇 --> - <el-dialog - width="50%" + <CompProRecent title="闂澶嶇幇" - v-model="proRecentDialogVisible" - :before-close="proRecentDialogClose" - > - <CompProRecent - v-if="proRecentDialogVisible" - :subtask="subtask" - :topTask="topTask" - :problem="problem" - /> - </el-dialog> + v-if="proRecentDialogVisible" + v-model:visible="proRecentDialogVisible" + :subtask="subtask" + :topTask="topTask" + :problem="problem" + /> </template> <script> @@ -185,6 +175,7 @@ import CompProRecent from './CompProRecent.vue'; import { useCloned } from '@vueuse/core'; export default { + emits: ['submmit', 'cancel'], components: { CompProblemAddOrUpd, ComChangeEdit, @@ -221,9 +212,10 @@ default: 1 } }, - emits: ['submit'], data() { return { + changeDialogVisible: false, + changeType: -1, addChangeDialogVisible: false, // 杩戞湡鎯呭喌 proRecentDialogVisible: false, @@ -291,30 +283,19 @@ } }, methods: { - onAddChangeSubmited() { - this.$emit('updated', true); - this.addChangeDialogVisible = false; - }, - // 杩戞湡鎯呭喌寮圭獥鍏抽棴 - proRecentDialogClose() { - this.proRecentDialogVisible = false; - }, - newProblem() { - this.proAddOrUpdDialogVisible = true; + onProCanceled() { + this.proAddOrUpdDialogVisible = false; }, onProSubmited(isOk) { - this.$emit('updated', isOk); + this.$emit('submit', isOk); this.proAddOrUpdDialogVisible = false; + }, + onChangeCanceled() { + this.changeDialogVisible = false; }, onChangeSubmited(isOk) { - this.$emit('updated', isOk); - this.changeEditDialogVisible = false; - }, - proAddOrUpdDialogClose() { - this.proAddOrUpdDialogVisible = false; - }, - changeEditDialogClose() { - this.changeEditDialogVisible = false; + this.$emit('submit', isOk); + this.changeDialogVisible = false; }, deletePro() { useMessageBoxTip({ @@ -339,7 +320,7 @@ passPro() { this.checkPro(true); }, - beforePro() { + revokePro() { const pro = this.problem; let status = this.proStatus; let doneMsg; @@ -359,7 +340,6 @@ .checkProblem({ pId: pro.guid, action: action }) .then((res) => { if (res.success) { - pro.extension3 = status; this.$emit('submit', false); } }); @@ -381,20 +361,14 @@ .checkProblem({ pId: pro.guid, action: action }) .then((res) => { if (res.success) { - pro.extension3 = status; this.$emit('submit', false); } }); } }); }, - addChange() { - this.addChangeDialogVisible = true; - }, updatePro() { this.deepCopyPro = useCloned(this.problem).cloned.value; - this.deepCopySubtask = useCloned(this.subtask).cloned.value; - this.deepCopyTopTask = useCloned(this.topTask).cloned.value; this.$nextTick(() => { this.proAddOrUpdDialogVisible = true; }); @@ -414,10 +388,11 @@ updateChange() { this.getCurrentMouth(); if (!this.problem.ischanged) { - this.addChange(); + this.changeType = 0; } else { - this.changeEditDialogVisible = true; + this.changeType = 1; } + this.changeDialogVisible = true; }, currProRecent() { this.proRecentDialogVisible = true; -- Gitblit v1.9.3