|
|
@ -25,14 +25,11 @@ |
|
|
|
<el-text class="mx-1" size="large">所属地区:</el-text> |
|
|
|
<el-cascader |
|
|
|
v-model="selectedMarketPath" |
|
|
|
:options="markets" |
|
|
|
:options="market" |
|
|
|
placeholder="请选择所属地区" |
|
|
|
clearable |
|
|
|
collapse-tags |
|
|
|
collapse-tags-tooltip |
|
|
|
style="width:180px" |
|
|
|
@change="handleMarketChange" |
|
|
|
:props="props" |
|
|
|
/> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@ -83,11 +80,8 @@ |
|
|
|
<el-table-column type="index" label="序号" width="60"/> |
|
|
|
<el-table-column prop="name" label="姓名" width="120"/> |
|
|
|
<el-table-column prop="jwcode" label="精网号" width="120"/> |
|
|
|
<el-table-column prop="market" label="所属地区" width="120"> |
|
|
|
<template #default="scope"> |
|
|
|
{{ marketMapping[scope.row.market] || scope.row.market }} |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="market" label="所属地区" width="120"/> |
|
|
|
|
|
|
|
<el-table-column prop="refundType" label="退款类型" width="120"/> |
|
|
|
<el-table-column prop="refundModel" label="退款方式" width="120"> |
|
|
|
<template #default="{ row }"> |
|
|
@ -175,7 +169,11 @@ import {onMounted, reactive, ref} from 'vue' |
|
|
|
import {ElMessage} from 'element-plus' |
|
|
|
import API from '@/util/http.js' |
|
|
|
import moment from 'moment' |
|
|
|
import {marketMapping, reverseMarketMapping} from "@/utils/marketMap.js"; |
|
|
|
import {useAdminStore} from "@/store/index.js"; |
|
|
|
import {storeToRefs} from "pinia"; |
|
|
|
import {findMenuById, permissionMapping} from "@/utils/menuTreePermission.js" |
|
|
|
import dayjs from "dayjs"; |
|
|
|
|
|
|
|
const defaultTime = [ |
|
|
|
new Date(2000, 1, 1, 0, 0, 0), |
|
|
|
new Date(2000, 2, 1,23 , 59, 59), |
|
|
@ -201,7 +199,7 @@ const searchForm = ref({ |
|
|
|
jwcode: '', |
|
|
|
refundModel: '', |
|
|
|
goodsName: '', |
|
|
|
markets: [], |
|
|
|
market: "", |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
auditStatus: '0' |
|
|
@ -292,7 +290,7 @@ const showRejectDialog = (row) => { |
|
|
|
rejectDialogVisible.value = true |
|
|
|
} |
|
|
|
// 查地区 |
|
|
|
const markets = ref([]) |
|
|
|
const market = ref("") |
|
|
|
|
|
|
|
// 查商品名 |
|
|
|
const getRefundGoods = async () => { |
|
|
@ -336,11 +334,6 @@ const get = async function (val) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
import {useAdminStore} from "@/store/index.js"; |
|
|
|
import {storeToRefs} from "pinia"; |
|
|
|
import {findMenuById, permissionMapping} from "@/utils/menuTreePermission.js" |
|
|
|
import dayjs from "dayjs"; |
|
|
|
|
|
|
|
const adminStore = useAdminStore(); |
|
|
|
const {menuTree} = storeToRefs(adminStore); |
|
|
|
|
|
|
@ -438,7 +431,7 @@ const resetSearch = function () { |
|
|
|
jwcode: '', |
|
|
|
refundType: '', |
|
|
|
goodsName: '', |
|
|
|
markets: [], |
|
|
|
market: "", |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
sortField: '', |
|
|
@ -552,63 +545,14 @@ const adminReject = async function () { |
|
|
|
} |
|
|
|
|
|
|
|
// 存储地区选择变化 |
|
|
|
const selectedMarketPath = ref([]) |
|
|
|
//处理地区选择变化 |
|
|
|
const selectedMarketPath = ref("") |
|
|
|
const handleMarketChange = (value) => { |
|
|
|
if (Array.isArray(value) && value.length > 0) { |
|
|
|
const ids = new Set(); |
|
|
|
|
|
|
|
value.forEach(path => { |
|
|
|
const lastName = path[path.length - 1]; |
|
|
|
const id = reverseMarketMapping[lastName]; |
|
|
|
if (id) ids.add(Number(id)); |
|
|
|
}); |
|
|
|
|
|
|
|
// 添加额外处理:如果一个父节点下所有子节点都被选中,则把父节点也加入 |
|
|
|
const getAllLeafNames = (nodes) => { |
|
|
|
const leafNames = []; |
|
|
|
|
|
|
|
const traverse = (node, parentName = null) => { |
|
|
|
if (!node.children || node.children.length === 0) { |
|
|
|
leafNames.push({name: node.label, parent: parentName}); |
|
|
|
if (value && value.length > 0) { |
|
|
|
searchForm.value.market = value[value.length - 1] |
|
|
|
} else { |
|
|
|
node.children.forEach(child => traverse(child, node.label)); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
nodes.forEach(node => traverse(node)); |
|
|
|
return leafNames; |
|
|
|
}; |
|
|
|
|
|
|
|
const leafNameMap = getAllLeafNames(markets.value); // 所有叶子节点和对应父级名称 |
|
|
|
|
|
|
|
// 列表构建 |
|
|
|
const parentToChildren = {}; |
|
|
|
leafNameMap.forEach(({name, parent}) => { |
|
|
|
if (!parentToChildren[parent]) parentToChildren[parent] = []; |
|
|
|
parentToChildren[parent].push(name); |
|
|
|
}); |
|
|
|
|
|
|
|
// 构建当前被选中的叶子节点 |
|
|
|
const selectedLeafNames = value.map(path => path[path.length - 1]); |
|
|
|
|
|
|
|
// 如果 parent 下所有子节点都选中了,就把 parent 加进来 |
|
|
|
Object.entries(parentToChildren).forEach(([parent, children]) => { |
|
|
|
const allChildrenSelected = children.every(child => selectedLeafNames.includes(child)); |
|
|
|
if (allChildrenSelected && reverseMarketMapping[parent]) { |
|
|
|
ids.add(Number(reverseMarketMapping[parent])); |
|
|
|
searchForm.value.market = '' |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
searchForm.value.markets = Array.from(ids); |
|
|
|
} else { |
|
|
|
searchForm.value.markets = []; |
|
|
|
} |
|
|
|
|
|
|
|
console.log('最终映射后的 market IDs:', searchForm.value.markets); |
|
|
|
}; |
|
|
|
|
|
|
|
const props = {multiple: true} |
|
|
|
// 获取地区,修改为级联下拉框 |
|
|
|
const getMarket = async function () { |
|
|
|
try { |
|
|
@ -638,8 +582,8 @@ const getMarket = async function () { |
|
|
|
}); |
|
|
|
}; |
|
|
|
// 存储地区信息 |
|
|
|
markets.value = transformTree(result.data) |
|
|
|
console.log('转换后的地区树==============', markets.value) |
|
|
|
market.value = transformTree(result.data) |
|
|
|
console.log('转换后的地区树==============', market.value) |
|
|
|
} catch (error) { |
|
|
|
console.log('请求失败', error) |
|
|
|
} |
|
|
|