Browse Source

EAM ——> 保养工单 提交 添加验证内容

master_hella_20240701
gaojs 5 months ago
parent
commit
38fe212202
  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. 91
      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 {
id: number
number: string
describing: string
number: string
sources: string
equipmentCode: string
type: string
classes: string
planNumber: string
faultType: string
cycle: string
times: string
planNumber: string
planStartTime: Date
planEndTime: Date
startTime: Date
endTime: Date
classType: string
verifyer: number
verifyContent: string
verifyTime: Date
maintenancer: number
maintenancePhone: string
completeResult: string
completionTime: Date
maintenanceTime: Date
status: string
autoOrder: string
autoPerform: string
autoVerify: string
directCreateRecord: string
factoryAreaCode: string
workshopCode: string
workshopSectionCode: string
departmentCode: string
remark: 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 })
}
export const getMaintenanceOrderConfig = async () => {
return await request.get({ url: `/eam/equipment-maintenance-main/get-order-config`})
}
// 新增设备保养工单主
export const createEquipmentMaintenanceMain = async (data: EquipmentMaintenanceMainVO) => {
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 * as ItemApi from "@/api/eam/relationMaintenancePlanItem";
import {validateroundNumber} from "@/utils/validator";
import {getRelationMaintenancePlanItemPage} from "@/api/eam/relationMaintenancePlanItem";
// 表单校验
export const EquipmentMaintenanceMainRules = reactive({
number: [required],
sources: [required],
equipmentCode: [required],
planNumber: [required],
type: [required],
planStartTime: [required],
planEndTime: [required],
status: [required],
factoryAreaCode: [required],
})
export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -29,23 +30,23 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
isDetail:false,
},
{
label: '保养工单编号',
field: 'number',
label: '描述',
field: 'describing',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isSearch: true,
isDetail:false,
},
{
label: '描述',
field: 'describing',
label: '保养工单编号',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '设备类别',
field: 'type',
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string',
label: '来源字典',
field: 'sources',
sort: 'custom',
isSearch: true,
},
@ -75,8 +76,16 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '班次枚举',
field: 'classes',
label: '设备类别',
field: 'type',
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string',
sort: 'custom',
isSearch: true,
},
{
label: '故障类型枚举',
field: 'faultType',
sort: 'custom',
isSearch: true,
},
@ -87,26 +96,98 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true,
},
{
label: '故障类型枚举',
field: 'faultType',
label: '计划开始时间',
field: 'planStartTime',
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: 'cycle',
label: '计划结束时间',
field: 'planEndTime',
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: 'times',
label: '保养开始时间',
field: 'startTime',
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: 'InputNumber',
value: 0
component: 'DatePicker',
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: '验证人',
@ -119,6 +200,13 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'verifyContent',
sort: 'custom',
isSearch: true,
form: {
component: 'Editor',
componentProps: {
valueHtml: '',
height: 200
}
},
},
{
label: '验证时间',
@ -154,12 +242,6 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: true,
},
{
label: '结果枚举临时措施、完成',
field: 'completeResult',
sort: 'custom',
isSearch: true,
},
{
label: '完成时间',
field: 'completionTime',
@ -212,14 +294,35 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.EAM_ORDER_STATUS,
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: '所属厂区编号',
field: 'factoryAreaCode',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
isSearch: true,
},
{
label: '车间编号',
@ -288,9 +391,10 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '是否可用默认TRUE',
field: 'available',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '删除时间',
@ -351,6 +455,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
]))
export const EquipmentMaintenanceDetailRules = reactive({
number: [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>

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

@ -51,6 +51,20 @@
@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"
:isBasic="false"
@ -83,12 +97,13 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.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 {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data";
import * as ToolItemApi from "@/api/eam/toolAccounts";
import {updateMaintenanceOrder} from "@/api/eam/equipmentMaintenanceMain";
import {getMaintenanceOrderConfig} from "@/api/eam/equipmentMaintenanceMain";
defineOptions({ name: 'EquipmentMaintenanceMain' })
@ -195,7 +210,7 @@ const buttonTableClick = async (val, row) => {
} else if (val == 'execute') { //
handleExecute(row.id)
} else if (val == 'finish') { //
handleFinish(row.id)
handleFinish(row)
} else if (val == 'validate') { //
handleValidate(row.id)
}
@ -330,22 +345,38 @@ const handleExecute = async (id: number) => {
}
/** 完成按钮操作 */
const handleFinish = async (id: number) => {
try {
//
await message.delConfirm('是否完成所选中工单?');
const params = ref({
id: '',
status:'',
})
params.value.id = id
params.value.status = '5'
//
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value)
message.success(t('工单已完成'))
//
await getList()
} catch {}
const finishFormRef = ref()
const handleFinish = async (row) => {
let res = await EquipmentMaintenanceMainApi.getMaintenanceOrderConfig();
//
if(res.remark === 'TRUE'){
try {
//
await message.delConfirm('是否完成所选中工单?');
const params = ref({
id: '',
status:'',
})
params.value.id = row.id
params.value.status = '5'
//
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value)
message.success(t('工单已完成'))
//
await getList()
} catch {}
}
//
if(res.remark === 'FALSE'){
try {
//
await message.delConfirm('是否完成所选中工单?');
//
finishFormRef.value.open('update', row);
} catch {}
}
}
/** 验证按钮操作 */
@ -498,6 +529,30 @@ const searchFormClick = (searchData) => {
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 () => {
getList()

Loading…
Cancel
Save