Commit 04fbc029 by lixinyi

iso报文bic查找弹窗调整,新增分页功能

parent 37651b0b
<template>
<div>
<el-table
<div >
<el-table class="table-container"
ref="table"
@select="rowSelectChange"
@row-click="getCurrentRow"
@row-dblclick="selectRow"
@select-all="selectAll"
:header-cell-class-name="cellClass"
:data="data"
border
......@@ -63,9 +62,6 @@ export default {
return 'disabledCheck';
}
},
selectAll() {
this.$refs.table.clearSelection();
},
rowSelectChange(pageSelected, row) {
// 取消其他行的选中状态
this.$refs.table.clearSelection();
......@@ -81,7 +77,7 @@ export default {
},
currentPageChange(newPage) {
this.$emit("loadData", {
currentPage: newPage,
pageNum: newPage,
});
},
pageSizeChange(newPageSize) {
......@@ -109,5 +105,10 @@ export default {
line-height: 37px;
}
.table-container {
width: 100%;
height: 300px; /* 根据需要设置高度 */
overflow-y: auto; /* 添加垂直滚动条 */
}
</style>
\ No newline at end of file
......@@ -20,9 +20,27 @@
:visible.sync="dialogVisible"
title="请选择"
v-if="dialogVisible"
width="40%"
width="80%"
append-to-body
>
<div>
<el-input
:disabled="disabled"
v-model="dataModel.value"
:maxlength="max"
:type="dataType"
:placeholder="vpcPlaceholder"
:show-word-limit="true"
style="width: 30%"
:class="{ inputDeep: active }"
>
</el-input>
<span class="search-btn" @click="loadData">
搜索
</span>
</div>
<s-table
ref="table"
@selectionChange="selectionChange"
......@@ -46,6 +64,7 @@
<script>
import Table from "./Table.vue";
import send from "../Service/post";
export default {
components:{
......@@ -62,40 +81,27 @@ export default {
ifaccount: false,
dialogVisible: false,
// 最终选中的所有数据
allSelectedUserList: [],
// 最终选中的全部唯一字段列表
allUniquePropList: [],
// 唯一字段
uniqueProp: "id",
// 每次弹窗中选中的所有数据
allSelectedList: [],
tableData: [],
tableConfig: {
showSelect: true,
selectable: (row, rowIndex) => {
if (this.allUniquePropList.indexOf(row[this.uniqueProp]) === -1) {
if (rowIndex === row.index) {
return false;
} else {
return true;
}
}
return true;
},
pageConfig: {
pageSizeList: [3, 5, 10],
pageSize: 3,
currentPage: 1,
pageSize: 5,
pageNum: 1,
total: 0,
},
itemList: [
{
label: "BIC Code",
prop: "BIC",
prop: "bic",
},
{
label: "Name",
prop: "NAM1",
prop: "nam1",
},
],
},
......@@ -196,88 +202,59 @@ export default {
// 点击选择按钮
choose() {
this.allUniquePropList = [];
this.allSelectedUserList.forEach((item) => {
this.allUniquePropList.push(item[this.uniqueProp]);
});
this.allSelectedList = [];
this.dialogVisible = true;
}, // 点击选择弹窗的确定按钮
chooseConfirm() {
console.log(this.allSelectedUserList.concat(
this.allSelectedList
)[0].BIC)
this.dataModel.value = this.allSelectedUserList.concat(
this.allSelectedList
)[0].BIC;
console.log(this.allSelectedList[0].bic);
this.dataModel.value = this.allSelectedList[0].bic;
this.dialogVisible = false;
}, // 加载数据
loadData(newPageConfig) {
if (newPageConfig && newPageConfig.currentPage) {
this.tableConfig.pageConfig.currentPage = newPageConfig.currentPage;
console.log(newPageConfig);
if (newPageConfig && newPageConfig.pageNum) {
this.tableConfig.pageConfig.pageNum = newPageConfig.pageNum;
}
if (newPageConfig && newPageConfig.pageSize) {
this.tableConfig.pageConfig.pageSize = newPageConfig.pageSize;
}
const data = {
bicnam: "",
biccod: "",
currentPage: this.tableConfig.pageConfig.currentPage,
biccod: this.dataModel.value,
pageNum: this.tableConfig.pageConfig.pageNum,
pageSize: this.tableConfig.pageConfig.pageSize,
};
// send.getBic(data).then((res) => {
// let data = res.data;
// this.tableData = data.records;
// this.tableConfig.pageConfig.total = data.total;
// this.updateSelectedMark();
// });
send.getBic(data).then((res) => {
let data = res.data;
console.log(res);
this.tableData = data.accountList;
this.tableConfig.pageConfig.total = data.total;
});
//调试数据
this.tableData = [
{
BIC: "001",
NAM1: "001",
},
{
BIC: "002",
NAM1: "002",
},
]
this.tableConfig.pageConfig.total = 2;
this.updateSelectedMark();
// this.tableData = [
// {
// BIC: "001",
// NAM1: "001",
// },
// {
// BIC: "002",
// NAM1: "002",
// },
// ]
// this.tableConfig.pageConfig.total = 2;
},
// 改变多选列的选中状态时,更新选中列表
selectionChange(pageSelectedList) {
// 当页唯一字段组成的列表
let uniquePropList = [];
this.tableData.forEach((row) => {
uniquePropList.push(row[this.uniqueProp]);
});
// 从全部选中的数据中,过滤掉当前页的数据,再添加当前页选中的数据
this.allSelectedList = this.allSelectedList
.filter((row) => !uniquePropList.includes(row[this.uniqueProp]))
.concat(pageSelectedList);
this.allSelectedList = pageSelectedList;
},
// 更新选中标记--选中数据与当页数据的交集,标记为选中状态
updateSelectedMark() {
this.$nextTick(() => {
let pageSelectedList = [];
this.allSelectedList.forEach((row1) => {
this.tableData.forEach((row2) => {
if (row1[this.uniqueProp] === row2[this.uniqueProp]) {
pageSelectedList.push(row2);
}
});
});
pageSelectedList.forEach((row) => {
this.$refs.table.toggleRowSelection(row);
});
});
},
},
mounted() {
this.loadData();
if("bicfi" === this.dataModel.tag){
this.loadData();
}
if ("CHBHHKHHXXX"===this.dataModel.headBic) {
this.$set(this.dataModel, "value", "CHBHHKHHXXX");
}
......@@ -410,7 +387,7 @@ export default {
.search-btn {
display: inline-block;
width: 40px;
height: 30px;
height: 33px;
line-height: 30px;
text-align: center;
background-color: #409EFF;
......
......@@ -613,8 +613,12 @@ export default {
this.treeModel.treeNodeArry = jsonArry;
//解决选择checked的但依旧置灰的错误
this.changeTreeNodeStatus(this.treeModel.treeNodeArry);
this.$nextTick(()=>{
console.log("-----初始化展开-----");
this.open();
});
console.log("cips2Json done");
});
console.log("mx2Json done");
},
parentNodeData(node) {
return node.parent.data;
......@@ -1008,6 +1012,11 @@ export default {
},
mounted() {
this.buildMsgStruct();
// 在nextTick回调函数中执行渲染完毕后的函数
this.$nextTick(()=>{
console.log("-----初始化展开-----");
this.open();
});
},
created(){
window.sessionStorage.clear()
......
......@@ -717,7 +717,7 @@ tag:"PlcAndNm",
type:"TextInput",
status:"M",
maxLength:"350",
defaultValue:"/Document/FIToFICstmrCdtTrf/CdtTrfTxInf",
defaultValue:"/Document/FICdtTrf/CdtTrfTxInf",
},
{
path:"0.1.18.1",
......
package com.brilliance.mxeditor.bo;
import java.io.Serializable;
public class Account implements Serializable {
private static final long serialVersionUID = 1L;
private String BIC;
private String NAM1;
public String getBIC() {
return BIC;
}
public void setBIC(String BIC) {
this.BIC = BIC;
}
public String getNAM1() {
return NAM1;
}
public void setNAM1(String NAM1) {
this.NAM1 = NAM1;
}
public Account(String BIC, String NAM1) {
this.BIC = BIC;
this.NAM1 = NAM1;
}
public Account() {
}
}
......@@ -4,6 +4,7 @@ package com.brilliance.mxeditor.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.brilliance.mxeditor.MxTransfer;
import com.brilliance.mxeditor.bo.Account;
import com.brilliance.mxeditor.exception.SwiftException;
import com.brilliance.mxeditor.interf.CommonSend;
import com.brilliance.mxeditor.util.StringUtil;
......@@ -15,6 +16,8 @@ import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.prowidesoftware.swift.model.MxId;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import com.prowidesoftware.swift.model.mx.NamespaceReader;
......@@ -29,10 +32,9 @@ import org.springframework.web.bind.annotation.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -356,7 +358,7 @@ public class MxEditorController {
@RequestMapping(value = "/getBic", method = RequestMethod.POST)
@ResponseBody
public String getBic(@RequestBody AccountVo account) {
public AccountVo getBic(@RequestBody AccountVo account) throws IllegalAccessException, InstantiationException {
logger.info("---->查询信息为:" + account.toString());
Map<String, Object> map = new HashMap();
map.put("interface", "bdTaskFive");
......@@ -364,11 +366,60 @@ public class MxEditorController {
map.put("biccod", account.getBiccod());
map.put("bicnam", account.getBicnam());
Map rs = (Map) CommonSend.send(map);
//测试数据
// Map<String,Object> rs = new HashMap<>();
// rs.put("retcode","0000000");
// List<Map<String,Object>> ccdlst = new ArrayList<>();
// Map<String,Object> tmpmap1 = new HashMap<>();
// tmpmap1.put("BIC","1111");
// tmpmap1.put("NAM1","1111");
// Map<String,Object> tmpmap2 = new HashMap<>();
// tmpmap2.put("BIC","2222");
// tmpmap2.put("NAM1","2222");
// ccdlst.add(tmpmap1);
// ccdlst.add(tmpmap2);
// ccdlst.add(tmpmap2);
// ccdlst.add(tmpmap2);
// ccdlst.add(tmpmap2);
// ccdlst.add(tmpmap2);
// rs.put("data",ccdlst);
String retcod = (String) rs.get("retcode");
if (retcod != null && retcod.endsWith("0000000")) {
return (String) rs.get("data");
// PageHelper.startPage( account.getPageNum() == null ? 0 : account.getPageNum(), account.getPageSize() == null ? 10 : account.getPageSize());
List<Map<String, Object>> resMapList = (List<Map<String, Object>>) rs.get("data");
List<Account> reslist = mapListToList(resMapList,Account.class);
int startIndex = (account.getPageNum() - 1) * account.getPageSize();
int endIndex = Math.min(startIndex + account.getPageSize(), reslist.size());
List<Account> currentPageData = reslist.subList(startIndex, endIndex);
AccountVo accountVo = new AccountVo();
accountVo.setAccountList(currentPageData);
accountVo.setTotal(reslist.size());
return accountVo;
}else
return null;
}
public static List<Map<String, Object>> jsonToListMap(String jsonString) {
Gson gson = new Gson();
Type type = new TypeToken<ArrayList<HashMap<String, Object>>>() {}.getType();
return gson.fromJson(jsonString, type);
}
public static <T> List<T> mapListToList(List<Map<String, Object>> mapList, Class<T> clazz) throws IllegalAccessException, InstantiationException {
List<T> list = new ArrayList<>();
for (Map<String, Object> map : mapList) {
T obj = clazz.newInstance();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
if (map.containsKey(field.getName())) {
field.set(obj, map.get(field.getName()));
}
}
list.add(obj);
}
return list;
}
}
package com.brilliance.mxeditor.vo;
import com.brilliance.mxeditor.bo.Account;
import java.util.List;
/**
* @author zh
* @create 2022-07-29 16:00
......@@ -9,6 +13,46 @@ public class AccountVo {
private String bicnam;
private Integer pageNum;
private Integer pageSize;
private Integer total;
private List<Account> accountList;//查询结果
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public List<Account> getAccountList() {
return accountList;
}
public void setAccountList(List<Account> accountList) {
this.accountList = accountList;
}
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public String getBiccod() {
return biccod;
}
......@@ -32,4 +76,7 @@ public class AccountVo {
", bicnam='" + bicnam + '\'' +
'}';
}
public AccountVo() {
}
}
<!doctype html><html lang=""><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="icon" href="favicon.ico"/><title>ISO手工拟报</title><script defer="defer" src="js/chunk-vendors.e88189ab.js"></script><script defer="defer" src="js/app.79ddbfdc.js"></script><link href="css/chunk-vendors.7c88cb4c.css" rel="stylesheet"><link href="css/app.b6f65ab8.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but swiftiso-editor doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file
<!doctype html><html lang=""><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="icon" href="favicon.ico"/><title>ISO手工拟报</title><script defer="defer" src="js/chunk-vendors.80ffbb63.js"></script><script defer="defer" src="js/app.e44d0563.js"></script><link href="css/chunk-vendors.7c88cb4c.css" rel="stylesheet"><link href="css/app.411c12ef.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but swiftiso-editor doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment