popularActiveRecord.vue 6.46 KB
Newer Older
qzhxx's avatar
qzhxx committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
<template>
  <div class="popularActiveRecord H100">
    <div class="head_box">
      <h6>预约记录 / 热门活动</h6>
      <h4>热门活动</h4>

    </div>
    <div class="content_box">
      <div class="form_box h778px" >
        <el-form :inline="true" :model="form" class="search-form" onsubmit="return false;">
          <el-form-item label="活动名称:">
            <el-input  size="mini" placeholder="请输入活动名称"  v-model="form.name" @keyup.enter.native="Search" clearable></el-input>
          </el-form-item>
          <el-form-item label="网点归属:"  v-if="roleId != 3">
            <el-select size="mini" v-model="form.value" placeholder="请选择网点归属" filterable clearable @change="Search">
              <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button size="mini"  type="primary" class="btn_form_search" @click="Search">查询</el-button>
          </el-form-item>
          <el-form-item class="r-float">
            <el-button size="mini" type="primary"   class="btn_form_add"  @click="exportExcel">下载数据</el-button>
          </el-form-item>
        </el-form>
        <div class="scrool">
          <el-table id="out-table" style="width:100%;" ref="multipleTable"  :data="tableData">
          <el-table-column label="预约人" prop="name"  ></el-table-column>
          <el-table-column label="预约人数" prop="numberOfPeople"></el-table-column>
          <el-table-column label="预约手机号" prop="phoneNumber"></el-table-column>
          <el-table-column label="活动名称" show-overflow-tooltip prop="proActName"></el-table-column>
          <el-table-column label="预约时间" prop="createTime" width="160">
            <template slot-scope="scope">
              {{scope.row.appointTime | dateformat('YYYY-MM-DD HH:mm:ss')}}
            </template>
          </el-table-column>
          <el-table-column label="归属网点" prop="bankName"></el-table-column>
        </el-table>
        </div>
        <el-pagination small background
                       @current-change="handleCurrentChange"
                       :current-page="page.currentPage"
                       :page-size="page.pageSize"
                       layout="prev, pager, next"
                       :total="page.total">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        page: {
          currentPage: 1, //当前页
          pageSize: null, //每页条数
          total: null, //总条数
        },
        tableData: [],
        options: [],

        roleId: '',
        bankBranchId: '',
        form:{
          name: '',
          value: '',
        }


      }
    },
    computed: {
    },
    mounted() {
      this.initData();
    },
    components: {

    },
    methods: {
      initData() {
        this.roleId = localStorage.getItem('roleId');
        this.bankBranchId = localStorage.getItem('bankBranchId');
        this.onSearch();
        this.getBranch();
      },
      // 归属网点列表渲染
      getBranch() {
        let _this = this;
        _this.$https({
          method: 'get',
          url: 'bankBranchInfo/getBankBox?action=appInfoQuery&roleId='+_this.roleId+'&bankId='+_this.bankBranchId,
          authType: this.backToken
        }).then((res) => {
          _this.options =  res.data;
          }, (error) => {
            console.log(error)
          }
        )
      },
      // 获得数据接口
      getTableData(param) {
        let vm = this;
        vm.$https({
          url : "productAppointmentRecord/getList?type=2",
          method: 'get',
          authType: this.backToken
        },param).then((res)=>{
          let data = res.data;
          vm.page.pageSize = data.size;
          vm.page.total = data.total;
          vm.tableData = data.records;
        }).catch(function(err){
          console.log(err);
        })
      },
      // 分页
      handleCurrentChange(val) {
        let _this = this;
        _this.page.currentPage = val;
        _this.onSearch();
      },
      onSearch() {
        let _this = this;
        let param = _this.getSearchQuery();
        _this.getTableData(param)
      },
      Search(){
        let _this = this;
        _this.page.currentPage = 1;
        let searchObj = {
          "_index": 1,
          "_size": _this.page.pageSize,
          "proActName": _this.form.name,
          "bankId": _this.form.value,
          'roleId': _this.roleId,
          'currentBankId': _this.bankBranchId
        };
        this.getTableData(searchObj);
      },
      // // 获取当前查询参数
      getSearchQuery() {
        let _this = this;
        let searchObj = {
liqin's avatar
liqin committed
147
          "_index":  _this.page.currentPage,
qzhxx's avatar
qzhxx committed
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
          "_size": _this.page.pageSize,
          'roleId': _this.roleId,
          'currentBankId': _this.bankBranchId
        };
        for (let key in _this.form) {
          if (_this.form[key]) {
            searchObj[key] = _this.form[key];
          }
        }
        return searchObj;
      },
      exportExcel () {
        window.location.href= this.$baseUrl+'productAppointmentRecord/generalCaseDownload?proActName='+this.form.name
          +'&bankId='+this.form.value+'&type=2&roleId='+this.roleId+'&currentBankId='+this.bankBranchId;
      },
    }
  }
</script>

<style lang="less">
  @import '../../style/common';
  .popularActiveRecord{
    .content_box{
      .input_box{
        width: 100%;
        min-width: 815px;
        margin-bottom: 30px;
        .el-input, .el-select{
          max-width:272px;
          background:rgba(255,255,255,1);
          border-radius:4px;
          .el-input__inner{
            height:32px;
          }
          .el-input__suffix{
            height: 110%;
          }
        }
        .btn_form_search,.btn_form_add{
          height: 32px;
          text-align: center;
          padding: 0 15px;
        }
      }
      .scrool {
        width: 100%;
        height: calc(100% - 100px);
        overflow-x: hidden;
        overflow-y: scroll;
        .el-table {
          .el-table__header-wrapper {
            .el-table__header {
              .has-gutter tr th {
                background: rgba(250, 250, 250, 1);
              }

            }
          }
          .el-table__body-wrapper {
            width: 100%;
            table tbody tr td {
              padding: 6px 0px;
            }
          }
        }
      }
    }
  }
</style>