yaozc
2023-04-28 bdf99bb9ab8b0250c073e85e4d676c3c745aed8b
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-table :data="props.row.businessExpenseReimbursementDtoList" style="margin: 10px 20px 10px 105px; width: calc(100% - 20px - 105px);">
              <el-table-column :show-overflow-tooltip="true" prop="reimbursementContent" label="报销内容" />
              <el-table-column :show-overflow-tooltip="true" prop="reimbursementAmount" label="报销金额">
                <template slot-scope="scope">
                  {{ crud.toMoney(scope.row.reimbursementAmount) }}
                </template>
              </el-table-column>
              <el-table-column :show-overflow-tooltip="true" prop="reimbursementVoucher" label="报销凭证">
                <template slot-scope="scope">
                  <el-image
                    :src="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? baseApi + scope.row.reimbursementVoucher.split(',')[0] : ''"
                    :preview-src-list="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? scope.row.reimbursementVoucher.split(',').map(item => { return baseApi + item }) : []"
                    style="width: 100px;"
                  >
                    <div slot="placeholder" class="image-slot">
                      加载中...
                    </div>
                    <div slot="error" class="image-slot">
                      暂无图片
                    </div>
                  </el-image>
                </template>
              </el-table-column>
              <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" />
            </el-table>
          </template>
        </el-table-column>
        <el-table-column prop="expenseType" label="费用类型">
          <template slot-scope="scope">
            {{ dict.label[expenseType][scope.row.expenseType] }}
          </template>
        </el-table-column>
        <el-table-column prop="businessPlanContent" label="所属营业计划" />
        <el-table-column prop="projectName" label="所属项目" />
        <el-table-column prop="amountReimbursementAmount" label="报销总金额">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.amountReimbursementAmount) }}
          </template>
        </el-table-column>
        <el-table-column prop="remarks" label="备注" />
        <el-table-column prop="createTime" label="创建时间" />
        <el-table-column v-if="checkPer(['admin','businessExpenseFlowable:agree','businessExpenseFlowable:reject'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <el-popover
              :ref="`agree_${scope.row.processInstanceId}`"
              v-permission="permission.agree"
              width="200"
              placement="top"
            >
              <p>您确定同意这条申请吗?</p>
              <div style="text-align: right; margin: 0">
                <el-button size="mini" type="text" @click="canelAgree(scope.row)">取消</el-button>
                <el-button size="mini" type="primary" :loading="agreeLoading" @click="toAgree(scope.row)">确定</el-button>
              </div>
              <el-button slot="reference" size="mini" type="success" icon="el-icon-check" />
            </el-popover>
            <el-popover
              :ref="`reject_${scope.row.processInstanceId}`"
              v-permission="permission.reject"
              width="200"
              placement="top"
            >
              <p>您确定拒绝这条申请吗?</p>
              <div style="text-align: right; margin: 0">
                <el-button size="mini" type="text" @click="canelReject(scope.row)">取消</el-button>
                <el-button size="mini" type="primary" :loading="rejectLoading" @click="toReject(scope.row)">确定</el-button>
              </div>
              <el-button slot="reference" size="mini" type="danger" icon="el-icon-close" />
            </el-popover>
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
 
<script>
import crudBusinessExpenseFlowable from '@/api/business/expenseFlowable'
import CRUD, { presenter, header, crud } from '@crud/crud'
import pagination from '@crud/Pagination'
import constant from '../../../utils/constant'
import { mapGetters } from 'vuex'
 
export default {
  name: 'BusinessExpenseFlowableApprove',
  components: { pagination },
  mixins: [presenter(), header(), crud()],
  dicts: [constant.EXPENSE_TYPE],
  cruds() {
    return CRUD({ title: '营业费用审批', url: 'api/businessExpenseFlowable/approve', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessExpenseFlowable }})
  },
  data() {
    return {
      permission: {
        agree: ['admin', 'businessExpenseFlowable:agree'],
        reject: ['admin', 'businessExpenseFlowable:reject']
      },
      // 字典:费用类型
      expenseType: constant.EXPENSE_TYPE,
      // 同意按钮加载状态
      agreeLoading: false,
      // 拒绝按钮加载状态
      rejectLoading: false
    }
  },
  computed: {
    ...mapGetters([
      'baseApi'
    ])
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    // 同意
    toAgree(data) {
      // 同意按钮加载状态
      this.agreeLoading = true
      // 同意
      crudBusinessExpenseFlowable.agree(data.processInstanceId).then(res => {
        // 关闭弹出框
        this.$refs[`agree_${data.processInstanceId}`].showPopper = false
        // 查询
        this.crud.toQuery()
      }).finally(() => {
        // 同意按钮加载状态
        this.agreeLoading = false
      })
    },
    canelAgree(data) {
      // 关闭弹出框
      this.$refs[`agree_${data.processInstanceId}`].showPopper = false
    },
    // 拒接
    toReject(data) {
      // 拒绝按钮加载状态
      this.rejectLoading = true
      // 拒绝
      crudBusinessExpenseFlowable.reject(data.processInstanceId).then(res => {
        // 关闭弹出框
        this.$refs[`reject_${data.processInstanceId}`].showPopper = false
        // 查询
        this.crud.toQuery()
      }).finally(() => {
        // 拒绝按钮加载状态
        this.rejectLoading = false
      })
    },
    canelReject(data) {
      // 关闭弹出框
      this.$refs[`reject_${data.processInstanceId}`].showPopper = false
    }
  }
}
</script>
 
<style scoped>
 
</style>