+
@@ -136,6 +136,7 @@ import configs from "@/config"
const base_url = configs.baseUrl + configs.urlPrefix
import useUserStore from "@/stores/modules/user";
const userStore = useUserStore();
+const formDataannex = reactive([])
// 上传文件
const handleAvatarSuccess_four = (
response,
@@ -145,14 +146,14 @@ const handleAvatarSuccess_four = (
ElMessage.error(response.msg);
return;
}
- formData.annex.push(
+ formDataannex.push(
{ uri: response.data.uri, name: response.data.name }
);
};
// 删除上传的文件
const delFileFn = (index: number) => {
- formData.annex.splice(index, 1)
+ formDataannex.splice(index, 1)
}
//获取值
const customEvent = (e: any) => {
@@ -201,6 +202,17 @@ const setFormData = async (data: Record
) => {
matsname.value = data.project.person
project_name.value = data.project.name
project_code.value = data.project.project_code
+ if (data.annex && data.annex.length > 0) {
+
+ const arry1 = data.annex.map((item: any, index: any) => {
+ return {
+ name: `文件${index + 1}`,
+ uri: item
+ };
+ });
+ Object.assign(formDataannex, arry1)
+
+ }
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
@@ -221,6 +233,9 @@ const getDetail = async (row: Record) => {
// 提交按钮
const handleSubmit = async () => {
+ if (formDataannex.length > 0) {
+ formData.annex = JSON.stringify(formDataannex.map((item: any) => item.uri))
+ }
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
diff --git a/src/views/bidbbond/edit.vue b/src/views/bidbbond/edit.vue
index be40640..13d53f5 100644
--- a/src/views/bidbbond/edit.vue
+++ b/src/views/bidbbond/edit.vue
@@ -264,20 +264,15 @@ const formRules = reactive({
// 获取详情
const setFormData = async (data: Record) => {
if (data.annex && data.annex.length > 0) {
- if (data.annex.includes(",")) {
- const arry1 = data.annex.split(',').map((item: any, index: any) => {
- return {
- name: `文件${index + 1}`,
- uri: item
- };
- });
- Object.assign(formDataannex, arry1)
- } else {
- const arry1 = [{ name: `文件1`, uri: data.annex }]
- Object.assign(formDataannex, arry1)
- console.log(formDataannex)
- }
+ const arry1 = data.annex.map((item: any, index: any) => {
+ return {
+ name: `文件${index + 1}`,
+ uri: item
+ };
+ });
+ Object.assign(formDataannex, arry1)
+
}
@@ -309,8 +304,9 @@ const getDetail = async (row: Record) => {
// 提交按钮
const handleSubmit = async () => {
if (formDataannex.length > 0) {
- formData.annex = formDataannex.map((item: any) => item.uri).toString()
+ formData.annex = JSON.stringify(formDataannex.map((item: any) => item.uri))
}
+
console.log(formRef.value?.validate(), '22222222')
await formRef.value?.validate()
diff --git a/src/views/build/build_plan/detail.vue b/src/views/build/build_plan/detail.vue
index cb15d2f..accc901 100644
--- a/src/views/build/build_plan/detail.vue
+++ b/src/views/build/build_plan/detail.vue
@@ -1,7 +1,7 @@