Commit 1250bce6 by chenwq

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

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