spring
2025-02-20 037a7112a2bc9e38bb2f398ff5ca740ac01a8fb2
检验任务搬迁30%
已修改10个文件
已添加1个文件
6851 ■■■■ 文件已修改
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/business/inspectionTask.js 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/styles/index.scss 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/lims-table.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/value-table.vue 2531 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/excelFountion.js 358 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/inspectionTask/components/EditInspectionItem.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/inspectionTask/index.vue 316 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/inspectionTask/inspection.vue 3290 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/performance/manHour/workTimeConfig.vue 143 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json
@@ -45,6 +45,7 @@
    "file-saver": "2.0.5",
    "fuse.js": "6.4.3",
    "highlight.js": "9.18.5",
    "html2canvas": "^1.4.1",
    "js-beautify": "1.13.0",
    "js-cookie": "3.0.1",
    "jsencrypt": "3.0.0-rc.1",
src/api/business/inspectionTask.js
@@ -107,3 +107,165 @@
    params: query,
  });
}
// é™„件上传
export function uploadFile(data) {
  return request({
    url: "/insOrderPlan/uploadFile",
    method: "post",
    data: data,
  });
}
// æŸ¥è¯¢æ£€éªŒä»»åŠ¡
export function doInsOrder(query) {
  return request({
    url: "/insOrderPlan/doInsOrder",
    method: "get",
    params: query,
  });
}
// æŸ¥è¯¢æ˜¯å¦æœ‰éœ€è¦å¤šæ¬¡æ£€éªŒçš„电缆配置
export function getCableTag(query) {
  return request({
    url: "/insOrderPlan/getCableTag",
    method: "get",
    params: query,
  });
}
// æŸ¥çœ‹é‡å¤æ ‡è¯†
export function getRepetitionTag(query) {
  return request({
    url: "/insOrderPlan/getRepetitionTag",
    method: "get",
    params: query,
  });
}
// æŸ¥è¯¢æ˜¯å¦æœ‰éœ€è¦å¤šæ¬¡æ£€éªŒçš„电缆配置
export function getRawMaterialTag(query) {
  return request({
    url: "/insOrderPlan/getRawMaterialTag",
    method: "get",
    params: query,
  });
}
// æ•°é‡‡-数据采集
export function dataCollection(data) {
  return request({
    url: "/deviceScope/dataCollection",
    method: "post",
    data: data,
  });
}
// å¡«å†™æ¸©åº¦ä¸Žæ¹¿åº¦
export function write(data) {
  return request({
    url: "/insOrderPlan/write",
    method: "post",
    data: data,
  });
}
// èŽ·å–æ£€éªŒé¡¹ç›®å’Œæ¨¡æ¿å†…å®¹
export function getInsProduct(query) {
  return request({
    url: "/insOrderPlan/getInsProduct",
    method: "get",
    params: query,
  });
}
// åˆ‡æ¢å…‰çº¤-光纤带记录模版查询检验内容
export function getReportModel(query) {
  return request({
    url: "/insOrderPlan/getReportModel",
    method: "get",
    params: query,
  });
}
// åˆ¤æ–­è¯¥è®¾å¤‡æ˜¯å¦å¯ä»¥æ•°é‡‡
export function determineWhetherToCollectData(query) {
  return request({
    url: "/deviceScope/determineWhetherToCollectData",
    method: "get",
    params: query,
  });
}
// é€šè¿‡è®¾å¤‡åˆ†ç±»èŽ·å–è®¾å¤‡åˆ—è¡¨
export function search(query) {
  return request({
    url: "/deviceScope/search",
    method: "get",
    params: query,
  });
}
// å¤æ ¸æ£€éªŒä»»åŠ¡
export function verifyPlan(data) {
  return request({
    url: "/insOrderPlan/verifyPlan",
    method: "post",
    data: data,
  });
}
// æ ¡éªŒæ£€éªŒä»»åŠ¡æäº¤
export function checkSubmitPlan(data) {
  return request({
    url: "/insOrderPlan/checkSubmitPlan",
    method: "post",
    data: data,
  });
}
// æ£€éªŒä»»åŠ¡æäº¤
export function submitPlan(data) {
  return request({
    url: "/insOrderPlan/submitPlan",
    method: "post",
    data: data,
  });
}
// ä¿å­˜æ£€éªŒå†…容
export function saveInsContext(data) {
  return request({
    url: "/insOrderPlan/saveInsContext",
    method: "post",
    data: data,
  });
}
// é™„件下载
export function downFile(query) {
  return request({
    url: "/insOrderPlan/downFile",
    method: "get",
    params: query,
  });
}
// æŸ¥çœ‹æ£€éªŒå•下的附件列表
export function getFileList(query) {
  return request({
    url: "/insOrderPlan/getFileList",
    method: "get",
    params: query,
  });
}
// é™„件删除
export function delfile(query) {
  return request({
    url: "/insOrderPlan/delfile",
    method: "delete",
    params: query,
  });
}
src/assets/styles/index.scss
@@ -1,16 +1,17 @@
@import './variables.scss';
@import './mixin.scss';
@import './transition.scss';
@import './element-ui.scss';
@import './sidebar.scss';
@import './btn.scss';
@import "./variables.scss";
@import "./mixin.scss";
@import "./transition.scss";
@import "./element-ui.scss";
@import "./sidebar.scss";
@import "./btn.scss";
body {
  height: 100%;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
    Microsoft YaHei, Arial, sans-serif;
}
label {
@@ -104,7 +105,8 @@
  display: block;
  line-height: 32px;
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  color: #2c3e50;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
@@ -137,7 +139,7 @@
}
.text-center {
  text-align: center
  text-align: center;
}
.sub-navbar {
@@ -148,7 +150,13 @@
  text-align: right;
  padding-right: 20px;
  transition: 600ms ease position;
  background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%);
  background: linear-gradient(
    90deg,
    rgba(32, 182, 249, 1) 0%,
    rgba(32, 182, 249, 1) 0%,
    rgba(33, 120, 241, 1) 100%,
    rgba(33, 120, 241, 1) 100%
  );
  .subtitle {
    font-size: 20px;
@@ -183,3 +191,7 @@
    margin-bottom: 10px;
  }
}
.required-span {
  color: red;
}
src/components/Table/lims-table.vue
@@ -361,11 +361,10 @@
  },
  data() {
    return {
      spanInfo: {},
      spanList: [],
    };
  },
  created() {
  mounted() {
    this.calculateSpanInfo();
  },
  methods: {
src/components/Table/value-table.vue
@@ -1,320 +1,666 @@
<style scoped>
  .value-table {
    width: 100%;
    height: 100%;
    overflow-y: auto;
  }
.value-table {
  width: 100%;
  height: 100%;
  overflow-y: auto;
}
  .table {
    width: 100%;
    height: calc(100% - 42px);
  }
.table {
  width: 100%;
  height: calc(100% - 42px);
}
  .page {
    width: 100%;
    height: 30px;
    text-align: right;
    margin-top: 10px;
  }
.page {
  width: 100%;
  height: 30px;
  text-align: right;
  margin-top: 10px;
}
  .down-left {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
.down-left {
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
  .down-right {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
.down-right {
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
  .body {
    overflow-x: hidden;
  }
.body {
  overflow-x: hidden;
}
  .handleBtn {
    border: none;
    padding: 0;
    color: #409EFF;
    background: transparent;
  }
.handleBtn {
  border: none;
  padding: 0;
  color: #409eff;
  background: transparent;
}
  .handleBtn:hover {
    background: transparent;
  }
.handleBtn:hover {
  background: transparent;
}
  .handleBtn.is-disabled {
    color: #C0C4CC;
  }
  .red{
    color: red !important;
  }
  >>>.el-loading-parent--relative {
    z-index: 1 !important;
  }
  >>> .el-table__body-wrapper::-webkit-scrollbar {
    height: 14px; /* è®¾ç½®æ»šåŠ¨æ¡å®½åº¦ */
  }
.handleBtn.is-disabled {
  color: #c0c4cc;
}
.red {
  color: red !important;
}
>>> .el-loading-parent--relative {
  z-index: 1 !important;
}
>>> .el-table__body-wrapper::-webkit-scrollbar {
  height: 14px; /* è®¾ç½®æ»šåŠ¨æ¡å®½åº¦ */
}
</style>
<style>
  /* .value-table .highlight-warning-row-border td {
/* .value-table .highlight-warning-row-border td {
        border-top: 2px solid #ffcd29;
        border-bottom: 2px solid #ffcd29;
    } */
  .value-table .highlight-warning-row-border td:first-child {
    border-left: 4px solid #ffcd29;
  }
.value-table .highlight-warning-row-border td:first-child {
  border-left: 4px solid #ffcd29;
}
  .value-table .highlight-warning-row-border td:last-child {
    border-right: 4px solid #ffcd29;
  }
.value-table .highlight-warning-row-border td:last-child {
  border-right: 4px solid #ffcd29;
}
  /* .value-table .highlight-danger-row-border td {
/* .value-table .highlight-danger-row-border td {
        border-top: 2px solid red;
        border-bottom: 2px solid red;
    } */
  .value-table .highlight-danger-row-border td:first-child {
    border-left: 4px solid #f56c6c;
  }
.value-table .highlight-danger-row-border td:first-child {
  border-left: 4px solid #f56c6c;
}
  .value-table .highlight-danger-row-border td:last-child {
    border-right: 4px solid #f56c6c;
  }
.value-table .highlight-danger-row-border td:last-child {
  border-right: 4px solid #f56c6c;
}
  .value-table .el-upload {
    width: 100%;
  }
.value-table .el-upload {
  width: 100%;
}
  .value-table .el-upload-dragger {
    width: 100%;
  }
.value-table .el-upload-dragger {
  width: 100%;
}
  .value-table .handleBtn.is-disabled .el-upload:focus {
    color: #C0C4CC !important;
  }
.value-table .handleBtn.is-disabled .el-upload:focus {
  color: #c0c4cc !important;
}
  .value-table .avatar-uploader .el-upload {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .el-table__empty-text{
    text-align: left;
    width: 100%;
    display: inline-block;
    margin-left: 200px;
  }
.value-table .avatar-uploader .el-upload {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.el-table__empty-text {
  text-align: left;
  width: 100%;
  display: inline-block;
  margin-left: 200px;
}
</style>
<template>
  <div class="value-table">
    <div :style="data.isPage!=undefined&&data.isPage!=true?'height:100%':''" class="table">
      <el-table :key="specialKey" ref="eltable" v-loading="loading" :current-row-key="data.currentId" :data="tableData" :highlight-current-row="data.highlight===undefined||data.highlight"
        :row-class-name="tableRowClassName" :row-key="record=>record[rowKey]" :show-summary="data.countFleid!=undefined && data.countFleid.length > 0" :span-method="spanMethod"
    <div
      :style="
        data.isPage != undefined && data.isPage != true ? 'height:100%' : ''
      "
      class="table"
    >
      <el-table
        :key="specialKey"
        ref="eltable"
        v-loading="loading"
        :current-row-key="data.currentId"
        :data="tableData"
        :highlight-current-row="data.highlight === undefined || data.highlight"
        :row-class-name="tableRowClassName"
        :row-key="(record) => record[rowKey]"
        :show-summary="
          data.countFleid != undefined && data.countFleid.length > 0
        "
        :span-method="spanMethod"
        :summary-method="getSummaries"
        height="100%" style="width: 100%;" tooltip-effect="dark"
        @select="select" @selection-change="selectChange"
        @sort-change="sortChange" @row-click="rowClick">
        <el-table-column v-if="data.showSelect" :key="Math.random()" :width="selectionWidth" type="selection">
        height="100%"
        style="width: 100%"
        tooltip-effect="dark"
        @select="select"
        @selection-change="selectChange"
        @sort-change="sortChange"
        @row-click="rowClick"
      >
        <el-table-column
          v-if="data.showSelect"
          :key="Math.random()"
          :width="selectionWidth"
          type="selection"
        >
        </el-table-column>
        <el-table-column v-if="data.isIndex" :key="Math.random()" :width="selectionWidth" align="center" label="序号" type="index">
        <el-table-column
          v-if="data.isIndex"
          :key="Math.random()"
          :width="selectionWidth"
          align="center"
          label="序号"
          type="index"
        >
        </el-table-column>
        <el-table-column v-for="(a, ai) in tableHead" v-if="!data.headNoShow||(data.headNoShow&&data.headNoShow.length==0)||(data.headNoShow&&data.headNoShow.length>0&&!data.headNoShow.find(d=>d==a.label))" :key="ai+'bbbbb'" :isColumnWidth="isColumnWidth" :isShowZero="isShowZero"
          :label="a.value" :min-width="columnMinWidth" :prop="a.label" :sortable="a.sort === 'custom' ? 'custom' : false" show-overflow-tooltip>
        <el-table-column
          v-for="(a, ai) in tableHead"
          v-if="
            !data.headNoShow ||
            (data.headNoShow && data.headNoShow.length == 0) ||
            (data.headNoShow &&
              data.headNoShow.length > 0 &&
              !data.headNoShow.find((d) => d == a.label))
          "
          :key="ai + 'bbbbb'"
          :isColumnWidth="isColumnWidth"
          :isShowZero="isShowZero"
          :label="a.value"
          :min-width="columnMinWidth"
          :prop="a.label"
          :sortable="a.sort === 'custom' ? 'custom' : false"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <div v-if="showType(a.label, data.tagField) != null">
              <template v-if="typeof(scope.row[a.label]) == 'object'">
              <template v-if="typeof scope.row[a.label] == 'object'">
                <template v-for="(param, i) in scope.row[a.label]">
                  <el-tag v-for="(b, bi) in data.tagField[a.label].select" v-if="b.value == param" :key="bi+'cccc'"
                    :type="b.type" size="medium" style="margin-right: 5px;">{{b.label}}</el-tag>
                  <el-tag
                    v-for="(b, bi) in data.tagField[a.label].select"
                    v-if="b.value == param"
                    :key="bi + 'cccc'"
                    :type="b.type"
                    size="medium"
                    style="margin-right: 5px"
                    >{{ b.label }}</el-tag
                  >
                </template>
              </template>
              <template v-else>
                <el-tag v-for="(b, bi) in data.tagField[a.label].select" v-show="b.value == scope.row[a.label]" :key="bi+'ddddd'"
                  :type="b.type" size="medium">{{b.label}}</el-tag>
                <el-tag
                  v-for="(b, bi) in data.tagField[a.label].select"
                  v-show="b.value == scope.row[a.label]"
                  :key="bi + 'ddddd'"
                  :type="b.type"
                  size="medium"
                  >{{ b.label }}</el-tag
                >
              </template>
            </div>
            <!-- å¯æ“ä½œè¡Œè¿›è¡Œç‚¹å‡»äº‹ä»¶ -->
            <span v-else-if="data.linkEvent&&showLink(a.label, data.linkEvent)" style="color:#409EFF;cursor: pointer;"
              @click="handleLinkEvent(scope.row,data.linkEvent[a.label])">{{scope.row[a.label]}}</span>
            <img v-else-if="showUpload(a.label)&&scope.row[a.label]" :src="javaApi+'/img/'+scope.row[a.label]"
              alt="" style="width: 40px;height: 40px;margin-top: 10px;">
            <span v-else :class="{red:getRedColor(a.label,scope.row)}" >{{scope.row[a.label]}}</span>
            <span
              v-else-if="data.linkEvent && showLink(a.label, data.linkEvent)"
              style="color: #409eff; cursor: pointer"
              @click="handleLinkEvent(scope.row, data.linkEvent[a.label])"
              >{{ scope.row[a.label] }}</span
            >
            <img
              v-else-if="showUpload(a.label) && scope.row[a.label]"
              :src="javaApi + '/img/' + scope.row[a.label]"
              alt=""
              style="width: 40px; height: 40px; margin-top: 10px"
            />
            <span v-else :class="{ red: getRedColor(a.label, scope.row) }">{{
              scope.row[a.label]
            }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="data.do.length > 0" :width="getWidth()" align="center" fixed="right" label="操作">
        <el-table-column
          v-if="data.do.length > 0"
          :width="getWidth()"
          align="center"
          fixed="right"
          label="操作"
        >
          <template slot-scope="scope">
            <el-button v-for="(a, ai) in data.do" :key="ai
            +'qqqq'" :disabled="a.disabFun ? a.disabFun(scope.row,scope.$index) : false"
              :type="a.type" class="handleBtn"
              @click="main(scope.row, a)">
              <span v-if="a.type!='upload'">{{a.font}}</span>
              <el-upload v-else ref='upload'
                :accept='a.uploadConfig.accept' :action="javaApi+a.uploadConfig.url+'?id='+ (a.uploadConfig.uploadIdFun ? a.uploadConfig.uploadIdFun(scope.row) :  scope.row.id)"
                :disabled="a.disabFun ? a.disabFun(scope.row,scope.$index) : false" :headers="token" :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false"
                name="file" style="background: transparent;">
                <span>{{a.font}}</span>
            <el-button
              v-for="(a, ai) in data.do"
              :key="ai + 'qqqq'"
              :disabled="
                a.disabFun ? a.disabFun(scope.row, scope.$index) : false
              "
              :type="a.type"
              class="handleBtn"
              @click="main(scope.row, a)"
            >
              <span v-if="a.type != 'upload'">{{ a.font }}</span>
              <el-upload
                v-else
                ref="upload"
                :accept="a.uploadConfig.accept"
                :action="
                  javaApi +
                  a.uploadConfig.url +
                  '?id=' +
                  (a.uploadConfig.uploadIdFun
                    ? a.uploadConfig.uploadIdFun(scope.row)
                    : scope.row.id)
                "
                :disabled="
                  a.disabFun ? a.disabFun(scope.row, scope.$index) : false
                "
                :headers="token"
                :on-error="onError"
                :on-success="handleSuccessUp"
                :show-file-list="false"
                name="file"
                style="background: transparent"
              >
                <span>{{ a.font }}</span>
              </el-upload>
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div v-if="data.isPage==undefined||data.isPage" class="page">
      <el-pagination :current-page="page.current" :page-size="page.size" :page-sizes="[10, 20, 30, 50, 100]"
        :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="sizeChange"
        @current-change="currentChange">
    <div v-if="data.isPage == undefined || data.isPage" class="page">
      <el-pagination
        :current-page="page.current"
        :page-size="page.size"
        :page-sizes="[10, 20, 30, 50, 100]"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="sizeChange"
        @current-change="currentChange"
      >
      </el-pagination>
    </div>
    <el-dialog :close-on-click-modal="false" :visible.sync="upDia"
               :width="data.row==1?'500px':540+data.row * 200 + 'px'"
               append-to-body title="编辑">
      <div class="body" style="max-height: 600px;overflow-y: auto;padding: 5px 10px 5px 0;">
    <el-dialog
      :close-on-click-modal="false"
      :visible.sync="upDia"
      :width="data.row == 1 ? '500px' : 540 + data.row * 200 + 'px'"
      append-to-body
      title="编辑"
    >
      <div
        class="body"
        style="max-height: 600px; overflow-y: auto; padding: 5px 10px 5px 0"
      >
        <div v-if="data.row > 1">
          <div v-for="(a, ai) in upHead" :key="ai+'ffff'" style="line-height: 50px;">
            <el-col :offset="1" :span="6/data.row" style="text-align: right;">
              <span v-if="showUpReq(a.label)" class="required-span">* </span>{{a.value}}:
          <div
            v-for="(a, ai) in upHead"
            :key="ai + 'ffff'"
            style="line-height: 50px"
          >
            <el-col :offset="1" :span="6 / data.row" style="text-align: right">
              <span v-if="showUpReq(a.label)" class="required-span">* </span
              >{{ a.value }}:
            </el-col>
            <el-col :span="16/data.row">
              <el-input v-if="showType(a.label, data.selectField) == null&&!showUpload(a.label)&&!showCascader(a.label)" v-model="upData[a.label]" :disabled="isDisabled(a.label)" :placeholder="`请输入${a.value}`"
            <el-col :span="16 / data.row">
              <el-input
                v-if="
                  showType(a.label, data.selectField) == null &&
                  !showUpload(a.label) &&
                  !showCascader(a.label)
                "
                v-model="upData[a.label]"
                :disabled="isDisabled(a.label)"
                :placeholder="`请输入${a.value}`"
                clearable
                size="small"></el-input>
              <el-select v-if="showType(a.label, data.selectField) != null" v-model="upData[a.label]" :allow-create="data.selectField[a.label].allowCreate"
                         :default-first-option="data.selectField[a.label].defaultFirstOption"
                         :disabled="isDisabled(a.label)"
                :multiple="data.selectField[a.label].choose" clearable filterable
                size="small" style="width: 100%;">
                <el-option v-for="(b, bi) in data.selectField[a.label].select" :key="bi+'eeeee'" :label="b.label"
                  :value="b.value">
                size="small"
              ></el-input>
              <el-select
                v-if="showType(a.label, data.selectField) != null"
                v-model="upData[a.label]"
                :allow-create="data.selectField[a.label].allowCreate"
                :default-first-option="
                  data.selectField[a.label].defaultFirstOption
                "
                :disabled="isDisabled(a.label)"
                :multiple="data.selectField[a.label].choose"
                clearable
                filterable
                size="small"
                style="width: 100%"
              >
                <el-option
                  v-for="(b, bi) in data.selectField[a.label].select"
                  :key="bi + 'eeeee'"
                  :label="b.label"
                  :value="b.value"
                >
                </el-option>
              </el-select>
              <el-upload v-if="showUpload(a.label)" ref='upload'
                :accept='data.addUploadConfig.accept' :action="javaApi+data.addUploadConfig.url" :headers="token" :multiple="false"
                :on-error="onError" :on-success="m=>handleSuccessUp(m, a.label)" :show-file-list="false" class="avatar-uploader"
              <el-upload
                v-if="showUpload(a.label)"
                ref="upload"
                :accept="data.addUploadConfig.accept"
                :action="javaApi + data.addUploadConfig.url"
                :headers="token"
                :multiple="false"
                :on-error="onError"
                :on-success="(m) => handleSuccessUp(m, a.label)"
                :show-file-list="false"
                class="avatar-uploader"
                name="file"
                style="background: transparent;width: 80px;height: 80px;border: 1px solid #DCDFE6;border-radius: 6px;margin: 10px 0;">
                <img v-if="upData[a.label]" :src="javaApi+'/img/'+upData[a.label]" class="avatar"
                  style="width: 80px;height: 80px;border-radius: 6px;">
                style="
                  background: transparent;
                  width: 80px;
                  height: 80px;
                  border: 1px solid #dcdfe6;
                  border-radius: 6px;
                  margin: 10px 0;
                "
              >
                <img
                  v-if="upData[a.label]"
                  :src="javaApi + '/img/' + upData[a.label]"
                  class="avatar"
                  style="width: 80px; height: 80px; border-radius: 6px"
                />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <el-cascader v-if="showCascader(a.label)" :options="data.cascaderField[a.label].tree" :placeholder="`请选择${a.value}`"
                :props="data.cascaderField.props" :show-all-levels="false" :value="upData[a.label]"
                clearable filterable size="small"
                style="width: 100%;" @change="m=>handleCascader(m,a.label)"></el-cascader>
              <el-cascader
                v-if="showCascader(a.label)"
                :options="data.cascaderField[a.label].tree"
                :placeholder="`请选择${a.value}`"
                :props="data.cascaderField.props"
                :show-all-levels="false"
                :value="upData[a.label]"
                clearable
                filterable
                size="small"
                style="width: 100%"
                @change="(m) => handleCascader(m, a.label)"
              ></el-cascader>
            </el-col>
          </div>
        </div>
        <div v-else>
          <el-row v-for="(a, ai) in upHead" :key="ai+'ggggg'" style="line-height: 50px;">
            <el-col :span="6" style="text-align: right;">
              <span v-if="showUpReq(a.label)" class="required-span">* </span>{{a.value}}:
          <el-row
            v-for="(a, ai) in upHead"
            :key="ai + 'ggggg'"
            style="line-height: 50px"
          >
            <el-col :span="6" style="text-align: right">
              <span v-if="showUpReq(a.label)" class="required-span">* </span
              >{{ a.value }}:
            </el-col>
            <el-col :offset="1" :span="16">
              <el-input v-if="showType(a.label, data.selectField) == null&&!showUpload(a.label)&&!showCascader(a.label)" v-model="upData[a.label]" :disabled="isDisabled(a.label)" :placeholder="`请输入${a.value}`"
              <el-input
                v-if="
                  showType(a.label, data.selectField) == null &&
                  !showUpload(a.label) &&
                  !showCascader(a.label)
                "
                v-model="upData[a.label]"
                :disabled="isDisabled(a.label)"
                :placeholder="`请输入${a.value}`"
                clearable
                size="small"></el-input>
              <el-select v-if="showType(a.label, data.selectField) != null" v-model="upData[a.label]" :disabled="isDisabled(a.label)"
                :multiple="data.selectField[a.label].choose" clearable filterable
                size="small" style="width: 100%;">
                <el-option v-for="(b, bi) in data.selectField[a.label].select" :key="bi+'fffff'" :label="b.label"
                  :value="b.value"></el-option>
                size="small"
              ></el-input>
              <el-select
                v-if="showType(a.label, data.selectField) != null"
                v-model="upData[a.label]"
                :disabled="isDisabled(a.label)"
                :multiple="data.selectField[a.label].choose"
                clearable
                filterable
                size="small"
                style="width: 100%"
              >
                <el-option
                  v-for="(b, bi) in data.selectField[a.label].select"
                  :key="bi + 'fffff'"
                  :label="b.label"
                  :value="b.value"
                ></el-option>
              </el-select>
              <el-upload v-if="showUpload(a.label)" ref='upload' :accept='data.addUploadConfig.accept'
                :action="javaApi+data.addUploadConfig.url" :headers="token" :multiple="false" :on-error="onError"
                :on-success="m=>handleSuccessUp(m, a.label)" :show-file-list="false" class="avatar-uploader" name="file"
                style="background: transparent;width: 80px;height: 80px;border: 1px solid #DCDFE6;border-radius: 6px;margin: 10px 0;">
                <img v-if="upData[a.label]" :src="javaApi+'/img/'+upData[a.label]" class="avatar"
                  style="width: 80px;height: 80px;border-radius: 6px;">
              <el-upload
                v-if="showUpload(a.label)"
                ref="upload"
                :accept="data.addUploadConfig.accept"
                :action="javaApi + data.addUploadConfig.url"
                :headers="token"
                :multiple="false"
                :on-error="onError"
                :on-success="(m) => handleSuccessUp(m, a.label)"
                :show-file-list="false"
                class="avatar-uploader"
                name="file"
                style="
                  background: transparent;
                  width: 80px;
                  height: 80px;
                  border: 1px solid #dcdfe6;
                  border-radius: 6px;
                  margin: 10px 0;
                "
              >
                <img
                  v-if="upData[a.label]"
                  :src="javaApi + '/img/' + upData[a.label]"
                  class="avatar"
                  style="width: 80px; height: 80px; border-radius: 6px"
                />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <el-cascader v-if="showCascader(a.label)" :options="data.cascaderField[a.label].tree" :placeholder="`请选择${a.value}`"
                :props="data.cascaderField.props" :show-all-levels="false" :value="upData[a.label]" clearable
                filterable size="small" style="width: 100%;" @change="m=>handleCascader(m,a.label)"></el-cascader>
              <el-cascader
                v-if="showCascader(a.label)"
                :options="data.cascaderField[a.label].tree"
                :placeholder="`请选择${a.value}`"
                :props="data.cascaderField.props"
                :show-all-levels="false"
                :value="upData[a.label]"
                clearable
                filterable
                size="small"
                style="width: 100%"
                @change="(m) => handleCascader(m, a.label)"
              ></el-cascader>
            </el-col>
          </el-row>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="upDia = false">取 æ¶ˆ</el-button>
        <el-button :loading="upLoad" type="primary" @click="saveUpData">ç¡® å®š</el-button>
        <el-button :loading="upLoad" type="primary" @click="saveUpData"
          >ç¡® å®š</el-button
        >
      </span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :visible.sync="addDia"
               :width="data.row==1?'500px':540+data.row * 200 + 'px'"
               append-to-body title="新增">
      <div v-if="addDia" class="body" style="max-height: 550px;overflow-y: auto;padding: 5px 10px 5px 0;">
    <el-dialog
      :close-on-click-modal="false"
      :visible.sync="addDia"
      :width="data.row == 1 ? '500px' : 540 + data.row * 200 + 'px'"
      append-to-body
      title="新增"
    >
      <div
        v-if="addDia"
        class="body"
        style="max-height: 550px; overflow-y: auto; padding: 5px 10px 5px 0"
      >
        <div v-if="data.row > 1">
          <div v-for="(a, ai) in upHead" :key="ai+'yyyyy'" style="line-height: 50px;">
            <el-col :offset="1" :span="6/data.row" style="text-align: right;"><span v-if="showAddReq(a.label)"
                class="required-span">*
              </span>{{a.value}}:</el-col>
            <el-col :span="16/data.row">
              <el-input v-if="showType(a.label, data.selectField) == null&&!showUpload(a.label)&&!showCascader(a.label)" v-model="upData[a.label]" :placeholder="`请输入${a.value}`" clearable
                size="small"></el-input>
              <el-select v-if="showType(a.label, data.selectField) != null" v-model="upData[a.label]" :multiple="data.selectField[a.label].choose"
              :placeholder="`请选择${a.value}`"
                clearable filterable size="small" style="width: 100%;">
                <el-option v-for="(b, bi) in data.selectField[a.label].select" :key="bi+'hhhh'" :label="b.label"
                  :value="b.value"></el-option>
          <div
            v-for="(a, ai) in upHead"
            :key="ai + 'yyyyy'"
            style="line-height: 50px"
          >
            <el-col :offset="1" :span="6 / data.row" style="text-align: right"
              ><span v-if="showAddReq(a.label)" class="required-span">* </span
              >{{ a.value }}:</el-col
            >
            <el-col :span="16 / data.row">
              <el-input
                v-if="
                  showType(a.label, data.selectField) == null &&
                  !showUpload(a.label) &&
                  !showCascader(a.label)
                "
                v-model="upData[a.label]"
                :placeholder="`请输入${a.value}`"
                clearable
                size="small"
              ></el-input>
              <el-select
                v-if="showType(a.label, data.selectField) != null"
                v-model="upData[a.label]"
                :multiple="data.selectField[a.label].choose"
                :placeholder="`请选择${a.value}`"
                clearable
                filterable
                size="small"
                style="width: 100%"
              >
                <el-option
                  v-for="(b, bi) in data.selectField[a.label].select"
                  :key="bi + 'hhhh'"
                  :label="b.label"
                  :value="b.value"
                ></el-option>
              </el-select>
              <el-upload v-if="showUpload(a.label)" ref='upload'
                :accept='data.addUploadConfig.accept' :action="javaApi+data.addUploadConfig.url" :headers="token" :multiple="false"
                :on-error="onError" :on-success="m=>handleSuccessUp(m, a.label)" :show-file-list="false" class="avatar-uploader"
              <el-upload
                v-if="showUpload(a.label)"
                ref="upload"
                :accept="data.addUploadConfig.accept"
                :action="javaApi + data.addUploadConfig.url"
                :headers="token"
                :multiple="false"
                :on-error="onError"
                :on-success="(m) => handleSuccessUp(m, a.label)"
                :show-file-list="false"
                class="avatar-uploader"
                name="file"
                style="background: transparent;width: 80px;height: 80px;border: 1px solid #DCDFE6;border-radius: 6px;margin: 10px 0;">
                <img v-if="upData[a.label]" :src="javaApi+'/img/'+upData[a.label]" class="avatar"
                  style="width: 80px;height: 80px;border-radius: 6px;">
                style="
                  background: transparent;
                  width: 80px;
                  height: 80px;
                  border: 1px solid #dcdfe6;
                  border-radius: 6px;
                  margin: 10px 0;
                "
              >
                <img
                  v-if="upData[a.label]"
                  :src="javaApi + '/img/' + upData[a.label]"
                  class="avatar"
                  style="width: 80px; height: 80px; border-radius: 6px"
                />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <el-cascader v-if="showCascader(a.label)" :options="data.cascaderField[a.label].tree" :placeholder="`请选择${a.value}`"
                :props="data.cascaderField.props" :show-all-levels="false" clearable filterable
                size="small" style="width: 100%;" @change="m=>handleCascader(m,a.label)"></el-cascader>
              <el-cascader
                v-if="showCascader(a.label)"
                :options="data.cascaderField[a.label].tree"
                :placeholder="`请选择${a.value}`"
                :props="data.cascaderField.props"
                :show-all-levels="false"
                clearable
                filterable
                size="small"
                style="width: 100%"
                @change="(m) => handleCascader(m, a.label)"
              ></el-cascader>
            </el-col>
          </div>
        </div>
        <div v-else>
          <el-row v-for="(a, ai) in upHead" :key="ai+'jjjjj'" style="line-height: 50px;">
            <el-col :span="6" style="text-align: right;"><span v-if="showAddReq(a.label)" class="required-span">*
              </span>{{a.value}}:</el-col>
          <el-row
            v-for="(a, ai) in upHead"
            :key="ai + 'jjjjj'"
            style="line-height: 50px"
          >
            <el-col :span="6" style="text-align: right"
              ><span v-if="showAddReq(a.label)" class="required-span">* </span
              >{{ a.value }}:</el-col
            >
            <el-col :offset="1" :span="16">
              <el-input v-if="showType(a.label, data.selectField) == null&&!showUpload(a.label)&&!showCascader(a.label)" v-model="upData[a.label]" :placeholder="`请输入${a.value}`" clearable
                size="small"></el-input>
              <el-select v-if="showType(a.label, data.selectField) != null" v-model="upData[a.label]" :multiple="data.selectField[a.label].choose"
              :placeholder="`请选择${a.value}`"
                clearable size="small" style="width: 100%;">
                <el-option v-for="(b, bi) in data.selectField[a.label].select" :key="bi+'mmmmmm'" :label="b.label"
                  :value="b.value"></el-option>
              <el-input
                v-if="
                  showType(a.label, data.selectField) == null &&
                  !showUpload(a.label) &&
                  !showCascader(a.label)
                "
                v-model="upData[a.label]"
                :placeholder="`请输入${a.value}`"
                clearable
                size="small"
              ></el-input>
              <el-select
                v-if="showType(a.label, data.selectField) != null"
                v-model="upData[a.label]"
                :multiple="data.selectField[a.label].choose"
                :placeholder="`请选择${a.value}`"
                clearable
                size="small"
                style="width: 100%"
              >
                <el-option
                  v-for="(b, bi) in data.selectField[a.label].select"
                  :key="bi + 'mmmmmm'"
                  :label="b.label"
                  :value="b.value"
                ></el-option>
              </el-select>
              <el-upload v-if="showUpload(a.label)" ref='upload'
                :accept='data.addUploadConfig.accept' :action="javaApi+data.addUploadConfig.url" :headers="token" :multiple="false"
                :on-error="onError" :on-success="m=>handleSuccessUp(m, a.label)" :show-file-list="false" class="avatar-uploader"
              <el-upload
                v-if="showUpload(a.label)"
                ref="upload"
                :accept="data.addUploadConfig.accept"
                :action="javaApi + data.addUploadConfig.url"
                :headers="token"
                :multiple="false"
                :on-error="onError"
                :on-success="(m) => handleSuccessUp(m, a.label)"
                :show-file-list="false"
                class="avatar-uploader"
                name="file"
                style="background: transparent;width: 80px;height: 80px;border: 1px solid #DCDFE6;border-radius: 6px;margin: 10px 0;">
                <img v-if="upData[a.label]" :src="javaApi+'/img/'+upData[a.label]" class="avatar"
                  style="width: 80px;height: 80px;border-radius: 6px;">
                style="
                  background: transparent;
                  width: 80px;
                  height: 80px;
                  border: 1px solid #dcdfe6;
                  border-radius: 6px;
                  margin: 10px 0;
                "
              >
                <img
                  v-if="upData[a.label]"
                  :src="javaApi + '/img/' + upData[a.label]"
                  class="avatar"
                  style="width: 80px; height: 80px; border-radius: 6px"
                />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <el-cascader v-if="showCascader(a.label)" :options="data.cascaderField[a.label].tree" :placeholder="`请选择${a.value}`"
                :props="data.cascaderField.props" :show-all-levels="false" clearable filterable
                size="small" style="width: 100%;" @change="m=>handleCascader(m,a.label)"></el-cascader>
              <el-cascader
                v-if="showCascader(a.label)"
                :options="data.cascaderField[a.label].tree"
                :placeholder="`请选择${a.value}`"
                :props="data.cascaderField.props"
                :show-all-levels="false"
                clearable
                filterable
                size="small"
                style="width: 100%"
                @change="(m) => handleCascader(m, a.label)"
              ></el-cascader>
            </el-col>
          </el-row>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addDia = false">取 æ¶ˆ</el-button>
        <el-button :loading="addLoad" type="primary" @click="saveAddData">ç¡® å®š</el-button>
        <el-button :loading="addLoad" type="primary" @click="saveAddData"
          >ç¡® å®š</el-button
        >
      </span>
    </el-dialog>
    <el-dialog :visible.sync="downDia" title="导出" width="400px">
      <div style="display: flex;width: 100%;height: 100px;">
      <div style="display: flex; width: 100%; height: 100px">
        <div class="down-left" @click="downFile(true)">
          <el-button>本页导出</el-button>
        </div>
@@ -324,10 +670,22 @@
      </div>
    </el-dialog>
    <el-dialog :visible.sync="uploadDia" title="数据导入" width="500px">
      <div style="margin: 0 auto;">
        <el-upload ref="upload" :accept="data.accept===undefined?'.csv':data.accept" :action="javaApi + inputUrl" :auto-upload="false" :data="{param: data.uploadStr}" :file-list="fileList"
          :headers="token" :limit="1" :on-change="beforeUpload" :on-error="onError" :on-success="onSuccess"
          drag name="file">
      <div style="margin: 0 auto">
        <el-upload
          ref="upload"
          :accept="data.accept === undefined ? '.csv' : data.accept"
          :action="javaApi + inputUrl"
          :auto-upload="false"
          :data="{ param: data.uploadStr }"
          :file-list="fileList"
          :headers="token"
          :limit="1"
          :on-change="beforeUpload"
          :on-error="onError"
          :on-success="onSuccess"
          drag
          name="file"
        >
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        </el-upload>
@@ -341,323 +699,346 @@
</template>
<script>
  export default {
    props: {
      selectionWidth: {
        type: String,
        default: () => '65'
      },
      columnMinWidth: {
        type: String,
        default: () => '155'
      },
      isColumnWidth: {
        type: Boolean,
        default: () => false
      },
      isShowZero: {
        type: Boolean,
        default: () => false
      },
      tableRowClassName: {
        type: Function
      },
      rowKey: {
        type: String,
        default: ()=>{
          return 'id'
        }
      },
      url: {
        type: String,
        default: () => null
      },
      upUrl: {
        type: String,
        default: () => null
      },
      delUrl: {
        type: String,
        default: () => null
      },
      downUrl: {
        type: String,
        default: () => null
      },
      inputUrl: {
        type: String,
        default: () => null
      },
      componentData: {
        type: Object,
        default: () => {
          return {
            entity: {
              orderBy: {
                field: 'id',
                order: 'asc'
              }
            },
            isIndex: false,
            showSelect: false,
            select: true,
            row: 1,
            do: [{
              id: 'update',
              font: '编辑',
              type: 'text',
              method: 'doDiy'
            }, {
              id: 'delete',
              font: '删除',
              type: 'text',
              method: 'doDiy'
            }],
            doDiy: true,
            tagField: [{
              label: 'state',
              select: [{
                value: '1',
                type: 'success',
                label: '启用'
              }, {
                value: '0',
                type: 'danger',
                label: '停用'
              }]
            }]
          }
        }
      }
export default {
  props: {
    selectionWidth: {
      type: String,
      default: () => "65",
    },
    data() {
      return {
        data: {
    columnMinWidth: {
      type: String,
      default: () => "155",
    },
    isColumnWidth: {
      type: Boolean,
      default: () => false,
    },
    isShowZero: {
      type: Boolean,
      default: () => false,
    },
    tableRowClassName: {
      type: Function,
    },
    rowKey: {
      type: String,
      default: () => {
        return "id";
      },
    },
    url: {
      type: String,
      default: () => null,
    },
    upUrl: {
      type: String,
      default: () => null,
    },
    delUrl: {
      type: String,
      default: () => null,
    },
    downUrl: {
      type: String,
      default: () => null,
    },
    inputUrl: {
      type: String,
      default: () => null,
    },
    componentData: {
      type: Object,
      default: () => {
        return {
          entity: {
            orderBy: {
              field: 'id',
              order: 'asc'
            }
              field: "id",
              order: "asc",
            },
          },
          isIndex: false,
          showSelect: false,
          select: true,
          row: 1,
          isPage: true, //
          do: [{
            font: '删除',
            type: 'text'
          }],
          type: [],
          uploadStr: "",
          currentId: '', //当前高亮的ID
          do: [
            {
              id: "update",
              font: "编辑",
              type: "text",
              method: "doDiy",
            },
            {
              id: "delete",
              font: "删除",
              type: "text",
              method: "doDiy",
            },
          ],
          doDiy: true,
          tagField: [
            {
              label: "state",
              select: [
                {
                  value: "1",
                  type: "success",
                  label: "启用",
                },
                {
                  value: "0",
                  type: "danger",
                  label: "停用",
                },
              ],
            },
          ],
        };
      },
    },
  },
  data() {
    return {
      data: {
        entity: {
          orderBy: {
            field: "id",
            order: "asc",
          },
        },
        tableHead: [],
        tableData: [],
        multipleSelection: [],
        user: {},
        page: {
          current: 1,
          size: 20,
        },
        total: 0,
        loading: false,
        upDia: false,
        upData: {},
        upHead: [],
        upLoad: false,
        addDia: false,
        addUrl: null,
        addLoad: false,
        dataCopy: {},
        downDia: false,
        uploadDia: false,
        token: null,
        fileList: [],
        init: true,
        spanList: [
          // {
          //   arr:[],
          //   position:0
          // }
        isIndex: false,
        showSelect: false,
        select: true,
        row: 1,
        isPage: true, //
        do: [
          {
            font: "删除",
            type: "text",
          },
        ],
        specialSpanList: [
          // {
          //   arr:[],
          //   position:0
          // }
        ],
        param: {},
        specialKey:'table-'
      }
    },
    beforeUpdate() {
      this.$nextTick(() => {
        this.$refs.eltable.doLayout()
      })
    },
    mounted() {
      this.data = this.componentData
      this.dataCopy = this.HaveJson(this.componentData)
      if (this.data.init === undefined || this.data.init === true) {
        this.selectList()
      }
      this.token = {
        'token': sessionStorage.getItem('token')
      }
      this.specialKey = this.specialKey+Math.random()*100;
    },
    methods: {
      rowspan(spanArr, position, spanName) {
        this.tableData.forEach((item, index) => {
          if (index === 0) {
        type: [],
        uploadStr: "",
        currentId: "", //当前高亮的ID
      },
      tableHead: [],
      tableData: [],
      multipleSelection: [],
      user: {},
      page: {
        current: 1,
        size: 20,
      },
      total: 0,
      loading: false,
      upDia: false,
      upData: {},
      upHead: [],
      upLoad: false,
      addDia: false,
      addUrl: null,
      addLoad: false,
      dataCopy: {},
      downDia: false,
      uploadDia: false,
      token: null,
      fileList: [],
      init: true,
      spanList: [
        // {
        //   arr:[],
        //   position:0
        // }
      ],
      specialSpanList: [
        // {
        //   arr:[],
        //   position:0
        // }
      ],
      param: {},
      specialKey: "table-",
    };
  },
  beforeUpdate() {
    this.$nextTick(() => {
      this.$refs.eltable.doLayout();
    });
  },
  mounted() {
    this.data = this.componentData;
    this.dataCopy = this.HaveJson(this.componentData);
    if (this.data.init === undefined || this.data.init === true) {
      this.selectList();
    }
    this.token = {
      token: sessionStorage.getItem("token"),
    };
    this.specialKey = this.specialKey + Math.random() * 100;
  },
  methods: {
    rowspan(spanArr, position, spanName) {
      this.tableData.forEach((item, index) => {
        if (index === 0) {
          spanArr.push(1);
          position = 0;
        } else {
          if (
            this.tableData[index][spanName] ===
            this.tableData[index - 1][spanName]
          ) {
            spanArr[position] += 1;
            spanArr.push(0);
          } else {
            spanArr.push(1);
            position = 0;
          } else {
            if (
              this.tableData[index][spanName] ===
              this.tableData[index - 1][spanName]
            ) {
              spanArr[position] += 1;
              spanArr.push(0);
            } else {
              spanArr.push(1);
              position = index;
            }
            position = index;
          }
        }
      });
    },
    spanMethod({ row, column, rowIndex, columnIndex }) {
      // ä¸€èˆ¬çš„合并行
      if (
        this.data.spanConfig != undefined &&
        this.data.spanConfig.rows &&
        this.data.spanConfig.rows.length > 0
      ) {
        let i = null;
        let obj = this.data.spanConfig.rows.find((item, index) => {
          i = index;
          return item.index == columnIndex;
        });
      },
      spanMethod({
        row,
        column,
        rowIndex,
        columnIndex
      }) {
        // ä¸€èˆ¬çš„合并行
        if (this.data.spanConfig != undefined && this.data.spanConfig.rows && this.data.spanConfig.rows.length > 0) {
          let i = null;
          let obj = this.data.spanConfig.rows.find((item, index) => {
            i = index;
            return item.index == columnIndex
          })
          if (obj) {
            const _row = this.spanList[i].arr[rowIndex];
            const _col = _row > 0 ? 1 : 0;
            return {
              rowspan: _row,
              colspan: _col,
            };
          }
        if (obj) {
          const _row = this.spanList[i].arr[rowIndex];
          const _col = _row > 0 ? 1 : 0;
          return {
            rowspan: _row,
            colspan: _col,
          };
        }
        // ç‰¹æ®Šçš„合并行
        if (this.data.spanConfig != undefined && this.data.spanConfig.special && this.data.spanConfig.special.main &&
          this.data.spanConfig.special.rows && this.data.spanConfig.special.rows.length > 0) {
          let i = null;
          let obj = this.data.spanConfig.special.rows.find((item, index) => {
            i = index;
            return item.index == columnIndex
          })
          if (obj) {
            const _row = this.specialSpanList[i].arr[rowIndex];
            const _col = _row > 0 ? 1 : 0;
            return {
              rowspan: _row,
              colspan: _col,
            };
          }
      }
      // ç‰¹æ®Šçš„合并行
      if (
        this.data.spanConfig != undefined &&
        this.data.spanConfig.special &&
        this.data.spanConfig.special.main &&
        this.data.spanConfig.special.rows &&
        this.data.spanConfig.special.rows.length > 0
      ) {
        let i = null;
        let obj = this.data.spanConfig.special.rows.find((item, index) => {
          i = index;
          return item.index == columnIndex;
        });
        if (obj) {
          const _row = this.specialSpanList[i].arr[rowIndex];
          const _col = _row > 0 ? 1 : 0;
          return {
            rowspan: _row,
            colspan: _col,
          };
        }
      },
      selectChange(val) {
        if (this.data.select) {
          this.multipleSelection = val;
      }
    },
    selectChange(val) {
      if (this.data.select) {
        this.multipleSelection = val;
      } else {
        this.multipleSelection = val[val.length - 1];
      }
      if (this.data.selectMethod != undefined) {
        if (this.$parent.$el.className.indexOf("el-") == 0) {
          this.$parent.$parent[this.data.selectMethod](val);
        } else {
          this.multipleSelection = val[val.length - 1];
          this.$parent[this.data.selectMethod](val);
        }
        if (this.data.selectMethod != undefined) {
          if (this.$parent.$el.className.indexOf('el-') == 0) {
            this.$parent.$parent[this.data.selectMethod](val)
          } else {
            this.$parent[this.data.selectMethod](val)
      }
    },
    select(val, row) {
      if (!this.data.select) {
        this.$refs["eltable"].clearSelection();
        this.$refs["eltable"].toggleRowSelection(row, true);
      }
    },
    rowClick(row, column, event) {
      if (this.data.select) {
        this.$refs["eltable"].toggleRowSelection(row);
      } else {
        this.$refs["eltable"].clearSelection();
        this.$refs["eltable"].toggleRowSelection(row, true);
      }
    },
    sizeChange(val) {
      this.page.size = val;
      this.selectList("page");
    },
    currentChange(val) {
      this.page.current = val;
      this.selectList("page");
    },
    // è°ƒå–表格查询接口
    selectList(val) {
      // console.log('val---', val)
      // console.log('this.page---', this.page)
      // this.loading = true
      if (val === undefined) {
        this.page.current = 1;
      }
      if (val === "lastPage") {
        this.page.current = this.page.current - 1; // ä¾‹å¦‚删除本页最后一条数据,将当前页面定为上一页,除第一页外
      }
      // ä¸è¦åˆ†é¡µå°±å…¨æŸ¥
      if (this.data.isPage != undefined && this.data.isPage != true) {
        this.page = {
          current: -1,
          size: -1,
        };
      }
      this.$axios
        .post(
          this.url,
          {
            page: this.page,
            entity: this.data.entity,
          },
          {
            headers: {
              "Content-Type": "application/json",
            },
          }
        }
      },
      select(val, row) {
        if (!this.data.select) {
          this.$refs['eltable'].clearSelection()
          this.$refs['eltable'].toggleRowSelection(row, true)
        }
      },
      rowClick(row, column, event) {
        if (this.data.select) {
          this.$refs['eltable'].toggleRowSelection(row)
        } else {
          this.$refs['eltable'].clearSelection()
          this.$refs['eltable'].toggleRowSelection(row, true)
        }
      },
      sizeChange(val) {
        this.page.size = val
        this.selectList('page')
      },
      currentChange(val) {
        this.page.current = val
        this.selectList('page')
      },
      // è°ƒå–表格查询接口
      selectList(val) {
        // console.log('val---', val)
        // console.log('this.page---', this.page)
        // this.loading = true
        if(val===undefined){
          this.page.current = 1;
        }
        if (val === 'lastPage') {
          this.page.current = this.page.current - 1 // ä¾‹å¦‚删除本页最后一条数据,将当前页面定为上一页,除第一页外
        }
        // ä¸è¦åˆ†é¡µå°±å…¨æŸ¥
        if (this.data.isPage != undefined && this.data.isPage != true) {
          this.page = {
            current: -1,
            size: -1,
          }
        }
        this.$axios.post(this.url, {
          page: this.page,
          entity: this.data.entity
        }, {
          headers: {
            'Content-Type': 'application/json'
          }
        }).then(res => {
        )
        .then((res) => {
          if (res.code === 201) {
            this.loading = false
            return
            this.loading = false;
            return;
          }
          this.total = res.data.body.total
          this.tableHead = res.data.head
          this.tableData = res.data.body.records
          this.total = res.data.body.total;
          this.tableHead = res.data.head;
          this.tableData = res.data.body.records;
          if (this.data.needSort !== undefined) {
            // æ ¹æ®çˆ¶ç»„件传回来的needSort数组,判断哪些字段需要排序功能
            for (var i = 0; i < this.data.needSort.length; i++) {
              this.tableHead.forEach(item => {
              this.tableHead.forEach((item) => {
                if (item.label === this.data.needSort[i]) {
                  item.sort = 'custom'
                  item.sort = "custom";
                }
              })
              });
            }
          }
          if (this.isShowZero) {
            // å·¥æ—¶ç®¡ç†-工时统计没有时间的就展示0
            this.tableData.map(item => {
              Object.keys(item).forEach(val => {
                if (item[val] === null && (val.includes('Hours') || val === 'total')) {
                  item[val] = 0
            this.tableData.map((item) => {
              Object.keys(item).forEach((val) => {
                if (
                  item[val] === null &&
                  (val.includes("Hours") || val === "total")
                ) {
                  item[val] = 0;
                }
              })
            })
              });
            });
          }
          if (this.tableData.length === 0 && this.page.current > 1) {
            this.selectList('lastPage')
            this.selectList("lastPage");
          }
          // if (this.isColumnWidth) {
          //   this.tableHead.forEach(item => {
@@ -684,554 +1065,634 @@
          // console.log(JSON.stringify(this.tableHead)+"---------"+JSON.stringify(this.tableData))
          for (var a in this.data.selectField) {
            if (this.data.selectField[a].choose == true) {
              this.tableData.map(b => {
              this.tableData.map((b) => {
                try {
                  b[a] = JSON.parse(b[a])
                  b[a] = JSON.parse(b[a]);
                } catch (e) {}
              })
              });
            }
          }
          // ä¸€èˆ¬çš„合并行
          if (this.data.spanConfig != undefined && this.data.spanConfig.rows && this.data.spanConfig.rows.length >
            0) {
          if (
            this.data.spanConfig != undefined &&
            this.data.spanConfig.rows &&
            this.data.spanConfig.rows.length > 0
          ) {
            this.spanList = [];
            this.data.spanConfig.rows.forEach((item, index) => {
              this.spanList.push({
                arr: [],
                position: 0
              })
              this.rowspan(this.spanList[index].arr, this.spanList[index].position, item.name);
            })
                position: 0,
              });
              this.rowspan(
                this.spanList[index].arr,
                this.spanList[index].position,
                item.name
              );
            });
          }
          // ç‰¹æ®Šçš„合并行
          if (this.data.spanConfig != undefined && this.data.spanConfig.special && this.data.spanConfig.special
            .main && this.data.spanConfig.special.rows && this.data.spanConfig.special.rows.length > 0) {
            this.specialSpanList = []
          if (
            this.data.spanConfig != undefined &&
            this.data.spanConfig.special &&
            this.data.spanConfig.special.main &&
            this.data.spanConfig.special.rows &&
            this.data.spanConfig.special.rows.length > 0
          ) {
            this.specialSpanList = [];
            this.data.spanConfig.special.rows.forEach((item, index) => {
              this.specialSpanList.push({
                arr: [],
                position: 0
              })
              this.rowspan(this.specialSpanList[index].arr, this.specialSpanList[index].position, this.data
                .spanConfig.special.main);
            })
                position: 0,
              });
              this.rowspan(
                this.specialSpanList[index].arr,
                this.specialSpanList[index].position,
                this.data.spanConfig.special.main
              );
            });
          }
          this.loading = false
        }).catch(e => {
          console.log('请刷新页面再尝试---', e)
          this.loading = false
          this.$message.error('请刷新页面再尝试')
          this.loading = false;
        })
      },
      sortChange(ob) {
        this.data.entity.orderBy = {}
        this.data.entity.orderBy.field = ob.prop
        if (ob.order == 'ascending') {
          this.data.entity.orderBy.order = 'asc'
        } else if (ob.order == 'descending') {
          this.data.entity.orderBy.order = 'desc'
        } else {
          if (this.componentData.entity.orderBy != undefined) {
            this.data.entity.orderBy = this.HaveJson(this.dataCopy.entity.orderBy)
          }
        }
        this.selectList()
      },
      // å±•示tag
      showType(val, ob) {
        var str = ob[val]
        return str == undefined ? null : ob[val].select
      },
      // å±•示操作栏
      showLink(val, ob) {
        var str = ob[val]
        return str == undefined ? null : ob[val].method
      },
      showAddReq(label) {
        if (this.data.requiredAdd == undefined) {
          return
        }
        for (var i = 0; i < this.data.requiredAdd.length; i++) {
          if (label == this.data.requiredAdd[i]) {
            return true
          }
        }
        return false
      },
      showUpReq(label) {
        if (this.data.requiredUp == undefined) {
          return
        }
        for (var i = 0; i < this.data.requiredUp.length; i++) {
          if (label == this.data.requiredUp[i]) {
            return true
          }
        }
        return false
      },
      showUpload(label) {
        if (this.data.addUpload && this.data.addUpload.find(m => m == label)) {
          return true;
        } else {
          return false;
        }
      },
      showCascader(label) {
        if (this.data.cascaderField && this.data.cascaderField[label]) {
          return true;
        } else {
          return false;
        }
      },
      handleTree(arr, value) {
        let label = ''
        for (let i = 0; i < arr.length; i++) {
          if (arr[i].id == value) {
            label = arr[i].name
            return label
          } else if (arr[i].children) {
            label = this.handleTree(arr[i].children, value)
          }
        }
        return label
      },
      main(row, val) {
        if (val.method == undefined) return
        else if (val.method == 'doDiy') {
          if (val.id == 'update') { // ç¼–辑操作
            this.upDia = true,
            this.upData = this.HaveJson(row)
            this.upHead = this.HaveJson(this.tableHead)
            this.upHead.forEach((item, index) => {
              if (this.data.cascaderField && this.data.cascaderField[item.label]) {
                if (this.upData[item.label]) {
                  this.upData[item.label] = JSON.parse(this.upData[item.label])
                } else {
                  this.upData[item.label] = []
                }
              }
            })
            this.upHead = this.upHead.filter(a => a.label != 'createTime' && a.label != 'updateTime')
            delete this.upData.orderBy
            delete this.upData.createTime
            delete this.upData.updateTime
            delete this.upData.createUser
            delete this.upData.updateUser
            val.field.forEach(a => {
              if (this.upData[a] === undefined) {
                this.upHead.push({
                  value: a.split('=')[0],
                  label: a.split('=')[1]
                })
              } else {
                delete this.upData[a]
                for (var i = 0; i < this.upHead.length; i++) {
                  if (this.upHead[i].label == a) {
                    this.upHead.splice(i, 1);
                    i--
                    break
                  }
                }
              }
            })
          } else if (val.id == 'delete') { // åˆ é™¤æ“ä½œ
            if (this.delUrl == null) {
              this.$message.error('请给删除请求地址')
              return
            }
            this.$confirm('是否删除当前数据?', "警告", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning"
            }).then(() => {
              this.$axios.post(this.delUrl, {
                id: row.id
              }).then(res => {
                if (res.code === 201) {
                  return
                }
                this.$message.success('删除成功')
                this.selectList('page')
                this.$emit('delete')
              }).catch(e => {
                this.$message.error('删除失败')
              })
            }).catch(() => {})
          }
        } else if (val.id === 'parent') {
          delete row.orderBy
          this.$parent.$parent[val.method](row)
        } else {
          delete row.orderBy
          this.$parent[val.method](row)
        }
      },
      saveUpData() {
        if (this.upUrl == null) {
          this.$message.error('请给修改请求地址')
          return
        }
        for (var i = 0; i < this.data.requiredUp.length; i++) {
          // å¿…填校验
          if (this.upData[this.data.requiredUp[i]] === null || this.upData[this.data.requiredUp[i]] === '') {
            var list = this.upHead.filter(a => {
              if (a.label == this.data.requiredUp[i]) return a
            })
            if (list[0].value == undefined) continue
            this.$message.error(list[0].value + '是必填项')
            return
          }
        }
        for (var a in this.data.selectField) {
          if (this.data.selectField[a].choose == true) {
            this.upData[a] = JSON.stringify(this.upData[a])
          }
        }
        for (var i = 0; i < this.upHead.length; i++) {
          if(this.upHead[i].label == 'password'){
            if(this.upData[this.upHead[i].label]){
              const reg2 =/^(?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[~!#@$%^*&()_+{}\[\]|\\;:'",<.>\/?])[a-zA-Z\d~!#@$%^*&()_+{}\[\]|\\;:'",<.>\/?]*$/;
              if (!reg2.test(this.upData[this.upHead[i].label])) {
                this.$message.error('密码必须包括数字、大小写字母以及特殊字符')
                return
              }
            }
          }
          if (this.data.cascaderField && this.data.cascaderField[this.upHead[i].label]) {
            if (this.upData[this.upHead[i].label]) {
              this.upData[this.upHead[i].label] = JSON.stringify(this.upData[this.upHead[i].label])
            } else {
              this.upData[this.upHead[i].label] = ''
            }
          }
        }
        this.upLoad = true
        this.$axios.post(this.upUrl, this.upData, {
          headers: {
            'Content-Type': 'application/json'
          }
        }).then(res => {
          if (res.code === 201) {
            this.upLoad = false
            return
          }
          this.$message.success('修改成功')
          this.upDia = false
          this.selectList('page')
          this.$refs.eltable.doLayout();
          this.upLoad = false
        }).catch(e => {
          this.$message.error('修改失败')
          this.upDia = false
          this.upLoad = false
        })
      },
      // æ‰“开新增弹框回调
      openAddDia(addUrl, param) {
        this.addDia = true
        this.addUrl = addUrl
        this.param = param
        this.upData = {}
        this.tableHead.forEach((k, v) => {
          if (k.label != 'orderBy' && k.label != 'createTime' && k.label != 'updateTime' && k.label != 'createUser' && k.label != 'updateUser')
            this.upData[k.label] = null
        })
        this.upData = this.HaveJson(this.upData)
        this.upHead = this.HaveJson(this.tableHead)
        this.upHead = this.upHead.filter(a => a.label != 'createTime' && a.label != 'updateTime')
        var val = this.data.do.filter(a => a.id == 'update')[0]
        if (val == undefined) {
          val = {
            field: []
          }
        }
        val.field.forEach(a => {
          if (JSON.stringify(this.upData[a]) === undefined) {
            this.upHead.push({
              value: a.split('=')[0],
              label: a.split('=')[1]
            })
          } else {
            delete this.upData[a]
            for (var i = 0; i < this.upHead.length; i++) {
              if (this.upHead[i].label == a) {
                this.upHead.splice(i, 1);
                i--
                break
              }
            }
          }
        })
      },
      // æ–°å¢žå›žè°ƒ
      saveAddData() {
        if (this.addUrl == null) {
          this.$message.error('请给添加请求地址')
          return
        }
        for (var i = 0; i < this.data.requiredAdd.length; i++) {
          if (this.upData[this.data.requiredAdd[i]] === null || this.upData[this.data.requiredAdd[i]] === '') {
            var list = this.upHead.filter(a => {
              if (a.label == this.data.requiredAdd[i]) return a
            })
            if (list[0].value == undefined) continue
            this.$message.error(list[0].value + '是必填项')
            return
          }
        }
        this.addLoad = true
        for (var a in this.data.selectField) {
          if (this.data.selectField[a].choose == true) {
            this.upData[a] = JSON.stringify(this.upData[a])
          }
        }
        this.upHead.forEach((item, index) => {
          if (this.data.cascaderField && this.data.cascaderField[item.label]) {
            if (this.upData[item.label]) {
              this.upData[item.label] = JSON.stringify(this.upData[item.label])
            } else {
              this.upData[item.label] = ''
            }
          }
        })
        if (this.param !== undefined && this.param !== null) {
          for (let i in this.param) {
            this.upData[i] = this.param[i]
          }
        }
        this.$axios.post(this.addUrl, this.upData, {
          headers: {
            'Content-Type': 'application/json'
          }
        }).then(res => {
          if (res.code === 201) {
            this.addLoad = false
            return
          }
          this.$message.success('添加成功')
          this.addDia = false
          this.selectList('page')
          this.addLoad = false
        }).catch(e => {
          this.addDia = false
          this.addLoad = false
        })
      },
      openDownDia() {
        this.downDia = true
      },
      downFile(type) {
        if (this.downUrl == null) {
          this.$message.error('请给导出请求地址')
          return
        }
        var page = this.HaveJson(this.page)
        if (!type) {
          page.current = 0
          page.size = this.total
        }
        this.loading = true
        this.$axios.post(this.downUrl, {
          page: page,
          entity: this.data.entity
        }, {
          headers: {
            'Content-Type': 'application/json'
          }
        }).then(res => {
          if (res.code === 201) {
            this.loading = false
            return
          }
          this.downDia = false
          this.loading = false
          this.$message.success('导出成功')
          let eleLink = document.createElement('a')
          eleLink.style.display = 'none'
          eleLink.download = res.data
          eleLink.href = this.javaApi + '/outPath/' + res.data
          document.body.appendChild(eleLink)
          eleLink.click()
          document.body.removeChild(eleLink)
        }).catch(e => {
          console.log(e);
          this.loading = false
          this.$message.error('请刷新页面再尝试')
        })
      },
      openUpload() {
        if (this.inputUrl == null) {
          this.$message.error('请给导入请求地址')
          return
        }
        this.uploadDia = true
      },
      beforeUpload(file, fileList) {
        console.log(file.raw.type);
        if (file.raw.type != (this.data.inputType===undefined?'text/csv':this.data.inputType)) {
          this.$message.error('上传文件格式不正确');
          this.$refs.upload.clearFiles()
          return false;
        }
      },
      submitUpload() {
        if (this.$refs.upload.uploadFiles.length == 0) {
          this.$message.error('未选择文件')
          return
        }
        this.uploading = true
        this.$refs.upload.submit();
      },
      onSuccess(response, file, fileList) {
        this.$refs.upload.clearFiles()
        this.uploadDia = false
        this.uploading = false
        if (response.code == 201) {
          this.$message.error(response.message)
          return
        }
        this.$message.success('上传成功')
        this.selectList()
      },
      onError(err, file, fileList) {
        this.$message.error('上传失败')
        this.$refs.upload.clearFiles()
        this.uploading = false
      },
      // æ“ä½œæŒ‰é’®ç½®ç°åˆ¤æ–­
      isDisabled(label) {
        if (this.data.disabledUp == undefined) {
          return
        }
        for (var i = 0; i < this.data.disabledUp.length; i++) {
          if (label == this.data.disabledUp[i]) {
            return true
          }
        }
        return false
      },
      getSummaries(param) {
        const {
          columns,
          data
        } = param;
        const sums = [];
        columns.forEach((column, index) => {
          if (index === 0) {
            sums[index] = '合计';
            return;
          }
          const values = data.map(item => Number(item[column.property]));
          if (this.data.countFleid == undefined) {
            sums[index] = ''
            return
          }
          if (this.data.countFleid.filter(str => {
              return str === column.property
            }).length > 0) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr);
              if (!isNaN(value)) {
                return prev + curr;
              } else {
                return prev;
              }
            }, 0);
            sums[index] += '';
          } else {
            sums[index] = '';
          }
        .catch((e) => {
          console.log("请刷新页面再尝试---", e);
          this.loading = false;
          this.$message.error("请刷新页面再尝试");
        });
        return sums;
      },
      handleLinkEvent(row, val) {
        if (val.method == 'doDiy') {
          this.main(row, val)
        } else {
          this.$parent[val.method](row)
        }
      },
      getWidth() {
        let count = 0
        this.data.do.forEach(a => {
          count += a.font.length
        })
        return count * 15 + 60 + 'px'
      },
      handleSuccessUp(response, label) {
        if (typeof label === 'string') {
          if (response.code == 200) {
            this.upData[label] = response.data.url;
          }
        } else {
          if (response.code == 200) {
            this.$message.success('上传成功')
            this.selectList()
          }
        }
      },
      handleCascader(e, label) {
        this.upData[label] = e;
      },
      // æ‰¹é‡åˆ é™¤
      batchDelete() {
        if (this.multipleSelection && this.multipleSelection.length > 0) {
          this.$confirm('是否删除选中的数据?', "警告", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          }).then(() => {
            this.$axios.post(this.delUrl, {
              ids: JSON.stringify(this.multipleSelection.map(item => item.id))
            }).then(res => {
              if (res.code === 201) {
                return
              }
              this.$message.success('删除成功')
              this.selectList('page')
            }).catch(e => {
              this.$message.error('删除失败')
            })
          }).catch(() => {})
        } else {
          this.$message.error('请选择要删除的数据')
        }
      },
      // æ—¥å·¥æ—¶ç®¡ç†è¾…助工时--批量审核和批准
      batchCheck(e) {
        if (this.multipleSelection && this.multipleSelection.length > 0) {
          const list = JSON.parse(JSON.stringify(this.multipleSelection))
          const state = e === 0 ? '不批准' : '已批准'
          let auxiliaryWorkingHoursDays = []
          list.forEach(item => {
            delete item.orderBy
            item.state = state
            auxiliaryWorkingHoursDays.push(item)
          })
          this.$axios.post(this.$api.auxiliaryWorkingHoursDay.approve, {auxiliaryWorkingHoursDays: auxiliaryWorkingHoursDays
            },{
              headers: {
                'Content-Type': 'application/json'
              }
            }
          ).then(res => {
            if (res.code === 201) {
              return
            }
            this.$parent.submitBatchCheckDialog()
            this.$message.success('操作成功')
          })
        } else {
          this.$message.error('请选择至少一条数据')
        }
      },
      getRedColor(label,row){
        if(this.data.cellSpecialStyle&&this.data.cellSpecialStyle.redColorByKey&&label.includes(this.data.cellSpecialStyle.redColorByKey)&&row[(label.replace(this.data.cellSpecialStyle.redColorByKey, ""))]){
          return true
        }else{
          return false
    },
    sortChange(ob) {
      this.data.entity.orderBy = {};
      this.data.entity.orderBy.field = ob.prop;
      if (ob.order == "ascending") {
        this.data.entity.orderBy.order = "asc";
      } else if (ob.order == "descending") {
        this.data.entity.orderBy.order = "desc";
      } else {
        if (this.componentData.entity.orderBy != undefined) {
          this.data.entity.orderBy = this.HaveJson(
            this.dataCopy.entity.orderBy
          );
        }
      }
    }
  }
      this.selectList();
    },
    // å±•示tag
    showType(val, ob) {
      var str = ob[val];
      return str == undefined ? null : ob[val].select;
    },
    // å±•示操作栏
    showLink(val, ob) {
      var str = ob[val];
      return str == undefined ? null : ob[val].method;
    },
    showAddReq(label) {
      if (this.data.requiredAdd == undefined) {
        return;
      }
      for (var i = 0; i < this.data.requiredAdd.length; i++) {
        if (label == this.data.requiredAdd[i]) {
          return true;
        }
      }
      return false;
    },
    showUpReq(label) {
      if (this.data.requiredUp == undefined) {
        return;
      }
      for (var i = 0; i < this.data.requiredUp.length; i++) {
        if (label == this.data.requiredUp[i]) {
          return true;
        }
      }
      return false;
    },
    showUpload(label) {
      if (this.data.addUpload && this.data.addUpload.find((m) => m == label)) {
        return true;
      } else {
        return false;
      }
    },
    showCascader(label) {
      if (this.data.cascaderField && this.data.cascaderField[label]) {
        return true;
      } else {
        return false;
      }
    },
    handleTree(arr, value) {
      let label = "";
      for (let i = 0; i < arr.length; i++) {
        if (arr[i].id == value) {
          label = arr[i].name;
          return label;
        } else if (arr[i].children) {
          label = this.handleTree(arr[i].children, value);
        }
      }
      return label;
    },
    main(row, val) {
      if (val.method == undefined) return;
      else if (val.method == "doDiy") {
        if (val.id == "update") {
          // ç¼–辑操作
          (this.upDia = true), (this.upData = this.HaveJson(row));
          this.upHead = this.HaveJson(this.tableHead);
          this.upHead.forEach((item, index) => {
            if (
              this.data.cascaderField &&
              this.data.cascaderField[item.label]
            ) {
              if (this.upData[item.label]) {
                this.upData[item.label] = JSON.parse(this.upData[item.label]);
              } else {
                this.upData[item.label] = [];
              }
            }
          });
          this.upHead = this.upHead.filter(
            (a) => a.label != "createTime" && a.label != "updateTime"
          );
          delete this.upData.orderBy;
          delete this.upData.createTime;
          delete this.upData.updateTime;
          delete this.upData.createUser;
          delete this.upData.updateUser;
          val.field.forEach((a) => {
            if (this.upData[a] === undefined) {
              this.upHead.push({
                value: a.split("=")[0],
                label: a.split("=")[1],
              });
            } else {
              delete this.upData[a];
              for (var i = 0; i < this.upHead.length; i++) {
                if (this.upHead[i].label == a) {
                  this.upHead.splice(i, 1);
                  i--;
                  break;
                }
              }
            }
          });
        } else if (val.id == "delete") {
          // åˆ é™¤æ“ä½œ
          if (this.delUrl == null) {
            this.$message.error("请给删除请求地址");
            return;
          }
          this.$confirm("是否删除当前数据?", "警告", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
            .then(() => {
              this.$axios
                .post(this.delUrl, {
                  id: row.id,
                })
                .then((res) => {
                  if (res.code === 201) {
                    return;
                  }
                  this.$message.success("删除成功");
                  this.selectList("page");
                  this.$emit("delete");
                })
                .catch((e) => {
                  this.$message.error("删除失败");
                });
            })
            .catch(() => {});
        }
      } else if (val.id === "parent") {
        delete row.orderBy;
        this.$parent.$parent[val.method](row);
      } else {
        delete row.orderBy;
        this.$parent[val.method](row);
      }
    },
    saveUpData() {
      if (this.upUrl == null) {
        this.$message.error("请给修改请求地址");
        return;
      }
      for (var i = 0; i < this.data.requiredUp.length; i++) {
        // å¿…填校验
        if (
          this.upData[this.data.requiredUp[i]] === null ||
          this.upData[this.data.requiredUp[i]] === ""
        ) {
          var list = this.upHead.filter((a) => {
            if (a.label == this.data.requiredUp[i]) return a;
          });
          if (list[0].value == undefined) continue;
          this.$message.error(list[0].value + "是必填项");
          return;
        }
      }
      for (var a in this.data.selectField) {
        if (this.data.selectField[a].choose == true) {
          this.upData[a] = JSON.stringify(this.upData[a]);
        }
      }
      for (var i = 0; i < this.upHead.length; i++) {
        if (this.upHead[i].label == "password") {
          if (this.upData[this.upHead[i].label]) {
            const reg2 =
              /^(?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[~!#@$%^*&()_+{}\[\]|\\;:'",<.>\/?])[a-zA-Z\d~!#@$%^*&()_+{}\[\]|\\;:'",<.>\/?]*$/;
            if (!reg2.test(this.upData[this.upHead[i].label])) {
              this.$message.error("密码必须包括数字、大小写字母以及特殊字符");
              return;
            }
          }
        }
        if (
          this.data.cascaderField &&
          this.data.cascaderField[this.upHead[i].label]
        ) {
          if (this.upData[this.upHead[i].label]) {
            this.upData[this.upHead[i].label] = JSON.stringify(
              this.upData[this.upHead[i].label]
            );
          } else {
            this.upData[this.upHead[i].label] = "";
          }
        }
      }
      this.upLoad = true;
      this.$axios
        .post(this.upUrl, this.upData, {
          headers: {
            "Content-Type": "application/json",
          },
        })
        .then((res) => {
          if (res.code === 201) {
            this.upLoad = false;
            return;
          }
          this.$message.success("修改成功");
          this.upDia = false;
          this.selectList("page");
          this.$refs.eltable.doLayout();
          this.upLoad = false;
        })
        .catch((e) => {
          this.$message.error("修改失败");
          this.upDia = false;
          this.upLoad = false;
        });
    },
    // æ‰“开新增弹框回调
    openAddDia(addUrl, param) {
      this.addDia = true;
      this.addUrl = addUrl;
      this.param = param;
      this.upData = {};
      this.tableHead.forEach((k, v) => {
        if (
          k.label != "orderBy" &&
          k.label != "createTime" &&
          k.label != "updateTime" &&
          k.label != "createUser" &&
          k.label != "updateUser"
        )
          this.upData[k.label] = null;
      });
      this.upData = this.HaveJson(this.upData);
      this.upHead = this.HaveJson(this.tableHead);
      this.upHead = this.upHead.filter(
        (a) => a.label != "createTime" && a.label != "updateTime"
      );
      var val = this.data.do.filter((a) => a.id == "update")[0];
      if (val == undefined) {
        val = {
          field: [],
        };
      }
      val.field.forEach((a) => {
        if (JSON.stringify(this.upData[a]) === undefined) {
          this.upHead.push({
            value: a.split("=")[0],
            label: a.split("=")[1],
          });
        } else {
          delete this.upData[a];
          for (var i = 0; i < this.upHead.length; i++) {
            if (this.upHead[i].label == a) {
              this.upHead.splice(i, 1);
              i--;
              break;
            }
          }
        }
      });
    },
    // æ–°å¢žå›žè°ƒ
    saveAddData() {
      if (this.addUrl == null) {
        this.$message.error("请给添加请求地址");
        return;
      }
      for (var i = 0; i < this.data.requiredAdd.length; i++) {
        if (
          this.upData[this.data.requiredAdd[i]] === null ||
          this.upData[this.data.requiredAdd[i]] === ""
        ) {
          var list = this.upHead.filter((a) => {
            if (a.label == this.data.requiredAdd[i]) return a;
          });
          if (list[0].value == undefined) continue;
          this.$message.error(list[0].value + "是必填项");
          return;
        }
      }
      this.addLoad = true;
      for (var a in this.data.selectField) {
        if (this.data.selectField[a].choose == true) {
          this.upData[a] = JSON.stringify(this.upData[a]);
        }
      }
      this.upHead.forEach((item, index) => {
        if (this.data.cascaderField && this.data.cascaderField[item.label]) {
          if (this.upData[item.label]) {
            this.upData[item.label] = JSON.stringify(this.upData[item.label]);
          } else {
            this.upData[item.label] = "";
          }
        }
      });
      if (this.param !== undefined && this.param !== null) {
        for (let i in this.param) {
          this.upData[i] = this.param[i];
        }
      }
      this.$axios
        .post(this.addUrl, this.upData, {
          headers: {
            "Content-Type": "application/json",
          },
        })
        .then((res) => {
          if (res.code === 201) {
            this.addLoad = false;
            return;
          }
          this.$message.success("添加成功");
          this.addDia = false;
          this.selectList("page");
          this.addLoad = false;
        })
        .catch((e) => {
          this.addDia = false;
          this.addLoad = false;
        });
    },
    openDownDia() {
      this.downDia = true;
    },
    downFile(type) {
      if (this.downUrl == null) {
        this.$message.error("请给导出请求地址");
        return;
      }
      var page = this.HaveJson(this.page);
      if (!type) {
        page.current = 0;
        page.size = this.total;
      }
      this.loading = true;
      this.$axios
        .post(
          this.downUrl,
          {
            page: page,
            entity: this.data.entity,
          },
          {
            headers: {
              "Content-Type": "application/json",
            },
          }
        )
        .then((res) => {
          if (res.code === 201) {
            this.loading = false;
            return;
          }
          this.downDia = false;
          this.loading = false;
          this.$message.success("导出成功");
          let eleLink = document.createElement("a");
          eleLink.style.display = "none";
          eleLink.download = res.data;
          eleLink.href = this.javaApi + "/outPath/" + res.data;
          document.body.appendChild(eleLink);
          eleLink.click();
          document.body.removeChild(eleLink);
        })
        .catch((e) => {
          console.log(e);
          this.loading = false;
          this.$message.error("请刷新页面再尝试");
        });
    },
    openUpload() {
      if (this.inputUrl == null) {
        this.$message.error("请给导入请求地址");
        return;
      }
      this.uploadDia = true;
    },
    beforeUpload(file, fileList) {
      console.log(file.raw.type);
      if (
        file.raw.type !=
        (this.data.inputType === undefined ? "text/csv" : this.data.inputType)
      ) {
        this.$message.error("上传文件格式不正确");
        this.$refs.upload.clearFiles();
        return false;
      }
    },
    submitUpload() {
      if (this.$refs.upload.uploadFiles.length == 0) {
        this.$message.error("未选择文件");
        return;
      }
      this.uploading = true;
      this.$refs.upload.submit();
    },
    onSuccess(response, file, fileList) {
      this.$refs.upload.clearFiles();
      this.uploadDia = false;
      this.uploading = false;
      if (response.code == 201) {
        this.$message.error(response.message);
        return;
      }
      this.$message.success("上传成功");
      this.selectList();
    },
    onError(err, file, fileList) {
      this.$message.error("上传失败");
      this.$refs.upload.clearFiles();
      this.uploading = false;
    },
    // æ“ä½œæŒ‰é’®ç½®ç°åˆ¤æ–­
    isDisabled(label) {
      if (this.data.disabledUp == undefined) {
        return;
      }
      for (var i = 0; i < this.data.disabledUp.length; i++) {
        if (label == this.data.disabledUp[i]) {
          return true;
        }
      }
      return false;
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        const values = data.map((item) => Number(item[column.property]));
        if (this.data.countFleid == undefined) {
          sums[index] = "";
          return;
        }
        if (
          this.data.countFleid.filter((str) => {
            return str === column.property;
          }).length > 0
        ) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          sums[index] += "";
        } else {
          sums[index] = "";
        }
      });
      return sums;
    },
    handleLinkEvent(row, val) {
      if (val.method == "doDiy") {
        this.main(row, val);
      } else {
        this.$parent[val.method](row);
      }
    },
    getWidth() {
      let count = 0;
      this.data.do.forEach((a) => {
        count += a.font.length;
      });
      return count * 15 + 60 + "px";
    },
    handleSuccessUp(response, label) {
      if (typeof label === "string") {
        if (response.code == 200) {
          this.upData[label] = response.data.url;
        }
      } else {
        if (response.code == 200) {
          this.$message.success("上传成功");
          this.selectList();
        }
      }
    },
    handleCascader(e, label) {
      this.upData[label] = e;
    },
    // æ‰¹é‡åˆ é™¤
    batchDelete() {
      if (this.multipleSelection && this.multipleSelection.length > 0) {
        this.$confirm("是否删除选中的数据?", "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.$axios
              .post(this.delUrl, {
                ids: JSON.stringify(
                  this.multipleSelection.map((item) => item.id)
                ),
              })
              .then((res) => {
                if (res.code === 201) {
                  return;
                }
                this.$message.success("删除成功");
                this.selectList("page");
              })
              .catch((e) => {
                this.$message.error("删除失败");
              });
          })
          .catch(() => {});
      } else {
        this.$message.error("请选择要删除的数据");
      }
    },
    // æ—¥å·¥æ—¶ç®¡ç†è¾…助工时--批量审核和批准
    batchCheck(e) {
      if (this.multipleSelection && this.multipleSelection.length > 0) {
        const list = JSON.parse(JSON.stringify(this.multipleSelection));
        const state = e === 0 ? "不批准" : "已批准";
        let auxiliaryWorkingHoursDays = [];
        list.forEach((item) => {
          delete item.orderBy;
          item.state = state;
          auxiliaryWorkingHoursDays.push(item);
        });
        this.$axios
          .post(
            this.$api.auxiliaryWorkingHoursDay.approve,
            { auxiliaryWorkingHoursDays: auxiliaryWorkingHoursDays },
            {
              headers: {
                "Content-Type": "application/json",
              },
            }
          )
          .then((res) => {
            if (res.code === 201) {
              return;
            }
            this.$parent.submitBatchCheckDialog();
            this.$message.success("操作成功");
          });
      } else {
        this.$message.error("请选择至少一条数据");
      }
    },
    getRedColor(label, row) {
      if (
        this.data.cellSpecialStyle &&
        this.data.cellSpecialStyle.redColorByKey &&
        label.includes(this.data.cellSpecialStyle.redColorByKey) &&
        row[label.replace(this.data.cellSpecialStyle.redColorByKey, "")]
      ) {
        return true;
      } else {
        return false;
      }
    },
  },
};
</script>
src/main.js
@@ -63,7 +63,9 @@
Vue.prototype.HaveJson = (val) => {
  return JSON.parse(JSON.stringify(val));
};
Vue.prototype.javaApi = process.env.VUE_APP_BASE_API;
Vue.prototype.javaApi = process.env.VUE_APP_BASE_API
  ? process.env.VUE_APP_BASE_API
  : "http://192.168.0.170:8002";
Vue.prototype.checkPermi = checkPermi;
// å…¨å±€ç»„件挂载
@@ -74,7 +76,7 @@
Vue.component("FileUpload", FileUpload);
Vue.component("ImageUpload", ImageUpload);
Vue.component("ImagePreview", ImagePreview);
Vue.component('barcode', VueBarcode)
Vue.component("barcode", VueBarcode);
Vue.use(directive);
Vue.use(plugins);
src/utils/excelFountion.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,358 @@
/**
 * è®¡ç®—多个数值的和
 *
 * @param val æ•°å€¼åž‹å‚数,可变长参数列表
 * @returns è¿”回所有参数的和,如果参数列表为空或参数类型非数值型,则返回null
 */
function SUM(...val) {
  try {
    let num = null;
    if (val && val.length > 0) {
      val.forEach((item) => {
        num += item;
      });
    }
    return num;
  } catch (error) {}
}
/**
 * è®¡ç®—传入参数中的最大值
 *
 * @param ...val å¯å˜å‚数列表,用于计算最大值的数值或可转换为数值的类型
 * @returns è¿”回最大值,如果参数列表为空或为null/undefined/'',则返回null
 */
function MAX(...val) {
  try {
    let max = null;
    if (val && val.length > 0) {
      val = val.filter((item) => item != null && item !== "");
      if (val.length > 0) {
        max = Math.max(...val);
      } else {
        max = null;
      }
    }
    return max;
  } catch (error) {}
}
/**
 * è®¡ç®—传入参数中的最小值
 *
 * @param val å¯å˜å‚数,用于计算最小值的数值数组
 * @returns è¿”回传入参数中的最小值,如果传入参数为空或所有值均为null或空字符串,则返回null
 */
function MIN(...val) {
  try {
    let min = null;
    if (val && val.length > 0) {
      val = val.filter((item) => item != null && item !== "");
      // console.log(val)
      if (val.length > 0) {
        min = Math.min(...val);
      }
    }
    return min;
  } catch (error) {}
}
/**
 * è®¡ç®—给定数值的平均值
 *
 * @param val æ•°å€¼åˆ—表,可包含任意个参数
 * @returns è¿”回平均值,如果数值列表为空或包含非数值项,则返回null
 */
function AVERAGE(...val) {
  try {
    let num = null;
    let arr = [];
    if (val && val.length > 0) {
      arr = val.filter((item) => item != null && item !== "");
      arr.forEach((item) => {
        num += item;
      });
      if (arr.length > 0) {
        return num / arr.length;
      } else {
        return null;
      }
    } else {
      return null;
    }
  } catch (error) {}
}
/**
 * è®¡ç®—一个数的绝对值
 *
 * @param val ä»»æ„æ•°å€¼
 * @returns è¿”回该数值的绝对值
 */
function ABS(val) {
  try {
    return Math.abs(val);
  } catch (error) {}
}
/**
 * è®¡ç®—一组数字的中位数
 *
 * @param val ä»»æ„ä¸ªå‚数,需要计算中位数的数字
 * @returns å¦‚果参数中有有效的数字,则返回计算出的中位数;否则返回null
 */
function MEDIAN(...val) {
  try {
    let arr = [];
    if (val && val.length > 0) {
      arr = val.filter((item) => item != null && item !== "");
      const sortedArr = arr.sort((a, b) => a - b);
      // è®¡ç®—中位数
      const half = Math.floor(sortedArr.length / 2);
      if (arr.length > 0) {
        // å¦‚果数组长度是奇数,直接取中间的元素
        if (sortedArr.length % 2 === 1) {
          return sortedArr[half];
        } else {
          // å¦‚果数组长度是偶数,取中间两个元素的平均值
          return (sortedArr[half - 1] + sortedArr[half]) / 2;
        }
      } else {
        return null;
      }
    } else {
      return null;
    }
  } catch (error) {}
}
/**
 * è®¡ç®—幂
 *
 * @param str å­—符串形式的幂表达式,例如"2^3"
 * @returns è¿”回计算后的幂值,如果表达式无效则返回null
 */
function CalculatePower(str) {
  try {
    if (str && str.includes("^")) {
      let arr = str.split("^");
      if (arr && arr.length > 1) {
        return Math.pow(arr[0], arr[1]);
      } else {
        return null;
      }
    }
  } catch (error) {}
}
/**
 * æ ¹æ®åæ ‡èŽ·å–åˆ—å
 * @param {Object} cellId
 */
function getColumnNameFromId(cellId) {
  try {
    if (!Array.isArray(cellId)) {
      cellId = cellId.split("-");
    }
    var i = cellId[0];
    var letter = "";
    if (i > 701) {
      letter += String.fromCharCode(64 + parseInt(i / 676));
      letter += String.fromCharCode(64 + parseInt((i % 676) / 26));
    } else if (i > 25) {
      letter += String.fromCharCode(64 + parseInt(i / 26));
    }
    letter += String.fromCharCode(65 + (i % 26));
    return letter + (parseInt(cellId[1]) + 1);
  } catch (e) {
    console.log("error", cellId);
  }
}
/**
 * æ ¹æ®åˆ—名获取坐标
 * @param {Object} id
 * @param {Object} arr
 */
function getIdFromColumnName(id, arr) {
  try {
    // Get the letters
    var t = /^[a-zA-Z]+/.exec(id);
    if (t) {
      // Base 26 calculation
      var code = 0;
      for (var i = 0; i < t[0].length; i++) {
        code +=
          parseInt(t[0].charCodeAt(i) - 64) * Math.pow(26, t[0].length - 1 - i);
      }
      code--;
      // Make sure jexcel starts on zero
      if (code < 0) {
        code = 0;
      }
      // Number
      var number = parseInt(/[0-9]+$/.exec(id));
      if (number > 0) {
        number--;
      }
      if (arr == true) {
        id = [code, number];
      } else {
        // id = code + '-' + number;
        id = {
          c: code,
          r: number,
        };
      }
    }
    return id;
  } catch (e) {
    console.log("error", id);
  }
}
/**
 * æ›´æ”¹å‚æ•°
 *
 * @param f å‚数列表
 * @returns è¿”回一个包含坐标信息的数组
 */
function changeParameter(f) {
  try {
    let arr = getABCList(f);
    let arr2 = [];
    arr.forEach((item) => {
      if (item.includes(":")) {
        let r0 = getIdFromColumnName(item.split(":")[0]).r;
        let c0 = getIdFromColumnName(item.split(":")[0]).c;
        let r1 = getIdFromColumnName(item.split(":")[1]).r;
        let c1 = getIdFromColumnName(item.split(":")[1]).c;
        for (let i = Number(r0); i <= Number(r1); i++) {
          for (let u = Number(c0); u <= Number(c1); u++) {
            arr2.push({
              r: i,
              c: u,
            });
          }
        }
      } else {
        arr2.push(getIdFromColumnName(item));
      }
    });
    return arr2;
  } catch (error) {}
}
/**
 * èŽ·å–åŒ…å« ABC å­—符的列表
 *
 * @param f å­—符串,包含需要解析的公式或表达式
 * @returns åŒ…含 ABC å­—符的数组列表
 */
function getABCList(f) {
  try {
    let regex = /[=\+\-\*\%\(\)\/\^\s]/g;
    let fouList = ["SUM", "MAX", "MIN", "AVERAGE", "ABS"];
    f = f
      .replace(regex, ",")
      .replace(new RegExp('"&', "g"), "")
      .replace(new RegExp('&"', "g"), "");
    fouList.forEach((item) => {
      f = f.replace(new RegExp(item, "g"), "");
    });
    // console.log('f',f)
    let arr = f.split(",").filter((item) => {
      return (
        item && /[a-zA-Z]/.test(item) && item != "undefined" && item != "null"
      );
    });
    return arr;
  } catch (error) {}
}
/**
 * èŽ·å–æ‰€æœ‰å•å…ƒæ ¼
 *
 * @param f è¡¨æ ¼æ•°æ®æˆ–相关参数
 * @returns è¿”回一个对象,其键为单元格的唯一标识符(由列和行ID拼接而成),值为null
 */
function getAllCell(f) {
  try {
    let arr = changeParameter(f);
    let arr0 = {};
    arr.forEach((item) => {
      arr0[getColumnNameFromId(`${item.c}` + "-" + `${item.r}`)] = null;
    });
    return arr0;
  } catch (error) {}
}
/**
 * è®¡ç®—函数
 *
 * @param f å­—符串类型,表示待计算的公式
 * @param comValue å¯¹è±¡ç±»åž‹ï¼Œè¡¨ç¤ºè¦æ›¿æ¢çš„单元格值,键为单元格名称,值为替换后的值
 * @returns è¿”回计算后的结果,如果计算失败则返回0
 */
function compute(f, comValue) {
  try {
    let str = f;
    // èŽ·å–å•å…ƒæ ¼å¯¹åº”å€¼
    let arr = getAllCell(f);
    for (var a in comValue) {
      if (
        comValue[a] !== "undefined" &&
        comValue[a] !== "null" &&
        comValue[a] !== undefined
      ) {
        if (typeof comValue[a] == "string" && comValue[a].includes("^")) {
          // è®¡ç®—幂次
          arr[a] = CalculatePower(comValue[a]);
        } else if (
          typeof comValue[a] == "string" &&
          comValue[a].includes("/")
        ) {
          arr[a] = comValue[a];
        } else {
          arr[a] = comValue[a];
        }
      }
    }
    // è§£æžå…¬å¼å‚数,特别是带:的
    let arr0 = getABCList(f);
    let obj = {};
    arr0.forEach((item) => {
      if (item.includes(":")) {
        let arr1 = [];
        let r0 = getIdFromColumnName(item.split(":")[0]).r;
        let c0 = getIdFromColumnName(item.split(":")[0]).c;
        let r1 = getIdFromColumnName(item.split(":")[1]).r;
        let c1 = getIdFromColumnName(item.split(":")[1]).c;
        for (let i = Number(r0); i <= Number(r1); i++) {
          for (let u = Number(c0); u <= Number(c1); u++) {
            arr1.push({
              r: i,
              c: u,
            });
          }
        }
        let arr2 = [];
        arr1.forEach((m) => {
          arr2.push(getColumnNameFromId(`${m.c}` + "-" + `${m.r}`));
        });
        obj[item.split(":").join("-")] = arr2.join(",");
      } else {
        obj[item] = item;
      }
    });
    str = str.replace(new RegExp(":", "g"), "");
    // æ›¿æ¢å‚æ•°
    for (var a in obj) {
      str = str.replace(new RegExp(a, "g"), obj[a]);
    }
    // è®¡ç®—
    for (var a in arr) {
      str = str.replace(new RegExp(a, "g"), arr[a]);
    }
    return eval(str);
  } catch (error) {}
}
export default {
  compute,
  changeParameter,
};
src/views/business/inspectionTask/components/EditInspectionItem.vue
@@ -38,7 +38,7 @@
            style="width: 100%"
          >
            <el-option
              v-for="dict in dict.type.inspection_value_type"
              v-for="dict in inspectionValueType"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
@@ -73,7 +73,6 @@
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      dicts: ["inspection_value_type"],
      editInspectionDia: false,
      entity: {
        id: 0,
@@ -164,8 +163,14 @@
        inspectionValueType: "",
      },
      handleEditLoading: false,
      inspectionValueType: [],
    };
  },
  mounted() {
    this.getDicts("inspection_value_type").then((response) => {
      this.inspectionValueType = this.dictToValue(response.data);
    });
  },
  // æ–¹æ³•集合
  methods: {
    showDialog(id) {
src/views/business/inspectionTask/index.vue
@@ -89,43 +89,27 @@
</style>
<template>
  <div class="ins-order-plan-main">
    <div v-show="activeFace == 0 && state == 0" style="height: 100%">
    <div v-show="activeFace == 0" style="height: 100%">
      <div class="search">
        <div class="search_thing">
          <div class="search_label">委托编号:</div>
          <div class="search_input">
            <el-input
              v-model="queryParams.entrustCode"
              clearable
              placeholder="请输入"
              size="small"
              @keyup.enter.native="refreshTable()"
            ></el-input>
            <el-input v-model="queryParams.entrustCode" clearable placeholder="请输入" size="small"
              @keyup.enter.native="refreshTable()"></el-input>
          </div>
        </div>
        <div class="search_thing">
          <div class="search_label">检验状态:</div>
          <div class="search_input">
            <el-select
              v-model="queryParams.insState"
              size="small"
              style="width: 100%"
              @change="refreshTable()"
            >
              <el-option
                v-for="(a, i) in dict.type.inspection_task_state"
                :key="i"
                :label="a.label"
                :value="a.value"
              ></el-option>
            <el-select v-model="queryParams.insState" size="small" style="width: 100%" @change="refreshTable()">
              <el-option v-for="(a, i) in dict.type.inspection_task_state" :key="i" :label="a.label"
                :value="a.value"></el-option>
            </el-select>
          </div>
        </div>
        <div class="search_thing" style="padding-left: 30px">
          <el-button size="small" @click="refresh()">重 ç½®</el-button>
          <el-button size="small" type="primary" @click="refreshTable()"
            >查 è¯¢</el-button
          >
          <el-button size="small" type="primary" @click="refreshTable()">查 è¯¢</el-button>
        </div>
      </div>
      <div class="center">
@@ -135,22 +119,13 @@
              <div style="display: flex; align-items: center">
                <span style="font-size: 14px">试验室种类:</span>
                <ul class="tab">
                  <li
                    v-for="(m, i) in tabList"
                    :key="i"
                    :class="{ active: i == tabIndex }"
                    @click="handleTab(m, i)"
                  >
                  <li v-for="(m, i) in tabList" :key="i" :class="{ active: i == tabIndex }" @click="handleTab(m, i)">
                    {{ m.label.replace("试验室", "") }}
                  </li>
                </ul>
                <div>
                  <el-checkbox
                    v-model="alone"
                    class="view-self-checkbox"
                    @change="changeCheckBox"
                    ><span>我的任务</span></el-checkbox
                  >
                  <el-checkbox v-model="alone" class="view-self-checkbox"
                    @change="changeCheckBox"><span>我的任务</span></el-checkbox>
                </div>
              </div>
            </el-col>
@@ -162,27 +137,17 @@
            </el-col>
          </el-row>
        </div>
        <lims-table
          :tableData="tableData"
          :column="column"
          :page="page"
          :tableLoading="tableLoading"
          :height="'calc(100vh - 300px)'"
          @pagination="pagination"
          key="tableData0"
        ></lims-table>
        <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
          :height="'calc(100vh - 300px)'" @pagination="pagination" key="tableData0"></lims-table>
      </div>
    </div>
    <el-dialog :visible.sync="claimVisible" title="提示" width="400px">
      æ˜¯å¦è®¤é¢†å§”托编号<span style="color: #33c130">{{
        sampleUserForm.entrustCode
      }}</span
      >的任务
      }}</span>的任务
      <span slot="footer" class="dialog-footer">
        <el-button @click="claimVisible = false">取 æ¶ˆ</el-button>
        <el-button :loading="loading" type="primary" @click="confirmClaim"
          >ç¡® å®š</el-button
        >
        <el-button :loading="loading" type="primary" @click="confirmClaim">ç¡® å®š</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="connectVisible" title="检验交接" width="400px">
@@ -191,18 +156,8 @@
          <span class="required-span">* </span>交接人员:
        </div>
        <div class="search_input">
          <el-select
            v-model="connect.connectPerson"
            filterable
            placeholder="请选择"
            style="width: 100%"
          >
            <el-option
              v-for="item in personList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
          <el-select v-model="connect.connectPerson" filterable placeholder="请选择" style="width: 100%">
            <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </div>
@@ -212,39 +167,21 @@
          <span class="required-span">* </span>试验室:
        </div>
        <div class="search_input">
          <el-select
            v-model="connect.sonLaboratory"
            filterable
            placeholder="请选择"
            style="width: 100%"
          >
            <el-option
              v-for="item in sonLaboratoryList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
          <el-select v-model="connect.sonLaboratory" filterable placeholder="请选择" style="width: 100%">
            <el-option v-for="item in sonLaboratoryList" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="connectVisible = false">取 æ¶ˆ</el-button>
        <el-button :loading="loading" type="primary" @click="confirmConnect"
          >ç¡® å®š</el-button
        >
        <el-button :loading="loading" type="primary" @click="confirmConnect">ç¡® å®š</el-button>
      </span>
    </el-dialog>
    <div
      v-if="activeFace > 0 && isCopper == null"
      style="width: 100%; height: 100%"
    >
    <div v-if="activeFace > 0 && isCopper == null" style="width: 100%; height: 100%">
      <!-- <Add :active="activeFace" :currentId="currentId" :examine="examine" /> -->
    </div>
    <div
      v-if="activeFace > 0 && isCopper == 0"
      style="width: 100%; height: 100%"
    >
    <div v-if="activeFace > 0 && isCopper == 0" style="width: 100%; height: 100%">
      <!-- <CustomsInspection
        :active="activeFace"
        :currentId="currentId"
@@ -252,10 +189,7 @@
        :isReport="isReport"
      /> -->
    </div>
    <div
      v-if="activeFace > 0 && isCopper == 1"
      style="width: 100%; height: 100%"
    >
    <div v-if="activeFace > 0 && isCopper == 1" style="width: 100%; height: 100%">
      <!-- <CopperOrder :active="activeFace" :currentId="currentId"></CopperOrder> -->
    </div>
    <!--<Inspection
@@ -271,46 +205,23 @@
    />-->
    <el-dialog :visible.sync="dataDialogVisible" title="数据查看" width="80%">
      <div v-if="dataDialogVisible" style="height: 70vh; overflow-y: auto">
        <lims-table
          :tableData="lookTableData"
          :column="lookColumn"
          :page="lookPage"
          :tableLoading="lookTableLoading"
          :height="'60vh'"
          @pagination="lookPagination"
          key="tableData1"
        ></lims-table>
        <lims-table :tableData="lookTableData" :column="lookColumn" :page="lookPage" :tableLoading="lookTableLoading"
          :height="'60vh'" @pagination="lookPagination" key="tableData1"></lims-table>
      </div>
    </el-dialog>
    <el-dialog
      :visible.sync="bindDialogVisible"
      title="检验项绑定"
      width="600px"
    >
      <div
        slot="title"
        style="
    <el-dialog :visible.sync="bindDialogVisible" title="检验项绑定" width="600px">
      <div slot="title" style="
          display: flex;
          align-items: center;
          justify-content: space-between;
        "
      >
        ">
        <span>检验项绑定</span>
        <el-button
          style="float: right; margin-left: 360px"
          size="small"
          @click="openBindAdd"
          type="primary"
        >
        <el-button style="float: right; margin-left: 360px" size="small" @click="openBindAdd" type="primary">
          æ–°å¢ž
        </el-button>
      </div>
      <el-table :data="bindTableData" style="width: 100%" height="70vh">
        <el-table-column
          prop="inspectionItemClass"
          label="检验项分类"
          width="150"
        >
        <el-table-column prop="inspectionItemClass" label="检验项分类" width="150">
        </el-table-column>
        <el-table-column prop="inspectionItem" label="检验项" width="150">
        </el-table-column>
@@ -318,30 +229,16 @@
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button size="mini" type="text" @click="handleDelete(scope.row)"
              >删除</el-button
            >
            <el-button size="mini" type="text" @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog
      :visible.sync="bindAddDialogVisible"
      title="选择绑定"
      width="600px"
    >
      <el-table
        :data="bindAddTableData"
        style="width: 100%"
        height="60vh"
        @selection-change="handleBindAddSelectionChange"
      >
    <el-dialog :visible.sync="bindAddDialogVisible" title="选择绑定" width="600px">
      <el-table :data="bindAddTableData" style="width: 100%" height="60vh"
        @selection-change="handleBindAddSelectionChange">
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column
          prop="inspectionItemClass"
          label="检验项分类"
          width="150"
        >
        <el-table-column prop="inspectionItemClass" label="检验项分类" width="150">
        </el-table-column>
        <el-table-column prop="inspectionItem" label="检验项" width="150">
        </el-table-column>
@@ -350,17 +247,9 @@
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="bindAddDialogVisible = false">取 æ¶ˆ</el-button>
        <el-button :loading="loading" type="primary" @click="bindAdd"
          >绑 å®š</el-button
        >
        <el-button :loading="loading" type="primary" @click="bindAdd">绑 å®š</el-button>
      </span>
    </el-dialog>
    <!-- <un-pass-retest-result
      v-if="retestVisible"
      :retestInfo="retestInfo"
      :retestVisible="retestVisible"
      @closeRetestLook="closeRetestLook"
    ></un-pass-retest-result> -->
    <!--产业链信息查看-->
    <!-- <ShowInfo
      v-if="showInfoDialog"
@@ -379,11 +268,9 @@
// import Add from "../do/b1-ins-order/add.vue";
// import ShowInfo from "../do/b1-material-ins-order/showInfo.vue";
// import CopperOrder from "../do/b1-material-ins-order/copper-order.vue";
// import UnPassRetestResult from "../do/b1-material-ins-order/unPassRetestResult.vue";
import EditInspectionItem from "./components/EditInspectionItem.vue";
import limsTable from "@/components/Table/lims-table.vue";
import {
  getRetestResult,
  claimInsOrderPlan,
  upPlanUser2,
  upPlanUser,
@@ -406,11 +293,10 @@
    // Inspection,
    // Add,
    // CustomsInspection,
    // UnPassRetestResult
  },
  dicts: ["urgency_level", "inspection_task_state"],
  computed: {
    ...mapGetters(["name", "userId"]),
    ...mapGetters(["nickName", "userId"]),
  },
  data() {
    return {
@@ -435,85 +321,6 @@
      ],
      active: 1,
      tabIndex: 0,
      componentDataDataLook: {
        entity: {
          id: 0,
          orderBy: {
            field: "sampleCode",
            order: "asc",
          },
        },
        isIndex: false,
        showSelect: false,
        select: false,
        do: [
          {
            id: "parent",
            font: "不合格复测查看",
            type: "text",
            method: "getRetestResult",
            disabFun: (row, index) => {
              return row.insResult != 0;
            },
          },
          {
            id: "parent",
            font: "检验项绑定",
            type: "text",
            method: "getBinding",
            disabFun: (row, index) => {
              return (
                this.lookInfo.userName == null ||
                this.lookInfo.insState == 3 ||
                this.lookInfo.insState == 5
              );
            },
          },
        ],
        tagField: {
          insState: {
            select: [],
          },
          insResult: {
            select: [
              {
                value: 1,
                label: "合格",
                type: "success",
              },
              {
                value: 0,
                label: "不合格",
                type: "danger",
              },
              {
                value: 3,
                label: "不判定",
                type: "",
              },
            ],
          },
        },
        selectField: {},
        spanConfig: {
          rows: [
            {
              name: "sampleCode",
              index: 0,
            },
            {
              name: "sample",
              index: 1,
            },
            {
              name: "model",
              index: 6,
            },
          ],
        },
        requiredAdd: [],
        requiredUp: [],
      },
      dataDialogVisible: false,
      planTotal: 0,
      insStateList: [],
@@ -540,7 +347,6 @@
      customsInspection: {},
      showInfoDialog: false, // äº§ä¸šé“¾ä¿¡æ¯æŸ¥çœ‹
      isReport: 0,
      retestVisible: false,
      retestInfo: [],
      isCopper: null,
      bindCurrentInfo: {},
@@ -668,7 +474,7 @@
                  row.userName == null ||
                  row.insState == 3 ||
                  row.insState == 5 ||
                  (row.userName && !row.userName.includes(this.name))
                  (row.userName && !row.userName.includes(this.nickName))
                );
              },
            },
@@ -683,7 +489,7 @@
                  row.userName == null ||
                  row.insState == 5 ||
                  row.insState == 3 ||
                  (row.userName && !row.userName.includes(this.name))
                  (row.userName && !row.userName.includes(this.nickName))
                );
              },
            },
@@ -721,6 +527,7 @@
          type: "",
        },
      ],
      // æ•°æ®æŸ¥çœ‹ç›¸å…³å­—段---开始
      lookTableData: [],
      lookColumn: [
        {
@@ -756,16 +563,6 @@
          label: "操作",
          operation: [
            {
              name: "不合格复测查看",
              type: "text",
              clickFun: (row) => {
                this.getRetestResult(row);
              },
              disabled: (row) => {
                return row.insResult != 0;
              },
            },
            {
              name: "检验项绑定",
              type: "text",
              clickFun: (row) => {
@@ -788,6 +585,7 @@
        current: 0,
      },
      lookTableLoading: false,
      // æ•°æ®æŸ¥çœ‹ç›¸å…³å­—段---结束
    };
  },
  created() {
@@ -837,6 +635,7 @@
          if (res.code === 200) {
            this.lookTableData = res.data.records;
            this.lookPage.total = res.data.total;
            this.dataDialogVisible = true;
          }
        })
        .catch((err) => {
@@ -860,19 +659,6 @@
    handleDataLook(row) {
      this.lookInfo = row;
      this.getLookList();
      this.dataDialogVisible = true;
    },
    // æŸ¥çœ‹ä¸åˆæ ¼å¤æµ‹ç»“æžœ
    getRetestResult(row) {
      getRetestResult({ insProductId: row.insProductId }).then((res) => {
        if (res.code == 201) return;
        this.retestVisible = true;
        this.retestInfo = res.data;
      });
    },
    //
    closeRetestLook() {
      this.retestVisible = false;
    },
    // æƒé™åˆ†é…
    getPower(radio) {
@@ -1023,14 +809,24 @@
      if (row.userName) {
        inspectorList = row.userName.split(",");
      }
      if (this.name) {
        inspectorList.push(this.name);
      if (this.nickName) {
        inspectorList.push(this.nickName);
      }
      this.inspectorList = inspectorList;
      this.sonLaboratory = row.sonLaboratory;
      this.state = 1;
      this.typeSource = row.typeSource;
      this.orderId = row.id;
      this.$router.push({
        path: "/inspectionTask/inspection",
        query: {
          inspectorList: this.inspectorList,
          sonLaboratory: this.sonLaboratory,
          state: this.state,
          typeSource: this.typeSource,
          orderId: this.orderId,
        },
      });
    },
    // æŸ¥çœ‹æ£€éªŒæ•°æ®
    viewInspectInfo(row) {
@@ -1039,8 +835,8 @@
      if (row.userName) {
        inspectorList = row.userName.split(",");
      }
      if (this.name) {
        inspectorList.push(this.name);
      if (this.nickName) {
        inspectorList.push(this.nickName);
      }
      this.inspectorList = inspectorList;
      this.sonLaboratory = row.sonLaboratory;
@@ -1106,7 +902,7 @@
      this.orderId = row.id;
    },
    getAuthorizedPerson() {
      selectUserCondition().then((res) => {
      selectUserCondition({ type: 1 }).then((res) => {
        let data = [];
        res.data.forEach((a) => {
          data.push({
src/views/business/inspectionTask/inspection.vue
@@ -0,0 +1,3290 @@
<template>
  <div v-loading="loading" class="inspection">
    <el-row class="title">
      <el-col :span="4" style="padding-left: 20px; text-align: left">检验单详情
      </el-col>
      <el-col :span="20" style="text-align: right">
        <el-form :inline="true" :model="otherForm" class="form-inline" label-width="50px"
          style="text-align: right; padding-top: 0; display: inline">
          <el-form-item label="温度:" style="margin-bottom: 0">
            <el-input v-model="otherForm.temperature" :disabled="state > 1" placeholder="" size="small"
              style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'temperature')"></el-input>
            <span style="margin-left: 4px">℃</span>
          </el-form-item>
          <el-form-item label="湿度:" style="margin-bottom: 0">
            <el-input v-model="otherForm.humidity" :disabled="state > 1" placeholder="" size="small"
              style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'humidity')"></el-input>
            <span style="margin-left: 4px">%</span>
          </el-form-item>
        </el-form>
        <el-button size="small" type="primary" @click="refreshView">刷新</el-button>
        <el-button v-if="typeSource === 1" size="small" type="primary" @click="openPurchase">进货验证</el-button>
        <el-button v-if="state === 1 && typeSource === 1" size="small" type="primary"
          @click="openUnPassDialog('add')">不合格处理</el-button>
        <el-button size="small" type="primary" @click="
          sampleVisible = true;
        uploadSample();
        ">样品切换</el-button>
        <el-button v-if="state == 1" size="small" type="primary" @click="taskVisible = true">任务切换</el-button>
        <el-button v-if="state == 1" size="small" type="primary" @click="addVerifyDia = true">提交</el-button>
        <!-- å¤æ ¸ -->
        <el-button v-if="state == 2" size="medium" type="primary" @click="openAddCheck">通过</el-button>
        <el-button v-if="state == 2" size="medium" @click="upInsReview(0)">不通过</el-button>
        <el-button type="primary" size="small" @click="exportTable('myTable')">下载原始记录</el-button>
        <el-button size="small" @click="$emit('goback')">返回</el-button>
      </el-col>
    </el-row>
    <div class="search">
      <el-form :inline="true" :model="searchForm" class="form-inline" label-position="right" label-width="100px">
        <el-form-item label="委托编号:">
          <el-input v-model="insOrder.entrustCode" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="样品编号:">
          <el-tooltip :content="currentSample.sampleCode" :disabled="!currentSample.sampleCode">
            <el-input v-model="currentSample.sampleCode" clearable disabled placeholder="请输入" size="small"></el-input>
          </el-tooltip>
        </el-form-item>
        <el-form-item label="样品名称:">
          <el-input v-model="currentSample.sample" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="样品数量:">
          <el-input v-model="sampleProduct.length" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="样品型号:">
          <el-input v-model="currentSample.model" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="下发时间:">
          <el-input v-model="insOrder.sendTime" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="紧急程度:">
          <el-input v-model="insOrder.typeName" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="约定时间:">
          <el-input v-model="insOrder.appointed" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item v-if="typeSource === 1" label="抽检数量:">
          <el-input v-model="insOrder.testQuantity" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item v-if="typeSource === 1" label="厂家密度:">
          <el-input v-model="supplierDensity" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="当前样品位数:">
          <el-tag v-if="currentKey">{{ `NO.${currentKey}` }}</el-tag>
        </el-form-item>
        <el-form-item label="备注:">
          <!--          <span style="color:red">{{ insOrder.remark?insOrder.remark:'-' }}</span>-->
          <el-input v-model="insOrder.remark" :disabled="state !== 1" clearable placeholder="请输入" size="small"
            @blur="subOtherForm(insOrder.remark, 'remark')"></el-input>
          <!-- <el-tag v-if="currentKey">{{ insOrder.remark }}</el-tag> -->
        </el-form-item>
      </el-form>
    </div>
    <div class="center">
      <div class="search" style="
          text-align: left;
          display: flex;
          align-items: center;
          justify-content: space-between;
        ">
        <div style="display: flex; align-items: center">
          <span v-if="tableList.length > 0">检验模板:</span>
          <el-radio-group v-model="currentTable" size="small">
            <el-radio-button v-for="(item, index) in tableLists" :key="index" :label="item.templateId" size="small">{{
              item.templateName }}</el-radio-button>
          </el-radio-group>
        </div>
        <div style="display: flex; align-items: center">
          <el-button v-if="state === 1" size="small" type="primary" @click="openAddUnpass">新增不合格复测</el-button>
          <el-button v-if="state === 1" size="small" type="primary" @click="unpassCheck">不合格复测</el-button>
          <el-button v-if="state > 1" size="small" type="primary" @click="viewUnpassCheck">查看不合格复测</el-button>
          <span v-if="cableTagList.length > 0">&nbsp;&nbsp;电缆配置:</span>
          <el-select v-if="cableTagList.length > 0" v-model="currentTab" clearable placeholder="请选择" size="small"
            @change="(m) => handleChangeCableTag(currentSample.id, 0, 'cableTag', m)
              " @focus="getCableTag(currentSample.id)">
            <el-option v-for="item in cableTagList" :key="item.cableTag" :label="item.cableTag" :value="item.cableTag">
              <span style="float: left">{{ item.cableTag }}</span>
              <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px"
                type="danger">未检</el-tag>
              <el-tag v-if="item.status == 1" size="small" style="float: right; margin-top: 5px"
                type="warning">检验中</el-tag>
              <el-tag v-if="item.status == 2" size="small" style="float: right; margin-top: 5px"
                type="success">已检</el-tag>
            </el-option>
          </el-select>
          <span v-if="repetitionTagList.length > 0">&nbsp;&nbsp;重复检验项:</span>
          <el-select v-if="repetitionTagList.length > 0" v-model="repetitionTag" clearable placeholder="请选择"
            size="small" @change="(m) =>
              handleChangeCableTag(currentSample.id, 0, 'repetitionTag', m)
              " @focus="getRepetitionTag(currentSample.id)">
            <el-option v-for="item in repetitionTagList" :key="item.repetitionTag" :label="item.radius"
              :value="item.repetitionTag">
              <span style="float: left">{{ item.radius }}</span>
              <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px"
                type="danger">未检</el-tag>
              <el-tag v-if="item.status == 1" size="small" style="float: right; margin-top: 5px"
                type="warning">检验中</el-tag>
              <el-tag v-if="item.status == 2" size="small" style="float: right; margin-top: 5px"
                type="success">已检</el-tag>
            </el-option>
          </el-select>
          <span v-if="typeSource == '1'">&nbsp;&nbsp;待检验数量:</span>
          <el-select v-if="typeSource == '1'" v-model="rawMaterialTag" placeholder="请选择" size="small" @change="(m) => handleChangeCableTag(currentSample.id, 4, 'cableTag', m)
            " @focus="getRawMaterialTag(currentSample.id)">
            <el-option v-for="item in rawMaterialTagList" :key="item.rawMaterialTag" :label="item.rawMaterialTag"
              :value="item.rawMaterialTag">
              <span style="float: left">{{ item.rawMaterialTag }}</span>
              <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px"
                type="danger">未检</el-tag>
              <el-tag v-if="item.status == 1" size="small" style="float: right; margin-top: 5px"
                type="warning">检验中</el-tag>
              <el-tag v-if="item.status == 2" size="small" style="float: right; margin-top: 5px"
                type="success">已检</el-tag>
            </el-option>
          </el-select>
          <el-button :loading="dataAcquisitionLoading" v-if="state == 1" size="small" type="primary"
            @click="getDataAcquisitionDevice">数据采集</el-button>
          <el-button :type="dataAcquisitionEidtAble ? '' : 'primary'" v-if="state == 1" size="small"
            @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble">{{ dataAcquisitionEidtAble ? "关闭编辑" : "编辑数采"
            }}</el-button>
        </div>
      </div>
      <!-- å¸¸è§„检验原始记录 -->
      <div v-if="
        !tableLists.find((m) => m.templateId == currentTable) ||
        (tableLists.find((m) => m.templateId == currentTable).templateName !=
          '温度循环检验原始记录' &&
          !tableLists
            .find((m) => m.templateId == currentTable)
            .templateName.includes('热循环') &&
          !tableLists
            .find((m) => m.templateId == currentTable)
            .templateName.includes('温升试验') &&
          tableLists.find((m) => m.templateId == currentTable).templateName !=
          '弧垂特性检验原始记录')
      " id="nav" v-loading="tableLoading" class="center-box">
        <table v-for="(item, index) in tableList" :key="index + currentTable + currentSample.id" border="1"
          cellpadding="10" class="tables" id="myTable">
          <tbody>
            <tr style="white-space: nowrap">
              å§”托编号:{{
                insOrder.entrustCode
              }}
            </tr>
            <tr v-for="(m, i) in item.arr" :key="i">
              <td v-for="(n, j) in m" v-if="n.v.mc == undefined || Object.keys(n.v.mc).length === 4"
                :id="item.templateId + '-' + n.i + '-' + n.r + '-' + n.c" :key="j"
                :colspan="n.v.mc && n.v.mc.cs ? n.v.mc.cs : 1" :rowspan="n.v.mc && n.v.mc.rs ? n.v.mc.rs : 1" :style="`background:${n.v.bg ? n.v.bg : ''};color:${n.v.fc
                  };font-size:${n.v.fs}px;width:${handleWidth(
                    n
                  )}px !important;height:${item.style.rowlen[n.r]}px;font-wight:${n.v.bl ? 'bold' : ''
                  };`">
                <div :class="`content-h-${n.v.ht} content-v-${n.v.vt}`" :style="`width:${handleWidth(n)}px !important;min-height:${item.style.rowlen[n.r]
                  }px;`" class="content">
                  <template v-if="
                    n.v.ps != undefined &&
                    typeof n.v.ps.value === 'string' &&
                    n.v.ps.value.includes('检验值') &&
                    state == 1
                  ">
                    <el-input v-if="getInspectionValueType(n.i) == 1"
                      :key="'abc-' + '000' + index + '000' + i + '000' + j" v-model="n.v.v" :disabled="(getInspectionItemType(n.i) == 1 &&
                        !dataAcquisitionEidtAble) ||
                        (n.u != userId && n.u != undefined && n.u != '')
                        " class="table_input" @change="(m) =>
                          changeInput(
                            m,
                            `${item.templateId}-${n.r}-${n.c}-${n.i}`,
                            n,
                            'getDataType'
                          )
                          " @input="handleInput(n)" @mousewheel.native.prevent @keydown.enter="
                            changeInput(
                              '',
                              `${item.templateId}-${n.r}-${n.c}-${n.i}`,
                              n,
                              'getDataType'
                            )
                            ">
                    </el-input>
                    <el-input v-else-if="getInspectionValueType(n.i) == 2" v-model="n.v.v" :disabled="getInspectionItemType(n.i) == 1 ||
                      (n.u != userId && n.u != undefined && n.u != '')
                      " class="table_input" type="textarea" @change="(m) =>
                        changeInput(
                          m,
                          `${item.templateId}-${n.r}-${n.c}-${n.i}`,
                          n,
                          'getDataType'
                        )
                        " />
                    <!-- <el-select v-else-if="getInspectionValueType(n.i) == 5" v-model="n.v.v" :disabled="state > 1 ||
                      getInspectionItemType(n.i) == 1 ||
                      (n.u != userId && n.u != undefined && n.u != '')
                      " class="table_input" @change="(m) =>
                        changeInput(
                          m,
                          `${item.templateId}-${n.r}-${n.c}-${n.i}`,
                          n,
                          'getDataType'
                        )
                        " @visible-change="(e) => getDic(e, n.i)">
                      <el-option v-for="(e, i) in enumList" :key="i" :label="e.label" :value="e.value"></el-option>
                    </el-select> -->
                    <span v-else-if="getInspectionValueType(n.i) == 4"
                      :style="`font-family:${n.v.ff} !important;`">/</span>
                  </template>
                  <template v-else-if="n.v.ps != undefined && n.v.ps.value === '结论'">
                    <el-select v-if="
                      (getInspectionValueType(n.i) == 2 ||
                        getInspectionValueType(n.i) == 5) &&
                      state == 1
                    " v-model="n.v.v" class="table_input" @change="(m) =>
                      changeInput(
                        m,
                        `${item.templateId}-${n.r}-${n.c}-${n.i}`,
                        n,
                        'getDataType',
                        'changeSelect'
                      )
                      ">
                      <el-option :value="1" label="合格"></el-option>
                      <el-option :value="0" label="不合格"></el-option>
                      <el-option :value="3" label="不判定"></el-option>
                      <el-option :value="2" label="待定"></el-option>
                    </el-select>
                    <template v-if="state > 1">
                      <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">合格</span>
                      <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">不合格</span>
                      <span v-else-if="n.v.v === 3"
                        :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">不判定</span>
                      <span v-else :style="`font-family:${n.v.ff} !important;`">待定</span>
                    </template>
                    <template v-if="
                      PROJECT == '检测中心' ||
                      (PROJECT == '装备电缆' &&
                        getInspectionValueType(n.i) != 2 &&
                        state == 1)
                    ">
                      <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">合格</span>
                      <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">不合格</span>
                      <span v-else-if="n.v.v === 3"
                        :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">不判定</span>
                      <span v-else :style="`font-family:${n.v.ff} !important;`">待定</span>
                    </template>
                  </template>
                  <template v-else-if="
                    n.v.ps != undefined &&
                    n.v.ps.value === '设备编码' &&
                    state == 1
                  ">
                    <span>{{ n.v.v }}</span>
                  </template>
                  <template v-else-if="
                    n.v.ps != undefined && n.v.ps.value === '设备名称'
                  ">
                    <el-select v-model="n.v.v" :disabled="state > 1" class="table_input" filterable multiple
                      placeholder="设备" remote @change="(val) => changeEquip(val, n)"
                      @visible-change="(e) => getEquipOptions(e, n.i)">
                      <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.value">
                        {{ item.label + "--" + item.value }}
                      </el-option>
                    </el-select>
                  </template>
                  <template v-else-if="
                    n.v.ps != undefined &&
                    n.v.ps.value === '要求值' &&
                    state == 1
                  ">
                    <span :style="`font-family:${n.v.ff} !important;`">{{
                      getTell(n.i)
                    }}</span>
                  </template>
                  <template v-else-if="
                    n.v.ps != undefined &&
                    n.v.ps.value === '计算值' &&
                    state == 1
                  "><span :style="`font-family:${n.v.ff} !important;`">{{
                    toFixed(n.v.v, n.v.ct)
                      }}</span></template>
                  <template v-else-if="
                    n.v.ps != undefined &&
                    n.v.ps.value === '最终值' &&
                    state == 1
                  ">
                    <span :style="`font-family:${n.v.ff} !important;`">{{
                      toFixed(n.v.v, n.v.ct)
                    }}</span>
                  </template>
                  <template v-else-if="
                    n.v.ps != undefined && n.v.ps.value === '样品编号'
                  ">
                    <div :title="currentSample.sampleCode" style="
                        display: flex;
                        flex-wrap: nowrap;
                        align-items: center;
                        width: 100%;
                      ">
                      <i v-if="!currentFiberOpticTape && !currentFiberOptic" class="el-icon-caret-left table_caret"
                        style="width: 16px" @click="caretSample(-1)"></i>
                      <div
                        :style="`font-family:${n.v.ff} !important;overflow: hidden;white-space: nowrap;width: calc(100% - 32px);`">
                        {{ currentSample.sampleCode }}
                      </div>
                      <i v-if="!currentFiberOpticTape && !currentFiberOptic" class="el-icon-caret-right table_caret"
                        style="width: 16px" @click="caretSample(1)"></i>
                    </div>
                  </template>
                  <template v-else-if="
                    n.v.ps != undefined && n.v.ps.value === '样品型号'
                  ">
                    <div v-if="
                      currentSample.model !== undefined &&
                      currentSample.model !== null
                    " :style="`font-family:${n.v.ff} !important;`">
                      {{ currentSample.model }}
                    </div>
                  </template>
                  <span v-else :style="`font-family:${n.v.ff} !important;`" v-html="getValue(n.v)"></span>
                </div>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <el-upload v-if="state == 1" ref="upload" :action="action" :before-upload="beforeUpload" :data="{
        orderId: id,
      }" :headers="headers" :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false"
        accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar" style="width: 80px !important">
        <el-button v-if="state == 1" size="small" type="primary">附件上传</el-button></el-upload>
      <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
        :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table>
      <!-- <ValueTable :key="upIndex" ref="fileList" :componentData="componentData0" :delUrl="$api.insOrderPlan.delfile"
        :url="$api.insOrderPlan.getFileList" class="value-table" style="height: 100%; margin-top: 16px" /> -->
    </div>
    <el-drawer :size="550" :visible.sync="sampleVisible" title="样品切换">
      <el-table v-if="sampleVisible" ref="productTable" :current-row-key="currentKey" :data="sampleProduct"
        :row-class-name="tableRowClassName" :row-key="(record) => record.index" border class="el-table" height="100%"
        highlight-current-row tooltip-effect="dark" @row-click="handleChangeSample">
        <el-table-column :key="Math.random()" align="center" label="序号" type="index" width="70px">
        </el-table-column>
        <el-table-column label="样品编号" min-width="100px" prop="sampleCode" show-overflow-tooltip></el-table-column>
        <el-table-column label="样品型号" min-width="100px" prop="model" show-overflow-tooltip></el-table-column>
        <el-table-column label="检测状态" prop="insState" show-overflow-tooltip width="100px">
          <template slot-scope="scope">
            <el-tag v-for="(item, i) in typeList" v-if="item.value == scope.row.insState" :key="i" :type="item.type"
              size="medium" style="margin-right: 5px">{{ item.label }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="检验人" min-width="80px" prop="checkName" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="是否留样" prop="isLeave" show-overflow-tooltip width="95px">
          <template slot-scope="scope">
            <span>{{ scope.row.isLeave == 0 ? "否" : "是" }}</span>
          </template>
        </el-table-column>
        <!-- æ£€éªŒå•会有一个是否有配套样品字段控制显示 -->
        <el-table-column v-if="insOrder.mating > 0" label="配套样品型号" min-width="130px" prop="joinModel"
          show-overflow-tooltip></el-table-column>
        <el-table-column v-if="insOrder.mating > 0" label="配套样品名称" min-width="130px" prop="joinName"
          show-overflow-tooltip></el-table-column>
        <el-table-column v-if="insOrder.mating > 0" label="配套样品数量" min-width="130px" prop="joinNum"
          show-overflow-tooltip></el-table-column>
      </el-table>
    </el-drawer>
    <el-drawer :size="500" :visible.sync="taskVisible" title="任务切换">
      <!-- <ValueTable :key="upIndex" ref="insOrderPlan" :componentData="componentData"
        :url="$api.insOrderPlan.inspectionOrderDetailsTaskSwitching" class="value-table" style="height: 100%" /> -->
    </el-drawer>
    <el-dialog :visible.sync="reviewDia" title="检验复核" width="500px">
      <div v-if="reviewDia" class="body" style="display: flex; padding: 10px">
        <div class="search_label" style="width: 150px">
          <span class="required-span">* </span>不通过的理由:
        </div>
        <div class="search_input" style="width: 100%">
          <el-input v-model="noReason" :autosize="{ minRows: 4 }" clearable size="small" type="textarea"></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="reviewDia = false">取 æ¶ˆ</el-button>
        <el-button :loading="reviewLoading" type="primary" @click="handleReviewDia">ç¡® å®š</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="addVerifyDia" title="指定复核人员" width="400px">
      <div class="body" style="display: flex; padding: 10px; align-items: center">
        <div class="search_label" style="width: 150px">
          <span class="required-span">*</span>复核人
        </div>
        <div class="search_input" style="width: 100%">
          <el-select v-model="verifyUser" clearable filterable placeholder="请选择" size="small" style="width: 100%">
            <el-option v-for="(item, i) in personList" :key="i" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addVerifyDia = false">取 æ¶ˆ</el-button>
        <el-button :loading="submitLoading" type="primary" @click="submit()">ç¡® å®š</el-button>
      </span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false"
      :visible.sync="dataGetDia" title="数据采集" width="80%">
      <div>
        <table border="1" cellpadding="10" class="thermal-table">
          <tr>
            <td style="width: 120px">检验项分类</td>
            <td style="width: 120px">检验项</td>
            <td style="width: 120px">检验子项</td>
            <td>数采数据</td>
          </tr>
          <template v-for="(item, index) in getData">
            <tr>
              <td :rowspan="item.child.length">{{ item.sortName }}</td>
              <td :rowspan="item.child.length">{{ item.faName }}</td>
              <td>{{ item.child[0].name }}</td>
              <td style="text-align: left">
                <el-select v-if="item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1"
                  :multiple-limit="item.child[0].maxNum" clearable filterable multiple placeholder="请选择"
                  @change="setData(item)">
                  <el-option v-for="(item, index) in item.child[0].arr" :key="index" :filter-method="filterMethod"
                    :label="index + 1 + '^' + item.result" :value="index + '^' + item.result">
                    <span>{{
                      "序号:" +
                      (index + 1) +
                      "," +
                      "结果:" +
                      item.result +
                      "," +
                      "厚度:" +
                      item.thickness +
                      "," +
                      "时间:" +
                      item.mergedDateTime
                    }}</span>
                  </el-option>
                </el-select>
                <el-checkbox-group v-if="!item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1"
                  :max="item.child[0].maxNum">
                  <el-checkbox v-for="(n, j) in item.child[0].arr" :key="j" :label="j + '^' + n">{{ n }}</el-checkbox>
                </el-checkbox-group>
              </td>
            </tr>
            <tr v-for="(m, i) in item.child" v-show="i > 0" :key="i + 'bbbbbbbbbbbbbb'">
              <td>{{ m.name }}</td>
              <td style="text-align: left">
                <el-select v-if="m.isShowSelect" v-model="m.getDataIndex1" :multiple-limit="m.maxNum" clearable
                  filterable multiple placeholder="请选择">
                  <el-option v-for="(item, index1) in m.arr" :key="index1" :label="index + 1 + '^' + item.result"
                    :value="index1 + '^' + item.result">
                    <span>{{
                      "序号:" +
                      (index1 + 1) +
                      "," +
                      "结果:" +
                      item.result +
                      "," +
                      "厚度:" +
                      item.thickness +
                      "," +
                      "时间:" +
                      item.mergedDateTime
                    }}</span>
                  </el-option>
                </el-select>
                <el-checkbox-group v-if="!m.isShowSelect" v-model="m.getDataIndex1" :max="m.maxNum">
                  <el-checkbox v-for="(n, j) in m.arr" :key="j" :label="j + '^' + n">{{ n }}</el-checkbox>
                </el-checkbox-group>
              </td>
            </tr>
          </template>
        </table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dataGetDia = false">取 æ¶ˆ</el-button>
        <el-button :loading="getDataIndexLoading" type="primary" @click="submitDataGet()">ç¡® å®š</el-button>
      </span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :visible.sync="addCheck" title="指定报告审核人员" width="400px"
      @close="closeAddVerifyDia">
      <div class="body" style="display: flex; padding: 10px; align-items: center">
        <div class="search_label" style="width: 150px">
          <span class="required-span">*</span>审核人:
        </div>
        <div class="search_input" style="width: 100%">
          <el-select v-model="checkUser" clearable filterable placeholder="请选择" size="small" style="width: 100%">
            <el-option v-for="(item, i) in personList" :key="i" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeAddVerifyDia">取 æ¶ˆ</el-button>
        <el-button :loading="reviewLoading" type="primary" @click="upInsReview(1)">ç¡® å®š</el-button>
      </span>
    </el-dialog>
    <add-un-pass v-if="addUnPassDialog" ref="addUnPassDialog" :addUnPassDialog="addUnPassDialog"
      @resetAddUnPass="resetAddUnPass"></add-un-pass>
    <!-- <UnPassDialog
      v-if="unPassDialog"
      ref="unPassDialog"
      :orderId="orderId"
      :unPassDialog="unPassDialog"
      @resetForm="resetForm"
    ></UnPassDialog> -->
    <!-- <InspectionWord
      v-if="unPassCheck"
      :inspectorList="inspectorList"
      :orderId="orderId"
      :rawMaterialTag="rawMaterialTag"
      :sonLaboratory="sonLaboratory"
      :state="state"
      :typeSource="typeSource"
      :unPassCheck="unPassCheck"
      @closeUnPassCheckDialog="closeUnPassCheckDialog"
      @refreshView="refreshView"
    /> -->
    <!-- <purchase-verification
      v-if="purchaseDialog"
      ref="purchaseDialog"
      :orderId="orderId"
      :purchaseDialog="purchaseDialog"
      @resetPurchaseDialog="resetPurchaseDialog"
    ></purchase-verification> -->
  </div>
</template>
<script>
import excelFunction from "@/utils/excelFountion";
import limsTable from "@/components/Table/lims-table.vue";
// import UnPassDialog from "../b1-unpass-manage/unPassDialog.vue";
// import AddUnPass from "../b1-unpass-manage/addUnPass.vue";
// import InspectionWord from "./InspectionWord.vue";
// import PurchaseVerification from "../b1-unpass-manage/PurchaseVerification.vue";
import {
  doInsOrder,
  getCableTag,
  getRepetitionTag,
  getRawMaterialTag,
  dataCollection,
  write,
  getInsProduct,
  getReportModel,
  determineWhetherToCollectData,
  search,
  verifyPlan,
  checkSubmitPlan,
  submitPlan,
  saveInsContext,
  selectUserCondition,
  downFile,
  getFileList,
  delfile
} from "@/api/business/inspectionTask.js";
import html2canvas from "html2canvas";
import { mapGetters } from "vuex";
export default {
  // props: ["sonLaboratory", "orderId", "state", "inspectorList", "typeSource"],
  components: {
    // PurchaseVerification,
    // AddUnPass,
    limsTable,
    // UnPassDialog,
    // InspectionWord,
  },
  data() {
    return {
      sonLaboratory: null,
      orderId: null,
      state: null,
      inspectorList: null,
      typeSource: null,
      sagData: [],
      sagForm: {
        sampleCode: null,
        model: null,
        inspection: null,
        methodName: null,
        tensileForce: null,
        spanLength: null,
        load: null,
      },
      dataGetDia: false,
      wareTableDataLoading: false,
      fileAdd: false,
      sampleVisible: false,
      taskVisible: false,
      submitLoading: false,
      searchForm: {
        sampleName: null,
        state: null,
      },
      id: null,
      componentData: {
        entity: {
          sonLaboratory: null,
          userId: 0,
        },
        isIndex: false,
        showSelect: false,
        select: false,
        selectMethod: "handleChangeTask",
        sort: false,
        do: [],
        isPage: false,
        linkEvent: {},
        tagField: {
          type: {
            select: [],
          },
          insState: {
            select: [],
          },
        },
        currentId: "",
        selectField: {},
        requiredAdd: [],
        requiredUp: [],
      },
      changeType: null,
      getReportModelLoading: false,
      insOrder: {},
      sampleProduct: [],
      supplierDensity: "", // åŽ‚å®¶å¯†åº¦
      typeList: [],
      urgentList: [],
      currentSample: {}, //当前样品信息
      tableList: [],
      loading: false,
      ps: {},
      param: {},
      currentKey: 1,
      currentKey0: 1,
      currentKey1: 1,
      currentKey2: 1,
      comparisonList: [],
      excelMethodList: [],
      equipOptions: [],
      reviewLoading: false,
      reviewDia: false,
      noReason: "",
      tableWidth: 1000,
      currentTable: null,
      tableLists: [],
      widthList: [],
      addVerifyDia: false,
      verifyUser: null,
      personList: [],
      enumList: [],
      fiberOpticVisible: false,
      fiberOpticTapeVisible: false,
      bushingVisible: false,
      fiberOpticTape: [], //光纤带列表
      fiberOptic: [], //光纤列表
      bushing: [], //套管列表
      currentFiberOpticTape: null, //当前光纤带
      currentFiberOptic: null, //当前光纤
      currentBushing: null, //当前套管
      tableLoading: false,
      upLoading: false,
      temptList: null,
      fiber: [],
      fibers: [],
      casing: [],
      currentTab: null,
      wareForm: {
        inspectionItem: 1,
        inspectionItemSubclass: "20(常温)",
      },
      wareForm0: {},
      numOptions: [],
      temperatureOptions: [],
      wareTableData: [],
      otherForm: {
        humidity: null,
        temperature: null,
      },
      equipForm: {
        value0: null,
        code0: null,
        value1: null,
        code1: null,
      },
      result: null,
      worker: null,
      worker0: null,
      wareLength: [],
      dataAcquisitionInfo: {},
      dataAcquisitionInfoNew: {},
      dataAcquisitionEidtAble: false,
      isGet: false,
      dataAcquisitionLoading: false,
      collected: false,
      // çƒ­å¾ªçޝ---开始
      thermalCyclingInfo: {
        max: 0,
        inspectionItem: 1,
        arr: [],
        length: 1,
        inspectionItemClass: null,
      },
      thermalCyclingLoading: false,
      temDataAcquisition: false,
      getData: [
        {
          faName: "波长附加衰减",
          child: [
            {
              name: "1285nm~1330nm",
              arr: [12, 13, 14, 15],
            },
            {
              name: "1525nm~1575nm",
              arr: [12, 13, 14, 15],
            },
          ],
        },
        {
          faName: "截至波长",
          child: [
            {
              name: "截至波长",
              arr: [12, 13, 14, 15],
            },
          ],
        },
      ],
      getDataIndex: [],
      getDataIndexLoading: false,
      getDataTypeId: "",
      getDataType: null,
      unPassDialog: false, // ä¸åˆæ ¼å¤„理弹框
      cableTagList: [],
      rawMaterialTag: "", // æ‰¹æ¬¡
      rawMaterialTagList: [], // æ‰¹æ¬¡é€‰é¡¹
      addCheck: false, // æŒ‡å®šå®¡æ ¸äººå‘˜å¼¹æ¡†
      checkUser: "",
      addUnPassDialog: false,
      type: "",
      retestTag: "",
      unPassCheck: false,
      unPassTableList: [],
      unPassTableLoading: false,
      purchaseDialog: false, // è¿›è´§éªŒè¯åŽŸå§‹è®°å½•å¼¹æ¡†
      temCableTag: "",
      repetitionTagList: [],
      repetitionTag: "",
      // æ–‡ä»¶åˆ—表相关--开始
      tableData: [],
      column: [
        {
          label: "类型", prop: "type", dataType: "tag",
          formatData: (params) => {
            if (params == 1) {
              return '图片'
            } else {
              return '文件'
            }
          },
        },
        { label: "附件名称", prop: "fileName" },
        { label: "上传人", prop: "name" },
        { label: "上传时间", prop: "createTime" },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          operation: [
            {
              name: "下载",
              type: "text",
              clickFun: (row) => {
                this.handleDown(row);
              },
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
                this.handleDelete(row);
              },
              disabled: (row) => {
                return this.state != 1;
              },
            },
          ],
        },
      ],
      page: {
        total: 0,
        size: 10,
        current: 0,
      },
      tableLoading: false,
      // æ–‡ä»¶åˆ—表相关--结束
    };
  },
  // ç”¨äºŽä¸Šä¼ æ–‡ä»¶çš„信息
  computed: {
    ...mapGetters(["userId"]),
    headers() {
      return {
        token: sessionStorage.getItem("token"),
      };
    },
    action() {
      return this.javaApi + "/insOrderPlan/uploadFile";
    },
  },
  created() {
    this.componentData.entity.sonLaboratory = this.sonLaboratory;
    this.getUserInfo();
    let { sonLaboratory, orderId, state, inspectorList, typeSource } =
      this.$route.query;
    this.sonLaboratory = sonLaboratory;
    this.orderId = orderId;
    this.id = this.orderId;
    this.state = state;
    this.inspectorList = inspectorList;
    this.typeSource = typeSource;
  },
  mounted() {
    this.getTypeDicts(); // èŽ·å–ç´§æ€¥ç¨‹åº¦ä¸‹æ‹‰æ¡†é€‰é¡¹
    this.getInsStateDicts();
    this.getComparisonList();
    this.getAuthorizedPerson();
    this.scrollInit();
    // this.getPower();
    this.startWorker();
  },
  watch: {
    // ç›‘听任务id,获取任务信息
    id(val) {
      this.loading = true;
      doInsOrder({
        id: val,
        laboratory: this.sonLaboratory,
      }).then(async (res) => {
        this.insOrder = res.data.insOrder;
        this.supplierDensity = res.data.supplierDensity;
        this.getList()
        this.urgentList.forEach((m) => {
          if (m.value == this.insOrder.type) {
            this.insOrder.typeName = m.label;
          }
        });
        this.loading = false;
        if (!res.data.sampleProduct || res.data.sampleProduct.length == 0) {
          this.$emit("goback");
          return this.$message.error("该任务没有样品信息");
        }
        // èµ‹å€¼å½“前样品列表
        this.sampleProduct = res.data.sampleProduct;
        this.currentSample = this.HaveJson(this.sampleProduct[0]);
        let insProduct = this.HaveJson(this.currentSample.insProduct);
        // æ¸©åº¦ã€æ¹¿åº¦èµ‹å€¼
        this.otherForm = {
          temperature: this.insOrder.temperature
            ? this.insOrder.temperature
            : null,
          humidity: this.insOrder.humidity ? this.insOrder.humidity : null,
        };
        if (this.typeSource == "1") {
          this.getRawMaterialTag(this.currentSample.id); // åŽŸææ–™çš„æ£€éªŒä»»åŠ¡æŸ¥è¯¢æ‰¹æ•°
          this.rawMaterialTag = "1";
        }
        this.getEquipOptions(1);
        // èŽ·å–å½“å‰æ ·å“çš„æ£€éªŒé¡¹
        let list = await this.getCurrentProduct(this.currentSample.id, 0);
        this.currentSample.insProduct = this.HaveJson(list);
        // åˆå§‹åŒ–传递到后端的参数
        this.param = {};
        this.changeType = 0;
        this.currentSample.insProduct.forEach((a) => {
          // æ˜¯å¦ä¸ºæˆå“ç”µç¼†ä¸‹çš„æ¾å¥—管项目,不是则执行初始化
          if (this.handleCasing(a.inspectionItem)) {
            this.param[a.id] = {
              insValue: [],
              comValue: [],
              resValue: null,
              equipValue: [],
              equipName: [],
              insResult: null,
            };
          }
        });
        this.determineWhetherToCollectData(); //是否需要数采
        this.getReportModel(this.currentSample.id); //获取套管、光纤带、光纤信息
        if (this.currentSample.index == undefined)
          this.currentSample["index"] = 1;
        let bushing = this.currentSample.bushing;
        this.getTableLists(); //处理模板列表信息
        this.componentData.currentId = val;
        this.currentKey = 1;
        this.getCableTag(this.currentSample.id); // æŸ¥è¯¢æ˜¯å¦æœ‰è¦å¤šæ¬¡æ£€éªŒçš„电缆配置
        this.getRepetitionTag(this.currentSample.id); // æŸ¥è¯¢æ˜¯å¦æœ‰è¦é‡å¤æ£€éªŒé¡¹
        // æ¸…空光纤配置相关数据---下面信息暂时可忽略
        this.fiberOpticTape = [];
        this.currentFiberOpticTape = null;
        this.fiberOptic = [];
        this.currentFiberOptic = null;
        this.bushing = [];
        this.currentBushing = null;
        this.currentTab = null;
        if (bushing && bushing.length > 0) {
          this.bushing = bushing;
        }
      });
    },
    // ç›‘听当前模板变化
    currentTable(val1, val0) {
      if (val0 != null && val1 != val0) {
        if (this.changeType && this.changeType > 0) {
          // å¦‚果是光纤、光纤带,则不执行下面操作
          return;
        }
        this.tableLists.forEach(async (m, i) => {
          if (m.templateId == val1) {
            let list = await this.getCurrentProduct(this.currentSample.id, 0);
            this.currentSample.insProduct = this.HaveJson(list); //赋值当前样品的检验项
            this.param = {}; //初始化传到后端的参数
            this.currentSample.insProduct.forEach((a, j) => {
              if (this.handleCasing(a.inspectionItem)) {
                this.param[a.id] = {
                  insValue: [],
                  comValue: [],
                  resValue: null,
                  equipValue: [],
                  equipName: [],
                  insResult: null,
                };
              }
            });
            this.getReportModel(this.currentSample.id); //获取套管、光纤带、光纤信息
            // åŽ»é‡æ¨¡æ¿ï¼Œè¿”å›žæœ‰å‡ ä¸ªæ¨¡æ¿
            const mySet1 = new Set();
            this.tableLists = this.currentSample.insProduct.filter((m) => {
              let num0 = mySet1.size;
              if (m.templateId != null && m.template != null) {
                try {
                  mySet1.add(
                    JSON.stringify({
                      template: m.template,
                      templateId: m.templateId,
                    })
                  );
                } catch (error) {
                  console.log(222, error);
                }
              }
              let num1 = mySet1.size;
              if (num1 > num0) {
                return m;
              }
            });
            if (this.tableLists && this.tableLists.length > 0) {
              this.tableList = null;
              this.tableList = this.tableLists.filter(
                (m) => m.templateId == val1
              );
              // å¯¹æ¨¡æ¿è¿›è¡Œå¤„理
              this.handleTableData();
            }
          }
        });
      }
    },
    // ç‰¹æ®Šæ£€éªŒé¡¹--监听设备信息改变
    equipForm: {
      deep: true,
      handler(val) { },
    },
  },
  beforeDestroy() {
    // åœ¨ç»„件销毁前确保停止 Worker,避免内存泄漏
    this.stopWorker();
  },
  methods: {
    // æ–‡ä»¶ç®¡ç†--开始
    getList() {
      this.tableLoading = true;
      let param = { ...this.page };
      delete param.total;
      getFileList({ insOrderId: this.id, ...param })
        .then((res) => {
          this.tableLoading = false;
          if (res.code === 200) {
            this.tableData = res.data.records;
            this.page.total = res.data.total;
          }
        })
        .catch((err) => {
          this.tableLoading = false;
        });
    },
    pagination({ page, limit }) {
      this.page.current = page;
      this.page.size = limit;
      this.getList();
    },
    handleDelete(row) {
      this.$confirm("是否删除该条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          delfile({ id: row.id }).then((res) => {
            if (res.code == 201) return;
            this.$message.success("删除成功");
            this.refresh();
          });
        })
        .catch(() => { });
    },
    // æ–‡ä»¶ç®¡ç†--结束
    closeAddVerifyDia() {
      this.addCheck = false;
      this.checkUser = "";
    },
    // åˆ·æ–°é¡µé¢
    refreshView() {
      this.$emit("refreshView");
    },
    closeUnPassCheckDialog() {
      this.unPassCheck = false;
    },
    // æŸ¥è¯¢æ˜¯å¦æœ‰è¦å¤šæ¬¡æ£€éªŒçš„电缆配置
    getCableTag() {
      getCableTag({
        id: this.currentSample.id,
        laboratory: this.sonLaboratory,
      }).then((res) => {
        if (res.code === 200 && res.data.length > 0) {
          this.cableTagList = res.data;
        }
      });
    },
    // æŸ¥è¯¢æ˜¯å¦æœ‰è¦é‡å¤æ£€éªŒé¡¹
    getRepetitionTag() {
      getRepetitionTag({
        id: this.currentSample.id,
        laboratory: this.sonLaboratory,
        cableTag: this.temCableTag,
      }).then((res) => {
        if (res.code === 200) {
          this.repetitionTagList = res.data;
        }
      });
    },
    getRawMaterialTag() {
      getRawMaterialTag({
        id: this.currentSample.id,
        laboratory: this.sonLaboratory,
      }).then((res) => {
        if (res.code === 200) {
          res.data.forEach((item) => {
            this.rawMaterialTagList = res.data;
          });
        }
      });
    },
    // æ·»åŠ éœ€è¦å¤æµ‹çš„ä¸åˆæ ¼æ£€éªŒé¡¹
    openAddUnpass() {
      this.addUnPassDialog = true;
      const info = {
        id: this.currentSample.id,
        type: this.type,
        laboratory: this.sonLaboratory,
        cableTag: "",
        rawMaterialTag: this.rawMaterialTag,
      };
      this.$nextTick(() => {
        this.$refs.addUnPassDialog.getInsOrder(info);
      });
    },
    resetAddUnPass() {
      this.addUnPassDialog = false;
    },
    // è¿›è¡Œä¸åˆæ ¼å¤æµ‹
    unpassCheck() {
      this.unPassCheck = true;
      this.retestTag = "1";
    },
    viewUnpassCheck() {
      this.unPassCheck = true;
      this.retestTag = "1";
    },
    // æ‰“开不合格处理弹框
    openUnPassDialog(type) {
      this.unPassDialog = true;
      this.$nextTick(() => {
        this.$refs.unPassDialog.getInsOrder(type);
      });
    },
    // å…³é—­ä¸åˆæ ¼å¤„理弹框
    resetForm() {
      this.$refs.unPassDialog.$refs["unPassForm"].resetFields();
      this.unPassDialog = false;
    },
    // æ‰“开进货验证弹框
    openPurchase() {
      const operationType = this.state === 1 ? "add" : "view";
      this.purchaseDialog = true;
      const item = {
        id: this.currentSample.id,
        sonLaboratory: this.sonLaboratory,
        cableTag: this.temCableTag,
        rawMaterialTag: this.rawMaterialTag,
        typeSource: this.typeSource,
      };
      this.$nextTick(() => {
        this.$refs.purchaseDialog.getInsOrder(operationType, item);
      });
    },
    resetPurchaseDialog() {
      this.$refs.purchaseDialog.$refs["purchaseForm"].resetFields();
      this.purchaseDialog = false;
    },
    // æ•°æ®é‡‡é›†
    getDataAcquisitionDevice() {
      let itemIds = [];
      this.currentSample.insProduct.forEach((item) => {
        if (item.inspectionItemType === "1") {
          itemIds.push(item.id);
        }
      });
      const params = {
        entrustCode: this.insOrder.entrustCode,
        sampleCode: this.currentSample.sampleCode,
        id: this.currentSample.id,
        itemIds: itemIds,
      };
      this.dataAcquisitionLoading = true;
      dataCollection(params).then((res) => {
        this.dataAcquisitionLoading = false;
        if (res.code != 200) {
          return;
        }
        this.dataAcquisitionInfoNew = this.HaveJson(res.data);
        // å¯¹æ•°é‡‡å›žæ¥çš„值进行处理
        this.handleDataAcquisition(res.data);
      });
    },
    objectOrder(obj) {
      let newkey = Object.keys(obj).sort();
      let newObj = {};
      for (let i = 0; i < newkey.length; i++) {
        newObj[newkey[i]] = obj[newkey[i]];
      }
      return newObj;
    },
    handleDataAcquisition(data, noDialog) {
      // æ˜¯å¦å¯ä»¥ç¼–辑数采数据
      if (this.dataAcquisitionEidtAble) {
        this.getDataType = 1;
      } else {
        this.getDataType = 2;
      }
      this.dataAcquisitionInfo = {};
      this.getData = [];
      for (let i in this.objectOrder(data)) {
        console.log("i---", i);
        let obj = {};
        if (i.includes("@")) {
          obj = {
            faName: i.split("@")[0],
            sortName: i.split("@")[1],
            child: [],
          };
        } else {
          obj = {
            faName: i,
            child: [],
          };
        }
        // å¾ªçŽ¯æ•°é‡‡æ•°æ®
        for (let j in data[i]) {
          // æ‹¼æŽ¥å­—符串  æ£€éªŒé¡¹åˆ†ç±»+检验项+检验子项
          let str0 = "";
          if (i.includes("@")) {
            if (i.split("@")[0] == j) {
              str0 = i.split("@")[0] + ",";
            } else {
              str0 = i.split("@")[1] + "," + i.split("@")[0] + "," + j;
            }
          } else {
            if (i == j) {
              str0 = i + ",";
            } else {
              str0 = i + "," + j;
            }
          }
          if (
            j != "frequency" &&
            data[i][j] &&
            (!data[i][j].result || typeof data[i][j].result == "string")
          ) {
            // å¤„理数采信息格式
            if (data[i][j].result) {
              this.dataAcquisitionInfo[str0] = {
                value: data[i][j].result,
                frequency: data[i].frequency,
              };
            }
            let list = this.tableList[0].arr;
            // å¾ªçŽ¯é¡µé¢åˆ—è¡¨ä¿¡æ¯ï¼Œåˆ¤æ–­æ•°é‡‡æ•°æ®å¯¹åº”é¡µé¢åˆ—è¡¨ä¿¡æ¯çš„æ£€éªŒé¡¹æ˜¯å“ªä¸ªï¼Œå¹¶ç»™å½“å‰æ£€éªŒé¡¹ç»‘å®šè®¾å¤‡ä¿¡æ¯
            list.forEach((item, index) => {
              let num0 = 0;
              let str = "";
              item.forEach((m) => {
                if (
                  m.v.ps &&
                  (m.v.ps.value == "检验子项" ||
                    m.v.ps.value == "检验项" ||
                    m.v.ps.value == "检验项分类")
                ) {
                  if (m.v.ps && m.v.ps.value == "检验项分类") {
                    if (num0 == 0) {
                      num0++;
                      str = m.v.v + ",";
                    }
                  }
                  if (m.v.ps && m.v.ps.value == "检验项") {
                    if (num0 == 1) {
                      str = str + m.v.v + ",";
                      num0++;
                    } else {
                      str = m.v.v + ",";
                      num0++;
                    }
                  }
                  if (m.v.ps && m.v.ps.value == "检验子项") {
                    str = str + m.v.v;
                  }
                }
                // ç»‘定设备信息
                if (
                  data[i][j].equipName &&
                  data[i][j].equipValue &&
                  m.v &&
                  m.v.ps &&
                  m.v.ps.value == "设备名称" &&
                  str0 == str
                ) {
                  if (!m.v.v) {
                    // this.changeEquip(data[i][j].equipValue,m,data[i][j].equipName)
                  }
                }
              });
            });
          } else if (
            j != "frequency" &&
            data[i][j] &&
            Array.isArray(data[i][j].result)
          ) {
            // å¦‚果返回的数采数据是数组,则处理数组
            // ä»¥ä¸‹é€»è¾‘为获取每个检验项可输入的检验值的最大个数
            let str0 = "";
            if (i.includes("@")) {
              if (i.split("@")[0] == j) {
                str0 = i.split("@")[0] + ",";
              } else {
                str0 = i.split("@")[1] + "," + i.split("@")[0] + "," + j;
              }
            } else {
              if (i == j) {
                str0 = i + ",";
              } else {
                str0 = i + "," + j;
              }
            }
            let list = this.tableList[0].arr;
            let maxNum = 0;
            list.forEach((item, index) => {
              let num0 = 0;
              let str = "";
              item.forEach((m) => {
                if (
                  m.v.ps &&
                  (m.v.ps.value == "检验子项" ||
                    m.v.ps.value == "检验项" ||
                    m.v.ps.value == "检验项分类")
                ) {
                  if (m.v.ps && m.v.ps.value == "检验项分类") {
                    if (num0 == 0) {
                      num0++;
                      str = m.v.v + ",";
                    }
                  }
                  if (m.v.ps && m.v.ps.value == "检验项") {
                    if (num0 == 1) {
                      str = str + m.v.v + ",";
                      num0++;
                    } else {
                      str = m.v.v + ",";
                      num0++;
                    }
                  }
                  if (m.v.ps && m.v.ps.value == "检验子项") {
                    str = str + m.v.v;
                  }
                  let num = 0;
                  list[index].forEach((n) => {
                    if (
                      n.v.ps &&
                      n.v.ps.value &&
                      typeof n.v.ps.value == "string" &&
                      n.v.ps.value.includes("检验值")
                    ) {
                      num++;
                    }
                  });
                  if (str0 == str) {
                    maxNum = num;
                  }
                }
                // ç»‘定设备
                if (
                  data[i][j].equipName &&
                  data[i][j].equipValue &&
                  m.v &&
                  m.v.ps &&
                  m.v.ps.value == "设备名称" &&
                  str0 == str
                ) {
                  if (!m.v.v) {
                    // this.changeEquip(data[i][j].equipValue,m,data[i][j].equipName)
                  }
                }
              });
            });
            // èŽ·å–åˆ°æœ€å¤§æ£€éªŒå€¼è¾“å…¥ä¸ªæ•°åŽé‡ç»„æ•°æ®
            let obj0 = {
              name: j,
              arr: data[i][j].result,
              maxNum: maxNum,
              equipValue: data[i][j].equipValue,
              value: [],
            };
            // å¦‚果数采返回的数组长度大于最大输入个数,则将数采数据在弹框中展示,用户选择需要手动选择数采的信息
            if (
              (data[i][j].result &&
                Array.isArray(data[i][j].result) &&
                data[i][j].result.length > maxNum &&
                noDialog !== "noDialog") ||
              (obj0.equipValue === "JCZX-ZB-FF01014" && noDialog !== "noDialog")
            ) {
              obj.child.push(obj0);
            } else {
              this.dataAcquisitionInfo[str0] = {
                value: data[i][j].result,
              };
            }
          }
        }
        // å¾ªçŽ¯æ•°é‡‡æ•°æ®
        if (obj.child.length > 0) {
          obj.child.forEach((m) => {
            this.$set(m, "getDataIndex1", []);
            // è®¾å¤‡é€‰æ‹©ä¸ºæ‹‰åŠ›æœºï¼Œå°±æ˜¾ç¤ºå¤šé€‰ä¸‹æ‹‰æ¡†
            if (m.equipValue === "JCZX-ZB-FF01014") {
              this.$set(m, "isShowSelect", true);
            } else {
              this.$set(m, "isShowSelect", false);
            }
          });
          this.getData.push(obj);
        }
      }
      // å¦‚果存在数采返回的数组长度大于最大输入个数,则弹出弹框选择
      if (this.getData.length > 0) {
        this.dataGetDia = true;
      } else {
        // å¦‚果都不存在,则,进入处理数采线程里去处理数据
        try {
          // å‘ Worker å‘送消息,开始处理逻辑
          this.getDataIndexLoading = false;
          this.dataGetDia = false;
          this.getDataTypeId = "";
          this.worker0.postMessage(
            JSON.stringify({
              dataAcquisitionInfo: this.dataAcquisitionInfo,
              list: this.tableList[0].arr,
            })
          );
        } catch (error) {
          console.log(1111, error);
        }
      }
      // ç›‘听 Worker è¿”回的结果
      this.worker0.onmessage = (event) => {
        let result = JSON.parse(event.data);
        if (result.method == "changeInput") {
          // é‡‡é›†åŽçš„æ•°æ®ï¼Œéœ€è¦è¿›è¡Œè®¡ç®—的线程进行计算
          let { list, n } = result.value;
          this.$set(this.tableList[0], "arr", list);
          this.changeInput(
            "",
            `${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,
            n
          );
        } else if (result.getDataTypeId) {
          // èŽ·å–åˆ°æ•°é‡‡æœ€åŽä¸€é¡¹ï¼Œæ£€éªŒé¡¹çš„ID
          this.getDataTypeId = result.getDataTypeId;
        }
      };
      this.dataAcquisitionLoading = false;
    },
    setData(item) {
      if (item.child.length > 1) {
        let arr1 = [];
        // å¤šä¸ªæ£€éªŒå­é¡¹çš„话,第一个检验子项选的第几个下面的就赋值第几个
        for (let j = 0; j < item.child.length; j++) {
          let arr = [];
          if (j === 0) {
            for (let k = 0; k < item.child[j].getDataIndex1.length; k++) {
              let val1 = item.child[j].getDataIndex1[k];
              const index = val1.indexOf("^");
              if (index > -1) {
                val1 = val1.substring(0, index);
                arr.push(val1);
              }
            }
            arr1 = arr;
          } else {
            this.$set(item.child[j], "getDataIndex1", []);
            arr1.map((a) => {
              const value1 = a + "^" + item.child[j].arr[Number(a)].result;
              item.child[j].getDataIndex1.push(value1);
            });
          }
        }
      }
    },
    // æ‹‰åŠ›æœºæ•°é‡‡
    filterMethod(val) {
      console.log("val---", val);
    },
    // å¦‚果存在数采返回的数组长度大于最大输入个数,则弹出弹框选择,这里是弹框的提交
    submitDataGet() {
      for (let i = 0; i < this.getData.length; i++) {
        for (let j = 0; j < this.getData[i].child.length; j++) {
          // å¯¹ç”¨æˆ·é€‰æ‹©çš„æ•°é‡‡ä¿¡æ¯è¿›è¡Œå¤„理,赋值
          let arr = [];
          for (
            let k = 0;
            k < this.getData[i].child[j].getDataIndex1.length;
            k++
          ) {
            if (this.getData[i].child[j].getDataIndex1[k].includes("^")) {
              const index =
                this.getData[i].child[j].getDataIndex1[k].indexOf("^");
              if (index > -1) {
                this.getData[i].child[j].getDataIndex1[k] = this.getData[
                  i
                ].child[j].getDataIndex1[k].slice(
                  index + 1,
                  this.getData[i].child[j].getDataIndex1[k].length
                );
              }
            }
            arr.push(this.getData[i].child[j].getDataIndex1[k]);
          }
          if (this.getData[i].sortName) {
            this.dataAcquisitionInfoNew[
              this.getData[i].faName + "@" + this.getData[i].sortName
            ][this.getData[i].child[j].name].result = arr;
          } else {
            this.dataAcquisitionInfoNew[this.getData[i].faName][
              this.getData[i].child[j].name
            ].result = arr;
          }
        }
      }
      this.getDataIndexLoading = true;
      // èµ‹å€¼å®ŒæˆåŽéœ€è¦å†æ¬¡è¿›å…¥å¤„理数采线程里去处理数据
      this.handleDataAcquisition(this.dataAcquisitionInfoNew, "noDialog");
    },
    // å¤šçº¿ç¨‹
    startWorker() {
      if (this.worker) {
        this.stopWorker(); // ç¡®ä¿ä¹‹å‰çš„ Worker å·²åœæ­¢
      }
      // åˆ›å»º Worker å®žä¾‹
      this.worker = new Worker("/static/js/worker.js");
      if (this.worker0) {
        this.stopWorker(); // ç¡®ä¿ä¹‹å‰çš„ Worker å·²åœæ­¢
      }
      // åˆ›å»º Worker å®žä¾‹
      this.worker0 = new Worker("/static/js/worker0.js");
    },
    // åœæ­¢å¤šçº¿ç¨‹
    stopWorker() {
      if (this.worker) {
        this.worker.terminate();
        this.worker = null;
      }
      if (this.worker0) {
        this.worker0.terminate();
        this.worker0 = null;
      }
    },
    // çƒ­å¾ªçޝ---结束
    // ä¿å­˜æ¹¿åº¦ã€æ¸©åº¦æ•°æ®
    subOtherForm(m, type) {
      console.log("m---", m);
      write({
        [type]: type === "remark" ? m : Number(m),
        id: this.insOrder.id,
      }).then((res) => {
        if (res.code == 201) return;
        this.$message.success("保存成功");
      });
    },
    exportTable(tableId) {
      // èŽ·å–table元素
      var table = document.getElementById(tableId);
      // ä½¿ç”¨html2canvas库生成canvas
      html2canvas(table).then(function (canvas) {
        // åˆ›å»ºä¸€ä¸ªå›¾ç‰‡å…ƒç´ 
        var img = canvas.toDataURL("image/png");
        // åˆ›å»ºä¸€ä¸ªa标签模拟点击进行下载
        var a = document.createElement("a");
        a.href = img;
        a.download = "table.png";
        a.click();
      });
    },
    // æƒé™èŽ·å–
    getPower() {
      let power = JSON.parse(sessionStorage.getItem("power"));
      let fileDel = false;
      let fileAdd = false;
      let collected = false;
      let temDataAcquisition = false;
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == "uploadFile") {
          fileAdd = true;
        }
        if (power[i].menuMethod == "delfile") {
          fileDel = true;
        }
        if (power[i].menuMethod == "isItAllowedToModifyTheCollectedValues") {
          collected = true;
        }
        if (power[i].menuMethod == "temDataAcquisition") {
          temDataAcquisition = true;
        }
      }
      if (!fileDel) {
        // this.componentData0.do.splice(1, 1);
      }
      this.fileAdd = fileAdd;
      this.collected = collected;
      this.temDataAcquisition = temDataAcquisition;
    },
    uploadSample() {
      doInsOrder({
        id: this.id,
        laboratory: this.sonLaboratory,
      }).then(async (res) => {
        this.sampleProduct = res.data.sampleProduct;
      });
    },
    // æ ¹æ®ç±»åž‹ã€ä»»åŠ¡id、实验室来获取样品的检验项信息
    async getCurrentProduct(id, type, cableTag) {
      if (cableTag === undefined) {
        cableTag = "";
      }
      this.tableLoading = true;
      type = this.typeSource == "1" ? 5 : type;
      this.type = type;
      let res = await getInsProduct({
        id: id,
        type: type,
        laboratory: this.sonLaboratory,
        cableTag: (cableTag ? cableTag : this.temCableTag),
        rawMaterialTag: this.rawMaterialTag,
        repetitionTag: this.repetitionTag
      });
      this.tableLoading = false;
      if (res.data.length > 0) {
        return res.data;
      }
    },
    // åˆ‡æ¢æ ·å“
    async handleChangeSample(row, column, event) {
      // åˆå§‹åŒ–数据
      this.param = {};
      // æ¸…空光纤配置相关数据
      this.fiberOpticTape = [];
      this.currentFiberOpticTape = null;
      this.fiberOptic = [];
      this.currentFiberOptic = null;
      this.bushing = [];
      this.currentBushing = null;
      this.sampleVisible = false;
      // èµ‹å€¼æ ·å“
      this.currentSample = this.HaveJson(row);
      let list = await this.getCurrentProduct(row.id, 0);
      // èµ‹å€¼æ ·å“æ£€éªŒé¡¹
      this.currentSample.insProduct = this.HaveJson(list);
      // åˆå§‹åŒ–后端传参
      this.param = {};
      this.changeType = 0;
      this.currentSample.insProduct.forEach((a, j) => {
        if (this.handleCasing(a.inspectionItem)) {
          this.param[a.id] = {
            insValue: [],
            comValue: [],
            resValue: null,
            equipValue: [],
            equipName: [],
            insResult: null,
          };
        }
      });
      // èŽ·å–å¥—ç®¡,光纤带,光纤数据
      this.getReportModel(row.id);
      let bushing = this.currentSample.bushing;
      if (bushing && bushing.length > 0) {
        this.bushing = bushing;
      }
      // å¤„理页面列表数据
      this.getTableLists();
      this.currentKey = row.index;
      this.currentTab = null;
      // å‘多线程去保存页面列表数据,后端传参,当前模板信息
      this.worker.postMessage(
        JSON.stringify({
          modelType: this.sampleProduct[0].model,
          type: "saveData",
          tableList: this.tableList,
          param: this.param,
          currentTable: this.currentTable,
        })
      );
    },
    // æ¾å¥—管的判断\如果changeType不等于3那么页面不展示松套管检验项
    handleCasing(inspectionItem) {
      if (this.changeType != 3) {
        if (inspectionItem.includes("松套管")) {
          return false;
        } else {
          return true;
        }
      } else {
        return true;
      }
    },
    // èŽ·å–å¥—ç®¡,光纤带,光纤数据
    getReportModel(id) {
      if (this.PROJECT != "检测中心") {
        return;
      }
      this.getReportModelLoading = true;
      getReportModel({
        sampleId: id
      }).then((res) => {
        this.getReportModelLoading = false;
        this.fibers = res.data["光纤带"];
        this.fiber = res.data["光纤"];
        this.casing = res.data["套管"];
      });
    },
    async handleChangeCableTag(m, type, num, m2) {
      let cableTag = "";
      let repetitionTag = "";
      if (num === "cableTag") {
        cableTag = m2;
        this.temCableTag = cableTag;
        this.getRepetitionTag();
      }
      if (num === "repetitionTag") {
        repetitionTag = m2;
        this.repetitionTag = repetitionTag;
      }
      if (!m2) {
        type = 0;
      }
      this.changeType = type;
      if (m) {
        let list = await this.getCurrentProduct(m, type, cableTag);
        if (list && list.length > 0) {
          this.param = {};
          list.forEach((a) => {
            this.param[a.id] = {
              insValue: [],
              comValue: [],
              resValue: null,
              equipValue: [],
              equipName: [],
              insResult: null,
            };
          });
          this.getTableLists0(list);
          this.getReportModel(this.currentSample.id);
          this.worker.postMessage(
            JSON.stringify({
              type: "saveData",
              tableList: this.tableList,
              param: this.param,
              currentTable: this.currentTable,
              bushing: m,
            })
          );
        } else {
          this.tableLists = [];
          this.tableList = [];
          this.$message.error("检验项为空");
        }
      }
    },
    // æ”¹å˜ä»»åŠ¡
    handleChangeTask(row) {
      if (row.length > 0) this.id = row[0].id;
      this.taskVisible = false;
    },
    // å­—典获取信息
    getTypeDicts() {
      this.getDicts("urgency_level").then((response) => {
        this.urgentList = this.dictToValue(response.data);
        this.componentData.tagField.type.select = this.urgentList;
      });
    },
    // å­—典获取信息
    getInsStateDicts() {
      this.getDicts("inspection_task_state").then((response) => {
        this.typeList = this.dictToValue(response.data);
        this.componentData.tagField.insState.select = this.typeList;
      });
    },
    // å­—典获取信息
    getComparisonList() {
      this.getDicts("coordinate_transformation").then((response) => {
        this.comparisonList = this.dictToValue(response.data);
      });
    },
    // èŽ·å–æ£€éªŒå€¼ä¸ºä¸‹æ‹‰æ—¶çš„ä¸‹æ‹‰åˆ—è¡¨
    // selectEnumByCategoryOfSelect(val) {
    //   this.enumList = [];
    //   if (val === undefined || val === null) {
    //     return;
    //   }
    //   this.$axios
    //     .post(this.$api.enums.selectEnumByCategory, {
    //       category: val,
    //     })
    //     .then((res) => {
    //       this.enumList = res.data;
    //     });
    // },
    tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    // å¤„理页面列表数据--去重,生成检验模板切换列表
    getTableLists() {
      const mySet1 = new Set();
      this.tableLists = this.currentSample.insProduct.filter((m) => {
        let num0 = mySet1.size;
        if (m.templateId != null && m.template != null) {
          try {
            mySet1.add(
              JSON.stringify({
                template: m.template,
                templateId: m.templateId,
              })
            );
          } catch (error) {
            console.log(222, error);
          }
        }
        let num1 = mySet1.size;
        if (num1 > num0) {
          return m;
        }
      });
      if (this.tableLists && this.tableLists.length > 0) {
        this.tableList = null;
        this.tableList = [this.tableLists[0]];
        this.currentTable = this.tableLists[0].templateId;
        // å¤„理页面列表数据
        this.handleTableData();
      }
    },
    // å…‰çº¤é…ç½®ç›¸å…³æ¨¡æ¿table列表
    getTableLists0(list) {
      const mySet1 = new Set();
      this.tableLists = list.filter((m) => {
        let num0 = mySet1.size;
        if (m.templateId != null && m.template != null) {
          try {
            mySet1.add(
              JSON.stringify({
                template: m.template,
                templateId: m.templateId,
              })
            );
          } catch (error) {
            console.log(333, error);
          }
        }
        let num1 = mySet1.size;
        if (num1 > num0) {
          return m;
        }
      });
      if (this.tableLists && this.tableLists.length > 0) {
        this.tableList = null;
        this.tableList = [this.tableLists[0]];
        this.currentTable = this.tableLists[0].templateId;
        this.currentSample.insProduct = this.HaveJson(list);
        // å¤„理页面列表数据
        this.handleTableData();
      }
    },
    // å¤„理页面列表数据
    handleTableData() {
      this.excelMethodList = []; //excel函数列表
      this.widthList = this.tableList[0].style.columnlen; //页面宽度--根据模板来的
      // æœ¬æ¬¡å¾ªçŽ¯ä¸»è¦åšé¡µé¢æ¸²æŸ“å±‚é¢çš„å¤„ç†--单元格合并预处理
      this.tableList.forEach((a) => {
        let mcList = a.template.filter(
          (b) =>
            b.v.mc != undefined &&
            b.v.mc.cs != undefined &&
            b.v.mc.rs != undefined
        );
        let count = 0;
        // å°† a.template è½¬æ¢ä¸º Map ä»¥åŠ é€ŸæŸ¥æ‰¾
        let templateMap = new Map();
        a.template.forEach((item) => {
          templateMap.set(`${item.c}-${item.r}`, item);
        });
        mcList.forEach((b) => {
          let cs = b.v.mc.cs;
          let rs = b.v.mc.rs;
          for (let i = 0; i < cs; i++) {
            for (let i2 = 0; i2 < rs; i2++) {
              let key = `${b.c + i}-${b.r + i2}`;
              let item = templateMap.get(key);
              if (item) {
                let bb = this.HaveJson(b);
                item.v.v = bb.v.v;
                item.v.ps = bb.v.ps;
                item.v.fc = bb.v.fc;
                item.v.fs = bb.v.fs;
                item.v.ht = bb.v.ht;
                item.mc = count;
              }
            }
          }
          count++;
        });
      });
      // æœ¬æ¬¡å¾ªçŽ¯ä¸»è¦æ˜¯æŽ§åˆ¶åˆå¹¶,以及控制检验项信息是否展示出来,以便后续检验
      this.tableList.forEach((a) => {
        let dels = new Set(); //需要删除的行
        let ids = []; //所有检验项的id
        let set3 = new Set();
        a.template.forEach((b) => {
          let size1 = set3.size;
          let size2 = set3.add(b.r).size;
          if (size1 < size2) {
            let str = "";
            let str2 = "";
            let unit2 = "";
            let count4 = 0;
            let isThree = 0;
            a.template.forEach((c) => {
              // èŽ·å–åˆ° æ£€éªŒé¡¹åˆ†ç±»+检验项+检验子项的拼接,如果模板里的信息跟接口返回的检验项信息能够匹配则展示出来
              if (b.r === c.r) {
                if (
                  c.v.ps != undefined &&
                  c.v.ps.value === "检验项分类" &&
                  count4 === 0
                ) {
                  // ä¸‰çº§åˆ†ç±»
                  isThree = 1;
                } else if (
                  c.v.ps != undefined &&
                  c.v.ps.value === "检验项" &&
                  count4 === 0
                ) {
                  // äºŒçº§åˆ†ç±»
                  isThree = 0;
                }
                if (isThree == 0) {
                  if (c.v.ps != undefined && c.v.ps.value === "检验项") {
                    if (count4 === 0) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
                    }
                  } else if (
                    c.v.ps != undefined &&
                    c.v.ps.value === "检验子项"
                  ) {
                    if (count4 === 1) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
                    }
                  }
                } else if (isThree == 1) {
                  if (c.v.ps != undefined && c.v.ps.value === "检验项分类") {
                    if (count4 === 0) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
                    }
                  } else if (c.v.ps != undefined && c.v.ps.value === "检验项") {
                    if (count4 === 1) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
                    }
                  } else if (
                    c.v.ps != undefined &&
                    c.v.ps.value === "检验子项"
                  ) {
                    if (count4 === 2) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
                    }
                  }
                }
                if (str === "机械性能干态拉伸强度(纵向)") {
                  if (c.v.ps != undefined && c.v.ps.value === "单位") {
                    if (c.v.v) {
                      c.v.v = c.v.v.replace(/\s*/g, "");
                    }
                    str2 = str + c.v.v;
                    unit2 = c.v.v;
                  }
                }
              }
            });
            if (str != "") {
              let count2 = 0;
              for (let i in this.currentSample.insProduct) {
                let inspectionItemClass =
                  this.currentSample.insProduct[i].inspectionItemClass ==
                    null ||
                    this.currentSample.insProduct[i].inspectionItemClass ==
                    undefined
                    ? ""
                    : this.currentSample.insProduct[i].inspectionItemClass;
                inspectionItemClass = inspectionItemClass.replace(/\s*/g, "");
                let inspectionItem =
                  this.currentSample.insProduct[i].inspectionItem == null ||
                    this.currentSample.insProduct[i].inspectionItem == undefined
                    ? ""
                    : this.currentSample.insProduct[i].inspectionItem;
                inspectionItem = inspectionItem.replace(/\s*/g, "");
                let inspectionItemSubclass =
                  this.currentSample.insProduct[i].inspectionItemSubclass ==
                    null ||
                    this.currentSample.insProduct[i].inspectionItemSubclass ==
                    undefined
                    ? ""
                    : this.currentSample.insProduct[i].inspectionItemSubclass;
                inspectionItemSubclass = inspectionItemSubclass.replace(
                  /\s*/g,
                  ""
                );
                if (inspectionItemSubclass === "干态拉伸强度(纵向)") {
                  // æ£€éªŒå­é¡¹ä¸º'干态拉伸强度(纵向)'时,模版里是两个计算值对应相同的检验值并且计算方式不同,要根据相同的'单位'做特殊的渲染
                  const unit = this.currentSample.insProduct[i].unit;
                  if (
                    (this.currentSample.insProduct[i].templateId ===
                      a.templateId &&
                      inspectionItemClass +
                      inspectionItem +
                      inspectionItemSubclass +
                      unit ===
                      str2) ||
                    (this.currentSample.insProduct[i].templateId ===
                      a.templateId &&
                      !unit2.includes("/") &&
                      inspectionItemClass +
                      inspectionItem +
                      inspectionItemSubclass ===
                      str)
                  ) {
                    ids.push({
                      r: b.r,
                      id: this.currentSample.insProduct[i].id,
                      product: this.currentSample.insProduct[i],
                    });
                    break;
                  }
                } else {
                  // å¦‚果相等,那么说明找到了,并且把id存起来,后续检验项也会在页面中显示出来
                  if (
                    this.currentSample.insProduct[i].templateId ===
                    a.templateId &&
                    inspectionItemClass +
                    inspectionItem +
                    inspectionItemSubclass ===
                    str
                  ) {
                    ids.push({
                      r: b.r,
                      id: this.currentSample.insProduct[i].id,
                      product: this.currentSample.insProduct[i],
                    });
                    break;
                  }
                }
                count2++;
              }
              if (count2 == this.currentSample.insProduct.length) {
                dels.add(b.r);
              }
            }
          }
        });
        // æ“ä½œåˆ é™¤
        dels.forEach((del) => {
          for (let b = 0; b < a.template.length; b++) {
            if (a.template[b].r === del) {
              a.template.splice(b, 1);
              b -= 1;
            }
          }
        });
        // æ“ä½œèµ‹å€¼--主要赋值单位,试验方法等信息
        ids.forEach((id) => {
          for (let b = 0; b < a.template.length; b++) {
            if (a.template[b].r === id.r) {
              a.template[b].i = id.id;
              if (
                a.template[b].v.ps != undefined &&
                a.template[b].v.ps.value === "单位"
              ) {
                a.template[b].v.v = id.product.unit;
              }
              if (
                a.template[b].v.ps != undefined &&
                (a.template[b].v.ps.value === "试验方法" ||
                  a.template[b].v.ps.value === "检测方法")
              ) {
                a.template[b].v.v = id.product.methodS;
              }
            }
          }
        });
        let set2 = new Set();
        // åˆå¹¶çš„æ•°æ®å¤„理,cs  rs  ä»£è¡¨åˆå¹¶çš„æ•°é‡
        a.template.forEach((b) => {
          let size1 = set2.size;
          let size2 = set2.add(b.mc).size;
          if (b.mc != undefined && size1 < size2) {
            b.v.mc.rs = 0;
            b.v.mc.cs = 0;
            a.template.forEach((c) => {
              if (b.mc === c.mc) {
                if (b.r === c.r) {
                  b.v.mc.cs += 1;
                }
                if (b.c === c.c) {
                  b.v.mc.rs += 1;
                }
              }
            });
          }
        });
      });
      // æœ¬æ¬¡å¾ªçŽ¯ä¸»è¦æ˜¯å¯¹åŽç«¯ä¼ å‚è¿›è¡Œåˆå§‹åŒ–,样式逻辑修改
      this.tableList.forEach((a) => {
        let arrs = [];
        let set = new Set();
        let count1 = 0;
        let conclusionList = []; //结论列表
        let finalList = []; //最终值列表
        // ç»“论与最终值在这里一一对应,以下两个列表长度肯定是一样的,如果有不一样,那么多半是模板配置得问题
        conclusionList = a.template.filter(
          (n) => n.v.ps != undefined && n.v.ps.value === "结论"
        ); //结论列表
        finalList = a.template.filter(
          (n) => n.v.ps != undefined && n.v.ps.value === "最终值"
        ); //最终值列表
        a.template.forEach((b) => {
          if (
            b.v.ps != undefined &&
            b.v.ps.value === "序号" &&
            (b.v.mc == undefined || Object.keys(b.v.mc).length === 4)
          ) {
            // å¯¹åºå·è¿›è¡Œèµ‹å€¼
            count1++;
            b.v.v = count1;
          }
          if (b.v.ps != undefined && b.v.ps.value === "要求值") {
            // å¯¹è¦æ±‚值进行赋值
            b.v.v = this.getAsk(b.i);
          }
          // å¯¹é¡µé¢çš„和给后端传参的检验值,计算值,设备编码,设备名称,最终值,结论进行初始化
          if (
            b.v.ps != undefined &&
            typeof b.v.ps.value === "string" &&
            b.v.ps.value.includes("检验值")
          ) {
            this.$set(b.v, "v", "");
            // b.v.v = ''
            b.u = "";
            b.i && this.param[b.i] && this.param[b.i].insValue.push(b);
          }
          if (b.v.ps != undefined && b.v.ps.value === "计算值") {
            this.$set(b.v, "v", "");
            // b.v.v = ''
            b.i && this.param[b.i] && this.param[b.i].comValue.push(b);
          }
          if (b.v.ps != undefined && b.v.ps.value === "设备编码") {
            // b.v.v = ''
            this.$set(b.v, "v", "");
            b.i && this.param[b.i] && this.param[b.i].equipValue.push(b);
          }
          if (b.v.ps != undefined && b.v.ps.value === "设备名称") {
            this.$set(b.v, "v", "");
            // b.v.v = ''
            b.i && this.param[b.i] && this.param[b.i].equipName.push(b);
          }
          if (b.v.ps != undefined && b.v.ps.value === "最终值") {
            // b.v.v = ''
            this.$set(b.v, "v", "");
            if (
              b.i !== undefined &&
              this.param[b.i] &&
              !this.param[b.i].resValue
            ) {
              this.param[b.i].resValue = b;
            }
          }
          if (b.v.ps != undefined && b.v.ps.value === "结论") {
            if (
              b.i !== undefined &&
              this.param[b.i] &&
              !this.param[b.i].insResult
            ) {
              this.param[b.i].insResult = b;
              conclusionList.forEach((n, i) => {
                if (n.r == b.r && n.c == b.c) {
                  b.v.f = `(${this.comparisonList.find((j) => j.value == finalList[i].c)
                    .label
                    }${finalList[i].r + 1})`;
                }
              });
            }
          }
          set.add(b.r);
          // å¦‚果模板列表的函数存在,那么加入到excel函数列表里面
          if (b.v.f) {
            this.excelMethodList.push(b);
          }
        });
        // ä»¥ä¸‹æ˜¯æ ·å¼å¤„理逻辑
        set = Array.sort(set);
        set.forEach((b) => {
          let arr = [];
          a.template.forEach((c) => {
            if (c.r === b) {
              arr.push(c);
            }
          });
          arrs.push(arr);
        });
        a.arr = arrs;
        this.tableWidth = 0;
        for (let i = 0; i < arrs[0].length; i++) {
          this.tableWidth +=
            a.style.columnlen[i] === undefined ? 100 : a.style.columnlen[i];
        }
      });
      // æœ¬æ¬¡å¾ªçŽ¯ä¸»è¦æ˜¯å¯¹é¡µé¢åŠåŽç«¯ä¼ å‚è¿›è¡Œåˆå§‹åŒ–èµ‹å€¼
      this.currentSample.insProduct.forEach(async (a) => {
        try {
          // è®¡ç®—值赋值
          let comValue = JSON.parse(a.insProductResult.comValue);
          for (var i = 0; i < comValue.length; i++) {
            if (
              this.param[a.id].comValue.find(
                (m) => m.c == comValue[i].c && m.r == comValue[i].r
              )
            ) {
              this.param[a.id].comValue.find(
                (m) => m.c == comValue[i].c && m.r == comValue[i].r
              ).v.v = this.toFixed(
                comValue[i].v,
                this.param[a.id].comValue.find(
                  (m) => m.c == comValue[i].c && m.r == comValue[i].r
                ).v.ct
              );
            } else if (!comValue[i].c || !comValue[i].r) {
              this.param[a.id].comValue[i].v.v = this.toFixed(
                comValue[i].v,
                this.param[a.id].comValue[i].v.ct
              );
            }
          }
        } catch (e) { }
        try {
          // æ£€éªŒå€¼èµ‹å€¼
          let insValue = JSON.parse(a.insProductResult.insValue);
          for (let i = 0; i < insValue.length; i++) {
            if (
              this.param[a.id].insValue.find(
                (m) => m.c == insValue[i].c && m.r == insValue[i].r
              )
            ) {
              this.param[a.id].insValue.find(
                (m) => m.c == insValue[i].c && m.r == insValue[i].r
              ).v.v = this.toFixed(
                insValue[i].v,
                this.param[a.id].insValue.find(
                  (m) => m.c == insValue[i].c && m.r == insValue[i].r
                ).v.ct
              );
              this.param[a.id].insValue.find(
                (m) => m.c == insValue[i].c && m.r == insValue[i].r
              ).u = insValue[i].u;
              // this.param[a.id].insValue[i].v.v = insValue[i].v
              // this.param[a.id].insValue[i].u = insValue[i].u
            }
          }
        } catch (e) { }
        try {
          // è®¾å¤‡ç¼–号赋值
          let equipValue = JSON.parse(a.insProductResult.equipValue);
          for (let i = 0; i < equipValue.length; i++) {
            // æ™®é€šè®¾å¤‡èµ‹å€¼
            this.param[a.id].equipValue[i].v.v = equipValue[i].v;
          }
        } catch (e) { }
        try {
          // è®¾å¤‡åç§°èµ‹å€¼
          let equipName = JSON.parse(a.insProductResult.equipName);
          for (let i = 0; i < equipName.length; i++) {
            equipName[i].v !== "" &&
              equipName[i].v.map((val) => {
                const index = this.equipOptions.findIndex(
                  (item) => item.value === val
                );
                if (index > -1) {
                  // æ ¹æ®è®¾å¤‡ç¼–码转换为相应的设备名称
                  val = this.equipOptions[index].deviceName;
                }
              });
          }
          for (let i = 0; i < equipName.length; i++) {
            // æ™®é€šè®¾å¤‡åç§°èµ‹å€¼
            this.param[a.id].equipName[i].v.v = equipName[i].v;
          }
        } catch (e) {
          console.log("设备名称赋值----", e);
        }
        try {
          // æœ€ç»ˆå€¼èµ‹å€¼
          this.param[a.id].resValue.v.v = this.toFixed(
            a.lastValue,
            this.param[a.id].resValue.v.ct
          );
          // ç»“论赋值
          this.param[a.id].insResult.v.v = a.insResult;
        } catch (e) { }
      });
      // å¯¹excel函数进行处理
      this.handleExcelMethod();
    },
    // æ£€éªŒå€¼è¾“入后触发的函数
    changeInput(m, code, n, getDataType, changeSelect) {
      // ä¸ºæ•°é‡‡å®šä¹‰ä¸€ä¸ªé€»è¾‘参数
      if (getDataType == "getDataType") {
        this.getDataType = 2;
      }
      let currentInsItemId = null; //当前检验项id
      if (n) {
        currentInsItemId = JSON.parse(JSON.stringify(n.i));
        // å®šä¹‰ä¸€ä¸ªå‡½æ•°æ¥éªŒè¯åˆ†æ•°æ˜¯å¦æœ‰æ•ˆ
        if (typeof n.v.v == "string") {
          function isValidFraction(fraction) {
            const [numerator, denominator] = fraction.split("/"); // åˆ†å­å’Œåˆ†æ¯
            return !(!denominator || !numerator);
          }
          const isTrue = isValidFraction(n.v.v);
          if (!isTrue) {
            n.v.v = n.v.v.replace("/", "");
          }
        }
      }
      try {
        // å‘ Worker å‘送消息,开始处理逻辑
        this.worker.postMessage(
          JSON.stringify({
            code: code,
            tableList: this.tableList,
            excelMethodList: this.excelMethodList,
            comparisonList: this.comparisonList,
            currentSample: this.currentSample,
            PROJECT: this.PROJECT,
            param: this.param,
            currentTable: this.currentTable,
            getDataTypeId: this.getDataTypeId,
            modelType: this.sampleProduct[0].model,
            currentInsItem: n,
          })
        );
      } catch (error) {
        console.log(444, error);
      }
      // ç›‘听 Worker è¿”回的结果
      this.worker.onmessage = (event) => {
        this.result = JSON.parse(event.data);
        switch (this.result.method) {
          case "saveInsContext":
            this.$nextTick(() => {
              // this.$delete(this.tableList[0],'arr')
              this.$set(
                this.tableList[0],
                "arr",
                this.result.value.tableList[0].arr
              );
              this.param = this.result.value.param;
              if (this.result.value.currentInsItemId) {
                currentInsItemId = this.result.value.currentInsItemId;
              }
              // ç‰¹æ®Šå¤„理一下结论,会有这种特殊情况
              for (var i in this.param) {
                if (
                  this.param[i].insResult &&
                  this.param[i].insResult.v &&
                  this.param[i].insResult.v.v
                ) {
                  if (this.param[i].insResult.v.v == "合格") {
                    this.$set(this.param[i].insResult.v, "v", 1);
                  } else if (this.param[i].insResult.v.v == "不合格") {
                    this.$set(this.param[i].insResult.v, "v", 0);
                  }
                }
              }
              this.saveInsContext(currentInsItemId);
            });
            break;
          case "tableList":
            this.$nextTick(() => {
              // æ›´æ–°æ•°æ®
              this.$delete(this.tableList[0], "arr");
              this.$set(this.tableList[0], "arr", this.result.value[0].arr);
              // this.param = this.result.value.param
              if (this.result.value.currentInsItem) {
                currentInsItemId = this.result.value.currentInsItem.i;
              }
            });
            break;
          case "getCurrentInsProduct":
            // æ›´æ–°é¡µé¢æ•°æ®
            this.getCurrentInsProduct(this.result.value);
            break;
        }
      };
      // ä¿å­˜æ•°æ®
      setTimeout(() => {
        if (changeSelect) {
          this.saveInsContext(currentInsItemId);
        }
      }, 200);
    },
    // æ˜¯å¦éœ€è¦æ•°é‡‡
    async determineWhetherToCollectData() {
      let res = await determineWhetherToCollectData({ managementNumber: '' })
      this.isGet = res.data;
    },
    // æ ¹æ®åŽç«¯ä¼ å‚更新页面数据   param => this.tableList[0].insProductResult
    getCurrentInsProduct(pId) {
      if (!this.tableList[0].insProductResult) {
        this.tableList[0].insProductResult = {};
      }
      for (let m in this.param[pId]) {
        let value = this.param[pId][m];
        switch (m) {
          case "comValue":
            // èµ‹å€¼è®¡ç®—值
            if (value && value.length > 0) {
              this.tableList[0].insProductResult[m] = [];
              value.forEach((a, i) => {
                let obj = {
                  v: a.v.v,
                };
                this.tableList[0].insProductResult[m].push(obj);
              });
              try {
                this.tableList[0].insProductResult[m] = JSON.stringify(
                  this.tableList[0].insProductResult[m]
                );
              } catch (error) {
                console.log(555, error);
              }
            }
            break;
          // èµ‹å€¼æ£€éªŒå€¼
          case "insValue":
            if (value && value.length > 0) {
              this.tableList[0].insProductResult[m] = [];
              value.forEach((a, i) => {
                let obj = {
                  v: a.v.v,
                  u: a.u,
                };
                this.tableList[0].insProductResult[m].push(obj);
              });
              try {
                this.tableList[0].insProductResult[m] = JSON.stringify(
                  this.tableList[0].insProductResult[m]
                );
              } catch (error) {
                console.log(666, error);
              }
            }
            break;
          // èµ‹å€¼è®¾å¤‡ç¼–号
          case "equipValue":
            if (value && value.length > 0) {
              this.tableList[0].insProductResult[m] = [];
              value.forEach((a, i) => {
                let obj = {
                  v: a.v.v,
                };
                this.tableList[0].insProductResult[m].push(obj);
              });
              try {
                this.tableList[0].insProductResult[m] = JSON.stringify(
                  this.tableList[0].insProductResult[m]
                );
              } catch (error) {
                console.log(777, error);
              }
            }
            break;
          // èµ‹å€¼è®¾å¤‡åç§°
          case "equipName":
            if (value && value.length > 0) {
              this.tableList[0].insProductResult[m] = [];
              value.forEach((a, i) => {
                let obj = {
                  v: a.v.v,
                };
                this.tableList[0].insProductResult[m].push(obj);
              });
              try {
                this.tableList[0].insProductResult[m] = JSON.stringify(
                  this.tableList[0].insProductResult[m]
                );
              } catch (error) {
                console.log(888, error);
              }
            }
            break;
          // èµ‹å€¼æœ€ç»ˆå€¼
          case "resValue":
            this.tableList[0].lastValue = value ? value.v.v : "";
            break;
          // èµ‹å€¼ç»“论
          case "insResult":
            this.tableList[0].insResult = value ? value.v.v : "";
            break;
        }
      }
    },
    // å¯¹EXCEL函数进行处理
    handleExcelMethod() {
      if (this.excelMethodList.length > 0) {
        this.excelMethodList.map((item) => {
          // å¾—到每个函数的参数列表
          item.valueList = excelFunction.changeParameter(item.v.f);
          return item;
        });
      }
    },
    getValue(v) {
      // å¯¹é¡µé¢å±•示数据进行处理,@,代表换行
      let str = v.v
        ? v.v
        : v.v === 0
          ? v.v
          : v.ct && v.ct.s
            ? v.ct.s.length > 0 &&
            v.ct.s[0].v
              .replace(new RegExp("\n", "g"), "<br/>")
              .replace(new RegExp("@", "g"), "<br/>")
            : "";
      // å¯¹æ•°æ®ä¿ç•™å°æ•°ç‚¹è¿›è¡Œå¤„理
      if (v.ct && v.ct.fa && v.ct.fa.includes(".") && str) {
        let num = 0;
        let str0 = v.ct.fa.split(".")[1];
        num = str0.length;
        str = Number(str).toFixed(num);
      }
      if (v.v && typeof v.v == "string" && v.v.includes("@")) {
        str = v.v.replace(new RegExp("@", "g"), "<br/>");
      }
      return str;
    },
    // èŽ·å–å½“å‰è¾“å…¥æ¡†ç±»åž‹
    getInspectionValueType(id) {
      for (var a in this.currentSample.insProduct) {
        if (this.currentSample.insProduct[a].id == id) {
          return this.currentSample.insProduct[a].inspectionValueType;
        }
      }
    },
    // èŽ·å–è¦æ±‚æè¿°
    getTell(id) {
      for (var a in this.currentSample.insProduct) {
        if (this.currentSample.insProduct[a].id == id) {
          return this.currentSample.insProduct[a].tell;
        }
      }
    },
    // åŠ¨æ€èŽ·å–å•å…ƒæ ¼å®½åº¦
    handleWidth(n) {
      let sum = 0;
      if (n.v.mc && n.v.mc.cs && n.v.mc.c != undefined) {
        for (let i = 0; i < n.v.mc.cs; i++) {
          let num = this.widthList[i + n.v.mc.c]
            ? this.widthList[i + n.v.mc.c]
            : 100;
          sum += num;
        }
      } else {
        sum = this.widthList[n.c] ? this.widthList[n.c] : 100;
      }
      return sum;
    },
    // å¯¹è¾“入值进行格式校验
    handleInput(n) {
      try {
        n.v.v = n.v.v.replace(/[^\d.^e>>≥≤<<断裂脆化\-/+]/g, "");
        n.v.v = n.v.v.replace(/\.{2,}/g, "."); //只保留第一个. æ¸…除多余的
        n.v.v = n.v.v
          .replace(".", "$#$")
          .replace(/\./g, "")
          .replace("$#$", ".");
        n.v.v = n.v.v.replace(/\/{2,}/g, "/"); //只保留第一个/清除多余的
        n.v.v = n.v.v
          .replace("/", "$#$")
          .replace(/\//g, "")
          .replace("$#$", "/");
      } catch (error) {
        console.log(error);
      }
    },
    getInspectionItemType(id) {
      for (var a in this.currentSample.insProduct) {
        if (this.currentSample.insProduct[a].id == id) {
          return this.currentSample.insProduct[a].inspectionItemType;
        }
      }
    },
    // èŽ·å–è¦æ±‚å€¼
    getAsk(id) {
      for (var a in this.currentSample.insProduct) {
        if (this.currentSample.insProduct[a].id == id) {
          return this.currentSample.insProduct[a].ask;
        }
      }
    },
    // èŽ·å–æ‰€æœ‰è®¾å¤‡
    getEquipOptions(e, id) {
      if (e) {
        this.equipOptions = [];
        search({ status: 0 }).then((res) => {
          if (res.code === 200 && res.data) {
            this.equipOptions = res.data.map((m) => {
              m.value = m.managementNumber;
              m.label = m.deviceName;
              return m;
            });
          }
        })
          .catch((error) => {
            console.error(error);
          });
      }
    },
    // getDic(e, id) {
    //   if (e) {
    //     for (var a in this.currentSample.insProduct) {
    //       if (this.currentSample.insProduct[a].id == id) {
    //         let str = this.currentSample.insProduct[a].dic;
    //         this.selectEnumByCategoryOfSelect(str);
    //         return str;
    //       }
    //     }
    //   }
    // },
    getUserInfo() {
      this.componentData.entity.userId = this.userId;
    },
    openAddCheck() {
      this.addCheck = true;
    },
    // å¤æ ¸
    upInsReview(e) {
      if (e == 1) {
        // é€šè¿‡
        this.reviewLoading = true;
        verifyPlan({
          orderId: this.orderId,
          type: 1,
          laboratory: this.sonLaboratory,
          tell: null,
          userId: this.checkUser,
        }).then((res) => {
          if (res.code === 200) {
            this.$message.success("操作成功");
            this.$emit("goback");
            this.addCheck = false;
          }
          this.reviewLoading = false;
        })
          .catch((error) => {
            console.error(error);
            this.reviewLoading = false;
          });
      } else {
        // ä¸é€šè¿‡
        this.reviewDia = true;
      }
    },
    handleReviewDia() {
      if (this.noReason) {
        this.reviewLoading = true;
        verifyPlan({
          orderId: this.orderId,
          type: 0,
          laboratory: this.sonLaboratory,
          tell: this.noReason,
        }).then((res) => {
          if (res.code === 200) {
            this.$message.success("操作成功");
            this.$emit("goback");
          }
          this.reviewLoading = false;
        })
          .catch((error) => {
            console.error(error);
            this.reviewLoading = false;
          });
      } else {
        this.$message.error("未输入不通过原因");
      }
    },
    submit() {
      if (this.verifyUser === null || this.verifyUser === "") {
        this.$message.error("请指定复核人员");
        return;
      }
      if (!this.otherForm.humidity) {
        this.$message.error("请输入湿度");
        return;
      }
      if (!this.otherForm.temperature) {
        this.$message.error("请输入温度");
        return;
      }
      this.submitLoading = true;
      checkSubmitPlan({
        orderId: this.orderId,
        laboratory: this.sonLaboratory,
      }).then((res) => {
        if (res.code === 200) {
          if (!res.data || res.data.length == 0) {
            this.submitLoading = true;
            submitPlan({
              orderId: this.orderId,
              laboratory: this.sonLaboratory,
              verifyUser: this.verifyUser,
              entrustCode: this.insOrder.entrustCode,
            }).then((res) => {
              if (res.code === 200) {
                this.$message.success("操作成功");
                this.$emit("goback");
                this.submitLoading = false;
                this.addVerifyDia = false;
              }
            })
              .catch((error) => {
                console.error(error);
                this.submitLoading = false;
              });
          } else {
            let newData = [];
            const h = this.$createElement;
            for (let i in res.data) {
              const lastChar = res.data[i].slice(-1);
              if (lastChar == "-") {
                res.data[i] = res.data[i].slice(0, -1);
              }
              newData.push(
                h(
                  "p",
                  { style: "font-size: 14px;color: red;" },
                  Number(i) + 1 + "、" + res.data[i]
                )
              );
            }
            newData.push(
              h(
                "p",
                {
                  style:
                    "font-size: 16px;color:#000;margin-top:12px;overflow-y: auto;max-height:80vh",
                },
                "以上项目不合格,确定提交?"
              )
            );
            this.$confirm("提示", {
              title: "提示",
              message: h("div", null, newData),
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "",
            })
              .then(() => {
                this.submitLoading = true;
                submitPlan({
                  orderId: this.orderId,
                  laboratory: this.sonLaboratory,
                  verifyUser: this.verifyUser,
                }).then((res) => {
                  if (res.code === 200) {
                    this.$message.success("操作成功");
                    this.addVerifyDia = false;
                    this.$emit("goback");
                  }
                  this.submitLoading = false;
                })
                  .catch((error) => {
                    console.error(error);
                    this.submitLoading = false;
                  });
              })
              .catch(() => { });
          }
        }
      })
        .catch((error) => {
          console.error(error);
          this.submitLoading = false;
        });
      return;
    },
    // ç»Ÿä¸€åœ¨è¿™é‡Œä¿å­˜æ•°æ®
    saveInsContext(currentInsItemId) {
      try {
        if (this.param) {
          let param = null;
          if (currentInsItemId) {
            param = { [currentInsItemId]: this.param[currentInsItemId] };
          } else {
            param = this.param;
          }
          saveInsContext({
            param: JSON.stringify(param),
            currentTable: this.currentTable,
            sampleId: this.currentSample.id,
          }).then((res) => {
            if (res.code == 201) {
              this.$message.error("保存失败");
              return;
            }
            this.$message.success("已保存");
          });
          // å‘ Worker å‘送消息,开始处理逻辑
          this.worker.postMessage(
            JSON.stringify({
              modelType: this.sampleProduct[0].model,
              type: "saveData",
              tableList: this.tableList,
              param: this.param,
              currentTable: this.currentTable,
            })
          );
        }
      } catch (error) {
        console.log(999, error);
      }
    },
    // è®¾å¤‡æ”¹å˜
    changeEquip(val, n, v) {
      try {
        // this.$set(n.v,'v',val)
        this.tableList[0].arr.forEach((item, index) => {
          item.forEach((m, i) => {
            if (this.param[m.i]) {
              this.param[m.i].state = 1;
            }
            // if(m.i==n.i&&m.v.ps&&m.v.ps.value=='设备名称'&&v){
            //   this.$set(m.v,'v',v)
            // }
          });
        });
        for (let i in this.param) {
          if (this.param[i].state != 1) {
            delete this.param[i];
          }
        }
        // this.equipOptions为设备名称下拉框选项数据
        for (let i1 in this.param[n.i].equipName) {
          if (
            this.param[n.i].equipName[i1].i === n.i &&
            this.param[n.i].equipName[i1].r === n.r
          ) {
            this.$delete(this.param[n.i].equipValue[i1].v, "v");
            // å°†æ•°ç»„赋值给设备编码
            this.$set(this.param[n.i].equipValue[i1].v, "v", val.join(","));
            this.$delete(this.param[n.i].equipName[i1].v, "v");
            // å°†æ•°ç»„赋值给设备编码
            this.$set(this.param[n.i].equipName[i1].v, "v", val);
            this.tableList[0].arr.forEach((item, index) => {
              item.forEach((m) => {
                if (m.i == n.i && m.v.ps && m.v.ps.value == "设备编码") {
                  this.$set(m.v, "v", val.join(","));
                }
                if (m.i == n.i && m.v.ps && m.v.ps.value == "设备名称") {
                  this.$set(m.v, "v", val);
                }
              });
            });
          }
        }
        // ä¿å­˜æ•°æ®
        this.saveInsContext(n.i);
      } catch (e) {
        console.log("changeEquip----", e);
      }
    },
    getAuthorizedPerson() {
      selectUserCondition({ type: 0 }).then((res) => {
        let data = [];
        res.data.forEach((a) => {
          data.push({
            label: a.name,
            value: a.id,
          });
        });
        this.personList = data;
      });
    },
    scrollInit() {
      // èŽ·å–è¦ç»‘å®šäº‹ä»¶çš„å…ƒç´ 
      const nav = document.getElementById("nav");
      var flag; // é¼ æ ‡æŒ‰ä¸‹
      var downX; // é¼ æ ‡ç‚¹å‡»çš„x下标
      var scrollLeft; // å½“前元素滚动条的偏移量
      nav.addEventListener("mousedown", function (event) {
        flag = true;
        downX = event.clientX; // èŽ·å–åˆ°ç‚¹å‡»çš„x下标
        scrollLeft = this.scrollLeft; // èŽ·å–å½“å‰å…ƒç´ æ»šåŠ¨æ¡çš„åç§»é‡
      });
      nav.addEventListener("mousemove", function (event) {
        if (flag) {
          // åˆ¤æ–­æ˜¯å¦æ˜¯é¼ æ ‡æŒ‰ä¸‹æ»šåŠ¨å…ƒç´ åŒºåŸŸ
          var moveX = event.clientX; // èŽ·å–ç§»åŠ¨çš„xè½´
          var scrollX = moveX - downX; // å½“前移动的x轴下标减去刚点击下去的x轴下标得到鼠标滑动距离
          this.scrollLeft = scrollLeft - scrollX; // é¼ æ ‡æŒ‰ä¸‹çš„æ»šåŠ¨æ¡åç§»é‡å‡åŽ»å½“å‰é¼ æ ‡çš„æ»‘åŠ¨è·ç¦»
        }
      });
      // é¼ æ ‡æŠ¬èµ·åœæ­¢æ‹–动
      nav.addEventListener("mouseup", function () {
        flag = false;
      });
      // é¼ æ ‡ç¦»å¼€å…ƒç´ åœæ­¢æ‹–动
      nav.addEventListener("mouseleave", function (event) {
        flag = false;
      });
    },
    // é¡µé¢é‡Œé¢åˆ‡æ¢æ ·å“
    async caretSample(num) {
      let index = this.currentKey + num;
      if (index < 1) {
        this.$message.error("当前是第一个样品");
        return;
      } else if (index > this.sampleProduct.length) {
        this.$message.error("当前是最后一个样品");
        return;
      }
      this.currentKey = index;
      this.currentSample = this.HaveJson(this.sampleProduct[index - 1]);
      // èŽ·å–æ£€éªŒé¡¹
      let list = await this.getCurrentProduct(this.currentSample.id, 0);
      this.currentSample.insProduct = this.HaveJson(list);
      // åˆå§‹åŒ–后端传参
      this.param = {};
      this.changeType = 0;
      this.currentSample.insProduct.forEach((a, j) => {
        if (this.handleCasing(a.inspectionItem)) {
          this.param[a.id] = {
            insValue: [],
            comValue: [],
            resValue: null,
            equipValue: [],
            equipName: [],
            insResult: null,
          };
        }
      });
      // é¡µé¢æ•°æ®å¤„理
      this.getTableLists();
      // æ›´æ–°åˆ°å¤šçº¿ç¨‹
      this.worker.postMessage(
        JSON.stringify({
          modelType: this.sampleProduct[0].model,
          type: "saveData",
          tableList: this.tableList,
          param: this.param,
          currentTable: this.currentTable,
        })
      );
    },
    handleSuccessUp(response) {
      this.upLoading = false;
      if (response.code == 200) {
        this.$message.success("上传成功");
        this.$refs.fileList.selectList();
      }
    },
    beforeUpload(file) {
      if (file.size > 1024 * 1024 * 10) {
        this.$message.error("上传文件不超过10M");
        this.$refs.upload.clearFiles();
        return false;
      } else {
        this.upLoading = true;
        return true;
      }
    },
    onError(err, file, fileList) {
      this.$message.error("上传失败");
      this.$refs.upload.clearFiles();
    },
    handleDown(row) {
      downFile({ id: row.id }).then((res) => {
        if (res.code === 200) {
          let url = "";
          if (res.data.type == 1) {
            url = this.javaApi + "/img/" + res.data.fileUrl;
            this.$download.saveAs(url, row.fileName)
          } else {
            url = this.javaApi + "/word/" + res.data.fileUrl;
            this.$download.saveAs(url, row.fileName)
          }
        }
      })
        .catch((error) => { });
    },
    /**
     * å°†æ•°å€¼v保留ct.fa中'##'后的指定小数位数,并返回格式化后的字符串。
     *
     * @param v è¦æ ¼å¼åŒ–的数值
     * @param ct åŒ…含格式化配置的对象
     * @param ct.fa æ ¼å¼åŒ–配置字符串,若包含'##'则按照其后的内容确定小数位数
     * @returns æ ¼å¼åŒ–后的字符串或原始数值(若配置不符合要求)
     */
    toFixed(v, ct) {
      if (v && ct && ct.fa) {
        if (ct.fa.includes(".")) {
          let num = ct.fa.slice(4).length;
          return Number(v).toFixed(num);
        } else {
          return v;
        }
      } else {
        return v;
      }
    },
  },
};
</script>
<style scoped>
.custom-table .el-table__header-wrapper th {
  background-color: #87ceeb;
  /* åªå¯¹å¸¦æœ‰my-custom-table类的表格生效 */
  color: #fff;
}
.container {
  overflow: auto;
  /* ç¡®ä¿å®¹å™¨èƒ½åŒ…裹浮动元素 */
  margin-bottom: 10px;
}
.right-button {
  float: right;
}
.inspection {
  height: 100%;
  overflow-y: auto;
}
.inspection::-webkit-scrollbar {
  width: 0;
}
.title {
  height: 60px;
  line-height: 60px;
}
.search {
  width: 100%;
  margin-bottom: 10px;
  background-color: #fff;
  border-radius: 3px;
}
.search .form-inline {
  padding-top: 20px;
  padding-left: 0px;
  text-align: left;
}
.center {
  width: calc(100% - 40px);
  /* max-height: 580px; */
  background-color: #fff;
  border-radius: 3px;
  padding: 20px;
  overflow: auto;
}
.center-box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex-wrap: wrap;
  width: 100%;
  overflow-x: auto;
  /* overflow-x: scroll; */
  cursor: grab;
}
.center-box:active {
  cursor: grabbing;
}
.tables {
  table-layout: fixed;
  margin: 5px 5px 16px;
}
.tables td {
  height: 40px;
  width: 100px;
  text-align: center;
  font-size: 14px;
  word-wrap: break-word;
  white-space: normal;
}
.thermal-table {
  min-width: calc(100% - 10px);
  margin: 5px 5px 0;
  table-layout: fixed;
}
.thermal-table td {
  min-width: 70px;
  text-align: center;
  font-size: 14px;
  word-wrap: break-word;
  white-space: normal;
  padding: 5px;
}
.table-container {
  overflow-x: auto;
  /* ä½¿å®¹å™¨æ”¯æŒæ¨ªå‘滚动 */
  max-width: 100%;
  /* é™åˆ¶å®¹å™¨çš„æœ€å¤§å®½åº¦ */
  margin-bottom: 16px;
}
.content {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: left;
  padding: 5px;
  box-sizing: border-box;
  overflow: hidden;
  user-select: none;
}
.content * {
  user-select: none;
}
.content-h-0 {
  justify-content: center;
}
.content-h-1 {
  justify-content: start;
}
.content-h-2 {
  justify-content: end;
}
.content-v-0 {
  align-items: center;
}
.content-v-1 {
  align-items: start;
}
.content-v-2 {
  align-items: end;
}
.table_input {
  width: 100%;
  height: 100%;
}
.table_input>>>.el-input__inner {
  border-color: rgba(0, 0, 0, 0.5) !important;
}
.collection {
  width: 50px;
  height: 100%;
  margin-left: 5px;
  border-color: transparent;
  background-color: #409eff;
  color: #fff;
  border-radius: 4px;
  font-size: 12px;
}
.collection:active {
  opacity: 0.7;
}
.table_caret {
  font-size: 16px;
  margin: 0 5px;
  color: rgba(0, 0, 0, 0.5);
}
.table_caret:hover {
  color: #409eff;
  cursor: pointer;
}
.table_caret:active {
  opacity: 0.8;
}
>>>input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  /* éšè—å¾®è°ƒæŒ‰é’® */
  margin: 0 !important;
  /* ç§»é™¤å¾®è°ƒæŒ‰é’®çš„边距 */
}
>>>input[type="number"] {
  -moz-appearance: textfield !important;
  /* é’ˆå¯¹ Firefox */
}
>>>.el-form-item__content {
  display: inline-flex;
  align-items: center;
}
</style>
<style>
.inspection .el-form-item__label {
  color: #000;
}
.inspection .el-drawer__header::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 30.24px;
  background: #3a7bfa;
  border-radius: 10px;
  margin-left: 32px;
  margin-right: 8.5px;
}
.inspection .el-drawer__header {
  color: #303133;
  text-align: left;
}
.inspection .el-input-group__append {
  padding: 0 14px;
  color: #3a7bfa;
  background-color: #fff;
  height: 100%;
  display: flex;
  align-items: center;
}
.inspection .center-box .el-input__inner {
  font-size: 12px;
  padding: 0 6px;
  text-align: center;
}
.inspection .el-textarea__inner {
  padding: 2px;
}
.inspection .el-textarea__inner::-webkit-scrollbar {
  width: 0;
}
.inspection .el-select {
  display: flex;
  align-items: center;
}
.inspection .el-textarea__inner {
  min-height: 100% !important;
}
.inspection .tables .el-input {
  display: flex;
  align-items: center;
}
.thermal-table .el-input {
  display: flex;
  align-items: center;
}
.custom-dialog .el-dialog__body {
  max-width: 1000px;
  /* è®¾ç½®æœ€å¤§å®½åº¦ */
}
</style>
src/views/performance/manHour/workTimeConfig.vue
@@ -4,168 +4,73 @@
      <div class="search_thing">
        <div class="search_label">编号:</div>
        <div class="search_input">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="queryParams.number"
            @keyup.enter.native="refreshTable()"
          ></el-input>
          <el-input size="small" placeholder="请输入" clearable v-model="queryParams.number"
            @keyup.enter.native="refreshTable()"></el-input>
        </div>
      </div>
      <div class="search_thing">
        <div class="search_label">实验室:</div>
        <el-select
          v-model="queryParams.laboratory"
          placeholder="全部"
          size="small"
          @change="refreshTable()"
          clearable
        >
          <el-option
            v-for="item in laboratoryList"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
        <el-select v-model="queryParams.laboratory" placeholder="全部" size="small" @change="refreshTable()" clearable>
          <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </div>
      <div class="search_thing">
        <div class="search_label">部门:</div>
        <div class="search_input">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="queryParams.department"
            @keyup.enter.native="refreshTable()"
          ></el-input>
          <el-input size="small" placeholder="请输入" clearable v-model="queryParams.department"
            @keyup.enter.native="refreshTable()"></el-input>
        </div>
      </div>
      <div class="search_thing" style="padding-left: 30px">
        <el-button size="small" @click="refresh()">重 ç½®</el-button>
        <el-button size="small" type="primary" @click="refreshTable()"
          >查 è¯¢</el-button
        >
        <el-button size="small" type="primary" @click="refreshTable()">查 è¯¢</el-button>
      </div>
      <el-button
        size="small"
        type="primary"
        style="position: absolute; right: 50px"
        @click="openAdd('新增')"
        v-if="checkPermi(['performance:manHour:workTimeConfig:add'])"
        >新 å¢ž</el-button
      >
      <el-button size="small" type="primary" style="position: absolute; right: 50px" @click="openAdd('新增')"
        v-if="checkPermi(['performance:manHour:workTimeConfig:add'])">新 å¢ž</el-button>
    </div>
    <div class="table">
      <lims-table
        :tableData="tableData"
        :column="column"
        :page="page"
        :tableLoading="tableLoading"
        :height="'calc(100vh - 290px)'"
        @pagination="pagination"
      ></lims-table>
      <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
        :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table>
    </div>
    <!-- æ–°å¢ž/编辑 -->
    <el-dialog :title="title" :visible.sync="timeDia" width="500px">
      <el-form
        :model="timeForm"
        ref="timeForm"
        :rules="timeRules"
        label-position="right"
        label-width="120px"
      >
      <el-form :model="timeForm" ref="timeForm" :rules="timeRules" label-position="right" label-width="120px">
        <el-form-item label="编号" prop="number">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="timeForm.number"
          ></el-input>
          <el-input size="small" placeholder="请输入" clearable v-model="timeForm.number"></el-input>
        </el-form-item>
        <el-form-item label="辅助项目名称" prop="auxiliaryProject">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="timeForm.auxiliaryProject"
          >
          <el-input size="small" placeholder="请输入" clearable v-model="timeForm.auxiliaryProject">
          </el-input>
        </el-form-item>
        <el-form-item label="部门" prop="department">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="timeForm.department"
          >
          <el-input size="small" placeholder="请输入" clearable v-model="timeForm.department">
          </el-input>
        </el-form-item>
        <el-form-item label="实验室" prop="laboratory">
          <el-select
            v-model="timeForm.laboratory"
            size="small"
            clearable
            placeholder="请选择"
            style="width: 100%"
          >
            <el-option
              v-for="item in laboratoryList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
          <el-select v-model="timeForm.laboratory" size="small" clearable placeholder="请选择" style="width: 100%">
            <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="单位" prop="unit">
          <el-select
            v-model="timeForm.unit"
            size="small"
            clearable
            placeholder="请选择"
            style="width: 100%"
          >
            <el-option
              v-for="item in unitList"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            >
          <el-select v-model="timeForm.unit" size="small" clearable placeholder="请选择" style="width: 100%">
            <el-option v-for="item in unitList" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="核准工时" prop="approvedWorkingHour">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="timeForm.approvedWorkingHour"
          >
          <el-input size="small" placeholder="请输入" clearable v-model="timeForm.approvedWorkingHour">
          </el-input>
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input
            size="small"
            placeholder="请输入"
            type="textarea"
            :rows="2"
            clearable
            v-model="timeForm.remarks"
          >
          <el-input size="small" placeholder="请输入" type="textarea" :rows="2" clearable v-model="timeForm.remarks">
          </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="timeDia = false">取 æ¶ˆ</el-button>
        <el-button
          :loading="uploading"
          type="primary"
          @click="submitProduct('timeForm')"
          >ç¡® è®¤</el-button
        >
        <el-button :loading="uploading" type="primary" @click="submitProduct('timeForm')">ç¡® è®¤</el-button>
      </span>
    </el-dialog>
  </div>
@@ -377,7 +282,7 @@
            this.refresh();
          });
        })
        .catch(() => {});
        .catch(() => { });
    },
  },
};
@@ -387,6 +292,7 @@
.work-time-config {
  height: 100%;
}
.search {
  background-color: #fff;
  height: 80px;
@@ -409,6 +315,7 @@
.search_input {
  width: calc(100% - 70px);
}
.table {
  padding: 10px;
  padding-top: 0;