|
@ -21,35 +21,39 @@ |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row> |
|
|
<el-row> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12"> |
|
|
<el-form-item label="描述" prop="describing"> |
|
|
<el-form-item label="是否可修改" prop="isUpdated"> |
|
|
<el-input v-model="formData.describing" placeholder="请输入描述" /> |
|
|
<el-select v-model="formData.isUpdated" style="width: 200px"> |
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-form-item label="项是否可修改" prop="isUpdated"> |
|
|
|
|
|
<el-select v-model="formData.isUpdated" style="width: 150px"> |
|
|
|
|
|
<el-option label="是" value="TRUE"></el-option> |
|
|
<el-option label="是" value="TRUE"></el-option> |
|
|
<el-option label="否" value="FALSE"></el-option> |
|
|
<el-option label="否" value="FALSE"></el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="12"> |
|
|
|
|
|
<el-form-item label="描述" prop="describing"> |
|
|
|
|
|
<el-input v-model="formData.describing" placeholder="请输入描述" /> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row> |
|
|
<el-row> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12"> |
|
|
<el-form-item label="备注" prop="remark"> |
|
|
<el-form-item label="是否可用" prop="available"> |
|
|
<el-input v-model="formData.remark" placeholder="请输入备注" /> |
|
|
<el-select v-model="formData.available" style="width: 200px"> |
|
|
</el-form-item> |
|
|
<el-option label="是" value="TRUE"></el-option> |
|
|
</el-col> |
|
|
<el-option label="否" value="FALSE"></el-option> |
|
|
<el-form-item label="是否可用" prop="available"> |
|
|
</el-select> |
|
|
<el-select v-model="formData.available" style="width: 150px"> |
|
|
</el-form-item> |
|
|
<el-option label="是" value="TRUE"></el-option> |
|
|
</el-col> |
|
|
<el-option label="否" value="FALSE"></el-option> |
|
|
<el-col :span="12"> |
|
|
</el-select> |
|
|
<el-form-item label="备注" prop="remark"> |
|
|
</el-form-item> |
|
|
<el-input v-model="formData.remark" placeholder="请输入备注" /> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row> |
|
|
<el-row> |
|
|
<el-col :span="11"> |
|
|
<el-col :span="11"> |
|
|
<el-form-item label="选择集ID" prop="selectId"> |
|
|
<el-form-item label="选择集ID" prop="selectId"> |
|
|
<div class="tag-container flex gap-2"> |
|
|
<div class="tag-container flex gap-2"> |
|
|
<el-tag v-for="ent in tags" :key="ent.content" closable :disable-transitions="false" @close="handleClose(ent.selectId)"> |
|
|
<el-tag v-for="ent in tags" :key="ent.selectId" closable :disable-transitions="false" @close="handleClose(ent.selectId)"> |
|
|
{{ ent.selectId}} |
|
|
{{ ent.selectId}} |
|
|
</el-tag> |
|
|
</el-tag> |
|
|
<el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="w-20" size="small"/> |
|
|
<el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="w-20" size="small"/> |
|
@ -61,17 +65,17 @@ |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
</el-form> |
|
|
</el-form> |
|
|
<el-table :data="maintenanceItemData" ref="tableEquipment" style="width: 100%; height: 80%"> |
|
|
<el-table :data="maintenanceItemData" style="width: 100%; height: 80%"> |
|
|
<el-table-column prop="name" label="保养名称" /> |
|
|
<el-table-column prop="itemCode" label="保养项ID" /> |
|
|
<el-table-column prop="content" label="保养要求" /> |
|
|
<el-table-column prop="itemName" label="保养名称" /> |
|
|
<el-table-column prop="equipmentParts" label="保养部位" /> |
|
|
<!-- <el-table-column prop="equipmentParts" label="保养部位" />--> |
|
|
<el-table-column prop="opera" label="" width="130" > |
|
|
<el-table-column prop="isSelectd" label="" width="150" > |
|
|
<template #header> |
|
|
<template #header> |
|
|
<span>是否必选默认是</span> |
|
|
<span>是否必选(默认是)</span> |
|
|
</template> |
|
|
</template> |
|
|
<template #default="scope"> |
|
|
<template #default="scope"> |
|
|
<el-switch |
|
|
<el-switch |
|
|
v-model="scope.row.replaceFlag" |
|
|
v-model="scope.row.isSelectd" |
|
|
active-color="#13ce66" |
|
|
active-color="#13ce66" |
|
|
inactive-color="#ff4949" |
|
|
inactive-color="#ff4949" |
|
|
active-text="是" |
|
|
active-text="是" |
|
@ -91,12 +95,16 @@ |
|
|
|
|
|
|
|
|
</template> |
|
|
</template> |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import * as SelectSetApi from '@/api/eam/inspectionItemSelectSet' |
|
|
import * as BasicMaintenanceOptionApi from '@/api/eam/basicMaintenanceOption' |
|
|
import request from "@/config/axios"; |
|
|
import request from "@/config/axios"; |
|
|
import { SearchTable } from '@/components/SearchTable' |
|
|
import { SearchTable } from '@/components/SearchTable' |
|
|
import { BasicMaintenanceItemSelectSet} from "@/views/eam/maintenanceItemSelectSet/maintenanceItemSelectSet.data"; |
|
|
import { BasicMaintenanceItemSelectSet} from "@/views/eam/maintenanceItemSelectSet/maintenanceItemSelectSet.data"; |
|
|
import * as maintenanceItemSelectSetApi from "@/api/eam/maintenanceItemSelectSet"; |
|
|
import * as maintenanceItemSelectSetApi from "@/api/eam/maintenanceItemSelectSet"; |
|
|
import {ElInput} from "element-plus"; |
|
|
import {ElInput} from "element-plus"; |
|
|
|
|
|
import { |
|
|
|
|
|
BasicMaintenanceOptionVO, |
|
|
|
|
|
createBasicMaintenanceOption, updateBasicMaintenanceOption |
|
|
|
|
|
} from "@/api/eam/basicMaintenanceOption"; |
|
|
|
|
|
|
|
|
defineOptions({ name: 'TeamForm' }) |
|
|
defineOptions({ name: 'TeamForm' }) |
|
|
|
|
|
|
|
@ -129,13 +137,24 @@ const formData = ref({ |
|
|
isUpdated: '', |
|
|
isUpdated: '', |
|
|
remark: '', |
|
|
remark: '', |
|
|
available: '', |
|
|
available: '', |
|
|
selectId: '' |
|
|
selectId: '', |
|
|
|
|
|
optionItem:[] |
|
|
}) |
|
|
}) |
|
|
const formRules = reactive({ |
|
|
const formRules = reactive({ |
|
|
|
|
|
code: [ |
|
|
|
|
|
{ required: true, message: '方案编号不能为空', trigger: 'blur' }, |
|
|
|
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|
|
|
|
|
], |
|
|
name: [ |
|
|
name: [ |
|
|
{ required: true, message: '选择集名称不能为空', trigger: 'blur' }, |
|
|
{ required: true, message: '方案名称不能为空', trigger: 'blur' }, |
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|
|
], |
|
|
], |
|
|
|
|
|
isUpdated: [ |
|
|
|
|
|
{ required: true, message: '不能为空', trigger: 'blur' }, |
|
|
|
|
|
], |
|
|
|
|
|
available: [ |
|
|
|
|
|
{ required: true, message: '不能为空', trigger: 'blur' }, |
|
|
|
|
|
], |
|
|
remark: [ |
|
|
remark: [ |
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|
|
], |
|
|
], |
|
@ -144,7 +163,9 @@ const basicFormRef = ref() // 表单 Ref |
|
|
|
|
|
|
|
|
/** 删除巡检项 */ |
|
|
/** 删除巡检项 */ |
|
|
const handleClose = (id: string) => { |
|
|
const handleClose = (id: string) => { |
|
|
const index = tags.value.findIndex(tag => tag.id === id); |
|
|
console.log(id) |
|
|
|
|
|
console.log(tags) |
|
|
|
|
|
const index = tags.value.findIndex(tag => tag.selectId === id); |
|
|
if (index !== -1) { |
|
|
if (index !== -1) { |
|
|
tags.value.splice(index, 1); |
|
|
tags.value.splice(index, 1); |
|
|
} |
|
|
} |
|
@ -203,20 +224,21 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
tags.value = []; |
|
|
tags.value = []; |
|
|
tags.value.push(newItem); |
|
|
tags.value.push(newItem); |
|
|
} |
|
|
} |
|
|
itemsId = item.itemCode |
|
|
itemsId = item.itemCode; |
|
|
}); |
|
|
}); |
|
|
//保养项赋值 |
|
|
//保养项赋值 |
|
|
try { |
|
|
try { |
|
|
formLoading.value = true; |
|
|
formLoading.value = true; |
|
|
maintenanceItemData.value = []; |
|
|
maintenanceItemData.value = []; |
|
|
for (const item of itemsId.split(",")) { |
|
|
for (const item of itemsId.split(",")) { |
|
|
let res = await request.get({url: `/eam/basic/maintenance-item/get?id=` + item}) |
|
|
let res = await request.get({url: `/eam/basic/maintenance-item/get?id=` + item}) |
|
|
const newItem = {}; |
|
|
const newItem = {}; |
|
|
newItem['name'] = res.name; |
|
|
newItem['itemCode'] = res.id; |
|
|
newItem['content'] = res.content; |
|
|
newItem['itemName'] = res.name; |
|
|
newItem['equipmentParts'] = res.equipmentParts; |
|
|
newItem['equipmentParts'] = res.equipmentParts; |
|
|
maintenanceItemData.value.push(newItem); |
|
|
newItem['isSelectd'] = true; |
|
|
} |
|
|
maintenanceItemData.value.push(newItem); |
|
|
|
|
|
} |
|
|
} finally { |
|
|
} finally { |
|
|
formLoading.value = false; |
|
|
formLoading.value = false; |
|
|
} |
|
|
} |
|
@ -244,39 +266,36 @@ const open = async (type: string, row?: object) => { |
|
|
formType.value = type |
|
|
formType.value = type |
|
|
// 修改时,设置数据 |
|
|
// 修改时,设置数据 |
|
|
if (row) { |
|
|
if (row) { |
|
|
tags.value=[]; |
|
|
|
|
|
maintenanceItemData.value = []; |
|
|
|
|
|
isDisabled.value = true; |
|
|
isDisabled.value = true; |
|
|
formLoading.value = true |
|
|
formLoading.value = true |
|
|
formData.value = row; |
|
|
formData.value = row; |
|
|
|
|
|
//添加保养选择集 |
|
|
let item = (row.id.toString()).split(",") |
|
|
let item = (row.id.toString()).split(",") |
|
|
try { |
|
|
try { |
|
|
for (var i = 0; i < item.length; i++) { |
|
|
tags.value=[]; |
|
|
itemData.value = await request.get({ url: `/eam/basic-maintenance-option/get?id=` + item[i] }); |
|
|
for (var i = 0; i < item.length; i++) { |
|
|
tags.value.push(itemData.value); |
|
|
itemData.value = await request.get({ url: `/eam/basic-maintenance-option/get?id=` + item[i] }); |
|
|
} |
|
|
tags.value.push(itemData.value); |
|
|
|
|
|
} |
|
|
} finally { |
|
|
} finally { |
|
|
formLoading.value = false |
|
|
formLoading.value = false |
|
|
} |
|
|
} |
|
|
|
|
|
//添加保养项 |
|
|
let res = await request.get({url: `/eam/relation-maintenance-item-select-set/getList?selectId=` + row.selectId}) |
|
|
let res = await request.get({url: `/eam/relation-maintenance-option-item/getList?optionCode=` + row.code}) |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
formLoading.value = true; |
|
|
maintenanceItemData.value = []; |
|
|
for (const item of res) { |
|
|
formLoading.value = true; |
|
|
console.log(item) |
|
|
for (const item of res) { |
|
|
let res = await request.get({url: `/eam/basic/maintenance-item/get?id=` + item.itemCode}) |
|
|
const newItem = {}; |
|
|
const newItem = {}; |
|
|
newItem['id'] = item.id; |
|
|
newItem['name'] = res.name; |
|
|
newItem['itemCode'] = item.itemCode; |
|
|
newItem['content'] = res.content; |
|
|
newItem['itemName'] = item.itemName; |
|
|
newItem['equipmentParts'] = res.equipmentParts; |
|
|
newItem['isSelectd'] = item.isSelectd; |
|
|
maintenanceItemData.value.push(newItem); |
|
|
maintenanceItemData.value.push(newItem); |
|
|
} |
|
|
} |
|
|
} finally { |
|
|
} finally { |
|
|
formLoading.value = false; |
|
|
formLoading.value = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
// 新增时 |
|
|
// 新增时 |
|
|
else { |
|
|
else { |
|
@ -298,25 +317,28 @@ const submitForm = async () => { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let result = ''; |
|
|
//赋值 保养选择集ID |
|
|
for (var i = 0; i < tags.value.length; i++) { |
|
|
formData.value.selectId = tags.value[0].selectId |
|
|
result += tags.value[i].id + ','; |
|
|
|
|
|
} |
|
|
|
|
|
if(result.endsWith(',')){ |
|
|
|
|
|
result = result.substring(0,result.length -1) |
|
|
|
|
|
} |
|
|
|
|
|
formData.value.itemCode = result |
|
|
|
|
|
// 提交请求 |
|
|
// 提交请求 |
|
|
formLoading.value = true |
|
|
formLoading.value = true |
|
|
//formData.value.members = JSON.stringify(tags.value) |
|
|
//formData.value.members = JSON.stringify(tags.value) |
|
|
try { |
|
|
try { |
|
|
const data = formData.value as unknown as SelectSetApi.InspectionItemSelectSetVO |
|
|
|
|
|
if (formType.value === 'create') { |
|
|
if (formType.value === 'create') { |
|
|
await SelectSetApi.createInspectionItemSelectSet(data) |
|
|
for (var i = 0; i < maintenanceItemData.value.length; i++) { |
|
|
message.success(t('common.createSuccess')) |
|
|
maintenanceItemData.value[i].optionCode = formData.value.code |
|
|
|
|
|
} |
|
|
|
|
|
formData.value.optionItem = maintenanceItemData.value |
|
|
|
|
|
//新增保养方案 及 方案与项关系 |
|
|
|
|
|
await BasicMaintenanceOptionApi.createBasicMaintenanceOption(formData.value) |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
} else { |
|
|
} else { |
|
|
await SelectSetApi.updateInspectionItemSelectSet(data) |
|
|
for (var i = 0; i < maintenanceItemData.value.length; i++) { |
|
|
message.success(t('common.updateSuccess')) |
|
|
maintenanceItemData.value[i].optionCode = formData.value.code |
|
|
|
|
|
} |
|
|
|
|
|
formData.value.optionItem = maintenanceItemData.value |
|
|
|
|
|
console.log(formData.value) |
|
|
|
|
|
await BasicMaintenanceOptionApi.updateBasicMaintenanceOption(formData.value) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
} |
|
|
} |
|
|
dialogVisible.value = false |
|
|
dialogVisible.value = false |
|
|
// 发送操作成功的事件 |
|
|
// 发送操作成功的事件 |
|
|