cuijian
2023-11-22 4f9858af4306d4dc14bd21eaf2ffddd2a1a827d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<template>
  <j-modal
    :title="title"
    :width="1400"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel">
    <operation-certificate-apply-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :achievement="isAchievement"/>
  
    <template slot="footer">
      <a-button
        :style="{marginRight: '8px'}"
        @click="handleCancel()"
      >
        关闭
      </a-button>
 
      <!-- <a-button
        @click="handleOk()"
        type="primary"
        :loading="confirmLoading"
        :disabled="disableSubmit || confirmLoading"
      >确定</a-button> -->
      <a-popconfirm
        @confirm="() => handleReject()"
        title="确认将当前操作证申请驳回?"
      >
        <a-button
          :loading='confirmLoading'
          :style="{marginRight: '8px'}"
          :disabled="this.auditStatus == 'created' || this.auditStatus == 'audited'"
        >
          驳回
        </a-button>
      </a-popconfirm>
      <a-popconfirm
        @confirm="() => handlePass()"
        title="确认将当前操作证申请审核通过?"
      >
        <a-button
          type='primary'
          :loading='confirmLoading'
          :style="{marginRight: '8px'}"
          :disabled="this.auditStatus == 'created' || this.auditStatus == 'audited'"
        >
          通过
        </a-button>
      </a-popconfirm>
    </template>
  </j-modal>
</template>
 
<script>
 
  import OperationCertificateApplyForm from './OperationCertificateApplyForm'
 
  export default {
    name: 'OperationCertificateApplyModal',
    components: {
      OperationCertificateApplyForm
    },
    data() {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false,
        isAchievement: false,
        record:{},
        model:{},
        url: {
          edit: '/eam/operationCertificateApply/edit',
        }
      }
    },
    methods:{
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.record = record
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handlePass() {
        if (this.record.auditStatus == 'submitted') {
          this.record.auditStatus = 'approved'
          } else if (this.record.auditStatus == 'approved') {
            this.record.auditStatus = 'audited'
          } 
        this.$nextTick(()=>{
          this.$refs.realForm.edit(this.record);
        })
        this.handleOk();
    },
 
    handleReject() {
      if (this.record.auditStatus == 'submitted') {
        this.record.auditStatus = 'created'
          } else if (this.record.auditStatus == 'approved') {
            this.record.auditStatus = 'submitted'
          } 
          this.$nextTick(()=>{
          this.$refs.realForm.edit(this.record);
        })
        this.handleOk();
    },
 
    handleOk () {
        this.$refs.realForm.handleOk();
      },
 
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>
 
<style scoped>
</style>