Commit 6c8a30dd by Jaxon

Merge remote-tracking branch 'origin/SAAS+V5.6.1' into feature/salaryPerformance

# Conflicts:
#	src/views/residentManage/salaryPerformance/components/planList.vue
2 parents ca85503a 2cef9fad
......@@ -1826,7 +1826,6 @@ export const paymentMethodOpt = [
export const statusList = [
{ confId: 2, confValue: "生效" },
{ confId: 1, confValue: "审批中" },
{ confId: 0, confValue: "草稿" },
{ confId: 3, confValue: "未生效" }
]
......
......@@ -367,6 +367,19 @@ export const rangePickerOptions_outputValue = {
}
/**
* 时间控件-限制只能选当前年份的上一年1月1日至今
*/
export const rangePickerOptions_lastOneYear = {
disabledDate(date) {
const now = new Date()
const lastYearStart = new Date(now.getFullYear() - 1, 0, 1)
lastYearStart.setHours(0, 0, 0, 0)
// 禁用:大于今天 OR 小于去年1月1日
return date > now || date < lastYearStart
}
}
/**
* 店面配置-门店主机厂交付数/个人交付成交率
* 限制:当前日期>10号‌:仅允许选择当前月份;当前日期≤10号‌:允许选择当前月份和上个月;其他情况‌:禁用所有其他月份‌
*/
......
......@@ -195,7 +195,8 @@ import {
rangePickerOptions_30day2,
todayEndPickerOptions,
rangePickertwoMonthOptions,
rangePickertwoMonthOptionsWithCurrentLimit
rangePickertwoMonthOptionsWithCurrentLimit,
rangePickerOptions_lastOneYear
} from "@/common/format"
export default {
name: "D2Search",
......@@ -208,7 +209,8 @@ export default {
todayEndPickerOptions: todayEndPickerOptions,
rangePickertwoMonthOptions: rangePickertwoMonthOptions,
rangePickertwoMonthOptionsWithCurrentLimit:
rangePickertwoMonthOptionsWithCurrentLimit
rangePickertwoMonthOptionsWithCurrentLimit,
rangePickerOptions_lastOneYear: rangePickerOptions_lastOneYear
}
}
},
......
import { BrowserTracing } from "@sentry/tracing";
// 接入sentry
import * as Sentry from "@sentry/vue";
import { Request } from "glsk-toolkit";
// Vue
import Vue from "vue";
// import { GLCombiForm } from "glsx-components" // 权限按钮 (根据权限动态创建)
import VueLazyload from "vue-lazyload";
import { config } from "@/common/baseConfig";
import GLMapSdk from "@/common/glsk-mapapi-sdk";
import notice from "@/common/notice";
import util from "@/libs/util.js";
// 针对template模板中使用可选链操作符
import chaining from "@/plugin/chaining";
// 核心插件
import d2Admin from "@/plugin/d2admin";
// store
import store from "@/store/index";
import Vue from "vue"
// import axios from 'axios'
// import i18n from './i18n'
import App from "./App";
import App from "./App"
// 核心插件
import d2Admin from "@/plugin/d2admin"
// store
import store from "@/store/index"
// 针对template模板中使用可选链操作符
import chaining from "@/plugin/chaining"
// 接入sentry
import * as Sentry from "@sentry/vue"
import { BrowserTracing } from "@sentry/tracing"
// import D2Crud from '@d2-projects/d2-crud'
// 菜单和路由设置
import router from "./router";
import "default-passive-events";
import "element-ui/lib/theme-chalk/index.css";
import router from "./router"
import "default-passive-events"
import notice from "@/common/notice"
import "element-ui/lib/theme-chalk/index.css"
import { config } from "@/common/baseConfig"
import GLMapSdk from "@/common/glsk-mapapi-sdk"
// import { GLCombiForm } from "glsx-components" // 权限按钮 (根据权限动态创建)
import VueLazyload from "vue-lazyload"
import { Request } from "glsk-toolkit"
import util from "@/libs/util.js"
Vue.prototype.$mapapi = new GLMapSdk();
Vue.prototype.$mapapi = new GLMapSdk()
Vue.use(VueLazyload, {
// 懒加载默认加载图片
loading:
// 懒加载默认加载图片
loading:
"https://img02.glsx.com.cn/weapp/resource/saas/dj/images/img_loading.png",
attempt: 3, // 尝试加载次数
});
attempt: 3 // 尝试加载次数
})
// 实例化
process.env.NODE_ENV === "production"
&& Sentry.init({
Vue,
dsn: "https://39bc80d3bb0a419a8d7d9bf5a39678e3@sentry.glsx.com.cn/24",
// dsn: 'http://6225fb8e73fb453a8455a9371f3517da@192.168.3.115:9000/4',
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ["localhost", "my-site-url.com", /^\//],
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
logErrors: true,
// 解决火狐浏览器 无法捕获错误的问题
beforeSend(event, hint) {
const isNonErrorException
= event.exception.values[0].value.startsWith(
"Non-Error exception captured",
)
|| hint.originalException.message.startsWith(
"Non-Error exception captured",
);
if (isNonErrorException) {
// We want to ignore those kind of errors
return null;
}
return event;
},
// "send-default-pii": true
});
process.env.NODE_ENV === "production" &&
Sentry.init({
Vue,
dsn: "https://39bc80d3bb0a419a8d7d9bf5a39678e3@sentry.glsx.com.cn/24",
// dsn: 'http://6225fb8e73fb453a8455a9371f3517da@192.168.3.115:9000/4',
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ["localhost", "my-site-url.com", /^\//]
})
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
logErrors: true,
// 解决火狐浏览器 无法捕获错误的问题
beforeSend(event, hint) {
const isNonErrorException =
event.exception.values[0].value.startsWith(
"Non-Error exception captured"
) ||
hint.originalException.message.startsWith(
"Non-Error exception captured"
)
if (isNonErrorException) {
// We want to ignore those kind of errors
return null
}
return event
}
// "send-default-pii": true
})
// d2Admin 已导入
// import ElementUI from 'element-ui'
// Vue.use(ElementUI)
// 核心插件
Vue.use(d2Admin);
Vue.use(chaining);
Vue.use(d2Admin)
Vue.use(chaining)
// Vue.use(GLCombiForm)
Vue.prototype.notice = notice;
Vue.prototype.notice = notice
const isProd = process.env.NODE_ENV === "production";
const isProd = process.env.NODE_ENV === "production"
// console.log(isProd)
if (!isProd) {
Vue.config.devtools = true;
Vue.config.devtools = true
}
Vue.prototype.$EventBus = new Vue();
Vue.prototype.$EventBus = new Vue()
Vue.directive("preventReClick", {
bind: (el, binding) => {
let time = binding.value; // 防抖时间
if (!time) {
// 用户若不设置防抖时间,则默认1s
time = 1000;
}
let fun;
el.addEventListener(
"click",
(event) => {
if (!fun) {
// 第一次执行
fun = setTimeout(() => {
fun = null;
}, time);
} else {
// 直接取消当前事件
event && event.stopImmediatePropagation();
}
},
true,
);
},
});
let baseConfig = config;
bind: (el, binding) => {
let time = binding.value // 防抖时间
if (!time) {
// 用户若不设置防抖时间,则默认1s
time = 1000
}
let fun
el.addEventListener(
"click",
(event) => {
if (!fun) {
// 第一次执行
fun = setTimeout(() => {
fun = null
}, time)
} else {
// 直接取消当前事件
event && event.stopImmediatePropagation()
}
},
true
)
}
})
let baseConfig = config
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
fetch(
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config",
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config"
)
.then(
(response) => {
// 处理http响应
return response.json();
},
(error) => {
// 处理错误
console.log(error);
},
)
.then((response) => {
const { code, data } = response;
console.log("response", code, response);
if (code == "200") {
console.log(data);
baseConfig = data;
// console.log("baseConfig", baseConfig)
// window.$fetchConfig = data
} else {
baseConfig = response;
window.$fetchConfig = response;
console.log(response);
window.$gscApi = new Request({
...response.gsc,
// baseURL:'http://192.168.3.145:9898/gsc-vcp-web-facade',
// baseURL: 'http://gsc.test.glsx.com.cn/gsc-vcp-web-facade',
session: {
requiresSession: true,
sessionId: _ => util.cookies.get("token"),
},
events: {
error: (error, config) => {
Vue.prototype.$message.error(error.msg);
},
logout: (response, config) => {
store.dispatch("d2admin/user/clear");
util.cookies.remove("token");
router.replace("/login");
Vue.prototype.$message.error("登录超时,请重新登录");
},
},
});
console.log(window.$gscApi, "========");
}
})
.finally(() => {
init();
});
.then(
(response) => {
// 处理http响应
return response.json()
},
(error) => {
// 处理错误
console.log(error)
}
)
.then((response) => {
const { code, data } = response
console.log("response", code, response)
if (code == "200") {
console.log(data)
baseConfig = data
// console.log("baseConfig", baseConfig)
// window.$fetchConfig = data
} else {
baseConfig = response
window.$fetchConfig = response
console.log(response)
window.$gscApi = new Request({
...response.gsc,
// baseURL:'http://192.168.3.145:9898/gsc-vcp-web-facade',
// baseURL: 'http://gsc.test.glsx.com.cn/gsc-vcp-web-facade',
session: {
requiresSession: true,
sessionId: (_) => util.cookies.get("token")
},
events: {
error: (error, config) => {
Vue.prototype.$message.error(error.msg)
},
logout: (response, config) => {
store.dispatch("d2admin/user/clear")
util.cookies.remove("token")
router.replace("/login")
Vue.prototype.$message.error("登录超时,请重新登录")
}
}
})
console.log(window.$gscApi, "========")
}
})
.finally(() => {
init()
})
function init() {
new Vue({
router,
store,
// i18n,
render: (h) => {
// baseConfig.axios.baseURL = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
// data
// console.log(data)
Vue.prototype.baseConfig = baseConfig;
return h(App);
},
created() {
// 系统配置
Vue.config.devtools = true;
// 展示系统信息
this.$store.commit("d2admin/releases/versionShow");
// 用户登录后从数据库加载一系列的设置
this.$store.dispatch("d2admin/account/load");
// 获取并记录用户 UA
this.$store.commit("d2admin/ua/get");
// 初始化全屏监听
this.$store.dispatch("d2admin/fullscreen/listen");
},
mounted() {},
}).$mount("#app");
new Vue({
router,
store,
// i18n,
render: (h) => {
// baseConfig.axios.baseURL = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
// data
// console.log(data)
Vue.prototype.baseConfig = baseConfig
return h(App)
},
created() {
// 系统配置
Vue.config.devtools = true
// 展示系统信息
this.$store.commit("d2admin/releases/versionShow")
// 用户登录后从数据库加载一系列的设置
this.$store.dispatch("d2admin/account/load")
// 获取并记录用户 UA
this.$store.commit("d2admin/ua/get")
// 初始化全屏监听
this.$store.dispatch("d2admin/fullscreen/listen")
},
mounted() {}
}).$mount("#app")
}
export { baseConfig };
export { baseConfig }
......@@ -133,16 +133,34 @@
:formRules="confirmRules"
:editData="confirmForm"
:editFormData="confirmFormData"
:slotArr="['transTimeHtml']"
:slotArr="['transTimeHtml', 'bankAccHtml', 'oppAccNoHtml']"
@handleClose="handleConfirmClose"
@handleConfirm="handleConfirmSubmit"
@handleConfirm="debouncedConfirmSubmit"
>
<template slot="bankAccHtml">
<el-input
v-model="confirmForm.bankAcc"
placeholder="请输入本方账号"
:maxlength="50"
style="width: 500px"
@input="(val) => (confirmForm.bankAcc = val.replace(/[^\d]/g, ''))"
></el-input>
</template>
<template slot="oppAccNoHtml">
<el-input
v-model="confirmForm.oppAccNo"
placeholder="请输入对方账号"
:maxlength="50"
style="width: 500px"
@input="(val) => (confirmForm.oppAccNo = val.replace(/[^\d]/g, ''))"
></el-input>
</template>
<template slot="transTimeHtml">
<el-time-picker
v-model="confirmForm.transTime"
placeholder="请选择交易时间"
value-format="HH:mm:ss"
style="width: 100%"
style="width: 500px"
>
</el-time-picker>
</template>
......@@ -181,6 +199,7 @@ import {
getPendingCorporateOrderDetail
} from "@/api/finance"
import { Util } from "@/common/util"
import { debounce } from "@/views/index/debounce"
import detailComp from "./components/detailComp.vue"
export default {
......@@ -265,8 +284,7 @@ export default {
{
label: "本方账号",
name: "bankAcc",
type: "input",
maxlength: "50",
addHtml: "bankAccHtml",
required: true
},
{
......@@ -299,8 +317,7 @@ export default {
{
label: "对方账号",
name: "oppAccNo",
type: "input",
maxlength: "50",
addHtml: "oppAccNoHtml",
required: true
},
{
......@@ -355,8 +372,16 @@ export default {
tableColumns: [
// { label: "序号", prop: "index", width: "60px" },
{ label: "交易参考号", prop: "outTradeNo", width: "150px" },
{ label: "原支付金额", prop: "totalPrice" },
{ label: "结余金额", prop: "notRefundedTotalPrice" },
{
label: "原支付金额",
prop: "totalPrice",
formatter: (row) => "¥" + row.totalPrice
},
{
label: "结余金额",
prop: "notRefundedTotalPrice",
formatter: (row) => "¥" + row.notRefundedTotalPrice
},
{ label: "支付时间", prop: "payDate", width: "160px" },
{ label: "支付渠道", prop: "payChannel" },
{ label: "收款来源", prop: "payType", addHtml: "payType" },
......@@ -380,7 +405,11 @@ export default {
{ label: "客户名称", prop: "customerName" },
{ label: "转化人员", prop: "sellerName" },
{ label: "销售顾问", prop: "employeeName" },
{ label: "订单金额", prop: "totalAmount" },
{
label: "订单金额",
prop: "totalAmount",
formatter: (row) => "¥" + row.totalAmount
},
{ label: "订单时间", prop: "orderDate", width: "160px" },
{ label: "交易参考号", prop: "outTradeNo", width: "150px" },
{ label: "支付时间", prop: "payDate", width: "160px" },
......@@ -406,7 +435,11 @@ export default {
{ label: "客户名称", prop: "customerName" },
{ label: "转化人员", prop: "sellerName" },
{ label: "销售顾问", prop: "employeeName" },
{ label: "订单金额", prop: "totalAmount" },
{
label: "订单金额",
prop: "totalAmount",
formatter: (row) => "¥" + row.totalAmount
},
{ label: "订单时间", prop: "orderDate", width: "160px" },
{ label: "交易参考号", prop: "outTradeNo", width: "150px" },
{ label: "支付时间", prop: "payDate", width: "160px" },
......@@ -477,6 +510,7 @@ export default {
},
created() {
this.fetchStatData()
this.debouncedConfirmSubmit = debounce(this.handleConfirmSubmit, 300)
},
methods: {
async fetchStatData() {
......@@ -497,7 +531,10 @@ export default {
goBack() {
this.$router.push({
path: "exceptionOrderManage",
query: {}
query: {
startTime: this.routerInfo.startTime,
endTime: this.routerInfo.endTime
}
})
},
getStatusLabel(status) {
......@@ -536,7 +573,8 @@ export default {
},
getDistributionStatusLabel(status) {
const map = {
1: "待分账",
0: "未分账",
1: "已分账",
2: "分账中",
3: "分账成功",
4: "分账失败"
......
......@@ -8,6 +8,30 @@
:form-data="showFormData"
label-width="100px"
>
<template slot="timeRangeSlot">
<el-date-picker
v-model="searchForm.timeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
style="width: 100%"
clearable
>
</el-date-picker>
</template>
<template slot="merchantIdInput">
<el-input
v-model="searchForm.merchantId"
placeholder="请输入"
clearable
:maxlength="10"
@input="
(val) => (searchForm.merchantId = val.replace(/[^\d]/g, ''))
"
></el-input>
</template>
<div class="up-btns">
<el-button :id="tableParams.btnId" size="small" type="primary">
查询
......@@ -76,7 +100,7 @@
title="对公流水导入"
:is-visible="fileVisible"
@closeDialog="fileVisible = false"
@confirmDialog="confirmBtn"
@confirmDialog="debouncedConfirmBtn"
>
<el-form
:model="fileForm"
......@@ -145,13 +169,46 @@ import {
getAbnormalOrderStat
} from "@/api/finance"
import { deepClone } from "@/common/util"
import { debounce } from "@/views/index/debounce"
import dayjs from "dayjs"
import { mapActions, mapState, mapMutations } from "vuex"
export default {
name: "exceptionOrderManage",
data() {
let timeOptionRange = null
return {
pickerOptions: {
onPick: ({ maxDate, minDate }) => {
if (minDate && !maxDate) {
timeOptionRange = minDate
}
if (maxDate) {
timeOptionRange = null
}
},
disabledDate: (time) => {
const today = new Date()
const todayStart = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate()
).getTime()
if (timeOptionRange) {
const oneYearAfter = dayjs(timeOptionRange).add(1, "year").valueOf()
const oneYearBefore = dayjs(timeOptionRange)
.subtract(1, "year")
.valueOf()
return (
time.getTime() >= oneYearAfter ||
time.getTime() <= oneYearBefore ||
time.getTime() > todayStart
)
}
return time.getTime() > todayStart
}
},
fileInfo: null,
fileVisible: false,
fileForm: {
......@@ -182,21 +239,22 @@ export default {
{
label: "时间",
name: "timeRange",
type: "datePicker",
isClear: true,
pickerOptions: "rangePickerOptions"
type: "custom",
addHtml: "timeRangeSlot",
isClear: true
},
{
label: "门店名称",
name: "merchantName",
type: "input",
isClear: true,
placeholder: "请输入"
placeholder: "请输入",
maxlength: 50
},
{
label: "门店商户号",
name: "merchantId",
type: "input",
addHtml: "merchantIdInput",
isClear: true,
placeholder: "请输入"
}
......@@ -281,6 +339,19 @@ export default {
}
}
},
created() {
this.debouncedConfirmBtn = debounce(this.confirmBtn, 300)
if (this.$route.query.startTime && this.$route.query.endTime) {
this.searchForm.timeRange = [
dayjs(this.$route.query.startTime).toDate(),
dayjs(this.$route.query.endTime).toDate()
]
const query = JSON.parse(JSON.stringify(this.$route.query))
delete query.startTime
delete query.endTime
this.$router.replace({ query })
}
},
mounted() {
// this.onPageShow()
// this.getOptionsList()
......@@ -418,17 +489,26 @@ export default {
},
importFile(e) {
// console.log(e)
const size = e.target.files[0].size / 1024 / 1024
const file = e.target.files[0]
const isExcel =
file.type ===
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
file.type === "application/vnd.ms-excel"
if (!isExcel) {
this.$message.error("文件格式错误")
document.getElementById("fileUpload").value = ""
return
}
const size = file.size / 1024 / 1024
if (size < 9) {
this.$set(this.fileForm, "fileName", e.target.files[0].name)
this.$set(this.fileForm, "fileName", file.name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.readAsDataURL(file)
reader.onload = (event) => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(",")
this.fileInfo =
e.target.files[0].name.split(".")[1] + "@" + arrBase64[1]
this.fileInfo = file.name.split(".")[1] + "@" + arrBase64[1]
document.getElementById("fileUpload").value = ""
}
} else {
......@@ -477,7 +557,7 @@ export default {
.catch((res) => {
console.log(res, "上传文件失败")
this.uploadFlag = false
this.$message.error("导入失败")
// this.$message.error("导入失败")
})
} else {
this.uploadFlag = false
......@@ -751,3 +831,5 @@ export default {
left: 0;
}
</style>
}
</style>
......@@ -358,9 +358,9 @@
</span>
</template>
</el-table-column>
<el-table-column label="总价" align="center" prop="totalPrice">
<el-table-column label="总价" align="center" prop="finalPrice">
<template slot-scope="scope">
<span>¥ {{ scope.row.totalPrice }}</span>
<span>¥ {{ scope.row.finalPrice }}</span>
</template>
</el-table-column>
<el-table-column label="退款明细" align="center" prop="totalPrice">
......
<!-- 引荐数审核 -->
<template>
<d2-container class="layout">
<div class="header">
<d2-search
ref="showSearch"
:search-form="searchForm"
:form-data="showFormData"
label-width="100px"
:selectPopperAppendToBody="false"
class="d2-search"
>
<template slot="managerCommitTime">
<el-date-picker
v-model="searchForm.managerCommitTime"
type="monthrange"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
:picker-options="monthPickerOptions"
size="small"
:clearable="false"
value-format="yyyy-MM"
>
</el-date-picker>
</template>
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId" size="small" type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table-header>
<auth-button :show-btn-ids="['9040903']" category="Button" />
</d2-table-header>
<d2-container class="layout">
<div class="header">
<d2-search
ref="showSearch"
:search-form="searchForm"
:form-data="showFormData"
label-width="100px"
:selectPopperAppendToBody="false"
class="d2-search"
>
<template slot="managerCommitTime">
<el-date-picker
v-model="searchForm.managerCommitTime"
type="monthrange"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
:picker-options="monthPickerOptions"
size="small"
:clearable="false"
value-format="yyyy-MM"
>
</el-date-picker>
</template>
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId" size="small" type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table-header>
<auth-button :show-btn-ids="['9040903']" category="Button" />
</d2-table-header>
<!-- :get-list-api="getListApi" -->
<d2-table
ref="tableRef"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<div slot="imageUrls" slot-scope="scope" class="coverImage-preview">
<glsx-preview
:image-url-arr="
scope.scope.imageUrls
? formatterImg(scope.scope.imageUrls)
: [noDataUrl]
"
:pic-options="picOptions"
limit="1"
></glsx-preview>
</div>
<template slot="remark" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.remark || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.remark || "-"
}}</span>
</el-popover>
</template>
<template slot="merchantName" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.merchantName || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.merchantName || "-"
}}</span>
</el-popover>
</template>
<!--状态 -->
<div slot="statusHtml" slot-scope="scope">
<div class="online-status">
<span
class="dot"
:style="{
background: getStatusColor(
scope && scope.scope && scope.scope.isReviewed,
'reviewStatusOptMap'
)
}"
></span>
{{
getStatusItem(
baseData,
"reviewStatusOpts",
scope.scope,
"isReviewed"
)
}}
</div>
</div>
<div slot="auth-button" slot-scope="scope">
<span
style="margin-right: 8px"
v-if="scope.scope.isReviewed == 2 || scope.scope.isReviewed == 1"
>
<auth-button
slot="auth-button"
:show-btn-ids="['9040901']"
:data="scope.scope"
/>
</span>
<span v-else>
<auth-button
slot="auth-button"
:show-btn-ids="['9040902']"
:data="scope.scope"
/>
</span>
</div>
</d2-table>
</div>
<referral-dialog
v-if="referralVisible"
:detailVisible="referralVisible"
:id="id"
@dialogClose="handlereferralClose"
></referral-dialog>
</d2-container>
<!-- :get-list-api="getListApi" -->
<d2-table
ref="tableRef"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<div
slot="imageUrls"
slot-scope="scope"
class="coverImage-preview"
>
<glsx-preview
:image-url-arr="
scope.scope.imageUrls
? formatterImg(scope.scope.imageUrls)
: [noDataUrl]
"
:pic-options="picOptions"
limit="1"
></glsx-preview>
</div>
<template slot="remark" slot-scope="scope">
<template v-if="scope.scope.remark">
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div class="tags-popover">
{{ scope.scope.remark || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.remark || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
<template slot="merchantName" slot-scope="scope">
<template v-if="scope.scope.merchantName">
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div class="tags-popover">
{{ scope.scope.merchantName || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.merchantName || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
<!--状态 -->
<div slot="statusHtml" slot-scope="scope">
<div class="online-status">
<span
class="dot"
:style="{
background: getStatusColor(
scope &&
scope.scope &&
scope.scope.isReviewed,
'reviewStatusOptMap'
),
}"
></span>
{{
getStatusItem(
baseData,
"reviewStatusOpts",
scope.scope,
"isReviewed"
)
}}
</div>
</div>
<div slot="auth-button" slot-scope="scope">
<span
style="margin-right: 8px"
v-if="
scope.scope.isReviewed == 2 ||
scope.scope.isReviewed == 1
"
>
<auth-button
slot="auth-button"
:show-btn-ids="['9040901']"
:data="scope.scope"
/>
</span>
<span v-else>
<auth-button
slot="auth-button"
:show-btn-ids="['9040902']"
:data="scope.scope"
/>
</span>
</div>
</d2-table>
</div>
<referral-dialog
v-if="referralVisible"
:detailVisible="referralVisible"
:id="id"
@dialogClose="handlereferralClose"
></referral-dialog>
</d2-container>
</template>
<script type="text/ecmascript-6">
......@@ -502,70 +525,70 @@ export default {
<style scoped lang="scss">
.layout {
.d2-search {
::v-deep.el-select-dropdown,
.el-popper {
width: 300px !important;
}
}
.header {
background: #fff;
}
.content {
position: absolute;
left: 20px;
width: calc(100% - 40px);
padding: 0 20px 36px;
background: #fff;
margin-top: 14px;
height: calc(100% - 110px);
box-sizing: border-box;
overflow-y: auto;
.top {
height: 52px;
color: #333333;
font-size: 32rpx;
font-weight: 500;
display: flex;
align-items: center;
.exprot {
margin-left: auto;
}
}
}
.tag {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
padding: 0 10px;
display: block;
}
.online-status {
display: flex;
justify-content: center;
align-items: center;
.d2-search {
::v-deep.el-select-dropdown,
.el-popper {
width: 300px !important;
}
}
.header {
background: #fff;
}
.content {
position: absolute;
left: 20px;
width: calc(100% - 40px);
padding: 0 20px 36px;
background: #fff;
margin-top: 14px;
height: calc(100% - 110px);
box-sizing: border-box;
overflow-y: auto;
.top {
height: 52px;
color: #333333;
font-size: 32rpx;
font-weight: 500;
display: flex;
align-items: center;
.exprot {
margin-left: auto;
}
}
}
.tag {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
padding: 0 10px;
display: block;
}
.online-status {
display: flex;
justify-content: center;
align-items: center;
.dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 8px;
}
}
.dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 8px;
}
}
}
.coverImage-preview {
width: 138px;
height: 54px;
::v-deep .photo-activity {
width: 100%;
height: 100%;
object-fit: contain;
position: static !important;
}
width: 138px;
height: 54px;
::v-deep .photo-activity {
width: 100%;
height: 100%;
object-fit: contain;
position: static !important;
}
}
::v-deep.tags-popover {
max-width: 50vw;
max-width: 50vw;
}
</style>
......@@ -14,6 +14,7 @@
@handleClose="closeDialogVisible"
@handleConfirm="handleUpdateConfirm"
:slotArr="slotArr"
class="batch-modify-salary-dialog"
>
<template slot="effectiveMonth">
<el-date-picker
......@@ -24,6 +25,7 @@
size="small"
:clearable="false"
value-format="yyyy-MM"
class="effectiveMonth"
>
</el-date-picker>
</template>
......@@ -62,7 +64,7 @@ export default {
},
isUpdateDialogConfig: {
title: "批量修改薪资占比",
width: "500px",
width: "480px",
okText: "确定"
},
isUpdateForm: {
......@@ -111,6 +113,9 @@ export default {
this.validatePercent(value, callback),
trigger: "blur"
}
],
effectiveMonth: [
{ required: true, message: "请选择", trigger: "change" }
]
},
baseData: {},
......@@ -195,4 +200,10 @@ export default {
}
}
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.batch-modify-salary-dialog{
::v-deep .el-date-editor.el-input{
width: 290px!important;
}
}
</style>
......@@ -77,7 +77,8 @@
></glsx-preview>
</div>
<template slot="remark" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<template v-if="scope.scope.remark">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.remark || "-" }}
</div>
......@@ -85,16 +86,21 @@
scope.scope.remark || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
<template slot="replyContent" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.replyContent || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.replyContent || "-"
}}</span>
</el-popover>
<template v-if="scope.scope.replyContent">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.replyContent || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.replyContent || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
<div slot="auth-button" slot-scope="scope">
<el-button
......@@ -421,6 +427,9 @@ export default {
.el-popper {
width: 300px !important;
}
.el-date-editor.el-input, .el-date-editor.el-input__inner{
width:100% !important;
}
}
.content {
position: absolute;
......
......@@ -1062,6 +1062,11 @@ export default {
trigger: "blur"
}
],
effectiveMonth:[{
required: true,
message: "请选择",
trigger: "blur"
}],
hireType: [
{
required: true,
......
......@@ -29,7 +29,6 @@
v-model="infoForm.merchantIds"
multiple
collapse-tags
:multiple-limit="10"
@change="updateStaffList('staffPhoneList')"
>
<el-option
......@@ -48,7 +47,6 @@
v-model="infoForm.staffPhoneList"
multiple
collapse-tags
:multiple-limit="10"
>
<el-option
v-for="item in baseData.staffList"
......@@ -96,7 +94,7 @@
>模板下载</el-button
> -->
<div class="tips-text">
选择员工在近3个月内的工资导出文件,批量修订后导入更新
支持批量修订近3个月内到工资导出文件后导入更新
</div>
<div class="file_box" v-if="fileName">
<div class="file_name">{{ fileName }}</div>
......@@ -135,7 +133,6 @@
v-model="infoForm.exportMerchantIds"
multiple
collapse-tags
:multiple-limit="10"
@change="updateStaffList('salaryMerchantList')"
>
<el-option
......@@ -154,7 +151,6 @@
v-model="infoForm.exportStaffPhoneList"
multiple
collapse-tags
:multiple-limit="10"
>
<el-option
v-for="item in baseData.exportStaffList"
......
......@@ -358,19 +358,27 @@ export default {
return n.toFixed(fixed)
},
// 限制最多两位小数
// 限制最多两位小数,并规范化前导零(例如 000 -> 0,000000.3 -> 0.3)
sanitizeFloatRangeLoose(val, maxDecimals = 2) {
let s = String(val == null ? "" : val).replace(/[^\d.]/g, "")
if (!s) return ""
// 仅保留第一个小数点
const firstDot = s.indexOf(".")
if (firstDot !== -1) {
const before = s.slice(0, firstDot)
const after = s.slice(firstDot + 1).replace(/\./g, "")
s = `${before}.${after}`
}
const [intPart, decPart] = s.split(".")
let [intPart, decPart] = s.split(".")
// 规范化整数部分前导零:'000' -> '0','000123' -> '123'
intPart = (intPart || "").replace(/^0+(?=\d)/, "")
if (intPart === "") intPart = "0"
if (decPart != null) {
s = `${intPart}.${decPart.slice(0, maxDecimals)}`
// 保留到指定小数位数;当还没输入小数位时保留尾随小数点
decPart = decPart.slice(0, maxDecimals)
s = `${intPart}.${decPart}`
} else {
s = intPart
}
return s
},
......@@ -420,14 +428,23 @@ export default {
// 保存前校验:分数取数值部分;系数 0-10 且最多两位小数(由输入清洗保证)
validateBeforeSave() {
for (const r of this.performanceLevelDetailDTOS) {
const { numeric } = this.parseScoreWithSymbol(
r.scoreNumericValue || r.scoreSymbolValue,
0,
200
)
// 新增:分数、系数不能为空
const scoreRaw = String(r.scoreNumericValue || r.scoreSymbolValue || "").trim()
if (!scoreRaw&&scoreRaw!=0) {
this.$message.error(`${this.levelNameMap[r.levelCode]}分数不能为空`)
return false
}
const coefRaw = String(r.rewardCoefficient || "").trim()
if (!coefRaw&&coefRaw!=0) {
this.$message.error(`${this.levelNameMap[r.levelCode]}奖励系数不能为空`)
return false
}
// 保留原有数值解析与范围校验(同时显式检查 numeric 为空)
const { numeric } = this.parseScoreWithSymbol(scoreRaw, 0, 200)
const score = Number(numeric)
const coef = Number(r.rewardCoefficient)
if (isNaN(score) || score < 0 || score > 200) {
const coef = Number(coefRaw)
if (numeric === "" || isNaN(score) || score < 0 || score > 200) {
this.$message.error(
`${this.levelNameMap[r.levelCode]}分数需为0-200,最多2位小数`
)
......@@ -437,9 +454,7 @@ export default {
if (r.levelCode === "B") {
if (isNaN(coef) || coef < 0 || coef > 1) {
this.$message.error(
`${
this.levelNameMap[r.levelCode]
}奖励系数需小于等于1.0,最多2位小数`
`${this.levelNameMap[r.levelCode]}奖励系数需小于等于1.0,最多2位小数`
)
return false
}
......@@ -459,27 +474,43 @@ export default {
}
}
}
// 新员工
const a = Number(this.autoPerformRuleDetailDTO.monthOnboardAttendanceDays)
// 新增:自动评绩效规则配置 - 出勤天数不能为空
const aRaw = String(this.autoPerformRuleDetailDTO.monthOnboardAttendanceDays || "").trim()
if (!aRaw) {
this.$message.error("出勤天数不能为空")
return false
}
const a = Number(aRaw)
if (!Number.isInteger(a) || a < 1 || a > 30) {
this.$message.error("出勤天数需为1-30的整数")
return false
}
const mOut = Number(
this.autoPerformRuleDetailDTO.monthOnboardOutputThreshold
)
// 新增:自动评绩效规则配置 - 产值阈值不能为空(当月入职)
const mOutRaw = String(this.autoPerformRuleDetailDTO.monthOnboardOutputThreshold || "").trim()
if (!mOutRaw) {
this.$message.error("当月入职新员工产值阈值不能为空")
return false
}
const mOut = Number(mOutRaw)
if (!Number.isInteger(mOut) || mOut < 5000 || mOut > 20000) {
this.$message.error("当月入职新员工产值阈值需为5000-20000的整数")
return false
}
// 非新员工
const noOut = Number(
this.autoPerformRuleDetailDTO.noMonthOnboardOutputThreshold
)
// 新增:自动评绩效规则配置 - 产值阈值不能为空(非月入职)
const noOutRaw = String(this.autoPerformRuleDetailDTO.noMonthOnboardOutputThreshold || "").trim()
if (!noOutRaw) {
this.$message.error("非月入职员工产值阈值不能为空")
return false
}
const noOut = Number(noOutRaw)
if (!Number.isInteger(noOut) || noOut < 5000 || noOut > 20000) {
this.$message.error("非月入职员工产值阈值需为5000-20000的整数")
return false
}
if (!this.autoPerformRuleDetailDTO.effectiveMonth) {
this.$message.error("请输入生效月份")
return false
......@@ -593,7 +624,7 @@ export default {
padding: 0 20px;
height: 100vh;
.layout {
height: calc(100% - 220px);
height: calc(100% - 195px);
overflow: scroll;
&::-webkit-scrollbar {
width: 1px;
......
......@@ -252,7 +252,7 @@ export default {
optionsName: "directLeaderList"
},
{
label: "工资绩效",
label: "含工资人员",
name: "salaryStaffPhone",
type: "select",
isClear: true,
......
......@@ -56,6 +56,7 @@
</span>
</div>
</d2-table>
<!-- :isEdit="true" -->
<detail-dialog
v-if="detailVisible"
:detailVisible="detailVisible"
......
......@@ -237,7 +237,6 @@ export default {
watch: {
isClose: {
handler(val) {
console.log(val,'isClose')
this.picOptions.isClose = val
},
immediate: true
......
<!-- 门店提成方案 -->
<template>
<div class="container">
<d2-table ref="table"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="searchFormSearch"
:table-params="tableParams">
<template #brandNames="scope">
<template v-if="scope.scope.brandNames && scope.scope.brandNames.length > 20">
<el-popover placement="top"
popper-class="brand_popver"
trigger="hover"
width="300">
<div class="brand-box">
{{ brandFilter(scope.scope) }}
</div>
<template #reference>
<div>
{{ brandFilter(scope.scope, 30) }}
</div>
</template>
</el-popover>
</template>
<span v-else>{{ scope.scope.brandNames || "-" }}</span>
</template>
<template #schemeNames="scope">
<template v-if="
scope.scope.schemeNames
&& scope.scope.schemeNames.split(',').length > 0
">
<div v-for="(item, index) in scope.scope.schemeNames.split(',')"
:key="index">
{{ item || "-" }}
</div>
</template>
<div class="container">
<d2-table
ref="table"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<template slot="merchantNames" slot-scope="scope">
{{scope.scope.merchantNames||'-'}} {{scope.scope.merchantId}}
</template>
<template slot="brandNames" slot-scope="scope">
<template
v-if="scope.scope.brandNames && scope.scope.brandNames.length > 20"
>
<el-popover
placement="top"
width="300"
popper-class="brand_popver"
trigger="hover"
>
<div class="brand-box">
{{ brandFilter(scope.scope) }}
</div>
<div slot="reference">
{{ brandFilter(scope.scope, 30) }}
</div>
</el-popover>
</template>
<span v-else>{{ scope.scope.brandNames || "-" }}</span>
</template>
<template slot="schemeNames" slot-scope="scope">
<template
v-if="
scope.scope.schemeNames &&
scope.scope.schemeNames.split(',').length > 0
"
>
<div
v-for="(item, index) in scope.scope.schemeNames.split(',')"
:key="index"
>
{{ item || "-" }}
</div>
</template>
<span v-else>-</span>
</template>
<template #auth-button="scope">
<div>
<!-- 编辑 -->
<span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9121202']" />
</span>
</div>
</template>
</d2-table>
</div>
<span v-else>-</span>
</template>
<div slot="auth-button" slot-scope="scope">
<!-- 编辑 -->
<span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9121202']" />
</span>
</div>
</d2-table>
</div>
</template>
<script>
import { getStoreConfigList } from "@api/salaryManagement";
import { deepClone, getStatusItem } from "@/common/util";
import { getStoreConfigList } from "@api/salaryManagement"
import { deepClone, getStatusItem } from "@/common/util"
export default {
props: {
searchForm: {
type: Object,
default: () => {},
},
baseData: {
type: Object,
default: () => {},
},
},
data() {
return {
getStatusItem,
......@@ -71,87 +68,97 @@ export default {
getListApi: getStoreConfigList,
// 表格参数
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableOption: {
width: "100",
width: "100"
},
tableColumns: [
{
label: "门店名称",
prop: "merchantNames",
addHtml: "merchantNames"
},
{
label: "品牌",
prop: "brandNames",
width: "200",
addHtml: "brandNames",
addHtml: "brandNames"
},
{
label: "提成方案名称",
prop: "schemeNames",
prop: "schemeNames"
// addHtml: "schemeNames"
},
{
label: "适配业务",
prop: "businessTypes",
formatter: (cellValue) => {
if (!cellValue.businessTypes)
return "-";
let str = [];
if (!cellValue.businessTypes) return "-"
let str = []
cellValue.businessTypes.split(",").forEach((item) => {
str.push(
this.getStatusItem(this.baseData, "businessTypeOpts", item),
);
});
return str.join(",");
},
},
],
},
};
this.getStatusItem(this.baseData, "businessTypeOpts", item)
)
})
return str.join(",")
}
}
]
}
}
},
props: {
searchForm: {
type: Object,
default: () => {}
},
baseData: {
type: Object,
default: () => {}
}
},
mounted() {},
methods: {
keyDowmGetList() {
this.$refs.table.refreshTable(true, true);
this.$refs.table.refreshTable(true, true)
},
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = {
...this.searchForm,
};
resolve();
});
...this.searchForm
}
resolve()
})
},
brandFilter(ele, lenght) {
if (ele.brandNames) {
return lenght
? ele.brandNames?.length > lenght
? `${ele.brandNames.substring(0, lenght)}\u2026`
? ele.brandNames.substring(0, lenght) + "\u2026"
: ele.brandNames.substring(0, lenght)
: ele.brandNames;
: ele.brandNames
} else {
return "-";
return "-"
}
},
getOptions() {
this.showFormData?.forEach((item, index) => {
if (item.type == "select") {
if (
this.baseData[item.optionsName].length
&& this.baseData[item.optionsName][0][
this.baseData[item.optionsName].length &&
this.baseData[item.optionsName][0][
this.showFormData[index].optionLabel
] !== "全部"
] !== "全部"
) {
const temp = {};
temp[this.showFormData[index].optionId] = "";
temp[this.showFormData[index].optionLabel] = "全部";
this.baseData[item.optionsName].unshift(temp);
const temp = {}
temp[this.showFormData[index].optionId] = ""
temp[this.showFormData[index].optionLabel] = "全部"
this.baseData[item.optionsName].unshift(temp)
}
this.showFormData[index].optionList = this.baseData[item.optionsName];
this.showFormData[index].optionList = this.baseData[item.optionsName]
}
});
})
},
// 编辑方案
handleToEdit(row) {
......@@ -162,11 +169,10 @@ export default {
id: row.merchantId,
},
});
},
},
};
}
}
}
</script>
<style lang="scss" scoped>
.m-t-40 {
margin-top: 40px;
......@@ -180,7 +186,6 @@ export default {
box-sizing: border-box;
}
</style>
<style>
.brand_popver {
height: auto !important;
......
......@@ -48,25 +48,39 @@
></glsx-preview>
</div>
<template slot="remark" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.remark || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.remark || "-"
}}</span>
</el-popover>
</template>
<template slot="merchantName" slot-scope="scope">
<el-popover placement="top" width="fit-content" trigger="hover">
<div class="tags-popover">
{{ scope.scope.merchantName || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.merchantName || "-"
}}</span>
</el-popover>
</template>
<template v-if="scope.scope.remark">
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div class="tags-popover">
{{ scope.scope.remark || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.remark || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
<template slot="merchantName" slot-scope="scope">
<template v-if="scope.scope.merchantName">
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div class="tags-popover">
{{ scope.scope.merchantName || "-" }}
</div>
<span class="tag" slot="reference">{{
scope.scope.merchantName || "-"
}}</span>
</el-popover>
</template>
<template v-else>-</template>
</template>
</d2-table>
</div>
</d2-container>
......@@ -151,7 +165,7 @@ export default {
}
},
{
label: "线上有效引荐数",
label: "运营修正有效引荐数",
prop: "reviewedEffectiveCount",
minWidth: "150",
formatter:(cellValue)=>{
......
  • @limin
    commented
    Owner

    你好。我是负责本次代码审查的资深软件开发工程师。本次提交涵盖了财务管理、订单管理、员工管理等多个模块的功能增强与 Bug 修复。

    以下是针对本次代码变更的审查意见:

    一、关键问题与优化建议(Top 3)

    1. 文件后缀提取逻辑缺陷(功能正确性)

    • 问题描述:在 src/views/financeManage/exceptionOrderManage/index.vue 的 importFile 方法中,获取文件后缀使用了 file.name.split(".")[1]。
    • 影响分析:如果文件名包含多个点(例如 2023.05.财务报表.xlsx),该逻辑将提取到 05 而非 xlsx。这会导致 fileInfo 拼接错误,进而可能导致后端解析失败或上传报错。
    • 优化建议:建议使用 pop() 获取数组最后一个元素。 javascript // 优化建议 const fileNameParts = file.name.split("."); const extension = fileNameParts.length > 1 ? fileNameParts.pop() : ""; this.fileInfo = extension + "@" + arrBase64[1];

    2. 全局配置加载的健壮性风险(稳定性/健壮性)

    • 问题描述:在 src/main.js 中,系统初始化依赖于 fetch 获取远程配置。当 code != "200" 时,逻辑将 baseConfig 直接赋值为 response 对象,且在 finally 中强制执行 init()。
    • 影响分析:若接口返回非预期格式的错误对象,baseConfig 将失去预期的结构。由于 baseConfig 被挂载在 Vue.prototype 并广泛用于各组件,这可能导致整个应用在渲染阶段抛出 Cannot read property 'xxx' of undefined 异常,造成白屏。
    • 优化建议:在赋值前应校验响应结构的合法性,并提供完备的默认配置(Fallback)。 javascript // 优化建议 .then((response) => { if (response && response.code === "200" && response.data) { baseConfig = response.data; } else { console.error("配置加载失败,使用本地默认配置"); // 保持本地 baseConfig 不变或进行深度合并 } })

    3. 日期禁用逻辑的边界准确性(功能正确性)

    • 问题描述:在 src/common/format.js 的 rangePickerOptions_lastOneYear 中,使用 date > now 进行禁用判断。
    • 影响分析:now 包含当前的时分秒,而 Element UI 传入的 date 通常是当天的 00:00:00。这会导致“今天”这个日期在某些时刻处于模糊状态(例如:当前是上午 10 点,今天的 0 点确实小于 now,但用户通常期望“今天”是可选的)。
    • 优化建议:应统一时间基准,建议将 now 的时分秒重置后再进行比较。 javascript // 优化建议 const now = new Date() now.setHours(23, 59, 59, 999) // 确保今天整天可选 // 或者使用更清晰的判断 return date.getTime() > Date.now() || date < lastYearStart

    二、评分明细

    评分维度 分数 理由
    功能实现的正确性与健壮性 32分 实现了核心功能,但文件解析逻辑和日期边界处理存在明显 Bug。
    安全性与潜在风险 28分 输入框加入了正则过滤,安全性尚可;但全局配置加载缺乏容错机制。
    最佳实践与可维护性 16分 main.js 的大规模格式化干扰了 Diff 阅读;部分非响应式变量定义不规范。
    性能与资源利用 5分 正确使用了防抖(Debounce)处理提交操作,性能意识良好。
    提交信息质量 4分 描述较为清晰,但存在部分如 "fixed" 这样描述过简的 commit。

    三、总分

    总分:85分

  • @limin
    commented
    Owner

    你好,我是资深软件开发工程师。感谢你提交的代码。本次代码变更涉及工资绩效方案的路由重构、API 新增以及多个组件的逻辑调整。

    经过审查,以下是本次提交中最重要的三个问题及优化建议:

    一、关键问题与优化建议

    1. 违背 Vuex 单向数据流原则,直接修改 State(稳定性)

    • 问题描述:在 src/views/residentManage/salaryPerformance/performanceScheme/components/storeApply/index.vue 中,通过 mapState 引入了 merchantBrandRefList,但在 handleDeleteMer 方法中直接使用了 this.merchantBrandRefList.splice(idx, 1)。
    • 影响分析:Vue 无法追踪这种直接在组件内对 Vuex State 的修改,会导致调试困难、状态同步失效(例如其他依赖该数据的组件不会触发更新),并可能在开启 Vuex 严格模式时抛出错误。
    • 优化建议:应通过 mapMutations 提交一个 mutation 来修改数组。
    • 代码示例: ```javascript // store 中定义 mutations: { REMOVE_MERCHANT_BRAND_REF(state, index) { state.merchantBrandRefList.splice(index, 1); } }

    // 组件中使用 methods: { ...mapMutations("PerformanceFormStore", ["REMOVE_MERCHANT_BRAND_REF"]), handleDeleteMer(row, idx) { this.REMOVE_MERCHANT_BRAND_REF(idx); }, }

    
    #### 2. 业务逻辑映射键值变更的兼容性风险(正确性)
    - **问题描述**:在 `performanceRuleSelection/index.vue` 中,`commissionMapping` 的键名从 `DDSL` 修改为了 `SJDDS`。
    - **影响分析**:如果后端接口返回的历史配置数据、或者数据库中存储的旧方案仍使用 `DDSL` 作为标识符,此处修改将导致旧方案在前端无法正确映射提成方式,甚至导致计算逻辑崩溃。
    - **优化建议**:确认后端是否同步进行了数据迁移。若需兼容历史数据,建议保留旧键或增加容错逻辑。
    - **代码示例**:
    ```javascript
    commissionMapping: {
        GMV: "BL",
        DDTC: "XS",
        SJDDS: "GDJE",
        DDSL: "GDJE", // 建议保留兼容逻辑,除非确定历史数据已清理
    },
    

    3. 工程实践:Git 提交污染与注释误导(可维护性)

    • 问题描述:
      1. src/router/modules/912_residentManage.js 文件进行了全量格式化(缩进由 2 空格变为 Tab),导致 diff 内容包含上千行无关变更,掩盖了真正的新增路由逻辑。
      2. src/api/resident.js 中新增的 postBrandMerchant 方法,其 API 方法名指向 valid.merchant.brand(校验/查询),但代码注释却是“新增 工资绩效 方案”。
    • 影响分析:全量格式化导致 Code Review 极其困难,且污染了 Git 历史溯源(git blame)。误导性的注释会增加后续维护者的理解成本,可能导致调用错误的 API。
    • 优化建议:
      1. 配置 IDE 的 .editorconfig 或 Prettier,避免在业务代码提交中混入非必要的格式化变更。
      2. 修正 API 注释,使其与实际功能(根据门店查询品牌/业务校验)保持一致。

    二、评分明细

    评分维度 分数 理由
    功能实现正确性与健壮性 32分 核心逻辑基本实现,但 DDSL 键名修改存在历史兼容性隐患。
    安全性与潜在风险 28分 未发现明显安全漏洞,但直接修改 Vuex 状态属于高风险的不稳定操作。
    最佳实践与可维护性 10分 大规模格式化导致 diff 污染严重;API 注释与实际逻辑不符,严重影响维护。
    性能与资源利用 4分 引入了可选链和合理的计算属性,性能表现正常。
    提交信息质量 4分 变更内容较多,但缺少对路由重构动机的说明(假设 commit 信息一般)。

    三、总分

    总分:78分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!