Commit ddf4caef by Jaxon

Merge branch 'feature/strategy-center' into 'SAAS+V5.8.2'

Feature/strategy center

See merge request !669
2 parents c3c90d38 3b6ad690
Showing 50 changed files with 3155 additions and 1149 deletions
...@@ -2,14 +2,8 @@ ...@@ -2,14 +2,8 @@
"eslint.enable": true, "eslint.enable": true,
"eslint.format.enable": true, "eslint.format.enable": true,
"prettier.enable": false, "prettier.enable": false,
"i18n-ally.localesPaths": [ "i18n-ally.localesPaths": ["src/locales"],
"src/locales" "cSpell.words": ["vuex", "Cascader", "glsx"],
],
"cSpell.words": [
"vuex",
"Cascader",
"glsx"
],
"workbench.tree.indent": 24, "workbench.tree.indent": 24,
"explorer.compactFolders": false, "explorer.compactFolders": false,
"scm.compactFolders": false, "scm.compactFolders": false,
...@@ -71,10 +65,7 @@ ...@@ -71,10 +65,7 @@
// "source.organizeImports": "explicit", // "source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit" "source.fixAll.eslint": "explicit"
}, },
"editor.pasteAs.preferences": [ "editor.pasteAs.preferences": ["text.updateImports.jsts", "text"],
"text.updateImports.jsts",
"text"
],
"eslint.validate": [ "eslint.validate": [
"javascript", "javascript",
"javascriptreact", "javascriptreact",
...@@ -100,5 +91,8 @@ ...@@ -100,5 +91,8 @@
"javascript.preferences.importModuleSpecifier": "non-relative", // 优先使用 @/ 别名路径 "javascript.preferences.importModuleSpecifier": "non-relative", // 优先使用 @/ 别名路径
"javascript.suggest.autoImports": true, // 确保这个是 true "javascript.suggest.autoImports": true, // 确保这个是 true
"vue.updateImportsOnFileMove.enabled": true, "vue.updateImportsOnFileMove.enabled": true,
"i18n-ally.sourceLanguage": "zh-chs" "i18n-ally.sourceLanguage": "zh-chs",
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
} }
...@@ -4,8 +4,7 @@ export function getCurrentSixMonth(n = 5) { ...@@ -4,8 +4,7 @@ export function getCurrentSixMonth(n = 5) {
} }
export function formatThousand(val) { export function formatThousand(val) {
if (val === null || val === undefined || val === "") if (val === null || val === undefined || val === "") return "-";
return "-";
const str = String(val); const str = String(val);
const parts = str.split("."); const parts = str.split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
...@@ -20,7 +19,7 @@ export function limitPrice( ...@@ -20,7 +19,7 @@ export function limitPrice(
pointDigit, pointDigit,
minValue, minValue,
maxValue, maxValue,
regRule, regRule
) { ) {
// console.log( // console.log(
// newValue, // newValue,
...@@ -31,15 +30,15 @@ export function limitPrice( ...@@ -31,15 +30,15 @@ export function limitPrice(
// ) // )
let reg = { let reg = {
priceReg: /^\d[\d\.]*$/, // eslint-disable-line priceReg: /^\d[\d\.]*$/, // eslint-disable-line
numReg: /^[1-9]\d*$/, numReg: /^[1-9]\d*$/,
priceReg_negative: /^-?\d[\d.]*$/, // 允许负数的正则表达式, priceReg_negative: /^-?\d[\d.]*$/, // 允许负数的正则表达式,
priceReg_negative_input: /^-?(\d+(?:\.\d*)?|\.\d+)?$/, // input时,允许负数的正则表达式 priceReg_negative_input: /^-?(\d+(?:\.\d*)?|\.\d+)?$/, // input时,允许负数的正则表达式
}; };
regRule = regRule || "priceReg"; regRule = regRule || "priceReg";
if ( if (
newValue newValue &&
&& ((minValue && newValue < minValue) || (maxValue && newValue > maxValue)) ((minValue && newValue < minValue) || (maxValue && newValue > maxValue))
) { ) {
return oldValue || ""; return oldValue || "";
} }
...@@ -48,16 +47,16 @@ export function limitPrice( ...@@ -48,16 +47,16 @@ export function limitPrice(
newValue = newValue + ""; newValue = newValue + "";
let interger = newValue.split(".")[0]; let interger = newValue.split(".")[0];
let point = newValue.split(".")[1]; let point = newValue.split(".")[1];
let intergerNum let intergerNum =
= interger.length > intergerDigit ? oldValue.split(".")[0] : interger; interger.length > intergerDigit ? oldValue.split(".")[0] : interger;
let pointNum let pointNum =
= point.length > pointDigit ? point.slice(0, pointDigit) : point; point.length > pointDigit ? point.slice(0, pointDigit) : point;
newValue = pointDigit newValue = pointDigit
? intergerNum + "." + pointNum ? intergerNum + "." + pointNum
: newValue.split(".")[0]; : newValue.split(".")[0];
} else { } else {
newValue newValue =
= newValue.length > intergerDigit newValue.length > intergerDigit
? oldValue.slice(0, intergerDigit) ? oldValue.slice(0, intergerDigit)
: newValue; : newValue;
} }
...@@ -149,9 +148,9 @@ export const appointDays = 35; ...@@ -149,9 +148,9 @@ export const appointDays = 35;
export const afterTodayOptions = { export const afterTodayOptions = {
disabledDate(date) { disabledDate(date) {
if ( if (
date < new Date(new Date().toLocaleDateString()) date < new Date(new Date().toLocaleDateString()) ||
|| date date >
> new Date(new Date().setDate(new Date().getDate() + (appointDays - 1))) new Date(new Date().setDate(new Date().getDate() + (appointDays - 1)))
) { ) {
return true; return true;
} }
...@@ -288,8 +287,8 @@ export const rangePickerOptions_year_2023 = { ...@@ -288,8 +287,8 @@ export const rangePickerOptions_year_2023 = {
// console.log(new Date()) // console.log(new Date())
if ( if (
date.getFullYear() > new Date().getFullYear() date.getFullYear() > new Date().getFullYear() ||
|| date.getFullYear() < 2023 date.getFullYear() < 2023
) { ) {
return true; return true;
} }
...@@ -322,7 +321,7 @@ export const todayEndPickerOptions = { ...@@ -322,7 +321,7 @@ export const todayEndPickerOptions = {
today.getDate(), today.getDate(),
23, 23,
59, 59,
59, 59
); );
return time.getTime() > todayEnd.getTime(); return time.getTime() > todayEnd.getTime();
...@@ -331,7 +330,7 @@ export const todayEndPickerOptions = { ...@@ -331,7 +330,7 @@ export const todayEndPickerOptions = {
export const stockQueryDatePickerOptions = { export const stockQueryDatePickerOptions = {
disabledDate(time) { disabledDate(time) {
const minDate = new Date(2026, 1, 1); const minDate = new Date(2026, 1, 1); // 2026年2月1日 (月份从0开始,1代表2月)
minDate.setHours(0, 0, 0, 0); minDate.setHours(0, 0, 0, 0);
const today = new Date(); const today = new Date();
...@@ -341,12 +340,11 @@ export const stockQueryDatePickerOptions = { ...@@ -341,12 +340,11 @@ export const stockQueryDatePickerOptions = {
today.getDate(), today.getDate(),
23, 23,
59, 59,
59, 59
); );
return ( return (
time.getTime() < minDate.getTime() time.getTime() < minDate.getTime() || time.getTime() > todayEnd.getTime()
|| time.getTime() > todayEnd.getTime()
); );
}, },
}; };
...@@ -383,7 +381,7 @@ export const rangePickerOptions_outputValue = { ...@@ -383,7 +381,7 @@ export const rangePickerOptions_outputValue = {
const year = time.getFullYear(); const year = time.getFullYear();
const month = time.getMonth(); const month = time.getMonth();
const isAllowed = allowedMonths.some( const isAllowed = allowedMonths.some(
m => m.year === year && m.month === month, (m) => m.year === year && m.month === month
); );
return !isAllowed; // 不在允许范围则禁用 return !isAllowed; // 不在允许范围则禁用
}, },
...@@ -418,7 +416,7 @@ export const rangePickerOptions_oneYearNoFuture = { ...@@ -418,7 +416,7 @@ export const rangePickerOptions_oneYearNoFuture = {
const todayStart = new Date( const todayStart = new Date(
today.getFullYear(), today.getFullYear(),
today.getMonth(), today.getMonth(),
today.getDate(), today.getDate()
).getTime(); ).getTime();
// 不可选未来时间 // 不可选未来时间
if (time.getTime() > todayStart) { if (time.getTime() > todayStart) {
...@@ -430,12 +428,9 @@ export const rangePickerOptions_oneYearNoFuture = { ...@@ -430,12 +428,9 @@ export const rangePickerOptions_oneYearNoFuture = {
const minTime = selectDate_oneYearNoFuture - oneYearMs; const minTime = selectDate_oneYearNoFuture - oneYearMs;
const maxTime = Math.min( const maxTime = Math.min(
selectDate_oneYearNoFuture + oneYearMs, selectDate_oneYearNoFuture + oneYearMs,
todayStart, todayStart
);
return (
time.getTime() < minTime
|| time.getTime() > maxTime
); );
return time.getTime() < minTime || time.getTime() > maxTime;
} }
return false; return false;
}, },
...@@ -464,7 +459,7 @@ export const rangePickerOptions_deliveryQuantity = { ...@@ -464,7 +459,7 @@ export const rangePickerOptions_deliveryQuantity = {
// 处理跨年情况(如当前为1月时,上个月是去年12月) // 处理跨年情况(如当前为1月时,上个月是去年12月)
currentMonth === 0 currentMonth === 0
? { year: currentYear - 1, month: 11 } ? { year: currentYear - 1, month: 11 }
: { year: currentYear, month: currentMonth - 1 }, : { year: currentYear, month: currentMonth - 1 }
); );
} }
...@@ -472,7 +467,7 @@ export const rangePickerOptions_deliveryQuantity = { ...@@ -472,7 +467,7 @@ export const rangePickerOptions_deliveryQuantity = {
const year = time.getFullYear(); const year = time.getFullYear();
const month = time.getMonth(); const month = time.getMonth();
const isAllowed = allowedMonths.some( const isAllowed = allowedMonths.some(
m => m.year === year && m.month === month, (m) => m.year === year && m.month === month
); );
return !isAllowed; // 不在允许范围则禁用 return !isAllowed; // 不在允许范围则禁用
}, },
......
<template>
<baseDialog class="effect-detail-dialog"
:config="config"
:dialog-config="dialogConfig.config"
:is-show.sync="dialogShow">
<div class="content">
<div class="block">
<div class="business-box">
<img class="bg"
src="@/assets/strategy/strategy-analyse-bg.png">
<div class="left">
<div class="business-title">
当前周期
</div>
<template v-for="(item, index) in row">
<div :key="index"
class="business-item">
<div class="label">
{{ item.categoryExtension }}
</div>
<div class="value flex">
<template v-if="item.currentValue >= 0">
{{ item.currentValue }}<template v-if="item.unit">
{{ item.unit }}
</template>
</template>
<template v-else>
-
</template>
</div>
</div>
</template>
</div>
<div class="right">
<div class="business-title">
下一周期
</div>
<template v-for="(item, index) in row">
<div :key="index"
class="business-item">
<div class="label">
{{ item.categoryExtension }}
</div>
<div class="value flex">
<template v-if="item.nextValue >= 0">
{{ item.nextValue }}<template v-if="item.unit">
{{ item.unit }}
</template>
<img class="arrow"
:src="getIconSrc(formatIsRatio(item.nextValue - item.currentValue))" />
</template>
<template v-else>
-
</template>
</div>
</div>
</template>
</div>
</div>
</div>
</div>
</baseDialog>
</template>
<script>
const decline = require("@/assets/strategy/decline.png");
const just01 = require("@/assets/strategy/just01.png");
const rise = require("@/assets/strategy/rise.png");
export default {
name: "EffectDetailDialog",
props: {
visible: {
type: Boolean,
default: false,
},
row: {
type: Array,
default: () => [],
},
searchParams: {
type: Object,
default: () => ({}),
},
},
data() {
return {
config: {
isShowFooter: false,
cancel_name: "关闭",
hideConfirmBtn: true,
},
dialogConfig: {
config: {
title: "效果分析",
width: "720px",
},
},
};
},
computed: {
dialogShow: {
get() {
return this.visible;
},
set() {
this.close();
},
},
},
methods: {
close() {
this.$emit("update:visible", false);
},
getIconSrc(name) {
return {
rise,
decline,
just01,
}[name] ?? "";
},
formatIsRatio(delta) {
return delta < 0 ? "decline" : delta === 0 ? "just01" : "rise";
},
},
};
</script>
<style scoped lang="scss">
.flex {
display: flex;
align-items: center;
}
.arrow {
width: 16px;
height: 16px;
transform: translateY(1px);
}
.content {
min-height: 289px;
}
.block {
&-title {
padding: 0 0 8px;
}
&-icon {
width: 16px;
height: 16px;
margin-right: 4px;
}
.business-box {
height: 289px;
border-radius: 4px;
position: relative;
display: flex;
box-sizing: border-box;
padding: 10px;
.bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.left,
.right {
width: 59%;
display: flex;
flex-direction: column;
gap: 14px;
position: relative;
z-index: 2;
.business-title {
padding-top: 16px;
color: #1d1d1d;
font-size: 14px;
font-weight: 500;
}
.business-item {
display: flex;
align-items: center;
font-size: 13px;
.label {
width: 104px;
color: #888888;
}
.value {
color: #1d1d1d;
}
}
}
.left {
box-sizing: border-box;
padding-left: 15%;
}
.right {
border-radius: 4px;
background: #ffffffcc;
padding-left: 24px;
.business-item {
.value {
color: #2a58ad;
font-size: 16px;
font-weight: 500;
}
}
}
}
}
</style>
<template> <template>
<baseDialog :is-show.sync="dialogShow" <baseDialog class="filtrate-dialog"
:dialog-config="dialogConfig.config" :config="config"
:config="config" :dialog-config="dialogConfig.config"
class="filtrate-dialog" :is-show.sync="dialogShow"
@handleClick="submit"> @handleClick="submit">
<div class="filtrate-body"> <div class="filtrate-body">
<div class="filtrate-form"> <div class="filtrate-form">
<div class="filter-group"> <div class="filter-group">
<span class="label">区域:</span> <span class="label">区域:</span>
<el-select v-model="formData.provinceId" <el-select v-model="formData.provinceId"
size="small" class="filter-select"
placeholder="全部" clearable
class="filter-select" filterable
filterable placeholder="全部"
clearable> size="small">
<el-option v-for="item in provinceOptions" <el-option v-for="item in provinceOptions"
:key="item.code" :key="item.code"
:label="item.name" :label="item.name"
:value="item.code"> :value="item.code">
</el-option> </el-option>
</el-select> </el-select>
</div>
<div class="filter-group">
<span class="label">品牌:</span>
<el-cascader v-model="formData.brand"
:options="brandOptions"
:props="cascaderProps"
collapse-tags
size="small"
filterable
class="filter-select filter-select-brand"
placeholder="全部"
:show-all-levels="false"
clearable>
</el-cascader>
</div>
<div class="filter-group">
<span class="label">区域运营:</span>
<el-select v-model="formData.regionOps"
size="small"
placeholder="全部"
class="filter-select"
filterable
clearable>
<el-option v-for="item in regionOpsOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
<div class="filter-group">
<span class="label">线上运营:</span>
<el-select v-model="formData.onlineOps"
size="small"
placeholder="全部"
class="filter-select"
filterable
clearable>
<el-option v-for="item in onlineOpsOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
</div>
</div> </div>
</baseDialog> <div class="filter-group">
<span class="label">品牌:</span>
<el-cascader v-model="formData.brand"
class="filter-select filter-select-brand"
clearable
collapse-tags
filterable
:options="brandOptions"
placeholder="全部"
:props="cascaderProps"
:show-all-levels="false"
size="small">
</el-cascader>
</div>
<div class="filter-group">
<span class="label">区域运营:</span>
<el-select v-model="formData.regionOps"
class="filter-select"
clearable
filterable
placeholder="全部"
size="small">
<el-option v-for="item in regionOpsOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
<div class="filter-group">
<span class="label">线上运营:</span>
<el-select v-model="formData.onlineOps"
class="filter-select"
clearable
filterable
placeholder="全部"
size="small">
<el-option v-for="item in onlineOpsOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
<div class="filter-group">
<span class="label">区域督导:</span>
<el-select v-model="formData.supervisorOps"
class="filter-select"
clearable
filterable
placeholder="全部"
size="small">
<el-option v-for="item in supervisorOpsOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
</div>
</div>
</baseDialog>
</template> </template>
<script> <script>
...@@ -82,10 +97,11 @@ export default { ...@@ -82,10 +97,11 @@ export default {
type: Object, type: Object,
default: () => ({ default: () => ({
region: "", region: "",
provinceId: "", provinceId: null,
brand: [], brand: [],
regionOps: "", regionOps: "all",
onlineOps: "", onlineOps: null,
supervisorOps: null,
}), }),
}, },
brandOptions: { brandOptions: {
...@@ -104,6 +120,10 @@ export default { ...@@ -104,6 +120,10 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
supervisorOpsOptions: {
type: Array,
default: () => [],
},
cascaderProps: { cascaderProps: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
...@@ -144,13 +164,17 @@ export default { ...@@ -144,13 +164,17 @@ export default {
}, },
}, },
methods: { methods: {
getDefaultOnlineOps() {
const { roleName, uuid } = this.$store.state.d2admin.user.info?.detail || {};
return roleName === "线上运营" ? uuid : "";
},
getInitialFormData() { getInitialFormData() {
return { return {
region: "", region: "",
provinceId: "", provinceId: "",
brand: [], brand: [],
regionOps: "", regionOps: "",
onlineOps: "", onlineOps: this.getDefaultOnlineOps(),
}; };
}, },
syncFormFromFilters() { syncFormFromFilters() {
...@@ -160,7 +184,7 @@ export default { ...@@ -160,7 +184,7 @@ export default {
provinceId: provinceId || "", provinceId: provinceId || "",
brand: Array.isArray(brand) ? brand.map(item => (Array.isArray(item) ? [...item] : item)) : [], brand: Array.isArray(brand) ? brand.map(item => (Array.isArray(item) ? [...item] : item)) : [],
regionOps: regionOps || "", regionOps: regionOps || "",
onlineOps: onlineOps || "", onlineOps: onlineOps || this.getDefaultOnlineOps(),
}; };
}, },
submit() { submit() {
...@@ -201,11 +225,17 @@ $text-sub: #333333; ...@@ -201,11 +225,17 @@ $text-sub: #333333;
.label { .label {
flex-shrink: 0; flex-shrink: 0;
width: 72px; width: 92px;
font-size: 14px; font-size: 14px;
color: $text-sub; color: $text-sub;
text-align: right; text-align: right;
margin-right: 12px; margin-right: 12px;
&::before {
content: "*";
color: #f56c6c;
margin-right: 4px;
}
} }
.filter-select { .filter-select {
......
<template> <template>
<el-popover <el-dropdown :disabled="disabled"
placement="bottom-start" placement="bottom-start"
:width="popoverWidth" trigger="click"
trigger="click" @command="handleSelect">
popper-class="pure-popover" <div class="icon-text-btn"
v-model="popoverVisible" :class="{ 'has-selected': value && value.label && value.label !== defaultText, 'is-disabled': disabled }">
> <img v-if="triggerIconType === 'image'"
<ul class="popover-list"> alt=""
<li class="icon-img"
v-for="(item, index) in options" :src="triggerIcon">
:key="index" <i v-else-if="triggerIconType === 'icon'"
:class="{ 'is-selected': isSelected(item) }" :class="triggerIcon">
@click="handleSelect(item)" </i>
style="font-size: 14px;"
>
<!-- 支持图片图标 -->
<img
v-if="item.iconUrl"
:src="item.iconUrl"
alt=""
class="icon-img"
>
<!-- 支持字体图标 -->
<i
v-else-if="item.icon"
:class="item.icon"
></i>
{{ item.label }}
</li>
</ul>
<div
slot="reference"
class="icon-text-btn"
:class="{ 'has-selected': value && value.label && value.label !== defaultText }"
>
<!-- 触发按钮图标:支持图片和字体图标 -->
<img
v-if="triggerIconType === 'image'"
:src="triggerIcon"
alt=""
class="icon-img"
>
<i
v-else-if="triggerIconType === 'icon'"
:class="triggerIcon"
></i>
<span>{{ label }}:{{ currentValue }}</span> <span>{{ label }}:{{ currentValue }}</span>
</div> </div>
</el-popover> <template #dropdown>
<el-dropdown-menu class="select-custom-dropdown"
:style="{ minWidth: `${popoverWidth}px` }">
<el-dropdown-item v-for="(item, index) in options"
:key="index"
:class="{ 'is-selected': isSelected(item) }"
:command="item">
<div class="icon-img">
<img v-if="item.iconUrl"
alt=""
class="icon-img"
:src="item.iconUrl">
<i v-else-if="item.icon"
:class="item.icon">
</i>
</div>
{{ item.label }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template> </template>
<script> <script>
export default { export default {
name: 'SelectCustom', name: "SelectCustom",
props: { props: {
// 选项列表 options: {
options: { type: Array,
type: Array, required: true,
required: true, default: () => [],
default: () => [] },
}, value: {
// 当前选中的值 type: Object,
value: { default: () => ({ label: "盯防类型", value: "" }),
type: Object, },
default: () => ({ label: '盯防类型', value: '' }) label: {
}, type: String,
// 标签文本(如"盯防类型"、"指标类型") required: true,
label: { },
type: String, triggerIcon: {
required: true type: String,
}, required: true,
// 触发按钮的图标(可以是图片路径或图标类名) },
triggerIcon: { triggerIconType: {
type: String, type: String,
required: true default: "icon",
}, validator: value => ["image", "icon"].includes(value),
// 触发按钮图标类型:'image' | 'icon' },
triggerIconType: { defaultText: {
type: String, type: String,
default: 'icon', default: "全部",
validator: (value) => ['image', 'icon'].includes(value) },
}, popoverWidth: {
// 默认文本(用于判断是否选中状态) type: Number,
defaultText: { default: 120,
type: String, },
default: '全部' disabled: {
}, type: Boolean,
// popover宽度 default: false,
popoverWidth: { },
type: Number, },
default: 120 computed: {
} currentValue() {
}, if (this.value && typeof this.value === "object" && this.value.label) {
data() { return this.value.label;
return { }
popoverVisible: false return this.defaultText;
}; },
}, },
computed: { methods: {
// 当前显示的值 // 根据选项 value(即 warningType)动态获取图标,逻辑与 monitorCard.getAlertIcon 一致
currentValue() { getOptionIcon(item) {
if (this.value && typeof this.value === 'object' && this.value.label) { if (!item || item.value == null) {
return this.value.label; return null;
} }
return this.defaultText; const iconMap = {
} 2: require("@/assets/strategy/icon-strategy-type01.png"),
}, 3: require("@/assets/strategy/icon-strategy-type02.png"),
methods: { 4: require("@/assets/strategy/icon-strategy-type07.png"),
// 处理选择 5: require("@/assets/strategy/icon-strategy-type08.png"),
handleSelect(item) { };
this.popoverVisible = false; const key = item.value ?? item.warningType;
// 触发change事件,传递选中的项 return iconMap[key] || iconMap[2];
this.$emit('change', item); },
// 同时触发input事件,支持v-model,传递包含label和value的对象 handleSelect(item) {
const selectedValue = { this.$emit("change", item);
label: item.label, const selectedValue = {
value: item.value !== undefined ? item.value : item.label label: item.label,
}; value: item.value !== undefined ? item.value : item.label,
this.$emit('input', selectedValue); };
}, this.$emit("input", selectedValue);
// 判断选项是否被选中 },
isSelected(item) { isSelected(item) {
if (!this.value) return false; if (!this.value)
// 优先比较value属性,如果没有value则比较label return false;
const itemValue = item.value !== undefined ? item.value : item.label; const itemValue = item.value !== undefined ? item.value : item.label;
const currentValue = this.value.value !== undefined ? this.value.value : this.value.label; const currentValue = this.value.value !== undefined ? this.value.value : this.value.label;
return itemValue === currentValue; return itemValue === currentValue;
} },
} },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.icon-text-btn { .icon-text-btn {
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 4px 8px; padding: 4px 8px;
border-radius: 4px; border-radius: 4px;
transition: all 0.3s; transition: all 0.3s;
font-size: 14px; font-size: 14px;
color: #333333; color: #333333;
&:hover { &:hover {
color: #2A58AD; color: #2a58ad;
} }
i { i {
margin-right: 6px; margin-right: 6px;
font-size: 16px; font-size: 16px;
} }
.icon-img { .icon-img {
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-right: 6px; margin-right: 6px;
object-fit: contain; object-fit: contain;
vertical-align: middle; vertical-align: middle;
} }
&.has-selected { &.has-selected {
background-color: #EFF3F6; background-color: #eff3f6;
} }
&.is-disabled {
cursor: not-allowed;
color: #c0c4cc;
&:hover {
color: #c0c4cc;
}
}
} }
</style> </style>
<style> <style>
/* 全局样式,与父组件保持一致 */ .select-custom-dropdown {
.pure-popover { padding: 4px 0 !important;
padding: 4px 0 !important; border-color: #e5e6eb !important;
border-color: #E5E6EB !important; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important; }
.select-custom-dropdown .el-dropdown-menu__item {
display: flex;
align-items: center;
padding: 9px 16px;
font-size: 14px;
color: #333333;
line-height: 1.5;
}
.select-custom-dropdown .el-dropdown-menu__item.is-selected {
background-color: #f7f7f7;
} }
.popover-list { .select-custom-dropdown .el-dropdown-menu__item .icon-img {
list-style: none; width: 18px;
margin: 0; height: 18px;
padding: 0; border-radius: 3px;
margin-right: 8px;
li {
padding: 9px 16px;
cursor: pointer;
color: #333333;
font-size: 12px;
display: flex;
align-items: center;
&.is-selected {
background-color: #f7f7f7;
}
&:hover {
background-color: #F2F3F5;
}
i {
margin-right: 8px;
font-size: 14px;
}
.icon-img {
width: 18px;
height: 18px;
border-radius: 3px;
margin-right: 8px;
}
}
} }
</style> </style>
export default { export default {
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
chooseData: { chooseData: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}, },
inject: [ inject: [
'deepClone', "deepClone",
'GET_POSITION_TYPE_LIST', "GET_POSITION_TYPE_LIST",
'GET_PARAMS_INFO', "GET_PARAMS_INFO",
'GET_MERCHANT_LIST', "GET_MERCHANT_LIST",
'GET_BIZ', "GET_BIZ",
'DEL_PARAMS_MERCHANT_LIST' "DEL_PARAMS_MERCHANT_LIST",
], ],
computed: { computed: {
dialogShow: { dialogShow: {
get () { get() {
return this.visible return this.visible;
}, },
set (val) { set(val) {
this.chooseList = [] this.chooseList = [];
this.close() this.close();
} },
}, },
count () { count() {
return this.chooseList.length return this.chooseList.length;
}, },
positionTypeList () { positionTypeList() {
return this.GET_POSITION_TYPE_LIST && this.GET_POSITION_TYPE_LIST() return this.GET_POSITION_TYPE_LIST && this.GET_POSITION_TYPE_LIST();
}, },
paramsInfo () { paramsInfo() {
return this.GET_PARAMS_INFO && this.GET_PARAMS_INFO() return this.GET_PARAMS_INFO && this.GET_PARAMS_INFO();
}, },
merchantList () { merchantList() {
return this.GET_MERCHANT_LIST && this.GET_MERCHANT_LIST() return this.GET_MERCHANT_LIST && this.GET_MERCHANT_LIST();
}, },
biz () { biz() {
return this.GET_BIZ && this.GET_BIZ() return this.GET_BIZ && this.GET_BIZ();
}, },
delMerchantList(){ delMerchantList() {
return this.DEL_PARAMS_MERCHANT_LIST && this.DEL_PARAMS_MERCHANT_LIST() return this.DEL_PARAMS_MERCHANT_LIST && this.DEL_PARAMS_MERCHANT_LIST();
} },
}, },
watch: { watch: {
visible: { visible: {
handler (val) { handler(val) {
if (val) { if (val) {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm;
let multipleTable = this.multipleTable() let multipleTable = this.multipleTable();
if (multipleTable) multipleTable.page.currentPage = 1 if (multipleTable)
this.chooseList = this.deepClone(this.chooseData) multipleTable.page.currentPage = 1;
this.viewKey = Date.now() this.chooseList = this.deepClone(this.chooseData);
} this.viewKey = Date.now();
}, }
immediate: true, },
deep: true immediate: true,
}, deep: true,
}, },
},
mounted () { mounted() {
}, },
data () { data() {
return { return {
viewKey: Date.now(), viewKey: Date.now(),
config: { config: {
appendToBody: true, appendToBody: true,
isShowFooter: true, isShowFooter: true,
cancel_name: "取消", cancel_name: "取消",
confirm_name: "确定", confirm_name: "确定",
}, },
searchFormSearch: {}, searchFormSearch: {},
chooseList: [], chooseList: [],
} };
}, },
methods: { methods: {
getParams () { getParams() {
const params = this.deepClone(this.searchForm) const params = this.deepClone(this.searchForm);
return params return params;
}, },
beforeSearchFn () { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
this.searchFormSearch = this.getParams() this.searchFormSearch = this.getParams();
resolve() resolve();
}) });
}, },
close () { close() {
this.$emit('dialogClose') this.$emit("dialogClose");
}, },
remove (i, index) { remove(i, index) {
this.chooseList.splice(index, 1) this.chooseList.splice(index, 1);
let tableData = this.multipleTable().data let tableData = this.multipleTable().data;
tableData.map(j => { tableData.map((j) => {
if (i[this.targetId] === j[this.targetId]) { if (i[this.targetId] === j[this.targetId]) {
this.multipleTable().tableRef.toggleRowSelection(j, false) this.multipleTable().tableRef.toggleRowSelection(j, false);
} }
}) });
}, },
async submit () { async submit() {
this.$emit('choose', this.chooseList) this.$emit("choose", this.chooseList);
this.close() this.close();
}, },
handleReset () { handleReset() {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm;
this.multipleTable().page.currentPage = 1 this.multipleTable().page.currentPage = 1;
this.handleSearch() this.handleSearch();
}, },
handleSearch () { handleSearch() {
this.multipleTable().page.currentPage = 1 this.multipleTable().page.currentPage = 1;
this.multipleTable().refreshTable() this.multipleTable().refreshTable();
}, },
setTableFinishFun (data) { setTableFinishFun(data) {
this.$nextTick(() => { this.$nextTick(() => {
let { chooseList, targetId } = this let { chooseList, targetId } = this;
chooseList.map(item => { chooseList.map((item) => {
let index = data.findIndex(i => i[targetId] === item[targetId]) let index = data.findIndex(i => i[targetId] === item[targetId]);
if (index > -1) this.multipleTable().tableRef.toggleRowSelection(data[index], true) if (index > -1)
}) this.multipleTable().tableRef.toggleRowSelection(data[index], true);
}) });
}, });
selectionTable (list) { },
this.$nextTick(() => { selectionTable(list) {
let { targetId, chooseList } = this this.$nextTick(() => {
if (this.formatTag) list = list.map(e => { let { targetId, chooseList } = this;
return this.formatTag(e) if (this.formatTag) {
}) list = list.map((e) => {
// 合并列表后基于 targetId 去重 return this.formatTag(e);
const mergedList = [...chooseList, ...list] });
this.chooseList = [...new Map( }
mergedList.map(item => [item[targetId], item]) // 合并列表后基于 targetId 去重
).values()] const mergedList = [...chooseList, ...list];
}) this.chooseList = [...new Map(
}, mergedList.map(item => [item[targetId], item]),
selectRow (list, row) { ).values()];
let { targetId } = this, });
index = list.findIndex(i => i[targetId] === row[targetId]) },
if (index == -1) { selectRow(list, row) {
let delIndex = this.chooseList.findIndex(i => i[targetId] === row[targetId]) let { targetId } = this;
if (delIndex > -1) this.chooseList.splice(delIndex, 1) let index = list.findIndex(i => i[targetId] === row[targetId]);
} if (index == -1) {
}, let delIndex = this.chooseList.findIndex(i => i[targetId] === row[targetId]);
selectAll (list) { if (delIndex > -1)
if (!list.length) { this.chooseList.splice(delIndex, 1);
let tableData = this.multipleTable().data, }
{ targetId } = this },
// 使用 Set 存储 tableData 中的所有 targetId selectAll(list) {
const tableDataIds = new Set(tableData.map(item => item[targetId])); if (!list.length) {
// 保留 chooseList 中不在 tableData 的项目 let tableData = this.multipleTable().data;
this.chooseList = this.chooseList.filter(item => let { targetId } = this;
!tableDataIds.has(item[targetId]) // 使用 Set 存储 tableData 中的所有 targetId
); const tableDataIds = new Set(tableData.map(item => item[targetId]));
} // 保留 chooseList 中不在 tableData 的项目
}, this.chooseList = this.chooseList.filter(item =>
multipleTable () { !tableDataIds.has(item[targetId]),
return this.$refs.multipleTable );
}, }
clearChooseList () { },
this.chooseList = [] multipleTable() {
this.multipleTable().clearMutiSelect() return this.$refs.multipleTable;
} },
} clearChooseList() {
this.chooseList = [];
this.multipleTable().clearMutiSelect();
},
},
}
\ No newline at end of file \ No newline at end of file
};
\ No newline at end of file \ No newline at end of file
<template>
<el-drawer ref="drawer"
class="strategy-drawer"
size="50vw"
:visible.sync="dialogShow"
:wrapper-closable="false"
@close="close">
<template #title>
<div class="strategy-drawer-title">
添加协同任务
</div>
</template>
<div class="strategy-drawer-content">
<el-scrollbar class="content">
<el-form ref="form"
class="form"
label-width="110px"
:model="formData"
:rules="rules"
size="small">
<el-form-item label="任务类型:" prop="taskType">
<el-select v-model="formData.taskType"
placeholder="请选择任务类型"
style="width: 100%;">
<el-option v-for="(label, value) in taskTypeOptions"
:key="value"
:label="label"
:value="Number(value)">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="任务标题:" prop="taskTitle">
<el-input v-model="formData.taskTitle"
maxlength="20"
placeholder="请输入标题">
</el-input>
</el-form-item>
<el-form-item v-if="formData.taskType === 9"
label="问题人员:"
prop="staffList">
<el-button size="small" @click="openStaffDialog">
选择人员
</el-button>
<div v-if="formData.staffList && formData.staffList.length > 0" class="tags-container">
<el-tag v-for="(item, index) in formData.staffList"
:key="item.staffUuid"
class="staff-tag"
closable
@close="removeStaff(index)">
{{ item.staffName }}
</el-tag>
</div>
</el-form-item>
<el-form-item label="执行人员:" prop="executorUuid">
<el-select v-model="formData.executorUuid"
placeholder="请选择执行人员"
style="width: 100%;">
<el-option v-for="item in executorList"
:key="item.directorUserId"
:label="item.directorName"
:value="item.directorUserId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="任务说明:" prop="description">
<el-input v-model="formData.description"
maxlength="200"
placeholder="请输入任务说明"
:rows="6"
type="textarea">
</el-input>
</el-form-item>
</el-form>
</el-scrollbar>
<div class="footer">
<el-button v-preventReClick
size="small"
@click="close">
取消
</el-button>
<el-button :loading="loading"
size="small"
type="primary"
@click="confirm">
确定
</el-button>
</div>
</div>
<MultipleStaff ref="staffTagRef"
:choose-data="formData.staffList"
:visible="staffTagVisible"
@choose="handleStaffChoose"
@dialogClose="staffTagVisible = false">
</MultipleStaff>
</el-drawer>
</template>
<script>
import { batchCreateStrategy, getStrategyShopMerchantOperators, getStrategyStaffList } from "@/api/earlyWarningManager";
import MultipleStaff from "../AddStrategy/MultipleStaff.vue";
export default {
name: "AddTask",
components: {
MultipleStaff,
},
inject: ["GET_PARAMS_INFO", "GET_MERCHANT_NAME"],
provide() {
return {
GET_POSITION_TYPE_LIST: () => this.positionTypeList,
GET_MERCHANT_LIST: () => [],
GET_BIZ: () => this.biz,
DEL_PARAMS_MERCHANT_LIST: () => false,
};
},
props: {
visibleSync: {
type: Boolean,
default: false,
},
biz: {
type: Number,
default: 1,
},
},
data() {
return {
loading: false,
taskTypeOptions: {
9: "人员更换评估",
10: "商务政策更新评估",
11: "多品类拓张",
12: "流量问题改善",
},
formData: {
taskType: "",
taskTitle: "",
staffList: [],
executorUuid: "",
description: "",
},
rules: {
taskType: [
{ required: true, message: "请选择任务类型", trigger: "change" },
],
staffList: [
{
validator: (rule, value, callback) => {
if (this.formData.taskType === 9 && (!value || value.length === 0)) {
callback(new Error("请选择问题人员"));
} else {
callback();
}
},
trigger: "change",
},
],
executorUuid: [
{ required: true, message: "请选择执行人员", trigger: "change" },
],
description: [
{ required: true, message: "请输入任务说明", trigger: "blur" },
],
},
staffTagVisible: false,
positionTypeList: [0], // 0:驻店人员
executorList: [], // 区域运营列表
};
},
computed: {
dialogShow: {
get() {
return this.visibleSync;
},
set(val) {
this.$emit("update:visibleSync", val);
},
},
paramsInfo() {
return this.GET_PARAMS_INFO && this.GET_PARAMS_INFO();
},
merchantName() {
return this.GET_MERCHANT_NAME && this.GET_MERCHANT_NAME();
},
},
watch: {
visibleSync(val) {
if (val) {
this.init();
}
},
"formData.taskType": function (val) {
// 切换任务类型时,如果不是人员更换评估,清空问题人员
if (val !== 9) {
this.formData.staffList = [];
}
// 触发重新校验
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.validateField("staffList");
}
});
},
},
methods: {
init() {
this.formData = {
taskType: "",
taskTitle: "",
staffList: [],
executorUuid: "",
description: "",
};
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.clearValidate();
}
});
this.loadExecutors();
},
close() {
this.dialogShow = false;
},
loadExecutors() {
const params = {
merchantId: this.paramsInfo ? this.paramsInfo.merchantIds[0] : "",
businessType: this.biz,
};
getStrategyShopMerchantOperators(params).then((res) => {
if (res && res.length) {
this.executorList = res;
} else {
this.executorList = [];
}
}).catch(() => {
this.executorList = [];
});
},
openStaffDialog() {
this.staffTagVisible = true;
},
removeStaff(index) {
this.formData.staffList.splice(index, 1);
},
handleStaffChoose(list) {
this.formData.staffList = list;
this.$refs.form.validateField("staffList");
},
confirm() {
try {
this.loading = true;
let { paramsInfo, merchantName, formData, biz } = this;
let { taskType, taskTitle, staffList, executorUuid, description } = formData;
this.$refs.form.validate(async (valid) => {
if (valid) {
const executor = this.executorList.find(item => item.directorUserId === executorUuid);
let params = {
strategyInfo: {
strategyType: taskType,
biz,
title: taskTitle,
description,
},
merchantList: [
{
merchantId: paramsInfo.merchantIds[0],
merchantName,
},
],
};
let allStaffs = [];
if (staffList && staffList.length) {
if (staffList.length > 100) {
this.loading = false;
this.$message.error("最多只能选择100个问题人员");
return;
}
allStaffs = staffList.map(e => ({
userUuid: e.staffUuid,
userName: e.staffName,
userPhone: e.phoneNumber,
userPosition: 0, // 问题人员
}));
}
if (executor) {
allStaffs.push({
userUuid: executor.directorUserId,
userName: executor.directorName,
userPhone: executor.directorPhone,
userPosition: biz === 2 ? 8 : 9, // 执行人员:轻改=8,权益、延保=9
});
}
if (allStaffs.length) {
params.staffList = allStaffs;
}
console.log(params);
const data = await batchCreateStrategy(params);
this.loading = false;
if (data) {
this.$emit("refresh");
this.$message.success("操作成功");
this.close();
} else {
this.$message.error("操作失败");
}
} else {
this.loading = false;
}
});
} catch (error) {
console.log(error, "===");
this.loading = false;
if (error)
this.$message.error(error);
console.log(error);
}
},
},
};
</script>
<style scoped lang="scss">
::v-deep.strategy-drawer {
.el-drawer__header {
padding: 0;
margin: 0;
border-bottom: 1px solid #e5e5e5;
}
.el-drawer__close-btn {
padding: 0 20px;
.el-dialog__close {
font-weight: 700;
font-size: 24px;
}
}
&-title {
height: 26px;
line-height: 26px;
color: #333333;
font-size: 18px;
padding: 17px 20px;
font-weight: bold;
}
&-content {
height: calc(100vh - 61px);
.content {
height: calc(100% - 61px);
.form {
padding: 20px;
.tags-container {
margin-top: 10px;
padding: 10px;
border: 1px solid #e4e7ed;
border-radius: 4px;
min-height: 40px;
max-height: 120px;
overflow-y: auto;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.staff-tag {
margin-right: 0;
}
}
}
.footer {
padding: 14px 0;
border-top: 1px solid #e5e5e5;
display: flex;
justify-content: flex-end;
padding-right: 20px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<el-drawer ref="drawer"
class="strategy-drawer"
size="50vw"
:visible.sync="dialogShow"
:wrapper-closable="false"
@close="close">
<template #title>
<div class="strategy-drawer-title">
添加带教申请
</div>
</template>
<div class="strategy-drawer-content">
<el-scrollbar class="content">
<el-form ref="form"
class="form"
label-width="110px"
:model="formData"
:rules="rules"
size="small">
<el-form-item label="需带教人员:" prop="staffList">
<el-button size="small" @click="openStaffDialog">
选择人员
</el-button>
<div v-if="formData.staffList && formData.staffList.length > 0" class="tags-container">
<el-tag v-for="(item, index) in formData.staffList"
:key="item.staffUuid"
class="staff-tag"
closable
@close="removeStaff(index)">
{{ item.staffName }}
</el-tag>
</div>
</el-form-item>
<el-form-item label="申请说明:" prop="description">
<el-input v-model="formData.description"
maxlength="200"
placeholder="请输入申请说明"
:rows="6"
type="textarea">
</el-input>
</el-form-item>
</el-form>
</el-scrollbar>
<div class="footer">
<el-button v-preventReClick
size="small"
@click="close">
取消
</el-button>
<el-button :loading="loading"
size="small"
type="primary"
@click="confirm">
确定
</el-button>
</div>
</div>
<MultipleStaff ref="staffTagRef"
:choose-data="formData.staffList"
:visible="staffTagVisible"
@choose="handleStaffChoose"
@dialogClose="staffTagVisible = false">
</MultipleStaff>
</el-drawer>
</template>
<script>
import { batchCreateStrategy } from "@/api/earlyWarningManager";
import MultipleStaff from "../AddStrategy/MultipleStaff.vue";
export default {
name: "AddTeaching",
components: {
MultipleStaff,
},
inject: ["GET_PARAMS_INFO", "GET_MERCHANT_NAME"],
provide() {
return {
GET_POSITION_TYPE_LIST: () => this.positionTypeList,
GET_MERCHANT_LIST: () => [],
GET_BIZ: () => this.biz,
DEL_PARAMS_MERCHANT_LIST: () => false,
};
},
props: {
visibleSync: {
type: Boolean,
default: false,
},
biz: {
type: Number,
default: 1,
},
},
data() {
return {
loading: false,
formData: {
staffList: [],
description: "",
},
rules: {
staffList: [
{ type: "array", required: true, message: "请选择需带教人员", trigger: "change" },
],
description: [
{ required: true, message: "请输入申请说明", trigger: "blur" },
],
},
staffTagVisible: false,
positionTypeList: [0], // 0:驻店人员
};
},
computed: {
dialogShow: {
get() {
return this.visibleSync;
},
set(val) {
this.$emit("update:visibleSync", val);
},
},
paramsInfo() {
return this.GET_PARAMS_INFO && this.GET_PARAMS_INFO();
},
merchantName() {
return this.GET_MERCHANT_NAME && this.GET_MERCHANT_NAME();
},
},
watch: {
visibleSync(val) {
if (val) {
this.init();
}
},
},
methods: {
init() {
this.formData = {
staffList: [],
description: "",
};
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.clearValidate();
}
});
},
close() {
this.dialogShow = false;
},
openStaffDialog() {
this.staffTagVisible = true;
},
removeStaff(index) {
this.formData.staffList.splice(index, 1);
},
handleStaffChoose(list) {
this.formData.staffList = list;
this.$refs.form.validateField("staffList");
},
confirm() {
try {
this.loading = true;
const { paramsInfo, merchantName, formData, biz } = this;
const { staffList, description } = formData;
this.$refs.form.validate(async (valid) => {
if (valid) {
const params = {
strategyInfo: {
strategyType: 8,
biz,
description,
},
merchantList: [
{
merchantId: paramsInfo.merchantIds[0],
merchantName,
},
],
};
if (staffList && staffList.length) {
if (staffList.length > 100) {
this.loading = false;
this.$message.error("最多只能选择100个人员");
return;
}
params.staffList = staffList.map((e) => {
return {
userUuid: e.staffUuid,
userName: e.staffName,
userPhone: e.phoneNumber,
userPosition: e.positionType,
};
});
}
console.log(params);
const data = await batchCreateStrategy(params);
this.loading = false;
if (data) {
this.$emit("refresh");
this.$message.success("操作成功");
this.close();
} else {
this.$message.error("操作失败");
}
} else {
this.loading = false;
}
});
} catch (error) {
console.log(error, "===");
this.loading = false;
if (error)
this.$message.error(error);
console.log(error);
}
},
},
};
</script>
<style scoped lang="scss">
::v-deep.strategy-drawer {
.el-drawer__header {
padding: 0;
margin: 0;
border-bottom: 1px solid #e5e5e5;
}
.el-drawer__close-btn {
padding: 0 20px;
.el-dialog__close {
font-weight: 700;
font-size: 24px;
}
}
&-title {
height: 26px;
line-height: 26px;
color: #333333;
font-size: 18px;
padding: 17px 20px;
font-weight: bold;
}
&-content {
height: calc(100vh - 61px);
.content {
height: calc(100% - 61px);
.form {
padding: 20px;
.tags-container {
margin-top: 10px;
padding: 10px;
border: 1px solid #e4e7ed;
border-radius: 4px;
min-height: 40px;
max-height: 120px;
overflow-y: auto;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.staff-tag {
margin-right: 0;
}
}
}
.footer {
padding: 14px 0;
border-top: 1px solid #e5e5e5;
display: flex;
justify-content: flex-end;
padding-right: 20px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<baseDialog <baseDialog class="detail-content"
:is-show.sync="dialogShow" :dialog-config="dialogConfig.config"
:dialog-config="dialogConfig.config" :is-show.sync="dialogShow"
class="detail-content" @handleClick="submit">
@handleClick="submit" <el-form ref="form"
> class="form"
<el-form label-width="120px"
ref="form" :model="formData"
class="form" :rules="formRules"
label-width="120px" size="small"
size="small" @submit.native.prevent="submit">
:rules="formRules" <el-form-item label="停止展业日期:"
:model="formData" prop="nodeDate">
@submit.native.prevent="submit" <el-date-picker v-model="formData.nodeDate"
> :picker-options="afterTodayOptions"
<el-form-item placeholder="请选择停止展业日期"
label="停止展业日期:" type="date">
prop="nodeDate"
>
<el-date-picker
v-model="formData.nodeDate"
type="date"
placeholder="请选择停止展业日期"
:picker-options="afterTodayOptions"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -32,125 +24,128 @@ ...@@ -32,125 +24,128 @@
<script> <script>
import { import {
stopBusiness, stopBusiness,
} from "@api/earlyWarningManager" } from "@api/earlyWarningManager";
import dayjs from "dayjs"; import dayjs from "dayjs";
export default { export default {
name: "AddStaff", name: "AddStaff",
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
minDate: { minDate: {
type: String, type: String,
default: dayjs().format("YYYY-MM-DD") default: dayjs().format("YYYY-MM-DD"),
} },
}, },
inject: ['GET_PARAMS_INFO'], inject: ["GET_PARAMS_INFO"],
data() {
return {
formData: {
nodeDate: "",
},
formRules: {
nodeDate: [{ required: true, message: "请选择停止展业日期", trigger: "blur" }],
},
dialogConfig: {
config: {
title: "停止展业",
width: "640px",
},
},
};
},
computed: { computed: {
dialogShow: { dialogShow: {
get () { get() {
return this.visible return this.visible;
}, },
set (val) { set(val) {
this.close() this.close();
} },
}, },
afterTodayOptions () { afterTodayOptions() {
return { return {
disabledDate: (time) => { disabledDate: (time) => {
return ( return (
time.getTime() < dayjs(this.minDate).valueOf() // 小于最小日期 → 禁用 time.getTime() < dayjs(this.minDate).valueOf() // 小于最小日期 → 禁用
); );
} },
} };
}, },
paramsInfo () { paramsInfo() {
return this.GET_PARAMS_INFO() return this.GET_PARAMS_INFO();
}, },
}, },
mounted () { mounted() {
}, },
data () { methods: {
return { close() {
formData: { this.formData = this.$options.data.call(this).formData;
nodeDate: '', this.$refs?.form?.resetFields();
}, this.$emit("dialogClose");
formRules: { },
nodeDate: [{ required: true, message: '请选择停止展业日期', trigger: 'blur' }], submit() {
}, this.$refs.form.validate(async (valid) => {
dialogConfig: { if (valid) {
config: { const { merchantIds, bizs } = this.paramsInfo;
title: "停止展业", const { nodeDate } = this.formData;
width: "640px" const data = await stopBusiness({
} merchantId: merchantIds[0],
}, sceneType: bizs == 2 ? 1 : 0, // 业务场景(0.会员权益(延保权益),1.精品升级(轻改))
} bizs,
}, nodeDate: dayjs(nodeDate).format("YYYY-MM-DD HH:mm:ss"),
methods: { });
close () { if (data) {
this.formData = this.$options.data.call(this).formData this.$emit("refresh");
this.$refs?.form?.resetFields() this.$message.success("操作成功");
this.$emit('dialogClose') this.close();
}, } else {
submit () { this.$message.error("操作失败");
this.$refs.form.validate(async (valid) => { }
if (valid) { }
const { merchantIds } = this.paramsInfo, });
{ nodeDate } = this.formData, },
data = await stopBusiness({ },
merchantId: merchantIds[0], };
sceneType: 0,
bizs: 1,
nodeDate: dayjs(nodeDate).format("YYYY-MM-DD HH:mm:ss")
})
if(data) {
this.$emit('refresh')
this.$message.success('操作成功')
this.close()
}else this.$message.error('操作失败')
}
})
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.flex { .flex {
display: flex; display: flex;
align-items: center; align-items: center;
} }
::v-deep.el-dialog__wrapper { ::v-deep.el-dialog__wrapper {
overflow: hidden !important; overflow: hidden !important;
.el-dialog { .el-dialog {
margin: 50vh auto 0 !important; margin: 50vh auto 0 !important;
transform: translateY(-50%); transform: translateY(-50%);
.el-dialog__body { .el-dialog__body {
padding: 0; padding: 0;
// padding-bottom: 24px; // padding-bottom: 24px;
// border-bottom: 1px solid #e6e6e6; // border-bottom: 1px solid #e6e6e6;
} }
.el-dialog__footer { .el-dialog__footer {
margin-top: auto; margin-top: auto;
border-top: 1px solid #e5e5e5; border-top: 1px solid #e5e5e5;
padding: 15px 20px 15px; padding: 15px 20px 15px;
} }
.dialog-footer { .dialog-footer {
border-top: none; border-top: none;
padding: 0; padding: 0;
} }
} }
} }
.detail-content { .detail-content {
.form { .form {
padding: 52px 42px 34px; padding: 52px 42px 34px;
.el-date-editor { .el-date-editor {
width: 100%; width: 100%;
} }
} }
} }
</style> </style>
<template> <template>
<baseDialog <baseDialog class="detail-content"
:is-show.sync="dialogShow" :config="config"
:dialog-config="dialogConfig.config" :dialog-config="dialogConfig.config"
class="detail-content" :is-show.sync="dialogShow">
:config="config"
>
<div class="content"> <div class="content">
<d2-table <d2-table ref="table"
class="table" class="table"
ref="table" :has-num="false"
:search-form="formSearch" :has-page="false"
:table-params="tableParams" :search-form="formSearch"
:table-data="list" :table-data="list"
:has-page="false" :table-params="tableParams">
:has-num="false"
>
</d2-table> </d2-table>
<div class="block"></div> <div class="block"></div>
</div> </div>
...@@ -23,156 +19,156 @@ ...@@ -23,156 +19,156 @@
<script> <script>
import { import {
getStrategyMerchantAnalysisIndexHistory, getStrategyMerchantAnalysisIndexHistory,
} from "@api/earlyWarningManager" } from "@api/earlyWarningManager";
export default { export default {
name: "HistoryTarget", name: "HistoryTarget",
inject: [ inject: [
'GET_PARAMS_INFO', "GET_PARAMS_INFO",
], ],
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
index: { index: {
type: Number, type: Number,
default: 0 default: 0,
} },
}, },
computed: { data() {
dialogShow: { return {
get () { config: {
return this.visible isShowFooter: true,
}, cancel_name: "返回",
set (val) { hideConfirmBtn: true,
this.close() },
} dialogConfig: {
}, config: {
merchantId () { title: "历史兜底目标",
let [merchantId] = this.GET_PARAMS_INFO().merchantIds width: "600px",
return merchantId },
} },
}, formSearch: {},
watch: { tableParams: {
visible: function (val) { tableColumns: [
if (val) { {
this.list = [] label: "月份",
this.getList() prop: "recordYearMonth",
} minWidth: 64,
} },
}, {
label: "渗透率兜底目标",
minWidth: 80,
formatter: (row) => {
let val = row[
{
0: "ewPenetrationRate",
1: "ewAxbPenetrationRate",
2: "batteryPenetrationRate",
3: "ewLtPenetrationRate",
}[this.index]
] || null;
return val != null ? val + "%" : "-";
},
},
{
label: "转化率兜底目标",
minWidth: 80,
formatter: (row) => {
let val = row[
{
0: "ewConRate",
1: "ewAxbConRate",
2: "batteryConversionRate",
3: "ewLtConRate",
}[this.index]
] || null;
return val != null ? val + "%" : "-";
},
},
],
},
list: [],
};
},
computed: {
dialogShow: {
get() {
return this.visible;
},
set(val) {
this.close();
},
},
merchantId() {
let [merchantId] = this.GET_PARAMS_INFO().merchantIds;
return merchantId;
},
},
watch: {
visible(val) {
if (val) {
this.list = [];
this.getList();
}
},
},
mounted () { mounted() {
}, },
data () { methods: {
return { close() {
config: { this.$emit("dialogClose");
isShowFooter: true, },
cancel_name: "返回", async getList() {
hideConfirmBtn: true const { merchantId } = this;
}, const data = await getStrategyMerchantAnalysisIndexHistory({
dialogConfig: { bizs: 1,
config: { merchantId,
title: "历史兜底目标", });
width: "600px" this.list = data;
} },
}, },
formSearch: {}, };
tableParams: {
tableColumns: [
{
label: "月份",
prop: 'recordYearMonth',
minWidth: 64,
},
{
label: "渗透率兜底目标",
minWidth: 80,
formatter: (row) => {
let val = row[
{
0: 'ewPenetrationRate',
1: 'ewAxbPenetrationRate',
2: 'batteryPenetrationRate',
3: 'ewLtPenetrationRate'
}[this.index]
] || null
return val != null ? val + '%' : '-'
}
},
{
label: "转化率兜底目标",
minWidth: 80,
formatter: (row) => {
let val = row[
{
0: 'ewConRate',
1: 'ewAxbConRate',
2: 'batteryConversionRate',
3: 'ewLtConRate'
}[this.index]
] || null
return val != null ? val + '%' : '-'
}
},
]
},
list: []
}
},
methods: {
close () {
this.$emit('dialogClose')
},
async getList () {
const { merchantId } = this,
data = await getStrategyMerchantAnalysisIndexHistory({
bizs: 1,
merchantId
})
this.list = data
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.flex { .flex {
display: flex; display: flex;
align-items: center; align-items: center;
} }
::v-deep.el-dialog__wrapper { ::v-deep.el-dialog__wrapper {
overflow: hidden !important; overflow: hidden !important;
.el-dialog { .el-dialog {
margin: 50vh auto 0 !important; margin: 50vh auto 0 !important;
transform: translateY(-50%); transform: translateY(-50%);
.el-dialog__body { .el-dialog__body {
padding: 0; padding: 0;
// padding-bottom: 24px; // padding-bottom: 24px;
// border-bottom: 1px solid #e6e6e6; // border-bottom: 1px solid #e6e6e6;
} }
.el-dialog__footer { .el-dialog__footer {
margin-top: auto; margin-top: auto;
border-top: 1px solid #e5e5e5; border-top: 1px solid #e5e5e5;
padding: 15px 20px 15px; padding: 15px 20px 15px;
} }
.dialog-footer { .dialog-footer {
border-top: none; border-top: none;
padding: 0; padding: 0;
} }
} }
} }
.detail-content { .detail-content {
.content { .content {
height: 592px; height: 592px;
box-sizing: border-box; box-sizing: border-box;
padding: 20px; padding: 20px;
overflow-y: auto; overflow-y: auto;
.table { .table {
width: 100%; width: 100%;
} }
} }
} }
</style> </style>
<template> <template>
<div class="storeSignboard-container"> <div class="storeSignboard-container">
<div class="calendar-box"> <div class="calendar-box">
<!-- 时间切换和日期选择器 --> <!-- 时间切换和日期选择器 -->
<CalendarCustom ref="calendarCustom" <CalendarCustom ref="calendarCustom"
v-model="timeRangeType" v-model="timeRangeType"
:time-range-options="timeRangeOptions" :date-format="dateFormat"
:date-range.sync="dateRange" :date-range.sync="dateRange"
:date-format="dateFormat" :time-range-options="timeRangeOptions"
@date-range-change="handleDateRangeChange" /> @date-range-change="handleDateRangeChange" />
</div>
<div class="merchant-info flex">
<div class="merchant-icon flex">
<img class="icon"
:src="`${IMG_URL}merchant-icon.webp`">
</div>
<div class="info ">
<div class="name text-hide">
{{ merchantDetailInfo.merchantName || '-' }}
</div> </div>
<div class="merchant-info flex"> <div class="control flex">
<div class="merchant-icon flex"> <div class="scene flex">
<img :src="`${IMG_URL}merchant-icon.webp`" <img class="scene-icon"
class="icon"> :src="`${IMG_URL}scene-icon.webp`">
</div> 业务:{{ businessLabel }}
<div class="info "> </div>
<div class="name text-hide"> <el-button class="change-store"
{{ merchantDetailInfo.merchantName || '-' }} type="text"
</div> @click="merchantVisible = true">
<div class="control flex"> 切换门店
<div class="scene flex"> <i class="el-icon-sort"></i>
<img :src="`${IMG_URL}scene-icon.webp`" </el-button>
class="scene-icon">
业务:延保
</div>
<el-button type="text"
class="change-store"
@click="merchantVisible = true">
切换门店
<i class="el-icon-sort"></i>
</el-button>
</div>
</div>
</div> </div>
<div class="merchant-detail flex"> </div>
<template v-for="(item, index) in formList"> </div>
<div :key="index" <div class="merchant-detail flex">
class="item flex" <template v-for="(item, index) in formList">
:class="[item.className]"> <div :key="index"
<div class="label"> class="item flex"
{{ item.label }}: :class="[item.className]">
</div> <div class="label">
<template v-if=" merchantDetailInfo[item.key]"> {{ item.label }}:
<template v-if="item.tooltip"> </div>
<el-tooltip effect="dark" <template v-if=" merchantDetailInfo[item.key]">
placement="top"> <template v-if="item.tooltip">
<template #content> <el-tooltip effect="dark"
<div class="tooltip-content-max"> placement="top">
<div>{{ merchantDetailInfo[item.key] }}</div> <template #content>
</div> <div class="tooltip-content-max">
</template> <div>{{ merchantDetailInfo[item.key] }}</div>
<span class="text-hide value">{{ merchantDetailInfo[item.key] }}</span> </div>
</el-tooltip> </template>
</template> <span class="text-hide value">{{ merchantDetailInfo[item.key] }}</span>
<template v-else> </el-tooltip>
<div class="value text-hide"> </template>
{{ merchantDetailInfo[item.key] }} <template v-else>
</div> <div class="value text-hide">
</template> {{ merchantDetailInfo[item.key] }}
</template> </div>
<template v-else>
-
</template>
</div>
</template> </template>
</template>
<template v-else>
-
</template>
</div> </div>
<ChangeMerchantDialog :visible="merchantVisible" </template>
:merchant-id="merchantDetailInfo.merchantNo"
@dialogClose="merchantVisible = false"
@changeMerchant="changeMerchant">
</ChangeMerchantDialog>
</div> </div>
<ChangeMerchantDialog :merchant-id="merchantDetailInfo.merchantNo"
:visible="merchantVisible"
@changeMerchant="changeMerchant"
@dialogClose="merchantVisible = false">
</ChangeMerchantDialog>
</div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
...@@ -118,8 +118,8 @@ export default { ...@@ -118,8 +118,8 @@ export default {
tooltip: true, tooltip: true,
}, },
{ {
label: "区域运营", label: "区域督导",
key: "areaOperatorText", key: "flightSupervisionext",
tooltip: true, tooltip: true,
}, },
{ {
...@@ -138,6 +138,17 @@ export default { ...@@ -138,6 +138,17 @@ export default {
paramsInfo() { paramsInfo() {
return this.GET_PARAMS_INFO(); return this.GET_PARAMS_INFO();
}, },
businessLabel() {
const BIZ_LABEL_MAP = {
1: "延保",
2: "轻改",
3: "权益",
};
const routeLabel = this.$route.query.businessLabel;
if (routeLabel)
return routeLabel;
return BIZ_LABEL_MAP[this.paramsInfo.bizs] || "-";
},
}, },
mounted() { mounted() {
...@@ -158,9 +169,9 @@ export default { ...@@ -158,9 +169,9 @@ export default {
}); });
}, },
async getStrategyMerchantDetail(merchantNo = "") { async getStrategyMerchantDetail(merchantNo = "") {
let { merchantIds } = this.paramsInfo; let { merchantIds, bizs } = this.paramsInfo;
let data = await getStrategyMerchantDetail({ let data = await getStrategyMerchantDetail({
businessType: 1, businessType: bizs || 1,
merchantNo: merchantNo || merchantIds[0], merchantNo: merchantNo || merchantIds[0],
}); });
data.directSalesFlagText = { data.directSalesFlagText = {
...@@ -186,6 +197,8 @@ export default { ...@@ -186,6 +197,8 @@ export default {
data.onlineOperatorText = data.onlineOperator.map(e => e.username).join("/"); data.onlineOperatorText = data.onlineOperator.map(e => e.username).join("/");
if (data.areaOperator && data.areaOperator.length) if (data.areaOperator && data.areaOperator.length)
data.areaOperatorText = data.areaOperator.map(e => e.username).join("/"); data.areaOperatorText = data.areaOperator.map(e => e.username).join("/");
if (data.flightSupervision && data.flightSupervision.length)
data.flightSupervisionText = data.flightSupervision.map(e => e.username).join("/");
this.merchantDetailInfo = data; this.merchantDetailInfo = data;
}, },
changeMerchant(e) { changeMerchant(e) {
......
import dayjs from "dayjs" /*
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2026-04-01 09:57:49
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-06-02 17:54:09
* @FilePath: \dj-car-life-system\src\views\earlyWarningManager\strategyCentre\storeSignboard\components\StrategyList\contant.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import dayjs from "dayjs";
const STRATEGYTYPEOPTIONS = { const STRATEGYTYPEOPTIONS = {
0: '学习', 0: "学习",
1: '优秀案例分享', 1: "优秀案例分享",
2: '带教', 2: "带教",
3: '任务下发', 3: "任务下发",
4: '销售精英到店提拉', 4: "销售精英到店提拉",
5: '强力促销', 5: "强力促销",
6: '最终盘点与低客单产品购入', 6: "最终盘点与低客单产品购入",
7: '留言' 7: "留言",
} 8: "带教申请",
9: "人员更换评估",
10: "商务政策更新评估",
11: "多品类拓张",
12: "流量问题改善",
};
const DATE_RANGE = { const DATE_RANGE = {
label: '执行周期', label: "执行周期",
format: (val) => { format: (val) => {
let { startDate, endDate } = val let { startDate, endDate } = val;
return `${dayjs(startDate).format('YYYY-MM-DD')}至 ${dayjs(endDate).format('YYYY-MM-DD')}` return `${dayjs(startDate).format("YYYY-MM-DD")}至 ${dayjs(endDate).format("YYYY-MM-DD")}`;
} },
} };
const STAFF_FORMAT = (label) => { function STAFF_FORMAT(label) {
return { return {
label, label,
format: (val) => { format: (val) => {
let { staffList } = val let { staffList } = val;
return staffList.map(item => item.userName).join('/') || '-' return staffList.filter(item => !item.userPosition).map(item => item.userName).join("/") || "-";
} },
} };
} }
const STRATEGY_01 = [ const STRATEGY_01 = [
STAFF_FORMAT('学习人员'), STAFF_FORMAT("学习人员"),
{ {
label: '学习内容', label: "学习内容",
className: 'two-line-ellipsis', className: "two-line-ellipsis",
format: (val) => { format: (val) => {
let { courseList, recordingList, strategyType } = val let { courseList, recordingList, strategyType } = val;
return strategyType == 1 ? return strategyType == 1
recordingList.map(item => `《${item.receptionStaffName}${item.receptionDate}》`).join('\t') : ? recordingList.map(item => `《${item.receptionStaffName}${item.receptionDate}》`).join("\t")
courseList.map(item => `《${item.courseName}》`).join('\t') : courseList.map(item => `《${item.courseName}》`).join("\t");
} },
}, },
DATE_RANGE DATE_RANGE,
] ];
const STRATEGY_2456 = [ const STRATEGY_2456 = [
{ {
...STAFF_FORMAT('执行人'), ...STAFF_FORMAT("执行人"),
hide: (val) => { hide: (val) => {
let { strategyType } = val let { strategyType } = val;
return [5, 6].includes(strategyType) return [5, 6].includes(strategyType);
}, },
}, },
DATE_RANGE DATE_RANGE,
] ];
const STRATEGY_3 = [ const STRATEGY_3 = [
{ {
label: '标题', label: "标题",
key: 'title', key: "title",
}, },
STAFF_FORMAT('处理人'), STAFF_FORMAT("处理人"),
{ {
label: '执行时间', label: "执行时间",
format: (val) => { format: (val) => {
let { startDate, createdDate } = val let { startDate, createdDate } = val;
return `${dayjs(startDate ? startDate : createdDate).format('YYYY-MM-DD HH:mm:ss')}` return `${dayjs(startDate || createdDate).format("YYYY-MM-DD HH:mm:ss")}`;
} },
}, },
] ];
const STRATEGY_7 = [ const STRATEGY_7 = [
{ {
label: '留言人', label: "留言人",
key: 'createdBy', key: "createdBy",
}, },
STAFF_FORMAT('处理人') STAFF_FORMAT("处理人"),
] ];
const STRATEGY_8 = [
STAFF_FORMAT("需带教人员"),
];
const STRATEGY_9 = [
STAFF_FORMAT("问题人员"),
{
label: "执行人员",
format: (val) => {
let { staffList } = val;
return staffList.filter(item => item.userPosition != 0).map(item => item.userName).join("/") || "-";
},
},
];
const STRATEGY_10_11_12 = [
{
label: "执行人员",
format: (val) => {
let { staffList } = val;
return staffList.filter(item => item.userPosition != 0).map(item => item.userName).join("/") || "-";
},
},
];
export { export {
STRATEGYTYPEOPTIONS, STRATEGY_01,
STRATEGY_01, STRATEGY_3,
STRATEGY_2456, STRATEGY_7,
STRATEGY_3, STRATEGY_8,
STRATEGY_7, STRATEGY_9,
STRATEGY_10_11_12,
STRATEGY_2456,
STRATEGYTYPEOPTIONS,
}
\ No newline at end of file \ No newline at end of file
};
\ No newline at end of file \ No newline at end of file
<template>
<el-drawer class="strategy-drawer"
size="69.44vw"
:visible.sync="dialogShow"
:wrapper-closable="false"
@close="close">
<template #title>
<div class="strategy-drawer-title">
查看详情
</div>
</template>
<div class="drawer-content">
<el-scrollbar class="scrollbar-wrapper">
<div class="detail-container">
<div v-for="(section, index) in detailData"
:key="index"
class="detail-section">
<div class="section-title">
{{ section.title }}
</div>
<div class="section-content">
<el-row>
<el-col v-for="(item, idx) in section.config"
:key="idx"
class="info-item"
:span="item.fullRow ? 24 : 12">
<div class="info-label">
{{ item.subtitle }}
</div>
<div class="info-value">
<template v-if="!item.isImage">
{{ item.value || '-' }}
</template>
<template v-else>
<div v-if="item.value && item.value.length > 0" class="image-list">
<el-image v-for="(img, imgIdx) in item.value"
:key="imgIdx"
fit="cover"
:preview-src-list="item.value"
:src="img"
style="width: 80px; height: 80px; margin-right: 10px; border-radius: 4px;">
</el-image>
</div>
<div v-else>
-
</div>
</template>
</div>
</el-col>
</el-row>
</div>
</div>
</div>
</el-scrollbar>
<div class="footer">
<el-button v-preventReClick
:size="size"
@click="close">
返回
</el-button>
</div>
</div>
</el-drawer>
</template>
<script>
import { queryStrategyStudyDetailById } from "@/api/earlyWarningManager";
export default {
name: "TeachingDetail",
props: {
visibleSync: {
type: Boolean,
default: false,
},
item: {
type: Object,
default: () => ({}),
},
},
data() {
return {
size: "small",
detailData: [],
};
},
computed: {
dialogShow: {
get() {
return this.visibleSync;
},
set(val) {
this.$emit("update:visibleSync", val);
},
},
},
watch: {
visibleSync(val) {
if (val) {
this.initData();
}
},
},
methods: {
close() {
this.dialogShow = false;
},
async initData() {
if (!this.item.id)
return;
try {
this.item.id = 133;
const res = await queryStrategyStudyDetailById({ id: this.item.id });
if (res) {
this.formatDetailData(res);
}
} catch (error) {
console.error(error);
}
},
formatDetailData(data) {
const staffList = data.staffList || [];
const targetStaffs = staffList.filter(e => e.userPosition === 0).map(e => e.userName).join("/");
const detailData = [
{
title: "申请信息",
config: [
{ subtitle: "需带教人员:", value: targetStaffs || "-", fullRow: true },
{ subtitle: "申请说明:", value: data.description || "-", fullRow: true },
{ subtitle: "操作人:", value: data.createdBy || "-", fullRow: false },
{ subtitle: "操作时间:", value: data.createdDate || "-", fullRow: false },
],
},
];
const mentoringAppDetail = data.mentoringApplicationDetail || {};
const approvalInfo = mentoringAppDetail.approvalInfo || {};
detailData.push({
title: "审批信息",
config: [
{ subtitle: "状态:", value: approvalInfo.approvalStatus || "-", fullRow: true },
...(approvalInfo.approvalStatus === "驳回" && approvalInfo.rejectReason ? [{ subtitle: "驳回:", value: approvalInfo.rejectReason || "-", fullRow: true }] : []),
{ subtitle: "审批人:", value: approvalInfo.approverName || "-", fullRow: false },
{ subtitle: "审批时间:", value: approvalInfo.approvalTime || "-", fullRow: false },
],
});
const taskDetail = mentoringAppDetail.taskDetail;
if (taskDetail) {
detailData.push({
title: "带教信息",
config: [
{ subtitle: "状态:", value: taskDetail.taskStatus || "-", fullRow: false },
{ subtitle: "指定区域督导:", value: taskDetail.supervisorName || "-", fullRow: false },
{ subtitle: "带教场景:", value: taskDetail.mentoringScene || "-", fullRow: false },
{ subtitle: "带教时间:", value: taskDetail.mentoringTime || "-", fullRow: false },
{ subtitle: "带教方式:", value: taskDetail.mentoringMethod || "-", fullRow: false },
{ subtitle: "带教主题:", value: taskDetail.mentoringTopic || "-", fullRow: false },
{ subtitle: "推送课程:", value: taskDetail.pushCourses || "-", fullRow: true },
{ subtitle: "带教内容摘要:", value: taskDetail.contentSummary || "-", fullRow: true },
{ subtitle: "带教招聘佐证:", value: taskDetail.evidenceImages || [], isImage: true, fullRow: true },
],
});
}
this.detailData = detailData;
},
},
};
</script>
<style scoped lang="scss">
::v-deep.strategy-drawer {
.el-drawer__header {
padding: 0;
margin: 0;
border-bottom: 1px solid #e5e5e5;
}
.el-drawer__close-btn {
padding: 0 20px;
.el-dialog__close {
font-weight: 700;
font-size: 24px;
}
}
&-title {
height: 26px;
line-height: 26px;
color: #333333;
font-size: 18px;
padding: 17px 20px;
font-weight: bold;
}
.el-drawer__body {
height: calc(100% - 55px);
overflow: hidden;
}
}
.drawer-content {
height: 100%;
display: flex;
flex-direction: column;
.scrollbar-wrapper {
flex: 1;
overflow: hidden;
::v-deep .el-scrollbar__wrap {
overflow-x: hidden;
}
}
.detail-container {
padding: 0 20px;
}
.detail-section {
.section-title {
color: #333333;
font-size: 16px;
padding: 16px 0;
border-bottom: 1px solid #e5e5e5;
margin-bottom: 16px;
display: flex;
justify-content: space-between;
align-items: center;
}
.section-content {
padding: 0 10px;
.info-item {
display: flex;
margin-bottom: 16px;
line-height: 20px;
font-size: 14px;
.info-label {
color: #666;
width: 110px;
flex-shrink: 0;
text-align: right;
}
.info-value {
color: #333;
flex: 1;
word-break: break-all;
.image-list {
display: flex;
flex-wrap: wrap;
}
}
}
}
}
.footer {
padding: 14px 0;
border-top: 1px solid #e5e5e5;
display: flex;
justify-content: flex-end;
padding-right: 20px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<el-drawer class="strategy-drawer"
size="69.44vw"
:visible.sync="dialogShow"
:wrapper-closable="false"
@close="close">
<template #title>
<div class="strategy-drawer-title">
查看详情
</div>
</template>
<div class="drawer-content">
<el-scrollbar class="scrollbar-wrapper">
<div class="detail-container">
<el-row class="section-content">
<el-col v-for="(item, idx) in detailData"
:key="idx"
class="info-item"
:span="item.fullRow ? 24 : 12">
<div class="info-label">
{{ item.subtitle }}
</div>
<div class="info-value">
<template v-if="!item.isImage">
{{ item.value || '-' }}
</template>
<template v-else>
<div v-if="item.value && item.value.length > 0" class="image-list">
<el-image v-for="(img, imgIdx) in item.value"
:key="imgIdx"
fit="cover"
:preview-src-list="item.value"
:src="img"
style="width: 80px; height: 80px; margin-right: 10px; border-radius: 4px;">
</el-image>
</div>
<div v-else>
-
</div>
</template>
</div>
</el-col>
</el-row>
</div>
</el-scrollbar>
<div class="footer">
<el-button v-preventReClick
:size="size"
@click="close">
返回
</el-button>
</div>
</div>
</el-drawer>
</template>
<script>
import { queryStrategyStudyDetailById } from "@/api/earlyWarningManager";
export default {
name: "TaskDetail",
props: {
visibleSync: {
type: Boolean,
default: false,
},
item: {
type: Object,
default: () => ({}),
},
},
data() {
return {
size: "small",
detailData: [],
};
},
computed: {
dialogShow: {
get() {
return this.visibleSync;
},
set(val) {
this.$emit("update:visibleSync", val);
},
},
},
watch: {
visibleSync(val) {
if (val) {
this.initData();
}
},
},
methods: {
close() {
this.dialogShow = false;
},
async initData() {
if (!this.item.id)
return;
try {
const res = await queryStrategyStudyDetailById({ id: this.item.id });
if (res) {
this.formatDetailData(res);
}
} catch (error) {
console.error(error);
}
},
formatDetailData(data) {
const staffList = data.staffList || [];
// 问题人员:userPosition=0
const problemStaffs = staffList.filter(e => e.userPosition === 0).map(e => e.userName).join("、");
// 执行人员:userPosition=8 或 9
const executorStaffs = staffList.filter(e => e.userPosition === 8 || e.userPosition === 9).map(e => e.userName).join("、");
// 任务类型映射
const taskTypeMap = {
9: "人员更换评估",
10: "商务政策更新评估",
11: "多品类拓张",
12: "流量问题改善",
};
const taskTypeName = taskTypeMap[data.strategyType] || "-";
const taskStatusName = data.pushFlag === 6 ? "已完成" : "未完成";
const detailData = [
{ subtitle: "任务类型:", value: taskTypeName, fullRow: false },
{ subtitle: "操作人:", value: data.createdBy || "-", fullRow: false },
{ subtitle: "操作时间:", value: data.createdDate || "-", fullRow: false },
];
// 仅 strategyType=9 时展示问题人员
if (data.strategyType === 9) {
detailData.push({ subtitle: "问题人员:", value: problemStaffs || "-", fullRow: true });
}
// 剩余基础字段
detailData.push(
{ subtitle: "执行人:", value: executorStaffs || "-", fullRow: true },
{ subtitle: "任务说明:", value: data.description || "-", fullRow: true },
{ subtitle: "任务状态:", value: taskStatusName, fullRow: true },
);
// 协同任务专有详情 (collaborativeTaskDetail)
const collabDetail = data.collaborativeTaskDetail || {};
detailData.push(
{ subtitle: "完成描述:", value: collabDetail.completionDescription || "-", fullRow: true },
{ subtitle: "完成人:", value: collabDetail.completedBy || "-", fullRow: false },
{ subtitle: "完成时间:", value: collabDetail.completedTime || "-", fullRow: false },
);
this.detailData = detailData;
},
},
};
</script>
<style scoped lang="scss">
::v-deep.strategy-drawer {
.el-drawer__header {
padding: 0;
margin: 0;
border-bottom: 1px solid #e5e5e5;
}
.el-drawer__close-btn {
padding: 0 20px;
.el-dialog__close {
font-weight: 700;
font-size: 24px;
}
}
&-title {
height: 26px;
line-height: 26px;
color: #333333;
font-size: 18px;
padding: 17px 20px;
font-weight: bold;
}
.el-drawer__body {
height: calc(100% - 55px);
overflow: hidden;
}
}
.drawer-content {
height: 100%;
display: flex;
flex-direction: column;
.scrollbar-wrapper {
flex: 1;
overflow: hidden;
::v-deep .el-scrollbar__wrap {
overflow-x: hidden;
}
}
.detail-container {
padding: 20px;
}
.info-item {
display: flex;
margin-bottom: 16px;
line-height: 20px;
font-size: 14px;
.info-label {
color: #666;
width: 110px;
flex-shrink: 0;
text-align: right;
}
.info-value {
color: #333;
flex: 1;
word-break: break-all;
.image-list {
display: flex;
flex-wrap: wrap;
}
}
}
.footer {
padding: 14px 0;
border-top: 1px solid #e5e5e5;
display: flex;
justify-content: flex-end;
padding-right: 20px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<!-- 采购订单 --> <!-- 采购订单 -->
<template> <template>
<d2-container class="container"> <d2-container class="container">
<template #header> <template #header>
<div class="header"> <div class="header">
<d2-search ref="showSearch" class="show-search" label-width="130px" :form-data="showFormData" <d2-search ref="showSearch"
:search-form="searchForm"> class="show-search"
<template slot="onlyAllocateOrderHtml"> label-width="130px"
<el-switch v-model="searchForm.onlyAllocateOrder"></el-switch> :form-data="showFormData"
</template> :search-form="searchForm">
</d2-search> <template #onlyAllocateOrderHtml>
<div class="up-btns"> <el-switch v-model="searchForm.onlyAllocateOrder"></el-switch>
<el-button :id="tableParams.btnId" handle size="small" type="primary"> </template>
查询 </d2-search>
</el-button> <div class="up-btns">
<el-button size="small" @click="handleReset"> <el-button :id="tableParams.btnId"
重置 size="small"
</el-button> type="primary"
</div> handle>
</div> 查询
</template> </el-button>
<div class="d2-container-content"> <el-button size="small" @click="handleReset">
<d2-table-header> 重置
<template #left> </el-button>
<span v-if="!userInfo.beSuper && userInfo.beYQMerchant"> </div>
<!-- <auth-button category="Button" /> --> </div>
<auth-button category="Button" /> </template>
</span> <div class="d2-container-content">
</template> <d2-table-header>
<span> <template #left>
<!-- <el-button type="primary" <span v-if="!userInfo.beSuper && userInfo.beYQMerchant">
<!-- <auth-button category="Button" /> -->
<auth-button category="Button" />
</span>
</template>
<span>
<!-- <el-button type="primary"
size="mini" size="mini"
@click="handleExport"> @click="handleExport">
导出 导出
</el-button> --> </el-button> -->
<auth-button category="Button" :show-btn-ids="['9090106']" /> <auth-button category="Button" :show-btn-ids="['9090106']" />
</span> </span>
</d2-table-header> </d2-table-header>
<d2-table ref="purchaseOrderTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi" <d2-table ref="purchaseOrderTable"
:search-form="tableSearchForm" :table-data="tableData" :table-params="tableParams"> :before-search-fn="beforeSearchFn"
<template #auth-button="scope"> :get-list-api="getListApi"
<div> :search-form="tableSearchForm"
<!-- 查看 --> :table-data="tableData"
<span style="margin-right: 10px;"> :table-params="tableParams">
<auth-button :data="scope.scope" :show-btn-ids="['9090102']" /> <template #auth-button="scope">
</span> <div>
<!-- 取消 --> <!-- 查看 -->
<span v-show="scope.scope.status == 1 && !userInfo.beSuper && userInfo.beYQMerchant" <span style="margin-right: 10px;">
style="margin-right: 10px;"> <auth-button :data="scope.scope" :show-btn-ids="['9090102']" />
<auth-button :data="scope.scope" :show-btn-ids="['9090103']" /> </span>
</span> <!-- 取消 -->
<!-- 入库 --> <span v-show="scope.scope.status == 1 && !userInfo.beSuper && userInfo.beYQMerchant"
<span v-show="scope.scope.putStatus == 1 && !userInfo.beSuper && userInfo.beYQMerchant" style="margin-right: 10px;">
style="margin-right: 10px;"> <auth-button :data="scope.scope" :show-btn-ids="['9090103']" />
<auth-button :data="scope.scope" :show-btn-ids="['9090104']" /> </span>
</span> <!-- 入库 -->
<span <span v-show="scope.scope.putStatus == 1 && !userInfo.beSuper && userInfo.beYQMerchant"
v-show="(scope.scope.purchaseType == 1 && scope.scope.deliveryStatus == 2) || (scope.scope.purchaseType == 1 && scope.scope.deliveryStatus == 3) || (scope.scope.purchaseType == 1 && scope.scope.deliveryStatus == 4)" style="margin-right: 10px;">
style="margin-right: 10px;"> <auth-button :data="scope.scope" :show-btn-ids="['9090104']" />
<auth-button :data="scope.scope" :show-btn-ids="['9090105']" /> </span>
</span> <span v-show="(scope.scope.purchaseType == 1 && scope.scope.deliveryStatus == 2) || (scope.scope.purchaseType == 1 && scope.scope.deliveryStatus == 3) || (scope.scope.purchaseType == 1 && scope.scope.deliveryStatus == 4)"
</div> style="margin-right: 10px;">
</template> <auth-button :data="scope.scope" :show-btn-ids="['9090105']" />
</d2-table> </span>
</div> </div>
<OrderDeatilDialog v-if="detailVisible" :params-obj="paramsObj" :show-film-roll-no="paramsObj.purchaseType != 1" </template>
:visible.sync="detailVisible" :is-allocate="true"> </d2-table>
</OrderDeatilDialog> </div>
</d2-container> <OrderDeatilDialog v-if="detailVisible"
:is-allocate="true"
:params-obj="paramsObj"
:show-film-roll-no="paramsObj.purchaseType != 1"
:visible.sync="detailVisible">
</OrderDeatilDialog>
</d2-container>
</template> </template>
<script> <script>
...@@ -160,7 +172,7 @@ export default { ...@@ -160,7 +172,7 @@ export default {
{ {
label: "仅查看调拨订单", label: "仅查看调拨订单",
name: "onlyAllocateOrder", name: "onlyAllocateOrder",
addHtml: 'onlyAllocateOrderHtml' addHtml: "onlyAllocateOrderHtml",
}, },
// { // {
// label: '入库时间', // label: '入库时间',
......
<!-- 出入库记录 --> <!-- 出入库记录 -->
<template> <template>
<d2-container class="container"> <d2-container class="container">
<template #header> <template #header>
<div class="header"> <div class="header">
<d2-search ref="showSearch" class="show-search" :form-data="showFormData" label-width="120px" <d2-search ref="showSearch"
:search-form="searchForm"> class="show-search"
</d2-search> label-width="120px"
<div class="up-btns"> :form-data="showFormData"
<el-button :id="tableParams.btnId" handle size="small" type="primary"> :search-form="searchForm">
查询 </d2-search>
</el-button> <div class="up-btns">
<el-button size="small" @click="handleReset"> <el-button :id="tableParams.btnId"
重置 size="small"
</el-button> type="primary"
</div> @click="handleSearch">
</div> 查询
</template> </el-button>
<div class="d2-container-content"> <el-button size="small" @click="handleReset">
<d2-table-header> 重置
<span> </el-button>
<auth-button category="Button" :show-btn-ids="['9081301']" /> </div>
</span> </div>
</d2-table-header> </template>
<d2-table ref="purchasementReviewTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi" <div class="d2-container-content">
:search-form="tableSearchForm" :selectable-fn="selectableFn" :table-data="tableData" <d2-table-header>
:table-params="tableParams"> <span>
</d2-table> <auth-button category="Button" :show-btn-ids="['9081301']" />
</div> </span>
</d2-container> </d2-table-header>
<d2-table ref="purchasementReviewTable"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="tableSearchForm"
:selectable-fn="selectableFn"
:table-data="tableData"
:table-params="tableParams">
</d2-table>
</div>
</d2-container>
</template> </template>
<script> <script>
...@@ -231,6 +241,26 @@ export default { ...@@ -231,6 +241,26 @@ export default {
width: 150, width: 150,
}, },
{ {
label: "出入库方式",
prop: "stockMethod",
width: 120,
formatter: (cellValue) => {
const obj = {
1: "扫码入库",
2: "扫码出库",
3: "手工入库",
4: "手工出库",
};
// stockMethod:出入库方式(1, “扫码入库”,2, “扫码出库”,3, “手工入库”,“手工出库”)
return cellValue.stockMethod ? obj[cellValue.stockMethod] : "-";
},
},
{
label: "备注",
prop: "remark",
width: 120,
},
{
label: "操作人", label: "操作人",
prop: "operator", prop: "operator",
}, },
...@@ -295,6 +325,13 @@ export default { ...@@ -295,6 +325,13 @@ export default {
mounted() { mounted() {
let allOpt = { confId: "", confValue: "全部" }; let allOpt = { confId: "", confValue: "全部" };
this.baseData.inventoryTypeList.unshift(allOpt); this.baseData.inventoryTypeList.unshift(allOpt);
// 接收上个页面带过来的时间参数
if (this.$route.query.startDate && this.$route.query.endDate) {
this.searchForm.transactionTimeStr = [this.$route.query.startDate, this.$route.query.endDate];
this.handleSearch();
}
this.getBaseData(); this.getBaseData();
}, },
...@@ -325,6 +362,9 @@ export default { ...@@ -325,6 +362,9 @@ export default {
} }
delete this.tableSearchForm.transactionTimeStr; delete this.tableSearchForm.transactionTimeStr;
}, },
handleSearch() {
this.$refs.purchasementReviewTable.refreshTable(true, true);
},
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
transactionTimeStr: "", transactionTimeStr: "",
......
<!-- 出库管理 --> <!-- 出库管理 -->
<template> <template>
<div> <div>
<d2-container> <d2-container>
<template #header> <template #header>
<div class="header" style="padding: 10px 20px;"> <div class="header"
<d2-search ref="showSearch" class="show-search" :form-data="showFormData" :search-form="searchForm">
<template #filmRollNo> style="padding: 10px 20px;">
<el-input v-model.trim="searchForm.filmRollNo" :clearable="true" :maxlength="50" <d2-search ref="showSearch"
placeholder="请输入膜卷号" :style="{ width: '100%' }" @input="filmRollNoInput" /> class="show-search"
</template> :form-data="showFormData"
</d2-search> :search-form="searchForm">
<div class="up-btns"> <template #filmRollNo>
<el-button size="small" type="primary" @click="handleSearch"> <el-input v-model.trim="searchForm.filmRollNo"
查询 :clearable="true"
</el-button> :maxlength="50"
<el-button size="small" @click="handleReset"> placeholder="请输入膜卷号"
重置 :style="{ width: '100%' }"
</el-button> @input="filmRollNoInput" />
</div> </template>
</div> </d2-search>
</template> <div class="up-btns">
<div class="d2-container-content"> <el-button size="small"
<d2-table-header> type="primary"
<template #left> @click="handleSearch">
<span class="leftSpan"> 查询
合计:出库数量<span class="count-txt">{{ statisticsData.totalReduceStockNum }}</span>,出库金额<span </el-button>
class="count-txt">¥{{ statisticsData.totalReduceStockMoney }}</span> <el-button size="small"
</span> @click="handleReset">
</template> 重置
<auth-button category="Button" /> </el-button>
</d2-table-header> </div>
<d2-table ref="recordTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi" </div>
:search-form="searchFormSearch" :table-params="tableParams"> </template>
<template #auth-button="scope"> <div class="d2-container-content">
<!-- 关联技师 --> <d2-table-header>
<span v-if="scope.scope.subOrderStatus != 2" style="margin-right: 10px;"> <template #left>
<auth-button :data="scope.scope" :show-btn-ids="['9080302']" /> <span class="leftSpan">
</span> 合计:出库数量<span class="count-txt">{{ statisticsData.totalReduceStockNum }}</span>,出库金额<span class="count-txt">¥{{ statisticsData.totalReduceStockMoney }}</span>
</template> </span>
</d2-table> </template>
</div> <auth-button category="Button" />
<!-- 关联技师 --> </d2-table-header>
<CorrelationDialog v-if="corrVisible" :params-obj="recordInfo" :visible.sync="corrVisible" <d2-table ref="recordTable"
@dialogClose="closeCorrDialog" /> :before-search-fn="beforeSearchFn"
</d2-container> :get-list-api="getListApi"
</div> :search-form="searchFormSearch"
:table-params="tableParams">
<template #auth-button="scope">
<!-- 关联技师 -->
<span v-if="scope.scope.subOrderStatus != 2"
style="margin-right: 10px;">
<auth-button :data="scope.scope"
:show-btn-ids="['9080302']" />
</span>
</template>
</d2-table>
</div>
<!-- 关联技师 -->
<CorrelationDialog v-if="corrVisible"
:params-obj="recordInfo"
:visible.sync="corrVisible"
@dialogClose="closeCorrDialog" />
</d2-container>
</div>
</template> </template>
<script> <script>
...@@ -287,6 +305,28 @@ export default { ...@@ -287,6 +305,28 @@ export default {
return cellValue.storeUsage || "-"; return cellValue.storeUsage || "-";
}, },
}, { }, {
label: "出库方式",
prop: "reduceMethod",
width: "200px",
formatter: (cellValue) => {
// 出库方式: 2-扫码出库, 4-手工出库
return cellValue.reduceMethod == 2 ? "扫码出库" : cellValue.reduceMethod == 4 ? "手工出库" : "-";
},
}, {
label: "备注",
prop: " remark",
}, {
label: "出库方式",
prop: "reduceMethod",
width: "200px",
formatter: (cellValue) => {
// 出库方式: 2-扫码出库, 4-手工出库
return cellValue.reduceMethod == 2 ? "扫码出库" : cellValue.reduceMethod == 4 ? "手工出库" : "-";
},
}, {
label: "备注",
prop: " remark",
}, {
label: "支付时间", label: "支付时间",
prop: "successDate", prop: "successDate",
width: 150, width: 150,
......
<!-- 补库存标签码弹窗 -->
<template>
<baseDialog :config="config"
:dialog-config="dialogConfig"
:is-loading="isLoading"
:is-show.sync="visible"
@handleClick="handleConfirm">
<div class="complement-dialog-content">
<!-- 步骤1:填写补码信息 -->
<div v-if="!showQrCode">
<el-form ref="form"
label-width="120px"
:model="form"
:rules="rules">
<el-form-item label="产品名称:">
<span>{{ row.upgradeGoodsName || '-' }}</span>
</el-form-item>
<el-form-item label="产品编码:">
<span>{{ row.productCode || '-' }}</span>
</el-form-item>
<el-form-item label="产品ID:">
<span>{{ row.upgradeCommodityCode || '-' }}</span>
</el-form-item>
<el-form-item v-if="row.isFilm"
:error="errorMsg"
label="库存数量:"
prop="stockNum">
<el-input v-model="form.stockNum"
placeholder="请输入"
style="width: 200px"
@input="handleInput">
<template #append>
米
</template>
</el-input>
</el-form-item>
</el-form>
</div>
</div>
</baseDialog>
</template>
<script>
import { replenishCodeApi } from "@/api/stockManage";
import { limitPrice } from "@/common/format";
export default {
name: "ComplementCodeDialog",
props: {
visibleSync: {
type: Boolean,
default: false,
},
row: {
type: Object,
default: () => ({}),
},
},
data() {
return {
showQrCode: false,
form: {
stockNum: "",
},
rules: {
stockNum: [
{ required: true, message: "请输入库存数量", trigger: "blur" },
],
},
errorMsg: "",
isLoading: false,
config: {
showClose: true,
appendToBody: false,
isShowFooter: true,
cancel_name: "取消",
confirm_name: "下载",
},
dialogConfig: {
title: "补库存标签码",
width: "500px",
},
qrcode: null,
};
},
computed: {
visible: {
get() {
return this.visibleSync;
},
set(newVal) {
this.$emit("update:visibleSync", newVal);
},
},
},
methods: {
handleInput(val) {
// 只能输入数字,保留2位小数
let formatted = val.replace(/[^\d.]/g, "");
formatted = limitPrice(formatted, this.form.stockNum, 10, 2, 0);
this.form.stockNum = formatted;
if (this.form.stockNum && Number(this.form.stockNum) > Number(this.row.stock)) {
this.errorMsg = "输入值不能高于当前库存数量";
} else {
this.errorMsg = "";
}
},
handleConfirm() {
if (this.showQrCode) {
// 执行下载
this.downloadQrCode();
} else {
if (this.row.isFilm) {
if (!this.form.stockNum) {
this.$message.warning("请输入库存数量");
return;
}
if (Number(this.form.stockNum) > Number(this.row.stock)) {
this.errorMsg = "输入值不能高于当前库存数量";
this.$message.error("输入值不能高于当前库存数量");
return;
}
} else {
if (!this.row.stock || Number(this.row.stock) <= 0) {
this.$message.error("当前产品库存必须大于0,才允许补库存标签码");
return;
}
}
const params = {
merchantId: this.row.yqMerchantId,
upgradeGoodsId: this.row.upgradeGoodsId, // 产品ID
goodsType: this.row.goodsType, // 商品类型
};
if (this.row.isFilm) {
params.stockNum = this.form.stockNum;
}
this.isLoading = true;
replenishCodeApi({ dataString: JSON.stringify(params) }).then((res) => {
this.isLoading = false;
if (res && res.labelImageUrl) {
this.downloadFile(res.labelImageUrl);
this.visible = false;
this.$message.success("补库存标签码成功并开始下载");
} else {
this.$message.error("未获取到标签码下载链接");
}
}).catch(() => {
this.isLoading = false;
});
}
},
downloadFile(url, fileName) {
const link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.download = fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
},
};
</script>
<style scoped lang="scss">
.complement-dialog-content {
padding: 20px;
}
.qrcode-wrapper {
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
}
.qrcode-capture-box {
width: 280px;
padding: 20px;
background: #fff;
border: 1px solid #eee;
border-radius: 8px;
display: flex;
flex-direction: column;
align-items: center;
.info-section {
width: 100%;
margin-bottom: 15px;
font-size: 14px;
color: #333;
line-height: 1.8;
.info-item {
word-break: break-all;
}
}
.qrcode-img {
margin-bottom: 10px;
}
.qr-text {
font-size: 16px;
font-weight: bold;
color: #333;
margin-top: 5px;
}
}
::v-deep .el-form-item__error {
position: relative;
margin-top: 4px;
}
</style>
<!-- 补库存标签码日志弹窗 -->
<template>
<baseDialog :config="config"
:dialog-config="dialogConfig"
:is-show.sync="visible">
<div class="complement-log-content">
<!-- 产品基础信息 -->
<div class="section-title">
产品基础信息
</div>
<div class="info-box">
<el-row>
<el-col class="info-item" :span="24">
<span class="label">产品名称:</span>
<span class="value">{{ row.upgradeGoodsName || '-' }}</span>
</el-col>
<el-col class="info-item" :span="24">
<span class="label">产品编码:</span>
<span class="value">{{ row.productCode || '-' }}</span>
</el-col>
<el-col class="info-item" :span="24">
<span class="label">产品ID:</span>
<span class="value">{{ row.upgradeCommodityCode || '-' }}</span>
</el-col>
</el-row>
</div>
<!-- 操作日志 -->
<template v-if="tableData.length">
<div class="section-title" style="margin-top: 20px;">
操作日志
</div>
<el-table v-loading="loading"
border
:data="tableData"
style="width: 100%">
<el-table-column align="center"
label="序号"
type="index"
width="80">
</el-table-column>
<el-table-column v-if="row.isFilm"
align="center"
label="库存数量"
prop="stockNum">
</el-table-column>
<el-table-column align="center"
label="操作人"
prop="createdBy">
</el-table-column>
<el-table-column align="center"
label="操作时间">
<template #default="scope">
{{ scope.row.createdDate | formatDate }}
</template>
</el-table-column>
</el-table>
</template>
</div>
</baseDialog>
</template>
<script>
import dayjs from "dayjs";
import { getReplenishLogListApi } from "@/api/stockManage";
export default {
name: "ComplementLogDialog",
filters: {
formatDate(val) {
if (!val)
return "-";
return dayjs(val).format("YYYY-MM-DD HH:mm:ss");
},
},
props: {
visibleSync: {
type: Boolean,
default: false,
},
row: {
type: Object,
default: () => ({}),
},
},
data() {
return {
config: {
showClose: true,
appendToBody: false,
isShowFooter: false, // 日志弹窗只需要展示,不需要底部确认/取消按钮
},
dialogConfig: {
title: "补库存标签码日志",
width: "700px",
},
tableData: [],
loading: false,
};
},
computed: {
visible: {
get() {
return this.visibleSync;
},
set(newVal) {
this.$emit("update:visibleSync", newVal);
},
},
},
mounted() {
this.fetchLogData();
},
methods: {
fetchLogData() {
this.loading = true;
const params = {
pageSize: 1000,
currentPage: 1,
upgradeGoodsId: this.row.upgradeGoodsId,
merchantId: this.row.merchantId,
};
getReplenishLogListApi(params).then((res) => {
this.loading = false;
if (res && res.list) {
this.tableData = res.list;
} else {
this.tableData = [];
}
}).catch(() => {
this.loading = false;
this.tableData = [];
});
},
},
};
</script>
<style scoped lang="scss">
.complement-log-content {
padding: 0 10px 20px 10px;
.section-title {
font-size: 16px;
font-weight: bold;
color: #333;
margin-bottom: 15px;
}
.info-box {
padding: 0 20px;
.info-item {
margin-bottom: 12px;
font-size: 14px;
.label {
color: #666;
display: inline-block;
width: 80px;
text-align: right;
}
.value {
color: #333;
}
}
}
}
</style>
<!-- 库存管理 --> <!-- 库存管理 -->
<template> <template>
<div> <div>
<d2-container> <d2-container>
<template #header> <template #header>
<div class="header" style="padding: 10px 20px;"> <div class="header" style="padding: 10px 20px;">
<d2-search ref="showSearch" class="show-search" :form-data="showFormData" :search-form="searchForm" /> <d2-search ref="showSearch"
<div class="up-btns"> class="show-search"
<el-button size="small" type="primary" @click="handleSearch"> :form-data="showFormData"
查询 :search-form="searchForm" />
</el-button> <div class="up-btns">
<el-button size="small" @click="handleReset"> <el-button size="small"
重置 type="primary"
</el-button> @click="handleSearch">
</div> 查询
</div> </el-button>
</template> <el-button size="small" @click="handleReset">
<div class="d2-container-content"> 重置
<d2-table-header> </el-button>
<template #left> </div>
<span class="leftSpan"> </div>
合计:当前库存<span class="count-txt">{{ statisticsData }}</span> </template>
</span> <div class="d2-container-content">
</template> <d2-table-header>
<div> <template #left>
<auth-button category="Button" /> <span class="leftSpan">
</div> 合计:当前库存<span class="count-txt">{{ statisticsData }}</span>
</d2-table-header> </span>
<d2-table ref="recordTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi" </template>
:search-form="searchFormSearch" :table-params="tableParams"> <div>
<template #auth-button="scope"> <auth-button category="Button" />
<auth-button :data="scope.scope" /> </div>
</template> </d2-table-header>
</d2-table> <d2-table ref="recordTable"
</div> :before-search-fn="beforeSearchFn"
</d2-container> :get-list-api="getListApi"
<!-- 查看 --> :search-form="searchFormSearch"
<StockMonthDialog v-if="stockMonthVisible" :record-info="recordInfo" :stock-month-visible="stockMonthVisible" :table-params="tableParams">
@dialogClose="dialogClose" /> <template #stockHtml="scope">
<StockDetailDialog v-if="stockDetailDialogVisible" :record-info="recordInfo" <span class="count-txt" @click="gotoInventoryTransaction">{{ (scope.scope.stock || scope.scope.stock == 0) ? Number.parseFloat(scope.scope.stock).toFixed(2) + (membraneTypeList.includes(scope.scope.goodsType) == 1 ? "米" : "件") : "-" }}</span>
:visible.sync="stockDetailDialogVisible">
</StockDetailDialog> </template>
<StatementOfAccountDialog v-if="statementOfAccountDialogVisible" :visible.sync="statementOfAccountDialogVisible" <template #auth-button="scope">
:yq-merchant-list="baseData.yqMerchantList" @handleRelateProConfirm="handleRelateProConfirm"> <auth-button :data="scope.scope" :show-btn-ids="['9080202', '9080203']" />
</StatementOfAccountDialog> <!-- 补码 日志 -->
</div> <span v-if="!scope.scope.canScanEnable" style="margin-left:10px">
<auth-button :data="scope.scope" :show-btn-ids="['9080205', '9080206']" />
</span>
</template>
</d2-table>
</div>
</d2-container>
<!-- 查看 -->
<StockMonthDialog v-if="stockMonthVisible"
:record-info="recordInfo"
:stock-month-visible="stockMonthVisible"
@dialogClose="dialogClose" />
<StockDetailDialog v-if="stockDetailDialogVisible"
:record-info="recordInfo"
:visible.sync="stockDetailDialogVisible">
</StockDetailDialog>
<StatementOfAccountDialog v-if="statementOfAccountDialogVisible"
:visible.sync="statementOfAccountDialogVisible"
:yq-merchant-list="baseData.yqMerchantList"
@handleRelateProConfirm="handleRelateProConfirm">
</StatementOfAccountDialog>
<ComplementCodeDialog v-if="complementDialogVisible"
:row="recordInfo"
:visibleSync.sync="complementDialogVisible">
</ComplementCodeDialog>
<ComplementLogDialog v-if="complementLogDialogVisible"
:row="recordInfo"
:visibleSync.sync="complementLogDialogVisible">
</ComplementLogDialog>
</div>
</template> </template>
<script> <script>
...@@ -52,6 +81,8 @@ import { getMerchantGoodsStockMonthReport, getyqMerchantList, stockMonthReportCo ...@@ -52,6 +81,8 @@ import { getMerchantGoodsStockMonthReport, getyqMerchantList, stockMonthReportCo
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import complementCodeDialog from "./complementCodeDialog";
import complementLogDialog from "./complementLogDialog";
import statementOfAccountDialog from "./statementOfAccountDialog"; import statementOfAccountDialog from "./statementOfAccountDialog";
import stockDetailDialog from "./stockDetailDialog"; import stockDetailDialog from "./stockDetailDialog";
import stockMonthDialog from "./stockMonthDialog"; import stockMonthDialog from "./stockMonthDialog";
...@@ -62,6 +93,8 @@ export default { ...@@ -62,6 +93,8 @@ export default {
StockMonthDialog: stockMonthDialog, StockMonthDialog: stockMonthDialog,
StockDetailDialog: stockDetailDialog, StockDetailDialog: stockDetailDialog,
StatementOfAccountDialog: statementOfAccountDialog, StatementOfAccountDialog: statementOfAccountDialog,
ComplementCodeDialog: complementCodeDialog,
ComplementLogDialog: complementLogDialog,
}, },
data() { data() {
return { return {
...@@ -72,6 +105,7 @@ export default { ...@@ -72,6 +105,7 @@ export default {
yqMerchantId: "", yqMerchantId: "",
goodsType: "", goodsType: "",
goodsSeries: "", goodsSeries: "",
selectData: [],
queryDate: "", queryDate: "",
}, },
searchFormSearch: {}, searchFormSearch: {},
...@@ -123,9 +157,8 @@ export default { ...@@ -123,9 +157,8 @@ export default {
isClear: true, isClear: true,
}, { }, {
label: "选择日期", label: "选择日期",
name: "queryDate", name: "selectData",
type: "datePicker", type: "datePicker",
dateType: "date",
isClear: true, isClear: true,
placeholder: "请选择", placeholder: "请选择",
pickerOptions: "stockQueryDatePickerOptions", pickerOptions: "stockQueryDatePickerOptions",
...@@ -137,20 +170,26 @@ export default { ...@@ -137,20 +170,26 @@ export default {
mutiSelectUniqueKey: "uniqueVal", mutiSelectUniqueKey: "uniqueVal",
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000), btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list", listName: "list",
tableOption: true, tableOption: {
width: "200",
},
tableColumns: [{ tableColumns: [{
label: "产品名称", label: "产品名称",
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
width: "160px", width: "160px",
}, { }, {
label: "规格",
prop: "specificationData",
width: "160px",
}, {
label: "产品编码", label: "产品编码",
prop: "productCode", prop: "productCode",
width: "250px", width: "250px",
}, { }, {
label: "产品ID",
prop: "upgradeCommodityCode",
width: "250px",
}, {
label: "规格",
prop: "specificationData",
width: "160px",
}, {
label: "系列", label: "系列",
prop: "goodsSeries", prop: "goodsSeries",
width: "250px", width: "250px",
...@@ -173,9 +212,10 @@ export default { ...@@ -173,9 +212,10 @@ export default {
}, { }, {
label: "当前库存", label: "当前库存",
prop: "stock", prop: "stock",
formatter: (cellValue) => { addHtml: "stockHtml",
return (cellValue.stock || cellValue.stock == 0) ? Number.parseFloat(cellValue.stock).toFixed(2) + (this.membraneTypeList.includes(cellValue.goodsType) == 1 ? "米" : "件") : "-"; // formatter: (cellValue) => {
}, // return (cellValue.stock || cellValue.stock == 0) ? Number.parseFloat(cellValue.stock).toFixed(2) + (this.membraneTypeList.includes(cellValue.goodsType) == 1 ? "米" : "件") : "-";
// },
}, { }, {
label: "所属仓库", label: "所属仓库",
prop: "yqMerchantName", prop: "yqMerchantName",
...@@ -192,6 +232,8 @@ export default { ...@@ -192,6 +232,8 @@ export default {
}, },
stockDetailDialogVisible: false, stockDetailDialogVisible: false,
stockMonthVisible: false, stockMonthVisible: false,
complementDialogVisible: false,
complementLogDialogVisible: false,
recordInfo: null, recordInfo: null,
statisticsData: {}, statisticsData: {},
statementOfAccountDialogVisible: false, statementOfAccountDialogVisible: false,
...@@ -229,10 +271,30 @@ export default { ...@@ -229,10 +271,30 @@ export default {
// async getBaseData() { // async getBaseData() {
// this.getOptionsList() // this.getOptionsList()
// }, // },
gotoInventoryTransaction() {
let query = {};
if (this.searchForm.selectData && this.searchForm.selectData.length === 2) {
query.startDate = Util.dateFormate(this.searchForm.selectData[0], "YYYY-MM-DD");
query.endDate = Util.dateFormate(this.searchForm.selectData[1], "YYYY-MM-DD");
}
this.$router.push({
path: "/inventoryTransactionRecords",
query,
});
},
// 补码
handleComplement(row) {
this.recordInfo = row;
this.complementDialogVisible = true;
},
// 日志
handleLog(row) {
this.recordInfo = row;
this.complementLogDialogVisible = true;
},
// 库存记录统计 // 库存记录统计
stockMonthReportCount() { stockMonthReportCount() {
this.beforeSearchFn() this.beforeSearchFn();
stockMonthReportCount(this.searchFormSearch).then((res) => { stockMonthReportCount(this.searchFormSearch).then((res) => {
this.statisticsData = res; this.statisticsData = res;
}); });
...@@ -246,9 +308,10 @@ export default { ...@@ -246,9 +308,10 @@ export default {
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm); this.searchFormSearch = deepClone(this.searchForm);
if (this.searchFormSearch.queryDate) { if (this.searchFormSearch.selectData && this.searchFormSearch.selectData.length) {
this.searchFormSearch.queryDate = Util.dateFormate(this.searchFormSearch.queryDate, "YYYY-MM-DD") + " 23:59:59"; this.searchFormSearch.queryDate = Util.dateFormate(this.searchFormSearch.selectData[1], "YYYY-MM-DD") + " 23:59:59";
} }
delete this.searchFormSearch.selectData;
this.searchFormSearch.dataMonth = Util.dateFormate(new Date(), "YYYY-MM"); this.searchFormSearch.dataMonth = Util.dateFormate(new Date(), "YYYY-MM");
resolve(); resolve();
...@@ -279,6 +342,7 @@ export default { ...@@ -279,6 +342,7 @@ export default {
yqMerchantId: "", yqMerchantId: "",
goodsType: "", goodsType: "",
goodsSeries: "", goodsSeries: "",
selectData: [],
queryDate: "", queryDate: "",
}; };
this.$refs.recordTable.refreshTable(); this.$refs.recordTable.refreshTable();
...@@ -289,7 +353,7 @@ export default { ...@@ -289,7 +353,7 @@ export default {
handleRelateProConfirm(data) { handleRelateProConfirm(data) {
let params = data; let params = data;
params.method = "dj.api.smartcarlife.merchantShopGoodsStock.statement.exportAsync"; params.method = "dj.api.smartcarlife.merchantShopGoodsStock.statement.exportAsync";
console.log(params);
// return // return
const list = [ const list = [
...this.dowloadList, ...this.dowloadList,
...@@ -348,6 +412,7 @@ export default { ...@@ -348,6 +412,7 @@ export default {
font-weight: 700; font-weight: 700;
color: #2a58ad; color: #2a58ad;
margin: 0 2px; margin: 0 2px;
cursor: pointer;
} }
.leftSpan { .leftSpan {
......
<!-- 入库管理 --> <!-- 入库管理 -->
<template> <template>
<div> <div>
<d2-container> <d2-container>
<template #header> <template #header>
<div class="header" <div class="header"
style="padding: 10px 20px;"> style="padding: 10px 20px;">
<d2-search ref="showSearch" <d2-search ref="showSearch"
class="show-search" class="show-search"
:form-data="showFormData" :form-data="showFormData"
:search-form="searchForm"> :search-form="searchForm">
<template #filmRollNo> <template #filmRollNo>
<el-input v-model.trim="searchForm.filmRollNo" <el-input v-model.trim="searchForm.filmRollNo"
:clearable="true" :clearable="true"
:maxlength="50" :maxlength="50"
placeholder="请输入膜卷号" placeholder="请输入膜卷号"
:style="{ width: '100%' }" :style="{ width: '100%' }"
@input="filmRollNoInput" /> @input="filmRollNoInput" />
</template>
</d2-search>
<div class="up-btns">
<el-button size="small"
type="primary"
@click="handleSearch">
查询
</el-button>
<el-button size="small"
@click="handleReset">
重置
</el-button>
</div>
</div>
</template> </template>
<div class="d2-container-content"> </d2-search>
<d2-table-header> <div class="up-btns">
<template #left> <el-button size="small"
<span class="leftSpan"> type="primary"
合计:入库数量<span class="count-txt">{{ statisticsData.totalIncreaseStockNum }}</span>,入库金额<span class="count-txt">¥{{ statisticsData.totalIncreaseStockMoney }}</span> @click="handleSearch">
</span> 查询
</template> </el-button>
<auth-button category="Button" /> <el-button size="small"
</d2-table-header> @click="handleReset">
<d2-table ref="recordTable" 重置
:before-search-fn="beforeSearchFn" </el-button>
:get-list-api="getListApi" </div>
:search-form="searchFormSearch" </div>
:table-params="tableParams"> </template>
<template #auth-button="scope"> <div class="d2-container-content">
<auth-button :data="scope.scope" /> <d2-table-header>
</template> <template #left>
</d2-table> <span class="leftSpan">
</div> 合计:入库数量<span class="count-txt">{{ statisticsData.totalIncreaseStockNum }}</span>,入库金额<span class="count-txt">¥{{ statisticsData.totalIncreaseStockMoney }}</span>
</d2-container> </span>
</div> </template>
<auth-button category="Button" />
</d2-table-header>
<d2-table ref="recordTable"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="searchFormSearch"
:table-params="tableParams">
<template #auth-button="scope">
<auth-button :data="scope.scope" />
</template>
</d2-table>
</div>
</d2-container>
</div>
</template> </template>
<script> <script>
...@@ -261,6 +261,15 @@ export default { ...@@ -261,6 +261,15 @@ export default {
label: "入库门店", label: "入库门店",
prop: "merchantName", prop: "merchantName",
width: "200px", width: "200px",
}, {
label: "入库方式",
prop: "warehousingMethod",
width: "200px",
formatter: (cellValue) => {
// 入库方式: 1-扫码入库, 3-手工入库
return cellValue.warehousingMethod == 1 ? "扫码入库" : cellValue.warehousingMethod == 3 ? "手工入库" : "-";
},
}], }],
}, },
baseData: { baseData: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!