| | |
| | | <template> |
| | | <FormDialog |
| | | v-model="dialogVisitable" |
| | | :title="operationType === 'add' ? '新增保养任务' : '编辑保养任务'" |
| | | width="800px" |
| | | :operation-type="operationType" |
| | | @confirm="submitForm" |
| | | @cancel="cancel" |
| | | @close="cancel" |
| | | > |
| | | <el-form ref="formRef" :model="form" :rules="rules" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="任务名称" prop="taskName"> |
| | | <el-input v-model="form.taskName" placeholder="请输入任务名称" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设备名称" prop="deviceIds"> |
| | | <el-select |
| | | v-model="form.deviceIds" |
| | | multiple |
| | | filterable |
| | | placeholder="请选择设备" |
| | | @change="handleDeviceChange" |
| | | > |
| | | <el-option |
| | | v-for="(item, index) in deviceOptions" |
| | | :key="index" |
| | | :label="item.deviceName" |
| | | :value="item.id" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="录入人" prop="inspector"> |
| | | <el-select |
| | | v-model="form.inspector" |
| | | filterable |
| | | default-first-option |
| | | :reserve-keyword="false" |
| | | placeholder="请选择" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :label="item.nickName" |
| | | :value="item.userId" |
| | | :key="item.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="登记时间" prop="registrationDate"> |
| | | <el-date-picker |
| | | v-model="form.registrationDate" |
| | | type="date" |
| | | placeholder="选择登记日期" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="任务频率" prop="frequencyType"> |
| | | <el-select v-model="form.frequencyType" placeholder="请选择" clearable> |
| | | <el-option label="每日" value="DAILY"/> |
| | | <el-option label="每周" value="WEEKLY"/> |
| | | <el-option label="每月" value="MONTHLY"/> |
| | | <el-option label="季度" value="QUARTERLY"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" v-if="form.frequencyType === 'DAILY' && form.frequencyType"> |
| | | <el-form-item label="日期" prop="frequencyDetail"> |
| | | <el-time-picker v-model="form.frequencyDetail" placeholder="选择时间" format="HH:mm" |
| | | value-format="HH:mm" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" v-if="form.frequencyType === 'WEEKLY' && form.frequencyType"> |
| | | <el-form-item label="日期" prop="frequencyDetail"> |
| | | <el-select v-model="form.week" placeholder="请选择" clearable style="width: 50%"> |
| | | <el-option label="周一" value="MON"/> |
| | | <el-option label="周二" value="TUE"/> |
| | | <el-option label="周三" value="WED"/> |
| | | <el-option label="周四" value="THU"/> |
| | | <el-option label="周五" value="FRI"/> |
| | | <el-option label="周六" value="SAT"/> |
| | | <el-option label="周日" value="SUN"/> |
| | | </el-select> |
| | | <el-time-picker v-model="form.time" placeholder="选择时间" format="HH:mm" |
| | | value-format="HH:mm" style="width: 50%"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" v-if="form.frequencyType === 'MONTHLY' && form.frequencyType"> |
| | | <el-form-item label="日期" prop="frequencyDetail"> |
| | | <el-date-picker |
| | | v-model="form.frequencyDetail" |
| | | type="datetime" |
| | | clearable |
| | | placeholder="选择开始日期" |
| | | format="DD,HH:mm" |
| | | value-format="DD,HH:mm" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" v-if="form.frequencyType === 'QUARTERLY' && form.frequencyType"> |
| | | <el-form-item label="日期" prop="frequencyDetail"> |
| | | <el-date-picker |
| | | v-model="form.frequencyDetail" |
| | | type="datetime" |
| | | clearable |
| | | placeholder="选择开始日期" |
| | | format="MM,DD,HH:mm" |
| | | value-format="MM,DD,HH:mm" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="备注" prop="remarks"> |
| | | <el-input v-model="form.remarks" placeholder="请输入备注" type="textarea" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </FormDialog> |
| | | <FormDialog |
| | | v-model="dialogVisitable" |
| | | :title="operationType === 'add' ? '新增保养任务' : '编辑保养任务'" |
| | | width="800px" |
| | | :operation-type="operationType" |
| | | @confirm="submitForm" |
| | | @cancel="cancel" |
| | | @close="cancel" |
| | | > |
| | | <el-form ref="formRef" :model="form" :rules="rules" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="任务名称" prop="taskName"> |
| | | <el-input |
| | | v-model="form.taskName" |
| | | placeholder="请输入任务名称" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设备名称" prop="deviceIds"> |
| | | <el-select |
| | | v-model="form.deviceIds" |
| | | multiple |
| | | filterable |
| | | placeholder="请选择设备" |
| | | @change="handleDeviceChange" |
| | | > |
| | | <el-option |
| | | v-for="(item, index) in deviceOptions" |
| | | :key="index" |
| | | :label="item.deviceName" |
| | | :value="item.id" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="录入人" prop="inspector"> |
| | | <el-select |
| | | v-model="form.inspector" |
| | | filterable |
| | | default-first-option |
| | | :reserve-keyword="false" |
| | | placeholder="请选择" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :label="item.nickName" |
| | | :value="item.userId" |
| | | :key="item.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="登记时间" prop="registrationDate"> |
| | | <el-date-picker |
| | | v-model="form.registrationDate" |
| | | type="date" |
| | | placeholder="选择登记日期" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="任务频率" prop="frequencyType"> |
| | | <el-select |
| | | v-model="form.frequencyType" |
| | | placeholder="请选择" |
| | | clearable |
| | | > |
| | | <el-option label="每日" value="DAILY" /> |
| | | <el-option label="每周" value="WEEKLY" /> |
| | | <el-option label="每月" value="MONTHLY" /> |
| | | <el-option label="季度" value="QUARTERLY" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col |
| | | :span="12" |
| | | v-if="form.frequencyType === 'DAILY' && form.frequencyType" |
| | | > |
| | | <el-form-item label="日期/时间" prop="frequencyDetail"> |
| | | <el-time-picker |
| | | v-model="form.frequencyDetail" |
| | | placeholder="选择时间" |
| | | format="HH:mm" |
| | | value-format="HH:mm" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col |
| | | :span="12" |
| | | v-if="form.frequencyType === 'WEEKLY' && form.frequencyType" |
| | | > |
| | | <el-form-item label="日期/时间" prop="frequencyDetail"> |
| | | <el-select |
| | | v-model="form.week" |
| | | placeholder="请选择" |
| | | clearable |
| | | style="width: 50%" |
| | | > |
| | | <el-option label="周一" value="MON" /> |
| | | <el-option label="周二" value="TUE" /> |
| | | <el-option label="周三" value="WED" /> |
| | | <el-option label="周四" value="THU" /> |
| | | <el-option label="周五" value="FRI" /> |
| | | <el-option label="周六" value="SAT" /> |
| | | <el-option label="周日" value="SUN" /> |
| | | </el-select> |
| | | <el-time-picker |
| | | v-model="form.time" |
| | | placeholder="选择时间" |
| | | format="HH:mm" |
| | | value-format="HH:mm" |
| | | style="width: 50%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col |
| | | :span="12" |
| | | v-if="form.frequencyType === 'MONTHLY' && form.frequencyType" |
| | | > |
| | | <el-form-item label="日期/时间" prop="frequencyDetail"> |
| | | <el-date-picker |
| | | v-model="form.frequencyDetail" |
| | | type="datetime" |
| | | clearable |
| | | placeholder="选择开始日期" |
| | | format="DD,HH:mm" |
| | | value-format="DD,HH:mm" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col |
| | | :span="12" |
| | | v-if="form.frequencyType === 'QUARTERLY' && form.frequencyType" |
| | | > |
| | | <el-form-item label="日期/时间" prop="frequencyDetail"> |
| | | <el-date-picker |
| | | v-model="form.frequencyDetail" |
| | | type="datetime" |
| | | clearable |
| | | placeholder="选择开始日期" |
| | | format="MM,DD,HH:mm" |
| | | value-format="MM,DD,HH:mm" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="备注" prop="remarks"> |
| | | <el-input |
| | | v-model="form.remarks" |
| | | placeholder="请输入备注" |
| | | type="textarea" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </FormDialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import FormDialog from "@/components/Dialog/FormDialog.vue"; |
| | | import { reactive, ref, getCurrentInstance, toRefs } from "vue"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { getDeviceLedger } from "@/api/equipmentManagement/ledger"; |
| | | import { deviceMaintenanceTaskAdd, deviceMaintenanceTaskEdit } from "@/api/equipmentManagement/upkeep"; |
| | | import { |
| | | deviceMaintenanceTaskAdd, |
| | | deviceMaintenanceTaskEdit, |
| | | } from "@/api/equipmentManagement/upkeep"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits() |
| | | const { proxy } = getCurrentInstance(); |
| | | const emit = defineEmits(); |
| | | const dialogVisitable = ref(false); |
| | | const operationType = ref('add'); |
| | | const operationType = ref("add"); |
| | | const deviceOptions = ref([]); |
| | | const userStore = useUserStore(); |
| | | const data = reactive({ |
| | | form: { |
| | | taskId: undefined, |
| | | deviceIds: [], |
| | | taskName: "", |
| | | // 录入人:单选一个用户 id |
| | | inspector: undefined, |
| | | remarks: '', |
| | | frequencyType: '', |
| | | frequencyDetail: '', |
| | | week: '', |
| | | time: '', |
| | | deviceModel: undefined, // 规格型号 |
| | | registrationDate: '' |
| | | }, |
| | | rules: { |
| | | deviceIds: [{ required: true, message: "请选择设备", trigger: "change" }], |
| | | taskName: [{ required: true, message: "请输入任务名称", trigger: "blur" }], |
| | | inspector: [{ required: true, message: "请选择录入人", trigger: "blur" },], |
| | | registrationDate: [{ required: true, message: "请选择登记时间", trigger: "change" }] |
| | | } |
| | | }) |
| | | const { form, rules } = toRefs(data) |
| | | const userList = ref([]) |
| | | form: { |
| | | taskId: undefined, |
| | | deviceIds: [], |
| | | taskName: "", |
| | | // 录入人:单选一个用户 id |
| | | inspector: undefined, |
| | | remarks: "", |
| | | frequencyType: "", |
| | | frequencyDetail: "", |
| | | week: "", |
| | | time: "", |
| | | deviceModel: undefined, // 规格型号 |
| | | registrationDate: "", |
| | | }, |
| | | rules: { |
| | | deviceIds: [{ required: true, message: "请选择设备", trigger: "change" }], |
| | | taskName: [{ required: true, message: "请输入任务名称", trigger: "blur" }], |
| | | inspector: [{ required: true, message: "请选择录入人", trigger: "blur" }], |
| | | registrationDate: [ |
| | | { required: true, message: "请选择登记时间", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | const userList = ref([]); |
| | | |
| | | const loadDeviceName = async () => { |
| | | const { data } = await getDeviceLedger(); |
| | | deviceOptions.value = data; |
| | | const { data } = await getDeviceLedger(); |
| | | deviceOptions.value = data; |
| | | }; |
| | | |
| | | const normalizeIdList = (val) => { |
| | | if (!val) return [] |
| | | if (Array.isArray(val)) return val |
| | | if (typeof val === 'string') { |
| | | const s = val.trim() |
| | | // JSON 字符串:"[1,2,3]" |
| | | if (s.startsWith('[') && s.endsWith(']')) { |
| | | try { |
| | | const arr = JSON.parse(s) |
| | | return Array.isArray(arr) ? arr : [] |
| | | } catch { |
| | | return [] |
| | | } |
| | | } |
| | | // 逗号分隔:"1,2,3" |
| | | return s.split(',').map(v => v.trim()).filter(Boolean) |
| | | } |
| | | return [] |
| | | } |
| | | if (!val) return []; |
| | | if (Array.isArray(val)) return val; |
| | | if (typeof val === "string") { |
| | | const s = val.trim(); |
| | | // JSON 字符串:"[1,2,3]" |
| | | if (s.startsWith("[") && s.endsWith("]")) { |
| | | try { |
| | | const arr = JSON.parse(s); |
| | | return Array.isArray(arr) ? arr : []; |
| | | } catch { |
| | | return []; |
| | | } |
| | | } |
| | | // 逗号分隔:"1,2,3" |
| | | return s |
| | | .split(",") |
| | | .map((v) => v.trim()) |
| | | .filter(Boolean); |
| | | } |
| | | return []; |
| | | }; |
| | | |
| | | // 选择设备时,顺带回填规格型号(多选时取第一个设备的规格型号) |
| | | const handleDeviceChange = () => { |
| | | const selectedIds = form.value.deviceIds || [] |
| | | const firstId = Array.isArray(selectedIds) ? selectedIds[0] : undefined |
| | | const firstDevice = deviceOptions.value.find(d => String(d.id) === String(firstId)) |
| | | form.value.deviceModel = firstDevice?.deviceModel || firstDevice?.model || form.value.deviceModel |
| | | } |
| | | const selectedIds = form.value.deviceIds || []; |
| | | const firstId = Array.isArray(selectedIds) ? selectedIds[0] : undefined; |
| | | const firstDevice = deviceOptions.value.find( |
| | | (d) => String(d.id) === String(firstId) |
| | | ); |
| | | form.value.deviceModel = |
| | | firstDevice?.deviceModel || firstDevice?.model || form.value.deviceModel; |
| | | }; |
| | | |
| | | // 打开弹框 |
| | | const openDialog = async (type, row) => { |
| | | dialogVisitable.value = true |
| | | operationType.value = type |
| | | |
| | | // 重置表单 |
| | | resetForm(); |
| | | |
| | | // 加载用户列表 |
| | | userListNoPageByTenantId().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | |
| | | // 加载设备列表 |
| | | await loadDeviceName(); |
| | | |
| | | if (type === 'edit' && row) { |
| | | form.value = { ...form.value, ...row } |
| | | // 编辑时用接口返回的 registrantId 回显录入人 |
| | | if (row.registrantId) { |
| | | form.value.inspector = row.registrantId |
| | | } |
| | | dialogVisitable.value = true; |
| | | operationType.value = type; |
| | | |
| | | // 编辑回显:deviceIds 可能是 JSON 字符串 / 逗号分隔 / 数组 |
| | | const ids = normalizeIdList(row.deviceIds ?? row.taskIds) |
| | | form.value.deviceIds = ids.map(v => { |
| | | const n = Number(v) |
| | | return Number.isNaN(n) ? v : n |
| | | }) |
| | | handleDeviceChange() |
| | | } else if (type === 'add') { |
| | | // 新增时设置登记日期为当天 |
| | | form.value.registrationDate = getCurrentDate(); |
| | | // 新增时设置录入人为当前登录账户 |
| | | form.value.inspector = userStore.id; |
| | | } |
| | | } |
| | | // 重置表单 |
| | | resetForm(); |
| | | |
| | | // 加载用户列表 |
| | | userListNoPageByTenantId().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | |
| | | // 加载设备列表 |
| | | await loadDeviceName(); |
| | | |
| | | if (type === "edit" && row) { |
| | | form.value = { ...form.value, ...row }; |
| | | // 编辑时用接口返回的 registrantId 回显录入人 |
| | | if (row.registrantId) { |
| | | form.value.inspector = row.registrantId; |
| | | } |
| | | |
| | | // 编辑回显:deviceIds 可能是 JSON 字符串 / 逗号分隔 / 数组 |
| | | const ids = normalizeIdList(row.deviceIds ?? row.taskIds); |
| | | form.value.deviceIds = ids.map((v) => { |
| | | const n = Number(v); |
| | | return Number.isNaN(n) ? v : n; |
| | | }); |
| | | handleDeviceChange(); |
| | | } else if (type === "add") { |
| | | // 新增时设置登记日期为当天 |
| | | form.value.registrationDate = getCurrentDate(); |
| | | // 新增时设置录入人为当前登录账户 |
| | | form.value.inspector = userStore.id; |
| | | } |
| | | }; |
| | | |
| | | // 关闭对话框 |
| | | const cancel = () => { |
| | | resetForm() |
| | | dialogVisitable.value = false |
| | | emit('closeDia') |
| | | } |
| | | resetForm(); |
| | | dialogVisitable.value = false; |
| | | emit("closeDia"); |
| | | }; |
| | | |
| | | // 重置表单函数 |
| | | const resetForm = () => { |
| | | if (proxy.$refs.formRef) { |
| | | proxy.$refs.formRef.resetFields() |
| | | } |
| | | // 重置表单数据确保设备信息正确重置 |
| | | form.value = { |
| | | taskId: undefined, |
| | | deviceIds: [], |
| | | taskName: "", |
| | | inspector: undefined, |
| | | remarks: '', |
| | | frequencyType: '', |
| | | frequencyDetail: '', |
| | | week: '', |
| | | time: '', |
| | | deviceModel: undefined, |
| | | registrationDate: '' |
| | | } |
| | | } |
| | | if (proxy.$refs.formRef) { |
| | | proxy.$refs.formRef.resetFields(); |
| | | } |
| | | // 重置表单数据确保设备信息正确重置 |
| | | form.value = { |
| | | taskId: undefined, |
| | | deviceIds: [], |
| | | taskName: "", |
| | | inspector: undefined, |
| | | remarks: "", |
| | | frequencyType: "", |
| | | frequencyDetail: "", |
| | | week: "", |
| | | time: "", |
| | | deviceModel: undefined, |
| | | registrationDate: "", |
| | | }; |
| | | }; |
| | | |
| | | // 提交表单 |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(async valid => { |
| | | if (valid) { |
| | | try { |
| | | const payload = { ...form.value } |
| | | // 后端要求:deviceIds 以 JSON.stringify([1,2,3]) 形式传参 |
| | | payload.deviceIds = JSON.stringify(form.value.deviceIds || []) |
| | | // 不再向后端传保养人字段,仅使用接口要求的 registrant / registrantId |
| | | // 根据选择的"录入人"设置 registrant / registrantId |
| | | if (payload.inspector) { |
| | | const selectedUser = userList.value.find( |
| | | (u) => String(u.userId) === String(payload.inspector) |
| | | ) |
| | | if (selectedUser) { |
| | | payload.registrantId = selectedUser.userId |
| | | payload.registrant = selectedUser.nickName |
| | | } |
| | | } |
| | | delete payload.inspector |
| | | delete payload.inspectorIds |
| | | delete payload.taskIds |
| | | |
| | | if (payload.frequencyType === 'WEEKLY') { |
| | | let frequencyDetail = '' |
| | | frequencyDetail = payload.week + ',' + payload.time |
| | | payload.frequencyDetail = frequencyDetail |
| | | } |
| | | |
| | | // 录入日期:直接使用表单里的 registrationDate 字段 |
| | | // 一些默认状态字段 |
| | | if (payload.status === undefined || payload.status === null || payload.status === '') { |
| | | payload.status = '0' // 默认状态,可按实际枚举调整 |
| | | } |
| | | payload.active = true |
| | | payload.deleted = 0 |
| | | |
| | | if (operationType.value === 'edit') { |
| | | await deviceMaintenanceTaskEdit(payload) |
| | | } else { |
| | | await deviceMaintenanceTaskAdd(payload) |
| | | } |
| | | cancel() |
| | | proxy.$modal.msgSuccess('提交成功') |
| | | } catch (error) { |
| | | proxy.$modal.msgError('提交失败,请重试') |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | defineExpose({ openDialog }) |
| | | proxy.$refs["formRef"].validate(async (valid) => { |
| | | if (valid) { |
| | | try { |
| | | const payload = { ...form.value }; |
| | | // 后端要求:deviceIds 以 JSON.stringify([1,2,3]) 形式传参 |
| | | payload.deviceIds = JSON.stringify(form.value.deviceIds || []); |
| | | // 不再向后端传保养人字段,仅使用接口要求的 registrant / registrantId |
| | | // 根据选择的"录入人"设置 registrant / registrantId |
| | | if (payload.inspector) { |
| | | const selectedUser = userList.value.find( |
| | | (u) => String(u.userId) === String(payload.inspector) |
| | | ); |
| | | if (selectedUser) { |
| | | payload.registrantId = selectedUser.userId; |
| | | payload.registrant = selectedUser.nickName; |
| | | } |
| | | } |
| | | delete payload.inspector; |
| | | delete payload.inspectorIds; |
| | | delete payload.taskIds; |
| | | |
| | | if (payload.frequencyType === "WEEKLY") { |
| | | let frequencyDetail = ""; |
| | | frequencyDetail = payload.week + "," + payload.time; |
| | | payload.frequencyDetail = frequencyDetail; |
| | | } |
| | | |
| | | // 录入日期:直接使用表单里的 registrationDate 字段 |
| | | // 一些默认状态字段 |
| | | if ( |
| | | payload.status === undefined || |
| | | payload.status === null || |
| | | payload.status === "" |
| | | ) { |
| | | payload.status = "0"; // 默认状态,可按实际枚举调整 |
| | | } |
| | | payload.active = true; |
| | | payload.deleted = 0; |
| | | |
| | | if (operationType.value === "edit") { |
| | | await deviceMaintenanceTaskEdit(payload); |
| | | } else { |
| | | await deviceMaintenanceTaskAdd(payload); |
| | | } |
| | | cancel(); |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | } catch (error) { |
| | | proxy.$modal.msgError("提交失败,请重试"); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | defineExpose({ openDialog }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | | <style scoped></style> |