Browse Source

EAM ——> 保养计划 及 保养工单 更新

master_hella_20240701
gaojs 6 months ago
parent
commit
d9931edcf2
  1. 57
      src/api/eam/relationMaintenancePlanItem/index.ts
  2. 1
      src/components/BasicForm/src/BasicForm.vue
  3. 61
      src/views/eam/equipmentMaintenanceMain/MaintenanceOrderDetail.vue
  4. 21
      src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts
  5. 13
      src/views/eam/equipmentMaintenanceMain/index.vue
  6. 160
      src/views/eam/maintenance/maintenance.data.ts

57
src/api/eam/relationMaintenancePlanItem/index.ts

@ -0,0 +1,57 @@
import request from '@/config/axios'
export interface RelationMaintenancePlanItemVO {
id: number
planNumber: string
itemCode: string
itemName: string
isSelectd: boolean
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询保养计划表和保养项关系列表
export const getRelationMaintenancePlanItemPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/relation-maintenance-plan-item/senior', data })
} else {
return await request.get({ url: `/eam/relation-maintenance-plan-item/page`, params })
}
}
// 查询保养计划表和保养项关系详情
export const getRelationMaintenancePlanItem = async (id: number) => {
return await request.get({ url: `/eam/relation-maintenance-plan-item/get?id=` + id })
}
// 新增保养计划表和保养项关系
export const createRelationMaintenancePlanItem = async (data: RelationMaintenancePlanItemVO) => {
return await request.post({ url: `/eam/relation-maintenance-plan-item/create`, data })
}
// 修改保养计划表和保养项关系
export const updateRelationMaintenancePlanItem = async (data: RelationMaintenancePlanItemVO) => {
return await request.put({ url: `/eam/relation-maintenance-plan-item/update`, data })
}
// 删除保养计划表和保养项关系
export const deleteRelationMaintenancePlanItem = async (id: number) => {
return await request.delete({ url: `/eam/relation-maintenance-plan-item/delete?id=` + id })
}
// 导出保养计划表和保养项关系 Excel
export const exportRelationMaintenancePlanItem = async (params) => {
return await request.download({ url: `/eam/relation-maintenance-plan-item/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/relation-maintenance-plan-item/get-import-template' })
}

1
src/components/BasicForm/src/BasicForm.vue

@ -731,7 +731,6 @@ const clearInput = (field, row, index) => {
* @param cur 改变后值 * @param cur 改变后值
*/ */
const onChange = (field, cur) => { const onChange = (field, cur) => {
console.log(2222222222222)
emit('onChange', field, cur, formRef) emit('onChange', field, cur, formRef)
} }

61
src/views/eam/equipmentMaintenanceMain/DetailEam.vue → src/views/eam/equipmentMaintenanceMain/MaintenanceOrderDetail.vue

@ -585,9 +585,11 @@ const formRef = ref()
const titleNameRef = ref() const titleNameRef = ref()
const titleValueRef = ref() const titleValueRef = ref()
const count =ref(0) const count =ref(0)
const planNumber = ref();
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => { const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
titleNameRef.value = titleName titleNameRef.value = titleName
titleValueRef.value = titleValue titleValueRef.value = titleValue
planNumber.value = row.planNumber
remarksData.data = { remarksData.data = {
tableId: row.masterId||row.id, tableId: row.masterId||row.id,
tableName: tableName tableName: tableName
@ -707,7 +709,7 @@ const isShowMainButton = (row, val) => {
const { getList } = tableMethodsRef.value const { getList } = tableMethodsRef.value
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item ,row) => {
if (val == 'add') { if (val == 'add') {
// //
if(props.isOpenSearchTable){ if(props.isOpenSearchTable){
@ -728,6 +730,8 @@ const buttonBaseClick = (val, item) => {
undefined,undefined undefined,undefined
) )
}else{ }else{
console.log(planNumber.value)
openForm('create') openForm('create')
} }
} else if (val == 'import') { } else if (val == 'import') {
@ -824,10 +828,8 @@ const buttonTableClick = async (val, row) => {
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const openForm = async (type: string, row?: number) => { const openForm = async (type: string, row?: number) => {
formRef.value.open(type, row, masterParmas.value) formRef.value.open(type, row, masterParmas.value)
emit('detailOpenForm', type, row) emit('detailOpenForm', type, row)
if(type == "create"){ if(type == "create"){
EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((item) => { EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if(item.field == 'peoples'){ if(item.field == 'peoples'){
@ -854,19 +856,41 @@ const openForm = async (type: string, row?: number) => {
} }
if(item.field == 'name'){ if(item.field == 'name'){
EquipmentMaintenanceDetailRules.name[0].required = true EquipmentMaintenanceDetailRules.name[0].required = true
item.componentProps.searchCondition = []
const newItem1 = {};
newItem1['action'] = '==';
newItem1['value'] = planNumber.value;
newItem1['key'] = 'planNumber';
item.componentProps.searchCondition.push(newItem1)
const newItem2 = {};
newItem2['action'] = '==';
newItem2['value'] = 'TRUE';
newItem2['key'] = 'available';
item.componentProps.searchCondition.push(newItem2)
const newItem3 = {};
newItem3['action'] = '==';
newItem3['value'] = false;
newItem3['key'] = 'isSelectd';
item.componentProps.searchCondition.push(newItem3)
} }
}) })
}else{ }else{
row.peoples = row.peoples.toString() if(row.peoples !== null && row.peoples !== undefined){
row.estimatedMinutes = row.estimatedMinutes.toString() row.peoples = row.peoples.toString()
row.actualMinutes = row.actualMinutes.toString() }
if(row.estimatedMinutes !== null && row.estimatedMinutes !== undefined){
row.estimatedMinutes = row.estimatedMinutes.toString()
}
if(row.actualMinutes !== null && row.actualMinutes !== undefined){
row.actualMinutes = row.actualMinutes.toString()
}
EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((item) => { EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if(item.field == 'peoples'){ if(item.field == 'peoples'){
item.componentProps.disabled = false item.componentProps.disabled = false
EquipmentMaintenanceDetailRules.peoples[0].required = true EquipmentMaintenanceDetailRules.peoples[0].required = true
} }
if(item.field == 'estimatedMinutes'){ if(item.field == 'estimatedMinutes'){
EquipmentMaintenanceDetailRules.estimatedMinutes[0].required = false EquipmentMaintenanceDetailRules.estimatedMinutes[0].required = true
} }
if(item.field == 'actualMinutes'){ if(item.field == 'actualMinutes'){
item.componentProps.disabled = false item.componentProps.disabled = false
@ -885,6 +909,22 @@ const openForm = async (type: string, row?: number) => {
} }
if(item.field == 'name'){ if(item.field == 'name'){
EquipmentMaintenanceDetailRules.name[0].required = true EquipmentMaintenanceDetailRules.name[0].required = true
item.componentProps.searchCondition = []
const newItem1 = {};
newItem1['action'] = '==';
newItem1['value'] = planNumber.value;
newItem1['key'] = 'planNumber';
item.componentProps.searchCondition.push(newItem1)
const newItem2 = {};
newItem2['action'] = '==';
newItem2['value'] = 'TRUE';
newItem2['key'] = 'available';
item.componentProps.searchCondition.push(newItem2)
const newItem3 = {};
newItem3['action'] = '==';
newItem3['value'] = false;
newItem3['key'] = 'isSelectd';
item.componentProps.searchCondition.push(newItem3)
} }
}) })
} }
@ -950,7 +990,12 @@ const handleDelete = async (id: number) => {
// //
await getList() await getList()
updateKey.value += 1 updateKey.value += 1
} catch {} } catch {
emit('handleMainFefresh')
//
await getList()
updateKey.value += 1
}
} }
// //
const searchFormClick = async (searchData) => { const searchFormClick = async (searchData) => {

21
src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts

@ -4,9 +4,10 @@ import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data"; import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data";
import * as WorkshopApi from "@/api/wms/workshop"; import * as WorkshopApi from "@/api/wms/workshop";
import {MaintenanceItem} from "@/views/eam/maintenanceItem/maintenanceItem.data"; import {RelationMaintenancePlanItem} from "@/views/eam/maintenance/maintenance.data";
import * as ItemApi from "@/api/eam/maintenanceItem"; import * as ItemApi from "@/api/eam/relationMaintenancePlanItem";
import {validateroundNumber} from "@/utils/validator"; import {validateroundNumber} from "@/utils/validator";
import {getRelationMaintenancePlanItemPage} from "@/api/eam/relationMaintenancePlanItem";
// 表单校验 // 表单校验
export const EquipmentMaintenanceMainRules = reactive({ export const EquipmentMaintenanceMainRules = reactive({
@ -505,16 +506,12 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>(
form: { form: {
componentProps: { componentProps: {
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择 类别编码', searchListPlaceholder: '请选择 非必选保养项',
searchTitle: '保养项信息', // 查询弹窗标题 searchTitle: '非必选保养项信息', // 查询弹窗标题
searchAllSchemas: MaintenanceItem.allSchemas, // 查询弹窗所需类 searchAllSchemas: RelationMaintenancePlanItem.allSchemas, // 查询弹窗所需类
searchField: 'name', // 查询弹窗赋值字段 searchField: 'itemName', // 查询弹窗赋值字段
searchPage: ItemApi.getMaintenanceItemPage, // 查询弹窗所需分页方法 searchPage: ItemApi.getRelationMaintenancePlanItemPage, // 查询弹窗所需分页方法
searchCondition: [{ searchCondition: []
key: 'available',
value: 'TRUE',
action: '=='
}]
} }
} }
}, },

13
src/views/eam/equipmentMaintenanceMain/index.vue

@ -82,12 +82,13 @@ import * as EquipmentMaintenanceDetailApi from '@/api/eam/equipmentMaintenanceDe
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
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'
import Detail from '@/views/eam/equipmentMaintenanceMain/DetailEam.vue' import Detail from '@/views/eam/equipmentMaintenanceMain/MaintenanceOrderDetail.vue'
import {Maintenance} from "@/views/eam/maintenance/maintenance.data"; import {Maintenance} from "@/views/eam/maintenance/maintenance.data";
import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data"; import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data"; import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data";
import * as ToolItemApi from "@/api/eam/toolAccounts"; import * as ToolItemApi from "@/api/eam/toolAccounts";
import {updateMaintenanceOrder} from "@/api/eam/equipmentMaintenanceMain";
defineOptions({ name: 'EquipmentMaintenanceMain' }) defineOptions({ name: 'EquipmentMaintenanceMain' })
@ -122,7 +123,7 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:equipmentMaintenanceMain:create'}), // //defaultButtons.defaultAddBtn({hasPermi:'eam:equipmentMaintenanceMain:create'}), //
//defaultButtons.defaultImportBtn({hasPermi:'eam:equipmentMaintenanceMain:import'}), // //defaultButtons.defaultImportBtn({hasPermi:'eam:equipmentMaintenanceMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:equipmentMaintenanceMain:export'}), // defaultButtons.defaultExportBtn({hasPermi:'eam:equipmentMaintenanceMain:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
@ -256,7 +257,7 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
const setV = {} const setV = {}
let result = ''; let result = '';
for (var i = 0; i < val.length; i++) { for (var i = 0; i < val.length; i++) {
result += val[i].name + ','; result += val[i].itemName + ',';
} }
if(result.endsWith(',')){ if(result.endsWith(',')){
result = result.substring(0,result.length -1) result = result.substring(0,result.length -1)
@ -320,8 +321,8 @@ const handleExecute = async (id: number) => {
}) })
params.value.id = id params.value.id = id
params.value.status = '5' params.value.status = '5'
// //
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) await EquipmentMaintenanceMainApi.updateMaintenanceOrder(params.value)
message.success(t('执行成功')) message.success(t('执行成功'))
// //
await getList() await getList()
@ -339,7 +340,7 @@ const handleFinish = async (id: number) => {
}) })
params.value.id = id params.value.id = id
params.value.status = '5' params.value.status = '5'
// //
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value)
message.success(t('工单已完成')) message.success(t('工单已完成'))
// //

160
src/views/eam/maintenance/maintenance.data.ts

@ -357,3 +357,163 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
])) ]))
// 表单校验
export const RelationMaintenancePlanItemRules = reactive({
planNumber: [required],
itemCode: [required],
itemName: [required],
})
export const RelationMaintenancePlanItem = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '计划编号',
field: 'planNumber',
sort: 'custom',
isSearch: true,
},
{
label: '项编号',
field: 'itemCode',
sort: 'custom',
isSearch: true,
},
{
label: '保养名称',
field: 'itemName',
sort: 'custom',
isSearch: true,
},
{
label: '是否必选',
field: 'isSelectd',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.FALSE_OR_TRUE,
dictClass: 'string',
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm: false,
},
{
label: '部门id',
field: 'departmentCode',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '是否可用默认TRUE',
field: 'available',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '删除时间',
field: 'deletionTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '删除人id',
field: 'deleterId',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
table: {
width: 150,
fixed: 'right'
}
}
]))

Loading…
Cancel
Save