diff --git a/src/views/eam/basic/assetsAccount/assetsAccount.data.ts b/src/views/eam/basic/assetsAccount/assetsAccount.data.ts index bda74e3..8bc9f47 100644 --- a/src/views/eam/basic/assetsAccount/assetsAccount.data.ts +++ b/src/views/eam/basic/assetsAccount/assetsAccount.data.ts @@ -13,9 +13,9 @@ const admin = checkPermi(['gdzc_admin']); // 表单校验 export const AssetsAccountRules = reactive({ - // number: [ - // required, - // ], + number: [ + required, + ], name: [ required, { max: 50, message: '不得超过50个字符', trigger: 'blur' }, @@ -65,7 +65,7 @@ export const AssetsAccountRules = reactive({ export const AssetsAccount = useCrudSchemas(reactive([ { - label: '资产编号', + label: '工位器具编号', field: 'number', sort: 'custom', table: { @@ -76,7 +76,7 @@ export const AssetsAccount = useCrudSchemas(reactive([ isForm: true, }, { - label: '资产名称', + label: '工位器具名称', field: 'name', sort: 'custom', table: { @@ -274,6 +274,20 @@ export const AssetsAccount = useCrudSchemas(reactive([ width: '150', }, }, + { + label: '图片', + field: 'upload', + isForm: true, + form: { + component: 'UploadImgs', + componentProps: { + limit:3, + }, + colProps: { + span: 24 + } + } + }, { label: '操作', field: 'action', diff --git a/src/views/eam/basic/assetsAccount/index.vue b/src/views/eam/basic/assetsAccount/index.vue index 14d536f..8bc2e9c 100644 --- a/src/views/eam/basic/assetsAccount/index.vue +++ b/src/views/eam/basic/assetsAccount/index.vue @@ -32,6 +32,9 @@ {{ row.code }} + @@ -52,7 +55,15 @@ - + + + @@ -78,6 +89,10 @@ const routeName = ref() routeName.value = route.name const tableColumns = ref(AssetsAccount.allSchemas.tableColumns) +const showView = ref(false) +const viewTitle = ref('图片预览') +const urls = ref([]) +const viewKey = ref(0) // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef) => { nextTick(() => { @@ -145,6 +160,8 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + } else if (val == 'view') { //预览 + openForm('view', row) } } @@ -152,9 +169,20 @@ const buttonTableClick = async (val, row) => { const basicFormRef = ref() const openForm = (type: string, row?: any) => { - + if (type == 'view') { + showView.value = true + urls.value = row.filePathList + viewKey.value += 1 + }else if (type == 'update') { + row['upload']= row.filePathList?.map((item: any) => { + return {url:item} + }) + basicFormRef.value.open(type, row) + } else { + basicFormRef.value.open(type, row) + } + - basicFormRef.value.open(type, row) } // form表单提交 @@ -169,7 +197,12 @@ const formsSuccess = async (formType,data) => { } } if(data.activeTime==0)data.activeTime = null; - if(data.expireTime==0)data.expireTime = null; + if (data.expireTime == 0) data.expireTime = null; + if (data.upload != null && data.upload != "") { + data.filePathList = data?.upload?.map((item: any) => { + return item.url + }) + } const userStore = useUserStore() // 用户信息 const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.SPECIAL_DEPT_ROLE) // 查找第一个同时存在于userStore.roles和deviceMoldTypeList中的值 @@ -232,6 +265,14 @@ const handleExport = async () => { } } +// 列表-操作按钮 +const butttondataView = (row) => { + return [ + defaultButtons.viewBtn(null), + + ] +} + /** 导入 */ const importFormRef = ref() const handleImport = () => { diff --git a/src/views/eam/basic/assetsAccountControlsHistory/assetsAccountControlsHistory.data.ts b/src/views/eam/basic/assetsAccountControlsHistory/assetsAccountControlsHistory.data.ts index 92de219..ef341b9 100644 --- a/src/views/eam/basic/assetsAccountControlsHistory/assetsAccountControlsHistory.data.ts +++ b/src/views/eam/basic/assetsAccountControlsHistory/assetsAccountControlsHistory.data.ts @@ -157,6 +157,20 @@ export const AssetsAccountControlsHistory = useCrudSchemas(reactive{{ row.code }} + @@ -49,6 +52,15 @@ @searchTableSuccess="searchTableSuccess" :isBusiness="false" /> + + + @@ -67,7 +79,10 @@ const route = useRoute() // 路由信息 const routeName = ref() routeName.value = route.name const tableColumns = ref(AssetsAccountControlsHistory.allSchemas.tableColumns) - +const showView = ref(false) +const viewTitle = ref('图片预览') +const urls = ref([]) +const viewKey = ref(0) // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef) => { nextTick(() => { @@ -135,13 +150,28 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + } else if (val == 'view') { //预览 + openForm('view', row) } } +const butttondataView = (row) => { + return [ + defaultButtons.viewBtn(null), + + ] +} + /** 添加/修改操作 */ const basicFormRef = ref() const openForm = (type: string, row?: any) => { - basicFormRef.value.open(type, row) + if (type == 'view') { + showView.value = true + urls.value = row.filePathList + viewKey.value += 1 + } else { + basicFormRef.value.open(type, row) + } } // form表单提交 @@ -196,7 +226,7 @@ const handleExport = async () => { // 发起导出 exportLoading.value = true const data = await AssetsAccountControlsHistoryApi.exportAssetsAccountControlsHistory(tableObject.params) - download.excel(data, '固定资产表操作记录.xlsx') + download.excel(data, '固定工位器具表操作记录.xlsx') } catch { } finally { exportLoading.value = false @@ -211,7 +241,7 @@ const handleImport = () => { // 导入附件弹窗所需的参数 const importTemplateData = reactive({ templateUrl: '', - templateTitle: '固定资产表操作记录导入模版.xlsx' + templateTitle: '固定工位器具表操作记录导入模版.xlsx' }) // 导入成功之后 const importSuccess = () => { diff --git a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts index 86eabb0..fa3e03c 100644 --- a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts +++ b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts @@ -274,6 +274,20 @@ export const FixedAssets = useCrudSchemas(reactive([ width: '150', }, }, + { + label: '图片', + field: 'upload', + isForm: true, + form: { + component: 'UploadImgs', + componentProps: { + limit:3, + }, + colProps: { + span: 24 + } + } + }, { label: '操作', field: 'action', diff --git a/src/views/eam/basic/fixedAssets/index.vue b/src/views/eam/basic/fixedAssets/index.vue index 45da77f..b6ee603 100644 --- a/src/views/eam/basic/fixedAssets/index.vue +++ b/src/views/eam/basic/fixedAssets/index.vue @@ -32,6 +32,9 @@ {{ row.code }} + @@ -52,7 +55,15 @@ - + + + @@ -79,6 +90,11 @@ const routeName = ref() routeName.value = route.name const tableColumns = ref(FixedAssets.allSchemas.tableColumns) +const showView = ref(false) +const viewTitle = ref('图片预览') +const urls = ref([]) +const viewKey = ref(0) + // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef) => { nextTick(() => { @@ -146,16 +162,26 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + } else if (val == 'view') { //预览 + openForm('view', row) } } /** 添加/修改操作 */ const basicFormRef = ref() const openForm = (type: string, row?: any) => { - - - - basicFormRef.value.open(type, row) + if (type == 'view') { + showView.value = true + urls.value = row.filePathList + viewKey.value += 1 + }else if (type == 'update') { + row['upload']= row.filePathList?.map((item: any) => { + return {url:item} + }) + basicFormRef.value.open(type, row) + } else { + basicFormRef.value.open(type, row) + } } // form表单提交 @@ -170,7 +196,12 @@ const formsSuccess = async (formType,data) => { } } if(data.activeTime==0)data.activeTime = null; - if(data.expireTime==0)data.expireTime = null; + if (data.expireTime == 0) data.expireTime = null; + if (data.upload != null && data.upload != "") { + data.filePathList = data?.upload?.map((item: any) => { + return item.url + }) + } const userStore = useUserStore() // 用户信息 const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.SPECIAL_DEPT_ROLE) // 查找第一个同时存在于userStore.roles和deviceMoldTypeList中的值 @@ -217,6 +248,14 @@ const handleDelete = async (id: number) => { } catch {} } +// 列表-操作按钮 +const butttondataView = (row) => { + return [ + defaultButtons.viewBtn(null), + + ] +} + /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 const handleExport = async () => { diff --git a/src/views/eam/basic/fixedAssetsControlsHistory/fixedAssetsControlsHistory.data.ts b/src/views/eam/basic/fixedAssetsControlsHistory/fixedAssetsControlsHistory.data.ts index 77142fa..0319207 100644 --- a/src/views/eam/basic/fixedAssetsControlsHistory/fixedAssetsControlsHistory.data.ts +++ b/src/views/eam/basic/fixedAssetsControlsHistory/fixedAssetsControlsHistory.data.ts @@ -167,6 +167,20 @@ export const FixedAssetsControlsHistory = useCrudSchemas(reactive( formatter: dateFormatter, isForm: false, }, + { + label: '图片', + field: 'upload', + isForm: true, + form: { + component: 'UploadImgs', + componentProps: { + limit:3, + }, + colProps: { + span: 24 + } + } + }, { label: '操作', field: 'action', diff --git a/src/views/eam/basic/fixedAssetsControlsHistory/index.vue b/src/views/eam/basic/fixedAssetsControlsHistory/index.vue index 07ced84..6118f46 100644 --- a/src/views/eam/basic/fixedAssetsControlsHistory/index.vue +++ b/src/views/eam/basic/fixedAssetsControlsHistory/index.vue @@ -32,6 +32,9 @@ {{ row.code }} + @@ -49,7 +52,15 @@ @searchTableSuccess="searchTableSuccess" :isBusiness="false" /> - + + +