From f11419776141fb6de9b1fac2c4d5e2baae7521f7 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Fri, 22 Mar 2024 11:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=B6=E6=98=93=E6=8D=9F=E4=BB=B6?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E6=8C=87=E5=AF=BC=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UploadFile/src/UploadImg.vue | 1 + src/views/eam/device/problemSolving/index.vue | 11 ----------- src/views/eam/item/replaceItemDes/index.vue | 11 +++++++++-- .../item/replaceItemDes/replaceItemDes.data.ts | 17 ++++++++++++++++- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/components/UploadFile/src/UploadImg.vue b/src/components/UploadFile/src/UploadImg.vue index 31571e2..11b71a9 100644 --- a/src/components/UploadFile/src/UploadImg.vue +++ b/src/components/UploadFile/src/UploadImg.vue @@ -84,6 +84,7 @@ const props = defineProps({ width: propTypes.string.def('150px'), // 组件宽度 ==> 非必传(默认为 150px) borderradius: propTypes.string.def('8px') // 组件边框圆角 ==> 非必传(默认为 8px) }) +debugger const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 // 生成组件唯一id diff --git a/src/views/eam/device/problemSolving/index.vue b/src/views/eam/device/problemSolving/index.vue index bc88d44..6b6570a 100644 --- a/src/views/eam/device/problemSolving/index.vue +++ b/src/views/eam/device/problemSolving/index.vue @@ -176,17 +176,6 @@ const openForm = (type: string, row?: any) => { // form表单提交 const formsSuccess = async (formType, data) => { - var isHave = ProblemSolving.allSchemas.formSchema.some(function (item) { - return item.field === 'activeTime' || item.field === 'expireTime' - }) - if (isHave) { - if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { - message.error('失效时间要大于生效时间') - return - } - } - if (data.activeTime == 0) data.activeTime = null - if (data.expireTime == 0) data.expireTime = null data.filePathList = [] for (let i = 0; i < data.filePathListView.length; i++) { data.filePathList.push(data.filePathListView[i].url) diff --git a/src/views/eam/item/replaceItemDes/index.vue b/src/views/eam/item/replaceItemDes/index.vue index 0cdbad3..e92eda1 100644 --- a/src/views/eam/item/replaceItemDes/index.vue +++ b/src/views/eam/item/replaceItemDes/index.vue @@ -124,13 +124,20 @@ /** 添加/修改操作 */ const basicFormRef = ref() const openForm = (type : string, row ?: any) => { + if (row&&row.filePathList && row.filePathList.length > 0) { + row.filePathListView = row.filePathList.map((item) => { + return { + name: item, + url: item + } + }) + } basicFormRef.value.open(type, row) } // form表单提交 const formsSuccess = async (formType, data) => { - if (data.expireTime == 0) data.expireTime = null; - data.filePathList = data.filePathList.map(item=>item.url) + data.filePathList = data.filePathListView.map(item=>item.url) if (formType === 'create') { await ReplaceItemDesApi.createReplaceItemDes(data) message.success(t('common.createSuccess')) diff --git a/src/views/eam/item/replaceItemDes/replaceItemDes.data.ts b/src/views/eam/item/replaceItemDes/replaceItemDes.data.ts index d74e5c9..050d569 100644 --- a/src/views/eam/item/replaceItemDes/replaceItemDes.data.ts +++ b/src/views/eam/item/replaceItemDes/replaceItemDes.data.ts @@ -7,7 +7,7 @@ import * as ItemApi from '@/api/eam/basic/item' // 表单校验 export const ReplaceItemDesRules = reactive({ number: [required], - filePathList: [required], + filePathListView: [required], }) export const ReplaceItemDes = useCrudSchemas(reactive([ @@ -34,16 +34,31 @@ export const ReplaceItemDes = useCrudSchemas(reactive([ } } }, + { + label: '文件', + field: 'filePathListView', + sort: 'custom', + isTable: false, + table: { + }, + form: { + component: 'UploadFile', + componentProps: { + } + } + }, { label: '文件', field: 'filePathList', sort: 'custom', isTable: false, + isForm: false, table: { }, form: { component: 'UploadFile', componentProps: { + } } },