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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
<template>
<div class="currentPage">
<el-form :model="atpbch" ref="atpbchForm" label-width="150px" label-position="right" label-suffix=":" size="small">
<c-row>
<!--c-col :span="11">
<c-form-item label="机构编码" prop="trn">
<c-input event-render="loadText" v-model="atpbch.branch" type="text"/>
</c-form-item>
</c-col-->
</c-row>
<div class="text-center">
<c-button type="primary" icon="el-icon-search" :loading="false"
style="margin-right:50px;margin-bottom:25px" @click="searchTable()">
查询
</c-button>
<!--c-button type="primary" :loading="false" icon="el-icon-refresh"
native-type="reset" @click="resetFormFields('atpbchForm')">
重置
</c-button-->
</div>
<div style="height:40px;margin-top:-20px;">
<c-button type="primary" size="mini" @click="addInfo()">新增</c-button>
</div>
</el-form>
<c-paging-table :data="tableData" ref="atpbchTableRef"
:pageSize="atpbch.pageSize" :pageNumber="atpbch.pageNum" :total="atpbch.total" stripe
@queryFunc="queryFunc" :border="true">
<el-table-column label="id" prop="id" v-if="false">
</el-table-column>
<el-table-column label="ID主键" prop="id" min-width="11%" >
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="机构代码" prop="branch" sortable min-width="13%">
<template slot-scope="scope">{{scope.row.branch}}</template>
</el-table-column>
<el-table-column label="交易代码类型" prop="frmtyp" sortable min-width="18%">
<template slot-scope="scope">
<span>{{scope.row.frmtyp}}</span>
</template>
</el-table-column>
<el-table-column label="交易代码" prop="inifrm" sortable min-width="18%">
<template slot-scope="scope">
<span>{{scope.row.inifrm}}</span>
</template>
</el-table-column>
<el-table-column label="收单行权限标志" prop="flg" min-width="18%" :formatter="flgFormat">
<!--template slot-scope="scope">
<span>{{scope.row.flg}}</span>
</template-->
</el-table-column>
<el-table-column label="收单行交易码标志" prop="negflg" min-width="20%" :formatter="negflgFormat">
<!--template slot-scope="scope">
<span>{{scope.row.negflg}}</span>
</template-->
</el-table-column>
<el-table-column label="操作" min-width="22%">
<template slot-scope="scope">
<!--el-button @click="getInfo(scope.row.id)" type="info" size="mini">详情</el-button-->
<el-button @click="updateInfo(scope.row.id)" type="primary" size="mini">修改</el-button>
<el-button @click="deleteInfo(scope.row.id)" type="danger" size="mini">删除</el-button>
</template>
</el-table-column>
</c-paging-table>
<el-dialog :visible.sync="atpbchDialogFormVisible" :title="title" :modal-append-to-body="false"
:lock-scroll="false" :show-close="false" :close-on-click-modal="false"
:close-on-press-escape="false" v-dialogDrag >
<el-form ref="atpbchDialogForm" :model="atpbchDialog" label-width="120px" label-position="right" label-suffix=":" :rules="rules">
<el-row style="margin-top:20px;">
<el-col :span="22">
<!--el-form-item label="机构代码" prop="branch">
<el-input v-model="atpbchDialog.branch" :disabled="atpbchDialogFieldsDisabled" maxlength="4"></el-input>
</el-form-item-->
<el-form-item label="机构代码" prop="branch">
<c-select
v-model="atpbchDialog.branch"
:disabled="atpbchDialogFieldsDisabled"
maxlength="4"
placeholder="请输入客户所属机构"
:isShowKeyAndLabel="true"
>
<el-option v-for="item in branchlist" :key="item.branch" :label="item.branch+' - '+item.bchname"
:value="item.branch">
<span style="float: left">{{ item.branch }} - {{ item.bchname }}</span>
</el-option>
</c-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="交易代码类型" prop="frmtyp">
<c-select :isShowKeyAndLabel="true" v-model="atpbchDialog.frmtyp" style="width: 100%" :disabled="atpbchDialogFieldsDisabled" dbCode="ATPTXT">
</c-select>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="交易代码" prop="inifrm">
<c-select :isShowKeyAndLabel="true" v-model="atpbchDialog.inifrm" style="width: 100%" :disabled="atpbchDialogFieldsDisabled" dbCode="ATPTXT">
</c-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="收单行权限标志" prop="flg">
<el-radio-group v-model="atpbchDialog.flg" :disabled="atpbchDialogFieldsDisabled">
<el-radio label="X">是</el-radio>
<el-radio label=" ">否</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="收单行交易码标志" prop="negflg">
<el-radio-group v-model="atpbchDialog.negflg" :disabled="atpbchDialogFieldsDisabled">
<el-radio label="X">是</el-radio>
<el-radio label=" ">否</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelDialog">取 消</el-button>
<el-button type="primary" @click="submitDialog" v-show="dialogSubBtnVisible">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import DeptModel, { Pattern } from "./DeptModel.js";
import { queryAtpbchByPage, getAtpbchInfo, saveAtpbchInfo, deleteAtpbchInfo, getBchInfo, getBranchList } from "~/service/manage/dept.js";
import Utils from "~/utils";
export default {
props:{
orgBranch:String
},
data(){
return{
tableData:null,
deleteId:null,
branch:null,
title:"收单行模式配置",
rules:Pattern,
atpbch:new DeptModel().data.atpbch,
atpbchDialog:new DeptModel().data.atpbch,
atpbchDialogFormVisible:false,
dialogSubBtnVisible:true,
atpbchDialogFieldsDisabled:false,
branchlist: [],
}
},
watch:{
// 会出现父组件传真,子组件更新不及时的情况
orgBranch:{
handler:function(newValue,oldValue){
if(newValue != '' && newValue != null && newValue != 'undefined'){
this.branch = this.orgBranch;
this.searchTable();
}
},
// 强制立即执行回调
immediate:true
}
},
methods:{
getBchlist() {
getBranchList(this.branch).then((res) => {
if (res.respCode == "AAAAAA") {
const list = res.data
this.branchlist = list
}
})
},
// 【搜索】按钮
searchTable(){
this.atpbch.branch = this.branch;
queryAtpbchByPage(this.atpbch)
.then((res)=>{
this.tableData = res.data.list;
this.atpbch.total = res.data.total;
this.atpbch.pageNum = res.data.pageNumber;
this.atpbch.pageSize = res.data.pageSize;
})
.catch((err)=>{
this.$notify.error("查询失败!");
});
},
// 【重置】按钮
resetFormFields(formName){
this.$refs[formName].resetFields();
},
// 数据格式化
flgFormat(row,column){
if(row.flg == 'X'||row.flg == 'x'){
return '是';
}else{
return '否';
}
},
negflgFormat(row,column){
if(row.negflg == 'X'||row.negflg == 'x'){
return '是';
}else{
return '否';
}
},
// 【新增】按钮
addInfo(){
// 选中节点后操作
if(!(this.branch != '' && this.branch != null)){
this.$message({message: '请选中具体分行、支行再操作!',center: true,type: 'warning'});
return;
}
getBchInfo(this.branch)
.then((res)=>{
if(res.respCode == "AAAAAA"){
var bch = res.data;
if(bch == null){
this.$message({message: '请先在【国结机构信息】页签中新增该机构信息!',center: true,type: 'warning'});
return;
}
if(bch.lev == "0" || bch.lev == "A" || bch.lev == "B"){
this.$message({message: '请选中具体的分行、支行再操作!',center: true,type: 'warning'});
return;
}
this.getBchlist(),
this.title = "新增收单行模式配置信息";
this.atpbchDialogFormVisible = true;
this.dialogSubBtnVisible = true;
this.atpbchDialogFieldsDisabled = false;
this.clearAtpbchDialogModel();
this.atpbchDialog.branch=this.branch;
this.atpbchDialog.flg=" ",
this.atpbchDialog.negflg=" "
} else {
this.$notify.error("获取机构号:["+this.branch+"]机构信息失败!");
return;
}
})
.catch((res)=>{
this.$notify.error("获取机构号:["+this.orgBranch+"]机构信息失败!");
});
},
// 清空model数据
clearAtpbchDialogModel(){
this.atpbchDialog.id = '';
this.atpbchDialog.branch = '';
this.atpbchDialog.frmtyp = '';
this.atpbchDialog.inifrm = '';
this.atpbchDialog.flg = '';
this.atpbchDialog.negflg = '';
},
// 【详情】按钮
getInfo(id){
this.title = "查看收单行模式配置信息";
this.atpbchDialogFormVisible = true;
this.dialogSubBtnVisible = false;
this.atpbchDialogFieldsDisabled = true;
this.getDetailInfo(id);
},
// 【修改】按钮
updateInfo(id){
this.title = "修改收单行模式配置信息";
this.atpbchDialogFormVisible = true;
this.dialogSubBtnVisible = true;
this.atpbchDialogFieldsDisabled = false;
this.getDetailInfo(id);
},
// 查看详情信息
getDetailInfo(id){
this.atpbch.id = id;
getAtpbchInfo(this.atpbch)
.then((res)=>{
this.atpbchDialog.id = res.data.id;
this.atpbchDialog.branch = res.data.branch;
this.atpbchDialog.frmtyp = res.data.frmtyp;
this.atpbchDialog.inifrm = res.data.inifrm;
this.atpbchDialog.flg = res.data.flg!=null&& res.data.flg!=""?res.data.flg:" ";
this.atpbchDialog.negflg = res.data.negflg!=null&&res.data.negflg!=""?res.data.negflg:" ";
})
.catch((err)=>{
this.$notify.error("查询失败!");
});
},
// 【删除】按钮
deleteInfo(id){
this.deleteId = id;
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(()=>{
this.deleteDialogInfo();
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
// 【取消】按钮
cancelDialog(){
// 关闭弹框
this.atpbchDialogFormVisible = false;
this.clearAtpbchDialogModel();
this.$refs['atpbchDialogForm'].resetFields();
},
// 【提交】按钮
submitDialog(){
this.$refs.atpbchDialogForm.validate((validated) => {
if(validated){
this.atpbchDialog.branch = this.branch;
saveAtpbchInfo(this.atpbchDialog)
.then((res)=>{
if(res.respCode == 'AAAAAA'){
this.$notify.success("保存成功!");
} else {
this.$notify.error(res.respMsg);
}
// 关闭弹框
this.cancelDialog();
// 刷新列表
this.searchTable();
})
.catch((err)=>{
this.$notify.error("保存失败!");
});
} else {
Utils.formValidateTips(this.$refs.atpbchDialogForm.fields)
}
})
},
// 获取分页组件数据,为请求数据赋值
queryFunc(pageNumber, pageSize) {
this.atpbch.pageNum = pageNumber;
this.atpbch.pageSize = pageSize;
this.searchTable();
},
// 【删除弹窗-确定】按钮
deleteDialogInfo(){
this.atpbchDialog.id = this.deleteId;
deleteAtpbchInfo(this.atpbchDialog)
.then((res)=>{
this.$notify.success("删除成功!");
// 刷新列表
this.searchTable();
// 清空待删除的ID
this.deleteId = null;
})
.catch((err)=>{
this.$notify.error("删除失败!");
});
}
}
}
</script>
<style lang="less" scoped>
.currentPage{
.el-table--enable-row-hover .el-table__body tr:hover>td{
background-color: #c694dc !important;
}
}
</style>