提交 936718d3 authored 作者: lidongxu's avatar lidongxu

refactor(display_schedule): 修改:链路中心_AP计划上班_计划为-时,让实际填报选项禁用

上级 5544a086
......@@ -9,6 +9,12 @@ export function getDisplayList(params) {
// 填报-陈列计划
export function submitDisplayPlan(data) {
// 遍历 data 每对 key value,发现 value 是 undefined 替换成空字符串
Object.keys(data).forEach(key => {
if (data[key] === undefined || data[key] === null) {
data[key] = ''
}
})
return request({
url: `/operation/sales/ap_display/core/${data.id}`,
method: 'PUT',
......@@ -28,6 +34,11 @@ export function getDisplayScheduleList(params) {
// 填报-档期计划
export function submitDisplaySchedulePlan(data) {
Object.keys(data).forEach(key => {
if (data[key] === undefined || data[key] === null) {
data[key] = ''
}
})
return request({
url: `/operation/sales/ap_promotion/core/${data.id}`,
method: 'PUT',
......
......@@ -48,7 +48,7 @@
<!-- 实际主货架-数量(要根据实际主货架-形式不为空时才可以选择否则为 0) -->
<div v-if="col.prop === 'actualMainShelfQty'">
<span>{{ row[col.referenceKey] || '-' }}</span>
<el-select :disabled="!row.actualMainShelfType"
<el-select :disabled="!row.actualMainShelfType || !row.plannedMainShelfQty"
v-model="row[col.prop]"
placeholder=""
clearable
......@@ -62,6 +62,7 @@
<div v-else>
<span>{{ row[col.referenceKey] || '-' }}</span>
<el-select v-model="row[col.prop]"
:disabled="!row[col.referenceKey]"
placeholder=""
clearable
@change="submitChange(row, col)">
......@@ -77,10 +78,16 @@
{{ col.func(row) }}
</div>
<!-- 输入框 -->
<div v-else-if="col.type === 'input'">
<el-input v-model="row[col.prop]"
placeholder=""
@input="submitChange(row, col)" />
<div v-else-if="col.type === 'input'"
class="cell-style">
<div>
<span>{{ row[col.referenceKey] || '-' }}</span>
<el-input v-model="row[col.prop]"
:disabled="!row[col.referenceKey]"
placeholder=""
@input="submitChange(row, col)" />
</div>
</div>
<!-- 为其他类型或未定义类型提供默认显示 -->
<div v-else>
......@@ -108,11 +115,12 @@ import { onMounted } from 'vue';
/*************** 操作类型 ***************/
const operation = ref('平铺模式');
const tableRef = ref(null)
// 平铺模式
// 全部列
const baseColumns = ref([
{
label: "基础信息",
children: [
{ label: '计划月份', prop: 'salesMonth', visible: true, type: 'string', fill: false, fixed: 'left' },
{ label: "销售大区", prop: "regionName", visible: true, type: 'string', fill: false },
{ label: "销售战区", prop: "districtName", visible: true, type: 'string', fill: false },
{ label: "经销商-省份", prop: "dealerProvince", visible: true, type: 'string', fill: false },
......@@ -316,10 +324,10 @@ const baseColumns = ref([
formulaStr: '公式:(实际地堆平米数 >= 计划地堆平米数)并且(实际地堆数量 >= 计划地堆数量)',
fill: true
},
{
label: "计划多点陈列-数量+形式", prop: "plannedMultiDisplay", visible: true, type: 'string',
fill: true
},
// {
// label: "计划多点陈列-数量+形式", prop: "plannedMultiDisplay", visible: true, type: 'string',
// fill: true
// },
{
label: "计划多点陈列-总费用", prop: "plannedMultiDisplayTotalCost", visible: true, type: 'string',
fill: false
......@@ -365,6 +373,7 @@ const baseColumns = ref([
row.regularDisplayExecuted = (row.actualMainShelfExecuted === '是' && row.actualEndCapExecuted === '是' && row.actualFloorStackExecuted === '是' && row.actualMultiDisplayExecuted === '是') ? '是' : '否';
return row.regularDisplayExecuted;
},
formulaStr: '公式:(实际主货架是否执行,并且实际端架是否执行,并且实际地堆是否执行,并且实际多点陈列是否执行)',
fill: true
},
{
......@@ -445,6 +454,16 @@ const submitChange = async (row, col) => {
[col.prop]: row[col.prop]
})
// 这些提交变化的,同时会影响公式计算的,需要把公式计算的字段列结果,一起发给后台
// 注意:实际主货架形式改变并为空时,要置空实际主货架数量
if (col.prop === 'actualMainShelfType' && !row.actualMainShelfType) {
row.actualMainShelfQty = ''
// 并提交保存一次
await submitDisplayPlan({
id: row.sadId,
actualMainShelfQty: row.actualMainShelfQty,
})
}
// 主货架
if (['actualMainShelfType', 'actualMainShelfQty'].includes(col.prop)) {
await submitDisplayPlan({
......@@ -489,6 +508,9 @@ const getTableList = async () => {
const res = await getDisplayList({
...params
})
res.data.rows.forEach(item => {
item.salesMonth = parseTime(item.salesMonth, '{y}-{m}')
})
tableData.value = res.data.rows
total.value = res.data.total
isLoading.value = false
......@@ -499,6 +521,7 @@ getTableList()
const getColumnMinWidth = (column) => {
// 根据列名或属性判断合适的最小宽度
const widthMap = {
'salesMonth': 85,
'regionName': 85,
'districtName': 85,
'dealerProvince': 100,
......@@ -655,6 +678,10 @@ const formatterTableData = (row, col) => {
width: 100% !important;
padding: 10px;
}
.el-input {
padding: 10px;
}
}
}
......
<template>
<el-row>
<el-form-item label="操作类型">
<el-form-item>
<el-radio-group v-model="operation"
@change="checkTableColumns">
<el-radio-button label="平铺模式"
......@@ -53,6 +53,7 @@
<span class="ellipsis-tooltip">{{ row[col.referenceKey] || '-' }}</span>
</el-tooltip>
<el-select v-model="row[col.prop]"
:disabled="!row[col.referenceKey]"
placeholder=""
clearable
@change="submitChange(row, col)">
......@@ -78,6 +79,7 @@
<span class="ellipsis-tooltip">{{ row[col.referenceKey] || '-' }}</span>
</el-tooltip>
<el-input v-model="row[col.prop]"
:disabled="!row[col.referenceKey]"
placeholder=""
:type="col.format === 'number' ? 'number' : 'text'"
@input="submitChange(row, col)" />
......@@ -91,6 +93,7 @@
<div class="date-picker">
<el-date-picker v-model="row[col.prop]"
type="date"
:disabled="!row[col.referenceKey]"
:format="col.format"
placeholder=""
@change="submitChange(row, col)" />
......@@ -128,6 +131,7 @@ const baseColumns = ref([
{
label: "基础信息",
children: [
{ label: '计划月份', prop: 'salesMonth', visible: true, type: 'string', fill: false, fixed: 'left' },
{ "label": "销售大区", "prop": "regionName", visible: true, type: "string", fill: false },
{ "label": "销售战区", "prop": "districtName", visible: true, type: "string", fill: false },
{ "label": "经销商-省份", "prop": "dealerProvince", visible: true, type: "string", fill: false },
......@@ -505,13 +509,14 @@ const getTableList = async () => {
})
// 处理日期格式
res.data.rows.forEach(item => {
item.salesMonth = parseTime(item.salesMonth, '{y}-{m}')
item.openingDate = parseTime(item.openingDate, '{y}-{m}-{d}')
item.plannedAdjustmentStartDate = parseTime(item.plannedAdjustmentStartDate, '{y}-{m}-{d}')
item.plannedAdjustmentEndDate = parseTime(item.plannedAdjustmentEndDate, '{y}-{m}-{d}')
item.plannedPromotionStartDate = parseTime(item.plannedPromotionStartDate, '{m}-{d}')
item.actualPromotionStartDate = parseTime(item.actualPromotionStartDate, '{m}-{d}')
item.plannedPromotionEndDate = parseTime(item.plannedPromotionEndDate, '{m}-{d}')
item.actualPromotionEndDate = parseTime(item.actualPromotionEndDate, '{m}-{d}')
item.plannedPromotionStartDate = parseTime(item.plannedPromotionStartDate, '{y}-{m}-{d}')
item.actualPromotionStartDate = parseTime(item.actualPromotionStartDate, '{y}-{m}-{d}')
item.plannedPromotionEndDate = parseTime(item.plannedPromotionEndDate, '{y}-{m}-{d}')
item.actualPromotionEndDate = parseTime(item.actualPromotionEndDate, '{y}-{m}-{d}')
item.totalCostRate = item.totalCostRate ? `${(item.totalCostRate).toFixed(2)}%` : '-'
item.adjustmentCostRatio = item.adjustmentCostRatio ? `${(item.adjustmentCostRatio).toFixed(2)}%` : '-'
})
......@@ -525,6 +530,7 @@ getTableList()
const getColumnMinWidth = (column) => {
// 根据列名或属性判断合适的最小宽度
const widthMap = {
'salesMonth': 85,
'regionName': 85,
'districtName': 85,
'dealerProvince': 100,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论