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

export default {
    async onInfbutSearow() {
        let rtnmsg = await this.executeRule("infbut.searow")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑
            this.stmData.data = rtnmsg.data.infbut_dspstm.rows;
            //console.log("smhstm:",rtnmsg);
            if (rtnmsg.data.infbut_dspstm.rows.length == 0) {
                this.$notify({
                    title: '成功',
                    message: '搜索完毕，无满足条件记录',
                    type: 'success'
                });
            }
        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败！' });
        }
    },
    async onInfbutDsp(row) {
        let rtnmsg = await this.executeRule("infbut.dsp")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑
            console.log("rows:", row);
            console.log("你猜", rtnmsg);

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败！' });
        }
    },
    async onInfbutUserow() {
        let rtnmsg = await this.executeRule("infbut.userow")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑
            //console.log("use测试：",rtnmsg);

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败！' });
        }
    },
    async onInfbutClr() {
        this.model.infcon.seaownref = "";
        this.model.infcon.searef = "";
        this.model.infcon.pty.extkey = "";
        this.model.infcon.seapty = "";
        this.model.infcon.opndatfrom = "";
        this.model.infcon.opndatto = "";
        this.model.infcon.seaamtfr = "";
        this.model.infcon.seaamtto = "";
        this.model.infcon.seasta = "";
        this.model.infcon.usr.extkey = "";
        this.model.infcon.nam = "";
        this.model.infcon.hndtyp = "";
        this.model.infcon.pty.nam = "";
        this.model.infcon.searol = "";
        this.model.infcon.seacur = "";
        this.stmData.data = "";

        //let rtnmsg = await this.executeRule("infbut.clr")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

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

        }
        else {
            this.$notify.error({ title: '错误', message: '服务请求失败！' });
        }
    },
    async onInfbutExi() {
        this.$confirm("确认退出？", "", {
            confirmButtonText: "确认",
            cancelButtonText: "取消",
            type: "warning",
          })
            .then((res) => {
              // this.$router.back();
              this.$store.dispatch("TagsView/delView", this.$route);
              this.handleExit && this.handleExit();
              if (this.$route.query && this.$route.query.routeParams) {
                setTimeout(() => {
                  this.$router.back();
                }, 500);
              } else {
                setTimeout(() => {
                  this.$router.push("/home");
                }, 500);
              }
            })
            .catch(() => {});
        //let rtnmsg = await this.executeRule("infbut.exi")
        if (rtnmsg.respCode == SUCCESS) {
            //TODO 处理数据逻辑

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

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

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

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

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

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

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

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

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

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

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

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

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

}