Commit 1250bce6 by chenwq

feat(specialBankAccount): 优化特殊银行账户页面的搜索与展示逻辑,精简代码结构

移除未使用的导入项与银行账号输入侦听器
重构getOptionsList方法提升代码复用性
更新搜索表单,替换原有商户分类/渠道字段为账号类型,新增备注字段
调整表格列配置与数据展示方式
优化表单重置与搜索参数处理逻辑
添加表格has-num属性关闭数字统计
1 parent 106bba8d
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<d2-table ref="merchantTable" <d2-table ref="merchantTable"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
:get-list-api="getListApi" :get-list-api="getListApi"
:has-num="false"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams"> :table-params="tableParams">
<auth-button slot="auth-button" <auth-button slot="auth-button"
...@@ -51,7 +52,6 @@ ...@@ -51,7 +52,6 @@
<script> <script>
import { deleteBankAccount, getListApi } from "@api/specialBankAccount"; import { deleteBankAccount, getListApi } from "@api/specialBankAccount";
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { BaseData, merchantStoreServiceList } from "@/common/constants.js";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import reportTrackFunMixin from "@/mixins/reportTrackFunMixin"; import reportTrackFunMixin from "@/mixins/reportTrackFunMixin";
import EditBankDialog from "./components/EditBankDialog.vue"; import EditBankDialog from "./components/EditBankDialog.vue";
...@@ -70,71 +70,62 @@ export default { ...@@ -70,71 +70,62 @@ export default {
// 搜索 // 搜索
merchantLevelVal: [], merchantLevelVal: [],
searchForm: { searchForm: {
merchantType: "", accountType: "",
channelType: "",
merchantName: "", merchantName: "",
merchantId: "",
openAccBankName: "", openAccBankName: "",
enterDate: [],
bankAccountNo: "", bankAccountNo: "",
bankAccountName: "", bankAccountName: "",
enterDate: [],
remark: "",
}, },
searchFormSearch: {}, searchFormSearch: {},
showFormData: [{ showFormData: [{
label: "商户分类", label: "账号类型",
name: "merchantType", name: "accountType",
type: "select", type: "select",
optionList: [],
optionId: "confId",
optionLabel: "confLabel",
optionsName: "merchantStoreServiceList",
}, {
label: "渠道",
name: "channelType",
type: "select",
optionList: [],
optionId: "value", optionId: "value",
optionLabel: "name", optionLabel: "name",
optionsName: "channelTypeList", optionList: [],
optionsName: "accountTypeList",
}, { }, {
label: "商户名称", label: "商户名称",
name: "merchantName", name: "merchantName",
type: "input", type: "input",
maxlength: "20",
isClear: true, isClear: true,
keyFn: this.keyDowmGetList, keyFn: this.keyDowmGetList,
}, { }, {
label: "商户号", label: "开户银行",
name: "merchantId",
type: "input",
inputType: "number",
maxlength: "50",
isClear: true,
keyFn: this.keyDowmGetList,
}, {
label: "开户行",
name: "openAccBankName", name: "openAccBankName",
type: "input", type: "input",
maxlength: "50", maxlength: "20",
isClear: true, isClear: true,
keyFn: this.keyDowmGetList, keyFn: this.keyDowmGetList,
}, { }, {
label: "录入时间",
name: "enterDate",
type: "datePicker",
isClear: true,
pickerOptions: "rangePickerOptions",
}, {
label: "银行账号", label: "银行账号",
name: "bankAccountNo", name: "bankAccountNo",
type: "input", type: "input",
maxlength: "50", maxlength: "20",
isClear: true, isClear: true,
keyFn: this.keyDowmGetList, keyFn: this.keyDowmGetList,
}, { }, {
label: "账户名称", label: "账户名称",
name: "bankAccountName", name: "bankAccountName",
type: "input", type: "input",
maxlength: "50", maxlength: "20",
isClear: true,
keyFn: this.keyDowmGetList,
}, {
label: "录入时间",
name: "enterDate",
type: "datePicker",
isClear: true,
// pickerOptions: "rangePickerOptions",
}, {
label: "备注",
name: "remark",
type: "input",
maxlength: "20",
isClear: true, isClear: true,
keyFn: this.keyDowmGetList, keyFn: this.keyDowmGetList,
}], }],
...@@ -147,19 +138,16 @@ export default { ...@@ -147,19 +138,16 @@ export default {
mutiSelectUniqueKey: "merchantId", mutiSelectUniqueKey: "merchantId",
mutiSelectName: "merchantId", mutiSelectName: "merchantId",
tableColumns: [{ tableColumns: [{
label: "商户名称", label: "账号类型",
prop: "merchantName",
}, {
label: "商户号",
prop: "merchantId",
}, {
label: "渠道",
prop: "", prop: "",
formatter: (cellValue) => { formatter: (cellValue) => {
return this.baseData.channelTypeShow[cellValue.channelType]; return this.baseData.accountTypeShow[cellValue.accountType] || "";
}, },
}, { }, {
label: "开户行", label: "商户名称",
prop: "merchantName",
}, {
label: "开户银行",
prop: "openAccBankName", prop: "openAccBankName",
}, { }, {
label: "银行账号", label: "银行账号",
...@@ -173,16 +161,27 @@ export default { ...@@ -173,16 +161,27 @@ export default {
formatter: (cellValue) => { formatter: (cellValue) => {
return Util.dateFormate(cellValue.createdDate, "YYYY-MM-DD HH:mm:ss"); return Util.dateFormate(cellValue.createdDate, "YYYY-MM-DD HH:mm:ss");
}, },
}, {
label: "备注",
prop: "remark",
}], }],
}, },
baseData: { baseData: {
channelTypeList: [], accountTypeList: [{
channelTypeShow: { name: "灵工平台",
1: "嘀加", value: "1",
2: "广汇", }, {
8: "直营", name: "个体工商户",
value: "2",
}, {
name: "其他",
value: "3",
}],
accountTypeShow: {
1: "灵工平台",
2: "个体工商户",
3: "其他",
}, },
merchantStoreServiceList: deepClone(merchantStoreServiceList),
}, },
modeDialogConfig: { modeDialogConfig: {
config: { config: {
...@@ -193,20 +192,8 @@ export default { ...@@ -193,20 +192,8 @@ export default {
}; };
}, },
watch: {
"searchForm.bankAccountNo": function (value) {
// 只允许:数字 0-9、英文字母 A-Za-z、常见特殊字符(如 !@#$%^&*()_+-=[]{}|;:'",.<>/?`~)
// 排除:中文、空格、换行符、制表符等
const allowedPattern = /[^\w!@#$%^&*()+\-=[\]{}|;:'",.<>?/`~]/g;
const cleanedInput = value.replace(allowedPattern, "");
// 更新银行账号数据
this.searchForm.bankAccountNo = cleanedInput;
},
},
mounted() { mounted() {
this.getBaseData(); this.getOptionsList("showFormData");
this.onPageShow(); this.onPageShow();
}, },
beforeDestroy() { beforeDestroy() {
...@@ -220,30 +207,33 @@ export default { ...@@ -220,30 +207,33 @@ export default {
}, },
methods: { methods: {
...mapActions({
get: "d2admin/base/get",
}),
...mapActions("d2admin/user", ["actionSetDownloadList"]), ...mapActions("d2admin/user", ["actionSetDownloadList"]),
async getBaseData() {
this.baseData.channelTypeList = await this.get(BaseData.channelType);
this.getOptionsList();
},
getOptionsList() { getOptionsList(formName, hasAll = true, refreshSigle) {
this.showFormData.forEach((item, index) => { if (refreshSigle) {
if (item.type === "select") { let item = this[formName].find(k => k.name == refreshSigle);
if (this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== "全部") { let index = this[formName].findIndex(k => k.name == refreshSigle);
const temp = {}; this.$set(this[formName][index], "optionList", deepClone(this.baseData[item.optionsName]));
temp[this.showFormData[index].optionId] = ""; if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== "全部") {
temp[this.showFormData[index].optionLabel] = "全部"; const temp = {};
this.baseData[item.optionsName].unshift(temp); temp[this[formName][index].optionId] = "";
} temp[this[formName][index].optionLabel] = "全部";
this.$set(this.showFormData[index], "optionList", this.baseData[item.optionsName]); this[formName][index].optionList.unshift(temp);
} }
}); } else {
console.log(this.showFormData, "showFormData"); this[formName].forEach((item, index) => {
if (item.type === "select" && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], "optionList", deepClone(this.baseData[item.optionsName]));
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== "全部") {
const temp = {};
temp[this[formName][index].optionId] = "";
temp[this[formName][index].optionLabel] = "全部";
this[formName][index].optionList.unshift(temp);
}
}
});
}
}, },
handleAdd() { handleAdd() {
this.modeDialogConfig.config.title = "新增银企账号"; this.modeDialogConfig.config.title = "新增银企账号";
this.bankOprType = "add"; this.bankOprType = "add";
...@@ -277,14 +267,13 @@ export default { ...@@ -277,14 +267,13 @@ export default {
}, },
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
merchantType: "", accountType: "",
channelType: "",
merchantName: "", merchantName: "",
merchantId: "",
openAccBankName: "", openAccBankName: "",
enterDate: [],
bankAccountNo: "", bankAccountNo: "",
bankAccountName: "", bankAccountName: "",
enterDate: [],
remark: "",
}; };
this.merchantLevelVal = []; this.merchantLevelVal = [];
this.$refs.merchantTable.resetRefreshTable(); this.$refs.merchantTable.resetRefreshTable();
...@@ -301,8 +290,8 @@ export default { ...@@ -301,8 +290,8 @@ export default {
if (params[item.attr] && params[item.attr].length) { if (params[item.attr] && params[item.attr].length) {
params[item.startAttr] = Util.dateFormate(params[item.attr][0], "YYYY-MM-DD 00:00:00"); params[item.startAttr] = Util.dateFormate(params[item.attr][0], "YYYY-MM-DD 00:00:00");
params[item.endAttr] = Util.dateFormate(params[item.attr][1], "YYYY-MM-DD 23:59:59"); params[item.endAttr] = Util.dateFormate(params[item.attr][1], "YYYY-MM-DD 23:59:59");
delete params[item.attr];
} }
delete params[item.attr];
}); });
return params; return params;
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!