xzc 6 dni temu
rodzic
commit
b35747f460

+ 2 - 1
yudao-ui-admin-vue3/src/views/pressure2/boilertaskorder/components/AddOrEditCheckItemForEquipment.vue

@@ -836,7 +836,8 @@ const handleConfirm = async () => {
             connectId: x.connectId,
             fee: x.fee,
             type: x.type,
-            orderItemId
+            orderItemId,
+            sort: x.sort || 0,
           }
           if (x.name?.includes('壁厚测定')) {
             result.wallThicknessList = x.wallThicknessList

+ 6 - 0
yudao-ui-admin-vue3/src/views/pressure2/equipboilerscheduling/components/BoilerPlanScheduleDialog.vue

@@ -1429,6 +1429,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             ), ...checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.IN)[1].itemList.filter(i => i.use).map(
@@ -1440,6 +1441,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             ),]
@@ -1478,6 +1480,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             ), ...checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.OUT)[1].itemList.filter(i => i.use).map(
@@ -1489,6 +1492,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             ),]
@@ -1528,6 +1532,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             ), ...checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.PRESSURE)[1].itemList.filter(i => i.use).map(
@@ -1539,6 +1544,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             ),]

+ 82 - 3
yudao-ui-admin-vue3/src/views/pressure2/inspectionNature/index.vue

@@ -174,7 +174,14 @@
         </div> -->
       </el-form-item>
     </el-form>
-    <el-table :data="inspectionNatureForm.templateSaveReqVOList">
+    <el-table ref="sortTableRef" :data="inspectionNatureForm.templateSaveReqVOList" row-key="templateId">
+      <el-table-column label="" width="40" align="center">
+        <template #default>
+          <div class="drag-handle">
+            <el-icon style="cursor: move; color: #909399"><Menu /></el-icon>
+          </div>
+        </template>
+      </el-table-column>
       <el-table-column label="检验项目名称" prop="name">
         <template #default="{ row }">
           <div style="display: flex; align-items: center; gap: 4px;">
@@ -282,7 +289,7 @@
 <script lang="ts" setup>
 import {DynamicTbApi} from '@/api/pressure2/dynamictb'
 import CustomDialog from '@/components/CustomDialog/index.vue'
-import {Management} from '@element-plus/icons-vue'
+import {Management, Menu} from '@element-plus/icons-vue'
 import {useDictStore} from '@/store/modules/dict'
 import dayjs from 'dayjs'
 import {
@@ -294,6 +301,7 @@ import {
 } from '@/api/pressure2/inspectionNature'
 import {has} from 'lodash'
 import {ElMessage, ElMessageBox} from 'element-plus'
+import Sortable from 'sortablejs'
 
 const dictStore = useDictStore()
 // 检验性质字典
@@ -487,11 +495,12 @@ const handleInspectionNatureSubmit = async () => {
     console.log(inspectionNatureForm.value.templateSaveReqVOList)
     const params = {
       ...inspectionNatureForm.value,
-      templateSaveReqVOList: inspectionNatureForm.value.templateSaveReqVOList.map((item: any) => ({
+      templateSaveReqVOList: inspectionNatureForm.value.templateSaveReqVOList.map((item: any, index: number) => ({
         id: item.id,
         templateId: item.templateId,
         isDefault: item.isDefault,
         defaultCount: item.defaultCount,
+        sort: index + 1,
         inspectionNatureId: has(item, 'inspectionNatureId') ? item.inspectionNatureId : (editType.value === 'edit' ? editInspectionNatureId.value : undefined),
         // 如果是电站锅炉内检,将 part 数组转换为字符串
         part: isPowerStationBoiler ? (item.part || []).join('/') : ""
@@ -614,6 +623,55 @@ const isPowerStationBoiler = computed(() => {
     inspectionNatureForm.value.equipmentCategory == '200' &&
     inspectionNatureForm.value.inspectionNature == '100'
 })
+
+// 拖拽排序
+const sortTableRef = ref()
+const sortableInstance = ref<any>(null)
+
+const initSortable = () => {
+  nextTick(() => {
+    if (sortableInstance.value) {
+      sortableInstance.value.destroy()
+      sortableInstance.value = null
+    }
+
+    const tableBody = sortTableRef.value?.$el?.querySelector('.el-table__body-wrapper tbody')
+    if (!tableBody) return
+
+    sortableInstance.value = Sortable.create(tableBody, {
+      animation: 150,
+      handle: '.drag-handle',
+      ghostClass: 'sortable-ghost',
+      chosenClass: 'sortable-chosen',
+      dragClass: 'sortable-drag',
+      onEnd: (evt: any) => {
+        const { oldIndex, newIndex } = evt
+        if (oldIndex !== undefined && newIndex !== undefined && oldIndex !== newIndex) {
+          const list = inspectionNatureForm.value.templateSaveReqVOList
+          const movedItem = list.splice(oldIndex, 1)[0]
+          list.splice(newIndex, 0, movedItem)
+        }
+      }
+    })
+  })
+}
+
+// 弹窗打开且数据变化时重新初始化拖拽
+watch(
+  () => [inspectionNatureCreateOrEditDialog.value, inspectionNatureForm.value.templateSaveReqVOList.length],
+  () => {
+    if (inspectionNatureCreateOrEditDialog.value) {
+      initSortable()
+    }
+  }
+)
+
+onBeforeUnmount(() => {
+  if (sortableInstance.value) {
+    sortableInstance.value.destroy()
+    sortableInstance.value = null
+  }
+})
 </script>
 <style lang="scss" scoped>
 .standard-class-list {
@@ -827,4 +885,25 @@ const isPowerStationBoiler = computed(() => {
     color: var(--el-text-color-placeholder);
   }
 }
+
+// 拖拽排序样式
+.sortable-ghost {
+  opacity: 0.4;
+  background: #c8ebfb;
+}
+
+.sortable-chosen {
+  opacity: 0.8;
+}
+
+.sortable-drag {
+  opacity: 0.8;
+}
+
+.drag-handle {
+  cursor: move;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
 </style>

+ 5 - 1
yudao-ui-admin-vue3/src/views/pressure2/pipescheduling/components/PipePlanScheduleDialog.vue

@@ -230,7 +230,7 @@
             v-show="showCheck(checkItem)"
             :key="checkItem.inspectionNature + '-' + checkItem.type"
           >
-            <div v-if="checkItem.inspectionNature == formData.checkType && getEquipCountByType(checkItem.inspectionNature) != 0">
+            <div v-if="checkItem.inspectionNature == formData.checkType && getEquipCountByType(checkItem.inspectionNature) != 0 && (checkItem.inspectionNature == '100' ? checkItem.type == '1' : checkItem.type == '2')">
               <div class="content-title" @click="toggleCheckItemCollapse(checkItem)">
                 <el-icon class="collapse-icon" :class="{ 'is-collapsed': !checkItem.isExpanded }">
                   <ArrowDown />
@@ -1093,6 +1093,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             ), ...checkItemList.value.filter(i => i.inspectionNature == PressurePipeCheckType.REGULAR)[1].itemList.filter(i => i.use).map(
@@ -1104,6 +1105,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             )]
@@ -1141,6 +1143,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             ), ...checkItemList.value.filter(i => i.inspectionNature == PressurePipeCheckType.ANNUAL)[1].itemList.filter(i => i.use).map(
@@ -1152,6 +1155,7 @@ const handleConfirm = async () => {
                   type: i.type,
                   feeCalculateJson: i.feeCalculateJson || '',
                   defaultCount: i.defaultCount || 1,
+                  sort: i.sort || 0,
                 }
               }
             )]

+ 68 - 65
yudao-ui-admin-vue3/src/views/pressure2/pipetaskorder/components/AddOrEditCheckItemForEquipment.vue

@@ -39,74 +39,62 @@
             v-for="checkItem in checkItemList"
             :key="checkItem.inspectionNature + '-' + checkItem.type"
           >
-            <div class="content-title" @click="toggleCheckItemCollapse(checkItem)">
-              <el-icon class="collapse-icon" :class="{ 'is-collapsed': !checkItem.isExpanded }">
-                <ArrowDown />
-              </el-icon>
-              {{ checkItem.inspectionNatureName }}
-            </div>
-            <div class="inspection-grid" v-show="checkItem.isExpanded">
-              <!-- 标题行 -->
-              <div class="grid-header">检验项目</div>
-              <template v-if="checkItem.itemList.length > 0">
-                <!-- Grid 容器 -->
-                <div
-                  class="grid-container"
-                  :style="{
+          <div v-if="checkItem.inspectionNature == '100' ? checkItem.type == '1' : checkItem.type == '2'">
+              <div class="content-title" @click="toggleCheckItemCollapse(checkItem)">
+                <el-icon class="collapse-icon" :class="{ 'is-collapsed': !checkItem.isExpanded }">
+                  <ArrowDown />
+                </el-icon>
+                {{ checkItem.inspectionNatureName }}
+              </div>
+              <div class="inspection-grid" v-show="checkItem.isExpanded">
+                <!-- 标题行 -->
+                <div class="grid-header">检验项目</div>
+                <template v-if="checkItem.itemList.length > 0">
+                  <!-- Grid 容器 -->
+                  <div class="grid-container" :style="{
                     'grid-template-columns':
                       checkItem.itemList.length < 5
                         ? `repeat(${checkItem.itemList.length}, 1fr)`
                         : `repeat(5, 1fr)`
-                  }"
-                >
-                  <!-- 循环渲染子项(模拟数据) -->
-                  <div class="grid-item" v-for="(item, index) in checkItem.itemList" :key="index">
-                    <div class="grid-item-top">
-                      <el-checkbox
-                        :disabled="item.projectType === 'MAIN'|| item.name === '一览表'"
-                        v-model="item.use"
-                        @change="(val) => handleCheckItemSelectedChange(item, val)"
-                      />
-                      <div style="display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1;">
+                  }">
+                    <!-- 循环渲染子项(模拟数据) -->
+                    <div class="grid-item" v-for="(item, index) in checkItem.itemList" :key="index">
+                      <div class="grid-item-top">
+                        <el-checkbox :disabled="item.projectType === 'MAIN' || item.name === '一览表'" v-model="item.use"
+                          @change="(val) => handleCheckItemSelectedChange(item, val)" />
+                        <div style="display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1;">
                           <span v-if="item.projectType === 'MAIN'"
-                                style="display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 20px; height: 20px; background-color: #6cbcf5; color: #fff; font-size: 12px; border-radius: 2px; font-weight: bold;">主</span>
-                        <el-tooltip :content="item.name" placement="top" :show-after="500">
-                          <span style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; word-break: break-all;">{{ item.name }}</span>
-                        </el-tooltip>
+                            style="display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 20px; height: 20px; background-color: #6cbcf5; color: #fff; font-size: 12px; border-radius: 2px; font-weight: bold;">主</span>
+                          <el-tooltip :content="item.name" placement="top" :show-after="500">
+                            <span
+                              style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; word-break: break-all;">{{
+                              item.name }}</span>
+                          </el-tooltip>
+                        </div>
+                        <template v-if="!item.use && item.isFee === '1'">
+                          <span style="flex-shrink: 0; white-space: nowrap;">
+                            (
+                            <el-button link type="primary" @click="() => handleInputCalcField(item)">费用:{{
+                              getCheckItemFeeType(item) }}</el-button>
+                            )
+                          </span>
+                        </template>
                       </div>
-                      <template v-if="!item.use && item.isFee === '1'">
-                        <span style="flex-shrink: 0; white-space: nowrap;">
-                        (
-                        <el-button link type="primary" @click="() => handleInputCalcField(item)"
-                        >费用:{{ getCheckItemFeeType(item) }}</el-button
-                        >
-                        )
+                      <div class="grid-item-bottom" v-if="item.use">
+                        <el-input-number v-model="item.quantity" :min="1" :max="999" :precision="0" :step="1"
+                          size="small" style="width: 76px; flex-shrink: 0;" @change="calculateAmounts" />
+                        <span style="flex-shrink: 0; white-space: nowrap; margin-left: 8px;" v-if="item.isFee === '1'">
+                          (
+                          <el-button link type="primary" @click="() => handleInputCalcField(item)">费用:{{
+                            getCheckItemFeeType(item) }}</el-button>
+                          )
                         </span>
-                      </template>
-                    </div>
-                    <div class="grid-item-bottom" v-if="item.use">
-                      <el-input-number
-                        v-model="item.quantity"
-                        :min="1"
-                        :max="999"
-                        :precision="0"
-                        :step="1"
-                        size="small"
-                        style="width: 76px; flex-shrink: 0;"
-                        @change="calculateAmounts"
-                      />
-                      <span style="flex-shrink: 0; white-space: nowrap; margin-left: 8px;"  v-if="item.isFee === '1'">
-                      (
-                      <el-button link type="primary" @click="() => handleInputCalcField(item)"
-                      >费用:{{ getCheckItemFeeType(item) }}</el-button
-                      >
-                      )
-                      </span>
+                      </div>
                     </div>
                   </div>
-                </div>
-              </template>
-              <el-empty v-else :description="`暂无【${checkItem.inspectionNatureName}】检验项目`" />
+                </template>
+                <el-empty v-else :description="`暂无【${checkItem.inspectionNatureName}】检验项目`" />
+              </div>
             </div>
           </div>
         </div>
@@ -280,6 +268,7 @@ import {
   PressurePipeCheckTypeMap,
   PressureReportType
 } from '@/utils/constants'
+import {InspectionNatureTypeApi} from "@/api/pressure2/inspectionnaturetype";
 import { ReportItemVO, PipeTaskOrderApi } from '@/api/pressure2/pipetaskorder'
 import { useUserStore } from '@/store/modules/user'
 import { is, isEmpty } from '@/utils/is'
@@ -418,15 +407,25 @@ const handleQueryCheckItemList = async (checkType) => {
     itemIds: props.equipmentIds,
     equipmentCategory: queryParams.value.equipmentCategory,
     inspectionNature: [checkType],
-    equipType:equipType
+    equipType: equipType
   }
   const queryResult = await queryCheckItemList(params)
+  const type = Number(checkType) || checkType
+  const inspectionNatureType = await InspectionNatureTypeApi.getInspectionNatureTypePage({
+    pageNo: 1,
+    pageSize: 1,
+    equip: '300',
+    nature: type
+  })
+  const inType = inspectionNatureType.list[0].type
+ 
   //console.log(queryResult)
   checkItemList.value.push({
     inspectionNatureName: filterPressurePipeCheckTypeMap.value[checkType] + " 法定收费项目",
     inspectionNature: checkType,
     type: '1',
-    isExpanded: true, // 默认展开
+    // isExpanded: true, // 默认展开
+    isExpanded: inType == 1,
     itemList: (queryResult || []).map((item) => ({
       ...item,
       isAutoAmount: props.isBatch ? '0' : item.isAutoAmount,
@@ -435,14 +434,16 @@ const handleQueryCheckItemList = async (checkType) => {
       //use: props.selectedIds.includes(item.templateId)
       use:false,
       type: '1',
-      quantity: 1 // 默认数量为 1
+      quantity: 1, // 默认数量为 1
+      sort: item.sort
     }))
   })
   checkItemList.value.push({
     inspectionNatureName: filterPressurePipeCheckTypeMap.value[checkType] + " 服务收费项目",
     inspectionNature: checkType,
     type: '2',
-    isExpanded: false, // 默认收起
+    // isExpanded: false, // 默认收起
+    isExpanded: inType == 2,
     itemList: (queryResult || []).map((item) => ({
       ...item,
       isAutoAmount: props.isBatch ? '0' : item.isAutoAmount,
@@ -451,7 +452,8 @@ const handleQueryCheckItemList = async (checkType) => {
       //use: props.selectedIds.includes(item.templateId)
       use:false,
       type: '2',
-      quantity: 1 // 默认数量为 1
+      quantity: 1 ,// 默认数量为 1
+      sort: item.sort
     }))
   })
 }
@@ -852,7 +854,8 @@ const handleConfirm = async () => {
         connectId: x.connectId,
         fee: x.fee,
         type: x.type,
-        quantity: x.quantity || 1
+        quantity: x.quantity || 1,
+        sort: x.sort
       }
       if (x.name?.includes('壁厚测定')) {
         result.wallThicknessList = x.wallThicknessList