Browse Source

变更令>>新增批量【删除】和新增【删除限制】

duy 1 week ago
parent
commit
e8ffb2ab01
2 changed files with 80 additions and 17 deletions
  1. 2 2
      src/config/index.json
  2. 78 15
      src/views/alter/admin/order.vue

+ 2 - 2
src/config/index.json

@@ -1,11 +1,11 @@
 {
     "version": "20230607160059",
     "target33": "http://127.0.0.1:8090",
-    "target334": "http://192.168.0.109:8090",
+    "target": "http://192.168.0.109:8090",
     "target88": "http://219.151.181.73:8090",
     "target8": "http://192.168.0.109:8090",
     "target22": "http://192.168.0.109:8090",
-    "target": "http://183.247.216.148:28090",
+    "target111": "http://183.247.216.148:28090",
     "socket": "wss://measure.hczcxx.cn/websocket",
     "socket2": "ws://192.168.0.125:9527/websocket",
     "localModel": false,

+ 78 - 15
src/views/alter/admin/order.vue

@@ -11,6 +11,10 @@
             </div>
         </template>
         <template #extra>
+            <el-button hc-btn type="danger" :disabled="tableCheckKeys.length === 0" @click="delClick">
+                <hc-icon name="delete-bin" />
+                <span>删除</span>
+            </el-button>
             <el-button hc-btn type="primary" @click="addModalClick">
                 <hc-icon name="add" />
                 <span>新增</span>
@@ -19,7 +23,10 @@
                 <hc-icon name="send-plane-2" />
                 <span>上报</span>
             </el-button>
-            <el-button hc-btn color="#FF7D43" :loading="undoLoading" class="text-white" :disabled="tableCheckKeys.length <= 0" @click="undoReportClick">
+            <el-button
+                hc-btn color="#FF7D43" :loading="undoLoading" class="text-white"
+                :disabled="tableCheckKeys.length <= 0" @click="undoReportClick"
+            >
                 <span>撤销上报</span>
             </el-button>
         </template>
@@ -33,13 +40,31 @@
                     >
                         <template #action="{ row }">
                             <template v-if="row.approveStatus === 2">
-                                <el-link v-if="row.commandStatus === 0" type="success" @click="rowExecuteChange(row.id)">下达</el-link>
-                                <el-link v-if="row.commandStatus === 0" type="danger" @click="delRowClick(row)">删除</el-link>
-                                <el-link v-if="row.commandStatus === 1 && row.citeStatus === 0" type="success" @click="rowAnnulChange(row.id)">撤销下达</el-link>
+                                <el-link
+                                    v-if="row.commandStatus === 0" type="success"
+                                    @click="rowExecuteChange(row.id)"
+                                >
+                                    下达
+                                </el-link>
+                                <!-- <el-link
+                                    v-if="row.commandStatus === 0" type="danger"
+                                    @click="delRowClick(row)"
+                                >
+                                    删除
+                                </el-link> -->
+                                <el-link
+                                    v-if="row.commandStatus === 1 && row.citeStatus === 0" type="success"
+                                    @click="rowAnnulChange(row.id)"
+                                >
+                                    撤销下达
+                                </el-link>
                             </template>
                             <template v-if="row.approveStatus === 0 || row.approveStatus === 3">
                                 <el-link type="success" @click="rowEditClick(row)">修改</el-link>
-                                <el-link type="danger" @click="delRowClick(row)">删除</el-link>
+                                <!-- <el-link type="danger" @click="delRowClick(row)">删除</el-link> -->
+                            </template>
+                            <template v-if="row.approveStatus === 0">
+                                <el-link type="danger" @click="delRowClick(row.id)">删除</el-link>
                             </template>
                         </template>
                     </hc-table>
@@ -74,15 +99,27 @@
                                 <hc-info-table-td center is-title>设计图完成时间:</hc-info-table-td>
                                 <hc-info-table-td width="120px">{{ tableInfo.designDate ?? '-' }}</hc-info-table-td>
                                 <hc-info-table-td center is-title>实际变更桩号:</hc-info-table-td>
-                                <hc-info-table-td width="120px">{{ tableInfo.realityChangeNumber ?? '-' }}</hc-info-table-td>
+                                <hc-info-table-td width="120px">
+                                    {{ tableInfo.realityChangeNumber ?? '-'
+                                    }}
+                                </hc-info-table-td>
                             </tr>
                             <tr>
                                 <hc-info-table-td center is-title>变更归类:</hc-info-table-td>
-                                <hc-info-table-td width="120px">{{ tableInfo.changeClassifyName ?? '-' }}</hc-info-table-td>
+                                <hc-info-table-td width="120px">
+                                    {{ tableInfo.changeClassifyName ?? '-'
+                                    }}
+                                </hc-info-table-td>
                                 <hc-info-table-td center is-title>变更批复文号:</hc-info-table-td>
-                                <hc-info-table-td width="120px">{{ tableInfo.changeApprovalNumber ?? '-' }}</hc-info-table-td>
+                                <hc-info-table-td width="120px">
+                                    {{ tableInfo.changeApprovalNumber ?? '-'
+                                    }}
+                                </hc-info-table-td>
                                 <hc-info-table-td center is-title>变更批复时间:</hc-info-table-td>
-                                <hc-info-table-td width="120px">{{ tableInfo.changeApprovalDate ?? '-' }}</hc-info-table-td>
+                                <hc-info-table-td width="120px">
+                                    {{ tableInfo.changeApprovalDate ?? '-'
+                                    }}
+                                </hc-info-table-td>
                             </tr>
                             <tr>
                                 <hc-info-table-td center is-title>引用预变更:</hc-info-table-td>
@@ -90,16 +127,25 @@
                             </tr>
                             <tr>
                                 <hc-info-table-td center is-title>变更原因:</hc-info-table-td>
-                                <hc-info-table-td width="auto" colspan="5">{{ tableInfo.changeCause ?? '-' }}</hc-info-table-td>
+                                <hc-info-table-td width="auto" colspan="5">
+                                    {{ tableInfo.changeCause ?? '-'
+                                    }}
+                                </hc-info-table-td>
                             </tr>
                         </hc-info-table>
                     </hc-card-item>
                     <hc-card-item class="mt-3" title="变更申请部位">
-                        <hc-table ref="tableRef1" :column="tableColumn1" :datas="tableInfo.nodeList" is-new :index-style="{ width: 60 }" is-current-row @row-click="tableNodeRowClick" />
+                        <hc-table
+                            ref="tableRef1" :column="tableColumn1" :datas="tableInfo.nodeList" is-new
+                            :index-style="{ width: 60 }" is-current-row @row-click="tableNodeRowClick"
+                        />
                     </hc-card-item>
                     <hc-card-item v-if="tableChangeData.length > 0" class="mt-3" title="变更申请清单">
                         <div class="no-border hc-table-ref-box">
-                            <el-table class="w-full" :data="tableChangeData" row-key="id" height="100%" highlight-current-row border>
+                            <el-table
+                                class="w-full" :data="tableChangeData" row-key="id" height="100%"
+                                highlight-current-row border
+                            >
                                 <el-table-column type="index" label="序号" />
                                 <el-table-column prop="formNumber" label="清单编号" />
                                 <el-table-column prop="formName" label="清单名称" />
@@ -130,7 +176,10 @@
         </div>
 
         <!-- 上报弹窗 -->
-        <hc-report-dialog v-model="isReport" :info="reportInfo" :is-build-audit="false" :is-batch="true" @finish="reportFinish" />
+        <hc-report-dialog
+            v-model="isReport" :info="reportInfo" :is-build-audit="false" :is-batch="true"
+            @finish="reportFinish"
+        />
 
         <!-- 新增修改的弹窗 -->
         <addModal v-model="isAddShow" :ids="addEditIds" @finish="addEditFinish" />
@@ -303,9 +352,9 @@ const addEditFinish = () => {
 }
 
 //删除
-const delRowClick = (row) => {
+const delRowClick = (ids) => {
     delMessage(async () => {
-        const { error, code, msg } = await mainApi.remove({ ids: row.id })
+        const { error, code, msg } = await mainApi.remove({ ids })
         if (!error && code === 200) {
             window.$message.success('删除成功')
             getTableData().then()
@@ -315,6 +364,18 @@ const delRowClick = (row) => {
     })
 }
 
+const delClick = async () => {
+    const rows = tableCheckKeys.value
+
+    const hasApprovedItem = rows.some(row => row.approveStatus !== 0)
+    if (hasApprovedItem) {
+        window.$message.warning('包含已上报变更,不允许删除')
+        return
+    }
+    const ids = arrToId(rows)
+    await delRowClick(ids)
+}
+
 //下达变更
 const rowExecuteChange = async (id) => {
     if (isNullES(id)) {
@@ -420,9 +481,11 @@ const undoReportClick = async () => {
 .table-info-file .item-upload-btn {
     display: none;
 }
+
 .hc-ui-form-upload-box.table-info-file .hc-ui-form-item-dashed.list .file-list-box {
     margin-top: 0;
 }
+
 .hc-ui-form-upload-box.table-info-file .hc-ui-form-item-dashed.list .file-list-box .item .close-icon {
     display: none;
 }