Commit d1e7ec30 by 张立顺

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

…stem into SAAS+V5.6.1
2 parents 6cdd301c 5176dab7
Showing 51 changed files with 2984 additions and 1080 deletions
......@@ -36,4 +36,4 @@
}
},
"i18n-ally.sourceLanguage": "zh-chs"
}
\ No newline at end of file
}
......@@ -4247,6 +4247,27 @@
"whatwg-fetch": "^3.6.2"
},
"dependencies": {
"@vue/vue-loader-v15": {
"version": "npm:vue-loader@15.11.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.11.1.tgz",
"integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
"dev": true,
"requires": {
"@vue/component-compiler-utils": "^3.1.0",
"hash-sum": "^1.0.2",
"loader-utils": "^1.1.0",
"vue-hot-reload-api": "^2.3.0",
"vue-style-loader": "^4.1.0"
},
"dependencies": {
"hash-sum": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz",
"integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==",
"dev": true
}
}
},
"acorn-walk": {
"version": "8.2.0",
"resolved": "https://registry.npmmirror.com/acorn-walk/-/acorn-walk-8.2.0.tgz",
......@@ -4782,27 +4803,6 @@
"lodash": "^4.17.4"
}
},
"@vue/vue-loader-v15": {
"version": "npm:vue-loader@15.11.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.11.1.tgz",
"integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
"dev": true,
"requires": {
"@vue/component-compiler-utils": "^3.1.0",
"hash-sum": "^1.0.2",
"loader-utils": "^1.1.0",
"vue-hot-reload-api": "^2.3.0",
"vue-style-loader": "^4.1.0"
},
"dependencies": {
"hash-sum": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz",
"integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==",
"dev": true
}
}
},
"@vue/vue2-jest": {
"version": "27.0.0",
"resolved": "https://registry.npmmirror.com/@vue/vue2-jest/-/vue2-jest-27.0.0.tgz",
......
......@@ -597,6 +597,16 @@ export function postSalaryPerformanceScheme(data) {
data.method = `dj.staff.api.performance.config.add`;
return request(data, "post");
}
// 新增 工资绩效 方案
export function postBrandMerchant(data) {
data.method = `dj.staff.api.performance.config.valid.merchant.brand.by.merchant`;
return request(data, "post");
}
// 新增 工资绩效 方案
export function getConfigMerchantDetail(data) {
data.method = `dj.staff.api.performance.config.merchant.detail`;
return request(data, "post");
}
// 校验圈定产品/套餐是否可被删除
export function checkProductDefineAPI(data) {
......
......@@ -258,7 +258,8 @@ export const uploadCustodyAgreement = (data = {}) => {
*/
export const webPayDepositApplication = (data = {}) => {
return gscPost("/evalElectronicContract/webPayDepositApplication", data, {
timeout: 30000
timeout: 30000,
returnAll: true
})
}
/**
......@@ -266,7 +267,8 @@ export const webPayDepositApplication = (data = {}) => {
*/
export const webPayFinalApplication = (data = {}) => {
return gscPost("/evalElectronicContract/webPayFinalApplication", data, {
timeout: 30000
timeout: 30000,
returnAll: true
})
}
/**
......
import { BrowserTracing } from "@sentry/tracing";
// 接入sentry
import * as Sentry from "@sentry/vue";
import { Request } from "glsk-toolkit";
// Vue
import Vue from "vue";
// import { GLCombiForm } from "glsx-components" // 权限按钮 (根据权限动态创建)
import VueLazyload from "vue-lazyload";
import { config } from "@/common/baseConfig";
import GLMapSdk from "@/common/glsk-mapapi-sdk";
import notice from "@/common/notice";
import util from "@/libs/util.js";
// 针对template模板中使用可选链操作符
import chaining from "@/plugin/chaining";
// 核心插件
import d2Admin from "@/plugin/d2admin";
// store
import store from "@/store/index";
import Vue from "vue"
// import axios from 'axios'
// import i18n from './i18n'
import App from "./App";
import App from "./App"
// 核心插件
import d2Admin from "@/plugin/d2admin"
// store
import store from "@/store/index"
// 针对template模板中使用可选链操作符
import chaining from "@/plugin/chaining"
// 接入sentry
import * as Sentry from "@sentry/vue"
import { BrowserTracing } from "@sentry/tracing"
// import D2Crud from '@d2-projects/d2-crud'
// 菜单和路由设置
import router from "./router";
import "default-passive-events";
import "element-ui/lib/theme-chalk/index.css";
import router from "./router"
import "default-passive-events"
import notice from "@/common/notice"
import "element-ui/lib/theme-chalk/index.css"
import { config } from "@/common/baseConfig"
import GLMapSdk from "@/common/glsk-mapapi-sdk"
// import { GLCombiForm } from "glsx-components" // 权限按钮 (根据权限动态创建)
import VueLazyload from "vue-lazyload"
import { Request } from "glsk-toolkit"
import util from "@/libs/util.js"
Vue.prototype.$mapapi = new GLMapSdk();
Vue.prototype.$mapapi = new GLMapSdk()
Vue.use(VueLazyload, {
// 懒加载默认加载图片
loading:
// 懒加载默认加载图片
loading:
"https://img02.glsx.com.cn/weapp/resource/saas/dj/images/img_loading.png",
attempt: 3, // 尝试加载次数
});
attempt: 3 // 尝试加载次数
})
// 实例化
process.env.NODE_ENV === "production"
&& Sentry.init({
Vue,
dsn: "https://39bc80d3bb0a419a8d7d9bf5a39678e3@sentry.glsx.com.cn/24",
// dsn: 'http://6225fb8e73fb453a8455a9371f3517da@192.168.3.115:9000/4',
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ["localhost", "my-site-url.com", /^\//],
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
logErrors: true,
// 解决火狐浏览器 无法捕获错误的问题
beforeSend(event, hint) {
const isNonErrorException
= event.exception.values[0].value.startsWith(
"Non-Error exception captured",
)
|| hint.originalException.message.startsWith(
"Non-Error exception captured",
);
if (isNonErrorException) {
// We want to ignore those kind of errors
return null;
}
return event;
},
// "send-default-pii": true
});
process.env.NODE_ENV === "production" &&
Sentry.init({
Vue,
dsn: "https://39bc80d3bb0a419a8d7d9bf5a39678e3@sentry.glsx.com.cn/24",
// dsn: 'http://6225fb8e73fb453a8455a9371f3517da@192.168.3.115:9000/4',
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ["localhost", "my-site-url.com", /^\//]
})
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
logErrors: true,
// 解决火狐浏览器 无法捕获错误的问题
beforeSend(event, hint) {
const isNonErrorException =
event.exception.values[0].value.startsWith(
"Non-Error exception captured"
) ||
hint.originalException.message.startsWith(
"Non-Error exception captured"
)
if (isNonErrorException) {
// We want to ignore those kind of errors
return null
}
return event
}
// "send-default-pii": true
})
// d2Admin 已导入
// import ElementUI from 'element-ui'
// Vue.use(ElementUI)
// 核心插件
Vue.use(d2Admin);
Vue.use(chaining);
Vue.use(d2Admin)
Vue.use(chaining)
// Vue.use(GLCombiForm)
Vue.prototype.notice = notice;
Vue.prototype.notice = notice
const isProd = process.env.NODE_ENV === "production";
const isProd = process.env.NODE_ENV === "production"
// console.log(isProd)
if (!isProd) {
Vue.config.devtools = true;
Vue.config.devtools = true
}
Vue.prototype.$EventBus = new Vue();
Vue.prototype.$EventBus = new Vue()
Vue.directive("preventReClick", {
bind: (el, binding) => {
let time = binding.value; // 防抖时间
if (!time) {
// 用户若不设置防抖时间,则默认1s
time = 1000;
}
let fun;
el.addEventListener(
"click",
(event) => {
if (!fun) {
// 第一次执行
fun = setTimeout(() => {
fun = null;
}, time);
} else {
// 直接取消当前事件
event && event.stopImmediatePropagation();
}
},
true,
);
},
});
let baseConfig = config;
bind: (el, binding) => {
let time = binding.value // 防抖时间
if (!time) {
// 用户若不设置防抖时间,则默认1s
time = 1000
}
let fun
el.addEventListener(
"click",
(event) => {
if (!fun) {
// 第一次执行
fun = setTimeout(() => {
fun = null
}, time)
} else {
// 直接取消当前事件
event && event.stopImmediatePropagation()
}
},
true
)
}
})
let baseConfig = config
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
fetch(
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config",
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config"
)
.then(
(response) => {
// 处理http响应
return response.json();
},
(error) => {
// 处理错误
console.log(error);
},
)
.then((response) => {
const { code, data } = response;
console.log("response", code, response);
if (code == "200") {
console.log(data);
baseConfig = data;
// console.log("baseConfig", baseConfig)
// window.$fetchConfig = data
} else {
baseConfig = response;
window.$fetchConfig = response;
console.log(response);
window.$gscApi = new Request({
...response.gsc,
// baseURL:'http://192.168.3.145:9898/gsc-vcp-web-facade',
// baseURL: 'http://gsc.test.glsx.com.cn/gsc-vcp-web-facade',
session: {
requiresSession: true,
sessionId: _ => util.cookies.get("token"),
},
events: {
error: (error, config) => {
Vue.prototype.$message.error(error.msg);
},
logout: (response, config) => {
store.dispatch("d2admin/user/clear");
util.cookies.remove("token");
router.replace("/login");
Vue.prototype.$message.error("登录超时,请重新登录");
},
},
});
console.log(window.$gscApi, "========");
}
})
.finally(() => {
init();
});
.then(
(response) => {
// 处理http响应
return response.json()
},
(error) => {
// 处理错误
console.log(error)
}
)
.then((response) => {
const { code, data } = response
console.log("response", code, response)
if (code == "200") {
console.log(data)
baseConfig = data
// console.log("baseConfig", baseConfig)
// window.$fetchConfig = data
} else {
baseConfig = response
window.$fetchConfig = response
console.log(response)
window.$gscApi = new Request({
...response.gsc,
// baseURL:'http://192.168.3.145:9898/gsc-vcp-web-facade',
// baseURL: 'http://gsc.test.glsx.com.cn/gsc-vcp-web-facade',
session: {
requiresSession: true,
sessionId: (_) => util.cookies.get("token")
},
events: {
error: (error, config) => {
Vue.prototype.$message.error(error.msg)
},
logout: (response, config) => {
store.dispatch("d2admin/user/clear")
util.cookies.remove("token")
router.replace("/login")
Vue.prototype.$message.error("登录超时,请重新登录")
}
}
})
console.log(window.$gscApi, "========")
}
})
.finally(() => {
init()
})
function init() {
new Vue({
router,
store,
// i18n,
render: (h) => {
// baseConfig.axios.baseURL = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
// data
// console.log(data)
Vue.prototype.baseConfig = baseConfig;
return h(App);
},
created() {
// 系统配置
Vue.config.devtools = true;
// 展示系统信息
this.$store.commit("d2admin/releases/versionShow");
// 用户登录后从数据库加载一系列的设置
this.$store.dispatch("d2admin/account/load");
// 获取并记录用户 UA
this.$store.commit("d2admin/ua/get");
// 初始化全屏监听
this.$store.dispatch("d2admin/fullscreen/listen");
},
mounted() {},
}).$mount("#app");
new Vue({
router,
store,
// i18n,
render: (h) => {
// baseConfig.axios.baseURL = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
// data
// console.log(data)
Vue.prototype.baseConfig = baseConfig
return h(App)
},
created() {
// 系统配置
Vue.config.devtools = true
// 展示系统信息
this.$store.commit("d2admin/releases/versionShow")
// 用户登录后从数据库加载一系列的设置
this.$store.dispatch("d2admin/account/load")
// 获取并记录用户 UA
this.$store.commit("d2admin/ua/get")
// 初始化全屏监听
this.$store.dispatch("d2admin/fullscreen/listen")
},
mounted() {}
}).$mount("#app")
}
export { baseConfig };
export { baseConfig }
......@@ -59,6 +59,19 @@ const PAY_MENTMETHOD_OPTIONS = Object.keys(PAY_MENTMETHOD_MAP).map((key) => {
value: key
}
})
// 合同企业主体(内部主体)
// wechatType: 1-惠州广联、3-优加
const wechatType_MAP = {
1: "惠州广联",
3: "优加"
}
const wechatType_OPTIONS = Object.keys(wechatType_MAP).map((key) => {
return {
label: wechatType_MAP[key],
value: key
}
})
module.exports = {
RECEIPT_STATUS,
PUSH_STATUS,
......@@ -70,5 +83,7 @@ module.exports = {
RECEIPT_STATUS_OPTIONS,
NB_TRANSFER_STATUS_OPTIONS,
PAY_MENTMETHOD_OPTIONS,
PAY_MENTMETHOD_MAP
PAY_MENTMETHOD_MAP,
wechatType_OPTIONS,
wechatType_MAP
}
......@@ -7,16 +7,14 @@
class="show-search"
:search-form="searchForm"
:form-data="showFormData"
label-width="130px"
>
label-width="130px">
<template #inputRangeHtml>
<input-range
start-placeholder="最小金额"
end-placeholder="最大金额"
:display-value="searchForm.amtList"
max-length="15"
input-max-length="15"
></input-range>
input-max-length="15"></input-range>
</template>
<template #selectDatePickerHtml>
<div class="select-date-picker">
......@@ -24,14 +22,12 @@
v-model="searchForm.dateType"
placeholder="请选择"
@change="searchForm.dateValue = ''"
class="select"
>
class="select">
<el-option
v-for="(subItem, subIndex) in selectOption"
:key="subIndex"
:label="subItem.label"
:value="subItem.value"
/>
:value="subItem.value" />
</el-select>
<el-date-picker
class="date-picker"
......@@ -42,8 +38,7 @@
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="rangePickerOptions"
:default-time="['00:00:00', '23:59:59']"
/>
:default-time="['00:00:00', '23:59:59']" />
</div>
</template>
</d2-search>
......@@ -58,13 +53,11 @@
<d2-table-header>
<span
data-event-code="usedcar_payment_push_list"
style="margin-right: 10px"
>
style="margin-right: 10px">
<auth-button
category="Button"
:show-btn-ids="['9051401']"
:loading="pushPayBillLoading"
/>
:loading="pushPayBillLoading" />
</span>
<span data-event-code="usedcar_payment_management_list_export">
<auth-button category="Button" :show-btn-ids="['9051402']" />
......@@ -75,16 +68,14 @@
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
:before-search-fn="beforeSearchFn">
<div slot="statusHtml" slot-scope="scope">
<span
class="circle"
:style="{
background:
baseData[scope.columnsObj.colorKey][scope.scope[scope.prop]]
}"
></span>
}"></span>
{{
baseData[scope.columnsObj.enumKey][scope.scope[scope.prop]] || "-"
}}
......@@ -98,8 +89,7 @@
id: scope.scope.id
})
"
data-event-code="usedcar_payment_detail"
>
data-event-code="usedcar_payment_detail">
<auth-button :data="scope.scope" :show-btn-ids="['9051403']" />
</span>
<!-- 回单 -->
......@@ -112,8 +102,7 @@
<detailDialog
:visible="detailDialogVisible"
:params-obj="detailDialogParams"
@dialogClose="closeDetailDialog"
/>
@dialogClose="closeDetailDialog" />
</d2-container>
</template>
......@@ -135,7 +124,9 @@ import {
RECEIPT_STATUS_OPTIONS,
NB_TRANSFER_STATUS_OPTIONS,
PAY_MENTMETHOD_OPTIONS,
PAY_MENTMETHOD_MAP
PAY_MENTMETHOD_MAP,
wechatType_OPTIONS,
wechatType_MAP
} from "./contant"
import detailDialog from "./components/detailDialog.vue"
import { todayEndPickerOptions } from "@/common/format"
......@@ -179,7 +170,8 @@ export default {
amtList: [],
dateType: "payment",
dateValue: "",
paymentMethod: "全部"
paymentMethod: "全部",
wechatType: ""
},
showFormData: [
{
......@@ -298,6 +290,16 @@ export default {
optionId: "label",
optionLabel: "label",
optionsName: "PAY_MENTMETHOD_OPTIONS"
},
{
label: "内部主体",
name: "wechatType",
type: "select",
isClear: true,
optionList: [],
optionId: "value",
optionLabel: "label",
optionsName: "wechatType_OPTIONS"
}
],
// 基本数据
......@@ -311,7 +313,9 @@ export default {
pushStatus: deepClone(PUSH_STATUS),
nbTransferStatus: deepClone(NB_TRANSFER_STATUS),
PAY_MENTMETHOD_OPTIONS: deepClone(PAY_MENTMETHOD_OPTIONS),
PAY_MENTMETHOD_MAP: deepClone(PAY_MENTMETHOD_MAP)
PAY_MENTMETHOD_MAP: deepClone(PAY_MENTMETHOD_MAP),
wechatType_OPTIONS: deepClone(wechatType_OPTIONS),
wechatType_MAP: deepClone(wechatType_MAP)
},
getListApi: getUsedCarPaymentList,
searchFormSearch: {},
......@@ -422,6 +426,14 @@ export default {
label: "付款方式",
prop: "paymentMethod",
minWidth: 120
},
{
label: "内部主体",
prop: "wechatType",
minWidth: 120,
formatter: (cellValue) => {
return this.baseData.wechatType_MAP[cellValue.wechatType] || "-"
}
}
]
},
......
......@@ -524,10 +524,14 @@
<!-- 取消分账 -->
<auth-button slot="auth-button" v-if="scope.row.profitAllocationStatus == 5" :show-btn-ids="['9040135']"
:data="scope.row" />
<!-- 通过 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040147']" :data="scope.row" />
<!-- 驳回 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040148']" :data="scope.row" />
<div>
<!-- 通过 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040147']" :data="scope.row" />
</div>
<div>
<!-- 驳回 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040148']" :data="scope.row" />
</div>
</template>
</el-table-column>
</el-table>
......
......@@ -505,10 +505,14 @@
</el-button> -->
<!-- 取消分账 -->
<auth-button v-if="scope.row.profitAllocationStatus == 5" :show-btn-ids="['9040107']" :data="scope.row" />
<!-- 通过 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040147']" :data="scope.row" />
<!-- 驳回 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040148']" :data="scope.row" />
<div>
<!-- 通过 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040147']" :data="scope.row" />
</div>
<div>
<!-- 驳回 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040148']" :data="scope.row" />
</div>
</template>
</el-table-column>
</el-table>
......
<!-- 引荐数审核 -->
<template>
<d2-container class="layout">
<div class="header">
<d2-search
ref="showSearch"
:search-form="searchForm"
:form-data="showFormData"
label-width="100px"
:selectPopperAppendToBody="false"
class="d2-search"
>
<template slot="managerCommitTime">
<el-date-picker
v-model="searchForm.managerCommitTime"
type="monthrange"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
:picker-options="monthPickerOptions"
size="small"
:clearable="false"
value-format="yyyy-MM"
>
</el-date-picker>
</template>
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId" size="small" type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table-header>
<auth-button :show-btn-ids="['9040903']" category="Button" />
</d2-table-header>
<d2-container class="layout">
<div class="header">
<d2-search
ref="showSearch"
:search-form="searchForm"
:form-data="showFormData"
label-width="100px"
:selectPopperAppendToBody="false"
class="d2-search"
>
<template slot="managerCommitTime">
<el-date-picker
v-model="searchForm.managerCommitTime"
type="monthrange"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
:picker-options="monthPickerOptions"
size="small"
:clearable="false"
value-format="yyyy-MM"
>
</el-date-picker>
</template>
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId" size="small" type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table-header>
<auth-button :show-btn-ids="['9040903']" category="Button" />
</d2-table-header>
<!-- :get-list-api="getListApi" -->
<d2-table
ref="tableRef"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<div slot="imageUrls" slot-scope="scope" class="coverImage-preview">
<glsx-preview
:image-url-arr="
scope.scope.imageUrls
? formatterImg(scope.scope.imageUrls)
: [noDataUrl]
"
:pic-options="picOptions"
limit="1"
></glsx-preview>
</div>
<template slot="remark" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.remark || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.remark || "-"
}}</span>
</el-popover>
</template>
<template slot="merchantName" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.merchantName || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.merchantName || "-"
}}</span>
</el-popover>
</template>
<!--状态 -->
<div slot="statusHtml" slot-scope="scope">
<div class="online-status">
<span
class="dot"
:style="{
background: getStatusColor(
scope && scope.scope && scope.scope.isReviewed,
'reviewStatusOptMap'
)
}"
></span>
{{
getStatusItem(
baseData,
"reviewStatusOpts",
scope.scope,
"isReviewed"
)
}}
</div>
</div>
<div slot="auth-button" slot-scope="scope">
<span
style="margin-right: 8px"
v-if="scope.scope.isReviewed == 2 || scope.scope.isReviewed == 1"
>
<auth-button
slot="auth-button"
:show-btn-ids="['9040901']"
:data="scope.scope"
/>
</span>
<span v-else>
<auth-button
slot="auth-button"
:show-btn-ids="['9040902']"
:data="scope.scope"
/>
</span>
</div>
</d2-table>
</div>
<referral-dialog
v-if="referralVisible"
:detailVisible="referralVisible"
:id="id"
@dialogClose="handlereferralClose"
></referral-dialog>
</d2-container>
<!-- :get-list-api="getListApi" -->
<d2-table
ref="tableRef"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<div
slot="imageUrls"
slot-scope="scope"
class="coverImage-preview"
>
<glsx-preview
:image-url-arr="
scope.scope.imageUrls
? formatterImg(scope.scope.imageUrls)
: [noDataUrl]
"
:pic-options="picOptions"
limit="1"
></glsx-preview>
</div>
<template slot="remark" slot-scope="scope">
<template v-if="scope.scope.remark">
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div class="tags-popover">
{{ scope.scope.remark || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.remark || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
<template slot="merchantName" slot-scope="scope">
<template v-if="scope.scope.merchantName">
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div class="tags-popover">
{{ scope.scope.merchantName || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.merchantName || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
<!--状态 -->
<div slot="statusHtml" slot-scope="scope">
<div class="online-status">
<span
class="dot"
:style="{
background: getStatusColor(
scope &&
scope.scope &&
scope.scope.isReviewed,
'reviewStatusOptMap'
),
}"
></span>
{{
getStatusItem(
baseData,
"reviewStatusOpts",
scope.scope,
"isReviewed"
)
}}
</div>
</div>
<div slot="auth-button" slot-scope="scope">
<span
style="margin-right: 8px"
v-if="
scope.scope.isReviewed == 2 ||
scope.scope.isReviewed == 1
"
>
<auth-button
slot="auth-button"
:show-btn-ids="['9040901']"
:data="scope.scope"
/>
</span>
<span v-else>
<auth-button
slot="auth-button"
:show-btn-ids="['9040902']"
:data="scope.scope"
/>
</span>
</div>
</d2-table>
</div>
<referral-dialog
v-if="referralVisible"
:detailVisible="referralVisible"
:id="id"
@dialogClose="handlereferralClose"
></referral-dialog>
</d2-container>
</template>
<script type="text/ecmascript-6">
......@@ -502,70 +525,70 @@ export default {
<style scoped lang="scss">
.layout {
.d2-search {
::v-deep.el-select-dropdown,
.el-popper {
width: 300px !important;
}
}
.header {
background: #fff;
}
.content {
position: absolute;
left: 20px;
width: calc(100% - 40px);
padding: 0 20px 36px;
background: #fff;
margin-top: 14px;
height: calc(100% - 110px);
box-sizing: border-box;
overflow-y: auto;
.top {
height: 52px;
color: #333333;
font-size: 32rpx;
font-weight: 500;
display: flex;
align-items: center;
.exprot {
margin-left: auto;
}
}
}
.tag {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
padding: 0 10px;
display: block;
}
.online-status {
display: flex;
justify-content: center;
align-items: center;
.d2-search {
::v-deep.el-select-dropdown,
.el-popper {
width: 300px !important;
}
}
.header {
background: #fff;
}
.content {
position: absolute;
left: 20px;
width: calc(100% - 40px);
padding: 0 20px 36px;
background: #fff;
margin-top: 14px;
height: calc(100% - 110px);
box-sizing: border-box;
overflow-y: auto;
.top {
height: 52px;
color: #333333;
font-size: 32rpx;
font-weight: 500;
display: flex;
align-items: center;
.exprot {
margin-left: auto;
}
}
}
.tag {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
padding: 0 10px;
display: block;
}
.online-status {
display: flex;
justify-content: center;
align-items: center;
.dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 8px;
}
}
.dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 8px;
}
}
}
.coverImage-preview {
width: 138px;
height: 54px;
::v-deep .photo-activity {
width: 100%;
height: 100%;
object-fit: contain;
position: static !important;
}
width: 138px;
height: 54px;
::v-deep .photo-activity {
width: 100%;
height: 100%;
object-fit: contain;
position: static !important;
}
}
::v-deep.tags-popover {
max-width: 50vw;
max-width: 50vw;
}
</style>
......@@ -14,6 +14,7 @@
@handleClose="closeDialogVisible"
@handleConfirm="handleUpdateConfirm"
:slotArr="slotArr"
class="batch-modify-salary-dialog"
>
<template slot="effectiveMonth">
<el-date-picker
......@@ -24,6 +25,7 @@
size="small"
:clearable="false"
value-format="yyyy-MM"
class="effectiveMonth"
>
</el-date-picker>
</template>
......@@ -62,7 +64,7 @@ export default {
},
isUpdateDialogConfig: {
title: "批量修改薪资占比",
width: "500px",
width: "480px",
okText: "确定"
},
isUpdateForm: {
......@@ -111,6 +113,9 @@ export default {
this.validatePercent(value, callback),
trigger: "blur"
}
],
effectiveMonth: [
{ required: true, message: "请选择", trigger: "change" }
]
},
baseData: {},
......@@ -195,4 +200,10 @@ export default {
}
}
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.batch-modify-salary-dialog{
::v-deep .el-date-editor.el-input{
width: 290px!important;
}
}
</style>
......@@ -77,7 +77,8 @@
></glsx-preview>
</div>
<template slot="remark" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<template v-if="scope.scope.remark">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.remark || "-" }}
</div>
......@@ -85,16 +86,21 @@
scope.scope.remark || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
<template slot="replyContent" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.replyContent || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.replyContent || "-"
}}</span>
</el-popover>
<template v-if="scope.scope.replyContent">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.replyContent || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.replyContent || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
<div slot="auth-button" slot-scope="scope">
<el-button
......@@ -421,6 +427,9 @@ export default {
.el-popper {
width: 300px !important;
}
.el-date-editor.el-input, .el-date-editor.el-input__inner{
width:100% !important;
}
}
.content {
position: absolute;
......
This diff could not be displayed because it is too large.
......@@ -29,7 +29,6 @@
v-model="infoForm.merchantIds"
multiple
collapse-tags
:multiple-limit="10"
@change="updateStaffList('staffPhoneList')"
>
<el-option
......@@ -48,7 +47,6 @@
v-model="infoForm.staffPhoneList"
multiple
collapse-tags
:multiple-limit="10"
>
<el-option
v-for="item in baseData.staffList"
......@@ -96,7 +94,7 @@
>模板下载</el-button
> -->
<div class="tips-text">
选择员工在近3个月内的工资导出文件,批量修订后导入更新
支持批量修订近3个月内到工资导出文件后导入更新
</div>
<div class="file_box" v-if="fileName">
<div class="file_name">{{ fileName }}</div>
......@@ -135,7 +133,6 @@
v-model="infoForm.exportMerchantIds"
multiple
collapse-tags
:multiple-limit="10"
@change="updateStaffList('salaryMerchantList')"
>
<el-option
......@@ -154,7 +151,6 @@
v-model="infoForm.exportStaffPhoneList"
multiple
collapse-tags
:multiple-limit="10"
>
<el-option
v-for="item in baseData.exportStaffList"
......
......@@ -252,7 +252,7 @@ export default {
optionsName: "directLeaderList"
},
{
label: "工资绩效",
label: "含工资人员",
name: "salaryStaffPhone",
type: "select",
isClear: true,
......
<!-- 详情 -->
<template>
<baseDialog
:dialog-config="dialogConfig"
class="accountDailog"
:config="config"
:dialog-config="dialogConfig"
:is-show.sync="visible"
class="accountDailog"
@handleClick="handleClick"
>
<div class="sun-dialog" v-loading="loading">
<div v-loading="loading" class="sun-dialog">
<div class="approve-info">
提交后经由嘀加企微,推送到审批人<span
v-for="(item, index) in detailInfo.examineData"
:key="index + 'exam'"
>{{ item.approverName }}{{ item.approverMobile }}</span
>,抄送人<span
v-for="(item, index) in detailInfo.referData"
:key="index + 'refer'"
>{{ item.approverName }}{{ item.approverMobile }}</span
>,审批人通过方案后,方案正式生效
提交后经由嘀加企微,推送到审批人
<template
v-if="
detailInfo.examineData && detailInfo.examineData.length
"
><span
v-for="(item, index) in detailInfo.examineData"
:key="`${index}exam`"
>
{{ item.approverName }}{{ item.approverMobile }}
</span> </template
><span v-else>-</span>,抄送人
<template
v-if="detailInfo.referData && detailInfo.referData.length"
>
<span
v-for="(item, index) in detailInfo.referData"
:key="`${index}refer`"
>
{{ item.approverName }}{{ item.approverMobile }}
</span></template
>
<span v-else>-</span>,审批人通过方案后,方案正式生效
</div>
<template v-if="detailInfo">
<detailComp
:configData="configData"
:detailInfo="detailInfo"
<DetailComp
:config-data="configData"
:detail-info="detailInfo"
:is-close="isEdit"
:rules="rules"
:isClose="isEdit"
>
<template #merchantBrandRefList>
<div
class="merchantBrand-box"
v-if="
detailInfo.merchantBrandList &&
detailInfo.merchantBrandList.length
"
class="merchantBrand-box"
>
<div
class="box"
v-for="item in detailInfo.merchantBrandList"
:key="item.merchantId"
class="box"
>
<div class="merchantName">
{{ item.merchantName }}
</div>
<div class="brands">
<div
class="brand"
v-for="tag in item.child"
:key="tag.childId"
class="brand"
>
{{ tag.childName }}
</div>
......@@ -55,15 +69,15 @@
</div>
<span v-else>-</span>
</template>
</detailComp>
</DetailComp>
<template v-if="!isEdit">
<el-form label-width="150px" style="margin-top: -60px">
<el-row
:gutter="20"
:key="index"
v-for="(
item, index
) in detailInfo.approveOperationRecordList"
:key="index"
:gutter="20"
>
<el-col :span="12">
<el-form-item label="审批人:">
......@@ -73,20 +87,22 @@
<el-col :span="12">
<el-form-item label="审批意见:">
<!-- 将 v-html 改为纯文本插值,并应用换行样式 -->
<span class="opinion-text">{{
formatOpinionText(
item.approveOpinion
) || "-"
}}</span>
<span class="opinion-text">
{{
formatOpinionText(
item.approveOpinion
) || "-"
}}
</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-form label-width="150px" v-if="detailInfo.referData">
<el-form v-if="detailInfo.referData" label-width="150px">
<el-row
:gutter="20"
:key="index"
v-for="(item, index) in detailInfo.referData"
:key="index"
:gutter="20"
>
<el-col :span="24">
<el-form-item label="查阅人:">
......@@ -102,19 +118,35 @@
</template>
<script>
import { interviewResultOpt, processResultOpt } from "@/common/constants.js";
import { getPerformanceConfigDetailAPI } from "@/api/resident";
import {
getApproveConfig,
getConfigApprovetDetail,
submitConfigApprove,
getApproveConfig,
} from "@/api/salaryManagement.js";
import { getPerformanceConfigDetailAPI } from "@/api/resident";
import { interviewResultOpt, processResultOpt } from "@/common/constants.js";
import { deepClone, getStatusItem, Util } from "@/common/util";
import detailComp from "./detailComp.vue";
import { Util, deepClone, getStatusItem } from "@/common/util";
export default {
name: "approvalView",
name: "ApprovalView",
components: {
detailComp,
DetailComp: detailComp,
},
props: {
detailVisible: {
type: Boolean,
default: false,
},
id: {
type: Number || String,
default: "",
},
isEdit: {
type: Boolean,
default: false,
},
},
data() {
return {
......@@ -203,23 +235,9 @@ export default {
interviewResultOpt,
processResultOpt,
},
isConfirm: false,
};
},
props: {
detailVisible: {
type: Boolean,
default: false,
},
id: {
type: Number || String,
default: "",
},
isEdit: {
type: Boolean,
default: false,
},
},
computed: {
visible: {
get() {
......@@ -228,6 +246,7 @@ export default {
set(newVal) {
this.$emit("dialogClose", {
isConfirm: this.isConfirm,
flag: newVal,
attrName: "detailVisible",
});
......@@ -264,11 +283,12 @@ export default {
approveAttachments: this.detailInfo.editAttachmentImgs.length
? this.detailInfo.editAttachmentImgs.join(",")
: "",
}
};
submitConfigApprove(params)
.then((res) => {
if (res) {
this.$message.success("操作成功");
this.isConfirm = true;
}
})
.finally((err) => {
......@@ -303,16 +323,16 @@ export default {
this.loading = false;
this.configData[0].infoData[
this.findAttrIdx("infoData", "approveRemark")
].isHidden = !this.isEdit ? false : true;
].isHidden = !!this.isEdit;
this.configData[0].infoData[
this.findAttrIdx("infoData", "attachmentImgs")
].isHidden = !this.isEdit ? false : true;
].isHidden = !!this.isEdit;
this.configData[0].infoData[
this.findAttrIdx("infoData", "editApproveRemark")
].isHidden = this.isEdit ? false : true;
].isHidden = !this.isEdit;
this.configData[0].infoData[
this.findAttrIdx("infoData", "editAttachmentImgs")
].isHidden = this.isEdit ? false : true;
].isHidden = !this.isEdit;
// this.detailInfo = res
Object.assign(this.detailInfo, res);
......@@ -347,16 +367,16 @@ export default {
this.loading = false;
this.configData[0].infoData[
this.findAttrIdx("infoData", "approveRemark")
].isHidden = !this.isEdit ? false : true;
].isHidden = !!this.isEdit;
this.configData[0].infoData[
this.findAttrIdx("infoData", "attachmentImgs")
].isHidden = !this.isEdit ? false : true;
].isHidden = !!this.isEdit;
this.configData[0].infoData[
this.findAttrIdx("infoData", "editApproveRemark")
].isHidden = this.isEdit ? false : true;
].isHidden = !this.isEdit;
this.configData[0].infoData[
this.findAttrIdx("infoData", "editAttachmentImgs")
].isHidden = this.isEdit ? false : true;
].isHidden = !this.isEdit;
this.detailInfo = res;
// console.log(this.detailInfo, "this.detailInfo")
......@@ -401,7 +421,7 @@ export default {
return result;
},
findAttrIdx(formName, name) {
var index = this.configData[0][formName].findIndex(
let index = this.configData[0][formName].findIndex(
(k) => k.key == name
);
return index || 0;
......@@ -422,6 +442,7 @@ export default {
},
};
</script>
<style lang="scss" scoped>
@import "./detail.scss";
::v-deep .el-dialog__body {
......@@ -501,6 +522,7 @@ export default {
border-radius: 4px;
border: 1px solid #00000026;
padding: 3px 8px;
margin-bottom: 8px;
}
}
}
......
<!-- 提成方案配置 -->
<template>
<d2-container class="rewardPool-list m-t-40">
<div class="d2-container-content">
<d2-table-header>
<span>
<el-button type="primary" size="small" @click="handleAdd"
>新增提成方案</el-button
>
</span>
</d2-table-header>
<d2-table
ref="commissionTable"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
>
<!-- 状态 -->
<div slot="statusHtml" slot-scope="scope">
<div
class="online-status"
v-if="scope.scope.status === 0 || scope.scope.status"
>
<span
class="dot"
:style="{
background: getStatusColor(
scope && scope.scope && scope.scope.status,
'statusTypeOptMap'
)
}"
></span>
{{ getStatusItem(baseData, "statusList", scope.scope, "status") }}
</div>
<span v-else>-</span>
</div>
<div slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleParameter(scope.scope)"
>调整参数</el-button
>
</div>
</d2-table>
</div>
</d2-container>
<d2-container class="rewardPool-list m-t-40">
<div class="d2-container-content">
<d2-table-header>
<span>
<el-button size="small" type="primary" @click="handleAdd">
新增提成方案
</el-button>
</span>
</d2-table-header>
<d2-table
ref="commissionTable"
:get-list-api="getListApi"
:search-form="searchFormSearch"
:table-params="tableParams"
>
<!-- 状态 -->
<template #statusHtml="scope">
<div>
<div
v-if="
scope.scope.status === 0 || scope.scope.status
"
class="online-status"
>
<span
class="dot"
:style="{
background: getStatusColor(
scope &&
scope.scope &&
scope.scope.status,
'statusTypeOptMap'
),
}"
>
</span>
{{
getStatusItem(
baseData,
"statusList",
scope.scope,
"status"
)
}}
</div>
<span v-else>-</span>
</div>
</template>
<template #auth-button="scope">
<div>
<el-button
type="text"
@click="handleParameter(scope.scope)"
>
调整参数
</el-button>
</div>
</template>
</d2-table>
</div>
</d2-container>
</template>
<script>
import { Util, deepClone, getStatusItem, getStatusColor } from "@/common/util"
import { getConfigList } from "@api/salaryManagement"
import { getConfigList } from "@api/salaryManagement";
import {
outputValue_businessOpt,
statusList,
statusTypeOptMap
} from "@/common/constants"
export default {
name: "commissionPlanList",
data() {
return {
getStatusColor,
getStatusItem,
getListApi: getConfigList,
tableParams: {
listName: "list",
tableOption: {
width: "100"
},
tableColumns: [
{
label: "提成方案名称",
prop: "schemeName"
},
{
label: "业务",
prop: "businessType",
formatter: (cellValue) => {
return this.getStatusItem(
this.baseData,
"businessTypeOpt",
cellValue,
"businessType"
)
}
},
{
label: "应用门店数",
prop: "applicationQuantity",
formatter: (cellValue) => {
return cellValue.applicationQuantity ||
cellValue.applicationQuantity === 0
? cellValue.applicationQuantity + "家"
: "-"
}
},
{
label: "状态",
prop: "status",
minWidth: 120,
addHtml: "statusHtml"
},
{
label: "生效月份",
prop: "effectiveMonth",
formatter: (cellValue) => {
// 生效月份(格式:yyyy-MM)转成2026年1月
if (!cellValue.effectiveMonth) return "-"
const [year, month] = cellValue.effectiveMonth.split("-")
return `${year}年${parseInt(month)}月`
}
},
{
label: "更新时间",
prop: "updatedDate",
formatter: (cellValue) => {
return Util.dateFormate(
cellValue.updatedDate,
"YYYY-MM-DD HH:mm:ss"
)
}
}
]
},
baseData: {
businessTypeOpt: [
{
confId: 2,
confValue: "单延保"
},
{
confId: 1,
confValue: "广联权益"
},
{
confId: 0,
confValue: "轻改"
}
],
statusList: deepClone(statusList),
statusTypeOptMap: deepClone(statusTypeOptMap)
},
searchFormSearch: {}
}
},
mounted() {},
methods: {
handleSearch() {
this.page = this.$options.data.call(this).page
outputValue_businessOpt,
statusList,
statusTypeOptMap,
} from "@/common/constants";
import { deepClone, getStatusColor, getStatusItem, Util } from "@/common/util";
this.$refs.commissionTable.refreshTable(true, true)
},
// 新增提成方案
handleAdd() {
const params = JSON.stringify({
page: 'commissionPlanList'
})
this.$router.push({
name: 'performanceScheme',
query: {
params
}
})
export default {
name: "CommissionPlanList",
data() {
return {
getStatusColor,
getStatusItem,
getListApi: getConfigList,
tableParams: {
listName: "list",
tableOption: {
width: "100",
},
tableColumns: [
{
label: "提成方案名称",
prop: "schemeName",
},
{
label: "业务",
prop: "businessType",
formatter: (cellValue) => {
return this.getStatusItem(
this.baseData,
"businessTypeOpt",
cellValue,
"businessType"
);
},
},
{
label: "应用门店数",
prop: "applicationQuantity",
formatter: (cellValue) => {
return cellValue.applicationQuantity ||
cellValue.applicationQuantity === 0
? `${cellValue.applicationQuantity}家`
: "-";
},
},
{
label: "状态",
prop: "status",
minWidth: 120,
addHtml: "statusHtml",
},
{
label: "生效月份",
prop: "effectiveMonth",
formatter: (cellValue) => {
// 生效月份(格式:yyyy-MM)转成2026年1月
if (!cellValue.effectiveMonth) return "-";
const [year, month] =
cellValue.effectiveMonth.split("-");
return `${year}年${Number.parseInt(month)}月`;
},
},
{
label: "更新时间",
prop: "updatedDate",
formatter: (cellValue) => {
return Util.dateFormate(
cellValue.updatedDate,
"YYYY-MM-DD HH:mm:ss"
);
},
},
],
},
baseData: {
businessTypeOpt: [
{
confId: 2,
confValue: "单延保",
},
{
confId: 1,
confValue: "广联权益",
},
{
confId: 0,
confValue: "轻改",
},
],
statusList: [
{ confId: 2, confValue: "生效" },
{ confId: 1, confValue: "审批中" },
{ confId: 0, confValue: "草稿" },
{ confId: 3, confValue: "未生效" },
],
statusTypeOptMap: deepClone(statusTypeOptMap),
},
searchFormSearch: {},
};
},
//调整参数
handleParameter(data) {
const params = JSON.stringify({
page: 'commissionPlanList',
id: data.id
})
this.$router.push({
name: 'performanceScheme',
query: {
params
}
})
mounted() {},
methods: {
handleSearch() {
this.page = this.$options.data.call(this).page;
this.$refs.commissionTable.refreshTable(true, true);
},
// 新增提成方案
handleAdd() {
this.$router.push({
// 提成方案
path: "/configureCommissionPlan",
});
},
// 调整参数
handleParameter(data) {
this.$router.push({
path: "/configureCommissionPlan",
query: {
id: data.id,
},
});
},
},
}
}
};
</script>
<style lang="scss" scoped>
.month-class {
width: 100% !important;
width: 100% !important;
}
.rewardPool-list {
// background: #fff;
// padding: 20px;
// background: #fff;
// padding: 20px;
}
.m-t-40 {
margin-top: 40px;
::v-deep .el-tabs__header {
padding: 0 !important;
margin: 0 0 15px !important;
}
margin-top: 40px;
::v-deep .el-tabs__header {
padding: 0 !important;
margin: 0 0 15px !important;
}
}
.static-text {
position: absolute;
top: 30px;
left: 200px;
// margin-top: 20px;
font-size: 14px;
color: #666;
position: absolute;
top: 30px;
left: 200px;
// margin-top: 20px;
font-size: 14px;
color: #666;
}
.d2-container-content {
position: relative;
position: relative;
}
.online-status {
display: flex;
justify-content: center;
align-items: center;
display: flex;
justify-content: center;
align-items: center;
.dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 8px;
}
.dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 8px;
}
}
</style>
......@@ -119,7 +119,13 @@ export default {
storeIdList: [],
statusTypeOptMap: deepClone(statusTypeOptMap),
businessTypeOpts: deepClone(outputValue_businessOpt),
statusList: deepClone(statusList)
statusList: deepClone(statusList),
// approveStatusOpt:[
// { confId: 2, confValue: "生效" },
// { confId: 1, confValue: "审批中" },
// { confId: 0, confValue: "草稿" },
// { confId: 3, confValue: "未生效" }
// ]
}
}
},
......
<!-- 门店提成方案 -->
<template>
<div class="container">
<d2-table
ref="table"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<template slot="brandNames" slot-scope="scope">
<template
v-if="scope.scope.brandNames && scope.scope.brandNames.length > 20"
>
<el-popover
placement="top"
width="300"
popper-class="brand_popver"
trigger="hover"
>
<div class="brand-box">
{{ brandFilter(scope.scope) }}
</div>
<div slot="reference">
{{ brandFilter(scope.scope, 30) }}
</div>
</el-popover>
</template>
<span v-else>{{ scope.scope.brandNames || "-" }}</span>
</template>
<template slot="schemeNames" slot-scope="scope">
<template
v-if="
<div class="container">
<d2-table
ref="table"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<template slot="merchantNames" slot-scope="scope">
{{scope.scope.merchantNames||'-'}} {{scope.scope.merchantId}}
</template>
<template slot="brandNames" slot-scope="scope">
<template
v-if="scope.scope.brandNames && scope.scope.brandNames.length > 20"
>
<el-popover
placement="top"
width="300"
popper-class="brand_popver"
trigger="hover"
>
<div class="brand-box">
{{ brandFilter(scope.scope) }}
</div>
<div slot="reference">
{{ brandFilter(scope.scope, 30) }}
</div>
</el-popover>
</template>
<span v-else>{{ scope.scope.brandNames || "-" }}</span>
</template>
<template slot="schemeNames" slot-scope="scope">
<template
v-if="
scope.scope.schemeNames &&
scope.scope.schemeNames.split(',').length > 0
"
>
<div
v-for="(item, index) in scope.scope.schemeNames.split(',')"
:key="index"
>
{{ item || "-" }}
</div>
</template>
>
<div
v-for="(item, index) in scope.scope.schemeNames.split(',')"
:key="index"
>
{{ item || "-" }}
</div>
</template>
<span v-else>-</span>
</template>
<div slot="auth-button" slot-scope="scope">
<!-- 编辑 -->
<span style="margin-right: 10px">
<span v-else>-</span>
</template>
<div slot="auth-button" slot-scope="scope">
<!-- 编辑 -->
<span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9121202']" />
</span>
</div>
</d2-table>
</div>
</div>
</d2-table>
</div>
</template>
<script>
import { getStoreConfigList } from "@api/salaryManagement"
import { deepClone, getStatusItem } from "@/common/util"
export default {
data() {
return {
getStatusItem,
searchFormSearch: {},
getListApi: getStoreConfigList,
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableOption: {
width: "100"
},
tableColumns: [
{
label: "门店名称",
prop: "merchantNames"
},
{
label: "品牌",
prop: "brandNames",
width: "200",
addHtml: "brandNames"
},
{
label: "提成方案名称",
prop: "schemeNames"
// addHtml: "schemeNames"
},
{
label: "适配业务",
prop: "businessTypes",
formatter: (cellValue) => {
if (!cellValue.businessTypes) return "-"
let str = []
cellValue.businessTypes.split(",").forEach((item) => {
str.push(
this.getStatusItem(this.baseData, "businessTypeOpts", item)
)
})
return str.join(",")
}
}
]
}
}
},
props: {
searchForm: {
type: Object,
default: () => {}
},
baseData: {
type: Object,
default: () => {}
}
},
mounted() {},
methods: {
keyDowmGetList() {
this.$refs.table.refreshTable(true, true)
},
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = {
...this.searchForm
}
resolve()
})
},
brandFilter(ele, lenght) {
if (ele.brandNames) {
return lenght
? ele.brandNames?.length > lenght
? ele.brandNames.substring(0, lenght) + "\u2026"
: ele.brandNames.substring(0, lenght)
: ele.brandNames
} else {
return "-"
}
},
getOptions() {
this.showFormData?.forEach((item, index) => {
if (item.type == "select") {
if (
this.baseData[item.optionsName].length &&
this.baseData[item.optionsName][0][
this.showFormData[index].optionLabel
] !== "全部"
) {
const temp = {}
temp[this.showFormData[index].optionId] = ""
temp[this.showFormData[index].optionLabel] = "全部"
this.baseData[item.optionsName].unshift(temp)
}
this.showFormData[index].optionList = this.baseData[item.optionsName]
}
})
},
// 编辑方案
handleToEdit(row) {
const params = JSON.stringify({
page: 'performanceList',
id: row.id
})
this.$router.push({
name: "performanceScheme",
query: {
params
}
})
}
}
data() {
return {
getStatusItem,
searchFormSearch: {},
getListApi: getStoreConfigList,
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableOption: {
width: "100"
},
tableColumns: [
{
label: "门店名称",
prop: "merchantNames",
addHtml: "merchantNames"
},
{
label: "品牌",
prop: "brandNames",
width: "200",
addHtml: "brandNames"
},
{
label: "提成方案名称",
prop: "schemeNames"
// addHtml: "schemeNames"
},
{
label: "适配业务",
prop: "businessTypes",
formatter: (cellValue) => {
if (!cellValue.businessTypes) return "-"
let str = []
cellValue.businessTypes.split(",").forEach((item) => {
str.push(
this.getStatusItem(this.baseData, "businessTypeOpts", item)
)
})
return str.join(",")
}
}
]
}
}
},
props: {
searchForm: {
type: Object,
default: () => {}
},
baseData: {
type: Object,
default: () => {}
}
},
mounted() {},
methods: {
keyDowmGetList() {
this.$refs.table.refreshTable(true, true)
},
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = {
...this.searchForm
}
resolve()
})
},
brandFilter(ele, lenght) {
if (ele.brandNames) {
return lenght
? ele.brandNames?.length > lenght
? ele.brandNames.substring(0, lenght) + "\u2026"
: ele.brandNames.substring(0, lenght)
: ele.brandNames
} else {
return "-"
}
},
getOptions() {
this.showFormData?.forEach((item, index) => {
if (item.type == "select") {
if (
this.baseData[item.optionsName].length &&
this.baseData[item.optionsName][0][
this.showFormData[index].optionLabel
] !== "全部"
) {
const temp = {}
temp[this.showFormData[index].optionId] = ""
temp[this.showFormData[index].optionLabel] = "全部"
this.baseData[item.optionsName].unshift(temp)
}
this.showFormData[index].optionList = this.baseData[item.optionsName]
}
})
},
// 编辑方案
handleToEdit(row) {
console.log(row);
this.$router.push({
path: "/configureStoreCommissionPlan",
query: {
id: row.merchantId,
},
});
}
}
}
</script>
<style lang="scss" scoped>
.m-t-40 {
margin-top: 40px;
margin-top: 40px;
}
.container {
margin-top: 8px;
margin-top: 8px;
}
.brand-box {
font-size: 12px;
padding: 10px;
box-sizing: border-box;
font-size: 12px;
padding: 10px;
box-sizing: border-box;
}
</style>
<style>
.brand_popver {
height: auto !important;
max-height: 200px;
overflow: auto !important;
min-height: 0;
padding: 0 !important;
box-sizing: border-box;
height: auto !important;
max-height: 200px;
overflow: auto !important;
min-height: 0;
padding: 0 !important;
box-sizing: border-box;
}
</style>
<template>
<div>
<el-form-item label="适配业务:" prop="businessType" >
<el-radio-group v-model="businessType">
<el-radio label="0">
<el-form-item label="适配业务:" prop="businessType">
<el-radio-group v-model="businessType" @change="handleChangeBusinessType">
<el-radio :disabled="!businessTypes.includes(0)" :label="0">
轻改
</el-radio>
<el-radio label="1">
<el-radio :disabled="!businessTypes.includes(1)" :label="1">
延保
</el-radio>
<el-radio label="2">
<el-radio :disabled="!businessTypes.includes(2)" :label="2">
权益
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="品牌:"
prop="businessType">
<el-radio-group v-model="businessType" @change="handleChangeBusinessType">
<el-radio v-for="item in brandMerchant"
:key="item.businessType"
:label="item.businessType">
{{ item.childBrandNames }}
</el-radio>
</el-radio-group>
</el-form-item>
</div>
</template>
......@@ -22,25 +32,43 @@ import { bindFormFields } from "../../store/helper";
export default {
name: "",
props: {
brandMerchant: {
type: Array,
require: true,
},
},
data() {
return {
businessType: undefined,
};
},
computed: {
businessType: bindFormFields("businessType"),
businessTypes() {
return this.brandMerchant.map(item => item.businessType);
},
brandList() {
return this.brandMerchant.map(item => item.childBrandNames);
},
},
mounted() {
async mounted() {
setTimeout(() => {
if (this.brandMerchant[0]?.businessType) {
this.businessType = this.brandMerchant[0].businessType;
this.handleChangeBusinessType(this.businessType);
}
}, 300);
},
methods: {
handleChangeBusinessType(e) {
const item = this.brandMerchant.find(item => item.businessType === e);
if (item) {
this.$emit("changeBusiness", item);
}
},
},
};
</script>
<style scoped lang="scss">
</style>
<template>
<div class="">
<el-cascader :options="goodsCategory"
placeholder="请选择商品品类"
:props="{ checkStrictly: true, label: 'categoryName', value: 'categoryType' }"
:show-all-levels="false"
:value="value"
@change="handleProductChange">
</el-cascader>
</div>
<div class="">
<el-cascader
clearable
:options="visible ? computedGoodsCategory : goodsCategory"
placeholder="请选择商品品类"
:props="{
checkStrictly: true,
label: 'categoryName',
value: 'categoryType',
}"
:show-all-levels="false"
:value="value"
@change="handleProductChange"
@visible-change="handleVisibleChange"
>
</el-cascader>
</div>
</template>
<script>
import { mapState } from "vuex";
export default {
name: "",
name: "GoodsCategoryCascader",
props: {
value: {
type: Array,
default: () => [],
},
/**
* Config Index in formData.paramConfigList
* Used to isolate the scope of disabled checks to the current assessment factor table.
*/
configIndex: {
type: Number,
default: undefined,
},
/**
* Index of the current item in the list (ParamsType1Products or ParamsType2)
* Used to identify "self" to avoid filtering out other identical selections.
*/
index: {
type: Number,
default: undefined,
},
/**
* Whether to allow duplicate selections.
* true: Allows duplicate selections within the same table, but still prevents containment relationships.
* false: Globally unique within the table (no duplicates, no containment).
*/
allowRepeat: {
type: Boolean,
default: false,
},
/**
* Value of the "All" option.
* If this value is encountered, it is treated as containing everything.
*/
allValue: {
type: [String, Number],
default: -1,
},
/**
* Path to the value in the item object.
* Supports dot notation for nested paths (e.g., "conditionType4.productValue").
*/
valuePath: {
type: String,
default: "productLabel",
},
/**
* List of all value paths to check for conflicts in the same row.
* If not provided, defaults to [valuePath].
*/
conflictPaths: {
type: Array,
default: () => [],
},
},
data() {
return {
visible: false,
};
},
computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList", "commissionTypesOptions", "goodsCategory"]),
},
mounted() {
...mapState("PerformanceFormStore", [
"formData",
"productDefineList",
"commissionTypesOptions",
"goodsCategory",
]),
occupiedPaths() {
const paths = [];
// Determine the scope: specific config (if index provided) or all configs
let targetConfigs = [];
// We need to know the original index of the config to compare with this.configIndex
let targetConfigIndices = [];
if (this.configIndex !== undefined && this.configIndex !== null) {
const config = this.formData.paramConfigList[this.configIndex];
if (config) {
targetConfigs = [config];
targetConfigIndices = [this.configIndex];
}
} else {
targetConfigs = this.formData.paramConfigList || [];
targetConfigIndices = targetConfigs.map((_, i) => i);
}
targetConfigs.forEach((config, i) => {
const actualConfigIndex = targetConfigIndices[i];
const isCurrentConfig = actualConfigIndex === this.configIndex;
// Determine check paths
const pathsToCheck =
this.conflictPaths && this.conflictPaths.length > 0
? this.conflictPaths
: [this.valuePath];
// Type 1
if (
config.ParamsType1Products &&
Array.isArray(config.ParamsType1Products)
) {
const isActiveList = config.templateType === "ParamsType1";
config.ParamsType1Products.forEach((item, itemIdx) => {
pathsToCheck.forEach((path) => {
// Skip self: matches both index and path
if (
isCurrentConfig &&
isActiveList &&
itemIdx === this.index &&
path === this.valuePath
) {
return;
}
const val = this.getValueByPath(item, path);
if (Array.isArray(val) && val.length > 0) {
paths.push(val);
}
});
});
}
// Type 2
if (config.ParamsType2 && Array.isArray(config.ParamsType2)) {
const isActiveList = config.templateType === "ParamsType2";
config.ParamsType2.forEach((item, itemIdx) => {
pathsToCheck.forEach((path) => {
// Skip self: matches both index and path
if (
isCurrentConfig &&
isActiveList &&
itemIdx === this.index &&
path === this.valuePath
) {
return;
}
const val = this.getValueByPath(item, path);
if (Array.isArray(val) && val.length > 0) {
paths.push(val);
}
});
});
}
});
// If index prop is NOT provided (backward compatibility), fallback to value filtering
if (this.index === undefined || this.index === null) {
const currentPath = this.value || [];
return paths.filter((p) => {
if (p.length !== currentPath.length) return true;
for (let i = 0; i < p.length; i++) {
if (p[i] != currentPath[i]) return true;
}
return false;
});
}
return paths;
},
computedGoodsCategory() {
// Fast path: if no goods category data, return empty
if (!this.goodsCategory || !this.goodsCategory.length) return [];
const occupiedPaths = this.occupiedPaths;
const allValue = this.allValue;
const myValue = this.value || [];
// Check if I have selected "All" (Local Lock)
// We use loose equality for value check
const iHaveAll = myValue.length === 1 && myValue[0] == allValue;
// Check if I have selected something else (Local Lock)
const iHaveOthers = myValue.length > 0 && !iHaveAll;
// Check if "All" is selected by anyone else (Global Lock)
const hasAllSelectedByOthers = occupiedPaths.some(
(path) => path.length === 1 && path[0] == allValue
);
const process = (nodes, parentPath) => {
return nodes.map((node) => {
// Build path for current node
const currentPath = parentPath
? [...parentPath, node.categoryType]
: [node.categoryType];
// Check if this node is "All" (loose equality)
const isAllNode = node.categoryType == allValue;
let isDisabled = false;
if (isAllNode) {
// Logic for "All" Node
// 1. If I have selected "Others", "All" is disabled (Must clear others first)
if (iHaveOthers) {
isDisabled = true;
}
// 2. If others have selected "All", check allowRepeat
else if (hasAllSelectedByOthers) {
isDisabled = !this.allowRepeat;
}
// 3. If any other items are occupied (by others), "All" is disabled (Containment)
// Note: We check if occupiedPaths contains ANY non-All items.
// Actually, if occupiedPaths has ANY items (and we handled "All" above),
// it means there's a conflict because "All" contains everything.
// But we need to be careful: if occupiedPaths only contains "All", we handled it in step 2.
// So we check if occupiedPaths has items that are NOT "All".
else {
const hasOthersOccupied = occupiedPaths.some(
(path) =>
!(path.length === 1 && path[0] == allValue)
);
if (hasOthersOccupied) {
isDisabled = true;
}
}
} else {
// Logic for "Other" Nodes
// 1. If I have selected "All", "Others" are disabled (Must clear All first)
if (iHaveAll) {
isDisabled = true;
}
// 2. If others have selected "All", "Others" are disabled (Containment)
else if (hasAllSelectedByOthers) {
isDisabled = true;
}
// 3. Standard containment check against occupiedPaths
else {
isDisabled = occupiedPaths.some((occupied) => {
const len = Math.min(
currentPath.length,
occupied.length
);
// Check for prefix match
let isPrefixMatch = true;
for (let i = 0; i < len; i++) {
if (currentPath[i] != occupied[i]) {
isPrefixMatch = false;
break;
}
}
if (isPrefixMatch) {
// If strict containment (lengths differ) -> Parent/Child conflict -> Always Disabled
if (
currentPath.length !== occupied.length
) {
return true;
}
// If exact match (lengths same) -> Duplicate -> Check allowRepeat
return !this.allowRepeat;
}
return false;
});
}
}
const newNode = {
...node,
disabled: isDisabled,
};
if (newNode.children && newNode.children.length > 0) {
newNode.children = process(
newNode.children,
currentPath
);
}
return newNode;
});
};
return process(this.goodsCategory, null);
},
},
mounted() {},
methods: {
getValueByPath(obj, path) {
if (!obj || !path) return undefined;
const keys = path.split(".");
let result = obj;
for (const key of keys) {
if (result === null || result === undefined) return undefined;
result = result[key];
}
return result;
},
handleProductChange(value) {
this.$emit("input", value);
this.$emit("change", value);
},
handleVisibleChange(isVisible) {
this.visible = isVisible;
},
},
};
</script>
.params-config-table {
width: 100%;
margin-bottom: 20px !important;
::v-deep .el-table {
.product-cascader-wrapper {
.icon {
line-height: normal;
height: 14px;
vertical-align: middle;
position: absolute;
left: 6px;
top: 50%;
transform: rotate(90deg);
transform: translate(0, -50%);
padding: 0;
cursor: pointer;
}
}
.el-table__header {
th {
background-color: #f2f4f7;
padding: 4px 0 !important;
.cell {
padding: 0 12px 0 12px;
position: relative;
}
}
}
.el-table__row {
.assessment-factor-column {
display: flex;
align-items: center;
justify-content: center;
padding-right: 10px;
.el-input {
min-width: 80px;
}
.el-input-number {
min-width: 80px;
}
.el-input_showing {
min-width: 80px;
}
.tag {
margin: 0 6px;
}
}
td {
padding-top: 10px !important;
padding-bottom: 10px !important;
}
.tag {
margin: 0 2px;
}
}
.el-input {
width: 140px;
.el-input__inner {
height: 32px;
line-height: 32px;
}
}
.el-input-number {
width: 140px;
height: 32px;
line-height: 32px;
}
.el-input_showing {
width: 140px;
height: 32px;
line-height: 30px;
}
}
}
......@@ -8,7 +8,7 @@
<el-radio label="ParamsType1">
适配通用配置
</el-radio>
<el-radio label="ParamsType2">
<el-radio v-if="[3, 4].includes(curParamsAssessFactorValue)" label="ParamsType2">
适配渗透率配置
</el-radio>
</el-radio-group>
......@@ -31,12 +31,11 @@
<div class="table-wrapper">
<component :is="curParamsConfig.templateType" :config-index="configIndex"></component>
</div>
</div>
</template>
<script>
import { last } from "lodash-es";
import { isObject, last } from "lodash-es";
import { mapState } from "vuex";
import { paramConfigListTemplate } from "../performanceRuleSelection/options.js";
import ParamsType1 from "./type1.vue";
......@@ -62,12 +61,19 @@ export default {
...mapState("PerformanceFormStore", ["formData"]),
curParamsConfig: {
get() {
console.log("this.formData.paramConfigList[this.configIndex]", this.formData.paramConfigList[this.configIndex]);
return this.formData.paramConfigList[this.configIndex];
},
set(value) {
this.formData.paramConfigList[this.configIndex] = value;
},
},
curParamsAssessFactorValue() {
if (isObject(this.curParamsConfig.assessmentFactor)) {
return this.curParamsConfig.assessmentFactor?.value;
}
return this.curParamsConfig.assessmentFactor;
},
},
mounted() {
......@@ -90,10 +96,29 @@ export default {
handleAppendTableRow() {
const templateType = this.curParamsConfig.templateType;
// 检查现有数据,确保没有初始值或结束值为空的行
const existingRows = this.curParamsConfig[templateType] || [];
for (let i = 0; i < existingRows.length; i++) {
const row = existingRows[i];
const priceRange = row?.priceRange || [];
const startValue = priceRange[0];
const endValue = priceRange[1];
// 检查初始值或结束值是否为空(undefined、null、空字符串)
if (startValue === undefined || startValue === null || startValue === "") {
this.$message.warning("存在初始值为空的行,请先完善数据后再新增");
return;
}
if (endValue === undefined || endValue === null || endValue === "") {
this.$message.warning("存在结束值为空的行,请先完善数据后再新增");
return;
}
}
const lastPriceRange = last(this.curParamsConfig[templateType])?.priceRange || [0, 0];
const nPriceRange = [undefined, undefined];
if (lastPriceRange && lastPriceRange[1]) {
nPriceRange[0] = lastPriceRange[1] + (this.curParamsConfig.priceRangeProps.precision ? 1 : 0.01);
nPriceRange[0] = lastPriceRange[1] + 0.01;
nPriceRange[1] = undefined;
}
this.curParamsConfig[templateType].push({
......
......@@ -99,6 +99,7 @@ export default {
<style scoped lang="scss">
.param-config-type-2-condition-type {
padding-left: 10px;
> span.label {
color: #666666;
font-size: 14px;
......
<template>
<span class="param-config-type-2-condition-type">
<EditableText v-model="triggerCondition"
:controls="false"
type="number"
v-bind="getComponentsProp">
</EditableText>
<span class="label">
且
</span>
<span class="label">
整体增加指标达成奖励
</span>
<EditableText v-model="increaseReward"
:controls="false"
:max="999999"
:min="0"
:precision="2"
type="number">
</EditableText>
<span class="label">
元
</span>
</span>
<span class="param-config-type-2-condition-type">
<EditableText
v-model="triggerCondition"
:controls="false"
type="number"
v-bind="getComponentsProp"
>
</EditableText>
<span class="label"> 且 </span>
<GoodsCategoryCascader
v-if="goodsCategory === 0"
:config-index="configIndex"
:index="row"
:value-path="'conditionType3.productValue'"
allowRepeat
v-model="productValue"
@change="handleProductChange"
/>
<!-- 圈定套餐/商品 cascader -->
<ProductDefineCascader
v-else
v-model="productValue"
:index="row"
:value-path="'conditionType3.productValue'"
:config-index="configIndex"
:allow-repeat="true"
@change="handleProductChange"
/>
<span class="label"> 整体增加指标达成奖励 </span>
<EditableText
v-model="increaseReward"
:controls="false"
:max="999999"
:min="0"
:precision="2"
type="number"
>
</EditableText>
<span class="label"> 元 </span>
</span>
</template>
<script>
import { mapState } from "vuex";
import { mapGetters, mapState } from "vuex";
import EditableText from "@/components/editableText/index.vue";
import { commissionTypeEnum } from "../../performanceRuleSelection/options";
import GoodsCategoryCascader from "../../goodsCategoryCascader/index.vue";
import ProductDefineCascader from "../../prodectDefine/index.vue";
export default {
name: "",
components: {
EditableText,
GoodsCategoryCascader,
ProductDefineCascader,
},
props: {
configIndex: {
......@@ -43,70 +63,85 @@ export default {
type: Number,
required: true,
},
},
data() {
return {
};
return {};
},
computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList"]),
// 商品选择项
getProductDefineListOptions() {
return this.productDefineList;
},
...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]),
// 路径太长 简化
paramsType2CommissionTypes() {
return this.formData.paramConfigList[this.configIndex].ParamsType2CommissionTypes;
return this.formData.paramConfigList[this.configIndex]
.ParamsType2CommissionTypes;
},
// 提成方式 的值 决定 的 组件传参
getComponentsProp() {
return this.paramsType2CommissionTypes ? commissionTypeEnum[this.paramsType2CommissionTypes].componentProps : {};
return this.paramsType2CommissionTypes
? commissionTypeEnum[this.paramsType2CommissionTypes]
.componentProps
: {};
},
goodsCategory: {
get() {
return this.formData.paramConfigList[this.configIndex]
.goodsCategory;
},
set(value) {
this.formData.paramConfigList[this.configIndex].goodsCategory =
value;
},
},
triggerCondition: {
get() {
return this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType3.triggerCondition;
return this.formData.paramConfigList[this.configIndex]
.ParamsType2[this.row].conditionType3.triggerCondition;
},
set(value) {
this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType3.triggerCondition = value;
this.formData.paramConfigList[this.configIndex].ParamsType2[
this.row
].conditionType3.triggerCondition = value;
},
},
productLabel: {
get() {
return this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType3.productLabel;
return this.formData.paramConfigList[this.configIndex]
.ParamsType2[this.row].conditionType3.productLabel;
},
set(value) {
this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType3.productLabel = value;
this.formData.paramConfigList[this.configIndex].ParamsType2[
this.row
].conditionType3.productLabel = value;
},
},
productValue: {
get() {
return this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType3.productValue;
return this.formData.paramConfigList[this.configIndex]
.ParamsType2[this.row].conditionType3.productValue;
},
set(value) {
this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType3.productValue = value;
this.formData.paramConfigList[this.configIndex].ParamsType2[
this.row
].conditionType3.productValue = value;
},
},
increaseReward: {
get() {
return this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType3.increaseReward;
return this.formData.paramConfigList[this.configIndex]
.ParamsType2[this.row].conditionType3.increaseReward;
},
set(value) {
this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType3.increaseReward = value;
this.formData.paramConfigList[this.configIndex].ParamsType2[
this.row
].conditionType3.increaseReward = value;
},
},
},
mounted() {
},
mounted() {},
methods: {
// TODO: 商品切换
handleProductChange() {
},
handleProductChange() {},
},
};
</script>
......@@ -114,9 +149,9 @@ export default {
<style scoped lang="scss">
.param-config-type-2-condition-type {
// overflow-x: auto;
// display: flex;
display: flex;
// flex-wrap: nowrap;
// align-items: center;
align-items: center;
> span.label {
color: #666666;
font-size: 14px;
......
<template>
<span class="param-config-type-2-condition-type">
<EditableText v-model="triggerCondition"
:controls="false"
type="number"
v-bind="getComponentsProp">
</EditableText>
<span class="label">
且
</span>
<span class="label">
提出
</span>
<el-cascader v-model="productValue"
:options="getProductDefineListOptions"
:show-all-levels="false"
@change="handleProductChange">
</el-cascader>
<span class="label">
的订单计算提出
</span>
</span>
<span class="param-config-type-2-condition-type">
<EditableText
v-model="triggerCondition"
:controls="false"
type="number"
v-bind="getComponentsProp"
>
</EditableText>
<span class="label"> 且 </span>
<!-- 品类cascader -->
<GoodsCategoryCascader
v-if="goodsCategory === 0"
:config-index="configIndex"
:index="row"
:value-path="'conditionType4.productValue'"
:conflict-paths="[
'conditionType4.productValue',
'conditionType4.productValue1',
]"
allowRepeat
v-model="productValue"
@change="handleProductChange"
/>
<!-- 圈定套餐/商品 cascader -->
<ProductDefineCascader
v-else
v-model="productValue"
:index="row"
:value-path="'conditionType4.productValue'"
:conflict-paths="[
'conditionType4.productValue',
'conditionType4.productValue1',
]"
:config-index="configIndex"
:allow-repeat="true"
@change="handleProductChange"
/>
<span class="label"> 剔除 </span>
<GoodsCategoryCascader
v-if="goodsCategory === 0"
:config-index="configIndex"
:index="row"
:value-path="'conditionType4.productValue1'"
:conflict-paths="[
'conditionType4.productValue',
'conditionType4.productValue1',
]"
allowRepeat
v-model="productValue1"
@change="handleProductChange"
/>
<!-- 圈定套餐/商品 cascader -->
<ProductDefineCascader
v-else
v-model="productValue1"
:index="row"
:value-path="'conditionType4.productValue1'"
:conflict-paths="[
'conditionType4.productValue',
'conditionType4.productValue1',
]"
:config-index="configIndex"
:allow-repeat="true"
@change="handleProductChange"
/>
<span class="label"> 的订单计算提成 </span>
</span>
</template>
<script>
import { mapState } from "vuex";
import { mapGetters, mapState } from "vuex";
import EditableText from "@/components/editableText/index.vue";
import { commissionTypeEnum } from "../../performanceRuleSelection/options";
import GoodsCategoryCascader from "../../goodsCategoryCascader/index.vue";
import ProductDefineCascader from "../../prodectDefine/index.vue";
export default {
name: "",
components: {
EditableText,
GoodsCategoryCascader,
ProductDefineCascader,
},
props: {
configIndex: {
......@@ -41,61 +91,73 @@ export default {
type: Number,
required: true,
},
},
data() {
return {
};
return {};
},
computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList"]),
// 商品选择项
getProductDefineListOptions() {
return this.productDefineList;
},
...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]),
// 路径太长 简化
paramsType2CommissionTypes() {
return this.formData.paramConfigList[this.configIndex].ParamsType2CommissionTypes;
return this.formData.paramConfigList[this.configIndex]
.ParamsType2CommissionTypes;
},
// 提成方式 的值 决定 的 组件传参
getComponentsProp() {
return this.paramsType2CommissionTypes ? commissionTypeEnum[this.paramsType2CommissionTypes].componentProps : {};
return this.paramsType2CommissionTypes
? commissionTypeEnum[this.paramsType2CommissionTypes]
.componentProps
: {};
},
triggerCondition: {
get() {
return this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType4.triggerCondition;
return this.formData.paramConfigList[this.configIndex]
.ParamsType2[this.row].conditionType4.triggerCondition;
},
set(value) {
this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType4.triggerCondition = value;
this.formData.paramConfigList[this.configIndex].ParamsType2[
this.row
].conditionType4.triggerCondition = value;
},
},
goodsCategory: {
get() {
return this.formData.paramConfigList[this.configIndex]
.goodsCategory;
},
set(value) {
this.formData.paramConfigList[this.configIndex].goodsCategory =
value;
},
},
productValue: {
get() {
return this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType4.productValue;
return this.formData.paramConfigList[this.configIndex]
.ParamsType2[this.row].conditionType4.productValue;
},
set(value) {
this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType4.productValue = value;
this.formData.paramConfigList[this.configIndex].ParamsType2[
this.row
].conditionType4.productValue = value;
},
},
productValue1: {
get() {
return this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType4.productValue1;
return this.formData.paramConfigList[this.configIndex]
.ParamsType2[this.row].conditionType4.productValue1;
},
set(value) {
this.formData.paramConfigList[this.configIndex].ParamsType2[this.row].conditionType4.productValue1 = value;
this.formData.paramConfigList[this.configIndex].ParamsType2[
this.row
].conditionType4.productValue1 = value;
},
},
},
mounted() {
},
mounted() {},
methods: {
// TODO: 商品切换
handleProductChange() {
},
handleProductChange() {},
},
};
</script>
......@@ -103,9 +165,9 @@ export default {
<style scoped lang="scss">
.param-config-type-2-condition-type {
// overflow-x: auto;
// display: flex;
display: flex;
// flex-wrap: nowrap;
// align-items: center;
align-items: center;
> span.label {
color: #666666;
font-size: 14px;
......
......@@ -53,7 +53,8 @@
<el-form-item label="商品分类:"
prop="goodsConfigTypes">
<el-checkbox-group v-model="goodsConfigTypes"
class="checkbox-group-product-category ">
class="checkbox-group-product-category "
@change="handleGoodsConfigTypesGroupChange">
<el-checkbox label="0">
品类
</el-checkbox>
......@@ -65,6 +66,20 @@
</el-checkbox-group>
</el-form-item>
<el-form-item label="适配业务:" prop="businessType">
<el-radio-group v-model="businessType" @change="handleBusinessTypeChange">
<el-radio :label="0">
轻改
</el-radio>
<el-radio :label="2">
延保
</el-radio>
<el-radio :label="1">
权益
</el-radio>
</el-radio-group>
</el-form-item>
<DefineProductsDialog v-if="dialog.defineProducts.visible"
:define-visible="dialog.defineProducts.visible"
@dialogClose="handleDefineProductsDialogClose" />
......@@ -102,7 +117,7 @@ export default {
commissionMapping: {
GMV: "BL", // GMV产值 <-> 比例
DDTC: "XS", // 单店总提成 <-> 系数
DDSL: "GDJE", // 升级订单数 <-> 固定金额
SJDDS: "GDJE", // 升级订单数 <-> 固定金额
},
};
},
......@@ -111,16 +126,16 @@ export default {
...mapState("PerformanceFormStore", ["formData"]),
assessmentFactorValue: bindFormFields("assessmentFactorValue"),
assessmentFactor: bindFormFields("assessmentFactor"),
checkList: bindFormFields("checkList"),
commissionBases: bindFormFields("commissionBases"),
commissionTypes: bindFormFields("commissionTypes"),
goodsConfigTypes: bindFormFields("goodsConfigTypes"),
paramConfigList: bindFormFields("paramConfigList"),
businessType: bindFormFields("businessType"),
},
watch: {
commissionTypes(newVal) {
// TODO: 还需要清空下方表格所有提成方式的值
// this.setCommissionTypesOptions(newVal);
this.setCommissionTypesOptions(newVal);
},
},
mounted() {
......@@ -128,6 +143,15 @@ export default {
methods: {
...mapMutations("PerformanceFormStore", ["setProductDefineList", "touchAssessment", "setCommissionTypesOptions", "setCommissionBases", "setCommissionTypes"]),
handleGoodsConfigTypesGroupChange(e) {
if (e.length === 1) {
// TODO: 强力设置表格内的所有goodType
}
// 只验证当前字段
this.validateCurrentField("goodsConfigTypes");
},
/**
* 更新关联的复选框
* @param {Array} currentValues 当前变化的值
......@@ -187,6 +211,8 @@ export default {
this.setCommissionTypes(newTypes);
this.$nextTick(() => {
this.isUpdating = false;
// 只验证当前字段
this.validateCurrentField("commissionBases");
});
},
......@@ -199,6 +225,8 @@ export default {
this.setCommissionBases(newBases);
this.$nextTick(() => {
this.isUpdating = false;
// 只验证当前字段
this.validateCurrentField("commissionTypes");
});
},
......@@ -206,6 +234,20 @@ export default {
// 根据 value 数组从 assessmentFactorOptions 中找出对应的完整项
const selectedItems = this.assessmentFactorOptions.filter(item => value.includes(item.value));
this.touchAssessment(selectedItems);
// 只验证当前字段
this.validateCurrentField("assessmentFactorValue");
},
handleBusinessTypeChange() {
// 只验证当前字段
this.validateCurrentField("businessType");
},
// 验证当前字段(只验证单个字段,不触发全表单验证)
validateCurrentField(prop) {
// 通过 $parent 访问父组件的表单引用
const form = this.$parent?.$refs?.form;
if (form && !this.$parent?.shouldValidateAll) {
form.validateField(prop, () => {});
}
},
},
};
......
<template>
<div class="">
<el-cascader
clearable
:options="visible ? computedOptions : getProductDefineListOptions"
placeholder="请选择"
:props="{checkStrictly: true}"
:show-all-levels="false"
:value="value"
@change="handleProductChange"
@visible-change="handleVisibleChange"
>
</el-cascader>
</div>
</template>
<script>
import { mapState, mapGetters } from "vuex";
export default {
name: "ProductDefineCascader",
props: {
value: {
type: Array,
default: () => [],
},
/**
* Config Index in formData.paramConfigList
* Used to isolate the scope of disabled checks to the current assessment factor table.
*/
configIndex: {
type: Number,
default: undefined,
},
/**
* Index of the current item in the list
* Used to identify "self" to avoid filtering out other identical selections.
*/
index: {
type: Number,
default: undefined,
},
/**
* Whether to allow duplicate selections.
*/
allowRepeat: {
type: Boolean,
default: false,
},
/**
* Value of the "All" option.
*/
allValue: {
type: [String, Number],
default: -1,
},
/**
* Custom label/value field names
*/
/**
* Path to the value in the item object.
* Supports dot notation for nested paths (e.g., "conditionType4.productValue").
*/
valuePath: {
type: String,
default: "productLabel",
},
/**
* List of all value paths to check for conflicts in the same row.
* If not provided, defaults to [valuePath].
*/
conflictPaths: {
type: Array,
default: () => [],
},
},
data() {
return {
visible: false,
};
},
computed: {
...mapState("PerformanceFormStore", ["formData", "getProductDefineListOptions"]),
...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]),
occupiedPaths() {
const paths = [];
// Determine the scope: specific config (if index provided) or all configs
let targetConfigs = [];
let targetConfigIndices = [];
if (this.configIndex !== undefined && this.configIndex !== null) {
const config = this.formData.paramConfigList[this.configIndex];
if (config) {
targetConfigs = [config];
targetConfigIndices = [this.configIndex];
}
} else {
targetConfigs = this.formData.paramConfigList || [];
targetConfigIndices = targetConfigs.map((_, i) => i);
}
targetConfigs.forEach((config, i) => {
const actualConfigIndex = targetConfigIndices[i];
const isCurrentConfig = actualConfigIndex === this.configIndex;
// Determine check paths
const pathsToCheck =
this.conflictPaths && this.conflictPaths.length > 0
? this.conflictPaths
: [this.valuePath];
// Type 1
if (
config.ParamsType1Products &&
Array.isArray(config.ParamsType1Products)
) {
const isActiveList = config.templateType === "ParamsType1";
config.ParamsType1Products.forEach((item, itemIdx) => {
pathsToCheck.forEach((path) => {
// Skip self
if (
isCurrentConfig &&
isActiveList &&
itemIdx === this.index &&
path === this.valuePath
) {
return;
}
const val = this.getValueByPath(item, path);
if (Array.isArray(val) && val.length > 0) {
paths.push(val);
}
});
});
}
// Type 2
if (config.ParamsType2 && Array.isArray(config.ParamsType2)) {
const isActiveList = config.templateType === "ParamsType2";
config.ParamsType2.forEach((item, itemIdx) => {
pathsToCheck.forEach((path) => {
// Skip self
if (
isCurrentConfig &&
isActiveList &&
itemIdx === this.index &&
path === this.valuePath
) {
return;
}
const val = this.getValueByPath(item, path);
if (Array.isArray(val) && val.length > 0) {
paths.push(val);
}
});
});
}
});
// Fallback for backward compatibility
if (this.index === undefined || this.index === null) {
const currentPath = this.value || [];
return paths.filter((p) => {
if (p.length !== currentPath.length) return true;
for (let i = 0; i < p.length; i++) {
if (p[i] != currentPath[i]) return true;
}
return false;
});
}
return paths;
},
computedOptions() {
if (!this.getProductDefineListOptions || !this.getProductDefineListOptions.length)
return [];
const occupiedPaths = this.occupiedPaths;
const allValue = this.allValue;
const myValue = this.value || [];
const valueField = "value";
const childrenField = "children";
// Check if I have selected "All" (Local Lock)
const iHaveAll = myValue.length === 1 && myValue[0] == allValue;
// Check if I have selected something else (Local Lock)
const iHaveOthers = myValue.length > 0 && !iHaveAll;
// Check if "All" is selected by anyone else (Global Lock)
const hasAllSelectedByOthers = occupiedPaths.some(
(path) => path.length === 1 && path[0] == allValue
);
const process = (nodes, parentPath) => {
return nodes.map((node) => {
const nodeValue = node[valueField];
// Build path for current node
const currentPath = parentPath
? [...parentPath, nodeValue]
: [nodeValue];
// Check if this node is "All" (loose equality)
const isAllNode = nodeValue == allValue;
let isDisabled = false;
if (isAllNode) {
// Logic for "All" Node
if (iHaveOthers) {
isDisabled = true;
} else if (hasAllSelectedByOthers) {
isDisabled = !this.allowRepeat;
} else {
const hasOthersOccupied = occupiedPaths.some(
(path) =>
!(path.length === 1 && path[0] == allValue)
);
if (hasOthersOccupied) {
isDisabled = true;
}
}
} else {
// Logic for "Other" Nodes
if (iHaveAll) {
isDisabled = true;
} else if (hasAllSelectedByOthers) {
isDisabled = true;
} else {
isDisabled = occupiedPaths.some((occupied) => {
const len = Math.min(
currentPath.length,
occupied.length
);
let isPrefixMatch = true;
for (let i = 0; i < len; i++) {
if (currentPath[i] != occupied[i]) {
isPrefixMatch = false;
break;
}
}
if (isPrefixMatch) {
if (
currentPath.length !== occupied.length
) {
return true;
}
return !this.allowRepeat;
}
return false;
});
}
}
const newNode = {
...node,
disabled: isDisabled,
};
if (node[childrenField] && node[childrenField].length > 0) {
newNode[childrenField] = process(
node[childrenField],
currentPath
);
}
return newNode;
});
};
return process(this.getProductDefineListOptions, null);
},
},
mounted() {},
methods: {
getValueByPath(obj, path) {
if (!obj || !path) return undefined;
const keys = path.split(".");
let result = obj;
for (const key of keys) {
if (result === null || result === undefined) return undefined;
result = result[key];
}
return result;
},
handleProductChange(value) {
this.$emit("input", value);
this.$emit("change", value);
},
handleVisibleChange(isVisible) {
this.visible = isVisible;
},
},
};
</script>
......@@ -13,11 +13,12 @@
</el-date-picker>
</el-form-item> -->
<d2-table v-if="selectedMerchantsList.length > 0"
<d2-table v-if="merchantBrandRefList.length > 0"
ref="selectedMerTable"
:has-page="false"
:search-form="{}"
:table-data="selectedMerchantsList"
style="padding-left:170px;margin-bottom:14px"
:table-data="merchantBrandRefList"
:table-params="tableParams">
<template #auth-button="scope">
<div>
......@@ -29,9 +30,19 @@
</div>
</template>
</d2-table>
<el-form-item label="生效月份:" prop="effectiveMonth">
<el-date-picker v-model="effectiveMonth"
format="yyyy-MM"
:picker-options="pickerOptions"
placeholder="请选择"
type="month"
value-format="yyyy-MM"
@change="handleEffectiveMonthChange">
</el-date-picker>
</el-form-item>
<el-dialog v-if="dialog.storeApply.visible"
:before-close="handleCloseDialog"
:close-on-click-modal="false"
custom-class="store-select-dialog"
:title="dialog.storeApply.title"
:visible.sync="dialog.storeApply.visible"
......@@ -68,7 +79,6 @@ export default {
visible: false,
},
},
selectedMerchantsList: [],
tableParams: {
listName: "list",
tableOption: true,
......@@ -99,14 +109,38 @@ export default {
},
],
},
pickerOptions: {
disabledDate(time) {
// 最早:2025-01
const min = new Date(2025, 0, 1).getTime();
// 最晚:当前月份往后 1 年(当月 + 12 个月)
const now = new Date();
const max = new Date(
now.getFullYear(),
now.getMonth() + 12,
1,
).getTime();
const t = time.getTime();
return t < min || t > max;
},
},
};
},
computed: {
...mapGetters("PerformanceFormStore", ["getMerchantBrandRefList"]),
...mapState("PerformanceFormStore", ["merchantBrandRefList", "formData"]),
effectiveMonth: {
get() {
return this.formData.effectiveMonth;
},
set(value) {
this.formData.effectiveMonth = value;
},
},
},
async mounted() {
this.selectedMerchantsList = this.getMerchantBrandRefList || [];
console.log(this.selectedMerchantsList, "0000");
},
methods: {
...mapMutations("PerformanceFormStore", ["setMerchantBrandRefList"]),
......@@ -118,36 +152,32 @@ export default {
},
handleDeleteMer(row, idx) {
this.selectedMerchantsList.splice(idx, 1);
this.setMerchantBrandRefList(deepClone(this.selectedMerchantsList));
this.merchantBrandRefList.splice(idx, 1);
},
handleDialogConfirm() {
console.log(this.$refs.storeSelect.selectedMerchants);
this.selectedMerchantsList = Object.keys(this.$refs.storeSelect.selectedMerchants).map(key => this.$refs.storeSelect.selectedMerchants[key]) || [];
console.log(this.selectedMerchantsList);
if (this.selectedMerchantsList.length === 0) {
const selectedMerchantList = Object.keys(this.$refs.storeSelect.selectedMerchants).map(key => this.$refs.storeSelect.selectedMerchants[key]) || [];
if (selectedMerchantList.length === 0) {
this.$message({
message: "请选择门店及品牌",
type: "warning",
});
return;
}
// let list = []
// selectedMerchantsList.forEach(item => {
// item.checkBrands.forEach(brand => {
// list.push({
// merchantId: item.merchantId,
// merchantName: item.merchantName,
// brandId: brand.brandId,
// brandName: brand.brandName,
// childId: brand.childId,
// childName: brand.childName,
// })
// })
// })
this.setMerchantBrandRefList(deepClone(this.selectedMerchantsList));
this.setMerchantBrandRefList(deepClone(selectedMerchantList));
this.changeStoreApplyVisible();
},
handleEffectiveMonthChange() {
// 只验证当前字段
this.validateCurrentField("effectiveMonth");
},
// 验证当前字段(只验证单个字段,不触发全表单验证)
validateCurrentField(prop) {
// 通过 $parent 访问父组件的表单引用
const form = this.$parent?.$refs?.form;
if (form && !this.$parent?.shouldValidateAll) {
form.validateField(prop, () => {});
}
},
},
};
</script>
......
import { groupBy } from "lodash";
import { assessmentFactorOptions } from "../components/performanceRuleSelection/options";
import { setBackendAllGoods, setBackendConditionGoods, setBackendGoods } from "./help";
export function convertBackendToData(data) {
// merchantBrandModelPageBrands merchantBrandRefList 接口返回的字段不一样
const { merchantBrandRefList, paramConfigList, performanceConfigRule, ...lists } = data;
const response = {
...lists,
...handlePerformanceConfigRule(performanceConfigRule),
merchantBrandRefList: dealInterfaceBrand(merchantBrandRefList),
paramConfigList: coverParamConfigList(paramConfigList),
};
return response;
}
function handlePerformanceConfigRule(configRule) {
console.log("configRule", configRule);
if (!configRule) {
console.warn("后端数据缺少 performanceConfigRule");
return {};
}
return {
assessmentFactorValue: configRule.assessmentFactors.split(","),
commissionBases: configRule.commissionBases.split(","),
commissionTypes: configRule.commissionTypes.split(","),
goodsConfigTypes: configRule.goodsConfigTypes.split(","),
};
}
const templateType = {
1: "ParamsType1",
......@@ -23,9 +40,10 @@ const tableEnum = {
// { productLabel: [], productValue: [], optionList: [] },
],
ParamsType1: [],
ParamsType2CommissionTypes: undefined,
ParamsType2: [],
priceRangeProps: [],
assessmentFactor: {},
assessmentFactor: undefined,
sort: -1,
};
......@@ -41,10 +59,8 @@ export function coverParamConfigList(paramConfigList) {
const tableList = groupBy(paramConfigList, "assessmentFactor");
const _paramConfigList = [];
console.log("tableList", tableList);
if (tableList && Object.keys(tableList).length) {
for (let tableIndex in tableList) {
console.log("table");
for (const tableIndex in tableList) {
const tableItem = tableList[tableIndex][0];
const table = tableList[tableIndex];
// 因为每一个table的数据是一样的,所以直接取0位
......@@ -52,67 +68,101 @@ export function coverParamConfigList(paramConfigList) {
baseTable.title = getAssessmentFactorOptionsTitle(tableItem.assessmentFactor)?.label; // 找enum
baseTable.templateType = templateType[tableList[tableIndex][0].templateType];
baseTable.goodsCategory = tableList[tableIndex][0].goodsConfigType;
baseTable.assessmentFactor = Number(tableIndex);
if (baseTable.templateType === "ParamsType2") {
baseTable.ParamsType2CommissionTypes = tableList[tableIndex][0].commissionType;
}
console.log("baseTable", baseTable);
const rowTable = groupBy(tableList[tableIndex], item => String(item.startValue) + String(item.endValue));
const colTable = groupBy(table, item => String(item.goodsType) + String(item.secondaryGoodsType) + String(item.thirdLevelGoodsType));
Object.keys(colTable).forEach((colIndex, colEachIndex) => {
const colItem = colTable[colIndex][colEachIndex];
const paramsTypeProductsItem = {
productLabel: [colItem.goodsType],
productValue: [],
optionList: [],
};
// 整理ParamsType1Products
if (baseTable.templateType === "ParamsType1") {
Object.keys(colTable).forEach((colIndex, colEachIndex) => {
const colItem = colTable[colIndex][colEachIndex];
const paramsTypeProductsItem = {
productLabel: [],
productValue: [],
optionList: [],
};
if ([1, 2].includes(colItem.goodsConfigType)) {
console.error("error", colItem);
colItem.productDefineId && paramsTypeProductsItem.productLabel.push(colItem.productDefineId);
} else {
setBackendGoods(colItem, paramsTypeProductsItem);
}
colItem.secondaryGoodsType && paramsTypeProductsItem.productLabel.push(colItem.secondaryGoodsType);
colItem.thirdLevelGoodsType && paramsTypeProductsItem.productLabel.push(colItem.thirdLevelGoodsType);
Object.keys(rowTable).forEach((rowIndex, rowEachIndex) => {
console.log("rowTable", rowTable);
console.log("rowIndex", rowIndex);
console.log("rowEachIndex", rowEachIndex);
Object.keys(rowTable).forEach((rowIndex, rowEachIndex) => {
const rowItem = rowTable[rowIndex][rowEachIndex];
paramsTypeProductsItem.productValue.push(rowItem.commissionTypeValue);
const rowItem = rowTable[rowIndex][0];
paramsTypeProductsItem.productValue.push(rowItem?.commissionTypeValue);
});
baseTable.ParamsType1Products.push(paramsTypeProductsItem);
});
baseTable.ParamsType1Products.push(paramsTypeProductsItem);
// if (!baseTable.ParamsType1Products[colEachIndex]) {
// baseTable.ParamsType1Products[colEachIndex] = {
// productLabel: [colItem.goodsType, colItem.secondaryGoodsType, colItem.thirdLevelGoodsType],
// productValue: [colItem.commissionTypeValue],
// optionList: [],
// };
// } else {
// baseTable.ParamsType1Products[colEachIndex].productValue.push(colItem.commissionTypeValue);
// }
});
}
Object.keys(rowTable).forEach((rowIndex, rowEachIndex) => {
// 整理 ParamsType1
console.log("hang", rowTable[rowIndex]);
const rowItem = rowTable[rowIndex][0];
if (baseTable.templateType === "ParamsType1") {
console.log(333, rowItem.startValue, rowItem.endValue);
baseTable.ParamsType1.push({
priceRange: [rowItem.startValue, rowItem.endValue],
commissionTypes: rowItem.commissionType,
});
}
if (baseTable.templateType === "ParamsType2") {
console.log("ParamsType2 => rowItem", rowItem);
const rowItemParamConfig = rowItem.performanceParamConfigConditions;
const conditionType = rowItemParamConfig.length ? rowItemParamConfig[0].conditionType : 0;
const conditionKey = `conditionType${conditionType}`;
const paramsType2Item = {
condition: conditionType,
priceRange: [rowItem.startValue, rowItem.endValue],
productLabel: [],
};
setBackendAllGoods(rowItem, paramsType2Item);
// const colTable = groupBy(rowTable[rowIndex], item => String(item.goodsType) + String(item.secondaryGoodsType) + String(item.thirdLevelGoodsType));
// for (let productColIndex in colTable) {
// const colItem = colTable[productColIndex][0];
// if (!baseTable.ParamsType1Products[rowEachIndex]) {
// baseTable.ParamsType1Products[rowEachIndex] = {
// productLabel: [colItem.goodsType, colItem.secondaryGoodsType, colItem.thirdLevelGoodsType],
// productValue: [colItem.commissionTypeValue],
// optionList: [],
// };
// } else {
// baseTable.ParamsType1Products[rowEachIndex].productValue.push(colItem.commissionTypeValue);
// }
// }
if (conditionType === 0) {
paramsType2Item.conditionType0 = rowItem.commissionTypeValue;
} else {
paramsType2Item[conditionKey] = {
triggerCondition: rowItem.commissionTypeValue,
productValue: [],
};
setBackendConditionGoods(rowItemParamConfig[0], paramsType2Item[conditionKey], "productValue");
// 到这里 conditionType4 已经解决
if (conditionType === 3) {
paramsType2Item[conditionKey].increaseReward = rowItemParamConfig[0].conditionCommissionTypeValue;
}
if (conditionType === 2) {
paramsType2Item[conditionKey].deductRate = rowItemParamConfig[0].conditionEndValue;
paramsType2Item[conditionKey].perOrderDeductAmount = rowItemParamConfig[0].conditionCommissionTypeValue;
}
if (conditionType === 1) {
// 要先排序. 小的在前面
rowItemParamConfig.sort((a, b) => a.id - b.id);
paramsType2Item[conditionKey].permeabilityMin = rowItemParamConfig[0].conditionStartValue;
paramsType2Item[conditionKey].permeabilityMax = rowItemParamConfig[0].conditionEndValue;
paramsType2Item[conditionKey].productValue1 = [];
setBackendConditionGoods(rowItemParamConfig[1], paramsType2Item[conditionKey], "productValue1");
paramsType2Item[conditionKey].permeabilityMin1 = rowItemParamConfig[1].conditionStartValue;
paramsType2Item[conditionKey].permeabilityMax1 = rowItemParamConfig[1].conditionEndValue;
}
}
console.log("paramsType2Item", paramsType2Item);
baseTable.ParamsType2.push(paramsType2Item);
}
});
_paramConfigList.push(baseTable);
// handleParamsType1Product(tableList[tableIndex]);
}
}
console.log("即将返回出去的 _paramConfigList", _paramConfigList);
return _paramConfigList;
}
......
export function setBackendGoodsValue(backendDta, paramsConfig, options = {
key: "conditionProductDefineId",
paramsKey: "productValue1",
}) {
backendDta[options.key] && paramsConfig[options.paramsKey].push(backendDta[options.key]);
}
export function setBackendConditionGoods(backendDta, paramsConfig, valueKey = "productValue") {
setBackendGoodsValue(backendDta, paramsConfig, {
key: "conditionProductDefineId",
paramsKey: valueKey,
});
setBackendGoodsValue(backendDta, paramsConfig, {
key: "conditionGoodsType",
paramsKey: valueKey,
});
setBackendGoodsValue(backendDta, paramsConfig, {
key: "conditionSecondaryGoodsType",
paramsKey: valueKey,
});
setBackendGoodsValue(backendDta, paramsConfig, {
key: "conditionThirdLevelGoodsType",
paramsKey: valueKey,
});
}
export function setBackendGoods(backendDta, paramsConfig, valueKey = "productLabel") {
setBackendGoodsValue(backendDta, paramsConfig, {
key: "goodsType",
paramsKey: valueKey,
});
setBackendGoodsValue(backendDta, paramsConfig, {
key: "secondaryGoodsType",
paramsKey: valueKey,
});
setBackendGoodsValue(backendDta, paramsConfig, {
key: "thirdLevelGoodsType",
paramsKey: valueKey,
});
}
export function setBackendAllGoods(backendDta, paramsConfig, valueKey = "productLabel") {
setBackendGoodsValue(backendDta, paramsConfig, {
key: "productDefineId",
paramsKey: valueKey,
});
setBackendGoodsValue(backendDta, paramsConfig, {
key: "goodsType",
paramsKey: valueKey,
});
setBackendGoodsValue(backendDta, paramsConfig, {
key: "secondaryGoodsType",
paramsKey: valueKey,
});
setBackendGoodsValue(backendDta, paramsConfig, {
key: "thirdLevelGoodsType",
paramsKey: valueKey,
});
}
import { last } from "lodash-es";
import { isObject, last } from "lodash-es";
import store from "@/store";
const commissionTypesCoverCommissionBase = {
......@@ -13,9 +13,12 @@ export function convertDataToBackend(formData) {
const { paramConfigList, merchantBrandRefList, ...data } = formData;
const requestData = {
schemaName: data.schemaName,
// 注意是scheme
schemeName: data.schemeName,
schemeType: data.schemeType,
businessType: data.businessType,
effectiveMonth: data.storeConfig.effectiveMonth,
effectiveMonth: data.effectiveMonth,
performanceConfigRule: {
assessmentFactors: data.assessmentFactorValue.join(","),
commissionBases: data.commissionBases.join(","),
......@@ -25,6 +28,9 @@ export function convertDataToBackend(formData) {
paramConfigList: [],
merchantBrandRefList: [],
};
if (data.originPerformanceConfigId) {
requestData.originPerformanceConfigId = data.originPerformanceConfigId;
}
for (const paramConfig of paramConfigList) {
// 每一份表格
const { templateType, ParamsType1, ParamsType1Products, ParamsType2 } = paramConfig;
......@@ -34,7 +40,7 @@ export function convertDataToBackend(formData) {
coverParamsType1(ParamsType1, ParamsType1Products, (item, { rowItem, row }, { productColItem, colIndex }) => {
requestData.paramConfigList.push({
...item,
assessmentFactor: paramConfig.assessmentFactor.value,
assessmentFactor: isObject(paramConfig.assessmentFactor) ? paramConfig.assessmentFactor.value : paramConfig.assessmentFactor,
goodsConfigType: paramConfig.goodsCategory,
commissionTypeValue: productColItem.productValue[row],
...paramConfig.goodsCategory === 0
......@@ -50,7 +56,7 @@ export function convertDataToBackend(formData) {
...result,
commissionType: paramConfig.ParamsType2CommissionTypes,
commissionBase: commissionTypesCoverCommissionBase[paramConfig.ParamsType2CommissionTypes],
assessmentFactor: paramConfig.assessmentFactor.value,
assessmentFactor: isObject(paramConfig.assessmentFactor) ? paramConfig.assessmentFactor.value : paramConfig.assessmentFactor,
goodsConfigType: paramConfig.goodsCategory,
...paramConfig.goodsCategory === 0
? buildGoodsTypePayload(goodsCategory, paramsType2Item.productLabel)
......@@ -60,8 +66,11 @@ export function convertDataToBackend(formData) {
});
}
}
console.log("convertDataToBackend", merchantBrandRefList);
// 整理门店
// requestData.merchantBrandRefList = buildMerchantBrandPayload(merchantBrandRefList, data.businessType);
if (merchantBrandRefList && merchantBrandRefList.length) {
requestData.merchantBrandRefList = buildMerchantBrandPayload(merchantBrandRefList, data.businessType);
}
return requestData;
}
......@@ -78,10 +87,15 @@ function getPerformanceParamConfigConditions(paramsType2Item, paramsConfig) {
level2Name: "conditionSecondaryGoodsTypeName",
level3Name: "conditionThirdLevelGoodsTypeName",
};
const buildProductDefinePayloadOptions = {
id: "conditionProductDefineId",
name: "conditionProductDefineName",
type: "conditionGoodsConfigType",
};
console.log("paramsConfigdddsss", paramsConfig);
const conditionItem = [{
conditionType: paramsType2Item.condition,
// conditionGoodsConfigType: paramsConfig.goodsCategory,
conditionGoodsConfigType: paramsConfig.goodsCategory,
// conditionStartValue: "",
// conditionEndValue: "",
}];
......@@ -94,21 +108,40 @@ function getPerformanceParamConfigConditions(paramsType2Item, paramsConfig) {
const conditionParamsData = paramsType2Item[`conditionType${paramsType2Item.condition}`];
// 如果 conditionParamsData 不存在,直接返回空的 conditionItem
if (!conditionParamsData) {
return conditionItem;
}
if (paramsType2Item.condition === 1) {
// 检查四个渗透率字段是否有值
const hasPermeabilityValue
= (conditionParamsData.permeabilityMax !== undefined && conditionParamsData.permeabilityMax !== null && conditionParamsData.permeabilityMax !== "")
|| (conditionParamsData.permeabilityMax1 !== undefined && conditionParamsData.permeabilityMax1 !== null && conditionParamsData.permeabilityMax1 !== "")
|| (conditionParamsData.permeabilityMin !== undefined && conditionParamsData.permeabilityMin !== null && conditionParamsData.permeabilityMin !== "")
|| (conditionParamsData.permeabilityMin1 !== undefined && conditionParamsData.permeabilityMin1 !== null && conditionParamsData.permeabilityMin1 !== "");
// 如果四个渗透率字段全部没有值,直接返回空的 conditionItem,不进行后续处理
if (!hasPermeabilityValue) {
return conditionItem;
}
extend.conditionStartValue = conditionParamsData.permeabilityMin;
extend.conditionEndValue = conditionParamsData.permeabilityMax;
extend = {
...extend,
...paramsConfig.goodsCategory === 0
? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue, buildGoodsTypePayloadOptions)
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue),
? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue || [], buildGoodsTypePayloadOptions)
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue || [], buildProductDefinePayloadOptions),
};
conditionItem.push({
conditionType: paramsType2Item.condition,
conditionStartValue: conditionParamsData.permeabilityMin1,
conditionEndValue: conditionParamsData.permeabilityMax1,
conditionGoodsConfigType: paramsConfig.goodsCategory,
...paramsConfig.goodsCategory === 0
? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue1, buildGoodsTypePayloadOptions)
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue1),
? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue1 || [], buildGoodsTypePayloadOptions)
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue1 || [], buildProductDefinePayloadOptions),
});
}
if (paramsType2Item.condition === 2) {
......@@ -119,19 +152,36 @@ function getPerformanceParamConfigConditions(paramsType2Item, paramsConfig) {
extend.conditionCommissionTypeValue = conditionParamsData.increaseReward;
}
if (paramsType2Item.condition === 4) {
extend
= paramsConfig.goodsCategory === 0
? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue, buildGoodsTypePayloadOptions)
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue);
extend = {
...extend,
...paramsConfig.goodsCategory === 0
? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue || [], buildGoodsTypePayloadOptions)
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue || [], buildProductDefinePayloadOptions),
};
}
conditionItem[0] = {
...conditionItem[0],
...extend,
};
return conditionItem;
}
function buildProductDefinePayload(tree, pathIds) {
function buildProductDefinePayload(tree, pathIds, options = {
id: "productDefineId",
name: "productDefineName",
type: "goodsConfigType",
}) {
// 如果 pathIds 不存在或不是数组,返回空对象
if (!pathIds || !Array.isArray(pathIds) || pathIds.length === 0) {
return {
[options.id]: null,
[options.name]: null,
[options.type]: null,
};
}
let currentLevel = tree;
let targetNode = null;
......@@ -143,8 +193,9 @@ function buildProductDefinePayload(tree, pathIds) {
}
return {
productDefineId: targetNode?.id ?? null,
productDefineName: targetNode?.label ?? null,
[options.id]: targetNode?.id ?? null,
[options.name]: targetNode?.label ?? null,
[options.type]: targetNode?.defineType,
};
}
......@@ -158,10 +209,19 @@ function buildGoodsTypePayload(tree, pathIds, options = {
}) {
const result = {};
let currentLevel = tree;
// 如果 pathIds 不存在或不是数组,返回空对象
if (!pathIds || !Array.isArray(pathIds) || pathIds.length === 0) {
return result;
}
pathIds.forEach((id, index) => {
const node = currentLevel.find(item => item.categoryType === id);
let node = {};
traverseTree(tree, (_node) => {
if (id === _node.categoryType) {
node = _node;
}
});
if (!node)
return;
......@@ -175,12 +235,22 @@ function buildGoodsTypePayload(tree, pathIds, options = {
result[options.level3Id] = node.categoryType;
result[options.level3Name] = node.categoryName;
}
currentLevel = node.children || [];
});
return result;
}
function traverseTree(tree, callback) {
if (!Array.isArray(tree))
return;
for (const node of tree) {
callback(node);
if (Array.isArray(node.children) && node.children.length) {
traverseTree(node.children, callback);
}
}
}
function coverParamsType1(ParamsType1, ParamsType1Products, fn) {
ParamsType1.forEach((rowItem, row) => {
......@@ -200,10 +270,11 @@ function coverParamsType1(ParamsType1, ParamsType1Products, fn) {
});
}
// 整理商户品牌数据
function coverParamsType2(ParamsType2, fn) {
ParamsType2.forEach((rowItem, rowIndex) => {
const result = {
templateType: 1,
templateType: 2,
startValue: rowItem.priceRange[0],
endValue: rowItem.priceRange[1],
commissionTypeValue: rowItem.condition === 0 ? rowItem.conditionType0 : rowItem[`conditionType${rowItem.condition}`].triggerCondition,
......@@ -240,7 +311,7 @@ function buildMerchantBrandPayload(
brandName: brand.brandName,
childId: brand.childId,
childName: brand.childName,
businessType: String(businessType),
businessType,
});
});
});
......
.performance-scheme-wrapper {
.warp-box {
background: #fff;
margin-bottom: 16px;
position: relative;
.title {
height: 50px;
line-height: 50px;
padding: 0 20px;
border-bottom: 1px solid #e5e5e5;
font-size: 16px;
font-weight: 600;
color: #333333;
display: flex;
align-items: center;
margin-bottom: 16px;
.title-wrap {
display: flex;
align-items: center;
}
.merchant-text {
font-size: 14px;
font-weight: normal;
color: #666666;
}
}
.space-b {
justify-content: space-between;
}
::v-deep .el-form-item__label {
padding: 0;
}
.warp-content {
padding: 0 20px 20px;
.params-config-list {
border-bottom: 1px solid #e5e5e5;
margin-top: 18px;
&:first-child {
margin-top: 0;
}
&:last-child {
border-bottom: 0;
}
}
}
}
.btn-box {
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
.btn {
box-sizing: border-box;
font-size: 14px;
height: 32px;
padding: 5px 14px;
line-height: 22px;
border-radius: 4px;
line-height: 22px;
}
.check-btn {
border: 1px solid #2a58ad;
background: #2a58ad;
color: #ffffff;
}
.save-btn {
width: 76px;
border: 1px solid #2a58ad;
background: #eff3f6;
color: #2a58ad;
}
.cancel-btn {
color: #666666;
width: 56px;
background: #e8e8e8;
}
}
.form-performance-name {
::v-deep .el-form-item {
margin-bottom: 14px;
.el-input {
.el-input__inner {
height: 32px;
line-height: 32px;
}
}
}
}
}
<template>
<d2-container v-loading="$store.state.d2admin.loading.value" class="performance-scheme-wrapper">
<el-form ref="form"
class="form-performance-name"
label-width="170px"
:model="formData"
:rules="rules"
:validate-on-rule-change="false">
<div class="warp-box">
<div class="title space-b">
<div class="title-wrap">
<span>绩效规则选择</span>
</div>
</div>
<div class="warp-content">
<PerformanceRuleSelection />
</div>
</div>
<div class="warp-box">
<div class="title space-b">
<div class="title-wrap">
<span>绩效参数配置</span>
</div>
</div>
<div class="warp-content">
<el-form-item label="当前方案名称:" prop="schemeName">
<el-input v-model="schemeName"
clearable
maxlength="20"
placeholder="请输入当前方案名称"
style="width:290px"
@blur="handleFieldBlur('schemeName')" />
</el-form-item>
<ParamConfigList v-for="(parameter, index) in formData.paramConfigList"
:key="parameter.sort"
class="params-config-list"
:config-index="index" />
</div>
</div>
<div class="warp-box">
<div class="title space-b">
<div class="title-wrap">
<span>应用到门店</span>
</div>
</div>
<div class="warp-content">
<StoreApply />
</div>
</div>
<div class="btn-box">
<el-button class="btn check-btn"
size="small"
type="primary"
@click="handleSubmitCheck">
提交审核
</el-button>
<el-button class="btn save-btn"
size="small"
@click="handleSubmitSave(true)">
保存
</el-button>
<el-button class="btn cancel-btn"
size="small"
@click="handleCancelSubmit">
取消
</el-button>
</div>
</el-form>
<DetailDialog v-if="detailVisible"
:id="id"
:detail-visible="detailVisible"
:is-edit="true"
@dialogClose="handleCheckClose">
</DetailDialog>
</d2-container>
</template>
<script>
import { groupBy } from "lodash-es";
import { mapMutations, mapState } from "vuex";
import { getAllCategory } from "@/api/product.js";
import {
getPerformanceConfigDetailAPI,
getTargetProductConfigListAPI,
postSalaryPerformanceScheme,
} from "@/api/resident";
import DetailDialog from "../../components/approvalView";
import ParamConfigList from "../components/paramConfigList/index.vue";
import PerformanceRuleSelection from "../components/performanceRuleSelection/index.vue";
import { assessmentFactorOptions } from "../components/performanceRuleSelection/options.js";
import StoreApply from "../components/storeApply/index.vue";
import { bindFormFields } from "../store/helper.js";
import { convertBackendToData } from "../utils/convertBackendToData.js";
import { convertDataToBackend } from "../utils/index.js";
import { getFormRules, validateParamConfigList } from "../utils/rules.js";
// 提成方案配置
export default {
name: "",
components: {
PerformanceRuleSelection,
ParamConfigList,
StoreApply,
DetailDialog,
},
beforeRouteLeave(to, from, next) {
// 离开页面时, 清空数据
this.resetFormData();
next();
},
props: {},
data() {
return {
id: 0,
rules: {},
detailVisible: false,
shouldValidateAll: false, // 是否应该验证所有字段
};
},
computed: {
...mapState("PerformanceFormStore", [
"formData",
"merchantBrandRefList",
]),
schemeName: bindFormFields("schemeName"),
},
watch: {
formData: {
handler() {
// 当formData变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
immediate: true,
},
merchantBrandRefList: {
handler() {
// 当门店列表变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
},
},
async mounted() {
await this.initLoad();
if (this.$route?.query?.id) {
this.id = this.$route.query.id;
await this.getData(this.$route?.query?.id);
}
},
methods: {
...mapMutations("PerformanceFormStore", [
"setFormData",
"setProductDefineList",
"setGoodsCategory",
"setMerchantBrandRefList",
"touchAssessment",
"setAssessmentFactorValue",
"setParamConfigList",
"resetFormData",
]),
// 提交审核
async handleSubmitCheck() {
await this.handleSubmitSave();
this.detailVisible = !this.detailVisible;
},
handleCheckClose(e) {
this.detailVisible = !this.detailVisible;
if (e.isConfirm) {
this.handleCancelSubmit();
}
},
// 处理单个字段失焦事件,只验证当前字段
handleFieldBlur(prop) {
if (!this.shouldValidateAll && this.$refs.form) {
this.$refs.form.validateField(prop, () => {});
}
},
// 提交保存
async handleSubmitSave(isConfirm = false) {
console.log("handleSubmitSave", this.formData);
// 设置需要验证所有字段
this.shouldValidateAll = true;
// 表单校验
try {
await this.$refs.form.validate();
} catch (error) {
this.$message.warning("请完善表单信息");
this.shouldValidateAll = false;
return;
}
this.shouldValidateAll = false;
// 校验门店列表
if (!this.merchantBrandRefList || this.merchantBrandRefList.length === 0) {
this.$message.warning("请至少选择一个门店");
return;
}
// 校验参数配置列表
const paramConfigError = validateParamConfigList(this.formData);
if (paramConfigError) {
this.$message.warning(paramConfigError);
return;
}
console.log(this.formData, "this.formData");
const params = convertDataToBackend({
...this.formData,
merchantBrandRefList: this.merchantBrandRefList,
});
if (this.formData.id) {
params.id = this.formData.id;
if (this.formData.schemeType) {
params.schemeType = this.formData.schemeType;
}
}
const res = await postSalaryPerformanceScheme(params);
this.id = res;
console.log(res, "res");
if (res && isConfirm) {
this.$message.success("保存成功");
this.handleCancelSubmit();
}
// console.log("handleSubmitSave", params);
// await postSalaryPerformanceScheme(params);
// await postSalaryPerformanceScheme();
},
// 取消按钮
handleCancelSubmit() {
if (window.history.length > 1) {
this.$router.back();
} else {
this.$router.replace("/salaryPerformance"); // 兜底页
}
},
async initLoad() {
// 获取品类
const { list } = await getAllCategory({
pageSize: 9999,
currentPage: 1,
});
// 添加全部选项
const allOption = { categoryType: -1, categoryName: "全部" };
list.unshift(allOption);
this.setGoodsCategory(list);
// 获取圈定商品/套餐
const res = await getTargetProductConfigListAPI({
currentPage: 1,
pageSize: 999,
});
this.setProductDefineList(res?.list);
},
async getData(id) {
const data = await getPerformanceConfigDetailAPI({ id });
if (!data) {
this.$message.error("获取数据失败");
return;
}
const { merchantBrandRefList, ...performance } =
convertBackendToData(data);
this.setMerchantBrandRefList(merchantBrandRefList);
const assessmentKeys = Object.keys(
groupBy(performance.paramConfigList, "assessmentFactor")
).map(Number);
const selectAssessment = assessmentFactorOptions.filter((item) =>
assessmentKeys.includes(item.value)
);
this.touchAssessment(selectAssessment);
this.setFormData(performance);
this.setAssessmentFactorValue(assessmentKeys);
},
},
};
</script>
<style scoped lang="scss">
@import "./common.scss";
</style>
<template>
<d2-container v-loading="$store.state.d2admin.loading.value"
class="performance-scheme-wrapper">
<el-form ref="form"
class="form-performance-name"
label-width="170px"
:model="formData"
:rules="rules"
:validate-on-rule-change="false">
<div class="warp-box">
<div class="title space-b">
<div class="title-wrap">
<span>渠道配置</span>
</div>
</div>
<div class="warp-content">
<ChannelConfig v-if="brandMerchantList.length"
:brand-merchant="brandMerchantList"
@changeBusiness="handleChangeBusinessType">
</ChannelConfig>
</div>
</div>
<div class="warp-box">
<div class="title space-b">
<div class="title-wrap">
<span>绩效规则选择</span>
</div>
</div>
<div class="warp-content">
<PerformanceRuleSelection />
</div>
</div>
<div class="warp-box">
<div class="title space-b">
<div class="title-wrap">
<span>绩效参数配置</span>
</div>
</div>
<div class="warp-content">
<el-form-item label="当前方案名称:" prop="schemeName">
<el-input v-model="schemeName"
clearable
maxlength="20"
placeholder="请输入当前方案名称"
style="width: 290px"
@blur="handleFieldBlur('schemeName')" />
</el-form-item>
<ParamConfigList v-for="(parameter, index) in formData.paramConfigList"
:key="parameter.sort"
class="params-config-list"
:config-index="index" />
</div>
</div>
<div class="warp-box">
<div class="title space-b">
<div class="title-wrap">
<span>应用时间</span>
</div>
</div>
<div class="warp-content">
<el-form-item label="生效月份:" prop="effectiveMonth">
<el-date-picker v-model="effectiveMonth"
format="yyyy-MM"
:picker-options="pickerOptions"
placeholder="请选择"
type="month"
value-format="yyyy-MM"
@blur="handleFieldBlur('effectiveMonth')">
</el-date-picker>
</el-form-item>
</div>
</div>
<div class="btn-box">
<el-button class="btn check-btn"
size="small"
type="primary"
@click="handleSubmitCheck">
提交审核
</el-button>
<el-button class="btn cancel-btn"
size="small"
@click="handleCancel">
取消
</el-button>
</div>
</el-form>
<DetailDialog v-if="detailVisible"
:id="detailVisibleId"
:detail-visible="detailVisible"
:is-edit="true"
@dialogClose="handleCheckClose">
</DetailDialog>
</d2-container>
</template>
<script>
import { groupBy } from "lodash-es";
import { mapMutations, mapState } from "vuex";
import { getAllCategory } from "@/api/product.js";
import {
getConfigMerchantDetail,
getTargetProductConfigListAPI,
postBrandMerchant,
postSalaryPerformanceScheme,
} from "@/api/resident";
import detailDialog from "../../components/approvalView";
import ChannelConfig from "../components/channelConfig/index.vue";
import ParamConfigList from "../components/paramConfigList/index.vue";
import PerformanceRuleSelection from "../components/performanceRuleSelection/index.vue";
import { assessmentFactorOptions } from "../components/performanceRuleSelection/options.js";
import { bindFormFields } from "../store/helper.js";
import { convertBackendToData } from "../utils/convertBackendToData.js";
import { convertDataToBackend } from "../utils/index.js";
import { getFormRules, validateParamConfigList } from "../utils/rules.js";
// 门店提成方案
export default {
name: "",
components: {
PerformanceRuleSelection,
ParamConfigList,
ChannelConfig,
DetailDialog: detailDialog,
},
props: {},
data() {
return {
brandMerchantList: [],
rules: {},
detailVisible: false,
detailVisibleId: undefined,
shouldValidateAll: false, // 是否应该验证所有字段
pickerOptions: {
disabledDate(time) {
// 最早:2025-01
const min = new Date(2025, 0, 1).getTime();
// 最晚:当前月份往后 1 年(当月 + 12 个月)
const now = new Date();
const max = new Date(
now.getFullYear(),
now.getMonth() + 12,
1,
).getTime();
const t = time.getTime();
return t < min || t > max;
},
},
};
},
computed: {
...mapState("PerformanceFormStore", ["formData", "merchantBrandRefList"]),
schemeName: bindFormFields("schemeName"),
effectiveMonth: {
get() {
return this.formData.effectiveMonth;
},
set(value) {
this.formData.effectiveMonth = value;
},
},
},
watch: {
formData: {
handler() {
// 当formData变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
immediate: true,
},
merchantBrandRefList: {
handler() {
// 当门店列表变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
},
},
async mounted() {
console.log("this.$route.query", this.$route.query);
if (this.$route.query?.id) {
await this.getData(this.$route.query?.id);
}
},
methods: {
...mapMutations("PerformanceFormStore", [
"setFormData",
"setProductDefineList",
"setGoodsCategory",
"setMerchantBrandRefList",
"touchAssessment",
"setAssessmentFactorValue",
"setParamConfigList",
"resetFormData",
]),
async handleChangeBusinessType({ id }) {
const data = await getConfigMerchantDetail({
id,
merchantId: this.$route.query?.id,
});
const performance = convertBackendToData(data);
const assessmentKeys = Object.keys(
groupBy(performance.paramConfigList, "assessmentFactor"),
).map(Number);
const selectAssessment = assessmentFactorOptions.filter(item =>
assessmentKeys.includes(item.value),
);
this.touchAssessment(selectAssessment);
this.setFormData({
...performance,
id,
});
this.setAssessmentFactorValue(assessmentKeys);
this.setMerchantBrandRefList(data.merchantBrandRefList);
},
handleCheckClose(e) {
this.detailVisible = !this.detailVisible;
if (e.isConfirm) {
this.handleCancelSubmit();
}
},
// 处理单个字段失焦事件,只验证当前字段
handleFieldBlur(prop) {
if (!this.shouldValidateAll && this.$refs.form) {
this.$refs.form.validateField(prop, () => {});
}
},
// 提交审核
async handleSubmitCheck() {
// 表单校验
this.shouldValidateAll = true;
try {
await this.$refs.form.validate();
} catch (error) {
this.$message.warning("请完善表单信息");
this.shouldValidateAll = false;
return;
}
this.shouldValidateAll = false;
// 校验参数配置列表
const paramConfigError = validateParamConfigList(this.formData);
if (paramConfigError) {
this.$message.warning(paramConfigError);
return;
}
const params = convertDataToBackend({
...this.formData,
// 门店提成方案不需要门店列表,传空数组
merchantBrandRefList: [],
});
if (this.formData.id) {
params.id = this.formData.id;
}
if (this.formData.schemeType) {
params.schemeType = this.formData.schemeType;
}
this.detailVisibleId = await postSalaryPerformanceScheme(params);
if (this.detailVisibleId) {
this.detailVisible = !this.detailVisible;
}
},
// 取消按钮
handleCancelSubmit() {
if (window.history.length > 1) {
this.$router.back();
} else {
this.$router.replace("/salaryPerformance"); // 兜底页
}
},
async getData(id) {
this.brandMerchantList = await postBrandMerchant({
merchantId: id,
});
// 获取品类
const { list } = await getAllCategory({
pageSize: 9999,
currentPage: 1,
});
this.setGoodsCategory(list);
// 获取圈定商品/套餐
const res = await getTargetProductConfigListAPI({
currentPage: 1,
pageSize: 999,
});
this.setProductDefineList(res?.list);
console.log(this.brandMerchantList);
},
handleCancel() {
// this.$EventBus.$emit("salaryPerformanceTab", {
// tabName: this.routeParams.page
// })
// this.$router.push({
// name: "salaryPerformance",
// params: {
// tabPane: this.routeParams.page == "performanceList" ? "1" : "0",
// tabName: this.routeParams.page,
// },
// });
if (window.history.length > 1) {
this.$router.back();
} else {
this.$router.replace("/salaryPerformance"); // 兜底页
}
},
},
};
</script>
<style scoped lang="scss">
@import "./common.scss";
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!