import Api from "~/service/Api"
import Utils from "~/utils"

export default {
    onSeainf() {

    },
    async handleSearch() {
        let colflg = this.model.cldgrp.rec.colflg;
        if (!colflg || colflg == '') {
            this.$notify.error({ title: '错误', message: 'Payemnt Disposition必输!' });
            return;
        }
        let cur = this.model.cur;
        if (!cur || cur == '') {
            this.$notify.error({ title: '错误', message: 'cur必输!' });
            return;
        }
        this.model.bptbck.bptbckg = [];
        let rtnmsg = await this.executeRule("butsea")
        if (rtnmsg.respCode == SUCCESS) {
            this.updateModel(rtnmsg.data);
            console.log(rtnmsg.data.ccdbatg)
            //TODO 处理数据逻辑
            this.model.bptbck.bptbckg = rtnmsg.data.ccdbatg;
            this.$refs.table.$refs.urls.$refs.table.toggleAllSelection();
        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async handleSearchAll() {
        let rtnmsg = await this.executeRule("search")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 列表显示数据
            this.model.bptbck.bptbckg = rtnmsg.data.ccdbatg;
        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onCltpButgetref() {
        let rtnmsg = await this.executeRule("cltp.butgetref")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑
            this.model.cldgrp.rec.ownref = rtnmsg.data.cldgrp_rec_ownref;
        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onGet() {
        let rtnmsg = await this.executeRule("get")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onColpDet() {
        let rtnmsg = await this.executeRule("colp.det")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onTrndocButshw() {
        let rtnmsg = await this.executeRule("trndoc.butshw")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onTrndocButadd() {
        let rtnmsg = await this.executeRule("trndoc.butadd")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onTrndocButnew() {
        let rtnmsg = await this.executeRule("trndoc.butnew")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onTrndocButattto() {
        let rtnmsg = await this.executeRule("trndoc.butattto")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onTrndocButdel() {
        let rtnmsg = await this.executeRule("trndoc.butdel")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onTrndocButatt() {
        let rtnmsg = await this.executeRule("trndoc.butatt")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onSetmodDet() {
        let rtnmsg = await this.executeRule("setmod.det")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },
    async onSetinsButtxmsel() {
        let rtnmsg = await this.executeRule("setins.buttxmsel")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑
            this.showGridPromptDialog(cldgrp.blk.setins);

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
    },

}