|
|
@@ -0,0 +1,784 @@
|
|
|
+<template>
|
|
|
+ <el-row :gutter="20" class="standard-class-list">
|
|
|
+ <div class="left-tree">
|
|
|
+ <el-tree
|
|
|
+ :data="getPressureEquipmentCategory"
|
|
|
+ node-key="value"
|
|
|
+ default-expand-all
|
|
|
+ :highlight-current="false"
|
|
|
+ :expand-on-click-node="false"
|
|
|
+ :icon="''"
|
|
|
+ :draggable="true"
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ >
|
|
|
+ <template #default="{ data }">
|
|
|
+ <div class="class-content">
|
|
|
+ <el-icon size="16" color="#015293">
|
|
|
+ <Management/>
|
|
|
+ </el-icon>
|
|
|
+ <span
|
|
|
+ class="custom-tree-node"
|
|
|
+ >
|
|
|
+ {{ data.label }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ <div class="right-table">
|
|
|
+ <SmartTable
|
|
|
+ ref="inspectionNatureTableRef"
|
|
|
+ v-model:columns="columns"
|
|
|
+ v-model:pageNo="pageNo"
|
|
|
+ v-model:pageSize="pageSize"
|
|
|
+ v-model:formData="inspectionNatureListSearchForm"
|
|
|
+ :data="inspectionNatureList"
|
|
|
+ :buttons="buttons"
|
|
|
+ :total="total"
|
|
|
+ @on-page-no-change="fetchInspectionNatureList"
|
|
|
+ @on-page-size-change="fetchInspectionNatureList"
|
|
|
+ @on-reset="fetchInspectionNatureList"
|
|
|
+ @on-search="fetchInspectionNatureList"
|
|
|
+ @refresh="fetchInspectionNatureList"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+ <CustomDialog
|
|
|
+ v-model="inspectionNatureCreateOrEditDialog"
|
|
|
+ :title="(editType === 'edit' ? '编辑' : '添加') + '检验性质'"
|
|
|
+ width="1200px"
|
|
|
+ :showFooter="false"
|
|
|
+ @cancel="handleInspectionNatureDialogClose"
|
|
|
+ >
|
|
|
+ <el-form ref="inspectionNatureFormRef" :model="inspectionNatureForm"
|
|
|
+ :rules="inspectionNatureFormRules" style="width: 400px;" width="400px"
|
|
|
+ label-width="110px">
|
|
|
+ <el-form-item label="检验性质" prop="inspectionNature">
|
|
|
+ <el-select v-model="inspectionNatureForm.inspectionNature" placeholder="请选择检验性质">
|
|
|
+ <el-option
|
|
|
+ v-for="item in getPressureInspectionNature"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属设备" prop="equipmentCategory">
|
|
|
+ <el-select v-model="inspectionNatureForm.equipmentCategory" placeholder="请选择所属设备"
|
|
|
+ @change="handleEquipmentCategoryChange">
|
|
|
+ <el-option
|
|
|
+ v-for="item in getPressureEquipmentCategory[0].children"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备类型" prop="equipmentType">
|
|
|
+ <el-select v-model="inspectionNatureForm.equipmentType" placeholder="请选择设备类型">
|
|
|
+ <el-option
|
|
|
+ v-for="item in getPressureEquipContainerType"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="关联报告模板" prop="templateSaveReqVOList">
|
|
|
+ <!-- <el-select readonly placeholder="请选择关联报告模板" @click.stop.prevent="handleShowReportList"/> -->
|
|
|
+ <el-select
|
|
|
+ :model-value="getTemplateNames"
|
|
|
+ clearable
|
|
|
+ multiple
|
|
|
+ @remove-tag="handleRemoveTag"
|
|
|
+ @click.stop.prevent="() => handleShowReportList()"
|
|
|
+ @clear="handleClearSelectedItem"
|
|
|
+ placeholder="请选择关联报告模板"
|
|
|
+ />
|
|
|
+ <!-- <div class="custom-select" @click.stop.prevent="handleShowReportList">
|
|
|
+ <el-input readonly placeholder="请选择关联报告模板"/>
|
|
|
+ <el-icon size="14"><ArrowDown /></el-icon>
|
|
|
+ </div> -->
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-table :data="inspectionNatureForm.templateSaveReqVOList">
|
|
|
+ <el-table-column label="检验项目名称" prop="name"/>
|
|
|
+ <el-table-column label="是否默认" prop="isDefault">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-switch v-model="scope.row.isDefault" active-value="1" inactive-value="0"
|
|
|
+ style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- 电站锅炉内检时显示部件选择 -->
|
|
|
+ <el-table-column label="部件" prop="part" v-if="isPowerStationBoiler">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.part"
|
|
|
+ multiple
|
|
|
+ placeholder="请选择部件"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in getPressureBoilerPartType"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button link type="primary" @click="() => handleDeleteReport(scope.row, scope.$index)">
|
|
|
+ 解除关联
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div style="display: flex; justify-content: center; padding-top: 24px;">
|
|
|
+ <el-button type="default" @click="handleInspectionNatureDialogClose">取消</el-button>
|
|
|
+ <el-button type="primary" @click="handleInspectionNatureSubmit">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </CustomDialog>
|
|
|
+ <CustomDialog
|
|
|
+ v-model="reportTemplateDialog"
|
|
|
+ title="报告模板列表"
|
|
|
+ width="1200px"
|
|
|
+ @confirm="handleReportTemplateConfirm"
|
|
|
+ >
|
|
|
+ <SmartTable
|
|
|
+ ref="reportTemplateTableRef"
|
|
|
+ v-model:columns="reportColumns"
|
|
|
+ v-model:pageNo="reportPageNo"
|
|
|
+ v-model:pageSize="reportPageSize"
|
|
|
+ v-model:formData="reportTemplateListSearchForm"
|
|
|
+ :data="reportTemplateList"
|
|
|
+ :total="reportTotal"
|
|
|
+ :refresh="false"
|
|
|
+ @on-page-no-change="fetchReportTemplateList"
|
|
|
+ @on-page-size-change="fetchReportTemplateList"
|
|
|
+ @on-reset="fetchReportTemplateList"
|
|
|
+ @on-search="fetchReportTemplateList"
|
|
|
+ @refresh="fetchReportTemplateList"
|
|
|
+ :tableProps="{
|
|
|
+ height: 500,
|
|
|
+ onSelect: handSelectionChange
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </CustomDialog>
|
|
|
+ <CustomDialog
|
|
|
+ v-model="reportTemplateDialog_Boiler"
|
|
|
+ title="报告模板列表"
|
|
|
+ width="1200px"
|
|
|
+ @confirm="handleReportTemplateConfirm"
|
|
|
+ >
|
|
|
+ <SmartTable
|
|
|
+ ref="reportTemplateTableRef"
|
|
|
+ v-model:columns="reportColumns"
|
|
|
+ v-model:pageNo="reportPageNo"
|
|
|
+ v-model:pageSize="reportPageSize"
|
|
|
+ v-model:formData="reportTemplateListSearchForm"
|
|
|
+ :data="reportTemplateList"
|
|
|
+ :total="reportTotal"
|
|
|
+ :refresh="false"
|
|
|
+ @on-page-no-change="fetchReportTemplateList_Boiler"
|
|
|
+ @on-page-size-change="fetchReportTemplateList_Boiler"
|
|
|
+ @on-reset="fetchReportTemplateList_Boiler"
|
|
|
+ @on-search="fetchReportTemplateList_Boiler"
|
|
|
+ @refresh="fetchReportTemplateList_Boiler"
|
|
|
+ :tableProps="{
|
|
|
+ height: 500,
|
|
|
+ onSelect: handSelectionChange
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </CustomDialog>
|
|
|
+</template>
|
|
|
+<script lang="tsx" setup>
|
|
|
+import {DynamicTbApi} from "@/api/pressure2/dynamictb";
|
|
|
+
|
|
|
+const SmartTable = defineAsyncComponent(() => import('@/components/SmartTable/SmartTable'))
|
|
|
+const CustomDialog = defineAsyncComponent(() => import('@/components/CustomDialog/index.vue'))
|
|
|
+
|
|
|
+import {Management, MoreFilled, Plus, ArrowDown} from '@element-plus/icons-vue'
|
|
|
+import {useDictStore} from '@/store/modules/dict'
|
|
|
+import dayjs from 'dayjs'
|
|
|
+import {
|
|
|
+ getPressureInspectionNatureList,
|
|
|
+ createPressureInspectionNature,
|
|
|
+ updatePressureInspectionNature,
|
|
|
+ deletePressureInspectionNature,
|
|
|
+ getPressureInspectionNatureInfo
|
|
|
+} from '@/api/pressure/inspectionNature/index'
|
|
|
+import {getPressureReportTemplateListNoLimit} from '@/api/pressure/reportTemplate/index'
|
|
|
+import {has} from 'lodash'
|
|
|
+import {updatePressure2InspectionNature} from "@/api/pressure2/inspectionNature";
|
|
|
+
|
|
|
+const dictStore = useDictStore()
|
|
|
+// 检验性质字典
|
|
|
+const getPressureInspectionNatureType = ref({
|
|
|
+ '100': computed(() => dictStore.getDictMap['pressure_inspection_nature']),
|
|
|
+ '200': computed(() => dictStore.getDictMap['pressure_inspection_nature']), //管道
|
|
|
+ '300': computed(() => dictStore.getDictMap['pressure_inspection_nature_boiler']) //锅炉
|
|
|
+})
|
|
|
+
|
|
|
+let getPressureInspectionNature = computed(() => dictStore.getDictMap['pressure_inspection_nature'])
|
|
|
+// 所属设备
|
|
|
+const getPressureEquipmentCategory = computed(() => [{
|
|
|
+ value: '-1', label: '全部设备', children: [
|
|
|
+ {label: '锅炉', value: '300'}, {
|
|
|
+ label: '管道', value: '200'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+}])
|
|
|
+
|
|
|
+// 设备类型字典
|
|
|
+const getPressureEquipType = ref({
|
|
|
+ '100': computed(() => dictStore.getDictMap['system_equip_container_type']),
|
|
|
+ '200': computed(() => dictStore.getDictMap['system_equip_pipe_type']), //管道
|
|
|
+ '300': computed(() => dictStore.getDictMap['system_equip_boiler_type']) //锅炉
|
|
|
+})
|
|
|
+let getPressureEquipContainerType = computed(() => dictStore.getDictMap['system_equip_container_type'])
|
|
|
+
|
|
|
+// 报告类型
|
|
|
+const getPressureReportTemplateType = computed(() => dictStore.getDictMap['pressure_report_template_type'])
|
|
|
+
|
|
|
+// 锅炉检验部件类型字典
|
|
|
+const getPressureBoilerPartType = computed(() => dictStore.getDictMap['pressure2_boiler_part_type'])
|
|
|
+
|
|
|
+const inspectionNatureTableRef = ref()
|
|
|
+const inspectionNatureList = ref([])
|
|
|
+const pageNo = ref(1)
|
|
|
+const pageSize = ref(10)
|
|
|
+const total = ref(0)
|
|
|
+const inspectionNatureListSearchForm = ref({})
|
|
|
+const getTemplateNames = computed(() => inspectionNatureForm.value.templateSaveReqVOList.map(x => x.name))
|
|
|
+
|
|
|
+const columns = ref([
|
|
|
+ {
|
|
|
+ type: 'selection',
|
|
|
+ width: 50,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '检验性质',
|
|
|
+ prop: 'inspectionNature',
|
|
|
+ search: {
|
|
|
+ type: 'select',
|
|
|
+ options: getPressureInspectionNature.value
|
|
|
+ },
|
|
|
+ render: (row, value) => getPressureInspectionNatureType.value[row.equipmentCategory].find(x => x.value === value)?.label || '-'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '所属设备',
|
|
|
+ prop: 'equipmentCategory',
|
|
|
+ render: (row, value) => getPressureEquipmentCategory.value[0].children.find(x => x.value === value)?.label || '-'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '设备类型',
|
|
|
+ prop: 'equipmentType',
|
|
|
+ render: (row, value) => getPressureEquipType.value[row.equipmentCategory].find(x => x.value === value)?.label || '-'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '默认报告模板数',
|
|
|
+ prop: 'defaultTemplateCount'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '关联报告模板数',
|
|
|
+ prop: 'templateCount',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '最近修改人',
|
|
|
+ prop: 'updaterName'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '最近修改时间',
|
|
|
+ prop: 'updateTime',
|
|
|
+ render: (row, value) => !value ? '' : dayjs(value).format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '操作',
|
|
|
+ render: (row) => <el-button link type="primary"
|
|
|
+ onClick={() => handleCreateOrEditInspectionNature(row)}>编辑</el-button>
|
|
|
+ }
|
|
|
+])
|
|
|
+
|
|
|
+const buttons = ref([
|
|
|
+ {
|
|
|
+ label: '新增',
|
|
|
+ render: () => <el-button type="primary"
|
|
|
+ onClick={() => handleCreateOrEditInspectionNature()}>新增</el-button>
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '删除',
|
|
|
+ render: () => <el-button type="danger"
|
|
|
+ onClick={() => handleDeleteInspectionNature()}>删除</el-button>
|
|
|
+ }
|
|
|
+])
|
|
|
+
|
|
|
+// 获取检验性质列表
|
|
|
+const fetchInspectionNatureList = async (equipmentCategory?: string) => {
|
|
|
+ const params = {
|
|
|
+ pageNo: pageNo.value,
|
|
|
+ pageSize: pageSize.value,
|
|
|
+ equipmentCategory,
|
|
|
+ ...inspectionNatureListSearchForm.value
|
|
|
+ }
|
|
|
+ const result = await getPressureInspectionNatureList(params)
|
|
|
+ if (result) {
|
|
|
+ inspectionNatureList.value = result.list
|
|
|
+ total.value = result.total
|
|
|
+ }
|
|
|
+}
|
|
|
+fetchInspectionNatureList()
|
|
|
+
|
|
|
+// 设备类型查询
|
|
|
+const handleNodeClick = (data) => {
|
|
|
+ const equipmentCategory = data.value === '-1' ? null : data.value
|
|
|
+ fetchInspectionNatureList(equipmentCategory)
|
|
|
+}
|
|
|
+
|
|
|
+// 编辑 & 新增 检验性质按钮
|
|
|
+const handleCreateOrEditInspectionNature = async (row?: any) => {
|
|
|
+ if (row) {
|
|
|
+ editInspectionNatureId.value = row.id
|
|
|
+ editType.value = 'edit'
|
|
|
+ let detailInfo = [];
|
|
|
+
|
|
|
+ // 判断是否为锅炉或管道(需要特殊处理)
|
|
|
+ if (row.equipmentCategory == 200 || row.equipmentCategory == 300) {
|
|
|
+ getPressureInspectionNature = getPressureInspectionNatureType.value[row.equipmentCategory]
|
|
|
+ getPressureEquipContainerType = getPressureEquipType.value[row.equipmentCategory]
|
|
|
+ inspectionNatureCreateOrEditDialog.value = true
|
|
|
+ await loadDetailInfo(row.id)
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ detailInfo = await getPressureInspectionNatureInfo({id: row.id})
|
|
|
+ getPressureInspectionNature = getPressureInspectionNatureType.value['100']
|
|
|
+ getPressureEquipContainerType = getPressureEquipType.value['100']
|
|
|
+ }
|
|
|
+
|
|
|
+ inspectionNatureForm.value = {
|
|
|
+ ...detailInfo,
|
|
|
+ templateSaveReqVOList: detailInfo.templateDetailRespVOList.map(item => ({
|
|
|
+ ...item,
|
|
|
+ name: item.templateName
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ editType.value = 'create'
|
|
|
+ // 重置为默认字典
|
|
|
+ getPressureInspectionNature = getPressureInspectionNatureType.value['100']
|
|
|
+ getPressureEquipContainerType = getPressureEquipType.value['100']
|
|
|
+ }
|
|
|
+ inspectionNatureCreateOrEditDialog.value = true
|
|
|
+}
|
|
|
+
|
|
|
+// 加载详情信息(锅炉/管道专用)
|
|
|
+const loadDetailInfo = async (id: string) => {
|
|
|
+ try {
|
|
|
+ const detailInfo = await DynamicTbApi.getPressureInspectionNatureInfoBoiler({id})
|
|
|
+ inspectionNatureForm.value = {
|
|
|
+ ...detailInfo,
|
|
|
+ templateSaveReqVOList: detailInfo.templateDetailRespVOList.map(item => ({
|
|
|
+ ...item,
|
|
|
+ name: item.templateName,
|
|
|
+ // 将后端返回的 part 字符串转换为数组
|
|
|
+ part: item.part ? (typeof item.part === 'string' ? item.part.split('/').filter(p => p) : (item.part || [])) : []
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载详情失败:', error)
|
|
|
+ ElMessage.error('加载详情失败')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const handleEquipmentCategoryChange = (value) => {
|
|
|
+ if (value == 200 || value == 300) {
|
|
|
+ getPressureInspectionNature = getPressureInspectionNatureType.value[value]
|
|
|
+ getPressureEquipContainerType = getPressureEquipType.value[value]
|
|
|
+ } else {
|
|
|
+ getPressureInspectionNature = getPressureInspectionNatureType.value['100']
|
|
|
+ getPressureEquipContainerType = getPressureEquipType.value['100']
|
|
|
+ }
|
|
|
+ // 切换设备类别时清空设备类型
|
|
|
+ inspectionNatureForm.value.equipmentType = ''
|
|
|
+}
|
|
|
+
|
|
|
+// 删除检验性质
|
|
|
+const handleDeleteInspectionNature = () => {
|
|
|
+ const selectedRows = inspectionNatureTableRef.value?.getTableRef().getSelectionRows()
|
|
|
+ if (!selectedRows.length) return ElMessage.warning('请选择检验性质')
|
|
|
+ if (selectedRows.length > 1) return ElMessage.warning('仅限选择一个检验性质')
|
|
|
+ ElMessageBox.confirm('确定删除选中的检验性质吗?', '删除提示', {
|
|
|
+ confirmButtonText: '确 认',
|
|
|
+ cancelButtonText: '取 消'
|
|
|
+ }).then(async () => {
|
|
|
+ const res = await deletePressureInspectionNature({id: selectedRows[0].id})
|
|
|
+ if (res) {
|
|
|
+ ElMessage.success('删除成功')
|
|
|
+ fetchInspectionNatureList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 新增&编辑 检验性质
|
|
|
+const inspectionNatureCreateOrEditDialog = ref(false)
|
|
|
+const editType = ref('')
|
|
|
+const editInspectionNatureId = ref('')
|
|
|
+const inspectionNatureFormRef = ref()
|
|
|
+const inspectionNatureForm = ref({
|
|
|
+ inspectionNature: '',
|
|
|
+ equipmentCategory: '',
|
|
|
+ equipmentType: '',
|
|
|
+ templateSaveReqVOList: [] as any[]
|
|
|
+})
|
|
|
+const inspectionNatureFormRules = ref({
|
|
|
+ inspectionNature: [
|
|
|
+ {required: true, message: '请选择检验性质', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ equipmentCategory: [
|
|
|
+ {required: true, message: '请选择设备类别', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ equipmentType: [
|
|
|
+ {required: true, message: '请选择设备类型', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ templateSaveReqVOList: [
|
|
|
+ {required: true, message: '请选择关联报告模板', trigger: 'blur'}
|
|
|
+ ]
|
|
|
+})
|
|
|
+
|
|
|
+const handleDeleteReport = (row, $index) => {
|
|
|
+ inspectionNatureForm.value.templateSaveReqVOList.splice($index, 1)
|
|
|
+}
|
|
|
+
|
|
|
+const handleInspectionNatureDialogClose = () => {
|
|
|
+ inspectionNatureCreateOrEditDialog.value = false
|
|
|
+ editType.value = ''
|
|
|
+ inspectionNatureFormRef.value.resetFields()
|
|
|
+}
|
|
|
+
|
|
|
+// 提交检验性质
|
|
|
+const handleInspectionNatureSubmit = async () => {
|
|
|
+ try {
|
|
|
+ await inspectionNatureFormRef.value.validate()
|
|
|
+
|
|
|
+ // 判断是否为电站锅炉内检
|
|
|
+ const isPowerStationBoiler = inspectionNatureForm.value.equipmentType == '1' &&
|
|
|
+ inspectionNatureForm.value.equipmentCategory == '300' &&
|
|
|
+ inspectionNatureForm.value.inspectionNature == '100'
|
|
|
+
|
|
|
+ const params = {
|
|
|
+ ...inspectionNatureForm.value,
|
|
|
+ templateSaveReqVOList: inspectionNatureForm.value.templateSaveReqVOList.map((item: any) => ({
|
|
|
+ id: item.id,
|
|
|
+ templateId: item.templateId,
|
|
|
+ isDefault: item.isDefault,
|
|
|
+ inspectionNatureId: has(item, 'inspectionNatureId') ? item.inspectionNatureId : (editType.value === 'edit' ? editInspectionNatureId.value : undefined),
|
|
|
+ // 如果是电站锅炉内检,将 part 数组转换为字符串
|
|
|
+ part: isPowerStationBoiler ? (item.part || []).join('/') : ""
|
|
|
+ })),
|
|
|
+ id: editType.value === 'edit' ? editInspectionNatureId.value : undefined
|
|
|
+ }
|
|
|
+
|
|
|
+ // 根据设备类型选择不同的更新接口
|
|
|
+ const result = editType.value === 'edit'
|
|
|
+ ? (inspectionNatureForm.value.equipmentCategory == 200 || inspectionNatureForm.value.equipmentCategory == 300
|
|
|
+ ? await updatePressure2InspectionNature(params)
|
|
|
+ : await updatePressureInspectionNature(params))
|
|
|
+ : await createPressureInspectionNature(params)
|
|
|
+
|
|
|
+ if (result) {
|
|
|
+ ElMessage.success((editType.value === 'edit' ? '编辑' : '新增') + '成功')
|
|
|
+ handleInspectionNatureDialogClose()
|
|
|
+ fetchInspectionNatureList()
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('提交失败:', error)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 报告模板列表
|
|
|
+const reportTemplateTableRef = ref()
|
|
|
+const reportPageNo = ref(1)
|
|
|
+const reportPageSize = ref(10)
|
|
|
+const reportTotal = ref(0)
|
|
|
+const reportTemplateListSearchForm = ref({})
|
|
|
+const reportTemplateList = ref([])
|
|
|
+const reportColumns = computed(() => ([
|
|
|
+ {
|
|
|
+ type: 'selection',
|
|
|
+ width: 55,
|
|
|
+ fieldProps: {
|
|
|
+ reserveSelection: true,
|
|
|
+ selectable: (row) => {
|
|
|
+ return inspectionNatureForm.value.templateSaveReqVOList.findIndex(item => item.templateId === row.id) < 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '报告编号',
|
|
|
+ prop: 'id',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '报告名称',
|
|
|
+ prop: 'name',
|
|
|
+ search: {
|
|
|
+ type: 'input',
|
|
|
+ placeholder: '请输入报告名称'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '报告分类',
|
|
|
+ prop: 'className',
|
|
|
+ search: {
|
|
|
+ type: 'select',
|
|
|
+ options: [],
|
|
|
+ prop: 'classId'
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '报告类型',
|
|
|
+ prop: 'type',
|
|
|
+ render: (row) => {
|
|
|
+ return getPressureReportTemplateType.value[row.type].label || '未知'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '生效日期',
|
|
|
+ prop: 'effectiveDate',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '失效日期',
|
|
|
+ prop: 'expiryDate',
|
|
|
+ }
|
|
|
+]))
|
|
|
+
|
|
|
+const fetchReportTemplateList = async () => {
|
|
|
+ const params = {
|
|
|
+ pageNo: reportPageNo.value,
|
|
|
+ pageSize: reportPageSize.value,
|
|
|
+ ...reportTemplateListSearchForm.value
|
|
|
+ }
|
|
|
+ const result = await getPressureReportTemplateListNoLimit(params)
|
|
|
+ if (result) {
|
|
|
+ reportTemplateList.value = result.list
|
|
|
+ reportTotal.value = result.total
|
|
|
+ // 获取当前已关联的报告模板ID列表
|
|
|
+ const selectedIds = inspectionNatureForm.value.templateSaveReqVOList.map(item => item.templateId)
|
|
|
+ // 反选表格中已关联的项
|
|
|
+ nextTick(() => {
|
|
|
+ const tableRef = reportTemplateTableRef.value?.getTableRef()
|
|
|
+ if (tableRef) {
|
|
|
+ reportTemplateList.value.forEach(row => {
|
|
|
+ if (selectedIds.includes(row.id)) {
|
|
|
+ tableRef.toggleRowSelection(row, true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const fetchReportTemplateList_Boiler = async () => {
|
|
|
+ const params = {
|
|
|
+ pageNo: reportPageNo.value,
|
|
|
+ pageSize: reportPageSize.value,
|
|
|
+ reportType: 100,
|
|
|
+ ...reportTemplateListSearchForm.value
|
|
|
+ }
|
|
|
+ const result = await DynamicTbApi.getDynamicTbPageInspection(params)
|
|
|
+ if (result) {
|
|
|
+ reportTemplateList.value = result.list
|
|
|
+ reportTotal.value = result.total
|
|
|
+ // 获取当前已关联的报告模板ID列表
|
|
|
+ const selectedIds = inspectionNatureForm.value.templateSaveReqVOList.map(item => item.templateId)
|
|
|
+ // 反选表格中已关联的项
|
|
|
+ nextTick(() => {
|
|
|
+ const tableRef = reportTemplateTableRef.value?.getTableRef()
|
|
|
+ if (tableRef) {
|
|
|
+ reportTemplateList.value.forEach(row => {
|
|
|
+ if (selectedIds.includes(row.id)) {
|
|
|
+ tableRef.toggleRowSelection(row, true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 报告模板弹窗
|
|
|
+const reportTemplateDialog = ref(false)
|
|
|
+const reportTemplateDialog_Boiler = ref(false)
|
|
|
+const handleShowReportList = () => {
|
|
|
+
|
|
|
+ if (inspectionNatureForm.value.equipmentCategory == 200 || inspectionNatureForm.value.equipmentCategory == 300) {
|
|
|
+ reportTemplateDialog_Boiler.value = true
|
|
|
+ fetchReportTemplateList_Boiler()
|
|
|
+ } else {
|
|
|
+ reportTemplateDialog.value = true
|
|
|
+ fetchReportTemplateList()
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+const handleClearSelectedItem = () => {
|
|
|
+ inspectionNatureForm.value.templateSaveReqVOList = []
|
|
|
+}
|
|
|
+const handleRemoveTag = (name) => {
|
|
|
+ inspectionNatureForm.value.templateSaveReqVOList = inspectionNatureForm.value.templateSaveReqVOList.filter(item => item.name !== name)
|
|
|
+}
|
|
|
+
|
|
|
+const handleReportTemplateConfirm = () => {
|
|
|
+ const selectedRows = reportTemplateTableRef.value?.getTableRef().getSelectionRows() || [];
|
|
|
+
|
|
|
+ // 过滤掉已存在的项
|
|
|
+ selectedRows.forEach(item => {
|
|
|
+ const templateIds = inspectionNatureForm.value.templateSaveReqVOList.map(x => x.templateId)
|
|
|
+ if (!templateIds.includes(item.id)) {
|
|
|
+ // 合并新数据
|
|
|
+ inspectionNatureForm.value.templateSaveReqVOList.push({
|
|
|
+ templateId: item.id,
|
|
|
+ name: item.name,
|
|
|
+ effectiveDate: item.effectiveDate,
|
|
|
+ expiryDate: item.expiryDate,
|
|
|
+ isDefault: '0', // 默认值
|
|
|
+ part: [] // 初始化部件类型数组(锅炉/管道专用)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+const handSelectionChange = (newSelection, row) => {
|
|
|
+ console.log('newSelection', newSelection, row)
|
|
|
+}
|
|
|
+
|
|
|
+// 判断是否为电站锅炉内检
|
|
|
+const isPowerStationBoiler = computed(() => {
|
|
|
+ return inspectionNatureForm.value.equipmentType == '1' &&
|
|
|
+ inspectionNatureForm.value.equipmentCategory == '300' &&
|
|
|
+ inspectionNatureForm.value.inspectionNature == '100'
|
|
|
+})
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.standard-class-list {
|
|
|
+ display: flex;
|
|
|
+ align-items: stretch;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ margin: 0 !important;
|
|
|
+
|
|
|
+ .right-table {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .left-tree {
|
|
|
+ min-width: 240px;
|
|
|
+ margin-right: 24px;
|
|
|
+ border-right: 1px solid var(--el-border-color);
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.el-tree) {
|
|
|
+ .el-tree-node {
|
|
|
+ &.is-current {
|
|
|
+ // background: none !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-tree-node__content {
|
|
|
+ height: 48px;
|
|
|
+
|
|
|
+ .el-tree-node__expand-icon {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ &:hover, &:visited, &:active, &:focus, &:checked {
|
|
|
+ background-color: var(--el-color-primary-light-9);
|
|
|
+ }
|
|
|
+
|
|
|
+ &.is-current {
|
|
|
+ background-color: var(--el-color-primary-light-9);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .add-class-btn {
|
|
|
+ width: 100%;
|
|
|
+ height: 38px;
|
|
|
+ margin-right: 10px;
|
|
|
+ border-radius: 0;
|
|
|
+
|
|
|
+ .el-icon {
|
|
|
+ margin-right: 6px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .class-content {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+
|
|
|
+ .el-icon {
|
|
|
+ margin-top: 2px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .custom-tree-node {
|
|
|
+ padding-left: 8px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .more {
|
|
|
+ position: absolute;
|
|
|
+ right: 12px;
|
|
|
+ top: 50%;
|
|
|
+ transform: translateY(-50%) rotate(90deg);
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.custom-tree-node-popover {
|
|
|
+ color: var(--el-text-color-primary);
|
|
|
+
|
|
|
+ .el-button {
|
|
|
+ display: block;
|
|
|
+ margin-left: 0;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ height: 36px;
|
|
|
+ width: 100%;
|
|
|
+ line-height: 36px;
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
+ &:last-child {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.custom-select {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ line-height: 32px;
|
|
|
+ min-height: 32px;
|
|
|
+
|
|
|
+ :deep(.el-input) {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ flex: 1;
|
|
|
+
|
|
|
+ .el-input__inner {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.el-icon) {
|
|
|
+ position: absolute;
|
|
|
+ right: 12px;
|
|
|
+ top: 50%;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ color: var(--el-text-color-placeholder);
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|