hdy
2024-03-19 c92f19bea0eab25cfc6b9ee6c338e62dde4b44da
jcdm-ui/src/views/main/em/inspectionPlan/machinery.vue
@@ -11,20 +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>
    <MachinerySelect ref="machinerySelect" @onSelected="onMachineryAdd" ></MachinerySelect>
    <el-table v-loading="loading" :data="checkmachineryList" @selection-change="handleSelectionChange">
    <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" />
@@ -36,7 +25,7 @@
            size="mini"
            type="danger"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            @click="deleteSelectedColumns(scope.row)"
          >删除</el-button>
        </template>
      </el-table-column>
@@ -79,7 +68,7 @@
      total: 0,
      // 点检设备表格数据
      checkmachineryList: [],
      // 弹出层标题
        // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
@@ -102,7 +91,21 @@
    this.getList();
  },
  methods: {
    /** 查询点检设备列表 */
    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;
      listInspectionPlanArchives(this.queryParams).then(response => {
@@ -112,12 +115,7 @@
      });
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.recordId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.$refs.machinerySelect.showFlag = true;
@@ -140,16 +138,7 @@
      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>