|
@@ -12,7 +12,7 @@
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="计划名称" prop="planTitle">
|
|
<el-form-item label="计划名称" prop="planTitle">
|
|
- <el-input v-model="formData.routeName" placeholder="请输入计划名称" />
|
|
|
|
|
|
+ <el-input v-model="formData.planTitle" placeholder="请输入计划名称" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
@@ -33,8 +33,12 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
- <el-form-item label="负责人" prop="charge">
|
|
|
|
- <el-select v-model="formData.charge" multiple filterable clearable style="width: 100%">
|
|
|
|
|
|
+ <el-form-item label="负责人" prop="charges">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="formData.charges"
|
|
|
|
+ multiple
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ >
|
|
<el-option
|
|
<el-option
|
|
v-for="item in deptUsers"
|
|
v-for="item in deptUsers"
|
|
:key="item.id"
|
|
:key="item.id"
|
|
@@ -133,19 +137,14 @@
|
|
import * as UserApi from '@/api/system/user'
|
|
import * as UserApi from '@/api/system/user'
|
|
import { useUserStore } from '@/store/modules/user'
|
|
import { useUserStore } from '@/store/modules/user'
|
|
import { ref } from 'vue'
|
|
import { ref } from 'vue'
|
|
-import { IotMaintainMaterialVO } from '@/api/pms/maintain/material'
|
|
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
|
-import { handleTree } from '@/utils/tree'
|
|
|
|
-import * as ProductClassifyApi from '@/api/pms/productclassify'
|
|
|
|
-import draggable from 'vuedraggable'
|
|
|
|
import InspectItemList from '@/views/pms/inspect/route/InspectItemList.vue'
|
|
import InspectItemList from '@/views/pms/inspect/route/InspectItemList.vue'
|
|
import InspectRouteList from '@/views/pms/inspect/plan/InspectRouteList.vue'
|
|
import InspectRouteList from '@/views/pms/inspect/plan/InspectRouteList.vue'
|
|
-import { IotInspectRouteApi, IotInspectRouteVO } from '@/api/pms/inspect/route'
|
|
|
|
|
|
+import { IotInspectRouteVO } from '@/api/pms/inspect/route'
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
-import {IotInspectPlanApi} from "@/api/pms/inspect/plan";
|
|
|
|
-import RouteInspectItemDrawer from "@/views/pms/inspect/plan/RouteInspectItemDrawer.vue";
|
|
|
|
-
|
|
|
|
|
|
+import { IotInspectPlanApi, IotInspectPlanVO } from '@/api/pms/inspect/plan'
|
|
|
|
+import RouteInspectItemDrawer from '@/views/pms/inspect/plan/RouteInspectItemDrawer.vue'
|
|
|
|
|
|
/** 维修工单 表单 */
|
|
/** 维修工单 表单 */
|
|
defineOptions({ name: 'IotMaintainAe' })
|
|
defineOptions({ name: 'IotMaintainAe' })
|
|
@@ -171,6 +170,7 @@ const formData = ref({
|
|
planCycle: undefined,
|
|
planCycle: undefined,
|
|
planUnit: undefined,
|
|
planUnit: undefined,
|
|
charge: undefined,
|
|
charge: undefined,
|
|
|
|
+ charges:[],
|
|
deviceIds: undefined,
|
|
deviceIds: undefined,
|
|
remark: undefined,
|
|
remark: undefined,
|
|
deptId: undefined
|
|
deptId: undefined
|
|
@@ -180,7 +180,7 @@ const formRules = reactive({
|
|
planCode: [{ required: true, message: '巡检计划编号不能为空', trigger: 'blur' }],
|
|
planCode: [{ required: true, message: '巡检计划编号不能为空', trigger: 'blur' }],
|
|
planCycle: [{ required: true, message: '周期不能为空', trigger: 'blur' }],
|
|
planCycle: [{ required: true, message: '周期不能为空', trigger: 'blur' }],
|
|
planUnit: [{ required: true, message: '单位不能为空', trigger: 'blur' }],
|
|
planUnit: [{ required: true, message: '单位不能为空', trigger: 'blur' }],
|
|
- charge: [{ required: true, message: '负责人不能为空', trigger: 'blur' }]
|
|
|
|
|
|
+ charges: [{ required: true, message: '负责人不能为空', trigger: 'blur' }]
|
|
})
|
|
})
|
|
// 拖动状态管理
|
|
// 拖动状态管理
|
|
const items = ref([])
|
|
const items = ref([])
|
|
@@ -209,20 +209,12 @@ const openForm = () => {
|
|
const close = () => {
|
|
const close = () => {
|
|
delView(unref(currentRoute))
|
|
delView(unref(currentRoute))
|
|
push({
|
|
push({
|
|
- name: 'IotInspectRoute',
|
|
|
|
|
|
+ name: 'IotInspectPlan',
|
|
query: {
|
|
query: {
|
|
date: new Date().getTime()
|
|
date: new Date().getTime()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-const itemsWithIndex = computed(() => {
|
|
|
|
- return items.value.map((item, index) => ({
|
|
|
|
- itemId: item.id,
|
|
|
|
- item: item.item,
|
|
|
|
- standard: item.standard,
|
|
|
|
- index: index + 1 // 序号从1开始
|
|
|
|
- }))
|
|
|
|
-})
|
|
|
|
const { wsCache } = useCache()
|
|
const { wsCache } = useCache()
|
|
/** 提交表单 */
|
|
/** 提交表单 */
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
@@ -232,18 +224,19 @@ const submitForm = async () => {
|
|
// 提交请求
|
|
// 提交请求
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
try {
|
|
try {
|
|
- const newitems = itemsWithIndex
|
|
|
|
- debugger
|
|
|
|
- formData.value.itemJson = JSON.stringify(newitems.value)
|
|
|
|
const user = wsCache.get(CACHE_KEY.USER)
|
|
const user = wsCache.get(CACHE_KEY.USER)
|
|
- formData.value.deptId = user.user.deptId
|
|
|
|
- const data = formData.value as unknown as IotInspectRouteVO
|
|
|
|
|
|
+ formData.value.deviceIds = JSON.stringify(list.value)
|
|
|
|
+ debugger
|
|
|
|
+ const data = formData.value as unknown as IotInspectPlanVO
|
|
if (formType.value === 'create') {
|
|
if (formType.value === 'create') {
|
|
- await IotInspectRouteApi.createIotInspectRoute(data)
|
|
|
|
|
|
+ formData.value.deptId = user.user.deptId
|
|
|
|
+ await IotInspectPlanApi.createIotInspectPlan(data)
|
|
message.success(t('common.createSuccess'))
|
|
message.success(t('common.createSuccess'))
|
|
close()
|
|
close()
|
|
} else {
|
|
} else {
|
|
- await IotInspectRouteApi.updateIotInspectRoute(data)
|
|
|
|
|
|
+ debugger
|
|
|
|
+ console.log(JSON.stringify(data.charges))
|
|
|
|
+ await IotInspectPlanApi.updateIotInspectPlan(data)
|
|
message.success(t('common.updateSuccess'))
|
|
message.success(t('common.updateSuccess'))
|
|
close()
|
|
close()
|
|
}
|
|
}
|
|
@@ -255,40 +248,16 @@ const submitForm = async () => {
|
|
}
|
|
}
|
|
|
|
|
|
/** 重置表单 */
|
|
/** 重置表单 */
|
|
-const resetForm = () => {
|
|
|
|
- formData.value = {
|
|
|
|
- id: undefined,
|
|
|
|
- failureCode: undefined,
|
|
|
|
- failureName: undefined,
|
|
|
|
- deviceId: undefined,
|
|
|
|
- status: undefined,
|
|
|
|
- ifStop: undefined,
|
|
|
|
- failureTime: undefined,
|
|
|
|
- failureInfluence: undefined,
|
|
|
|
- failureSystem: undefined,
|
|
|
|
- description: undefined,
|
|
|
|
- pic: undefined,
|
|
|
|
- solution: undefined,
|
|
|
|
- maintainStartTime: undefined,
|
|
|
|
- maintainEndTime: undefined,
|
|
|
|
- remark: undefined,
|
|
|
|
- deviceName: undefined,
|
|
|
|
- processInstanceId: undefined,
|
|
|
|
- auditStatus: undefined,
|
|
|
|
- deptId: undefined
|
|
|
|
- }
|
|
|
|
- formRef.value?.resetFields()
|
|
|
|
-}
|
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
const deptId = useUserStore().getUser.deptId
|
|
const deptId = useUserStore().getUser.deptId
|
|
deptUsers.value = await UserApi.getDeptUsersByDeptId(deptId)
|
|
deptUsers.value = await UserApi.getDeptUsersByDeptId(deptId)
|
|
if (id) {
|
|
if (id) {
|
|
formType.value = 'update'
|
|
formType.value = 'update'
|
|
- const iotInspectRoute = await IotInspectPlanApi.getIotInspectPlan(id)
|
|
|
|
- formData.value = iotInspectRoute
|
|
|
|
- items.value = JSON.parse(iotInspectRoute.itemJson)
|
|
|
|
|
|
+ const iotInspectPlan = await IotInspectPlanApi.getIotInspectPlan(id)
|
|
|
|
+ formData.value = iotInspectPlan
|
|
|
|
+ debugger
|
|
|
|
+ list.value = JSON.parse(iotInspectPlan.deviceIds)
|
|
} else {
|
|
} else {
|
|
- formData.value.type = 'in'
|
|
|
|
formType.value = 'create'
|
|
formType.value = 'create'
|
|
}
|
|
}
|
|
})
|
|
})
|