/*
 * @Author: rao JiaGuan
 * @Date: 2021年12月2日17:06:21
 * @LastEditors: rao JiaGuan
 * @Description: 林草项目状态修改
 */
export default {
    execute: function(bill, param) {
      let msg;
      if(param.param.clickMessage){
        msg =  param.param.clickMessage
      }
      GMS.$hideContainer.$Modal.confirm({ 
        title: "信息提示",
        content: msg,
        onOk: () => {
            this.updateFieldAction(bill, param);
        },
        onCancel: () => {                       
          GMS.$hideContainer.$Message["error"]({
            content: "已取消",
          });
        },
      });
    },
    updateFieldAction(bill, param) {
      debugger
      let _actions = param.param.actions;
      let define = param.define;
      let postData = {
        data: bill.getBuillData(),
      };
      let url = `/gms/bill/executed/${define}/${_actions}?transmission=total`;
      GMS.$http
        .post(url, postData, {
          headers: {
            post: {
              "Content-Type": "application/json",
            },
          },
        })
        .then((res) => {
          if (res.status == 200 && res.data.code == 0) {
            const masterName = bill.billdata.billTable.masterName;
            let successMessage;
            if(param.param.successMessage){
              successMessage =  param.param.successMessage
            }
            GMS.vbus.$Message.success(successMessage);
            // 刷新页面
            GMS.vbus.$emit("custom-query-refresh");
            GMS.vbus.$emit("tab-count-refresh");
            GMS.vbus.$emit("submitSuccess");
          } else if (res.data.code == -1 && res.data.message) {
            let stringOne = res.data.message.split(":")[1];
            let stringResult = stringOne.split(";")[0];
            GMS.vbus.$Message.error(stringResult);
          } else {
            res.data.message && GMS.vbus.$Message.error(res.data.message);
          }
        });
    },
  };
  