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
<template>
<div>
<c-col :span="24">
<el-form-item label="受益人国别" :prop="`${grp}.rec.countrycod`">
<c-fullbox>
<c-input
v-model.trim="model[grp].rec.countrycod"
:disabled="disabled"
placeholder="请输入受益人国别"
@keyup.enter.native="showBenCtyDialog()"
@blur="showBenCtyDialog()"
@input="bcyInput"
@change="modifyCountrycod()"
:customModifykey="`${grp}.rec.countrycod`"
clearable
></c-input>
<template slot="footer">
<c-button type="primary" size="small" :disabled="disabled" icon="el-icon-search" style="margin-left:5px;padding: 0 12px;" @click="showBenCtyDialog()">
</c-button>
</template>
</c-fullbox>
</el-form-item>
</c-col>
<!-- 弹窗 -->
<el-dialog v-dialogDrag width="80%" :visible.sync="dialogTableVisible" title="收支申报国家信息表" destroy-on-close v-if="dialogTableVisible">
<div v-if="!loading && tableList.length === 0">暂无数据</div>
<div v-else style="width: 100%;height: 100%;">
<el-table height="calc(100% - 32px)" :data="tableList" @row-dblclick="dbClickRow" >
<el-table-column v-for="(item,key) in tableColumn" :key="key" :prop="item.prop" :label="item.label">
</el-table-column>
</el-table>
<el-pagination
layout="prev, pager, next, jumper, ->, sizes, total"
:page-sizes="pageSizes"
:page-size="pageSize"
:current-page="currentPage"
:total="total"
@size-change="sizeChange"
@current-change="currentChange"
></el-pagination>
</div>
</el-dialog>
</div>
</template>
<script>
import { getBopCtyCountryData } from "~/service/business/common";
import commonDepend from '~/mixin/commonDepend.js'
export default {
inject: ["root"],
mixins: [commonDepend],
props: {
model: {
type: Object,
default: () => {}
},
grp: {
type: String,
required: true
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
dialogTableVisible: false,
tableList: [],
loading: true,
total: 0,
currentPage: 1, // 页数
pageSizes: [5, 10, 20, 30, 40, 50, 100],
pageSize: 5, // 条数
tableColumn: [
{ prop: "cod", label: "国家/地区编号" },
{ prop: "numcod", label: "国家/地区数字代码" },
{ prop: "txt", label: "国家/地区简称" },
{ prop: "fultxt", label: "国家/地区全称" }
]
};
},
methods: {
async showBenCtyDialog() {
this.currentPage = 1;
await this.getTableData();
if(this.total ==1){
this.dbClickRow(this.tableList[0])
}else{
this.dialogTableVisible = true;
}
},
async getTableData() {
this.loading = true;
this.tableList = [];
let params = {
countryCod: this.model[this.grp].rec.countrycod || "",
pageNum: this.currentPage,
pageSize: this.pageSize
};
const res = await getBopCtyCountryData(params);
if (res.respCode == SUCCESS) {
if (res.data && res.data.list) {
this.total = res.data.total;
this.tableList = res.data.list;
}
}
this.loading = false;
},
bcyInput(){
this.model[this.grp].payeecountcode=this.model[this.grp].rec.countrycod
},
//回填数据
dbClickRow(row) {
this.model[this.grp].rec.countrycod = row.cod;
this.modifyCountrycod()
this.dialogTableVisible = false;
this.$emit('handleChange')
},
modifyCountrycod(){
this.customAddModify(this.model[this.grp].rec,'countrycod')
},
sizeChange(num) {
console.log(111,num)
this.pageSize = num;
this.getTableData();
},
currentChange(num) {
console.log(222,num)
this.currentPage = num;
this.getTableData();
}
}
};
</script>
<style scoped lang="less">
::v-deep .el-dialog__body {
height: calc(100% - 55px)
}
.el-table .cell {
white-space: pre-wrap;
}
</style>