import Api from "~/service/Api"
import Utils from "../utils"
 
export default {
    data(){
        return {}
    },
    mounted(){
        //this.restoreDisplay()
    },
    methods:{
        init(params){
            return Api.post(this.declareParams.trnName+"/init",{params})
        },
        save(params){
            return Api.post(this.declareParams.trnName+"/saveData", Utils.getRequestDataFn.call(this, params))
        },
        exeuteCheck(rulePath,params){
            return Api.post(this.declareParams.trnName+"/executeCheck/"+rulePath, Utils.getRequestDataFn.call(this, params))
        },
        executeDefault(rulePath,params)
        {
            return Api.post(this.declareParams.trnName+"/executeDefault/"+rulePath, Utils.getRequestDataFn.call(this, params))
        },
        executeRule(rulePath,params)
        {
            return Api.post(this.declareParams.trnName+"/executeRule/"+rulePath, Utils.getRequestDataFn.call(this, params))
        },
        async checkAll(params){
            const res = await Api.post(this.declareParams.trnName+"/checkAll", Utils.getRequestDataFn.call(this, params))
            return res
        },
        pedding(params){
            return Api.post(this.declareParams.trnName+"/pending", Utils.getRequestDataFn.call(this, params))
        },
        async restoreDisplay()
        {
            let inr = this.$route.query.trn
            if(!inr)
                return
            let data =await Api.post("display/"+inr)
            Utils.copyValueFromVO(this.model,JSON.parse(data.data))
        },
        executeNotify(params)
        {
            return Api.post(this.declareParams.trnName+"/executeNotify", Utils.getRequestDataFn.call(this, params))
        },
    }
} 