zouyu
2025-03-19 45792b3776cda2e1ada31755ffc226a663f90b48
src/views/business/inspectionOrder/equip-config.vue
@@ -2,54 +2,152 @@
  <div class="ins_order_config">
    <div>
      <el-row class="title">
        <el-col :span="6" style="padding-left: 20px;text-align: left;">子样品配置</el-col>
        <el-col :span="18" style="text-align: right;">
          <el-button size="medium" type="primary" @click="addChild" v-if="active==1">添加子样品</el-button>
          <el-button size="medium" type="primary" @click="save" :loading="saveLoad" v-if="active==1">保 存</el-button>
        <el-col :span="6" style="padding-left: 20px; text-align: left"
          >子样品配置</el-col
        >
        <el-col :span="18" style="text-align: right">
          <el-button
            size="medium"
            type="primary"
            @click="addChild"
            v-if="active == 1"
            >添加子样品</el-button
          >
          <el-button
            size="medium"
            type="primary"
            @click="save"
            :loading="saveLoad"
            v-if="active == 1"
            >保 存</el-button
          >
          <el-button size="medium" @click="outConfig">
            <span style="color: #3A7BFA;">返 回</span>
            <span style="color: #3a7bfa">返 回</span>
          </el-button>
        </el-col>
      </el-row>
    </div>
    <div class="center">
      <el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" height="50%" tooltip-effect="dark"
        border highlight-current-row @row-click="rowClick" @current-change="selectSample">
        <!-- <el-table-column type="selection" width="60" :selectable="selectable" v-if="active==1"></el-table-column> -->
        <el-table-column type="index" label="序号" width="65" align="center"></el-table-column>
        <el-table-column prop="sample" label="样品名称" align="center" min-width="100">
      <el-table
        class="el-table sampleTable"
        ref="sampleTable"
        :data="sampleList"
        height="50%"
        tooltip-effect="dark"
        border
        highlight-current-row
        @row-click="rowClick"
        @current-change="selectSample"
      >
        <el-table-column
          type="index"
          label="序号"
          width="65"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="sample"
          label="样品名称"
          align="center"
          min-width="100"
        >
          <template slot-scope="scope">
            <el-input size="small" v-model="scope.row.sample" clearable :readonly="active>1"></el-input>
            <el-input
              size="small"
              v-model="scope.row.sample"
              clearable
              :readonly="active > 1"
            ></el-input>
          </template>
        </el-table-column>
        <el-table-column prop="sampleCode" label="样品编号" min-width="140" align="center">
        <el-table-column
          prop="sampleCode"
          label="样品编号"
          min-width="140"
          align="center"
        >
          <template slot-scope="scope">
            <el-input size="small" v-model="scope.row.sampleCode" clearable placeholder="不填写则系统自动生成"
              :readonly="active>1"></el-input>
            <el-input
              size="small"
              v-model="scope.row.sampleCode"
              clearable
              placeholder="不填写则系统自动生成"
              :readonly="active > 1"
            ></el-input>
          </template>
        </el-table-column>
        <el-table-column prop="model" label="样品型号" align="center" min-width="100">
        <el-table-column
          prop="model"
          label="样品型号"
          align="center"
          min-width="100"
        >
          <template slot-scope="scope">
            <el-select v-model="scope.row.model" filterable allow-create default-first-option placeholder="样品型号"
              size="small" @change="handleChangeModel" :disabled="active>1" style="width: 100%;">
              <el-option v-for="item in models" :key="item.value" :label="item.label" :value="item.value">
            <el-select
              v-model="scope.row.model"
              filterable
              allow-create
              default-first-option
              placeholder="样品型号"
              size="small"
              @change="handleChangeModel"
              :disabled="active > 1"
              style="width: 100%"
            >
              <el-option
                v-for="item in models"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column prop="modelNum" label="型号参数" width="130" align="center" v-if="!(active>1)">
        <el-table-column
          prop="modelNum"
          label="型号参数"
          width="130"
          align="center"
          v-if="!(active > 1)"
        >
          <template slot-scope="scope">
            <el-input size="small" v-model="scope.row.modelNum" clearable placeholder="非必填"
              @keyup.enter.native="methodChange(scope.row.standardMethodListId, scope.row)"
              @clear="methodChange(scope.row.standardMethodListId, scope.row)"></el-input>
            <el-input
              size="small"
              v-model="scope.row.modelNum"
              clearable
              placeholder="非必填"
              @keyup.enter.native="
                methodChange(scope.row.standardMethodListId, scope.row)
              "
              @clear="methodChange(scope.row.standardMethodListId, scope.row)"
            ></el-input>
          </template>
        </el-table-column>
        <el-table-column prop="standardMethodListId" label="检验标准" align="center" min-width="100">
        <el-table-column
          prop="standardMethodListId"
          label="检验标准"
          align="center"
          min-width="100"
        >
          <template slot-scope="scope">
            <el-select v-model="scope.row.standardMethodListId" :disabled="scope.row.model==null||active>1"
              placeholder="检验标准" size="small" :loading="methodLoad" @change="(value)=>methodChange(value, scope.row)"
              @focus="methodFocus" :readonly="active>1" style="width: 100%;">
              <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id">
            <el-select
              v-model="scope.row.standardMethodListId"
              :disabled="scope.row.model == null || active > 1"
              placeholder="检验标准"
              size="small"
              :loading="methodLoad"
              @change="(value) => methodChange(value, scope.row)"
              @focus="methodFocus"
              :readonly="active > 1"
              style="width: 100%"
            >
              <el-option
                v-for="item in methods"
                :key="item.id"
                :label="item.code"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </template>
@@ -58,59 +156,162 @@
        </el-table-column>
        <el-table-column label="操作" width="120">
          <template slot-scope="scope">
            <el-button @click.native.prevent="deleteRow(scope.$index, sampleList)" type="text"
              size="small">删除</el-button>
            <el-button
              @click.native.prevent="deleteRow(scope.$index, sampleList)"
              type="text"
              size="small"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-table class="el-table" ref="productTable" :data="productList" height="50%" tooltip-effect="dark" border
        @selection-change="selectProduct" style="margin-bottom: 10px;" @select="upProductSelect"
        :row-class-name="tableRowClassName" v-loading="getProductLoad" @select-all="handleAll">
        <el-table-column type="selection" width="65" :selectable="selectable" v-if="active==1"></el-table-column>
        <el-table-column prop="inspectionItem" label="检验项" min-width="140" show-overflow-tooltip></el-table-column>
        <el-table-column prop="inspectionItemSubclass" label="检验项子项" min-width="140"
          show-overflow-tooltip></el-table-column>
        <el-table-column prop="sonLaboratory" label="子实验室" min-width="130" show-overflow-tooltip :filters="filters"
          :filter-method="filterHandler"></el-table-column>
        <el-table-column prop="methodS" label="试验方法" min-width="120" show-overflow-tooltip>
      <el-table
        class="el-table"
        ref="productTable"
        :data="productList"
        height="50%"
        tooltip-effect="dark"
        border
        @selection-change="selectProduct"
        style="margin-bottom: 10px"
        @select="upProductSelect"
        :row-class-name="tableRowClassName"
        v-loading="getProductLoad"
        @select-all="handleAll"
      >
        <el-table-column
          type="selection"
          width="65"
          :selectable="selectable"
          v-if="active == 1"
        ></el-table-column>
        <el-table-column
          prop="inspectionItem"
          label="检验项"
          min-width="140"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column
          prop="inspectionItemSubclass"
          label="检验项子项"
          min-width="140"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column
          prop="sonLaboratory"
          label="子实验室"
          min-width="130"
          show-overflow-tooltip
          :filters="filters"
          :filter-method="filterHandler"
        ></el-table-column>
        <el-table-column
          prop="methodS"
          label="试验方法"
          min-width="120"
          show-overflow-tooltip
        >
        </el-table-column>
        <el-table-column prop="unit" label="计量单位" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column prop="price" label="单价" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column prop="section" label="区间" min-width="120" show-overflow-tooltip></el-table-column>
        <el-table-column
          prop="unit"
          label="计量单位"
          width="100"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column
          prop="price"
          label="单价"
          width="100"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column
          prop="section"
          label="区间"
          min-width="120"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column prop="ask" label="要求值" min-width="220px">
          <template slot-scope="scope">
            <el-input size="small" placeholder="要求值" v-model="scope.row.ask" clearable type="textarea"
              :autosize="{ minRows: 1, maxRows: 3}" @change="e=>requestChange(e,scope.row)"
              v-if="active==1&&isAskOnlyRead"></el-input>
            <el-input
              size="small"
              placeholder="要求值"
              v-model="scope.row.ask"
              clearable
              type="textarea"
              :autosize="{ minRows: 1, maxRows: 3 }"
              @change="(e) => requestChange(e, scope.row)"
              v-if="active == 1 && isAskOnlyRead"
            ></el-input>
            <span v-else>{{ scope.row.ask }}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-dialog title="选择子样品" :visible.sync="selectStandardTree" width="400px" @closed="addObj.sampleNum = 1">
      <div class="body" style="height: 60vh;overflow-y: auto;user-select: none;" v-if="selectStandardTree">
        <el-row style="margin-bottom: 10px;">
    <el-dialog
      title="选择子样品"
      :visible.sync="selectStandardTree"
      width="400px"
      @closed="addObj.sampleNum = 1"
    >
      <div
        class="body"
        style="height: 60vh; overflow-y: auto; user-select: none"
        v-if="selectStandardTree"
      >
        <el-row style="margin-bottom: 10px">
          <el-col :span="24">
            <label>样品数量:</label>
            <el-input-number v-model="addObj.sampleNum" :min="1" label="请输入数量" size="small"></el-input-number>
            <el-input-number
              v-model="addObj.sampleNum"
              :min="1"
              label="请输入数量"
              size="small"
            ></el-input-number>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-input placeholder="输入关键字进行搜索" suffix-icon="el-icon-search" v-model="search" size="small"
              style="margin-bottom: 5px;" clearable @blur="searchFilter" @clear="searchFilter"
              @keyup.enter.native="searchFilter"></el-input>
            <el-input
              placeholder="输入关键字进行搜索"
              suffix-icon="el-icon-search"
              v-model="search"
              size="small"
              style="margin-bottom: 5px"
              clearable
              @blur="searchFilter"
              @clear="searchFilter"
              @keyup.enter.native="searchFilter"
            ></el-input>
          </el-col>
        </el-row>
        <el-tree :data="list" ref="tree" :props="{ children: 'children', label: 'label' }" node-key="label"
          :filter-node-method="filterNode" @node-click="handleNodeClick" highlight-current @node-expand="nodeOpen"
          @node-collapse="nodeClose" :default-expanded-keys="expandedKeys" @dblclick.native="activeStandardTree">
        <el-tree
          :data="list"
          ref="tree"
          :props="{ children: 'children', label: 'label' }"
          node-key="label"
          :filter-node-method="filterNode"
          @node-click="handleNodeClick"
          highlight-current
          @node-expand="nodeOpen"
          @node-collapse="nodeClose"
          :default-expanded-keys="expandedKeys"
          @dblclick.native="activeStandardTree"
        >
          <div class="custom-tree-node" slot-scope="{ node, data }">
            <el-row>
              <el-col :span="24">
                <span><i
                    :class="`node_i ${data.children != undefined ? (data.code==='[1]'?'el-icon-folder-opened':'el-icon-folder') : 'el-icon-tickets'}`"></i>
                  {{ data.code }} {{ data.label }}</span>
                <span
                  ><i
                    :class="`node_i ${
                      data.children != undefined
                        ? data.code === '[1]'
                          ? 'el-icon-folder-opened'
                          : 'el-icon-folder'
                        : 'el-icon-tickets'
                    }`"
                  ></i>
                  {{ data.code }} {{ data.label }}</span
                >
              </el-col>
            </el-row>
          </div>
@@ -121,24 +322,42 @@
        <el-button type="primary" @click="activeStandardTree">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="检测到特殊项,请作出以下选择" :visible.sync="bsm1Dia" width="500px" :show-close="false"
      :before-close="beforeClose">
      <div class="body" style="max-height: 60vh;">
    <el-dialog
      title="检测到特殊项,请作出以下选择"
      :visible.sync="bsm1Dia"
      width="500px"
      :show-close="false"
      :before-close="beforeClose"
    >
      <div class="body" style="max-height: 60vh">
        <el-row v-if="bsm1">
          <el-col class="search_thing" :span="22">
            <div class="search_label"><span class="required-span">* </span>护套密度:</div>
            <div class="search_label">
              <span class="required-span">* </span>护套密度:
            </div>
            <div class="search_input">
              <el-radio-group v-model="bsm1Val" @input="upBsm1">
                <el-radio v-for="(a, ai) in JSON.parse(bsmRow.section)" :key="ai" :label="a"></el-radio>
                <el-radio
                  v-for="(a, ai) in JSON.parse(bsmRow.section)"
                  :key="ai"
                  :label="a"
                ></el-radio>
              </el-radio-group>
            </div>
          </el-col>
          <el-col class="search_thing" :span="22">
            <div class="search_label">要求值:</div>
            <div class="search_input" v-show="bsm1Val!==null&&bsm1Val!==''">
            <div
              class="search_input"
              v-show="bsm1Val !== null && bsm1Val !== ''"
            >
              <el-radio-group v-model="bsm1Val" @input="upBsm1">
                <el-radio v-for="(a, ai) in JSON.parse(bsmRow.section)" :key="ai"
                  :label="a">{{JSON.parse(bsmRow.ask)[ai]}}</el-radio>
                <el-radio
                  v-for="(a, ai) in JSON.parse(bsmRow.section)"
                  :key="ai"
                  :label="a"
                  >{{ JSON.parse(bsmRow.ask)[ai] }}</el-radio
                >
              </el-radio-group>
            </div>
          </el-col>
@@ -149,443 +368,504 @@
</template>
<script>
  export default {
    props: {
      active: {
        type: Number,
        default: () => 0
      },
import {
  getStandTreeBySampleType,
  selectStandardTreeList2,
  selectStandardMethodEnum,
  selectsStandardMethodByFLSSM,
  selectStandardProductList,
} from "@/api/standard/standardLibrary";
export default {
  props: {
    active: {
      type: Number,
      default: () => 0,
    },
    data() {
      return {
        saveLoad: false,
        sampleList: [],
        productList: [],
        getProductLoad: false,
        filters: [],
        sampleIds: [],
        isAskOnlyRead: false,
        selectStandardTree: false,
        search: '',
        expandedKeys: [],
        addObj: {
          sampleNum: 1,
        },
        selectTree: null,
        models: [],
        sample: {
          sampleCode: null,
          laboratory: null,
          factory: null,
          sampleType: null,
          sample: null,
          model: null,
          modelNum: null,
          sampleNum: 1,
          isLeave: 0,
          unit: null
        },
        currentMethod: null,
        methods: [],
        methodLoad: false,
        sampleId: null,
        bsmRow: null,
        bsm1: false,
        bsm1Val: null,
        bsm1Dia: false,
        list: [],
        parentSample: []
  },
  data() {
    return {
      saveLoad: false,
      sampleList: [],
      productList: [],
      getProductLoad: false,
      filters: [],
      sampleIds: [],
      isAskOnlyRead: false,
      selectStandardTree: false,
      search: "",
      expandedKeys: [],
      addObj: {
        sampleNum: 1,
      },
      selectTree: null,
      models: [],
      sample: {
        sampleCode: null,
        laboratory: null,
        factory: null,
        sampleType: null,
        sample: null,
        model: null,
        modelNum: null,
        sampleNum: 1,
        isLeave: 0,
        unit: null,
      },
      currentMethod: null,
      methods: [],
      methodLoad: false,
      sampleId: null,
      bsmRow: null,
      bsm1: false,
      bsm1Val: null,
      bsm1Dia: false,
      list: [],
      parentSample: [],
    };
  },
  mounted() {
    this.selectStandardTreeList();
    this.selectStandardMethods();
    this.$parent.sampleIds.forEach((a) => {
      for (var i = 0; i < this.$parent.sampleList.length; i++) {
        if (this.$parent.sampleList[i].id == a) {
          this.sampleList = this.$parent.sampleList[i].childSampleList;
          this.parentSample.push(this.$parent.sampleList[i]);
          break;
        }
      }
    });
  },
  methods: {
    selectStandardTreeList() {
      selectStandardTreeList()
        .then((res) => {
          if (res.code === 200) {
            this.list = res.data;
            this.list.forEach((a) => {
              this.expandedKeys.push(a.label);
            });
          }
        })
        .catch((error) => {
          console.error(error);
        });
    },
    save() {
      if (this.sampleList.length === 0) {
        this.$message.error("缺少配置无法保存");
        return;
      }
      this.parentSample.forEach((a) => {
        a.childSampleList = this.sampleList;
      });
      this.$message.success("已保存");
    },
    deleteRow(index, rows) {
      this.productList = [];
      rows.splice(index, 1);
    },
    outConfig() {
      this.$parent.equipConfigShow = false;
    },
    addChild() {
      this.selectStandardTree = true;
    },
    selectSample(val) {
      if (val === null) return;
      this.sampleIds = [val.id];
    },
    rowClick(row, column, event) {
      this.currentMethod = row;
      let obj = this.methods.find(
        (a) => a.id == this.currentMethod.standardMethodListId
      );
      if (obj && obj.code == "委托要求") {
        this.isAskOnlyRead = true;
      } else {
        this.isAskOnlyRead = false;
      }
      this.sampleId = row.id;
      if (this.active !== 1) {
        this.sampleIds = [];
        this.sampleIds.push(row.id);
      }
      this.productList = row.insProduct;
      setTimeout(() => {
        this.productList.forEach((a) => {
          if (a.state == 1) this.toggleSelection(a);
        });
      }, 200);
    },
    toggleSelection(row) {
      this.$refs.productTable.toggleRowSelection(row, true);
    },
    selectable() {
      if (this.active > 1) {
        return false;
      } else {
        return true;
      }
    },
    mounted() {
      this.selectStandardTreeList()
      this.selectStandardMethods()
      this.$parent.sampleIds.forEach(a => {
        for (var i = 0; i < this.$parent.sampleList.length; i++) {
          if (this.$parent.sampleList[i].id == a) {
            this.sampleList = this.$parent.sampleList[i].childSampleList
            this.parentSample.push(this.$parent.sampleList[i])
            break
          }
        }
      })
    handleChangeModel(e) {
      let num = this.selectTree.split("-").length;
      if (num != 5) {
        this.selectTree = this.selectTree + " - " + e;
      } else {
        let arr = this.selectTree.split("-");
        let arr0 = arr.slice(0, arr.length - 1);
        this.selectTree = arr0.join("-") + "- " + e;
      }
    },
    methods: {
      selectStandardTreeList() {
        this.$axios.get(this.$api.standardTree.selectStandardTreeList).then(res => {
          this.list = res.data
          this.list.forEach(a => {
            this.expandedKeys.push(a.label)
          })
        })
      },
      save() {
        if (this.sampleList.length === 0) {
          this.$message.error('缺少配置无法保存')
          return
        }
        this.parentSample.forEach(a => {
          a.childSampleList = this.sampleList
        })
        this.$message.success('已保存')
      },
      deleteRow(index, rows) {
        this.productList = []
        rows.splice(index, 1);
      },
      outConfig() {
        this.$parent.equipConfigShow = false
      },
      addChild() {
        this.selectStandardTree = true
      },
      selectSample(val) {
        if (val === null) return
        this.sampleIds = [val.id]
      },
      rowClick(row, column, event) {
        this.currentMethod = row
        let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
        if (obj && obj.code == '委托要求') {
          this.isAskOnlyRead = true
        } else {
          this.isAskOnlyRead = false
        }
        this.sampleId = row.id
        if (this.active !== 1) {
          this.sampleIds = []
          this.sampleIds.push(row.id)
        }
        this.productList = row.insProduct
        setTimeout(() => {
          this.productList.forEach(a => {
            if (a.state == 1) this.toggleSelection(a)
          })
        }, 200)
      },
      toggleSelection(row) {
        this.$refs.productTable.toggleRowSelection(row, true);
      },
      selectable() {
        if (this.active > 1) {
          return false
        } else {
          return true
        }
      },
      handleChangeModel(e) {
        let num = this.selectTree.split('-').length;
        if (num != 5) {
          this.selectTree = this.selectTree + ' - ' + e
        } else {
          let arr = this.selectTree.split('-')
          let arr0 = arr.slice(0, arr.length - 1)
          this.selectTree = arr0.join('-') + '- ' + e
        }
      },
      methodChange(val, row) {
        if (val === null || val === '') return
        this.currentMethod = row
        let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
        if (obj && obj.code == '委托要求') {
          this.isAskOnlyRead = true
        } else {
          this.isAskOnlyRead = false
        }
        this.getProductLoad = true
        this.$axios.post(this.$api.standardTree.selectStandardProductList, {
          model: row.model + '-' + row.modelNum,
          standardMethodListId: val,
          factory: this.selectTree,
        }, {
          headers: {
            'Content-Type': 'application/json'
    methodChange(val, row) {
      if (val === null || val === "") return;
      this.currentMethod = row;
      let obj = this.methods.find(
        (a) => a.id == this.currentMethod.standardMethodListId
      );
      if (obj && obj.code == "委托要求") {
        this.isAskOnlyRead = true;
      } else {
        this.isAskOnlyRead = false;
      }
      this.getProductLoad = true;
      selectStandardProductList({
        model: row.model + "-" + row.modelNum,
        standardMethodListId: val,
        factory: this.selectTree,
      })
        .then((res) => {
          if (res.code === 200) {
            res.data.forEach((a) => {
              a.state = 0;
            });
            row.insProduct = this.HaveJson(res.data);
            this.getProductLoad = false;
            this.productList = row.insProduct;
            this.$refs.sampleTable.setCurrentRow(row);
            setTimeout(() => {
              this.productList.forEach((a) => {
                if (a.state == 1) this.toggleSelection(a);
              });
            }, 200);
          }
        }).then(res => {
          res.data.forEach(a => {
            a.state = 0
          })
          row.insProduct = this.HaveJson(res.data)
          this.getProductLoad = false
          this.productList = row.insProduct
          this.$refs.sampleTable.setCurrentRow(row)
          setTimeout(() => {
            this.productList.forEach(a => {
              if (a.state == 1) this.toggleSelection(a)
            })
          }, 200)
        })
      },
      methodFocus() {
        this.selectsStandardMethodByFLSSM()
      },
      selectStandardMethods() {
        this.$axios.get(this.$api.standardTree.selectStandardMethodEnum).then(res => {
          this.methods = res.data
        .catch((error) => {
          console.error(error);
        });
    },
    methodFocus() {
      this.selectsStandardMethodByFLSSM();
    },
    selectStandardMethods() {
      selectStandardMethodEnum()
        .then((res) => {
          if (res.code === 200) {
            this.methods = res.data;
          }
        })
      },
      selectsStandardMethodByFLSSM() {
        this.methodLoad = true
        this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
          tree: this.selectTree
        }).then(res => {
          this.methodLoad = false
          try {
            if (res.data.standardMethodList.length == 0 && this.selectTree.split('-').length == 5) {
              let arr = this.selectTree.split('-')
              let arr0 = arr.slice(0, arr.length - 1)
              let selectTree = arr0.join('-').substring(0, arr0.join('-').length - 1)
              this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
                tree: selectTree
              }).then(ress => {
                this.methods = ress.data.standardMethodList
              })
            } else {
              this.methods = res.data.standardMethodList
        .catch((error) => {
          console.error(error);
        });
    },
    selectsStandardMethodByFLSSM() {
      this.methodLoad = true;
      selectsStandardMethodByFLSSM({
        tree: this.selectTree,
      })
        .then((res) => {
          if (res.code === 200) {
            this.methodLoad = false;
            try {
              if (
                res.data.standardMethodList.length == 0 &&
                this.selectTree.split("-").length == 5
              ) {
                let arr = this.selectTree.split("-");
                let arr0 = arr.slice(0, arr.length - 1);
                let selectTree = arr0
                  .join("-")
                  .substring(0, arr0.join("-").length - 1);
                selectsStandardMethodByFLSSM({
                  tree: selectTree,
                })
                  .then((res) => {
                    if (res.code === 200) {
                      this.methods = res.data.standardMethodList;
                    }
                  })
                  .catch((error) => {
                    console.error(error);
                  });
              } else {
                this.methods = res.data.standardMethodList;
              }
            } catch (e) {}
          }
        })
        .catch((error) => {
          console.error(error);
        });
    },
    selectProduct(val) {
      this.productIds = [];
      val.forEach((a) => {
        this.productIds.push(a.id);
      });
    },
    upProductSelect(selection, row) {
      row.state = row.state == 1 ? 0 : 1;
      if (
        row.bsm === "1" &&
        row.section !== "" &&
        row.section !== null &&
        row.state === 1
      ) {
        if (row.section.indexOf("[") > -1) {
          this.bsmRow = this.HaveJson(row);
        }
        this.bsm1 = true;
        this.bsm1Dia = true;
      } else if (
        row.bsm === "1" &&
        row.section !== "" &&
        row.section !== null &&
        row.state === 0
      ) {
        this.bsm1 = false;
      }
      this.sampleList.map((item) => {
        if (this.sampleIds.indexOf(item.id) > -1) {
          item.insProduct.map((m) => {
            if (m.id == row.id) {
              m.state = row.state;
            }
          } catch (e) {}
        })
      },
      selectProduct(val) {
        this.productIds = []
        val.forEach(a => {
          this.productIds.push(a.id)
        })
      },
      upProductSelect(selection, row) {
        row.state = row.state == 1 ? 0 : 1
        if (row.bsm === '1' && row.section !== '' && row.section !== null && row.state === 1) {
          if (row.section.indexOf('[') > -1) {
            this.bsmRow = this.HaveJson(row)
          }
          this.bsm1 = true
          this.bsm1Dia = true
        } else if (row.bsm === '1' && row.section !== '' && row.section !== null && row.state === 0) {
          this.bsm1 = false
            return m;
          });
        }
        this.sampleList.map(item => {
        return item;
      });
    },
    tableRowClassName({ row, rowIndex }) {
      if (row.state === 0) {
        return "warning-row";
      }
      return "";
    },
    handleAll(e) {
      if (e.length > 0) {
        this.productList.map((m) => {
          m.state = 1;
          return m;
        });
      } else {
        this.productList.map((m) => {
          m.state = 0;
          return m;
        });
      }
      this.productList.forEach((p) => {
        if (
          p.bsm === "1" &&
          p.section !== "" &&
          p.section !== null &&
          p.state === 1
        ) {
          if (p.section.indexOf("[") > -1) {
            this.bsmRow = this.HaveJson(p);
          }
          this.bsm1 = true;
          this.bsm1Dia = true;
        } else if (
          p.bsm === "1" &&
          p.section !== "" &&
          p.section !== null &&
          p.state === 0
        ) {
          this.bsm1 = false;
        }
      });
      if (e.length > 0) {
        this.sampleList.map((item) => {
          if (this.sampleIds.indexOf(item.id) > -1) {
            item.insProduct.map(m => {
              if (m.id == row.id) {
                m.state = row.state;
              }
            item.insProduct.map((m) => {
              m.state = 1;
              return m;
            })
            });
          }
          return item
        })
      },
      tableRowClassName({
        row,
        rowIndex
      }) {
        if (row.state === 0) {
          return 'warning-row';
        }
        return '';
      },
      handleAll(e) {
        if (e.length > 0) {
          this.productList.map(m => {
            m.state = 1
            return m
          })
        } else {
          this.productList.map(m => {
            m.state = 0
            return m
          })
        }
        this.productList.forEach(p => {
          if (p.bsm === '1' && p.section !== '' && p.section !== null && p.state === 1) {
            if (p.section.indexOf('[') > -1) {
              this.bsmRow = this.HaveJson(p)
            }
            this.bsm1 = true
            this.bsm1Dia = true
          } else if (p.bsm === '1' && p.section !== '' && p.section !== null && p.state === 0) {
            this.bsm1 = false
          }
        })
        if (e.length > 0) {
          this.sampleList.map(item => {
            if (this.sampleIds.indexOf(item.id) > -1) {
              item.insProduct.map(m => {
                m.state = 1
                return m;
              })
            }
            return item
          })
        } else {
          this.sampleList.map(item => {
            if (this.sampleIds.indexOf(item.id) > -1) {
              item.insProduct.map(m => {
                m.state = 0
                return m;
              })
            }
            return item
          })
        }
        this.$nextTick(() => {
          this.$refs.productTable.doLayout()
        })
      },
      filterHandler(value, row, column) {
        const property = column['property'];
        return row[property] === value;
      },
      requestChange(e, row) {
        this.sampleList.map(item => {
          return item;
        });
      } else {
        this.sampleList.map((item) => {
          if (this.sampleIds.indexOf(item.id) > -1) {
            item.insProduct.map(m => {
              if (m.id == row.id) {
                m.ask = e;
              }
            item.insProduct.map((m) => {
              m.state = 0;
              return m;
            })
            });
          }
          return item
        })
      },
      activeStandardTree() {
        let trees = this.selectTree.split(" - ")
        if (trees.length < 4) {
          this.$message.error('未选择子产品')
          return
          return item;
        });
      }
      this.$nextTick(() => {
        this.$refs.productTable.doLayout();
      });
    },
    filterHandler(value, row, column) {
      const property = column["property"];
      return row[property] === value;
    },
    requestChange(e, row) {
      this.sampleList.map((item) => {
        if (this.sampleIds.indexOf(item.id) > -1) {
          item.insProduct.map((m) => {
            if (m.id == row.id) {
              m.ask = e;
            }
            return m;
          });
        }
        this.addObj.factory = trees[0]
        this.addObj.laboratory = trees[1]
        this.addObj.sampleType = trees[2]
        if(trees[3]===''){
          this.addObj.sample = (trees[4] == undefined ? null : trees[4])
        }else if(trees[3]===undefined){
          this.addObj.sample = trees[2]
        }else{
          this.addObj.sample = trees[3]
        return item;
      });
    },
    activeStandardTree() {
      let trees = this.selectTree.split(" - ");
      if (trees.length < 4) {
        this.$message.error("未选择子产品");
        return;
      }
      this.addObj.factory = trees[0];
      this.addObj.laboratory = trees[1];
      this.addObj.sampleType = trees[2];
      if (trees[3] === "") {
        this.addObj.sample = trees[4] == undefined ? null : trees[4];
      } else if (trees[3] === undefined) {
        this.addObj.sample = trees[2];
      } else {
        this.addObj.sample = trees[3];
      }
      this.addObj.model = trees[4] == undefined ? null : trees[4];
      this.selectStandardTree = false;
      this.sample.joinName = null;
      this.sample.joinModel = null;
      this.sample.joinNum = 1;
      this.sample.sample = this.addObj.sample;
      this.sample.model = this.addObj.model;
      this.sample.unit = this.addObj.unit;
      this.sample.standardMethodListId = null;
      this.sample.insProduct = [];
      this.sample.id = this.count;
      this.sample.num = this.addObj.sampleNum;
      this.sampleList.push(this.HaveJson(this.sample));
      this.count++;
      this.$refs.sampleTable.doLayout();
    },
    searchFilter() {
      this.$refs.tree.filter(this.search);
    },
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    handleNodeClick(val, node, el) {
      this.selectTree = "";
      this.models = val.children;
      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(" - ", "");
    },
    getNodeParent(val) {
      if (val.parent != null) {
        if (val.data.children === null) {
          this.selectTree += " - " + val.label + " - " + "";
        } else {
          this.selectTree += " - " + val.label;
        }
        this.addObj.model = (trees[4] == undefined ? null : trees[4])
        this.selectStandardTree = false
        this.sample.joinName = null
        this.sample.joinModel = null
        this.sample.joinNum = 1
        this.sample.sample = this.addObj.sample
        this.sample.model = this.addObj.model
        this.sample.unit = this.addObj.unit
        this.sample.standardMethodListId = null
        this.sample.insProduct = []
        this.sample.id = this.count
        this.sample.num = this.addObj.sampleNum
        this.sampleList.push(this.HaveJson(this.sample))
        this.count++
        this.$refs.sampleTable.doLayout()
      },
      searchFilter() {
        this.$refs.tree.filter(this.search)
      },
      filterNode(value, data) {
        if (!value) return true;
        return data.label.indexOf(value) !== -1;
      },
      handleNodeClick(val, node, el) {
        this.selectTree = ''
        this.models = val.children
        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.getNodeParent(val.parent);
      }
    },
    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");
    },
    beforeClose(done) {
      if (this.bsm1) {
        if (this.bsm1Val === null || this.bsm1Val === "") {
          this.$message.error("特殊项目必须处理");
          return;
        }
        this.selectTree = data2.replace(' - ', '')
      },
      getNodeParent(val) {
        if (val.parent != null) {
          if (val.data.children === null) {
            this.selectTree += ' - ' + val.label + ' - ' + ''
          } else {
            this.selectTree += ' - ' + val.label
          }
          this.getNodeParent(val.parent)
      }
      done();
    },
    upBsm1(val) {
      let sections = JSON.parse(this.bsmRow.section);
      let asks = JSON.parse(this.bsmRow.ask);
      let tells = JSON.parse(this.bsmRow.tell);
      let manHours = JSON.parse(this.bsmRow.manHour);
      let prices = JSON.parse(this.bsmRow.price);
      for (var a in sections) {
        if (val === sections[a]) {
          this.productList.forEach((p) => {
            if (p.id === this.bsmRow.id) {
              p.section = sections[a];
              p.ask = asks[a];
              p.tell = tells[a];
              p.manHour = manHours[a];
              p.price = prices[a];
            }
          });
          break;
        }
      },
      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')
      },
      beforeClose(done) {
        if (this.bsm1) {
          if (this.bsm1Val === null || this.bsm1Val === '') {
            this.$message.error('特殊项目必须处理')
            return
          }
        }
        done()
      },
      upBsm1(val) {
        let sections = JSON.parse(this.bsmRow.section);
        let asks = JSON.parse(this.bsmRow.ask);
        let tells = JSON.parse(this.bsmRow.tell);
        let manHours = JSON.parse(this.bsmRow.manHour);
        let prices = JSON.parse(this.bsmRow.price);
        for (var a in sections) {
          if (val === sections[a]) {
            this.productList.forEach(p => {
              if (p.id === this.bsmRow.id) {
                p.section = sections[a]
                p.ask = asks[a]
                p.tell = tells[a]
                p.manHour = manHours[a]
                p.price = prices[a]
              }
            })
            break
          }
        }
      },
    }
  }
      }
    },
  },
};
</script>
<style scoped>
  .ins_order_config {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }
.ins_order_config {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
  .ins_order_config::-webkit-scrollbar {
    width: 0;
  }
.ins_order_config::-webkit-scrollbar {
  width: 0;
}
  .title {
    height: 60px;
    line-height: 60px;
  }
.title {
  height: 60px;
  line-height: 60px;
}
  .center {
    width: 100%;
    height: calc(100% - 60px);
  }
.center {
  width: 100%;
  height: calc(100% - 60px);
}
>>> .all-disabled .el-checkbox__input .el-checkbox__inner {
  background-color: #edf2fc;
  border-color: #dcdfe6;
  cursor: not-allowed;
}
  >>>.all-disabled .el-checkbox__input .el-checkbox__inner {
    background-color: #edf2fc;
    border-color: #dcdfe6;
    cursor: not-allowed;
  }
.node_i {
  color: orange;
  font-size: 18px;
}
  .node_i {
    color: orange;
    font-size: 18px;
  }
  .el-select-dropdown__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
.el-select-dropdown__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
</style>