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

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

@ -76,11 +76,11 @@
:apiUpdate="DeviceMaintenanceMainApi.updateDeviceMaintenanceMain" :apiUpdate="DeviceMaintenanceMainApi.updateDeviceMaintenanceMain"
:apiCreate="DeviceMaintenanceMainApi.createDeviceMaintenanceMain" :apiCreate="DeviceMaintenanceMainApi.createDeviceMaintenanceMain"
:isBusiness="false" :isBusiness="false"
@onChange="onChange" @onChange="onChangeSec"
@handleAddTable="handleAddTable" @handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable" @handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
@submitForm="submitForm" @submitForm="submitFormSec"
@success="submitForm" @success="submitForm"
:isSearchTableItem="true" :isSearchTableItem="true"
/> />
@ -140,6 +140,8 @@ import {
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain' import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import * as DeviceMaintenanceDetailApi from '@/api/eam/device/deviceMaintenanceDetail' import * as DeviceMaintenanceDetailApi from '@/api/eam/device/deviceMaintenanceDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' 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 { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept' import { selecUserByType } from '@/api/system/dept'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
@ -161,6 +163,10 @@ const viewTitle = ref('图片预览')
const urls = ref([]) const urls = ref([])
const viewKey = ref(0) const viewKey = ref(0)
const operatRecord = ref() const operatRecord = ref()
const newRow = ref()
const deviceList = ref()
const moldList = ref()
const repairUser = ref()
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
@ -300,6 +306,92 @@ const onChange = (field, cur, item) => {
formRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id) 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) => { const buttonTableClick = async (val, row) => {
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false
@ -334,12 +426,39 @@ const buttonTableClick = async (val, row) => {
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
tableData.value = [] // tableData.value = [] //
debugger
formRef.value.open(type, row) formRef.value.open(type, row)
} }
const openFormSec = (type: string, row?: any) => { const openFormSec = async (type: string, row?: any) => {
tableData.value = [] // 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')) message.success(t('common.updateSuccess'))
} }
formRef.value.dialogVisible = false formRef.value.dialogVisible = false
formRefSec.value.dialogVisible = false
// //
getList() getList()
} finally { } finally {
formRef.value.formLoading = false 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) =>{ const detailOpenForm = (type, row) =>{
console.log("type",type); console.log("type",type);
console.log("row",row); console.log("row",row);

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

@ -65,6 +65,26 @@
:isSearchTableItem="true" :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 ref="detailRef" :isBasic="true" :allSchemas="MoldMaintenanceMain.allSchemas" /> -->
<Detail <Detail
@ -83,6 +103,7 @@
:detailValidate="detailValidate" :detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm" @detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true" :isSearchTableItem="true"
:openFormCallBack="openFormCallBack"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -112,13 +133,18 @@ import {
MoldMaintenanceMain, MoldMaintenanceMain,
MoldMaintenanceMainRules, MoldMaintenanceMainRules,
MoldMaintenanceDetail, MoldMaintenanceDetail,
MoldMaintenanceDetailRules MoldMaintenanceDetailRules,
MoldMaintenanceMainSec,
MoldMaintenanceMainSecRules,
} from './moldMaintenanceMain.data' } from './moldMaintenanceMain.data'
import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain' import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain'
import * as MoldMaintenanceDetailApi from '@/api/eam/mold/moldMaintenanceDetail' import * as MoldMaintenanceDetailApi from '@/api/eam/mold/moldMaintenanceDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' 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 deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
const moldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value == 'MOLD') 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 route = useRoute() //
const routeName = ref() const routeName = ref()
const formRef = ref() const formRef = ref()
const formRefSec = ref()
const showView = ref(false) const showView = ref(false)
const viewTitle = ref('图片预览') const viewTitle = ref('图片预览')
const urls = ref([]) const urls = ref([])
const viewKey = ref(0) const viewKey = ref(0)
const operatRecord = ref()
const newRow = ref()
const deviceList = ref()
const moldList = ref()
const repairUser = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(MoldMaintenanceMain.allSchemas.tableColumns) const tableColumns = ref(MoldMaintenanceMain.allSchemas.tableColumns)
@ -305,16 +337,7 @@ const buttonTableClick = async (val, row) => {
} else if (val == 'acceptOrder') { } else if (val == 'acceptOrder') {
acceptOrder(row) acceptOrder(row)
} else if (val == 'turnOrder') { } else if (val == 'turnOrder') {
MoldMaintenanceMain.allSchemas.formSchema.find(item => { openFormSec('turnOrder', row)
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)
} else if (val == 'finishOrder') { } else if (val == 'finishOrder') {
finishOrder(row) finishOrder(row)
} else if (val == 'verifyOrder') { } else if (val == 'verifyOrder') {
@ -338,6 +361,7 @@ const openForm = (type: string, row?: any) => {
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
operatRecord.value = row;
detailRef.value.openDetail(row, titleName, titleValue,'MoldMaintenanceMain') 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 () => { onMounted(async () => {
getList() 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 { selecUserByType } from '@/api/system/dept'
import { ItemSearchTable } from '../../basic/item/item.data' import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item' 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 userStore = useUserStore()
const factoryList = await selectAllFactoryArea() const factoryList = await selectAllFactoryArea()
const moldList = await MoldAccountsApi.getMoldAccountsNoPage({}) const moldList = await MoldAccountsApi.getMoldAccountsNoPage({})
const userList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 }) 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({ export const MoldMaintenanceMainRules = reactive({
number: [required], number: [required],
@ -51,20 +57,32 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: '150', width: '150',
}, },
isSearch: false, formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
isForm: true, return deviceMoldTypeList.find((account) => account.value == cellValue)?.label
dictType: DICT_TYPE.DEVICE_MOLD_TYPE, },
dictClass: 'string', isSearch: true,
search: {
component: 'Select',
componentProps: {
options: deviceTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
},
},
form: { form: {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
disabled: true, options: deviceTypeList,
} optionsAlias: {
labelField: 'label',
valueField: 'value'
}, },
search: { placeholder: "请选择设备"
value: 'MOLD'
} }
}, },
},
{ {
label: '设备模具编号', label: '设备模具编号',
field: 'deviceNumber', field: 'deviceNumber',
@ -141,9 +159,13 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
width: '150', width: '150',
}, },
isSearch: true, isSearch: true,
api: () => userListAll,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userListAll.find((account) => account.id == cellValue)?.nickname
},
form: { form: {
component: 'Select', component: 'Select',
api: () => userList, api: () => userListAll,
componentProps: { componentProps: {
disabled: true, disabled: true,
optionsAlias: { optionsAlias: {
@ -263,24 +285,24 @@ export const MoldMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修人', label: '维修人',
field: 'maintenances', field: 'maintenances',
sort: 'custom', sort: 'custom',
api: () => userList, api: () => userListAll,
formatter: (_: Recordable, __: TableColumn, cellValue) => { 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: { tableForm: {
type: 'Select', type: 'Select',
initOptions: userList, initOptions: userListAll,
multiple:true, multiple:true,
collapseTags:true, collapseTags:true,
collapseTagsTooltip:true, collapseTagsTooltip:true,
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'nickname',
valueField: 'id' valueField: 'id'
} }
}, },
form:{ form:{
component: 'Select', component: 'Select',
api: () => userList, api: () => userListAll,
componentProps: { componentProps: {
multiple:true, multiple:true,
collapseTags:true, collapseTags:true,
@ -374,10 +396,14 @@ export const MoldMaintenanceMainSecRules = reactive({
deviceNumber: [required], deviceNumber: [required],
factoryAreaNumber: [required], factoryAreaNumber: [required],
maintenance: [required], maintenance: [required],
turnType: [required],
type: [required], type: [required],
classes: [required], classes: [required],
faultType: [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, isSearch: false,
isTable: true, 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: '转办类型', label: '转办类型',
field: 'turnType', field: 'turnType',
@ -441,45 +446,46 @@ export const MoldMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
{ {
label: '设备模具编号', label: '类型',
field: 'deviceNumber', field: 'type',
sort: 'custom', sort: 'custom',
table: { table: {
width: '150', width: '150',
}, },
api: () => moldList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return moldList.find((account) => account.number == cellValue)?.name return deviceMoldTypeList.find((account) => account.value == cellValue)?.label
}, },
isSearch: true,
search: { search: {
show: true, component: 'Select',
component: 'Input', componentProps: {
// api: () => moldList, options: deviceMoldTypeList,
// componentProps: { optionsAlias: {
// optionsAlias: { labelField: 'label',
// labelField: 'name', valueField: 'value'
// valueField: 'number' },
// } },
// }
}, },
form: { form: {
component: 'Select', component: 'Select',
api: () => moldList,
componentProps: { componentProps: {
options: deviceMoldTypeList,
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'label',
valueField: 'number' valueField: 'value'
},
}, },
placeholder: "请选择类型"
} }
}, },
},
{ {
label: '厂区编号', label: '厂区',
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', sort: 'custom',
table: { table: {
width: '150', width: '150',
}, },
isDetail: false,
api: () => factoryList, api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name 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: '维修人', label: '维修人',
field: 'maintenance', field: 'maintenance',
@ -516,11 +567,16 @@ export const MoldMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
width: '150', width: '150',
}, },
isSearch: true, isSearch: true,
isDetail: false,
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return dutyUserList.find((account) => account.id == cellValue)?.name
},
form: { form: {
component: 'Select', component: 'Select',
api: () => userList, api: () => dutyUserList,
componentProps: { componentProps: {
disabled: true, disabled: false,
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'name',
valueField: 'id' 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: '班次', label: '班次',
field: 'classes', field: 'classes',

Loading…
Cancel
Save