Commit bf33e5a6 by wangzhihui

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

…stem into feature/584/wzh
2 parents d5b341b8 981d1afb
Showing 58 changed files with 2010 additions and 367 deletions
......@@ -4,9 +4,9 @@
# VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config
# 配置中心地址继承 .env 中的 VUE_APP_CONFIG_CENTER_URL(config-center-backend)
# 配置中心不可用时,main.js 会回退到 src/common/baseConfig.develop.json
# 使用 develop 环境完整配置(含 axios.appkey/secret/baseURL)
# oss mock 不可用时,main.js 会回退到 src/common/baseConfig.develop.json
VUE_APP_CONFIG_CENTER_URL=https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config
VUE_APP_USE_DEVELOP_AXIOS=true
# 门店工作汇报:默认走真实 dailyReport 接口;本地需 Mock 时设 VUE_APP_JOURNAL_MOCK=true
......@@ -26,7 +26,10 @@ export function mapDetailResponse(res = {}, fallback = {}) {
subformDataList: res.subformDataList,
reportTemplateId: res.reportTemplateId,
baseSceneCode: res.baseSceneCode,
sceneType: res.sceneType ?? fallback.sceneType,
schema: res.schema,
brandIds: res.brandIds ?? fallback.brandIds ?? [],
sceneList: res.sceneList ?? fallback.sceneList ?? [],
};
}
......
......@@ -10,7 +10,7 @@ export function mapOverviewRow(row = {}) {
return {
id: row.id ?? row.dailyReportRecordId,
staffName: row.staffName,
staffName: row.staffName ?? row.staffname ?? "",
staffUuid: row.staffUuid,
merchantId: row.merchantId,
merchantName: row.merchantName,
......@@ -20,7 +20,6 @@ export function mapOverviewRow(row = {}) {
staffCount: row.staffCount,
lastSaveTime: createdDate,
submitTime: reportStatus === 1 ? (row.submitTime ?? createdDate) : (row.submitTime || ""),
submitUserName: row.submitUserName ?? row.submitStaffName ?? "",
reportDate: row.reportDate,
templateType: row.templateType,
reportStatus,
......
......@@ -78,6 +78,7 @@ function buildStoreDailyList(params) {
merchantName: store.merchantName,
sceneType: String(store.sceneType),
staffCount: 3,
staffName: index % 3 === 0 ? "" : STAFF_LIST[index % STAFF_LIST.length].staffName,
createdDate: "2026-06-12 14:41:00",
reportStatus: index % 3 === 0 ? 0 : 1,
reportDate: params.reportDate,
......
......@@ -109,7 +109,6 @@ export default {
},
value: {
required: true,
type: [Array, String, Number],
},
fieldName: {
type: Object,
......@@ -236,7 +235,7 @@ export default {
});
}
},
handleSelectChange(e) {
handleSelectChange(e, d) {
this.$emit("input", e);
if (isFunction(this.$listeners?.change)) {
this.$listeners.change(e);
......
......@@ -5,7 +5,7 @@ const path = require("path");
const { getAxiosConfigKey } = require("./resolveApiName");
const DEFAULT_CONFIG_URL = process.env.VUE_APP_CONFIG_CENTER_URL
|| "https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config";
|| "https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config";
const DEVELOP_CONFIG_PATH = path.join(__dirname, "../../common/baseConfig.develop.json");
......
......@@ -5,34 +5,34 @@
const API_NAME_MAPPING = {
"dj.smartcarlife": "axios",
dj: "axios",
scrm: "axios2",
merchants: "axios3",
reportExport: "axios4",
"dj": "axios",
"scrm": "axios2",
"merchants": "axios3",
"reportExport": "axios4",
"glsx.accounts.biz.common.pictureUpload": "common",
clue: "axios5",
"clue": "axios5",
"dj.businessSchool": "axios6",
script: "axios7",
staff: "axios9",
riskmanage: "axios10",
strategy: "axios_strategy",
supervisor: "axios_supervisor",
oaapproval: "axios_oaapproval",
taskcenter: "axiosTaskCenter",
"script": "axios7",
"staff": "axios9",
"riskmanage": "axios10",
"strategy": "axios_strategy",
"supervisor": "axios_supervisor",
"oaapproval": "axios_oaapproval",
"taskcenter": "axiosTaskCenter",
};
const SIGN_WAY = {
"dj.smartcarlife": "sha1",
dj: "sha1",
scrm: "sha1",
glsx: "md5",
"dj": "sha1",
"scrm": "sha1",
"glsx": "md5",
"glsx.accounts.biz.common.pictureUpload": "md5",
clue: "sha1",
script: "sha1",
staff: "sha1",
riskmanage: "sha1",
oaapproval: "sha1",
taskcenter: "sha1",
"clue": "sha1",
"script": "sha1",
"staff": "sha1",
"riskmanage": "sha1",
"oaapproval": "sha1",
"taskcenter": "sha1",
};
/**
......@@ -77,7 +77,7 @@ function resolveApiName(method = "") {
if (method.includes("dj.api.taskcenter")) {
return "taskcenter";
}
if (method.includes("merchants.api.open.createMerchantWithPermissions")) {
if (method.includes("merchants.api.open.createMerchantWithPermissions") || method.includes("merchants.api.oaapproval")) {
return "oaapproval";
}
if (method.includes("dj.api.marketing")) {
......
......@@ -9,13 +9,13 @@ import store from "@/store";
axios.defaults.withCredentials = true;
// const expiresMinute = 60 // 过期时间(分钟)
// 创建一个错误
export function errorCreate (msg) {
export function errorCreate(msg) {
const error = new Error(msg);
errorLog(error);
throw error;
}
// 记录和显示错误
function errorLog (error) {
function errorLog(error) {
console.log("error", error.toString(), error);
// 添加到日志
store.dispatch("d2admin/log/push", {
......@@ -148,7 +148,9 @@ service.interceptors.response.use(
return errorCreate("登录超时,请重新登录");
// return Promise.reject(new Error(response.message || 'Error'))
}
if (returnAll) return dataAxios;
if (returnAll) {
return dataAxios;
}
const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode;
switch (+codeValue) {
case ruleResult.code_success_value:
......@@ -224,8 +226,9 @@ service.interceptors.response.use(
if (!error.config?.skipGlobalLoading) {
store.commit("d2admin/loading/set", false);
}
if (!error.__CANCEL__)
errorLog(error); // 取消请求 不做错误提示
if (!error.__CANCEL__) {
errorLog(error);
} // 取消请求 不做错误提示
return Promise.reject(error);
},
);
......
......@@ -748,6 +748,11 @@ export const routerName = {
parentId: "9031803",
name: "商品查看",
},
{
authId: "90318102",
parentId: "9031803",
name: "常规商品详情",
},
],
},
{
......@@ -761,6 +766,11 @@ export const routerName = {
name: "商品编辑",
parentId: "90318",
},
{
authId: "90318101",
parentId: "9031803",
name: "常规上架",
},
],
},
{
......@@ -780,7 +790,7 @@ export const routerName = {
90318101: {
path: "/goods-shelf/normal-modify",
name: "goodsShelfNormalCreate",
name: "goodsShelfNormalModify",
meta: {
title: "常规上架",
authId: "90318101",
......@@ -790,6 +800,19 @@ export const routerName = {
},
component: _import("goods/shelfProduct/view/normalModify/index"),
},
// 常规商品详情
90318102: {
path: "/goods-shelf/normal-detail",
name: "goodsShelfNormalDetail",
meta: {
title: "常规上架详情",
authId: "90318102",
parentId: "90318",
sideHidden: true,
activePath: "/goods-shelf",
},
component: _import("goods/shelfProduct/view/normalDetail/index"),
},
9031802: {
path: "/goods-shelf/modify",
......@@ -803,6 +826,7 @@ export const routerName = {
},
component: _import("goods/shelfProduct/view/modify/index"),
},
// 特殊商品详情
9031805: {
path: "/goods-shelf/detail",
name: "goodsShelfDetail",
......
......@@ -91,9 +91,9 @@
</div>
<div class="drawer-footer">
<el-button @click="handleClose">
取消
{{ readonly ? "关闭" : "取消" }}
</el-button>
<el-button v-if="drawerMode === 'approve'"
<el-button v-if="!readonly && drawerMode === 'approve'"
type="primary"
:loading="submitting"
@click="handleSubmit">
......@@ -147,6 +147,10 @@ export default {
type: Object,
default: null,
},
readonly: {
type: Boolean,
default: false,
},
},
data() {
const validateRemark = (rule, value, callback) => {
......@@ -274,6 +278,9 @@ export default {
},
},
drawerMode() {
if (this.readonly) {
return "view";
}
return getDrawerMode(this.detailInfo);
},
showSecondRoundSection() {
......
......@@ -97,6 +97,13 @@
</template>
<template slot="auth-button" slot-scope="scope">
<el-button
v-if="canViewProcessRow(scope.scope)"
type="text"
@click="handleViewProcess(scope.scope)"
>
查看
</el-button>
<el-button
v-if="canProcessRow(scope.scope)"
type="text"
@click="handleProcess(scope.scope)"
......@@ -231,6 +238,7 @@
<abnormal-flow-process-drawer
:visible.sync="processDrawerVisible"
:row-data="currentProcessRow"
:readonly="processDrawerReadonly"
@success="handleProcessSuccess"
/>
<template slot="footer">
......@@ -278,6 +286,7 @@ export default {
lockSwitchLoading: false,
previousLockFlag: "N",
processDrawerVisible: false,
processDrawerReadonly: false,
currentProcessRow: null,
// Confirm Dialog Data
......@@ -432,7 +441,7 @@ export default {
transactionTableParams: {
listName: "list",
tableOption: {
width: "100px",
width: "140px",
fixed: "right"
},
tableColumns: [
......@@ -666,9 +675,15 @@ export default {
}
return Number(row.declarationApprovalStatus) === APPROVAL_STATUS.WAIT_BACKEND
},
canViewProcessRow(row) {
if (!row || !row.declarationId) {
return false
}
return getApprovalStatusMeta(row.declarationApprovalStatus).label !== "-"
},
async fetchShopLockConfig() {
const { merchantId, merchantName } = this.routerInfo
if (!merchantId) {
const { merchantId, merchantName, storeType } = this.routerInfo
if (!merchantId || storeType === undefined || storeType === "") {
return
}
try {
......@@ -676,7 +691,7 @@ export default {
const res = await getShopLockConfig({
merchantId,
merchantName,
storeType: 0
storeType
})
const lockFlag = res && res.lockFlag ? res.lockFlag : "N"
this.abnormalFlowLockFlag = lockFlag
......@@ -689,12 +704,17 @@ export default {
},
async handleLockSwitchChange(val) {
const prev = this.previousLockFlag
const { merchantId, merchantName } = this.routerInfo
const { merchantId, merchantName, storeType } = this.routerInfo
if (!merchantId || storeType === undefined || storeType === "") {
this.$message.warning("缺少门店类型参数,无法修改异常流水开关")
this.abnormalFlowLockFlag = prev
return
}
try {
await saveShopLockConfig({
merchantId,
merchantName,
storeType: 0,
storeType,
lockFlag: val
})
this.previousLockFlag = val
......@@ -708,11 +728,17 @@ export default {
this.abnormalFlowLockFlag = prev
}
},
handleViewProcess(row) {
this.processDrawerReadonly = true
this.currentProcessRow = row
this.processDrawerVisible = true
},
handleProcess(row) {
if (!this.canProcessRow(row)) {
this.$message.warning("仅待后台审批的报备可处理")
return
}
this.processDrawerReadonly = false
this.currentProcessRow = row
this.processDrawerVisible = true
},
......
......@@ -476,6 +476,7 @@ export default {
query: {
merchantId: row.merchantId,
merchantName: row.merchantName,
storeType: row.storeType,
startTime: this.searchFormSearch.startTime,
endTime: this.searchFormSearch.endTime
}
......
......@@ -189,15 +189,27 @@ export function postReconciliationConfigOtherGoodsApi(data = {}) {
return request(data, RequestMethods.POST);
}
// 获取 product 的 原上架id用的列表
// 获取 product 的 原上架id用的列表 - 商品
export function postProductOldMerchantGoodsCodeList(data = {}) {
data.method = "dj.api.marketing.goods.page";
return request(data, RequestMethods.POST);
}
// 获取 product 的 原上架id用的列表 - 套餐
export function postComboOldMerchantGoodsCodeList(data = {}) {
data.method = "dj.api.marketing.package.page";
return request(data, RequestMethods.POST);
}
// 获取 服务项目
export function postProductServiceList(data = {}) {
// 只要膜类
data.categoryId = 1;
return getServiceItem(data);
}
// 获取 服务项目
export function postProductCostCalculateApi(data = {}) {
data.method = "dj.api.smartcarlife.merchantGoodsInfo.productCost.calculate";
return request(data, RequestMethods.POST);
}
......@@ -3,8 +3,10 @@
<div v-if="form.groupType !== 1" style="display: flex">
<el-form-item label="分账品类"
prop="specialDetail.categoryType">
<!-- 5.8.4 禁止修改 -->
<el-select v-model="form.categoryType"
style="width:414px"
disabled
@change="handleCategoryTypeChange">
<el-option v-for="item in options.categoryType"
:key="item.value"
......@@ -17,12 +19,14 @@
label-width="12px"
prop="specialDetail.goodsTypeGroupRelationList"
required>
<!-- 5.8.4 禁止修改 -->
<RemoteSelect v-if="form.categoryType === 2"
:key="form.categoryType"
v-model="form.goodsTypeGroupRelationList"
placeholder="请选择商品"
style="width:390px"
value-key="merchantGoodsCode"
disabled
:fetch-api="fetchUpgradeGoodsList"
:field-name="{
value: 'merchantGoodsCode',
......@@ -37,6 +41,7 @@
}"
:options.sync="options.upgradeGoods">
</RemoteSelect>
<!-- 5.8.4 禁止修改 -->
<RemoteSelect v-if="form.categoryType === 3"
:key="form.categoryType"
ref="packageGoods"
......@@ -44,6 +49,7 @@
placeholder="请选择套餐"
style="width:390px"
value-key="packageCode"
disabled
:fetch-api="getPackagesGoodsList"
:field-name="{
value: 'packageCode',
......
......@@ -135,23 +135,24 @@
<span class="label">
{{ item.title }}
</span>
<span v-if="(item.groupType !== 1) && useEdit && isView(editState)"
<!-- 5.8.4 取消删除 -->
<!-- <span v-if="(item.groupType !== 1) && useEdit && isView(editState)"
class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(item)">
</span>
</span> -->
</div>
</el-option>
</el-select>
</div>
<span v-if="useEdit && editState === VIEW_MODE.VIEW" class="actions-wrapper">
<!-- 5.8.4 取消新增 -->
<!-- <span v-if="useEdit && editState === VIEW_MODE.VIEW" class="actions-wrapper">
<el-button icon="el-icon-plus"
size="small"
plain
@click="handleAppendSpecialCategory">
新增
</el-button>
</span>
</span> -->
</div>
<div v-if="tabsActive" class="public-container">
......
......@@ -3,8 +3,10 @@
<div v-if="form.groupType !== 1" style="display: flex">
<el-form-item label="分账品类"
prop="specialDetail.categoryType">
<!-- 5.8.4 禁止修改 -->
<el-select v-model="form.categoryType"
style="width:414px"
disabled
@change="handleCategoryTypeChange">
<el-option v-for="item in options.categoryType"
:key="item.value"
......@@ -18,13 +20,14 @@
label-width="12px"
prop="specialDetail.goodsTypeGroupRelationList"
required>
<!-- 5.8.4 取消修改 -->
<RemoteSelect v-if="form.categoryType === 2"
:key="form.categoryType"
v-model="form.goodsTypeGroupRelationList"
placeholder="请选择商品"
style="width:390px"
value-key="merchantGoodsCode"
disabled
:fetch-api="fetchUpgradeGoodsList"
:field-name="{
value: 'merchantGoodsCode',
......@@ -39,6 +42,7 @@
}"
:options.sync="options.upgradeGoods">
</RemoteSelect>
<!-- 5.8.4 取消修改 -->
<RemoteSelect v-if="form.categoryType === 3"
:key="form.categoryType"
ref="packageGoods"
......@@ -46,6 +50,7 @@
placeholder="请选择套餐商品"
style="width:390px"
value-key="packageCode"
disabled
:fetch-api="fetchPackagesGoodsList"
:field-name="{
value: 'packageCode',
......
......@@ -102,23 +102,26 @@
<span class="label">
{{ item.title }}
</span>
<span v-if="useEdit && isView(editState) && item.groupType !== 1"
<!-- 5.8.4 取消删除功能 -->
<!-- <span v-if="useEdit && isView(editState) && item.groupType !== 1"
class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(item)">
</span>
</span> -->
</div>
</el-option>
</el-select>
</div>
<span v-if="useEdit && isView(editState)" class="actions-wrapper">
<!-- 5.8.4 取消删除新增 -->
<!-- <span v-if="useEdit && isView(editState)" class="actions-wrapper">
<el-button icon="el-icon-plus"
size="small"
plain
@click="handleAppendSpecialCategory">
新增
</el-button>
</span>
</span> -->
</div>
<div v-if="tabsActive" class="public-container">
......@@ -232,6 +235,8 @@ export default {
form: {
firstLineSunshineOnlinePointsFlag: "N",
firstLineSunshine2OnlinePointsFlag: "N",
managementMarketingFeesPrerequisite: "N",
firstLineSunshinePrerequisite: "N",
operationMode: undefined,
specialDetail: {
categoryType: undefined,
......@@ -241,17 +246,20 @@ export default {
},
},
rules: {
// 一线阳光是否开启线上积分
"firstLineSunshineOnlinePointsFlag": [
{ required: true, trigger: "change" },
{ required: true, message: "请选择一线阳光是否开启线上积分", trigger: "change" },
],
"firstLineSunshine2OnlinePointsFlag": [
{ required: true, trigger: "change" },
{ required: true, message: "请选择一线阳光2是否开启线上积分", trigger: "change" },
],
// 管理层市场费是否前置
"managementMarketingFeesPrerequisite": [
{ required: true, trigger: "change" },
{ required: true, message: "请选择管理层市场费是否前置", trigger: "change" },
],
// 请选择一线阳光是否前置
"firstLineSunshinePrerequisite": [
{ required: true, trigger: "change" },
{ required: true, message: "请选择一线阳光是否前置", trigger: "change" },
],
"specialDetail.categoryType": [
{ required: true, message: "请选择分账品类", trigger: "change" },
......
......@@ -11,7 +11,6 @@
:merchant-id-list="merchantIdList"
:product="productData"
:shelf-type="shelfType"
:show-business-line="false"
:show-gift-cost="false"
:show-old-merchant-goods-code="false"
......@@ -19,7 +18,6 @@
:show-sales-proportion-percent="false"
:show-settlement-type="false"
:show-shelf-style="false"
@update:upgradeGoods="handleUpdateProduct($event, index)" />
<el-divider class="divider"></el-divider>
</div>
......
......@@ -39,20 +39,23 @@
</el-radio-group>
</el-form-item>
</el-col>
<!-- TODO: 且上架类型的值 为 修改 才显示 -->
<!-- 单店模式 且 类型 为修改 -->
<el-col v-if="isSingleShopMode(shelfType) && isShelfStyleEdit(packageForm.shelfStyle)" :span="12">
<el-form-item label="原上架ID:"
prop="oldMerchantGoodsCode"
:rules="[{ required: true, message: '请选择原上架ID', trigger: 'change' }]">
<el-select v-model="packageForm.oldMerchantGoodsCode"
placeholder="请选择">
<el-option v-for="item in options.serviceList"
:key="item.id"
:label="item.serviceItemsName"
:value="item.id">
</el-option>
</el-select>
<RemoteSelect v-model="packageForm.oldMerchantGoodsCode"
placeholder="原上架ID"
:fetch-api="fetchMerchantGoodsCode"
:field-name="{
value: 'packageId',
label: 'packageId',
}"
:immediate="true"
:multiple="false"
:options.sync="options.oldMerchantGoodsCode">
</RemoteSelect>
</el-form-item>
</el-col>
......@@ -68,20 +71,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售占比:" prop="salesProportionPercent">
<div class="form-item-append-fix">
<VenusNumberInput v-model="packageForm.salesProportionPercent"
placeholder="请输入销售占比"
:controls="false"
:max="100"
:min="0"
:precision="2">
</VenusNumberInput>
<span class="fix-symbol">%</span>
</div>
</el-form-item>
</el-col>
<el-col title="按子商品的售价进行累计,实时计算" :span="12">
<el-form-item label="售价/件:" prop="sellPrice">
......@@ -146,21 +135,6 @@
</div>
</el-form-item>
</el-col>
<el-col v-if="isQualityUpgrade(baseSceneCode)"
title="按子商品的回收成本进行累计,实时计算"
:span="12">
<el-form-item label="回收成本:" prop="recoveryCost">
<div class="form-item-append-fix">
<VenusNumberInput disabled
:controls="false"
:min="0"
:precision="2"
:value="getSumValue.totalRecoveryCost">
</VenusNumberInput>
<span class="fix-symbol">元</span>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
......@@ -180,8 +154,9 @@
:base-scene-code="baseSceneCode"
:disabled-positions="getProductDisabledPositions(goodsForm.upgradeGoodsId, goodsForm.merchantGoodsCode)"
:edit-state="VIEW_MODE.EDIT"
:merchant-id="merchantId"
:merchant-id-list="merchantIdList"
:product.sync="goodsForm"
:product.sync="productList[index]"
:shelf-type="shelfType"
:show-gift-cost="false"
:show-old-merchant-goods-code="false"
......@@ -202,8 +177,10 @@
import { cloneDeep, isFunction, pick, reduce } from "lodash-es";
import { nanoid } from "nanoid";
import { settlementTypeOpt } from "@/common/constants.js";
import RemoteSelect from "@/components/remoteSearchSelect/index.vue";
import VenusNumberInput from "@/components/venusNumberInput/index.vue";
import { baseConfig } from "@/main";
import { postComboOldMerchantGoodsCodeList } from "@/views/goods/shelfProduct/api";
import { shelfStyleOptions, VIEW_MODE } from "@/views/goods/shelfProduct/constant/index";
import { isMemberRightsUpgrade, isQualityUpgrade, isShelfStyleEdit, isSingleShopMode, isSolarFilm, isUpgradeProductCostStyleCustom, isUpgradeProductCostStyleDefault } from "@/views/goods/shelfProduct/utils/status.js";
import Product from "../../../product/index.vue";
......@@ -213,12 +190,17 @@ export default {
components: {
Product,
VenusNumberInput,
RemoteSelect,
},
props: {
merchantIdList: {
type: Array,
required: true,
},
merchantId: {
type: [Number, Array],
required: true,
},
baseSceneCode: {
type: String,
required: true,
......@@ -241,6 +223,7 @@ export default {
options: {
settlementType: settlementTypeOpt,
shelfStyleOptions,
oldMerchantGoodsCode: [],
},
dialog: {
selectGoods: {
......@@ -272,7 +255,7 @@ export default {
res[2] += (item.upgradeGoods.djCost ?? 0) * 100;
res[3] += (item.thirdPartyCost ?? 0) * 100;
res[4] += (item.upgradeProductCost ?? 0) * 100;
res[5] += (item.recoveryCost ?? 0) * 100;
// res[5] += (item.recoveryCost ?? 0) * 100;
return res;
}, [0, 0, 0, 0, 0, 0]);
return {
......@@ -281,7 +264,7 @@ export default {
totalDjCost: sum[2] / 100,
totalThirdPartyCost: sum[3] / 100,
totalUpgradeProductCost: sum[4] / 100,
totalRecoveryCost: sum[5] / 100,
// totalRecoveryCost: sum[5] / 100,
};
},
......@@ -308,6 +291,21 @@ export default {
isQualityUpgrade,
isSolarFilm,
isSingleShopMode,
async fetchMerchantGoodsCode({ pageQuery }) {
const res = await postComboOldMerchantGoodsCodeList({
...pageQuery,
merchantIds: Array.isArray(this.merchantId) ? this.merchantId : [this.merchantId],
baseSceneCode: this.baseSceneCode,
productName: pageQuery.searchValue,
});
return {
list: res.list,
query: {
pages: res.pages,
total: res.total,
},
};
},
getProductDisabledPositions(upgradeGoodsId, excludeMerchantGoodsCode) {
return this.productList.filter(item => item.upgradeGoodsId === upgradeGoodsId && item.merchantGoodsCode !== excludeMerchantGoodsCode).map(item => item.detailList?.[0]?.position);
},
......@@ -324,7 +322,6 @@ export default {
upgradeCommodityCode: upgradeGoods.commodityCode,
upgradeGoodsId: upgradeGoods.id,
upgradeGoodsName: upgradeGoods.upgradeGoodsName,
});
}
},
......
......@@ -68,18 +68,23 @@ export default {
computed: {
filterSchema() {
return this.schema.filter((item) => {
// 结算方式
if (item.name === "settlementType") {
return this.showSettlementType;
}
// 销售占比
if (item.name === "salesProportionPercent") {
return this.showSalesProportionPercent;
}
// 上架类型
if (item.name === "shelfStyle") {
return this.showShelfStyle;
}
// 原上架id
if (item.name === "oldMerchantGoodsCode") {
return this.showOldMerchantGoodsCode;
}
// 赠送成本
if (item.name === "detailList.0.giftCost") {
return this.showGiftCost;
}
......
......@@ -62,6 +62,7 @@ export default {
if (!commodityCode) {
return;
}
// 查询运营成本
const { operationCost } = await getOperationCost({
commodityCode,
merchantIdList: this.merchantIdList,
......@@ -75,7 +76,6 @@ export default {
},
// product.detailList[0].upgradeGoods.commodityCode
async validate() {
console.log("进得来?");
const modifyRef = this.$refs.modifyRef;
if (!modifyRef) {
// 尚未初始化
......
......@@ -11,7 +11,8 @@
<div v-if="showDialog"
v-loading="loading"
class="selected-product-wrapper">
<d2-search class="show-search"
<d2-search v-if="table.formSchema.length"
class="show-search"
label-width="100px"
:form-data="table.formSchema"
:search-form="table.form">
......@@ -57,6 +58,9 @@
@change="handleGoodsCascaderChange($event)">
</el-cascader>
</template>
<template #supplierCode>
<remote-select v-model="table.form.supplierCode"></remote-select>
</template>
</d2-search>
<div class="up-btns">
<el-button :id="table.props.btnId"
......@@ -181,6 +185,7 @@ export default {
goodsName: "",
baseGoodsCommodityCode: "",
tempGoodsType: [],
supplierCode: "",
},
props: selectGoodsTableSchema,
api: getUpgradeProductList,
......@@ -215,7 +220,7 @@ export default {
this.selectedId = this.activeId;
await this.getSelectedRow();
// this.keyDowmGetList 不知道在哪里设置的全局变量. 原有组件中需要传入
this.table.formSchema = getSelectGoodsTableFilterSchema(this.keyDowmGetList);
this.table.formSchema = await getSelectGoodsTableFilterSchema(this.keyDowmGetList);
await this.getOptionsList();
} finally {
this.loading = false;
......@@ -262,6 +267,9 @@ export default {
this.table.form[key] = e.replace(/[^a-z0-9]/gi, "");
}
},
keyDowmGetList() {
this.$refs?.tableRef?.refreshTable();
},
async getOptionsList() {
// 获取全部类目 屏蔽服务商自建类目
const res = await getAllCategory({ categoryTypeList: baseConfig.selfBuildGoodsType, pageSize: 9999, currentPage: 1 });
......
......@@ -22,15 +22,17 @@
<span class="label">
{{ row.productName }}
</span>
<span v-if="useEdit && isView(editState)"
<!-- 5.8.4 不允许删除 -->
<!-- <span v-if="useEdit && isView(editState)"
class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(row)">
</span>
</span> -->
</div>
</template>
</RemoteSelect>
</div>
<div v-if="useEdit && isView(editState)" class="actions-wrapper">
<!-- 5.8.4 取消新增功能 -->
<!-- <div v-if="useEdit && isView(editState)" class="actions-wrapper">
<el-dropdown @command="handleAppendProductPackages">
<el-button size="small" plain>
新增
......@@ -47,7 +49,7 @@
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div> -->
</div>
<div class="content-wrapper">
......@@ -84,6 +86,7 @@
ref="productRefs"
:base-scene-code="baseSceneCode"
:edit-state="editState"
:merchant-id="merchantId"
:merchant-id-list="merchantIdList"
:product="productDetail || { detailList: [] }"
:shelf-type="shelfType"
......@@ -93,6 +96,7 @@
ref="packageRefs"
:base-scene-code="baseSceneCode"
:edit-state="editState"
:merchant-id="merchantId"
:merchant-id-list="merchantIdList"
:packages="productDetail || { detailList: [] }"
:prefix="$data._prefix"
......@@ -151,6 +155,10 @@ export default {
type: String,
required: true,
},
merchantId: {
type: [Number, Array],
required: true,
},
shelfType: {
type: Number,
required: true,
......@@ -246,10 +254,27 @@ export default {
// 获取 某个商品/套餐 详情
async getProductPackageDetail(id) {
const detail = await getProductPackagesDetailApi({ id });
// 如果是商品
if (detail.productType === 1) {
// 商品在这个层级依赖
detail.upgradeGoodsId = detail.detailList[0].upgradeGoodsId;
// 若无嘀加成本则默认=0
if (detail?.detailList?.[0]?.upgradeGoods) {
if (!detail?.detailList?.[0]?.upgradeGoods?.djCost) {
detail.detailList[0].upgradeGoods.djCost = 0;
}
}
// 5.8.6 若产品供应方=广联直营,则第三方成本默认=0且不可编辑
if (detail?.detailList?.[0]?.supplyFlag === 1) {
// 第三方成本
detail.detailList[0].thirdPartyCost = 0;
}
// ●赠送成本(仅精品升级场景存在)
// ○根据根据“商品上架表”,即上架商品匹配行中取对应的“是否作为赠送产品”
// TODO 5.8.6 ○若是则自动带入对应的产品、升级成本,成本的获取方式与产品、升级成本一致;
// TODO 5.8.6 ○若否则默认为空
}
detail.shelfType = this.shelfType;
detail.baseSceneCode = this.baseSceneCode;
return detail;
......
import { getBrandSupplyMerchant } from "@api/product";
import { get } from "lodash-es";
import { nanoid } from "nanoid";
import { BaseData, settlementTypeOpt } from "@/common/constants";
import { isZeroOrNumber } from "@/libs/number";
import store from "@/store";
import { convertYuanToWan, filterSpecsStr } from "@/views/goods/filterOption";
import { inventoryTypeOption, shelfStyleOptions } from "@/views/goods/shelfProduct/constant";
import {
inventoryTypeOption,
productCostStyleOpt,
shelfStyleOptions,
} from "@/views/goods/shelfProduct/constant";
import { isExtendedWarranty, isMembraneType, isOfficialRightsService, isThirdPart } from "@/views/goods/shelfProduct/utils/businessCheck";
import { schemaSumBy } from "@/views/goods/shelfProduct/utils/calc";
......@@ -64,7 +69,6 @@ export async function getProductDetailDescriptionSchema(shelfType) {
},
isHide({ formModel }) {
const goodsType = getUpgradeGoods(formModel)?.goodsInfo?.goodsType;
// 不是太阳膜类型的 隐藏
return !(isSolarFilm(goodsType));
},
......@@ -82,7 +86,7 @@ export async function getProductDetailDescriptionSchema(shelfType) {
);
},
isHide({ formModel }) {
// 单店模式才存在;
// 单店模式存在
return !(isSingleShopMode(shelfType));
},
},
......@@ -92,16 +96,15 @@ export async function getProductDetailDescriptionSchema(shelfType) {
label: "原上架ID",
col: 12,
render(h, { data, schemaItem }) {
// const value = get(data, schemaItem.name);
// const item = value && shelfStyleOptions.find(item => item.value === value);
const value = get(data, schemaItem.name);
return h(
"span",
"动态获取" || "-",
value || "-",
);
},
isHide({ formModel }) {
// 单店模式 且 shelfStyle === 修改才存在
return !(isSingleShopMode(shelfType) && !isShelfStyleEdit(formModel.shelfStyle));
return !(isSingleShopMode(shelfType) && isShelfStyleEdit(formModel.shelfStyle));
},
},
......@@ -123,6 +126,31 @@ export async function getProductDetailDescriptionSchema(shelfType) {
);
},
},
{
name: "detailList.0.serviceItem",
label: "服务项目",
col: 12,
render(h, { data, schemaItem }) {
const value = get(data, schemaItem.name);
return h(
"div",
{
attrs: {
title: value,
},
class: "text-hide",
},
value || "-",
);
},
isHide({ formModel }) {
const goodsType = getUpgradeGoods(formModel)?.goodsInfo?.goodsType;
// 不是太阳膜类型的 隐藏
return !(isSolarFilm(goodsType));
},
},
// 套餐加载时不显示
{
name: "settlementType",
......@@ -150,19 +178,6 @@ export async function getProductDetailDescriptionSchema(shelfType) {
);
},
},
// 套餐加载时不显示
{
name: "salesProportionPercent",
label: "销售占比",
col: 12,
render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name));
return h(
"span",
value === "-" ? value : `${value}%`,
);
},
},
{
name: "detailList.0.sellPrice",
label: "售价/件",
......@@ -240,23 +255,38 @@ export async function getProductDetailDescriptionSchema(shelfType) {
},
{
name: "detailList.0.recoveryCost",
label: "回收成本",
name: "detailList.0.upgradeProductCostStyle",
label: "产品、升级成本/件",
col: 12,
render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name));
const value = get(data, schemaItem.name);
const item = productCostStyleOpt.find(item => item.value === value);
return h(
"span",
value === "-" ? value : `${value}元`,
// priceFilter(data.recoveryCost),
item?.label || "-",
// priceFilter(data.upgradeProductCost),
);
},
isHide({ formModel }) {
// 仅精品升级场景存在
return !(isQualityUpgrade(formModel.baseSceneCode));
},
},
// {
// name: "detailList.0.recoveryCost",
// label: "回收成本",
// col: 12,
// render(h, { data, schemaItem }) {
// const value = isZeroOrNumber(get(data, schemaItem.name));
// return h(
// "span",
// value === "-" ? value : `${value}元`,
// // priceFilter(data.recoveryCost),
// );
// },
// isHide({ formModel }) {
// // 仅精品升级场景存在
// return !(isQualityUpgrade(formModel.baseSceneCode));
// },
// },
// 套餐加载时不展示
{
name: "detailList.0.giftCost",
......@@ -551,6 +581,18 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
);
},
},
{
name: "detailList.0.upgradeGoods.purchaseCost",
label: "采购成本/元",
col: 8,
render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name));
return h(
"span",
value === "-" ? value : `${value}元`,
);
},
},
];
}
......@@ -615,16 +657,16 @@ export async function getPackagesDetailDescriptionSchema(shelfType) {
label: "原上架ID",
col: 12,
render(h, { data, schemaItem }) {
// const value = get(data, schemaItem.name);
const value = get(data, schemaItem.name);
// const item = value && shelfStyleOptions.find(item => item.value === value);
return h(
"span",
"动态获取" || "-",
value || "-",
);
},
isHide({ formModel }) {
// 单店模式 且 shelfStyle === 修改才存在
return !(isSingleShopMode(shelfType) && !isShelfStyleEdit(formModel.shelfStyle));
return !(isSingleShopMode(shelfType) && isShelfStyleEdit(formModel.shelfStyle));
},
},
{
......@@ -640,18 +682,18 @@ export async function getPackagesDetailDescriptionSchema(shelfType) {
);
},
},
{
name: "salesProportionPercent",
label: "销售占比",
col: 12,
render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name));
return h(
"span",
value === "-" ? value : value + "%",
);
},
},
// {
// name: "salesProportionPercent",
// label: "销售占比",
// col: 12,
// render(h, { data, schemaItem }) {
// const value = isZeroOrNumber(get(data, schemaItem.name));
// return h(
// "span",
// value === "-" ? value : value + "%",
// );
// },
// },
{
name: "sellPrice",
label: "售价/件",
......@@ -701,19 +743,19 @@ export async function getPackagesDetailDescriptionSchema(shelfType) {
return h("span", value);
},
},
{
name: "recoveryCost",
label: "回收成本",
col: 12,
isHide({ formModel }) {
// 仅精品升级场景存在;
return !(isQualityUpgrade(formModel.baseSceneCode));
},
render(h, { data, schemaItem }) {
const value = schemaSumBy(data.detailList, schemaItem.name);
return h("span", value);
},
},
// {
// name: "recoveryCost",
// label: "回收成本",
// col: 12,
// isHide({ formModel }) {
// // 仅精品升级场景存在;
// return !(isQualityUpgrade(formModel.baseSceneCode));
// },
// render(h, { data, schemaItem }) {
// const value = schemaSumBy(data.detailList, schemaItem.name);
// return h("span", value);
// },
// },
];
}
......@@ -777,6 +819,15 @@ export const selectGoodsTableSchema = {
},
},
{
label: "采购成本/元",
prop: "purchaseCost",
width: 100,
formatter: (row) => {
const value = isZeroOrNumber(row.purchaseCost);
return value === "-" ? value : `${value}元`;
},
},
{
label: "适用区域",
prop: "upgradeGoodsAreaList",
width: 180,
......@@ -834,7 +885,10 @@ export const selectGoodsTableSchema = {
};
// 选择商品表格筛选项
export function getSelectGoodsTableFilterSchema(keyDownGetList) {
export async function getSelectGoodsTableFilterSchema(keyDownGetList) {
// 获取品牌方 / 供应方数据 1 - 品牌商 ; 2 - 供应方
const supplierCodeList = await getBrandSupplyMerchant({ partitionFlag: 2 });
console.log("supplierCodeList", supplierCodeList);
return [
{
label: "产品名称",
......@@ -893,5 +947,13 @@ export function getSelectGoodsTableFilterSchema(keyDownGetList) {
name: "goodsType",
addHtml: "goodsCascader",
},
{
label: "供应商",
name: "supplierCode",
type: "select",
optionList: supplierCodeList,
optionId: "id",
optionLabel: "relatedPartyName",
},
];
}
......@@ -140,36 +140,91 @@ export async function getShelfProductImportSchema() {
col: 24,
render(h, { data }) {
const fileName = last(data?.goodsCreateExcel?.split("/"));
// 利润率测算表
const onShelvesExcel = last(data?.onShelvesExcel?.split("/"));
return h(
"div",
{
attrs: {
title: fileName,
},
style: {
display: "flex",
"display": "flex",
"flex-direction": "column",
"align-items": "flex-start",
},
},
[
// 商品上架表
h(
"span",
"div",
{
class: "text-hide",
attrs: {
title: fileName,
},
style: {
"max-width": "400px",
"display": "inline-block",
"display": "flex",
"align-items": "center",
},
},
fileName,
),
h(
"el-link",
{
props: { type: "text", href: data?.goodsCreateExcel, target: "_blank" },
style: { "marginLeft": "8px", "line-height": 1 },
},
"下载",
[
h(
"span",
{
class: "text-hide",
style: {
"max-width": "400px",
"display": "inline-block",
},
},
fileName,
),
h(
"el-link",
{
props: { type: "text", href: data?.goodsCreateExcel, target: "_blank" },
style: { "marginLeft": "8px", "line-height": 1 },
},
"下载",
),
],
),
// 利润率测算表
onShelvesExcel
? h(
"div",
{
attrs: {
title: onShelvesExcel,
},
style: {
"display": "flex",
"align-items": "center",
"margin-top": "4px",
},
},
[
h(
"span",
{
class: "text-hide",
style: {
"max-width": "400px",
"display": "inline-block",
},
},
onShelvesExcel,
),
h(
"el-link",
{
props: { type: "text", href: data?.onShelvesExcel, target: "_blank" },
style: { "marginLeft": "8px", "line-height": 1 },
},
"下载",
),
],
)
: null,
],
);
},
......
export const statusOptions = [
{ value: 0, label: "草稿" },
{ value: 1, label: "待审核" },
{ value: 2, label: "已审核" },
{ value: 1, label: "商务审核" },
{ value: 2, label: "已完成" },
{ value: 3, label: "驳回" },
{ value: 5, label: "审核提交中" },
{ value: 6, label: "审核提交失败" },
{ value: 5, label: "数据处理中" },
{ value: 6, label: "数据处理失败" },
];
// 商品上架 业务场景 第0位必须是 精品升级
export const sceneTypeOptions = [
......@@ -15,6 +15,12 @@ export const sceneTypeOptions = [
{ value: "110202", label: "2.3.2 售后延保" },
];
// 商品上架 商品成本带入方式
export const productCostStyleOpt = [
{ value: 2, label: "默认带入产品成本" },
{ value: 1, label: "自定义成本" },
];
export const VIEW_MODE = {
EDIT: "edit",
VIEW: "view",
......@@ -40,7 +46,7 @@ export const realityShopLevelOptions = [
// 上架模式
export const shelfModelOptions = [
{ value: 1, label: "特殊商品上架" },
{ value: 2, label: "常规商品上架" },
{ value: 2, label: "常规上架" },
];
// 上架类型
......
......@@ -92,11 +92,20 @@ export function getTableFilterIds(baseSceneCode) {
return sceneTypeFilter[sceneType] || [];
}
// "产品成本获取方式 1-自定义成本 2-默认带入产品成本" -->
/**
* "产品成本获取方式 1-自定义成本
* @param {*} upgradeProductCostStyle
* @returns
*/
export function isUpgradeProductCostStyleCustom(upgradeProductCostStyle) {
return upgradeProductCostStyle === 1;
}
/**
* 产品成本获取方式 2-默认带入产品成本"
* @param {*} upgradeProductCostStyle
* @returns
*/
export function isUpgradeProductCostStyleDefault(upgradeProductCostStyle) {
return upgradeProductCostStyle === 2;
}
......@@ -104,7 +113,7 @@ export function isUpgradeProductCostStyleDefault(upgradeProductCostStyle) {
/**
* 是否直营
* 权益、延保 且 供应方=广联直营 0-否 1-是
* @returns Boolean
* @returns
*/
export function isDirectOperation(supplyFlag) {
return supplyFlag === 1;
......
......@@ -34,6 +34,7 @@
style="margin-top:20px">
<ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode"
:merchant-id="merchantIdList"
:shelf-type="shelfType"
:use-edit="false" />
</FormStep>
......@@ -118,12 +119,14 @@ export default {
baseSceneCode: undefined,
businessCode: undefined,
shelfType: undefined,
merchantIdList: undefined,
logList: [],
};
},
computed: {
isReadyForNextStep() {
return this.baseSceneCode && this.businessCode && this.shelfType;
return this.baseSceneCode && this.businessCode && this.shelfType && this.merchantIdList;
},
},
async created() {
......
......@@ -46,6 +46,7 @@
<FormStep v-loading="data.isStepLoading" name="ProductConfirm">
<ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode"
:merchant-id="merchantId"
:shelf-type="shelfType" />
</FormStep>
<FormStep v-loading="data.isStepLoading" name="ProfitSharingConfig">
......@@ -139,6 +140,10 @@ import ShelfProductImport from "../../components/shelfProductImport/index.vue";
// 业务层(FormStep + 各种组件)
// └── 只负责:输入 / 校验 / 数据
/**
* 特殊上架
*/
const shelfModel = 1;
export default {
name: "ShelfProductModify",
components: {
......@@ -218,9 +223,10 @@ export default {
});
},
async getStep() {
const { confirmStep } = await getShelfProductUpdateStep({
const { confirmStep, merchantId } = await getShelfProductUpdateStep({
businessCode: this.businessCode,
});
this.merchantId = merchantId;
return confirmStep - 1;
},
async beforeChangeStepBefore(isNext) {
......@@ -315,6 +321,8 @@ export default {
const fileExt = stepFormData.goodsCreateExcel.name.split(".");
const reqData = {
...stepFormData,
// 特殊上架
shelfModel,
file: last(fileExt) + "@" + arrBase64,
};
if (!reqData.businessCode) {
......
<template>
<d2-container v-loading="!isReadyForNextStep" class="detail-wrapper">
<FormProvider v-if="isReadyForNextStep"
class="form-provide-wrapper"
:use-edit="false">
<template #default="{ data }">
<FormStep name="ProductImport">
<ShelfProductImport ref="shelfProductImportRef"
:business-code="businessCode"
:use-edit="false" />
</FormStep>
<FormStep v-loading="data.getSomeItemStepLoading('ProductConfirm')"
name="ProductConfirm"
style="margin-top:20px">
<ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode"
:merchant-id="merchantIdList"
:shelf-type="shelfType"
:use-edit="false" />
</FormStep>
<!-- 5.8.4 批量模式没有这个 -->
<FormStep v-if="isSingleShopMode(shelfType)"
v-loading="data.getSomeItemStepLoading('ProfitMarginTable')"
name="ProfitMarginTable"
style="height:100%;margin-top:20px">
<ProfitMarginTable style="height:680px;overflow:hidden"
:business-code="businessCode"
:use-edit="false" />
</FormStep>
<FormStep v-loading="data.getSomeItemStepLoading('OperateOperateList')"
name="OperateList"
style="margin-top:20px">
<OperateList :log-list="logList" />
</FormStep>
<div style="text-align:center">
<el-button size="small"
style="width:60px"
type="info"
@click="handleBack">
返回
</el-button>
</div>
</template>
</FormProvider>
</d2-container>
</template>
<script>
import {
getShelfProductBaseInfoApi,
} from "@/views/goods/shelfProduct/api";
import { sceneTypeOptions } from "@/views/goods/shelfProduct/constant/index";
import { getMemberRightsUpgradeValue, isMemberRightsUpgrade, isQualityUpgrade, isSingleShopMode } from "@/views/goods/shelfProduct/utils/status";
import FormStep from "../../components/formProvider/formStep.vue";
import FormProvider from "../../components/formProvider/index.vue";
import OperateList from "../../components/operateList/index.vue";
import ProfitMarginTable from "../../components/profitMarginTable/index.vue";
import ProfitSharingConfig from "../../components/profitSharingConfig/index.vue";
import ReconciliationConfig from "../../components/reconciliationConfig/index.vue";
import ShelfProductConfirm from "../../components/shelfProductConfirm/index.vue";
import ShelfProductImport from "../../components/shelfProductImport/index.vue";
export default {
name: "",
components: {
OperateList,
ShelfProductImport,
ShelfProductConfirm,
ProfitMarginTable,
FormProvider,
FormStep,
},
props: {
},
data() {
return {
sceneTypeOptions,
baseSceneCode: undefined,
businessCode: undefined,
shelfType: undefined,
merchantIdList: undefined,
logList: [],
};
},
computed: {
isReadyForNextStep() {
return this.baseSceneCode && this.businessCode && this.shelfType && this.merchantIdList;
},
},
async created() {
this.baseSceneCode = this.$route.query.baseSceneCode;
this.businessCode = this.$route.query.businessCode;
this.shelfType = Number(this.$route.query.shelfType);
await this.$nextTick();
await this.getStep(this.businessCode);
},
mounted() {
},
methods: {
isSingleShopMode,
getMemberRightsUpgradeValue,
isMemberRightsUpgrade,
isQualityUpgrade,
async getStep(businessCode) {
const res = await getShelfProductBaseInfoApi({ businessCode });
if (!res.logList) {
res.logList = [];
}
Object.assign(this.$data, res);
},
handleBack() {
this.$router.back();
},
},
};
</script>
<style scoped lang="scss">
.detail-wrapper {
}
</style>
......@@ -33,7 +33,7 @@
<el-steps finish-status="success" :active="step.confirmStep">
<el-step title="1、商品上架表导入"></el-step>
<el-step title="2、上架商品确认"></el-step>
<el-step title="3、利润率测算"></el-step>
<el-step v-if="isSingleShopMode(shelfType)" title="3、利润率测算"></el-step>
</el-steps>
</div>
<div v-loading="data.isProviderLoading" class="wrapper">
......@@ -44,9 +44,9 @@
<FormStep v-loading="data.isStepLoading" name="ProductConfirm">
<ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode"
:merchant-id="merchantId"
:shelf-type="shelfType" />
</FormStep>
<FormStep v-loading="data.isStepLoading"
name="ProfitMarginTable"
style="height:100%">
......@@ -63,7 +63,7 @@
@click="handlePreviousSteps">
上一步
</VenusButton>
<VenusButton v-if="step.confirmStep < 2"
<VenusButton v-if="step.confirmStep < (isSingleShopMode(shelfType) ? 2 : 1)"
size="small"
type="primary"
:disabled="data.isEditing || data.isSaving"
......@@ -107,7 +107,7 @@ import {
} from "@/views/goods/shelfProduct/api";
import { sceneTypeOptions, VIEW_MODE } from "@/views/goods/shelfProduct/constant/index";
import { getMemberRightsUpgradeValue, isMemberRightsUpgrade, isQualityUpgrade } from "@/views/goods/shelfProduct/utils/status";
import { getMemberRightsUpgradeValue, isMemberRightsUpgrade, isQualityUpgrade, isSingleShopMode } from "@/views/goods/shelfProduct/utils/status";
import VenusButton from "../../components/btn/index.vue";
import FormStep from "../../components/formProvider/formStep.vue";
import FormProvider from "../../components/formProvider/index.vue";
......@@ -124,6 +124,10 @@ import ShelfProductImport from "../../components/shelfProductImport/index.vue";
// 业务层(FormStep + 各种组件)
// └── 只负责:输入 / 校验 / 数据
/**
* 常规上架
*/
const shelfModel = 2;
export default {
name: "ShelfProductModify",
components: {
......@@ -152,6 +156,7 @@ export default {
baseSceneCode: undefined,
businessCode: undefined,
shelfType: undefined,
merchantId: undefined,
};
},
......@@ -169,6 +174,7 @@ export default {
async created() {
this.setShelfProductInfo(this.$route.query);
await this.$nextTick();
// 如果是编辑
if (this.isReadyForNextStep) {
await this.init();
}
......@@ -182,6 +188,7 @@ export default {
getMemberRightsUpgradeValue,
isMemberRightsUpgrade,
isQualityUpgrade,
isSingleShopMode,
async withLoading(fn) {
if (!isFunction(fn)) {
return;
......@@ -200,18 +207,25 @@ export default {
});
},
async getStep() {
const { confirmStep } = await getShelfProductUpdateStep({
const { confirmStep, merchantId } = await getShelfProductUpdateStep({
businessCode: this.businessCode,
});
this.merchantId = merchantId;
// 常规上架特殊处理
if ((confirmStep - 1) > 2) {
return 2;
}
return confirmStep - 1;
},
async beforeChangeStepBefore(isNext) {
this.btnLoading = true;
try {
// 常规上架特殊处理
const confirmStep = this.step.confirmStep + 1;
await putShelfProductUpdateStep({
businessCode: this.businessCode,
nextStep: isNext,
confirmStep: this.step.confirmStep + 1,
confirmStep: confirmStep === 3 ? 5 : confirmStep,
});
} finally {
this.btnLoading = false;
......@@ -273,6 +287,8 @@ export default {
const fileExt = stepFormData.goodsCreateExcel.name.split(".");
const reqData = {
...stepFormData,
// 常规上架
shelfModel,
file: last(fileExt) + "@" + arrBase64,
};
if (!reqData.businessCode) {
......@@ -293,6 +309,7 @@ export default {
componentsRef.setImportProgressState("starting");
const that = this;
async function stopCondition([result]) {
console.log("stopCondition", result.progress);
// 更新数据
// 失败
componentsRef.setProgress(result.progress);
......@@ -301,11 +318,15 @@ export default {
await syncTime(500);
}
if (isSuccess(result.progress, result.failNum)) {
console.log("成功?");
componentsRef.setImportProgressState("success");
console.log("1?");
const res = await getShelfProductBaseInfoByUUIDApi({ uuid: result.uuid });
console.log("isSuccess", res);
console.log("isSuccess", that.baseSceneCode);
console.log("2?", res);
that.setShelfProductInfo(pick(res, "baseSceneCode", "businessCode", "shelfType"));
console.log("3?");
that.merchantId = res.merchantId;
return true;
}
if (isFail(result.progress, result.failNum)) {
......
......@@ -23,13 +23,13 @@
<div class="d2-container-content">
<d2-table-header>
<span style=" display:flex; gap:8px; ">
<!-- 常规上架 handleModify -->
<!-- 常规上架 handleNormalModify -->
<auth-button category="Button"
:data="{ operate: 'create' }"
:data="{ operate: 'create', record: { shelfModel: 2 } }"
:show-btn-ids="['9031810']" />
<!-- 特殊商品上架 handleModify -->
<auth-button category="Button"
:data="{ operate: 'create' }"
:data="{ operate: 'create', record: { shelfModel: 1 } }"
:show-btn-ids="['9031801']" />
</span>
</d2-table-header>
......@@ -51,19 +51,23 @@
<template #auth-button="{ scope }">
<div style="padding:21px 0">
<!-- 查看 handleDetail -->
<!-- 全部状态的单据均可操作 -->
<span style="margin-right: 10px">
<auth-button :data="scope" :show-btn-ids="['9031803']" />
</span>
<!-- 编辑 handleModify 仅草稿出现 -->
<!-- 仅状态=“草稿”的记录可操作 -->
<span v-if="scope.systemStatus === 0" style="margin-right: 10px">
<auth-button :data="{ operate: 'edit', record: scope }" :show-btn-ids="['9031806']" />
</span>
<!-- 驳回 handleReject 待审核才出现 -->
<!-- 仅状态=“商务审核” -->
<span v-if="scope.systemStatus === 1" style="margin-right: 10px">
<auth-button :data="scope"
:show-btn-ids="['9031808']" />
</span>
<!-- 审核 handleApprove 待审核才出现 -->
<!-- 仅状态=“商务审核”的记录可操作 -->
<span v-if="scope.systemStatus === 1" style="margin-right: 10px">
<auth-button :data="scope" :show-btn-ids="['9031809']" />
</span>
......@@ -94,6 +98,7 @@ export default {
},
data() {
return {
isCacheLoaded: false,
table: {
formSchema: cloneDeep(shelfProductTableFormSchema),
getListApi: getShelfProductPageApi,
......@@ -124,11 +129,13 @@ export default {
};
},
async mounted() {
console.log("mounted");
await this.getBaseData();
},
activated() {
this.$refs?.tableRef?.refreshTable();
if (this.isCacheLoaded) {
this.$refs?.tableRef?.refreshTable();
}
this.isCacheLoaded = true;
},
methods: {
......@@ -168,12 +175,9 @@ export default {
},
// 常规上架
handleNormalModify({ operate, record }) {
console.log("????");
if (operate === "create") {
this.$router.push({
name: "goodsShelfNormalCreate",
});
}
this.$router.push({
name: "goodsShelfNormalModify",
});
},
handleRefreshTable() {
this.$refs.tableRef.refreshTable();
......@@ -185,34 +189,74 @@ export default {
},
// 查看
handleDetail(row) {
this.$router.push({
name: "goodsShelfDetail",
query: {
baseSceneCode: row.baseSceneCode,
businessCode: row.businessCode,
shelfType: row.shelfType,
},
});
},
// 新增 或 修改
handleModify({ operate, record }) {
if (operate === "create") {
if (row.shelfModel === 1) {
// 特殊上架详情
this.$router.push({
name: "goodsShelfCreate",
name: "goodsShelfDetail",
query: {
baseSceneCode: row.baseSceneCode,
businessCode: row.businessCode,
shelfType: row.shelfType,
},
});
}
if (operate === "edit") {
if (row.shelfModel === 2) {
// 常规上架详情
this.$router.push({
name: "goodsShelfModify",
name: "goodsShelfNormalDetail",
query: {
baseSceneCode: record.baseSceneCode,
businessCode: record.businessCode,
shelfType: record.shelfType,
baseSceneCode: row.baseSceneCode,
businessCode: row.businessCode,
shelfType: row.shelfType,
shelfModel: row.shelfModel,
},
});
}
},
// 新增 或 修改
handleModify({ operate, record }) {
console.log(record);
// 特殊上架编辑
if (record?.shelfModel === 1) {
if (operate === "create") {
this.$router.push({
name: "goodsShelfCreate",
});
}
if (operate === "edit") {
this.$router.push({
name: "goodsShelfModify",
query: {
baseSceneCode: record.baseSceneCode,
businessCode: record.businessCode,
shelfType: record.shelfType,
},
});
}
}
if (record?.shelfModel === 2) {
if (operate === "create") {
this.$router.push({
name: "goodsShelfNormalModify",
});
}
if (operate === "edit") {
this.$router.push({
name: "goodsShelfNormalModify",
query: {
baseSceneCode: record.baseSceneCode,
businessCode: record.businessCode,
shelfType: record.shelfType,
shelfModel: record.shelfModel,
},
});
}
}
},
},
};
</script>
......
......@@ -72,7 +72,10 @@
</div>
</template>
</template>
<el-empty v-else description="暂无汇报内容" />
<div v-else
class="dynamic-form-readonly__empty">
暂无汇报内容
</div>
</div>
</template>
......@@ -117,6 +120,13 @@ export default {
<style scoped lang="scss">
.dynamic-form-readonly {
&__empty {
padding: 40px 0;
text-align: center;
color: #909399;
font-size: 14px;
}
&__section,
&__group,
&__subform {
......
import {
formatJournalDate,
formatJournalDateTime,
JOURNAL_EMPTY_TEXT,
} from "./utils/journalDateTime";
export const JOURNAL_TABS = [
{ key: "staffDaily", label: "驻店日报", journalType: 1 },
{ key: "storeDaily", label: "门店日报", journalType: 2 },
......@@ -36,56 +42,81 @@ export function getTabKeyByTemplateType(templateType) {
return tab?.key ?? "staffDaily";
}
export { formatJournalDate, formatJournalDateTime } from "./utils/journalDateTime";
const bizTypeColumn = {
label: "业务大类",
prop: "bizTypeName",
width: "120px",
minWidth: "100px",
width: "100px",
addHtml: "bizType",
isPopConfig: { text: BIZ_TYPE_TOOLTIP },
};
function createDateTimeColumn(label, prop) {
return {
label,
prop,
minWidth: "170px",
formatter: (row) => formatJournalDateTime(row[prop]),
};
}
function createEmptyTextColumn(label, prop, options = {}) {
return {
label,
prop,
formatter: (row) => {
const value = row[prop];
return value != null && value !== "" ? value : "—";
},
...options,
};
}
export const TABLE_COLUMNS_MAP = {
staffDaily: [
{ label: "驻店人员", prop: "staffName", minWidth: "120px" },
{ label: "驻店人员", prop: "staffName", minWidth: "100px", showOverFlow: true },
bizTypeColumn,
{ label: "所属门店", prop: "merchantName", minWidth: "200px", showOverFlow: true },
{ label: "今日出勤", prop: "attendanceStatus", width: "100px" },
{ label: "最近保存时间", prop: "lastSaveTime", width: "160px" },
{ label: "所属门店", prop: "merchantName", minWidth: "160px", showOverFlow: true, align: "left" },
createEmptyTextColumn("今日出勤", "attendanceStatus", { width: "100px" }),
createDateTimeColumn("最近保存时间", "lastSaveTime"),
],
storeDaily: [
{ label: "所属门店", prop: "merchantName", minWidth: "180px", showOverFlow: true },
{
label: "所属门店",
prop: "merchantName",
minWidth: "160px",
showOverFlow: true,
align: "left",
},
bizTypeColumn,
{
label: "今日驻店人数",
prop: "staffCount",
width: "130px",
width: "120px",
formatter: (row) => (row.staffCount != null ? `${row.staffCount}人` : "—"),
},
{ label: "最近保存时间", prop: "lastSaveTime", width: "160px" },
{
label: "提交时间",
prop: "submitTime",
width: "160px",
formatter: (row) => row.submitTime || "—",
},
{
label: "提交人",
prop: "submitUserName",
createDateTimeColumn("最近保存时间", "lastSaveTime"),
createDateTimeColumn("提交时间", "submitTime"),
createEmptyTextColumn("提交人", "staffName", {
minWidth: "100px",
width: "120px",
formatter: (row) => row.submitUserName || "—",
},
showOverFlow: true,
}),
],
negotiation: [
{ label: "驻店人员", prop: "staffName", minWidth: "120px" },
{ label: "驻店人员", prop: "staffName", minWidth: "100px", showOverFlow: true },
bizTypeColumn,
{ label: "所属门店", prop: "merchantName", minWidth: "200px", showOverFlow: true },
{ label: "最近保存时间", prop: "lastSaveTime", width: "160px" },
{ label: "所属门店", prop: "merchantName", minWidth: "160px", showOverFlow: true, align: "left" },
createDateTimeColumn("最近保存时间", "lastSaveTime"),
],
};
export function getDetailTitle(detail, journalType) {
const { staffName, merchantName, reportDate } = detail;
const dateText = reportDate ? `(${reportDate})` : "";
const formattedDate = formatJournalDate(reportDate);
const dateText = formattedDate !== JOURNAL_EMPTY_TEXT ? `(${formattedDate})` : "";
const titleMap = {
staffDaily: `${staffName}的驻店日报${dateText}`,
storeDaily: `${merchantName}的门店日报${dateText}`,
......
......@@ -50,7 +50,14 @@ export default {
},
methods: {
async fetchDetail() {
const { id, journalType, reportDate, merchantId, staffUuid } = this.$route.query;
const {
id,
journalType,
reportDate,
merchantId,
staffUuid,
sceneType,
} = this.$route.query;
if (!id) {
return;
}
......@@ -63,6 +70,7 @@ export default {
reportDate,
merchantId,
staffUuid,
sceneType,
});
this.detail = {
...res,
......
......@@ -173,7 +173,10 @@ export default {
return {
btnId: `journal-${this.activeTab}`,
listName: "list",
tableOption: { label: "操作", width: "100px" },
tableOption: {
label: "操作",
width: this.activeTab === "storeDaily" ? "90px" : "100px",
},
tableColumns: TABLE_COLUMNS_MAP[this.activeTab],
};
},
......@@ -337,6 +340,7 @@ export default {
reportDate: this.reportDate,
merchantId: row.merchantId,
staffUuid: row.staffUuid,
sceneType: row.sceneType,
},
});
}
......
import dayjs from "dayjs";
export const JOURNAL_EMPTY_TEXT = "—";
function formatByPattern(value, pattern) {
if (value == null || value === "") {
return JOURNAL_EMPTY_TEXT;
}
const formatted = dayjs(value).format(pattern);
return formatted === "Invalid Date" ? JOURNAL_EMPTY_TEXT : formatted;
}
export function formatJournalDate(value) {
return formatByPattern(value, "YYYY-MM-DD");
}
export function formatJournalDateTime(value) {
return formatByPattern(value, "YYYY-MM-DD HH:mm:ss");
}
import {
formatJournalDate,
formatJournalDateTime,
} from "./journalDateTime";
import { filterFormListForDisplay } from "./journalFormVisibility";
const EMPTY_TEXT = "—";
function sortBySortNum(list = []) {
......@@ -102,9 +108,11 @@ export function formatEchoValue(field = {}) {
return `${raw}${unit}`;
}
case "textarea":
return String(raw);
case "date":
return formatJournalDate(raw);
case "datetime":
return String(raw);
return formatJournalDateTime(raw);
default:
return String(raw);
}
......@@ -213,7 +221,9 @@ export function buildSubformTable(field = {}) {
* 解析详情并生成展示块
*/
export function parseJournalEcho(detail = {}) {
return buildEchoBlocks(parseFormList(detail));
const formList = parseFormList(detail);
const visibleFormList = filterFormListForDisplay(formList, detail);
return buildEchoBlocks(visibleFormList);
}
export default {
......
export function isSubform(field = {}) {
return field.type === "subform";
}
export function isStaticGroup(field = {}) {
return field.type === "group";
}
export function getStaticGroupChildren(field = {}) {
const children = field.children;
if (!Array.isArray(children)) {
return [];
}
return Array.isArray(children[0]) ? children[0] : children;
}
export function getSubformRowTemplate(field = {}) {
const children = field.children;
if (!Array.isArray(children) || !children.length) {
return [];
}
return Array.isArray(children[0]) ? children[0] : children;
}
function evalPart(part = "", ctx = {}) {
const trimmed = part.trim();
const eqMatch = trimmed.match(/^val(\d+)\s*==\s*(?:'([^']*)'|"([^"]*)")$/);
if (eqMatch) {
const actual = ctx[`val${eqMatch[1]}`];
const expected = eqMatch[2] != null ? eqMatch[2] : eqMatch[3];
return actual == expected;
}
const neNullMatch = trimmed.match(/^val(\d+)\s*!=\s*null$/);
if (neNullMatch) {
const actual = ctx[`val${neNullMatch[1]}`];
return actual != null && actual !== "";
}
return false;
}
function fallbackEvaluate(expr = "", ctx = {}) {
if (!expr) {
return true;
}
return expr.split("&&").every((part) => evalPart(part, ctx));
}
export function evaluateShowRule(keys = [], resultExpr = "", rowFields = [], getRowFieldValue) {
if (!keys.length || !resultExpr) {
return true;
}
try {
const ctx = {};
keys.forEach((key, index) => {
ctx[`val${index + 1}`] = getRowFieldValue(rowFields, key);
});
return fallbackEvaluate(resultExpr, ctx);
} catch (error) {
console.error("[evaluateShowRule] eval error", resultExpr, error);
return false;
}
}
import { evaluateShowRule } from "./groupShowRuleEval";
function getRowFieldValue(rowFields = [], key = "", rowMap = null) {
const field = (rowFields || []).find((item) => item.key === key);
if (field) {
if (field.value != null && field.value !== "") {
return field.value;
}
const metaKey = field.key;
if (metaKey != null && field[metaKey] != null && field[metaKey] !== "") {
const meta = field[metaKey];
if (typeof meta === "object" && !Array.isArray(meta)) {
return meta.name ?? meta.label ?? meta.id ?? meta;
}
return meta;
}
}
if (rowMap && rowMap[key] != null && rowMap[key] !== "") {
return rowMap[key];
}
return null;
}
function isGroupChildVisibleInRow(group = {}, child = {}, rowFields = [], rowMap = null) {
const rules = group.childrenShowRules;
if (!rules || !child?.key) {
return true;
}
const rule = rules[child.key];
if (!rule) {
return true;
}
const keys = rule.keys || [];
const resultExpr = rule.result;
if (!keys.length || !resultExpr) {
return true;
}
return evaluateShowRule(keys, resultExpr, rowFields, (rf, k) =>
getRowFieldValue(rf, k, rowMap));
}
export function filterVisibleRowFields(group = {}, rowFields = [], rowMap = null) {
return (rowFields || []).filter((field) =>
isGroupChildVisibleInRow(group, field, rowFields, rowMap));
}
import {
getStaticGroupChildren,
getSubformRowTemplate,
isStaticGroup,
isSubform,
} from "./fieldTypes";
import { filterVisibleRowFields } from "./groupVisibility";
import { isAttendanceOnDuty } from "./radioValue";
import {
findSchemaFieldInContext,
isStaffBrandGroupOnOffDuty,
resolveDetailSceneList,
resolveFieldShowRules,
resolveSchemaList,
schemaHasAttendanceField,
} from "./visibilityHelpers";
import { isFieldVisibleBySpecs } from "./visibilitySpecs";
function sortBySortNum(list = []) {
return [ ...list ].sort((a, b) =>
String(a.sortNum || "").localeCompare(String(b.sortNum || ""), undefined, { numeric: true }));
}
function getEchoKeysFromFormList(formList = []) {
const echoSubformKeys = formList
.filter((item) => item?.key && (item.type === "subform" || item.type === "group"))
.map((item) => item.key);
const echoTopLevelKeys = formList.filter((item) => item?.key).map((item) => item.key);
return { echoSubformKeys, echoTopLevelKeys };
}
function buildDetailPageContext(detail = {}, formList = []) {
const { echoSubformKeys, echoTopLevelKeys } = getEchoKeysFromFormList(formList);
const sceneList = resolveDetailSceneList(detail);
return {
hasDetailEcho: formList.length > 0,
echoSubformKeys: new Set(echoSubformKeys),
echoTopLevelKeys: new Set(echoTopLevelKeys),
sceneList,
baseSceneCode: detail.baseSceneCode,
brandIds: Array.isArray(detail.brandIds) ? detail.brandIds : [],
schemaList: resolveSchemaList(detail, formList),
};
}
function buildValuesMap(formList = []) {
const values = {};
formList.forEach((field) => {
if (
field?.key
&& field.type !== "group"
&& field.type !== "subform"
&& field.type !== "divider"
) {
values[field.key] = field.value;
}
});
return values;
}
function mergeFieldMeta(field = {}, schemaList = [], formList = []) {
const schemaField = findSchemaFieldInContext(schemaList, formList, field.key);
if (!schemaField) {
return field;
}
return {
...schemaField,
...field,
rules: resolveFieldShowRules(field, schemaField),
children: field.children ?? schemaField.children,
childrenShowRules: field.childrenShowRules || schemaField.childrenShowRules,
options: field.options || schemaField.options,
};
}
function buildVisibilityOptions(schemaList = [], formList = [], values = {}, ctx = {}) {
const hasAttendanceField = schemaHasAttendanceField(schemaList)
|| schemaHasAttendanceField(formList);
const attendanceSourceList = schemaHasAttendanceField(schemaList) ? schemaList : formList;
return {
schemaList,
hasAttendanceField,
attendanceOnDuty: isAttendanceOnDuty(attendanceSourceList, values),
echoSubformKeys: ctx.echoSubformKeys instanceof Set
? ctx.echoSubformKeys
: new Set(ctx.echoSubformKeys || []),
};
}
function getVisibleSubformChildren(group, ctx, values, schemaList = [], formList = []) {
if (!group || !isSubform(group)) {
return [];
}
const visibilityOptions = {
...buildVisibilityOptions(schemaList, formList, values, ctx),
echoParentKey: group?.key,
};
return getSubformRowTemplate(group)
.map((child) => mergeFieldMeta(child, schemaList, formList))
.filter((child) => isFieldVisibleBySpecs(child, ctx, values, visibilityOptions))
.sort((a, b) => Number(a.sortNum) - Number(b.sortNum));
}
function getVisibleGroupChildren(group, ctx, values, schemaList = [], formList = []) {
if (!group || !isStaticGroup(group)) {
return [];
}
const visibilityOptions = {
...buildVisibilityOptions(schemaList, formList, values, ctx),
echoParentKey: group?.key,
};
return getStaticGroupChildren(group)
.map((child) => mergeFieldMeta(child, schemaList, formList))
.filter((child) => isFieldVisibleBySpecs(child, ctx, values, visibilityOptions))
.sort((a, b) => Number(a.sortNum) - Number(b.sortNum));
}
function filterFieldNode(field, schemaList, formList, ctx, values, options) {
const merged = mergeFieldMeta(field, schemaList, formList);
const visibilityOptions = { ...options };
if (isStaffBrandGroupOnOffDuty(merged, visibilityOptions)) {
return null;
}
if (!isFieldVisibleBySpecs(merged, ctx, values, visibilityOptions)) {
return null;
}
if (isStaticGroup(merged)) {
const visibleChildren = getVisibleGroupChildren(merged, ctx, values, schemaList, formList);
if (!visibleChildren.length) {
return null;
}
const childMap = new Map(
getStaticGroupChildren(merged).map((child) => [child.key, child]),
);
return {
...merged,
children: visibleChildren.map((child) => ({
...child,
...(childMap.get(child.key) || {}),
value: childMap.get(child.key)?.value ?? child.value,
})),
};
}
if (isSubform(merged)) {
const visibleTemplate = getVisibleSubformChildren(merged, ctx, values, schemaList, formList);
if (!visibleTemplate.length) {
return null;
}
const templateMap = new Map(
getSubformRowTemplate(merged).map((col) => [col.key, col]),
);
const mergedTemplate = visibleTemplate.map((col) => ({
...col,
...(templateMap.get(col.key) || {}),
}));
const rowFieldsList = Array.isArray(merged.value) ? merged.value : [];
const groupDef = mergeFieldMeta(merged, schemaList, formList);
const allowedKeys = new Set(mergedTemplate.map((col) => col.key));
const filteredRows = rowFieldsList
.map((rowCells) => {
const cells = Array.isArray(rowCells) ? rowCells : [];
const rowMap = {};
cells.forEach((cell) => {
if (cell?.key) {
rowMap[cell.key] = cell.value;
}
});
const visibleInRow = filterVisibleRowFields(groupDef, cells, rowMap);
return visibleInRow.filter((cell) => allowedKeys.has(cell.key));
})
.filter((row) => row.length);
return {
...merged,
children: [mergedTemplate],
value: filteredRows,
};
}
return merged;
}
export function filterFormListForDisplay(formList = [], detail = {}) {
if (!formList.length) {
return [];
}
const schemaList = resolveSchemaList(detail, formList);
const values = buildValuesMap(formList);
const ctx = buildDetailPageContext(detail, formList);
const options = buildVisibilityOptions(schemaList, formList, values, ctx);
return sortBySortNum(
formList
.map((field) => filterFieldNode(field, schemaList, formList, ctx, values, options))
.filter(Boolean),
);
}
export { isFieldVisibleBySpecs };
import { ATTENDANCE_KEY, flattenFields } from "./visibilityHelpers";
export { ATTENDANCE_KEY };
export const ON_DUTY_LABEL = "在岗";
export const OFF_DUTY_LABEL = "调休";
export const LEGACY_ON_DUTY = "1";
export const LEGACY_OFF_DUTY = "2";
export function resolveRadioOptionValue(field, rawValue) {
if (rawValue == null || rawValue === "" || !field?.options?.length) {
return rawValue;
}
const str = String(rawValue);
const byValue = field.options.find((option) => String(option.value) === str);
if (byValue) {
return byValue.value;
}
const byLabel = field.options.find(
(option) => option.label === rawValue || option.label === str,
);
if (byLabel) {
return byLabel.value;
}
if (str === LEGACY_ON_DUTY) {
const onDuty = field.options.find((option) => option.label === ON_DUTY_LABEL)
|| field.options.find((option) => String(option.value) === LEGACY_ON_DUTY)
|| field.options[0];
return onDuty?.value ?? rawValue;
}
if (str === LEGACY_OFF_DUTY) {
const offDuty = field.options.find((option) => option.label === OFF_DUTY_LABEL)
|| field.options.find((option) => String(option.value) === LEGACY_OFF_DUTY)
|| field.options[1];
return offDuty?.value ?? rawValue;
}
return rawValue;
}
export function getAttendanceField(list = []) {
return flattenFields(list).find((field) => field.key === ATTENDANCE_KEY);
}
export function getOnDutyOption(field) {
if (!field?.options?.length) {
return null;
}
return field.options.find((option) => option.label === ON_DUTY_LABEL)
|| field.options.find((option) => String(option.value) === LEGACY_ON_DUTY)
|| field.options[0];
}
export function isAttendanceOnDuty(list = [], values = {}) {
const field = getAttendanceField(list);
const raw = values[ATTENDANCE_KEY];
if (raw == null || raw === "") {
return false;
}
if (!field?.options?.length) {
return raw === LEGACY_ON_DUTY || raw === ON_DUTY_LABEL;
}
const onDutyOption = getOnDutyOption(field);
if (!onDutyOption) {
return false;
}
const normalized = resolveRadioOptionValue(field, raw);
return String(normalized) === String(onDutyOption.value);
}
import {
getStaticGroupChildren,
getSubformRowTemplate,
isStaticGroup,
isSubform,
} from "./fieldTypes";
const DIVIDER_QY_SCENE_CODES = [110101, 110102];
const DIVIDER_YB_SCENE_CODES = [110201, 110202];
const SCENE_TYPE_LIGHT_REFORM_CODES = [100101, 100102, 100103];
const SCENE_TYPE_RIGHTS_CODES = [110101, 110102, 110201, 110202];
export const ATTENDANCE_KEY = "F1-1";
export function hasIntersection(a = [], b = []) {
return a.some((id) => b.includes(id));
}
export function normalizeSceneCodeList(codes) {
if (codes == null || codes === "") {
return [];
}
const list = Array.isArray(codes) ? codes : [codes];
return list.map((code) => Number(code)).filter((code) => !Number.isNaN(code));
}
export function flattenFields(list = []) {
const result = [];
for (const field of list) {
if (isSubform(field)) {
result.push(...flattenFields(getSubformRowTemplate(field)));
} else if (isStaticGroup(field)) {
result.push(...flattenFields(getStaticGroupChildren(field)));
} else if (field.type !== "group" && field.type !== "subform") {
result.push(field);
}
}
return result;
}
export function schemaHasAttendanceField(list = []) {
return flattenFields(list).some((field) => field.key === ATTENDANCE_KEY);
}
/** 字段是否受 F1-1 出勤 rules.result 联动 */
export function isAttendanceGatedField(field = {}) {
const rules = field.rules || {};
const keys = rules.keys || [];
return keys.includes(ATTENDANCE_KEY) && !!rules.result;
}
/** 优先取带 keys/result 的出勤联动 rules,避免被 min/integer 等校验 rules 覆盖 */
export function resolveFieldShowRules(field = {}, schemaField = {}) {
const candidates = [field?.rules, schemaField?.rules];
const withGate = candidates.find((rules) => rules?.keys?.length && rules?.result);
if (withGate) {
return withGate;
}
return field?.rules || schemaField?.rules || {};
}
export function findSchemaFieldInContext(schemaList = [], formList = [], key = "") {
return flattenFields(schemaList).find((field) => field.key === key)
|| flattenFields(formList).find((field) => field.key === key);
}
/** 驻店日报调休时隐藏 brand group(对 merge 后的字段判断) */
export function isStaffBrandGroupOnOffDuty(field = {}, options = {}) {
if (!options.hasAttendanceField || options.attendanceOnDuty) {
return false;
}
if (field.type !== "group") {
return false;
}
if (isAttendanceGatedField(field)) {
return true;
}
if (field.brandId?.length || field.filterBrandId?.length) {
return true;
}
return false;
}
/** 详情 schema 回退:空 schema.list 时使用 jsonContent formList */
export function resolveSchemaList(detail = {}, formList = []) {
const fromSchema = detail.schema?.list;
if (Array.isArray(fromSchema) && fromSchema.length) {
return fromSchema;
}
return formList;
}
export function getMerchantSceneCodes(sceneList = []) {
return normalizeSceneCodeList((sceneList || []).map((item) => item?.baseSceneCode));
}
export function getEffectiveSceneCodes(ctx = {}) {
const codes = getMerchantSceneCodes(ctx.sceneList);
if (codes.length) {
return codes;
}
return normalizeSceneCodeList(ctx.baseSceneCode);
}
export function matchesBaseSceneCode(field, ctx = {}) {
const fieldCodes = normalizeSceneCodeList(field.baseSceneCode);
if (!fieldCodes.length) {
return true;
}
const effective = getEffectiveSceneCodes(ctx);
return fieldCodes.some((code) => effective.includes(code));
}
export function isDividerVisible(field, ctx = {}) {
const merchantCodes = getMerchantSceneCodes(ctx.sceneList);
if (field.qgCode?.length) {
return hasIntersection(normalizeSceneCodeList(field.qgCode), merchantCodes);
}
const merchantHasQY = hasIntersection(DIVIDER_QY_SCENE_CODES, merchantCodes);
const merchantHasYB = hasIntersection(DIVIDER_YB_SCENE_CODES, merchantCodes);
const fieldMatchesQY = hasIntersection(field.qyCode || [], merchantCodes);
const fieldMatchesYB = hasIntersection(field.ybCode || [], merchantCodes);
if (field.isQY || field.isYB) {
if (field.isQY) {
return fieldMatchesQY && !merchantHasYB;
}
if (field.isYB) {
return fieldMatchesYB && !merchantHasQY;
}
}
return merchantHasQY && merchantHasYB;
}
export function shouldHideByFilterBrandId(field = {}, brandIds = []) {
if (!field.filterBrandId?.length || !brandIds.length) {
return false;
}
const hasOtherBrand = brandIds.some((id) => !field.filterBrandId.includes(id));
return !hasOtherBrand;
}
/** sceneType(0 权益 / 1 轻改)→ sceneList,与列表 bizTypeName 同源 */
export function inferSceneListFromSceneType(sceneType) {
if (sceneType == null || sceneType === "") {
return [];
}
const codes = String(sceneType) === "1"
? SCENE_TYPE_LIGHT_REFORM_CODES
: String(sceneType) === "0"
? SCENE_TYPE_RIGHTS_CODES
: [];
return codes.map((baseSceneCode) => ({ baseSceneCode }));
}
/** 详情 sceneList 解析:接口 sceneList → baseSceneCode → sceneType */
export function resolveDetailSceneList(detail = {}) {
if (Array.isArray(detail.sceneList) && detail.sceneList.length) {
return detail.sceneList;
}
if (detail.baseSceneCode != null && detail.baseSceneCode !== "") {
return [{ baseSceneCode: detail.baseSceneCode }];
}
return inferSceneListFromSceneType(detail.sceneType);
}
import { evaluateShowRule } from "./groupShowRuleEval";
import { isStaticGroup, isSubform } from "./fieldTypes";
import { resolveRadioOptionValue } from "./radioValue";
import {
ATTENDANCE_KEY,
flattenFields,
hasIntersection,
isAttendanceGatedField,
isDividerVisible,
matchesBaseSceneCode,
shouldHideByFilterBrandId,
} from "./visibilityHelpers";
function resolveEchoSubformKeys(ctx = {}, options = {}) {
if (options.echoSubformKeys instanceof Set && options.echoSubformKeys.size) {
return options.echoSubformKeys;
}
const fromCtx = ctx.echoSubformKeys;
if (fromCtx instanceof Set) {
return fromCtx;
}
return new Set(Array.isArray(fromCtx) ? fromCtx : []);
}
function resolveEchoTopLevelKeys(ctx = {}) {
const fromCtx = ctx.echoTopLevelKeys;
if (fromCtx instanceof Set) {
return fromCtx;
}
return new Set(Array.isArray(fromCtx) ? fromCtx : []);
}
function isInDetailEchoScope(field = {}, ctx = {}, options = {}) {
if (!ctx.hasDetailEcho) {
return false;
}
const echoSubformKeys = resolveEchoSubformKeys(ctx, options);
if (
field.key
&& echoSubformKeys.has(field.key)
&& (isSubform(field) || isStaticGroup(field))
) {
return true;
}
if (options.echoParentKey && echoSubformKeys.has(options.echoParentKey)) {
return true;
}
const echoTopLevelKeys = resolveEchoTopLevelKeys(ctx);
if (field.key && echoTopLevelKeys.has(field.key)) {
return true;
}
return false;
}
export function detailEchoSpec(field, ctx, _values, options = {}) {
if (!ctx.hasDetailEcho) {
return null;
}
if (isInDetailEchoScope(field, ctx, options)) {
if (field.type === "divider") {
return isDividerVisible(field, ctx);
}
if (
options.hasAttendanceField
&& !options.attendanceOnDuty
&& isAttendanceGatedField(field)
) {
return null;
}
return true;
}
if (options.hasAttendanceField && options.attendanceOnDuty) {
return null;
}
return false;
}
function findFieldByKey(list = [], key = "") {
return flattenFields(list).find((field) => field.key === key);
}
function getTopLevelFieldValue(list = [], values = {}, key = "") {
const field = findFieldByKey(list, key);
const raw = values[key];
if (!field) {
return raw == null || raw === "" ? null : raw;
}
if (field.type === "radio") {
const resolved = resolveRadioOptionValue(field, raw);
return resolved == null || resolved === "" ? null : resolved;
}
return raw == null || raw === "" ? null : raw;
}
export function fieldShowRuleSpec(field, ctx, values, options = {}) {
const rules = field.rules || {};
const keys = rules.keys || [];
const resultExpr = rules.result;
if (!keys.length || !resultExpr) {
return true;
}
const list = options.schemaList || ctx.schemaList || [];
return evaluateShowRule(keys, resultExpr, [], (_rowFields, key) =>
getTopLevelFieldValue(list, values, key));
}
export function baseSceneSpec(field, ctx) {
if (field.type === "divider") {
return isDividerVisible(field, ctx);
}
if (field.baseSceneCode != null && field.baseSceneCode !== "") {
return matchesBaseSceneCode(field, ctx);
}
return true;
}
export function brandSpec(field, ctx) {
if (field.brandId?.length > 0 && !hasIntersection(field.brandId, ctx.brandIds || [])) {
return false;
}
if (shouldHideByFilterBrandId(field, ctx.brandIds || [])) {
return false;
}
return true;
}
export function isFieldVisibleBySpecs(field, ctx, values, options = {}) {
const echoResult = detailEchoSpec(field, ctx, values, options);
if (echoResult === false) {
return false;
}
if (echoResult === true) {
return baseSceneSpec(field, ctx, values, options);
}
if (!fieldShowRuleSpec(field, ctx, values, options)) {
return false;
}
if (!baseSceneSpec(field, ctx, values, options)) {
return false;
}
if (!brandSpec(field, ctx, values, options)) {
return false;
}
return true;
}
......@@ -222,8 +222,10 @@ export default {
deep: true,
},
'infoForm.shelfType': {
handler(val) {
handler(val, oldVal) {
console.log(val)
// 仅在用户真正切换上架类型时执行重置,避免 immediate 和程序赋值时误清空
if (oldVal === undefined) return
if (val == 2) {
this.infoForm.merchantId = ''
this.infoForm.merchantName = ''
......@@ -231,7 +233,6 @@ export default {
this.infoForm.baseSceneCode = []
},
immediate: true,
deep: true,
}
},
computed: {
......@@ -248,7 +249,21 @@ export default {
{ required: true, message: "请选择流量方", trigger: "change" },
],
sceneFiles: [
{ required: true, message: "门店上架表不能为空", trigger: "change" },
{
required: true, trigger: "change", validator: (rule, value, callback) => {
let { sceneTypeOpts } = this.options
if (value.length == 0) {
callback(new Error("门店上架表不能为空"));
} else {
value.forEach(file => {
if (!file.file) {
callback(new Error(`门店上架表不能为空`));
}
});
callback();
}
}
},
],
}
templateInfo.forEach(item => {
......@@ -449,6 +464,7 @@ export default {
}
this.$set(this.infoForm.sceneFiles, index, item);
document.getElementById("fileUpload").value = "";
this.formRef.validateField("sceneFiles")
};
} else {
this.notice.errorTips("上传文件不可超过10M");
......@@ -491,11 +507,11 @@ export default {
},
handleRemoveProductFile(index) {
let item = this.infoForm.sceneFiles[index];
this.$set(this.infoForm.sceneFiles, index, {
...item,
file: null,
name: '',
});
item.file = null;
item.name = '';
// 手动触发数组响应式更新,避免 $set 触发 baseSceneCode 深层 watcher 导致整个数组被重置
this.infoForm.sceneFiles = [...this.infoForm.sceneFiles];
this.formRef.validateField("sceneFiles")
},
filterInputVal(controlId, val) {
// 只保留数字和小数点,确保只有一个小数点
......
......@@ -8,11 +8,12 @@
<el-table-column v-for="(item, index) in componentData" :key="'col-' + item.expenseCategoryId + '-' + index"
:label="getExpenseName(item.expenseCategoryId)" align="center">
<template slot-scope="{ row }">
<span class="radio-wrapper"
:class="[{ 'is-checked': getSelectedValue(item.expenseCategoryId) === row.targetMerchantType }, { 'disabled': isViewMode }]"
@click.stop="handleRadioChange(row, item, index)">
<i class="radio"></i>
</span>
<div class="radio-item" @click.stop="handleRadioChange(row, item, index)">
<span class="radio-wrapper"
:class="[{ 'is-checked': getSelectedValue(item.expenseCategoryId) === row.targetMerchantType }, { 'disabled': isViewMode }]">
<i class="radio"></i>
</span>
</div>
</template>
</el-table-column>
</el-table>
......@@ -183,7 +184,14 @@ export default {
}
}
::v-deep .el-table__body-wrapper {}
.radio-item {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
padding: 18px 0;
cursor: pointer;
}
.radio-wrapper {
display: block;
......@@ -192,7 +200,7 @@ export default {
height: 12px;
border-radius: 50%;
border: 1px solid #dcdfe6;
cursor: pointer;
transition: all 0.3s;
margin: 0 auto;
......
......@@ -366,7 +366,6 @@ export default {
}, item) {
let data = this.componentData.productCategoryRules[this.productCategoryIndex][item.key]
data[index].targetMerchantType = targetMerchantType
console.log(data)
this.$set(this.componentData.productCategoryRules[this.productCategoryIndex], item.key, data)
},
validate(callback) {
......@@ -432,6 +431,7 @@ export default {
.step-title {
gap: 16px;
margin-bottom: 20px;
z-index: 4 !important;
}
.form-box {
......
......@@ -5,39 +5,41 @@
1: '是',
0: '否'
}[data] }}
<div class="condition-box-view">
<template v-for="(item, index) in guaranteeConfigs">
<div class="block" :key="index">
<div class="item">
<div class="item-label">兜底标准:</div>
<div class="item-value">{{ metricName(item) }}</div>
</div>
<div class="item">
<div class="item-label">赔付标准:</div>
<div class="item-value">
<template v-if="item.guaranteeIndex">
<template v-if="item.compensationMode == 0">无</template>
<template v-else>
<template v-if="item.compensationMode == 1">
固定模式
<div class="text">差距订单数每单赔付{{ item.guaranteeStandard }}元</div>
</template>
<template v-if="data == 1">
<div class="condition-box-view">
<template v-for="(item, index) in guaranteeConfigs">
<div class="block" :key="index">
<div class="item">
<div class="item-label">兜底标准:</div>
<div class="item-value">{{ metricName(item) }}</div>
</div>
<div class="item">
<div class="item-label">赔付标准:</div>
<div class="item-value">
<template v-if="item.guaranteeIndex">
<template v-if="item.compensationMode == 0">无</template>
<template v-else>
阶梯模式
<template v-for="(i, ind) in formatGuaranteeConfigs(item.ladderConditions)">
<div class="text" :key="`i-${ind}`">
<span v-html="formatGuaranteeItem(i, item)"></span>
</div>
<template v-if="item.compensationMode == 1">
固定模式
<div class="text">差距订单数每单赔付{{ item.guaranteeStandard }}元</div>
</template>
<template v-else>
阶梯模式
<template v-for="(i, ind) in formatGuaranteeConfigs(item.ladderConditions)">
<div class="text" :key="`i-${ind}`">
<span v-html="formatGuaranteeItem(i, item)"></span>
</div>
</template>
</template>
</template>
</template>
</template>
<template v-else>-</template>
<template v-else>-</template>
</div>
</div>
</div>
</div>
</template>
</div>
</template>
</div>
</template>
</template>
<template v-else>
<el-radio-group v-model="data" @change="changeData">
......@@ -168,7 +170,6 @@ export default {
},
metricName(item) {
let { metricConfigs } = this
console.log(metricConfigs)
if (metricConfigs && metricConfigs.length) return metricConfigs.find(e => e.metricCode == item.guaranteeIndex)?.metricName || '-'
return '-'
},
......@@ -176,7 +177,6 @@ export default {
return JSON.parse(data)
},
formatGuaranteeItem(i, item) {
console.log(i)
let unit = i.unit || ''
return `满足${i.startValue}${unit} &le; ${this.metricName(item)}&lt;${i.endValue}${unit}时,差距订单数每单赔付${i.compensationAmount}元`
}
......
......@@ -23,7 +23,8 @@
</el-select>
</template>
<template v-else-if="i.type == 'radio'">
<el-radio-group v-model="componentData[i.key]" :disabled="disabled(componentData.guaranteeIndex)">
<el-radio-group v-model="componentData[i.key]" :disabled="disabled(componentData.guaranteeIndex)"
@change="radioChange">
<template v-for="r in i.options">
<el-radio :key="r.value" :label="r.value">{{ r.label }}</el-radio>
</template>
......@@ -145,6 +146,7 @@ export default {
this.selectionChange(val.guaranteeIndex, false)
if (val.ladderConditions) this.ladderConditions = JSON.parse(val.ladderConditions)
}
this.formRef && this.formRef.clearValidate()
},
deep: true,
immediate: true
......@@ -164,22 +166,6 @@ export default {
},
deep: true
},
'componentData.compensationMode': {
handler(val) {
if (val == 2) {
this.ladderConditions = [{
startValue: '',
endValue: '',
compensationAmount: ''
}, {
startValue: '',
endValue: '',
compensationAmount: ''
}]
} else this.ladderConditions = []
if (val == 1 && this.componentData.fixedCompensation) this.componentData.fixedCompensation = ''
}
},
},
computed: {
......@@ -206,7 +192,20 @@ export default {
},
mounted() { },
methods: {
radioChange(val) {
if (val == 2) {
this.ladderConditions = [{
startValue: '',
endValue: '',
compensationAmount: ''
}, {
startValue: '',
endValue: '',
compensationAmount: ''
}]
} else this.ladderConditions = []
if (val == 1 && this.componentData.fixedCompensation) this.componentData.fixedCompensation = ''
},
selectionChange(val, clear = true) {
let item = this.conditionForm[1],
{ conditionStartConfig, conditionEndConfig } = this,
......
......@@ -133,9 +133,8 @@ export default {
data: {
handler(newVal) {
this.componentData = deepClone(newVal)
console.log(JSON.parse(JSON.stringify(newVal)))
this.$nextTick(() => {
this.formRef.clearValidate()
this.formRef && this.formRef.clearValidate()
})
},
immediate: true,
......@@ -180,9 +179,7 @@ export default {
{ label: "其他(房租、水电、耗材等)/月", labelWidth: "240px", key: "otherCostPerMonth", type: 'input', filterRule: "decimalRange", min: 0, max: 99999999, precision: 2 },
{ label: "预估毛利率", key: "estimatedGrossMargin", type: 'input', unit: "%", filterRule: "decimalRange", min: 0, max: 100, precision: 2 },
{ label: "是否存在兜底", key: "hasGuarantee", type: 'addComponent', addComponent: 'BottomLineCondition', class: !this.isViewMode ? 'w100' : '', listKey: 'guaranteeConfigs' },
{
label: '兜底结算日期', key: 'monthlySettlementDate', type: 'select', viewKey: 'monthlySettlementDate', options: monthSettlementDateOptions, hide: (val) => val.e == 0
},
{ label: '兜底结算日期', key: 'monthlySettlementDate', type: 'select', viewKey: 'monthlySettlementDateText', options: monthSettlementDateOptions, hide: (val) => val.hasGuarantee == 0 },
],
rules: {
......@@ -213,7 +210,7 @@ export default {
getSelectText(i) {
const value = this.componentData[i.key]
if (this.isViewMode && i.viewKey) {
if (i.viewKey == 'monthlySettlementDate') return monthSettlementDateOptions.find(e => e.value == value).label || '-'
if (i.viewKey == 'monthlySettlementDateText') return monthSettlementDateOptions.find(e => e.value == value).label || '-'
else return this.componentData[i.viewKey] || value || '-'
}
if (!value || !i?.options?.length) return '-'
......
......@@ -224,7 +224,6 @@ export default {
})
}
if (item.hasGuarantee == 1) {
console.log('item.guaranteeConfigs', item.guaranteeConfigs)
if (item.guaranteeConfigs && item.guaranteeConfigs.length) {
item.guaranteeConfigs.forEach((c, num) => {
if (c.guaranteeStandard == null || c.guaranteeIndex == '') {
......@@ -256,7 +255,6 @@ export default {
params.trafficPartyDetails = i.trafficPartyDetails
sceneConfigs.push(params)
})
console.log(sceneConfigs)
if (flag) callback(true, { sceneConfigs })
else callback(false, message)
} else callback(false)
......
......@@ -25,6 +25,8 @@
<template v-if="pageComplete">
<el-button v-if="pageType == 'audit' && step == 4" type="primary" @click="rejectDialogVisible = true"
plain>驳回</el-button>
<el-button v-if="!['audit', 'view'].includes(pageType) && step == 3" type="primary" @click="prevStep"
plain>上一步</el-button>
<el-button v-if="pageType != 'view'" @click="submit" :loading="buttonLoading" type="primary">{{ submitText
}}</el-button>
</template>
......@@ -97,10 +99,10 @@
<div class="reject-input">
<div class="label">驳回原因:</div>
<div class="value">
<el-input v-model="rejectReason" placeholder="请输入" maxlength="50" type="textarea" :rows="4"
<el-input v-model="rejectReason" placeholder="请输入" maxlength="200" type="textarea" :rows="4"
resize="none"></el-input>
</div>
<div class="word-limit">{{ rejectReason.length }}/50</div>
<div class="word-limit">{{ rejectReason.length }}/200</div>
</div>
</div>
<template #footer>
......@@ -208,10 +210,15 @@ export default {
}
},
methods: {
async getDetail(businessCode, pageType) {
prevStep() {
let { businessCode, pageType, step } = this
this.getDetail(businessCode, pageType, true, step)
},
async getDetail(businessCode, pageType, isPrevStep, STEP) {
const data = await storeApproveQueryDetail({ businessCode }),
{ basicApproveInfo, trafficPartyConfigs, operateLogs, shelfType, updStep } = data,
step = updStep ? updStep + 1 : 2
// step = 2
step = isPrevStep ? STEP - 1 : (updStep ? updStep + 1 : 2)
this.basicinformationData = data
let basicinformationFormList = JSON.parse(basicApproveInfo)
if (pageType != 'reapply') {
......@@ -313,7 +320,8 @@ export default {
this.stepOneRef.formRef.validate(async (valid) => {
if (valid) {
try {
let { infoForm, sceneTypeName } = this.stepOneRef,
let { sceneTypeName } = this.stepOneRef,
infoForm = deepClone(this.stepOneRef.infoForm),
{ approveType } = this.$route.query,
{ sceneFiles } = infoForm,
basicApproveInfo = this.templateInfo.map((item) => {
......@@ -339,7 +347,9 @@ export default {
}
return item;
})
sceneFiles.map(i => delete i.name)
sceneFiles.map(i => {
delete i.name
})
const params = {
sceneFiles,
basicApproveInfo: JSON.stringify(basicApproveInfo),
......@@ -363,7 +373,6 @@ export default {
}
} else throw message
} catch (error) {
console.log(error)
this.dialogVisible = false
this.buttonLoading = false
setTimeout(() => {
......@@ -625,7 +634,7 @@ export default {
.word-limit {
position: absolute;
right: 0;
right: -5px;
bottom: 0;
font-size: 14px;
color: #999999;
......
......@@ -259,6 +259,28 @@ export default {
});
return list;
},
// 其他Tab已选节点所在的完整路径(用于判断父级是否需要禁用)
otherTabSelectedPathsWithLevel() {
return this.disabledGoodsTypeList.map((item) => {
let targetValue = null;
let level = 1; // 1: 一级, 2: 二级, 3: 三级
if (item.thirdLevelGoodsType) {
targetValue = item.thirdLevelGoodsType;
level = 3;
} else if (item.secondaryGoodsType) {
targetValue = item.secondaryGoodsType;
level = 2;
} else {
targetValue = item.goodsType;
level = 1;
}
if (targetValue) {
const path = this.findCompletePathByTargetValue(this.goodsList, targetValue);
return { path, level };
}
return null;
}).filter(Boolean);
},
// 带有 disabled 状态的树形数据(实时计算,确保响应式更新)
computedGoodsTypeTreeList() {
// 重新计算整个树,确保disabled状态实时更新
......@@ -272,6 +294,7 @@ export default {
// 收集当前Tab和其他Tab的选中路径
const currentPaths = this.currentTabSelectedPaths || [];
const otherPaths = this.otherTabSelectedPaths || [];
const otherPathsWithLevel = this.otherTabSelectedPathsWithLevel || [];
// 构建需要禁用的节点值集合
const shouldDisableValues = new Set();
......@@ -298,20 +321,14 @@ export default {
});
// 2. 处理其他Tab已选路径(跨Tab禁用规则)
otherPaths.forEach((path) => {
// 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选
otherPathsWithLevel.forEach(({ path, level }) => {
if (!path || !path.length) {
return;
}
// 其他Tab选中的节点本身也要禁用
path.forEach((value) => {
shouldDisableValues.add(value);
});
// 禁用该路径的所有祖先
for (let i = 0; i < path.length - 1; i++) {
shouldDisableValues.add(path[i]);
}
// 禁用该路径的所有后代
this.collectAllDescendantsByPath(tree, path, shouldDisableValues);
// 只禁用节点本身(防止重复选择)
shouldDisableValues.add(path[path.length - 1]);
});
// 设置disabled状态(排除当前Tab可取消勾选的节点)
......
......@@ -383,14 +383,14 @@ export default {
],
rules: {
signingEntityId: [{ required: true, message: "请选择签约主体", trigger: "change" }],
estimatedDeliveryCountPerMonth: [{ required: true, message: "请输入预估交付数/月", trigger: "change" }],
estimatedDeliveryCountPerMonth: [{ required: false, message: "请输入预估交付数/月", trigger: "change" }],
operationMode: [{ required: true, message: "请选择运营模式", trigger: "change" }],
partnerId: [{ required: true, message: "请选择服务商", trigger: "change" }],
yqMerchantId: [{ required: true, message: "请选择园区店", trigger: "change" }],
personnelCostRate: [{ required: true, message: "请输入人员成本占比", trigger: "change" }],
renovationEquipmentCost: [{ required: true, message: "请输入装修、设备总投入", trigger: "change" }],
otherCostPerMonth: [{ required: true, message: "请输入其他(房租、水电、耗材等)/月", trigger: "change" }],
estimatedGrossMargin: [{ required: true, message: "请输入预估毛利率", trigger: "change" }],
personnelCostRate: [{ required: false, message: "请输入人员成本占比", trigger: "change" }],
renovationEquipmentCost: [{ required: false, message: "请输入装修、设备总投入", trigger: "change" }],
otherCostPerMonth: [{ required: false, message: "请输入其他(房租、水电、耗材等)/月", trigger: "change" }],
estimatedGrossMargin: [{ required: false, message: "请输入预估毛利率", trigger: "change" }],
hasGuarantee: [{ required: true, message: "请选择是否存在兜底", trigger: "change" }],
monthlySettlementDate: [{ required: true, message: "请选择月度结算日期", trigger: "change" }],
},
......
......@@ -981,7 +981,6 @@ export default {
cascaderProps: {
multiple: true,
checkStrictly: true,
expandTrigger: "hover",
label: "categoryName",
value: "categoryType",
disabled: "disabled", // 显式配置 disabled 属性映射
......@@ -1167,6 +1166,28 @@ export default {
});
return list;
},
// 其他Tab已选节点所在的完整路径(用于判断父级是否需要禁用)
otherTabSelectedPathsWithLevel() {
return this.disabledGoodsTypeList.map((item) => {
let targetValue = null;
let level = 1; // 1: 一级, 2: 二级, 3: 三级
if (item.thirdLevelGoodsType) {
targetValue = item.thirdLevelGoodsType;
level = 3;
} else if (item.secondaryGoodsType) {
targetValue = item.secondaryGoodsType;
level = 2;
} else {
targetValue = item.goodsType;
level = 1;
}
if (targetValue) {
const path = this.findCompletePathByTargetValue(this.goodsList, targetValue);
return { path, level };
}
return null;
}).filter(Boolean);
},
// 带有 disabled 状态的树形数据(实时计算,确保响应式更新)
computedGoodsTypeTreeList() {
// 重新计算整个树,确保disabled状态实时更新
......@@ -1180,6 +1201,7 @@ export default {
// 收集当前Tab和其他Tab的选中路径
const currentPaths = this.currentTabSelectedPaths || [];
const otherPaths = this.otherTabSelectedPaths || [];
const otherPathsWithLevel = this.otherTabSelectedPathsWithLevel || [];
// 构建需要禁用的节点值集合
const shouldDisableValues = new Set();
......@@ -1206,20 +1228,14 @@ export default {
});
// 2. 处理其他Tab已选路径(跨Tab禁用规则)
otherPaths.forEach((path) => {
// 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选
otherPathsWithLevel.forEach(({ path, level }) => {
if (!path || !path.length) {
return;
}
// 其他Tab选中的节点本身也要禁用
path.forEach((value) => {
shouldDisableValues.add(value);
});
// 禁用该路径的所有祖先
for (let i = 0; i < path.length - 1; i++) {
shouldDisableValues.add(path[i]);
}
// 禁用该路径的所有后代
this.collectAllDescendantsByPath(tree, path, shouldDisableValues);
// 只禁用节点本身(防止重复选择)
shouldDisableValues.add(path[path.length - 1]);
});
// 设置disabled状态(排除当前Tab可取消勾选的节点)
......
const {
filterFormListForDisplay,
isFieldVisibleBySpecs,
} = require("@/views/residentManage/journalRecord/utils/journalFormVisibility");
const staffSchemaList = [
{
key: "F1-1",
type: "radio",
sortNum: "1",
label: "今日出勤",
options: [
{ label: "在岗", value: "1" },
{ label: "调休", value: "2" },
],
},
{
key: "F1-2",
type: "numberInput",
sortNum: "2",
label: "延保退单",
rules: { keys: ["F1-1"], result: 'val1 == "在岗"' },
baseSceneCode: [110201, 110202],
},
{
key: "F1-4",
type: "textarea",
sortNum: "4",
label: "备注",
},
{
key: "F1-5",
type: "group",
sortNum: "5",
label: "问界",
brandId: [3454],
rules: { keys: ["F1-1"], result: 'val1 == "在岗"' },
children: [
{ key: "F1-5-1", type: "numberInput", sortNum: "1", label: "轻改个人大定触客/进群数", baseSceneCode: [100101] },
{ key: "F1-5-2", type: "numberInput", sortNum: "2", label: "轻改个人售后触客数", baseSceneCode: [100101] },
],
},
];
function buildOffDutyFormListWithBrandGroup() {
return [
{ ...staffSchemaList[0], value: "调休" },
{ ...staffSchemaList[2], value: "备注内容" },
{
...staffSchemaList[3],
value: {},
children: [
{ ...staffSchemaList[3].children[0], value: 2 },
{ ...staffSchemaList[3].children[1], value: 3 },
],
},
];
}
function buildOffDutyFormListWithoutBrandGroup() {
return [
{ ...staffSchemaList[0], value: "调休" },
{ ...staffSchemaList[2], value: "备注内容" },
];
}
function buildOnDutyFormList() {
return [
{ ...staffSchemaList[0], value: "在岗" },
{ ...staffSchemaList[1], value: 1 },
{ ...staffSchemaList[2], value: "备注内容" },
{
...staffSchemaList[3],
value: {},
children: staffSchemaList[3].children,
},
];
}
function buildRealOffDutyFormList() {
return [
{
key: "F1-1",
type: "radio",
sortNum: "1",
label: "今日出勤",
options: [
{ label: "在岗", value: "在岗" },
{ label: "调休", value: "调休" },
],
value: "调休",
},
{
key: "F1-12",
type: "numberInput",
sortNum: "2",
label: "轻改问界鸿蒙个人大定触客/进群数",
baseSceneCode: [100101, 100102, 100103],
value: 10,
},
{
key: "F1-13",
type: "numberInput",
sortNum: "3",
label: "轻改问界鸿蒙个人售后触客数",
baseSceneCode: [100101, 100102, 100103],
value: 20,
},
{
key: "F1-4",
type: "textarea",
sortNum: "6",
label: "备注",
value: "",
},
{
key: "F1-5",
type: "group",
sortNum: "7",
label: "问界",
brandId: [3454],
rules: { keys: ["F1-1"], result: 'val1 == "在岗"' },
children: [
{
key: "F1-5-3",
type: "numberInput",
sortNum: "10",
label: "轻改个人交付引荐数",
baseSceneCode: [100101, 100102, 100103],
value: 20,
},
],
},
{
key: "F1-11",
type: "group",
sortNum: "48",
label: "其他品牌",
rules: { keys: ["F1-1"], result: 'val1 == "在岗"' },
filterBrandId: [3454, 3503, 3458, 3574, 3502, 3067],
children: [
{
key: "F1-11-1",
type: "numberInput",
sortNum: "49",
label: "轻改个人售前有效触客数",
baseSceneCode: [100101, 100102, 100103],
value: 20,
},
],
},
];
}
describe("journalFormVisibility", () => {
it("调休且 jsonContent 含品牌 group 时不应展示出勤联动 group", () => {
const formList = buildOffDutyFormListWithBrandGroup();
const detail = {
schema: { list: staffSchemaList },
baseSceneCode: 100101,
brandIds: [3454],
sceneList: [{ baseSceneCode: 100101 }],
};
const visible = filterFormListForDisplay(formList, detail);
const keys = visible.map((item) => item.key);
expect(keys).toEqual(["F1-1", "F1-4"]);
});
it("调休真实 jsonContent 应展示 F1-12/F1-13 但隐藏 F1-5/F1-11 group", () => {
const formList = buildRealOffDutyFormList();
const detail = {
sceneType: "1",
};
const visible = filterFormListForDisplay(formList, detail);
const keys = visible.map((item) => item.key);
expect(keys).toEqual(["F1-1", "F1-12", "F1-13", "F1-4"]);
});
it("调休且 jsonContent 无品牌 group 时应仅保留 F1-1 与 F1-4", () => {
const formList = buildOffDutyFormListWithoutBrandGroup();
const detail = {
schema: { list: staffSchemaList },
baseSceneCode: 100101,
brandIds: [3454],
sceneList: [{ baseSceneCode: 100101 }],
};
const visible = filterFormListForDisplay(formList, detail);
const keys = visible.map((item) => item.key);
expect(keys).toEqual(["F1-1", "F1-4"]);
});
it("在岗时应展示匹配 brandIds 的品牌 group", () => {
const formList = buildOnDutyFormList();
const detail = {
schema: { list: staffSchemaList },
baseSceneCode: 100101,
brandIds: [3454],
sceneList: [{ baseSceneCode: 100101 }],
};
const visible = filterFormListForDisplay(formList, detail);
const keys = visible.map((item) => item.key);
expect(keys).toContain("F1-1");
expect(keys).toContain("F1-5");
expect(keys).not.toContain("F1-2");
});
it("详情 echo 应绕过 brandId 但仍校验 baseSceneCode", () => {
const field = {
key: "F3-1",
type: "subform",
baseSceneCode: [110201, 110202],
brandId: [999],
};
const ctx = {
hasDetailEcho: true,
echoSubformKeys: new Set(["F3-1"]),
brandIds: [3067],
sceneList: [{ baseSceneCode: 110201 }],
};
expect(isFieldVisibleBySpecs(field, ctx, {}, { schemaList: [field] })).toBe(true);
const mismatchCtx = {
...ctx,
sceneList: [{ baseSceneCode: 100101 }],
};
expect(isFieldVisibleBySpecs(field, mismatchCtx, {}, { schemaList: [field] })).toBe(false);
});
it("sceneType 权益时不应展示轻改顶层字段", () => {
const formList = [
{
key: "F1-12",
type: "numberInput",
sortNum: "2",
label: "轻改问界鸿蒙个人大定触客/进群数",
baseSceneCode: [100101, 100102, 100103],
value: 10,
},
];
const detail = {
sceneType: "0",
};
const visible = filterFormListForDisplay(formList, detail);
expect(visible).toHaveLength(0);
});
it("group 无 rules 仅有 brandId 时调休应不可见", () => {
const formList = buildRealOffDutyFormList().map((field) => {
if (field.key === "F1-5") {
const { rules, ...rest } = field;
return rest;
}
return field;
});
const detail = { sceneType: "1" };
const visible = filterFormListForDisplay(formList, detail);
const keys = visible.map((item) => item.key);
expect(keys).toEqual(["F1-1", "F1-12", "F1-13", "F1-4"]);
});
it("group rules 仅含 min 无 keys 时调休应不可见", () => {
const formList = buildRealOffDutyFormList().map((field) => {
if (field.key === "F1-5") {
return { ...field, rules: { min: 0 } };
}
return field;
});
const detail = { sceneType: "1" };
const visible = filterFormListForDisplay(formList, detail);
const keys = visible.map((item) => item.key);
expect(keys).toEqual(["F1-1", "F1-12", "F1-13", "F1-4"]);
});
it("schema.list 非空但无 F1-5 rules 时调休应不可见", () => {
const formList = buildRealOffDutyFormList().map((field) => {
if (field.key === "F1-5" || field.key === "F1-11") {
const { rules, ...rest } = field;
return rest;
}
return field;
});
const schemaWithoutGroupRules = [
{
key: "F1-1",
type: "radio",
sortNum: "1",
label: "今日出勤",
options: [
{ label: "在岗", value: "在岗" },
{ label: "调休", value: "调休" },
],
},
{
key: "F1-5",
type: "group",
sortNum: "7",
label: "问界",
brandId: [3454],
children: [],
},
{
key: "F1-11",
type: "group",
sortNum: "48",
label: "其他品牌",
filterBrandId: [3454],
children: [],
},
];
const detail = {
sceneType: "1",
schema: { list: schemaWithoutGroupRules },
};
const visible = filterFormListForDisplay(formList, detail);
const keys = visible.map((item) => item.key);
expect(keys).toEqual(["F1-1", "F1-12", "F1-13", "F1-4"]);
});
it("subform 行内 childrenShowRules 应过滤不可见列", () => {
const subformField = {
key: "F3-1",
type: "subform",
sortNum: "1",
label: "洽谈明细",
baseSceneCode: [110201, 110202],
brandId: [3067],
children: [[
{ key: "F3-1-10", type: "radio", sortNum: "10", label: "是否成交", options: [{ label: "是", value: "是" }, { label: "否", value: "否" }] },
{ key: "F3-1-11", type: "input", sortNum: "11", label: "订单号" },
]],
childrenShowRules: {
"F3-1-11": { keys: ["F3-1-10"], result: 'val1 == "是"' },
},
value: [[
{ key: "F3-1-10", type: "radio", value: "否" },
{ key: "F3-1-11", type: "input", value: "ORDER-001" },
]],
};
const detail = {
schema: { list: [subformField] },
brandIds: [3067],
sceneList: [{ baseSceneCode: 110201 }],
};
const visible = filterFormListForDisplay([subformField], detail);
expect(visible).toHaveLength(1);
expect(visible[0].value[0].map((cell) => cell.key)).toEqual(["F3-1-10"]);
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!