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 @@ ...@@ -36,4 +36,4 @@
} }
}, },
"i18n-ally.sourceLanguage": "zh-chs" "i18n-ally.sourceLanguage": "zh-chs"
}
\ No newline at end of file \ No newline at end of file
}
...@@ -4247,6 +4247,27 @@ ...@@ -4247,6 +4247,27 @@
"whatwg-fetch": "^3.6.2" "whatwg-fetch": "^3.6.2"
}, },
"dependencies": { "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": { "acorn-walk": {
"version": "8.2.0", "version": "8.2.0",
"resolved": "https://registry.npmmirror.com/acorn-walk/-/acorn-walk-8.2.0.tgz", "resolved": "https://registry.npmmirror.com/acorn-walk/-/acorn-walk-8.2.0.tgz",
...@@ -4782,27 +4803,6 @@ ...@@ -4782,27 +4803,6 @@
"lodash": "^4.17.4" "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": { "@vue/vue2-jest": {
"version": "27.0.0", "version": "27.0.0",
"resolved": "https://registry.npmmirror.com/@vue/vue2-jest/-/vue2-jest-27.0.0.tgz", "resolved": "https://registry.npmmirror.com/@vue/vue2-jest/-/vue2-jest-27.0.0.tgz",
......
...@@ -597,6 +597,16 @@ export function postSalaryPerformanceScheme(data) { ...@@ -597,6 +597,16 @@ export function postSalaryPerformanceScheme(data) {
data.method = `dj.staff.api.performance.config.add`; data.method = `dj.staff.api.performance.config.add`;
return request(data, "post"); 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) { export function checkProductDefineAPI(data) {
......
...@@ -258,7 +258,8 @@ export const uploadCustodyAgreement = (data = {}) => { ...@@ -258,7 +258,8 @@ export const uploadCustodyAgreement = (data = {}) => {
*/ */
export const webPayDepositApplication = (data = {}) => { export const webPayDepositApplication = (data = {}) => {
return gscPost("/evalElectronicContract/webPayDepositApplication", data, { return gscPost("/evalElectronicContract/webPayDepositApplication", data, {
timeout: 30000 timeout: 30000,
returnAll: true
}) })
} }
/** /**
...@@ -266,7 +267,8 @@ export const webPayDepositApplication = (data = {}) => { ...@@ -266,7 +267,8 @@ export const webPayDepositApplication = (data = {}) => {
*/ */
export const webPayFinalApplication = (data = {}) => { export const webPayFinalApplication = (data = {}) => {
return gscPost("/evalElectronicContract/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 // Vue
import Vue from "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 axios from 'axios' // import axios from 'axios'
// import i18n from './i18n' // 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 D2Crud from '@d2-projects/d2-crud'
// 菜单和路由设置 // 菜单和路由设置
import router from "./router"; import router from "./router"
import "default-passive-events"; import "default-passive-events"
import "element-ui/lib/theme-chalk/index.css"; 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, { Vue.use(VueLazyload, {
// 懒加载默认加载图片 // 懒加载默认加载图片
loading: loading:
"https://img02.glsx.com.cn/weapp/resource/saas/dj/images/img_loading.png", "https://img02.glsx.com.cn/weapp/resource/saas/dj/images/img_loading.png",
attempt: 3, // 尝试加载次数 attempt: 3 // 尝试加载次数
}); })
// 实例化 // 实例化
process.env.NODE_ENV === "production" process.env.NODE_ENV === "production" &&
&& Sentry.init({ Sentry.init({
Vue, Vue,
dsn: "https://39bc80d3bb0a419a8d7d9bf5a39678e3@sentry.glsx.com.cn/24", dsn: "https://39bc80d3bb0a419a8d7d9bf5a39678e3@sentry.glsx.com.cn/24",
// dsn: 'http://6225fb8e73fb453a8455a9371f3517da@192.168.3.115:9000/4', // dsn: 'http://6225fb8e73fb453a8455a9371f3517da@192.168.3.115:9000/4',
integrations: [ integrations: [
new BrowserTracing({ new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router), routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ["localhost", "my-site-url.com", /^\//], tracingOrigins: ["localhost", "my-site-url.com", /^\//]
}), })
], ],
// Set tracesSampleRate to 1.0 to capture 100% // Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring. // of transactions for performance monitoring.
// We recommend adjusting this value in production // We recommend adjusting this value in production
tracesSampleRate: 1.0, tracesSampleRate: 1.0,
logErrors: true, logErrors: true,
// 解决火狐浏览器 无法捕获错误的问题 // 解决火狐浏览器 无法捕获错误的问题
beforeSend(event, hint) { beforeSend(event, hint) {
const isNonErrorException const isNonErrorException =
= event.exception.values[0].value.startsWith( event.exception.values[0].value.startsWith(
"Non-Error exception captured", "Non-Error exception captured"
) ) ||
|| hint.originalException.message.startsWith( hint.originalException.message.startsWith(
"Non-Error exception captured", "Non-Error exception captured"
); )
if (isNonErrorException) { if (isNonErrorException) {
// We want to ignore those kind of errors // We want to ignore those kind of errors
return null; return null
} }
return event; return event
}, }
// "send-default-pii": true // "send-default-pii": true
}); })
// d2Admin 已导入 // d2Admin 已导入
// import ElementUI from 'element-ui' // import ElementUI from 'element-ui'
// Vue.use(ElementUI) // Vue.use(ElementUI)
// 核心插件 // 核心插件
Vue.use(d2Admin); Vue.use(d2Admin)
Vue.use(chaining); Vue.use(chaining)
// Vue.use(GLCombiForm) // 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) // console.log(isProd)
if (!isProd) { if (!isProd) {
Vue.config.devtools = true; Vue.config.devtools = true
} }
Vue.prototype.$EventBus = new Vue(); Vue.prototype.$EventBus = new Vue()
Vue.directive("preventReClick", { Vue.directive("preventReClick", {
bind: (el, binding) => { bind: (el, binding) => {
let time = binding.value; // 防抖时间 let time = binding.value // 防抖时间
if (!time) { if (!time) {
// 用户若不设置防抖时间,则默认1s // 用户若不设置防抖时间,则默认1s
time = 1000; time = 1000
} }
let fun; let fun
el.addEventListener( el.addEventListener(
"click", "click",
(event) => { (event) => {
if (!fun) { if (!fun) {
// 第一次执行 // 第一次执行
fun = setTimeout(() => { fun = setTimeout(() => {
fun = null; fun = null
}, time); }, time)
} else { } else {
// 直接取消当前事件 // 直接取消当前事件
event && event.stopImmediatePropagation(); event && event.stopImmediatePropagation()
} }
}, },
true, true
); )
}, }
}); })
let baseConfig = config; let baseConfig = config
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取 // 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
fetch( 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( .then(
(response) => { (response) => {
// 处理http响应 // 处理http响应
return response.json(); return response.json()
}, },
(error) => { (error) => {
// 处理错误 // 处理错误
console.log(error); console.log(error)
}, }
) )
.then((response) => { .then((response) => {
const { code, data } = response; const { code, data } = response
console.log("response", code, response); console.log("response", code, response)
if (code == "200") { if (code == "200") {
console.log(data); console.log(data)
baseConfig = data; baseConfig = data
// console.log("baseConfig", baseConfig) // console.log("baseConfig", baseConfig)
// window.$fetchConfig = data // window.$fetchConfig = data
} else { } else {
baseConfig = response; baseConfig = response
window.$fetchConfig = response; window.$fetchConfig = response
console.log(response); console.log(response)
window.$gscApi = new Request({ window.$gscApi = new Request({
...response.gsc, ...response.gsc,
// baseURL:'http://192.168.3.145:9898/gsc-vcp-web-facade', // baseURL:'http://192.168.3.145:9898/gsc-vcp-web-facade',
// baseURL: 'http://gsc.test.glsx.com.cn/gsc-vcp-web-facade', // baseURL: 'http://gsc.test.glsx.com.cn/gsc-vcp-web-facade',
session: { session: {
requiresSession: true, requiresSession: true,
sessionId: _ => util.cookies.get("token"), sessionId: (_) => util.cookies.get("token")
}, },
events: { events: {
error: (error, config) => { error: (error, config) => {
Vue.prototype.$message.error(error.msg); Vue.prototype.$message.error(error.msg)
}, },
logout: (response, config) => { logout: (response, config) => {
store.dispatch("d2admin/user/clear"); store.dispatch("d2admin/user/clear")
util.cookies.remove("token"); util.cookies.remove("token")
router.replace("/login"); router.replace("/login")
Vue.prototype.$message.error("登录超时,请重新登录"); Vue.prototype.$message.error("登录超时,请重新登录")
}, }
}, }
}); })
console.log(window.$gscApi, "========"); console.log(window.$gscApi, "========")
} }
}) })
.finally(() => { .finally(() => {
init(); init()
}); })
function init() { function init() {
new Vue({ new Vue({
router, router,
store, store,
// i18n, // i18n,
render: (h) => { render: (h) => {
// baseConfig.axios.baseURL = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router' // baseConfig.axios.baseURL = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
// data // data
// console.log(data) // console.log(data)
Vue.prototype.baseConfig = baseConfig; Vue.prototype.baseConfig = baseConfig
return h(App); return h(App)
}, },
created() { created() {
// 系统配置 // 系统配置
Vue.config.devtools = true; Vue.config.devtools = true
// 展示系统信息 // 展示系统信息
this.$store.commit("d2admin/releases/versionShow"); this.$store.commit("d2admin/releases/versionShow")
// 用户登录后从数据库加载一系列的设置 // 用户登录后从数据库加载一系列的设置
this.$store.dispatch("d2admin/account/load"); this.$store.dispatch("d2admin/account/load")
// 获取并记录用户 UA // 获取并记录用户 UA
this.$store.commit("d2admin/ua/get"); this.$store.commit("d2admin/ua/get")
// 初始化全屏监听 // 初始化全屏监听
this.$store.dispatch("d2admin/fullscreen/listen"); this.$store.dispatch("d2admin/fullscreen/listen")
}, },
mounted() {}, mounted() {}
}).$mount("#app"); }).$mount("#app")
} }
export { baseConfig }; export { baseConfig }
...@@ -59,6 +59,19 @@ const PAY_MENTMETHOD_OPTIONS = Object.keys(PAY_MENTMETHOD_MAP).map((key) => { ...@@ -59,6 +59,19 @@ const PAY_MENTMETHOD_OPTIONS = Object.keys(PAY_MENTMETHOD_MAP).map((key) => {
value: 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 = { module.exports = {
RECEIPT_STATUS, RECEIPT_STATUS,
PUSH_STATUS, PUSH_STATUS,
...@@ -70,5 +83,7 @@ module.exports = { ...@@ -70,5 +83,7 @@ module.exports = {
RECEIPT_STATUS_OPTIONS, RECEIPT_STATUS_OPTIONS,
NB_TRANSFER_STATUS_OPTIONS, NB_TRANSFER_STATUS_OPTIONS,
PAY_MENTMETHOD_OPTIONS, PAY_MENTMETHOD_OPTIONS,
PAY_MENTMETHOD_MAP PAY_MENTMETHOD_MAP,
wechatType_OPTIONS,
wechatType_MAP
} }
...@@ -7,16 +7,14 @@ ...@@ -7,16 +7,14 @@
class="show-search" class="show-search"
:search-form="searchForm" :search-form="searchForm"
:form-data="showFormData" :form-data="showFormData"
label-width="130px" label-width="130px">
>
<template #inputRangeHtml> <template #inputRangeHtml>
<input-range <input-range
start-placeholder="最小金额" start-placeholder="最小金额"
end-placeholder="最大金额" end-placeholder="最大金额"
:display-value="searchForm.amtList" :display-value="searchForm.amtList"
max-length="15" max-length="15"
input-max-length="15" input-max-length="15"></input-range>
></input-range>
</template> </template>
<template #selectDatePickerHtml> <template #selectDatePickerHtml>
<div class="select-date-picker"> <div class="select-date-picker">
...@@ -24,14 +22,12 @@ ...@@ -24,14 +22,12 @@
v-model="searchForm.dateType" v-model="searchForm.dateType"
placeholder="请选择" placeholder="请选择"
@change="searchForm.dateValue = ''" @change="searchForm.dateValue = ''"
class="select" class="select">
>
<el-option <el-option
v-for="(subItem, subIndex) in selectOption" v-for="(subItem, subIndex) in selectOption"
:key="subIndex" :key="subIndex"
:label="subItem.label" :label="subItem.label"
:value="subItem.value" :value="subItem.value" />
/>
</el-select> </el-select>
<el-date-picker <el-date-picker
class="date-picker" class="date-picker"
...@@ -42,8 +38,7 @@ ...@@ -42,8 +38,7 @@
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
:picker-options="rangePickerOptions" :picker-options="rangePickerOptions"
:default-time="['00:00:00', '23:59:59']" :default-time="['00:00:00', '23:59:59']" />
/>
</div> </div>
</template> </template>
</d2-search> </d2-search>
...@@ -58,13 +53,11 @@ ...@@ -58,13 +53,11 @@
<d2-table-header> <d2-table-header>
<span <span
data-event-code="usedcar_payment_push_list" data-event-code="usedcar_payment_push_list"
style="margin-right: 10px" style="margin-right: 10px">
>
<auth-button <auth-button
category="Button" category="Button"
:show-btn-ids="['9051401']" :show-btn-ids="['9051401']"
:loading="pushPayBillLoading" :loading="pushPayBillLoading" />
/>
</span> </span>
<span data-event-code="usedcar_payment_management_list_export"> <span data-event-code="usedcar_payment_management_list_export">
<auth-button category="Button" :show-btn-ids="['9051402']" /> <auth-button category="Button" :show-btn-ids="['9051402']" />
...@@ -75,16 +68,14 @@ ...@@ -75,16 +68,14 @@
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams" :table-params="tableParams"
:get-list-api="getListApi" :get-list-api="getListApi"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn">
>
<div slot="statusHtml" slot-scope="scope"> <div slot="statusHtml" slot-scope="scope">
<span <span
class="circle" class="circle"
:style="{ :style="{
background: background:
baseData[scope.columnsObj.colorKey][scope.scope[scope.prop]] baseData[scope.columnsObj.colorKey][scope.scope[scope.prop]]
}" }"></span>
></span>
{{ {{
baseData[scope.columnsObj.enumKey][scope.scope[scope.prop]] || "-" baseData[scope.columnsObj.enumKey][scope.scope[scope.prop]] || "-"
}} }}
...@@ -98,8 +89,7 @@ ...@@ -98,8 +89,7 @@
id: scope.scope.id 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']" /> <auth-button :data="scope.scope" :show-btn-ids="['9051403']" />
</span> </span>
<!-- 回单 --> <!-- 回单 -->
...@@ -112,8 +102,7 @@ ...@@ -112,8 +102,7 @@
<detailDialog <detailDialog
:visible="detailDialogVisible" :visible="detailDialogVisible"
:params-obj="detailDialogParams" :params-obj="detailDialogParams"
@dialogClose="closeDetailDialog" @dialogClose="closeDetailDialog" />
/>
</d2-container> </d2-container>
</template> </template>
...@@ -135,7 +124,9 @@ import { ...@@ -135,7 +124,9 @@ import {
RECEIPT_STATUS_OPTIONS, RECEIPT_STATUS_OPTIONS,
NB_TRANSFER_STATUS_OPTIONS, NB_TRANSFER_STATUS_OPTIONS,
PAY_MENTMETHOD_OPTIONS, PAY_MENTMETHOD_OPTIONS,
PAY_MENTMETHOD_MAP PAY_MENTMETHOD_MAP,
wechatType_OPTIONS,
wechatType_MAP
} from "./contant" } from "./contant"
import detailDialog from "./components/detailDialog.vue" import detailDialog from "./components/detailDialog.vue"
import { todayEndPickerOptions } from "@/common/format" import { todayEndPickerOptions } from "@/common/format"
...@@ -179,7 +170,8 @@ export default { ...@@ -179,7 +170,8 @@ export default {
amtList: [], amtList: [],
dateType: "payment", dateType: "payment",
dateValue: "", dateValue: "",
paymentMethod: "全部" paymentMethod: "全部",
wechatType: ""
}, },
showFormData: [ showFormData: [
{ {
...@@ -298,6 +290,16 @@ export default { ...@@ -298,6 +290,16 @@ export default {
optionId: "label", optionId: "label",
optionLabel: "label", optionLabel: "label",
optionsName: "PAY_MENTMETHOD_OPTIONS" 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 { ...@@ -311,7 +313,9 @@ export default {
pushStatus: deepClone(PUSH_STATUS), pushStatus: deepClone(PUSH_STATUS),
nbTransferStatus: deepClone(NB_TRANSFER_STATUS), nbTransferStatus: deepClone(NB_TRANSFER_STATUS),
PAY_MENTMETHOD_OPTIONS: deepClone(PAY_MENTMETHOD_OPTIONS), 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, getListApi: getUsedCarPaymentList,
searchFormSearch: {}, searchFormSearch: {},
...@@ -422,6 +426,14 @@ export default { ...@@ -422,6 +426,14 @@ export default {
label: "付款方式", label: "付款方式",
prop: "paymentMethod", prop: "paymentMethod",
minWidth: 120 minWidth: 120
},
{
label: "内部主体",
prop: "wechatType",
minWidth: 120,
formatter: (cellValue) => {
return this.baseData.wechatType_MAP[cellValue.wechatType] || "-"
}
} }
] ]
}, },
......
...@@ -524,10 +524,14 @@ ...@@ -524,10 +524,14 @@
<!-- 取消分账 --> <!-- 取消分账 -->
<auth-button slot="auth-button" v-if="scope.row.profitAllocationStatus == 5" :show-btn-ids="['9040135']" <auth-button slot="auth-button" v-if="scope.row.profitAllocationStatus == 5" :show-btn-ids="['9040135']"
:data="scope.row" /> :data="scope.row" />
<!-- 通过 --> <div>
<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="['9040147']" :data="scope.row" />
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040148']" :data="scope.row" /> </div>
<div>
<!-- 驳回 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040148']" :data="scope.row" />
</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -505,10 +505,14 @@ ...@@ -505,10 +505,14 @@
</el-button> --> </el-button> -->
<!-- 取消分账 --> <!-- 取消分账 -->
<auth-button v-if="scope.row.profitAllocationStatus == 5" :show-btn-ids="['9040107']" :data="scope.row" /> <auth-button v-if="scope.row.profitAllocationStatus == 5" :show-btn-ids="['9040107']" :data="scope.row" />
<!-- 通过 --> <div>
<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="['9040147']" :data="scope.row" />
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040148']" :data="scope.row" /> </div>
<div>
<!-- 驳回 -->
<auth-button v-if="scope.row.goodsOrderApplyStatus == 2" :show-btn-ids="['9040148']" :data="scope.row" />
</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
<!-- 引荐数审核 --> <!-- 引荐数审核 -->
<template> <template>
<d2-container class="layout"> <d2-container class="layout">
<div class="header"> <div class="header">
<d2-search <d2-search
ref="showSearch" ref="showSearch"
:search-form="searchForm" :search-form="searchForm"
:form-data="showFormData" :form-data="showFormData"
label-width="100px" label-width="100px"
:selectPopperAppendToBody="false" :selectPopperAppendToBody="false"
class="d2-search" class="d2-search"
> >
<template slot="managerCommitTime"> <template slot="managerCommitTime">
<el-date-picker <el-date-picker
v-model="searchForm.managerCommitTime" v-model="searchForm.managerCommitTime"
type="monthrange" type="monthrange"
range-separator="至" range-separator="至"
start-placeholder="开始月份" start-placeholder="开始月份"
end-placeholder="结束月份" end-placeholder="结束月份"
:picker-options="monthPickerOptions" :picker-options="monthPickerOptions"
size="small" size="small"
:clearable="false" :clearable="false"
value-format="yyyy-MM" value-format="yyyy-MM"
> >
</el-date-picker> </el-date-picker>
</template> </template>
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button :id="tableParams.btnId" size="small" type="primary"> <el-button :id="tableParams.btnId" size="small" type="primary">
查询 查询
</el-button> </el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button> <el-button size="small" @click="handleReset"> 重置 </el-button>
</div> </div>
</div> </div>
<div class="d2-container-content"> <div class="d2-container-content">
<d2-table-header> <d2-table-header>
<auth-button :show-btn-ids="['9040903']" category="Button" /> <auth-button :show-btn-ids="['9040903']" category="Button" />
</d2-table-header> </d2-table-header>
<!-- :get-list-api="getListApi" --> <!-- :get-list-api="getListApi" -->
<d2-table <d2-table
ref="tableRef" ref="tableRef"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams" :table-params="tableParams"
:get-list-api="getListApi" :get-list-api="getListApi"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
> >
<div slot="imageUrls" slot-scope="scope" class="coverImage-preview"> <div
<glsx-preview slot="imageUrls"
:image-url-arr=" slot-scope="scope"
scope.scope.imageUrls class="coverImage-preview"
? formatterImg(scope.scope.imageUrls) >
: [noDataUrl] <glsx-preview
" :image-url-arr="
:pic-options="picOptions" scope.scope.imageUrls
limit="1" ? formatterImg(scope.scope.imageUrls)
></glsx-preview> : [noDataUrl]
</div> "
<template slot="remark" slot-scope="scope"> :pic-options="picOptions"
<el-popover placement="top" width="fit-content" trigger="hover"> limit="1"
<div class="tags-popover"> ></glsx-preview>
{{ scope.scope.remark || "-" }} </div>
</div> <template slot="remark" slot-scope="scope">
<span class="tag" slot="reference">{{ <template v-if="scope.scope.remark">
scope.scope.remark || "-" <el-popover
}}</span> placement="top"
</el-popover> width="fit-content"
</template> trigger="hover"
<template slot="merchantName" slot-scope="scope"> >
<el-popover placement="top" width="fit-content" trigger="hover"> <div class="tags-popover">
<div class="tags-popover"> {{ scope.scope.remark || "-" }}
{{ scope.scope.merchantName || "-" }} </div>
</div> <span class="tag" slot="reference">{{
<span class="tag" slot="reference">{{ scope.scope.remark || "-"
scope.scope.merchantName || "-" }}</span>
}}</span> </el-popover>
</el-popover> </template>
</template> <template v-else>-</template>
<!--状态 --> </template>
<div slot="statusHtml" slot-scope="scope"> <template slot="merchantName" slot-scope="scope">
<div class="online-status"> <template v-if="scope.scope.merchantName">
<span <el-popover
class="dot" placement="top"
:style="{ width="fit-content"
background: getStatusColor( trigger="hover"
scope && scope.scope && scope.scope.isReviewed, >
'reviewStatusOptMap' <div class="tags-popover">
) {{ scope.scope.merchantName || "-" }}
}" </div>
></span> <span class="tag" slot="reference">{{
{{ scope.scope.merchantName || "-"
getStatusItem( }}</span>
baseData, </el-popover>
"reviewStatusOpts", </template>
scope.scope, <template v-else>-</template>
"isReviewed" </template>
) <!--状态 -->
}} <div slot="statusHtml" slot-scope="scope">
</div> <div class="online-status">
</div> <span
<div slot="auth-button" slot-scope="scope"> class="dot"
<span :style="{
style="margin-right: 8px" background: getStatusColor(
v-if="scope.scope.isReviewed == 2 || scope.scope.isReviewed == 1" scope &&
> scope.scope &&
<auth-button scope.scope.isReviewed,
slot="auth-button" 'reviewStatusOptMap'
:show-btn-ids="['9040901']" ),
:data="scope.scope" }"
/> ></span>
</span> {{
<span v-else> getStatusItem(
<auth-button baseData,
slot="auth-button" "reviewStatusOpts",
:show-btn-ids="['9040902']" scope.scope,
:data="scope.scope" "isReviewed"
/> )
</span> }}
</div> </div>
</d2-table> </div>
</div> <div slot="auth-button" slot-scope="scope">
<referral-dialog <span
v-if="referralVisible" style="margin-right: 8px"
:detailVisible="referralVisible" v-if="
:id="id" scope.scope.isReviewed == 2 ||
@dialogClose="handlereferralClose" scope.scope.isReviewed == 1
></referral-dialog> "
</d2-container> >
<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> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
...@@ -502,70 +525,70 @@ export default { ...@@ -502,70 +525,70 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.layout { .layout {
.d2-search { .d2-search {
::v-deep.el-select-dropdown, ::v-deep.el-select-dropdown,
.el-popper { .el-popper {
width: 300px !important; width: 300px !important;
} }
} }
.header { .header {
background: #fff; background: #fff;
} }
.content { .content {
position: absolute; position: absolute;
left: 20px; left: 20px;
width: calc(100% - 40px); width: calc(100% - 40px);
padding: 0 20px 36px; padding: 0 20px 36px;
background: #fff; background: #fff;
margin-top: 14px; margin-top: 14px;
height: calc(100% - 110px); height: calc(100% - 110px);
box-sizing: border-box; box-sizing: border-box;
overflow-y: auto; overflow-y: auto;
.top { .top {
height: 52px; height: 52px;
color: #333333; color: #333333;
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
display: flex; display: flex;
align-items: center; align-items: center;
.exprot { .exprot {
margin-left: auto; margin-left: auto;
} }
} }
} }
.tag { .tag {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
cursor: pointer; cursor: pointer;
padding: 0 10px; padding: 0 10px;
display: block; display: block;
} }
.online-status { .online-status {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.dot { .dot {
display: inline-block; display: inline-block;
width: 8px; width: 8px;
height: 8px; height: 8px;
border-radius: 50%; border-radius: 50%;
margin-right: 8px; margin-right: 8px;
} }
} }
} }
.coverImage-preview { .coverImage-preview {
width: 138px; width: 138px;
height: 54px; height: 54px;
::v-deep .photo-activity { ::v-deep .photo-activity {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: contain; object-fit: contain;
position: static !important; position: static !important;
} }
} }
::v-deep.tags-popover { ::v-deep.tags-popover {
max-width: 50vw; max-width: 50vw;
} }
</style> </style>
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
@handleClose="closeDialogVisible" @handleClose="closeDialogVisible"
@handleConfirm="handleUpdateConfirm" @handleConfirm="handleUpdateConfirm"
:slotArr="slotArr" :slotArr="slotArr"
class="batch-modify-salary-dialog"
> >
<template slot="effectiveMonth"> <template slot="effectiveMonth">
<el-date-picker <el-date-picker
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
size="small" size="small"
:clearable="false" :clearable="false"
value-format="yyyy-MM" value-format="yyyy-MM"
class="effectiveMonth"
> >
</el-date-picker> </el-date-picker>
</template> </template>
...@@ -62,7 +64,7 @@ export default { ...@@ -62,7 +64,7 @@ export default {
}, },
isUpdateDialogConfig: { isUpdateDialogConfig: {
title: "批量修改薪资占比", title: "批量修改薪资占比",
width: "500px", width: "480px",
okText: "确定" okText: "确定"
}, },
isUpdateForm: { isUpdateForm: {
...@@ -111,6 +113,9 @@ export default { ...@@ -111,6 +113,9 @@ export default {
this.validatePercent(value, callback), this.validatePercent(value, callback),
trigger: "blur" trigger: "blur"
} }
],
effectiveMonth: [
{ required: true, message: "请选择", trigger: "change" }
] ]
}, },
baseData: {}, baseData: {},
...@@ -195,4 +200,10 @@ export default { ...@@ -195,4 +200,10 @@ export default {
} }
} }
</script> </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 @@ ...@@ -77,7 +77,8 @@
></glsx-preview> ></glsx-preview>
</div> </div>
<template slot="remark" slot-scope="scope"> <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"> <div class="tags-popover">
{{ scope.scope.remark || "-" }} {{ scope.scope.remark || "-" }}
</div> </div>
...@@ -85,16 +86,21 @@ ...@@ -85,16 +86,21 @@
scope.scope.remark || "-" scope.scope.remark || "-"
}}</span> }}</span>
</el-popover> </el-popover>
</template>
<template v-else>-</template>
</template> </template>
<template slot="replyContent" slot-scope="scope"> <template slot="replyContent" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover"> <template v-if="scope.scope.replyContent">
<div class="tags-popover"> <el-popover placement="top" width="fit-content" trigger="hover">
{{ scope.scope.replyContent || "-" }} <div class="tags-popover">
</div> {{ scope.scope.replyContent || "-" }}
<span class="tag" slot="reference">{{ </div>
scope.scope.replyContent || "-" <span class="tag" slot="reference">{{
}}</span> scope.scope.replyContent || "-"
</el-popover> }}</span>
</el-popover>
</template>
<template v-else>-</template>
</template> </template>
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
<el-button <el-button
...@@ -421,6 +427,9 @@ export default { ...@@ -421,6 +427,9 @@ export default {
.el-popper { .el-popper {
width: 300px !important; width: 300px !important;
} }
.el-date-editor.el-input, .el-date-editor.el-input__inner{
width:100% !important;
}
} }
.content { .content {
position: absolute; position: absolute;
......
This diff could not be displayed because it is too large.
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
v-model="infoForm.merchantIds" v-model="infoForm.merchantIds"
multiple multiple
collapse-tags collapse-tags
:multiple-limit="10"
@change="updateStaffList('staffPhoneList')" @change="updateStaffList('staffPhoneList')"
> >
<el-option <el-option
...@@ -48,7 +47,6 @@ ...@@ -48,7 +47,6 @@
v-model="infoForm.staffPhoneList" v-model="infoForm.staffPhoneList"
multiple multiple
collapse-tags collapse-tags
:multiple-limit="10"
> >
<el-option <el-option
v-for="item in baseData.staffList" v-for="item in baseData.staffList"
...@@ -96,7 +94,7 @@ ...@@ -96,7 +94,7 @@
>模板下载</el-button >模板下载</el-button
> --> > -->
<div class="tips-text"> <div class="tips-text">
选择员工在近3个月内的工资导出文件,批量修订后导入更新 支持批量修订近3个月内到工资导出文件后导入更新
</div> </div>
<div class="file_box" v-if="fileName"> <div class="file_box" v-if="fileName">
<div class="file_name">{{ fileName }}</div> <div class="file_name">{{ fileName }}</div>
...@@ -135,7 +133,6 @@ ...@@ -135,7 +133,6 @@
v-model="infoForm.exportMerchantIds" v-model="infoForm.exportMerchantIds"
multiple multiple
collapse-tags collapse-tags
:multiple-limit="10"
@change="updateStaffList('salaryMerchantList')" @change="updateStaffList('salaryMerchantList')"
> >
<el-option <el-option
...@@ -154,7 +151,6 @@ ...@@ -154,7 +151,6 @@
v-model="infoForm.exportStaffPhoneList" v-model="infoForm.exportStaffPhoneList"
multiple multiple
collapse-tags collapse-tags
:multiple-limit="10"
> >
<el-option <el-option
v-for="item in baseData.exportStaffList" v-for="item in baseData.exportStaffList"
......
...@@ -252,7 +252,7 @@ export default { ...@@ -252,7 +252,7 @@ export default {
optionsName: "directLeaderList" optionsName: "directLeaderList"
}, },
{ {
label: "工资绩效", label: "含工资人员",
name: "salaryStaffPhone", name: "salaryStaffPhone",
type: "select", type: "select",
isClear: true, isClear: true,
......
<!-- 详情 --> <!-- 详情 -->
<template> <template>
<baseDialog <baseDialog
:dialog-config="dialogConfig" class="accountDailog"
:config="config" :config="config"
:dialog-config="dialogConfig"
:is-show.sync="visible" :is-show.sync="visible"
class="accountDailog"
@handleClick="handleClick" @handleClick="handleClick"
> >
<div class="sun-dialog" v-loading="loading"> <div v-loading="loading" class="sun-dialog">
<div class="approve-info"> <div class="approve-info">
提交后经由嘀加企微,推送到审批人<span 提交后经由嘀加企微,推送到审批人
v-for="(item, index) in detailInfo.examineData" <template
:key="index + 'exam'" v-if="
>{{ item.approverName }}{{ item.approverMobile }}</span detailInfo.examineData && detailInfo.examineData.length
>,抄送人<span "
v-for="(item, index) in detailInfo.referData" ><span
:key="index + 'refer'" v-for="(item, index) in detailInfo.examineData"
>{{ item.approverName }}{{ item.approverMobile }}</span :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> </div>
<template v-if="detailInfo"> <template v-if="detailInfo">
<detailComp <DetailComp
:configData="configData" :config-data="configData"
:detailInfo="detailInfo" :detail-info="detailInfo"
:is-close="isEdit"
:rules="rules" :rules="rules"
:isClose="isEdit"
> >
<template #merchantBrandRefList> <template #merchantBrandRefList>
<div <div
class="merchantBrand-box"
v-if=" v-if="
detailInfo.merchantBrandList && detailInfo.merchantBrandList &&
detailInfo.merchantBrandList.length detailInfo.merchantBrandList.length
" "
class="merchantBrand-box"
> >
<div <div
class="box"
v-for="item in detailInfo.merchantBrandList" v-for="item in detailInfo.merchantBrandList"
:key="item.merchantId" :key="item.merchantId"
class="box"
> >
<div class="merchantName"> <div class="merchantName">
{{ item.merchantName }} {{ item.merchantName }}
</div> </div>
<div class="brands"> <div class="brands">
<div <div
class="brand"
v-for="tag in item.child" v-for="tag in item.child"
:key="tag.childId" :key="tag.childId"
class="brand"
> >
{{ tag.childName }} {{ tag.childName }}
</div> </div>
...@@ -55,15 +69,15 @@ ...@@ -55,15 +69,15 @@
</div> </div>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
</detailComp> </DetailComp>
<template v-if="!isEdit"> <template v-if="!isEdit">
<el-form label-width="150px" style="margin-top: -60px"> <el-form label-width="150px" style="margin-top: -60px">
<el-row <el-row
:gutter="20"
:key="index"
v-for="( v-for="(
item, index item, index
) in detailInfo.approveOperationRecordList" ) in detailInfo.approveOperationRecordList"
:key="index"
:gutter="20"
> >
<el-col :span="12"> <el-col :span="12">
<el-form-item label="审批人:"> <el-form-item label="审批人:">
...@@ -73,20 +87,22 @@ ...@@ -73,20 +87,22 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="审批意见:"> <el-form-item label="审批意见:">
<!-- 将 v-html 改为纯文本插值,并应用换行样式 --> <!-- 将 v-html 改为纯文本插值,并应用换行样式 -->
<span class="opinion-text">{{ <span class="opinion-text">
formatOpinionText( {{
item.approveOpinion formatOpinionText(
) || "-" item.approveOpinion
}}</span> ) || "-"
}}
</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-form label-width="150px" v-if="detailInfo.referData"> <el-form v-if="detailInfo.referData" label-width="150px">
<el-row <el-row
:gutter="20"
:key="index"
v-for="(item, index) in detailInfo.referData" v-for="(item, index) in detailInfo.referData"
:key="index"
:gutter="20"
> >
<el-col :span="24"> <el-col :span="24">
<el-form-item label="查阅人:"> <el-form-item label="查阅人:">
...@@ -102,19 +118,35 @@ ...@@ -102,19 +118,35 @@
</template> </template>
<script> <script>
import { interviewResultOpt, processResultOpt } from "@/common/constants.js"; import { getPerformanceConfigDetailAPI } from "@/api/resident";
import { import {
getApproveConfig,
getConfigApprovetDetail, getConfigApprovetDetail,
submitConfigApprove, submitConfigApprove,
getApproveConfig,
} from "@/api/salaryManagement.js"; } 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 detailComp from "./detailComp.vue";
import { Util, deepClone, getStatusItem } from "@/common/util";
export default { export default {
name: "approvalView", name: "ApprovalView",
components: { components: {
detailComp, DetailComp: detailComp,
},
props: {
detailVisible: {
type: Boolean,
default: false,
},
id: {
type: Number || String,
default: "",
},
isEdit: {
type: Boolean,
default: false,
},
}, },
data() { data() {
return { return {
...@@ -203,23 +235,9 @@ export default { ...@@ -203,23 +235,9 @@ export default {
interviewResultOpt, interviewResultOpt,
processResultOpt, processResultOpt,
}, },
isConfirm: false,
}; };
}, },
props: {
detailVisible: {
type: Boolean,
default: false,
},
id: {
type: Number || String,
default: "",
},
isEdit: {
type: Boolean,
default: false,
},
},
computed: { computed: {
visible: { visible: {
get() { get() {
...@@ -228,6 +246,7 @@ export default { ...@@ -228,6 +246,7 @@ export default {
set(newVal) { set(newVal) {
this.$emit("dialogClose", { this.$emit("dialogClose", {
isConfirm: this.isConfirm,
flag: newVal, flag: newVal,
attrName: "detailVisible", attrName: "detailVisible",
}); });
...@@ -264,11 +283,12 @@ export default { ...@@ -264,11 +283,12 @@ export default {
approveAttachments: this.detailInfo.editAttachmentImgs.length approveAttachments: this.detailInfo.editAttachmentImgs.length
? this.detailInfo.editAttachmentImgs.join(",") ? this.detailInfo.editAttachmentImgs.join(",")
: "", : "",
} };
submitConfigApprove(params) submitConfigApprove(params)
.then((res) => { .then((res) => {
if (res) { if (res) {
this.$message.success("操作成功"); this.$message.success("操作成功");
this.isConfirm = true;
} }
}) })
.finally((err) => { .finally((err) => {
...@@ -303,16 +323,16 @@ export default { ...@@ -303,16 +323,16 @@ export default {
this.loading = false; this.loading = false;
this.configData[0].infoData[ this.configData[0].infoData[
this.findAttrIdx("infoData", "approveRemark") this.findAttrIdx("infoData", "approveRemark")
].isHidden = !this.isEdit ? false : true; ].isHidden = !!this.isEdit;
this.configData[0].infoData[ this.configData[0].infoData[
this.findAttrIdx("infoData", "attachmentImgs") this.findAttrIdx("infoData", "attachmentImgs")
].isHidden = !this.isEdit ? false : true; ].isHidden = !!this.isEdit;
this.configData[0].infoData[ this.configData[0].infoData[
this.findAttrIdx("infoData", "editApproveRemark") this.findAttrIdx("infoData", "editApproveRemark")
].isHidden = this.isEdit ? false : true; ].isHidden = !this.isEdit;
this.configData[0].infoData[ this.configData[0].infoData[
this.findAttrIdx("infoData", "editAttachmentImgs") this.findAttrIdx("infoData", "editAttachmentImgs")
].isHidden = this.isEdit ? false : true; ].isHidden = !this.isEdit;
// this.detailInfo = res // this.detailInfo = res
Object.assign(this.detailInfo, res); Object.assign(this.detailInfo, res);
...@@ -347,16 +367,16 @@ export default { ...@@ -347,16 +367,16 @@ export default {
this.loading = false; this.loading = false;
this.configData[0].infoData[ this.configData[0].infoData[
this.findAttrIdx("infoData", "approveRemark") this.findAttrIdx("infoData", "approveRemark")
].isHidden = !this.isEdit ? false : true; ].isHidden = !!this.isEdit;
this.configData[0].infoData[ this.configData[0].infoData[
this.findAttrIdx("infoData", "attachmentImgs") this.findAttrIdx("infoData", "attachmentImgs")
].isHidden = !this.isEdit ? false : true; ].isHidden = !!this.isEdit;
this.configData[0].infoData[ this.configData[0].infoData[
this.findAttrIdx("infoData", "editApproveRemark") this.findAttrIdx("infoData", "editApproveRemark")
].isHidden = this.isEdit ? false : true; ].isHidden = !this.isEdit;
this.configData[0].infoData[ this.configData[0].infoData[
this.findAttrIdx("infoData", "editAttachmentImgs") this.findAttrIdx("infoData", "editAttachmentImgs")
].isHidden = this.isEdit ? false : true; ].isHidden = !this.isEdit;
this.detailInfo = res; this.detailInfo = res;
// console.log(this.detailInfo, "this.detailInfo") // console.log(this.detailInfo, "this.detailInfo")
...@@ -401,7 +421,7 @@ export default { ...@@ -401,7 +421,7 @@ export default {
return result; return result;
}, },
findAttrIdx(formName, name) { findAttrIdx(formName, name) {
var index = this.configData[0][formName].findIndex( let index = this.configData[0][formName].findIndex(
(k) => k.key == name (k) => k.key == name
); );
return index || 0; return index || 0;
...@@ -422,6 +442,7 @@ export default { ...@@ -422,6 +442,7 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./detail.scss"; @import "./detail.scss";
::v-deep .el-dialog__body { ::v-deep .el-dialog__body {
...@@ -501,6 +522,7 @@ export default { ...@@ -501,6 +522,7 @@ export default {
border-radius: 4px; border-radius: 4px;
border: 1px solid #00000026; border: 1px solid #00000026;
padding: 3px 8px; padding: 3px 8px;
margin-bottom: 8px;
} }
} }
} }
......
<!-- 提成方案配置 --> <!-- 提成方案配置 -->
<template> <template>
<d2-container class="rewardPool-list m-t-40"> <d2-container class="rewardPool-list m-t-40">
<div class="d2-container-content"> <div class="d2-container-content">
<d2-table-header> <d2-table-header>
<span> <span>
<el-button type="primary" size="small" @click="handleAdd" <el-button size="small" type="primary" @click="handleAdd">
>新增提成方案</el-button 新增提成方案
> </el-button>
</span> </span>
</d2-table-header> </d2-table-header>
<d2-table <d2-table
ref="commissionTable" ref="commissionTable"
:search-form="searchFormSearch" :get-list-api="getListApi"
:table-params="tableParams" :search-form="searchFormSearch"
:get-list-api="getListApi" :table-params="tableParams"
> >
<!-- 状态 --> <!-- 状态 -->
<div slot="statusHtml" slot-scope="scope"> <template #statusHtml="scope">
<div <div>
class="online-status" <div
v-if="scope.scope.status === 0 || scope.scope.status" v-if="
> scope.scope.status === 0 || scope.scope.status
<span "
class="dot" class="online-status"
:style="{ >
background: getStatusColor( <span
scope && scope.scope && scope.scope.status, class="dot"
'statusTypeOptMap' :style="{
) background: getStatusColor(
}" scope &&
></span> scope.scope &&
{{ getStatusItem(baseData, "statusList", scope.scope, "status") }} scope.scope.status,
</div> 'statusTypeOptMap'
<span v-else>-</span> ),
</div> }"
<div slot="auth-button" slot-scope="scope"> >
<el-button type="text" @click="handleParameter(scope.scope)" </span>
>调整参数</el-button {{
> getStatusItem(
</div> baseData,
</d2-table> "statusList",
</div> scope.scope,
</d2-container> "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> </template>
<script> <script>
import { Util, deepClone, getStatusItem, getStatusColor } from "@/common/util" import { getConfigList } from "@api/salaryManagement";
import { getConfigList } from "@api/salaryManagement"
import { import {
outputValue_businessOpt, outputValue_businessOpt,
statusList, statusList,
statusTypeOptMap statusTypeOptMap,
} from "@/common/constants" } from "@/common/constants";
export default { import { deepClone, getStatusColor, getStatusItem, Util } from "@/common/util";
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
this.$refs.commissionTable.refreshTable(true, true) export default {
}, name: "CommissionPlanList",
// 新增提成方案 data() {
handleAdd() { return {
const params = JSON.stringify({ getStatusColor,
page: 'commissionPlanList' getStatusItem,
}) getListApi: getConfigList,
this.$router.push({ tableParams: {
name: 'performanceScheme', listName: "list",
query: { tableOption: {
params 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: {},
};
}, },
//调整参数 mounted() {},
handleParameter(data) { methods: {
const params = JSON.stringify({ handleSearch() {
page: 'commissionPlanList', this.page = this.$options.data.call(this).page;
id: data.id
}) this.$refs.commissionTable.refreshTable(true, true);
this.$router.push({ },
name: 'performanceScheme', // 新增提成方案
query: { handleAdd() {
params this.$router.push({
} // 提成方案
}) path: "/configureCommissionPlan",
});
},
// 调整参数
handleParameter(data) {
this.$router.push({
path: "/configureCommissionPlan",
query: {
id: data.id,
},
});
},
}, },
} };
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.month-class { .month-class {
width: 100% !important; width: 100% !important;
} }
.rewardPool-list { .rewardPool-list {
// background: #fff; // background: #fff;
// padding: 20px; // padding: 20px;
} }
.m-t-40 { .m-t-40 {
margin-top: 40px; margin-top: 40px;
::v-deep .el-tabs__header { ::v-deep .el-tabs__header {
padding: 0 !important; padding: 0 !important;
margin: 0 0 15px !important; margin: 0 0 15px !important;
} }
} }
.static-text { .static-text {
position: absolute; position: absolute;
top: 30px; top: 30px;
left: 200px; left: 200px;
// margin-top: 20px; // margin-top: 20px;
font-size: 14px; font-size: 14px;
color: #666; color: #666;
} }
.d2-container-content { .d2-container-content {
position: relative; position: relative;
} }
.online-status { .online-status {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.dot { .dot {
display: inline-block; display: inline-block;
width: 8px; width: 8px;
height: 8px; height: 8px;
border-radius: 50%; border-radius: 50%;
margin-right: 8px; margin-right: 8px;
} }
} }
</style> </style>
...@@ -119,7 +119,13 @@ export default { ...@@ -119,7 +119,13 @@ export default {
storeIdList: [], storeIdList: [],
statusTypeOptMap: deepClone(statusTypeOptMap), statusTypeOptMap: deepClone(statusTypeOptMap),
businessTypeOpts: deepClone(outputValue_businessOpt), businessTypeOpts: deepClone(outputValue_businessOpt),
statusList: deepClone(statusList) statusList: deepClone(statusList),
// approveStatusOpt:[
// { confId: 2, confValue: "生效" },
// { confId: 1, confValue: "审批中" },
// { confId: 0, confValue: "草稿" },
// { confId: 3, confValue: "未生效" }
// ]
} }
} }
}, },
......
<!-- 门店提成方案 --> <!-- 门店提成方案 -->
<template> <template>
<div class="container"> <div class="container">
<d2-table <d2-table
ref="table" ref="table"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams" :table-params="tableParams"
:get-list-api="getListApi" :get-list-api="getListApi"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
> >
<template slot="brandNames" slot-scope="scope"> <template slot="merchantNames" slot-scope="scope">
<template {{scope.scope.merchantNames||'-'}} {{scope.scope.merchantId}}
v-if="scope.scope.brandNames && scope.scope.brandNames.length > 20" </template>
> <template slot="brandNames" slot-scope="scope">
<el-popover <template
placement="top" v-if="scope.scope.brandNames && scope.scope.brandNames.length > 20"
width="300" >
popper-class="brand_popver" <el-popover
trigger="hover" placement="top"
> width="300"
<div class="brand-box"> popper-class="brand_popver"
{{ brandFilter(scope.scope) }} trigger="hover"
</div> >
<div slot="reference"> <div class="brand-box">
{{ brandFilter(scope.scope, 30) }} {{ brandFilter(scope.scope) }}
</div> </div>
</el-popover> <div slot="reference">
</template> {{ brandFilter(scope.scope, 30) }}
<span v-else>{{ scope.scope.brandNames || "-" }}</span> </div>
</template> </el-popover>
<template slot="schemeNames" slot-scope="scope"> </template>
<template <span v-else>{{ scope.scope.brandNames || "-" }}</span>
v-if=" </template>
<template slot="schemeNames" slot-scope="scope">
<template
v-if="
scope.scope.schemeNames && scope.scope.schemeNames &&
scope.scope.schemeNames.split(',').length > 0 scope.scope.schemeNames.split(',').length > 0
" "
> >
<div <div
v-for="(item, index) in scope.scope.schemeNames.split(',')" v-for="(item, index) in scope.scope.schemeNames.split(',')"
:key="index" :key="index"
> >
{{ item || "-" }} {{ item || "-" }}
</div> </div>
</template> </template>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
<!-- 编辑 --> <!-- 编辑 -->
<span style="margin-right: 10px"> <span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9121202']" /> <auth-button :data="scope.scope" :show-btn-ids="['9121202']" />
</span> </span>
</div> </div>
</d2-table> </d2-table>
</div> </div>
</template> </template>
<script> <script>
import { getStoreConfigList } from "@api/salaryManagement" import { getStoreConfigList } from "@api/salaryManagement"
import { deepClone, getStatusItem } from "@/common/util" import { deepClone, getStatusItem } from "@/common/util"
export default { export default {
data() { data() {
return { return {
getStatusItem, getStatusItem,
searchFormSearch: {}, searchFormSearch: {},
getListApi: getStoreConfigList, getListApi: getStoreConfigList,
// 表格参数 // 表格参数
tableParams: { tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list", listName: "list",
tableOption: { tableOption: {
width: "100" width: "100"
}, },
tableColumns: [ tableColumns: [
{ {
label: "门店名称", label: "门店名称",
prop: "merchantNames" prop: "merchantNames",
}, addHtml: "merchantNames"
{ },
label: "品牌", {
prop: "brandNames", label: "品牌",
width: "200", prop: "brandNames",
addHtml: "brandNames" width: "200",
}, addHtml: "brandNames"
{ },
label: "提成方案名称", {
prop: "schemeNames" label: "提成方案名称",
// addHtml: "schemeNames" prop: "schemeNames"
}, // addHtml: "schemeNames"
{ },
label: "适配业务", {
prop: "businessTypes", label: "适配业务",
formatter: (cellValue) => { prop: "businessTypes",
if (!cellValue.businessTypes) return "-" formatter: (cellValue) => {
let str = [] if (!cellValue.businessTypes) return "-"
cellValue.businessTypes.split(",").forEach((item) => { let str = []
str.push( cellValue.businessTypes.split(",").forEach((item) => {
this.getStatusItem(this.baseData, "businessTypeOpts", item) str.push(
) this.getStatusItem(this.baseData, "businessTypeOpts", item)
}) )
return str.join(",") })
} return str.join(",")
} }
] }
} ]
} }
}, }
props: { },
searchForm: { props: {
type: Object, searchForm: {
default: () => {} type: Object,
}, default: () => {}
baseData: { },
type: Object, baseData: {
default: () => {} type: Object,
} default: () => {}
}, }
mounted() {}, },
methods: { mounted() {},
keyDowmGetList() { methods: {
this.$refs.table.refreshTable(true, true) keyDowmGetList() {
}, this.$refs.table.refreshTable(true, true)
beforeSearchFn() { },
return new Promise((resolve) => { beforeSearchFn() {
this.searchFormSearch = { return new Promise((resolve) => {
...this.searchForm this.searchFormSearch = {
} ...this.searchForm
resolve() }
}) resolve()
}, })
brandFilter(ele, lenght) { },
if (ele.brandNames) { brandFilter(ele, lenght) {
return lenght if (ele.brandNames) {
? ele.brandNames?.length > lenght return lenght
? ele.brandNames.substring(0, lenght) + "\u2026" ? ele.brandNames?.length > lenght
: ele.brandNames.substring(0, lenght) ? ele.brandNames.substring(0, lenght) + "\u2026"
: ele.brandNames : ele.brandNames.substring(0, lenght)
} else { : ele.brandNames
return "-" } else {
} return "-"
}, }
getOptions() { },
this.showFormData?.forEach((item, index) => { getOptions() {
if (item.type == "select") { this.showFormData?.forEach((item, index) => {
if ( if (item.type == "select") {
this.baseData[item.optionsName].length && if (
this.baseData[item.optionsName][0][ this.baseData[item.optionsName].length &&
this.showFormData[index].optionLabel this.baseData[item.optionsName][0][
] !== "全部" this.showFormData[index].optionLabel
) { ] !== "全部"
const temp = {} ) {
temp[this.showFormData[index].optionId] = "" const temp = {}
temp[this.showFormData[index].optionLabel] = "全部" temp[this.showFormData[index].optionId] = ""
this.baseData[item.optionsName].unshift(temp) temp[this.showFormData[index].optionLabel] = "全部"
} this.baseData[item.optionsName].unshift(temp)
this.showFormData[index].optionList = this.baseData[item.optionsName] }
} this.showFormData[index].optionList = this.baseData[item.optionsName]
}) }
}, })
// 编辑方案 },
handleToEdit(row) { // 编辑方案
const params = JSON.stringify({ handleToEdit(row) {
page: 'performanceList', console.log(row);
id: row.id this.$router.push({
}) path: "/configureStoreCommissionPlan",
this.$router.push({ query: {
name: "performanceScheme", id: row.merchantId,
query: { },
params });
} }
}) }
}
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.m-t-40 { .m-t-40 {
margin-top: 40px; margin-top: 40px;
} }
.container { .container {
margin-top: 8px; margin-top: 8px;
} }
.brand-box { .brand-box {
font-size: 12px; font-size: 12px;
padding: 10px; padding: 10px;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>
<style> <style>
.brand_popver { .brand_popver {
height: auto !important; height: auto !important;
max-height: 200px; max-height: 200px;
overflow: auto !important; overflow: auto !important;
min-height: 0; min-height: 0;
padding: 0 !important; padding: 0 !important;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>
<template> <template>
<div> <div>
<el-form-item label="适配业务:" prop="businessType" > <el-form-item label="适配业务:" prop="businessType">
<el-radio-group v-model="businessType"> <el-radio-group v-model="businessType" @change="handleChangeBusinessType">
<el-radio label="0"> <el-radio :disabled="!businessTypes.includes(0)" :label="0">
轻改 轻改
</el-radio> </el-radio>
<el-radio label="1"> <el-radio :disabled="!businessTypes.includes(1)" :label="1">
延保 延保
</el-radio> </el-radio>
<el-radio label="2"> <el-radio :disabled="!businessTypes.includes(2)" :label="2">
权益 权益
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </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> </div>
</template> </template>
...@@ -22,25 +32,43 @@ import { bindFormFields } from "../../store/helper"; ...@@ -22,25 +32,43 @@ import { bindFormFields } from "../../store/helper";
export default { export default {
name: "", name: "",
props: { props: {
brandMerchant: {
type: Array,
require: true,
},
}, },
data() { data() {
return { return {
businessType: undefined,
}; };
}, },
computed: { 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: { methods: {
handleChangeBusinessType(e) {
const item = this.brandMerchant.find(item => item.businessType === e);
if (item) {
this.$emit("changeBusiness", item);
}
},
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
</style> </style>
<template> <template>
<div class=""> <div class="">
<el-cascader :options="goodsCategory" <el-cascader
placeholder="请选择商品品类" clearable
:props="{ checkStrictly: true, label: 'categoryName', value: 'categoryType' }" :options="visible ? computedGoodsCategory : goodsCategory"
:show-all-levels="false" placeholder="请选择商品品类"
:value="value" :props="{
@change="handleProductChange"> checkStrictly: true,
</el-cascader> label: 'categoryName',
</div> value: 'categoryType',
}"
:show-all-levels="false"
:value="value"
@change="handleProductChange"
@visible-change="handleVisibleChange"
>
</el-cascader>
</div>
</template> </template>
<script> <script>
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
name: "", name: "GoodsCategoryCascader",
props: { props: {
value: { value: {
type: Array, type: Array,
default: () => [], 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() { data() {
return { return {
visible: false,
}; };
}, },
computed: { computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList", "commissionTypesOptions", "goodsCategory"]), ...mapState("PerformanceFormStore", [
}, "formData",
mounted() { "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: { 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) { handleProductChange(value) {
this.$emit("input", value); this.$emit("input", value);
this.$emit("change", value); this.$emit("change", value);
}, },
handleVisibleChange(isVisible) {
this.visible = isVisible;
},
}, },
}; };
</script> </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 @@ ...@@ -8,7 +8,7 @@
<el-radio label="ParamsType1"> <el-radio label="ParamsType1">
适配通用配置 适配通用配置
</el-radio> </el-radio>
<el-radio label="ParamsType2"> <el-radio v-if="[3, 4].includes(curParamsAssessFactorValue)" label="ParamsType2">
适配渗透率配置 适配渗透率配置
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
...@@ -31,12 +31,11 @@ ...@@ -31,12 +31,11 @@
<div class="table-wrapper"> <div class="table-wrapper">
<component :is="curParamsConfig.templateType" :config-index="configIndex"></component> <component :is="curParamsConfig.templateType" :config-index="configIndex"></component>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { last } from "lodash-es"; import { isObject, last } from "lodash-es";
import { mapState } from "vuex"; import { mapState } from "vuex";
import { paramConfigListTemplate } from "../performanceRuleSelection/options.js"; import { paramConfigListTemplate } from "../performanceRuleSelection/options.js";
import ParamsType1 from "./type1.vue"; import ParamsType1 from "./type1.vue";
...@@ -62,12 +61,19 @@ export default { ...@@ -62,12 +61,19 @@ export default {
...mapState("PerformanceFormStore", ["formData"]), ...mapState("PerformanceFormStore", ["formData"]),
curParamsConfig: { curParamsConfig: {
get() { get() {
console.log("this.formData.paramConfigList[this.configIndex]", this.formData.paramConfigList[this.configIndex]);
return this.formData.paramConfigList[this.configIndex]; return this.formData.paramConfigList[this.configIndex];
}, },
set(value) { set(value) {
this.formData.paramConfigList[this.configIndex] = value; this.formData.paramConfigList[this.configIndex] = value;
}, },
}, },
curParamsAssessFactorValue() {
if (isObject(this.curParamsConfig.assessmentFactor)) {
return this.curParamsConfig.assessmentFactor?.value;
}
return this.curParamsConfig.assessmentFactor;
},
}, },
mounted() { mounted() {
...@@ -90,10 +96,29 @@ export default { ...@@ -90,10 +96,29 @@ export default {
handleAppendTableRow() { handleAppendTableRow() {
const templateType = this.curParamsConfig.templateType; 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 lastPriceRange = last(this.curParamsConfig[templateType])?.priceRange || [0, 0];
const nPriceRange = [undefined, undefined]; const nPriceRange = [undefined, undefined];
if (lastPriceRange && lastPriceRange[1]) { if (lastPriceRange && lastPriceRange[1]) {
nPriceRange[0] = lastPriceRange[1] + (this.curParamsConfig.priceRangeProps.precision ? 1 : 0.01); nPriceRange[0] = lastPriceRange[1] + 0.01;
nPriceRange[1] = undefined; nPriceRange[1] = undefined;
} }
this.curParamsConfig[templateType].push({ this.curParamsConfig[templateType].push({
......
...@@ -99,6 +99,7 @@ export default { ...@@ -99,6 +99,7 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.param-config-type-2-condition-type { .param-config-type-2-condition-type {
padding-left: 10px;
> span.label { > span.label {
color: #666666; color: #666666;
font-size: 14px; font-size: 14px;
......
<template> <template>
<span class="param-config-type-2-condition-type"> <span class="param-config-type-2-condition-type">
<EditableText v-model="triggerCondition" <EditableText
:controls="false" v-model="triggerCondition"
type="number" :controls="false"
v-bind="getComponentsProp"> type="number"
</EditableText> v-bind="getComponentsProp"
<span class="label"> >
且 </EditableText>
</span> <span class="label"> 且 </span>
<span class="label"> <GoodsCategoryCascader
整体增加指标达成奖励 v-if="goodsCategory === 0"
</span> :config-index="configIndex"
<EditableText v-model="increaseReward" :index="row"
:controls="false" :value-path="'conditionType3.productValue'"
:max="999999" allowRepeat
:min="0" v-model="productValue"
:precision="2" @change="handleProductChange"
type="number"> />
</EditableText> <!-- 圈定套餐/商品 cascader -->
<span class="label"> <ProductDefineCascader
元 v-else
</span> v-model="productValue"
</span> :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> </template>
<script> <script>
import { mapState } from "vuex"; import { mapGetters, mapState } from "vuex";
import EditableText from "@/components/editableText/index.vue"; import EditableText from "@/components/editableText/index.vue";
import { commissionTypeEnum } from "../../performanceRuleSelection/options"; import { commissionTypeEnum } from "../../performanceRuleSelection/options";
import GoodsCategoryCascader from "../../goodsCategoryCascader/index.vue";
import ProductDefineCascader from "../../prodectDefine/index.vue";
export default { export default {
name: "", name: "",
components: { components: {
EditableText, EditableText,
GoodsCategoryCascader,
ProductDefineCascader,
}, },
props: { props: {
configIndex: { configIndex: {
...@@ -43,70 +63,85 @@ export default { ...@@ -43,70 +63,85 @@ export default {
type: Number, type: Number,
required: true, required: true,
}, },
}, },
data() { data() {
return { return {};
};
}, },
computed: { computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList"]), ...mapState("PerformanceFormStore", ["formData", "productDefineList"]),
// 商品选择项 ...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]),
getProductDefineListOptions() {
return this.productDefineList;
},
// 路径太长 简化 // 路径太长 简化
paramsType2CommissionTypes() { paramsType2CommissionTypes() {
return this.formData.paramConfigList[this.configIndex].ParamsType2CommissionTypes; return this.formData.paramConfigList[this.configIndex]
.ParamsType2CommissionTypes;
}, },
// 提成方式 的值 决定 的 组件传参 // 提成方式 的值 决定 的 组件传参
getComponentsProp() { 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: { triggerCondition: {
get() { 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) { 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: { productLabel: {
get() { 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) { 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: { productValue: {
get() { 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) { 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: { increaseReward: {
get() { 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) { 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: { methods: {
// TODO: 商品切换 // TODO: 商品切换
handleProductChange() { handleProductChange() {},
},
}, },
}; };
</script> </script>
...@@ -114,9 +149,9 @@ export default { ...@@ -114,9 +149,9 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.param-config-type-2-condition-type { .param-config-type-2-condition-type {
// overflow-x: auto; // overflow-x: auto;
// display: flex; display: flex;
// flex-wrap: nowrap; // flex-wrap: nowrap;
// align-items: center; align-items: center;
> span.label { > span.label {
color: #666666; color: #666666;
font-size: 14px; font-size: 14px;
......
<template> <template>
<span class="param-config-type-2-condition-type"> <span class="param-config-type-2-condition-type">
<EditableText v-model="triggerCondition" <EditableText
:controls="false" v-model="triggerCondition"
type="number" :controls="false"
v-bind="getComponentsProp"> type="number"
</EditableText> v-bind="getComponentsProp"
<span class="label"> >
且 </EditableText>
</span> <span class="label"> 且 </span>
<span class="label"> <!-- 品类cascader -->
提出 <GoodsCategoryCascader
</span> v-if="goodsCategory === 0"
<el-cascader v-model="productValue" :config-index="configIndex"
:options="getProductDefineListOptions" :index="row"
:show-all-levels="false" :value-path="'conditionType4.productValue'"
@change="handleProductChange"> :conflict-paths="[
</el-cascader> 'conditionType4.productValue',
<span class="label"> 'conditionType4.productValue1',
的订单计算提出 ]"
</span> allowRepeat
</span> 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> </template>
<script> <script>
import { mapState } from "vuex"; import { mapGetters, mapState } from "vuex";
import EditableText from "@/components/editableText/index.vue"; import EditableText from "@/components/editableText/index.vue";
import { commissionTypeEnum } from "../../performanceRuleSelection/options"; import { commissionTypeEnum } from "../../performanceRuleSelection/options";
import GoodsCategoryCascader from "../../goodsCategoryCascader/index.vue";
import ProductDefineCascader from "../../prodectDefine/index.vue";
export default { export default {
name: "", name: "",
components: { components: {
EditableText, EditableText,
GoodsCategoryCascader,
ProductDefineCascader,
}, },
props: { props: {
configIndex: { configIndex: {
...@@ -41,61 +91,73 @@ export default { ...@@ -41,61 +91,73 @@ export default {
type: Number, type: Number,
required: true, required: true,
}, },
}, },
data() { data() {
return { return {};
};
}, },
computed: { computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList"]), ...mapState("PerformanceFormStore", ["formData", "productDefineList"]),
// 商品选择项 ...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]),
getProductDefineListOptions() {
return this.productDefineList;
},
// 路径太长 简化 // 路径太长 简化
paramsType2CommissionTypes() { paramsType2CommissionTypes() {
return this.formData.paramConfigList[this.configIndex].ParamsType2CommissionTypes; return this.formData.paramConfigList[this.configIndex]
.ParamsType2CommissionTypes;
}, },
// 提成方式 的值 决定 的 组件传参 // 提成方式 的值 决定 的 组件传参
getComponentsProp() { getComponentsProp() {
return this.paramsType2CommissionTypes ? commissionTypeEnum[this.paramsType2CommissionTypes].componentProps : {}; return this.paramsType2CommissionTypes
? commissionTypeEnum[this.paramsType2CommissionTypes]
.componentProps
: {};
}, },
triggerCondition: { triggerCondition: {
get() { 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) { 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: { productValue: {
get() { 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) { 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: { productValue1: {
get() { 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) { 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: { methods: {
// TODO: 商品切换 // TODO: 商品切换
handleProductChange() { handleProductChange() {},
},
}, },
}; };
</script> </script>
...@@ -103,9 +165,9 @@ export default { ...@@ -103,9 +165,9 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.param-config-type-2-condition-type { .param-config-type-2-condition-type {
// overflow-x: auto; // overflow-x: auto;
// display: flex; display: flex;
// flex-wrap: nowrap; // flex-wrap: nowrap;
// align-items: center; align-items: center;
> span.label { > span.label {
color: #666666; color: #666666;
font-size: 14px; font-size: 14px;
......
...@@ -53,7 +53,8 @@ ...@@ -53,7 +53,8 @@
<el-form-item label="商品分类:" <el-form-item label="商品分类:"
prop="goodsConfigTypes"> prop="goodsConfigTypes">
<el-checkbox-group v-model="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 label="0">
品类 品类
</el-checkbox> </el-checkbox>
...@@ -65,6 +66,20 @@ ...@@ -65,6 +66,20 @@
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </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" <DefineProductsDialog v-if="dialog.defineProducts.visible"
:define-visible="dialog.defineProducts.visible" :define-visible="dialog.defineProducts.visible"
@dialogClose="handleDefineProductsDialogClose" /> @dialogClose="handleDefineProductsDialogClose" />
...@@ -102,7 +117,7 @@ export default { ...@@ -102,7 +117,7 @@ export default {
commissionMapping: { commissionMapping: {
GMV: "BL", // GMV产值 <-> 比例 GMV: "BL", // GMV产值 <-> 比例
DDTC: "XS", // 单店总提成 <-> 系数 DDTC: "XS", // 单店总提成 <-> 系数
DDSL: "GDJE", // 升级订单数 <-> 固定金额 SJDDS: "GDJE", // 升级订单数 <-> 固定金额
}, },
}; };
}, },
...@@ -111,16 +126,16 @@ export default { ...@@ -111,16 +126,16 @@ export default {
...mapState("PerformanceFormStore", ["formData"]), ...mapState("PerformanceFormStore", ["formData"]),
assessmentFactorValue: bindFormFields("assessmentFactorValue"), assessmentFactorValue: bindFormFields("assessmentFactorValue"),
assessmentFactor: bindFormFields("assessmentFactor"), assessmentFactor: bindFormFields("assessmentFactor"),
checkList: bindFormFields("checkList"),
commissionBases: bindFormFields("commissionBases"), commissionBases: bindFormFields("commissionBases"),
commissionTypes: bindFormFields("commissionTypes"), commissionTypes: bindFormFields("commissionTypes"),
goodsConfigTypes: bindFormFields("goodsConfigTypes"), goodsConfigTypes: bindFormFields("goodsConfigTypes"),
paramConfigList: bindFormFields("paramConfigList"), paramConfigList: bindFormFields("paramConfigList"),
businessType: bindFormFields("businessType"),
}, },
watch: { watch: {
commissionTypes(newVal) { commissionTypes(newVal) {
// TODO: 还需要清空下方表格所有提成方式的值 // TODO: 还需要清空下方表格所有提成方式的值
// this.setCommissionTypesOptions(newVal); this.setCommissionTypesOptions(newVal);
}, },
}, },
mounted() { mounted() {
...@@ -128,6 +143,15 @@ export default { ...@@ -128,6 +143,15 @@ export default {
methods: { methods: {
...mapMutations("PerformanceFormStore", ["setProductDefineList", "touchAssessment", "setCommissionTypesOptions", "setCommissionBases", "setCommissionTypes"]), ...mapMutations("PerformanceFormStore", ["setProductDefineList", "touchAssessment", "setCommissionTypesOptions", "setCommissionBases", "setCommissionTypes"]),
handleGoodsConfigTypesGroupChange(e) {
if (e.length === 1) {
// TODO: 强力设置表格内的所有goodType
}
// 只验证当前字段
this.validateCurrentField("goodsConfigTypes");
},
/** /**
* 更新关联的复选框 * 更新关联的复选框
* @param {Array} currentValues 当前变化的值 * @param {Array} currentValues 当前变化的值
...@@ -187,6 +211,8 @@ export default { ...@@ -187,6 +211,8 @@ export default {
this.setCommissionTypes(newTypes); this.setCommissionTypes(newTypes);
this.$nextTick(() => { this.$nextTick(() => {
this.isUpdating = false; this.isUpdating = false;
// 只验证当前字段
this.validateCurrentField("commissionBases");
}); });
}, },
...@@ -199,6 +225,8 @@ export default { ...@@ -199,6 +225,8 @@ export default {
this.setCommissionBases(newBases); this.setCommissionBases(newBases);
this.$nextTick(() => { this.$nextTick(() => {
this.isUpdating = false; this.isUpdating = false;
// 只验证当前字段
this.validateCurrentField("commissionTypes");
}); });
}, },
...@@ -206,6 +234,20 @@ export default { ...@@ -206,6 +234,20 @@ export default {
// 根据 value 数组从 assessmentFactorOptions 中找出对应的完整项 // 根据 value 数组从 assessmentFactorOptions 中找出对应的完整项
const selectedItems = this.assessmentFactorOptions.filter(item => value.includes(item.value)); const selectedItems = this.assessmentFactorOptions.filter(item => value.includes(item.value));
this.touchAssessment(selectedItems); 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 @@ ...@@ -13,11 +13,12 @@
</el-date-picker> </el-date-picker>
</el-form-item> --> </el-form-item> -->
<d2-table v-if="selectedMerchantsList.length > 0" <d2-table v-if="merchantBrandRefList.length > 0"
ref="selectedMerTable" ref="selectedMerTable"
:has-page="false" :has-page="false"
:search-form="{}" :search-form="{}"
:table-data="selectedMerchantsList" style="padding-left:170px;margin-bottom:14px"
:table-data="merchantBrandRefList"
:table-params="tableParams"> :table-params="tableParams">
<template #auth-button="scope"> <template #auth-button="scope">
<div> <div>
...@@ -29,9 +30,19 @@ ...@@ -29,9 +30,19 @@
</div> </div>
</template> </template>
</d2-table> </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" <el-dialog v-if="dialog.storeApply.visible"
:before-close="handleCloseDialog" :before-close="handleCloseDialog"
:close-on-click-modal="false"
custom-class="store-select-dialog" custom-class="store-select-dialog"
:title="dialog.storeApply.title" :title="dialog.storeApply.title"
:visible.sync="dialog.storeApply.visible" :visible.sync="dialog.storeApply.visible"
...@@ -68,7 +79,6 @@ export default { ...@@ -68,7 +79,6 @@ export default {
visible: false, visible: false,
}, },
}, },
selectedMerchantsList: [],
tableParams: { tableParams: {
listName: "list", listName: "list",
tableOption: true, tableOption: true,
...@@ -99,14 +109,38 @@ export default { ...@@ -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: { computed: {
...mapGetters("PerformanceFormStore", ["getMerchantBrandRefList"]), ...mapState("PerformanceFormStore", ["merchantBrandRefList", "formData"]),
effectiveMonth: {
get() {
return this.formData.effectiveMonth;
},
set(value) {
this.formData.effectiveMonth = value;
},
},
}, },
async mounted() { async mounted() {
this.selectedMerchantsList = this.getMerchantBrandRefList || [];
console.log(this.selectedMerchantsList, "0000");
}, },
methods: { methods: {
...mapMutations("PerformanceFormStore", ["setMerchantBrandRefList"]), ...mapMutations("PerformanceFormStore", ["setMerchantBrandRefList"]),
...@@ -118,36 +152,32 @@ export default { ...@@ -118,36 +152,32 @@ export default {
}, },
handleDeleteMer(row, idx) { handleDeleteMer(row, idx) {
this.selectedMerchantsList.splice(idx, 1); this.merchantBrandRefList.splice(idx, 1);
this.setMerchantBrandRefList(deepClone(this.selectedMerchantsList));
}, },
handleDialogConfirm() { handleDialogConfirm() {
console.log(this.$refs.storeSelect.selectedMerchants); const selectedMerchantList = Object.keys(this.$refs.storeSelect.selectedMerchants).map(key => this.$refs.storeSelect.selectedMerchants[key]) || [];
this.selectedMerchantsList = Object.keys(this.$refs.storeSelect.selectedMerchants).map(key => this.$refs.storeSelect.selectedMerchants[key]) || []; if (selectedMerchantList.length === 0) {
console.log(this.selectedMerchantsList);
if (this.selectedMerchantsList.length === 0) {
this.$message({ this.$message({
message: "请选择门店及品牌", message: "请选择门店及品牌",
type: "warning", type: "warning",
}); });
return; return;
} }
// let list = [] this.setMerchantBrandRefList(deepClone(selectedMerchantList));
// 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.changeStoreApplyVisible(); this.changeStoreApplyVisible();
}, },
handleEffectiveMonthChange() {
// 只验证当前字段
this.validateCurrentField("effectiveMonth");
},
// 验证当前字段(只验证单个字段,不触发全表单验证)
validateCurrentField(prop) {
// 通过 $parent 访问父组件的表单引用
const form = this.$parent?.$refs?.form;
if (form && !this.$parent?.shouldValidateAll) {
form.validateField(prop, () => {});
}
},
}, },
}; };
</script> </script>
......
import { groupBy } from "lodash"; import { groupBy } from "lodash";
import { assessmentFactorOptions } from "../components/performanceRuleSelection/options"; import { assessmentFactorOptions } from "../components/performanceRuleSelection/options";
import { setBackendAllGoods, setBackendConditionGoods, setBackendGoods } from "./help";
export function convertBackendToData(data) { export function convertBackendToData(data) {
// merchantBrandModelPageBrands merchantBrandRefList 接口返回的字段不一样
const { merchantBrandRefList, paramConfigList, performanceConfigRule, ...lists } = data; const { merchantBrandRefList, paramConfigList, performanceConfigRule, ...lists } = data;
const response = { const response = {
...lists, ...lists,
...handlePerformanceConfigRule(performanceConfigRule),
merchantBrandRefList: dealInterfaceBrand(merchantBrandRefList), merchantBrandRefList: dealInterfaceBrand(merchantBrandRefList),
paramConfigList: coverParamConfigList(paramConfigList), paramConfigList: coverParamConfigList(paramConfigList),
}; };
return response; 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 = { const templateType = {
1: "ParamsType1", 1: "ParamsType1",
...@@ -23,9 +40,10 @@ const tableEnum = { ...@@ -23,9 +40,10 @@ const tableEnum = {
// { productLabel: [], productValue: [], optionList: [] }, // { productLabel: [], productValue: [], optionList: [] },
], ],
ParamsType1: [], ParamsType1: [],
ParamsType2CommissionTypes: undefined,
ParamsType2: [], ParamsType2: [],
priceRangeProps: [], priceRangeProps: [],
assessmentFactor: {}, assessmentFactor: undefined,
sort: -1, sort: -1,
}; };
...@@ -41,10 +59,8 @@ export function coverParamConfigList(paramConfigList) { ...@@ -41,10 +59,8 @@ export function coverParamConfigList(paramConfigList) {
const tableList = groupBy(paramConfigList, "assessmentFactor"); const tableList = groupBy(paramConfigList, "assessmentFactor");
const _paramConfigList = []; const _paramConfigList = [];
console.log("tableList", tableList);
if (tableList && Object.keys(tableList).length) { if (tableList && Object.keys(tableList).length) {
for (let tableIndex in tableList) { for (const tableIndex in tableList) {
console.log("table");
const tableItem = tableList[tableIndex][0]; const tableItem = tableList[tableIndex][0];
const table = tableList[tableIndex]; const table = tableList[tableIndex];
// 因为每一个table的数据是一样的,所以直接取0位 // 因为每一个table的数据是一样的,所以直接取0位
...@@ -52,67 +68,101 @@ export function coverParamConfigList(paramConfigList) { ...@@ -52,67 +68,101 @@ export function coverParamConfigList(paramConfigList) {
baseTable.title = getAssessmentFactorOptionsTitle(tableItem.assessmentFactor)?.label; // 找enum baseTable.title = getAssessmentFactorOptionsTitle(tableItem.assessmentFactor)?.label; // 找enum
baseTable.templateType = templateType[tableList[tableIndex][0].templateType]; baseTable.templateType = templateType[tableList[tableIndex][0].templateType];
baseTable.goodsCategory = tableList[tableIndex][0].goodsConfigType; baseTable.goodsCategory = tableList[tableIndex][0].goodsConfigType;
baseTable.assessmentFactor = Number(tableIndex);
if (baseTable.templateType === "ParamsType2") {
baseTable.ParamsType2CommissionTypes = tableList[tableIndex][0].commissionType;
}
console.log("baseTable", baseTable); console.log("baseTable", baseTable);
const rowTable = groupBy(tableList[tableIndex], item => String(item.startValue) + String(item.endValue)); 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)); const colTable = groupBy(table, item => String(item.goodsType) + String(item.secondaryGoodsType) + String(item.thirdLevelGoodsType));
Object.keys(colTable).forEach((colIndex, colEachIndex) => { // 整理ParamsType1Products
const colItem = colTable[colIndex][colEachIndex]; if (baseTable.templateType === "ParamsType1") {
const paramsTypeProductsItem = { Object.keys(colTable).forEach((colIndex, colEachIndex) => {
productLabel: [colItem.goodsType], const colItem = colTable[colIndex][colEachIndex];
productValue: [], const paramsTypeProductsItem = {
optionList: [], 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); Object.keys(rowTable).forEach((rowIndex, rowEachIndex) => {
colItem.thirdLevelGoodsType && paramsTypeProductsItem.productLabel.push(colItem.thirdLevelGoodsType); console.log("rowTable", rowTable);
console.log("rowIndex", rowIndex);
console.log("rowEachIndex", rowEachIndex);
Object.keys(rowTable).forEach((rowIndex, rowEachIndex) => { const rowItem = rowTable[rowIndex][0];
const rowItem = rowTable[rowIndex][rowEachIndex]; paramsTypeProductsItem.productValue.push(rowItem?.commissionTypeValue);
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) => { Object.keys(rowTable).forEach((rowIndex, rowEachIndex) => {
// 整理 ParamsType1
console.log("hang", rowTable[rowIndex]); console.log("hang", rowTable[rowIndex]);
const rowItem = rowTable[rowIndex][0]; const rowItem = rowTable[rowIndex][0];
if (baseTable.templateType === "ParamsType1") { if (baseTable.templateType === "ParamsType1") {
console.log(333, rowItem.startValue, rowItem.endValue);
baseTable.ParamsType1.push({ baseTable.ParamsType1.push({
priceRange: [rowItem.startValue, rowItem.endValue], priceRange: [rowItem.startValue, rowItem.endValue],
commissionTypes: rowItem.commissionType, 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)); if (conditionType === 0) {
// for (let productColIndex in colTable) { paramsType2Item.conditionType0 = rowItem.commissionTypeValue;
// const colItem = colTable[productColIndex][0]; } else {
// if (!baseTable.ParamsType1Products[rowEachIndex]) { paramsType2Item[conditionKey] = {
// baseTable.ParamsType1Products[rowEachIndex] = { triggerCondition: rowItem.commissionTypeValue,
// productLabel: [colItem.goodsType, colItem.secondaryGoodsType, colItem.thirdLevelGoodsType], productValue: [],
// productValue: [colItem.commissionTypeValue], };
// optionList: [], setBackendConditionGoods(rowItemParamConfig[0], paramsType2Item[conditionKey], "productValue");
// };
// } else { // 到这里 conditionType4 已经解决
// baseTable.ParamsType1Products[rowEachIndex].productValue.push(colItem.commissionTypeValue); 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); _paramConfigList.push(baseTable);
// handleParamsType1Product(tableList[tableIndex]);
} }
} }
console.log("即将返回出去的 _paramConfigList", _paramConfigList);
return _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"; import store from "@/store";
const commissionTypesCoverCommissionBase = { const commissionTypesCoverCommissionBase = {
...@@ -13,9 +13,12 @@ export function convertDataToBackend(formData) { ...@@ -13,9 +13,12 @@ export function convertDataToBackend(formData) {
const { paramConfigList, merchantBrandRefList, ...data } = formData; const { paramConfigList, merchantBrandRefList, ...data } = formData;
const requestData = { const requestData = {
schemaName: data.schemaName,
// 注意是scheme
schemeName: data.schemeName,
schemeType: data.schemeType,
businessType: data.businessType, businessType: data.businessType,
effectiveMonth: data.storeConfig.effectiveMonth, effectiveMonth: data.effectiveMonth,
performanceConfigRule: { performanceConfigRule: {
assessmentFactors: data.assessmentFactorValue.join(","), assessmentFactors: data.assessmentFactorValue.join(","),
commissionBases: data.commissionBases.join(","), commissionBases: data.commissionBases.join(","),
...@@ -25,6 +28,9 @@ export function convertDataToBackend(formData) { ...@@ -25,6 +28,9 @@ export function convertDataToBackend(formData) {
paramConfigList: [], paramConfigList: [],
merchantBrandRefList: [], merchantBrandRefList: [],
}; };
if (data.originPerformanceConfigId) {
requestData.originPerformanceConfigId = data.originPerformanceConfigId;
}
for (const paramConfig of paramConfigList) { for (const paramConfig of paramConfigList) {
// 每一份表格 // 每一份表格
const { templateType, ParamsType1, ParamsType1Products, ParamsType2 } = paramConfig; const { templateType, ParamsType1, ParamsType1Products, ParamsType2 } = paramConfig;
...@@ -34,7 +40,7 @@ export function convertDataToBackend(formData) { ...@@ -34,7 +40,7 @@ export function convertDataToBackend(formData) {
coverParamsType1(ParamsType1, ParamsType1Products, (item, { rowItem, row }, { productColItem, colIndex }) => { coverParamsType1(ParamsType1, ParamsType1Products, (item, { rowItem, row }, { productColItem, colIndex }) => {
requestData.paramConfigList.push({ requestData.paramConfigList.push({
...item, ...item,
assessmentFactor: paramConfig.assessmentFactor.value, assessmentFactor: isObject(paramConfig.assessmentFactor) ? paramConfig.assessmentFactor.value : paramConfig.assessmentFactor,
goodsConfigType: paramConfig.goodsCategory, goodsConfigType: paramConfig.goodsCategory,
commissionTypeValue: productColItem.productValue[row], commissionTypeValue: productColItem.productValue[row],
...paramConfig.goodsCategory === 0 ...paramConfig.goodsCategory === 0
...@@ -50,7 +56,7 @@ export function convertDataToBackend(formData) { ...@@ -50,7 +56,7 @@ export function convertDataToBackend(formData) {
...result, ...result,
commissionType: paramConfig.ParamsType2CommissionTypes, commissionType: paramConfig.ParamsType2CommissionTypes,
commissionBase: commissionTypesCoverCommissionBase[paramConfig.ParamsType2CommissionTypes], commissionBase: commissionTypesCoverCommissionBase[paramConfig.ParamsType2CommissionTypes],
assessmentFactor: paramConfig.assessmentFactor.value, assessmentFactor: isObject(paramConfig.assessmentFactor) ? paramConfig.assessmentFactor.value : paramConfig.assessmentFactor,
goodsConfigType: paramConfig.goodsCategory, goodsConfigType: paramConfig.goodsCategory,
...paramConfig.goodsCategory === 0 ...paramConfig.goodsCategory === 0
? buildGoodsTypePayload(goodsCategory, paramsType2Item.productLabel) ? buildGoodsTypePayload(goodsCategory, paramsType2Item.productLabel)
...@@ -60,8 +66,11 @@ export function convertDataToBackend(formData) { ...@@ -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; return requestData;
} }
...@@ -78,10 +87,15 @@ function getPerformanceParamConfigConditions(paramsType2Item, paramsConfig) { ...@@ -78,10 +87,15 @@ function getPerformanceParamConfigConditions(paramsType2Item, paramsConfig) {
level2Name: "conditionSecondaryGoodsTypeName", level2Name: "conditionSecondaryGoodsTypeName",
level3Name: "conditionThirdLevelGoodsTypeName", level3Name: "conditionThirdLevelGoodsTypeName",
}; };
const buildProductDefinePayloadOptions = {
id: "conditionProductDefineId",
name: "conditionProductDefineName",
type: "conditionGoodsConfigType",
};
console.log("paramsConfigdddsss", paramsConfig);
const conditionItem = [{ const conditionItem = [{
conditionType: paramsType2Item.condition, conditionType: paramsType2Item.condition,
// conditionGoodsConfigType: paramsConfig.goodsCategory, conditionGoodsConfigType: paramsConfig.goodsCategory,
// conditionStartValue: "", // conditionStartValue: "",
// conditionEndValue: "", // conditionEndValue: "",
}]; }];
...@@ -94,21 +108,40 @@ function getPerformanceParamConfigConditions(paramsType2Item, paramsConfig) { ...@@ -94,21 +108,40 @@ function getPerformanceParamConfigConditions(paramsType2Item, paramsConfig) {
const conditionParamsData = paramsType2Item[`conditionType${paramsType2Item.condition}`]; const conditionParamsData = paramsType2Item[`conditionType${paramsType2Item.condition}`];
// 如果 conditionParamsData 不存在,直接返回空的 conditionItem
if (!conditionParamsData) {
return conditionItem;
}
if (paramsType2Item.condition === 1) { 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.conditionStartValue = conditionParamsData.permeabilityMin;
extend.conditionEndValue = conditionParamsData.permeabilityMax; extend.conditionEndValue = conditionParamsData.permeabilityMax;
extend = { extend = {
...extend, ...extend,
...paramsConfig.goodsCategory === 0 ...paramsConfig.goodsCategory === 0
? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue, buildGoodsTypePayloadOptions) ? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue || [], buildGoodsTypePayloadOptions)
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue), : buildProductDefinePayload(productDefineList, conditionParamsData.productValue || [], buildProductDefinePayloadOptions),
}; };
conditionItem.push({ conditionItem.push({
conditionType: paramsType2Item.condition,
conditionStartValue: conditionParamsData.permeabilityMin1, conditionStartValue: conditionParamsData.permeabilityMin1,
conditionEndValue: conditionParamsData.permeabilityMax1, conditionEndValue: conditionParamsData.permeabilityMax1,
conditionGoodsConfigType: paramsConfig.goodsCategory,
...paramsConfig.goodsCategory === 0 ...paramsConfig.goodsCategory === 0
? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue1, buildGoodsTypePayloadOptions) ? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue1 || [], buildGoodsTypePayloadOptions)
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue1), : buildProductDefinePayload(productDefineList, conditionParamsData.productValue1 || [], buildProductDefinePayloadOptions),
}); });
} }
if (paramsType2Item.condition === 2) { if (paramsType2Item.condition === 2) {
...@@ -119,19 +152,36 @@ function getPerformanceParamConfigConditions(paramsType2Item, paramsConfig) { ...@@ -119,19 +152,36 @@ function getPerformanceParamConfigConditions(paramsType2Item, paramsConfig) {
extend.conditionCommissionTypeValue = conditionParamsData.increaseReward; extend.conditionCommissionTypeValue = conditionParamsData.increaseReward;
} }
if (paramsType2Item.condition === 4) { if (paramsType2Item.condition === 4) {
extend extend = {
= paramsConfig.goodsCategory === 0 ...extend,
? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue, buildGoodsTypePayloadOptions) ...paramsConfig.goodsCategory === 0
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue); ? buildGoodsTypePayload(goodsCategory, conditionParamsData.productValue || [], buildGoodsTypePayloadOptions)
: buildProductDefinePayload(productDefineList, conditionParamsData.productValue || [], buildProductDefinePayloadOptions),
};
} }
conditionItem[0] = { conditionItem[0] = {
...conditionItem[0], ...conditionItem[0],
...extend, ...extend,
}; };
return conditionItem; 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 currentLevel = tree;
let targetNode = null; let targetNode = null;
...@@ -143,8 +193,9 @@ function buildProductDefinePayload(tree, pathIds) { ...@@ -143,8 +193,9 @@ function buildProductDefinePayload(tree, pathIds) {
} }
return { return {
productDefineId: targetNode?.id ?? null, [options.id]: targetNode?.id ?? null,
productDefineName: targetNode?.label ?? null, [options.name]: targetNode?.label ?? null,
[options.type]: targetNode?.defineType,
}; };
} }
...@@ -158,10 +209,19 @@ function buildGoodsTypePayload(tree, pathIds, options = { ...@@ -158,10 +209,19 @@ function buildGoodsTypePayload(tree, pathIds, options = {
}) { }) {
const result = {}; const result = {};
let currentLevel = tree;
// 如果 pathIds 不存在或不是数组,返回空对象
if (!pathIds || !Array.isArray(pathIds) || pathIds.length === 0) {
return result;
}
pathIds.forEach((id, index) => { 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) if (!node)
return; return;
...@@ -175,12 +235,22 @@ function buildGoodsTypePayload(tree, pathIds, options = { ...@@ -175,12 +235,22 @@ function buildGoodsTypePayload(tree, pathIds, options = {
result[options.level3Id] = node.categoryType; result[options.level3Id] = node.categoryType;
result[options.level3Name] = node.categoryName; result[options.level3Name] = node.categoryName;
} }
currentLevel = node.children || [];
}); });
return result; 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) { function coverParamsType1(ParamsType1, ParamsType1Products, fn) {
ParamsType1.forEach((rowItem, row) => { ParamsType1.forEach((rowItem, row) => {
...@@ -200,10 +270,11 @@ function coverParamsType1(ParamsType1, ParamsType1Products, fn) { ...@@ -200,10 +270,11 @@ function coverParamsType1(ParamsType1, ParamsType1Products, fn) {
}); });
} }
// 整理商户品牌数据
function coverParamsType2(ParamsType2, fn) { function coverParamsType2(ParamsType2, fn) {
ParamsType2.forEach((rowItem, rowIndex) => { ParamsType2.forEach((rowItem, rowIndex) => {
const result = { const result = {
templateType: 1, templateType: 2,
startValue: rowItem.priceRange[0], startValue: rowItem.priceRange[0],
endValue: rowItem.priceRange[1], endValue: rowItem.priceRange[1],
commissionTypeValue: rowItem.condition === 0 ? rowItem.conditionType0 : rowItem[`conditionType${rowItem.condition}`].triggerCondition, commissionTypeValue: rowItem.condition === 0 ? rowItem.conditionType0 : rowItem[`conditionType${rowItem.condition}`].triggerCondition,
...@@ -240,7 +311,7 @@ function buildMerchantBrandPayload( ...@@ -240,7 +311,7 @@ function buildMerchantBrandPayload(
brandName: brand.brandName, brandName: brand.brandName,
childId: brand.childId, childId: brand.childId,
childName: brand.childName, 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!