Browse Source

feat(现金流水): 添加从工作台跳转时处理地区参数功能

添加 useRoute 导入和地区参数处理逻辑,当从工作台跳转时自动匹配并设置对应地区筛选条件
zhangyong/feature-20260113094820-现金重构
zhangrenyuan 1 month ago
parent
commit
0055c07850
  1. 32
      src/views/moneyManage/financialAccount/cashFlow.vue

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

@ -1,5 +1,6 @@
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import request from '@/util/http.js'
import dayjs from 'dayjs'
@ -7,6 +8,7 @@ import { useI18n } from 'vue-i18n'
import { Moneyfunds,refundOnline } from '@/api/cash/financialAccount.js'
const { t } = useI18n()
const route = useRoute()
const paytypeList = [
t('cash.payMethods.stripe'),
@ -247,8 +249,34 @@ const getTagText = (state) => {
}
}
onMounted(() => {
getMarket()
// ID
const findValueByLabel = (options, label) => {
for (const option of options) {
// trim
if (option.label === label || option.label?.trim() === label?.trim()) {
return option.value
}
if (option.children && option.children.length) {
const found = findValueByLabel(option.children, label)
if (found) return found
}
}
return null
}
onMounted(async () => {
await getMarket()
//
const regionName = route.query.region
if (regionName && marketOptions.value.length) {
const matchedId = findValueByLabel(marketOptions.value, regionName)
if (matchedId) {
// el-cascader markets
queryParams.markets = [matchedId]
}
}
fetchData()
})
</script>

Loading…
Cancel
Save