123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <div class="print-count">
- <module-view :propConfig="config" ref="view" v-loading="load" @pagination="pagination" @onRefresh="getList" @resert="queryList" @search="queryList"/>
- </div>
- </template>
- <script lang="ts">
- import { Component, Prop, Vue, Watch } from "vue-property-decorator";
- import { query} from '@/api/printCount'
- @Component({components:{}})
- export default class PrintCount extends Vue {
- load=false;
- isSearch=false
- timeNum = 0;
- config:any={
- attr:{
- calculateH:true
- },
- search:{
- attr:{
- size:'small'
- },
- columns:[
- [{
- span:8,
- label:'模板名称',
- prop:'templateName',
- component:'by-input',
- compConfig:{
- attr:{
- clearable:true
- }
- }
- },{
- span:8,
- label:'外部用户标识',
- prop:'userName',
- component:'user-modal'
- }]
- ]
- },
- tool:{
- tools:{
- search:true,
- refresh:true
- }
- },
- table:{
- attr:{
- size:'mini',
- seq:true,
- checkbox:true
- },
- columns:[{
- title:'外部用户标识',
- field:'userName',
- width:130
- },{
- title:'模板名称',
- field:'templateName'
- },{
- title:'打印次数',
- field:'printCount',
- width:130
- },{
- title:'最后一次打印时间',
- field:'lastTime',
- width:160
- }]
- }
- }
- mounted(){
- this.getList();
- }
- //分页
- pagination(){
- if(this.isSearch){
- this.queryList();
- }else{
- this.getList()
- }
- }
- //列表请求(只有分页,不包含搜素条件)
- getList(){
- if(!this.$refs.view){
- if(this.timeNum > 5){
- return
- }
- setTimeout(()=>{
- this.getList()
- },500)
- this.timeNum ++;
- return
- }
- this.isSearch = false;
- let data = (this.$refs.view as any).getPage();
- delete data.total;
- this.requestList(data);
- }
- //列表请求(包含分页和搜素条件)
- queryList(){
- this.isSearch = true;
- let data = (this.$refs.view as any).getQuery();
- delete data.total;
- this.requestList(data);
- }
- requestList(data:any){
- this.load = true;
- query(data).then((res:any) => {
- this.load = false;
- (this.$refs.view as any).setTableValue(res.data.records);
- let page = {
- pageNo: res.data.current, //当前页
- pageSize: res.data.size, //每页条数
- total: res.data.total //总条数
- };
- (this.$refs.view as any).setPage(page)
- }).catch(()=>{
- this.load = false;
- })
- }
- }
- </script>
- <style lang="scss" scoped>
- .print-count{
- width: 100%;
- height: 100%;
- overflow-y: hidden;
- }
- </style>
|