diff --git a/ruoyi-ui/src/components/SearchSelect/index.vue b/ruoyi-ui/src/components/SearchSelect/index.vue index bbff34d..b9eadef 100644 --- a/ruoyi-ui/src/components/SearchSelect/index.vue +++ b/ruoyi-ui/src/components/SearchSelect/index.vue @@ -1,178 +1,53 @@ + diff --git a/ruoyi-ui/src/components/SearchSelect/searchdata.js b/ruoyi-ui/src/components/SearchSelect/searchdata.js new file mode 100644 index 0000000..6a0d979 --- /dev/null +++ b/ruoyi-ui/src/components/SearchSelect/searchdata.js @@ -0,0 +1,68 @@ +// searchData.js - 搜索配置的独立模块 + +export const selectConfigs =[ + // 磅点选择 + { + key: 'truepound', + params: 't_data_truepound;id;concat(name,\' \',usrcode)', + where: 'poundtype = \'3\'', + orderby: 'usrcode asc' + }, + // 业务磅点 + { + key: 'buspound', + params: "t_data_buspound;id;concat(name,' ',usrcode)", + where: '', + orderby: 'usrcode asc' + }, + // 车号 + { + key: 'carno', + params: "t_data_pounddata;usrcode;usrcode", + where: "type = 'plateNumber'", + orderby: "usrcode asc" + }, + // 司机 + { + key: 'cardriver', + params: "t_data_pounddata;usrcode;usrcode", + where: "type = 'driverName'", + orderby: "usrcode asc" + }, + // 品名 + { + key: 'itmcode', + params: "t_data_pounddata;usrcode;concat(name,' ',usrcode)", + where: "type = 'productName'", + orderby: "usrcode asc" + }, + // 收货单位 + { + key: 'recunit', + params: "t_data_pounddata;usrcode;concat(name,' ',usrcode)", + where: "type = 'receivingCompany'", + orderby: "usrcode asc" + }, + // 承运单位 + { + key: 'trnunit', + params: "t_data_pounddata;usrcode;concat(name,' ',usrcode)", + where: "type = 'teamOrCarrier'", + orderby: "usrcode asc" + }, + // 发货单位 + { + key: 'sendunit', + params: "t_data_pounddata;usrcode;concat(name,' ',usrcode)", + where: "type = 'shippingCompany'", + orderby: "usrcode asc" + }, + // 主榜单号 + { + key: 'appli', + params: "t_data_poundmst;id;usrcode", + where: "", + orderby: "usrcode asc" + }, + ] +; diff --git a/ruoyi-ui/src/views/measurement/operation/outinpound/index.vue b/ruoyi-ui/src/views/measurement/operation/outinpound/index.vue index 72a8a80..414ece1 100644 --- a/ruoyi-ui/src/views/measurement/operation/outinpound/index.vue +++ b/ruoyi-ui/src/views/measurement/operation/outinpound/index.vue @@ -15,9 +15,7 @@ @@ -53,9 +51,7 @@ @@ -497,6 +493,10 @@ import {delUser} from "@/api/system/user"; //导入计算方法 import Decimal from 'decimal.js'; import {mulToString,mulToArray} from "@/api/tool/util.js" +//引入searchSelect方法 +import { getSearchSelectData } from "@/api/tool/gen.js"; +//引入searchData组件 +import {selectConfigs} from "@/components/SearchSelect/searchdata.js"; export default { name: "Outinpound", components: {SearchSelect}, @@ -585,9 +585,34 @@ export default { }, }, + //关于searchSelect的参数数据 + // searchData:{ + // optionsMap:{}, + // selectConfigs:[ + // //磅点选择 + // { + // key: 'truepound', + // params: 't_data_truepound;id;concat(name,\' \',usrcode)', + // where: 'poundtype = \'1\' or poundtype = \'2\'', + // orderby: 'usrcode asc' + // }, + // //车号 + // { + // key: 'carno', + // params : "t_data_pounddata;usrcode;usrcode", + // where : "type = 'plateNumber'", + // orderby : "usrcode asc" + // }, + // ] + // }, + searchData: { + optionsMap: {}, + selectConfigs:selectConfigs + }, } }, created() { + this.loadAllSelectOptions(); }, computed:{ searchPound(){ @@ -1046,6 +1071,31 @@ export default { this.poundbillList = response.rows; this.loading = false; }) + }, + //searchSelect相关方法 + buildCacheKey({ params, where, groupby = '', orderby = '' }) { + return `${params}|${where}|${groupby}|${orderby}`; + }, + async loadAllSelectOptions() { + for (const cfg of this.searchData.selectConfigs) { + const key = this.buildCacheKey(cfg); + if (!this.searchData.optionsMap[key]) { + const [tableName, value, label] = cfg.params.split(';'); + const res = await getSearchSelectData({ + tableName: tableName, + value: value, + label: label, + where: cfg.where, + groupby: cfg.groupby, + orderby: cfg.orderby + }); + this.$set(this.searchData.optionsMap, key, res.code === 200 ? res.data : []); + } + } + }, + getOptionsByKey(key) { + const cfg = this.searchData.selectConfigs.find(c => c.key === key); + return this.searchData.optionsMap[this.buildCacheKey(cfg)] || []; } }, mounted() { diff --git a/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue b/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue index 1e551b7..85b9017 100644 --- a/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue +++ b/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue @@ -15,9 +15,7 @@ @@ -74,9 +72,7 @@ @@ -90,9 +86,7 @@ @@ -102,9 +96,7 @@ @@ -112,9 +104,7 @@ @@ -158,9 +148,7 @@ @@ -174,9 +162,7 @@ @@ -186,9 +172,7 @@ @@ -198,9 +182,7 @@ @@ -248,9 +230,7 @@ @@ -262,9 +242,7 @@ @@ -274,9 +252,7 @@ @@ -286,9 +262,7 @@ @@ -379,9 +353,7 @@ @@ -393,9 +365,7 @@ @@ -405,9 +375,7 @@ @@ -417,9 +385,7 @@ @@ -429,9 +395,7 @@ @@ -526,9 +490,7 @@ @@ -548,9 +510,7 @@ @@ -611,10 +571,7 @@ @@ -624,9 +581,7 @@ @@ -634,9 +589,7 @@ @@ -646,9 +599,7 @@ @@ -663,9 +614,7 @@ @@ -698,9 +647,7 @@ @@ -714,9 +661,7 @@ @@ -725,18 +670,14 @@ @@ -801,6 +742,10 @@ import { getPoundbill, updateTransPoundbill, } from "@/api/measurement/bill/poundbill" +//引入searchSelect方法 +import { getSearchSelectData } from "@/api/tool/gen.js"; +//引入searchData组件 +import {searchData, selectConfigs} from "@/components/SearchSelect/searchdata.js"; export default { name: "Shortdispound", components: {SearchSelect}, @@ -936,10 +881,84 @@ export default { thisSelectedRow:{}, isWght:true, }, + //关于searchSelect的参数数据 + searchData111:{ + optionsMap:{}, + selectConfigs:[ + //磅点选择 + { + key: 'truepound', + params: 't_data_truepound;id;concat(name,\' \',usrcode)', + where: 'poundtype = \'3\'', + orderby: 'usrcode asc' + }, + //业务磅点 + { + key: 'buspound', + params: "t_data_buspound;id;concat(name,' ',usrcode)", + where: '', + orderby: 'usrcode asc' + }, + //车号 + { + key: 'carno', + params : "t_data_pounddata;usrcode;usrcode", + where : "type = 'plateNumber'", + orderby : "usrcode asc" + }, + //司机 + { + key: 'cardriver', + params : "t_data_pounddata;usrcode;usrcode", + where : "type = 'driverName'", + orderby : "usrcode asc" + }, + //品名 + { + key: 'itmcode', + params : "t_data_pounddata;usrcode;concat(name,' ',usrcode)", + where : "type = 'productName'", + orderby : "usrcode asc" + }, + //收货单位 + { + key: 'recunit', + params : "t_data_pounddata;usrcode;concat(name,' ',usrcode)", + where : "type = 'receivingCompany'", + orderby : "usrcode asc" + }, + //承运单位 + { + key: 'trnunit', + params : "t_data_pounddata;usrcode;concat(name,' ',usrcode)", + where : "type = 'teamOrCarrier'", + orderby : "usrcode asc" + }, + //发货单位 + { + key: 'sendunit', + params : "t_data_pounddata;usrcode;concat(name,' ',usrcode)", + where : "type = 'shippingCompany'", + orderby : "usrcode asc" + }, + //主榜单号 + { + key: 'appli', + params : "t_data_poundmst;id;usrcode", + where : "", + orderby : "usrcode asc" + }, + ] + }, + searchData: { + optionsMap: {}, + selectConfigs:selectConfigs + }, } }, created() { // this.getList() + this.loadAllSelectOptions(); }, watch: { //监听磅点变化 @@ -1444,7 +1463,32 @@ watch: { this.poundBillFullList = response.rows; this.poundBillFullLoading = false; }) - } + }, + //searchSelect相关方法 + buildCacheKey({ params, where, groupby = '', orderby = '' }) { + return `${params}|${where}|${groupby}|${orderby}`; + }, + async loadAllSelectOptions() { + for (const cfg of this.searchData.selectConfigs) { + const key = this.buildCacheKey(cfg); + if (!this.searchData.optionsMap[key]) { + const [tableName, value, label] = cfg.params.split(';'); + const res = await getSearchSelectData({ + tableName: tableName, + value: value, + label: label, + where: cfg.where, + groupby: cfg.groupby, + orderby: cfg.orderby + }); + this.$set(this.searchData.optionsMap, key, res.code === 200 ? res.data : []); + } + } + }, + getOptionsByKey(key) { + const cfg = this.searchData.selectConfigs.find(c => c.key === key); + return this.searchData.optionsMap[this.buildCacheKey(cfg)] || []; + }, } }