liding
2026-09-20 2b2fa317c30ee2de7a8b6f5fc964532031adea66
src/views/standard/standardLibrary/index.vue
@@ -6,14 +6,17 @@
        <pane size="12">
          <el-col>
            <div class="head-container addButton">
              <el-input v-model="search" clearable placeholder="输入关键字进行搜索" size="small" style="margin-bottom: 5px"
              <el-input v-model="search" clearable placeholder="输入关键字进行搜索" size="small"
                        style="margin-bottom: 5px; flex: 1; min-width: 0"
                        suffix-icon="el-icon-search" @keydown.enter.native="searchFilter" @blur="searchFilter" @clear="searchFilter"></el-input>
              <el-button circle icon="el-icon-plus" size="mini" type="primary" @click="openAddDia"></el-button>
              <el-button icon="el-icon-refresh" size="small" title="刷新"
                         style="margin-bottom: 5px; margin-left: 8px"
                         @click="selectStandardTreeList"></el-button>
            </div>
            <div class="head-container">
              <el-tree ref="tree" v-loading="treeLoad" :data="list"
                       :default-expanded-keys="expandedKeys" :filter-node-method="filterNode"
                       :props="{ children: 'children', label: 'label' }" highlight-current node-key="label"
                       :props="{ children: 'children', label: 'label' }" highlight-current node-key="id"
                       style="
                        height: calc(100vh - 173px);
                        overflow-y: scroll;
@@ -32,22 +35,6 @@
                {{ data.label }}
              </span>
                    </el-col>
                    <el-col v-if="
              checkPermi(['standard:standardLibrary:delStandardTree']) &&
              isLeaf(node.data)
            " :span="2" style="text-align: right">
                      <el-button size="mini" type="text" @click.stop="editTreeName(node)">
                        <i class="el-icon-edit"></i>
                      </el-button>
                    </el-col>
                    <el-col v-if="
              checkPermi(['standard:standardLibrary:delStandardTree']) &&
              isLeaf(node.data)
            " :span="2" style="text-align: right">
                      <el-button size="mini" type="text" @click.stop="remove(node, data)">
                        <i class="el-icon-delete"></i>
                      </el-button>
                    </el-col>
                  </el-row>
                </div>
              </el-tree>
@@ -58,7 +45,7 @@
        <pane size="88">
          <el-card v-if="selected.isLeaf" shadow="never" class="template-binding-card">
            <div slot="header"><span>原始记录模板</span><el-button v-if="checkPermi(['standard:standardLibrary:upStandardProduct'])" type="primary" size="mini" style="float:right" @click="saveBindings">保存绑定</el-button></div>
            <p v-if="!templateBindings.length" class="binding-tip">请为当前标准绑定原始记录模板;模板中须使用“检验项”标记。</p>
            <p v-if="!templateBindings.length" class="binding-tip">请为当前标准绑定原始记录模板。</p>
            <el-table :data="templateBindings" border size="small">
              <el-table-column type="index" label="顺序" width="70" /><el-table-column label="模板编号" prop="number" width="180" /><el-table-column label="模板名称" prop="name" /><el-table-column label="检测依据(模板备注)" prop="remark" />
              <el-table-column v-if="checkPermi(['standard:standardLibrary:upStandardProduct'])" label="操作" width="150"><template slot-scope="scope"><el-button type="text" :disabled="scope.$index === 0" @click="moveBinding(scope.$index, -1)">上移</el-button><el-button type="text" :disabled="scope.$index === templateBindings.length - 1" @click="moveBinding(scope.$index, 1)">下移</el-button><el-button type="text" @click="removeBinding(scope.$index)">移除</el-button></template></el-table-column>
@@ -585,7 +572,14 @@
    selectStandardTreeList() {
      this.treeLoad = true;
      selectStandardTreeList().then((res) => {
        this.list = res.data;
        this.list = (res.data || []).map(industry => ({
          ...industry,
          children: (industry.children || []).map(standard => ({
            ...standard,
            // 二级节点只展示标准编号;兼容尚未重启的旧后端返回格式。
            label: standard.standardCode || String(standard.label || '').split(' - ')[0],
          })),
        }));
        this.expandedKeys = [];
        this.list.forEach((a) => {
          this.expandedKeys.push(a.label);