Blame view

src/components/contract/flowAudit.vue 4.94 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
9c311762   wuxw   工作办理测试中
2
3
4
    <el-row>
      <el-col :span="24">
        <el-card>
9c8438ca   wuxw   v1.9 优化合同审批不能审核bu...
5
6
          <div slot="header" class="flex justify-between ">
            <span>{{ $t('flowAudit.auditInfo') }}</span>
9c311762   wuxw   工作办理测试中
7
          </div>
9c8438ca   wuxw   v1.9 优化合同审批不能审核bu...
8
          <div class="">
9c311762   wuxw   工作办理测试中
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
            <el-form label-width="120px">
              <el-form-item :label="$t('flowAudit.auditStatus')">
                <el-select v-model="flowAuditInfo.state" :placeholder="$t('flowAudit.pleaseAudit')" style="width:100%">
                  <el-option :label="$t('flowAudit.agree')" value="1100" />
                  <el-option :label="$t('flowAudit.reject')" value="1200" />
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('flowAudit.reason')">
                <el-input v-model="flowAuditInfo.remark" type="textarea" :placeholder="$t('flowAudit.requiredReason')"
                  :rows="4" />
              </el-form-item>
              <el-form-item v-if="flowAuditInfo.state === '1100' && flowAuditInfo.assignee === '-2'"
                :label="$t('flowAudit.staff')">
                <el-col :span="18">
                  <el-input v-model="flowAuditInfo.staffName" :placeholder="$t('flowAudit.selectNextHandler')" disabled />
                </el-col>
                <el-col :span="6">
                  <el-button @click="chooseStaff">
                    {{ $t('flowAudit.select') }}
                  </el-button>
                </el-col>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" class="float-right" @click="_flowAuditSubmit">
                  <i class="el-icon-check" /> {{ $t('common.submit') }}
                </el-button>
                <el-button type="warning" class="float-right" style="margin-right:20px;" @click="_goBack">
                  <i class="el-icon-close" /> {{ $t('common.cancel') }}
                </el-button>
              </el-form-item>
            </el-form>
          </div>
        </el-card>
      </el-col>
9c8438ca   wuxw   v1.9 优化合同审批不能审核bu...
43
      <select-staff ref="selectStaff" @selectStaff="handleSelectStaff" />
9c311762   wuxw   工作办理测试中
44
45
46
47
48
49
50
51
52
53
54
55
    </el-row>
  </template>
  
  <script>
  import { listWorkflowNextNode } from '@/api/contract/contractApplyAuditOrdersApi'
  import SelectStaff from '@/components/staff/SelectStaff'
  
  export default {
    name: 'FlowAudit',
    components: {
      SelectStaff
    },
9c311762   wuxw   工作办理测试中
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
    data() {
      return {
        flowAuditInfo: {
          state: '',
          remark: '',
          taskId: '',
          startUserId: '',
          assignee: '',
          staffId: '',
          staffName: ''
        }
      }
    },
    watch: {
      'flowAuditInfo.state': {
        handler(val) {
          if (val && this.flowAuditInfo.state === '1100') {
            this.flowAuditInfo.remark = this.$t('flowAudit.agree')
            this._listWorkflow()
          } else {
            this.flowAuditInfo.remark = ''
          }
        },
        deep: true
      }
    },
    methods: {
9c8438ca   wuxw   v1.9 优化合同审批不能审核bu...
83
84
85
86
      handleSelectStaff(staff) {
        this.flowAuditInfo.staffId = staff.userId
        this.flowAuditInfo.staffName = staff.userName
      },
9c311762   wuxw   工作办理测试中
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
      open(auditOrder) {
        Object.assign(this.flowAuditInfo, auditOrder)
        this.flowAuditInfo.state = ''
      },
      flowAuditValidate() {
        if (!this.flowAuditInfo.state) {
          this.$message.error(this.$t('flowAudit.auditStatusRequired'))
          return false
        }
        if (!this.flowAuditInfo.remark) {
          this.$message.error(this.$t('flowAudit.reasonRequired'))
          return false
        }
        if (this.flowAuditInfo.remark.length > 200) {
          this.$message.error(this.$t('flowAudit.reasonMaxLength'))
          return false
        }
        return true
      },
      async _flowAuditSubmit() {
        if (!this.flowAuditValidate()) return
  
        if (this.flowAuditInfo.assignee === '-2' && !this.flowAuditInfo.staffId) {
          this.$message.error(this.$t('flowAudit.selectNextHandler'))
          return
        }
  
9c8438ca   wuxw   v1.9 优化合同审批不能审核bu...
114
115
116
117
118
119
120
  
        const _flowAuditInfo = {
          state: this.flowAuditInfo.state,
          remark: this.flowAuditInfo.state === '1200'
            ? `${this.$t('flowAudit.reject')}:${this.flowAuditInfo.remark}`
            : this.flowAuditInfo.remark,
          nextUserId: this.flowAuditInfo.staffId
9c311762   wuxw   工作办理测试中
121
        }
9c8438ca   wuxw   v1.9 优化合同审批不能审核bu...
122
123
124
        this.$emit('auditSubmit', _flowAuditInfo)
        this.clearAddBasePrivilegeInfo()
  
9c311762   wuxw   工作办理测试中
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
      },
      clearAddBasePrivilegeInfo() {
        this.flowAuditInfo = {
          state: '',
          remark: '',
          taskId: '',
          startUserId: '',
          assignee: '',
          staffId: '',
          staffName: ''
        }
      },
      async _listWorkflow() {
        if (this.flowAuditInfo.state !== '1100') return
  
        try {
          const params = {
            taskId: this.flowAuditInfo.taskId,
            startUserId: this.flowAuditInfo.startUserId
          }
          const { data } = await listWorkflowNextNode(params)
          if (data && data.length > 0) {
            this.flowAuditInfo.assignee = data[0].assignee
          }
        } catch (error) {
          console.error('请求失败:', error)
        }
      },
      chooseStaff() {
        this.$refs.selectStaff.open(this.flowAuditInfo)
      },
      _goBack() {
9c8438ca   wuxw   v1.9 优化合同审批不能审核bu...
157
        this.$emit('goBack', {})
9c311762   wuxw   工作办理测试中
158
159
160
161
162
163
164
165
166
167
      }
    }
  }
  </script>
  
  <style scoped>
  .float-right {
    float: right;
  }
  </style>