Blame view

src/views/jktj/dataReceiveQuality/index.vue 6.22 KB
任超 committed
1 2 3 4 5 6
<!-- 接入质量评价表 -->
<template>
  <div class="from-clues">
    <!-- 头部搜索 -->
    <div class="from-clues-header">
      <el-form ref="ruleForm" :model="form" label-width="100px">
7
        <Breadcrumb />
任超 committed
8 9 10 11 12 13 14 15 16 17
        <el-row class="mb-5">
          <el-col :span="6">
            <el-form-item label="接收日期" prop="startTime">
              <el-date-picker type="date" class="width100" placeholder="开始日期" :picker-options="pickerOptionsStart"
                clearable v-model="form.startTime" value-format="yyyy-MM-dd"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="至" prop="endTime" label-width="35px">
              <el-date-picker type="date" class="width100" placeholder="结束日期" :picker-options="pickerOptionsEnd" clearable
任超 committed
18
                v-model="form.endTime" value-format="yyyy-MM-dd"></el-date-picker>
任超 committed
19 20 21 22 23
            </el-form-item>
          </el-col>
          <!-- 按钮操作 -->
          <el-col :span="12" class="btnColRight">
            <el-form-item>
任超 committed
24
              <btn nativeType="cz" @click="handleResetForm">重置</btn>
25
              <btn nativeType="cx" @click="featchDataSelf">查询</btn>
xiaomiao committed
26
              <btn nativeType="cx" :disableds="disableds" @click="handlesetExport2Excel(downTitle)">导出</btn>
任超 committed
27 28 29 30 31 32
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <!-- 列表区域 -->
33
    <div class="from-clues-content complex-header">
34
      <lb-table ref="table" :header-cell-style="headerStyle1" :calcHeight="BASE_API.calcHeight" :pagination="false"
任超 committed
35
        :column="tableData.columns" :data="tableData.data">
任超 committed
36
      </lb-table>
任超 committed
37 38 39 40

      <down-lb-table ref="table" v-show="false" :id="'mytable'" :downExcel="true" :header-cell-style="headerStyle"
        :pagination="false" :column="tableData.columns" :data="tableData.data" :downTitle="downTitle">
      </down-lb-table>
任超 committed
41 42 43 44 45
    </div>
  </div>
</template>

<script>
xiaomiao committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
  // 接入质量评价表
  // 引入表格头部数据
  import data from "./data";
  // 引入table混入方法
  import tableMixin from "@/mixins/tableMixin.js";
  // 导出excel表格
  import downLbTable from '@/components/DownLbTable'
  // 获取时间
  import { getCurrentDate, setExport2Excel } from "@/utils/tools";
  import { dataReceiveQuality } from "@/api/statistics.js";
  export default {
    name: "jsbwcx",
    components: {
      downLbTable
    },
    mixins: [tableMixin],
    data () {
      return {

        pickerOptionsStart: {
          disabledDate: (time) => {
            let endDateVal = this.form.endTime;
            if (endDateVal) {
              return (
                time.getTime() >=
                new Date(endDateVal).getTime()
              );
            }
          },
任超 committed
75
        },
xiaomiao committed
76 77 78 79 80 81 82 83 84 85
        pickerOptionsEnd: {
          disabledDate: (time) => {
            let beginDateVal = this.form.startTime;
            if (beginDateVal) {
              return (
                time.getTime() <
                new Date(beginDateVal).getTime()
              );
            }
          },
任超 committed
86
        },
xiaomiao committed
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
        // 表格数据
        form: {
          startTime: "", // 开始日期
          endTime: "" // 结束日期
        },
        // 校验规则
        rules: {
          startTime: [
            { required: true, message: "请选择开始日期", trigger: "change" },
          ],
          endTime: [
            { required: true, message: "请选择结束日期", trigger: "change" },
          ]
        },
        // 表格数据
102
        tableData: {
xiaomiao committed
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
          // 表格头部
          columns: [
            {
              label: "序号",
              type: "index",
              width: "50",
              // index: this.indexMethod,
            }
          ]
            .concat(data.columns()),
          data: []
        },
        // 导出表格标题
        downTitle: '',
        disableds: false,
      }
    },
    watch: {
任超 committed
121
      form: {
xiaomiao committed
122 123 124 125 126 127 128 129 130 131 132
        handler (newVal, oldVal) {
          this.generateFileName()
        },
        deep: true
      }
    },
    created () {
      this.handleResetForm()
      this.generateFileName()
    },
    methods: {
yuanbo committed
133 134 135 136
      /**
       * @description: handleSearch
       * @author: renchao
       */
xiaomiao committed
137 138
      handleSearch () { },
      // 生成文件名
yuanbo committed
139 140 141 142
      /**
       * @description: 生成文件名
       * @author: renchao
       */
xiaomiao committed
143 144
      generateFileName () {
        var reg = /(\d{4})\-(\d{2})\-(\d{2})/;
145
        this.downTitle = this.BASE_API.XZQ + `不动产登记增量数据接入质量评价表(${this.form.startTime.replace(reg, "$1年$2月$3日")}${this.form.endTime.replace(reg, "$1年$2月$3日")})`
任超 committed
146
      },
yuanbo committed
147 148 149 150 151 152
      /**
       * @description: headerStyle
       * @param {*} row
       * @param {*} rowIndex
       * @author: renchao
       */
xiaomiao committed
153 154 155 156 157 158
      headerStyle ({ row, rowIndex }) {
        if (rowIndex == 4) {
          row[2].rowSpan = 2;
          row[3].rowSpan = 2;
          row[4].rowSpan = 2;
        }
任超 committed
159
      },
yuanbo committed
160 161 162 163 164 165
      /**
       * @description: headerStyle1
       * @param {*} row
       * @param {*} rowIndex
       * @author: renchao
       */
xiaomiao committed
166 167 168 169 170 171
      headerStyle1 ({ row, rowIndex }) {
        if (rowIndex == 3) {
          row[2].rowSpan = 2;
          row[3].rowSpan = 2;
          row[4].rowSpan = 2;
        }
任超 committed
172
      },
yuanbo committed
173 174 175 176 177
      /**
       * @description: handlesetExport2Excel
       * @param {*} val
       * @author: renchao
       */
xiaomiao committed
178 179 180 181 182 183 184
      handlesetExport2Excel (val) {
        this.disableds = true
        setTimeout(() => {
          this.disableds = false
        }, 1000);

        setExport2Excel(val)
任超 committed
185
      },
xiaomiao committed
186
      // 初始化数据
yuanbo committed
187 188 189 190
      /**
       * @description: 初始化数据
       * @author: renchao
       */
xiaomiao committed
191 192 193 194 195 196 197
      featchDataSelf () {
        dataReceiveQuality(this.form.startTime, this.form.endTime).then(res => {
          let records = res.result
          this.tableData.data = records ? records : []
        })
      },
      // 重置
yuanbo committed
198 199 200 201
      /**
       * @description: 重置
       * @author: renchao
       */
xiaomiao committed
202 203 204 205
      handleResetForm () {
        this.form.startTime = getCurrentDate()
        this.form.endTime = getCurrentDate('time')
        this.featchDataSelf()
任超 committed
206
      }
任超 committed
207 208 209 210
    }
  }
</script>
<style scoped lang="scss">
xiaomiao committed
211
  @import "../css/index.scss";
212

xiaomiao committed
213 214 215
  /deep/th.el-table__cell {
    height: 0 !important;
  }
任超 committed
216 217
</style>