licp
2024-10-14 ae8b90c76912a7796b7c23c78f1a59bac434457d
src/components/do/b1-ins-order/add.vue
@@ -154,10 +154,10 @@
          <el-button size="medium" type="primary" @click="openConfig" v-if="addObj.sampleType==='光缆'">光纤配置</el-button>
          <el-button size="medium" type="primary" @click="save" :loading="saveLoad" v-show="active==1">提交</el-button>
          <!-- 审核 -->
          <el-button size="medium" @click="upInsOrderOfState(2)" :loading="saveLoad" v-show="active==3"
          <el-button size="medium" @click="upInsOrderOfState(2)" :loading="saveLoad" v-show="active==3&&addObj.companyId"
            :disabled="saveLoad">不通过</el-button>
          <el-button size="medium" type="primary" @click="upInsOrderOfState(1)" :loading="saveLoad"
            v-show="active==3">通过</el-button>
            v-show="active==3&&addObj.companyId">通过</el-button>
          <el-button size="medium" @click="$parent.playOrder(0)">
            <span style="color: #3A7BFA;">返回</span>
          </el-button>
@@ -185,18 +185,13 @@
            <div class="search_label"><span class="required-span">* </span>制单人:</div>
            <div class="search_input">
              <el-input size="small" clearable disabled v-model="addObj.custom"></el-input>
              <!-- <el-input readonly size="small" v-model="addObj.custom">
                <template slot="append"><el-button slot="append" icon="el-icon-search" @click="selectUserDia = true"
                    :disabled="active>1"></el-button></template>
              </el-input> -->
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
            <div class="search_label"><span class="required-span">* </span>委托单位:</div>
            <div class="search_input">
              <!-- <el-input size="small" placeholder="←选择委托客户" clearable disabled v-model="addObj.company"></el-input> -->
              <el-input readonly size="small" v-model="addObj.company" placeholder="选择委托单位">
                <template slot="append"><el-button slot="append" icon="el-icon-search" @click="selectUserDia = true"
                <template slot="append"><el-button slot="append" icon="el-icon-search" @click="selectUserDia = true,createState=1"
                    :disabled="active>1"></el-button></template>
              </el-input>
            </div>
@@ -205,6 +200,14 @@
            <div class="search_label"><span class="required-span">* </span>联系方式:</div>
            <div class="search_input">
              <el-input size="small" placeholder="选择委托客户" clearable :readonly="active>1" v-model="addObj.phone"></el-input>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6" v-if="addObj.orderType=='C'">
            <div class="search_label"><span class="required-span">* </span>下单至:</div>
            <div class="search_input">
              <el-select size="small" style="width: 100%;" clearable v-model="addObj.departmentLimsId" :disabled="active>1" placeholder="部门">
                <el-option v-for="(a, ai) in deaprtEnum" :key="ai" :value="a.id" :label="a.name"></el-option>
              </el-select>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
@@ -246,14 +249,29 @@
            </div>
          </el-col> -->
          <el-col class="search_thing" :span="6">
            <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-select v-model="addObj.formType" size="small" :disabled="active>1" style="width: 100%;">
                <el-option v-for="(a,ai) in formType" :key="ai" :label="a.label" :value="a.value"></el-option>
              </el-select>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
          <el-col class="search_thing" :span="6" v-if="addObj.formType==='其他成品'">
            <div class="search_label">零件号:</div>
            <div class="search_input">
              <el-input size="small" :placeholder="active>1 ? '' : '请输入'" clearable v-model="addObj.partNo"
                        :readonly="active>1"></el-input>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6" v-if="addObj.formType!='其他成品'&&addObj.formType">
            <div class="search_label"><span class="required-span">* </span>通知至样机员:</div>
            <div class="search_input">
              <el-select v-model="addObj.issueUser" size="small" :disabled="active>1" style="width: 100%;">
                <el-option v-for="(a,ai) in personList" :key="ai" :label="a.label" :value="a.value"></el-option>
              </el-select>
            </div>
          </el-col>
          <!-- <el-col class="search_thing" :span="6">
            <div class="search_label">报告发送方式:</div>
            <div class="search_input">
              <el-radio-group v-model="addObj.send">
@@ -261,8 +279,8 @@
                <el-radio :label="0">其他</el-radio>
              </el-radio-group>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
          </el-col> -->
          <!-- <el-col class="search_thing" :span="6">
            <div class="search_label">样品处理方式:</div>
            <div class="search_input">
              <el-radio-group v-model="addObj.processing">
@@ -270,7 +288,7 @@
                <el-radio :label="1">实验室处理</el-radio>
              </el-radio-group>
            </div>
          </el-col>
          </el-col> -->
          <el-col class="search_thing" :span="6">
            <div class="search_label">工程名称:</div>
            <div class="search_input">
@@ -288,8 +306,12 @@
          <el-col class="search_thing" :span="6">
            <div class="search_label"><span class="required-span">* </span>生产单位:</div>
            <div class="search_input">
              <el-input size="small" placeholder="请输入" clearable v-model="addObj.production"
                :readonly="active>1"></el-input>
              <!-- <el-input size="small" placeholder="请输入" clearable v-model="addObj.production"
                :readonly="active>1"></el-input> -->
              <el-input size="small" v-model="addObj.production" placeholder="选择生产单位" :readonly="active>1">
                <template slot="append"><el-button slot="append" icon="el-icon-search" @click="selectUserDia = true,createState=2"
                    :disabled="active>1"></el-button></template>
              </el-input>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
@@ -299,7 +321,7 @@
                :readonly="active>1"></el-input>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
          <!-- <el-col class="search_thing" :span="6">
            <div class="search_label">是否留样:</div>
            <div class="search_input">
              <el-radio-group v-model="addObj.isLeave">
@@ -307,26 +329,69 @@
                <el-radio :label="1">留样</el-radio>
              </el-radio-group>
            </div>
          </el-col>
          </el-col> -->
          <el-col class="search_thing" :span="6">
            <div class="search_label" style="width: 175px;">是否涉及配套样品:</div>
            <div class="search_input" style="width: calc(100% - 175px);">
              <el-radio-group v-model="addObj.mating" @change="$refs.sampleTable.doLayout()">
              <el-radio-group v-model="addObj.mating" @change="$refs.sampleTable.doLayout()" :disabled="active>1">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
          <!-- <el-col class="search_thing" :span="6">
            <div class="search_label">OTC订单号:</div>
            <div class="search_input">
              <el-input size="small" :placeholder="active>1 ? '' : '请输入'" clearable v-model="addObj.otcCode" :readonly="active>1"></el-input>
            </div>
          </el-col>
          </el-col> -->
          <el-col class="search_thing" :span="6">
            <div class="search_label">委托人:</div>
            <div class="search_input">
              <el-input size="small" :placeholder="active>1 ? '' : '请输入'" clearable v-model="addObj.prepareUser" :readonly="active>1"></el-input>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
            <div class="search_label"><span class="required-span">* </span>约定时间:</div>
            <div class="search_input">
              <el-date-picker
                v-model="addObj.appointed"
                :disabled="active>1"
                type="date"
                placeholder="选择日期"
                size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
              </el-date-picker>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
            <div class="search_label"><span class="required-span">* </span>样机完成时间:</div>
            <div class="search_input">
              <el-date-picker
                v-model="addObj.issueTime"
                :disabled="active>1"
                type="date"
                placeholder="选择日期"
                size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
              </el-date-picker>
            </div>
          </el-col>
          <el-col class="search_thing upload" :span="4" style="align-items: flex-start;height: auto" v-if="active==1">
            <el-upload
            style="margin: 8px 0 0px 50px;"
              action="#"
              :auto-upload="false"
              accept='.jpg,.jpeg,.png,.gif,.docx,.xls,.xlsx,.pdf,.zip,.rar,.csv' :on-change="handleChangeUpload">
              <el-button size="small" type="primary">上传附件</el-button>
            </el-upload>
          </el-col>
          <el-col class="search_thing" :span="8">
            <div class="search_input" style="width: 100%;margin-left: 40px;">
              <el-radio-group v-model="ruleInfo.rule" @change="$refs.sampleTable.doLayout()" :disabled="active>1">
                <el-radio :label="1">不考虑不确定度</el-radio>
                <el-radio :label="2">考虑不确定度<el-input placeholder="" v-model="ruleInfo.num" style="width: 100px;margin-left: 10px;" size="mini" :disabled="active>1">
                <template slot="append">%</template>
              </el-input></el-radio>
              </el-radio-group>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6" style="align-items: flex-start;margin: 8px 0;">
@@ -359,16 +424,20 @@
          <div class="search_thing">
            <div class="search_label">检验标准:</div>
            <div class="search_input">
              <el-select v-model="standardMethodListId" :placeholder="active>1 ? '' : '请输入'" size="small" @focus="methodFocus"
                :loading="methodLoad" @change="changeStandardMethodListId">
              <el-select v-model="standardMethodListId" :placeholder="active>1 ? '' : '请输选择'" size="small" @focus="methodFocus"
                :loading="methodLoad" multiple @change="changeStandardMethodListId">
                <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
        </div>
        <el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" height="250px" tooltip-effect="dark"
          border @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;">
        <el-radio-group v-model="currentPage" v-if="active>1" size="small" style="margin-top: 20px;">
          <el-radio-button :label="0">样品</el-radio-button>
          <el-radio-button :label="1">附件</el-radio-button>
        </el-radio-group>
        <el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" max-height="400px" tooltip-effect="dark"
          border @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;" v-show="currentPage==0">
          <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">
@@ -376,7 +445,7 @@
              <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="100" align="center">
            <template slot-scope="scope">
              <el-input size="small" v-model="scope.row.sampleCode" clearable placeholder="不填写则系统自动生成"
                :readonly="active>1"></el-input>
@@ -391,18 +460,27 @@
              </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="型号参数" min-width="100" 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>
            </template>
          </el-table-column>
          <el-table-column prop="testRequirements" label="试验标准" align="center" min-width="100">
            <template slot-scope="scope">
              <el-select v-model="scope.row.testRequirements" :disabled="scope.row.model==null||active>1"
                placeholder="试验标准" size="small" :readonly="active>1" style="width: 100%;" clearable>
                <el-option v-for="item in standard" :key="item.id" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </template>
          </el-table-column>
          <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%;" clearable @clear="productList = []">
                @focus="methodFocus" :readonly="active>1" style="width: 100%;" clearable @clear="productList = []" multiple>
                <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id">
                </el-option>
              </el-select>
@@ -428,9 +506,9 @@
          </el-table-column>
          <el-table-column prop="proNum" label="待检项数量" width="105" align="center"></el-table-column>
        </el-table>
        <el-table class="el-table" ref="productTable" :data="productList" height="380px" tooltip-effect="dark" border
        <el-table class="el-table" ref="productTable" :data="productList" max-height="400px" tooltip-effect="dark" border
          @selection-change="selectProduct" style="margin-bottom: 10px;" @select="upProductSelect"
          :row-class-name="tableRowClassName" v-loading="getProductLoad" @select-all="handleAll">
          :row-class-name="tableRowClassName" v-loading="getProductLoad" @select-all="handleAll" v-show="currentPage==0">
          <el-table-column type="selection" width="65" :selectable="selectable" v-if="active==1"></el-table-column>
          <el-table-column prop="inspectionItemClass" v-if="PROJECT === '装备电缆'" label="检验项分类" min-width="140" show-overflow-tooltip></el-table-column>
          <el-table-column prop="inspectionItemClassEn" v-if="PROJECT === '装备电缆'" label="检验项分类(EN)" min-width="140" show-overflow-tooltip></el-table-column>
@@ -465,17 +543,17 @@
            <template slot-scope="scope">
              <el-input size="small" placeholder="要求描述" v-model="scope.row.tell" clearable type="textarea"
                :autosize="{ minRows: 1, maxRows: 3}" @change="e=>requestChange(e,scope.row,'tell')"
                v-if="active==1&&isAskOnlyRead"></el-input>
                v-if="active==1"></el-input>
              <span v-else>
                <template >{{ scope.row.tell }}</template>
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="ask" label="要求值" min-width="220px" v-if="isAskOnlyRead">
          <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,'ask')"
                v-if="active==1&&isAskOnlyRead"></el-input>
                v-if="active==1&&scope.row.inspectionValueType!='5'"></el-input>
              <span v-else>
                <!-- <template v-if="(scope.row.ask.indexOf('D')>-1
                ||scope.row.ask.indexOf('W')>-1
@@ -512,8 +590,16 @@
          <el-table-column prop="sonLaboratory" label="子实验室" min-width="130" show-overflow-tooltip :filters="filters"
            :filter-method="filterHandler"></el-table-column>
        </el-table>
        <ValueTable class="value-table" ref="fileList" :url="$api.insOrderPlan.getFileList"
        :componentData="componentData0"
        :delUrl="$api.insOrderPlan.delfile" style="height: 100%;margin-top: 16px;" v-show="currentPage==1"/>
      </div>
    </div>
    <p style="font-size: 12px;color: red;margin-top: 20px;margin-bottom: 20px;">双方承诺:<br/>
      1、委托方承诺提供的信息与样品的真实性;<br/>
      2、委托送样检验结果仅适用于收到的样品;<br/>
      3、试验过程导致的样品损坏、配件损坏、损耗,本测试场不承担赔偿责任;<br/>
      4、实验室承诺公正开展检测活动,并承诺保守在检测活动过程中所获知的保密信息。</p>
    <el-dialog title="选择单位" :visible.sync="selectUserDia" width="70%">
      <div class="body" style="height: 60vh;" v-if="selectUserDia">
        <ValueTable ref="ValueTable2" :url="$api.user.selectCustomPageList" :componentData="componentData2" />
@@ -523,7 +609,7 @@
        <el-button type="primary" @click="selectUser">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="选择样品" :visible.sync="selectStandardTree" width="400px">
    <el-dialog title="选择样品" :visible.sync="selectStandardTree" width="500px">
      <div class="body" style="height: 60vh;overflow-y: auto;user-select: none;" v-if="selectStandardTree">
        <el-row>
          <el-col :span="24">
@@ -563,7 +649,8 @@
        <el-button type="primary" @click="addTemplateDia" :loading="templateLoading">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="检验下发" :visible.sync="issuedDialogVisible" width="400px">
    <el-dialog title="检验下发" :visible.sync="issuedDialogVisible" width="400px" :close-on-click-modal="false"
    :close-on-press-escape="false" :show-close="false">
      <div class="body" style="max-height: 60vh;">
        <el-row>
          <el-col class="search_thing" :span="22">
@@ -596,7 +683,7 @@
      </div>
      <span slot="footer" class="dialog-footer">
        <el-row>
          <el-button @click="issuedDialogVisible=false">取 消</el-button>
          <el-button @click="issuedDialogVisible=false;$parent.playOrder(0)">取 消</el-button>
          <el-button type="primary" @click="submitForm2" :loading="upLoad">确 定</el-button>
        </el-row>
      </span>
@@ -619,7 +706,8 @@
        </el-row>
      </span>
    </el-dialog>
    <fiberOpticConfig :currentId="currentId" @saveFiberopticConfig="getTotal()" v-if="configShow" :active="active" />
    <fiberOpticConfig :currentId="currentId" @saveFiberopticConfig="getTotal()" v-if="configShow && examine==0" :active="active" :inspectionItemST='inspectionItemST' />
    <fiberOpticConfigTwo :currentId="currentId"  v-if="configShow && examine==1" :active="active" />
    <equipConfig :currentId="currentId" v-if="equipConfigShow" :active="active" />
    <cableConfig v-if="cableConfigShow" :active="active" />
<!--    单选特殊值处理框-->
@@ -758,7 +846,7 @@
               width="800px" :show-close="false">
      <el-table
      :data="editTable"
      style="width: 100%">
      style="width: 100%" height="80vh">
      <!-- inspectionItemList -->
      <el-table-column
          prop="inspectionItemList"
@@ -880,6 +968,15 @@
        <el-button type="primary" @click="spliceData">保存</el-button>
      </span>
    </el-dialog>
    <el-dialog title="单根垂直燃烧检测次数填写" :visible.sync="singleVerticalCombustionShow" width="900px"
               :close-on-click-modal="false" :close-on-press-escape="false"
               :before-close="beforeCirculateShowClose" :show-close="false">
      <div>111</div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cleanSpliceData">取消</el-button>
        <el-button type="primary" @click="spliceData">保存</el-button>
      </span>
    </el-dialog>
    <!-- 电力试验室---温升试验/热循环 -->
    <el-dialog :title="temperatureTitle" :visible.sync="temperatureShow"
               :close-on-click-modal="false" :close-on-press-escape="false"
@@ -899,25 +996,39 @@
        <el-button type="primary" @click="spliceTemperatureTest">保存</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="文件预览"
      :visible.sync="lookFileVisible"
      width="60%" fullscreen>
      <filePreview v-if="lookFileVisible" :fileUrl="currentFile.url"
      :currentFile="currentFile" style="max-height: 87vh;overflow-y: auto;"/>
    </el-dialog>
  </div>
</template>
<script>
import ValueTable from '../../tool/value-table.vue'
import fiberOpticConfig from './fiberoptic-config.vue'
import fiberOpticConfigTwo from './fiberoptic-config-two.vue'
import equipConfig from './equip-config.vue'
import cableConfig from './cable-config.vue'
import Vue from 'vue'
import {iuCharts} from "../../../util/echarts";
import filePreview from '../../tool/file-preview.vue'
export default {
    components: {
      ValueTable,
      fiberOpticConfig,
      fiberOpticConfigTwo,
      equipConfig,
      cableConfig
      cableConfig,
      filePreview
    },
    props: {
      examine: {
        type: Number,
        default: () => 0
      },
      active: {
        type: Number,
        default: () => 0
@@ -929,6 +1040,9 @@
    },
    data() {
      return {
        currentFile:{},
        lookFileVisible:false,
        inspectionItemST: null,
        sampleSelectionList: [],//样品表格选中数据
        editTable:[],
        template: null,
@@ -941,6 +1055,7 @@
          type: '0',
          code: null,
          appointed: null,
          issueTime:null,
          remark: null,
          otcCode: null,
          mating: 0,
@@ -963,7 +1078,10 @@
          production: null,
          productionEn: null,
          companyId: null,
          prepareUser:null
          prepareUser:null,
          departmentLimsId:null,
          departmentLims:null,
          partNo: null, // 零件号
        },
        sample: {
          sampleCode: null,
@@ -1066,7 +1184,7 @@
        RTS: '',
        totalArr: [],
        model: null,
        standardMethodListId: null,
        standardMethodListId: [],
        symbolList:[
        'RTS','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
        inspectionItem:null,
@@ -1078,6 +1196,7 @@
          entrustNum: '',
          entrustPoint: ''
        },
        singleVerticalCombustionShow: false,
        isBsm2Val2:false,
        opticalProject: [], // 温度循环弹框光纤项目列表
        opticalProjectList: [], // 温度循环弹框光纤项目选中的数组
@@ -1099,6 +1218,59 @@
        temId: '',
        sonLaboratoryList:[],
        selectiveEcho: [], // 检验下单的时候勾选检验项目,如果使用筛选提交显示检验项目为空 回显列表
        deaprtEnum:[],
        standard:[],
        createState:1,//1:选择委托单位,2:选择生产单位
        fileList:[],
        currentPage:0,//0:样品信息,1:附件
        componentData0: {
          entity: {
            insOrderId:''
          },
          isIndex: true,
          showSelect: false,
          select: false,
          sort: false,
          init:false,
          do: [
          {
                  id: 'handleDown',
                  font: '下载',
                  type: 'text',
                  method: 'handleDown'
               },
          {
                  id: '1',
                  font: '预览',
                  type: 'text',
                  method: 'lookFile',
               }
          ],
          isPage: false,
          linkEvent: {},
          tagField: {
            type:{
              select:[
                {
                  value: 1,
                  label: '图片'
                },
                {
                  value: 2,
                  label: '文件'
                }
              ]
            }
          },
          currentId: '',
          selectField: {},
          requiredAdd: [],
          requiredUp: []
        },
        ruleInfo:{
          rule:null,
          num:null,
        }
      }
    },
    watch: {
@@ -1123,6 +1295,25 @@
          }
        }
      },
      productListSelected: {
        deep: true,
        handler(val) {
          if(val.length>0){
            for(let i =0 ; i< val.length; i++){
              if(val[i].inspectionItem.includes('松套管')){
                this.inspectionItemST = 1
                break;
              }else{
                this.inspectionItemST = 0
              }
            }
          }else{
            this.inspectionItemST = 0
          }
          console.log('0000',this.inspectionItemST);
        }
      },
      sampleList: {
        deep: true,
        handler(val) {
@@ -1131,11 +1322,11 @@
      },
      'addObj.sample'(val) {
        this.model = null
        this.standardMethodListId = null
        this.standardMethodListId = []
      },
      'addObj.sampleNum'(val) {
        this.model = null
        this.standardMethodListId = null
        this.standardMethodListId = []
      }
    },
    mounted() {
@@ -1145,8 +1336,10 @@
      // this.selectInsOrderTemplate()
      this.getAuthorizedPerson();
      this.selectEnumByCategoryForUnit()
      this.selectEnumByCategoryForStandard()
      this.selectStandardMethods()
      this.selectEnumByCategoryForOrderType()
      this.selectDepartmentEnum()
      // this.selectEnumByCategoryForSonLaboratory()
      this.selectEnumByCategoryForSampleForm()
      if (this.active != 1) {
@@ -1158,8 +1351,19 @@
          this.addObj = {
            ...res.data.insOrder
          };
          if(this.addObj.rule){
            if(this.addObj.rule=='不考虑不确定度'){
              this.ruleInfo.rule = 1
            }else{
              this.ruleInfo.rule = 2
              this.ruleInfo.num = this.addObj.rule.split('-')[1]
            }
          }
          this.addObj.type = String(this.addObj.type)
          this.sampleList = this.HaveJson(res.data.sampleProduct);
          this.sampleList = this.HaveJson(res.data.sampleProduct)
          this.sampleList.forEach(m=>{
            m.standardMethodListId = JSON.parse(m.standardMethodListId)
          });
          this.getProNum()
          this.addObj.sampleNum = this.sampleList.length
          this.$nextTick(() => {
@@ -1170,19 +1374,54 @@
            }
          })
        })
        // 文件信息
        this.componentData0.entity.insOrderId = this.currentId
        this.$refs.fileList.selectList()
      }
    },
    methods: {
      lookFile(row){
        this.currentFile = row;
        if(row.type==1){
          this.currentFile.url = this.javaApi+'/img/'+row.fileUrl
        }else{
          this.currentFile.url = this.javaApi+'/word/'+row.fileUrl
        }
        this.lookFileVisible = true
      },
      handleDown(row){
        this.$axios.post(this.$api.insOrderPlan.downFile, {
          id: row.id,
        }).then(res => {
          if (res.code === 200) {
            let url = '';
            if(res.data.type==1){
              url = this.javaApi+'/img/'+res.data.fileUrl
              file.downloadIamge(url,row.fileName)
            }else{
              url = this.javaApi+'/word/'+res.data.fileUrl
              const link = document.createElement('a');
              link.href = url;
              link.download = row.fileName;
              link.click();
            }
          }
        }).catch(error => {
        })
      },
      handleChangeUpload(file, fileLists){
        this.fileList = fileLists
      },
      //特殊值填写处理
      inputValueHandler(row,index){
        if(row){
          const nextIndex = index+1
          console.log(nextIndex, this.editTable)
          for (let i = nextIndex; i < this.editTable.length; i++) {
            const element = this.editTable[i];
            if(element.model==row.model){
            if(element.model==row.model&&row.symbolItem==element.symbolItem){
              this.editTable[i].value = row.value
            }else{
              break;
            }
          }
        }
@@ -1479,14 +1718,23 @@
          this.$message.error('未选择数据')
          return
        }
        this.addObj.company = selects.company
        this.addObj.code = selects.code
        this.addObj.companyId = selects.id
        this.selectUserDia = false
        if(this.active==1){
          // TODO
          this.selectInsOrderTemplate()
        if(this.createState==1){
          this.addObj.company = selects.company
          this.addObj.code = selects.code
          this.addObj.companyId = selects.id
          if(this.active==1){
            this.selectInsOrderTemplate()
          }
        }else if(this.createState==2){
          this.addObj.production = selects.company
          // 如果选择的单位是没有对应的英文名称就用'/'代替
          if (!selects.companyEn) {
            this.addObj.productionEn = '/'
          } else {
            this.addObj.productionEn = selects.companyEn
          }
        }
        this.selectUserDia = false
      },
      containsValue(str) {
        if(str){
@@ -1541,56 +1789,64 @@
        return str.replace(find, value);
      },
      save() {
        if(this.addObj.orderType=='C'&&this.addObj.departmentLimsId){
          this.addObj.departmentLims = this.deaprtEnum.find(m=>m.id==this.addObj.departmentLimsId).name
        }else if(this.addObj.orderType&&this.addObj.orderType!='C'&&!this.addObj.departmentLimsId){
          this.addObj.departmentLims = '检测中心'
          this.addObj.departmentLimsId = this.deaprtEnum.find(m=>m.name=='检测中心').id
        }
        // else{
        //   this.$message.error('请选择检验类别')
        //   return
        // }
        if (!this.addObj.companyId) {
          this.$message.error('未选择客户单位')
          return
        }
        let noLaboratory = this.totalArr.filter(a => a.state == 1&&!a.sonLaboratory)
        if(noLaboratory.length>0){
          let str = ''
          noLaboratory.forEach((m,j)=>{
            str += j==noLaboratory.length-1?m.inspectionItem+'-'+m.inspectionItemSubclass:m.inspectionItem+'-'+m.inspectionItemSubclass+','
          })
          this.$message.error(str+'没有关联实验室室,请联系管理员')
          return
        }
        if (!this.addObj.type) {
          this.$message.error('未选择紧急程度')
        } else if (!this.addObj.formType) {
          this.$message.error('请输入来样方式')
          this.$message.error('请输入订单类型')
        } else if (!this.addObj.orderType) {
          this.$message.error('请选择检验类别')
        } else if (!this.addObj.production) {
          this.$message.error('请输入生产单位')
        } else if (!this.addObj.productionEn) {
          this.$message.error('请输入生产单位EN')
        }else if (!this.addObj.departmentLimsId) {
          this.$message.error('选择下单到哪个部门')
        } else if (this.sampleList.length < 1) {
          this.$message.error('请添加一个样品')
        } else if (!this.sampleList.every(m => m.sample)) {
          this.$message.error('请输入样品名称')
        } else if (!this.sampleList.every(m => m.model)) {
          this.$message.error('请输入样品型号')
        } else if (!this.sampleList.every(m => m.standardMethodListId)) {
        }else if (!this.addObj.appointed) {
          this.$message.error('请选择约定时间')
        }else if (!this.addObj.issueTime) {
          this.$message.error('请选择样机完成时间')
        } else if (!this.sampleList.every(m => m.standardMethodListId&&m.standardMethodListId.length>0)) {
          this.$message.error('请选择检验标准')
        } else {
          const select = this.selectTree.split(' - ')
          const productListSelected = this.productListSelected.some(item => item.inspectionItem === '温度循环')
          let isHaveBushing = ''
          this.sampleList.forEach(item => {
            if (!item.bushing || item.bushing.length === 0) {
              isHaveBushing = false
            }
          })
          console.log('isHaveBushing===', this.totalArr)
          // inspectionItem
          let spcialItem = this.totalArr.find(a => a.state == 1 && a.inspectionItem.includes('松套管'))
          // console.log('isHaveBushing===', isHaveBushing)
          if (productListSelected && select[2] === '光缆' && isHaveBushing === false) {
            this.$message.error('光缆温度循环项目必须进行光纤配置')
            this.$refs.sampleTable.setCurrentRow(this.currentMethod, true)
            this.rowClick(this.currentMethod)
            this.sampleIds = [this.currentMethod.id]
            this.openConfig()
            return
          }else if(spcialItem&& isHaveBushing === false){
            this.$message.error('松套管项目必须进行光纤配置')
            this.$refs.sampleTable.setCurrentRow(this.currentMethod, true)
            this.rowClick(this.currentMethod)
            this.sampleIds = [this.currentMethod.id]
            this.openConfig()
            return
          }
        } else if(this.addObj.formType&&this.addObj.formType!='其他成品'&&!this.addObj.issueUser){
          this.$message.error('请选择通知至样机员')
        }else{
          //校验检验项的要求值和要求描述,仅委托要求
          // if(this.active==1&&this.isAskOnlyRead){
          //   const isTrue = this.checkRequiredValueAndRemark(filterProductList)
          //   if(!isTrue){
          //     this.$message.error('检验项的要求值与要求描述不匹配, 请检查')
          //     return
          //   }
          // }
          let sampleList = this.HaveJson(this.sampleList)
          let projectNum = this.totalArr.filter(a => a.state == 1).length
          if(projectNum==0){
@@ -1614,6 +1870,112 @@
            this.saveMethod(sampleList)
          }
        }
      },
      /**
       * 校验委托要求的检验项的要求描述和要求值
       *
       */
      checkRequiredValueAndRemark(data){
        let isTrue = true
        try{
          data.forEach(ele=>{
            //判断(≤,≥,>,<,=)这几种情况
            //判断要求值中的数字是否包含在要求描述中
            if(['≤','≥','>','<','='].includes(ele.ask[0])){
              const askVal = ele.ask.substring(1,ele.ask.length)
              if(isNaN(askVal) || ele.tell.indexOf(askVal)<0){
                console.log(1111);
                isTrue = false
              }
            }
            //判断范围(10-25),要求值必须是-
            if(ele.ask.indexOf('-')>0 && ele.ask.length>1){
              //要求描述的~和要求值的-,等效
              let tell = ele.tell
              if(ele.tell.indexOf('~')>0 || ele.tell.indexOf('(') || ele.tell.indexOf(')')){
                tell = tell.replace('~','-')
                tell = tell.replace('(','(')
                tell = tell.replace(')',')')
              }
              const splits = ele.ask.split('-')
              //满足格式要求,并且两个都是数字
              if(splits.length==2 && !isNaN(splits[0]) && !isNaN(splits[1])){
                /**
                 * 判断情况
                 * 1.要求描述与要求描述相同
                 * 2.要求描述包含要求值
                 * 3.要求描述为3N-10N这种情况
                 * 4.要求描述为10±5这种情况
                 * 5.
                 */
                 let min = Math.min(...splits)
                 let max = Math.max(...splits)
                 if(min==max){
                  console.log(2222);
                  isTrue = false
                 }
                //要求描述中不包含±以及区间的数字,则返回false
                if(tell.indexOf('±')<0&&tell.indexOf('-')<0){
                  console.log(3333,ele);
                  console.log(3333333,tell,tell.indexOf('±')<0,tell.indexOf('-')<0);
                  isTrue = false
                }else if(ele.tell.indexOf('-')==0){
                  console.log(4444);
                  isTrue = false
                }else if(tell.indexOf('-')>0){
                  if(tell.indexOf('±')>0){
                    ////校验要求描述为(10-15)±5这种写法的情况
                    const num = tell.split('±')[1]
                    const startIndex = tell.indexOf('(')
                    const endIndex = tell.indexOf(')')
                    if(startIndex>-1 && endIndex>0 ){
                      const str = tell.substring(startIndex,endIndex)
                      if(str && str.indexOf('-')>0){
                        let strList = str.split('-')
                        const minNum = Number(strList[0]-num)
                        const maxNum = Number(strList[1]+num)
                        if(minNum>min || maxNum<max){
                          console.log(555555);
                          isTrue = false
                        }
                      }
                    }else{
                      //校验要求描述为10±5这种写法的情况
                      let splitNums = ele.tell.split('±')
                      if(splitNums.length<2){
                        console.log(66666);
                        isTrue = false
                      }else{
                        let minTell = Number(splitNums[0])-Number(splitNums[1])
                        let maxTell = Number(splitNums[0])+Number(splitNums[1])
                        if(minTell!=min || maxTell!=max){
                          console.log(7777777);
                          isTrue = false
                        }
                      }
                    }
                  }else{
                    const splitTells = tell.split('-')
                    if(splitTells[0].indexOf(min)<0 || splitTells[1].indexOf(max)<0){
                      console.log(88888888);
                      isTrue = false
                    }
                  }
                }
              }else{
                console.log(89999999);
                isTrue = false
              }
            }
            // else if(ele.ask.indexOf('&')>0 && ele.ask.length>1){
            //   //判断
            // }
          })
        }catch(error){
          console.log(error);
          isTrue = false
        }
        return isTrue
      },
      save0(){
        if(this.editTable.every(m=>m.value)){
@@ -1657,7 +2019,7 @@
                        }
                      }
                    }else{
                      this.$message.error('要求值为空,需要去标准库维护!')
                      // this.$message.error('要求值为空,需要去标准库维护!')
                    }
                  }
                  // arr.forEach(f => {
@@ -1829,9 +2191,41 @@
        }
      },
      saveMethod(sampleList){
        let isHaveAsk = this.totalArr.filter(a => (a.ask === null||a.ask=='')&&a.state==1)
        if (isHaveAsk.length > 0) {
          this.$message({
            type: 'error',
            message: '请填写要求值后再提交'
          })
          return false;
        }
        let isHaveTell = this.totalArr.filter(a => (a.tell == null||a.tell=='')&&a.state==1)
        if (isHaveTell.length > 0) {
          this.$message({
            type: 'error',
            message: '请填写要求描述后再提交'
          })
          return false;
        }
        if(this.ruleInfo.rule==1){
          this.addObj.rule = '不考虑不确定度'
        }else if(this.ruleInfo.rule==2){
          if(this.ruleInfo.rule==2&&(!this.ruleInfo.num||this.ruleInfo.num<0||this.ruleInfo.num==0)){
            this.$message({
              type: 'error',
              message: '请输入不确定度'
            })
            return;
          }
          this.addObj.rule = '考虑不确定度'+'-'+this.ruleInfo.num
        }
        this.saveLoad = true
        this.$axios.post(this.$api.insOrder.addInsOrder, {
          str: JSON.stringify({
        let fd = new FormData();
        this.fileList.forEach((item,index)=>{
            //文件信息中raw才是真的文件
            fd.append("files",item.raw);
        })
        fd.append("str",JSON.stringify({
            insOrder: this.addObj,
            list: JSON.stringify(sampleList.map(a => {
              if (this.PROJECT === '装备电缆') {
@@ -1854,7 +2248,12 @@
              return a
            })),
            pairing: JSON.stringify(this.bsm2Val2)
          })
          }));
        this.$axios.post(this.$api.insOrder.addInsOrder, fd,{
          headers: {
            'Content-Type': 'multipart/form-data'
          },
          noQs:true
        }).then(res => {
          this.saveLoad = false
          if (res.code == 201) return
@@ -1903,7 +2302,10 @@
              this.distributeData.appointed = ress.data
            })
            setTimeout(() => {
              this.issuedDialogVisible = true;
              // this.issuedDialogVisible = true;
              // this.$message.success('提交成功')
              this.upLoad = false
              this.$parent.playOrder(0)
            }, 1000)
          })
        } else {
@@ -1963,9 +2365,15 @@
        })
      },
      getProNum() {
        this.sampleSelectionList.forEach((m, i) => {
          Vue.set(this.sampleSelectionList[i], 'proNum', m.insProduct.filter(a => a.state == 1).length)
        })
        if (this.active != 1) {
          this.sampleList.forEach((m, i) => {
            Vue.set(this.sampleList[i], 'proNum', m.insProduct.filter(a => a.state == 1).length)
          })
        }else{
          this.sampleSelectionList.forEach((m, i) => {
            Vue.set(this.sampleSelectionList[i], 'proNum', m.insProduct.filter(a => a.state == 1).length)
          })
        }
        this.$refs.sampleTable.doLayout()
      },
      searchFilter() {
@@ -1981,7 +2389,23 @@
        this.selectTree = ''
        this.models = val.children
        this.getNodeParent(node)
        let flag = false
        if (node.level == 3) {
          if(node.data.children.length>0){
            node.data.children.forEach(a => {
              let key = Object.keys(a)
              if(!key.includes('level')) {
                flag = true
              }
            })
          }
        }
        this.selectTree = this.selectTree.replace(' - ', '')
        if(flag) {
          this.selectTree =  '-  - ' + this.selectTree
        }
        let data = this.selectTree.split(' - ')
        let data2 = ''
        for (let index = data.length - 1; index >= 0; index--) {
@@ -2020,7 +2444,7 @@
        this.addObj.factory = trees[0]
        this.addObj.laboratory = trees[1]
        this.addObj.sampleType = trees[2]
        if (trees[3] === undefined || trees[3] === '') {
        if (trees[3] === undefined || trees[3] === '' || trees[3] === '- ') {
          this.addObj.sample = trees[2]
        } else {
          this.addObj.sample = trees[3]
@@ -2035,7 +2459,7 @@
          this.sample.sample = this.addObj.sample
          this.sample.model = this.addObj.model
          this.sample.unit = this.addObj.unit
          this.sample.standardMethodListId = null
          this.sample.standardMethodListId = []
          this.sample.insProduct = []
          this.sample.id = this.count
          this.sample.childSampleList = []
@@ -2080,14 +2504,14 @@
          this.sample.sample = this.addObj.sample
          this.sample.model = this.addObj.model
          this.sample.unit = this.addObj.unit
          this.sample.standardMethodListId = null
          this.sample.standardMethodListId = []
          this.sample.insProduct = []
          this.sample.id = this.count
          this.sample.id = parseInt(i+1)
          this.sample.childSampleList = []
          this.sample.insulating = null
          this.sample.sheath = null
          this.sampleList.push(this.HaveJson(this.sample))
          this.count++
          // this.count++
        }
        this.computationalPairing(this.sampleList.length)
        this.bsm2Val2 = this.HaveJson(this.bsm2Val3)
@@ -2120,12 +2544,6 @@
      },
      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 = []
@@ -2168,6 +2586,7 @@
          row.bsm1 = false
        }else if(arr.length>0){
          try{
          row.bsmRow = this.HaveJson(row)
          let section = arr[0].section
          let arr0 = JSON.parse(row.section)
          let arr1 = JSON.parse(row.ask)
@@ -2235,6 +2654,13 @@
        } else if ((row.inspectionItem === '温升试验' || row.inspectionItem === '热循环') && row.state === 0) {
          this.temperatureShow = false;
        }
        // if (row.inspectionItem === '单根垂直燃烧' && select[2] === '光缆' && row.state === 1) {
        //   this.singleVerticalCombustionShow = true;
        //   return
        // } else if (row.inspectionItem === '单根垂直燃烧' && select[2] === '光缆' && row.state === 0) {
        //   this.singleVerticalCombustionShow = false;
        // }
        this.changeProductList0()
        this.currentMethod.insProduct = this.productList0
        this.getProNum()
@@ -2340,6 +2766,11 @@
        this.$axios.post(this.$api.insOrder.selectInsOrderTemplateById + '?id=' + e).then(res => {
          if (res.code == 201) return
          let obj = JSON.parse(res.data)
          console.log(obj);
          //制单人设置为当前登录用户
          let user = JSON.parse(localStorage.getItem('user'))
          obj.addObj.custom = user.name
          obj.addObj.userId = user.userId
          this.addObj = obj.addObj;
          this.sampleList = obj.sampleList;
          this.selectTree = obj.selectTree
@@ -2356,6 +2787,13 @@
          this.units = res.data
        })
      },
      selectEnumByCategoryForStandard() {
        this.$axios.post(this.$api.enums.selectEnumByCategory, {
          category: "试验标准"
        }).then(res => {
          this.standard = res.data
        })
      },
      selectEnumByCategoryForOrderType() {
        this.$axios.post(this.$api.enums.selectEnumByCategory, {
          category: "检验类别"
@@ -2368,7 +2806,7 @@
      },
      selectEnumByCategoryForSampleForm() {
        this.$axios.post(this.$api.enums.selectEnumByCategory, {
          category: "来样方式"
          category: "订单类型"
        }).then(res => {
          this.formType = res.data
          if (this.formType.length > 0) {
@@ -2377,31 +2815,25 @@
        })
      },
      methodChange(val, row) {
        if (val === null || val === '') return
        if (val === null || val === ''||val.length ==0) 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
        let selectTreeList = this.selectTree.split(" - ")
        this.addObj.model&&(selectTreeList[selectTreeList.length - 1] = this.addObj.model)
        this.$axios.post(this.$api.standardTree.selectStandardProductList, {
          model: (this.addObj.model?this.addObj.model:row.model) + '-' + row.modelNum,
          standardMethodListId: val,
          model: (this.addObj.model?this.addObj.model:row.model) + '-' + row.modelNum+';'+row.testRequirements,
          standardMethodListId: val.join(','),
          factory: selectTreeList.join(" - "),
        }, {
          headers: {
            'Content-Type': 'application/json'
          }
        }).then(res => {
          this.getProductLoad = false
          res.data.forEach(a => {
            a.state = 0
          })
          row.insProduct = this.HaveJson(res.data)
          this.getProductLoad = false
          this.productList = row.insProduct
          this.productList0 = JSON.parse(JSON.stringify(this.productList))
          this.$refs.sampleTable.setCurrentRow(row)
@@ -2410,6 +2842,8 @@
              if (a.state == 1) this.toggleSelection(a)
            })
          }, 200)
        }).catch(e => {
          this.getProductLoad = false
        })
        this.searchProject()
        this.searchTemList()
@@ -2460,17 +2894,27 @@
      },
      // 要求值变化时
      requestChange(e, row,type) {
        this.sampleList.map(item => {
          if (this.sampleIds.indexOf(item.id) > -1) {
            item.insProduct.map(m => {
              if (m.id == row.id) {
                m[type] = e;
        //this.currentMethod 当前样品id
        this.sampleList.forEach(item=>{
          if(item.id == this.currentMethod.id){
            item.insProduct.forEach(i=>{
              if(i.id == row.id){
                i[type] = e
              }
              return m;
            })
          }
          return item
        })
        // this.sampleList.map(item => {
        //   if (this.sampleIds.indexOf(item.id) > -1) {
        //     item.insProduct.map(m => {
        //       if (m.id == row.id) {
        //         m[type] = e;
        //       }
        //       return m;
        //     })
        //   }
        //   return item
        // })
      },
      selectStandardMethods() {
        this.$axios.get(this.$api.standardTree.selectStandardMethodEnum).then(res => {
@@ -2485,6 +2929,7 @@
        }
      },
      handleAll(e) {
        console.log(1111,this.bsm1DiaAll,this.bsm1Dia)
        // console.log('e---', e)
        if (e.length > 0) {
          this.productList.map(m => {
@@ -2633,6 +3078,7 @@
            this.$message.error('未选中样品')
            return
          }
          this.sampleIds = [this.sampleId]
          this.$axios.post(this.$api.insBushing.selectBushingBySampleId, {
            sampleId: this.sampleId
          }).then(res => {
@@ -2893,7 +3339,6 @@
      getTotal() {
        this.totalArr = []
        this.total = 0;
        // console.log(this.sampleList)
        this.sampleList.forEach(item => {
          if (item.insProduct && item.insProduct.length > 0) {
            item.insProduct.forEach(a => {
@@ -2986,6 +3431,11 @@
        if(this.sonLaboratoryList.length>0){
          this.distributeData.sonLaboratory = this.sonLaboratoryList[0].value
        }
      },
      selectDepartmentEnum(){
        this.$axios.get(this.$api.department.selectDepartmentLimsEnum).then(res=>{
          this.deaprtEnum = res.data.filter(item=>item.name === '质量部' || item.name === '检测中心')
        })
      }
    }
  }