ljlong_2630
6 months ago
14 changed files with 1816 additions and 69 deletions
@ -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' }) |
|||
} |
@ -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 }) |
|||
} |
@ -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 }) |
|||
} |
@ -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' }) |
|||
} |
@ -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<CrudSchema[]>([ |
|||
{ |
|||
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' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,293 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="EquipmentAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="EquipmentAccounts.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="EquipmentAccountsRules" |
|||
:formAllSchemas="EquipmentAccounts.allSchemas" |
|||
:apiUpdate="EquipmentAccountsApi.updateEquipmentAccounts" |
|||
:apiCreate="EquipmentAccountsApi.createEquipmentAccounts" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentAccounts.allSchemas" /> |
|||
<!-- 主要部件 --> |
|||
<SearchTable ref="searchTableRef" @onMountedCallBack="onMountedCallBack" @searchTableSuccess="submitItem" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/equipment-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { EquipmentAccounts,EquipmentAccountsRules } from './equipmentAccounts.data' |
|||
import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
import { RelationMainPart,RelationMainPartRules } from '../relationMainPart/relationMainPart.data' |
|||
import * as RelationMainPartApi from '@/api/eam/relationMainPart' |
|||
|
|||
defineOptions({ name: 'EquipmentAccounts' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(EquipmentAccounts.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: EquipmentAccountsApi.getEquipmentAccountsPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:equipment-accounts:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:equipment-accounts:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:equipment-accounts:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:equipment-accounts:update'}), // 编辑 |
|||
defaultButtons.componentBtn({hasPermi:'eam:equipment-accounts:component'}), // 部件 |
|||
defaultButtons.itemBtn({hasPermi:'eam:equipment-accounts:item'}), // 备件 |
|||
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-accounts:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} else if (val == 'component') { // 部件 |
|||
openComponent(row) |
|||
} else if (val == 'part') { // 备件 |
|||
openItem(row) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =EquipmentAccounts.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; |
|||
if (formType === 'create') { |
|||
await EquipmentAccountsApi.createEquipmentAccounts(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await EquipmentAccountsApi.updateEquipmentAccounts(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicEquipmentAccounts') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await EquipmentAccountsApi.deleteEquipmentAccounts(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await EquipmentAccountsApi.exportEquipmentAccounts(tableObject.params) |
|||
download.excel(data, '设备台账.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '设备台账导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
|
|||
const searchTableRef = ref() |
|||
const searchTableSelections = ref([]) |
|||
// const syncData = async () => { |
|||
// await RelationMainPartApi.getRelationMainPartNoPage({ deviceNumber: deviceNumber.value }).then(async (res) => { |
|||
// await ItemApi.getItemNoPage().then(response => { |
|||
// searchTableSelections.value = response.filter(element => { |
|||
// let flag = false; |
|||
// res.forEach(item => { |
|||
// if (element.number == item.itemNumber) { |
|||
// flag = true; |
|||
// } |
|||
// }); |
|||
// return flag; |
|||
// }); |
|||
// }); |
|||
// }); |
|||
// }; |
|||
/** 绑定备件操作 */ |
|||
const openComponent = async (row : any) => { |
|||
searchTableRef.value.open( |
|||
'选择部件', |
|||
RelationMainPart.allSchemas, |
|||
RelationMainPartApi.getRelationMainPartPage, |
|||
null, |
|||
RelationMainPart.allSchemas.searchSchema, |
|||
true, |
|||
null, |
|||
null, |
|||
null, |
|||
null, |
|||
searchTableSelections.value |
|||
) |
|||
} |
|||
|
|||
const openItem = async (number : String) => { |
|||
|
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await EquipmentAccountsApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="RelationMainPart.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="RelationMainPart.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="RelationMainPartRules" |
|||
:formAllSchemas="RelationMainPart.allSchemas" |
|||
:apiUpdate="RelationMainPartApi.updateRelationMainPart" |
|||
:apiCreate="RelationMainPartApi.createRelationMainPart" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="RelationMainPart.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/relation/main-part/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { RelationMainPart,RelationMainPartRules } from './relationMainPart.data' |
|||
import * as RelationMainPartApi from '@/api/eam/relationMainPart' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'RelationMainPart' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(RelationMainPart.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: RelationMainPartApi.getRelationMainPartPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:main-part:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:main-part:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:main-part:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:main-part:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:main-part:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =RelationMainPart.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; |
|||
if (formType === 'create') { |
|||
await RelationMainPartApi.createRelationMainPart(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await RelationMainPartApi.updateRelationMainPart(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicMainPart') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await RelationMainPartApi.deleteRelationMainPart(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await RelationMainPartApi.exportRelationMainPart(tableObject.params) |
|||
download.excel(data, '主要部件关联.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '主要部件关联导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await RelationMainPartApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -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<CrudSchema[]>([ |
|||
{ |
|||
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' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="SparePart.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="SparePart.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="SparePartRules" |
|||
:formAllSchemas="SparePart.allSchemas" |
|||
:apiUpdate="SparePartApi.updateSparePart" |
|||
:apiCreate="SparePartApi.createSparePart" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="SparePart.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/sparepart/spare-part/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { SparePart,SparePartRules } from './sparePart.data' |
|||
import * as SparePartApi from '@/api/eam/sparePart' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'SparePart' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(SparePart.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: SparePartApi.getSparePartPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:spare-part:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:spare-part:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:spare-part:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:spare-part:update'}), // 编辑 |
|||
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:spare-part:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =SparePart.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; |
|||
if (formType === 'create') { |
|||
await SparePartApi.createSparePart(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await SparePartApi.updateSparePart(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicSparePart') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await SparePartApi.deleteSparePart(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await SparePartApi.exportSparePart(tableObject.params) |
|||
download.excel(data, '备件基础.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '备件基础导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await SparePartApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -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<CrudSchema[]>([ |
|||
{ |
|||
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' |
|||
} |
|||
} |
|||
])) |
Loading…
Reference in new issue