提交 65b07095 authored 作者: lidongxu's avatar lidongxu

refactor(display_schedule/*): 修复:AP 执行上报_已知的宽度和 tooltip 超出容器宽度显示问题,日期类型添加年份并且改变需要提交到后台保存接口调通

上级 9a8a94f1
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
<el-table :data="tableData" <el-table :data="tableData"
border border
ref="tableRef" ref="tableRef"
class="auto-fit-header-table" class="auto-fit-header-table "
:class="{ 'cell-no-padding': operation === '填报模式' }"
v-loading="isLoading"> v-loading="isLoading">
<template v-for="col in tableColumns"> <template v-for="col in tableColumns">
<el-table-column v-if="col.visible" <el-table-column v-if="col.visible"
...@@ -44,7 +45,8 @@ ...@@ -44,7 +45,8 @@
</template> </template>
<template #default="{ row }"> <template #default="{ row }">
<!-- 填报模式 --> <!-- 填报模式 -->
<div v-if="operation === '填报模式'" style="overflow: visible !important;"> <div v-if="operation === '填报模式'"
style="overflow: visible !important;">
<!-- 带选择框/输入框的操作单元格 --> <!-- 带选择框/输入框的操作单元格 -->
<div v-if="col.render" <div v-if="col.render"
class="cell-style"> class="cell-style">
...@@ -194,11 +196,14 @@ const getTableList = () => { ...@@ -194,11 +196,14 @@ const getTableList = () => {
} }
} }
&.cell-no-padding {
::v-deep(.el-table__row) { ::v-deep(.el-table__row) {
.el-table__cell { .el-table__cell {
padding: 0; padding: 0;
} }
} }
}
::v-deep(.column-style) { ::v-deep(.column-style) {
...@@ -268,14 +273,17 @@ const getTableList = () => { ...@@ -268,14 +273,17 @@ const getTableList = () => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
p{
p {
width: 100%; width: 100%;
margin: 0; margin: 0;
} }
p:first-child { p:first-child {
background-color: #e1e2e6; background-color: #e1e2e6;
border-bottom: 1px solid #ebeef5; border-bottom: 1px solid #ebeef5;
} }
p:last-child { p:last-child {
padding: 15px 0; padding: 15px 0;
} }
......
<template> <template>
<!-- 常规陈列 -->
<CommonPlan :tableData="tableData" <CommonPlan :tableData="tableData"
:isLoading="isLoading" :isLoading="isLoading"
:total="total" :total="total"
...@@ -150,7 +151,7 @@ ...@@ -150,7 +151,7 @@
showOverflowTooltip: true, showOverflowTooltip: true,
onlyFill: true,// 仅仅在填报模式下生效 onlyFill: true,// 仅仅在填报模式下生效
fixed: 'left', fixed: 'left',
width: 215, width: 225,
render: (h, row) => { render: (h, row) => {
return h('div', { return h('div', {
class: 'render-cell', class: 'render-cell',
...@@ -185,15 +186,17 @@ ...@@ -185,15 +186,17 @@
{ {
label: "门店编码", label: "门店编码",
prop: "storeCode", prop: "storeCode",
showOverflowTooltip: true,
visible: true, visible: true,
type: 'string', type: 'string',
fill: false, fill: false,
fixed: 'left', fixed: 'left',
width: 105 width: 125
}, },
{ {
label: "经销商名称", label: "经销商名称",
prop: "dealerName", prop: "dealerName",
showOverflowTooltip: true,
visible: true, visible: true,
type: 'string', type: 'string',
fill: false, fill: false,
...@@ -228,10 +231,11 @@ ...@@ -228,10 +231,11 @@
{ {
label: "系统名称", label: "系统名称",
prop: "lineName", prop: "lineName",
showOverflowTooltip: true,
visible: true, visible: true,
type: 'string', type: 'string',
fill: false, fill: false,
width: 90 width: 130
}, },
{ {
label: "渠道大类", label: "渠道大类",
...@@ -268,10 +272,11 @@ ...@@ -268,10 +272,11 @@
{ {
label: "门店面积", label: "门店面积",
prop: "storeArea", prop: "storeArea",
showOverflowTooltip: true,
visible: true, visible: true,
type: 'string', type: 'string',
fill: false, fill: false,
width: 90 width: 140
}, },
{ {
label: "门店分级(销量坎级)", label: "门店分级(销量坎级)",
...@@ -280,7 +285,7 @@ ...@@ -280,7 +285,7 @@
showOverflowTooltip: true, showOverflowTooltip: true,
type: 'string', type: 'string',
fill: false, fill: false,
width: 165 width: 215
}, },
{ {
label: "门店地址", label: "门店地址",
...@@ -289,7 +294,7 @@ ...@@ -289,7 +294,7 @@
visible: true, visible: true,
type: 'string', type: 'string',
fill: false, fill: false,
width: 255 width: 325
}, },
{ {
label: "品项数", label: "品项数",
...@@ -801,11 +806,11 @@ ...@@ -801,11 +806,11 @@
visible: true, visible: true,
type: 'formula', type: 'formula',
func: (row) => { func: (row) => {
// 实际主货架-是否执行 && 实际端架-是否执行 && 实际地堆-是否执行 && 实际多点陈列-是否执行 // 实际主货架-执行 && 实际端架-执行 && 实际地堆-执行 && 实际多点陈列-执行
row.regularDisplayExecuted = (row.actualMainShelfExecuted === '是' && row.actualEndCapExecuted === '是' && row.actualFloorStackExecuted === '是' && row.actualMultiDisplayExecuted === '是') ? '是' : '否'; row.regularDisplayExecuted = (row.actualMainShelfExecuted === '是' && row.actualEndCapExecuted === '是' && row.actualFloorStackExecuted === '是' && row.actualMultiDisplayExecuted === '是') ? '是' : '否';
return row.regularDisplayExecuted; return row.regularDisplayExecuted;
}, },
formulaStr: '公式:(实际主货架是否执行,并且实际端架是否执行,并且实际地堆是否执行,并且实际多点陈列是否执行)', formulaStr: '公式:(实际主货架执行,并且实际端架执行,并且实际地堆执行,并且实际多点陈列执行)',
fill: true, fill: true,
width: 150 width: 150
}, },
......
<template> <template>
<!-- 档期计划 -->
<CommonPlan :tableData="tableData" <CommonPlan :tableData="tableData"
:isLoading="isLoading" :isLoading="isLoading"
:total="total" :total="total"
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
prop: 'salesMonth', prop: 'salesMonth',
visible: true, visible: true,
type: 'string', type: 'string',
fill: false, fill: true,
fixed: 'left', fixed: 'left',
width: 90 width: 90
}, },
...@@ -103,7 +104,7 @@ ...@@ -103,7 +104,7 @@
type: "string", type: "string",
fill: true, fill: true,
fixed: 'left', fixed: 'left',
width: 215 width: 225
}, },
{ {
label: "经销商类型", label: "经销商类型",
...@@ -112,7 +113,7 @@ ...@@ -112,7 +113,7 @@
showOverflowTooltip: true, showOverflowTooltip: true,
type: "string", type: "string",
fill: false, fill: false,
width: 115 width: 155
}, },
{ {
label: "开户日期", label: "开户日期",
...@@ -161,7 +162,7 @@ ...@@ -161,7 +162,7 @@
type: "string", type: "string",
fill: true, fill: true,
fixed: 'left', fixed: 'left',
width: 90 width: 180
}, },
{ {
label: "系统类型", label: "系统类型",
...@@ -354,8 +355,8 @@ ...@@ -354,8 +355,8 @@
// span 标签超出宽度时显示省略号 // span 标签超出宽度时显示省略号
return ( return (
<div> <div>
<el-tooltip placement="top" content={row[col.referenceKey] || '-'} disabled={!isContentOverflow(col.referenceKey, row[col.referenceKey])}> <el-tooltip placement="top" content={row[col.referenceKey] || '-'} disabled={!isContentOverflow(col.referenceKey, row[col.referenceKey], col)}>
<span style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 100%;"> <span >
{row[col.referenceKey] || '-'} {row[col.referenceKey] || '-'}
</span> </span>
</el-tooltip> </el-tooltip>
...@@ -505,7 +506,6 @@ ...@@ -505,7 +506,6 @@
prop: "actualPromotionStartDate", prop: "actualPromotionStartDate",
visible: true, visible: true,
type: 'date', type: 'date',
format: 'MM-DD',
referenceKey: "plannedPromotionStartDate", referenceKey: "plannedPromotionStartDate",
fill: true, fill: true,
width: 140, width: 140,
...@@ -523,12 +523,12 @@ ...@@ -523,12 +523,12 @@
placeholder="" placeholder=""
clearable clearable
type="date" type="date"
value-format="MM-DD"
/> />
</div> </div>
</div> </div>
) )
} },
requestKey: ["timeExecutionStatus", 'promotionImplementationStatus']
}, },
{ {
label: "计划-档期结束时间", label: "计划-档期结束时间",
...@@ -551,7 +551,6 @@ ...@@ -551,7 +551,6 @@
prop: "actualPromotionEndDate", prop: "actualPromotionEndDate",
visible: true, visible: true,
type: 'date', type: 'date',
format: 'MM-DD',
fill: true, fill: true,
referenceKey: "plannedPromotionEndDate", referenceKey: "plannedPromotionEndDate",
width: 140, width: 140,
...@@ -569,13 +568,12 @@ ...@@ -569,13 +568,12 @@
placeholder="" placeholder=""
clearable clearable
type="date" type="date"
value-format="MM-DD"
/> />
</div> </div>
</div> </div>
) )
}, },
requestKey: ["plannedPromotionEndDate"] requestKey: ["timeExecutionStatus", 'promotionImplementationStatus']
}, },
{ {
label: "档期是否开展", label: "档期是否开展",
...@@ -596,15 +594,13 @@ ...@@ -596,15 +594,13 @@
visible: true, visible: true,
type: 'formula', type: 'formula',
func: (row) => { func: (row) => {
row.timeExecutionStatus = (row.actualPromotionStartDate === row.plannedPromotionStartDate) && (row.actualPromotionEndDate === row.plannedPromotionEndDate) ? '是' : '否'; row.timeExecutionStatus = (parseTime(row.actualPromotionStartDate) === parseTime(row.plannedPromotionStartDate)) && parseTime(row.actualPromotionEndDate) === parseTime(row.plannedPromotionEndDate) ? '是' : '否';
return row.timeExecutionStatus; return row.timeExecutionStatus;
}, },
formulaStr: '公式:(实际档期开始时间 = 计划档期开始时间,并且实际档期结束时间 = 计划档期结束时间)', formulaStr: '公式:(实际档期开始时间 = 计划档期开始时间,并且实际档期结束时间 = 计划档期结束时间)',
fill: true, fill: true,
width: 125 width: 125
}, },
{ {
label: "计划促销机制", label: "计划促销机制",
prop: "plannedPromotionMechanism", prop: "plannedPromotionMechanism",
...@@ -620,7 +616,7 @@ ...@@ -620,7 +616,7 @@
type: 'input', type: 'input',
referenceKey: "plannedPromotionMechanism", referenceKey: "plannedPromotionMechanism",
fill: true, fill: true,
width: 115, width: 185,
render: (_, row, col) => { render: (_, row, col) => {
return ( return (
<div> <div>
...@@ -1039,7 +1035,7 @@ ...@@ -1039,7 +1035,7 @@
// 提交变更 // 提交变更
const submitChange = async (row, col) => { const submitChange = async (row, col) => {
// 需要特殊处理的 // 需要特殊处理的
// 1. 实际主货架-形式,为空时,置空实际主货架-数量 // 实际主货架-形式,为空时,置空实际主货架-数量
if (col.prop === 'actualMainShelfType' && !row.actualMainShelfType) { if (col.prop === 'actualMainShelfType' && !row.actualMainShelfType) {
row.actualMainShelfQty = 0 row.actualMainShelfQty = 0
} }
...@@ -1049,6 +1045,7 @@ ...@@ -1049,6 +1045,7 @@
// 关联的公式计算列,需要特殊处理 // 关联的公式计算列,需要特殊处理
for (const str of col.requestKey) { for (const str of col.requestKey) {
const obj = tableColumns.value.find(item => item.prop == str) const obj = tableColumns.value.find(item => item.prop == str)
console.log(obj, str, 'y')
if (obj.type === 'formula') { if (obj.type === 'formula') {
obj.func(row) obj.func(row)
} }
...@@ -1059,11 +1056,13 @@ ...@@ -1059,11 +1056,13 @@
await submitDisplaySchedulePlan({ await submitDisplaySchedulePlan({
id: row.sapId, id: row.sapId,
[col.prop]: row[col.prop], // 当前修改列的值 [col.prop]: row[col.prop], // 当前修改列的值
...requestObj ...requestObj,
actualPromotionFlavor: Array.isArray(row.actualPromotionFlavor) ? row.actualPromotionFlavor.join(',') : '-', // 档期执行-促销口味,为数组时,转成字符串
actualPromotionStartDate: row.actualPromotionStartDate ? parseTime(row.actualPromotionStartDate, '{y}-{m}-{d}') : '', // 档期执行-促销开始日期,为字符串时,转成日期格式
}) })
} }
// // 表格数据 // 表格数据
const tableData = ref([]) const tableData = ref([])
const isLoading = ref(true) const isLoading = ref(true)
const params = reactive({ const params = reactive({
...@@ -1072,7 +1071,7 @@ ...@@ -1072,7 +1071,7 @@
}) })
const total = ref(0) const total = ref(0)
// // 获取表格数据 // 获取表格数据
const getTableList = async () => { const getTableList = async () => {
isLoading.value = true isLoading.value = true
const res = await getDisplayScheduleList({ const res = await getDisplayScheduleList({
...@@ -1090,6 +1089,8 @@ ...@@ -1090,6 +1089,8 @@
item.actualPromotionEndDate = parseTime(item.actualPromotionEndDate, '{y}-{m}-{d}') item.actualPromotionEndDate = parseTime(item.actualPromotionEndDate, '{y}-{m}-{d}')
item.totalCostRate = item.totalCostRate ? `${(item.totalCostRate).toFixed(2)}%` : '-' item.totalCostRate = item.totalCostRate ? `${(item.totalCostRate).toFixed(2)}%` : '-'
item.adjustmentCostRatio = item.adjustmentCostRatio ? `${(item.adjustmentCostRatio).toFixed(2)}%` : '-' item.adjustmentCostRatio = item.adjustmentCostRatio ? `${(item.adjustmentCostRatio).toFixed(2)}%` : '-'
// 档期执行-促销口味从字符串转成数组
item.actualPromotionFlavor = item.actualPromotionFlavor ? item.actualPromotionFlavor.split(',') : []
// 修改时间 // 修改时间
item.updateTime = parseTime(item.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') item.updateTime = parseTime(item.updateTime, '{y}-{m}-{d} {h}:{i}:{s}')
}) })
...@@ -1103,10 +1104,10 @@ ...@@ -1103,10 +1104,10 @@
getTableList() getTableList()
}) })
const isContentOverflow = (key, content) => { const isContentOverflow = (key, content, col) => {
// 创建临时元素用于测量 if (!content) return false; // 没有内容则直接禁用
if (!content) return false;
// 创建 DOM 计算
const tempSpan = document.createElement('span'); const tempSpan = document.createElement('span');
tempSpan.textContent = content; tempSpan.textContent = content;
tempSpan.className = 'ellipsis-tooltip'; tempSpan.className = 'ellipsis-tooltip';
...@@ -1115,16 +1116,14 @@ ...@@ -1115,16 +1116,14 @@
document.body.appendChild(tempSpan); document.body.appendChild(tempSpan);
// 获取元素宽度和内容宽度 // 获取元素宽度和内容宽度
const { width } = tempSpan.getBoundingClientRect(); const width = tempSpan.getBoundingClientRect().width;
const scrollWidth = tempSpan.scrollWidth;
// 移除临时元素 // 移除临时元素
document.body.removeChild(tempSpan); document.body.removeChild(tempSpan);
// 当内容宽度大于元素宽度时,表示内容溢出 // 当内容宽度大于元素宽度时,表示内容溢出
return scrollWidth > width; return width > col.width;
}; };
</script> </script>
<style scoped <style scoped
......
<!-- 档期陈列 -->
<template> <template>
<!-- 档期陈列 -->
<CommonPlan :tableData="tableData" <CommonPlan :tableData="tableData"
:isLoading="isLoading" :isLoading="isLoading"
:total="total" :total="total"
...@@ -43,6 +43,15 @@ ...@@ -43,6 +43,15 @@
) )
} }
}, },
{
label: '计划月份', // 列标题
prop: 'salesMonth', // 列属性
visible: true, // 是否显示
type: 'string', // 列类型
fill: true, // 是否为填报列
fixed: 'left', // 是否固定在左侧
width: 90
},
{ {
"label": "销售大区", "label": "销售大区",
"prop": "regionName", "prop": "regionName",
...@@ -544,6 +553,28 @@ ...@@ -544,6 +553,28 @@
"value": 3 "value": 3
} }
], ],
render: (_, row, col) => {
return (
<div>
<span>{row[col.referenceKey] || '-'}</span>
<el-select modelValue={row[col.prop]}
onUpdate:modelValue={(value) => {
row[col.prop] = value;
submitChange(row, col);
}}
disabled={!row[col.referenceKey]}
placeholder="">
{col.options.map(item => (
<el-option
key={item.value}
label={item.label}
value={item.value}
/>
))}
</el-select>
</div>
)
},
requestKey: ["actualFloorStackExecuted", "promotionDisplayExecuted"] requestKey: ["actualFloorStackExecuted", "promotionDisplayExecuted"]
}, },
{ {
...@@ -758,7 +789,7 @@ ...@@ -758,7 +789,7 @@
}) })
res.data.rows.forEach(item => { res.data.rows.forEach(item => {
// 计划月份 // 计划月份
item.promotionExecutionMonth = parseTime(item.promotionExecutionMonth, '{y}-{m}-{d}') item.salesMonth = parseTime(item.salesMonth, '{y}-{m}')
// 开户日期 // 开户日期
item.openingDate = parseTime(item.openingDate, '{y}-{m}-{d}') item.openingDate = parseTime(item.openingDate, '{y}-{m}-{d}')
// 闭户日期 // 闭户日期
......
<template> <template>
<!-- 零食陈列 -->
<CommonPlan :tableData="tableData" <CommonPlan :tableData="tableData"
:isLoading="isLoading" :isLoading="isLoading"
:total="total" :total="total"
...@@ -42,6 +43,15 @@ ...@@ -42,6 +43,15 @@
) )
} }
}, },
{
label: '计划月份', // 列标题
prop: 'salesMonth', // 列属性
visible: true, // 是否显示
type: 'string', // 列类型
fill: true, // 是否为填报列
fixed: 'left', // 是否固定在左侧
width: 90
},
{ {
"label": "销售大区", "label": "销售大区",
"prop": "regionName", "prop": "regionName",
...@@ -246,7 +256,7 @@ ...@@ -246,7 +256,7 @@
"type": "select", "type": "select",
referenceKey: "plannedDisplay", referenceKey: "plannedDisplay",
"fill": true, "fill": true,
"width": 130, "width": 160,
"options": [ "options": [
{ {
"label": "端架", "label": "端架",
...@@ -264,7 +274,11 @@ ...@@ -264,7 +274,11 @@
render: (_, row, col) => { render: (_, row, col) => {
return ( return (
<div> <div>
<span>{row[col.referenceKey] || '-'}</span> <el-tooltip placement="top" content={row[col.referenceKey] || '-'} disabled={!isContentOverflow(col.referenceKey, row[col.referenceKey], col)}>
<span style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 100%;">
{row[col.referenceKey] || '-'}
</span>
</el-tooltip>
<el-select modelValue={row[col.prop]} <el-select modelValue={row[col.prop]}
onUpdate:modelValue={(value) => { onUpdate:modelValue={(value) => {
row[col.prop] = value; row[col.prop] = value;
...@@ -561,6 +575,28 @@ ...@@ -561,6 +575,28 @@
isLoading.value = false isLoading.value = false
} }
getTableList() getTableList()
const isContentOverflow = (key, content, col) => {
if (!content) return false; // 没有内容则直接禁用
// 创建 DOM 计算
const tempSpan = document.createElement('span');
tempSpan.textContent = content;
tempSpan.className = 'ellipsis-tooltip';
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
document.body.appendChild(tempSpan);
// 获取元素宽度和内容宽度
const width = tempSpan.getBoundingClientRect().width;
// 移除临时元素
document.body.removeChild(tempSpan);
// 当内容宽度大于元素宽度时,表示内容溢出
return width > col.width;
};
</script> </script>
<style scoped <style scoped
......
...@@ -197,7 +197,7 @@ const columns = ref([ ...@@ -197,7 +197,7 @@ const columns = ref([
{ {
label: '快递单号', label: '快递单号',
prop: 'expressNo', prop: 'expressNo',
width: 150 width: 220
}, },
{ {
label: 'DD 单号', label: 'DD 单号',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论