diff --git a/src/api/eam/basic/item/index.ts b/src/api/eam/basic/item/index.ts index 35d3e10..a0d72d3 100644 --- a/src/api/eam/basic/item/index.ts +++ b/src/api/eam/basic/item/index.ts @@ -33,6 +33,17 @@ export const getItemPage = async (params) => { } } +// 查询备件列表 +export const getWarningPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = { ...params } + return await request.post({ url: '/eam/item/warningSenior', data }) + } else { + return await request.get({ url: `/eam/item/warningPage`, params }) + } +} + // 生成标签 export const genDevice = async (data) => { return await request.post({ url: `/eam/item/genDevice`, data }) @@ -78,3 +89,8 @@ export const getItemList = async (params) => { export const getItemNoPage = async (params) => { return await request.get({ url: `/eam/item/noPage`, params }) } + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/item/get-import-template' }) +} diff --git a/src/api/eam/basic/location/index.ts b/src/api/eam/basic/location/index.ts index 1ef6513..9fd7bf0 100644 --- a/src/api/eam/basic/location/index.ts +++ b/src/api/eam/basic/location/index.ts @@ -52,3 +52,8 @@ export const exportLocation = async (params) => { export const getLocationNoPage = async (params) => { return await request.get({ url: `/eam/location/noPage`, params }) } + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/location/get-import-template' }) +} diff --git a/src/api/eam/basic/locationArea/index.ts b/src/api/eam/basic/locationArea/index.ts index e1dd72e..124b0d9 100644 --- a/src/api/eam/basic/locationArea/index.ts +++ b/src/api/eam/basic/locationArea/index.ts @@ -46,3 +46,8 @@ export const exportLocationArea = async (params) => { return await request.download({ url: `/eam/location-area/export-excel`, params }) } +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/location-area/get-import-template' }) +} + diff --git a/src/views/eam/basic/item/index.vue b/src/views/eam/basic/item/index.vue index d5b29eb..afddda8 100644 --- a/src/views/eam/basic/item/index.vue +++ b/src/views/eam/basic/item/index.vue @@ -34,6 +34,9 @@ + + + @@ -59,6 +62,7 @@ routeName.value = route.name const itemNumber = ref(); const tableColumns = ref(Item.allSchemas.tableColumns) + const importFormRef = ref() // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef) => { @@ -83,8 +87,9 @@ // 列表头部按钮 const HeadButttondata = [ - defaultButtons.defaultAddBtn({hasPermi:'basic:item:create'}), // 新增 - defaultButtons.defaultExportBtn({hasPermi:'basic:item:export'}), // 导出 + defaultButtons.defaultAddBtn({ hasPermi: 'basic:item:create' }), // 新增 + defaultButtons.defaultImportBtn(null), // 导入 + defaultButtons.defaultExportBtn({ hasPermi: 'basic:item:export' }), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置 @@ -94,6 +99,8 @@ const buttonBaseClick = (val, item) => { if (val == 'add') { // 新增 openForm('create') + }else if (val == 'import') { // 导入 + handleImport() } else if (val == 'export') { // 导出 handleExport() } else if (val == 'refresh') { // 刷新 @@ -106,9 +113,8 @@ // 列表-操作按钮 const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'basic:item:update'}), // 编辑 - defaultButtons.chooseDeviceBtn({hasPermi:'basic:item:choose'}),//备件 - defaultButtons.mainListDeleteBtn({hasPermi:'basic:item:delete'}), // 删除 + defaultButtons.mainListEditBtn({ hasPermi: 'basic:item:update' }), // 编辑 + defaultButtons.mainListDeleteBtn({ hasPermi: 'basic:item:delete' }), // 删除 ] // 列表-操作按钮事件 @@ -233,7 +239,26 @@ exportLoading.value = false } } - + + onMounted(async () => { + importTemplateData.templateUrl = await ItemApi.importTemplate() + }) + + const handleImport = () => { + importFormRef.value.open() + } + + // 导入附件弹窗所需的参数 + const importTemplateData = reactive({ + templateUrl: '', + templateTitle: '物料导入模版.xlsx' + }) + + // 导入成功之后 + const importSuccess = () => { + getList() + } + // 筛选提交 const searchFormClick = (searchData) => { tableObject.params = { diff --git a/src/views/eam/basic/item/item.data.ts b/src/views/eam/basic/item/item.data.ts index d42ac55..a05ed1b 100644 --- a/src/views/eam/basic/item/item.data.ts +++ b/src/views/eam/basic/item/item.data.ts @@ -11,6 +11,12 @@ export const ItemRules = reactive({ { required: true, message: '请选择备件单位', trigger: 'blur' }, { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], + maxInventory: [ + { required: true, message: '请输入最高库存', trigger: 'blur' } + ], + minInventory: [ + { required: true, message: '请输入最高库存', trigger: 'blur' } + ], }) export const Item = useCrudSchemas(reactive([ diff --git a/src/views/eam/basic/location/index.vue b/src/views/eam/basic/location/index.vue index df9c4b3..13ab787 100644 --- a/src/views/eam/basic/location/index.vue +++ b/src/views/eam/basic/location/index.vue @@ -56,6 +56,7 @@ const routeName = ref() routeName.value = route.name const tableColumns = ref(Location.allSchemas.tableColumns) + const importFormRef = ref() // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { @@ -89,6 +90,7 @@ // 列表头部按钮 const HeadButttondata = [ defaultButtons.defaultAddBtn({hasPermi:'basic:location:create'}), // 新增 + defaultButtons.defaultImportBtn(null), // 导入 defaultButtons.defaultExportBtn({hasPermi:'basic:location:update'}), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 @@ -107,6 +109,8 @@ const buttonBaseClick = (val, item) => { if (val == 'add') { // 新增 openForm('create') + }else if (val == 'import') { // 导入 + handleImport() } else if (val == 'export') { // 导出 handleExport() } else if (val == 'refresh') { // 刷新 @@ -200,6 +204,25 @@ exportLoading.value = false } } + + onMounted(async () => { + importTemplateData.templateUrl = await LocationApi.importTemplate() + }) + + const handleImport = () => { + importFormRef.value.open() + } + + // 导入附件弹窗所需的参数 + const importTemplateData = reactive({ + templateUrl: '', + templateTitle: '库位导入模版.xlsx' + }) + + // 导入成功之后 + const importSuccess = () => { + getList() + } // 筛选提交 const searchFormClick = (searchData) => { diff --git a/src/views/eam/basic/locationArea/index.vue b/src/views/eam/basic/locationArea/index.vue index 8f40c3c..d534733 100644 --- a/src/views/eam/basic/locationArea/index.vue +++ b/src/views/eam/basic/locationArea/index.vue @@ -35,7 +35,7 @@ - + @@ -57,6 +57,7 @@ const routeName = ref() routeName.value = route.name const tableColumns = ref(LocationArea.allSchemas.tableColumns) + const importFormRef = ref() // 字段设置 更新主列表字段 const updataTableColumns = (val) => { @@ -83,6 +84,7 @@ // 列表头部按钮 const HeadButttondata = [ defaultButtons.defaultAddBtn({hasPermi:'basic:locationArea:create'}), // 新增 + defaultButtons.defaultImportBtn(null), // 导入 defaultButtons.defaultExportBtn({hasPermi:'basic:locationArea:export'}), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 @@ -101,6 +103,8 @@ const buttonBaseClick = (val, item) => { if (val == 'add') { // 新增 openForm('create') + }else if (val == 'import') { // 导入 + handleImport() } else if (val == 'export') { // 导出 handleExport() } else if (val == 'refresh') { // 刷新 @@ -206,20 +210,24 @@ } } - /** 导入 */ - const importFormRef = ref() - const handleImport = () => { - importFormRef.value.open() - } - // 导入附件弹窗所需的参数 - const importTemplateData = reactive({ - templateUrl: '', - templateTitle: '库区导入模版.xlsx' - }) - // 导入成功之后 - const importSuccess = () => { - getList() - } + onMounted(async () => { + importTemplateData.templateUrl = await LocationAreaApi.importTemplate() + }) + + const handleImport = () => { + importFormRef.value.open() + } + + // 导入附件弹窗所需的参数 + const importTemplateData = reactive({ + templateUrl: '', + templateTitle: '库区导入模版.xlsx' + }) + + // 导入成功之后 + const importSuccess = () => { + getList() + } // 筛选提交 const searchFormClick = (searchData) => { diff --git a/src/views/eam/report/itemWarning/index.vue b/src/views/eam/report/itemWarning/index.vue new file mode 100644 index 0000000..cf6726e --- /dev/null +++ b/src/views/eam/report/itemWarning/index.vue @@ -0,0 +1,275 @@ + + + diff --git a/src/views/eam/report/itemWarning/item.data.ts b/src/views/eam/report/itemWarning/item.data.ts new file mode 100644 index 0000000..334f1d2 --- /dev/null +++ b/src/views/eam/report/itemWarning/item.data.ts @@ -0,0 +1,199 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + +// 表单校验 +export const ItemRules = reactive({ + name: [ + { required: true, message: '请输入备件名称', trigger: 'blur' }, + { max: 50, message: '不得超过50个字符', trigger: 'blur' } + ], + uom: [ + { required: true, message: '请选择备件单位', trigger: 'blur' }, + { max: 50, message: '不得超过50个字符', trigger: 'blur' } + ], + maxInventory: [ + { required: true, message: '请输入最高库存', trigger: 'blur' } + ], + minInventory: [ + { required: true, message: '请输入最高库存', trigger: 'blur' } + ], +}) + +export const Item = useCrudSchemas(reactive([ + { + label: '零件编码', + field: 'number', + sort: 'custom', + isSearch: true, + table: { + width: 180, + fixed: 'left' + }, + }, + { + label: '零件名称', + field: 'name', + sort: 'custom', + isSearch: true, + table: { + width: 110 + }, + }, + { + label: '规格型号', + field: 'specifications', + sort: 'custom', + isSearch: false, + table: { + width: 110 + }, + }, + { + label: '单位', + field: 'uom', + sort: 'custom', + isSearch: false, + table: { + width: 110 + }, + }, + { + label: '供应商名称', + field: 'supplierName', + sort: 'custom', + isSearch: false, + table: { + width: 130 + }, + }, + { + label: '生产厂家', + field: 'brand', + sort: 'custom', + isSearch: false, + table: { + width: 110 + }, + }, + { + label: '最高库存', + field: 'maxInventory', + sort: 'custom', + isSearch: false, + form: { + component: 'InputNumber', + value: 0 + }, + table: { + width: 110 + }, + }, + { + label: '最低库存', + field: 'minInventory', + sort: 'custom', + isSearch: false, + form: { + component: 'InputNumber', + value: 0 + }, + table: { + width: 110 + }, + }, + { + label: '现有库存', + field: 'allCount', + sort: 'custom', + isSearch: false, + table: { + width: 110 + }, + }, + { + label: '采购周期(周)', + field: 'procurementCycle', + sort: 'custom', + isSearch: false, + form: { + component: 'InputNumber', + value: 0 + }, + table: { + width: 150 + }, + }, + { + label: 'ABC分类', + field: 'classification', + sort: 'custom', + isSearch: false, + table: { + width: 110 + }, + }, + { + label: '使用地点', + field: 'usePlace', + sort: 'custom', + isSearch: false, + table: { + width: 110 + }, + }, + { + label: '项目', + field: 'project', + sort: 'custom', + isSearch: false, + table: { + width: 110 + }, + }, + { + label: '价格', + field: 'price', + sort: 'custom', + isSearch: false, + table: { + width: 110 + }, + }, + { + label: '描述', + field: 'describes', + sort: 'custom', + isSearch: false, + table: { + width: 110 + }, + }, + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + isForm: false, + table: { + width: 180 + }, + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +]))