From c1d2051abc8ca88cd07f0d7c56c0dbf8165d5c33 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 18 九月 2025 17:02:22 +0800 Subject: [PATCH] 2025.9.18 数据产品(待完成) --- src/views/fysp/check/components/ComChangeEdit.vue | 58 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/views/fysp/check/components/ComChangeEdit.vue b/src/views/fysp/check/components/ComChangeEdit.vue index 64703dd..b8b5b27 100644 --- a/src/views/fysp/check/components/ComChangeEdit.vue +++ b/src/views/fysp/check/components/ComChangeEdit.vue @@ -46,17 +46,19 @@ </el-col> </el-row> <div class="flex-div"> - <el-button type="primary" @click="onSubmit">淇濆瓨</el-button> + <el-button type="primary" @click="onSubmit" :loading="loading" + >淇濆瓨</el-button + > <el-button @click="onCancel">鍙栨秷</el-button> </div> <el-image-viewer - v-if="previewDialogVisible" - :url-list="fileList.map((item) => item.url)" - :initial-index="initialIndex" - @close="previewDialogVisible = false" - alt="棰勮" - class="preview-pic" - /> + v-if="previewDialogVisible" + :url-list="fileList.map((item) => item.url)" + :initial-index="initialIndex" + @close="previewDialogVisible = false" + alt="棰勮" + class="preview-pic" + /> </template> </CompGenericWrapper> </template> @@ -68,8 +70,7 @@ import { ElMessage } from 'element-plus'; export default { emits: ['submit', 'cancel'], - components: { - }, + components: {}, watch: { oldChangeFileList: { handler(nv, ov) { @@ -117,13 +118,15 @@ deleteImg: [], ledgerPicDialog: false, - anyPhotoDialog: false + anyPhotoDialog: false, + + loading: false }; }, mounted() {}, methods: { pictureValidate() { - if (this.changeType == 1 && this.fileList.length < 1) { + if (this.fileList.length < 1) { ElMessage({ message: '鑷冲皯涓婁紶涓�寮犲浘鐗�', type: 'error' @@ -161,12 +164,14 @@ this.oldFileList = useCloned(beforeEditImgList).cloned.value; }, onCancel() { - this.$emit("cancel") + this.$emit('cancel'); + this.$emit('update:visible', false); }, onSubmit() { if (!this.pictureValidate()) { return; } + this.loading = true; // 鏁版嵁鍑嗗 let data = new FormData(); var picUrls = []; @@ -189,28 +194,35 @@ } }); - const that = this; let deleteImgCopy = this.deleteImg; if (this.changeType == 1) { - fileUtil.getImageFiles(picUrls, function (files) { + fileUtil.getImageFiles(picUrls, (files) => { data.append('deleteImg', deleteImgCopy); - data.append('problemId', that.problemId); + data.append('problemId', this.problemId); files.forEach((image) => { data.append('images', image); }); - problemApi.updateChange(data).then((res) => {}); + problemApi + .updateChange(data) + .then((res) => { + this.$emit('submit', true); + }) + .finally(() => (this.loading = false)); }); - that.$emit('submit', true); } else { - fileUtil.getImageFiles(picUrls, function (files) { - data.append('problemId', that.problemId); + fileUtil.getImageFiles(picUrls, (files) => { + data.append('problemId', this.problemId); files.forEach((image) => { data.append('images', image); }); - problemApi.changeProblem(data).then((res) => {}); - that.$emit('submit', true); + problemApi + .changeProblem(data) + .then((res) => { + this.$emit('submit', true); + }) + .finally(() => (this.loading = false)); }); } }, @@ -221,7 +233,7 @@ } }, 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