From fcadf16afa65a8a5ca53a33c4b8f4bf2efe2ea03 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 16 九月 2026 09:21:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_新疆_新聚' into dev_新疆_新聚

---
 src/views/standard/standardLibrary/index.vue | 1650 +++++++++++++++++-----------------------------------------
 1 files changed, 495 insertions(+), 1,155 deletions(-)

diff --git a/src/views/standard/standardLibrary/index.vue b/src/views/standard/standardLibrary/index.vue
index c30d290..16b01f8 100644
--- a/src/views/standard/standardLibrary/index.vue
+++ b/src/views/standard/standardLibrary/index.vue
@@ -1,724 +1,287 @@
-<style scoped>
-.standard {
-  padding-top: 10px;
-  display: flex;
-  height: calc(100vh - 90px);
-}
-
-.left {
-  width: 330px;
-  height: calc(100% - 40px - 10px);
-  background-color: white;
-  padding: 15px;
-}
-
-.custom-tree-node {
-  width: 100%;
-  line-height: 32px;
-}
-
-.custom-tree-node .el-icon-delete {
-  color: #3a7bfa;
-  opacity: 0;
-  font-size: 18px;
-}
-
-.custom-tree-node:hover .el-icon-delete {
-  opacity: 1;
-}
-
-.custom-tree-node .el-icon-edit {
-  color: #3a7bfa;
-  opacity: 0;
-  font-size: 18px;
-}
-
-.custom-tree-node:hover .el-icon-edit {
-  opacity: 1;
-}
-
-.node_i {
-  color: orange;
-  font-size: 18px;
-}
-
-.right {
-  margin-left: 5px;
-  width: calc(100% - 350px);
-  height: calc(100% - 40px);
-}
-
-.right .title {
-  height: 34px;
-  line-height: 34px;
-  padding: 0 10px;
-  background-color: white;
-}
-
-.standard_table {
-  border-top: 1px solid #ebeef5;
-  background-color: white;
-}
-
-.product_table {
-  border-top: 1px solid #ebeef5;
-  height: calc(100% - 235px);
-  margin-top: 5px;
-  background-color: white;
-  user-select: none;
-}
-
-.product_table .el-table {
-  height: calc(100% - 35px) !important;
-}
-
-.sort {
-  width: 80% !important;
-  overflow: hidden;
-}
-
->>> .el-table__body-wrapper {
-  height: calc(100% - 46px) !important;
-}
-
->>> .header-class {
-  height: 40px !important;
-}
-
->>> .header-class th.el-table__cell > .cell {
-  line-height: 20px !important;
-  padding-top: 0 !important;
-  padding-bottom: 0 !important;
-}
-
->>> .el-table__row {
-  height: 35px !important;
-}
-
-.search {
-  border-bottom: 1px solid #ebeef5;
-  margin-bottom: 16px;
-  display: flex;
-  align-items: center;
-  box-sizing: border-box;
-  padding-bottom: 10px;
-}
-
-.search-item {
-  display: flex;
-  align-items: center;
-  flex-wrap: wrap;
-}
-
-.search-item .el-row {
-  display: flex;
-  align-items: center;
-}
-
-.search-item .el-col {
-  margin-left: 0;
-}
-
-.more-edit .dialog-footer {
-  position: absolute;
-  top: 15px;
-  right: 70px;
-}
-
->>> .is-disabled .el-textarea__inner {
-  background: rgba(0, 0, 0, 0.05) !important;
-}
->>> .el-table__body-wrapper::-webkit-scrollbar {
-  height: 14px; /* 璁剧疆婊氬姩鏉″搴� */
-}
-</style>
-<style>
-.standard .el-tree-node__content {
-  height: 32px;
-  font-size: 14px;
-  border-radius: 2px;
-}
-
-.standard
-  .el-tree--highlight-current
-  .el-tree-node.is-current
-  > .el-tree-node__content {
-  color: #3a7bfa;
-}
-
-.standard .has-gutter .el-table__cell .cell {
-  line-height: 34px;
-  background-color: #f8f8f8;
-}
-
-.standard .has-gutter .el-table__cell {
-  background-color: #fafafa !important;
-}
-
-.standard .standard_table .el-table__row .cell {
-  font-size: 14px;
-}
-
-.standard .el-table .warning-row .cell {
-  color: #bababa;
-}
-
-.standard .el-table-filter__list {
-  max-height: 400px;
-  overflow-y: auto;
-}
-
-.standard .el-upload {
-  width: 100%;
-}
-
-.standard .el-upload-dragger {
-  width: 100%;
-}
-
-.standard .handleBtn.is-disabled .el-upload:focus {
-  color: #c0c4cc !important;
-}
-
-.standard .avatar-uploader .el-upload {
-  height: 80px;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-}
-</style>
-
 <template>
-  <div class="standard">
-    <div class="left">
-      <el-row>
-        <el-col :span="20">
-          <el-input
-            v-model="search"
-            clearable
-            placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�"
-            size="small"
-            style="margin-bottom: 5px"
-            suffix-icon="el-icon-search"
-            @blur="searchFilter"
-            @clear="searchFilter"
-          ></el-input>
-        </el-col>
-        <el-col
-          v-if="checkPermi(['standard:standardLibrary:add'])"
-          :span="4"
-          style="text-align: center; line-height: 30px"
-        >
-          <el-button
-            circle
-            icon="el-icon-plus"
-            size="mini"
-            type="primary"
-            @click="addDia = true"
-          ></el-button>
-        </el-col>
-      </el-row>
-      <el-tree
-        ref="tree"
-        v-loading="treeLoad"
-        :allow-drop="allowDrop"
-        :data="list"
-        :default-expanded-keys="expandedKeys"
-        :draggable="true"
-        :filter-node-method="filterNode"
-        :props="{ children: 'children', label: 'label' }"
-        highlight-current
-        node-key="label"
-        style="
-          height: calc(100% - 30px);
-          overflow-y: scroll;
-          scrollbar-width: none;
-        "
-        @node-click="handleNodeClick"
-        @node-expand="nodeOpen"
-        @node-collapse="nodeClose"
-        @node-drop="handleDrop"
-      >
-        <div slot-scope="{ node, data }" class="custom-tree-node">
-          <el-row style="width: 100%">
-            <el-col
-              :class="{ sort: node.level > 3 }"
-              :span="19"
-              :title="data.label"
-              style="text-align: left"
-            >
+  <div class="app-container">
+    <el-row :gutter="20">
+      <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
+        <!--閮ㄩ棬鏁版嵁-->
+        <pane size="12">
+          <el-col>
+            <div class="head-container addButton">
+              <el-input v-model="search" clearable placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�" size="small" style="margin-bottom: 5px"
+                        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>
+            </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"
+                       style="
+                        height: calc(100vh - 173px);
+                        overflow-y: scroll;
+                        scrollbar-width: none;"
+                       @node-click="handleNodeClick">
+                <div slot-scope="{ node, data }" class="custom-tree-node">
+                  <el-row style="width: 100%">
+                    <el-col :span="19" :title="data.label" style="text-align: left">
               <span>
-                <i
-                  :class="`node_i ${
-                    data.children != undefined
-                      ? data.code === '[1]'
-                        ? 'el-icon-folder-opened'
-                        : 'el-icon-folder'
-                      : 'el-icon-tickets'
-                  }`"
-                ></i>
+                <i :class="`node_i ${isLeaf(data)
+                  ? 'el-icon-tickets'
+                  : node.level === 1
+                    ? 'el-icon-folder-opened'
+                    : 'el-icon-folder'
+                  }`"></i>
                 {{ data.label }}
               </span>
-            </el-col>
-            <el-col
-              v-if="
-                checkPermi(['standard:standardLibrary:delStandardTree']) &&
-                (node.data.children === null ||
-                  node.data.children === undefined)
-              "
-              :span="2"
-              style="text-align: right"
-            >
-              <el-button
-                size="mini"
-                type="text"
-                @click="editTreeName(node.data)"
-              >
-                <i class="el-icon-edit"></i>
-              </el-button>
-            </el-col>
-            <el-col
-              v-if="
-                checkPermi(['standard:standardLibrary:delStandardTree']) &&
-                (node.data.children === null ||
-                  node.data.children === undefined)
-              "
-              :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>
-    </div>
-    <div class="right">
-      <el-row class="title" style="width: 100%">
-        <el-col :span="20" style="font-size: 14px; color: #999">{{
-          selectTree
-        }}</el-col>
-        <el-col :span="4">
-          <el-button
-            v-if="isShowCopy"
-            size="small"
-            style="position: absolute; right: 20px; top: 1px"
-            type="primary"
-            @click="openCopyDia"
-            >鎵归噺澶嶅埗</el-button
-          >
-        </el-col>
-      </el-row>
-      <el-row v-loading="tableLoad" class="standard_table">
-        <el-table
-          ref="standard"
-          :data="standardList"
-          class="el-table"
-          header-row-class-name="header-class"
-          height="220"
-          highlight-current-row
-          style="width: 100%; height: 220px !important"
-          tooltip-effect="dark"
-          @row-click="rowClick"
-        >
-          <el-table-column
-            label="鏍囧噯缂栧彿"
-            prop="code"
-            show-overflow-tooltip
-            width="200"
-          >
-            <template slot-scope="scope">
+                    </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>
+            </div>
+          </el-col>
+        </pane>
+        <!--鐢ㄦ埛鏁版嵁-->
+        <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>
+            <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>
+            </el-table>
+            <el-select v-if="checkPermi(['standard:standardLibrary:upStandardProduct'])" v-model="templateToBind" filterable placeholder="閫夋嫨鍘熷璁板綍妯℃澘" size="small" style="width:320px;margin-top:16px" @change="addBinding"><el-option v-for="template in templateList.filter(item => !templateBindings.some(binding => binding.templateId === item.id))" :key="template.id" :label="template.number ? template.number + ' - ' + template.name : template.name" :value="template.id" /></el-select>
+          </el-card>
+          <el-empty v-else description="璇烽�夋嫨浜岀骇鏍囧噯锛岀淮鎶ゅ叾鍘熷璁板綍妯℃澘" />
+          <div v-if="false">
+          <div class="search_form">
+            <div style="height:37px">
+              <p style="font-size: 14px; color: #999;margin-left: 10px">{{ selectTree }}</p>
+            </div>
+            <div class="options_button">
+              <el-input v-model="productKeyword" :disabled="!selected.isLeaf" clearable placeholder="鎼滅储妫�楠岄」/妫�楠岄」瀛愰」"
+                        size="small" style="width: 240px" suffix-icon="el-icon-search"
+                        @keyup.enter.native="searchProduct" @clear="searchProduct"></el-input>
+              <el-button v-if="isShowCopy" size="small" style="position: absolute; right: 20px; top: 1px" type="primary"
+                         @click="openCopyDia">鎵归噺澶嶅埗</el-button>
+            </div>
+          </div>
+          <el-col>
+            <el-row v-loading="tableLoad" class="standard_table">
+              <el-table ref="standard" :data="standardList" class="el-table" header-row-class-name="header-class" height="220"
+                        :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
+                        highlight-current-row style="width: 100%; height: 220px !important" tooltip-effect="dark"
+                        @row-click="rowClick">
+                <el-table-column label="鏍囧噯缂栧彿" prop="code" show-overflow-tooltip width="200">
+                  <template slot-scope="scope">
               <span style="color: red; font-size: 14px">{{
-                scope.row["code"]
-              }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="鏍囧噯鍚嶇О"
-            prop="name"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            label="澶囨敞"
-            prop="remark"
-            show-overflow-tooltip
-          ></el-table-column>
-        </el-table>
-      </el-row>
-      <el-row v-loading="tableLoad2" class="product_table">
-        <el-table
-          id="templateParamTable"
-          ref="productTable"
-          v-loading="productTableLoading"
-          :data="productList"
-          :fit="true"
-          :row-class-name="tableRowClassName"
-          border
-          class="productTable"
-          header-row-class-name="header-class"
-          height="100%"
-          row-key="id"
-          stripe
-          style="width: 100%"
-          tooltip-effect="dark"
-          @select="upProductSelect"
-          @selection-change="handleSelectionChange"
-          @select-all="handleAll"
-        >
-          <el-table-column type="selection" width="50"> </el-table-column>
-          <el-table-column
-            label="浜у搧"
-            min-width="100"
-            prop="sample"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            label="鍨嬪彿"
-            min-width="100"
-            prop="model"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            label="妫�楠岄」鍒嗙被"
-            min-width="140"
-            prop="inspectionItemClass"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            label="妫�楠岄」"
-            min-width="140"
-            prop="inspectionItem"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            label="妫�楠岄」瀛愰」"
-            min-width="140"
-            prop="inspectionItemSubclass"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            label="瀛愬疄楠屽"
-            prop="sonLaboratory"
-            show-overflow-tooltip
-            width="130"
-          ></el-table-column>
-          <el-table-column label="瑕佹眰鍊�" min-width="200px" prop="ask">
-            <template slot-scope="scope">
-              <el-input
-                v-if="
-                  checkPermi(['standard:standardLibrary:upStandardProduct'])
-                "
-                v-model="scope.row.ask"
-                :autosize="{ minRows: 1, maxRows: 3 }"
-                clearable
-                placeholder="瑕佹眰鍊�"
-                size="small"
-                type="textarea"
-                @change="(value) => upStandardProductList(value, scope.row.id)"
-              ></el-input>
-              <span v-else>{{ scope.row.ask }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="瑕佹眰鎻忚堪" min-width="220px" prop="tell">
-            <template slot-scope="scope">
-              <el-input
-                v-if="
-                  checkPermi(['standard:standardLibrary:upStandardProduct'])
-                "
-                v-model="scope.row.tell"
-                :autosize="{ minRows: 1, maxRows: 3 }"
-                clearable
-                placeholder="瑕佹眰鎻忚堪"
-                size="small"
-                type="textarea"
-                @change="
-                  (value) => upStandardProductListOfTell(value, scope.row.id)
-                "
-              ></el-input>
-              <span v-else>{{ scope.row.ask }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="璇曢獙鏂规硶" prop="method" width="200">
-            <template slot-scope="scope">
-              <el-select
-                v-if="
-                  checkPermi(['standard:standardLibrary:upStandardProduct'])
-                "
-                v-model="scope.row.methodS"
-                clearable
-                placeholder="璇曢獙鏂规硶"
-                size="small"
-                @change="
-                  (value) => upStandardProductListOfMethodS(value, scope.row.id)
-                "
-              >
-                <el-option
-                  v-for="(a, i) in scope.row.method &&
-                  JSON.parse(scope.row.method)"
-                  :key="i"
-                  :label="a"
-                  :value="a"
-                ></el-option>
-              </el-select>
-              <span v-else>{{ scope.row.methodS }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="鏉′欢"
-            min-width="140"
-            prop="radius"
-            show-overflow-tooltip
-          >
-            <template slot-scope="scope">
-              <el-select
-                v-if="
-                  checkPermi(['standard:standardLibrary:upStandardProduct'])
-                "
-                v-model="scope.row.radius"
-                clearable
-                placeholder="鏉′欢"
-                size="small"
-                @change="
-                  (value) => upStandardProductListOfRadius(value, scope.row.id)
-                "
-              >
-                <el-option
-                  v-for="(a, i) in scope.row.radiusList &&
-                  JSON.parse(scope.row.radiusList)"
-                  :key="i"
-                  :label="a"
-                  :value="a"
-                ></el-option>
-              </el-select>
-              <span v-else>{{ scope.row.radius }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="璁¢噺鍗曚綅"
-            prop="unit"
-            show-overflow-tooltip
-            width="100"
-          ></el-table-column>
-          <el-table-column label="鍗曚环(鍏�)" prop="price" width="120">
-            <template slot-scope="scope">
-              <el-input
-                v-if="
-                  checkPermi(['standard:standardLibrary:upStandardProduct'])
-                "
-                v-model="scope.row.price"
-                placeholder="鍗曚环(鍏�)"
-                size="small"
-                @change="
-                  (value) => upStandardProductListOfPrice(value, scope.row.id)
-                "
-              >
-              </el-input>
-              <span v-else>{{ scope.row.price }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="宸ユ椂绯绘暟" prop="manHour" width="120">
-            <template slot-scope="scope">
-              <el-input
-                v-if="
-                  checkPermi(['standard:standardLibrary:upStandardProduct'])
-                "
-                v-model="scope.row.manHour"
-                placeholder="鍗曚环(鍏�)"
-                size="small"
-                @change="
-                  (value) => upStandardProductListOfManHour(value, scope.row.id)
-                "
-              >
-              </el-input>
-              <span v-else>{{ scope.row.manHour }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="宸ユ椂鍒嗙粍"
-            prop="manHourGroup"
-            show-overflow-tooltip
-            width="100"
-          ></el-table-column>
-          <el-table-column label="妯℃澘" prop="templateId" width="200">
-            <template slot-scope="scope">
-              <el-select
-                v-model="scope.row.templateId"
-                :disabled="
-                  !checkPermi(['standard:standardLibrary:upStandardProduct'])
-                "
-                filterable
-                size="small"
-                @change="
-                  (value) =>
-                    upStandardProductListOfTemplate(value, scope.row.id)
-                "
-              >
-                <el-option
-                  v-for="(a, ai) in templateList"
-                  :key="ai"
-                  :label="a.name"
-                  :value="a.id"
-                ></el-option>
-              </el-select>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="鍖洪棿"
-            prop="section"
-            show-overflow-tooltip
-            width="120"
-          ></el-table-column>
-          <el-table-column label="鎿嶄綔" prop="section" width="160">
-            <template slot-scope="scope">
-              <el-button type="text" @click="sectionUp(scope.row)"
-                >鍖洪棿璁剧疆</el-button
-              >
-              <el-button
-                type="text"
-                @click="bindSupplierDensitySecond(scope.row)"
-                >缁戝畾鍘傚</el-button
-              >
-            </template>
-          </el-table-column>
-        </el-table>
-        <el-pagination
-          :current-page="currentPage"
-          :page-size="300"
-          :total="total"
-          layout="total, prev, pager, next, jumper"
-          style="position: absolute; right: 16px; bottom: 1px"
-          @current-change="handleCurrentChange"
-        >
-        </el-pagination>
-      </el-row>
-    </div>
+                  scope.row["code"]
+                }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="鏍囧噯鍚嶇О" prop="name" show-overflow-tooltip></el-table-column>
+                <el-table-column label="澶囨敞" prop="remark" show-overflow-tooltip></el-table-column>
+              </el-table>
+            </el-row>
+            <el-row v-loading="tableLoad2" class="product_table">
+              <el-table id="templateParamTable" ref="productTable" v-loading="productTableLoading" :data="productList"
+                        :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
+                        :fit="true" :row-class-name="tableRowClassName" class="productTable"
+                        header-row-class-name="header-class" height="100%" row-key="id" stripe style="width: 100%;height:calc(100% - 220px)"
+                        tooltip-effect="dark" @select="upProductSelect" @selection-change="handleSelectionChange"
+                        @select-all="handleAll">
+                <el-table-column type="selection" width="50"> </el-table-column>
+                <el-table-column label="浜у搧" min-width="100" prop="sample" show-overflow-tooltip></el-table-column>
+                <el-table-column label="鍨嬪彿" min-width="100" prop="model" show-overflow-tooltip></el-table-column>
+                <el-table-column label="妫�楠岄」鍒嗙被" min-width="140" prop="inspectionItemClass"
+                                 show-overflow-tooltip></el-table-column>
+                <el-table-column label="妫�楠岄」" min-width="140" prop="inspectionItem" show-overflow-tooltip></el-table-column>
+                <el-table-column label="妫�楠岄」瀛愰」" min-width="140" prop="inspectionItemSubclass"
+                                 show-overflow-tooltip></el-table-column>
+                <el-table-column label="瀛愬疄楠屽" prop="sonLaboratory" show-overflow-tooltip width="130"></el-table-column>
+                <el-table-column label="瑕佹眰鍊�" min-width="200px" prop="ask">
+                  <template slot-scope="scope">
+                    <el-input v-if="
+                checkPermi(['standard:standardLibrary:upStandardProduct'])
+              " v-model="scope.row.ask" :autosize="{ minRows: 1, maxRows: 3 }" clearable placeholder="瑕佹眰鍊�" size="small"
+                              type="textarea" @change="(value) => upStandardProductList(value, scope.row.id)"></el-input>
+                    <span v-else>{{ scope.row.ask }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="瑕佹眰鎻忚堪" min-width="220px" prop="tell">
+                  <template slot-scope="scope">
+                    <el-input v-if="
+                checkPermi(['standard:standardLibrary:upStandardProduct'])
+              " v-model="scope.row.tell" :autosize="{ minRows: 1, maxRows: 3 }" clearable placeholder="瑕佹眰鎻忚堪"
+                              size="small" type="textarea" @change="(value) => upStandardProductListOfTell(value, scope.row.id)
+                  "></el-input>
+                    <span v-else>{{ scope.row.ask }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="璇曢獙鏂规硶" prop="method" width="200">
+                  <template slot-scope="scope">
+                    <el-select v-if="
+                checkPermi(['standard:standardLibrary:upStandardProduct'])
+              " v-model="scope.row.methodS" clearable placeholder="璇曢獙鏂规硶" size="small" @change="(value) => upStandardProductListOfMethodS(value, scope.row.id)
+                ">
+                      <el-option v-for="(a, i) in scope.row.method &&
+                  JSON.parse(scope.row.method)" :key="i" :label="a" :value="a"></el-option>
+                    </el-select>
+                    <span v-else>{{ scope.row.methodS }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="鏉′欢" min-width="140" prop="radius" show-overflow-tooltip>
+                  <template slot-scope="scope">
+                    <el-select v-if="
+                checkPermi(['standard:standardLibrary:upStandardProduct'])
+              " v-model="scope.row.radius" clearable placeholder="鏉′欢" size="small" @change="(value) => upStandardProductListOfRadius(value, scope.row.id)
+                ">
+                      <el-option v-for="(a, i) in scope.row.radiusList &&
+                  JSON.parse(scope.row.radiusList)" :key="i" :label="a" :value="a"></el-option>
+                    </el-select>
+                    <span v-else>{{ scope.row.radius }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="璁¢噺鍗曚綅" prop="unit" show-overflow-tooltip width="100"></el-table-column>
+                <el-table-column label="鍗曚环(鍏�)" prop="price" width="120">
+                  <template slot-scope="scope">
+                    <el-input v-if="
+                checkPermi(['standard:standardLibrary:upStandardProduct'])
+              " v-model="scope.row.price" placeholder="鍗曚环(鍏�)" size="small" @change="(value) => upStandardProductListOfPrice(value, scope.row.id)
+                ">
+                    </el-input>
+                    <span v-else>{{ scope.row.price }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="宸ユ椂绯绘暟" prop="manHour" width="120">
+                  <template slot-scope="scope">
+                    <el-input v-if="
+                checkPermi(['standard:standardLibrary:upStandardProduct'])
+              " v-model="scope.row.manHour" placeholder="鍗曚环(鍏�)" size="small" @change="(value) => upStandardProductListOfManHour(value, scope.row.id)
+                ">
+                    </el-input>
+                    <span v-else>{{ scope.row.manHour }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="宸ユ椂鍒嗙粍" prop="manHourGroup" show-overflow-tooltip width="100"></el-table-column>
+                <el-table-column label="妯℃澘" prop="templateId" width="200">
+                  <template slot-scope="scope">
+                    <el-select v-model="scope.row.templateId" :disabled="!checkPermi(['standard:standardLibrary:upStandardProduct'])
+                " filterable size="small" @change="(value) =>
+                  upStandardProductListOfTemplate(value, scope.row.id)
+                  ">
+                      <el-option v-for="(a, ai) in templateList" :key="ai" :label="a.name" :value="a.id"></el-option>
+                    </el-select>
+                  </template>
+                </el-table-column>
+                <el-table-column label="鍖洪棿" prop="section" show-overflow-tooltip width="120"></el-table-column>
+                <el-table-column label="鎿嶄綔" prop="section" width="160">
+                  <template slot-scope="scope">
+                    <el-button type="text" @click="sectionUp(scope.row)" :disabled="!checkPermi(['standard:standardLibrary:upStandardProduct'])
+                ">鍖洪棿璁剧疆</el-button>
+                    <el-button type="text" :disabled="!checkPermi(['standard:standardLibrary:upStandardProduct'])
+                " @click="bindSupplierDensitySecond(scope.row)">缁戝畾鍘傚</el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+              <!-- <el-pagination :current-page="currentPage" :page-size="300" :total="total" layout="total"
+                style="position: absolute; right: 16px; bottom: 1px" @current-change="handleCurrentChange">
+              </el-pagination> -->
+              <p style="text-align: right;margin-right: 20px;color: #333;">鍏眥{ total }}鏉�</p>
+            </el-row>
+          </el-col>
+          </div>
+        </pane>
+      </splitpanes>
+    </el-row>
 
     <el-dialog :visible.sync="addDia" title="鍒嗙被娣诲姞" width="400px">
       <div class="body">
+        <el-row style="line-height: 30px">
+          <el-col :span="24" style="color: #999; font-size: 13px">
+            鏂板鍒帮細{{ selected.tree || '鏍圭洰褰�' }}
+          </el-col>
+        </el-row>
         <el-row style="line-height: 50px">
           <el-col :span="6" style="text-align: right">
-            <span class="required-span">* </span>鍨嬪彿锛�
+            <span class="required-span">* </span>鍚嶇О锛�
           </el-col>
           <el-col :offset="1" :span="16">
-            <el-input
-              v-model="addOb.model"
-              clearable
-              placeholder="璇疯緭鍏ュ瀷鍙�"
-              size="small"
-              @keyup.enter.native="addStandardTree"
-            ></el-input>
+            <el-input v-model="addOb.name" clearable placeholder="璇疯緭鍏ュ悕绉�" size="small"
+                      @keyup.enter.native="addStandardTree"></el-input>
           </el-col>
         </el-row>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="addDia = false">鍙� 娑�</el-button>
-        <el-button :loading="addLoad" type="primary" @click="addStandardTree"
-          >纭� 瀹�</el-button
-        >
+        <el-button :loading="addLoad" type="primary" @click="addStandardTree">纭� 瀹�</el-button>
       </span>
     </el-dialog>
     <el-dialog :visible.sync="updateDia" title="鍒嗙被淇敼" width="400px">
       <div class="body">
         <el-row style="line-height: 50px">
           <el-col :span="6" style="text-align: right">
-            <span class="required-span">* </span>鍨嬪彿锛�
+            <span class="required-span">* </span>鍚嶇О锛�
           </el-col>
           <el-col :offset="1" :span="16">
-            <el-input
-              v-model="addOb.model"
-              clearable
-              placeholder="璇疯緭鍏ュ瀷鍙�"
-              size="small"
-              @keyup.enter.native="updateStandardTree"
-            ></el-input>
+            <el-input v-model="addOb.name" clearable placeholder="璇疯緭鍏ュ悕绉�" size="small"
+                      @keyup.enter.native="updateStandardTree"></el-input>
           </el-col>
         </el-row>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="updateDia = false">鍙� 娑�</el-button>
-        <el-button
-          :loading="updateLoad"
-          type="primary"
-          @click="updateStandardTree"
-          >纭� 瀹�</el-button
-        >
+        <el-button :loading="updateLoad" type="primary" @click="updateStandardTree">纭� 瀹�</el-button>
       </span>
     </el-dialog>
-    <el-dialog
-      :close-on-click-modal="false"
-      :visible.sync="sectionUpDia"
-      title="鍖洪棿璁剧疆"
-      width="80%"
-    >
+    <el-dialog :close-on-click-modal="false" :visible.sync="sectionUpDia" title="鍖洪棿璁剧疆" width="80%">
       <div class="body" style="padding: 5px 0">
-        <el-table :data="sectionList" border height="350px" style="width: 100%">
+        <el-table :data="sectionList" border height="350px" style="width: 100%"
+                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }">
           <el-table-column align="center" label="搴忓彿" type="index" width="70">
           </el-table-column>
           <el-table-column align="center" label="鍖洪棿">
             <template slot-scope="scope">
-              <el-input
-                v-model="scope.row.thing"
-                clearable
-                placeholder="鍖洪棿"
-                size="small"
-              ></el-input>
+              <el-input v-model="scope.row.thing" clearable placeholder="鍖洪棿" size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column align="center" label="鑺暟">
             <template slot-scope="scope">
-              <el-input
-                v-model="scope.row.cores"
-                clearable
-                placeholder="鑺暟"
-                size="small"
-              ></el-input>
+              <el-input v-model="scope.row.cores" clearable placeholder="鑺暟" size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column align="center" label="瑕佹眰鍊�">
             <template slot-scope="scope">
-              <el-input
-                v-model="scope.row.ask"
-                clearable
-                placeholder="瑕佹眰鍊�"
-                size="small"
-              ></el-input>
+              <el-input v-model="scope.row.ask" clearable placeholder="瑕佹眰鍊�" size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column align="center" label="瑕佹眰鎻忚堪">
             <template slot-scope="scope">
-              <el-input
-                v-model="scope.row.tell"
-                :autosize="{ minRows: 1, maxRows: 2 }"
-                clearable
-                placeholder="瑕佹眰鎻忚堪"
-                size="small"
-                type="textarea"
-              ></el-input>
+              <el-input v-model="scope.row.tell" :autosize="{ minRows: 1, maxRows: 2 }" clearable placeholder="瑕佹眰鎻忚堪"
+                        size="small" type="textarea"></el-input>
             </template>
           </el-table-column>
           <el-table-column align="center" label="瀵间綋鏉愯川">
             <template slot-scope="scope">
-              <el-input
-                v-model="scope.row.conductorMaterial"
-                clearable
-                placeholder="瀵间綋鏉愯川"
-                size="small"
-              ></el-input>
+              <el-input v-model="scope.row.conductorMaterial" clearable placeholder="瀵间綋鏉愯川" size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column align="center" label="瀵间綋绫诲瀷">
             <template slot-scope="scope">
-              <el-input
-                v-model="scope.row.conductorType"
-                clearable
-                placeholder="瀵间綋绫诲瀷"
-                size="small"
-              ></el-input>
+              <el-input v-model="scope.row.conductorType" clearable placeholder="瀵间綋绫诲瀷" size="small"></el-input>
             </template>
           </el-table-column>
           <!--          <el-table-column align="center" label="鍗曚环" width="120">-->
@@ -733,74 +296,64 @@
           <!--          </el-table-column>-->
           <el-table-column align="center" label="鎿嶄綔" width="70">
             <template slot-scope="scope">
-              <el-button
-                circle
-                icon="el-icon-minus"
-                size="mini"
-                type="danger"
-                @click="sectionList.splice(scope.$index, 1)"
-              ></el-button>
+              <el-button circle icon="el-icon-minus" size="mini" type="danger"
+                         @click="sectionList.splice(scope.$index, 1)"></el-button>
             </template>
           </el-table-column>
         </el-table>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="sectionUpDia = false">鍙� 娑�</el-button>
-        <el-button :loading="sectionLoad" type="primary" @click="sectionLoadAdd"
-          >淇� 瀛�</el-button
-        >
-        <el-button
-          icon="el-icon-plus"
-          type="primary"
-          @click="sectionList.push({ thing: '' })"
-        ></el-button>
+        <el-button :loading="sectionLoad" type="primary" @click="sectionLoadAdd">淇� 瀛�</el-button>
+        <el-button icon="el-icon-plus" type="primary" @click="sectionList.push({ thing: '' })"></el-button>
       </span>
     </el-dialog>
-    <!-- <bindSupplierDensityDialogAsk v-if="bindSupplierDensityDialog"
-                               :bindSupplierDensityDialog="bindSupplierDensityDialog"
-                               :currentRow="currentSupplierDensityRow"
-                               @closeBindPartDialog="closeBindSupplierDensityDialog"></bindSupplierDensityDialogAsk> -->
-    <!-- <BatchCopy v-if="batchCopyDia" ref="BatchCopy" :selectTree1="selectTree"
-               :standardId="standardId" @refreshList="refreshList"></BatchCopy> -->
+    <bindSupplierDensityDialogAsk v-if="bindSupplierDensityDialog"
+                                  :bindSupplierDensityDialog="bindSupplierDensityDialog" :currentRow="currentSupplierDensityRow"
+                                  @closeBindPartDialog="closeBindSupplierDensityDialog">
+    </bindSupplierDensityDialogAsk>
+    <BatchCopy v-if="batchCopyDia" ref="BatchCopy" :selectTree1="selectTree" :standardId="standardId"
+               @refreshList="refreshList"></BatchCopy>
   </div>
 </template>
 
 <script>
 import Sortable from "sortablejs";
-import draggable from "vuedraggable";
 import {
-  updateTreeSort,
   resetTreeDragBatch,
   delStandardTree,
   selectStandardTreeList,
   obtainItemParameterList,
   selectTestObjectByName,
   selectStandardMethods,
-  addStandardMethodList,
   addStandardTree,
   updateStandardTree,
   selectsStandardMethodByFLSSM,
   upStandardProductList,
-  delStandardMethodByFLSSM,
-  delStandardProductByIds,
-  addStandardProduct,
   selectStandardProductListByMethodId,
   updateSection,
-  upStandardProducts,
   getStandardTemplate,
-  selectStandardProductByMethodId,
-  selectStandardProductEnumByMethodId,
-  resetTreeOfPrice,
-  resetTreeOfHour,
+  selectTemplateBindings,
+  saveTemplateBindings,
 } from "@/api/standard/standardLibrary";
-import { checkPermi } from "@/utils/permission"; // 鏉冮檺鍒ゆ柇鍑芥暟
-//   import bindSupplierDensityDialogAsk from "../do/a5-capacity-scope/bindSupplierDensityDialogAsk.vue";
-//   import BatchCopy from "../do/a5-capacity-scope/BatchCopy.vue";
+import bindSupplierDensityDialogAsk from "./components/bindSupplierDensityDialogAsk.vue";
+import BatchCopy from "./components/BatchCopy.vue";
+import {
+  isLeaf,
+  buildSelectTree,
+  getAncestorLabels,
+  dropLastLabel,
+} from "@/utils/standardTree";
+import { Splitpanes, Pane } from "splitpanes";
+import "splitpanes/dist/splitpanes.css";
+
 export default {
+  name: 'StandardLibrary',
   components: {
-    //   BatchCopy,
-    //   bindSupplierDensityDialogAsk,
-    draggable,
+    BatchCopy,
+    bindSupplierDensityDialogAsk,
+    Splitpanes,
+    Pane
   },
   dicts: ["sys_factory", "sys_sub_lab", "sys_samp_type"],
   data() {
@@ -812,13 +365,18 @@
       factory: [],
       addDia: false,
       updateDia: false, // 淇敼鏍戝悕瀛楀脊妗�
-      oldModel: "",
+      oldLabel: "",
+      editTree: "",
+      // 褰撳墠閫変腑鐨勮妭鐐癸細label / 瀹屾暣璺緞 / 鏄惁鍙跺瓙(鏍囧噯)
+      selected: {
+        label: "",
+        tree: "",
+        isLeaf: false,
+      },
+      // 妫�楠岄」鎼滅储鍏抽敭瀛楋紝璧板悗绔繃婊わ紙妫�楠岄」 + 妫�楠岄」瀛愰」锛�
+      productKeyword: "",
       addOb: {
-        factory: null,
-        laboratory: null,
-        sampleType: null,
-        sample: null,
-        model: null,
+        name: "",
       },
       laboratory: [],
       addLoad: false,
@@ -847,32 +405,22 @@
       sectionRow: null,
       sectionList: [],
       templateList: [],
+      templateBindings: [],
+      templateToBind: null,
       total: 0,
       currentPage: 1,
       standardId: 0,
-      total0: 0,
-      currentPage0: 1,
-      productList0: [],
       methodList: [],
-      productTableLoading0: false,
-      filters0: [],
-      filters1: [],
-      pages: 1,
-      inspectionItem: null,
-      inspectionItemSubclass: null,
-      sonLaboratory: null,
       token: null,
       fileList: [],
       uploading: false,
       isEquipment: true,
-      isHaveChildren: {},
       sortTable: null,
       currentSupplierDensityRow: {}, // 閫夋嫨闆朵欢缁戝畾鏈潯鏁版嵁鐨勪俊鎭�
       bindSupplierDensityDialog: false,
       isShowCopy: false,
       batchCopyDia: false,
       VUE_APP_BASE_API: process.env.VUE_APP_BASE_API,
-      moreSelects: [],
     };
   },
   mounted() {
@@ -882,6 +430,7 @@
     this.selectTestObjectByName();
     this.selectStandardMethods();
     this.selectEnumByCategoryForSonLaboratory();
+    this.selectEnumByCategoryForsampleType();
     this.getStandardTemplate();
     this.selectStandardMethodsSec();
     this.token = {
@@ -889,41 +438,18 @@
     };
   },
   methods: {
-    checkPermi,
-    // 淇敼鏈�瀛愮骇鍚嶅瓧
-    editTreeName(info) {
+    isLeaf,
+    // 鎵撳紑鏂板寮规锛氬湪褰撳墠閫変腑鑺傜偣涓嬫柊澧炲瓙绾э紙鏈�変腑鍒欐柊澧炴牴绾э級
+    openAddDia() {
+      this.addOb.name = "";
+      this.addDia = true;
+    },
+    // 淇敼鑺傜偣鍚嶅瓧
+    editTreeName(node) {
       this.updateDia = true;
-      this.oldModel = info.label;
-    },
-    // 鎷栨嫿鏃跺垽瀹氱洰鏍囪妭鐐硅兘鍚﹁鏀剧疆
-    // 'prev'銆�'inner' 鍜� 'next'锛屽墠銆佹彃鍏ャ�佸悗
-    allowDrop(draggingNode, dropNode, type) {
-      if (draggingNode.level !== 3) return;
-      if (draggingNode.data.level === dropNode.data.level) {
-        if (draggingNode.data.parentId === dropNode.data.parentId) {
-          return type === "prev" || type === "next";
-        } else {
-          return false;
-        }
-      } else {
-        // 涓嶅悓绾ц繘琛屽鐞�
-        return false;
-      }
-    },
-    // tree鎷栨嫿鎴愬姛瀹屾垚鏃惰Е鍙戠殑浜嬩欢
-    handleDrop(draggingNode, dropNode, dropType, ev) {
-      try {
-        this.treeLoad = true;
-        updateTreeSort(this.list).then((res) => {
-          if (res.code === 200) {
-            this.$message.success("鎿嶄綔鎴愬姛");
-          }
-          this.treeLoad = false;
-        });
-      } catch (e) {
-        this.treeLoad = false;
-        console.log("e----", e);
-      }
+      this.oldLabel = node.label;
+      this.editTree = buildSelectTree(node, "null");
+      this.addOb.name = node.label;
     },
     rowDrop(methodId) {
       const that = this;
@@ -963,23 +489,14 @@
         });
       }
     },
-    hasChildWithId(nodes, name) {
-      for (let node of nodes) {
-        const comName = node.label + node.code;
-        if (comName == name) {
-          //鍒ゆ柇閫掑綊缁撴潫鏉′欢
-          this.isHaveChildren = node;
-          return node;
-        } else if (node.children && node.children.length > 0) {
-          //鍒ゆ柇children鏄惁鏈夋暟鎹�
-          this.hasChildWithId(node.children, name); //閫掑綊璋冪敤
-        }
+    // 璋冪敤tree杩囨护鏂规硶 涓枃鑻辫繃婊�
+    filterNode (value, data, node) {
+      if (!value) {銆�銆�銆�銆�//濡傛灉鏁版嵁涓虹┖锛屽垯杩斿洖true,鏄剧ず鎵�鏈夌殑鏁版嵁椤�
+        return true
       }
-    },
-    filterNode(value, data) {
-      if (!value) return true;
       return data.label.indexOf(value) !== -1;
     },
+
     searchFilter() {
       this.$refs.tree.filter(this.search);
     },
@@ -987,40 +504,28 @@
       this.upIndex++;
     },
     handleNodeClick(val, node, el) {
-      //鏍戠殑鍊�
-      if (node.childNodes.length === 0) {
-        this.isShowCopy = true;
-      } else {
-        this.isShowCopy = false;
-      }
+      const leaf = isLeaf(val);
+      // 鍙跺瓙鑺傜偣鍗虫爣鍑嗭紝鎵嶆樉绀烘壒閲忓鍒躲�佹墠鏌ヨ妫�楠岄」
+      this.isShowCopy = leaf;
       this.total = 0;
       this.currentPage = 1;
-      this.selectTree = "";
-      this.getNodeParent(node);
-      this.selectTree = this.selectTree.replace(" - ", "");
-      let data = this.selectTree.split(" - ");
-      let data2 = "";
-      for (let index = data.length - 1; index >= 0; index--) {
-        data2 += " - " + data[index];
-      }
-      this.selectTree = data2.replace(" - ", "");
-      if (node.childNodes.length === 0) {
-        this.selectsStandardMethodByFLSSM();
-      }
-      let trees = this.selectTree.split(" - ");
-      this.addOb.factory = trees[0];
-      this.addOb.laboratory = trees[1];
-      this.addOb.sampleType = trees[2];
-      this.addOb.sample = trees[3];
-    },
-    getNodeParent(val) {
-      if (val.parent != null) {
-        if (val.data.children === null) {
-          this.selectTree += " - " + val.label + " - " + "null";
-        } else {
-          this.selectTree += " - " + val.label;
-        }
-        this.getNodeParent(val.parent);
+      this.selectTree = buildSelectTree(node, "null");
+      this.selected = {
+        id: val.id,
+        label: val.label,
+        tree: this.selectTree,
+        isLeaf: leaf,
+      };
+      // 鍒囨崲鑺傜偣鏃舵竻绌烘悳绱笌鍒楄〃锛涢潪鏍囧噯鑺傜偣杩樿娓呯┖ standardId锛岄伩鍏嶆悳绱㈡煡鍒颁笂涓�涓爣鍑�
+      this.productKeyword = "";
+      this.standardList = [];
+      this.productList = [];
+      if (leaf) {
+        this.loadTemplateBindings(val.id);
+      } else {
+        this.standardId = 0;
+        this.syncSortable();
+        this.templateBindings = [];
       }
     },
     remove(node, data) {
@@ -1028,27 +533,23 @@
         type: "error",
       })
         .then(() => {
-          // this.treeLoad = true
-          this.selectTree = "";
-          this.getNodeParent(node);
-          this.selectTree = this.selectTree.replace(" - ", "");
-          let data = this.selectTree.split(" - ");
-          let data2 = "";
-          for (let index = data.length - 1; index >= 0; index--) {
-            data2 += " - " + data[index];
-          }
-          this.selectTree = data2.replace(" - ", "");
-          delStandardTree({ tree: this.selectTree }).then((res) => {
-            if (res.code == 201) return;
+          const tree = buildSelectTree(node, "null");
+          delStandardTree({ tree }).then((res) => {
             this.$message.success("宸插垹闄�");
-            let arr = this.selectTree.split(" - ");
-            this.deleteStandard(this.list, arr[arr.length - 1]);
+            const labels = getAncestorLabels(node);
+            this.deleteStandard(this.list, labels[labels.length - 1]);
             this.selectTree = "";
+            this.selected = { label: "", tree: "", isLeaf: false };
             this.standardList = [];
             this.productList = [];
+            this.standardId = 0;
+            this.isShowCopy = false;
+            this.productKeyword = "";
+            this.total = 0;
+            this.syncSortable();
           });
         })
-        .catch((e) => {});
+        .catch((e) => { });
     },
     deleteStandard(arr, label) {
       arr.forEach((item, index) => {
@@ -1058,15 +559,6 @@
           item.children && this.deleteStandard(item.children, label);
         }
       });
-    },
-    nodeOpen(data, node, el) {
-      $($(el.$el).find(".node_i")[0]).attr(
-        "class",
-        "node_i el-icon-folder-opened"
-      );
-    },
-    nodeClose(data, node, el) {
-      $($(el.$el).find(".node_i")[0]).attr("class", "node_i el-icon-folder");
     },
     selectEnumByCategoryForFactory() {
       this.getConfigKey("sys_factory").then((response) => {
@@ -1094,6 +586,7 @@
       this.treeLoad = true;
       selectStandardTreeList().then((res) => {
         this.list = res.data;
+        this.expandedKeys = [];
         this.list.forEach((a) => {
           this.expandedKeys.push(a.label);
         });
@@ -1136,51 +629,23 @@
         this.standardEnum = data;
       });
     },
-    addStandardMethodList() {
-      if (this.standardId == null || this.standardId == "") {
-        this.$message.error("鏍囧噯鏂规硶鏈�夋嫨");
-        return;
-      }
-      this.addLoad2 = true;
-      addStandardMethodList({
-        standardId: this.standardId,
-        tree: this.selectTree,
-      }).then((res) => {
-        this.addLoad2 = false;
-        this.addStandardDia = false;
-        this.$message.success("娣诲姞鎴愬姛");
-        this.selectsStandardMethodByFLSSM();
-      });
-    },
-    // 鎻愪氦鍒嗙被娣诲姞
+    // 鎻愪氦鍒嗙被娣诲姞锛氬湪閫変腑鑺傜偣涓嬫柊澧炲瓙绾э紝鏈�変腑鍒欐柊澧炴牴绾�
     addStandardTree() {
-      if (this.addOb.sampleType == null || this.addOb.sampleType == "") {
-        this.$message.error("瀵硅薄涓嶅瓨鍦�");
-        return;
-      }
-      if (this.addOb.model == null || this.addOb.model == "") {
-        this.$message.error("璇峰~鍐欏瀷鍙�");
+      const name = (this.addOb.name || "").trim();
+      if (!name) {
+        this.$message.error("璇峰~鍐欏悕绉�");
         return;
       }
       this.addLoad = true;
-      addStandardTree(this.addOb)
+      addStandardTree({
+        parentTree: this.selected.tree || "",
+        name,
+      })
         .then((res) => {
-          if (res.code === 201) {
-            this.addLoad = false;
-            return;
-          }
           this.$message.success("娣诲姞鎴愬姛");
           this.addDia = false;
-          this.list
-            .find((a) => a.label == this.addOb.factory)
-            .children.find((a) => a.label == this.addOb.laboratory)
-            .children.find((a) => a.label == this.addOb.sampleType)
-            .children.find((a) => a.label == this.addOb.sample)
-            .children.push({
-              code: "[5]",
-              label: this.addOb.model,
-              value: this.addOb.model,
-            });
+          this.addOb.name = "";
+          this.selectStandardTreeList();
           this.addLoad = false;
         })
         .catch((e) => {
@@ -1188,27 +653,24 @@
           this.addLoad = false;
         });
     },
-    // 淇敼鍨嬪彿
+    // 淇敼鑺傜偣鍚嶅瓧
     updateStandardTree() {
-      if (this.addOb.sampleType == null || this.addOb.sampleType == "") {
-        this.$message.error("瀵硅薄涓嶅瓨鍦�");
+      const name = (this.addOb.name || "").trim();
+      if (!name) {
+        this.$message.error("璇峰~鍐欏悕绉�");
         return;
       }
-      if (this.addOb.model == null || this.addOb.model == "") {
-        this.$message.error("璇峰~鍐欏瀷鍙�");
-        return;
-      }
-      this.addOb.oldModel = this.oldModel;
       this.updateLoad = true;
-      updateStandardTree(this.addOb)
+      updateStandardTree({
+        parentTree: dropLastLabel(this.editTree),
+        oldLabel: this.oldLabel,
+        name,
+      })
         .then((res) => {
-          if (res.code === 201) {
-            this.updateLoad = false;
-            return;
-          }
-          this.$message.success("娣诲姞鎴愬姛");
-          this.selectStandardTreeList();
+          this.$message.success("淇敼鎴愬姛");
           this.updateDia = false;
+          this.addOb.name = "";
+          this.selectStandardTreeList();
           this.updateLoad = false;
         })
         .catch((e) => {
@@ -1222,12 +684,14 @@
         tree: this.selectTree,
       }).then((res) => {
         this.tableLoad = false;
-        this.standardList = res.data.standardMethodList;
-        if (this.standardList && this.standardList.length > 0) {
+        const data = res.data || {};
+        this.standardList = data.standardMethodList || [];
+        if (this.standardList.length > 0) {
           this.$refs.standard.setCurrentRow(this.standardList[0]);
           this.rowClick(this.standardList[0]);
         } else {
           this.productList = [];
+          this.syncSortable();
         }
       });
     },
@@ -1238,10 +702,6 @@
           ask: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -1252,10 +712,6 @@
           tell: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -1267,10 +723,6 @@
           methodS: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -1282,10 +734,6 @@
           radius: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -1296,10 +744,6 @@
           price: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -1310,10 +754,6 @@
           manHour: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -1324,30 +764,8 @@
           templateId: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
-    },
-    delStandardMethodByFLSSM(id) {
-      this.$confirm("鏄惁鍒犻櫎褰撳墠鏁版嵁?", "璀﹀憡", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning",
-      })
-        .then(() => {
-          this.tableLoad = true;
-          delStandardMethodByFLSSM({ id: id }).then((res) => {
-            if (res.code == 201) {
-              return;
-            }
-            this.$message.success("宸插垹闄�");
-            this.selectsStandardMethodByFLSSM();
-          });
-        })
-        .catch(() => {});
     },
     handleSelectionChange(val) {
       this.selects = [];
@@ -1355,57 +773,7 @@
         this.selects.push(a.id);
       });
     },
-    delStandardProductByIds() {
-      if (this.selects.length == 0) {
-        this.$message.error("鏈�変腑鏁版嵁");
-        return;
-      }
-      this.$confirm(
-        "鏄惁鍒犻櫎褰撳墠閫変腑 " + this.selects.length + " 鏉℃暟鎹�?",
-        "璀﹀憡",
-        {
-          confirmButtonText: "纭畾",
-          cancelButtonText: "鍙栨秷",
-          type: "warning",
-        }
-      )
-        .then(() => {
-          this.tableLoad = true;
-          delStandardProductByIds({
-            ids: JSON.stringify(this.selects),
-          }).then((res) => {
-            if (res.code == 201) {
-              return;
-            }
-            this.$message.success("宸插垹闄�");
-            this.selectsStandardMethodByFLSSM();
-          });
-        })
-        .catch(() => {});
-    },
-    addStandardProductDo() {
-      let selects = this.$refs.ValueTable.multipleSelection;
-      if (selects.length == 0) {
-        this.$message.error("鏈�夋嫨鏁版嵁");
-        return;
-      }
-      let select = [];
-      selects.forEach((a) => {
-        select.push(a.id);
-      });
-      this.tableLoad = true;
-      addStandardProduct({
-        ids: JSON.stringify(select),
-        tree: this.selectTree,
-      }).then((res) => {
-        if (res.code == 201) {
-          return;
-        }
-        this.$message.success("娣诲姞鎴愬姛");
-        this.selectsStandardMethodByFLSSM();
-      });
-      this.addProductDia = false;
-    },
+
     refreshList() {
       this.batchCopyDia = false;
       const index = this.standardList.findIndex(
@@ -1415,6 +783,22 @@
         this.rowClick(this.standardList[index]);
       }
     },
+    // 妫�楠岄」鎼滅储锛氳蛋鍚庣杩囨护锛堝尮閰嶆楠岄」 + 妫�楠岄」瀛愰」锛�
+    searchProduct() {
+      if (!this.selected.isLeaf || !this.standardId) return;
+      this.rowClick({ id: this.standardId });
+    },
+    // 鍙湁閫変腑鐨勬槸鏍囧噯(鍙跺瓙)銆佹湭鍦ㄦ悳绱㈣繃婊ょ姸鎬併�佷笖鍒楄〃闈炵┖鏃讹紝鎵嶅厑璁告嫋鎷芥帓搴�
+    syncSortable() {
+      if (this.sortTable) {
+        this.sortTable.destroy();
+        this.sortTable = null;
+      }
+      if (!this.selected.isLeaf || this.productKeyword || this.productList.length === 0) return;
+      this.$nextTick(() => {
+        this.rowDrop(this.standardId);
+      });
+    },
     rowClick(row, column, event) {
       this.currentPage = 1;
       this.tableLoad2 = true;
@@ -1423,40 +807,18 @@
         id: row.id,
         tree: this.selectTree,
         page: this.currentPage,
+        keyword: this.productKeyword,
       }).then((res) => {
-        this.productList = res.data.productList;
-        this.total = res.data.total;
+        const data = res.data || {};
+        this.productList = data.productList || [];
+        this.total = data.total || 0;
         setTimeout(() => {
           this.productList.forEach((a) => {
             if (a.state == 1) this.toggleSelection(a);
           });
         }, 300);
         this.tableLoad2 = false;
-        const tree = this.selectTree.split(" - ");
-        // 閫夋嫨鏈�鍚庝竴灞傛爲鎵嶅彲浠ユ嫋鎷芥帓搴�
-        if (tree.length === 4) {
-          const name = tree[3] + "[4]";
-          this.hasChildWithId(this.list, name);
-          if (
-            this.isHaveChildren.children &&
-            this.isHaveChildren.children.length > 0
-          ) {
-            if (this.sortTable) {
-              this.sortTable.destroy();
-              this.sortTable = null;
-            }
-            return;
-          }
-        } else if (tree.length < 4) {
-          if (this.sortTable) {
-            this.sortTable.destroy();
-            this.sortTable = null;
-          }
-          return;
-        }
-        this.$nextTick(() => {
-          this.rowDrop(row.id);
-        });
+        this.syncSortable();
       });
     },
     toggleSelection(row) {
@@ -1476,34 +838,8 @@
           state: row.state,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
-        // this.$message.success('宸蹭繚瀛�')
+        this.$message.success('宸蹭繚瀛�')
       });
-    },
-    filterHandler(value) {
-      for (let column in value) {
-        if (value[column].length === 0) {
-          if (column === "inspectionItem") {
-            this.inspectionItem = null;
-          } else if (column === "inspectionItemSubclass") {
-            this.inspectionItemSubclass = null;
-          } else if (column === "sonLaboratory") {
-            this.sonLaboratory = null;
-          }
-        } else {
-          if (column === "inspectionItem") {
-            this.inspectionItem = value[column][0];
-          } else if (column === "inspectionItemSubclass") {
-            this.inspectionItemSubclass = value[column][0];
-          } else if (column === "sonLaboratory") {
-            this.sonLaboratory = value[column][0];
-          }
-        }
-        this.getList();
-      }
     },
     handleAll(e) {
       if (e.length > 0) {
@@ -1615,56 +951,21 @@
         this.sectionRow.conductorType = JSON.stringify(conductorTypeList);
       }
       this.sectionLoad = true;
-      if (this.moreSelects.length === 0) {
-        updateSection({
-          str: JSON.stringify({
-            id: this.sectionRow.id,
-            section: this.sectionRow.section,
-            ask: this.sectionRow.ask,
-            tell: this.sectionRow.tell,
-            // price: this.sectionRow.price,
-            // manHour: this.sectionRow.manHour,
-            cores: this.sectionRow.cores,
-            conductorMaterial: this.sectionRow.conductorMaterial,
-            conductorType: this.sectionRow.conductorType,
-          }),
-        }).then((res) => {
-          this.sectionLoad = false;
-          if (res.code == 201) {
-            this.$message.error("鏈繚瀛�");
-            return;
-          }
-          this.$message.success("宸蹭繚瀛�");
-          this.sectionUpDia = false;
-        });
-      } else {
-        upStandardProducts({
-          ids: JSON.stringify(this.moreSelects.map((a) => a.id)),
-          standardProductList: {
-            section: this.sectionRow.section,
-            ask: this.sectionRow.ask,
-            tell: this.sectionRow.tell,
-            // price: this.sectionRow.price,
-            // manHour: this.sectionRow.manHour,
-            cores: this.sectionRow.cores,
-            conductorMaterial: this.sectionRow.conductorMaterial,
-            conductorType: this.sectionRow.conductorType,
-          },
-        }).then((res) => {
-          this.sectionLoad = false;
-          if (res.code == 201) {
-            this.$message.error("鏈繚瀛�");
-            return;
-          }
-          this.$message.success("宸蹭繚瀛�");
-          this.sectionUpDia = false;
-          this.currentPage0 = 1;
-          this.getList();
-          this.rowClick({
-            id: this.standardId,
-          });
-        });
-      }
+      updateSection({
+        str: JSON.stringify({
+          id: this.sectionRow.id,
+          section: this.sectionRow.section,
+          ask: this.sectionRow.ask,
+          tell: this.sectionRow.tell,
+          cores: this.sectionRow.cores,
+          conductorMaterial: this.sectionRow.conductorMaterial,
+          conductorType: this.sectionRow.conductorType,
+        }),
+      }).then((res) => {
+        this.sectionLoad = false;
+        this.$message.success("宸蹭繚瀛�");
+        this.sectionUpDia = false;
+      });
     },
     bindSupplierDensitySecond(row) {
       this.bindSupplierDensity(row);
@@ -1680,6 +981,35 @@
     getStandardTemplate() {
       getStandardTemplate().then((res) => {
         this.templateList = res.data;
+      });
+    },
+    loadTemplateBindings(standardTreeId) {
+      selectTemplateBindings({ standardTreeId }).then((res) => {
+        this.templateBindings = res.data || [];
+        this.templateToBind = null;
+      });
+    },
+    addBinding(templateId) {
+      const template = this.templateList.find((item) => item.id === templateId);
+      if (template && !this.templateBindings.some((item) => item.templateId === templateId)) {
+        this.templateBindings.push({ ...template, templateId, sort: this.templateBindings.length });
+      }
+      this.templateToBind = null;
+    },
+    removeBinding(index) {
+      this.templateBindings.splice(index, 1);
+    },
+    moveBinding(index, offset) {
+      const target = index + offset;
+      const item = this.templateBindings.splice(index, 1)[0];
+      this.templateBindings.splice(target, 0, item);
+    },
+    saveBindings() {
+      saveTemplateBindings({ standardTreeId: this.selected.id,
+        templates: this.templateBindings.map((item, index) => ({ templateId: item.templateId, sort: index }))
+      }).then(() => {
+        this.$message.success("妯℃澘缁戝畾宸蹭繚瀛�");
+        this.loadTemplateBindings(this.selected.id);
       });
     },
     handleCurrentChange(val) {
@@ -1717,81 +1047,91 @@
         this.methodList = data;
       });
     },
-    handleSelectAll0(rows) {
-      if (rows.length) {
-        rows.forEach((a) => {
-          if (!this.moreSelects.find((b) => a.id === b.id)) {
-            this.moreSelects.push(a);
-          }
-        });
-      } else {
-        this.productList0.forEach((a) => {
-          this.moreSelects = this.moreSelects.filter((b) => b.id != a.id);
-        });
-      }
-    },
-    handleSelectionChange0(val, row) {
-      if (this.moreSelects.find((a) => a.id === row.id)) {
-        this.moreSelects = this.moreSelects.filter((a) => a.id != row.id);
-      } else {
-        this.moreSelects.push(row);
-      }
-    },
-    getList() {
-      this.productTableLoading0 = true;
-      this.getItemEnum();
-      selectStandardProductByMethodId({
-        id: this.standardId,
-        tree: this.selectTree,
-        page: this.currentPage0,
-        laboratory: this.sonLaboratory,
-        items: this.inspectionItemSubclass,
-        item: this.inspectionItem,
-      }).then((res) => {
-        this.productList0 = res.data.records;
-        this.total0 = res.data.total;
-        this.productTableLoading0 = false;
-        this.page = res.data.pages;
-        this.$nextTick(() => {
-          this.productList0.forEach((a, i) => {
-            if (this.moreSelects.find((b) => a.id == b.id)) {
-              this.$refs.productTable0.toggleRowSelection(
-                this.productList0[i],
-                true
-              );
-            }
-          });
-        });
-      });
-    },
-    handleCurrentChange0(e) {
-      this.currentPage0 = e;
-      this.getList();
-    },
-    getItemEnum() {
-      selectStandardProductEnumByMethodId({
-        id: this.standardId,
-        tree: this.selectTree,
-        item: this.inspectionItem,
-      }).then((res) => {
-        this.filters0 = [];
-        this.filters1 = [];
-        res.data.item.forEach((a) => {
-          this.filters0.push({
-            text: a.inspectionItem,
-            value: a.inspectionItem,
-          });
-        });
-        res.data.items.forEach((a) => {
-          if (a != null) {
-            this.filters1.push({
-              text: a.inspectionItemSubclass,
-              value: a.inspectionItemSubclass,
-            });
-          }
-        });
-      });
-    },
   },
 };
 </script>
+
+<style scoped lang="scss">
+.search_form {
+  display: flex;
+  justify-content: space-between;
+
+  .options_button {
+    margin-top: 3px;
+    margin-right: 120px;
+    display: flex;
+    align-items: center;
+  }
+}
+
+.avatar-uploader ::v-deep .el-upload {
+  border: 1px dashed #666666;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+
+.avatar-uploader ::v-deep .el-upload:hover {
+  border-color: #409EFF;
+}
+
+.avatar-uploader-icon {
+  font-size: 20px;
+  color: #8c939d;
+  width: 90px;
+  height: 90px;
+  line-height: 90px;
+  text-align: center;
+}
+
+.avatar {
+  width: 90px;
+  height: 90px;
+  display: block;
+}
+
+.addButton {
+  display: flex;
+  align-items: flex-start;
+}
+.custom-tree-node {
+  width: 100%;
+  line-height: 32px;
+}
+.custom-tree-node .el-icon-delete {
+  color: #3a7bfa;
+  opacity: 0;
+  font-size: 18px;
+}
+
+.custom-tree-node:hover .el-icon-delete {
+  opacity: 1;
+}
+
+.custom-tree-node .el-icon-edit {
+  color: #3a7bfa;
+  opacity: 0;
+  font-size: 18px;
+}
+
+.custom-tree-node:hover .el-icon-edit {
+  opacity: 1;
+}
+
+.node_i {
+  color: orange;
+  font-size: 18px;
+}
+.product_table {
+  border-top: 1px solid #ebeef5;
+  height: calc(100vh - 398px);
+  margin-top: 5px;
+  background-color: white;
+  user-select: none;
+}
+
+.product_table .el-table {
+  height: calc(100% - 35px) !important;
+}
+</style>

--
Gitblit v1.9.3