From 06713afdb80bc876ffc6a09442049a08eb8a2364 Mon Sep 17 00:00:00 2001
From: admin <15939171744@163.com>
Date: 星期四, 09 五月 2024 14:36:28 +0800
Subject: [PATCH] -

---
 jcdm-ui/src/views/main/em/inspectionPlan/machinery.vue |   90 +++++++++++++++++++-------------------------
 1 files changed, 39 insertions(+), 51 deletions(-)

diff --git a/jcdm-ui/src/views/main/em/inspectionPlan/machinery.vue b/jcdm-ui/src/views/main/em/inspectionPlan/machinery.vue
index c082ea4..9a006b4 100644
--- a/jcdm-ui/src/views/main/em/inspectionPlan/machinery.vue
+++ b/jcdm-ui/src/views/main/em/inspectionPlan/machinery.vue
@@ -11,26 +11,24 @@
           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>
     <MachinerySelect ref="machinerySelect" @onSelected="onMachineryAdd" ></MachinerySelect>
-    <el-table v-loading="loading" :data="checkmachineryList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
+    <el-table v-loading="loading" :data="checkmachineryList" >
       <el-table-column label="璁惧缂栫爜" align="center" prop="equipmentCode" />
       <el-table-column label="璁惧鍚嶇О" align="center" prop="equipmentName" />
       <el-table-column label="鍝佺墝" align="center" prop="equipmentBrand" />
       <el-table-column label="瑙勬牸鍨嬪彿" align="center" prop="equipmentSpec" />
       <el-table-column label="澶囨敞" align="center" prop="remark" />
+      <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
@@ -49,10 +47,10 @@
 export default {
   name: "Checkmachinery",
   components:{MachinerySelect},
-  props:{
-    planId: null,
-    optType: null
-  },
+  props:{ id: null,
+          optType: null,
+          planCode: null,
+        },
   data() {
     return {
       // 閬僵灞�
@@ -70,7 +68,7 @@
       total: 0,
       // 鐐规璁惧琛ㄦ牸鏁版嵁
       checkmachineryList: [],
-      // 寮瑰嚭灞傛爣棰�
+        // 寮瑰嚭灞傛爣棰�
       title: "",
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
@@ -93,54 +91,44 @@
     this.getList();
   },
   methods: {
-    /** 鏌ヨ鐐规璁惧鍒楄〃 */
+    clearCheckmachineryList() {
+      this.checkmachineryList = [];
+    },
+    deleteSelectedColumns(row) {
+      const index = this.checkmachineryList.findIndex(item => item.id === row.id);
+      if (index !== -1) {
+        this.checkmachineryList.splice(index, 1);
+      } else {
+        this.$message({
+          message: '鏈壘鍒板叿鏈夎ID鐨勯」鐩�',
+          type: 'warning'
+        });
+      }
+      this.$emit('inSelected',this.checkmachineryList);
+
+    },
+  /** 鏌ヨ鐐规璁惧鍒楄〃 */
     getList() {
       this.loading = true;
+      this.checkmachineryList =this.machineryList;
       listInspectionPlanArchives(this.queryParams).then(response => {
-        this.checkmachineryList = response.rows;
+        // this.checkmachineryList = response.rows;
         this.total = response.total;
         this.loading = false;
       });
     },
-
-    // 澶氶�夋閫変腑鏁版嵁
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.recordId)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
     /** 鏂板鎸夐挳鎿嶄綔 */
-    handleAdd() {
+    handleAdd(){
       this.$refs.machinerySelect.showFlag = true;
     },
-      //璁惧璧勬簮閫夋嫨鍥炶皟
-    // onMachineryAdd(rows){
-    //   if(rows !=null && rows.length >0){
-    //      rows.forEach(row => {
-    //         row.planId = this.planId;
-    //        addInspectionPlanArchives(row).then(response =>{
-    //           this.getList();
-    //         });
-    //      });
-    //   }
-    // },
     onMachineryAdd(selectedRows){
       if(selectedRows !=null && selectedRows.length >0){
-        this.checkmachineryList.spareField1 = this.planCode
         this.checkmachineryList = selectedRows
-        console.log(this.checkmachineryList)
       }
+      this.$emit('inSelected',this.checkmachineryList);
+      console.log(this.checkmachineryList)
     },
-    /** 鍒犻櫎鎸夐挳鎿嶄綔 */
-    handleDelete(row) {
-      const recordIds = row.recordId || this.ids;
-      this.$modal.confirm('鏄惁纭鍒犻櫎鐐规璁惧缂栧彿涓�"' + recordIds + '"鐨勬暟鎹」锛�').then(function() {
-        return delInspectionPlanArchives(recordIds);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(() => {});
-    }
+
   }
 };
 </script>

--
Gitblit v1.9.3