index.js 2.4 KB
import Api from '~/service/Api';
import moment from 'moment';

export default {
  methods: {
    async handleReset() {
      this.model.chkinc = '';
      this.model.chkdzt = '';
      this.model.chkpen = '';
      this.model.chkcor = '';
      this.model.chkaut = '';
      this.model.chkdel = '';
      this.model.chktco = '';
      this.model.chkcan = '';
      this.model.selobj = '';
      this.model.seltxt = '';
      this.model.usfmod.flt = '';
      this.model.inidatfro = '';
      this.model.inidattil = '';
      this.model.dflg = '1';
      this.model.chkypt = '';
      this.model.yptinf = '';
    },
    //点击查询按钮时,判断“来源”是否有数据
    async handleSearch() {
      console.log('this', this.sourceList);
      if (!this.sourceList.length) {
        this.$notify.error({ title: '错误', message: '来源不能为空!' });
        return;
      }
      const params = {
        ...this.model,
        sourceList: this.sourceList,
        userId: window.sessionStorage.userId || 'ZL',
        pageSize: this.pagination.pageSize,
        pageNo: this.pagination.pageIndex,
        inidatfro: moment(this.model.inidatfro).format('YYYY-MM-DD'),
        inidattil: moment(this.model.inidattil).format('YYYY-MM-DD'),
      };
      const res = await Api.post('/service/sptsel/list', params);
      if (res.respCode === SUCCESS) {
        this.stmData.data = res.data.records;
        this.pagination.total = res.data.total;
        this.$store.commit('setTaskList', {
          key: 'sptsel',
          val: this.stmData.data.length,
        });
      }
    },
    async onDetails(idx, row) {
      let inr = row.inr;
      this.$router.push({ path: 'business-new/sptpopup', query: { inr: inr } });
    },
    async continueEdit(row, scope) {
      this.updateToHandleRowData({
        ...this.toHandleRowData,
        [`row_${row.frm.toLowerCase()}`]: row
      })
      let trnName = row.frm.toLowerCase();
      this.$router.push({
        path: 'business-new/' + trnName,
        params: { prePageId: this.model.pageId },
      });
    },
    // pageSize改变
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pagination.pageIndex = 1;
      this.pagination.pageSize = val;
      this.handleSearch();
    },
    // 页码改变
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pagination.pageIndex = val;
      this.handleSearch();
    },
  },
};