提交 647ffb20 authored 作者: lidongxu's avatar lidongxu

Merge branch 'ap' into dev

...@@ -167,4 +167,22 @@ export function downloadDisplayScheduleTable(params) { ...@@ -167,4 +167,22 @@ export function downloadDisplayScheduleTable(params) {
params, params,
responseType: 'blob' responseType: 'blob'
}) })
} }
\ No newline at end of file
// 上传表格
export function uploadDisplayScheduleTable(data) {
return request({
url: '/operation/sales/import/upload',
method: 'POST',
data
})
}
// 确定上传表格数据保存
export function confirmUploadDisplayScheduleTable(data) {
return request({
url: '/operation/sales/import/update',
method: 'POST',
data
})
}
...@@ -12,4 +12,11 @@ export const getDisplayScheduleDashboardListArea = (params) => { ...@@ -12,4 +12,11 @@ export const getDisplayScheduleDashboardListArea = (params) => {
url: '/operation/sales/ap_report/query/store_cm', url: '/operation/sales/ap_report/query/store_cm',
params params
}) })
}
// 查询,店内执行上报-看板(经销商)
export const getDisplayScheduleDashboardListStore = (params) => {
return request({
url: '/operation/sales/ap_report/query/dist_cm',
params
})
} }
\ No newline at end of file
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
// 重写 el-table 的 loading-mask 加载进度蒙层 // 重写 el-table 的 loading-mask 加载进度蒙层
.el-loading-mask { .el-loading-mask {
z-index: 1 !important; z-index: 10000 !important;
} }
// to fixed https://github.com/ElemeFE/element/issues/2461 // to fixed https://github.com/ElemeFE/element/issues/2461
......
...@@ -143,8 +143,41 @@ service.interceptors.response.use(async res => { ...@@ -143,8 +143,41 @@ service.interceptors.response.use(async res => {
return res.data return res.data
} }
if (code === 401) { if (code === 401) {
// ... existing 401 handling code ... if (window.h5sdk) {
// 如果在飞书客户端,则无感知重新获取token
const code = await fsClientAuth()
await useUserStore().login({
type: 'fs',
data: { code }
})
// 重新发送本次失败的请求
return service(res.config)
}
// PC/移动端刷新 token 有效期
// await useUserStore().refreshTokenFn()
// return service(res.config)
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false;
useUserStore().logOut().then(() => {
// location.href = '#/login';
router.push({ path: '/login' })
})
}).catch(() => {
isRelogin.show = false;
});
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 403) { } else if (code === 403) {
// 如果刷新 refreshToken 接口也报错了,证明需要重新登录
// ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
// isRelogin.show = false;
// useUserStore().logOut().then(() => {
// location.href = '#/login';
// })
// }).catch(() => {
// isRelogin.show = false;
// });
// return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
showErrorMessage(msg, 'error') showErrorMessage(msg, 'error')
return Promise.reject(new Error(msg)) return Promise.reject(new Error(msg))
} else if (code === 500) { } else if (code === 500) {
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
@change="handleChange" @change="handleChange"
clearable> clearable>
<el-option label="全部" <el-option label="全部"
value="" /> value="全部" />
<el-option label="未执行" <el-option label="未执行"
value="未执行" /> value="未执行" />
</el-select> </el-select>
......
...@@ -32,16 +32,20 @@ ...@@ -32,16 +32,20 @@
<el-tooltip class="item" <el-tooltip class="item"
effect="dark" effect="dark"
content="下载表格" content="下载表格"
placement="top"> placement="top"
<el-button @click="downloadTable" type="primary"> v-if="tabsType === '常规陈列'">
<el-button @click="downloadTable"
type="primary">
下载表格 下载表格
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-tooltip class="item" <el-tooltip class="item"
effect="dark" effect="dark"
content="上传表格" content="上传表格"
placement="top"> placement="top"
<el-button @click="openTableDialog" type="success"> v-if="tabsType === '常规陈列'">
<el-button @click="uploadExcel"
type="success">
上传表格 上传表格
</el-button> </el-button>
</el-tooltip> </el-tooltip>
...@@ -125,12 +129,54 @@ ...@@ -125,12 +129,54 @@
<div ref="dialogTableContainer" <div ref="dialogTableContainer"
class="dialog-table-container"></div> class="dialog-table-container"></div>
</el-dialog> </el-dialog>
<!-- 上传表格-确认弹窗 -->
<el-dialog title="上传表格"
v-model="uploadPlanDialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
draggable
overflow
@close="handleDialogCloseUpload">
<div>
<!-- 计划表格 -->
<el-table :data="planTableList"
border
style="width: 100%"
show-overflow-tooltip
:row-class-name="tableRowClassName">
<el-table-column prop="errorMsg"
label="错误信息"
width="450"
v-if="isHaveErrPlan" />
<el-table-column v-for="item in fillModeColumns"
:key="item.label"
:prop="item.prop"
:label="item.label"
:width="item.width" />
</el-table>
</div>
<template #footer>
<div class="dialog-footer">
<p style="color: red; float: left;">如果表格有红色行,请根据错误提示修改本地表格重新上传</p>
<el-button @click="cancel">取消上传</el-button>
<el-button type="primary"
:disabled="isHaveErrPlan"
@click="confirmPlanBtn">
确定保存
</el-button>
</div>
</template>
</el-dialog>
</template> </template>
<script setup> <script setup>
import { h } from 'vue' import { h } from 'vue'
import userStore from '@/store/modules/user' import userStore from '@/store/modules/user'
import { downloadDisplayScheduleTable, uploadDisplayScheduleTable, uploadFileToOSSAPI, confirmUploadDisplayScheduleTable } from '@/api'
import { saveAs } from 'file-saver'
import { parseTime } from '@/utils'
import { v4 as uuidv4 } from 'uuid'
const props = defineProps({ const props = defineProps({
tableData: { // 数据源 tableData: { // 数据源
...@@ -159,9 +205,15 @@ const props = defineProps({ ...@@ -159,9 +205,15 @@ const props = defineProps({
formatter: { // 格式化函数 formatter: { // 格式化函数
type: Function, type: Function,
default: (row, col, cellValue) => cellValue default: (row, col, cellValue) => cellValue
},
tabsType: { // 当前 tab 类型
type: String,
default: '常规陈列' // 默认常规陈列
} }
}) })
const emit = defineEmits(['getTableList', 'updateShowSearch', 'downloadTable']) const emit = defineEmits(['getTableList', 'updateShowSearch'])
const { proxy } = getCurrentInstance()
/*************** 工具栏 ***************/ /*************** 工具栏 ***************/
const showFill = userStore().hasQcMarketEmpInfo // 是否启用填报模式 const showFill = userStore().hasQcMarketEmpInfo // 是否启用填报模式
...@@ -227,8 +279,101 @@ const getTableList = () => { ...@@ -227,8 +279,101 @@ const getTableList = () => {
} }
// 下载表格 // 下载表格
const downloadTable = () => { const typeObj = {
emit('downloadTable') '常规陈列': 'NORMAL_DISPLAY_EXPORT',
'档期计划': 'PROMOTION_PLAN_EXPORT',
'档期陈列': 'PROMOTION_DISPLAY_EXPORT',
'零食陈列': 'SNACK_DISPLAY_EXPORT',
'三米两秒': 'THREE_METER_TWO_SECONDS_EXPORT',
'六小金刚': 'SIX_KINGkONG_EXPORT'
}
const downloadTable = async () => {
proxy.$modal.loading('正在下载表格,请稍候...')
const res = await downloadDisplayScheduleTable({
...props.params,
salesMonth: parseTime(props.params.salesMonth, '{y}-{m}'),
pageNum: null,
pageSize: null,
pageType: typeObj[props.tabsType]
})
// 如果 salesMonth 为空,默认当前月
if (props.params.salesMonth) {
saveAs(res, `${props.tabsType}计划${parseTime(props.params.salesMonth, '{y}-{m}')}.xlsx`)
} else {
saveAs(res, `${props.tabsType}计划.xlsx`)
}
// 下载完成后,执行回调函数
proxy.$modal.closeLoading()
}
// 上传表格
const uploadPlanDialogVisible = ref(false)
const planTableList = ref([])
const isHaveErrPlan = computed(() => {
return planTableList.value.some(item => item.errorMsg)
})
const nowUUID = ref('') // 本次导入的 excel 标记(用于下次保存确定接口使用)
const nowExcelUrl = ref('') // 本次导入的 excel 地址
const importTypeObj = {
'常规陈列': 'NORMAL_DISPLAY_IMPORT',
'档期计划': 'PROMOTION_PLAN_IMPORT',
'档期陈列': 'PROMOTION_DISPLAY_IMPORT',
'零食陈列': 'SNACK_DISPLAY_IMPORT',
'三米两秒': 'THREE_METER_TWO_SECONDS_IMPORT',
'六小金刚': 'SIX_KINGkONG_IMPORT'
}
const uploadExcel = () => {
proxy.$modal.loading('正在上传表格,请稍候...')
proxy.chooseFile({
accept: '.xls, .xlsx'
}).then(async file => {
// 先上传阿里云
const excelUrl = await uploadFileToOSSAPI(`storeReport/${userStore().empInfo.empNo}/${uuidv4()}.${file.name.split('.').pop()}`, file)
const res = await uploadDisplayScheduleTable({
importApFilePath: excelUrl,
importApType: importTypeObj[props.tabsType]
})
nowExcelUrl.value = excelUrl
nowUUID.value = res.data.uuid || ''
planTableList.value = res.data.table || []
uploadPlanDialogVisible.value = true
}).finally(() => {
proxy.$modal.closeLoading()
})
}
const tableRowClassName = ({ row }) => {
if (row.errorMsg) {
return 'error-row'
} else {
return ''
}
}
// 取消
const cancel = () => {
uploadPlanDialogVisible.value = false
proxy.$modal.closeLoading()
}
// 确定上传
const confirmPlanBtn = async () => {
const res = await confirmUploadDisplayScheduleTable({
uuid: nowUUID.value,
importApFilePath: nowExcelUrl.value,
importApType: importTypeObj[props.tabsType]
})
if (res.code === 200) {
proxy.$modal.msgSuccess('导入成功')
getTableList()
uploadPlanDialogVisible.value = false
} else {
proxy.$modal.msgError(res.msg || '导入失败')
}
}
const handleDialogCloseUpload = () => {
uploadPlanDialogVisible.value = false
proxy.$modal.closeLoading()
} }
/************** 弹框控制 ***************/ /************** 弹框控制 ***************/
...@@ -476,6 +621,8 @@ const tableRowStyle = ({ row }) => { ...@@ -476,6 +621,8 @@ const tableRowStyle = ({ row }) => {
} }
} }
/* 分页器 */ /* 分页器 */
.pagination-container { .pagination-container {
margin: 10px; margin: 10px;
...@@ -483,6 +630,19 @@ const tableRowStyle = ({ row }) => { ...@@ -483,6 +630,19 @@ const tableRowStyle = ({ row }) => {
} }
// 上传表格确认框内表格的样式
.el-table {
::v-deep(.error-row) {
--el-table-tr-bg-color: var(--el-color-error-light-9);
}
/* 灰色过期行颜色 */
::v-deep(.timeout-row) {
--el-table-tr-bg-color: var(--el-timeout-row);
}
}
</style> </style>
<style lang="scss"> <style lang="scss">
......
...@@ -10,7 +10,7 @@ function splitAndFilter(str) { ...@@ -10,7 +10,7 @@ function splitAndFilter(str) {
} }
// 每个表格里的数据列信息集合 // 每个表格里的数据列信息集合
// 常规陈列 // 常规陈列
export const getDisplayConfig = (submitChangeCallback) => { export const getDisplayConfig = (submitChange) => {
return [ return [
// 一级类 // 一级类
{ {
...@@ -354,7 +354,7 @@ export const getDisplayConfig = (submitChangeCallback) => { ...@@ -354,7 +354,7 @@ export const getDisplayConfig = (submitChangeCallback) => {
row[col.referenceKey] ? <el-select modelValue={row[col.prop]} row[col.referenceKey] ? <el-select modelValue={row[col.prop]}
onUpdate:modelValue={(value) => { onUpdate:modelValue={(value) => {
row[col.prop] = value; row[col.prop] = value;
submitChangeCallback(row, col); submitChange(row, col);
}} }}
disabled={disabled} disabled={disabled}
class={{ 'no-disabled': row[col.referenceKey] }} class={{ 'no-disabled': row[col.referenceKey] }}
...@@ -400,7 +400,7 @@ export const getDisplayConfig = (submitChangeCallback) => { ...@@ -400,7 +400,7 @@ export const getDisplayConfig = (submitChangeCallback) => {
row[col.referenceKey] ? <el-input modelValue={row[col.prop]} row[col.referenceKey] ? <el-input modelValue={row[col.prop]}
onUpdate:modelValue={(value) => { onUpdate:modelValue={(value) => {
row[col.prop] = value; row[col.prop] = value;
submitChangeCallback(row, col); submitChange(row, col);
}} }}
min="0" min="0"
type="number" type="number"
...@@ -485,7 +485,7 @@ export const getDisplayConfig = (submitChangeCallback) => { ...@@ -485,7 +485,7 @@ export const getDisplayConfig = (submitChangeCallback) => {
{row[col.referenceKey] ? <el-select modelValue={row[col.prop]} {row[col.referenceKey] ? <el-select modelValue={row[col.prop]}
onUpdate:modelValue={(value) => { onUpdate:modelValue={(value) => {
row[col.prop] = value; row[col.prop] = value;
submitChangeCallback(row, col); submitChange(row, col);
}} }}
disabled={disabled} disabled={disabled}
class={{ 'no-disabled': row[col.referenceKey] }} class={{ 'no-disabled': row[col.referenceKey] }}
...@@ -580,7 +580,7 @@ export const getDisplayConfig = (submitChangeCallback) => { ...@@ -580,7 +580,7 @@ export const getDisplayConfig = (submitChangeCallback) => {
{row[col.referenceKey] ? <el-select modelValue={row[col.prop]} {row[col.referenceKey] ? <el-select modelValue={row[col.prop]}
onUpdate:modelValue={(value) => { onUpdate:modelValue={(value) => {
row[col.prop] = value; row[col.prop] = value;
submitChangeCallback(row, col); submitChange(row, col);
}} }}
disabled={disabled} disabled={disabled}
class={{ 'no-disabled': row[col.referenceKey] }} class={{ 'no-disabled': row[col.referenceKey] }}
...@@ -632,7 +632,7 @@ export const getDisplayConfig = (submitChangeCallback) => { ...@@ -632,7 +632,7 @@ export const getDisplayConfig = (submitChangeCallback) => {
{row[col.referenceKey] ? <el-select modelValue={row[col.prop]} {row[col.referenceKey] ? <el-select modelValue={row[col.prop]}
onUpdate:modelValue={(value) => { onUpdate:modelValue={(value) => {
row[col.prop] = value; row[col.prop] = value;
submitChangeCallback(row, col); submitChange(row, col);
}} }}
disabled={!row.actualFloorStackArea || disabled} disabled={!row.actualFloorStackArea || disabled}
class={{ 'no-disabled': row.actualFloorStackArea && row[col.referenceKey] }} class={{ 'no-disabled': row.actualFloorStackArea && row[col.referenceKey] }}
...@@ -736,7 +736,7 @@ export const getDisplayConfig = (submitChangeCallback) => { ...@@ -736,7 +736,7 @@ export const getDisplayConfig = (submitChangeCallback) => {
{row[col.referenceKey] ? <el-select modelValue={row[col.prop]} {row[col.referenceKey] ? <el-select modelValue={row[col.prop]}
onUpdate:modelValue={(value) => { onUpdate:modelValue={(value) => {
row[col.prop] = value; row[col.prop] = value;
submitChangeCallback(row, col); submitChange(row, col);
}} }}
disabled={disabled} disabled={disabled}
class={{ 'no-disabled': row[col.referenceKey] }} class={{ 'no-disabled': row[col.referenceKey] }}
...@@ -798,7 +798,7 @@ export const getDisplayConfig = (submitChangeCallback) => { ...@@ -798,7 +798,7 @@ export const getDisplayConfig = (submitChangeCallback) => {
{row[col.referenceKey] ? <el-select modelValue={row[col.prop]} {row[col.referenceKey] ? <el-select modelValue={row[col.prop]}
onUpdate:modelValue={(value) => { onUpdate:modelValue={(value) => {
row[col.prop] = value; row[col.prop] = value;
submitChangeCallback(row, col); submitChange(row, col);
}} }}
disabled={disabled} disabled={disabled}
class={{ 'no-disabled': row[col.referenceKey] }} class={{ 'no-disabled': row[col.referenceKey] }}
...@@ -902,6 +902,7 @@ export const getDisplayConfig = (submitChangeCallback) => { ...@@ -902,6 +902,7 @@ export const getDisplayConfig = (submitChangeCallback) => {
fill: false, fill: false,
width: 130 width: 130
}, },
{ {
label: '修改人', label: '修改人',
prop: 'updateBy', prop: 'updateBy',
...@@ -917,6 +918,31 @@ export const getDisplayConfig = (submitChangeCallback) => { ...@@ -917,6 +918,31 @@ export const getDisplayConfig = (submitChangeCallback) => {
type: 'string', type: 'string',
fill: false, fill: false,
width: 100 width: 100
},
{
label: '备注',
prop: 'remark',
visible: true,
type: 'input',
fill: true,
width: 150,
render: (_, row, col, disabled) => {
return (
<div>
{
<el-input modelValue={row[col.prop]}
onUpdate:modelValue={(value) => {
row[col.prop] = value;
submitChange(row, col);
}}
placeholder=""
disabled={disabled}
clearable>
</el-input>
}
</div>
)
},
} }
], ],
visible: true visible: true
...@@ -2123,6 +2149,31 @@ export const getSchedulePlanConfig = (submitChange) => { ...@@ -2123,6 +2149,31 @@ export const getSchedulePlanConfig = (submitChange) => {
type: 'string', type: 'string',
fill: false, fill: false,
width: 180 width: 180
},
{
label: '备注',
prop: 'remark',
visible: true,
type: 'input',
fill: true,
width: 150,
render: (_, row, col, disabled) => {
return (
<div>
{
<el-input modelValue={row[col.prop]}
onUpdate:modelValue={(value) => {
row[col.prop] = value;
submitChange(row, col);
}}
placeholder=""
disabled={disabled}
clearable>
</el-input>
}
</div>
)
},
} }
], ],
visible: true visible: true
...@@ -2822,6 +2873,31 @@ export const getScheduleDisConfig = (submitChange) => { ...@@ -2822,6 +2873,31 @@ export const getScheduleDisConfig = (submitChange) => {
type: 'string', type: 'string',
fill: false, fill: false,
width: 180 width: 180
},
{
label: '备注',
prop: 'remark',
visible: true,
type: 'input',
fill: true,
width: 150,
render: (_, row, col, disabled) => {
return (
<div>
{
<el-input modelValue={row[col.prop]}
onUpdate:modelValue={(value) => {
row[col.prop] = value;
submitChange(row, col);
}}
placeholder=""
disabled={disabled}
clearable>
</el-input>
}
</div>
)
},
} }
], ],
visible: true visible: true
...@@ -3291,6 +3367,31 @@ export const getSnackCofing = (submitChange) => { ...@@ -3291,6 +3367,31 @@ export const getSnackCofing = (submitChange) => {
type: 'string', type: 'string',
fill: false, fill: false,
width: 180 width: 180
},
{
label: '备注',
prop: 'remark',
visible: true,
type: 'input',
fill: true,
width: 150,
render: (_, row, col, disabled) => {
return (
<div>
{
<el-input modelValue={row[col.prop]}
onUpdate:modelValue={(value) => {
row[col.prop] = value;
submitChange(row, col);
}}
placeholder=""
disabled={disabled}
clearable>
</el-input>
}
</div>
)
},
} }
], ],
prop: 'snackColumns', prop: 'snackColumns',
...@@ -3565,6 +3666,31 @@ export const getThreeTwoSecondsConfig = (submitChange) => { ...@@ -3565,6 +3666,31 @@ export const getThreeTwoSecondsConfig = (submitChange) => {
fill: true, fill: true,
width: 200 width: 200
}, },
{
label: '备注',
prop: 'remark',
visible: true,
type: 'input',
fill: true,
width: 150,
render: (_, row, col, disabled) => {
return (
<div>
{
<el-input modelValue={row[col.prop]}
onUpdate:modelValue={(value) => {
row[col.prop] = value;
submitChange(row, col);
}}
placeholder=""
disabled={disabled}
clearable>
</el-input>
}
</div>
)
},
}
], ],
prop: 'sixtyGramHangBarColumns', prop: 'sixtyGramHangBarColumns',
visible: true visible: true
...@@ -3838,6 +3964,31 @@ export const getSixLittleDiamondsConfig = (submitChange) => { ...@@ -3838,6 +3964,31 @@ export const getSixLittleDiamondsConfig = (submitChange) => {
formulaStr: '公式:(六小金刚批发挂网实际 = 六小金刚批发挂网计划)', formulaStr: '公式:(六小金刚批发挂网实际 = 六小金刚批发挂网计划)',
fill: true, fill: true,
width: 210 width: 210
},
{
label: '备注',
prop: 'remark',
visible: true,
type: 'input',
fill: true,
width: 150,
render: (_, row, col, disabled) => {
return (
<div>
{
<el-input modelValue={row[col.prop]}
onUpdate:modelValue={(value) => {
row[col.prop] = value;
submitChange(row, col);
}}
placeholder=""
disabled={disabled}
clearable>
</el-input>
}
</div>
)
},
} }
], ],
prop: 'wholesaleNetColumns', prop: 'wholesaleNetColumns',
......
...@@ -8,19 +8,20 @@ ...@@ -8,19 +8,20 @@
:total="total" :total="total"
:params="params" :params="params"
:isLoading="isLoading" :isLoading="isLoading"
tabsType="常规陈列"
@getTableList="getTableList" @getTableList="getTableList"
@downloadTable="downloadTable" @updateShowSearch="v => showSearch.value = v"
@updateShowSearch="v => showSearch.value = v" /> />
</template> </template>
<script setup <script setup
lang="jsx"> lang="jsx">
import CustomTable from '../components/Table' import CustomTable from '../components/Table'
import SearchList from '../components/SearchList' import SearchList from '../components/SearchList'
import { getDisplayList, submitDisplayPlan, downloadDisplayScheduleTable } from '@/api' import { getDisplayList, submitDisplayPlan } from '@/api'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
import { getDisplayConfig } from './data.jsx' import { getDisplayConfig } from './data.jsx'
import { saveAs } from 'file-saver'
/*************** 表格操作相关 ***************/ /*************** 表格操作相关 ***************/
...@@ -83,6 +84,7 @@ ...@@ -83,6 +84,7 @@
isLoading.value = true isLoading.value = true
const res = await getDisplayList({ const res = await getDisplayList({
...params.value, ...params.value,
rqStatus: params.value.rqStatus === '全部' ? '' : params.value.rqStatus,
salesMonth: parseTime(params.value.salesMonth, '{y}-{m}') salesMonth: parseTime(params.value.salesMonth, '{y}-{m}')
}) })
res.data.rows.forEach(item => { res.data.rows.forEach(item => {
...@@ -114,16 +116,7 @@ ...@@ -114,16 +116,7 @@
/*************** 筛选 ***************/ /*************** 筛选 ***************/
const showSearch = ref(true) const showSearch = ref(true)
/*************** 下载表格 ***************/
const downloadTable = async () => {
console.log(params.value, '1')
const res = await downloadDisplayScheduleTable({
...params.value,
salesMonth: parseTime(params.value.salesMonth, '{y}-{m}'),
pageType: 'NORMAL_DISPLAY_EXPORT'
})
saveAs(res, '陈列计划.xlsx')
}
</script> </script>
<style lang="scss"> <style lang="scss">
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
:params="params" :params="params"
:isLoading="isLoading" :isLoading="isLoading"
:formatter="formatterFn" :formatter="formatterFn"
tabsType="档期计划"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
<!-- 弹窗:实际与计划不一致,让用户补充实际内容 --> <!-- 弹窗:实际与计划不一致,让用户补充实际内容 -->
...@@ -103,6 +104,7 @@ ...@@ -103,6 +104,7 @@
isLoading.value = true isLoading.value = true
const res = await getDisplayScheduleList({ const res = await getDisplayScheduleList({
...params.value, ...params.value,
rqStatus: params.value.rqStatus === '全部' ? '' : params.value.rqStatus,
salesMonth: parseTime(params.value.salesMonth, '{y}-{m}') salesMonth: parseTime(params.value.salesMonth, '{y}-{m}')
}) })
// 处理日期格式 // 处理日期格式
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
:total="total" :total="total"
:params="params" :params="params"
:isLoading="isLoading" :isLoading="isLoading"
tabsType="档期陈列"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -75,6 +76,7 @@ ...@@ -75,6 +76,7 @@
isLoading.value = true isLoading.value = true
const res = await getDisplayScheduleDetail({ const res = await getDisplayScheduleDetail({
...params.value, ...params.value,
rqStatus: params.value.rqStatus === '全部' ? '' : params.value.rqStatus,
salesMonth: parseTime(params.value.salesMonth, '{y}-{m}') salesMonth: parseTime(params.value.salesMonth, '{y}-{m}')
}) })
res.data.rows.forEach(item => { res.data.rows.forEach(item => {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
:total="total" :total="total"
:params="params" :params="params"
:isLoading="isLoading" :isLoading="isLoading"
tabsType="六小金刚"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -72,6 +73,7 @@ ...@@ -72,6 +73,7 @@
isLoading.value = true isLoading.value = true
getSixLittleDiamondsPlanList({ getSixLittleDiamondsPlanList({
...params.value, ...params.value,
rqStatus: params.value.rqStatus === '全部' ? '' : params.value.rqStatus,
salesMonth: parseTime(params.value.salesMonth, '{y}-{m}') salesMonth: parseTime(params.value.salesMonth, '{y}-{m}')
}).then(res => { }).then(res => {
isLoading.value = false isLoading.value = false
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
:total="total" :total="total"
:params="params" :params="params"
:isLoading="isLoading" :isLoading="isLoading"
tabsType="零食陈列"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -107,6 +108,7 @@ ...@@ -107,6 +108,7 @@
isLoading.value = true isLoading.value = true
const res = await getSnackPlanList({ const res = await getSnackPlanList({
...params.value, ...params.value,
rqStatus: params.value.rqStatus === '全部' ? '' : params.value.rqStatus,
salesMonth: parseTime(params.value.salesMonth, '{y}-{m}') salesMonth: parseTime(params.value.salesMonth, '{y}-{m}')
}) })
res.data.rows.forEach(item => { res.data.rows.forEach(item => {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
:total="total" :total="total"
:params="params" :params="params"
:isLoading="isLoading" :isLoading="isLoading"
tabsType="三米两秒"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -27,8 +28,6 @@ ...@@ -27,8 +28,6 @@
/*************** 表格 ***************/ /*************** 表格 ***************/
// 提交变更 // 提交变更
const submitChange = async (row, col) => { const submitChange = async (row, col) => {
let requestObj = {} let requestObj = {}
if (col.requestKey) { if (col.requestKey) {
// 关联的公式计算列,需要特殊处理 // 关联的公式计算列,需要特殊处理
...@@ -73,6 +72,7 @@ ...@@ -73,6 +72,7 @@
isLoading.value = true isLoading.value = true
getThreeMetersTwoSecondsPlanList({ getThreeMetersTwoSecondsPlanList({
...params.value, ...params.value,
rqStatus: params.value.rqStatus === '全部' ? '' : params.value.rqStatus,
salesMonth: proxy.parseTime(params.value.salesMonth, '{y}-{m}') salesMonth: proxy.parseTime(params.value.salesMonth, '{y}-{m}')
}).then(res => { }).then(res => {
isLoading.value = false isLoading.value = false
......
...@@ -3,12 +3,15 @@ ...@@ -3,12 +3,15 @@
<!-- 操作类型 --> <!-- 操作类型 -->
<el-row> <el-row>
<el-form-item> <el-form-item>
<el-radio-group v-model="operation" @change="handleChange"> <el-radio-group v-model="operation"
@change="handleChange">
<el-radio-button label="大区战区-分析" <el-radio-button label="大区战区-分析"
value="大区战区-分析" value="大区战区-分析"
v-hasPermi="['promotion:dashboard:list-show']" /> v-hasPermi="['promotion:dashboard:list-show']" />
<el-radio-button label="城市经理-分析" <el-radio-button label="城市经理-分析"
value="城市经理-分析" /> value="城市经理-分析" />
<el-radio-button label="经销商-分析"
value="经销商-分析" />
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-row> </el-row>
...@@ -66,7 +69,11 @@ const props = defineProps({ ...@@ -66,7 +69,11 @@ const props = defineProps({
formatter: { // 格式化函数 formatter: { // 格式化函数
type: Function, type: Function,
default: (row, col, cellValue) => cellValue default: (row, col, cellValue) => cellValue
} },
queryParams: { // 查询参数
type: Object,
default: () => ({})
},
}) })
const emit = defineEmits(['getTableList']) const emit = defineEmits(['getTableList'])
...@@ -98,25 +105,58 @@ onMounted(() => { ...@@ -98,25 +105,58 @@ onMounted(() => {
// 初始化列选择的函数 // 初始化列选择的函数
const initColumns = () => { const initColumns = () => {
if (operation.value === '大区战区-分析') { if (operation.value === '大区战区-分析') {
chooseColumns.value = props.baseColumns.filter(item => item.prop !== 'cityManager') chooseColumns.value = [{
label: "大区",
prop: "regionName",
childCol: [],
},
{
label: "战区",
prop: "districtName",
childCol: [],
}].concat(props.baseColumns)
} else if (operation.value === '经销商-分析') {
chooseColumns.value = [{
label: '经销商',
prop: "dealerName",
childCol: [],
width: 220
},
{
label: '经销商编码',
prop: "dealerCode",
childCol: [],
}].concat(props.baseColumns)
} else { } else {
chooseColumns.value = props.baseColumns chooseColumns.value = [{
label: "大区",
prop: "regionName",
childCol: [],
},
{
label: "战区",
prop: "districtName",
childCol: [],
},
{
label: "城市经理",
prop: "cityManager",
childCol: [],
}].concat(props.baseColumns)
} }
} }
watch(operation, (newVal) => { watch(operation, () => {
// 如果是大区战区-分析,则隐藏城市经理列 // 如果是大区战区-分析,则隐藏城市经理列
if (newVal === '大区战区-分析') { initColumns()
chooseColumns.value = props.baseColumns.filter(item => item.prop !== 'cityManager')
} else {
chooseColumns.value = props.baseColumns
}
}, { }, {
immediate: true immediate: true
}) })
// 切换操作类型时触发的函数 // 切换操作类型时触发的函数
const handleChange = (newVal) => { const handleChange = (newVal) => {
console.log('table', newVal)
props.queryParams.operation = newVal
emit('getTableList', newVal) emit('getTableList', newVal)
} }
......
...@@ -9,21 +9,6 @@ export const getDisplayConfig = () => { ...@@ -9,21 +9,6 @@ export const getDisplayConfig = () => {
// width: 100, // width: 100,
// childCol: [] // childCol: []
// }, // },
{
label: "大区",
prop: "regionName",
childCol: []
},
{
label: "战区",
prop: "districtName",
childCol: []
},
{
label: "城市经理",
prop: "cityManager",
childCol: []
},
{ {
label: '主货架', label: '主货架',
prop: "mainShelf", prop: "mainShelf",
...@@ -125,21 +110,6 @@ export const getSchedulePlanConfig = (submitChange) => { ...@@ -125,21 +110,6 @@ export const getSchedulePlanConfig = (submitChange) => {
// prop: "salesMonth", // prop: "salesMonth",
// width: 100 // width: 100
// }, // },
{
label: "大区",
prop: "regionName",
width: 100
},
{
label: "战区",
prop: "districtName",
width: 100
},
{
label: "城市经理",
prop: "cityManager",
width: 100
},
{ {
label: '大区反馈', label: '大区反馈',
prop: "regionFeedback", prop: "regionFeedback",
...@@ -229,21 +199,7 @@ export const getScheduleDisConfig = (submitChange) => { ...@@ -229,21 +199,7 @@ export const getScheduleDisConfig = (submitChange) => {
// prop: "salesMonth", // prop: "salesMonth",
// width: 100 // width: 100
// }, // },
{
label: "大区",
prop: "regionName",
width: 100
},
{
label: "战区",
prop: "districtName",
width: 100
},
{
label: "城市经理",
prop: "cityManager",
width: 100
},
{ {
label: '端架', label: '端架',
prop: "endShelf", prop: "endShelf",
...@@ -309,21 +265,7 @@ export const getSnackCofing = (submitChange) => { ...@@ -309,21 +265,7 @@ export const getSnackCofing = (submitChange) => {
// prop: "salesMonth", // prop: "salesMonth",
// width: 100 // width: 100
// }, // },
{
label: "大区",
prop: "regionName",
width: 100
},
{
label: "战区",
prop: "districtName",
width: 100
},
{
label: "城市经理",
prop: "cityManager",
width: 100
},
{ {
label: '计划', label: '计划',
prop: "planSnackStoreCnt", prop: "planSnackStoreCnt",
...@@ -347,21 +289,7 @@ export const getThreeTwoSecondsConfig = (submitChange) => { ...@@ -347,21 +289,7 @@ export const getThreeTwoSecondsConfig = (submitChange) => {
// prop: "salesMonth", // prop: "salesMonth",
// width: 100 // width: 100
// }, // },
{
label: "大区",
prop: "regionName",
width: 100
},
{
label: "战区",
prop: "districtName",
width: 100
},
{
label: "城市经理",
prop: "cityManager",
width: 100
},
{ {
label: '计划', label: '计划',
prop: "planSLStoreCnt", prop: "planSLStoreCnt",
...@@ -385,21 +313,7 @@ export const getSixLittleDiamondsConfig = (submitChange) => { ...@@ -385,21 +313,7 @@ export const getSixLittleDiamondsConfig = (submitChange) => {
// prop: "salesMonth", // prop: "salesMonth",
// width: 100 // width: 100
// }, // },
{
label: "大区",
prop: "regionName",
width: 100
},
{
label: "战区",
prop: "districtName",
width: 100
},
{
label: "城市经理",
prop: "cityManager",
width: 100
},
{ {
label: '计划', label: '计划',
prop: "planSixJdStoreCnt", prop: "planSixJdStoreCnt",
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<CustomTable :tableData="tableData" <CustomTable :tableData="tableData"
:baseColumns="baseColumns" :baseColumns="baseColumns"
:isLoading="isLoading" :isLoading="isLoading"
:queryParams="queryParams"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
<script setup <script setup
lang="jsx"> lang="jsx">
import CustomTable from '../components/Table' import CustomTable from '../components/Table'
import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea } from '@/api' import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea, getDisplayScheduleDashboardListStore } from '@/api'
import { getDisplayConfig } from './data.jsx' import { getDisplayConfig } from './data.jsx'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
...@@ -35,32 +36,45 @@ ...@@ -35,32 +36,45 @@
// 表格数据 // 表格数据
const queryParams = reactive({ const queryParams = reactive({
salesMonth: new Date(), salesMonth: new Date(),
operation: ''
}) })
const tableData = ref([]) const tableData = ref([])
const isLoading = ref(true) const isLoading = ref(true)
const total = ref(0) const total = ref(0)
// 筛选列表数据 // 筛选列表数据
const getTableList = async (operation) => { const apiObj = {
'大区战区-分析': getDisplayScheduleDashboardList,
'城市经理-分析': getDisplayScheduleDashboardListArea,
'经销商-分析': getDisplayScheduleDashboardListStore,
}
const getTableList = async () => {
isLoading.value = true isLoading.value = true
const res = await (operation === '大区战区-分析' ? getDisplayScheduleDashboardList : getDisplayScheduleDashboardListArea)({ const res = await apiObj[queryParams.operation]({
...queryParams, ...queryParams,
salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}') salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}')
}) })
if (operation === '大区战区-分析') { if (queryParams.operation === '大区战区-分析') {
// 合并战区大区结构为扁平化 // 合并战区大区结构为扁平化
const { zq, dq } = res.data const { zq, dq, hz } = res.data
tableData.value = [...zq, ...dq] tableData.value = [...zq, ...dq, ...hz]
} else if (queryParams.operation === '经销商-分析') {
// 合并经销商结构为扁平化
const { dist, hz } = res.data
tableData.value = [...dist, ...hz]
} else { } else {
// 合并城市经理结构为扁平化
tableData.value = res.data tableData.value = res.data
} }
isLoading.value = false isLoading.value = false
} }
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show']) onMounted(() => {
getTableList(isDaQuZQ ? '大区战区-分析' : '城市经理-分析') const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show'])
queryParams.operation = isDaQuZQ ? '大区战区-分析' : '城市经理-分析'
getTableList()
})
</script> </script>
<style lang="scss"> <style lang="scss">
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<CustomTable :tableData="tableData" <CustomTable :tableData="tableData"
:baseColumns="baseColumns" :baseColumns="baseColumns"
:isLoading="isLoading" :isLoading="isLoading"
:queryParams="queryParams"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
<script setup <script setup
lang="jsx"> lang="jsx">
import CustomTable from '../components/Table' import CustomTable from '../components/Table'
import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea } from '@/api' import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea, getDisplayScheduleDashboardListStore } from '@/api'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
import { getSchedulePlanConfig } from './data.jsx' import { getSchedulePlanConfig } from './data.jsx'
...@@ -68,29 +69,42 @@ ...@@ -68,29 +69,42 @@
// 表格数据 // 表格数据
const queryParams = reactive({ const queryParams = reactive({
salesMonth: new Date(), salesMonth: new Date(),
operation: ''
}) })
const tableData = ref([]) const tableData = ref([])
const isLoading = ref(true) const isLoading = ref(true)
const total = ref(0) const total = ref(0)
// 筛选列表数据 // 筛选列表数据
const getTableList = async (operation) => { const apiObj = {
'大区战区-分析': getDisplayScheduleDashboardList,
'城市经理-分析': getDisplayScheduleDashboardListArea,
'经销商-分析': getDisplayScheduleDashboardListStore,
}
const getTableList = async () => {
isLoading.value = true isLoading.value = true
const res = await (operation === '大区战区-分析' ? getDisplayScheduleDashboardList : getDisplayScheduleDashboardListArea)({ const res = await apiObj[queryParams.operation]({
...queryParams, ...queryParams,
salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}') salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}')
}) })
if (operation === '大区战区-分析') { if (queryParams.operation === '大区战区-分析') {
// 合并战区大区结构为扁平化 // 合并战区大区结构为扁平化
const { zq, dq } = res.data const { zq, dq, hz } = res.data
tableData.value = [...zq, ...dq] tableData.value = [...zq, ...dq, ...hz]
} else if (queryParams.operation === '经销商-分析') {
// 合并经销商结构为扁平化
const { dist, hz } = res.data
tableData.value = [...dist, ...hz]
} else { } else {
// 合并城市经理结构为扁平化
tableData.value = res.data tableData.value = res.data
} }
isLoading.value = false isLoading.value = false
} }
const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show'])
getTableList(isDaQuZQ ? '大区战区-分析' : '城市经理-分析') onMounted(() => {
const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show'])
queryParams.operation = isDaQuZQ ? '大区战区-分析' : '城市经理-分析'
getTableList()
})
</script> </script>
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<CustomTable :tableData="tableData" <CustomTable :tableData="tableData"
:baseColumns="baseColumns" :baseColumns="baseColumns"
:isLoading="isLoading" :isLoading="isLoading"
:queryParams="queryParams"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
<script setup <script setup
lang="jsx"> lang="jsx">
import CustomTable from '../components/Table' import CustomTable from '../components/Table'
import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea } from '@/api' import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea, getDisplayScheduleDashboardListStore } from '@/api'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
import { getScheduleDisConfig } from './data' import { getScheduleDisConfig } from './data'
...@@ -64,30 +65,44 @@ ...@@ -64,30 +65,44 @@
// 表格数据 // 表格数据
const queryParams = reactive({ const queryParams = reactive({
salesMonth: new Date(), salesMonth: new Date(),
operation: ''
}) })
const tableData = ref([]) const tableData = ref([])
const isLoading = ref(true) const isLoading = ref(true)
const total = ref(0) const total = ref(0)
// 筛选列表数据 // 筛选列表数据
const getTableList = async (operation) => { const apiObj = {
'大区战区-分析': getDisplayScheduleDashboardList,
'城市经理-分析': getDisplayScheduleDashboardListArea,
'经销商-分析': getDisplayScheduleDashboardListStore,
}
const getTableList = async () => {
console.log('走了吗?')
isLoading.value = true isLoading.value = true
const res = await (operation === '大区战区-分析' ? getDisplayScheduleDashboardList : getDisplayScheduleDashboardListArea)({ const res = await apiObj[queryParams.operation]({
...queryParams, ...queryParams,
salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}') salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}')
}) })
if (operation === '大区战区-分析') { if (queryParams.operation === '大区战区-分析') {
// 合并战区大区结构为扁平化 // 合并战区大区结构为扁平化
const { zq, dq } = res.data const { zq, dq, hz } = res.data
tableData.value = [...zq, ...dq] tableData.value = [...zq, ...dq, ...hz]
} else if (queryParams.operation === '经销商-分析') {
// 合并经销商结构为扁平化
const { dist, hz } = res.data
tableData.value = [...dist, ...hz]
} else { } else {
// 合并城市经理结构为扁平化
tableData.value = res.data tableData.value = res.data
} }
isLoading.value = false isLoading.value = false
} }
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show']) onMounted(() => {
getTableList(isDaQuZQ ? '大区战区-分析' : '城市经理-分析') const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show'])
queryParams.operation = isDaQuZQ ? '大区战区-分析' : '城市经理-分析'
getTableList()
})
</script> </script>
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<CustomTable :tableData="tableData" <CustomTable :tableData="tableData"
:baseColumns="baseColumns" :baseColumns="baseColumns"
:isLoading="isLoading" :isLoading="isLoading"
:queryParams="queryParams"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
<script setup <script setup
lang="jsx"> lang="jsx">
import CustomTable from '../components/Table' import CustomTable from '../components/Table'
import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea } from '@/api' import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea, getDisplayScheduleDashboardListStore } from '@/api'
import { getSixLittleDiamondsConfig } from './data.jsx' import { getSixLittleDiamondsConfig } from './data.jsx'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
...@@ -64,30 +65,43 @@ ...@@ -64,30 +65,43 @@
// 表格数据 // 表格数据
const queryParams = reactive({ const queryParams = reactive({
salesMonth: new Date(), salesMonth: new Date(),
operation: ''
}) })
const tableData = ref([]) const tableData = ref([])
const isLoading = ref(true) const isLoading = ref(true)
const total = ref(0) const total = ref(0)
// 筛选列表数据 // 筛选列表数据
const getTableList = async (operation) => { const apiObj = {
'大区战区-分析': getDisplayScheduleDashboardList,
'城市经理-分析': getDisplayScheduleDashboardListArea,
'经销商-分析': getDisplayScheduleDashboardListStore,
}
const getTableList = async () => {
isLoading.value = true isLoading.value = true
const res = await (operation === '大区战区-分析' ? getDisplayScheduleDashboardList : getDisplayScheduleDashboardListArea)({ const res = await apiObj[queryParams.operation]({
...queryParams, ...queryParams,
salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}') salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}')
}) })
if (operation === '大区战区-分析') { if (queryParams.operation === '大区战区-分析') {
// 合并战区大区结构为扁平化 // 合并战区大区结构为扁平化
const { zq, dq } = res.data const { zq, dq, hz } = res.data
tableData.value = [...zq, ...dq] tableData.value = [...zq, ...dq, ...hz]
} else if (queryParams.operation === '经销商-分析') {
// 合并经销商结构为扁平化
const { dist, hz } = res.data
tableData.value = [...dist, ...hz]
} else { } else {
// 合并城市经理结构为扁平化
tableData.value = res.data tableData.value = res.data
} }
isLoading.value = false isLoading.value = false
} }
const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show'])
getTableList(isDaQuZQ ? '大区战区-分析' : '城市经理-分析') onMounted(() => {
const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show'])
queryParams.operation = isDaQuZQ ? '大区战区-分析' : '城市经理-分析'
getTableList()
})
</script> </script>
<style scoped></style> <style scoped></style>
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<CustomTable :tableData="tableData" <CustomTable :tableData="tableData"
:baseColumns="baseColumns" :baseColumns="baseColumns"
:isLoading="isLoading" :isLoading="isLoading"
:queryParams="queryParams"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
<script setup <script setup
lang="jsx"> lang="jsx">
import CustomTable from '../components/Table' import CustomTable from '../components/Table'
import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea } from '@/api' import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea, getDisplayScheduleDashboardListStore } from '@/api'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
import { getSnackCofing } from './data.jsx'; import { getSnackCofing } from './data.jsx';
...@@ -60,31 +61,44 @@ ...@@ -60,31 +61,44 @@
// 表格数据 // 表格数据
const queryParams = reactive({ const queryParams = reactive({
salesMonth: new Date(), salesMonth: new Date(),
operation: ''
}) })
const tableData = ref([]) const tableData = ref([])
const isLoading = ref(true) const isLoading = ref(true)
const total = ref(0) const total = ref(0)
// 筛选列表数据 // 筛选列表数据
const getTableList = async (operation) => { const apiObj = {
'大区战区-分析': getDisplayScheduleDashboardList,
'城市经理-分析': getDisplayScheduleDashboardListArea,
'经销商-分析': getDisplayScheduleDashboardListStore,
}
const getTableList = async () => {
isLoading.value = true isLoading.value = true
const res = await (operation === '大区战区-分析' ? getDisplayScheduleDashboardList : getDisplayScheduleDashboardListArea)({ const res = await apiObj[queryParams.operation]({
...queryParams, ...queryParams,
salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}') salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}')
}) })
if (operation === '大区战区-分析') { if (queryParams.operation === '大区战区-分析') {
// 合并战区大区结构为扁平化 // 合并战区大区结构为扁平化
const { zq, dq } = res.data const { zq, dq, hz } = res.data
tableData.value = [...zq, ...dq] tableData.value = [...zq, ...dq, ...hz]
} else if (queryParams.operation === '经销商-分析') {
// 合并经销商结构为扁平化
const { dist, hz } = res.data
tableData.value = [...dist, ...hz]
} else { } else {
// 合并城市经理结构为扁平化
tableData.value = res.data tableData.value = res.data
} }
isLoading.value = false isLoading.value = false
} }
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show']) onMounted(() => {
getTableList(isDaQuZQ ? '大区战区-分析' : '城市经理-分析') const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show'])
queryParams.operation = isDaQuZQ ? '大区战区-分析' : '城市经理-分析'
getTableList()
})
</script> </script>
<style scoped <style scoped
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<CustomTable :tableData="tableData" <CustomTable :tableData="tableData"
:baseColumns="baseColumns" :baseColumns="baseColumns"
:isLoading="isLoading" :isLoading="isLoading"
:queryParams="queryParams"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="v => showSearch.value = v" /> @updateShowSearch="v => showSearch.value = v" />
</template> </template>
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
<script setup <script setup
lang="jsx"> lang="jsx">
import CustomTable from '../components/Table' import CustomTable from '../components/Table'
import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea } from '@/api' import { getDisplayScheduleDashboardList, getDisplayScheduleDashboardListArea, getDisplayScheduleDashboardListStore } from '@/api'
import { getThreeTwoSecondsConfig } from './data.jsx' import { getThreeTwoSecondsConfig } from './data.jsx'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
...@@ -66,30 +67,43 @@ ...@@ -66,30 +67,43 @@
// 表格数据 // 表格数据
const queryParams = reactive({ const queryParams = reactive({
salesMonth: new Date(), salesMonth: new Date(),
operation: ''
}) })
const tableData = ref([]) const tableData = ref([])
const isLoading = ref(true) const isLoading = ref(true)
const total = ref(0) const total = ref(0)
// 筛选列表数据 // 筛选列表数据
const getTableList = async (operation) => { const apiObj = {
'大区战区-分析': getDisplayScheduleDashboardList,
'城市经理-分析': getDisplayScheduleDashboardListArea,
'经销商-分析': getDisplayScheduleDashboardListStore,
}
const getTableList = async () => {
isLoading.value = true isLoading.value = true
const res = await (operation === '大区战区-分析' ? getDisplayScheduleDashboardList : getDisplayScheduleDashboardListArea)({ const res = await apiObj[queryParams.operation]({
...queryParams, ...queryParams,
salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}') salesMonth: parseTime(queryParams.salesMonth, '{y}-{m}')
}) })
if (operation === '大区战区-分析') { if (queryParams.operation === '大区战区-分析') {
// 合并战区大区结构为扁平化 // 合并战区大区结构为扁平化
const { zq, dq } = res.data const { zq, dq, hz } = res.data
tableData.value = [...zq, ...dq] tableData.value = [...zq, ...dq, ...hz]
} else if (queryParams.operation === '经销商-分析') {
// 合并经销商结构为扁平化
const { dist, hz } = res.data
tableData.value = [...dist, ...hz]
} else { } else {
// 合并城市经理结构为扁平化
tableData.value = res.data tableData.value = res.data
} }
isLoading.value = false isLoading.value = false
} }
const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show'])
getTableList(isDaQuZQ ? '大区战区-分析' : '城市经理-分析') onMounted(() => {
const isDaQuZQ = proxy.checkPermi(['promotion:dashboard:list-show'])
queryParams.operation = isDaQuZQ ? '大区战区-分析' : '城市经理-分析'
getTableList()
})
</script> </script>
......
...@@ -424,6 +424,7 @@ const uploadPlanFile = async (file) => { // 上传计划表格 ...@@ -424,6 +424,7 @@ const uploadPlanFile = async (file) => { // 上传计划表格
"excelUrl": excelUrl, "excelUrl": excelUrl,
"employeeNo": empInfo.empNo "employeeNo": empInfo.empNo
}) })
console.log(res)
planTableList.value = res.data.table planTableList.value = res.data.table
isHaveErrPlan.value = !!res.data.table[0].errorMsg isHaveErrPlan.value = !!res.data.table[0].errorMsg
confirmExcelUUID.value = res.data.uuid confirmExcelUUID.value = res.data.uuid
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论