From 5c102a2fba8f10a080123168a06d4e80de1fdbe7 Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Wed, 22 May 2024 09:04:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8F=B0=E8=B4=A6=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/equipmentAccounts/index.ts | 79 ++++ src/api/eam/equipmentMainPart/index.ts | 67 --- src/api/eam/equipmentManufacturer/index.ts | 5 + src/api/eam/equipmentSupplier/index.ts | 5 + src/api/eam/relationMainPart/index.ts | 61 +++ src/api/eam/sparePart/index.ts | 75 ++++ src/utils/dict.ts | 9 +- src/utils/disposition/defaultButtons.ts | 24 ++ .../equipmentAccounts.data.ts | 393 ++++++++++++++++++ src/views/eam/equipmentAccounts/index.vue | 293 +++++++++++++ src/views/eam/relationMainPart/index.vue | 244 +++++++++++ .../relationMainPart/relationMainPart.data.ts | 122 ++++++ src/views/eam/sparePart/index.vue | 244 +++++++++++ src/views/eam/sparePart/sparePart.data.ts | 264 ++++++++++++ 14 files changed, 1816 insertions(+), 69 deletions(-) create mode 100644 src/api/eam/equipmentAccounts/index.ts delete mode 100644 src/api/eam/equipmentMainPart/index.ts create mode 100644 src/api/eam/relationMainPart/index.ts create mode 100644 src/api/eam/sparePart/index.ts create mode 100644 src/views/eam/equipmentAccounts/equipmentAccounts.data.ts create mode 100644 src/views/eam/equipmentAccounts/index.vue create mode 100644 src/views/eam/relationMainPart/index.vue create mode 100644 src/views/eam/relationMainPart/relationMainPart.data.ts create mode 100644 src/views/eam/sparePart/index.vue create mode 100644 src/views/eam/sparePart/sparePart.data.ts diff --git a/src/api/eam/equipmentAccounts/index.ts b/src/api/eam/equipmentAccounts/index.ts new file mode 100644 index 000000000..02a2fe927 --- /dev/null +++ b/src/api/eam/equipmentAccounts/index.ts @@ -0,0 +1,79 @@ +import request from '@/config/axios' + +export interface EquipmentAccountsVO { + id: number + code: string + name: string + specification: string + type: string + power: string + equity: string + electricMachine: string + beat: string + storageLocation: string + useDept: string + principal: string + principalTelephone: string + status: string + startDate: Date + supplierCode: string + purchaseTime: Date + purchaseDept: string + purchaser: string + productionDate: Date + manufactureCode: string + equipmentLife: string + acceptanceDate: Date + purchasePrice: number + factoryAreaCode: string + workshopCode: string + workshopSectionCode: string + departmentCode: string + remark: string + siteId: string + available: string + deletionTime: Date + deleterId: byte[] + concurrencyStamp: number +} + +// 查询设备台账列表 +export const getEquipmentAccountsPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/eam/equipment-accounts/senior', data }) + } else { + return await request.get({ url: `/eam/equipment-accounts/page`, params }) + } +} + +// 查询设备台账详情 +export const getEquipmentAccounts = async (id: number) => { + return await request.get({ url: `/eam/equipment-accounts/get?id=` + id }) +} + +// 新增设备台账 +export const createEquipmentAccounts = async (data: EquipmentAccountsVO) => { + return await request.post({ url: `/eam/equipment-accounts/create`, data }) +} + +// 修改设备台账 +export const updateEquipmentAccounts = async (data: EquipmentAccountsVO) => { + return await request.put({ url: `/eam/equipment-accounts/update`, data }) +} + +// 删除设备台账 +export const deleteEquipmentAccounts = async (id: number) => { + return await request.delete({ url: `/eam/equipment-accounts/delete?id=` + id }) +} + +// 导出设备台账 Excel +export const exportEquipmentAccounts = async (params) => { + return await request.download({ url: `/eam/equipment-accounts/export-excel`, params }) +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/equipment-accounts/get-import-template' }) +} \ No newline at end of file diff --git a/src/api/eam/equipmentMainPart/index.ts b/src/api/eam/equipmentMainPart/index.ts deleted file mode 100644 index 6a081dd4c..000000000 --- a/src/api/eam/equipmentMainPart/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -import request from '@/config/axios' - -export interface EquipmentMainPartVO { - id: number - name: string - code: string - type: string - departmentCode: string - remark: string - siteId: string - available: string - deletionTime: Date - deleterId: byte[] - concurrencyStamp: number -} - -// 查询主要部件列表 -export const getEquipmentMainPartPage = async (params) => { - if (params.isSearch) { - delete params.isSearch - const data = {...params} - return await request.post({ url: '/eam/equipment-main-part/senior', data }) - } else { - return await request.get({ url: `/eam/equipment-main-part/page`, params }) - } -} - -// 查询主要部件详情 -export const getEquipmentMainPart = async (id: number) => { - return await request.get({ url: `/eam/equipment-main-part/get?id=` + id }) -} - -// 新增主要部件 -export const createEquipmentMainPart = async (data: EquipmentMainPartVO) => { - return await request.post({ url: `/eam/equipment-main-part/create`, data }) -} - -// 修改主要部件 -export const updateEquipmentMainPart = async (data: EquipmentMainPartVO) => { - console.log(data) - return await request.put({ url: `/eam/equipment-main-part/update`, data }) -} - -// 删除主要部件 -export const deleteEquipmentMainPart = async (id: number) => { - return await request.delete({ url: `/eam/equipment-main-part/delete?id=` + id }) -} - -// 导出主要部件 Excel -export const exportEquipmentMainPart = async (params) => { - if (params.isSearch) { - const data = {...params} - return await request.downloadPost({ url: `/eam/equipment-main-part/export-excel-senior`, data }) - }else{ - return await request.download({ url: `/eam/equipment-main-part/export-excel`, params }) - } -} - -// 下载用户导入模板 -export const importTemplate = () => { - return request.download({ url: '/eam/equipment-main-part/get-import-template' }) -} - -// 启用 / 禁用 -export const updateEnableCode = async (data: EquipmentMainPartVO) => { - return await request.post({ url: `/eam/equipment-main-part/ables` , data }) -} diff --git a/src/api/eam/equipmentManufacturer/index.ts b/src/api/eam/equipmentManufacturer/index.ts index 6efa2cbb2..1160cc0e0 100644 --- a/src/api/eam/equipmentManufacturer/index.ts +++ b/src/api/eam/equipmentManufacturer/index.ts @@ -65,4 +65,9 @@ export const exportEquipmentManufacturer = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/basic/equipment-manufacturer/get-import-template' }) +} + +// 查询设备制造商列表 +export const getEquipmentManufacturerNoPage = async (params) => { + return await request.get({ url: `/eam/basic/equipment-manufacturer/noPage`, params }) } \ No newline at end of file diff --git a/src/api/eam/equipmentSupplier/index.ts b/src/api/eam/equipmentSupplier/index.ts index b6a38dc40..62e551080 100644 --- a/src/api/eam/equipmentSupplier/index.ts +++ b/src/api/eam/equipmentSupplier/index.ts @@ -65,4 +65,9 @@ export const exportEquipmentSupplier = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/basic/equipment-supplier/get-import-template' }) +} + +//供应商列表不分页 +export const getEquipmentSupplierNoPage = async (params) => { + return await request.get({ url: `/eam/basic/equipment-supplier/noPage`, params }) } \ No newline at end of file diff --git a/src/api/eam/relationMainPart/index.ts b/src/api/eam/relationMainPart/index.ts new file mode 100644 index 000000000..773210bfb --- /dev/null +++ b/src/api/eam/relationMainPart/index.ts @@ -0,0 +1,61 @@ +import request from '@/config/axios' + +export interface RelationMainPartVO { + id: number + mainPartCode: string + equipmentCode: string + type: string + departmentCode: string + remark: string + siteId: string + available: string + deletionTime: Date + deleterId: byte[] + concurrencyStamp: number +} + +// 查询主要部件关联列表 +export const getRelationMainPartPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/eam/relation/relation-main-partsenior', data }) + } else { + return await request.get({ url: `/eam/relation/relation-main-part/page`, params }) + } +} + +// 查询主要部件关联详情 +export const getRelationMainPart = async (id: number) => { + return await request.get({ url: `/eam/relation/relation-main-part/get?id=` + id }) +} + +// 新增主要部件关联 +export const createRelationMainPart = async (data: RelationMainPartVO) => { + return await request.post({ url: `/eam/relation/relation-main-part/create`, data }) +} + +// 修改主要部件关联 +export const updateRelationMainPart = async (data: RelationMainPartVO) => { + return await request.put({ url: `/eam/relation/relation-main-part/update`, data }) +} + +// 删除主要部件关联 +export const deleteRelationMainPart = async (id: number) => { + return await request.delete({ url: `/eam/relation/relation-main-part/delete?id=` + id }) +} + +// 导出主要部件关联 Excel +export const exportRelationMainPart = async (params) => { + return await request.download({ url: `/eam/relation/relation-main-part/export-excel`, params }) +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/relation/relation-main-part/get-import-template' }) +} + +// 查询主要部件关联列表不分页 +export const getRelationMainPartNoPage = async (params) => { + return await request.get({ url: `/eam/relation/relation-main-part/noPage`, params }) +} diff --git a/src/api/eam/sparePart/index.ts b/src/api/eam/sparePart/index.ts new file mode 100644 index 000000000..8ae1f345a --- /dev/null +++ b/src/api/eam/sparePart/index.ts @@ -0,0 +1,75 @@ +import request from '@/config/axios' + +export interface SparePartVO { + id: number + code: string + name: string + brand: string + specifications: string + isOverall: string + isConstant: string + subject: string + subjectCode: string + category: string + region: string + classification: string + uom: string + singlePrice: number + stockAge: number + reprocurement: number + safetyStock: number + cost: string + purchaser: string + financer: string + purchaseTime: Date + isFramework: string + isRadeIn: string + departmentCode: string + remark: string + siteId: string + available: string + deletionTime: Date + deleterId: byte[] + concurrencyStamp: number +} + +// 查询备件基础列表 +export const getSparePartPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/eam/sparepart/spare-part/senior', data }) + } else { + return await request.get({ url: `/eam/sparepart/spare-part/page`, params }) + } +} + +// 查询备件基础详情 +export const getSparePart = async (id: number) => { + return await request.get({ url: `/eam/sparepart/spare-part/get?id=` + id }) +} + +// 新增备件基础 +export const createSparePart = async (data: SparePartVO) => { + return await request.post({ url: `/eam/sparepart/spare-part/create`, data }) +} + +// 修改备件基础 +export const updateSparePart = async (data: SparePartVO) => { + return await request.put({ url: `/eam/sparepart/spare-part/update`, data }) +} + +// 删除备件基础 +export const deleteSparePart = async (id: number) => { + return await request.delete({ url: `/eam/sparepart/spare-part/delete?id=` + id }) +} + +// 导出备件基础 Excel +export const exportSparePart = async (params) => { + return await request.download({ url: `/eam/sparepart/spare-part/export-excel`, params }) +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/sparepart/spare-part/get-import-template' }) +} \ No newline at end of file diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 27a6ee73a..c3ef09211 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -339,8 +339,13 @@ export enum DICT_TYPE { PURCHASE_INVOICE_ORDER_TYPE = 'purchase_invoice_order_type', // 发票采购订单类型 // ========== eam - 业务 - ========== - DEVICE_TYPE = 'device_type', // 设备类型 + DEVICE_TYPE = 'device_type', // 设备分类 IS_UPDATED = 'is_updated', //是否可修改 DATA_SCOPE = 'data_scope', // 数据范围 - ROLE_STATUS = 'role_status' // 角色状态 + ROLE_STATUS = 'role_status', // 角色状态 + DEVICE_CLASS = 'device_class', //设备类型 + DEVICE_STATUS = 'device_status', //设备状态 + SUBJECT = 'subject', //科目 + REGION = 'region', //区域 + PART_CLASS = 'part_class', //备件分类 } \ No newline at end of file diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index e2cc243c6..73101cc39 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -932,6 +932,30 @@ export function mainCopyBtn(option:any) { hasPermi: '' }) } +// 主列表-部件 +export function componentBtn(option:any) { + return __defaultBtnOption(option,{ + label: '部件', + name: 'component', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} +// 主列表-备件 +export function itemBtn(option:any) { + return __defaultBtnOption(option,{ + label: '备件', + name: 'item', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} // 默认按钮规则 function __defaultBtnOption(option:any,specific:any){ return { diff --git a/src/views/eam/equipmentAccounts/equipmentAccounts.data.ts b/src/views/eam/equipmentAccounts/equipmentAccounts.data.ts new file mode 100644 index 000000000..ceb6d3314 --- /dev/null +++ b/src/views/eam/equipmentAccounts/equipmentAccounts.data.ts @@ -0,0 +1,393 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' +import * as WorkshopApi from '@/api/wms/workshop' +import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data' +import { validateHanset, validateNum, validateNum100 } from '@/utils/validator' +import { EquipmentSupplier } from '@/views/eam/equipmentSupplier/equipmentSupplier.data' +import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier' +import { EquipmentManufacturer } from '@/views/eam/equipmentManufacturer/equipmentManufacturer.data' +import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer' +import * as ConfigApi from '@/api/infra/config' +const workshopNoPage = await WorkshopApi.getWorkshopNoPage({}) +const equipmentManufacturerNoPage = await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({}) +const equipmentSupplierNoPage = await EquipmentSupplierApi.getEquipmentSupplierNoPage({}) +const autoCodeSwitch = await ConfigApi.getConfigKey('deviceCodeAutoSwitch') +const autoSwitch = ref(false) +if (autoCodeSwitch == 'TRUE') { + autoSwitch.value = true +} + +// 表单校验 +export const EquipmentAccountsRules = reactive({ + code: [required], + name: [required], + concurrencyStamp: [required], + principalTelephone: [ + { validator:validateHanset, message: '输入电话格式不正确', trigger: 'blur'} + ], + power: [ + { validator:validateNum, message: '输入功率格式不正确', trigger: 'blur'} + ], +}) + +export const EquipmentAccounts = useCrudSchemas(reactive([ + { + label: '设备编号', + field: 'code', + sort: 'custom', + isForm: !autoSwitch.value, + isSearch: true, + fixed: 'left' + }, + { + label: '名称', + field: 'name', + sort: 'custom', + isSearch: true + }, + { + label: '设备型号', + field: 'specification', + sort: 'custom', + isSearch: false + }, + { + label: '设备类型', + field: 'type', + sort: 'custom', + dictType: DICT_TYPE.DEVICE_CLASS, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: true, + form: { + component: 'Select' + } + }, + { + label: '功率(kw)', + field: 'power', + sort: 'custom', + isSearch: false + }, + { + label: '产权', + field: 'equity', + sort: 'custom', + isSearch: false + }, + { + label: '电机', + field: 'electricMachine', + sort: 'custom', + isSearch: false + }, + { + label: '节拍', + field: 'beat', + sort: 'custom', + isSearch: false + }, + { + label: '存放位置', + field: 'storageLocation', + sort: 'custom', + isSearch: false + }, + { + label: '使用部门', + field: 'useDept', + sort: 'custom', + isSearch: false + }, + { + label: '负责人', + field: 'principal', + sort: 'custom', + isSearch: false + }, + { + label: '负责人联系方式', + field: 'principalTelephone', + sort: 'custom', + isSearch: false, + }, + { + label: '设备状态', + field: 'status', + sort: 'custom', + isSearch: true, + dictType: DICT_TYPE.DEVICE_STATUS, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + form: { + component: 'Select' + } + }, + { + label: '启用日期', + field: 'startDate', + 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')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + } + }, + { + label: '供应商', + field: 'supplierCode', + sort: 'custom', + isSearch: true, + isDetail: false, + isForm: false, + isTable: true, + isTableForm: false, + search: { + component: 'Select', + componentProps: { + options: equipmentSupplierNoPage, + optionsAlias: { + labelField: 'name', + valueField: 'number' + }, + filterable: true, + } + }, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return equipmentSupplierNoPage.find((item) => item.number == cellValue)?.name + }, + }, + { + label: '供应商', + field: 'supplierName', + sort: 'custom', + isSearch: false, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择供应商', // 输入框占位文本 + searchField: 'number', // 查询弹窗赋值字段 + searchTitle: '供应商信息', // 查询弹窗标题 + searchAllSchemas: EquipmentSupplier.allSchemas, // 查询弹窗所需类 + searchPage: EquipmentSupplierApi.getEquipmentSupplierPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + isMainValue: false + }] + } + }, + }, + { + label: '采购时间', + field: 'purchaseTime', + 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')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + } + }, + { + label: '采购部门', + field: 'purchaseDept', + sort: 'custom', + isSearch: false + }, + { + label: '采购人', + field: 'purchaser', + sort: 'custom', + isSearch: false + }, + { + label: '出厂日期', + field: 'productionDate', + 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')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + } + }, + { + label: '生产厂商', + field: 'manufactureCode', + sort: 'custom', + isSearch: true, + isDetail: false, + isForm: false, + isTable: true, + isTableForm: false, + search: { + component: 'Select', + componentProps: { + options: equipmentManufacturerNoPage, + optionsAlias: { + labelField: 'name', + valueField: 'number' + } + } + }, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return equipmentManufacturerNoPage.find((item) => item.number == cellValue)?.name + }, + }, + { + label: '生产厂商', + field: 'manufactureName', + sort: 'custom', + isSearch: false, + form: { + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择厂商', // 输入框占位文本 + searchField: 'number', // 查询弹窗赋值字段 + searchTitle: '生产厂商', // 查询弹窗标题 + searchAllSchemas: EquipmentManufacturer.allSchemas, // 查询弹窗所需类 + searchPage: EquipmentManufacturerApi.getEquipmentManufacturerPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + isMainValue: false + }] + } + }, + }, + { + label: '设备使用寿命', + field: 'equipmentLife', + sort: 'custom', + isSearch: false + }, + { + label: '验收日期', + field: 'acceptanceDate', + 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')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + } + }, + { + label: '价格', + field: 'purchasePrice', + sort: 'custom', + isSearch: false + }, + { + label: '车间编号', + field: 'workshopCode', + sort: 'custom', + isSearch: true, + isDetail: false, + isForm: false, + isTable: true, + isTableForm: false, + search: { + component: 'Select', + componentProps: { + options: workshopNoPage, + optionsAlias: { + labelField: 'name', + valueField: 'code' + }, + filterable: true, + } + }, + formatter: (_: Recordable, __: TableColumn, cellValue: string) => { + return workshopNoPage.find((item) => item.code == cellValue)?.name + }, + }, + { + label: '车间编号', + field: 'workshopName', + sort: 'custom', + isTable: false, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择车间代码', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '车间信息', // 查询弹窗标题 + searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类 + searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + isMainValue: false + }] + } + }, + }, + { + label: '工段编号', + field: 'workshopSectionCode', + sort: 'custom', + isSearch: false + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + isSearch: true + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) diff --git a/src/views/eam/equipmentAccounts/index.vue b/src/views/eam/equipmentAccounts/index.vue new file mode 100644 index 000000000..a85b33ce1 --- /dev/null +++ b/src/views/eam/equipmentAccounts/index.vue @@ -0,0 +1,293 @@ + + + diff --git a/src/views/eam/relationMainPart/index.vue b/src/views/eam/relationMainPart/index.vue new file mode 100644 index 000000000..f781d723f --- /dev/null +++ b/src/views/eam/relationMainPart/index.vue @@ -0,0 +1,244 @@ + + + diff --git a/src/views/eam/relationMainPart/relationMainPart.data.ts b/src/views/eam/relationMainPart/relationMainPart.data.ts new file mode 100644 index 000000000..b1d1ae513 --- /dev/null +++ b/src/views/eam/relationMainPart/relationMainPart.data.ts @@ -0,0 +1,122 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + + +// 表单校验 +export const RelationMainPartRules = reactive({ + mainPartCode: [required], + equipmentCode: [required], + type: [required], + concurrencyStamp: [required] +}) + +export const RelationMainPart = useCrudSchemas(reactive([ + { + label: '主要零件编号', + field: 'mainPartCode', + sort: 'custom', + isSearch: true + }, + { + label: '编码', + field: 'equipmentCode', + sort: 'custom', + isSearch: true + }, + { + label: '类别', + field: 'type', + sort: 'custom', + isSearch: true, + form: { + component: 'SelectV2' + } + }, + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: true, + 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 + }, + { + label: '部门', + field: 'departmentCode', + sort: 'custom', + isSearch: true + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + isSearch: true + }, + { + label: '地点', + field: 'siteId', + sort: 'custom', + isSearch: true + }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + isSearch: true + }, + { + label: '删除时间', + field: 'deletionTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: true, + 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')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + } + }, + { + label: '删除人', + field: 'deleterId', + sort: 'custom', + isSearch: true + }, + { + label: '并发乐观锁', + field: 'concurrencyStamp', + sort: 'custom', + isSearch: true, + form: { + component: 'InputNumber', + value: 0 + } + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) diff --git a/src/views/eam/sparePart/index.vue b/src/views/eam/sparePart/index.vue new file mode 100644 index 000000000..3471dd480 --- /dev/null +++ b/src/views/eam/sparePart/index.vue @@ -0,0 +1,244 @@ + + + diff --git a/src/views/eam/sparePart/sparePart.data.ts b/src/views/eam/sparePart/sparePart.data.ts new file mode 100644 index 000000000..cd8e20602 --- /dev/null +++ b/src/views/eam/sparePart/sparePart.data.ts @@ -0,0 +1,264 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' +import * as ConfigApi from '@/api/infra/config' +const autoCodeSwitch = await ConfigApi.getConfigKey('sparePartCodeAutoSwitch') +const autoSwitch = ref(false) +if (autoCodeSwitch == 'TRUE') { + autoSwitch.value = true +} + +// 表单校验 +export const SparePartRules = reactive({ + code: [required], + name: [required], + isOverall: [required], + uom: [required], + concurrencyStamp: [required] +}) + +export const SparePart = useCrudSchemas(reactive([ + { + label: '备件编号', + field: 'code', + sort: 'custom', + isForm: !autoSwitch.value, + isSearch: true, + fixed: 'left' + }, + { + label: '名称', + field: 'name', + sort: 'custom', + isSearch: true + }, + { + label: '品牌', + field: 'brand', + sort: 'custom', + isSearch: false + }, + { + label: '规格型号', + field: 'specifications', + sort: 'custom', + isSearch: false + }, + { + label: '是否全局', + field: 'isOverall', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: true, + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + } + }, + { + label: '是否存储', + field: 'isConstant', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: true, + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + } + }, + { + label: '科目', + field: 'subject', + sort: 'custom', + dictType: DICT_TYPE.SUBJECT, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: true, + form: { + component: 'Select' + } + }, + { + label: '科目代码', + field: 'subjectCode', + sort: 'custom', + isSearch: false + }, + { + label: '类别', + field: 'category', + sort: 'custom', + isSearch: false + }, + { + label: '区域', + field: 'region', + sort: 'custom', + dictType: DICT_TYPE.REGION, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: false, + form: { + component: 'Select' + } + }, + { + label: '备件分类', + field: 'classification', + sort: 'custom', + dictType: DICT_TYPE.PART_CLASS, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: true, + form: { + component: 'Select' + } + }, + { + label: '单位', + field: 'uom', + sort: 'custom', + isSearch: false + }, + { + label: '单价', + field: 'singlePrice', + sort: 'custom', + isSearch: false + }, + { + label: '库龄', + field: 'stockAge', + sort: 'custom', + isSearch: false, + form: { + component: 'InputNumber', + value: 0 + } + }, + { + label: '重采购点', + field: 'reprocurement', + sort: 'custom', + isSearch: false, + form: { + component: 'InputNumber', + value: 0 + } + }, + { + label: '安全库存', + field: 'safetyStock', + sort: 'custom', + isSearch: false, + form: { + component: 'InputNumber', + value: 0 + } + }, + { + label: '成本中心', + field: 'cost', + sort: 'custom', + isSearch: false + }, + { + label: '采购员', + field: 'purchaser', + sort: 'custom', + isSearch: false + }, + { + label: '财务', + field: 'financer', + sort: 'custom', + isSearch: false + }, + { + label: '采购时间', + field: 'purchaseTime', + 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')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + } + }, + { + label: '是否框架协议', + field: 'isFramework', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: true, + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + } + }, + { + label: '是否以旧换新', + field: 'isRadeIn', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: true, + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + } + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + isSearch: true + }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isTable: true, + isDetail: false, + isForm: false, + isSearch: false, + isTableForm: false, + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +]))