index.js 4.53 KB
Newer Older
fukai 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 147 148 149 150 151 152 153 154 155 156 157 158 159
import Api from '~/service/Api';
import { getTrnNameByInr } from "~/service/business/common";
import moment from 'moment';
import commonFunctions from '~/mixin/commonFunctions.js';
import Pts from '~/components/business/commonModel/Pts';
import commonApi from "~/mixin/commonApi";
import Utils from "~/utils";

export default {
	mixins: [commonFunctions],
	methods: {
		async ruleHandleSearch() {
      const loading = this.loading();
      let param = {
        scenecode: this.model.signinfo.scenecode,
        isdefault: "1",
        pageNumber: this.model.rulePagination.pageIndex,
        pageSize: this.model.rulePagination.pageSize,
      };
      let rtnmsg = await Api.post('/Remittance/autosignrule/list', param);
      if (rtnmsg.respCode == SUCCESS) {
        this.model.ruleList = rtnmsg.data.list;
        this.model.rulePagination.total = rtnmsg.data.total;
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
      loading.close();
		},
		// pageSize改变
    ruleHandleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.model.rulePagination.pageIndex = 1;
      this.model.rulePagination.pageSize = val;
      this.ruleHandleSearch();
    },
    // 页码改变
    ruleHandleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.model.rulePagination.pageIndex = val;
      this.ruleHandleSearch();
		},
		async handleSearch() {
      const loading = this.loading();
      let param = {
        scenecode: this.model.signinfo.scenecode,
        pageNumber: this.model.pagination.pageIndex,
        pageSize: this.model.pagination.pageSize,
      };
      let rtnmsg = await Api.post('/Remittance/autosignpty/list', param);
      if (rtnmsg.respCode == SUCCESS) {
        this.model.countPtyList = rtnmsg.data.list;
        this.model.pagination.total = rtnmsg.data.total;
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
      loading.close();
		},
		// pageSize改变
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.model.pagination.pageIndex = 1;
      this.model.pagination.pageSize = val;
      this.handleSearch();
    },
    // 页码改变
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.model.pagination.pageIndex = val;
      this.handleSearch();
    },
		async commitAdd() {
			this.$refs['modelForm'].validate(async (validStatic) => {
				if (validStatic) {
					const loading = this.loading();
					let params = {
						autoSignInfo: this.model.signinfo,
						ruleList: this.model.ruleList,
						countPtyList: this.model.countPtyList,
					};
					let rtnmsg = await Api.post(`/${this.moduleRouter()}/autosign/add`, params);
					if (rtnmsg.respCode == SUCCESS) {
						this.$notify({
							title: "成功",
							message: "保存成功",
							type: "success",
						});
						this.goBack(true);
					} else {
						this.$notify.error({ title: '错误', message: rtnmsg.respMsg });
					}
					this.initdialog = false;
					loading.close();
				}
			})
		},
    changePaytyp(){
      this.model.signinfo.scenecode = '';
      this.ruleHandleSearch();
    },

		clearDialogData() {
			Object.keys(this.model.signinfo).forEach(key => (this.model.signinfo[key] = ''));
			this.model.signinfo.pye = {
				ptytyp: '',
				pts: new Pts().data,
			};
		},

		selectableFn(row) {
			return true;
		},
		// 表格多选
		handleSelectionChange(val) {
			this.multipleSelection = val.map((item) => {
				return item.inr
			})
			this.multipleSelectionObj = val.map((item) => {
				return item
			})
			this.multipleStatusSelection = val.map((item) => {
				return item.sta
			})
			this.multipleSelectionRow = val.map((item) => {
				return item
			})[0]
		},

		handleSta() {
			this.stadialog = true;
		},
    /**
     * update 是否更新查询列表
     */
		goBack() {
			this.$store.commit('delTagsArry', this.$route.path);
			this.$router.back()
			this.$store.commit("updateAulsigRefresh", true);
		},
		//获取交易编码列列表
		async getBopcodItems() {
			const loading = this.loading();
			let res = await Api.post(`/${this.moduleRouter()}/autosign/getBopList`);
			if (res.respCode === SUCCESS) {
				this.model.iBopcodList = res.data.iBopcodList;
				this.model.oBopcodList = res.data.oBopcodList;
			}
			loading.close();
    },
    formatSymbol(row, column) {
      var result = "";
      Object.keys(this.symbolsCodeMap).forEach(key => {
        if (row.symbols == key) {
          result = this.symbolsCodeMap[key];
        }
      });
      return result;
    },
	},
};