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 1942 additions and 299 deletions
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
# VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS # VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config 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) # 使用 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 VUE_APP_USE_DEVELOP_AXIOS=true
# 门店工作汇报:默认走真实 dailyReport 接口;本地需 Mock 时设 VUE_APP_JOURNAL_MOCK=true # 门店工作汇报:默认走真实 dailyReport 接口;本地需 Mock 时设 VUE_APP_JOURNAL_MOCK=true
...@@ -26,7 +26,10 @@ export function mapDetailResponse(res = {}, fallback = {}) { ...@@ -26,7 +26,10 @@ export function mapDetailResponse(res = {}, fallback = {}) {
subformDataList: res.subformDataList, subformDataList: res.subformDataList,
reportTemplateId: res.reportTemplateId, reportTemplateId: res.reportTemplateId,
baseSceneCode: res.baseSceneCode, baseSceneCode: res.baseSceneCode,
sceneType: res.sceneType ?? fallback.sceneType,
schema: res.schema, schema: res.schema,
brandIds: res.brandIds ?? fallback.brandIds ?? [],
sceneList: res.sceneList ?? fallback.sceneList ?? [],
}; };
} }
......
...@@ -10,7 +10,7 @@ export function mapOverviewRow(row = {}) { ...@@ -10,7 +10,7 @@ export function mapOverviewRow(row = {}) {
return { return {
id: row.id ?? row.dailyReportRecordId, id: row.id ?? row.dailyReportRecordId,
staffName: row.staffName, staffName: row.staffName ?? row.staffname ?? "",
staffUuid: row.staffUuid, staffUuid: row.staffUuid,
merchantId: row.merchantId, merchantId: row.merchantId,
merchantName: row.merchantName, merchantName: row.merchantName,
...@@ -20,7 +20,6 @@ export function mapOverviewRow(row = {}) { ...@@ -20,7 +20,6 @@ export function mapOverviewRow(row = {}) {
staffCount: row.staffCount, staffCount: row.staffCount,
lastSaveTime: createdDate, lastSaveTime: createdDate,
submitTime: reportStatus === 1 ? (row.submitTime ?? createdDate) : (row.submitTime || ""), submitTime: reportStatus === 1 ? (row.submitTime ?? createdDate) : (row.submitTime || ""),
submitUserName: row.submitUserName ?? row.submitStaffName ?? "",
reportDate: row.reportDate, reportDate: row.reportDate,
templateType: row.templateType, templateType: row.templateType,
reportStatus, reportStatus,
......
...@@ -78,6 +78,7 @@ function buildStoreDailyList(params) { ...@@ -78,6 +78,7 @@ function buildStoreDailyList(params) {
merchantName: store.merchantName, merchantName: store.merchantName,
sceneType: String(store.sceneType), sceneType: String(store.sceneType),
staffCount: 3, staffCount: 3,
staffName: index % 3 === 0 ? "" : STAFF_LIST[index % STAFF_LIST.length].staffName,
createdDate: "2026-06-12 14:41:00", createdDate: "2026-06-12 14:41:00",
reportStatus: index % 3 === 0 ? 0 : 1, reportStatus: index % 3 === 0 ? 0 : 1,
reportDate: params.reportDate, reportDate: params.reportDate,
......
...@@ -109,7 +109,6 @@ export default { ...@@ -109,7 +109,6 @@ export default {
}, },
value: { value: {
required: true, required: true,
type: [Array, String, Number],
}, },
fieldName: { fieldName: {
type: Object, type: Object,
...@@ -236,7 +235,7 @@ export default { ...@@ -236,7 +235,7 @@ export default {
}); });
} }
}, },
handleSelectChange(e) { handleSelectChange(e, d) {
this.$emit("input", e); this.$emit("input", e);
if (isFunction(this.$listeners?.change)) { if (isFunction(this.$listeners?.change)) {
this.$listeners.change(e); this.$listeners.change(e);
......
...@@ -5,7 +5,7 @@ const path = require("path"); ...@@ -5,7 +5,7 @@ const path = require("path");
const { getAxiosConfigKey } = require("./resolveApiName"); const { getAxiosConfigKey } = require("./resolveApiName");
const DEFAULT_CONFIG_URL = process.env.VUE_APP_CONFIG_CENTER_URL 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"); const DEVELOP_CONFIG_PATH = path.join(__dirname, "../../common/baseConfig.develop.json");
......
...@@ -5,34 +5,34 @@ ...@@ -5,34 +5,34 @@
const API_NAME_MAPPING = { const API_NAME_MAPPING = {
"dj.smartcarlife": "axios", "dj.smartcarlife": "axios",
dj: "axios", "dj": "axios",
scrm: "axios2", "scrm": "axios2",
merchants: "axios3", "merchants": "axios3",
reportExport: "axios4", "reportExport": "axios4",
"glsx.accounts.biz.common.pictureUpload": "common", "glsx.accounts.biz.common.pictureUpload": "common",
clue: "axios5", "clue": "axios5",
"dj.businessSchool": "axios6", "dj.businessSchool": "axios6",
script: "axios7", "script": "axios7",
staff: "axios9", "staff": "axios9",
riskmanage: "axios10", "riskmanage": "axios10",
strategy: "axios_strategy", "strategy": "axios_strategy",
supervisor: "axios_supervisor", "supervisor": "axios_supervisor",
oaapproval: "axios_oaapproval", "oaapproval": "axios_oaapproval",
taskcenter: "axiosTaskCenter", "taskcenter": "axiosTaskCenter",
}; };
const SIGN_WAY = { const SIGN_WAY = {
"dj.smartcarlife": "sha1", "dj.smartcarlife": "sha1",
dj: "sha1", "dj": "sha1",
scrm: "sha1", "scrm": "sha1",
glsx: "md5", "glsx": "md5",
"glsx.accounts.biz.common.pictureUpload": "md5", "glsx.accounts.biz.common.pictureUpload": "md5",
clue: "sha1", "clue": "sha1",
script: "sha1", "script": "sha1",
staff: "sha1", "staff": "sha1",
riskmanage: "sha1", "riskmanage": "sha1",
oaapproval: "sha1", "oaapproval": "sha1",
taskcenter: "sha1", "taskcenter": "sha1",
}; };
/** /**
...@@ -77,7 +77,7 @@ function resolveApiName(method = "") { ...@@ -77,7 +77,7 @@ function resolveApiName(method = "") {
if (method.includes("dj.api.taskcenter")) { if (method.includes("dj.api.taskcenter")) {
return "taskcenter"; return "taskcenter";
} }
if (method.includes("merchants.api.open.createMerchantWithPermissions")) { if (method.includes("merchants.api.open.createMerchantWithPermissions") || method.includes("merchants.api.oaapproval")) {
return "oaapproval"; return "oaapproval";
} }
if (method.includes("dj.api.marketing")) { if (method.includes("dj.api.marketing")) {
......
...@@ -9,13 +9,13 @@ import store from "@/store"; ...@@ -9,13 +9,13 @@ import store from "@/store";
axios.defaults.withCredentials = true; axios.defaults.withCredentials = true;
// const expiresMinute = 60 // 过期时间(分钟) // const expiresMinute = 60 // 过期时间(分钟)
// 创建一个错误 // 创建一个错误
export function errorCreate (msg) { export function errorCreate(msg) {
const error = new Error(msg); const error = new Error(msg);
errorLog(error); errorLog(error);
throw error; throw error;
} }
// 记录和显示错误 // 记录和显示错误
function errorLog (error) { function errorLog(error) {
console.log("error", error.toString(), error); console.log("error", error.toString(), error);
// 添加到日志 // 添加到日志
store.dispatch("d2admin/log/push", { store.dispatch("d2admin/log/push", {
...@@ -148,7 +148,9 @@ service.interceptors.response.use( ...@@ -148,7 +148,9 @@ service.interceptors.response.use(
return errorCreate("登录超时,请重新登录"); return errorCreate("登录超时,请重新登录");
// return Promise.reject(new Error(response.message || 'Error')) // return Promise.reject(new Error(response.message || 'Error'))
} }
if (returnAll) return dataAxios; if (returnAll) {
return dataAxios;
}
const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode; const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode;
switch (+codeValue) { switch (+codeValue) {
case ruleResult.code_success_value: case ruleResult.code_success_value:
...@@ -224,8 +226,9 @@ service.interceptors.response.use( ...@@ -224,8 +226,9 @@ service.interceptors.response.use(
if (!error.config?.skipGlobalLoading) { if (!error.config?.skipGlobalLoading) {
store.commit("d2admin/loading/set", false); store.commit("d2admin/loading/set", false);
} }
if (!error.__CANCEL__) if (!error.__CANCEL__) {
errorLog(error); // 取消请求 不做错误提示 errorLog(error);
} // 取消请求 不做错误提示
return Promise.reject(error); return Promise.reject(error);
}, },
); );
......
...@@ -748,6 +748,11 @@ export const routerName = { ...@@ -748,6 +748,11 @@ export const routerName = {
parentId: "9031803", parentId: "9031803",
name: "商品查看", name: "商品查看",
}, },
{
authId: "90318102",
parentId: "9031803",
name: "常规商品详情",
},
], ],
}, },
{ {
...@@ -761,6 +766,11 @@ export const routerName = { ...@@ -761,6 +766,11 @@ export const routerName = {
name: "商品编辑", name: "商品编辑",
parentId: "90318", parentId: "90318",
}, },
{
authId: "90318101",
parentId: "9031803",
name: "常规上架",
},
], ],
}, },
{ {
...@@ -780,7 +790,7 @@ export const routerName = { ...@@ -780,7 +790,7 @@ export const routerName = {
90318101: { 90318101: {
path: "/goods-shelf/normal-modify", path: "/goods-shelf/normal-modify",
name: "goodsShelfNormalCreate", name: "goodsShelfNormalModify",
meta: { meta: {
title: "常规上架", title: "常规上架",
authId: "90318101", authId: "90318101",
...@@ -790,6 +800,19 @@ export const routerName = { ...@@ -790,6 +800,19 @@ export const routerName = {
}, },
component: _import("goods/shelfProduct/view/normalModify/index"), 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: { 9031802: {
path: "/goods-shelf/modify", path: "/goods-shelf/modify",
...@@ -803,6 +826,7 @@ export const routerName = { ...@@ -803,6 +826,7 @@ export const routerName = {
}, },
component: _import("goods/shelfProduct/view/modify/index"), component: _import("goods/shelfProduct/view/modify/index"),
}, },
// 特殊商品详情
9031805: { 9031805: {
path: "/goods-shelf/detail", path: "/goods-shelf/detail",
name: "goodsShelfDetail", name: "goodsShelfDetail",
......
...@@ -91,9 +91,9 @@ ...@@ -91,9 +91,9 @@
</div> </div>
<div class="drawer-footer"> <div class="drawer-footer">
<el-button @click="handleClose"> <el-button @click="handleClose">
取消 {{ readonly ? "关闭" : "取消" }}
</el-button> </el-button>
<el-button v-if="drawerMode === 'approve'" <el-button v-if="!readonly && drawerMode === 'approve'"
type="primary" type="primary"
:loading="submitting" :loading="submitting"
@click="handleSubmit"> @click="handleSubmit">
...@@ -147,6 +147,10 @@ export default { ...@@ -147,6 +147,10 @@ export default {
type: Object, type: Object,
default: null, default: null,
}, },
readonly: {
type: Boolean,
default: false,
},
}, },
data() { data() {
const validateRemark = (rule, value, callback) => { const validateRemark = (rule, value, callback) => {
...@@ -274,6 +278,9 @@ export default { ...@@ -274,6 +278,9 @@ export default {
}, },
}, },
drawerMode() { drawerMode() {
if (this.readonly) {
return "view";
}
return getDrawerMode(this.detailInfo); return getDrawerMode(this.detailInfo);
}, },
showSecondRoundSection() { showSecondRoundSection() {
......
...@@ -97,6 +97,13 @@ ...@@ -97,6 +97,13 @@
</template> </template>
<template slot="auth-button" slot-scope="scope"> <template slot="auth-button" slot-scope="scope">
<el-button <el-button
v-if="canViewProcessRow(scope.scope)"
type="text"
@click="handleViewProcess(scope.scope)"
>
查看
</el-button>
<el-button
v-if="canProcessRow(scope.scope)" v-if="canProcessRow(scope.scope)"
type="text" type="text"
@click="handleProcess(scope.scope)" @click="handleProcess(scope.scope)"
...@@ -231,6 +238,7 @@ ...@@ -231,6 +238,7 @@
<abnormal-flow-process-drawer <abnormal-flow-process-drawer
:visible.sync="processDrawerVisible" :visible.sync="processDrawerVisible"
:row-data="currentProcessRow" :row-data="currentProcessRow"
:readonly="processDrawerReadonly"
@success="handleProcessSuccess" @success="handleProcessSuccess"
/> />
<template slot="footer"> <template slot="footer">
...@@ -278,6 +286,7 @@ export default { ...@@ -278,6 +286,7 @@ export default {
lockSwitchLoading: false, lockSwitchLoading: false,
previousLockFlag: "N", previousLockFlag: "N",
processDrawerVisible: false, processDrawerVisible: false,
processDrawerReadonly: false,
currentProcessRow: null, currentProcessRow: null,
// Confirm Dialog Data // Confirm Dialog Data
...@@ -432,7 +441,7 @@ export default { ...@@ -432,7 +441,7 @@ export default {
transactionTableParams: { transactionTableParams: {
listName: "list", listName: "list",
tableOption: { tableOption: {
width: "100px", width: "140px",
fixed: "right" fixed: "right"
}, },
tableColumns: [ tableColumns: [
...@@ -666,9 +675,15 @@ export default { ...@@ -666,9 +675,15 @@ export default {
} }
return Number(row.declarationApprovalStatus) === APPROVAL_STATUS.WAIT_BACKEND return Number(row.declarationApprovalStatus) === APPROVAL_STATUS.WAIT_BACKEND
}, },
canViewProcessRow(row) {
if (!row || !row.declarationId) {
return false
}
return getApprovalStatusMeta(row.declarationApprovalStatus).label !== "-"
},
async fetchShopLockConfig() { async fetchShopLockConfig() {
const { merchantId, merchantName } = this.routerInfo const { merchantId, merchantName, storeType } = this.routerInfo
if (!merchantId) { if (!merchantId || storeType === undefined || storeType === "") {
return return
} }
try { try {
...@@ -676,7 +691,7 @@ export default { ...@@ -676,7 +691,7 @@ export default {
const res = await getShopLockConfig({ const res = await getShopLockConfig({
merchantId, merchantId,
merchantName, merchantName,
storeType: 0 storeType
}) })
const lockFlag = res && res.lockFlag ? res.lockFlag : "N" const lockFlag = res && res.lockFlag ? res.lockFlag : "N"
this.abnormalFlowLockFlag = lockFlag this.abnormalFlowLockFlag = lockFlag
...@@ -689,12 +704,17 @@ export default { ...@@ -689,12 +704,17 @@ export default {
}, },
async handleLockSwitchChange(val) { async handleLockSwitchChange(val) {
const prev = this.previousLockFlag 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 { try {
await saveShopLockConfig({ await saveShopLockConfig({
merchantId, merchantId,
merchantName, merchantName,
storeType: 0, storeType,
lockFlag: val lockFlag: val
}) })
this.previousLockFlag = val this.previousLockFlag = val
...@@ -708,11 +728,17 @@ export default { ...@@ -708,11 +728,17 @@ export default {
this.abnormalFlowLockFlag = prev this.abnormalFlowLockFlag = prev
} }
}, },
handleViewProcess(row) {
this.processDrawerReadonly = true
this.currentProcessRow = row
this.processDrawerVisible = true
},
handleProcess(row) { handleProcess(row) {
if (!this.canProcessRow(row)) { if (!this.canProcessRow(row)) {
this.$message.warning("仅待后台审批的报备可处理") this.$message.warning("仅待后台审批的报备可处理")
return return
} }
this.processDrawerReadonly = false
this.currentProcessRow = row this.currentProcessRow = row
this.processDrawerVisible = true this.processDrawerVisible = true
}, },
......
...@@ -476,6 +476,7 @@ export default { ...@@ -476,6 +476,7 @@ export default {
query: { query: {
merchantId: row.merchantId, merchantId: row.merchantId,
merchantName: row.merchantName, merchantName: row.merchantName,
storeType: row.storeType,
startTime: this.searchFormSearch.startTime, startTime: this.searchFormSearch.startTime,
endTime: this.searchFormSearch.endTime endTime: this.searchFormSearch.endTime
} }
......
...@@ -189,15 +189,27 @@ export function postReconciliationConfigOtherGoodsApi(data = {}) { ...@@ -189,15 +189,27 @@ export function postReconciliationConfigOtherGoodsApi(data = {}) {
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
// 获取 product 的 原上架id用的列表 // 获取 product 的 原上架id用的列表 - 商品
export function postProductOldMerchantGoodsCodeList(data = {}) { export function postProductOldMerchantGoodsCodeList(data = {}) {
data.method = "dj.api.marketing.goods.page"; data.method = "dj.api.marketing.goods.page";
return request(data, RequestMethods.POST); 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 = {}) { export function postProductServiceList(data = {}) {
// 只要膜类 // 只要膜类
data.categoryId = 1; data.categoryId = 1;
return getServiceItem(data); return getServiceItem(data);
} }
// 获取 服务项目
export function postProductCostCalculateApi(data = {}) {
data.method = "dj.api.smartcarlife.merchantGoodsInfo.productCost.calculate";
return request(data, RequestMethods.POST);
}
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
<div v-if="form.groupType !== 1" style="display: flex"> <div v-if="form.groupType !== 1" style="display: flex">
<el-form-item label="分账品类" <el-form-item label="分账品类"
prop="specialDetail.categoryType"> prop="specialDetail.categoryType">
<!-- 5.8.4 禁止修改 -->
<el-select v-model="form.categoryType" <el-select v-model="form.categoryType"
style="width:414px" style="width:414px"
disabled
@change="handleCategoryTypeChange"> @change="handleCategoryTypeChange">
<el-option v-for="item in options.categoryType" <el-option v-for="item in options.categoryType"
:key="item.value" :key="item.value"
...@@ -17,12 +19,14 @@ ...@@ -17,12 +19,14 @@
label-width="12px" label-width="12px"
prop="specialDetail.goodsTypeGroupRelationList" prop="specialDetail.goodsTypeGroupRelationList"
required> required>
<!-- 5.8.4 禁止修改 -->
<RemoteSelect v-if="form.categoryType === 2" <RemoteSelect v-if="form.categoryType === 2"
:key="form.categoryType" :key="form.categoryType"
v-model="form.goodsTypeGroupRelationList" v-model="form.goodsTypeGroupRelationList"
placeholder="请选择商品" placeholder="请选择商品"
style="width:390px" style="width:390px"
value-key="merchantGoodsCode" value-key="merchantGoodsCode"
disabled
:fetch-api="fetchUpgradeGoodsList" :fetch-api="fetchUpgradeGoodsList"
:field-name="{ :field-name="{
value: 'merchantGoodsCode', value: 'merchantGoodsCode',
...@@ -37,6 +41,7 @@ ...@@ -37,6 +41,7 @@
}" }"
:options.sync="options.upgradeGoods"> :options.sync="options.upgradeGoods">
</RemoteSelect> </RemoteSelect>
<!-- 5.8.4 禁止修改 -->
<RemoteSelect v-if="form.categoryType === 3" <RemoteSelect v-if="form.categoryType === 3"
:key="form.categoryType" :key="form.categoryType"
ref="packageGoods" ref="packageGoods"
...@@ -44,6 +49,7 @@ ...@@ -44,6 +49,7 @@
placeholder="请选择套餐" placeholder="请选择套餐"
style="width:390px" style="width:390px"
value-key="packageCode" value-key="packageCode"
disabled
:fetch-api="getPackagesGoodsList" :fetch-api="getPackagesGoodsList"
:field-name="{ :field-name="{
value: 'packageCode', value: 'packageCode',
......
...@@ -135,23 +135,24 @@ ...@@ -135,23 +135,24 @@
<span class="label"> <span class="label">
{{ item.title }} {{ item.title }}
</span> </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" class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(item)"> @click.stop="handleRemoveTitleSelectItem(item)">
</span> </span> -->
</div> </div>
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
<!-- 5.8.4 取消新增 -->
<span v-if="useEdit && editState === VIEW_MODE.VIEW" class="actions-wrapper"> <!-- <span v-if="useEdit && editState === VIEW_MODE.VIEW" class="actions-wrapper">
<el-button icon="el-icon-plus" <el-button icon="el-icon-plus"
size="small" size="small"
plain plain
@click="handleAppendSpecialCategory"> @click="handleAppendSpecialCategory">
新增 新增
</el-button> </el-button>
</span> </span> -->
</div> </div>
<div v-if="tabsActive" class="public-container"> <div v-if="tabsActive" class="public-container">
......
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
<div v-if="form.groupType !== 1" style="display: flex"> <div v-if="form.groupType !== 1" style="display: flex">
<el-form-item label="分账品类" <el-form-item label="分账品类"
prop="specialDetail.categoryType"> prop="specialDetail.categoryType">
<!-- 5.8.4 禁止修改 -->
<el-select v-model="form.categoryType" <el-select v-model="form.categoryType"
style="width:414px" style="width:414px"
disabled
@change="handleCategoryTypeChange"> @change="handleCategoryTypeChange">
<el-option v-for="item in options.categoryType" <el-option v-for="item in options.categoryType"
:key="item.value" :key="item.value"
...@@ -18,13 +20,14 @@ ...@@ -18,13 +20,14 @@
label-width="12px" label-width="12px"
prop="specialDetail.goodsTypeGroupRelationList" prop="specialDetail.goodsTypeGroupRelationList"
required> required>
<!-- 5.8.4 取消修改 -->
<RemoteSelect v-if="form.categoryType === 2" <RemoteSelect v-if="form.categoryType === 2"
:key="form.categoryType" :key="form.categoryType"
v-model="form.goodsTypeGroupRelationList" v-model="form.goodsTypeGroupRelationList"
placeholder="请选择商品" placeholder="请选择商品"
style="width:390px" style="width:390px"
value-key="merchantGoodsCode" value-key="merchantGoodsCode"
disabled
:fetch-api="fetchUpgradeGoodsList" :fetch-api="fetchUpgradeGoodsList"
:field-name="{ :field-name="{
value: 'merchantGoodsCode', value: 'merchantGoodsCode',
...@@ -39,6 +42,7 @@ ...@@ -39,6 +42,7 @@
}" }"
:options.sync="options.upgradeGoods"> :options.sync="options.upgradeGoods">
</RemoteSelect> </RemoteSelect>
<!-- 5.8.4 取消修改 -->
<RemoteSelect v-if="form.categoryType === 3" <RemoteSelect v-if="form.categoryType === 3"
:key="form.categoryType" :key="form.categoryType"
ref="packageGoods" ref="packageGoods"
...@@ -46,6 +50,7 @@ ...@@ -46,6 +50,7 @@
placeholder="请选择套餐商品" placeholder="请选择套餐商品"
style="width:390px" style="width:390px"
value-key="packageCode" value-key="packageCode"
disabled
:fetch-api="fetchPackagesGoodsList" :fetch-api="fetchPackagesGoodsList"
:field-name="{ :field-name="{
value: 'packageCode', value: 'packageCode',
......
...@@ -102,23 +102,26 @@ ...@@ -102,23 +102,26 @@
<span class="label"> <span class="label">
{{ item.title }} {{ item.title }}
</span> </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" class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(item)"> @click.stop="handleRemoveTitleSelectItem(item)">
</span> </span> -->
</div> </div>
</el-option> </el-option>
</el-select> </el-select>
</div> </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" <el-button icon="el-icon-plus"
size="small" size="small"
plain plain
@click="handleAppendSpecialCategory"> @click="handleAppendSpecialCategory">
新增 新增
</el-button> </el-button>
</span> </span> -->
</div> </div>
<div v-if="tabsActive" class="public-container"> <div v-if="tabsActive" class="public-container">
...@@ -232,6 +235,8 @@ export default { ...@@ -232,6 +235,8 @@ export default {
form: { form: {
firstLineSunshineOnlinePointsFlag: "N", firstLineSunshineOnlinePointsFlag: "N",
firstLineSunshine2OnlinePointsFlag: "N", firstLineSunshine2OnlinePointsFlag: "N",
managementMarketingFeesPrerequisite: "N",
firstLineSunshinePrerequisite: "N",
operationMode: undefined, operationMode: undefined,
specialDetail: { specialDetail: {
categoryType: undefined, categoryType: undefined,
...@@ -241,17 +246,20 @@ export default { ...@@ -241,17 +246,20 @@ export default {
}, },
}, },
rules: { rules: {
// 一线阳光是否开启线上积分
"firstLineSunshineOnlinePointsFlag": [ "firstLineSunshineOnlinePointsFlag": [
{ required: true, trigger: "change" }, { required: true, message: "请选择一线阳光是否开启线上积分", trigger: "change" },
], ],
"firstLineSunshine2OnlinePointsFlag": [ "firstLineSunshine2OnlinePointsFlag": [
{ required: true, trigger: "change" }, { required: true, message: "请选择一线阳光2是否开启线上积分", trigger: "change" },
], ],
// 管理层市场费是否前置
"managementMarketingFeesPrerequisite": [ "managementMarketingFeesPrerequisite": [
{ required: true, trigger: "change" }, { required: true, message: "请选择管理层市场费是否前置", trigger: "change" },
], ],
// 请选择一线阳光是否前置
"firstLineSunshinePrerequisite": [ "firstLineSunshinePrerequisite": [
{ required: true, trigger: "change" }, { required: true, message: "请选择一线阳光是否前置", trigger: "change" },
], ],
"specialDetail.categoryType": [ "specialDetail.categoryType": [
{ required: true, message: "请选择分账品类", trigger: "change" }, { required: true, message: "请选择分账品类", trigger: "change" },
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
:merchant-id-list="merchantIdList" :merchant-id-list="merchantIdList"
:product="productData" :product="productData"
:shelf-type="shelfType" :shelf-type="shelfType"
:show-business-line="false" :show-business-line="false"
:show-gift-cost="false" :show-gift-cost="false"
:show-old-merchant-goods-code="false" :show-old-merchant-goods-code="false"
...@@ -19,7 +18,6 @@ ...@@ -19,7 +18,6 @@
:show-sales-proportion-percent="false" :show-sales-proportion-percent="false"
:show-settlement-type="false" :show-settlement-type="false"
:show-shelf-style="false" :show-shelf-style="false"
@update:upgradeGoods="handleUpdateProduct($event, index)" /> @update:upgradeGoods="handleUpdateProduct($event, index)" />
<el-divider class="divider"></el-divider> <el-divider class="divider"></el-divider>
</div> </div>
......
...@@ -39,20 +39,23 @@ ...@@ -39,20 +39,23 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- TODO: 且上架类型的值 为 修改 才显示 --> <!-- 单店模式 且 类型 为修改 -->
<el-col v-if="isSingleShopMode(shelfType) && isShelfStyleEdit(packageForm.shelfStyle)" :span="12"> <el-col v-if="isSingleShopMode(shelfType) && isShelfStyleEdit(packageForm.shelfStyle)" :span="12">
<el-form-item label="原上架ID:" <el-form-item label="原上架ID:"
prop="oldMerchantGoodsCode" prop="oldMerchantGoodsCode"
:rules="[{ required: true, message: '请选择原上架ID', trigger: 'change' }]"> :rules="[{ required: true, message: '请选择原上架ID', trigger: 'change' }]">
<el-select v-model="packageForm.oldMerchantGoodsCode"
placeholder="请选择"> <RemoteSelect v-model="packageForm.oldMerchantGoodsCode"
<el-option v-for="item in options.serviceList" placeholder="原上架ID"
:key="item.id" :fetch-api="fetchMerchantGoodsCode"
:label="item.serviceItemsName" :field-name="{
:value="item.id"> value: 'packageId',
</el-option> label: 'packageId',
</el-select> }"
:immediate="true"
:multiple="false"
:options.sync="options.oldMerchantGoodsCode">
</RemoteSelect>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -68,20 +71,6 @@ ...@@ -68,20 +71,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </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-col title="按子商品的售价进行累计,实时计算" :span="12">
<el-form-item label="售价/件:" prop="sellPrice"> <el-form-item label="售价/件:" prop="sellPrice">
...@@ -146,21 +135,6 @@ ...@@ -146,21 +135,6 @@
</div> </div>
</el-form-item> </el-form-item>
</el-col> </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-row>
</el-form> </el-form>
...@@ -180,8 +154,9 @@ ...@@ -180,8 +154,9 @@
:base-scene-code="baseSceneCode" :base-scene-code="baseSceneCode"
:disabled-positions="getProductDisabledPositions(goodsForm.upgradeGoodsId, goodsForm.merchantGoodsCode)" :disabled-positions="getProductDisabledPositions(goodsForm.upgradeGoodsId, goodsForm.merchantGoodsCode)"
:edit-state="VIEW_MODE.EDIT" :edit-state="VIEW_MODE.EDIT"
:merchant-id="merchantId"
:merchant-id-list="merchantIdList" :merchant-id-list="merchantIdList"
:product.sync="goodsForm" :product.sync="productList[index]"
:shelf-type="shelfType" :shelf-type="shelfType"
:show-gift-cost="false" :show-gift-cost="false"
:show-old-merchant-goods-code="false" :show-old-merchant-goods-code="false"
...@@ -202,8 +177,10 @@ ...@@ -202,8 +177,10 @@
import { cloneDeep, isFunction, pick, reduce } from "lodash-es"; import { cloneDeep, isFunction, pick, reduce } from "lodash-es";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
import { settlementTypeOpt } from "@/common/constants.js"; import { settlementTypeOpt } from "@/common/constants.js";
import RemoteSelect from "@/components/remoteSearchSelect/index.vue";
import VenusNumberInput from "@/components/venusNumberInput/index.vue"; import VenusNumberInput from "@/components/venusNumberInput/index.vue";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import { postComboOldMerchantGoodsCodeList } from "@/views/goods/shelfProduct/api";
import { shelfStyleOptions, VIEW_MODE } from "@/views/goods/shelfProduct/constant/index"; 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 { isMemberRightsUpgrade, isQualityUpgrade, isShelfStyleEdit, isSingleShopMode, isSolarFilm, isUpgradeProductCostStyleCustom, isUpgradeProductCostStyleDefault } from "@/views/goods/shelfProduct/utils/status.js";
import Product from "../../../product/index.vue"; import Product from "../../../product/index.vue";
...@@ -213,12 +190,17 @@ export default { ...@@ -213,12 +190,17 @@ export default {
components: { components: {
Product, Product,
VenusNumberInput, VenusNumberInput,
RemoteSelect,
}, },
props: { props: {
merchantIdList: { merchantIdList: {
type: Array, type: Array,
required: true, required: true,
}, },
merchantId: {
type: [Number, Array],
required: true,
},
baseSceneCode: { baseSceneCode: {
type: String, type: String,
required: true, required: true,
...@@ -241,6 +223,7 @@ export default { ...@@ -241,6 +223,7 @@ export default {
options: { options: {
settlementType: settlementTypeOpt, settlementType: settlementTypeOpt,
shelfStyleOptions, shelfStyleOptions,
oldMerchantGoodsCode: [],
}, },
dialog: { dialog: {
selectGoods: { selectGoods: {
...@@ -272,7 +255,7 @@ export default { ...@@ -272,7 +255,7 @@ export default {
res[2] += (item.upgradeGoods.djCost ?? 0) * 100; res[2] += (item.upgradeGoods.djCost ?? 0) * 100;
res[3] += (item.thirdPartyCost ?? 0) * 100; res[3] += (item.thirdPartyCost ?? 0) * 100;
res[4] += (item.upgradeProductCost ?? 0) * 100; res[4] += (item.upgradeProductCost ?? 0) * 100;
res[5] += (item.recoveryCost ?? 0) * 100; // res[5] += (item.recoveryCost ?? 0) * 100;
return res; return res;
}, [0, 0, 0, 0, 0, 0]); }, [0, 0, 0, 0, 0, 0]);
return { return {
...@@ -281,7 +264,7 @@ export default { ...@@ -281,7 +264,7 @@ export default {
totalDjCost: sum[2] / 100, totalDjCost: sum[2] / 100,
totalThirdPartyCost: sum[3] / 100, totalThirdPartyCost: sum[3] / 100,
totalUpgradeProductCost: sum[4] / 100, totalUpgradeProductCost: sum[4] / 100,
totalRecoveryCost: sum[5] / 100, // totalRecoveryCost: sum[5] / 100,
}; };
}, },
...@@ -308,6 +291,21 @@ export default { ...@@ -308,6 +291,21 @@ export default {
isQualityUpgrade, isQualityUpgrade,
isSolarFilm, isSolarFilm,
isSingleShopMode, 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) { getProductDisabledPositions(upgradeGoodsId, excludeMerchantGoodsCode) {
return this.productList.filter(item => item.upgradeGoodsId === upgradeGoodsId && item.merchantGoodsCode !== excludeMerchantGoodsCode).map(item => item.detailList?.[0]?.position); return this.productList.filter(item => item.upgradeGoodsId === upgradeGoodsId && item.merchantGoodsCode !== excludeMerchantGoodsCode).map(item => item.detailList?.[0]?.position);
}, },
...@@ -324,7 +322,6 @@ export default { ...@@ -324,7 +322,6 @@ export default {
upgradeCommodityCode: upgradeGoods.commodityCode, upgradeCommodityCode: upgradeGoods.commodityCode,
upgradeGoodsId: upgradeGoods.id, upgradeGoodsId: upgradeGoods.id,
upgradeGoodsName: upgradeGoods.upgradeGoodsName, upgradeGoodsName: upgradeGoods.upgradeGoodsName,
}); });
} }
}, },
......
...@@ -68,18 +68,23 @@ export default { ...@@ -68,18 +68,23 @@ export default {
computed: { computed: {
filterSchema() { filterSchema() {
return this.schema.filter((item) => { return this.schema.filter((item) => {
// 结算方式
if (item.name === "settlementType") { if (item.name === "settlementType") {
return this.showSettlementType; return this.showSettlementType;
} }
// 销售占比
if (item.name === "salesProportionPercent") { if (item.name === "salesProportionPercent") {
return this.showSalesProportionPercent; return this.showSalesProportionPercent;
} }
// 上架类型
if (item.name === "shelfStyle") { if (item.name === "shelfStyle") {
return this.showShelfStyle; return this.showShelfStyle;
} }
// 原上架id
if (item.name === "oldMerchantGoodsCode") { if (item.name === "oldMerchantGoodsCode") {
return this.showOldMerchantGoodsCode; return this.showOldMerchantGoodsCode;
} }
// 赠送成本
if (item.name === "detailList.0.giftCost") { if (item.name === "detailList.0.giftCost") {
return this.showGiftCost; return this.showGiftCost;
} }
......
...@@ -62,6 +62,7 @@ export default { ...@@ -62,6 +62,7 @@ export default {
if (!commodityCode) { if (!commodityCode) {
return; return;
} }
// 查询运营成本
const { operationCost } = await getOperationCost({ const { operationCost } = await getOperationCost({
commodityCode, commodityCode,
merchantIdList: this.merchantIdList, merchantIdList: this.merchantIdList,
...@@ -75,7 +76,6 @@ export default { ...@@ -75,7 +76,6 @@ export default {
}, },
// product.detailList[0].upgradeGoods.commodityCode // product.detailList[0].upgradeGoods.commodityCode
async validate() { async validate() {
console.log("进得来?");
const modifyRef = this.$refs.modifyRef; const modifyRef = this.$refs.modifyRef;
if (!modifyRef) { if (!modifyRef) {
// 尚未初始化 // 尚未初始化
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<div v-if="showDialog" <div v-if="showDialog"
v-loading="loading" v-loading="loading"
class="selected-product-wrapper"> class="selected-product-wrapper">
<d2-search class="show-search" <d2-search v-if="table.formSchema.length"
class="show-search"
label-width="100px" label-width="100px"
:form-data="table.formSchema" :form-data="table.formSchema"
:search-form="table.form"> :search-form="table.form">
...@@ -57,6 +58,9 @@ ...@@ -57,6 +58,9 @@
@change="handleGoodsCascaderChange($event)"> @change="handleGoodsCascaderChange($event)">
</el-cascader> </el-cascader>
</template> </template>
<template #supplierCode>
<remote-select v-model="table.form.supplierCode"></remote-select>
</template>
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button :id="table.props.btnId" <el-button :id="table.props.btnId"
...@@ -181,6 +185,7 @@ export default { ...@@ -181,6 +185,7 @@ export default {
goodsName: "", goodsName: "",
baseGoodsCommodityCode: "", baseGoodsCommodityCode: "",
tempGoodsType: [], tempGoodsType: [],
supplierCode: "",
}, },
props: selectGoodsTableSchema, props: selectGoodsTableSchema,
api: getUpgradeProductList, api: getUpgradeProductList,
...@@ -215,7 +220,7 @@ export default { ...@@ -215,7 +220,7 @@ export default {
this.selectedId = this.activeId; this.selectedId = this.activeId;
await this.getSelectedRow(); await this.getSelectedRow();
// this.keyDowmGetList 不知道在哪里设置的全局变量. 原有组件中需要传入 // this.keyDowmGetList 不知道在哪里设置的全局变量. 原有组件中需要传入
this.table.formSchema = getSelectGoodsTableFilterSchema(this.keyDowmGetList); this.table.formSchema = await getSelectGoodsTableFilterSchema(this.keyDowmGetList);
await this.getOptionsList(); await this.getOptionsList();
} finally { } finally {
this.loading = false; this.loading = false;
...@@ -262,6 +267,9 @@ export default { ...@@ -262,6 +267,9 @@ export default {
this.table.form[key] = e.replace(/[^a-z0-9]/gi, ""); this.table.form[key] = e.replace(/[^a-z0-9]/gi, "");
} }
}, },
keyDowmGetList() {
this.$refs?.tableRef?.refreshTable();
},
async getOptionsList() { async getOptionsList() {
// 获取全部类目 屏蔽服务商自建类目 // 获取全部类目 屏蔽服务商自建类目
const res = await getAllCategory({ categoryTypeList: baseConfig.selfBuildGoodsType, pageSize: 9999, currentPage: 1 }); const res = await getAllCategory({ categoryTypeList: baseConfig.selfBuildGoodsType, pageSize: 9999, currentPage: 1 });
......
...@@ -22,15 +22,17 @@ ...@@ -22,15 +22,17 @@
<span class="label"> <span class="label">
{{ row.productName }} {{ row.productName }}
</span> </span>
<span v-if="useEdit && isView(editState)" <!-- 5.8.4 不允许删除 -->
<!-- <span v-if="useEdit && isView(editState)"
class="actions el-icon-close" class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(row)"> @click.stop="handleRemoveTitleSelectItem(row)">
</span> </span> -->
</div> </div>
</template> </template>
</RemoteSelect> </RemoteSelect>
</div> </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-dropdown @command="handleAppendProductPackages">
<el-button size="small" plain> <el-button size="small" plain>
新增 新增
...@@ -47,7 +49,7 @@ ...@@ -47,7 +49,7 @@
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
</div> </div> -->
</div> </div>
<div class="content-wrapper"> <div class="content-wrapper">
...@@ -84,6 +86,7 @@ ...@@ -84,6 +86,7 @@
ref="productRefs" ref="productRefs"
:base-scene-code="baseSceneCode" :base-scene-code="baseSceneCode"
:edit-state="editState" :edit-state="editState"
:merchant-id="merchantId"
:merchant-id-list="merchantIdList" :merchant-id-list="merchantIdList"
:product="productDetail || { detailList: [] }" :product="productDetail || { detailList: [] }"
:shelf-type="shelfType" :shelf-type="shelfType"
...@@ -93,6 +96,7 @@ ...@@ -93,6 +96,7 @@
ref="packageRefs" ref="packageRefs"
:base-scene-code="baseSceneCode" :base-scene-code="baseSceneCode"
:edit-state="editState" :edit-state="editState"
:merchant-id="merchantId"
:merchant-id-list="merchantIdList" :merchant-id-list="merchantIdList"
:packages="productDetail || { detailList: [] }" :packages="productDetail || { detailList: [] }"
:prefix="$data._prefix" :prefix="$data._prefix"
...@@ -151,6 +155,10 @@ export default { ...@@ -151,6 +155,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
merchantId: {
type: [Number, Array],
required: true,
},
shelfType: { shelfType: {
type: Number, type: Number,
required: true, required: true,
...@@ -246,10 +254,27 @@ export default { ...@@ -246,10 +254,27 @@ export default {
// 获取 某个商品/套餐 详情 // 获取 某个商品/套餐 详情
async getProductPackageDetail(id) { async getProductPackageDetail(id) {
const detail = await getProductPackagesDetailApi({ id }); const detail = await getProductPackagesDetailApi({ id });
// 如果是商品
if (detail.productType === 1) { if (detail.productType === 1) {
// 商品在这个层级依赖 // 商品在这个层级依赖
detail.upgradeGoodsId = detail.detailList[0].upgradeGoodsId; 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.shelfType = this.shelfType;
detail.baseSceneCode = this.baseSceneCode; detail.baseSceneCode = this.baseSceneCode;
return detail; return detail;
......
import { getBrandSupplyMerchant } from "@api/product";
import { get } from "lodash-es"; import { get } from "lodash-es";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
import { BaseData, settlementTypeOpt } from "@/common/constants"; import { BaseData, settlementTypeOpt } from "@/common/constants";
import { isZeroOrNumber } from "@/libs/number"; import { isZeroOrNumber } from "@/libs/number";
import store from "@/store"; import store from "@/store";
import { convertYuanToWan, filterSpecsStr } from "@/views/goods/filterOption"; 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 { isExtendedWarranty, isMembraneType, isOfficialRightsService, isThirdPart } from "@/views/goods/shelfProduct/utils/businessCheck";
import { schemaSumBy } from "@/views/goods/shelfProduct/utils/calc"; import { schemaSumBy } from "@/views/goods/shelfProduct/utils/calc";
...@@ -64,7 +69,6 @@ export async function getProductDetailDescriptionSchema(shelfType) { ...@@ -64,7 +69,6 @@ export async function getProductDetailDescriptionSchema(shelfType) {
}, },
isHide({ formModel }) { isHide({ formModel }) {
const goodsType = getUpgradeGoods(formModel)?.goodsInfo?.goodsType; const goodsType = getUpgradeGoods(formModel)?.goodsInfo?.goodsType;
// 不是太阳膜类型的 隐藏 // 不是太阳膜类型的 隐藏
return !(isSolarFilm(goodsType)); return !(isSolarFilm(goodsType));
}, },
...@@ -82,7 +86,7 @@ export async function getProductDetailDescriptionSchema(shelfType) { ...@@ -82,7 +86,7 @@ export async function getProductDetailDescriptionSchema(shelfType) {
); );
}, },
isHide({ formModel }) { isHide({ formModel }) {
// 单店模式才存在; // 单店模式存在
return !(isSingleShopMode(shelfType)); return !(isSingleShopMode(shelfType));
}, },
}, },
...@@ -92,16 +96,15 @@ export async function getProductDetailDescriptionSchema(shelfType) { ...@@ -92,16 +96,15 @@ export async function getProductDetailDescriptionSchema(shelfType) {
label: "原上架ID", label: "原上架ID",
col: 12, col: 12,
render(h, { data, schemaItem }) { 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( return h(
"span", "span",
"动态获取" || "-", value || "-",
); );
}, },
isHide({ formModel }) { isHide({ formModel }) {
// 单店模式 且 shelfStyle === 修改才存在 // 单店模式 且 shelfStyle === 修改才存在
return !(isSingleShopMode(shelfType) && !isShelfStyleEdit(formModel.shelfStyle)); return !(isSingleShopMode(shelfType) && isShelfStyleEdit(formModel.shelfStyle));
}, },
}, },
...@@ -123,6 +126,31 @@ export async function getProductDetailDescriptionSchema(shelfType) { ...@@ -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", name: "settlementType",
...@@ -150,19 +178,6 @@ export async function getProductDetailDescriptionSchema(shelfType) { ...@@ -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", name: "detailList.0.sellPrice",
label: "售价/件", label: "售价/件",
...@@ -240,23 +255,38 @@ export async function getProductDetailDescriptionSchema(shelfType) { ...@@ -240,23 +255,38 @@ export async function getProductDetailDescriptionSchema(shelfType) {
}, },
{ {
name: "detailList.0.recoveryCost", name: "detailList.0.upgradeProductCostStyle",
label: "回收成本", label: "产品、升级成本/件",
col: 12, col: 12,
render(h, { data, schemaItem }) { 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( return h(
"span", "span",
value === "-" ? value : `${value}元`, item?.label || "-",
// priceFilter(data.recoveryCost), // 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", name: "detailList.0.giftCost",
...@@ -551,6 +581,18 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -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) { ...@@ -615,16 +657,16 @@ export async function getPackagesDetailDescriptionSchema(shelfType) {
label: "原上架ID", label: "原上架ID",
col: 12, col: 12,
render(h, { data, schemaItem }) { 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); // const item = value && shelfStyleOptions.find(item => item.value === value);
return h( return h(
"span", "span",
"动态获取" || "-", value || "-",
); );
}, },
isHide({ formModel }) { isHide({ formModel }) {
// 单店模式 且 shelfStyle === 修改才存在 // 单店模式 且 shelfStyle === 修改才存在
return !(isSingleShopMode(shelfType) && !isShelfStyleEdit(formModel.shelfStyle)); return !(isSingleShopMode(shelfType) && isShelfStyleEdit(formModel.shelfStyle));
}, },
}, },
{ {
...@@ -640,18 +682,18 @@ export async function getPackagesDetailDescriptionSchema(shelfType) { ...@@ -640,18 +682,18 @@ export async function getPackagesDetailDescriptionSchema(shelfType) {
); );
}, },
}, },
{ // {
name: "salesProportionPercent", // name: "salesProportionPercent",
label: "销售占比", // label: "销售占比",
col: 12, // col: 12,
render(h, { data, schemaItem }) { // render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name)); // const value = isZeroOrNumber(get(data, schemaItem.name));
return h( // return h(
"span", // "span",
value === "-" ? value : value + "%", // value === "-" ? value : value + "%",
); // );
}, // },
}, // },
{ {
name: "sellPrice", name: "sellPrice",
label: "售价/件", label: "售价/件",
...@@ -701,19 +743,19 @@ export async function getPackagesDetailDescriptionSchema(shelfType) { ...@@ -701,19 +743,19 @@ export async function getPackagesDetailDescriptionSchema(shelfType) {
return h("span", value); return h("span", value);
}, },
}, },
{ // {
name: "recoveryCost", // name: "recoveryCost",
label: "回收成本", // label: "回收成本",
col: 12, // col: 12,
isHide({ formModel }) { // isHide({ formModel }) {
// 仅精品升级场景存在; // // 仅精品升级场景存在;
return !(isQualityUpgrade(formModel.baseSceneCode)); // return !(isQualityUpgrade(formModel.baseSceneCode));
}, // },
render(h, { data, schemaItem }) { // render(h, { data, schemaItem }) {
const value = schemaSumBy(data.detailList, schemaItem.name); // const value = schemaSumBy(data.detailList, schemaItem.name);
return h("span", value); // return h("span", value);
}, // },
}, // },
]; ];
} }
...@@ -777,6 +819,15 @@ export const selectGoodsTableSchema = { ...@@ -777,6 +819,15 @@ export const selectGoodsTableSchema = {
}, },
}, },
{ {
label: "采购成本/元",
prop: "purchaseCost",
width: 100,
formatter: (row) => {
const value = isZeroOrNumber(row.purchaseCost);
return value === "-" ? value : `${value}元`;
},
},
{
label: "适用区域", label: "适用区域",
prop: "upgradeGoodsAreaList", prop: "upgradeGoodsAreaList",
width: 180, width: 180,
...@@ -834,7 +885,10 @@ export const selectGoodsTableSchema = { ...@@ -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 [ return [
{ {
label: "产品名称", label: "产品名称",
...@@ -893,5 +947,13 @@ export function getSelectGoodsTableFilterSchema(keyDownGetList) { ...@@ -893,5 +947,13 @@ export function getSelectGoodsTableFilterSchema(keyDownGetList) {
name: "goodsType", name: "goodsType",
addHtml: "goodsCascader", addHtml: "goodsCascader",
}, },
{
label: "供应商",
name: "supplierCode",
type: "select",
optionList: supplierCodeList,
optionId: "id",
optionLabel: "relatedPartyName",
},
]; ];
} }
...@@ -140,14 +140,30 @@ export async function getShelfProductImportSchema() { ...@@ -140,14 +140,30 @@ export async function getShelfProductImportSchema() {
col: 24, col: 24,
render(h, { data }) { render(h, { data }) {
const fileName = last(data?.goodsCreateExcel?.split("/")); const fileName = last(data?.goodsCreateExcel?.split("/"));
// 利润率测算表
const onShelvesExcel = last(data?.onShelvesExcel?.split("/"));
return h( return h(
"div", "div",
{ {
style: {
"display": "flex",
"flex-direction": "column",
"align-items": "flex-start",
},
},
[
// 商品上架表
h(
"div",
{
attrs: { attrs: {
title: fileName, title: fileName,
}, },
style: { style: {
display: "flex", "display": "flex",
"align-items": "center",
}, },
}, },
[ [
...@@ -171,6 +187,45 @@ export async function getShelfProductImportSchema() { ...@@ -171,6 +187,45 @@ export async function getShelfProductImportSchema() {
"下载", "下载",
), ),
], ],
),
// 利润率测算表
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 = [ export const statusOptions = [
{ value: 0, label: "草稿" }, { value: 0, label: "草稿" },
{ value: 1, label: "待审核" }, { value: 1, label: "商务审核" },
{ value: 2, label: "已审核" }, { value: 2, label: "已完成" },
{ value: 3, label: "驳回" }, { value: 3, label: "驳回" },
{ value: 5, label: "审核提交中" }, { value: 5, label: "数据处理中" },
{ value: 6, label: "审核提交失败" }, { value: 6, label: "数据处理失败" },
]; ];
// 商品上架 业务场景 第0位必须是 精品升级 // 商品上架 业务场景 第0位必须是 精品升级
export const sceneTypeOptions = [ export const sceneTypeOptions = [
...@@ -15,6 +15,12 @@ export const sceneTypeOptions = [ ...@@ -15,6 +15,12 @@ export const sceneTypeOptions = [
{ value: "110202", label: "2.3.2 售后延保" }, { value: "110202", label: "2.3.2 售后延保" },
]; ];
// 商品上架 商品成本带入方式
export const productCostStyleOpt = [
{ value: 2, label: "默认带入产品成本" },
{ value: 1, label: "自定义成本" },
];
export const VIEW_MODE = { export const VIEW_MODE = {
EDIT: "edit", EDIT: "edit",
VIEW: "view", VIEW: "view",
...@@ -40,7 +46,7 @@ export const realityShopLevelOptions = [ ...@@ -40,7 +46,7 @@ export const realityShopLevelOptions = [
// 上架模式 // 上架模式
export const shelfModelOptions = [ export const shelfModelOptions = [
{ value: 1, label: "特殊商品上架" }, { value: 1, label: "特殊商品上架" },
{ value: 2, label: "常规商品上架" }, { value: 2, label: "常规上架" },
]; ];
// 上架类型 // 上架类型
......
...@@ -92,11 +92,20 @@ export function getTableFilterIds(baseSceneCode) { ...@@ -92,11 +92,20 @@ export function getTableFilterIds(baseSceneCode) {
return sceneTypeFilter[sceneType] || []; return sceneTypeFilter[sceneType] || [];
} }
// "产品成本获取方式 1-自定义成本 2-默认带入产品成本" --> /**
* "产品成本获取方式 1-自定义成本
* @param {*} upgradeProductCostStyle
* @returns
*/
export function isUpgradeProductCostStyleCustom(upgradeProductCostStyle) { export function isUpgradeProductCostStyleCustom(upgradeProductCostStyle) {
return upgradeProductCostStyle === 1; return upgradeProductCostStyle === 1;
} }
/**
* 产品成本获取方式 2-默认带入产品成本"
* @param {*} upgradeProductCostStyle
* @returns
*/
export function isUpgradeProductCostStyleDefault(upgradeProductCostStyle) { export function isUpgradeProductCostStyleDefault(upgradeProductCostStyle) {
return upgradeProductCostStyle === 2; return upgradeProductCostStyle === 2;
} }
...@@ -104,7 +113,7 @@ export function isUpgradeProductCostStyleDefault(upgradeProductCostStyle) { ...@@ -104,7 +113,7 @@ export function isUpgradeProductCostStyleDefault(upgradeProductCostStyle) {
/** /**
* 是否直营 * 是否直营
* 权益、延保 且 供应方=广联直营 0-否 1-是 * 权益、延保 且 供应方=广联直营 0-否 1-是
* @returns Boolean * @returns
*/ */
export function isDirectOperation(supplyFlag) { export function isDirectOperation(supplyFlag) {
return supplyFlag === 1; return supplyFlag === 1;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
style="margin-top:20px"> style="margin-top:20px">
<ShelfProductConfirm :base-scene-code="baseSceneCode" <ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode" :business-code="businessCode"
:merchant-id="merchantIdList"
:shelf-type="shelfType" :shelf-type="shelfType"
:use-edit="false" /> :use-edit="false" />
</FormStep> </FormStep>
...@@ -118,12 +119,14 @@ export default { ...@@ -118,12 +119,14 @@ export default {
baseSceneCode: undefined, baseSceneCode: undefined,
businessCode: undefined, businessCode: undefined,
shelfType: undefined, shelfType: undefined,
merchantIdList: undefined,
logList: [], logList: [],
}; };
}, },
computed: { computed: {
isReadyForNextStep() { isReadyForNextStep() {
return this.baseSceneCode && this.businessCode && this.shelfType; return this.baseSceneCode && this.businessCode && this.shelfType && this.merchantIdList;
}, },
}, },
async created() { async created() {
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
<FormStep v-loading="data.isStepLoading" name="ProductConfirm"> <FormStep v-loading="data.isStepLoading" name="ProductConfirm">
<ShelfProductConfirm :base-scene-code="baseSceneCode" <ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode" :business-code="businessCode"
:merchant-id="merchantId"
:shelf-type="shelfType" /> :shelf-type="shelfType" />
</FormStep> </FormStep>
<FormStep v-loading="data.isStepLoading" name="ProfitSharingConfig"> <FormStep v-loading="data.isStepLoading" name="ProfitSharingConfig">
...@@ -139,6 +140,10 @@ import ShelfProductImport from "../../components/shelfProductImport/index.vue"; ...@@ -139,6 +140,10 @@ import ShelfProductImport from "../../components/shelfProductImport/index.vue";
// 业务层(FormStep + 各种组件) // 业务层(FormStep + 各种组件)
// └── 只负责:输入 / 校验 / 数据 // └── 只负责:输入 / 校验 / 数据
/**
* 特殊上架
*/
const shelfModel = 1;
export default { export default {
name: "ShelfProductModify", name: "ShelfProductModify",
components: { components: {
...@@ -218,9 +223,10 @@ export default { ...@@ -218,9 +223,10 @@ export default {
}); });
}, },
async getStep() { async getStep() {
const { confirmStep } = await getShelfProductUpdateStep({ const { confirmStep, merchantId } = await getShelfProductUpdateStep({
businessCode: this.businessCode, businessCode: this.businessCode,
}); });
this.merchantId = merchantId;
return confirmStep - 1; return confirmStep - 1;
}, },
async beforeChangeStepBefore(isNext) { async beforeChangeStepBefore(isNext) {
...@@ -315,6 +321,8 @@ export default { ...@@ -315,6 +321,8 @@ export default {
const fileExt = stepFormData.goodsCreateExcel.name.split("."); const fileExt = stepFormData.goodsCreateExcel.name.split(".");
const reqData = { const reqData = {
...stepFormData, ...stepFormData,
// 特殊上架
shelfModel,
file: last(fileExt) + "@" + arrBase64, file: last(fileExt) + "@" + arrBase64,
}; };
if (!reqData.businessCode) { 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 @@ ...@@ -33,7 +33,7 @@
<el-steps finish-status="success" :active="step.confirmStep"> <el-steps finish-status="success" :active="step.confirmStep">
<el-step title="1、商品上架表导入"></el-step> <el-step title="1、商品上架表导入"></el-step>
<el-step title="2、上架商品确认"></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> </el-steps>
</div> </div>
<div v-loading="data.isProviderLoading" class="wrapper"> <div v-loading="data.isProviderLoading" class="wrapper">
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
<FormStep v-loading="data.isStepLoading" name="ProductConfirm"> <FormStep v-loading="data.isStepLoading" name="ProductConfirm">
<ShelfProductConfirm :base-scene-code="baseSceneCode" <ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode" :business-code="businessCode"
:merchant-id="merchantId"
:shelf-type="shelfType" /> :shelf-type="shelfType" />
</FormStep> </FormStep>
<FormStep v-loading="data.isStepLoading" <FormStep v-loading="data.isStepLoading"
name="ProfitMarginTable" name="ProfitMarginTable"
style="height:100%"> style="height:100%">
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
@click="handlePreviousSteps"> @click="handlePreviousSteps">
上一步 上一步
</VenusButton> </VenusButton>
<VenusButton v-if="step.confirmStep < 2" <VenusButton v-if="step.confirmStep < (isSingleShopMode(shelfType) ? 2 : 1)"
size="small" size="small"
type="primary" type="primary"
:disabled="data.isEditing || data.isSaving" :disabled="data.isEditing || data.isSaving"
...@@ -107,7 +107,7 @@ import { ...@@ -107,7 +107,7 @@ import {
} from "@/views/goods/shelfProduct/api"; } from "@/views/goods/shelfProduct/api";
import { sceneTypeOptions, VIEW_MODE } from "@/views/goods/shelfProduct/constant/index"; 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 VenusButton from "../../components/btn/index.vue";
import FormStep from "../../components/formProvider/formStep.vue"; import FormStep from "../../components/formProvider/formStep.vue";
import FormProvider from "../../components/formProvider/index.vue"; import FormProvider from "../../components/formProvider/index.vue";
...@@ -124,6 +124,10 @@ import ShelfProductImport from "../../components/shelfProductImport/index.vue"; ...@@ -124,6 +124,10 @@ import ShelfProductImport from "../../components/shelfProductImport/index.vue";
// 业务层(FormStep + 各种组件) // 业务层(FormStep + 各种组件)
// └── 只负责:输入 / 校验 / 数据 // └── 只负责:输入 / 校验 / 数据
/**
* 常规上架
*/
const shelfModel = 2;
export default { export default {
name: "ShelfProductModify", name: "ShelfProductModify",
components: { components: {
...@@ -152,6 +156,7 @@ export default { ...@@ -152,6 +156,7 @@ export default {
baseSceneCode: undefined, baseSceneCode: undefined,
businessCode: undefined, businessCode: undefined,
shelfType: undefined, shelfType: undefined,
merchantId: undefined,
}; };
}, },
...@@ -169,6 +174,7 @@ export default { ...@@ -169,6 +174,7 @@ export default {
async created() { async created() {
this.setShelfProductInfo(this.$route.query); this.setShelfProductInfo(this.$route.query);
await this.$nextTick(); await this.$nextTick();
// 如果是编辑
if (this.isReadyForNextStep) { if (this.isReadyForNextStep) {
await this.init(); await this.init();
} }
...@@ -182,6 +188,7 @@ export default { ...@@ -182,6 +188,7 @@ export default {
getMemberRightsUpgradeValue, getMemberRightsUpgradeValue,
isMemberRightsUpgrade, isMemberRightsUpgrade,
isQualityUpgrade, isQualityUpgrade,
isSingleShopMode,
async withLoading(fn) { async withLoading(fn) {
if (!isFunction(fn)) { if (!isFunction(fn)) {
return; return;
...@@ -200,18 +207,25 @@ export default { ...@@ -200,18 +207,25 @@ export default {
}); });
}, },
async getStep() { async getStep() {
const { confirmStep } = await getShelfProductUpdateStep({ const { confirmStep, merchantId } = await getShelfProductUpdateStep({
businessCode: this.businessCode, businessCode: this.businessCode,
}); });
this.merchantId = merchantId;
// 常规上架特殊处理
if ((confirmStep - 1) > 2) {
return 2;
}
return confirmStep - 1; return confirmStep - 1;
}, },
async beforeChangeStepBefore(isNext) { async beforeChangeStepBefore(isNext) {
this.btnLoading = true; this.btnLoading = true;
try { try {
// 常规上架特殊处理
const confirmStep = this.step.confirmStep + 1;
await putShelfProductUpdateStep({ await putShelfProductUpdateStep({
businessCode: this.businessCode, businessCode: this.businessCode,
nextStep: isNext, nextStep: isNext,
confirmStep: this.step.confirmStep + 1, confirmStep: confirmStep === 3 ? 5 : confirmStep,
}); });
} finally { } finally {
this.btnLoading = false; this.btnLoading = false;
...@@ -273,6 +287,8 @@ export default { ...@@ -273,6 +287,8 @@ export default {
const fileExt = stepFormData.goodsCreateExcel.name.split("."); const fileExt = stepFormData.goodsCreateExcel.name.split(".");
const reqData = { const reqData = {
...stepFormData, ...stepFormData,
// 常规上架
shelfModel,
file: last(fileExt) + "@" + arrBase64, file: last(fileExt) + "@" + arrBase64,
}; };
if (!reqData.businessCode) { if (!reqData.businessCode) {
...@@ -293,6 +309,7 @@ export default { ...@@ -293,6 +309,7 @@ export default {
componentsRef.setImportProgressState("starting"); componentsRef.setImportProgressState("starting");
const that = this; const that = this;
async function stopCondition([result]) { async function stopCondition([result]) {
console.log("stopCondition", result.progress);
// 更新数据 // 更新数据
// 失败 // 失败
componentsRef.setProgress(result.progress); componentsRef.setProgress(result.progress);
...@@ -301,11 +318,15 @@ export default { ...@@ -301,11 +318,15 @@ export default {
await syncTime(500); await syncTime(500);
} }
if (isSuccess(result.progress, result.failNum)) { if (isSuccess(result.progress, result.failNum)) {
console.log("成功?");
componentsRef.setImportProgressState("success"); componentsRef.setImportProgressState("success");
console.log("1?");
const res = await getShelfProductBaseInfoByUUIDApi({ uuid: result.uuid }); const res = await getShelfProductBaseInfoByUUIDApi({ uuid: result.uuid });
console.log("isSuccess", res); console.log("2?", res);
console.log("isSuccess", that.baseSceneCode);
that.setShelfProductInfo(pick(res, "baseSceneCode", "businessCode", "shelfType")); that.setShelfProductInfo(pick(res, "baseSceneCode", "businessCode", "shelfType"));
console.log("3?");
that.merchantId = res.merchantId;
return true; return true;
} }
if (isFail(result.progress, result.failNum)) { if (isFail(result.progress, result.failNum)) {
......
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
<div class="d2-container-content"> <div class="d2-container-content">
<d2-table-header> <d2-table-header>
<span style=" display:flex; gap:8px; "> <span style=" display:flex; gap:8px; ">
<!-- 常规上架 handleModify --> <!-- 常规上架 handleNormalModify -->
<auth-button category="Button" <auth-button category="Button"
:data="{ operate: 'create' }" :data="{ operate: 'create', record: { shelfModel: 2 } }"
:show-btn-ids="['9031810']" /> :show-btn-ids="['9031810']" />
<!-- 特殊商品上架 handleModify --> <!-- 特殊商品上架 handleModify -->
<auth-button category="Button" <auth-button category="Button"
:data="{ operate: 'create' }" :data="{ operate: 'create', record: { shelfModel: 1 } }"
:show-btn-ids="['9031801']" /> :show-btn-ids="['9031801']" />
</span> </span>
</d2-table-header> </d2-table-header>
...@@ -51,19 +51,23 @@ ...@@ -51,19 +51,23 @@
<template #auth-button="{ scope }"> <template #auth-button="{ scope }">
<div style="padding:21px 0"> <div style="padding:21px 0">
<!-- 查看 handleDetail --> <!-- 查看 handleDetail -->
<!-- 全部状态的单据均可操作 -->
<span style="margin-right: 10px"> <span style="margin-right: 10px">
<auth-button :data="scope" :show-btn-ids="['9031803']" /> <auth-button :data="scope" :show-btn-ids="['9031803']" />
</span> </span>
<!-- 编辑 handleModify 仅草稿出现 --> <!-- 编辑 handleModify 仅草稿出现 -->
<!-- 仅状态=“草稿”的记录可操作 -->
<span v-if="scope.systemStatus === 0" style="margin-right: 10px"> <span v-if="scope.systemStatus === 0" style="margin-right: 10px">
<auth-button :data="{ operate: 'edit', record: scope }" :show-btn-ids="['9031806']" /> <auth-button :data="{ operate: 'edit', record: scope }" :show-btn-ids="['9031806']" />
</span> </span>
<!-- 驳回 handleReject 待审核才出现 --> <!-- 驳回 handleReject 待审核才出现 -->
<!-- 仅状态=“商务审核” -->
<span v-if="scope.systemStatus === 1" style="margin-right: 10px"> <span v-if="scope.systemStatus === 1" style="margin-right: 10px">
<auth-button :data="scope" <auth-button :data="scope"
:show-btn-ids="['9031808']" /> :show-btn-ids="['9031808']" />
</span> </span>
<!-- 审核 handleApprove 待审核才出现 --> <!-- 审核 handleApprove 待审核才出现 -->
<!-- 仅状态=“商务审核”的记录可操作 -->
<span v-if="scope.systemStatus === 1" style="margin-right: 10px"> <span v-if="scope.systemStatus === 1" style="margin-right: 10px">
<auth-button :data="scope" :show-btn-ids="['9031809']" /> <auth-button :data="scope" :show-btn-ids="['9031809']" />
</span> </span>
...@@ -94,6 +98,7 @@ export default { ...@@ -94,6 +98,7 @@ export default {
}, },
data() { data() {
return { return {
isCacheLoaded: false,
table: { table: {
formSchema: cloneDeep(shelfProductTableFormSchema), formSchema: cloneDeep(shelfProductTableFormSchema),
getListApi: getShelfProductPageApi, getListApi: getShelfProductPageApi,
...@@ -124,11 +129,13 @@ export default { ...@@ -124,11 +129,13 @@ export default {
}; };
}, },
async mounted() { async mounted() {
console.log("mounted");
await this.getBaseData(); await this.getBaseData();
}, },
activated() { activated() {
if (this.isCacheLoaded) {
this.$refs?.tableRef?.refreshTable(); this.$refs?.tableRef?.refreshTable();
}
this.isCacheLoaded = true;
}, },
methods: { methods: {
...@@ -168,12 +175,9 @@ export default { ...@@ -168,12 +175,9 @@ export default {
}, },
// 常规上架 // 常规上架
handleNormalModify({ operate, record }) { handleNormalModify({ operate, record }) {
console.log("????");
if (operate === "create") {
this.$router.push({ this.$router.push({
name: "goodsShelfNormalCreate", name: "goodsShelfNormalModify",
}); });
}
}, },
handleRefreshTable() { handleRefreshTable() {
this.$refs.tableRef.refreshTable(); this.$refs.tableRef.refreshTable();
...@@ -185,6 +189,8 @@ export default { ...@@ -185,6 +189,8 @@ export default {
}, },
// 查看 // 查看
handleDetail(row) { handleDetail(row) {
if (row.shelfModel === 1) {
// 特殊上架详情
this.$router.push({ this.$router.push({
name: "goodsShelfDetail", name: "goodsShelfDetail",
query: { query: {
...@@ -193,9 +199,26 @@ export default { ...@@ -193,9 +199,26 @@ export default {
shelfType: row.shelfType, shelfType: row.shelfType,
}, },
}); });
}
if (row.shelfModel === 2) {
// 常规上架详情
this.$router.push({
name: "goodsShelfNormalDetail",
query: {
baseSceneCode: row.baseSceneCode,
businessCode: row.businessCode,
shelfType: row.shelfType,
shelfModel: row.shelfModel,
},
});
}
}, },
// 新增 或 修改 // 新增 或 修改
handleModify({ operate, record }) { handleModify({ operate, record }) {
console.log(record);
// 特殊上架编辑
if (record?.shelfModel === 1) {
if (operate === "create") { if (operate === "create") {
this.$router.push({ this.$router.push({
name: "goodsShelfCreate", name: "goodsShelfCreate",
...@@ -212,6 +235,27 @@ export default { ...@@ -212,6 +235,27 @@ export default {
}, },
}); });
} }
}
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,
},
});
}
}
}, },
}, },
}; };
......
...@@ -72,7 +72,10 @@ ...@@ -72,7 +72,10 @@
</div> </div>
</template> </template>
</template> </template>
<el-empty v-else description="暂无汇报内容" /> <div v-else
class="dynamic-form-readonly__empty">
暂无汇报内容
</div>
</div> </div>
</template> </template>
...@@ -117,6 +120,13 @@ export default { ...@@ -117,6 +120,13 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.dynamic-form-readonly { .dynamic-form-readonly {
&__empty {
padding: 40px 0;
text-align: center;
color: #909399;
font-size: 14px;
}
&__section, &__section,
&__group, &__group,
&__subform { &__subform {
......
import {
formatJournalDate,
formatJournalDateTime,
JOURNAL_EMPTY_TEXT,
} from "./utils/journalDateTime";
export const JOURNAL_TABS = [ export const JOURNAL_TABS = [
{ key: "staffDaily", label: "驻店日报", journalType: 1 }, { key: "staffDaily", label: "驻店日报", journalType: 1 },
{ key: "storeDaily", label: "门店日报", journalType: 2 }, { key: "storeDaily", label: "门店日报", journalType: 2 },
...@@ -36,56 +42,81 @@ export function getTabKeyByTemplateType(templateType) { ...@@ -36,56 +42,81 @@ export function getTabKeyByTemplateType(templateType) {
return tab?.key ?? "staffDaily"; return tab?.key ?? "staffDaily";
} }
export { formatJournalDate, formatJournalDateTime } from "./utils/journalDateTime";
const bizTypeColumn = { const bizTypeColumn = {
label: "业务大类", label: "业务大类",
prop: "bizTypeName", prop: "bizTypeName",
width: "120px", minWidth: "100px",
width: "100px",
addHtml: "bizType", addHtml: "bizType",
isPopConfig: { text: BIZ_TYPE_TOOLTIP }, 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 = { export const TABLE_COLUMNS_MAP = {
staffDaily: [ staffDaily: [
{ label: "驻店人员", prop: "staffName", minWidth: "120px" }, { label: "驻店人员", prop: "staffName", minWidth: "100px", showOverFlow: true },
bizTypeColumn, bizTypeColumn,
{ label: "所属门店", prop: "merchantName", minWidth: "200px", showOverFlow: true }, { label: "所属门店", prop: "merchantName", minWidth: "160px", showOverFlow: true, align: "left" },
{ label: "今日出勤", prop: "attendanceStatus", width: "100px" }, createEmptyTextColumn("今日出勤", "attendanceStatus", { width: "100px" }),
{ label: "最近保存时间", prop: "lastSaveTime", width: "160px" }, createDateTimeColumn("最近保存时间", "lastSaveTime"),
], ],
storeDaily: [ storeDaily: [
{ label: "所属门店", prop: "merchantName", minWidth: "180px", showOverFlow: true }, {
label: "所属门店",
prop: "merchantName",
minWidth: "160px",
showOverFlow: true,
align: "left",
},
bizTypeColumn, bizTypeColumn,
{ {
label: "今日驻店人数", label: "今日驻店人数",
prop: "staffCount", prop: "staffCount",
width: "130px", width: "120px",
formatter: (row) => (row.staffCount != null ? `${row.staffCount}人` : "—"), formatter: (row) => (row.staffCount != null ? `${row.staffCount}人` : "—"),
}, },
{ label: "最近保存时间", prop: "lastSaveTime", width: "160px" }, createDateTimeColumn("最近保存时间", "lastSaveTime"),
{ createDateTimeColumn("提交时间", "submitTime"),
label: "提交时间", createEmptyTextColumn("提交人", "staffName", {
prop: "submitTime", minWidth: "100px",
width: "160px",
formatter: (row) => row.submitTime || "—",
},
{
label: "提交人",
prop: "submitUserName",
width: "120px", width: "120px",
formatter: (row) => row.submitUserName || "—", showOverFlow: true,
}, }),
], ],
negotiation: [ negotiation: [
{ label: "驻店人员", prop: "staffName", minWidth: "120px" }, { label: "驻店人员", prop: "staffName", minWidth: "100px", showOverFlow: true },
bizTypeColumn, bizTypeColumn,
{ label: "所属门店", prop: "merchantName", minWidth: "200px", showOverFlow: true }, { label: "所属门店", prop: "merchantName", minWidth: "160px", showOverFlow: true, align: "left" },
{ label: "最近保存时间", prop: "lastSaveTime", width: "160px" }, createDateTimeColumn("最近保存时间", "lastSaveTime"),
], ],
}; };
export function getDetailTitle(detail, journalType) { export function getDetailTitle(detail, journalType) {
const { staffName, merchantName, reportDate } = detail; const { staffName, merchantName, reportDate } = detail;
const dateText = reportDate ? `(${reportDate})` : ""; const formattedDate = formatJournalDate(reportDate);
const dateText = formattedDate !== JOURNAL_EMPTY_TEXT ? `(${formattedDate})` : "";
const titleMap = { const titleMap = {
staffDaily: `${staffName}的驻店日报${dateText}`, staffDaily: `${staffName}的驻店日报${dateText}`,
storeDaily: `${merchantName}的门店日报${dateText}`, storeDaily: `${merchantName}的门店日报${dateText}`,
......
...@@ -50,7 +50,14 @@ export default { ...@@ -50,7 +50,14 @@ export default {
}, },
methods: { methods: {
async fetchDetail() { async fetchDetail() {
const { id, journalType, reportDate, merchantId, staffUuid } = this.$route.query; const {
id,
journalType,
reportDate,
merchantId,
staffUuid,
sceneType,
} = this.$route.query;
if (!id) { if (!id) {
return; return;
} }
...@@ -63,6 +70,7 @@ export default { ...@@ -63,6 +70,7 @@ export default {
reportDate, reportDate,
merchantId, merchantId,
staffUuid, staffUuid,
sceneType,
}); });
this.detail = { this.detail = {
...res, ...res,
......
...@@ -173,7 +173,10 @@ export default { ...@@ -173,7 +173,10 @@ export default {
return { return {
btnId: `journal-${this.activeTab}`, btnId: `journal-${this.activeTab}`,
listName: "list", listName: "list",
tableOption: { label: "操作", width: "100px" }, tableOption: {
label: "操作",
width: this.activeTab === "storeDaily" ? "90px" : "100px",
},
tableColumns: TABLE_COLUMNS_MAP[this.activeTab], tableColumns: TABLE_COLUMNS_MAP[this.activeTab],
}; };
}, },
...@@ -337,6 +340,7 @@ export default { ...@@ -337,6 +340,7 @@ export default {
reportDate: this.reportDate, reportDate: this.reportDate,
merchantId: row.merchantId, merchantId: row.merchantId,
staffUuid: row.staffUuid, 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 = "—"; const EMPTY_TEXT = "—";
function sortBySortNum(list = []) { function sortBySortNum(list = []) {
...@@ -102,9 +108,11 @@ export function formatEchoValue(field = {}) { ...@@ -102,9 +108,11 @@ export function formatEchoValue(field = {}) {
return `${raw}${unit}`; return `${raw}${unit}`;
} }
case "textarea": case "textarea":
return String(raw);
case "date": case "date":
return formatJournalDate(raw);
case "datetime": case "datetime":
return String(raw); return formatJournalDateTime(raw);
default: default:
return String(raw); return String(raw);
} }
...@@ -213,7 +221,9 @@ export function buildSubformTable(field = {}) { ...@@ -213,7 +221,9 @@ export function buildSubformTable(field = {}) {
* 解析详情并生成展示块 * 解析详情并生成展示块
*/ */
export function parseJournalEcho(detail = {}) { export function parseJournalEcho(detail = {}) {
return buildEchoBlocks(parseFormList(detail)); const formList = parseFormList(detail);
const visibleFormList = filterFormListForDisplay(formList, detail);
return buildEchoBlocks(visibleFormList);
} }
export default { 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 { ...@@ -222,8 +222,10 @@ export default {
deep: true, deep: true,
}, },
'infoForm.shelfType': { 'infoForm.shelfType': {
handler(val) { handler(val, oldVal) {
console.log(val) console.log(val)
// 仅在用户真正切换上架类型时执行重置,避免 immediate 和程序赋值时误清空
if (oldVal === undefined) return
if (val == 2) { if (val == 2) {
this.infoForm.merchantId = '' this.infoForm.merchantId = ''
this.infoForm.merchantName = '' this.infoForm.merchantName = ''
...@@ -231,7 +233,6 @@ export default { ...@@ -231,7 +233,6 @@ export default {
this.infoForm.baseSceneCode = [] this.infoForm.baseSceneCode = []
}, },
immediate: true, immediate: true,
deep: true,
} }
}, },
computed: { computed: {
...@@ -248,7 +249,21 @@ export default { ...@@ -248,7 +249,21 @@ export default {
{ required: true, message: "请选择流量方", trigger: "change" }, { required: true, message: "请选择流量方", trigger: "change" },
], ],
sceneFiles: [ 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 => { templateInfo.forEach(item => {
...@@ -449,6 +464,7 @@ export default { ...@@ -449,6 +464,7 @@ export default {
} }
this.$set(this.infoForm.sceneFiles, index, item); this.$set(this.infoForm.sceneFiles, index, item);
document.getElementById("fileUpload").value = ""; document.getElementById("fileUpload").value = "";
this.formRef.validateField("sceneFiles")
}; };
} else { } else {
this.notice.errorTips("上传文件不可超过10M"); this.notice.errorTips("上传文件不可超过10M");
...@@ -491,11 +507,11 @@ export default { ...@@ -491,11 +507,11 @@ export default {
}, },
handleRemoveProductFile(index) { handleRemoveProductFile(index) {
let item = this.infoForm.sceneFiles[index]; let item = this.infoForm.sceneFiles[index];
this.$set(this.infoForm.sceneFiles, index, { item.file = null;
...item, item.name = '';
file: null, // 手动触发数组响应式更新,避免 $set 触发 baseSceneCode 深层 watcher 导致整个数组被重置
name: '', this.infoForm.sceneFiles = [...this.infoForm.sceneFiles];
}); this.formRef.validateField("sceneFiles")
}, },
filterInputVal(controlId, val) { filterInputVal(controlId, val) {
// 只保留数字和小数点,确保只有一个小数点 // 只保留数字和小数点,确保只有一个小数点
......
...@@ -8,11 +8,12 @@ ...@@ -8,11 +8,12 @@
<el-table-column v-for="(item, index) in componentData" :key="'col-' + item.expenseCategoryId + '-' + index" <el-table-column v-for="(item, index) in componentData" :key="'col-' + item.expenseCategoryId + '-' + index"
:label="getExpenseName(item.expenseCategoryId)" align="center"> :label="getExpenseName(item.expenseCategoryId)" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<div class="radio-item" @click.stop="handleRadioChange(row, item, index)">
<span class="radio-wrapper" <span class="radio-wrapper"
:class="[{ 'is-checked': getSelectedValue(item.expenseCategoryId) === row.targetMerchantType }, { 'disabled': isViewMode }]" :class="[{ 'is-checked': getSelectedValue(item.expenseCategoryId) === row.targetMerchantType }, { 'disabled': isViewMode }]">
@click.stop="handleRadioChange(row, item, index)">
<i class="radio"></i> <i class="radio"></i>
</span> </span>
</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -183,7 +184,14 @@ export default { ...@@ -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 { .radio-wrapper {
display: block; display: block;
...@@ -192,7 +200,7 @@ export default { ...@@ -192,7 +200,7 @@ export default {
height: 12px; height: 12px;
border-radius: 50%; border-radius: 50%;
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
cursor: pointer;
transition: all 0.3s; transition: all 0.3s;
margin: 0 auto; margin: 0 auto;
......
...@@ -366,7 +366,6 @@ export default { ...@@ -366,7 +366,6 @@ export default {
}, item) { }, item) {
let data = this.componentData.productCategoryRules[this.productCategoryIndex][item.key] let data = this.componentData.productCategoryRules[this.productCategoryIndex][item.key]
data[index].targetMerchantType = targetMerchantType data[index].targetMerchantType = targetMerchantType
console.log(data)
this.$set(this.componentData.productCategoryRules[this.productCategoryIndex], item.key, data) this.$set(this.componentData.productCategoryRules[this.productCategoryIndex], item.key, data)
}, },
validate(callback) { validate(callback) {
...@@ -432,6 +431,7 @@ export default { ...@@ -432,6 +431,7 @@ export default {
.step-title { .step-title {
gap: 16px; gap: 16px;
margin-bottom: 20px; margin-bottom: 20px;
z-index: 4 !important;
} }
.form-box { .form-box {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
1: '是', 1: '是',
0: '否' 0: '否'
}[data] }} }[data] }}
<template v-if="data == 1">
<div class="condition-box-view"> <div class="condition-box-view">
<template v-for="(item, index) in guaranteeConfigs"> <template v-for="(item, index) in guaranteeConfigs">
<div class="block" :key="index"> <div class="block" :key="index">
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
</template> </template>
</div> </div>
</template> </template>
</template>
<template v-else> <template v-else>
<el-radio-group v-model="data" @change="changeData"> <el-radio-group v-model="data" @change="changeData">
<el-radio :label="1">是</el-radio> <el-radio :label="1">是</el-radio>
...@@ -168,7 +170,6 @@ export default { ...@@ -168,7 +170,6 @@ export default {
}, },
metricName(item) { metricName(item) {
let { metricConfigs } = this let { metricConfigs } = this
console.log(metricConfigs)
if (metricConfigs && metricConfigs.length) return metricConfigs.find(e => e.metricCode == item.guaranteeIndex)?.metricName || '-' if (metricConfigs && metricConfigs.length) return metricConfigs.find(e => e.metricCode == item.guaranteeIndex)?.metricName || '-'
return '-' return '-'
}, },
...@@ -176,7 +177,6 @@ export default { ...@@ -176,7 +177,6 @@ export default {
return JSON.parse(data) return JSON.parse(data)
}, },
formatGuaranteeItem(i, item) { formatGuaranteeItem(i, item) {
console.log(i)
let unit = i.unit || '' let unit = i.unit || ''
return `满足${i.startValue}${unit} &le; ${this.metricName(item)}&lt;${i.endValue}${unit}时,差距订单数每单赔付${i.compensationAmount}元` return `满足${i.startValue}${unit} &le; ${this.metricName(item)}&lt;${i.endValue}${unit}时,差距订单数每单赔付${i.compensationAmount}元`
} }
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
</el-select> </el-select>
</template> </template>
<template v-else-if="i.type == 'radio'"> <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"> <template v-for="r in i.options">
<el-radio :key="r.value" :label="r.value">{{ r.label }}</el-radio> <el-radio :key="r.value" :label="r.value">{{ r.label }}</el-radio>
</template> </template>
...@@ -145,6 +146,7 @@ export default { ...@@ -145,6 +146,7 @@ export default {
this.selectionChange(val.guaranteeIndex, false) this.selectionChange(val.guaranteeIndex, false)
if (val.ladderConditions) this.ladderConditions = JSON.parse(val.ladderConditions) if (val.ladderConditions) this.ladderConditions = JSON.parse(val.ladderConditions)
} }
this.formRef && this.formRef.clearValidate()
}, },
deep: true, deep: true,
immediate: true immediate: true
...@@ -164,22 +166,6 @@ export default { ...@@ -164,22 +166,6 @@ export default {
}, },
deep: true 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: { computed: {
...@@ -206,7 +192,20 @@ export default { ...@@ -206,7 +192,20 @@ export default {
}, },
mounted() { }, mounted() { },
methods: { 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) { selectionChange(val, clear = true) {
let item = this.conditionForm[1], let item = this.conditionForm[1],
{ conditionStartConfig, conditionEndConfig } = this, { conditionStartConfig, conditionEndConfig } = this,
......
...@@ -133,9 +133,8 @@ export default { ...@@ -133,9 +133,8 @@ export default {
data: { data: {
handler(newVal) { handler(newVal) {
this.componentData = deepClone(newVal) this.componentData = deepClone(newVal)
console.log(JSON.parse(JSON.stringify(newVal)))
this.$nextTick(() => { this.$nextTick(() => {
this.formRef.clearValidate() this.formRef && this.formRef.clearValidate()
}) })
}, },
immediate: true, immediate: true,
...@@ -180,9 +179,7 @@ export default { ...@@ -180,9 +179,7 @@ export default {
{ label: "其他(房租、水电、耗材等)/月", labelWidth: "240px", key: "otherCostPerMonth", type: 'input', filterRule: "decimalRange", min: 0, max: 99999999, precision: 2 }, { 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: "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: "hasGuarantee", type: 'addComponent', addComponent: 'BottomLineCondition', class: !this.isViewMode ? 'w100' : '', listKey: 'guaranteeConfigs' },
{ { label: '兜底结算日期', key: 'monthlySettlementDate', type: 'select', viewKey: 'monthlySettlementDateText', options: monthSettlementDateOptions, hide: (val) => val.hasGuarantee == 0 },
label: '兜底结算日期', key: 'monthlySettlementDate', type: 'select', viewKey: 'monthlySettlementDate', options: monthSettlementDateOptions, hide: (val) => val.e == 0
},
], ],
rules: { rules: {
...@@ -213,7 +210,7 @@ export default { ...@@ -213,7 +210,7 @@ export default {
getSelectText(i) { getSelectText(i) {
const value = this.componentData[i.key] const value = this.componentData[i.key]
if (this.isViewMode && i.viewKey) { 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 || '-' else return this.componentData[i.viewKey] || value || '-'
} }
if (!value || !i?.options?.length) return '-' if (!value || !i?.options?.length) return '-'
......
...@@ -224,7 +224,6 @@ export default { ...@@ -224,7 +224,6 @@ export default {
}) })
} }
if (item.hasGuarantee == 1) { if (item.hasGuarantee == 1) {
console.log('item.guaranteeConfigs', item.guaranteeConfigs)
if (item.guaranteeConfigs && item.guaranteeConfigs.length) { if (item.guaranteeConfigs && item.guaranteeConfigs.length) {
item.guaranteeConfigs.forEach((c, num) => { item.guaranteeConfigs.forEach((c, num) => {
if (c.guaranteeStandard == null || c.guaranteeIndex == '') { if (c.guaranteeStandard == null || c.guaranteeIndex == '') {
...@@ -256,7 +255,6 @@ export default { ...@@ -256,7 +255,6 @@ export default {
params.trafficPartyDetails = i.trafficPartyDetails params.trafficPartyDetails = i.trafficPartyDetails
sceneConfigs.push(params) sceneConfigs.push(params)
}) })
console.log(sceneConfigs)
if (flag) callback(true, { sceneConfigs }) if (flag) callback(true, { sceneConfigs })
else callback(false, message) else callback(false, message)
} else callback(false) } else callback(false)
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
<template v-if="pageComplete"> <template v-if="pageComplete">
<el-button v-if="pageType == 'audit' && step == 4" type="primary" @click="rejectDialogVisible = true" <el-button v-if="pageType == 'audit' && step == 4" type="primary" @click="rejectDialogVisible = true"
plain>驳回</el-button> plain>驳回</el-button>
<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 v-if="pageType != 'view'" @click="submit" :loading="buttonLoading" type="primary">{{ submitText
}}</el-button> }}</el-button>
</template> </template>
...@@ -97,10 +99,10 @@ ...@@ -97,10 +99,10 @@
<div class="reject-input"> <div class="reject-input">
<div class="label">驳回原因:</div> <div class="label">驳回原因:</div>
<div class="value"> <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> resize="none"></el-input>
</div> </div>
<div class="word-limit">{{ rejectReason.length }}/50</div> <div class="word-limit">{{ rejectReason.length }}/200</div>
</div> </div>
</div> </div>
<template #footer> <template #footer>
...@@ -208,10 +210,15 @@ export default { ...@@ -208,10 +210,15 @@ export default {
} }
}, },
methods: { 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 }), const data = await storeApproveQueryDetail({ businessCode }),
{ basicApproveInfo, trafficPartyConfigs, operateLogs, shelfType, updStep } = data, { basicApproveInfo, trafficPartyConfigs, operateLogs, shelfType, updStep } = data,
step = updStep ? updStep + 1 : 2 // step = 2
step = isPrevStep ? STEP - 1 : (updStep ? updStep + 1 : 2)
this.basicinformationData = data this.basicinformationData = data
let basicinformationFormList = JSON.parse(basicApproveInfo) let basicinformationFormList = JSON.parse(basicApproveInfo)
if (pageType != 'reapply') { if (pageType != 'reapply') {
...@@ -313,7 +320,8 @@ export default { ...@@ -313,7 +320,8 @@ export default {
this.stepOneRef.formRef.validate(async (valid) => { this.stepOneRef.formRef.validate(async (valid) => {
if (valid) { if (valid) {
try { try {
let { infoForm, sceneTypeName } = this.stepOneRef, let { sceneTypeName } = this.stepOneRef,
infoForm = deepClone(this.stepOneRef.infoForm),
{ approveType } = this.$route.query, { approveType } = this.$route.query,
{ sceneFiles } = infoForm, { sceneFiles } = infoForm,
basicApproveInfo = this.templateInfo.map((item) => { basicApproveInfo = this.templateInfo.map((item) => {
...@@ -339,7 +347,9 @@ export default { ...@@ -339,7 +347,9 @@ export default {
} }
return item; return item;
}) })
sceneFiles.map(i => delete i.name) sceneFiles.map(i => {
delete i.name
})
const params = { const params = {
sceneFiles, sceneFiles,
basicApproveInfo: JSON.stringify(basicApproveInfo), basicApproveInfo: JSON.stringify(basicApproveInfo),
...@@ -363,7 +373,6 @@ export default { ...@@ -363,7 +373,6 @@ export default {
} }
} else throw message } else throw message
} catch (error) { } catch (error) {
console.log(error)
this.dialogVisible = false this.dialogVisible = false
this.buttonLoading = false this.buttonLoading = false
setTimeout(() => { setTimeout(() => {
...@@ -625,7 +634,7 @@ export default { ...@@ -625,7 +634,7 @@ export default {
.word-limit { .word-limit {
position: absolute; position: absolute;
right: 0; right: -5px;
bottom: 0; bottom: 0;
font-size: 14px; font-size: 14px;
color: #999999; color: #999999;
......
...@@ -259,6 +259,28 @@ export default { ...@@ -259,6 +259,28 @@ export default {
}); });
return list; 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 状态的树形数据(实时计算,确保响应式更新) // 带有 disabled 状态的树形数据(实时计算,确保响应式更新)
computedGoodsTypeTreeList() { computedGoodsTypeTreeList() {
// 重新计算整个树,确保disabled状态实时更新 // 重新计算整个树,确保disabled状态实时更新
...@@ -272,6 +294,7 @@ export default { ...@@ -272,6 +294,7 @@ export default {
// 收集当前Tab和其他Tab的选中路径 // 收集当前Tab和其他Tab的选中路径
const currentPaths = this.currentTabSelectedPaths || []; const currentPaths = this.currentTabSelectedPaths || [];
const otherPaths = this.otherTabSelectedPaths || []; const otherPaths = this.otherTabSelectedPaths || [];
const otherPathsWithLevel = this.otherTabSelectedPathsWithLevel || [];
// 构建需要禁用的节点值集合 // 构建需要禁用的节点值集合
const shouldDisableValues = new Set(); const shouldDisableValues = new Set();
...@@ -298,20 +321,14 @@ export default { ...@@ -298,20 +321,14 @@ export default {
}); });
// 2. 处理其他Tab已选路径(跨Tab禁用规则) // 2. 处理其他Tab已选路径(跨Tab禁用规则)
otherPaths.forEach((path) => { // 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选
otherPathsWithLevel.forEach(({ path, level }) => {
if (!path || !path.length) { if (!path || !path.length) {
return; return;
} }
// 其他Tab选中的节点本身也要禁用
path.forEach((value) => { // 只禁用节点本身(防止重复选择)
shouldDisableValues.add(value); shouldDisableValues.add(path[path.length - 1]);
});
// 禁用该路径的所有祖先
for (let i = 0; i < path.length - 1; i++) {
shouldDisableValues.add(path[i]);
}
// 禁用该路径的所有后代
this.collectAllDescendantsByPath(tree, path, shouldDisableValues);
}); });
// 设置disabled状态(排除当前Tab可取消勾选的节点) // 设置disabled状态(排除当前Tab可取消勾选的节点)
......
...@@ -383,14 +383,14 @@ export default { ...@@ -383,14 +383,14 @@ export default {
], ],
rules: { rules: {
signingEntityId: [{ required: true, message: "请选择签约主体", trigger: "change" }], signingEntityId: [{ required: true, message: "请选择签约主体", trigger: "change" }],
estimatedDeliveryCountPerMonth: [{ required: true, message: "请输入预估交付数/月", trigger: "change" }], estimatedDeliveryCountPerMonth: [{ required: false, message: "请输入预估交付数/月", trigger: "change" }],
operationMode: [{ required: true, message: "请选择运营模式", trigger: "change" }], operationMode: [{ required: true, message: "请选择运营模式", trigger: "change" }],
partnerId: [{ required: true, message: "请选择服务商", trigger: "change" }], partnerId: [{ required: true, message: "请选择服务商", trigger: "change" }],
yqMerchantId: [{ required: true, message: "请选择园区店", trigger: "change" }], yqMerchantId: [{ required: true, message: "请选择园区店", trigger: "change" }],
personnelCostRate: [{ required: true, message: "请输入人员成本占比", trigger: "change" }], personnelCostRate: [{ required: false, message: "请输入人员成本占比", trigger: "change" }],
renovationEquipmentCost: [{ required: true, message: "请输入装修、设备总投入", trigger: "change" }], renovationEquipmentCost: [{ required: false, message: "请输入装修、设备总投入", trigger: "change" }],
otherCostPerMonth: [{ required: true, message: "请输入其他(房租、水电、耗材等)/月", trigger: "change" }], otherCostPerMonth: [{ required: false, message: "请输入其他(房租、水电、耗材等)/月", trigger: "change" }],
estimatedGrossMargin: [{ required: true, message: "请输入预估毛利率", trigger: "change" }], estimatedGrossMargin: [{ required: false, message: "请输入预估毛利率", trigger: "change" }],
hasGuarantee: [{ required: true, message: "请选择是否存在兜底", trigger: "change" }], hasGuarantee: [{ required: true, message: "请选择是否存在兜底", trigger: "change" }],
monthlySettlementDate: [{ required: true, message: "请选择月度结算日期", trigger: "change" }], monthlySettlementDate: [{ required: true, message: "请选择月度结算日期", trigger: "change" }],
}, },
......
...@@ -981,7 +981,6 @@ export default { ...@@ -981,7 +981,6 @@ export default {
cascaderProps: { cascaderProps: {
multiple: true, multiple: true,
checkStrictly: true, checkStrictly: true,
expandTrigger: "hover",
label: "categoryName", label: "categoryName",
value: "categoryType", value: "categoryType",
disabled: "disabled", // 显式配置 disabled 属性映射 disabled: "disabled", // 显式配置 disabled 属性映射
...@@ -1167,6 +1166,28 @@ export default { ...@@ -1167,6 +1166,28 @@ export default {
}); });
return list; 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 状态的树形数据(实时计算,确保响应式更新) // 带有 disabled 状态的树形数据(实时计算,确保响应式更新)
computedGoodsTypeTreeList() { computedGoodsTypeTreeList() {
// 重新计算整个树,确保disabled状态实时更新 // 重新计算整个树,确保disabled状态实时更新
...@@ -1180,6 +1201,7 @@ export default { ...@@ -1180,6 +1201,7 @@ export default {
// 收集当前Tab和其他Tab的选中路径 // 收集当前Tab和其他Tab的选中路径
const currentPaths = this.currentTabSelectedPaths || []; const currentPaths = this.currentTabSelectedPaths || [];
const otherPaths = this.otherTabSelectedPaths || []; const otherPaths = this.otherTabSelectedPaths || [];
const otherPathsWithLevel = this.otherTabSelectedPathsWithLevel || [];
// 构建需要禁用的节点值集合 // 构建需要禁用的节点值集合
const shouldDisableValues = new Set(); const shouldDisableValues = new Set();
...@@ -1206,20 +1228,14 @@ export default { ...@@ -1206,20 +1228,14 @@ export default {
}); });
// 2. 处理其他Tab已选路径(跨Tab禁用规则) // 2. 处理其他Tab已选路径(跨Tab禁用规则)
otherPaths.forEach((path) => { // 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选
otherPathsWithLevel.forEach(({ path, level }) => {
if (!path || !path.length) { if (!path || !path.length) {
return; return;
} }
// 其他Tab选中的节点本身也要禁用
path.forEach((value) => { // 只禁用节点本身(防止重复选择)
shouldDisableValues.add(value); shouldDisableValues.add(path[path.length - 1]);
});
// 禁用该路径的所有祖先
for (let i = 0; i < path.length - 1; i++) {
shouldDisableValues.add(path[i]);
}
// 禁用该路径的所有后代
this.collectAllDescendantsByPath(tree, path, shouldDisableValues);
}); });
// 设置disabled状态(排除当前Tab可取消勾选的节点) // 设置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!