Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into master_hella

master_hella_20240701
zhaoxuebing 6 months ago
parent
commit
0036fc3650
  1. 25
      src/api/eam/equipmentMaintenanceMain/index.ts
  2. 175
      src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts
  3. 232
      src/views/eam/equipmentMaintenanceMain/finishForm.vue
  4. 63
      src/views/eam/equipmentMaintenanceMain/index.vue

25
src/api/eam/equipmentMaintenanceMain/index.ts

@ -3,27 +3,32 @@ import {EquipmentMainPartVO} from "@/api/eam/equipmentMainPart";
export interface EquipmentMaintenanceMainVO { export interface EquipmentMaintenanceMainVO {
id: number id: number
number: string
describing: string describing: string
number: string
sources: string
equipmentCode: string equipmentCode: string
type: string type: string
classes: string
planNumber: string
faultType: string faultType: string
cycle: string planNumber: string
times: string planStartTime: Date
planEndTime: Date
startTime: Date
endTime: Date
classType: string
verifyer: number verifyer: number
verifyContent: string verifyContent: string
verifyTime: Date verifyTime: Date
maintenancer: number maintenancer: number
maintenancePhone: string maintenancePhone: string
completeResult: string
completionTime: Date completionTime: Date
maintenanceTime: Date maintenanceTime: Date
status: string status: string
autoOrder: string
autoPerform: string
autoVerify: string
directCreateRecord: string
factoryAreaCode: string factoryAreaCode: string
workshopCode: string workshopCode: string
workshopSectionCode: string
departmentCode: string departmentCode: string
remark: string remark: string
siteId: string siteId: string
@ -49,6 +54,12 @@ export const getEquipmentMaintenanceMain = async (id: number) => {
return await request.get({ url: `/eam/equipment-maintenance-main/get?id=` + id }) return await request.get({ url: `/eam/equipment-maintenance-main/get?id=` + id })
} }
export const getMaintenanceOrderConfig = async () => {
return await request.get({ url: `/eam/equipment-maintenance-main/get-order-config`})
}
// 新增设备保养工单主 // 新增设备保养工单主
export const createEquipmentMaintenanceMain = async (data: EquipmentMaintenanceMainVO) => { export const createEquipmentMaintenanceMain = async (data: EquipmentMaintenanceMainVO) => {
return await request.post({ url: `/eam/equipment-maintenance-main/create`, data }) return await request.post({ url: `/eam/equipment-maintenance-main/create`, data })

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

@ -7,15 +7,16 @@ import * as WorkshopApi from "@/api/wms/workshop";
import {RelationMaintenancePlanItem} from "@/views/eam/maintenance/maintenance.data"; import {RelationMaintenancePlanItem} from "@/views/eam/maintenance/maintenance.data";
import * as ItemApi from "@/api/eam/relationMaintenancePlanItem"; 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({
number: [required], number: [required],
sources: [required],
equipmentCode: [required], equipmentCode: [required],
planNumber: [required], type: [required],
planStartTime: [required],
planEndTime: [required],
status: [required], status: [required],
factoryAreaCode: [required],
}) })
export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -29,23 +30,23 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
isDetail:false, isDetail:false,
}, },
{ {
label: '保养工单编号', label: '描述',
field: 'number', field: 'describing',
sort: 'custom', sort: 'custom',
isSearch: false,
isTable: false,
isForm: false, isForm: false,
isSearch: true, isDetail:false,
}, },
{ {
label: '描述', label: '保养工单编号',
field: 'describing', field: 'number',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
}, },
{ {
label: '设备类别', label: '来源字典',
field: 'type', field: 'sources',
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
}, },
@ -75,8 +76,16 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
{ {
label: '班次枚举', label: '设备类别',
field: 'classes', field: 'type',
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string',
sort: 'custom',
isSearch: true,
},
{
label: '故障类型枚举',
field: 'faultType',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
}, },
@ -87,26 +96,98 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
}, },
{ {
label: '故障类型枚举', label: '计划开始时间',
field: 'faultType', field: 'planStartTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter,
isSearch: true, isSearch: true,
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: '保养周期', label: '计划结束时间',
field: 'cycle', field: 'planEndTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter,
isSearch: true, isSearch: true,
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: '保养次数', label: '保养开始时间',
field: 'times', field: 'startTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter,
isSearch: true, isSearch: true,
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: { form: {
component: 'InputNumber', component: 'DatePicker',
value: 0 componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '保养结束时间',
field: 'endTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
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: '保养班组',
field: 'classType',
sort: 'custom',
isSearch: true,
}, },
{ {
label: '验证人', label: '验证人',
@ -119,6 +200,13 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'verifyContent', field: 'verifyContent',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: {
component: 'Editor',
componentProps: {
valueHtml: '',
height: 200
}
},
}, },
{ {
label: '验证时间', label: '验证时间',
@ -154,12 +242,6 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
}, },
{
label: '结果枚举临时措施、完成',
field: 'completeResult',
sort: 'custom',
isSearch: true,
},
{ {
label: '完成时间', label: '完成时间',
field: 'completionTime', field: 'completionTime',
@ -212,14 +294,35 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.EAM_ORDER_STATUS, dictType: DICT_TYPE.EAM_ORDER_STATUS,
dictClass: 'string', dictClass: 'string',
}, },
// {
// label: '自动接单',
// field: 'autoOrder',
// sort: 'custom',
// isSearch: true,
// },
// {
// label: '自动执行',
// field: 'autoPerform',
// sort: 'custom',
// isSearch: true,
// },
// {
// label: '自动验证',
// field: 'autoVerify',
// sort: 'custom',
// isSearch: true,
// },
{
label: '直接生成记录',
field: 'directCreateRecord',
sort: 'custom',
isSearch: true,
},
{ {
label: '所属厂区编号', label: '所属厂区编号',
field: 'factoryAreaCode', field: 'factoryAreaCode',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: true,
isTable: false,
isForm: false,
isDetail:false,
}, },
{ {
label: '车间编号', label: '车间编号',
@ -288,9 +391,10 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '是否可用默认TRUE', label: '是否可用默认TRUE',
field: 'available', field: 'available',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
dictType: DICT_TYPE.TRUE_FALSE, isTable: false,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isForm: false,
isDetail:false,
}, },
{ {
label: '删除时间', label: '删除时间',
@ -351,6 +455,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
])) ]))
export const EquipmentMaintenanceDetailRules = reactive({ export const EquipmentMaintenanceDetailRules = reactive({
number: [required], number: [required],
masterId: [required], masterId: [required],

232
src/views/eam/equipmentMaintenanceMain/finishForm.vue

@ -0,0 +1,232 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" :close-on-click-modal="false">
<el-form ref="basicFormRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="验证人" prop="verifyer">
<el-input v-model="formData.verifyer" placeholder="请输入验证人" :disabled="isDisabled"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="验证内容" prop="verifyContent">
<el-input v-model="formData.verifyContent" placeholder="请输入验证内容" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="验证时间" prop="verifyTime">
<el-date-picker
v-model="formData.verifyTime"
type="datetime"
placeholder="选择验证时间">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="保养人ID" prop="maintenancer">
<el-input v-model="formData.maintenancer" placeholder="请输入保养人" :disabled="isDisabled"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="保养人电话" prop="maintenancePhone">
<el-input v-model="formData.maintenancePhone" placeholder="请输入保养人电话" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm('success')"> </el-button>
<el-button @click="handleClose('close')"> </el-button>
</template>
</Dialog>
<!--添加巡检项弹窗-->
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template>
<script lang="ts" setup>
import * as EquipmentMaintenanceMainApi from '@/api/eam/equipmentMaintenanceMain'
import request from "@/config/axios";
import { SearchTable } from '@/components/SearchTable'
import { InspectionItem} from "@/views/eam/inspectionItem/inspectionItem.data";
import * as inspectionItemApi from "@/api/eam/inspectionItem";
import {ElInput} from "element-plus";
import {updateEquipmentMaintenanceMain} from "@/api/eam/equipmentMaintenanceMain";
defineOptions({ name: 'TeamForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const tags=ref([])
const inputValue = ref('')
const inputVisible = ref(false)
const isDisabled = ref(false)
const InputRef = ref<InstanceType<typeof ElInput>>()
const formData = ref({
id:'',
number:'',
verifyer: '',
verifyContent: '',
verifyTime: '',
maintenancer: '',
maintenancePhone: '',
})
const formRules = reactive({
verifyer: [
{ required: true, message: '验证人不能为空', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
verifyContent: [
{ required: true, message: '验证内容不能为空', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
verifyTime: [
{ required: true, message: '验证时间不能为空', trigger: 'blur' },
],
maintenancer: [
{ required: true, message: '保养人ID不能为空', trigger: 'blur' },
],
maintenancePhone: [
{ required: true, message: '保养人电话不能为空', trigger: 'blur' },
],
})
const basicFormRef = ref() // Ref
// /** */
// const searchTableRef = ref();
// const _searchTableTitle = ref();
// const _searchTableAllSchemas = ref();
// const _searchTablePage = ref();
// const _formField = ref();
// const _searchField = ref();
// const _multiple = ref();
// const _type = ref();
// const _row = ref();
// const _searchCondition = ref({})
//
//
// const addItem = () =>{
// addItemCommon(true,'xunJianItem')
// }
//
// /** */
// const addItemCommon = (multiple,field) => {
// _searchCondition.value = {}
// const filters: any[] = []
// filters.push({
// action: "==",
// column: 'available',
// value: 'TRUE'
// })
// //
// _searchCondition.value.isSearch = true
// _searchCondition.value.filters = filters
// _searchTableTitle.value = ''
// _multiple.value = multiple
// _formField.value = field
// _searchField.value = field
// _searchTablePage.value = inspectionItemApi.getInspectionItemPage
// _searchTableAllSchemas.value = InspectionItem.allSchemas
// openCommon()
// }
//
// /** */
// const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
// nextTick?.(() => {
// if (formField === 'xunJianItem') {
// val.forEach(item => {
// const isExist = tags.value.some(tag => tag.content === item.content);
// if (!isExist){
// const newItem = {};
// newItem['content'] = item.content;
// newItem['id'] = item.id;
// tags.value.push(newItem);
// }
// });
// }
// })
// }
// /**/
// const openCommon = () => {
// searchTableRef.value.open(
// _searchTableTitle.value,
// _searchTableAllSchemas.value,
// _searchTablePage.value,
// _formField.value,
// _searchField.value,
// _multiple.value,
// _type.value,
// _row.value,
// _searchCondition.value
// )
// }
/** 初始化弹窗 */
const open = async (type: string, row?: object) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
//
formData.value.id = row.id
formData.value.number = row.planNumber
}
defineExpose({ open }) // open
/** 提交表单 */
const submitForm = async (val) => {
//success
emit('success',formData.value.id)
//
if (!basicFormRef) return
const valid = await basicFormRef.value.validate()
if (!valid) return
//
await EquipmentMaintenanceMainApi.updateEquipmentMaintenanceMain(formData.value)
dialogVisible.value = false
}
const handleClose=(val)=>{
dialogVisible.value = false
emit('close',val)
}
//
const emit = defineEmits(['close','success'])
</script>
<style scoped>
.tag-container {
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */
border: 1px solid #ccc; /* 添加边框样式 */
padding: 10px; /* 可根据需要调整容器内边距 */
width: 950px; /* 设置固定宽度为 950px */
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */
overflow-wrap: break-word; /* 兼容性更好的写法 */
flex-wrap: wrap;
}
.input-with-button {
display: flex;
align-items: center;
width: 100%;
}
.input-with-button > .el-input {
flex: 1;
/*margin-right: 10px;*/
}
</style>

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

@ -51,6 +51,20 @@
@onChange="onChange" @onChange="onChange"
/> />
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="EquipmentMaintenanceMainRules"
:formAllSchemas="EquipmentMaintenanceMain.allSchemas"
:apiUpdate="EquipmentMaintenanceMainApi.updateEquipmentMaintenanceMain"
:apiCreate="EquipmentMaintenanceMainApi.createEquipmentMaintenanceMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChange"
/>
<FinishForm ref="finishFormRef" @success="getData" @close="getClosed"/>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" <Detail ref="detailRef"
:isBasic="false" :isBasic="false"
@ -83,12 +97,13 @@ 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/MaintenanceOrderDetail.vue' import Detail from '@/views/eam/equipmentMaintenanceMain/MaintenanceOrderDetail.vue'
import FinishForm from '@/views/eam/equipmentMaintenanceMain/finishForm.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"; import {getMaintenanceOrderConfig} from "@/api/eam/equipmentMaintenanceMain";
defineOptions({ name: 'EquipmentMaintenanceMain' }) defineOptions({ name: 'EquipmentMaintenanceMain' })
@ -195,7 +210,7 @@ const buttonTableClick = async (val, row) => {
} else if (val == 'execute') { // } else if (val == 'execute') { //
handleExecute(row.id) handleExecute(row.id)
} else if (val == 'finish') { // } else if (val == 'finish') { //
handleFinish(row.id) handleFinish(row)
} else if (val == 'validate') { // } else if (val == 'validate') { //
handleValidate(row.id) handleValidate(row.id)
} }
@ -330,7 +345,11 @@ const handleExecute = async (id: number) => {
} }
/** 完成按钮操作 */ /** 完成按钮操作 */
const handleFinish = async (id: number) => { const finishFormRef = ref()
const handleFinish = async (row) => {
let res = await EquipmentMaintenanceMainApi.getMaintenanceOrderConfig();
//
if(res.remark === 'TRUE'){
try { try {
// //
await message.delConfirm('是否完成所选中工单?'); await message.delConfirm('是否完成所选中工单?');
@ -338,7 +357,7 @@ const handleFinish = async (id: number) => {
id: '', id: '',
status:'', status:'',
}) })
params.value.id = id params.value.id = row.id
params.value.status = '5' params.value.status = '5'
// //
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value)
@ -347,6 +366,18 @@ const handleFinish = async (id: number) => {
await getList() await getList()
} catch {} } catch {}
} }
//
if(res.remark === 'FALSE'){
try {
//
await message.delConfirm('是否完成所选中工单?');
//
finishFormRef.value.open('update', row);
} catch {}
}
}
/** 验证按钮操作 */ /** 验证按钮操作 */
const handleValidate = async (id: number) => { const handleValidate = async (id: number) => {
@ -498,6 +529,30 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
const getClosed=(val)=> {
//console.log('orderday-publishClosed-200',val)
nextTick?.(() => {
console.log(val)
getList()
})
}
const getData=(val)=> {
nextTick?.(async () => {
console.log(val)
const params = ref({
id: '',
status: '',
})
params.value.id = val
params.value.status = '5'
//
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value)
message.success(t('工单已完成'))
//
await getList()})
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

Loading…
Cancel
Save