Browse Source

维修转办代码

master
ljlong_2630 8 months ago
parent
commit
44a11c275f
  1. 123
      src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts
  2. 163
      src/views/eam/device/devicemaintenancejob/index.vue
  3. 229
      src/views/eam/mold/moldmaintenancejob/index.vue
  4. 181
      src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts

123
src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts

@ -6,10 +6,13 @@ import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
import * as UserApi from '@/api/system/user'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { selecUserByType } from '@/api/system/dept'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userListAll = await UserApi.getSimpleUserList()
const deviceListAll = await DeviceAccountsApi.getDeviceAccountsAllNoPage({})
const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: null })
const deviceTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value != 'MOLD')
const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
// 表单校验
@ -51,7 +54,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
isTable: true,
},
{
label: '设备模具编号',
label: '设备模具',
field: 'deviceNumber',
sort: 'custom',
table: {
@ -59,7 +62,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
},
api: () => deviceList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceList.find((account) => account.number == cellValue)?.name
return deviceListAll.find((account) => account.number == cellValue)?.name
},
search: {
show: false,
@ -84,7 +87,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '厂区编号',
label: '厂区',
field: 'factoryAreaNumber',
sort: 'custom',
isDetail: false,
@ -120,7 +123,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '厂区编号',
label: '厂区',
field: 'factoryAreaNumber1',
sort: 'custom',
isDetail: true,
@ -464,6 +467,7 @@ export const DeviceMaintenanceMainSecRules = reactive({
deviceNumber: [required],
factoryAreaNumber: [required],
maintenance: [required],
turnType: [required],
type: [required],
classes: [required],
faultType: [required],
@ -507,44 +511,43 @@ export const DeviceMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
dictClass: 'string',
form: {
component: 'Select',
value: 0,
}
},
{
label: '设备模具编号',
field: 'deviceNumber',
label: '类型',
field: 'type',
sort: 'custom',
table: {
width: '150',
},
api: () => deviceList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceList.find((account) => account.number == cellValue)?.name
return deviceMoldTypeList.find((account) => account.value == cellValue)?.label
},
isSearch: true,
search: {
show: false,
component: 'Input',
api: () => deviceList,
component: 'Select',
componentProps: {
options: deviceMoldTypeList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
}
}
labelField: 'label',
valueField: 'value'
},
},
},
form: {
component: 'Select',
api: () => deviceList,
componentProps: {
options: deviceMoldTypeList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
labelField: 'label',
valueField: 'value'
},
placeholder: "请选择设备"
}
},
},
{
label: '厂区编号',
label: '厂区',
field: 'factoryAreaNumber',
sort: 'custom',
isDetail: false,
@ -580,7 +583,7 @@ export const DeviceMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '厂区编号',
label: '厂区',
field: 'factoryAreaNumber1',
sort: 'custom',
isDetail: true,
@ -591,6 +594,39 @@ export const DeviceMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
width: 150
}
},
{
label: '设备模具',
field: 'deviceNumber',
sort: 'custom',
table: {
width: '150',
},
api: () => deviceList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceListAll.find((account) => account.number == cellValue)?.name
},
search: {
show: false,
component: 'Input',
api: () => deviceList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
}
}
},
form: {
component: 'Select',
api: () => deviceList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
},
}
},
{
label: '维修人',
field: 'maintenance',
@ -599,17 +635,17 @@ export const DeviceMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
api: () => userListAll,
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userListAll.find((account) => account.id == cellValue)?.nickname
return dutyUserList.find((account) => account.id == cellValue)?.name
},
form: {
component: 'Select',
api: () => userListAll,
api: () => dutyUserList,
componentProps: {
disabled: true,
disabled: false,
optionsAlias: {
labelField: 'nickname',
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择设备"
@ -628,39 +664,6 @@ export const DeviceMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
width: 150
}
},
{
label: '类型',
field: 'type',
sort: 'custom',
table: {
width: '150',
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceMoldTypeList.find((account) => account.value == cellValue)?.label
},
isSearch: true,
search: {
component: 'Select',
componentProps: {
options: deviceTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
},
},
form: {
component: 'Select',
componentProps: {
options: deviceTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
placeholder: "请选择设备"
}
},
},
{
label: '班次',
field: 'classes',

163
src/views/eam/device/devicemaintenancejob/index.vue

@ -76,11 +76,11 @@
:apiUpdate="DeviceMaintenanceMainApi.updateDeviceMaintenanceMain"
:apiCreate="DeviceMaintenanceMainApi.createDeviceMaintenanceMain"
:isBusiness="false"
@onChange="onChange"
@onChange="onChangeSec"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
@submitForm="submitFormSec"
@success="submitForm"
:isSearchTableItem="true"
/>
@ -140,6 +140,8 @@ import {
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import * as DeviceMaintenanceDetailApi from '@/api/eam/device/deviceMaintenanceDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
@ -161,6 +163,10 @@ const viewTitle = ref('图片预览')
const urls = ref([])
const viewKey = ref(0)
const operatRecord = ref()
const newRow = ref()
const deviceList = ref()
const moldList = ref()
const repairUser = ref()
//
const updataTableColumns = (val) => {
tableColumns.value = val
@ -300,6 +306,92 @@ const onChange = (field, cur, item) => {
formRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id)
}
}
const onChangeSec = (field, cur, item,formRefSec) => {
if (field == 'type') {
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = false
if (cur == 'MOLD') {
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.options = moldList.value
selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: null }).then(res => {
repairUser.value = res
const setV = {}
setV['maintenance'] = ''
formRefSec.setValues(setV)
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'maintenance'
}).componentProps.options = res
})
const setV = {}
setV['deviceNumber'] = ''
formRefSec.setValues(setV)
} else {
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.options = deviceList.value
selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: null }).then(res => {
repairUser.value = res
const setV = {}
setV['maintenance'] = ''
formRefSec.setValues(setV)
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'maintenance'
}).componentProps.options = res
})
const setV = {}
setV['deviceNumber'] = ''
formRefSec.setValues(setV)
}
}
if (field == 'turnType') {
if (cur == '0') {
const setV = {}
setV['factoryAreaNumber'] = newRow.value.factoryAreaNumber
setV['maintenance'] = newRow.value.maintenance
formRefSec.setValues(setV)
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).componentProps.disabled = false
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = false
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'factoryAreaNumber'
}).componentProps.disabled = true
} else if (cur == '1') {
const setV = {}
setV['deviceNumber'] = newRow.value.deviceNumber
setV['type'] = newRow.value.type
formRefSec.setValues(setV)
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).componentProps.disabled = true
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = true
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'factoryAreaNumber'
}).componentProps.disabled = false
}
}
if (field == 'factoryAreaNumber') {
selecUserByType({ classType: 'DEVICE', factoryAreaNumber: cur, flag: null }).then(res => {
repairUser.value = res
const setV = {}
setV['maintenance'] = ''
formRefSec.setValues(setV)
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'maintenance'
}).componentProps.options = res
})
}
}
// -
const buttonTableClick = async (val, row) => {
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false
@ -334,12 +426,39 @@ const buttonTableClick = async (val, row) => {
const openForm = (type: string, row?: any) => {
tableData.value = [] //
debugger
formRef.value.open(type, row)
}
const openFormSec = (type: string, row?: any) => {
const openFormSec = async (type: string, row?: any) => {
tableData.value = [] //
formRefSec.value.open(type, row)
newRow.value = { ...row }
newRow.value.turnType = '0'
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).componentProps.disabled = false
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = false
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'factoryAreaNumber'
}).componentProps.disabled = true
await MoldAccountsApi.getMoldAccountsNoPage({})
.then(res => {
moldList.value = res
})
await DeviceAccountsApi.getDeviceAccountsNoPage({})
.then(res => {
deviceList.value = res
})
if (row.type == 'MOLD') {
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.options = moldList.value
} else {
DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.options = deviceList.value
}
formRefSec.value.open(type, newRow.value)
}
/** 详情操作 */
@ -482,12 +601,46 @@ const submitForm = async (formType, data) => {
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
formRefSec.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
formRefSec.value.formLoading = false
}
}
//
const submitFormSec = async (formType, data) => {
data.subList = tableData.value.map((item) => {
return {
describes: item.describes,
describes1: item.describes1,
itemNumbers: item.itemNumbers,
maintenances: item.maintenances.join(','),
workOut: item.workOut,
factoryAreaNumber: newRow.value.factoryAreaNumber,
}
}) //
console.log(data.subList)
try {
if (formType === 'create') {
await DeviceMaintenanceMainApi.createDeviceMaintenanceMain(data)
message.success(t('common.createSuccess'))
} else {
await DeviceMaintenanceMainApi.updateDeviceMaintenanceMain(data)
message.success(t('common.updateSuccess'))
}
formRefSec.value.dialogVisible = false
//
getList()
} finally {
formRefSec.value.formLoading = false
}
}
const detailOpenForm = (type, row) =>{
console.log("type",type);
console.log("row",row);

229
src/views/eam/mold/moldmaintenancejob/index.vue

@ -65,6 +65,26 @@
:isSearchTableItem="true"
/>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRefSec"
:rules="MoldMaintenanceMainSecRules"
:formAllSchemas="MoldMaintenanceMainSec.allSchemas"
:tableAllSchemas="MoldMaintenanceDetail.allSchemas"
:tableFormRules="MoldMaintenanceDetailRules"
:tableData="tableData"
:apiUpdate="MoldMaintenanceMainApi.updateMoldMaintenanceMain"
:apiCreate="MoldMaintenanceMainApi.createMoldMaintenanceMain"
:isBusiness="false"
@onChange="onChangeSec"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitFormSec"
@success="submitForm"
:isSearchTableItem="true"
/>
<!-- 详情 -->
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintenanceMain.allSchemas" /> -->
<Detail
@ -83,6 +103,7 @@
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
:openFormCallBack="openFormCallBack"
/>
<!-- 导入 -->
@ -112,13 +133,18 @@ import {
MoldMaintenanceMain,
MoldMaintenanceMainRules,
MoldMaintenanceDetail,
MoldMaintenanceDetailRules
MoldMaintenanceDetailRules,
MoldMaintenanceMainSec,
MoldMaintenanceMainSecRules,
} from './moldMaintenanceMain.data'
import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain'
import * as MoldMaintenanceDetailApi from '@/api/eam/mold/moldMaintenanceDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
const moldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value == 'MOLD')
@ -129,10 +155,16 @@ const userStore = useUserStore() // 用户信息
const route = useRoute() //
const routeName = ref()
const formRef = ref()
const formRefSec = ref()
const showView = ref(false)
const viewTitle = ref('图片预览')
const urls = ref([])
const viewKey = ref(0)
const operatRecord = ref()
const newRow = ref()
const deviceList = ref()
const moldList = ref()
const repairUser = ref()
routeName.value = route.name
const tableColumns = ref(MoldMaintenanceMain.allSchemas.tableColumns)
@ -305,16 +337,7 @@ const buttonTableClick = async (val, row) => {
} else if (val == 'acceptOrder') {
acceptOrder(row)
} else if (val == 'turnOrder') {
MoldMaintenanceMain.allSchemas.formSchema.find(item => {
return item.field == 'turnType'
}).isForm = true
MoldMaintenanceMain.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).componentProps.options = deviceMoldTypeList
MoldMaintenanceMain.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).componentProps.disabled = false
openForm('turnOrder', row)
openFormSec('turnOrder', row)
} else if (val == 'finishOrder') {
finishOrder(row)
} else if (val == 'verifyOrder') {
@ -338,6 +361,7 @@ const openForm = (type: string, row?: any) => {
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
operatRecord.value = row;
detailRef.value.openDetail(row, titleName, titleValue,'MoldMaintenanceMain')
}
@ -556,6 +580,189 @@ const detailSubmitForm= async (formType,data,getList,formRef,tableList) => {
}
}
const openFormCallBack = (type, row, masterParmas, callback) => {
if (operatRecord.value.type == 'TECH') {
MoldMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'maintenance') {
selecUserByType({ classType: 'TECH', factoryAreaNumber: '', flag: 1 }).then(response => {
item.componentProps.options = response
callback();
});
}
})
} else if (operatRecord.value.type == 'DEVICE') {
MoldMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'maintenance') {
selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 }).then(response => {
item.componentProps.options = response
callback();
});
}
})
} else if (operatRecord.value.type == 'MOLD') {
MoldMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'maintenance') {
selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 }).then(response => {
item.componentProps.options = response
callback();
});
}
})
}
}
const openFormSec = async (type: string, row?: any) => {
tableData.value = [] //
newRow.value = { ...row }
newRow.value.turnType = '0'
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).componentProps.disabled = false
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = false
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'factoryAreaNumber'
}).componentProps.disabled = true
await MoldAccountsApi.getMoldAccountsNoPage({})
.then(res => {
moldList.value = res
})
await DeviceAccountsApi.getDeviceAccountsNoPage({})
.then(res => {
deviceList.value = res
})
if (row.type == 'MOLD') {
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.options = moldList.value
} else {
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.options = deviceList.value
}
formRefSec.value.open(type, newRow.value)
}
const onChangeSec = (field, cur, item,formRefSec) => {
if (field == 'type') {
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = false
if (cur == 'MOLD') {
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.options = moldList.value
selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: null }).then(res => {
repairUser.value = res
const setV = {}
setV['maintenance'] = ''
formRefSec.setValues(setV)
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'maintenance'
}).componentProps.options = res
})
const setV = {}
setV['deviceNumber'] = ''
formRefSec.setValues(setV)
} else {
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.options = deviceList.value
selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: null }).then(res => {
repairUser.value = res
const setV = {}
setV['maintenance'] = ''
formRefSec.setValues(setV)
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'maintenance'
}).componentProps.options = res
})
const setV = {}
setV['deviceNumber'] = ''
formRefSec.setValues(setV)
}
}
if (field == 'turnType') {
if (cur == '0') {
const setV = {}
setV['factoryAreaNumber'] = newRow.value.factoryAreaNumber
setV['maintenance'] = newRow.value.maintenance
formRefSec.setValues(setV)
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).componentProps.disabled = false
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = false
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'factoryAreaNumber'
}).componentProps.disabled = true
} else if (cur == '1') {
const setV = {}
setV['deviceNumber'] = newRow.value.deviceNumber
setV['type'] = newRow.value.type
formRefSec.setValues(setV)
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).componentProps.disabled = true
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = true
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'factoryAreaNumber'
}).componentProps.disabled = false
}
}
if (field == 'factoryAreaNumber') {
selecUserByType({ classType: 'DEVICE', factoryAreaNumber: cur, flag: null }).then(res => {
repairUser.value = res
const setV = {}
setV['maintenance'] = ''
formRefSec.setValues(setV)
MoldMaintenanceMainSec.allSchemas.formSchema.find(item => {
return item.field == 'maintenance'
}).componentProps.options = res
})
}
}
//
const submitFormSec = async (formType, data) => {
data.subList = tableData.value.map((item) => {
return {
describes: item.describes,
describes1: item.describes1,
itemNumbers: item.itemNumbers,
maintenances: item.maintenances.join(','),
workOut: item.workOut,
factoryAreaNumber: newRow.value.factoryAreaNumber,
}
}) //
console.log(data.subList)
try {
if (formType === 'create') {
await DeviceMaintenanceMainApi.createDeviceMaintenanceMain(data)
message.success(t('common.createSuccess'))
} else {
await DeviceMaintenanceMainApi.updateDeviceMaintenanceMain(data)
message.success(t('common.updateSuccess'))
}
formRefSec.value.dialogVisible = false
//
getList()
} finally {
formRefSec.value.formLoading = false
}
}
/** 初始化 **/
onMounted(async () => {
getList()

181
src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts

@ -5,10 +5,16 @@ import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
import * as UserApi from '@/api/system/user'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const userListAll = await UserApi.getSimpleUserList()
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const moldList = await MoldAccountsApi.getMoldAccountsNoPage({})
const userList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: null })
const deviceTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value == 'MOLD')
const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
// 表单校验
export const MoldMaintenanceMainRules = reactive({
number: [required],
@ -51,20 +57,32 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
isSearch: false,
isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceMoldTypeList.find((account) => account.value == cellValue)?.label
},
isSearch: true,
search: {
component: 'Select',
componentProps: {
options: deviceTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
},
},
form: {
component: 'Select',
componentProps: {
disabled: true,
}
options: deviceTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
search: {
value: 'MOLD'
placeholder: "请选择设备"
}
},
},
{
label: '设备模具编号',
field: 'deviceNumber',
@ -141,9 +159,13 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
width: '150',
},
isSearch: true,
api: () => userListAll,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userListAll.find((account) => account.id == cellValue)?.nickname
},
form: {
component: 'Select',
api: () => userList,
api: () => userListAll,
componentProps: {
disabled: true,
optionsAlias: {
@ -263,24 +285,24 @@ export const MoldMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修人',
field: 'maintenances',
sort: 'custom',
api: () => userList,
api: () => userListAll,
formatter: (_: Recordable, __: TableColumn, cellValue) => {
return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',')
return userListAll.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.nickname).join(',')
},
tableForm: {
type: 'Select',
initOptions: userList,
initOptions: userListAll,
multiple:true,
collapseTags:true,
collapseTagsTooltip:true,
optionsAlias: {
labelField: 'name',
labelField: 'nickname',
valueField: 'id'
}
},
form:{
component: 'Select',
api: () => userList,
api: () => userListAll,
componentProps: {
multiple:true,
collapseTags:true,
@ -374,10 +396,14 @@ export const MoldMaintenanceMainSecRules = reactive({
deviceNumber: [required],
factoryAreaNumber: [required],
maintenance: [required],
turnType: [required],
type: [required],
classes: [required],
faultType: [required],
describes : [required],
describes : [
required,
{ max: 200, message: '不得超过200个字符', trigger: 'blur' },
],
})
@ -403,27 +429,6 @@ export const MoldMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false,
isTable: true,
},
{
label: '类型',
field: 'type',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
component: 'Select',
componentProps: {
disabled: true,
}
},
search: {
value: 'MOLD'
}
},
{
label: '转办类型',
field: 'turnType',
@ -441,45 +446,46 @@ export const MoldMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '设备模具编号',
field: 'deviceNumber',
label: '类型',
field: 'type',
sort: 'custom',
table: {
width: '150',
},
api: () => moldList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return moldList.find((account) => account.number == cellValue)?.name
return deviceMoldTypeList.find((account) => account.value == cellValue)?.label
},
isSearch: true,
search: {
show: true,
component: 'Input',
// api: () => moldList,
// componentProps: {
// optionsAlias: {
// labelField: 'name',
// valueField: 'number'
// }
// }
component: 'Select',
componentProps: {
options: deviceMoldTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
},
},
form: {
component: 'Select',
api: () => moldList,
componentProps: {
options: deviceMoldTypeList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
labelField: 'label',
valueField: 'value'
},
placeholder: "请选择类型"
}
},
},
{
label: '厂区编号',
label: '厂区',
field: 'factoryAreaNumber',
sort: 'custom',
table: {
width: '150',
},
isDetail: false,
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
@ -508,6 +514,51 @@ export const MoldMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
},
}
},
{
label: '厂区',
field: 'factoryAreaNumber1',
sort: 'custom',
isDetail: true,
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '设备模具',
field: 'deviceNumber',
sort: 'custom',
table: {
width: '150',
},
api: () => moldList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return moldList.find((account) => account.number == cellValue)?.name
},
search: {
show: true,
component: 'Input',
api: () => moldList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
}
}
},
form: {
component: 'Select',
api: () => moldList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
},
}
},
{
label: '维修人',
field: 'maintenance',
@ -516,11 +567,16 @@ export const MoldMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
width: '150',
},
isSearch: true,
isDetail: false,
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return dutyUserList.find((account) => account.id == cellValue)?.name
},
form: {
component: 'Select',
api: () => userList,
api: () => dutyUserList,
componentProps: {
disabled: true,
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
@ -529,7 +585,18 @@ export const MoldMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
},
}
},
{
label: '维修人',
field: 'maintenance1',
sort: 'custom',
isDetail: true,
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '班次',
field: 'classes',

Loading…
Cancel
Save