From af5a8d80bca9b8c08543238a370ea3c70c8c59b1 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 21 十一月 2024 11:09:21 +0800 Subject: [PATCH] Merge branch 'hc-dataproduct-v1112' into lsf-dataproduct-1024 --- /dev/null | 190 --------------------------- src/views/fysp/check/components/ArbitraryPhoto.vue | 8 src/components/FYImageSelectDialog.vue | 100 ++++++++++---- src/components/CompGenericWrapper.vue | 52 +++++++ src/components.d.ts | 1 src/views/fysp/check/components/CompProblemAddOrUpd.vue | 41 ++++- src/views/fysp/check/components/CompProRecent.vue | 2 src/views/fysp/check/components/ComChangeEdit.vue | 2 src/views/fysp/check/components/CompDeviceShowTest.vue | 3 src/views/fysp/check/components/CompLedgerPhoto.vue | 5 src/views/fysp/check/components/CompDevicePhoto.vue | 5 11 files changed, 173 insertions(+), 236 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index 6228984..f302504 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -10,6 +10,7 @@ BaseContentLayout: typeof import('./components/core/BaseContentLayout.vue')['default'] BaseMap: typeof import('./components/map/BaseMap.vue')['default'] BasePanelLayout: typeof import('./components/core/BasePanelLayout.vue')['default'] + CompGenericWrapper: typeof import('./components/CompGenericWrapper.vue')['default'] CompQuickSet: typeof import('./components/search-option/CompQuickSet.vue')['default'] Content: typeof import('./components/core/Content.vue')['default'] ElAside: typeof import('element-plus/es')['ElAside'] diff --git a/src/components/CompGenericWrapper.vue b/src/components/CompGenericWrapper.vue new file mode 100644 index 0000000..2b038a6 --- /dev/null +++ b/src/components/CompGenericWrapper.vue @@ -0,0 +1,52 @@ +<template> + <!-- dialog鍖呰9 --> + <el-dialog v-if="currType == '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> + <!-- drawer鍖呰9 --> + <el-drawer v-if="currType == '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 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/components/FYImageSelectDialog.vue b/src/components/FYImageSelectDialog.vue index 99397d4..6816f4c 100644 --- a/src/components/FYImageSelectDialog.vue +++ b/src/components/FYImageSelectDialog.vue @@ -1,8 +1,8 @@ <template> <el-dialog :model-value="dialogVisible" - @opened="$emit('update:dialogVisible', true)" - @closed="$emit('update:dialogVisible', false)" + @opened="handleOpen" + @closed="handleClose" width="66%" destroy-on-close > @@ -40,14 +40,15 @@ class="imgs" > <el-image + v-loading="img.loading" v-for="(img, i) in typeImgMap.get(activeId)" :key="i" :class="[img.isSelect ? 'selected' : 'noActive', 'image']" fit="cover" :src="img.url" @click="onSelect(img, i)" - @load="onOneImgLoadSuccess" - @error="onOneImgLoadError" + @load="onOneImgLoadSuccess(img)" + @error="onOneImgLoadError(img)" /> </el-scrollbar> <el-row v-else justify="space-between"> @@ -58,7 +59,7 @@ </el-dialog> </template> <script setup> -import { ref, watch, computed } from 'vue'; +import { ref, watch, computed, onMounted, onUnmounted } from 'vue'; const props = defineProps({ dialogVisible: Boolean, @@ -108,10 +109,12 @@ loadedImgCount.value ); }); -function onOneImgLoadError(e) { +function onOneImgLoadError(img) { + img.loading = false loadedImgCount.value++; } -function onOneImgLoadSuccess(e) { +function onOneImgLoadSuccess(img) { + img.loading = false loadedImgCount.value++; } watch( @@ -148,7 +151,28 @@ img.isSelect = false; } } - +function handleOpen() { + // if (props.typeImgMap.get(activeId.value) == undefined) { + // return; + // } + // props.typeImgMap.get(activeId.value).forEach((i) => { + // if (i.isSelect == true) { + // return; + // } + // props.defaultFile.forEach((imgItem) => { + // if (imgItem.url == i.url) { + // i.isSelect = true; + // selectedImgUrlList.value.push(i); + // } + // }); + // }); + emit('update:dialogVisible', true) +} +function handleClose() { + selectedImgUrlList.value.forEach(item => item.isSelect = false) + selectedImgUrlList.value = [] + emit('update:dialogVisible', false) +} function handleSubmit() { emit('submit', selectedImgUrlList.value); emit('update:dialogVisible', false); @@ -168,27 +192,47 @@ }, { immediate: true } ); +// watch( +// () => props.defaultFile, +// (nV, oV) => { +// if (props.typeImgMap.get(activeId.value) == undefined) { +// return; +// } +// props.typeImgMap.get(activeId.value).forEach((i) => { +// if (i.isSelect == true) { +// return; +// } +// nV.forEach((imgItem) => { +// if (imgItem.url == i.url) { +// i.isSelect = true; +// selectedImgUrlList.value.push(i); +// } +// }); +// }); +// }, +// { deep: true, immediate: true } +// ); -watch( - () => props.typeImgMap, - (newMap, oldMap) => { - if (newMap.get(activeId.value) == undefined) { - return; - } - newMap.get(activeId.value).forEach((i) => { - if (i.isSelect == true) { - return; - } - props.defaultFile.forEach((imgItem) => { - if (imgItem.url == i.url) { - i.isSelect = true; - selectedImgUrlList.value.push(i); - } - }); - }); - }, - { deep: true, immediate: true } -); +// watch( +// () => props.typeImgMap, +// (newMap, oldMap) => { +// if (newMap.get(activeId.value) == undefined) { +// return; +// } +// newMap.get(activeId.value).forEach((i) => { +// if (i.isSelect == true) { +// return; +// } +// props.defaultFile.forEach((imgItem) => { +// if (imgItem.url == i.url) { +// i.isSelect = true; +// selectedImgUrlList.value.push(i); +// } +// }); +// }); +// }, +// { immediate: true } +// ); </script> <style scoped> .center { diff --git a/src/views/fysp/check/components/ArbitraryPhoto.vue b/src/views/fysp/check/components/ArbitraryPhoto.vue index 4593d21..52034e9 100644 --- a/src/views/fysp/check/components/ArbitraryPhoto.vue +++ b/src/views/fysp/check/components/ArbitraryPhoto.vue @@ -1,5 +1,6 @@ <template> <FYImageSelectDialog + v-loading="loading" title="鍦烘櫙鍥剧墖" :typeList="typesList" :typeImgMap="typesMap" @@ -19,7 +20,8 @@ return { // 鏃犳暟鎹� typesList: [], - typesMap: new Map() + typesMap: new Map(), + loading: true, }; }, mounted() { @@ -29,6 +31,7 @@ // 鍥剧墖鍒嗙被 getGroupImgs() { mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => { + this.loading = true let typeList = []; let typeMap = new Map(); const data = res.data; @@ -52,9 +55,10 @@ } this.typesList = typeList; this.typesMap = typeMap; - }); + }).finally(() => (this.loading = false)); } } }; </script> <style scoped></style> + \ No newline at end of file diff --git a/src/views/fysp/check/components/ComChangeEdit.vue b/src/views/fysp/check/components/ComChangeEdit.vue index 293da55..64703dd 100644 --- a/src/views/fysp/check/components/ComChangeEdit.vue +++ b/src/views/fysp/check/components/ComChangeEdit.vue @@ -62,7 +62,6 @@ </template> <script> 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'; @@ -70,7 +69,6 @@ export default { emits: ['submit', 'cancel'], components: { - CompGenericWrapper }, watch: { oldChangeFileList: { diff --git a/src/views/fysp/check/components/CompDevicePhono.vue b/src/views/fysp/check/components/CompDevicePhono.vue deleted file mode 100644 index d1871fe..0000000 --- a/src/views/fysp/check/components/CompDevicePhono.vue +++ /dev/null @@ -1,262 +0,0 @@ -<template> - <div class="main"> - <div class="filters" v-if="false"> - <el-select - v-for="(key_select, index_select) of filters.keys()" - :placeholder="key_select.text" - > - <el-option - v-for="(key_option, index_option) in filters.get(key_select.key)" - :key="key_option.key" - :value="key_option.value" - :label="key_option.label" - > - </el-option> - </el-select> - </div> - <div class="btns" v-if="!readonly"> - <el-button size="small" type="primary" @click="sendSelectedImg(true)">纭畾</el-button> - <el-button size="small" type="primary" @click="sendSelectedImg(false)">鍙栨秷</el-button> - </div> - - <div class="center"> - <el-descriptions> - <el-descriptions-item label="鎬绘暟"> - <span>{{ this.imgPathsDataSourceCopy.length }}</span> - </el-descriptions-item> - </el-descriptions> - <el-tabs v-model="activeId" type="card"> - <el-tab-pane v-for="item in typeList" :label="item.label" :name="item.id"> </el-tab-pane> - </el-tabs> - <el-empty v-if="imgObjList.length == 0" description="鏆傛棤璁板綍" /> - <el-scrollbar v-else class="imgs"> - <el-image - v-for="(img, i) in imgObjList" - :class="[Boolean(img.isSelect) ? 'selected' : 'noActive', 'image']" - fit="cover" - :src="img._picUrl" - lazy - @click="onSelect(img, i)" - /> - </el-scrollbar> - </div> - </div> -</template> -<script> -import problemApi from '@/api/fysp/problemApi.js'; -import mediafileApi from '@/api/fysp/mediafileApi.js'; -import { $fysp } from '@/api/index.js'; -import { useCloned } from '@vueuse/core'; -export default { - props: { - filters: Map, - // 鏄惁浠ュ彧璇荤殑褰㈠紡鏌ョ湅褰撳墠椤甸潰 - readonly: { - type: Boolean, - default: false - }, - imgPathsDataSource: { - type: Array, - default: () => [] - }, - defaultFile: { - type: Array, - default: () => [] - } - }, - data() { - return { - // 鏃犳暟鎹� - isEmpty: false, - isClose: false, - isAll: false, - activeId: 0, - typeList: [ - { id: 0, label: '鐩戞帶璁惧' }, - { id: 1, label: '娌荤悊璁惧' }, - { id: 2, label: '鐢熶骇璁惧' } - ], - typeImgMap: new Map(), - imgPathsDataSourceCopy: [], - imgObjList: [] - }; - }, - watch: { - activeId: { - handler(newId, oldId) { - this.filterImgList() - }, - immediate: true - } - }, - mounted() { - this.initImgUrlList(); - }, - methods: { - filterImgList() { - this.imgObjList = this.imgPathsDataSourceCopy.filter((item) => { - return item.topTypeId == this.activeId; - }); - }, - initDefaultFile() { - for (let item of this.imgPathsDataSourceCopy) { - for (let defaultItem of this.defaultFile) { - if (item._picUrl == defaultItem.url) { - item.isSelect = true; - } - } - } - }, - // 鑾峰彇鍥剧墖璧勬簮 - initImgUrlList() { - this.imgPathsDataSourceCopy = useCloned(this.imgPathsDataSource).cloned.value; - this.imgObjList = this.imgPathsDataSourceCopy; - this.initDefaultFile(); - - this.initSelectedTab(); - }, - // 鍒濆鍖栧垰寮�濮嬮�変腑鐨勬爣绛� - initSelectedTab() { - if (this.typeList.length > 0) { - this.activeId = this.typeList[0].id; - } - this.filterImgList() - }, - onSelect(img, i) { - // if (i == 2 && !this.isAll) { - // this.getAllImgList(); - // this.isAll = true; - // } else { - // if (this.readonly) { - // return; - // } - // img.isSelect = !Boolean(img.isSelect); - // } - - if (this.readonly) { - return; - } - img.isSelect = !img.isSelect; - }, - sendSelectedImg(isOk) { - let result = []; - if (!isOk) { - this.$emit('selectPhonoEvent', result); - } - for (const item of this.imgPathsDataSourceCopy) { - if (item.isSelect == true) { - result.push(item); - } - } - this.isClose = true; - this.$emit('selectPhonoEvent', result); - } - } -}; -</script> -<style scoped> -.center { - display: flex; - flex-direction: column; - align-items: center; -} -.text { - padding: 20px; -} - -.main { - margin: 0 auto; /* 浣跨埗鍏冪礌灞呬腑 */ - height: 100%; - width: 100%; -} - -.btns { - /* height: 10%; */ -} -/* - .img_types { - margin: 0 auto; - height: 440px; - width: 900px; - flex-grow: 1; - overflow-y: hidden ; - padding: 3%; - flex-wrap: wrap; - overflow: hidden; - } */ - -.imgs { - height: 50vh; - width: 90%; - min-height: 100px !important; - /* border-style:solid; - border-radius: 1px; */ - /* height: 100%; */ - flex-grow: 1 !important; - overflow-y: auto !important; - /* 鍐呭鐨勫唴杈硅窛 */ - display: flex !important; - flex-wrap: wrap !important; - /* overflow: hidden; */ -} - -.image { - height: 210px; - width: 200px; - border-radius: 4px; -} - -.active { - padding: 5px; - width: 20%; - height: 200px; - border: 0.5rem outset rgb(52, 155, 4); -} - -.selected { - padding: 5px; - color: #4abe84; - box-shadow: 0 2px 7px 0 rgba(85, 110, 97, 0.35); - border: 1px solid rgba(74, 190, 132, 1); -} - -.selected:before { - content: ''; - position: absolute; - right: 0; - bottom: 0; - border: 17px solid #4abe84; - border-top-color: transparent; - border-left-color: transparent; -} - -.selected:after { - content: ''; - width: 5px; - height: 12px; - position: absolute; - right: 6px; - bottom: 6px; - border: 2px solid #fff; - border-top-color: transparent; - border-left-color: transparent; - transform: rotate(45deg); -} - -.noActive { - padding: 5px; -} - -.blurry { - filter: blur(3px); -} -.filters { - display: flex; - padding: 5px; -} - -::v-deep .el-dialog__body { - height: 60vh; - padding: 10px calc(var(--el-dialog-padding-primary) + 10px) !important; -} -</style> diff --git a/src/views/fysp/check/components/CompDevicePhoto.vue b/src/views/fysp/check/components/CompDevicePhoto.vue index 2fa8a10..275e866 100644 --- a/src/views/fysp/check/components/CompDevicePhoto.vue +++ b/src/views/fysp/check/components/CompDevicePhoto.vue @@ -1,5 +1,6 @@ <template> <FYImageSelectDialog + v-loading="loading" title="璁惧鍥剧墖" :typeList="typeList" :typeImgMap="typeImgMap" @@ -10,6 +11,7 @@ import deviceApi from '@/api/fysp/deviceApi'; import { useCloned } from '@vueuse/core'; import { $fysp } from '@/api/index.js'; +const loading = ref(true) const props = defineProps({ // 灞曠ず妯″紡 mode: { @@ -64,6 +66,7 @@ const topTypeId = deviceTopTypeElement.typeId; deviceImgMap.set(topTypeId, []); deviceApi.fetchDevices(props.subtask.sceneId, topTypeId).then((result) => { + loading.value = true; // 鏍囧噯鍖栧睘鎬у悕 for (let i = 0; i < result.data.length; i++) { var element = convertKeys(result.data[i]); @@ -92,7 +95,7 @@ deviceImgMap.get(topTypeId).push(newDevice); } } - }); + }).finally(() => (loading.value = false)); } }); } diff --git a/src/views/fysp/check/components/CompDeviceShow.vue b/src/views/fysp/check/components/CompDeviceShow.vue deleted file mode 100644 index b7e36d7..0000000 --- a/src/views/fysp/check/components/CompDeviceShow.vue +++ /dev/null @@ -1,233 +0,0 @@ -<template> - <div class="main"> - <!-- 閫夐」 --> - <!-- 璁惧绫诲瀷 --> - <el-row> - <el-col> - <span>璁惧绫诲瀷锛�</span> - </el-col> - <el-col> - <el-tabs class="child_select" placeholder="璁惧绫诲瀷" v-model="currSelect.deviceTypeId"> - <el-tab-pane v-for="item in deviceTypes" :name="item.id" :label="item.label" /> - </el-tabs> - </el-col> - </el-row> - <!-- 璁惧灞曠ず --> - <div class="devices"> - <el-card class="layout" shadow="hover" v-for="item of cardData"> - <div class="table-row"> - <span class="table-cell">绔欑偣: {{ item.diName || item.piName || item.wiName }}</span> - <span class="table-cell" - >渚涘簲鍟�: {{ item.diSupplier || item.piSupplier || item.wiSupplier }}</span - > - </div> - <div class="table-row"> - <span class="table-cell" - >杩愮淮鍟�: {{ item.diMaintainer || item.piMaintainer || item.wiMaintainer }}</span - > - <span class="table-cell" - >杩愮淮棰戞: - {{ - maintainFrequencysMap.get( - item.diMaintainFrequency || item.piMaintainFrequency || item.wiMaintainFrequency - ) - }}</span - > - </div> - <div class="table-row"> - <span class="table-cell" - >杩愮淮浜哄憳: - {{ item.diMaintainStaff || item.piMaintainStaff || item.wiMaintainStaff }}</span - > - <span class="table-cell" - >杩愮淮鑱旂郴鏂瑰紡: - {{ item.diMaintainTel || item.piMaintainTel || item.wiMaintainTel }}</span - > - </div> - <div class="table-row"> - <span class="table-cell" - >鍝佺墝鍨嬪彿: {{ item.diBrandModel || item.piBrandModel || item.wiBrandModel }}</span - > - <span class="table-cell" - >杩愯鐘舵��: - {{ - runStatusMap.get(item.diRunningStatus || item.piRunningStatus || item.wiRunningStatus) - }} - </span> - </div> - <div class="table-row"> - <span class="table-cell" - >浣嶇疆: {{ item.dlLocation || item.piLocation || item.wiLocation }}</span - > - <!-- The second cell is empty to maintain the two-field per row layout --> - <span class="table-cell"></span> - </div> - <el-image - class="pic-style" - :src="item.picUrl" - fit="cover" - :preview-src-list="Array.of(item.picUrl)" - /> - </el-card> - <!-- 鏁版嵁涓虹┖鏃� --> - <div class="empty" v-if="isEmpty"> - <h3>鏆傛棤鏁版嵁</h3> - </div> - </div> - </div> -</template> -<script> -import deviceApi from '@/api/fysp/deviceApi'; -import { $fysp } from '@/api/index'; -export default { - props: {}, - mounted() {}, - watch: { - // 閫夋嫨鏀瑰彉鐩戝惉 - currSelect: { - handler(newObj, oldObj) { - this.getList(); - }, - deep: true - } - }, - data() { - return { - // 鏃犳暟鎹� - isEmpty: false, - // 鍙屽悜缁戝畾 - currSelect: { - deviceTypeId: 0 - }, - // 鍦烘櫙绫诲瀷 - sceneType: '', - // 鍦烘櫙id - sceneId: null, - // 閫夐」 - scenes: [], - // 鏍规嵁鍦烘櫙绫诲瀷鍐冲畾鐨勮澶囩被鍨� - iDevTypes: [ - - ], - deviceTypes: [ - { id: 0, label: '鐩戞帶' }, - { id: 1, label: '娌荤悊' }, - { id: 2, label: '鐢熶骇' } - ], - // 鏁版嵁 - cardData: [], - // 杩愯鐘舵�� - runStatusMap: new Map( - [ - { key: 0, value: '鏈仈缃�' }, - { key: 1, value: '涓婄嚎涓�' }, - { key: 2, value: '涓嬬嚎' }, - { key: 3, value: '鎷嗛櫎' } - ].map((item) => [item.key, item.value]) - ), - - // 缁存姢棰戠巼鐘舵�� - maintainFrequencysMap: new Map( - [ - { key: '1', value: '姣忔湀涓�娆�' }, - { key: '2', value: '姣忓搴︿竴娆�' }, - { key: '3', value: '姣忓崐骞翠竴娆�' }, - { key: '4', value: '姣忓勾涓�娆�' } - ].map((item) => [item.key, item.value]) - ) - }; - }, - methods: { - // 鐖剁粍浠朵富鍔ㄤ紶鍊� - init(scene) { - this.sceneId = scene.guid; - this.sceneType = scene.type; - this.iDevTypes = dataMonitorDeviceTypeJs.monitorDevices(this.sceneType) - this.getList(); - }, - isShowEmpty(data) { - if (data.length == 0) { - this.isEmpty = true; - return true; - } else { - this.isEmpty = false; - return false; - } - }, - // 閲嶇疆灞曠ず鐨勬暟鎹� - initList() { - this.tableData = []; - }, - // 瀛楁鍚嶆嫤鎴櫒 - propNameConvert(obj, name) { - name = String(name).substring(1) - return obj['d'+name] || obj['p'+name] || obj['w'+name] - }, - getList() { - this.initList(); - var devicesInfoList = []; - deviceApi.fetchDevices(this.sceneId, this.currSelect.deviceTypeId).then((result) => { - devicesInfoList = result.data; - this.cardData = []; - if (this.isShowEmpty(devicesInfoList)) { - return; - } - if (devicesInfoList) { - devicesInfoList.forEach((e) => { - let data = { - deviceId: this.propNameConvert(e, 'diId'), - sceneId: this.propNameConvert(e, 'diSceneGuid'), - deviceTypeId: this.currSelect.deviceTypeId - }; - deviceApi - .fetchDeviceStatus(data) - .then((status) => { - var statusData = status.data; - if (statusData && statusData instanceof Array) { - if (statusData.length == 0) { - this.cardData.push(e); - return; - } - statusData.forEach((imgItem) => { - e.picUrl = $fysp.imgUrl + imgItem.dlPicUrl; - e.dlLocation = imgItem.dlLocation; - this.cardData.push(e); - }); - } - }) - .catch((err) => {}); - }); - } - }); - } - } -}; -</script> -<style scoped> -.selects { - display: flex; -} -.child_select { - margin-right: 10px; -} -.table-row { - display: flex; - justify-content: space-between; -} -.table-cell { - flex-basis: calc(50% - 10px); /* Adjust the width and margin as needed */ - border: 1px solid #ddd; /* Add border to mimic table cell */ - padding: 8px; - text-align: center; -} -.pic-style { - margin-top: 10px; - width: 100%; - height: 400px; -} -.empty { - display: flex; - align-items: center; - justify-content: center; -} -</style> diff --git a/src/views/fysp/check/components/CompDeviceShowTest.vue b/src/views/fysp/check/components/CompDeviceShowTest.vue index 7011936..1daa0e4 100644 --- a/src/views/fysp/check/components/CompDeviceShowTest.vue +++ b/src/views/fysp/check/components/CompDeviceShowTest.vue @@ -168,12 +168,11 @@ </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: { CompGenericWrapper }, + components: { }, watch: { // 閫夋嫨鏀瑰彉鐩戝惉 currSelect: { diff --git a/src/views/fysp/check/components/CompGenericWrapper.vue b/src/views/fysp/check/components/CompGenericWrapper.vue deleted file mode 100644 index 586c837..0000000 --- a/src/views/fysp/check/components/CompGenericWrapper.vue +++ /dev/null @@ -1,67 +0,0 @@ -<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 c42b372..79f5d31 100644 --- a/src/views/fysp/check/components/CompLedgerPhoto.vue +++ b/src/views/fysp/check/components/CompLedgerPhoto.vue @@ -1,5 +1,6 @@ <template> <FYImageSelectDialog + v-loading="loading" title="鍙拌处鍥剧墖" :typeList="typeList" :typeImgMap="typeImgMap" @@ -11,6 +12,7 @@ import userApi from '@/api/fysp/userApi.js'; import { svToTz } from '@/enum/scene'; import { $fytz } from '@/api/index'; +const loading = ref(true) const props = defineProps({ // 灞曠ず妯″紡 mode: { @@ -26,6 +28,7 @@ const typeImgMap = ref(new Map()); function getList() { userApi.getTzId(props.subtask.sceneId).then((res) => { + loading.value = true let tzUserId = res.tzUserId; problemApiFytz @@ -61,7 +64,7 @@ typeImgMap.value.get(type.typeId).push(item); }); } - }); + }).finally(() => loading.value = false); }); } function getMonth() { diff --git a/src/views/fysp/check/components/CompLedgerPic.vue b/src/views/fysp/check/components/CompLedgerPic.vue deleted file mode 100644 index 3c5e154..0000000 --- a/src/views/fysp/check/components/CompLedgerPic.vue +++ /dev/null @@ -1,190 +0,0 @@ -<template> - <div> - <div class="btns" v-if="!readonly"> - <el-button size="small" type="primary" @click="sendSelectedImg(true)">纭畾</el-button> - <el-button size="small" type="primary" @click="sendSelectedImg(false)">鍙栨秷</el-button> - </div> - <div class="center"> - <el-descriptions> - <el-descriptions-item label="鎬绘暟"> - <span>{{ this.imgListAll.length }}</span> - </el-descriptions-item> - </el-descriptions> - <el-tabs v-model="activeName" type="card"> - <el-tab-pane v-for="item in typeList" :label="item" :name="item"> </el-tab-pane> - </el-tabs> - <el-empty v-if="imgList.length == 0" description="鏆傛棤璁板綍" /> - <div class="imgs"> - <el-image - v-for="(img, i) in imgList" - :class="[Boolean(img.isSelect) ? 'selected' : 'noActive', 'image']" - fit="cover" - :src="img._picPath" - lazy - @click="onSelect(img)" - /> - </div> - </div> - </div> -</template> -<script> -import problemApiFytz from '@/api/fytz/problemApi.js'; -import userApi from '@/api/fysp/userApi.js'; -import { svToTz } from '@/enum/scene'; -import { $fytz } from '@/api/index'; -import { useCloned } from '@vueuse/core'; -export default { - watch: { - activeName: { - handler(newObj, oldObj) { - this.imgList = this.imgListAll.filter((item) => { - return item.ledgerType == newObj; - }); - }, - immediate: true - } - }, - props: { - month: Number, - subtask: Object - }, - computed: { - currImgList() { - return this.imgList.filter((item) => item.ledgerType == this.activeName); - } - }, - mounted() { - this.getList(); - }, - methods: { - getList() { - userApi.getTzId(this.subtask.sceneId).then((res) => { - this.isEmpty = false; - this.tzUserId = res.tzUserId; - - problemApiFytz - .getLedgerPic({ - tzUserId: this.tzUserId, - sceneType: svToTz(this.subtask.sceneTypeId).value, - time: this.month - }) - .then((res) => { - let data = res; - this.imgListAll = data; - if (this.imgListAll.length === 0) { - this.isEmpty = true; - } - if (this.imgListAll && this.imgListAll.length > 0) { - this.imgListAll.forEach((item) => { - item._picPath = $fytz.imgUrl + item.path1; - if (this.typeList.indexOf(item.ledgerType) == -1) { - this.typeList.push(item.ledgerType); - } - }); - this.activeName = this.typeList[0]; - } - }); - }); - }, - handleClick(tab, event) { - this.activeName = tab.label; - }, - onSelect(img) { - img.isSelect = !Boolean(img.isSelect); - }, - sendSelectedImg(isOk) { - let result = []; - if (!Boolean(isOk)) { - this.$emit('selectByLedgerPicEvent', result); - } - for (const item in this.imgList) { - if (item.isSelect == true) { - result.push(item); - } - } - this.$emit('selectByLedgerPicEvent', result); - } - }, - data() { - return { - tzUserId: null, - imgList: [], - imgListAll: [], - typeList: [], - isEmpty: false, - activeName: '' - }; - } -}; -</script> -<style scoped> -.imgs { - /* height: 650px; */ - width: 90%; - min-height: 100px !important; - /* border-style:solid; - border-radius: 1px; */ - /* height: 100%; */ - flex-grow: 1 !important; - overflow-y: auto !important; - /* 鍐呭鐨勫唴杈硅窛 */ - display: flex !important; - flex-wrap: wrap !important; - /* overflow: hidden; */ -} - -.image { - height: 210px; - width: 200px; - border-radius: 4px; -} - -.active { - padding: 5px; - width: 20%; - height: 200px; - border: 0.5rem outset rgb(52, 155, 4); -} - -.selected { - padding: 5px; - color: #4abe84; - box-shadow: 0 2px 7px 0 rgba(85, 110, 97, 0.35); - border: 1px solid rgba(74, 190, 132, 1); -} - -.selected:before { - content: ''; - position: absolute; - right: 0; - bottom: 0; - border: 17px solid #4abe84; - border-top-color: transparent; - border-left-color: transparent; -} - -.selected:after { - content: ''; - width: 5px; - height: 12px; - position: absolute; - right: 6px; - bottom: 6px; - border: 2px solid #fff; - border-top-color: transparent; - border-left-color: transparent; - transform: rotate(45deg); -} - -.noActive { - padding: 5px; -} -.btns { - /* height: 10%; */ -} -.center { - display: flex; - flex-direction: column; - align-items: center; -} -</style> diff --git a/src/views/fysp/check/components/CompProRecent.vue b/src/views/fysp/check/components/CompProRecent.vue index 8d31232..930bbbb 100644 --- a/src/views/fysp/check/components/CompProRecent.vue +++ b/src/views/fysp/check/components/CompProRecent.vue @@ -55,7 +55,6 @@ </CompGenericWrapper> </template> <script> -import CompGenericWrapper from './CompGenericWrapper.vue'; import CompProblemAddOrUpd from './CompProblemAddOrUpd.vue'; import taskApi from '@/api/fysp/taskApi'; import { useCloned } from '@vueuse/core'; @@ -99,7 +98,6 @@ }, components: { CompProblemAddOrUpd, - CompGenericWrapper }, mounted() {}, data() { diff --git a/src/views/fysp/check/components/CompProblemAddOrUpd.vue b/src/views/fysp/check/components/CompProblemAddOrUpd.vue index 2f58db3..1200e69 100644 --- a/src/views/fysp/check/components/CompProblemAddOrUpd.vue +++ b/src/views/fysp/check/components/CompProblemAddOrUpd.vue @@ -214,7 +214,6 @@ </CompGenericWrapper> </template> <script> -import CompGenericWrapper from './CompGenericWrapper.vue'; import ArbitraryPhoto from './ArbitraryPhoto.vue'; import CompLedgerPhoto from './CompLedgerPhoto.vue'; import CompDevicePhoto from './CompDevicePhoto.vue'; @@ -232,7 +231,6 @@ ArbitraryPhoto, CompDevicePhoto, CompLedgerPhoto, - CompGenericWrapper }, props: { readonly: { @@ -263,6 +261,8 @@ }, data() { return { + // fixme 2024.11.20 瀛愮粍浠跺垵濮嬪寲鏃舵満闂 + initPropsCount: 0, // 鍒濆棰勮鍥剧墖index initialIndex: -1, // 鍥剧墖閫夋嫨鏈�澶ф暟閲� @@ -327,10 +327,37 @@ }, deep: true }, + initPropsCount: { + handler(nv, ov) { + if (nv >= 3) { + this.initOptions(); + } + }, + immediate: true + }, problem: { handler(nv, ov) { - this.initOptions(); - } + if (nv != null && nv != undefined) { + this.initPropsCount++; + } + }, + immediate: true + }, + topTask: { + handler(nv, ov) { + if (nv != null && nv != undefined) { + this.initPropsCount++; + } + }, + immediate: true + }, + subtask: { + handler(nv, ov) { + if (nv != null && nv != undefined) { + this.initPropsCount++; + } + }, + immediate: true } }, computed: { @@ -362,15 +389,13 @@ return array; } }, - mounted() { - this.initOptions(); - }, + mounted() {}, methods: { onProAdviseChange(value) { this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice; }, handlePictureCardPreview(uploadFile) { - this.initialIndex = this.fileList.indexOf(uploadFile) + this.initialIndex = this.fileList.indexOf(uploadFile); this.previewDialogVisible = true; this.previewDialogImageUrl = uploadFile.url; }, -- Gitblit v1.9.3