<template>
  <div class="app-container">
    <el-form label-width="100px">
      <el-row>
        <el-col :span="4">
          <el-form-item label="隐患描述">
            <el-input v-model="condform.hiddendescr" placeholder="请输入关键字"/>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="隐患来源">
            <el-select v-model="condform.source" placeholder="请选择" style="width: 100%;">
              <el-option v-for="item in sourceList" :key="item.ID" :label="item.NAME" :value="item.ID" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="发现部门" prop="keyFindUserDept">
            <SelectTree
              ref="deptTree_Select"
              :clearable="false"
              :options="hiddenCreatorDeptList"
              :props="defaultProps"
              v-model="condform.creatorUserDept"
              placeholder="请选择部门"
            />
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="发现人">
            <el-input v-model="condform.creatorName" placeholder="请输入关键字"/>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="发现日期">
            <el-date-picker v-model="condform.creatTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" style="width: 100%;" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col v-if="hiddenVueType !='ignore'" :span="4">
          <el-form-item label="隐患级别">
            <SelectTree
              v-if="hiddenlevelList.length !== 0"
              ref="hlTree_Select"
              :clearable="false"
              :options="hiddenlevelList"
              :props="defaultProps"
              v-model="condform.hiddenlevel"
              :canparent="false"
              style="width: 100%;"
              children-name="nodes"
              placeholder="请选择" />
          </el-form-item>
        </el-col>
        <el-col v-if="hiddenVueType !='ignore'" :span="4">
          <el-form-item label="隐患状态">
            <el-select v-model="condform.state" placeholder="请选择" style="width: 100%;">
              <el-option v-for="item in statusList" :key="item.ID" :label="item.NAME" :value="item.ID" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="隐患类型" prop="HIDDENTYPE">
            <el-cascader
              ref="deptTree_Select3"
              :options="hiddenTypeList"
              :props="defaultProps"
              v-model="condform.hiddenType"
              collapse-tags
              clearable/>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="确认人">
            <el-input v-model="condform.confirmUserName" placeholder="请输入关键字"/>
          </el-form-item>
        </el-col>
        <el-col v-if="hiddenVueType !='ignore'" :span="4" >
          <el-form-item label="整改人">
            <el-input v-model="condform.rectificationorName" placeholder="请输入关键字"/>
          </el-form-item>
        </el-col>
        <el-col v-if="hiddenVueType !='ignore'" :span="4" >
          <el-form-item label="验收人">
            <el-input v-model="condform.checkrecordName" placeholder="请输入关键字"/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <el-form-item label="隐患部位">
            <SelectTree
              ref="hiddenPart_Select"
              :clearable="false"
              :options="hiddenPartList"
              :props="defaultProps"
              v-model="condform.hiddenpart"
              placeholder="请选择部门"
              style="width: 100%;"
            />
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label-width="10px">
            <el-button v-waves type="primary" icon="el-icon-search" @click="getQuery">
              搜索
            </el-button>
            <el-button v-waves type="success" icon="el-icon-refresh" @click="goKeyReset">
              重置
            </el-button>
          </el-form-item>
        </el-col>
        <el-col v-if="hasButtenAllMap.buttenTypeExcel" :span="16">
          <el-form-item style="text-align: right">
            <el-button type="info" icon="el-icon-printer" size="mini" plain @click="goPrint">打印</el-button>
            <el-button type="info" icon="el-icon-top-right" size="mini" plain @click="goExcel">导出</el-button>
            <el-button type="info" icon="el-icon-top-right" size="mini" plain @click="goExcelColumn">按列导出</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-table v-loading="listLoading" ref="multipleTable" :data="varList" :row-key="getRowKey" border tooltip-effect="dark" style="width: 100%">
      <el-table-column type="selection" width="50" align="center" />
      <el-table-column type="index" label="序号" width="50" align="center" />
      <el-table-column label="隐患来源" width="80" >
        <template slot-scope="{row}">
          {{ translate(row.SOURCE.toString() =='3'?'2':row.SOURCE.toString(), sourceList) }}
        </template>
      </el-table-column>
      <el-table-column label="隐患描述" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span class="link-type" @click="goView(row.HIDDEN_ID)">{{ row.HIDDENDESCR }}</span>
        </template>
      </el-table-column>
      <el-table-column label="隐患处置" show-overflow-tooltip width="80">
        <template slot-scope="{row}">
          <template v-if="row.RECTIFICATIONTYPE=='1'">
            <div>立即整改</div>
          </template>
          <template v-else-if="row.RECTIFICATIONTYPE=='2'">
            <div>限期整改</div>
          </template>
        </template>
      </el-table-column>
      <el-table-column prop="HIDDENLEVELNAME" label="隐患级别" width="80" align="center" />
      <el-table-column label="隐患发现人" prop="userNames" show-overflow-tooltip width="90" />
      <el-table-column label="隐患部位" prop="HREGIONNAME" width="120" show-overflow-tooltip >
        <template slot-scope="{row}">
          <template v-if="row.HREGIONNAME">{{ row.HREGIONNAME }}</template>
          <template v-else>{{ row.HIDDENPART }}</template>
        </template>
      </el-table-column>
      <el-table-column label="隐患发现时间" prop="DISCOVERYTIME" width="140" show-overflow-tooltip>
        <template slot-scope="{row}">
          {{ formatDate(row.DISCOVERYTIME,'YYYY-MM-DD HH:mm:ss') }}
        </template>
      </el-table-column>
      <el-table-column label="隐患状态" width="80" align="center" show-overflow-tooltip>
        <template slot-scope="{row}">
          {{ translate(row.STATE.toString(), statusList) }}
        </template>
      </el-table-column>
      <el-table-column label="确认人" prop="CONFIRM_USER_NAME" width="80" />
      <el-table-column prop="RECTIFICATIONTIME" label="整改时间" width="100" align="center" />
      <el-table-column prop="RECTIFICATIONOR_NAME" label="整改人" width="80" align="center" />
      <el-table-column prop="CHECKORNAME" label="验收人" width="80" align="center" show-overflow-tooltip >
        <template slot-scope="{row}">
          <template v-if="row.checkNames != ''"><span>{{ row.checkNames }}</span></template>
        </template>
      </el-table-column>
      <el-table-column prop="" label="操作" width="200" align="center">
        <template slot-scope="{row}">
          <el-button v-if="hasButtenAllMap.buttenTypeGoView" icon="el-icon-view" size="mini" @click="goView(row.HIDDEN_ID)">查看</el-button>
          <el-button v-if="hasButtenAllMap.buttenTypeConfirm" :disabled="row.STATE !='-2'" type="success" icon="el-icon-check" size="mini" @click="confirm(row.HIDDEN_ID)">确认</el-button>
          <el-button v-if="hasButtenAllMap.buttenTypeRectify" :disabled="!row.STATE =='1' || !row.STATE =='10'" type="danger" icon="el-icon-document" size="mini" @click="goRectify(row.HIDDEN_ID)">整改</el-button>
          <el-button v-if="hasButtenAllMap.buttenTypePostpone" :disabled="!((row.STATE =='-1' || row.STATE =='1' || row.STATE =='10') && row.exaCount === 0 )" type="warning" icon="el-icon-document" size="mini" @click="goApplyDelay(row)">申请延期</el-button>
          <el-button v-if="hasButtenAllMap.buttenTypeCheck" :disabled="row.STATE !='2'" type="success" icon="el-icon-document-checked" size="mini" @click="goCheck(row.HIDDEN_ID)">验收</el-button>
          <el-button v-if="hasButtenAllMap.buttenTypeUpdate && row.STATE =='16' && row.CREATOR === loginUserId" icon="el-icon-edit" size="mini" @click="goEdit(row.HIDDEN_ID)">编辑</el-button>
          <el-button v-show="hasButtenAllMap.buttenTypeDelete " v-if="row.STATE =='16'&& row.CREATOR === loginUserId && ISMAIN !='1'" type="danger" icon="el-icon-delete" size="mini" @click="goDel(row.HIDDEN_ID)">删除</el-button>
          <el-button v-show="hasButtenAllMap.buttenTypeDelete && del" type="danger" icon="el-icon-delete" size="mini" @click="goDel(row.HIDDEN_ID)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="page-btn-group">
      <div>
        <el-button v-show="hasButtenAllMap.buttenTypeAdd" type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
      </div>
      <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
    </div>
    <el-dialog :visible.sync="failForm.dialogVisible" title="延期申请">
      <el-form ref="digform" :rules="dialogRules" :model="failForm" label-width="150px">
        <el-form-item label="申请延期日期" prop="DELAY_TIME">
          <el-date-picker
            v-model="failForm.DELAY_TIME"
            :picker-options="pickerOptions0"
            value-format="yyyy-MM-dd"
            type="date"
            placeholder="选择日期"/>
        </el-form-item>
        <el-form-item label="处置方案" prop="disposalPlan">
          <el-input v-model="failForm.disposalPlan" type="textarea" placeholder="请输入处置方案" style="margin-bottom: 10px"/>
          <el-upload
            :file-list="failForm.fileList"
            :before-upload="beforeFileUpload"
            action="#"
            accept=".pdf,.PDF"
          >
            <el-button slot="trigger" size="small" type="primary">选择文件</el-button>
          </el-upload>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="success" @click="failSubmit">提交</el-button>
        <el-button @click="failForm.dialogVisible = false">关 闭</el-button>
      </span>
    </el-dialog>
    <el-dialog v-if="dialogVisibleshow" :visible.sync="dialogVisibleshow" width="500px" title="请选择要导出列">
      <el-form label-width="80px">
        <el-form-item label="导出内容">
          <el-select v-model="exportSelection" multiple style="width: 100%;">
            <el-option v-for="item in hiddenlist" :key="item.key" :label="item.name" :value="item.key"/>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="success" @click="exportsubmit">提交</el-button>
        <el-button @click="dialogVisibleshow = false">关 闭</el-button>
      </span>
    </el-dialog>
    <div v-if="dialogdProgress" class="mark"><dProgress :percentage ="percentageVar" ptype="circle" /></div>
    <!--    <el-dialog v-if="dialogdProgress" :visible.sync="dialogdProgress" width="70%" height="70%" >-->
    <!--      <dProgress :percentage ="percentageVar" ptype="circle" />-->
    <!--    </el-dialog>-->
  </div>

</template>

<script>
import Pagination from '@/components/Pagination'
import { requestFN } from '@/utils/request'
import waves from '@/directive/waves'
import SelectTree from '@/components/SelectTree'
import formatDate from '@/utils/dateformat'
import { upload } from '@/utils/upload'
import { Message } from 'element-ui'
import dProgress from './Progress'
// import dProgress from '@/components/Progress' // 通过 el-pagination二次打包
export default {
  components: { Pagination, SelectTree, dProgress },
  directives: { waves },
  data() {
    return {
      total: 0,
      listQuery: {
        page: 1,
        limit: 20
      },
      listLoading: false, // 遮罩层
      varList: [],	// list
      config: config,
      condform: { // 条件查询数据
        hiddendescr: '', // 隐患描述
        source: '', // 隐患来源
        creatorName: '', // 隐患发现人
        creatTime: '', // 发现日期
        confirmUserName: '', // 确认人
        rectificationorName: '', // 整改人
        checkrecordName: '', // 验收人
        hiddenlevel: '', // 隐患级别
        state: '', // 隐患状态
        hiddenpart: '', // 隐患部位
        hiddenType: '', // 隐患类型
        creatorUserDept: ''// 隐患发现部门
      },
      /** 条件中的字段,没有放在form表单中,是因为怕动态加载中出现问题 **/
      sourceList: [
        { ID: '1', NAME: '隐患快报' },
        { ID: '2', NAME: '清单排查' },
        { ID: '4', NAME: '安全环保检查(监管端)' },
        { ID: '5', NAME: '安全环保检查(企业端)' },
        { ID: '6', NAME: '消防检查' }
      ],
      statusList: [
        { ID: '1', NAME: '未整改' },
        { ID: '2', NAME: '已整改' },
        { ID: '4', NAME: '已验收' },
        { ID: '5', NAME: '忽略隐患' },
        { ID: '6', NAME: '重大隐患' },
        { ID: '7', NAME: '待处理的特殊隐患' },
        { ID: '8', NAME: '已处理的特殊隐患' },
        { ID: '-1', NAME: '已过期' },
        { ID: '-2', NAME: '待确认' },
        { ID: '16', NAME: '确认打回' },
        { ID: '10', NAME: '验收打回' }
      ],
      defaultProps: { value: 'id', children: 'nodes', label: 'name', multiple: true, emitPath: false },
      pickerOptions0: { disabledDate(time) { return time.getTime() < Date.now() - 8.64e6 } },
      hiddenlevelList: [], // 隐患级别
      hiddenPartList: [], // 隐患部位,
      hiddenTypeList: [], // 隐患类型,
      hiddenCreatorDeptList: [], // 隐患发现部门
      hiddenVueType: '',
      hasButtenAllMap: {
        buttenTypeGoView: false,
        buttenTypeConfirm: false,
        buttenTypeRectify: false,
        buttenTypePostpone: false,
        buttenTypeCheck: false,
        buttenTypeUpdate: false,
        buttenTypeDelete: false,
        buttenTypeAdd: false,
        buttenTypeExcel: false
      },
      add: false,		// 增
      del: false,		// 删
      edit: false,		// 改
      toExcel: false,	// 导出到excel权限
      dialogRules: {
        DELAY_TIME: [{ required: true, message: '延期日期不为空', trigger: 'blur' }],
        disposalPlan: [{ required: true, message: '处置方案不为空', trigger: 'blur' }]
      },
      failForm: {
        dialogVisible: false,
        fileList: [],
        disposalPlan: '',
        DELAY_TIME: '',
        HIDDEN_ID: ''
      }, // 延期申请
      loginUserId: '',
      ISMAIN: '',
      dialogVisibleshow: false,
      exportSelection: [],
      hiddenlist: [],
      zhenggaiList: [],
      yanshouList: [],
      dialogdProgress: false,
      percentageVar: 0
    }
  },
  // BI 页面有要过来,等待查看参数
  created() {
    this.showBut()
    this.hiddenVueType = this.$parent.hiddenVueType
    this.getList() // 获取列表
    this.getDict() // 获取字典的信息
    this.getDeptTreeData() // 获取用户所在的企业树
    this.getEditMyInfo()
    this.getHiddenNames()
  },
  methods: {
    getEditMyInfo() { // 获取登录人信息
      requestFN(
        '/user/goEditMyInfo',
        {}
      ).then((data) => {
        this.loginUserId = data.pd.USER_ID
        this.ISMAIN = data.pd.ISMAIN
        this.$forceUpdate()
      }).catch((e) => {

      })
    },
    formatDate(date, format) {
      return formatDate(date, format)
    },
    getRowKey(row) {
      return row.HIDDEN_ID
    },
    // 获取列表
    getList() {
      this.listLoading = true
      requestFN(
        '/hiddenApi/getList?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
        {
          ...this.condform,
          hiddenVueType: this.hiddenVueType,
          STARTTIME: this.condform.creatTime[0],
          ENDTIME: this.condform.creatTime[1]
        }
      ).then((data) => {
        this.listLoading = false
        this.varList = data.varList
        this.total = data.page.totalResult
      }).catch((e) => {
        this.listLoading = false
      })
    },
    goView(hiddenID) { // 查看按钮
      this.$parent.activeName = 'Detail'
      this.$parent.HIDDEN_ID = hiddenID
    },
    // 确认
    confirm(hiddenID) {
      this.$parent.activeName = 'confirm'
      this.$parent.HIDDEN_ID = hiddenID
    },
    goRectify(hiddenID) { // 整改
      this.$parent.activeName = 'Change'
      this.$parent.HIDDEN_ID = hiddenID
    },
    getQuery() {
      // this.$refs.multipleTable.clearSelection()
      this.getList()
    },
    goKeyReset() {
      this.condform = { // 条件查询数据
        hiddendescr: '', // 隐患描述
        source: '', // 隐患来源
        creatorName: '', // 隐患发现人
        creatTime: '', // 发现日期
        confirmUserName: '', // 确认人
        rectificationorName: '', // 整改人
        checkrecordName: '', // 验收人
        hiddenlevel: '', // 隐患级别
        state: '', // 隐患状态
        hiddenpart: '', // 隐患部位
        hiddenType: '', // 隐患类型
        creatorUserDept: ''// 隐患发现部门
      }
      this.$refs.deptTree_Select3.clearHandle()
      this.$refs.deptTree_Select.clearHandle()
      this.$refs.hlTree_Select.clearHandle()
      this.$refs.hiddenPart_Select.clearHandle()
      this.getList()
    },
    // 获取数据字典数据
    getDict: function() {
      requestFN( // 隐患级别
        '/dictionaries/listSelectTree',
        {
          DICTIONARIES_ID: '5e7cf8620ba54ad89719d0be62133c7a'
        }
      ).then((data) => {
        this.hiddenlevelList = JSON.parse(data.zTreeNodes)
      })
      // 隐患部位
      requestFN(
        '/hiddenRegion/listAll'
      ).then((data) => {
        this.hiddenPartList = JSON.parse(data.zTreeNodes)
      }).catch((e) => {
        this.listLoading = false
      })
      // 隐患类型
      requestFN(
        '/dictionaries/listSelectTree',
        {
          DICTIONARIES_ID: '3babc15144444bdc8d763d0af2bdfff6'
        }
      ).then((data) => {
        this.hiddenTypeList = JSON.parse(data.zTreeNodes)
      })
    },
    // 获得部门树
    getDeptTreeData() {
      requestFN(
        '/department/listTree',
        {}
      ).then((data) => {
        this.hiddenCreatorDeptList = JSON.parse(data.zTreeNodes)
      }).catch((e) => {
      })
    },
    // 没有字典是的数据转换
    translate(id, list) {
      for (let i = 0; i < list.length; i++) {
        if (list[i].BIANMA === id || list[i].value === id || list[i].id === id || list[i].ID === id) return list[i].NAME || list[i].label || list[i].name
      }
    },
    // 可以看见的按钮
    showBut() {
      var butList = this.$parent.hasButtons
      for (var key in this.hasButtenAllMap) {
        for (let i = 0; i < butList.length; i++) {
          if (butList[i] == key) {
            this.hasButtenAllMap[key] = true
          }
        }
      }
      var keys = 'hidden:add,hidden:del,hidden:edit,toExcel'
      requestFN(
        '/head/hasButton',
        {
          keys: keys
        }
      ).then((data) => {
        this.add = data.hiddenfhadminadd		// 新增权限
        this.del = data.hiddenfhadmindel		// 删除权限
        this.edit = data.hiddenfhadminedit	// 修改权限
        this.toExcel = data.toExcel // 导出到excel权限
      }).catch((e) => {
        this.listLoading = false
      })
    },
    // 打开延期申请的弹出层
    goApplyDelay(row) {
      this.failForm = {
        dialogVisible: true,
        fileList: [],
        disposalPlan: '',
        HIDDEN_ID: row.HIDDEN_ID
      }
    },
    // 上传延期申请附件
    beforeFileUpload(file) {
      const suffix = file.name.substring(file.name.lastIndexOf('.'), file.name.length)
      if (suffix === '.pdf' || suffix === '.PDF') {
        this.failForm.fileList.push(file)
      } else {
        this.$message.warning('请上传pdf文件')
      }
      return false
    },
    // 延期申请
    failSubmit() {
      this.$refs.digform.validate(valid => {
        if (valid) {
          const formData = new FormData()
          formData.append('HIDDEN_ID', this.failForm.HIDDEN_ID)
          formData.append('DELAY_TIME', this.failForm.DELAY_TIME)
          formData.append('disposalPlan', this.failForm.disposalPlan)
          formData.append('FFILE', this.failForm.fileList[0])
          upload(
            '/hiddenApi/delayed',
            formData
          ).then((data) => {
            if (data.result == 'success') {
              this.$message.success('通过成功')
              this.failForm.dialogVisible = false
              this.getList()
            } else {
              Message({
                message: data.msg,
                type: 'error',
                duration: 5 * 1000
              })
            }
          })
        } else {
          this.$message.warning('请检查必填项')
        }
      })
    },
    // 验收
    goCheck(id) {
      this.$parent.activeName = 'Acceptance'
      this.$parent.HIDDEN_ID = id
    },
    goDel(id) {
      this.$confirm('确定要删除吗?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.listLoading = true
        requestFN(
          '/hiddenApi/deleteHiddenApi',
          {
            HIDDEN_ID: id,
            tm: new Date().getTime()
          }
        ).then((res) => {
          if (res.result === 'success') {
            this.$message({
              message: '删除成功',
              type: 'success'
            })
          } else {
            this.$message({
              message: res.codeMsg,
              type: 'error'
            })
          }
          this.getList()
        }).catch((e) => {
          this.listLoading = false
        })
      }).catch(() => {
      })
    },
    goEdit(hiddenID) {
      this.$parent.activeName = 'Edit'
      this.$parent.HIDDEN_ID = hiddenID
    },
    handleAdd() {
      this.$parent.activeName = 'Edit'
      this.$parent.HIDDEN_ID = ''
    },
    goPrint() {
      const _selectData = this.$refs.multipleTable.selection
      if (_selectData == null || _selectData.length == 0) {
        this.$message({
          message: '请选中需要打印的数据...',
          type: 'error'
        })
        return false
      }
      const ids = _selectData.map((item, index) => {
        return item.HIDDEN_ID
      }).join(',')
      this.$parent.activeName = 'Print'
      this.$parent.HIDDEN_IDS = ids
    },
    goExcel() {
      var _this = this
      _this.dialogdProgress = true
      const date = (new Date()).valueOf()// 获取时间戳
      const txt = '1234567890'// 生成的随机机器码
      const len = 13// 机器码有多少位
      let uid = ''// 定义空变量用来接收机器码
      for (let i = 0; i < len; i++) {
        uid += txt.charAt(Math.floor(Math.random() * txt.length))// 循环机器码位数随机填充
      }
      var ssionID = date + uid
      var data = '?1=1'
      data += '&hiddendescr=' + _this.condform.hiddendescr
      data += '&source=' + _this.condform.source
      data += '&creatorUserDept=' + _this.condform.creatorUserDept
      data += '&DISPOSESTATE=' + _this.condform.creatorUserDept
      data += '&creatorName=' + _this.condform.creatorName
      data += '&creatTime=' + _this.condform.creatTime
      data += '&hiddenlevel=' + _this.condform.hiddenlevel
      data += '&state=' + _this.condform.state
      data += '&hiddenType=' + _this.condform.hiddenType
      data += '&confirmUserName=' + _this.condform.confirmUserName
      data += '&rectificationorName=' + _this.condform.rectificationorName
      data += '&checkrecordName=' + _this.condform.checkrecordName
      data += '&hiddenpart=' + _this.condform.hiddenpart
      data += '&hiddenVueType=' + _this.hiddenVueType
      data += '&STARTTIME=' + _this.condform.creatTime[0]
      data += '&ENDTIME=' + _this.condform.creatTime[1]
      data += '&sessionID=' + ssionID
      data += '&tm=' + new Date().getTime()
      window.location.href = config.httpurl + 'hiddenExcel/excel2' + data

      var timingTask = setInterval(function() {
        requestFN(
          '/hiddenExcel/exportExcelToSession',
          {
            sessionID: ssionID
          }
        ).then((data) => {
          _this.percentageVar = data.progress
          if (_this.percentageVar === 100) {
            clearInterval(timingTask)
            _this.dialogdProgress = false
          }
        }).catch((e) => {
          clearInterval(timingTask)
          _this.dialogdProgress = false
        })
      }, 1000)
    },
    goExcel2() {
      if (this.condform.creatTime.length == 0) {
        this.$message.error('请选择开始时间')
        return
      }
      if (this.condform.creatTime.length == 1) {
        this.$message.error('请选择开始时间')
        return
      }
      var data = '?KEYWORDS=' + this.condform.hiddendescr
      data += '&DISPOSESTATE=' + '-1'
      data += '&STATE=' + this.condform.state
      data += '&STARTTIME=' + this.condform.creatTime[0]
      data += '&ENDTIME=' + this.condform.creatTime[1]
      // data += '&DEPARTMENT_ID=' + this.DEPARTMENT_ID
      // data += '&ISQUALIFIED=' + this.ISQUALIFIED
      data += '&HIDDENLEVEL=' + this.condform.hiddenlevel
      // data += '&IS_SELF=' + this.IS_SELF
      data += '&tm=' + new Date().getTime()
      window.location.href = config.httpurl + 'hiddenApi/excel' + data
    },
    goExcelColumn() {
      if (this.condform.creatTime.length == 0) {
        this.$message.error('请选择开始时间')
        return
      }
      if (this.condform.creatTime.length == 1) {
        this.$message.error('请选择开始时间')
        return
      }
      this.exportSelection = []
      this.dialogVisibleshow = true
    },
    exportsubmit() {
      const _selectData = this.exportSelection
      if (_selectData == null || _selectData.length == 0) {
        this.$message({
          message: '请选中要导出的数据...',
          type: 'error'
        })
        return false
      }
      const rows = []
      for (let i = 0; i < this.exportSelection.length; i++) {
        for (let j = 0; j < this.hiddenlist.length; j++) {
          if (this.exportSelection[i] === this.hiddenlist[j].key) {
            rows.push({
              state: '1',
              name: this.hiddenlist[j].name,
              key: this.hiddenlist[j].key
            })
            break
          }
        }
      }
      window.open(this.config.httpurl + 'hidden/exportexcel?export=' +
        encodeURIComponent(JSON.stringify(rows)) + '&STARTTIME=' + this.condform.creatTime[0] + '&ENDTIME=' + this.condform.creatTime[1])
      this.dialogVisibleshow = false
    },
    getHiddenNames() {
      requestFN(
        '/hidden/getHiddenNames',
        {
        }
      ).then((data) => {
        this.hiddenlist = data.varList
        console.log(this.hiddenlist)
        this.zhenggaiList = data.zhenggaiList
        this.yanshouList = data.yanshouList
      }).catch((e) => {
        this.listLoading = false
      })
    }
  }

}

</script>

<style lang="sass" scoped>
.filter-container
  position: relative
  .filter-flot
    position: absolute
    right: 0
    top: 0
</style>
<style lang="scss" scoped>
.mark{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(0,0,0,0.5);
}
</style>
