Browse Source

fix(地区处理): 添加注释,工作台地区跳转逻辑理解

zhangyong/feature-20260113094820-现金重构
zhangrenyuan 1 month ago
parent
commit
240b5dd759
  1. 4
      src/views/moneyManage/financialAccount/cashFlow.vue

4
src/views/moneyManage/financialAccount/cashFlow.vue

@ -315,13 +315,16 @@ const throttledsubmitRefund = _.throttle(handleRefund, 5000, {
trailing: false trailing: false
}) })
// ID // ID
// normalizeMarketLabel
const normalizeMarketLabel = (value) => { const normalizeMarketLabel = (value) => {
return String(value ?? '') return String(value ?? '')
.trim() .trim()
.toLowerCase() .toLowerCase()
.replace(/[\s_-]+/g, '') .replace(/[\s_-]+/g, '')
} }
// ID
const findValueByLabel = (options, label) => { const findValueByLabel = (options, label) => {
// optionlabelnormalizeMarketLabel
const normalizedLabel = normalizeMarketLabel(label) const normalizedLabel = normalizeMarketLabel(label)
for (const option of options) { for (const option of options) {
if (normalizeMarketLabel(option.label) === normalizedLabel) { if (normalizeMarketLabel(option.label) === normalizedLabel) {
@ -339,6 +342,7 @@ onMounted(async () => {
await getMarket() await getMarket()
// //
// URL?region=a&region=b keyrouter['a','b'], ID
const regionName = Array.isArray(route.query.region) ? route.query.region[0] : route.query.region const regionName = Array.isArray(route.query.region) ? route.query.region[0] : route.query.region
if (regionName && marketOptions.value.length) { if (regionName && marketOptions.value.length) {
const matchedId = findValueByLabel(marketOptions.value, regionName) const matchedId = findValueByLabel(marketOptions.value, regionName)

Loading…
Cancel
Save