Browse Source

EAM ——> 保养工单 完成更新 保养计划审核完成更新

master_hella_20240701
gaojs 6 months ago
parent
commit
ac2a598d2d
  1. 7
      src/api/eam/equipmentMaintenanceMain/index.ts
  2. 11
      src/api/eam/maintenance/index.ts
  3. 15
      src/hooks/web/useMessage.ts
  4. 1
      src/utils/dict.ts
  5. 13
      src/utils/disposition/defaultButtons.ts
  6. 79
      src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts
  7. 18
      src/views/eam/equipmentMaintenanceMain/finishForm1.vue
  8. 215
      src/views/eam/equipmentMaintenanceMain/finishForm2.vue
  9. 151
      src/views/eam/equipmentMaintenanceMain/index.vue
  10. 142
      src/views/eam/maintenance/audiForm.vue
  11. 101
      src/views/eam/maintenance/index.vue
  12. 23
      src/views/eam/maintenance/maintenance.data.ts

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

@ -95,7 +95,12 @@ export const updateMaintenanceOrder = async (data: EquipmentMainPartVO) => {
return await request.post({ url: `/eam/equipment-maintenance-main/updateOrder`, data })
}
//执行保养工单
//完成保养工单
export const executeMaintenanceOrder = async (data: EquipmentMainPartVO) => {
return await request.post({ url: `/eam/equipment-maintenance-main/execute`, data })
}
//验证不通过,打回保养工单
export const backMaintenanceOrder = async (data: EquipmentMainPartVO) => {
return await request.post({ url: `/eam/equipment-maintenance-main/fallback`, data })
}

11
src/api/eam/maintenance/index.ts

@ -1,5 +1,6 @@
import request from '@/config/axios'
import {InspectionItemSelectSetVO} from "@/api/eam/inspectionItemSelectSet";
import {EquipmentMainPartVO} from "@/api/eam/equipmentMainPart";
export interface MaintenanceVO {
id: number
@ -56,6 +57,11 @@ export const updateMaintenance = async (data: MaintenanceVO) => {
return await request.put({ url: `/eam/maintenance/update`, data })
}
// 修改保养计划-审核
export const updateMaintenanceAudi = async (data: MaintenanceVO) => {
return await request.post({ url: `/eam/maintenance/updateAudi`, data })
}
// 删除保养计划
export const deleteMaintenance = async (id: number) => {
return await request.delete({ url: `/eam/maintenance/delete?id=` + id })
@ -75,3 +81,8 @@ export const importTemplate = () => {
export const updateEnableCode = async (data: MaintenanceVO) => {
return await request.post({ url: `/eam/maintenance/ables` , data })
}
// 修改计划状态
export const updateMaintenancePlan = async (data: MaintenanceVO) => {
return await request.post({ url: `/eam/maintenance/updatePlan`, data })
}

15
src/hooks/web/useMessage.ts

@ -59,11 +59,20 @@ export const useMessage = () => {
type: 'warning'
})
},
// 确认窗体
// 验证窗体
confirmPassword(content: string, tip?: string) {
return ElMessageBox.confirm(content, tip ? tip : t('common.confirmTitle'), {
confirmButtonText: t('通过'),
cancelButtonText: t('不通过'),
confirmButtonText: t('验证通过'),
cancelButtonText: t('验证不通过'),
type: 'warning'
})
},
// 审核窗体
confirmAudi(content: string, tip?: string) {
return ElMessageBox.confirm(content, tip ? tip : t('common.confirmTitle'), {
distinguishCancelAndClose: true,
confirmButtonText: t('审核通过'),
cancelButtonText: t('审核不通过'),
type: 'warning'
})
},

1
src/utils/dict.ts

@ -355,5 +355,6 @@ export enum DICT_TYPE {
IS_COMPLETED = 'is_completed', //是否完成
MAINTENANCE_CYCLE ='maintenance_cycle', // 保养周期
EAM_ORDER_STATUS = 'eam_order_status',
EAM_PLAN_STATUS = 'eam_plan_status',
OFF_BACK_STATUS = 'off_back_status'
}

13
src/utils/disposition/defaultButtons.ts

@ -377,6 +377,19 @@ export function mainListValidateBtn(option:any) {
})
}
// 主列表-审核按钮
export function mainListAuditingBtn(option:any) {
return __defaultBtnOption(option,{
label: t(`ts.审核`).replace('ts.', ''),
name: 'auditing',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-绑定
export function mainListBindBtn(option:any) {
return __defaultBtnOption(option,{

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

@ -49,6 +49,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'sources',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '设备编号',
@ -82,12 +83,14 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
dictClass: 'string',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '故障类型枚举',
field: 'faultType',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '保养计划工单号',
@ -100,7 +103,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'planStartTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -122,7 +125,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'planEndTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -144,7 +147,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'startTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -166,7 +169,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'endTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -187,19 +190,19 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '保养班组',
field: 'classType',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '验证人',
field: 'verifyer',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '验证内容',
field: 'verifyContent',
sort: 'custom',
isSearch: true,
isSearch: false,
form: {
component: 'Editor',
componentProps: {
@ -213,7 +216,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'verifyTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -234,42 +237,20 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '保养人id',
field: 'maintenancer',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '保养人联系电话',
field: 'maintenancePhone',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '完成时间',
field: 'completionTime',
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: 'maintenanceTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -286,6 +267,28 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
}
},
},
// {
// label: '保养时间',
// field: 'maintenanceTime',
// 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: 'status',
@ -316,19 +319,19 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '直接生成记录',
field: 'directCreateRecord',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '所属厂区编号',
field: 'factoryAreaCode',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true,
isSearch: false,
required: true,
form: {
// labelMessage: '信息提示说明!!!',
@ -352,7 +355,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -376,7 +379,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '地点ID',

18
src/views/eam/equipmentMaintenanceMain/finishForm.vue → src/views/eam/equipmentMaintenanceMain/finishForm1.vue

@ -19,23 +19,12 @@
<el-date-picker
v-model="formData.verifyTime"
type="datetime"
value-format="x"
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>
@ -49,12 +38,8 @@
</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' })
@ -184,7 +169,6 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交表单 */
const submitForm = async (val) => {
//success
emit('success',formData.value.id)
//

215
src/views/eam/equipmentMaintenanceMain/finishForm2.vue

@ -0,0 +1,215 @@
<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="保养人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-row>
<el-col :span="12">
<el-form-item label="保养开始时间" prop="startTime">
<el-date-picker
v-model="formData.startTime"
type="datetime"
value-format="x"
placeholder="选择保养开始时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="保养结束时间" prop="endTime">
<el-date-picker
v-model="formData.endTime"
type="datetime"
value-format="x"
placeholder="保养结束时间">
</el-date-picker>
</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 { SearchTable } from '@/components/SearchTable'
import {ElInput} from "element-plus";
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:'',
maintenancer: '',
maintenancePhone: '',
startTime:'',
endTime:'',
})
const formRules = reactive({
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>

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

@ -63,7 +63,8 @@
@onChange="onChange"
/>
<FinishForm ref="finishFormRef" @success="getData" @close="getClosed"/>
<FinishForm1 ref="finishForm1Ref" @success="getData1" @close="getClosed1"/>
<FinishForm2 ref="finishForm2Ref" @success="getData2" @close="getClosed2"/>
<!-- 详情 -->
<Detail ref="detailRef"
@ -97,13 +98,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 FinishForm1 from '@/views/eam/equipmentMaintenanceMain/finishForm1.vue'
import FinishForm2 from '@/views/eam/equipmentMaintenanceMain/finishForm2.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 {getMaintenanceOrderConfig} from "@/api/eam/equipmentMaintenanceMain";
defineOptions({ name: 'EquipmentMaintenanceMain' })
@ -190,12 +191,12 @@ const isShowStatusButton = (row,val) => {
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:equipmentMaintenanceMain:update'}), //
defaultButtons.mainListReceiveOrderBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListExecuteBtn({hide: isShowStatusButton(row,['4']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListFinishBtn({hide: isShowStatusButton(row,['5']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListValidateBtn({hide: isShowStatusButton(row,['6']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:maintenance:update'}),
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:maintenance:update'}),
defaultButtons.mainListReceiveOrderBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:equipmentMaintenanceMain:update'}), //
defaultButtons.mainListExecuteBtn({hide: isShowStatusButton(row,['4']),hasPermi:'eam:equipmentMaintenanceMain:update'}), //
defaultButtons.mainListFinishBtn({hide: isShowStatusButton(row,['5']),hasPermi:'eam:equipmentMaintenanceMain:update'}), //
defaultButtons.mainListValidateBtn({hide: isShowStatusButton(row,['6']),hasPermi:'eam:equipmentMaintenanceMain:update'}), //
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:equipmentMaintenanceMain:update'}),
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:equipmentMaintenanceMain:update'}),
]
}
@ -212,7 +213,7 @@ const buttonTableClick = async (val, row) => {
} else if (val == 'finish') { //
handleFinish(row)
} else if (val == 'validate') { //
handleValidate(row.id)
handleValidate(row)
}
}
@ -345,66 +346,68 @@ const handleExecute = async (id: number) => {
}
/** 完成按钮操作 */
const finishFormRef = ref()
const finishForm2Ref = 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);
finishForm2Ref.value.open('update', row);
} catch {}
}
//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('');
//
// //
// finishForm2Ref.value.open('update', row);
//
// } catch {}
// }
}
/** 验证按钮操作 */
const handleValidate = async (id: number) => {
try {
const params = ref({
id: '',
status:'',
})
//
const finishForm1Ref = ref()
const handleValidate = async (row) => {
await message.delConfirm('是否验证所选中工单?');
message.confirmPassword(t('')).then(async () => {
params.value.id = id
params.value.status = '7'
await EquipmentMaintenanceMainApi.updateMaintenanceOrder(params.value)
message.success(t('工单已流转'))
//
await getList()
//
//
finishForm1Ref.value.open('update', row);
}).catch (async () => {
params.value.id = id
const params = ref({id: '', status:''})
params.value.id = row.id
params.value.status = '5'
await EquipmentMaintenanceMainApi.updateMaintenanceOrder(params.value)
message.success(t('工单已流转'))
await EquipmentMaintenanceMainApi.backMaintenanceOrder(params.value)
message.success(t('工单已打回'))
//
await getList()
})
} catch {}
}
/** 启用 */
@ -529,15 +532,46 @@ const searchFormClick = (searchData) => {
getList() //
}
const getClosed=(val)=> {
//console.log('orderday-publishClosed-200',val)
//finishForm1
const getClosed1=(val)=> {
nextTick?.(() => {
console.log(val)
getList()
})
}
//finishForm1
const getData1=(val)=> {
nextTick?.(async () => {
console.log(val)
try {
const params = ref({
id: '',
status:'',
})
params.value.id = val
params.value.status = '7'
await EquipmentMaintenanceMainApi.updateMaintenanceOrder(params.value)
message.success(t('工单已流转'))
//
await getList()
} catch {}
}
)
}
//finishForm2
const getClosed2=(val)=> {
nextTick?.(() => {
console.log(val)
getList()
})
}
const getData=(val)=> {
//finishForm2
const getData2=(val)=> {
nextTick?.(async () => {
console.log(val)
const params = ref({
@ -550,7 +584,8 @@ const getData=(val)=> {
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value)
message.success(t('工单已完成'))
//
await getList()})
await getList()
})
}
/** 初始化 **/

142
src/views/eam/maintenance/audiForm.vue

@ -0,0 +1,142 @@
<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="approver">
<el-input v-model="formData.approver" placeholder="请输入审核人" :disabled="isDisabled"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核内容" prop="approveContent">
<el-input v-model="formData.approveContent" placeholder="请输入审核内容" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="审核时间" prop="approveTime">
<el-date-picker
v-model="formData.approveTime"
type="datetime"
value-format="x"
placeholder="选择审核时间">
</el-date-picker>
</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 MaintenanceApi from '@/api/eam/maintenance'
import { SearchTable } from '@/components/SearchTable'
import {ElInput} from "element-plus";
import {updateMaintenanceAudi} from "@/api/eam/maintenance";
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:'',
approver: '',
approveContent: '',
approveTime: '',
})
const formRules = reactive({
approver: [
{ required: true, message: '审核人不能为空', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
approveContent: [
{ required: true, message: '审核内容不能为空', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
approveTime: [
{ required: true, message: '审核时间不能为空', trigger: 'blur' },
],
})
const basicFormRef = ref() // Ref
/** 初始化弹窗 */
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.number
}
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 MaintenanceApi.updateMaintenanceAudi(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>

101
src/views/eam/maintenance/index.vue

@ -54,6 +54,8 @@
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Maintenance.allSchemas" />
<AudiForm ref="audiFormRef" @success="getData" @close="getClosed"/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/maintenance/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
@ -66,11 +68,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 '@/components/Detail/src/Detail.vue'
import AudiForm from '@/views/eam/maintenance/audiForm.vue'
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";
defineOptions({ name: 'Maintenance' })
const message = useMessage() //
@ -144,11 +148,20 @@ const isShowMainButton = (row,val) => {
}
}
const isShowStatusButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:maintenance:update'}), //
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:basicInspectionOption:delete'}), //
defaultButtons.mainListEditBtn({hide: isShowStatusButton(row,['0']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListAuditingBtn({hide: isShowStatusButton(row,['0']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListFinishBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:maintenance:update'}),
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:maintenance:update'}),
]
@ -164,12 +177,29 @@ const buttonTableClick = async (val, row) => {
handleEnable(row.id)
} else if (val == 'disable') {
handleDisable(row.id)
} else if (val == 'auditing') { //
handleAuditing(row.id)
} else if (val == 'finish') { //
handleFinish(row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if(type == "create"){
Maintenance.allSchemas.formSchema.forEach((item) => {
if(item.field == 'status'){
item.componentProps.disabled = true
}
})
}else{
Maintenance.allSchemas.formSchema.forEach((item) => {
if(item.field == 'status'){
item.componentProps.disabled = false
}
})
}
basicFormRef.value.open(type, row)
}
@ -216,6 +246,45 @@ const handleDelete = async (id: number) => {
} catch {}
}
//
const handleFinish = async (row) => {
message.confirmAudi(t('')).then(async () => {
//
audiFormRef.value.open('update', row);
}).catch(async (action: Action) => {
if(action === 'cancel'){
const params = ref({
id: '',
status:'',
})
params.value.id = row.id
params.value.status = '5'
await MaintenanceApi.updateMaintenancePlan(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
}
})
}
//
const audiFormRef = ref()
const handleAuditing = async (id: number) => {
await message.delConfirm('是否审核所选中工单?');
try {
const params = ref({
id: '',
status:'',
})
params.value.id = id
params.value.status = '3'
await MaintenanceApi.updateMaintenancePlan(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
} catch {}
}
/** 启用 */
const handleEnable = async (id: number) => {
try {
@ -314,6 +383,34 @@ const searchFormClick = (searchData) => {
getList() //
}
//audiForm
const getClosed=(val)=> {
nextTick?.(() => {
getList()
})
}
//audiForm
const getData=(val)=> {
nextTick?.(async () => {
try {
const params = ref({
id: '',
status:'',
})
params.value.id = val
params.value.status = '4'
await MaintenanceApi.updateMaintenancePlan(params.value)
message.success(t('计划已流转'))
//
await getList()
} catch {}
}
)
}
/** 初始化 **/
onMounted(async () => {
getList()

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

@ -47,7 +47,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '设备工装编号',
@ -112,7 +112,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
field: 'startTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -134,7 +134,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
field: 'endTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -156,26 +156,27 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
field: 'status',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.EAM_PLAN_STATUS,
dictClass: 'string',
},
{
label: '审核人',
field: 'approver',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '审核内容',
field: 'approveContent',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '审核时间',
field: 'approveTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -214,7 +215,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
label: '直接生成记录',
field: 'directCreateRecord',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '所属厂区编号',
@ -229,7 +230,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true,
isSearch: false,
required: true,
form: {
// labelMessage: '信息提示说明!!!',
@ -253,7 +254,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
@ -277,7 +278,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '地点ID',

Loading…
Cancel
Save