From da9ff2aff9efb4f91a0352539d7d5a1de698faa5 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 17 Jan 2026 17:47:46 +0800
Subject: [PATCH] feat: 评价管理
---
applications/task-work-order/src/views/basicManage/maintainRecord/FormDiaLog.vue | 135 ++++----------------------------------------
1 files changed, 14 insertions(+), 121 deletions(-)
diff --git a/applications/task-work-order/src/views/basicManage/maintainRecord/FormDiaLog.vue b/applications/task-work-order/src/views/basicManage/maintainRecord/FormDiaLog.vue
index 9001d6a..1f086ea 100644
--- a/applications/task-work-order/src/views/basicManage/maintainRecord/FormDiaLog.vue
+++ b/applications/task-work-order/src/views/basicManage/maintainRecord/FormDiaLog.vue
@@ -1,7 +1,12 @@
<template>
- <el-dialog class="gd-dialog" v-model="visible" :title="titleEnum[dialogMode]" @closed="handleClosed" destroy-on-close>
+ <el-dialog
+ class="gd-dialog"
+ v-model="visible"
+ :title="titleEnum[dialogMode]"
+ @closed="visible = false"
+ destroy-on-close
+ >
<div class="detail-container" v-if="dialogReadonly">
- <div class="detail-title">设备详情</div>
<el-row>
<el-col :span="12">
<div class="label">设备名称</div>
@@ -44,29 +49,6 @@
<div class="val">{{ formData.manufacturer }}</div>
</el-col>
</el-row>
-
- <div class="detail-title">维护详情</div>
- <div class="gd-table-container" v-loading="loading">
- <div class="gd-table-content">
- <el-table class="gd-table" :data="list">
- <el-table-column type="index" width="60" label="序号" />
- <el-table-column prop="maintainTime" label="维护时间" />
- <el-table-column prop="maintainContent" label="维护内容" />
- <el-table-column prop="replacePart" label="跟换部件" />
- </el-table>
- </div>
-
- <div class="gd-pagination-parent">
- <el-pagination
- popper-class="gd-select-popper"
- v-model:current-page="searchParams.current"
- v-model:page-size="searchParams.size"
- layout="total, prev, pager, next, sizes"
- :total="total"
- @change="getList"
- />
- </div>
- </div>
</div>
<el-form
@@ -107,30 +89,10 @@
</el-select>
</el-form-item>
</el-col>
- <el-col :span="12">
- <el-form-item label="维护计划时间" prop="planCycleValue">
- <el-select
- class="gd-select"
- popper-class="gd-select-popper"
- v-model="formData.planCycleValue"
- placeholder="请选择"
- clearable
- multiple
- :disabled="!formData.planCycleType"
- >
- <el-option
- v-for="item in planCycleValueOptions"
- :key="item.value"
- :label="item.value"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
</el-row>
</el-form>
<template #footer>
- <el-button color="#F2F3F5" @click="handleCancel">{{ dialogReadonly ? '关闭' : '取消' }}</el-button>
+ <el-button color="#F2F3F5" @click="visible = false">{{ dialogReadonly ? '关闭' : '取消' }}</el-button>
<el-button
class="save-btn"
color="#4C34FF"
@@ -149,11 +111,9 @@
import { computed, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { fieldRules, getDictLabel } from '@ztzf/utils'
-import { fwDeviceMaintainRecordPageApi } from '@/views/basicManage/maintainRecord/fwDeviceMaintainRecord'
import {
fwDeviceMaintainPlanDetailApi,
fwDeviceMaintainPlanSubmitApi,
- fwDevicePageApi,
} from '@/views/basicManage/maintainRecord/maintainRecordApi'
const initForm = () => ({
@@ -163,41 +123,23 @@
})
const planCycleOptions = inject('planCycleOptions')
-const planCycleValueOptions = ref([])
const emit = defineEmits(['success'])
const formRef = ref(null) // 表单实例
const formData = ref(initForm()) // 表单数据
-const visible = ref(false) // 弹框显隐
+const visible = defineModel() // 弹框显隐
const dialogMode = ref('add') // 弹框模式
const submitting = ref(false) // 提交中
const deviceList = ref([]) // 设备列表
const getPlanCycleLabel = inject('getPlanCycleLabel')
const dictObj = inject('dictObj')
const dialogReadonly = computed(() => dialogMode.value === 'view')
-const titleEnum = ref({ edit: '编辑', view: '查看', add: '维护计划' })
-
-const planCycleLabel = computed(() => {
- const item = planCycleOptions.find(option => option.value === formData.value.planCycleType)
- return item?.label || formData.value.planCycleType || '-'
-})
+const titleEnum = ref({ edit: '编辑', view: '查看', add: '新增' })
const rules = {
deviceId: fieldRules(true),
planCycleType: fieldRules(true),
planCycleValue: [{ required: true, message: '请选择', trigger: ['blur', 'change'] }],
-}
-
-// 获取设备列表
-function getDeviceList() {
- return fwDevicePageApi({ current: 1, size: 999 }).then(res => {
- deviceList.value = res?.data?.data?.records ?? []
- })
-}
-
-// 关闭弹框
-function handleCancel() {
- visible.value = false
}
// 提交新增/编辑
@@ -220,70 +162,21 @@
if (!formData.value.id) return
const res = await fwDeviceMaintainPlanDetailApi({ id: formData.value.id })
formData.value = res?.data?.data ?? {}
- console.log(formData.value, 66)
-}
-
-// 关闭后重置
-function handleClosed() {
- formData.value = initForm()
}
const initSearchParams = () => ({
current: 1, // 当前页
size: 10, // 每页大小
})
-const searchParams = ref(initSearchParams())
-const total = ref(0) // 总条数
-const loading = ref(true) // 列表加载中
-const list = ref([]) // 列表数据
-async function getList() {
- loading.value = true
- try {
- const params = { ...searchParams.value, planId: formData.value.id }
- const res = await fwDeviceMaintainRecordPageApi(params)
- list.value = res?.data?.data?.records ?? []
- total.value = res?.data?.data?.total ?? 0
- } finally {
- loading.value = false
- }
-}
// 打开弹框
-async function open({ mode, row } = {}) {
- dialogMode.value = mode || 'add'
- visible.value = true
- await getDeviceList()
- if (dialogMode.value === 'add') {
- formData.value = initForm()
- } else {
- formData.value = row
+async function open({ mode = 'add', row } = {}) {
+ dialogMode.value = mode
+ formData.value = dialogMode.value === 'add' ? initForm() : row
+ if (dialogMode.value !== 'add') {
await loadDetail()
- getList()
}
}
defineExpose({ open })
-
-watch(
- () => formData.value?.planCycleType,
- type => {
- planCycleValueOptions.value = []
- if (!type) return
- if (type === '1') {
- ;[...Array(12)].forEach((item, index) => {
- ;[...Array(31)].forEach((item1, index1) => {
- planCycleValueOptions.value.push({ value: `${index + 1}月${index1 + 1}号` })
- })
- })
- } else if (type === '2') {
- ;[...Array(31)].forEach((item, index) => {
- planCycleValueOptions.value.push({ value: `${index + 1}号` })
- })
- } else if (type === '3') {
- ;[...Array(7)].forEach((item, index) => {
- planCycleValueOptions.value.push({ value: `星期${index + 1}` })
- })
- }
- }
-)
</script>
--
Gitblit v1.9.3