123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <div class="calculateInfo_container">
- <div class="title">
- <el-row>
- <el-col :span="24">
- <div class="top">
- <div class="demo-input-suffix">
- <el-input placeholder="主体名称" class="input-demo" v-model="formCondition.companyLongName"></el-input>
- <el-input placeholder="公司名称" class="input-demo" v-model="formCondition.companyName"></el-input>
- <el-input placeholder="税号" class="input-demo" v-model="formCondition.companyReferencenum"></el-input>
- <el-input placeholder="etc卡号" class="input-demo" v-model="formCondition.etcNum"></el-input>
- </div>
- <div class="demo-input-suffix" style="margin-top: 5px;margin-left: 10px;">
- <el-date-picker v-model="formCondition.calTime" type="monthrange" value-format="yyyy-MM" range-separator="至" start-placeholder="计费开始" end-placeholder="计费结束"></el-date-picker>
- <el-button type="success" style="margin-left: 1%;" @click="firstLoadData">查询</el-button>
- <el-button type="primary" style="margin-left: 1%;" @click="exportExcel">导出报表</el-button>
- </div>
- </div>
- </el-col>
- </el-row>
- </div>
- <!-- 表格部分 -->
- <template>
- <el-table
- class="table"
- v-loading="loading"
- ref="multipleTable"
- :data="calculateInfo"
- :height="heightt"
- border
- tooltip-effect="dark">
- <el-table-column
- prop="companyLongName"
- label="主体名称"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- label="公司名称"
- prop="companyName"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- label="购方税号"
- prop="companyReferencenum"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="etcNum"
- label="ETC卡号"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="fee"
- label="费用"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="calTime"
- label="计费时间"
- show-overflow-tooltip>
- </el-table-column>
- </el-table>
- </template>
- <!-- 分页 -->
- <div class="block">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="current"
- :page-sizes="[6, 8, 10, 20, 50, 100]"
- :page-size="pagesize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </div>
- </template>
- <script type="text/javascript">
- import FileSaver from 'file-saver'
- import XLSX from 'xlsx'
- export default {
- data() {
- return {
- formCondition: {
- companyName: ``,
- companyReferencenum: ``,
- etcNum: ``,
- calTime: ``,
- companyLongName: ``
- },
- calculateInfo: [],
- hightt: `0px`,
- current: 1,
- pagesize: 8,
- total: ``
- }
- },
- created() {
- this.heightt = tableHeight // eslint-disable-line
- this.loadData()
- },
- filters: {
- rounding(value) {
- return value.toFixed(2)
- }
- },
- methods: {
- firstLoadData() {
- this.current = 1
- this.pagesize = 8
- this.loadData()
- },
- // 列表展示
- async loadData() {
- const formData = new FormData()
- formData.append(`current`, this.current)
- formData.append(`size`, this.pagesize)
- formData.append(`companyName`, this.formCondition.companyName)
- formData.append(`companyReferencenum`, this.formCondition.companyReferencenum)
- formData.append(`etcNum`, this.formCondition.etcNum)
- formData.append(`calTime`, this.formCondition.calTime)
- formData.append(`companyLongName`, this.formCondition.companyLongName)
- const response = await this.$http.post(`selfCar/findSelfcarCalculateInfo`, formData)
- if (response.data.code == 0) {
- this.calculateInfo = response.data.data.records
- this.total = response.data.data.total
- }
- },
- // 分页方法
- handleSizeChange(val) {
- this.pagesize = val
- this.loadData()
- },
- handleCurrentChange(val) {
- this.current = val
- this.loadData()
- },
- formartNum(wb) {
- var sheet = wb[`Sheets`][`Sheet1`]
- var replaceTemp = []
- for (var i in sheet) {
- if (sheet[i][`v`] == `费用`) {
- replaceTemp.push(i.replace(/[0-9]/g, ``))
- continue
- }
- if (replaceTemp.includes(i.replace(/[0-9]/g, ``))) {
- sheet[i][`t`] = `n`
- }
- }
- },
- async exportExcel() {
- const loading = this.$loading({
- lock: true,
- text: `系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...`,
- spinner: `el-icon-loading`,
- background: `rgba(0, 0, 0, 0.7)`
- })
- let curr = this.current
- let pagesize1 = this.pagesize
- this.current = 1
- this.pagesize = this.total
- await this.loadData()
- // 设置当前日期
- let time = new Date()
- let year = time.getFullYear()
- let month = time.getMonth() + 1
- let day = time.getDate()
- let name = `自有车计费查询列表_` + year + `` + month + `` + day
- /* generate workbook object from table */
- // .table要导出的是哪一个表格
- var wb = XLSX.utils.table_to_book(document.querySelector(`.table`), { raw: true })
- this.formartNum(wb)
- /* get binary string as output */
- var wbout = XLSX.write(wb, {
- bookType: `xlsx`,
- bookSST: true,
- type: `array`
- })
- try {
- // name+'.xlsx'表示导出的excel表格名字
- FileSaver.saveAs(
- new Blob([wbout], { type: `application/octet-stream` }),
- name + `.xlsx`
- )
- } catch (e) {
- }
- this.current = curr
- this.pagesize = pagesize1
- this.loadData()
- loading.close()
- return wbout
- }
- }
- }
- </script>
- <style>
- .calculateInfo_container {
- border: 1px solid #d9d9d9;
- border-radius: 10px;
- }
- .calculateInfo_container .title {
- font-size: 5px;
- margin-bottom: 20px;
- }
- .calculateInfo_container .top {
- padding-top: 20px;
- padding-left: 20px;
- }
- .calculateInfo_container .text {
- display: inline-block;
- color: #000;
- font-size: 16px ;
- margin-left: 1%;
- }
- .calculateInfo_container .input-demo {
- display: inline-block;
- width: 20%;
- margin-left: 1%;
- }
- .calculateInfo_container .block {
- font-size: 5px;
- text-align: center;
- margin-top: 25px;
- margin-bottom: 25px;
- }
- .calculateInfo_container .el-dialog {
- width: 60%;
- }
- .calculateInfo_container .el-dialog__header, .el-dialog__body {
- padding: 0 20px;
- }
- .calculateInfo_container .tou {
- font-size: 20px;
- height: 30px;
- line-height: 30px;
- padding-top: 15px;
- }
- .calculateInfo_container .line {
- margin-top: 15px;
- margin-bottom: 15px;
- width: 100%;
- height: 2px;
- background-color: #d9d9d9;
- }
- .calculateInfo_container .xinxi {
- text-align: center;
- margin: 15px auto;
- font-size: 18px;
- }
- </style>
|