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.
202 lines
4.1 KiB
202 lines
4.1 KiB
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
import { selectAllFactoryArea } from '@/api/system/dept'
|
|
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
|
|
// 邮箱账号的列表
|
|
const factoryList = await selectAllFactoryArea()
|
|
const deviceList = ref([]);
|
|
const deviceListNoPage = await DeviceAccountsApi.getDeviceAccountsAllNoPage({})
|
|
|
|
// 表单校验
|
|
export const DeviceRepairRules = reactive({
|
|
number: [required],
|
|
deviceNumber: [required],
|
|
factoryAreaNumber: [required],
|
|
declarer: [required],
|
|
faultType: [required],
|
|
type: [required],
|
|
available: [required],
|
|
concurrencyStamp: [required],
|
|
// result: [required],
|
|
})
|
|
|
|
export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
|
|
{
|
|
label: 'id',
|
|
field: 'id',
|
|
sort: 'custom',
|
|
table: {
|
|
width: '150',
|
|
},
|
|
isSearch: false,
|
|
isForm: false,
|
|
isTable: false
|
|
},
|
|
{
|
|
label: '报修工单编号',
|
|
field: 'number',
|
|
sort: 'custom',
|
|
table: {
|
|
width: '150',
|
|
},
|
|
isSearch: true,
|
|
isForm: false
|
|
},
|
|
{
|
|
label: '厂区',
|
|
field: 'factoryAreaNumber',
|
|
sort: 'custom',
|
|
table: {
|
|
width: '150',
|
|
},
|
|
api: () => factoryList,
|
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
|
|
return factoryList.find((account) => account.id == cellValue)?.name
|
|
},
|
|
search: {
|
|
show: true,
|
|
component: 'Select',
|
|
api: () => factoryList,
|
|
componentProps: {
|
|
optionsAlias: {
|
|
labelField: 'name',
|
|
valueField: 'id'
|
|
}
|
|
}
|
|
},
|
|
form: {
|
|
component: 'Select',
|
|
api: () => factoryList,
|
|
componentProps: {
|
|
optionsAlias: {
|
|
labelField: 'name',
|
|
valueField: 'id'
|
|
},
|
|
onChange: (val) => {
|
|
DeviceAccountsApi.getDeviceAccountsNoPage({
|
|
isSearch: false,
|
|
factoryAreaNumber: val
|
|
}).then((res) => {
|
|
deviceList.value = res
|
|
}).catch((e) => {
|
|
console.log(e)
|
|
})
|
|
}
|
|
},
|
|
}
|
|
},
|
|
{
|
|
label: '设备',
|
|
field: 'deviceNumber',
|
|
sort: 'custom',
|
|
table: {
|
|
width: '150',
|
|
},
|
|
isSearch: true,
|
|
api: () => DeviceAccountsApi.getDeviceAccountsNoPage({
|
|
isSearch: false
|
|
}),
|
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
|
|
return deviceListNoPage.find((account) => account.number == cellValue)?.name
|
|
},
|
|
form: {
|
|
component: 'Select',
|
|
componentProps: {
|
|
options: deviceList,
|
|
optionsAlias: {
|
|
labelField: 'name',
|
|
valueField: 'number'
|
|
},
|
|
},
|
|
}
|
|
},
|
|
{
|
|
label: '报修人电话',
|
|
field: 'declarerPhone',
|
|
sort: 'custom',
|
|
table: {
|
|
width: '150',
|
|
},
|
|
},
|
|
{
|
|
label: '故障类型',
|
|
field: 'faultType',
|
|
sort: 'custom',
|
|
table: {
|
|
width: '150',
|
|
},
|
|
dictType: DICT_TYPE.FAULT_TYPE,
|
|
dictClass: 'string',
|
|
form: {
|
|
component: 'Select'
|
|
},
|
|
},
|
|
{
|
|
label: '描述',
|
|
field: 'describe',
|
|
sort: 'custom',
|
|
table: {
|
|
width: '150',
|
|
},
|
|
form: {
|
|
component: 'Input',
|
|
componentProps: {
|
|
type: 'textarea',
|
|
}
|
|
|
|
},
|
|
},
|
|
{
|
|
label: '是否可用',
|
|
field: 'available',
|
|
sort: 'custom',
|
|
table: {
|
|
width: '150',
|
|
},
|
|
dictType: DICT_TYPE.TRUE_FALSE,
|
|
dictClass: 'string',
|
|
form: {
|
|
component: 'Switch',
|
|
value: 'TRUE',
|
|
componentProps: {
|
|
inactiveValue: 'FALSE',
|
|
activeValue: 'TRUE'
|
|
}
|
|
},
|
|
},
|
|
{
|
|
label: '维修状态',
|
|
field: 'result',
|
|
sort: 'custom',
|
|
table: {
|
|
width: '150',
|
|
},
|
|
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
|
|
dictClass: 'string',
|
|
isSearch: true,
|
|
isForm: false,
|
|
form: {
|
|
component: 'Select',
|
|
},
|
|
},
|
|
{
|
|
label: '图片',
|
|
field: 'upload',
|
|
isForm: true,
|
|
form: {
|
|
component: 'UploadImgs',
|
|
componentProps: {
|
|
limit:3,
|
|
}
|
|
}
|
|
},
|
|
{
|
|
label: '操作',
|
|
field: 'action',
|
|
isForm: false,
|
|
table: {
|
|
width: 150,
|
|
fixed: 'right'
|
|
}
|
|
}
|
|
]))
|
|
|