gaoluyang
6 小时以前 07f9f8657d057a38792c3822acc9b08d83478967
src/views/safeProduction/hazardousMaterialsControl/index.vue
@@ -1,6 +1,6 @@
<template>
  <div class="app-container">
    <div class="search_form">
    <div class="search_form mb20">
      <div>
        <span class="search_title">危险源名称:</span>
        <el-input v-model="searchForm.name"
@@ -264,7 +264,8 @@
                  @selection-change="handleSafeHazardSelectionChange"
                  style="width: 100%">
          <el-table-column type="selection"
                           width="55" />
                           width="55"
                           :selectable="isSelectable" />
          <el-table-column prop="code"
                           label="危险源编码"
                           width="180"
@@ -604,6 +605,11 @@
      });
  };
  const isSelectable = row => {
    // 只有库存数量大于0的行才能被选择
    return Number(row.stockQty) > 0;
  };
  const handleSafeHazardSelectionChange = selection => {
    // 只保留最后一个选中的项
    if (selection.length > 1) {
@@ -647,15 +653,7 @@
  // 选择变化处理
  const handleSelectionChange = selection => {
    // 主表格也只保留最后一个选中的项
    if (selection.length > 1) {
      const lastSelected = selection[selection.length - 1];
      selectedIds.value = [lastSelected.id];
    } else if (selection.length === 1) {
      selectedIds.value = [selection[0].id];
    } else {
      selectedIds.value = [];
    }
    selectedIds.value = selection.map(item => item.id);
  };
  // 打开表单