hdy
2024-03-19 5218032b30db4a1e19ac6bb243b71900a600da28
jcdm-ui/src/views/main/em/inspectionPlan/machinery.vue
@@ -23,14 +23,23 @@
        >删除</el-button>
      </el-col>
    </el-row>
    <MachinerySelect ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelect>
    <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-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="handleDelete(scope.row)"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
@@ -97,7 +106,7 @@
    getList() {
      this.loading = true;
      listInspectionPlanArchives(this.queryParams).then(response => {
        this.checkmachineryList = response.rows;
        // this.checkmachineryList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
@@ -114,15 +123,22 @@
      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(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 = selectedRows
      }
      this.$emit('inSelected',this.checkmachineryList);
      console.log(this.checkmachineryList)
    },
    /** 删除按钮操作 */
    handleDelete(row) {