From f19e5267cc23b1c714dc746239864f33ed715dd9 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 05 十二月 2025 17:55:02 +0800
Subject: [PATCH] 完成地图制作任务功能初版
---
src/views/fysp/check/components/ComChangeEdit.vue | 73 +++++++++++++++++++++---------------
1 files changed, 43 insertions(+), 30 deletions(-)
diff --git a/src/views/fysp/check/components/ComChangeEdit.vue b/src/views/fysp/check/components/ComChangeEdit.vue
index 1ae4e56..b8be328 100644
--- a/src/views/fysp/check/components/ComChangeEdit.vue
+++ b/src/views/fysp/check/components/ComChangeEdit.vue
@@ -46,32 +46,31 @@
</el-col>
</el-row>
<div class="flex-div">
- <el-button type="primary" @click="onSubmit">淇濆瓨</el-button>
- <el-button @click="$emit('submit', false)">鍙栨秷</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>
<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';
import { ElMessage } from 'element-plus';
export default {
- emits: ['submit'],
- components: {
- CompGenericWrapper
- },
+ emits: ['submit', 'cancel'],
+ components: {},
watch: {
oldChangeFileList: {
handler(nv, ov) {
@@ -119,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'
@@ -162,10 +163,15 @@
this.fileList = useCloned(beforeEditImgList).cloned.value;
this.oldFileList = useCloned(beforeEditImgList).cloned.value;
},
+ onCancel() {
+ this.$emit('cancel');
+ this.$emit('update:visible', false);
+ },
onSubmit() {
if (!this.pictureValidate()) {
return;
}
+ this.loading = true;
// 鏁版嵁鍑嗗
let data = new FormData();
var picUrls = [];
@@ -188,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));
});
}
},
@@ -220,7 +233,7 @@
}
},
handlePictureCardPreview(uploadFile) {
- this.initialIndex = this.fileList.indexOf(uploadFile)
+ this.initialIndex = this.fileList.indexOf(uploadFile);
this.previewDialogVisible = true;
this.previewDialogImageUrl = uploadFile.url;
},
@@ -250,10 +263,10 @@
margin-bottom: 30px;
margin-left: 63px;
}
-::v-deep .el-dialog__body {
+:deep(.el-dialog__body) {
width: 95%;
}
-::v-deep .el-upload-list--picture-card .el-upload-list__item-thumbnail {
+:deep(.el-upload-list--picture-card .el-upload-list__item-thumbnail) {
object-fit: cover !important;
}
.preview-pic {
@@ -261,11 +274,11 @@
width: 100%;
height: 100%;
}
-::v-deep .el-upload--picture-card {
+:deep(.el-upload--picture-card) {
display: none;
}
/* 闅愯棌el-upload涓婁紶鎴愬姛缁勪欢 */
-::v-deep .el-upload-list__item-status-label {
+:deep(.el-upload-list__item-status-label) {
display: none !important;
}
</style>
--
Gitblit v1.9.3