rejectAction.js 2.7 KB
Newer Older
1
import Bridge from '../components-control/util/bridge'
wangcong committed
2 3 4
export default {
  execute: function (bill, param) {
      if(bill){
5
        bill.setControlsSate(param["_control_name_"], "enable", false)
wangcong committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
          if(param.param.isNeedSave){
              let saveParam = {
                  actions: "bill.Basic.save",
                  afterAction: "",
                  confirmTitle: "",
                  customSaveAction: "",
                  noCheckCardDepressPeriod: true,
                  noCheckSubTable: true,
                  viewName: ""
              }
              bill.executeServerAction(saveParam,function(code,data){
                  if(code===200){
                      this.approval(bill, param);
                      bill.setControlsSate(param["_control_name_"],"loading",false)
                  }else{
                      bill.setControlsSate(param["_control_name_"],"loading",false)
22
                      bill.setControlsSate(param["_control_name_"], "enable", true)
wangcong committed
23 24 25 26 27 28 29
                      GMS.$hideContainer.$message.error("操作异常请联系管理员");
                  }
              }.bind(this));
          } else {
              this.approval(bill, param);
          }
      }else{
Joey committed
30
        GMS.$hideContainer.$Message.error('缺少参数');
wangcong committed
31 32 33 34 35 36 37 38 39
      }
  },
  approval: function(bill, param){
      let taskId = bill.getGlobalParam('reviewParam').taskId;
      let comments = bill.getGlobalParam('reviewParam').suggestions ? bill.getGlobalParam('reviewParam').suggestions:"";
      GMS.$http.post('/gms/workflow/task/completed/' + taskId + '?result=3&comments='+comments).then(
          function(response) {
              if (response.status == 200 || response.statusText == 'OK') {
                  // console.log('驳回成功');
40
                  bill.setControlsSate(param["_control_name_"], "enable", true)
wangcong committed
41 42 43 44 45 46
                  bill.setControlsSate(param["_control_name_"],"loading",false)
                  GMS.$hideContainer.$Message.success('驳回成功!')
                  if (
                    window.osConfig.appOpenMode &&
                    window.osConfig.appOpenMode == "apploader"
                  ) {
47
                    GMS.$hideContainer.$portalAPI.emit('entry-tag-close')
wangcong committed
48
                  }
49 50
                  else if (Bridge.vm) {
                    Bridge.vm.modal_visible = false
wangcong committed
51
                  }
52
                  window.GMS.vbus.$emit('refresh-workflow-job-view')
wangcong committed
53 54 55 56 57
              }
          }.bind(this)
      )
      .catch(
          function(error) {
58
              bill.setControlsSate(param["_control_name_"], "enable", true)
wangcong committed
59
              bill.setControlsSate(param["_control_name_"],"loading",false)
60
              GMS.$hideContainer.$Message.error(error)
wangcong committed
61 62 63 64
          }.bind(this)
      );
  }
}