Browse Source

修复测试bug

master
ljlong_2630 9 months ago
parent
commit
af78162b9b
  1. 17
      src/components/Detail/src/Detail.vue
  2. 2
      src/views/eam/device/deviceMaintainPlan/deviceMaintainPlan.data.ts
  3. 4
      src/views/eam/device/deviceRepair/index.vue
  4. 26
      src/views/eam/device/deviceSpotInspectionRecordMain/deviceSpotInspectionRecordMain.data.ts
  5. 31
      src/views/eam/device/deviceSpotInspectionRecordMain/index.vue
  6. 50
      src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts
  7. 38
      src/views/eam/device/deviceinspectionjob/index.vue
  8. 27
      src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts
  9. 37
      src/views/eam/device/devicemaintenancejob/index.vue
  10. 4
      src/views/eam/mold/moldinspectionjob/index.vue

17
src/components/Detail/src/Detail.vue

@ -451,7 +451,7 @@ const buttonBaseClick = (val, item) => {
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
console.log(val) console.log(val)
console.log(row) console.log('buttonTableClickRow',row)
if (val == 'edit') { if (val == 'edit') {
// //
openForm('update', row) openForm('update', row)
@ -491,8 +491,18 @@ const openForm = async (type: string, row?: number) => {
} }
} }
} }
//
let callbackTriggered = false;
// openFormCallBacklist
emit('openFormCallBack', type, row, masterParmas.value, () => {
callbackTriggered = true; //
});
nextTick(() => { // 使nextTick
if (!callbackTriggered) { // openFormCallBack
formRef.value.open(type, row, masterParmas.value);
}
});
formRef.value.open(type, row, masterParmas.value)
} }
// form // form
const submitForm = async (formType, data) => { const submitForm = async (formType, data) => {
@ -516,7 +526,8 @@ const emit = defineEmits([
'tableFormButton', 'tableFormButton',
'openImage', 'openImage',
'detailSubmitForm', 'detailSubmitForm',
'detailOnChange' 'detailOnChange',
'openFormCallBack',
]) ])
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {

2
src/views/eam/device/deviceMaintainPlan/deviceMaintainPlan.data.ts

@ -11,7 +11,7 @@ export const DeviceMaintainPlanRules = reactive({
export const DeviceMaintainPlan = useCrudSchemas(reactive<CrudSchema[]>([ export const DeviceMaintainPlan = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '编号唯一标识', label: '保养计划编号',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,

4
src/views/eam/device/deviceRepair/index.vue

@ -202,9 +202,11 @@ const formsSuccess = async (formType, data) => {
if (data.activeTime == 0) data.activeTime = null; if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null; if (data.expireTime == 0) data.expireTime = null;
data.result = 'PENDING'; data.result = 'PENDING';
data.filePathList = data.upload.map((item: any) => { if (data.upload != null && data.upload != "") {
data.filePathList = data?.upload?.map((item: any) => {
return item.url return item.url
}) })
}
if (formType === 'create') { if (formType === 'create') {
await DeviceRepairApi.createDeviceRepair(data) await DeviceRepairApi.createDeviceRepair(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))

26
src/views/eam/device/deviceSpotInspectionRecordMain/deviceSpotInspectionRecordMain.data.ts

@ -1,7 +1,7 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { selectAllFactoryArea } from '@/api/system/dept' import { selectAllFactoryArea } from '@/api/system/dept'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts' import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
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 { ItemSearchTable } from '../../basic/item/item.data' import { ItemSearchTable } from '../../basic/item/item.data'
@ -10,15 +10,14 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
// 邮箱账号的列表 // 邮箱账号的列表
const factoryList = await selectAllFactoryArea() const factoryList = await selectAllFactoryArea()
const moldList = await MoldAccountsApi.getMoldAccountsNoPage({}) const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 }) const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
const userListAll = await UserApi.getSimpleUserList() const userListAll = await UserApi.getSimpleUserList()
const moldListNoPage = await MoldAccountsApi.getMoldAccountsAllNoPage({}) const deviceListNoPage = await DeviceAccountsApi.getDeviceAccountsAllNoPage({})
const moldTypeList = 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 == 'DEVICE')
const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE) const deviceDeviceTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
// 表单校验 // 表单校验
export const DeviceSpotInspectionRecordMainRules = reactive({ export const DeviceSpotInspectionRecordMainRules = reactive({
number: [required],
deviceNumber: [required], deviceNumber: [required],
status: [required], status: [required],
type: [required], type: [required],
@ -34,6 +33,7 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema
table: { table: {
width: '150', width: '150',
}, },
isForm: false,
}, },
{ {
label: '设备模具', label: '设备模具',
@ -43,16 +43,16 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema
width: '150', width: '150',
}, },
isSearch: true, isSearch: true,
api: () => MoldAccountsApi.getMoldAccountsNoPage({ api: () => DeviceAccountsApi.getDeviceAccountsNoPage({
isSearch: false isSearch: false
}), }),
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return moldListNoPage.find((account) => account.number == cellValue)?.name return deviceListNoPage.find((account) => account.number == cellValue)?.name
}, },
form: { form: {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options: moldList, options: deviceList,
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'name',
valueField: 'number' valueField: 'number'
@ -112,13 +112,13 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema
width: 'getDeviceSpotInspectionRecordMainSenior', width: 'getDeviceSpotInspectionRecordMainSenior',
}, },
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceMoldTypeList.find((account) => account.value == cellValue)?.label return deviceDeviceTypeList.find((account) => account.value == cellValue)?.label
}, },
isSearch: true, isSearch: true,
search: { search: {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options: moldTypeList, options: deviceTypeList,
optionsAlias: { optionsAlias: {
labelField: 'label', labelField: 'label',
valueField: 'value' valueField: 'value'
@ -128,7 +128,7 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema
form: { form: {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options: moldTypeList, options: deviceTypeList,
optionsAlias: { optionsAlias: {
labelField: 'label', labelField: 'label',
valueField: 'value' valueField: 'value'

31
src/views/eam/device/deviceSpotInspectionRecordMain/index.vue

@ -82,6 +82,7 @@
:detailValidate="detailValidate" :detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm" @detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true" :isSearchTableItem="true"
:buttonControllFunction="buttonControllFunction"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -178,9 +179,9 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({ // defaultButtons.defaultAddBtn({
hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker') // hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
}), // // }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null) // defaultButtons.defaultSetBtn(null) //
@ -190,8 +191,12 @@ const HeadButttondata = [
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { if (val == 'add') {
// //
DeviceSpotInspectionRecordMain.allSchemas.formSchema[3].value = 'DEVICE' DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => {
DeviceSpotInspectionRecordMain.allSchemas.formSchema[0].componentProps.disabled = false return item.field == 'type'
}).value = 'DEVICE'
DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = false
openForm('create') openForm('create')
} else if (val == 'import') { } else if (val == 'import') {
// //
@ -257,11 +262,15 @@ const onChange = (field, cur, item) => {
} }
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
DeviceSpotInspectionRecordMain.allSchemas.formSchema[0].componentProps.disabled = false DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).value = 'DEVICE'
if (val == 'edit') { if (val == 'edit') {
// //
openForm('update', row) openForm('update', row)
DeviceSpotInspectionRecordMain.allSchemas.formSchema[0].componentProps.disabled = true DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => {
return item.field == 'number'
}).componentProps.disabled = true
} else if (val == 'delete') { } else if (val == 'delete') {
// //
handleDelete(row.id) handleDelete(row.id)
@ -473,6 +482,14 @@ const detailSubmitForm= async (formType,data,getList,formRef,tableList) => {
} }
} }
const buttonControllFunction = (row, val) => {
if (val == 'add') {
return false
} else {
return true
}
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

50
src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts

@ -6,11 +6,17 @@ import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMai
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
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 { validateHanset, validateNumDot, validateEmail } from '@/utils/validator' import { validateHanset, validateNumDot, validateNum, validateEmail } from '@/utils/validator'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
const userListAll = await UserApi.getSimpleUserList() const userListAll = await UserApi.getSimpleUserList()
const factoryList = await selectAllFactoryArea() const factoryList = await selectAllFactoryArea()
const factoryListSelf = factoryList.filter(item => item.id == userStore.userSelfInfo.dept.parentId)
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({}) const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const deviceListAll = await DeviceAccountsApi.getDeviceAccountsAllNoPage({})
const deviceListByFactory = deviceListAll.filter(item => item.factoryAreaNumber == userStore.userSelfInfo.dept.parentId)
// const deviceListByFactoryAndStatus = deviceListByFactory.filter(item => item.status == '0')
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 }) const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: undefined }) const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: undefined })
const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE') const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE')
@ -24,6 +30,7 @@ export const DeviceInspectionMainRules = reactive({
required, required,
], ],
describes: [ describes: [
{ max: 200, message: '不得超过200个字符', trigger: 'blur' },
], ],
maintenancePhone: [ maintenancePhone: [
{ validator:validateHanset, message: '输入电话格式不正确', trigger: 'blur'} { validator:validateHanset, message: '输入电话格式不正确', trigger: 'blur'}
@ -87,7 +94,7 @@ export const DeviceInspectionMain = 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: true, show: true,
@ -116,6 +123,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
isDetail: false,
table: { table: {
width: '150', width: '150',
}, },
@ -152,6 +160,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'maintenance', field: 'maintenance',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
isDetail: false,
table: { table: {
width: '150', width: '150',
}, },
@ -162,26 +171,44 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
search: { search: {
show: true, show: true,
component: 'Select', component: 'Select',
api: () => userList, api: () => userListAll,
componentProps: { componentProps: {
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'nickname',
valueField: 'id' valueField: 'id'
} }
} }
}, },
form: { form: {
component: 'Select', component: 'Select',
api: () => userList, api: () => userListAll,
componentProps: { componentProps: {
disabled: true, disabled: true,
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'nickname',
valueField: 'id' valueField: 'id'
}, },
placeholder: "请选择检修人" placeholder: "请选择检修人"
}, },
} },
},
{
label: '厂区',
field: 'factoryAreaNumber1',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail: true
},
{
label: '检修人',
field: 'maintenance1',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail: true
}, },
{ {
label: '检修人联系电话', label: '检修人联系电话',
@ -255,7 +282,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
// }, // },
{ {
label: '描述', label: '描述',
field: 'describe', field: 'describes',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
table: { table: {
@ -283,6 +310,13 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
// 表单校验 // 表单校验
export const DeviceInspectionDetailRules = reactive({ export const DeviceInspectionDetailRules = reactive({
chargePeoples:[
required,
],
estimatedMinutes:[
required,
{ validator:validateNum, message: '请输入数字格式', trigger: 'blur'}
],
number: [required], number: [required],
estimatedMinutes: [required], estimatedMinutes: [required],
maintenance: [required], maintenance: [required],

38
src/views/eam/device/deviceinspectionjob/index.vue

@ -70,6 +70,7 @@
:detailValidate="detailValidate" :detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm" @detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true" :isSearchTableItem="true"
@openFormCallBack="openFormCallBack"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -84,6 +85,9 @@ import * as DeviceInspectionMainApi from '@/api/eam/device/deviceInspectionMain'
import * as DeviceInspectionDetailApi from '@/api/eam/device/deviceInspectionDetail' import * as DeviceInspectionDetailApi from '@/api/eam/device/deviceInspectionDetail'
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 { selectAllFactoryArea } from '@/api/system/dept'
import * as UserApi from '@/api/system/user'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
// import TableHead from '@/components/TableHead/src/TableHead.vue' // import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' // import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
@ -159,8 +163,12 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') { //
DeviceInspectionMain.allSchemas.formSchema[4].value = 'PROCCED'; DeviceInspectionMain.allSchemas.formSchema.find(item => {
DeviceInspectionMain.allSchemas.formSchema[5].value = 'DEVICE'; return item.field == 'status'
}).value = 'PROCCED'
DeviceInspectionMain.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).value = 'DEVICE'
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') { //
handleImport() handleImport()
@ -198,7 +206,16 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = async (type: string, row?: any) => {
const deviceListAll = await DeviceAccountsApi.getDeviceAccountsAllNoPage({})
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
if (type == 'update') {
DeviceInspectionMain.allSchemas.formSchema.find(item => item.field == 'deviceNumber').componentProps.disabled = true
DeviceInspectionMain.allSchemas.formSchema.find(item => item.field == 'deviceNumber').componentProps.options = deviceListAll
} else {
DeviceInspectionMain.allSchemas.formSchema.find(item => item.field == 'deviceNumber').componentProps.disabled = false
DeviceInspectionMain.allSchemas.formSchema.find(item => item.field == 'deviceNumber').componentProps.options = deviceList
}
tableData.value = [] // tableData.value = [] //
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
@ -229,7 +246,11 @@ const formsSuccess = async (formType, data) => {
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = async (row: any, titleName: any, titleValue: any) => {
const factoryList = await selectAllFactoryArea()
const userListAll = await UserApi.getSimpleUserList()
row.factoryAreaNumber1 = factoryList.find((account) => account.id == row.factoryAreaNumber)?.name
row.maintenance1 = userListAll.find((account) => account.id == row.maintenance)?.nickname
detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceInspectionMain') detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceInspectionMain')
} }
@ -297,13 +318,14 @@ function handleFinishOrder(row) {
const onChange = (field, cur, item) => { const onChange = (field, cur, item) => {
// //
if (field == 'deviceNumber') { if (field == 'deviceNumber') {
basicFormRef.value.formRef.formModel.factoryAreaNumber = Number(item.componentProps.options.find(element => element.number == cur).factoryAreaNumber) basicFormRef.value.formRef.formModel.factoryAreaNumber = String(item.componentProps.options.find(element => element.number == cur).factoryAreaNumber)
basicFormRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id) basicFormRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id)
basicFormRef.value.formRef.formModel.maintenanceNumber = '' basicFormRef.value.formRef.formModel.maintenanceNumber = ''
} else if (field == 'maintenanceNumber') { } else if (field == 'maintenanceNumber') {
basicFormRef.value.formRef.formModel.deviceNumber = item.componentProps.options.find(element => element.number == cur).deviceNumber basicFormRef.value.formRef.formModel.deviceNumber = item.componentProps.options.find(element => element.number == cur).deviceNumber
basicFormRef.value.formRef.formModel.factoryAreaNumber = Number(item.componentProps.options.find(element => element.number == cur).factoryAreaNumber) basicFormRef.value.formRef.formModel.factoryAreaNumber = String(item.componentProps.options.find(element => element.number == cur).factoryAreaNumber)
basicFormRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id) basicFormRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id)
// basicFormRef.value.formRef.formModel.maintenancePhone = String(userStore?.getUser?.mobile)
} }
} }

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

@ -2,7 +2,6 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { selectAllFactoryArea } from '@/api/system/dept' import { selectAllFactoryArea } from '@/api/system/dept'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
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 * as UserApi from '@/api/system/user'
@ -10,7 +9,6 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
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 userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
const userListAll = await UserApi.getSimpleUserList() const userListAll = await UserApi.getSimpleUserList()
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)
@ -24,7 +22,10 @@ export const DeviceMaintenanceMainRules = reactive({
type: [required], type: [required],
classes: [required], classes: [required],
faultType: [required], faultType: [required],
describes : [required], describes : [
required,
{ max: 200, message: '不得超过200个字符', trigger: 'blur' },
],
}) })
export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -292,24 +293,25 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修人', label: '维修人',
field: 'maintenances', field: 'maintenances',
sort: 'custom', sort: 'custom',
api: () => userList, isDetail: false,
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.name).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,
@ -321,6 +323,15 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
{
label: '维修人',
field: 'maintenances1',
sort: 'custom',
isDetail: true,
table: {
width: 150
}
},
{ {
label: '备件', label: '备件',
field: 'itemNumbers1', field: 'itemNumbers1',

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

@ -83,6 +83,7 @@
:detailValidate="detailValidate" :detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm" @detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true" :isSearchTableItem="true"
@openFormCallBack="openFormCallBack"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -118,6 +119,7 @@ import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMai
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 { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
defineOptions({ name: 'DeviceMaintenanceMain' }) defineOptions({ name: 'DeviceMaintenanceMain' })
const message = useMessage() // const message = useMessage() //
@ -133,6 +135,7 @@ 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 updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
@ -307,6 +310,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,'DeviceMaintenanceMain') detailRef.value.openDetail(row, titleName, titleValue,'DeviceMaintenanceMain')
} }
@ -499,6 +503,39 @@ const detailSubmitForm= async (formType,data,getList,formRef,tableList) => {
} }
} }
const openFormCallBack = (type, row, masterParmas,callback) => {
if (type === 'create') {
if (operatRecord.value.type == 'TECH') {
DeviceMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'maintenances') {
selecUserByType({ classType: 'TECH', factoryAreaNumber: '', flag: 1 }).then(response => {
item.componentProps.options = response
callback();
});
}
})
} else if (operatRecord.value.type == 'DEVICE') {
DeviceMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'maintenances') {
selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 }).then(response => {
item.componentProps.options = response
callback();
});
}
})
} else if (operatRecord.value.type == 'MOLD') {
DeviceMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'maintenances') {
selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 }).then(response => {
item.componentProps.options = response
callback();
});
}
})
}
}
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

4
src/views/eam/mold/moldinspectionjob/index.vue

@ -159,7 +159,9 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') { //
MoldInspectionMain.allSchemas.formSchema[4].value = 'PROCCED'; debugger
// MoldInspectionMain.allSchemas.formSchema[4].value = 'PROCCED';
MoldInspectionMain.allSchemas.formSchema.find((item) => item.field == 'status').value = 'PROCCED';
MoldInspectionMain.allSchemas.formSchema[5].value = 'DEVICE'; MoldInspectionMain.allSchemas.formSchema[5].value = 'DEVICE';
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') { //

Loading…
Cancel
Save