From 07f9f8657d057a38792c3822acc9b08d83478967 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 07 五月 2026 14:23:10 +0800
Subject: [PATCH] 合并代码
---
src/views/projectManagement/projectType/components/ProjectTypeDialog.vue | 58 +++++++++-------------------------------------------------
1 files changed, 9 insertions(+), 49 deletions(-)
diff --git a/src/views/projectManagement/projectType/components/ProjectTypeDialog.vue b/src/views/projectManagement/projectType/components/ProjectTypeDialog.vue
index 2888516..bc1e196 100644
--- a/src/views/projectManagement/projectType/components/ProjectTypeDialog.vue
+++ b/src/views/projectManagement/projectType/components/ProjectTypeDialog.vue
@@ -29,24 +29,15 @@
style="width: 220px"
/>
</div>
+ </div>
+ <div class="base-info-row">
<div class="info-item">
<span class="item-label">闄勪欢</span>
- <el-upload
- v-if="isEdit"
- :action="uploadUrl"
- :headers="uploadHeaders"
- :on-success="handleUploadSuccess"
- :on-remove="handleRemove"
- v-model:file-list="uploadFileList"
- :limit="3"
- name="files"
- multiple
- >
- <el-button type="primary">涓婁紶闄勪欢</el-button>
- </el-upload>
+ <FileUpload v-if="isEdit" v-model:file-list="uploadFileList" />
<span v-else class="text-gray-400 text-sm">璇峰厛淇濆瓨鍚庡啀涓婁紶闄勪欢</span>
</div>
</div>
+
<!-- 姝ラ閰嶇疆琛ㄦ牸 -->
<p class="top-tip">璇锋寜鐓ч『搴忛厤缃」鐩樁娈碉紝鎷栨嫿<b>姝ラ</b>鎺掑簭鍗冲彲</p>
@@ -148,8 +139,8 @@
<template #footer>
<div class="dialog-footer">
- <el-button @click="visible = false">鍙栨秷</el-button>
<el-button type="primary" @click="submitForm">鎻愪氦</el-button>
+ <el-button @click="visible = false">鍙栨秷</el-button>
</div>
</template>
</el-dialog>
@@ -162,6 +153,7 @@
import { ElMessage, ElMessageBox } from 'element-plus';
import { getToken } from '@/utils/auth';
import Sortable from 'sortablejs';
+import FileUpload from "@/components/AttachmentUpload/file/index.vue";
const props = defineProps({
modelValue: Boolean,
@@ -175,16 +167,12 @@
const formRef = ref(null);
const userOptions = ref([]);
const isEdit = ref(false);
-const uploadHeaders = { Authorization: "Bearer " + getToken() };
-// 涓婁紶鍦板潃
-const uploadUrl = import.meta.env.VITE_APP_BASE_API + "/basic/customer-follow/upload";
let sortable = null;
const form = ref({
id: undefined,
name: '',
description: '',
- attachmentIds: [],
savePlanNodeList: []
});
const uploadFileList = ref([]);
@@ -204,11 +192,9 @@
id: props.data.id,
name: props.data.name,
description: props.data.description,
- attachmentIds: Array.isArray(props.data.attachmentIds)
- ? props.data.attachmentIds
- : (props.data.attachmentList || []).map(f => f.id).filter(Boolean),
savePlanNodeList: []
};
+ uploadFileList.value = props.data.storageBlobDTOs || [];
// 鍥炴樉姝ラ鑺傜偣
if (props.data.planNodeList && props.data.planNodeList.length > 0) {
@@ -279,7 +265,6 @@
id: undefined,
name: '',
description: '',
- attachmentIds: [],
savePlanNodeList: [createDefaultNode()]
};
uploadFileList.value = [];
@@ -306,29 +291,6 @@
if (user) {
row.leaderName = user.nickName;
}
-}
-
-/** 澶勭悊鏂囦欢涓婁紶鎴愬姛 */
-function handleUploadSuccess(response, file, fileList) {
- if (response.code === 200) {
- const newFile = response.data;
- const list = Array.isArray(newFile) ? newFile : [newFile];
- list.forEach(element => {
- const id = element?.id;
- if (id && !form.value.attachmentIds.includes(id)) {
- form.value.attachmentIds.push(id);
- }
- });
- } else {
- ElMessage.error(response.msg || '涓婁紶澶辫触');
- }
-}
-
-/** 澶勭悊鏂囦欢绉婚櫎 */
-function handleRemove(file) {
- const removedId = file?.id || file?.response?.data?.id;
- if (!removedId) return;
- form.value.attachmentIds = form.value.attachmentIds.filter(id => id !== removedId);
}
/** 娣诲姞姝ラ */
@@ -374,6 +336,7 @@
form.value.savePlanNodeList.forEach((node, index) => {
node.sort = index;
});
+ form.value.storageBlobDTOs = uploadFileList.value;
emit('submit', form.value);
}
} catch (error) {
@@ -457,10 +420,7 @@
}
.dialog-footer {
- display: flex;
- justify-content: flex-end;
- gap: 15px;
- padding-top: 10px;
+ text-align: center;
}
.top-tip {
--
Gitblit v1.9.3