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) => {
console.log(val)
console.log(row)
console.log('buttonTableClickRow',row)
if (val == 'edit') {
//
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
const submitForm = async (formType, data) => {
@ -516,7 +526,8 @@ const emit = defineEmits([
'tableFormButton',
'openImage',
'detailSubmitForm',
'detailOnChange'
'detailOnChange',
'openFormCallBack',
])
/** 删除按钮操作 */
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[]>([
{
label: '编号唯一标识',
label: '保养计划编号',
field: 'number',
sort: 'custom',
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.expireTime == 0) data.expireTime = null;
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
})
}
if (formType === 'create') {
await DeviceRepairApi.createDeviceRepair(data)
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 { dateFormatter } from '@/utils/formatTime'
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 { selecUserByType } from '@/api/system/dept'
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'
// 邮箱账号的列表
const factoryList = await selectAllFactoryArea()
const moldList = await MoldAccountsApi.getMoldAccountsNoPage({})
const userList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 })
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
const userListAll = await UserApi.getSimpleUserList()
const moldListNoPage = await MoldAccountsApi.getMoldAccountsAllNoPage({})
const moldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value == 'MOLD')
const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
const deviceListNoPage = await DeviceAccountsApi.getDeviceAccountsAllNoPage({})
const deviceTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value == 'DEVICE')
const deviceDeviceTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
// 表单校验
export const DeviceSpotInspectionRecordMainRules = reactive({
number: [required],
deviceNumber: [required],
status: [required],
type: [required],
@ -34,6 +33,7 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema
table: {
width: '150',
},
isForm: false,
},
{
label: '设备模具',
@ -43,16 +43,16 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema
width: '150',
},
isSearch: true,
api: () => MoldAccountsApi.getMoldAccountsNoPage({
api: () => DeviceAccountsApi.getDeviceAccountsNoPage({
isSearch: false
}),
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return moldListNoPage.find((account) => account.number == cellValue)?.name
return deviceListNoPage.find((account) => account.number == cellValue)?.name
},
form: {
component: 'Select',
componentProps: {
options: moldList,
options: deviceList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
@ -112,13 +112,13 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema
width: 'getDeviceSpotInspectionRecordMainSenior',
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceMoldTypeList.find((account) => account.value == cellValue)?.label
return deviceDeviceTypeList.find((account) => account.value == cellValue)?.label
},
isSearch: true,
search: {
component: 'Select',
componentProps: {
options: moldTypeList,
options: deviceTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
@ -128,7 +128,7 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema
form: {
component: 'Select',
componentProps: {
options: moldTypeList,
options: deviceTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'

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

@ -82,6 +82,7 @@
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
:buttonControllFunction="buttonControllFunction"
/>
<!-- 导入 -->
@ -178,9 +179,9 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({
hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
}), //
// defaultButtons.defaultAddBtn({
// hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
// }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null) //
@ -190,8 +191,12 @@ const HeadButttondata = [
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
DeviceSpotInspectionRecordMain.allSchemas.formSchema[3].value = 'DEVICE'
DeviceSpotInspectionRecordMain.allSchemas.formSchema[0].componentProps.disabled = false
DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).value = 'DEVICE'
DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = false
openForm('create')
} else if (val == 'import') {
//
@ -257,11 +262,15 @@ const onChange = (field, cur, item) => {
}
// -
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') {
//
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') {
//
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 () => {
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 { ItemSearchTable } from '../../basic/item/item.data'
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 { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
const userListAll = await UserApi.getSimpleUserList()
const factoryList = await selectAllFactoryArea()
const factoryListSelf = factoryList.filter(item => item.id == userStore.userSelfInfo.dept.parentId)
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 dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: undefined })
const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE')
@ -24,6 +30,7 @@ export const DeviceInspectionMainRules = reactive({
required,
],
describes: [
{ max: 200, message: '不得超过200个字符', trigger: 'blur' },
],
maintenancePhone: [
{ validator:validateHanset, message: '输入电话格式不正确', trigger: 'blur'}
@ -87,7 +94,7 @@ export const DeviceInspectionMain = 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: true,
@ -116,6 +123,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'factoryAreaNumber',
sort: 'custom',
isSearch: false,
isDetail: false,
table: {
width: '150',
},
@ -152,6 +160,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'maintenance',
sort: 'custom',
isSearch: false,
isDetail: false,
table: {
width: '150',
},
@ -162,26 +171,44 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
search: {
show: true,
component: 'Select',
api: () => userList,
api: () => userListAll,
componentProps: {
optionsAlias: {
labelField: 'name',
labelField: 'nickname',
valueField: 'id'
}
}
},
form: {
component: 'Select',
api: () => userList,
api: () => userListAll,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
labelField: 'nickname',
valueField: 'id'
},
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: '检修人联系电话',
@ -255,7 +282,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
// },
{
label: '描述',
field: 'describe',
field: 'describes',
sort: 'custom',
isSearch: false,
table: {
@ -283,6 +310,13 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
// 表单校验
export const DeviceInspectionDetailRules = reactive({
chargePeoples:[
required,
],
estimatedMinutes:[
required,
{ validator:validateNum, message: '请输入数字格式', trigger: 'blur'}
],
number: [required],
estimatedMinutes: [required],
maintenance: [required],

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

@ -70,6 +70,7 @@
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
: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 defaultButtons from '@/utils/disposition/defaultButtons'
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 ImportForm from '@/components/ImportForm/src/ImportForm.vue'
@ -159,8 +163,12 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
DeviceInspectionMain.allSchemas.formSchema[4].value = 'PROCCED';
DeviceInspectionMain.allSchemas.formSchema[5].value = 'DEVICE';
DeviceInspectionMain.allSchemas.formSchema.find(item => {
return item.field == 'status'
}).value = 'PROCCED'
DeviceInspectionMain.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).value = 'DEVICE'
openForm('create')
} else if (val == 'import') { //
handleImport()
@ -198,7 +206,16 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
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 = [] //
basicFormRef.value.open(type, row)
}
@ -229,7 +246,11 @@ const formsSuccess = async (formType, data) => {
/** 详情操作 */
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')
}
@ -297,13 +318,14 @@ function handleFinishOrder(row) {
const onChange = (field, cur, item) => {
//
if (field == 'deviceNumber') {
basicFormRef.value.formRef.formModel.factoryAreaNumber = Number(item.componentProps.options.find(element => element.number == cur).factoryAreaNumber)
basicFormRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id)
basicFormRef.value.formRef.formModel.factoryAreaNumber = String(item.componentProps.options.find(element => element.number == cur).factoryAreaNumber)
basicFormRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id)
basicFormRef.value.formRef.formModel.maintenanceNumber = ''
} else if (field == 'maintenanceNumber') {
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.maintenance = String(userStore?.getUser?.id)
basicFormRef.value.formRef.formModel.factoryAreaNumber = String(item.componentProps.options.find(element => element.number == cur).factoryAreaNumber)
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 * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
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'
@ -10,7 +9,6 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
const userListAll = await UserApi.getSimpleUserList()
const deviceTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value != 'MOLD')
const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
@ -24,7 +22,10 @@ export const DeviceMaintenanceMainRules = reactive({
type: [required],
classes: [required],
faultType: [required],
describes : [required],
describes : [
required,
{ max: 200, message: '不得超过200个字符', trigger: 'blur' },
],
})
export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -292,24 +293,25 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修人',
field: 'maintenances',
sort: 'custom',
api: () => userList,
isDetail: false,
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.name).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,
@ -321,6 +323,15 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
}
}
},
{
label: '维修人',
field: 'maintenances1',
sort: 'custom',
isDetail: true,
table: {
width: 150
}
},
{
label: '备件',
field: 'itemNumbers1',

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

@ -83,6 +83,7 @@
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
: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 defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
defineOptions({ name: 'DeviceMaintenanceMain' })
const message = useMessage() //
@ -133,6 +135,7 @@ const showView = ref(false)
const viewTitle = ref('图片预览')
const urls = ref([])
const viewKey = ref(0)
const operatRecord = ref()
//
const updataTableColumns = (val) => {
tableColumns.value = val
@ -307,6 +310,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,'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 () => {
getList()

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

@ -159,7 +159,9 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
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';
openForm('create')
} else if (val == 'import') { //

Loading…
Cancel
Save