diff --git a/ruoyi-ui/src/components/SearchSelect/searchdata.js b/ruoyi-ui/src/components/SearchSelect/searchdata.js index 6a0d979..b78b720 100644 --- a/ruoyi-ui/src/components/SearchSelect/searchdata.js +++ b/ruoyi-ui/src/components/SearchSelect/searchdata.js @@ -1,13 +1,34 @@ // searchData.js - 搜索配置的独立模块 export const selectConfigs =[ - // 磅点选择 + // 出厂入厂磅 { - key: 'truepound', + key: 'outinpound', + params: 't_data_truepound;id;concat(name,\' \',usrcode)', + where: "poundtype = '1' or poundtype = '2'", + orderby: 'usrcode asc' + }, + // 倒短 + { + key: 'shortdispound', params: 't_data_truepound;id;concat(name,\' \',usrcode)', where: 'poundtype = \'3\'', orderby: 'usrcode asc' }, + // 铁水 + { + key: 'moltenironpound', + params: 't_data_truepound;id;concat(name,\' \',usrcode)', + where: 'poundtype = \'4\'', + orderby: 'usrcode asc' + }, + // 成品 + { + key: 'steelpound', + params: 't_data_truepound;id;concat(name,\' \',usrcode)', + where: 'poundtype = \'5\'', + orderby: 'usrcode asc' + }, // 业务磅点 { key: 'buspound', diff --git a/ruoyi-ui/src/views/measurement/operation/moltenironpound/index.vue b/ruoyi-ui/src/views/measurement/operation/moltenironpound/index.vue index 9fca242..cc516db 100644 --- a/ruoyi-ui/src/views/measurement/operation/moltenironpound/index.vue +++ b/ruoyi-ui/src/views/measurement/operation/moltenironpound/index.vue @@ -14,9 +14,7 @@ @@ -73,9 +71,7 @@ @@ -89,9 +85,7 @@ @@ -101,9 +95,7 @@ @@ -111,9 +103,7 @@ @@ -153,9 +143,7 @@ @@ -168,9 +156,7 @@ @@ -180,9 +166,7 @@ @@ -192,9 +176,7 @@ @@ -236,9 +218,7 @@ @@ -252,9 +232,7 @@ @@ -264,9 +242,7 @@ @@ -276,9 +252,7 @@ @@ -359,9 +333,7 @@ @@ -373,9 +345,7 @@ @@ -385,9 +355,7 @@ @@ -397,9 +365,7 @@ @@ -409,9 +375,7 @@ @@ -480,9 +444,7 @@ @@ -528,10 +490,7 @@ @@ -541,9 +500,7 @@ @@ -551,9 +508,7 @@ @@ -563,9 +518,7 @@ @@ -580,9 +533,7 @@ @@ -610,9 +561,7 @@ @@ -626,9 +575,7 @@ @@ -637,18 +584,14 @@ @@ -713,7 +656,10 @@ import { updateTransPoundbill } from "@/api/measurement/bill/poundbill"; import {getCarnoEmpwgtData} from "@/api/measurement/basedata/empwgtdata"; - +//引入searchSelect方法 +import { getSearchSelectData } from "@/api/tool/gen.js"; +//引入searchData组件 +import {selectConfigs} from "@/components/SearchSelect/searchdata.js"; export default { name: "Moltenironpound", components: {SearchSelect}, @@ -839,10 +785,16 @@ export default { thisSelectedRow:{}, isWght:true, }, + //关于searchSelect的参数数据 + searchData: { + optionsMap: {}, + selectConfigs:selectConfigs + }, } }, created() { // this.getList() + this.loadAllSelectOptions(); }, watch: { //监听磅点变化 @@ -1261,7 +1213,33 @@ export default { } //触发完成方法 await complete(this.mstBillFormData.selectedIds[0]) - } + }, + + //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)] || []; + }, } } diff --git a/ruoyi-ui/src/views/measurement/operation/outinpound/index.vue b/ruoyi-ui/src/views/measurement/operation/outinpound/index.vue index 414ece1..6fbed17 100644 --- a/ruoyi-ui/src/views/measurement/operation/outinpound/index.vue +++ b/ruoyi-ui/src/views/measurement/operation/outinpound/index.vue @@ -15,7 +15,7 @@ diff --git a/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue b/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue index 85b9017..c41675f 100644 --- a/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue +++ b/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue @@ -15,7 +15,7 @@ @@ -882,74 +882,6 @@ export default { 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 diff --git a/ruoyi-ui/src/views/measurement/operation/steelpound/index.vue b/ruoyi-ui/src/views/measurement/operation/steelpound/index.vue index fecaf34..6a11d37 100644 --- a/ruoyi-ui/src/views/measurement/operation/steelpound/index.vue +++ b/ruoyi-ui/src/views/measurement/operation/steelpound/index.vue @@ -6,9 +6,7 @@ @@ -85,9 +83,7 @@ @@ -99,9 +95,7 @@ @@ -111,9 +105,7 @@ @@ -123,9 +115,7 @@ @@ -173,9 +163,7 @@ @@ -287,10 +275,7 @@ @@ -300,9 +285,7 @@ @@ -310,9 +293,7 @@ @@ -322,9 +303,7 @@ @@ -382,9 +361,7 @@ @@ -402,9 +379,7 @@ @@ -448,6 +423,10 @@ import SearchSelect from "@/components/SearchSelect"; import {addPoundmst, getNumber, getPoundmst, listPoundmst, updatePoundmst,complete} from "@/api/measurement/bill/poundmst"; import {addTransPoundbill, getNumber as getPoundBillNumber,getMaxBundleNo, listPoundbill,addSteelPoundbill} from "@/api/measurement/bill/poundbill"; import Decimal from "decimal.js"; +//引入searchSelect方法 +import { getSearchSelectData } from "@/api/tool/gen.js"; +//引入searchData组件 +import {selectConfigs} from "@/components/SearchSelect/searchdata.js"; export default { name: "Steelpound", @@ -568,11 +547,17 @@ export default { autoPound:false, isWeighing: false, // 是否已完成一次称重 weightTimer: null // 定时器引用 - } + }, + //关于searchSelect的参数数据 + searchData: { + optionsMap: {}, + selectConfigs:selectConfigs + }, } }, created() { // this.getList() + this.loadAllSelectOptions(); }, watch: { //监听磅点变化 @@ -985,7 +970,32 @@ export default { } //触发完成方法 await complete(this.mstBillFormData.selectedIds[0]) - } + }, + //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)] || []; + }, } }