You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

652 lines
16 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as ConfigApi from '@/api/infra/config'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier'
import { EquipmentSupplier } from '@/views/eam/equipmentSupplier/equipmentSupplier.data'
import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer'
import { EquipmentManufacturer } from '@/views/eam/equipmentManufacturer/equipmentManufacturer.data'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({})
const equipmentManufacturerNoPage = await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({})
const equipmentSupplierNoPage = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({});
const autoCodeSwitch = await ConfigApi.getConfigKey('deviceCodeAutoSwitch')
// ProductionlineApi.getProductionlinePage
const autoSwitch = ref(false)
if (autoCodeSwitch == 'TRUE') {
autoSwitch.value = true
}
// 表单校验
export const ToolAccountsRules = reactive({
code: [required],
name: [required],
concurrencyStamp: [required]
})
export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '工装编号',
field: 'code',
sort: 'custom',
isSearch: true,
isForm: !autoSwitch.value,
fixed: 'left'
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true
},
{
label: '型号',
field: 'specification',
sort: 'custom',
isSearch: true
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.TOOL_CLASS,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Select'
}
},
{
label: '产权',
field: 'equity',
sort: 'custom',
isSearch: false
},
{
label: '电机',
field: 'electricMachine',
sort: 'custom',
isSearch: false
},
{
label: '是否客户资质',
field: 'isCustomerAptitude',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.INFRA_BOOLEAN_STRING,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Radio'
}
},
{
label: '客户',
field: 'customerId',
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: false,
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: string) => {
return equipmentSupplierNoPage.find((item) => item.number == cellValue)?.name
},
},
{
label: '供应商',
field: 'supplierName',
sort: 'custom',
isSearch: false,
isTable: 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: true
},
{
label: '采购人',
field: 'purchaser',
sort: 'custom',
isSearch: true
},
{
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: string) => {
return equipmentManufacturerNoPage.find((item) => item.number == cellValue)?.name
},
},
{
label: '生产厂商',
field: 'manufactureName',
sort: 'custom',
isSearch: false,
isTable: 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: 'factoryAreaCode',
// sort: 'custom',
// isSearch: true
// },
{
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, // 查询弹窗所需分页方法
disable:true,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '产线编号',
field: 'lineCode',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: productionlineNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return productionlineNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '产线编号',
field: 'lineName',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
// {
// label: '工序编号',
// field: 'processCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择工序代码',
// searchField: 'code',
// searchTitle: '工序信息',
// searchAllSchemas: Process.allSchemas,
// searchPage: ProcessApi.getProcessPage,
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '工位编号',
// field: 'workstationCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择工位', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '工位信息', // 查询弹窗标题
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key:'available',
// value:'TRUE',
// isMainValue: false
// }]
// }
// },
// },
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
isSearch: false
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// isSearch: false,
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
{
label: '平均故障间隔时间',
field: 'purchaseInterval',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '总运行时长',
field: 'totalRunningTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: 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: 'maintenanceRunningTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: 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: 'usageTimes',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '上一次检验日期',
field: 'lastInspectionDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: 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: 'outageRate',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '平均故障恢复时间',
field: 'breakdownRecover',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))