From adb3b5b9edf8db637b82705f4512538de4b8137d Mon Sep 17 00:00:00 2001
From: hdy <1105738590@qq.com>
Date: 星期二, 26 三月 2024 15:18:26 +0800
Subject: [PATCH] 修改

---
 jcdm-ui/src/views/main/em/inspectionPlan/subject.vue |   72 ++++++++++++++++--------------------
 1 files changed, 32 insertions(+), 40 deletions(-)

diff --git a/jcdm-ui/src/views/main/em/inspectionPlan/subject.vue b/jcdm-ui/src/views/main/em/inspectionPlan/subject.vue
index 3e4baa9..6b44127 100644
--- a/jcdm-ui/src/views/main/em/inspectionPlan/subject.vue
+++ b/jcdm-ui/src/views/main/em/inspectionPlan/subject.vue
@@ -11,21 +11,9 @@
           v-hasPermi="['mes:dv:checkplan:add']"
         >鏂板</el-button>
       </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['mes:dv:checkplan:remove']"
-        >鍒犻櫎</el-button>
-      </el-col>
     </el-row>
     <DvsubjectSelect ref="subjectSelect"  @onSelected="onSubjectSelected"></DvsubjectSelect>
-    <el-table v-loading="loading" :data="checksubjectList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
+    <el-table v-loading="loading" :data="checksubjectList" >
       <el-table-column label="椤圭洰缂栫爜" align="center" prop="itemsCode" />
       <el-table-column label="椤圭洰鍚嶇О" align="center" prop="itemsName" />
       <el-table-column label="椤圭洰绫诲瀷" align="center" prop="itemsType">
@@ -35,6 +23,16 @@
       </el-table-column>
       <el-table-column label="椤圭洰鍐呭" align="center" width="300px" prop="itemsContent" />
       <el-table-column label="鏍囧噯" align="center" width="300px" prop="standard" />
+      <el-table-column label="鎿嶄綔" align="center" >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="danger"
+            icon="el-icon-delete"
+            @click="deleteSelectedColumns(scope.row)"
+          >鍒犻櫎</el-button>
+        </template>
+      </el-table-column>
     </el-table>
 
     <pagination
@@ -98,45 +96,39 @@
     this.getList();
   },
   methods: {
+    deleteSelectedColumns(row) {
+      const index = this.checksubjectList.findIndex(item => item.id === row.id);
+      if (index !== -1) {
+        this.checksubjectList.splice(index, 1);
+      } else {
+        this.$message({
+          message: '鏈壘鍒板叿鏈夎ID鐨勯」鐩�',
+          type: 'warning'
+        });
+      }
+      this.$emit('subSelected',this.checksubjectList);
+
+    },
     /** 鏌ヨ鐐规椤圭洰鍒楄〃 */
     getList() {
       this.loading = true;
       listInspectionPlanItems(this.queryParams).then(response => {
-        this.checksubjectList = response.rows;
+        // this.checksubjectList = response.rows;
         this.total = response.total;
         this.loading = false;
-        console.log(response.rows)
+        // console.log(response.rows)
       });
-    },
-    // 澶氶�夋閫変腑鏁版嵁
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.recordId)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
     },
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
         this.$refs.subjectSelect.showFlag = true;
     },
-    onSubjectSelected(rows){
-        if(rows != null && rows.length >0){
-            rows.forEach(row => {
-                row.planId= this.planId;
-              addInspectionPlanItems(row).then(response => {
-                    this.getList();
-                });
-            });
-        }
-    },
-    /** 鍒犻櫎鎸夐挳鎿嶄綔 */
-    handleDelete(row) {
-      const recordIds = row.recordId || this.ids;
-      this.$modal.confirm('鏄惁纭鍒犻櫎鐐规椤圭洰缂栧彿涓�"' + recordIds + '"鐨勬暟鎹」锛�').then(function() {
-        return delInspectionPlanItems(recordIds);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(() => {});
+    onSubjectSelected(selectedRows){
+      if(selectedRows !=null && selectedRows.length >0){
+        this.checksubjectList = selectedRows
+      }
+      this.$emit('subSelected',this.checksubjectList);
+      console.log(this.checksubjectList)
     },
 
   }

--
Gitblit v1.9.3