<template>
  <div style="height: 100%; width: 100%;">
    <a-layout>
      <a-layout-sider theme="light" :width="leftWidth" style="border-right:2px solid #d5d5ff;float:left" :style="{'max-height':testHeight+'px','height':testHeight+'px'}">
        <div class="tree" style="width: 100%; height: 100%; overflow: auto; display: inline-flex;">
          <a-tree
            :tree-data="treeData"
            @select="treeNodeClickHandler"
            :fieldNames="{children: 'children', title: 'pnm', key: 'id'}"
            :auto-expand-parent="true"
            v-model:expandedKeys="expandedKeys"
            ref="jigou_tree"
            style="height:100%;">
            <template #custom="item">
              <span style="float:left; position: relative;" :title="item.pnm">
                <span v-if="item.id && item.id.length >= 12">
                  <img
                    v-if="item.chkType == '0'"
                    src="../../assets/images/choucha.png"
                    style="width: 25px; height:20px; margin-top: 3px; float: left;" />
                  <img
                    v-if="item.chkType=='1'"
                    src="../../assets/images/zicha.png"
                    style="width: 25px; height:20px; margin-top: 3px; float: left;" />
                  &nbsp;
                </span>
                {{ item.pnm ? (item.pnm.length > 12 ? (item.pnm.substring(0, 12)) + "..." : item.pnm) : "" }}
              </span>
            </template>
          </a-tree>
        </div>
      </a-layout-sider>
      <a-layout-content id="dxdcListMainsk" style="padding:5px 20px;position:relative;">
        <a-row>
          <a-col :span="24">
            <a-form layout="inline">
              <a-form-item label="督查状态" style="min-width: 23%;">
                <a-select v-model:value="dcType" placeholder="督查状态" allow-clear>
                  <a-select-option value="0">未督查</a-select-option>
                  <a-select-option value="1">督查中</a-select-option>
                  <a-select-option value="2">已督查</a-select-option>
                </a-select>
              </a-form-item>
              <a-form-item label="水库名称" style="min-width: 23%;">
                <a-input v-model:value="rsvrName" placeholder="水库名称"/>
              </a-form-item>
              <a-form-item label="工程规模" style="min-width: 23%;">
                <a-select v-model:value="engScale" placeholder="工程规模" allow-clear>
                  <a-select-option v-for="item in engScales" :key="item.id">{{ item.name }}</a-select-option>
                </a-select>
              </a-form-item>
              <a-form-item label="督查时间" style="min-width: 23%;">
                <a-range-picker v-model:value="dateRange" format="YYYY-MM-DD" separator="至" allow-clear />
              </a-form-item>
              <a-form-item>
                <a-button type="primary" @click="onSubmit" size="small" >查询</a-button>
              </a-form-item>
            </a-form>
          </a-col>
        </a-row>
        <a-table
          ref="table"
          :columns="columns"
          :data-source="skDataList"
          :loading="expLoading"
          :pagination="false"
          row-key="rgstrId"
          style="width: 100%;"
          :style="{height: tableHeight + 'px'}"
          :scroll="{x: 'max-content', y: tableHeight - 60}"
          bordered>
          <template #bodyCell="{ column, record }">
            <template v-if="column.dataIndex === 'nm'">
              <a-tooltip placement="top">
                <template #title>
                  <span>{{ record.nm }}</span>
                </template>
                <span class="ellipsis130">{{ record.nm }}</span>
              </a-tooltip>
            </template>
            <template v-else-if="column.dataIndex === 'city'">
              <a-tooltip placement="top">
                <template #title>
                  <span>{{ record.city }}</span>
                </template>
                <span class="ellipsis100">{{ record.city }}</span>
              </a-tooltip>
            </template>
            <template v-else-if="column.dataIndex === 'county'">
              <a-tooltip placement="top">
                <template #title>
                  <span>{{ record.county }}</span>
                </template>
                <span class="ellipsis100">{{ record.county }}</span>
              </a-tooltip>
            </template>
            <template v-else-if="column.dataIndex === 'riverName'">
              <a-tooltip placement="top">
                <template #title>
                  <span>{{ record.riverName }}</span>
                </template>
                <span class="ellipsis120">{{ record.riverName }}</span>
              </a-tooltip>
            </template>
            <template v-else-if="column.dataIndex === 'groupName'">
              <a-tooltip placement="top">
                <template #title>
                  <span>{{ record.groupName }}</span>
                </template>
                <span class="ellipsis150">{{ record.groupName }}</span>
              </a-tooltip>
            </template>
            <template v-else-if="column.dataIndex === 'deadline'">
              <a-tooltip placement="top">
                <template #title>
                  <span>{{ record.deadline }}</span>
                </template>
                <span class="ellipsis180">{{ record.deadline }}</span>
              </a-tooltip>
            </template>
            <template v-else-if="column.dataIndex === 'intm1'">
              <a-tooltip placement="top">
                <template #title>
                  <span>{{ record.intm1 }}</span>
                </template>
                <span class="ellipsis120">{{ record.intm1 }}</span>
              </a-tooltip>
            </template>
            <template v-else-if="column.dataIndex === 'uptm'">
              <span>{{ record.uptm ? dateFormat(record.uptm,'yyyy-MM-dd') : '' }}</span>
            </template>
            <template v-else-if="column.dataIndex === 'chkType'">
              <img src="../../assets/images/choucha.png" v-if="record.chkType=='0'" style="width: 25px;height:20px;" />
              <img src="../../assets/images/zicha.png" v-if="record.chkType=='1'" style="width: 25px;height:20px;" />
            </template>
            <template v-else-if="column.dataIndex === 'state'">
              <span
                style="padding: 3px 10px;background:#F56C6C;border-radius:15px;color:rgba(255,255,255,1)"
                v-if="record.state == 0"
              >未督查</span>
              <span
                style="padding: 3px 10px;background:#FBB56D;border-radius:15px;color:rgba(255,255,255,1)"
                v-if="record.state == 1"
              >督查中</span>
              <span
                style="padding: 3px 10px;background:#63C25E;border-radius:15px;color:rgba(255,255,255,1)"
                v-if="record.state == 2"
              >已督查</span>
            </template>
            <template v-else-if="column.dataIndex === 'engScal'">
              <span v-if="record.engScal == '1'">大（1）型</span>
              <span v-if="record.engScal == '2'">大（2）型</span>
              <span v-if="record.engScal == '3'">中型</span>
              <span v-if="record.engScal == '4'">小（1）型</span>
              <span v-if="record.engScal == '5'">小（2）型</span>
              <span v-if="record.engScal == '9'">其他</span>
            </template>
            <template v-else-if="column.dataIndex === 'hystSite'">
              <a-tooltip placement="top">
                <template #title>
                  <span>{{ record.hystSite }}</span>
                </template>
                <span class="ellipsis200">{{ record.hystSite }}</span>
              </a-tooltip>
            </template>
            <template v-else-if="column.dataIndex === 'rsAdmName'">
              <a-tooltip placement="top">
                <template #title>
                  <span>{{ record.rsAdmName }}</span>
                </template>
                <span class="ellipsis180">{{ record.rsAdmName }}</span>
              </a-tooltip>
            </template>
            <template v-else-if="fillTableData.some(item => item.prop === column.dataIndex)">
              <span style="cursor:pointer;color:#F56C6C;" v-if="record[column.dataIndex] == '0' || !record[column.dataIndex]">待填报</span>
              <span style="cursor:pointer;color:#fbb56d" v-if="record[column.dataIndex] == '1'">未完成</span>
              <span style="cursor:pointer;color:#67C23A" v-if="record[column.dataIndex] == '2'">已完成</span>
            </template>
            <template v-else-if="column.dataIndex === 'action'">
              <div style="display: flex;justify-content: center;">
                <div v-if="ownPriv('manage')">
                  <a-button
                    size="small"
                    v-if="!record.rgstrId"
                    ghost
                    @click="toAddMember('填报',record)"
                    type="primary"
                  >填报</a-button>
                  <a-button
                    @click="toAddMember('编辑',record)"
                    size="small"
                    v-if="record.rgstrId"
                    ghost
                    :disabled="record.state == '2' && record.chkType!='1'"
                    type="primary">督查</a-button>
                  <a-button
                    size="small"
                    v-if="record.rgstrId && record.chkType!='1'"
                    ghost
                    @click="submitHandler(record)"
                    :disabled="record.state == '2'"
                    type="primary">提交</a-button>
                  <a-button size="small" type="primary" v-if="record.rgstrId && record.state == '2'" ghost @click="toCheck(record)">查看</a-button>
                </div>
                <div style="padding-left: 15px;" v-if="record.rgstrId && record.state!='2' && ownPriv('del')">
                  <a-button size="small" ghost @click="deleteMember(record)" type="primary">删除</a-button>
                </div>
              </div>
            </template>
          </template>
        </a-table>
        <a-pagination
          show-size-changer
          v-model:pageSize="pageSize"
          :total="total"
          :page-size-options="['10','20', '30', '40', '50','100']"
          :show-total="total => `共${total}条`"
          @showSizeChange="handleSizeChange"
          @change="pageIndexChange"
          style="margin-top: 10px;" />
        <div class="open_board">
          <a-icon type="left" v-if="isOpen" @click="closeLeft" />
          <a-icon type="right" v-else @click="openLeft" />
        </div>
        <shuiKuTianBao
          v-if="showShuiKuTianBao"
          :rowData="rowData"
          :currentObjectRgstrId="currentObjectRgstrId"
          :currentResCode="currentResCode"
          :currentObjectId="currentObjectId"
          :chkType="chkType"
          :currentObjectName="currentResName"
          :pType="pType"
          :currentRsvrNm="currentRsvrNm"
          :currentAdCode="currentAdCode"
          :ifView="ifView"
          :openType="openType"
          @cancelHandler="cancelHandler"
          @addShuiKuSuccess="addShuiKuSuccess">
        </shuiKuTianBao>
      </a-layout-content>
    </a-layout>
    <!-- 上传模板弹窗 -->
    <shuiku-tian-bao-pl
      v-if="showShuiKuTianBaoPl"
      :showShuiKuTianBaoPl="showShuiKuTianBaoPl"
      :id="currentNodeId"
      @closePlDialog="closePlDialog"></shuiku-tian-bao-pl>
    <rsvr-info
      :currentObjectRgstrId="currentObjectRgstrId"
      :currentResCode="currentResCode"
      :currentObjectId="currentObjectId"
      :currentObjectName="currentResName"
      :isJiangXi="isJiangXi"
      v-if="showDuchaDetails"
      @cancelHandler="closeInfoDialog"></rsvr-info>
  </div>
</template>

<script>
import { getrgstrIdObject, getSKList_xsk } from '../../api/duChaTianBao.js';
import { curAdcode_long, curAdcode_short } from '../../utils/global_variable';
import request from '../../utils/gw_ajax_request.js';
import { dateFormat } from '../../utils/gw_date.js';
import { exportModel } from '../../utils/gw_exportModel';
import addvSearch from '../../widgets/addvSearch.vue';
import provTreeList from '../../widgets/provTreeList.vue';
import shuiKuTianBao from '../duChaTianBao/shuiKuTianbao.vue';
import shuikuTianBaoPl from '../duChaTianBao/shuiKuTianbao_piliang.vue';
import {
  fillColumnForJiangxi,
  fillColumnNation,
} from './shuiku/forDifferentProvince.js';
import rsvrInfo from './shuiku/skInfo/main.vue';
export default {
  components: {
    provTreeList: provTreeList,
    shuiKuTianBao: shuiKuTianBao,
    shuikuTianBaoPl: shuikuTianBaoPl,
    rsvrInfo: rsvrInfo,
    addvSearch,
  },
  data() {
    return {
      openType: false,
      chkType: '',
      isOpen: true,
      leftWidth: '320px',
      dateRange: [],
      lyjg: [],
      engScales: [
        { id: '4', name: '小（1）型' },
        { id: '5', name: '小（2）型' },
      ],
      engScale: undefined,
      orgName: '',
      groupName: '',
      groupId: '',
      groups: [],
      // sttm:'',
      // ettm:'',
      adName: '',
      treeData: [],
      expandedKeys: [],
      dxdcMainHeight: window.innerHeight - 304,
      testHeight: window.innerHeight - 111,
      skDataList: [],
      pageIndex: 1,
      pageSize: 20,
      total: 0,
      tableHeight: 0,
      currentResCode: '',
      currentResName: '',
      currentObjectId: '',
      currentObjectRgstrId: '',
      currentObjectInfoObject: null,
      showShuiKuTianBao: false,
      currentAdCode: '',
      currentRsvrNm: '',
      ifView: false,
      currentNodeId: '',
      rsvrName: '',
      dcType: undefined,
      rowData: '',
      disabled: true,
      showShuiKuTianBaoPl: false,
      downIcon: 'el-icon-download',
      expLoading: false,
      //
      repeatId: '',
      showDuchaDetails: false,
      zerenrenLabel: '"三个责任人"落实情况',
      pType: 1,
      fillTableData: [], // 根据不同省份赋值
      columns: [
        {
          title: '水库名称',
          dataIndex: 'nm',
          width: 130,
          fixed: 'left',
          align: 'center',
        },
        {
          title: '市',
          dataIndex: 'city',
          width: 100,
          align: 'center',
        },
        {
          title: '县',
          dataIndex: 'county',
          width: 100,
          align: 'center',
        },
        {
          title: '检查单位',
          dataIndex: 'riverName',
          width: 120,
          align: 'center',
        },
        {
          title: '所在组',
          dataIndex: 'groupName',
          width: 150,
          align: 'center',
        },
        {
          title: '要求完成时间',
          dataIndex: 'deadline',
          width: 180,
          align: 'center',
        },
        {
          title: '督查时间',
          dataIndex: 'intm1',
          width: 120,
          align: 'center',
        },
        {
          title: '更新时间',
          dataIndex: 'uptm',
          width: 120,
          align: 'center',
        },
        {
          title: '督查分类',
          dataIndex: 'chkType',
          width: 50,
          align: 'center',
        },
        {
          title: '督查状态',
          dataIndex: 'state',
          width: 130,
          align: 'center',
        },
        {
          title: '工程规模',
          dataIndex: 'engScal',
          width: 100,
          align: 'center',
        },
        {
          title: '水库所在位置',
          dataIndex: 'hystSite',
          width: 200,
          align: 'center',
        },
        {
          title: '管理单位',
          dataIndex: 'rsAdmName',
          width: 180,
          align: 'center',
        },
        {
          title: '总库容(万m³)',
          // dataIndex: 'totCap',
          dataIndex: 'totCap',
          width: 130,
          align: 'right',
        },
        // {
        //   title: '操作',
        //   dataIndex: 'action',
        //   width: 330,
        //   align: 'center',
        //   fixed: 'right'
        // }
      ],
    };
  },
  computed: {
    persId() {
      return localStorage.getItem('persId')
        ? localStorage.getItem('persId')
        : '1098101939614724096';
    },
    isAdmin: () =>
      localStorage.getItem('isAdmin') ? localStorage.getItem('isAdmin') : '',
    currentRlcode() {
      return localStorage.getItem('currentRlcode')
        ? localStorage.getItem('currentRlcode')
        : '';
    },
    isJiangXi() {
      return this.currentRlcode.indexOf('36') == '0';
    },
    curAdcode_short() {
      return curAdcode_short;
    },
    curAdcode_long() {
      return curAdcode_long;
    },
    persType() {
      return localStorage.getItem('persType')
        ? localStorage.getItem('persType')
        : '';
    },
  },
  created() {},
  mounted() {
    this.$nextTick(function () {
      this.tableHeight =
        window.innerHeight - this.$refs.table.$el.offsetTop - 220;
      window.onresize = () => {
        this.tableHeight =
          window.innerHeight - this.$refs.table.$el.offsetTop - 220;
      };
    });
    this.getLeftTreeData();
    this.currentNodeId = '';
    this.rsvrName = '';
    this.dcType = undefined;
    this.getSkDataList();
    this.getAllGroup();
    this.$nextTick(() => {
      this.fillTableData = fillColumnNation;
      this.fillTableData.forEach((item) => {
        const obj = {
          title: item.label,
          dataIndex: item.prop,
          width: 130,
          align: 'center',
        };
        this.columns.push(obj);
      });
      this.columns.push({
        title: '操作',
        dataIndex: 'action',
        width: 330,
        align: 'center',
        fixed: 'right',
      });
    });
  },
  watch: {
    currentNodeId(n, o) {
      this.getSkDataList();
    },
    groupName(n, o) {
      if (n == '') {
        this.groupId = '';
      }
    },
  },
  methods: {
    dateFormat,
    closeLeft() {
      this.isOpen = false;
      this.leftWidth = '0';
      // this.rightWidth = 24
    },
    openLeft() {
      this.isOpen = true;
      this.leftWidth = '320px';
      // this.rightWidth = 19
    },
    // 获取所有的组
    getAllGroup() {
      request
        .get('/dc/user/getGroupByPersid', {
          params: { persid: this.persId, ptype: '1' },
        })
        .then((res) => {
          if (res.success) {
            this.groups = res.data;
          }
        });
    },
    querySearchAsync(queryString, cb) {
      var restaurants = this.groups;
      var results = queryString
        ? restaurants.filter(this.createStateFilter(queryString))
        : restaurants;

      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        cb(results);
      }, 1500 * Math.random());
    },
    createStateFilter(queryString) {
      return (state) => {
        return state.nm.toLowerCase().indexOf(queryString.toLowerCase()) != -1;
      };
    },
    handleSelect(item) {
      this.groupId = item;
    },
    getLeftTreeData() {
      this.lyjg = [];
      this.expandedKeys = [];
      request
        .get('/dc/organization/base/getAllNode', {
          params: { userId: this.persId, orgType: '001' },
        })
        .then((res) => {
          let data = res.data;
          data.forEach((ele) => {
            if (ele.pid == null || ele.pid == '') {
              ele.pid = '001';
            }
            if (ele.id.length == 6) {
              this.lyjg.push(ele);
            }
          });
          data = this.getTrees(data);
          const scopedSlots = {
            title: 'custom',
          };
          data.forEach((item) => {
            item.scopedSlots = scopedSlots;
            if (item.children && item.children.length > 0) {
              item.children.forEach((item1) => {
                item1.scopedSlots = scopedSlots;
                if (item1.children && item1.children.length > 0) {
                  item1.children.forEach((item2) => {
                    item2.scopedSlots = scopedSlots;
                  });
                }
              });
            }
          });
          this.treeData = data;
          this.expandedKeys.push(data[0].id);
          // _self.duChaType = _self.treeData[0].id.substring(2,3);
        });
    },
    // 格式化树形数据
    getTrees(list) {
      // @wxcwater重写方法 适应多个树
      let highLevelLength = 99; // 预设最大节点id长度，目前最大应该为12，所以设置为99保证正常
      list.forEach((item, index) => {
        item['pidLength'] = item.pid && item.pid != '' ? item.pid.length : 0;
        if (highLevelLength > item.pidLength) {
          highLevelLength = item.pidLength;
        }
      });
      const heightLevelNode = [];
      list.forEach((item, index) => {
        if (highLevelLength >= item.pidLength) {
          heightLevelNode.push(item);
        }
      });

      list.forEach((item, index) => {
        heightLevelNode.forEach((pItem) => {
          this.addTreeNode(pItem, item);
        });
      });
      return heightLevelNode;
    },

    addTreeNode: function (treeNode, leafNode) {
      if (!Object.hasOwn(treeNode, 'children')) {
        treeNode['children'] = [];
      }
      if (leafNode.pid == treeNode.id) {
        treeNode.children.push(leafNode);
        return;
      }
      treeNode.children.forEach((item) => {
        this.addTreeNode(item, leafNode);
      });
    },
    treeNodeClickHandler: function (selectedKeys, e) {
      const { dataRef: data } = e.node;
      this.currentNodeId = selectedKeys[0];
    },
    provTreeSelectChangeHandler: function (params) {
      this.currentAdCode = params.likeCode;
      this.getSkDataList();
    },
    getSkDataList: function () {
      let paramStartDate = '';
      let paramEndDate = '';
      if (
        this.dateRange &&
        this.dateRange.length > 1 &&
        this.dateRange[0] != '' &&
        this.dateRange[1] != ''
      ) {
        paramStartDate = this.dateRange[0];
        paramEndDate = this.dateRange[1];
      }
      const paramsData = {
        type: 'rsvr',
        presId: this.persId,
        pType: '1',
        pageSize: this.pageSize,
        pageNum: this.pageIndex,
        id: this.currentNodeId,
        rsName: this.rsvrName,
        state: this.dcType,
        adName: this.adName,
        sttm: paramStartDate,
        entm: paramEndDate,
        riverId: this.orgName,
        engScal: this.engScale,
        groupId: this.groupId,
      };
      if (this.currentRlcode.indexOf('36') == '0') {
        paramsData['repeatId'] = this.repeatId;
      }
      getSKList_xsk(paramsData).then((res) => {
        res.data.list.forEach((item) => {
          if (item.intm) {
            item.intm1 = dateFormat(item.intm, 'yyyy-MM-dd');
          }
        });
        this.skDataList = res.data.list;
        this.total = res.data.total;
      });
    },
    onSubmit() {
      this.getSkDataList();
    },
    toAddMember(type, rowData) {
      this.rowData = rowData;
      // getrgstrIdObject(rowData.code,rowData.objId,_self.pageIndex).then(
      //   (res) =>{
      //     console.log(res);
      this.currentResCode = this.rowData.code;
      this.currentObjectId = this.rowData.objId;
      this.currentObjectRgstrId = this.rowData.rgstrId;
      this.currentResName = this.rowData.nm;
      this.currentRsvrNm = this.rowData.rsvrNm;
      this.currentAdCode = this.rowData.adCode;
      this.ifView = false;
      this.showShuiKuTianBao = true;
      this.openType = true;
      this.chkType = this.rowData.chkType;

      // 获取完成
      //   },
      //   (err) =>{

      //   }
      // );
    },
    toCheck(rowData) {
      this.rowData = rowData;
      this.currentResCode = this.rowData.code;
      this.currentObjectId = this.rowData.objId;
      this.currentObjectRgstrId = this.rowData.rgstrId;
      this.currentResName = this.rowData.nm;
      this.currentRsvrNm = this.rowData.rsvrNm;
      this.currentAdCode = this.rowData.adCode;
      this.ifView = true;
      this.showShuiKuTianBao = true;
      this.openType = false;
    },
    cancelHandler() {
      this.showShuiKuTianBao = false;
    },
    addShuiKuSuccess() {
      this.getSkDataList();
      // this.showShuiKuTianBao = false;
    },
    deleteMember(obj) {
      // /dc/insp/rsvrRgstr/delete/{id}
      this.$confirm({
        title: '提示',
        content: '此操作将督查对象从列表中删除，确认删除该水库吗？',
        okType: 'warning',
        onOk: () => {
          request
            .get(
              `/supervision/plan/cleanObjDataByObjId?objType=1&objId=${obj.objId}`,
            )
            .then((res) => {
              if (res.success) {
                this.pageIndexChange();
                this.$message.success('删除成功');
              } else {
                this.$message.error(res.message);
              }
            });
        },
      });
    },
    submitHandler(rowData) {
      // optionsForJiangxi
      // 都要督查的数据的类别(运行管理、设备设施...)
      const duChaCategorys = this.fillTableData;
      getrgstrIdObject(rowData.code, rowData.objId).then(() => {
        this.$confirm({
          title: '提示',
          content: '请确认所有信息填报完毕？',
          okType: 'warning',
          onOk: () => {
            const formObj = {
              rgstrId: rowData.rgstrId,
              state: '2',
            };
            request.post('/dc/insp/rsvrRgstr/tbsubmit', formObj).then((res) => {
              if (res.success) {
                request
                  .get('/dc/insp/pblm/submit/updateState/' + rowData.objId)
                  .then((res) => {
                    if (res.success) {
                      this.addShuiKuSuccess();
                      this.$message.success('提交成功');
                    } else {
                      this.cancelHandler();
                    }
                  });
              } else {
                this.cancelHandler();
              }
            });
          },
        });
      });
    },
    pageIndexChange(val) {
      this.pageIndex = val;
      this.getSkDataList();
    },
    handleSizeChange(val, size) {
      this.pageSize = size;
      this.getSkDataList();
    },
    // 下载填报模板
    async downloadTemplate() {
      const url =
        '/pdcApi/dc/impExcel/downloadTemplate/sk?userId=' +
        this.persId +
        '&id=' +
        this.currentNodeId;
      const downloadName = '小水库填报模板.xls';
      const type = 'get';
      await exportModel(type, url, downloadName);
      this.disabled = false;
    },
    showPlDialog() {
      this.showShuiKuTianBaoPl = true;
    },
    closePlDialog(val) {
      this.showShuiKuTianBaoPl = false;
    },
    // 新需求  点击复查显示以前的督查信息
    toShowDuchaDetail(row) {
      this.currentResCode = row.code;
      this.currentObjectId = row.objId;
      this.currentObjectRgstrId = row.rgstrId;
      this.currentResName = row.nm;
      this.showDuchaDetails = true;
    },
    closeInfoDialog() {
      this.showDuchaDetails = false;
    },
    // 加入复查
    joinRecheck(row) {
      const data = {
        regerId: row.rgstrId,
        type: '1',
      };
      this.$confirm({
        title: '提示',
        content: '确定加入复查吗？',
        okType: 'warning',
        onOk: () => {
          request
            .post(`/bis/insp/repeat/check/log`, data)
            .then((res) => {
              if (res.success) {
                this.$message.success('已加入复查');
                this.getSkDataList();
              } else {
                this.$message.error(res.message);
              }
            })
            .catch((err) => {
              this.$message.error(err.message);
            });
        },
      });
    },
  },
};
</script>

<style lang='less' scoped>
/deep/ .ant-table-pagination {
  float: left;
}
/deep/ .warning-row {
  background: oldlace;
}
/deep/ .success-row {
  background: #f0f9eb;
}
#dxdcListMainsk {
  overflow-y: hidden;
}

.open_board {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 24px;
  height: 30px;
  line-height: 30px;
  border: solid 1px #ddd;
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
  text-align: center;
  background-color: #bbebff;
  cursor: pointer;
}
/deep/ .ant-layout-sider, /deep/ .ant-layout-content {
  background: #fff;
}
/deep/ .ant-table-thead>tr>th,
/deep/ .ant-table-tbody>tr>td {
  padding: 0;
  height: 60px;
}
.ellipsis130 {
  display: block;
  width: 128px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.ellipsis100 {
  display: block;
  width: 98px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.ellipsis120 {
  display: block;
  width: 118px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.ellipsis150 {
  display: block;
  width: 148px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.ellipsis180 {
  display: block;
  width: 178px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.ellipsis200 {
  display: block;
  width: 198px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.ant-table /deep/ td {
  white-space: nowrap;
}

// 处理表格横向滚动条不生效
/deep/ .ant-table-scroll {
  position: relative;
  z-index: 1;
}
/deep/.ant-table-fixed-left,
/deep/ .ant-table-fixed-right {
  z-index: 2;
}
.open_board {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 24px;
  height: 30px;
  line-height: 30px;
  border: solid 1px #ddd;
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
  text-align: center;
  background-color: #bbebff;
  cursor: pointer;
}
</style>
