Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -504,8 +504,10 @@ onActivated(() => {
|
||||
syncFromRoute(pendingRefresh.value)
|
||||
})
|
||||
|
||||
// 组件已处于激活状态时路由 query 变化的兜底
|
||||
// 仅当前路由就是本详情页时才响应 query;
|
||||
// 避免 keep-alive 缓存的另一个详情页(普通/专属)误用对方 API 导致「套餐不存在」
|
||||
watch(() => route.query.priceSetId, () => {
|
||||
if (route.path !== mod.routes.detail) return
|
||||
syncFromRoute(false)
|
||||
})
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
:columns="columns"
|
||||
:search-columns="searchColumns"
|
||||
:query="queryList"
|
||||
:default-params="defaultParams"
|
||||
row-key="priceSetId"
|
||||
>
|
||||
<template #toolbar>
|
||||
@@ -120,19 +121,22 @@ const auditPerm = [`${mod.permPrefix}:audit`]
|
||||
const { proxy } = getCurrentInstance()
|
||||
const tableRef = ref()
|
||||
const isFirstActivate = ref(true)
|
||||
/** 默认只看待启用、生效(排除已停用) */
|
||||
const defaultParams = { statuses: ['D', 'E'] }
|
||||
|
||||
const searchColumns = computed(() => [
|
||||
{
|
||||
label: '状态',
|
||||
prop: 'status',
|
||||
prop: 'statuses',
|
||||
component: 'select',
|
||||
options: [
|
||||
{ label: '待启用', value: 'D' },
|
||||
{ label: '生效', value: 'E' },
|
||||
{ label: '已停用', value: 'S' }
|
||||
],
|
||||
props: { multiple: true, collapseTags: true, clearable: true },
|
||||
placeholder: '全部状态',
|
||||
width: '140px'
|
||||
width: '200px'
|
||||
},
|
||||
{ label: '关键字', prop: 'keyword', component: 'input', placeholder: mod.labels.keywordPlaceholder, width: '200px' },
|
||||
{ label: '客户', prop: 'customerId', placeholder: '客户名称 / 代码', width: '240px' }
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
link
|
||||
type="danger"
|
||||
@click="$emit('remove', row)"
|
||||
v-hasPermi="['price:label:remove']"
|
||||
v-hasPermi="['price:label:edit']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -154,9 +154,11 @@ function canReschedule(row) {
|
||||
return row && String(row.status) === '0' && hasEffectiveTime(row)
|
||||
}
|
||||
|
||||
/** 仅待生效可删除整版 */
|
||||
/** 待生效/已生效可删;已失效不展示删除 */
|
||||
function canDelete(row) {
|
||||
return row && String(row.status) === '0'
|
||||
if (!row) return false
|
||||
const s = String(row.status ?? '')
|
||||
return s === '0' || s === '1'
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -285,7 +285,11 @@ function openEditVersion(row) {
|
||||
function removeVersion(row) {
|
||||
if (!priceSetId.value || !row?.versionNo) return
|
||||
const label = row.versionLabel || ('V' + row.versionNo)
|
||||
proxy.$modal.confirm('确认删除待生效版本 ' + label + '?该版产品价卡将一起清除。').then(() => {
|
||||
const isEffect = String(row.status) === '1'
|
||||
const tip = isEffect
|
||||
? ('确认删除版本 ' + label + '?该版产品价卡将一起清除,且上一周期将自动恢复为生效。')
|
||||
: ('确认删除版本 ' + label + '?该版产品价卡将一起清除。')
|
||||
proxy.$modal.confirm(tip).then(() => {
|
||||
return deleteLabelVersion(priceSetId.value, row.versionNo)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('版本已删除')
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
:columns="columns"
|
||||
:search-columns="searchColumns"
|
||||
:query="queryList"
|
||||
:default-params="defaultParams"
|
||||
row-key="priceSetId"
|
||||
>
|
||||
<template #toolbar>
|
||||
@@ -75,18 +76,22 @@ const { proxy } = getCurrentInstance()
|
||||
const tableRef = ref()
|
||||
const isFirstActivate = ref(true)
|
||||
|
||||
/** 默认只看待启用、生效(排除已停用) */
|
||||
const defaultParams = { statuses: ['D', 'E'] }
|
||||
|
||||
const searchColumns = [
|
||||
{
|
||||
label: '状态',
|
||||
prop: 'status',
|
||||
prop: 'statuses',
|
||||
component: 'select',
|
||||
options: [
|
||||
{ label: '待启用', value: 'D' },
|
||||
{ label: '生效', value: 'E' },
|
||||
{ label: '已停用', value: 'S' }
|
||||
],
|
||||
props: { multiple: true, collapseTags: true, clearable: true },
|
||||
placeholder: '全部状态',
|
||||
width: '140px'
|
||||
width: '200px'
|
||||
},
|
||||
{ label: '关键字', prop: 'keyword', component: 'input', placeholder: '套餐编码 / 名称', width: '200px' }
|
||||
]
|
||||
|
||||
@@ -75,11 +75,6 @@
|
||||
<surcharge-count-cell :list="row.surcharges || []" @remove="s => removeSurcharge(row, s)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="colAction" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="pickSurcharge(row)">附加费</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -95,7 +90,7 @@ const props = defineProps({
|
||||
productName: { type: String, default: '' },
|
||||
rows: { type: Array, default: () => [] }
|
||||
})
|
||||
const emit = defineEmits(['update:modelValue', 'pick-surcharge', 'row-change', 'surcharge-change'])
|
||||
const emit = defineEmits(['update:modelValue', 'row-change', 'surcharge-change'])
|
||||
|
||||
const keyword = ref('')
|
||||
const editingKey = ref('')
|
||||
@@ -115,7 +110,6 @@ const colWeight = '重量段'
|
||||
const colSetFv = '套餐运费'
|
||||
const colSetReg = '套餐挂号费'
|
||||
const colSurcharge = '附加费'
|
||||
const colAction = '操作'
|
||||
|
||||
function cellKey(row, field) {
|
||||
if (!row) return 'none:' + field
|
||||
@@ -171,10 +165,6 @@ async function commitEdit(row, field) {
|
||||
}
|
||||
}
|
||||
|
||||
function pickSurcharge(row) {
|
||||
emit('pick-surcharge', row || null)
|
||||
}
|
||||
|
||||
function removeSurcharge(row, sc) {
|
||||
if (!row || !sc || sc.scId == null) return
|
||||
const scId = String(sc.scId)
|
||||
|
||||
@@ -146,7 +146,6 @@
|
||||
:rows="editRows"
|
||||
@row-change="onRowPriceChange"
|
||||
@surcharge-change="onRowSurchargeChange"
|
||||
@pick-surcharge="openSurchargeFromDrawer"
|
||||
/>
|
||||
|
||||
<excel-import-dialog
|
||||
@@ -893,16 +892,6 @@ async function openSurchargeForProduct(row) {
|
||||
}
|
||||
}
|
||||
|
||||
/** 抽屉里点附加费:带行 = 行级(只改该行,国家+重量段),不带 = 产品级(覆盖全部明细行) */
|
||||
function openSurchargeFromDrawer(row) {
|
||||
const group = editGroup.value || { productCode: editCode.value, rows: editRows.value }
|
||||
if (row && (row.countryCode || row.countryName)) {
|
||||
openSurcharge(group, rowScopeKey(row), rowScopeLabel(row))
|
||||
} else {
|
||||
openSurcharge(group)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** persist one detail row to DB immediately (edit mode only) */
|
||||
async function persistDetail(row, withSurcharge) {
|
||||
@@ -994,21 +983,16 @@ function rowScopeLabel(r) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开附加费勾选弹窗
|
||||
* 列表 = 价格基础 → 附加费配置 主表全量(不要求产品已做关联);
|
||||
* 勾选回显 = 作用范围内明细行当前附加费的并集;
|
||||
* scopeKey 传行级键时只作用于该行(国家+重量段),不传则产品级全覆盖。
|
||||
* 打开附加费勾选弹窗(仅产品级:覆盖该产品全部明细行)
|
||||
* 列表 = 价格基础 → 附加费配置 主表全量;
|
||||
* 勾选回显 = 该产品明细行当前附加费的并集。
|
||||
*/
|
||||
async function openSurcharge(row, scopeKey, scopeName) {
|
||||
async function openSurcharge(row) {
|
||||
await props.refData.ensureAllSurcharges()
|
||||
scRows.value = row.rows || []
|
||||
scScopeKey.value = scopeKey || null
|
||||
const targets = scScopeKey.value
|
||||
? scRows.value.filter(r => rowScopeKey(r) === scScopeKey.value)
|
||||
: scRows.value
|
||||
scScopeName.value = scopeName || (scScopeKey.value
|
||||
? ((targets[0] && rowScopeLabel(targets[0])) || '')
|
||||
: '')
|
||||
scScopeKey.value = null
|
||||
scScopeName.value = ''
|
||||
const targets = scRows.value
|
||||
scList.value = props.refData.allSurchargeConfigs()
|
||||
const picked = new Set()
|
||||
targets.forEach(r => {
|
||||
@@ -1017,25 +1001,17 @@ async function openSurcharge(row, scopeKey, scopeName) {
|
||||
})
|
||||
})
|
||||
scPickedIds.value = [...picked]
|
||||
scTitle.value = row.productCode
|
||||
+ (scScopeName.value ? ' · ' + scScopeName.value : '')
|
||||
+ ' · 附加费'
|
||||
scTitle.value = row.productCode + ' · 附加费'
|
||||
scVisible.value = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 勾选结果写回:行级只改该行(国家+重量段),产品级覆盖该产品全部明细行;同一附加费只留一条。
|
||||
*
|
||||
* 校验口径:附加费的 country_code 是它自身的计费适用国家(如「燃油附加费 RO」仅对罗马
|
||||
* 尼亚计费),勾选挂载时【按目标明细行的国家做适用性校验】——国家码不匹配的附加费
|
||||
* 不落到该行(该行计费时也不会命中它,见 TmsPriceQuoteServiceImpl.surchargeApplies),
|
||||
* 并统计不匹配数提示用户。country_code 为空 = 全部国家,直接适用。
|
||||
* 勾选结果写回该产品全部明细行;同一附加费只留一条。
|
||||
* 按明细行国家做适用性校验:country_code 不匹配则该行不落;为空=全部国家。
|
||||
*/
|
||||
function onSurchargeConfirm(picked) {
|
||||
const ids = new Set((picked || []).map(s => String(s.scId)))
|
||||
const targets = scScopeKey.value
|
||||
? scRows.value.filter(r => rowScopeKey(r) === scScopeKey.value)
|
||||
: scRows.value
|
||||
const targets = scRows.value
|
||||
let applied = 0
|
||||
let skipped = 0
|
||||
targets.forEach(r => {
|
||||
|
||||
@@ -7,13 +7,21 @@
|
||||
class="ps-dialog"
|
||||
>
|
||||
<div class="ps-picker-bar">
|
||||
<span>共 {{ rows.length }} 项附加费配置,勾选后写入所选范围的明细行</span>
|
||||
<div class="ps-picker-bar__left">
|
||||
<el-input
|
||||
v-model="keyword"
|
||||
clearable
|
||||
placeholder="搜索附加费名称、计费方式或作用范围"
|
||||
class="ps-picker-search"
|
||||
/>
|
||||
<span>共 {{ filteredRows.length }} 项附加费配置(全部 {{ rows.length }} 项),勾选后写入所选范围的明细行</span>
|
||||
</div>
|
||||
<span class="ps-picker-bar__picked">已选 {{ picked.length }} 项</span>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
:data="rows"
|
||||
:data="filteredRows"
|
||||
row-key="scId"
|
||||
border
|
||||
size="small"
|
||||
@@ -45,10 +53,10 @@
|
||||
|
||||
<script setup name="SurchargePickerDialog">
|
||||
/**
|
||||
* 套餐 · 附加费勾选弹窗(新建流程第 3 步)
|
||||
* 套餐 · 附加费勾选弹窗(新建流程第 3 步 / 专属报价详情)
|
||||
*
|
||||
* 数据来源:产品已关联的附加费配置(prc_surcharge_rel ∩ prc_surcharge),
|
||||
* 与明细表格里「附加费」列展示的口径一致;勾选结果由父级写回该产品的明细行。
|
||||
* 数据来源:附加费配置主表全量;勾选结果由父级写回明细行。
|
||||
* 搜索仅过滤列表展示,已勾选项在筛选后仍保留。
|
||||
*/
|
||||
import { formatChargeValue, surchargeScopeLabel } from '../../utils/priceSet'
|
||||
|
||||
@@ -63,7 +71,9 @@ const props = defineProps({
|
||||
const emit = defineEmits(['update:modelValue', 'confirm'])
|
||||
|
||||
const tableRef = ref()
|
||||
const picked = ref([])
|
||||
const keyword = ref('')
|
||||
const pickedIds = ref(new Set())
|
||||
const syncing = ref(false)
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
@@ -107,19 +117,59 @@ function chargeTypeLabel(val) {
|
||||
return chargeTypeLabelMap[val] || chargeTypeLabelMap[String(val).toUpperCase()] || val
|
||||
}
|
||||
|
||||
const filteredRows = computed(() => {
|
||||
const text = String(keyword.value || '').trim().toLowerCase()
|
||||
const list = rows.value || []
|
||||
if (!text) return list
|
||||
return list.filter(row => {
|
||||
const bag = [
|
||||
row.scName,
|
||||
chargeTypeLabel(row.chargeType),
|
||||
row.chargeType,
|
||||
row.scopeText,
|
||||
row.chargeValue,
|
||||
row.currency
|
||||
].map(v => String(v ?? '').toLowerCase())
|
||||
return bag.some(item => item.includes(text))
|
||||
})
|
||||
})
|
||||
|
||||
const picked = computed(() => {
|
||||
const ids = pickedIds.value
|
||||
return (rows.value || []).filter(row => row?.scId != null && ids.has(String(row.scId)))
|
||||
})
|
||||
|
||||
function onSelectionChange(selection) {
|
||||
picked.value = selection
|
||||
if (syncing.value) return
|
||||
const visibleIds = new Set((filteredRows.value || []).map(row => String(row.scId)))
|
||||
const next = new Set(pickedIds.value)
|
||||
for (const id of visibleIds) {
|
||||
next.delete(id)
|
||||
}
|
||||
for (const row of selection || []) {
|
||||
if (row?.scId != null) next.add(String(row.scId))
|
||||
}
|
||||
pickedIds.value = next
|
||||
}
|
||||
|
||||
/** 确定:以表格当前选中为准(回显/重渲染可能清掉 selection,不能只信 selection-change 的快照) */
|
||||
function submit() {
|
||||
function restoreSelection() {
|
||||
const table = tableRef.value
|
||||
let list = picked.value
|
||||
if (table && typeof table.getSelection === 'function') {
|
||||
const cur = table.getSelection() || []
|
||||
if (cur.length || !list.length) list = cur
|
||||
if (!table) return
|
||||
syncing.value = true
|
||||
table.clearSelection()
|
||||
for (const row of filteredRows.value || []) {
|
||||
if (row?.scId != null && pickedIds.value.has(String(row.scId))) {
|
||||
table.toggleRowSelection(row, true)
|
||||
}
|
||||
}
|
||||
emit('confirm', list)
|
||||
nextTick(() => {
|
||||
syncing.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 确定:以当前已选 scId 为准(筛选隐藏行仍保留) */
|
||||
function submit() {
|
||||
emit('confirm', picked.value)
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
@@ -130,15 +180,17 @@ function applySelection(ids, tries) {
|
||||
if ((tries || 0) < 5) nextTick(() => applySelection(ids, (tries || 0) + 1))
|
||||
return
|
||||
}
|
||||
table.clearSelection()
|
||||
rows.value.forEach(row => {
|
||||
table.toggleRowSelection(row, ids.includes(String(row.scId)))
|
||||
})
|
||||
picked.value = rows.value.filter(row => ids.includes(String(row.scId)))
|
||||
pickedIds.value = new Set(ids)
|
||||
restoreSelection()
|
||||
}
|
||||
|
||||
watch(keyword, () => {
|
||||
nextTick(() => restoreSelection())
|
||||
})
|
||||
|
||||
watch(() => props.modelValue, v => {
|
||||
if (!v) return
|
||||
keyword.value = ''
|
||||
const ids = (props.selectedIds || []).map(id => String(id))
|
||||
nextTick(() => applySelection(ids, 0))
|
||||
})
|
||||
|
||||
@@ -521,8 +521,10 @@ onActivated(() => {
|
||||
syncFromRoute(pendingRefresh.value)
|
||||
})
|
||||
|
||||
// 组件已处于激活状态时路由 query 变化的兜底
|
||||
// 仅当前路由就是本详情页时才响应 query;
|
||||
// 避免 keep-alive 缓存的另一个详情页(普通/专属)误用对方 API 导致「套餐不存在」
|
||||
watch(() => route.query.priceSetId, () => {
|
||||
if (route.path !== mod.routes.detail) return
|
||||
syncFromRoute(false)
|
||||
})
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
:columns="columns"
|
||||
:search-columns="searchColumns"
|
||||
:query="queryList"
|
||||
:default-params="defaultParams"
|
||||
row-key="priceSetId"
|
||||
>
|
||||
<template #toolbar>
|
||||
@@ -117,19 +118,22 @@ const editPerm = usePriceSetPerm('edit')
|
||||
const auditPerm = usePriceSetPerm('audit')
|
||||
const tableRef = ref()
|
||||
const isFirstActivate = ref(true)
|
||||
/** 默认只看待启用、生效(排除已停用) */
|
||||
const defaultParams = { statuses: ['D', 'E'] }
|
||||
|
||||
const searchColumns = computed(() => [
|
||||
{
|
||||
label: '状态',
|
||||
prop: 'status',
|
||||
prop: 'statuses',
|
||||
component: 'select',
|
||||
options: [
|
||||
{ label: '待启用', value: 'D' },
|
||||
{ label: '生效', value: 'E' },
|
||||
{ label: '已停用', value: 'S' }
|
||||
],
|
||||
props: { multiple: true, collapseTags: true, clearable: true },
|
||||
placeholder: '全部状态',
|
||||
width: '140px'
|
||||
width: '200px'
|
||||
},
|
||||
{ label: '关键字', prop: 'keyword', component: 'input', placeholder: mod.labels.keywordPlaceholder, width: '200px' },
|
||||
{ label: '客户', prop: 'customerId', placeholder: '客户名称 / 代码', width: '240px' }
|
||||
|
||||
@@ -223,6 +223,18 @@
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
|
||||
&__left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ps-picker-search {
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
&__picked {
|
||||
flex: none;
|
||||
padding: 0 8px;
|
||||
|
||||
Reference in New Issue
Block a user