creditManager.vue
9.4 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<template>
<div class="body_wrap">
<div class="w80">
<div class="common_con mb10">
<el-form ref="queryForm" :model="state.queryParams" :rules="queryRules" label-position="right" label-width="120px">
<el-row :gutter="20">
<el-col :span="8" v-for="item in state.queryColumns">
<el-form-item :label="item.label">
<el-input v-if="item.type === 'input'" v-model.trim="state.queryParams[item.prop]" :placeholder="'请输入'+item.label" clearable size="small"></el-input>
<el-select v-if="item.type === 'select'" style="width: 100%" v-model="state.queryParams[item.prop]" size="small" clearable>
<el-option v-for="dict in dict[item.options]" :label="dict" :value="dict"></el-option>
</el-select>
<el-checkbox-group v-if="item.type === 'checkbox'" v-model="state.queryParams[item.prop]" size="small">
<el-checkbox v-for="dict in dict[item.options]" :label="dict" :value="dict"></el-checkbox>
</el-checkbox-group>
<el-radio-group v-if="item.type === 'radio'" v-model="state.queryParams[item.prop]" size="small">
<el-radio v-for="dict in dict[item.options]" :label="dict.dictLabel" :value="dict.dictValue"></el-radio>
</el-radio-group>
<el-date-picker v-if="item.type === 'date'"
v-model="state.queryParams[item.prop]"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD HH:mm:ss"
size="small"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item>
<el-button type="primary" icon="Search" v-debounceClick="()=>handleSearch()">查询</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
<div class="w80">
<div class="common_con">
<!-- <el-row :gutter="10" class="mb10">
<el-col :span="1.5">
</el-col>
</el-row>-->
<div style="display: flex;justify-content: space-between" class="mb20">
<div>
<el-button type="primary" icon="Plus" v-debounceClick="()=>handleAdd('addCreditOpen')">新增授信</el-button>
</div>
<div style="display: flex">
<el-select class="mr10" v-model="state.queryParams.sort" style="width: 200px" @change="getList">
<el-option label="默认排序-授信时间" value="1"></el-option>
<el-option label="授信额度最多" value="2"></el-option>
<el-option label="授信额度最少" value="3"></el-option>
<el-option label="综合信用评分最高" value="4"></el-option>
<el-option label="综合信用评分最低" value="5"></el-option>
</el-select>
<el-button type="danger" icon="SortDown" :loading="state.isExport" v-debounceClick="()=>handleExport()">导出EXCEL</el-button>
</div>
</div>
<el-table :data="state.tableList" style="width: 100%" @selection-change="handleSelectionChange" border v-loading="state.isLoading" class="own_table" height="500px">
<el-table-column v-for="(table, index) in state.tableColumns" :key="'table'+index" :label="table.label" :prop="table.prop" :min-width="table.width">
<template #default="scope">
<template v-if="table.limitLength">
{{scope.row[table.prop].substring(0, table.limitLength)}}
</template>
<template v-else-if="table.type && table.type === 'date'">
{{DateUtil.formatDate(scope.row[table.prop])}}
</template>
<template v-else>
{{dictFormatter(scope.row[table.prop], table.prop)}}
</template>
</template>
</el-table-column>
<el-table-column label="操作" min-width="60px">
<template #default="scope">
<el-button type="primary" icon="View" size="small" v-if="scope.row.auditStatus !== '1'" @click="handleDetail(scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="state.total > 0"
:total="state.total"
:page.sync="state.queryParams.pageNum"
:limit.sync="state.queryParams.pageSize"
@pagination="({page, limit})=>getList(page, limit)"
/>
<find-enterprise title="选择授信企业" :open="state.addCreditOpen" open-name="addCreditOpen" @handleClose="handleClose">
<template #cop="{row}">
<el-button type="primary" size="small" icon="Position" @click="handleSubmit(row)">立即授信</el-button>
</template>
</find-enterprise>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import * as api from "../../interface/api.ts";
import DateUtil from "../../utils/date.js"
import { downloadFileGet } from "../../utils/request.ts";
import AddCheck from "../../components/reportOrder/addCheck.vue";
import FindEnterprise from "../../components/findEnterprise.vue";
import router from "../../router";
import {switchToUrl} from "../../utils/until.ts";
let dict = reactive({
creditStatusList: ['未授信', '待生效', '生效中', '已失效'],
creditLvList: ['全部', 'AAA', 'AA+', 'AA', 'AA-', 'A+', 'A', 'A-', 'BBB+', 'BBB', 'BBB-', 'BB+', 'BB', 'BB-', 'B+', 'B', 'B-', 'CCC', 'CC', 'C', 'D'],
})
let queryForm = ref<FormInstance>()
let state = reactive( {
tableList: [],
isLoading: false,
total: 0,
queryParams: {
pageNum: 1,
pageSize: 10,
ename: "",
creditLimitSt: "",
creditLimitEd: "",
creditStatus: "",
creditStatusArray: [],
creditLv: "",
applicationDate: [],
creditTimeSt: "",
creditTimeEd: "",
outPut: false,
sort: "1",
},
queryColumns: [
{
type: "input",
label: "企业名称",
prop: "ename",
},{
type: "input",
label: "授信开始额度",
prop: "creditLimitSt",
},{
type: "input",
label: "授信结束额度",
prop: "creditLimitEd",
},{
type: "select",
label: "信用等级",
prop: "creditLv",
options: "creditLvList"
},{
type: "checkbox",
label: "授信状态",
prop: "creditStatusArray",
options: "creditStatusList"
},{
type: "date",
label: "授信有效期",
prop: "applicationDate",
}
],
tableColumns: [
{
label: "企业名称",
prop: "ename"
},{
label: "信用等级",
prop: "creditLv",
},{
label: "信用综合评分",
prop: "comprehensiveRate",
},{
label: "建议授信额度(万元)",
prop: "creditLimitLast",
},{
label: "生效日期",
prop: "effectiveDate",
},{
label: "有效截止日期",
prop: "deadline",
},
],
checkOpen: false,
projectInfo: {},
addCreditOpen: false,
isExport: false,
})
let queryRules = reactive<FormRules>({
})
let handleSelectionChange = (selection: Array<any>) => {
state.ids = selection.map((item: Object) => item.id)
state.single = selection.length !== 1
state.multiple = !selection.length
}
let handleSearch = () => {
state.queryParams.pageNum = 1
state.queryParams.creditTimeSt = ""
state.queryParams.creditTimeEd = ""
if (state.queryParams.applicationDate && state.queryParams.applicationDate.length > 1) {
state.queryParams.creditTimeSt = state.queryParams.applicationDate[0]
state.queryParams.creditTimeEd = state.queryParams.applicationDate[1]
}
getList()
}
let getList = (page = state.queryParams.pageNum, limit = state.queryParams.pageSize) => {
state.isLoading = true
state.queryParams.pageNum = page
state.queryParams.pageSize = limit
api.getInfoList(state.queryParams, "/web/creditGrantingInfo/list").then((res: object)=> {
state.tableList = res.data.rows
state.total = res.data.total
// state.total = 15
}).finally(()=> {
state.isLoading = false
})
}
let dictFormatter = (value, prop) => {
let lastVal = ""
lastVal = value
return lastVal
}
let handleAdd = (name: string,row: Object) => {
state[name] = true
state.projectInfo = row
}
let handleExport = () => {
state.queryParams.outPut = true
let tempJson = Object.assign({}, state.queryParams)
delete tempJson.pageNum;
delete tempJson.pageSize
downloadFileGet(`/web/creditGrantingInfo/list` + switchToUrl(tempJson))
}
let handleDetail = (row: object) => {
localStorage.setItem('creditId', row.id)
router.push("/creditDetail?name=" + row.ename)
}
let handleClose = (name: string, value: boolean, isRefresh: boolean) => {
state[name] = value
if (isRefresh) {
getList()
}
}
let handleSubmit = (row: object) => {
router.push('/addCredit?name=' + row.name)
}
onMounted(()=> {
getList()
})
</script>
<style scoped lang="scss">
</style>