Commit b42aeae1 by chenwq

Merge branch 'SAAS+V5.8.4' of http://192.168.3.233:8090/saas_plus/dj-car-life-sy…

…stem into feature/584/cwq
2 parents c4bcb30f 6b9658b2
...@@ -6,7 +6,15 @@ function formatDate(val) { ...@@ -6,7 +6,15 @@ function formatDate(val) {
} }
function formatDelayDeadline(val) { function formatDelayDeadline(val) {
return val ? Util.dateFormate(val, "YYYY-MM-DD") : "-" if (!val) {
return "-";
}
const str = String(val).trim();
const dateMatch = str.match(/^(\d{4}-\d{2}-\d{2})/);
if (dateMatch) {
return dateMatch[1];
}
return Util.dateFormate(val, "YYYY-MM-DD");
} }
export const APPROVAL_STATUS = { export const APPROVAL_STATUS = {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="first-box flex"> <div class="first-box flex">
<template v-for="(item, index) in fourFormObj"> <template v-for="(item, index) in fourFormObj">
<div class="item first-form-item" :key="index"> <div class="item first-form-item" :key="index">
<div class="label">{{ item.name }}:</div> <div :class="['label',{required:!isViewMode}]">{{ item.name }}:</div>
<template v-if="isViewMode">{{ getSelectText(item, componentData.pointsConfig) }}</template> <template v-if="isViewMode">{{ getSelectText(item, componentData.pointsConfig) }}</template>
<el-select :size="size" v-model="componentData.pointsConfig[item.key]" class="step-select" <el-select :size="size" v-model="componentData.pointsConfig[item.key]" class="step-select"
:disabled="disabled" v-else> :disabled="disabled" v-else>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<div class="form-box"> <div class="form-box">
<template v-for="(item, index) in fourFormTwoObj"> <template v-for="(item, index) in fourFormTwoObj">
<el-form-item :label="item.name + ':'" :key="index" :prop="item.key"> <el-form-item :label="item.name + ':'" :key="index" :prop="isViewMode ? '' : (item.inputKey || item.key)">
<template v-if="item.type == 'addHtml'"> <template v-if="item.type == 'addHtml'">
{{ formateData(componentData.productCategoryRules[productCategoryIndex][item.key]) }} {{ formateData(componentData.productCategoryRules[productCategoryIndex][item.key]) }}
</template> </template>
...@@ -254,13 +254,13 @@ export default { ...@@ -254,13 +254,13 @@ export default {
getExpenseCategoryCalculateTypeOptions(targetType) { getExpenseCategoryCalculateTypeOptions(targetType) {
let options = []; let options = [];
if (targetType === 1) { if (targetType === 1) {
options = this.options.expenseCategoryOther; options = deepClone(this.options.expenseCategoryOther);
} }
if (targetType === 2) { if (targetType === 2) {
options = this.options.expenseCategoryServer; options = deepClone(this.options.expenseCategoryServer);
} }
if (targetType === 3) { if (targetType === 3) {
options = this.options.expenseCategoryDefault; options = deepClone(this.options.expenseCategoryDefault);
} }
options.forEach((item) => { options.forEach((item) => {
item.expenseCategoryCalculateType = String(item.expenseCategoryCalculateType); item.expenseCategoryCalculateType = String(item.expenseCategoryCalculateType);
...@@ -362,6 +362,9 @@ export default { ...@@ -362,6 +362,9 @@ export default {
color: #333333; color: #333333;
font-size: 14px; font-size: 14px;
}
.required{
&::before { &::before {
content: '*'; content: '*';
color: #F56C6C; color: #F56C6C;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<div> <div>
<SplitPayment :disabled="disabled || isViewMode" :list="componentData.divisionRuleAutos" /> <SplitPayment :disabled="disabled || isViewMode" :list="componentData.divisionRuleAutos" />
<div class="item"> <div class="item">
<div class="label">流量方分账方:</div> <div :class="['label',{required:!isViewMode}]">流量方分账方:</div>
<template v-if="componentData.autoDivideConfig">
<template v-if="shelfType == 1"> <template v-if="shelfType == 1">
<template v-if="isViewMode"> <template v-if="isViewMode">
{{ componentData.autoDivideConfig.realityShopMerchantName || '-' }} {{ componentData.autoDivideConfig.realityShopMerchantName || '-' }}
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</template> </template>
<template v-else> <template v-else>
<template v-if="isViewMode"> <template v-if="isViewMode">
{{ getRealityShopLevelName(componentData.autoDivideConfig.realityShopLevel) }} {{ getRealityShopLevelName(componentData) }}
</template> </template>
<el-select v-else :size="size" v-model="componentData.autoDivideConfig.realityShopLevel" class="step-select"> <el-select v-else :size="size" v-model="componentData.autoDivideConfig.realityShopLevel" class="step-select">
<el-option v-for="item in options.realityShopLevelOptions" :key="item.realityShopLevel" <el-option v-for="item in options.realityShopLevelOptions" :key="item.realityShopLevel"
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
</el-option> </el-option>
</el-select> </el-select>
</template> </template>
</template>
</div> </div>
<div class="step-title flex"> <div class="step-title flex">
品类名称 品类名称
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
<div class="form-box"> <div class="form-box">
<template v-for="(item, index) in threeFormObj"> <template v-for="(item, index) in threeFormObj">
<el-form-item :label="item.name + ':'" :key="index" :prop="item.inputKey || item.key"> <el-form-item :label="item.name + ':'" :key="index" :prop="isViewMode ? '' : (item.inputKey || item.key)">
<template v-if="item.type == 'addHtml'"> <template v-if="item.type == 'addHtml'">
<template v-if="item.htmlName == 'RemoteSelect'"> <template v-if="item.htmlName == 'RemoteSelect'">
<div class="remote-select"> <div class="remote-select">
...@@ -116,6 +117,7 @@ import { ...@@ -116,6 +117,7 @@ import {
otherSelectOptions, otherSelectOptions,
severSelectOptions, severSelectOptions,
} from "@/common/constant/merchant"; } from "@/common/constant/merchant";
import { deepClone } from "@/common/util";
import VenusNumberInput from "@/components/venusNumberInput/index.vue"; import VenusNumberInput from "@/components/venusNumberInput/index.vue";
import { realityShopLevelOptions } from "@/views/goods/shelfProduct/constant/index"; import { realityShopLevelOptions } from "@/views/goods/shelfProduct/constant/index";
import { getSingleRealityShopMerchantOptions, getProfitSharingBaseDetail } from "@/views/goods/shelfProduct/components/profitSharingConfig/hooks"; import { getSingleRealityShopMerchantOptions, getProfitSharingBaseDetail } from "@/views/goods/shelfProduct/components/profitSharingConfig/hooks";
...@@ -320,13 +322,13 @@ export default { ...@@ -320,13 +322,13 @@ export default {
getExpenseCategoryCalculateTypeOptions(targetType) { getExpenseCategoryCalculateTypeOptions(targetType) {
let options = []; let options = [];
if (targetType === 1) { if (targetType === 1) {
options = this.options.expenseCategoryOther; options = deepClone(this.options.expenseCategoryOther);
} }
if (targetType === 2) { if (targetType === 2) {
options = this.options.expenseCategoryServer; options = deepClone(this.options.expenseCategoryServer);
} }
if (targetType === 3) { if (targetType === 3) {
options = this.options.expenseCategoryDefault; options = deepClone(this.options.expenseCategoryDefault);
} }
options.forEach((item) => { options.forEach((item) => {
item.expenseCategoryCalculateType = String(item.expenseCategoryCalculateType); item.expenseCategoryCalculateType = String(item.expenseCategoryCalculateType);
...@@ -420,7 +422,9 @@ export default { ...@@ -420,7 +422,9 @@ export default {
this.$set(this.componentData, 'autoDivideConfig', autoDivideConfig); this.$set(this.componentData, 'autoDivideConfig', autoDivideConfig);
}, },
getRealityShopLevelName(realityShopLevel) { getRealityShopLevelName(i) {
let realityShopLevel = i?.autoDivideConfig?.realityShopLevel
if(realityShopLevel == null || realityShopLevel == undefined || realityShopLevel == '') return '-'
return this.options.realityShopLevelOptions.find(item => item.realityShopLevel == realityShopLevel)?.realityShopLevelName || '-' return this.options.realityShopLevelOptions.find(item => item.realityShopLevel == realityShopLevel)?.realityShopLevelName || '-'
} }
} }
...@@ -464,6 +468,9 @@ export default { ...@@ -464,6 +468,9 @@ export default {
color: #333333; color: #333333;
}
.required {
&::before { &::before {
content: '*'; content: '*';
color: #F56C6C; color: #F56C6C;
......
...@@ -123,7 +123,6 @@ export default { ...@@ -123,7 +123,6 @@ export default {
guaranteeConfigs.map(item => { guaranteeConfigs.map(item => {
if(item.guaranteeIndex) includesConditionList.push(item.guaranteeIndex) if(item.guaranteeIndex) includesConditionList.push(item.guaranteeIndex)
}) })
console.log(includesConditionList)
return includesConditionList return includesConditionList
}, },
}, },
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</div> </div>
<div class="step-content"> <div class="step-content">
<div :class="['step-title', { top54: trafficPartyConfigs.length > 1 }]">对账配置</div> <div :class="['step-title', { top54: trafficPartyConfigs.length > 1 }]">对账配置</div>
<StepFourForm :isViewMode="isViewMode" :currentItem="currentReconciliationSceneConfigs" /> <StepFourForm :isViewMode="isViewMode" :currentItem="currentReconciliationSceneConfigs" :baseSceneCode="baseSceneCode" />
</div> </div>
<div class="step-content"> <div class="step-content">
<div class="step-title ">操作记录</div> <div class="step-title ">操作记录</div>
...@@ -212,9 +212,9 @@ export default { ...@@ -212,9 +212,9 @@ export default {
baseSceneName: i.baseSceneName baseSceneName: i.baseSceneName
} }
i.trafficPartyDetails.map(item => { i.trafficPartyDetails.map(item => {
let label = `流量方:${item.trafficPartyName}`, let label = i.trafficPartyDetails.length > 1 ? `流量方:【${item.trafficPartyName}】` : '',
judgment = shelfType == 1 ? i.baseSceneCode != baseSceneCode : item.trafficPartyId != trafficPartyId judgment = shelfType == 1 ? i.baseSceneCode != baseSceneCode : item.trafficPartyId != trafficPartyId
if (shelfType == 1) label = `场景:${i.baseSceneName}` if (shelfType == 1 && trafficPartyConfigs.length > 1) label = `场景:【${i.baseSceneName}】`
if (judgment) { if (judgment) {
rulesKeys.map(key => { rulesKeys.map(key => {
if (item[key] === undefined || item[key] === null) { if (item[key] === undefined || item[key] === null) {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<div class="detail-box view" v-loading="true"></div> <div class="detail-box view" v-loading="true"></div>
</template> </template>
<div class="fixed-btn-box flex"> <div class="fixed-btn-box flex">
<template v-if="buttonComplete">
<template v-if="pageComplete"> <template v-if="pageComplete">
<el-button v-if="pageType == 'audit' && step == 4" type="primary" @click="rejectDialogVisible = true" <el-button v-if="pageType == 'audit' && step == 4" type="primary" @click="rejectDialogVisible = true"
plain>驳回</el-button> plain>驳回</el-button>
...@@ -32,6 +33,7 @@ ...@@ -32,6 +33,7 @@
</template> </template>
<el-button v-if="!buttonLoading" @click="$router.go(-1)" plain type="info">{{ pageType == 'view' ? '返回' : '取消' <el-button v-if="!buttonLoading" @click="$router.go(-1)" plain type="info">{{ pageType == 'view' ? '返回' : '取消'
}}</el-button> }}</el-button>
</template>
</div> </div>
<el-dialog :close-on-click-modal="false" :show-close="false" title="提示" :visible.sync="dialogVisible" width="40%" <el-dialog :close-on-click-modal="false" :show-close="false" title="提示" :visible.sync="dialogVisible" width="40%"
...@@ -166,7 +168,8 @@ export default { ...@@ -166,7 +168,8 @@ export default {
buttonLoading: false, buttonLoading: false,
rejectDialogVisible: false, rejectDialogVisible: false,
rejectReason: '', rejectReason: '',
basicinformationData: {} basicinformationData: {},
buttonComplete:false
} }
}, },
watch: { watch: {
...@@ -221,6 +224,7 @@ export default { ...@@ -221,6 +224,7 @@ export default {
step = isPrevStep ? STEP - 1 : (updStep ? updStep + 1 : 2) step = isPrevStep ? STEP - 1 : (updStep ? updStep + 1 : 2)
this.basicinformationData = data this.basicinformationData = data
let basicinformationFormList = JSON.parse(basicApproveInfo) let basicinformationFormList = JSON.parse(basicApproveInfo)
this.buttonComplete = false
if (pageType != 'reapply') { if (pageType != 'reapply') {
if (pageType == 'view') { if (pageType == 'view') {
this.step = 2 this.step = 2
...@@ -280,6 +284,9 @@ export default { ...@@ -280,6 +284,9 @@ export default {
this.stepOneRef.init(shelfType, infoForm) this.stepOneRef.init(shelfType, infoForm)
}) })
} }
setTimeout(() => {
this.buttonComplete = true
}, 500)
}, },
...@@ -302,6 +309,7 @@ export default { ...@@ -302,6 +309,7 @@ export default {
} else this.pageComplete = true } else this.pageComplete = true
} else throw '获取模板信息失败' } else throw '获取模板信息失败'
this.buttonComplete = true
} catch (error) { } catch (error) {
this.$message.error(error) this.$message.error(error)
} }
...@@ -396,8 +404,7 @@ export default { ...@@ -396,8 +404,7 @@ export default {
if (params) this.$message.error(params) if (params) this.$message.error(params)
} }
}) })
} } else if (step == 3) {
else if (step == 3) {
this.stepThreeRef.validate(async (valid, params) => { this.stepThreeRef.validate(async (valid, params) => {
if (valid) { if (valid) {
params.businessCode = businessCode params.businessCode = businessCode
...@@ -480,13 +487,13 @@ export default { ...@@ -480,13 +487,13 @@ export default {
} }
.layout { .layout {
height: calc(100vh - 113px); height: calc(100vh - 124px);
// padding: 0 24px; // padding: 0 24px;
box-sizing: border-box; box-sizing: border-box;
.detail-box { .detail-box {
position: relative; position: relative;
height: calc(100% - 190px); height: calc(100% - 178px);
.detail { .detail {
height: 100%; height: 100%;
......
...@@ -2765,7 +2765,8 @@ export default { ...@@ -2765,7 +2765,8 @@ export default {
} }
::v-deep { ::v-deep {
.el-select__tags { .el-select__tags,
.el-cascader__tags {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
flex-wrap: nowrap; flex-wrap: nowrap;
...@@ -2775,10 +2776,19 @@ export default { ...@@ -2775,10 +2776,19 @@ export default {
align-items: center; align-items: center;
} }
} }
.el-cascader__tags {
.el-tag span {
display: inline-block;
max-width: 240px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.el-select__tags-text { .el-select__tags-text {
display: inline-block; display: inline-block;
max-width: 260px; max-width: 240px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
......
...@@ -61,13 +61,11 @@ ...@@ -61,13 +61,11 @@
]"> ]">
<el-cascader v-model="cascaderGoodsTypes" <el-cascader v-model="cascaderGoodsTypes"
placeholder="请选择品类" placeholder="请选择品类"
style="width: 320px" style="width: 370px"
clearable
collapse-tags collapse-tags
filterable filterable
:options="computedGoodsTypeTreeList" :options="computedGoodsTypeTreeList"
:props="cascaderProps" :props="cascaderProps"
:show-all-levels="false"
@change="onCascaderChange" /> @change="onCascaderChange" />
</el-form-item> </el-form-item>
<el-form-item v-show="classificationObj.categoryType == 2" <el-form-item v-show="classificationObj.categoryType == 2"
...@@ -307,18 +305,19 @@ export default { ...@@ -307,18 +305,19 @@ export default {
} }
}); });
// 1. 处理当前Tab已选路径(同一Tab内的禁用规则) // ⚠️ 同Tab内的禁用规则已注释:不再禁用祖先和后代节点,允许在同一Tab内自由选择
currentPaths.forEach((path) => { // // 1. 处理当前Tab已选路径(同一Tab内的禁用规则)
if (!path || !path.length) { // currentPaths.forEach((path) => {
return; // if (!path || !path.length) {
} // return;
// 禁用该路径的所有祖先(从第0个到倒数第2个) // }
for (let i = 0; i < path.length - 1; i++) { // // 禁用该路径的所有祖先(从第0个到倒数第2个)
shouldDisableValues.add(path[i]); // for (let i = 0; i < path.length - 1; i++) {
} // shouldDisableValues.add(path[i]);
// 禁用该路径的所有后代 // }
this.collectAllDescendantsByPath(tree, path, shouldDisableValues); // // 禁用该路径的所有后代
}); // this.collectAllDescendantsByPath(tree, path, shouldDisableValues);
// });
// 2. 处理其他Tab已选路径(跨Tab禁用规则) // 2. 处理其他Tab已选路径(跨Tab禁用规则)
// 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选 // 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选
......
...@@ -65,13 +65,11 @@ ...@@ -65,13 +65,11 @@
])"> ])">
<el-cascader v-model="cascaderGoodsTypes" <el-cascader v-model="cascaderGoodsTypes"
placeholder="请选择品类" placeholder="请选择品类"
style="width: 320px" style="width: 370px"
clearable
collapse-tags collapse-tags
filterable filterable
:options="computedGoodsTypeTreeList" :options="computedGoodsTypeTreeList"
:props="cascaderProps" :props="cascaderProps"
:show-all-levels="false"
@change="onCascaderChange" /> @change="onCascaderChange" />
</el-form-item> </el-form-item>
<el-form-item v-show="classificationObj.categoryType == 2" <el-form-item v-show="classificationObj.categoryType == 2"
...@@ -81,7 +79,7 @@ ...@@ -81,7 +79,7 @@
v-el-select-loadmore="interestsLoadmore" v-el-select-loadmore="interestsLoadmore"
placeholder="请选择商品" placeholder="请选择商品"
popper-class="class123" popper-class="class123"
style="width: 320px" style="width: 370px"
value-key="merchantGoodsCode" value-key="merchantGoodsCode"
collapse-tags collapse-tags
filterable filterable
...@@ -1214,18 +1212,19 @@ export default { ...@@ -1214,18 +1212,19 @@ export default {
} }
}); });
// 1. 处理当前Tab已选路径(同一Tab内的禁用规则) // ⚠️ 同Tab内的禁用规则已注释:不再禁用祖先和后代节点,允许在同一Tab内自由选择
currentPaths.forEach((path) => { // // 1. 处理当前Tab已选路径(同一Tab内的禁用规则)
if (!path || !path.length) { // currentPaths.forEach((path) => {
return; // if (!path || !path.length) {
} // return;
// 禁用该路径的所有祖先(从第0个到倒数第2个) // }
for (let i = 0; i < path.length - 1; i++) { // // 禁用该路径的所有祖先(从第0个到倒数第2个)
shouldDisableValues.add(path[i]); // for (let i = 0; i < path.length - 1; i++) {
} // shouldDisableValues.add(path[i]);
// 禁用该路径的所有后代 // }
this.collectAllDescendantsByPath(tree, path, shouldDisableValues); // // 禁用该路径的所有后代
}); // this.collectAllDescendantsByPath(tree, path, shouldDisableValues);
// });
// 2. 处理其他Tab已选路径(跨Tab禁用规则) // 2. 处理其他Tab已选路径(跨Tab禁用规则)
// 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选 // 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选
...@@ -2928,7 +2927,8 @@ export default { ...@@ -2928,7 +2927,8 @@ export default {
} }
::v-deep { ::v-deep {
.el-select__tags { .el-select__tags,
.el-cascader__tags {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
flex-wrap: nowrap; flex-wrap: nowrap;
...@@ -2938,10 +2938,19 @@ export default { ...@@ -2938,10 +2938,19 @@ export default {
align-items: center; align-items: center;
} }
} }
.el-cascader__tags {
.el-tag span {
display: inline-block;
max-width: 240px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.el-select__tags-text { .el-select__tags-text {
display: inline-block; display: inline-block;
max-width: 180px; max-width: 240px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
......
...@@ -167,6 +167,10 @@ import { ...@@ -167,6 +167,10 @@ import {
getStableReconciliationRuleId, getStableReconciliationRuleId,
mergeReconciliationRuleServerFields, mergeReconciliationRuleServerFields,
} from "./utils/reconciliationIncrementalRules"; } from "./utils/reconciliationIncrementalRules";
import {
getReconciliationRuleIndexForTab,
hasPhantomFullCategoryRuleSlot,
} from "./utils/reconciliationRuleTabIndex";
import { applyGoodsTypeGroupRelationBranches } from "./utils/reconciliationRuleBranches"; import { applyGoodsTypeGroupRelationBranches } from "./utils/reconciliationRuleBranches";
import { import {
fillDjGoodsTypeGroupRelations, fillDjGoodsTypeGroupRelations,
...@@ -475,20 +479,11 @@ export default { ...@@ -475,20 +479,11 @@ export default {
* 首条规则为特殊品类时 tab0「全部品类」仅占位,无对应规则行,返回 null(不可按 tab 下标写 rules[0])。 * 首条规则为特殊品类时 tab0「全部品类」仅占位,无对应规则行,返回 null(不可按 tab 下标写 rules[0])。
*/ */
reconciliationRuleIndexForTabIndex(tabIndex) { reconciliationRuleIndexForTabIndex(tabIndex) {
const rules = this.goodsTypeGroupReconciliationRules; return getReconciliationRuleIndexForTab(
if (!Array.isArray(rules) || !rules.length) { this.goodsTypeGroupReconciliationRules,
return tabIndex; tabIndex,
} this.getEffectivePhantomFullCategoryRuleRaw(),
if (rules[0]?.groupType == 1) { );
return tabIndex;
}
if (rules[0]?.groupType == 2) {
if (tabIndex <= 0) {
return null;
}
return tabIndex - 1;
}
return tabIndex;
}, },
/** /**
* live phantom 在 getEffectRule 末尾会清空;与基线比对、resolve、子组件 props 需回落 baseline.phantomFullCategoryRule。 * live phantom 在 getEffectRule 末尾会清空;与基线比对、resolve、子组件 props 需回落 baseline.phantomFullCategoryRule。
...@@ -520,7 +515,10 @@ export default { ...@@ -520,7 +515,10 @@ export default {
* tab0「全部品类」仅占位:首条接口规则为特殊品类时,tab0 无 goodsTypeGroupReconciliationRules 行。 * tab0「全部品类」仅占位:首条接口规则为特殊品类时,tab0 无 goodsTypeGroupReconciliationRules 行。
*/ */
hasPhantomFullCategoryTab() { hasPhantomFullCategoryTab() {
return this.reconciliationRuleIndexForTabIndex(0) == null; return hasPhantomFullCategoryRuleSlot(
this.goodsTypeGroupReconciliationRules,
this.getEffectivePhantomFullCategoryRuleRaw(),
);
}, },
/** /**
* 基线中与 Tab ti 对应的原始规则行(tab0 phantom 用 baseline.phantomFullCategoryRule,否则 rules[ruleIdx])。 * 基线中与 Tab ti 对应的原始规则行(tab0 phantom 用 baseline.phantomFullCategoryRule,否则 rules[ruleIdx])。
...@@ -1400,38 +1398,27 @@ export default { ...@@ -1400,38 +1398,27 @@ export default {
newActiveIndex -= 1; newActiveIndex -= 1;
} }
const goodsTypeGroupRules = this.getAllReconciliationParams();
const upgradeArr = []; const upgradeArr = [];
const packageArr = []; const packageArr = [];
const prevTabsMeta = this.editableTabs.map(t => ({ if (
classificationUserTouched: !!t.classificationUserTouched, ruleIdxRemoved != null
sessionAdded: !!t.sessionAdded, && ruleIdxRemoved < this.goodsTypeGroupReconciliationRules.length
})); ) {
this.editableTabs = []; this.goodsTypeGroupReconciliationRules.splice(ruleIdxRemoved, 1);
goodsTypeGroupRules.splice(removeIdx, 1); }
// this.$set(this.goodsTypeGroupReconciliationRules, goodsTypeGroupRules) tabs.splice(removeIdx, 1);
this.$nextTick(() => { tabs.forEach((tab, index) => {
this.goodsTypeGroupReconciliationRules = goodsTypeGroupRules; this.$set(tab, "title", index ? "特殊品类" + index : "全部品类");
this.$set(tab, "name", (index + 1).toString());
});
const typeList = goodsTypeGroupRules; newActiveIndex = Math.max(0, Math.min(newActiveIndex, tabs.length - 1));
const newLen = typeList.length; this.editableTabsValue = tabs[newActiveIndex].name;
newActiveIndex = Math.max(0, Math.min(newActiveIndex, newLen - 1));
this.editableTabsValue = (newActiveIndex + 1).toString();
typeList.forEach((item, index) => { this.goodsTypeGroupReconciliationRules.forEach((item) => {
const oldIdx = index < removeIdx ? index : index + 1;
const meta = prevTabsMeta[oldIdx];
const classificationUserTouched = !!(meta && meta.classificationUserTouched);
const sessionAdded = !!(meta && meta.sessionAdded);
this.editableTabs[index] = {
title: index ? "特殊品类" + index : "全部品类",
name: (index + 1).toString(),
classificationUserTouched,
sessionAdded,
};
applyGoodsTypeGroupRelationBranches( applyGoodsTypeGroupRelationBranches(
item, item,
this.goodsTypeGroupReconciliationRules[index], item,
upgradeArr, upgradeArr,
packageArr, packageArr,
); );
...@@ -1440,12 +1427,12 @@ export default { ...@@ -1440,12 +1427,12 @@ export default {
this.getSelectingListPackage(packageArr); this.getSelectingListPackage(packageArr);
this.rebuildCrossTabGoodsSelectionsFromRules(); this.rebuildCrossTabGoodsSelectionsFromRules();
this.bumpReconciliationInteractionEpoch(); this.bumpReconciliationInteractionEpoch();
// this.queryFeeCategoryByTypeFlow = deepClone(this.queryFeeCategoryByTypeFlow) await this.$nextTick();
this.$message({ this.$message({
type: "success", type: "success",
message: "删除成功!", message: "删除成功!",
}); });
}); return true;
}, },
deleteGoodsTypeItem(item) { deleteGoodsTypeItem(item) {
......
/**
* “全部品类”没有服务端规则行、但页面保留了草稿快照时,该 Tab 使用独立的 phantom 槽位。
* rules 为空时仍需保留此语义,否则删除最后一个特殊品类后会把全部品类草稿判成空槽位。
*/
export function hasPhantomFullCategoryRuleSlot(rules, phantomRule) {
const list = Array.isArray(rules) ? rules : [];
if (list[0]?.groupType == 1) {
return false;
}
if (list[0]?.groupType == 2) {
return true;
}
return !!(phantomRule && typeof phantomRule === "object");
}
/**
* 页面 Tab 下标转服务端规则数组下标。
* phantom 占用 Tab 0,但不占 rules 数组位置,因此特殊品类需向前偏移一位。
*/
export function getReconciliationRuleIndexForTab(
rules,
tabIndex,
phantomRule,
) {
if (!hasPhantomFullCategoryRuleSlot(rules, phantomRule)) {
return tabIndex;
}
if (tabIndex <= 0) {
return null;
}
return tabIndex - 1;
}
const {
getReconciliationRuleIndexForTab,
hasPhantomFullCategoryRuleSlot,
} = require("./reconciliationRuleTabIndex");
describe("对账规则 Tab 下标映射", () => {
const phantomRule = {
groupType: 1,
expenseCategoryRules: [ { expenseCategoryId: "flow" } ],
};
it("全部品类为占位草稿时,特殊品类从 rules[0] 开始映射", () => {
const rules = [
{ groupType: 2, groupDivisionRuleId: "special-1" },
{ groupType: 2, groupDivisionRuleId: "special-2" },
];
expect(hasPhantomFullCategoryRuleSlot(rules, phantomRule)).toBe(true);
expect(getReconciliationRuleIndexForTab(rules, 0, phantomRule)).toBeNull();
expect(getReconciliationRuleIndexForTab(rules, 1, phantomRule)).toBe(0);
expect(getReconciliationRuleIndexForTab(rules, 2, phantomRule)).toBe(1);
});
it("删除最后一个特殊品类后 rules 为空,仍保留全部品类占位草稿", () => {
const rules = [];
expect(hasPhantomFullCategoryRuleSlot(rules, phantomRule)).toBe(true);
expect(getReconciliationRuleIndexForTab(rules, 0, phantomRule)).toBeNull();
});
it("已有正式全部品类规则时,优先使用 rules[0]", () => {
const rules = [ { groupType: 1, groupDivisionRuleId: "full-1" } ];
expect(hasPhantomFullCategoryRuleSlot(rules, phantomRule)).toBe(false);
expect(getReconciliationRuleIndexForTab(rules, 0, phantomRule)).toBe(0);
});
it("规则和草稿都为空时,全部品类使用可写的 rules[0] 槽位", () => {
expect(hasPhantomFullCategoryRuleSlot([], null)).toBe(false);
expect(getReconciliationRuleIndexForTab([], 0, null)).toBe(0);
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!