|
@@ -0,0 +1,164 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="body-wrapper">
|
|
3
|
+ <div class="search-card">
|
|
4
|
+ <el-input class="input-wrapper" v-model="searchWords" placeholder="请输入关键字">
|
|
5
|
+ <el-button slot="append" icon="el-icon-search" @click="getTableData"></el-button>
|
|
6
|
+ </el-input>
|
|
7
|
+ </div>
|
|
8
|
+ <el-table :data="tableData">
|
|
9
|
+ <el-table-column v-for="(item, index) in columns" :key="index" :label="item.label" :prop="item.key">
|
|
10
|
+ </el-table-column>
|
|
11
|
+ <el-table-column
|
|
12
|
+ label="操作"
|
|
13
|
+ width="100">
|
|
14
|
+ <template slot-scope="scope">
|
|
15
|
+ <el-button v-if="scope.row && scope.row.applyType === '1'" @click="handleAudit(scope.row)" type="text" size="small">审核</el-button>
|
|
16
|
+ </template>
|
|
17
|
+ </el-table-column>
|
|
18
|
+ </el-table>
|
|
19
|
+ <div class="table-pagination">
|
|
20
|
+ <el-pagination :background="false" layout="total, prev, pager, next" :total="total" @current-change="handlePageChange"
|
|
21
|
+ :current-page.sync="pageNum" :page-size.sync="pageSize">
|
|
22
|
+ </el-pagination>
|
|
23
|
+ </div>
|
|
24
|
+ <el-dialog
|
|
25
|
+ title="审核"
|
|
26
|
+ :visible.sync="dialogVisible"
|
|
27
|
+ width="60%"
|
|
28
|
+ custom-class="audit-dialog">
|
|
29
|
+ <el-row class="mg-bt">
|
|
30
|
+ <el-col class="label" :span="4">审核:</el-col>
|
|
31
|
+ <el-col :span="18">
|
|
32
|
+ <el-radio v-model="radio" label="2">通过</el-radio>
|
|
33
|
+ <el-radio v-model="radio" label="3">驳回</el-radio>
|
|
34
|
+ </el-col>
|
|
35
|
+ </el-row>
|
|
36
|
+ <span slot="footer" class="dialog-footer">
|
|
37
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
38
|
+ <el-button type="primary" @click="handleConfirm">确 定</el-button>
|
|
39
|
+ </span>
|
|
40
|
+ </el-dialog>
|
|
41
|
+ </div>
|
|
42
|
+</template>
|
|
43
|
+<script>
|
|
44
|
+import api from "@/api/audit.js";
|
|
45
|
+
|
|
46
|
+export default {
|
|
47
|
+ components: {},
|
|
48
|
+ data() {
|
|
49
|
+ return {
|
|
50
|
+ columns: [
|
|
51
|
+ {
|
|
52
|
+ label: '资源名称',
|
|
53
|
+ key: 'resourceName'
|
|
54
|
+ },
|
|
55
|
+ {
|
|
56
|
+ label: '资源类型',
|
|
57
|
+ key: 'resourceType'
|
|
58
|
+ },
|
|
59
|
+ {
|
|
60
|
+ label: '申请人',
|
|
61
|
+ key: 'userName'
|
|
62
|
+ },
|
|
63
|
+ {
|
|
64
|
+ label: '状态',
|
|
65
|
+ key: 'applyTypeText'
|
|
66
|
+ }
|
|
67
|
+ ],
|
|
68
|
+ tableData: [],
|
|
69
|
+ total: 0,
|
|
70
|
+ pageSize: 10,
|
|
71
|
+ pageNum: 1,
|
|
72
|
+ radio: '2',
|
|
73
|
+ dialogVisible: false,
|
|
74
|
+ selRow: {},
|
|
75
|
+ searchWords: undefined
|
|
76
|
+ }
|
|
77
|
+ },
|
|
78
|
+ mounted() {
|
|
79
|
+ this.getTableData()
|
|
80
|
+ },
|
|
81
|
+ watch: {
|
|
82
|
+ },
|
|
83
|
+ methods: {
|
|
84
|
+ handlePageChange() {
|
|
85
|
+ this.getTableData()
|
|
86
|
+ },
|
|
87
|
+ handleAudit(row) {
|
|
88
|
+ this.selRow = row
|
|
89
|
+ this.dialogVisible = true
|
|
90
|
+ },
|
|
91
|
+ handleCancelApply(row) {
|
|
92
|
+ console.log('enter handle cancel apply')
|
|
93
|
+ },
|
|
94
|
+ handleConfirm() {
|
|
95
|
+ const {id} = this.selRow
|
|
96
|
+ console.log('radio', this.radio)
|
|
97
|
+ api.applyResource({id, applyType: this.radio}).then(res => {
|
|
98
|
+ if(res.success) {
|
|
99
|
+ this.dialogVisible = false
|
|
100
|
+ this.$message({
|
|
101
|
+ message: '审核成功!',
|
|
102
|
+ type: 'success'
|
|
103
|
+ })
|
|
104
|
+ this.getTableData()
|
|
105
|
+ }
|
|
106
|
+ })
|
|
107
|
+ },
|
|
108
|
+ getTableData() {
|
|
109
|
+ const {pageNum, pageSize, searchWords} = this
|
|
110
|
+ api.applyList({pageNum, pageSize, resourceName: searchWords}).then(res => {
|
|
111
|
+ this.tableData = []
|
|
112
|
+ res.data.records.map((item, index) => {
|
|
113
|
+ const newItem = {...item}
|
|
114
|
+ newItem.applyTypeText = this.getApplyTypeText(item.applyType)
|
|
115
|
+ this.tableData.push(newItem)
|
|
116
|
+ })
|
|
117
|
+ this.total = res.data.total
|
|
118
|
+ })
|
|
119
|
+ },
|
|
120
|
+ getApplyTypeText(val) {
|
|
121
|
+ if (!val){
|
|
122
|
+ return '未申请'
|
|
123
|
+ }
|
|
124
|
+ const textMap = {
|
|
125
|
+ 1: '待审批',
|
|
126
|
+ 2: '审批通过',
|
|
127
|
+ 3: '审批驳回'
|
|
128
|
+ }
|
|
129
|
+ return textMap[val]
|
|
130
|
+ },
|
|
131
|
+ handleSearch() {
|
|
132
|
+ this.pageNum = 1
|
|
133
|
+ this.getTableData()
|
|
134
|
+ }
|
|
135
|
+ }
|
|
136
|
+}
|
|
137
|
+</script>
|
|
138
|
+<style lang="scss" scoped>
|
|
139
|
+.body-wrapper {
|
|
140
|
+ padding: 20px;
|
|
141
|
+ .button-block{
|
|
142
|
+ text-align: right;
|
|
143
|
+ margin-bottom: 20px;
|
|
144
|
+ }
|
|
145
|
+ .table-pagination{
|
|
146
|
+ text-align: right;
|
|
147
|
+ }
|
|
148
|
+ .search-card{
|
|
149
|
+ margin-bottom: 20px;
|
|
150
|
+ text-align: center;
|
|
151
|
+ .input-wrapper{
|
|
152
|
+ width: 36%;
|
|
153
|
+ }
|
|
154
|
+ }
|
|
155
|
+}
|
|
156
|
+.audit-dialog{
|
|
157
|
+ .mg-bt{
|
|
158
|
+ margin-bottom: 24px;
|
|
159
|
+ }
|
|
160
|
+ .label{
|
|
161
|
+ text-align: right;
|
|
162
|
+ }
|
|
163
|
+}
|
|
164
|
+</style>
|