Commit b5cccf56 by 张立顺

feat 功能联调

1 parent 51f83bf8
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
class="select" class="select"
multiple multiple
:placeholder="`请选择${i.label}`" :placeholder="`请选择${i.label}`"
@change="onStaffMultiChange(i.key)"
> >
<el-option <el-option
v-for="item in i.options" v-for="item in i.options"
...@@ -255,6 +256,7 @@ export default { ...@@ -255,6 +256,7 @@ export default {
this.componentData = deepClone(this.data) this.componentData = deepClone(this.data)
}, },
save () { save () {
this.syncAllStaffNamesFromOptions()
this.editStatus = false this.editStatus = false
this.$emit('updateData', deepClone(this.componentData)) this.$emit('updateData', deepClone(this.componentData))
this.$emit('edit', false) this.$emit('edit', false)
...@@ -273,12 +275,45 @@ export default { ...@@ -273,12 +275,45 @@ export default {
const values = this.componentData[i.key] const values = this.componentData[i.key]
if (!values || !Array.isArray(values) || values.length === 0 || !i?.options?.length) return '-' if (!values || !Array.isArray(values) || values.length === 0 || !i?.options?.length) return '-'
const selectedNames = i.options const selectedNames = values
.filter(item => values.includes(item.uuid)) .map(uid => i.options.find(item => String(item.uuid) === String(uid))?.staffName)
.map(item => item.staffName) .filter(Boolean)
return selectedNames.length > 0 ? selectedNames.join('/') : '-' return selectedNames.length > 0 ? selectedNames.join('/') : '-'
}, },
/** 与上架 payload 一致:按选中 uuid 顺序逗号拼接 staffName;选项未加载时不覆盖详情带入的名称 */
syncStaffNameFromOptions (listKey) {
const nameByListKey = {
areaOpIdList: 'areaOpName',
onlineOpIdList: 'onlineOpName',
regionSupervisorIdList: 'regionSupervisorName'
}
const nameKey = nameByListKey[listKey]
if (!nameKey) return
const row = this.customerInformation.find(c => c.key === listKey)
const options = row?.options || []
const uuids = this.componentData[listKey]
if (!Array.isArray(uuids) || uuids.length === 0) {
this.$set(this.componentData, nameKey, '')
return
}
if (!options.length) return
const parts = uuids.map((uid) => {
const opt = options.find(o => String(o.uuid) === String(uid))
return opt && opt.staffName != null && opt.staffName !== '' ? String(opt.staffName) : ''
})
const joined = parts.filter(Boolean).join(',')
if (!joined && this.componentData[nameKey]) return
this.$set(this.componentData, nameKey, joined)
},
syncAllStaffNamesFromOptions () {
['areaOpIdList', 'onlineOpIdList', 'regionSupervisorIdList'].forEach(k => {
this.syncStaffNameFromOptions(k)
})
},
onStaffMultiChange (listKey) {
this.syncStaffNameFromOptions(listKey)
},
async merchantStaffByRoleList () { async merchantStaffByRoleList () {
const [areaOpIdList, onlineOpIdList, regionSupervisorIdList] = await Promise.all([ const [areaOpIdList, onlineOpIdList, regionSupervisorIdList] = await Promise.all([
merchantStaffByRoleList({ roleName: '区域运营' }), merchantStaffByRoleList({ roleName: '区域运营' }),
...@@ -293,6 +328,7 @@ export default { ...@@ -293,6 +328,7 @@ export default {
this.customerInformation.map(item => { this.customerInformation.map(item => {
item.options = data[item.key] item.options = data[item.key]
}) })
this.$nextTick(() => this.syncAllStaffNamesFromOptions())
}, },
async getyqMerchantList () { async getyqMerchantList () {
const { list } = await getyqMerchantList({ currentPage: 1, pageSize: 100000 }) const { list } = await getyqMerchantList({ currentPage: 1, pageSize: 100000 })
......
...@@ -184,7 +184,10 @@ import { ...@@ -184,7 +184,10 @@ import {
fillDjGoodsTypeGroupRelations, fillDjGoodsTypeGroupRelations,
rebuildFinancialCrossTabGoodsSelections rebuildFinancialCrossTabGoodsSelections
} from "../merchantStep/utils/reconciliationShared" } from "../merchantStep/utils/reconciliationShared"
import { getStableReconciliationRuleId } from "../merchantStep/utils/reconciliationIncrementalRules" import {
getStableReconciliationRuleId,
mergeReconciliationRuleServerFields
} from "../merchantStep/utils/reconciliationIncrementalRules"
import { import {
appendDeleteOpsToIncremental, appendDeleteOpsToIncremental,
buildGoodsTypeGroupIncrementalRules, buildGoodsTypeGroupIncrementalRules,
...@@ -990,20 +993,13 @@ export default { ...@@ -990,20 +993,13 @@ export default {
const upgradeArr = [] const upgradeArr = []
const packageArr = [] const packageArr = []
let startNum = 0
this.editableTabs = [] this.editableTabs = []
if (goodsTypeGroupRules[0].groupType == 2) { if (goodsTypeGroupRules[0].groupType == 2) {
goodsTypeGroupRules.unshift({ groupType: 1 }) goodsTypeGroupRules.unshift({ groupType: 1 })
} }
goodsTypeGroupRules.forEach((item, index) => { goodsTypeGroupRules.forEach((item, index) => {
if (index == 0 && item.groupType == 2) {
startNum = 1
}
this.editableTabs[index] = { this.editableTabs[index] = {
title: title: index ? "特殊品类" + index : "全部品类",
item.groupType == 1
? "全部品类"
: "特殊品类" + (index + startNum),
name: (index + 1).toString(), name: (index + 1).toString(),
testFlag: item.testFlag == "N" ? "N" : "Y", testFlag: item.testFlag == "N" ? "N" : "Y",
groupDivisionRuleId: groupDivisionRuleId:
...@@ -1559,7 +1555,19 @@ export default { ...@@ -1559,7 +1555,19 @@ export default {
} }
} }
const prepared = prepareRuleForValidation(rulePayload) let prepared = prepareRuleForValidation(rulePayload)
const cachedForId = this.financialObj.goodsTypeGroupRules?.[tabindex]
prepared = mergeReconciliationRuleServerFields(prepared, cachedForId)
if (process.env.NODE_ENV === "development") {
console.debug(
"[FinancialRules] validatedByIndex tab",
tabindex,
"groupDivisionRuleId:",
prepared?.groupDivisionRuleId,
"id:",
prepared?.id
)
}
validatedByIndex[tabindex] = prepared validatedByIndex[tabindex] = prepared
if (tab) { if (tab) {
this.$set(tab, "testFlag", "Y") this.$set(tab, "testFlag", "Y")
...@@ -1869,7 +1877,7 @@ export default { ...@@ -1869,7 +1877,7 @@ export default {
addTab() { addTab() {
// 重排已有 tab 的 name(保证连续),并记录当前数量作为新 tab 标题序号 // 重排已有 tab 的 name(保证连续),并记录当前数量作为新 tab 标题序号
const length = this.editableTabs.length const length = this.editableTabs.length
this.addIndex = length this.addIndex = Math.max(1, length)
this.editableTabs = this.editableTabs.map((item, index) => { this.editableTabs = this.editableTabs.map((item, index) => {
item.name = (index + 1).toString() item.name = (index + 1).toString()
......
import { getStableReconciliationRuleId } from "../../merchantStep/utils/reconciliationIncrementalRules"
import { GOODS_TYPE_GROUP_RULE_OP } from "./goodsTypeGroupRuleOpType" import { GOODS_TYPE_GROUP_RULE_OP } from "./goodsTypeGroupRuleOpType"
/** /**
* @param {object} rule
* @param {number} idx
*/
function buildOneIncrementalEntry(rule, idx) {
const idStr = getStableReconciliationRuleId(rule)
const type = idStr
? GOODS_TYPE_GROUP_RULE_OP.UPDATE
: GOODS_TYPE_GROUP_RULE_OP.ADD
const entry = {
...rule,
type,
tabPaneIndex: idx
}
if (idStr) {
const gidEmpty =
entry.groupDivisionRuleId == null
|| String(entry.groupDivisionRuleId).trim() === ""
if (gidEmpty) {
entry.groupDivisionRuleId = idStr
}
}
return entry
}
/**
* 由已通过纯数据校验的 validatedByIndex 生成增量提交行(带 type / tabPaneIndex)。 * 由已通过纯数据校验的 validatedByIndex 生成增量提交行(带 type / tabPaneIndex)。
* 主键与对账一致:groupDivisionRuleId 或 id 任一对接 UPDATE;仅 id 时回填 groupDivisionRuleId 便于接口识别。
* *
* @param {Record<number, object>} validatedByIndex * @param {Record<number, object>} validatedByIndex
* @param {number[]} indicesToValidate * @param {number[]} indicesToValidate
...@@ -18,32 +45,16 @@ export function buildGoodsTypeGroupIncrementalRules( ...@@ -18,32 +45,16 @@ export function buildGoodsTypeGroupIncrementalRules(
const idx = indicesToValidate[0] const idx = indicesToValidate[0]
if (idx !== undefined) { if (idx !== undefined) {
const rule = validatedByIndex[idx] const rule = validatedByIndex[idx]
const id = rule && rule.groupDivisionRuleId if (rule) {
const hasId = id != null && String(id).trim() !== "" incrementalRules.push(buildOneIncrementalEntry(rule, idx))
const type = hasId }
? GOODS_TYPE_GROUP_RULE_OP.UPDATE
: GOODS_TYPE_GROUP_RULE_OP.ADD
incrementalRules.push({
...rule,
type,
tabPaneIndex: idx
})
} }
} else { } else {
for (let j = 0; j < indicesToValidate.length; j++) { for (let j = 0; j < indicesToValidate.length; j++) {
const idx = indicesToValidate[j] const idx = indicesToValidate[j]
const rule = validatedByIndex[idx] const rule = validatedByIndex[idx]
if (!rule) continue if (!rule) continue
const id = rule.groupDivisionRuleId incrementalRules.push(buildOneIncrementalEntry(rule, idx))
const hasId = id != null && String(id).trim() !== ""
const type = hasId
? GOODS_TYPE_GROUP_RULE_OP.UPDATE
: GOODS_TYPE_GROUP_RULE_OP.ADD
incrementalRules.push({
...rule,
type,
tabPaneIndex: idx
})
} }
} }
return incrementalRules return incrementalRules
......
...@@ -42,6 +42,9 @@ export function buildTrafficProviderData(mi, baseSceneList = []) { ...@@ -42,6 +42,9 @@ export function buildTrafficProviderData(mi, baseSceneList = []) {
areaOpId: joinIds(mi, "areaOpIdList", "areaOpId"), areaOpId: joinIds(mi, "areaOpIdList", "areaOpId"),
onlineOpId: joinIds(mi, "onlineOpIdList", "onlineOpId"), onlineOpId: joinIds(mi, "onlineOpIdList", "onlineOpId"),
regionSupervisorId: joinIds(mi, "regionSupervisorIdList", "regionSupervisorId"), regionSupervisorId: joinIds(mi, "regionSupervisorIdList", "regionSupervisorId"),
areaOpName: mi.areaOpName || "",
onlineOpName: mi.onlineOpName || "",
regionSupervisorName: mi.regionSupervisorName || "",
}; };
} }
......
...@@ -169,6 +169,9 @@ export function buildMerchantOnShelfOpenPayload(options) { ...@@ -169,6 +169,9 @@ export function buildMerchantOnShelfOpenPayload(options) {
areaOpId: joinMultiId(traffic, "areaOpIdList", "areaOpId"), areaOpId: joinMultiId(traffic, "areaOpIdList", "areaOpId"),
onlineOpId: joinMultiId(traffic, "onlineOpIdList", "onlineOpId"), onlineOpId: joinMultiId(traffic, "onlineOpIdList", "onlineOpId"),
regionSupervisorId: joinMultiId(traffic, "regionSupervisorIdList", "regionSupervisorId"), regionSupervisorId: joinMultiId(traffic, "regionSupervisorIdList", "regionSupervisorId"),
areaOpName: (traffic && traffic.areaOpName) || "",
onlineOpName: (traffic && traffic.onlineOpName) || "",
regionSupervisorName: (traffic && traffic.regionSupervisorName) || "",
}; };
const productDetailBusinessDataList = (productDetailsForSubmit || []).map( const productDetailBusinessDataList = (productDetailsForSubmit || []).map(
......
...@@ -1154,7 +1154,7 @@ export default { ...@@ -1154,7 +1154,7 @@ export default {
addTab() { addTab() {
const length = this.editableTabs.length const length = this.editableTabs.length
this.addIndex = length this.addIndex = Math.max(1, length)
this.editableTabs = this.editableTabs.map((item, index) => { this.editableTabs = this.editableTabs.map((item, index) => {
item.name = (index + 1).toString() item.name = (index + 1).toString()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!