debug
完善自媒体渠道修改
This commit is contained in:
@@ -89,7 +89,15 @@
|
|||||||
|
|
||||||
<el-table class="mt-4" size="large" v-loading="pager.loading" :data="pager.lists">
|
<el-table class="mt-4" size="large" v-loading="pager.loading" :data="pager.lists">
|
||||||
<el-table-column label="日期" prop="cost_date" min-width="120" />
|
<el-table-column label="日期" prop="cost_date" min-width="120" />
|
||||||
<el-table-column label="自媒体渠道" prop="media_channel_name" min-width="120" />
|
<el-table-column label="自媒体渠道" min-width="160">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="getChannelGroupLabel(row.media_channel_code)">
|
||||||
|
<el-tag size="small" class="mr-1">{{ getChannelGroupLabel(row.media_channel_code) }}</el-tag>
|
||||||
|
{{ row.media_channel_name }}
|
||||||
|
</span>
|
||||||
|
<span v-else>{{ row.media_channel_name }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="部门" prop="dept_name" min-width="140" />
|
<el-table-column label="部门" prop="dept_name" min-width="140" />
|
||||||
<el-table-column label="账户消耗" min-width="120">
|
<el-table-column label="账户消耗" min-width="120">
|
||||||
<template #default="{ row }">¥{{ row.amount }}</template>
|
<template #default="{ row }">¥{{ row.amount }}</template>
|
||||||
@@ -213,6 +221,17 @@ const deptOptions = computed<DeptOption[]>(() => {
|
|||||||
|
|
||||||
const defaultMediaChannelCode = computed(() => String(pager.extend.default_media_channel_code || ''))
|
const defaultMediaChannelCode = computed(() => String(pager.extend.default_media_channel_code || ''))
|
||||||
|
|
||||||
|
const getChannelGroupLabel = (channelCode: string): string => {
|
||||||
|
if (!channelCode) return ''
|
||||||
|
for (const group of mediaChannelGroups.value) {
|
||||||
|
const channel = group.channels.find(ch => ch.channel_code === channelCode)
|
||||||
|
if (channel) {
|
||||||
|
return group.group_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
const treeProps = {
|
const treeProps = {
|
||||||
value: 'id',
|
value: 'id',
|
||||||
label: 'name',
|
label: 'name',
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ class AccountCostLogic extends BaseLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mediaChannelCode = trim((string) ($params['media_channel_code'] ?? ''));
|
||||||
|
$mediaChannelName = MediaChannelService::getNameByCode($mediaChannelCode);
|
||||||
|
|
||||||
$supportsDeptBinding = AccountCost::supportsDeptBinding();
|
$supportsDeptBinding = AccountCost::supportsDeptBinding();
|
||||||
$deptId = $supportsDeptBinding ? (int) ($params['dept_id'] ?? 0) : 0;
|
$deptId = $supportsDeptBinding ? (int) ($params['dept_id'] ?? 0) : 0;
|
||||||
$deptName = $supportsDeptBinding ? self::resolveDeptName($deptId) : '';
|
$deptName = $supportsDeptBinding ? self::resolveDeptName($deptId) : '';
|
||||||
@@ -89,7 +92,7 @@ class AccountCostLogic extends BaseLogic
|
|||||||
if ($supportsDeptBinding) {
|
if ($supportsDeptBinding) {
|
||||||
if (AccountCost::where('id', '<>', (int) $params['id'])
|
if (AccountCost::where('id', '<>', (int) $params['id'])
|
||||||
->where('cost_date', (string) $model->cost_date)
|
->where('cost_date', (string) $model->cost_date)
|
||||||
->where('media_channel_code', (string) $model->media_channel_code)
|
->where('media_channel_code', $mediaChannelCode)
|
||||||
->where('dept_id', $deptId)
|
->where('dept_id', $deptId)
|
||||||
->count() > 0) {
|
->count() > 0) {
|
||||||
self::setError('该日期下所选渠道和部门的账户消耗已存在,请直接编辑');
|
self::setError('该日期下所选渠道和部门的账户消耗已存在,请直接编辑');
|
||||||
@@ -98,6 +101,8 @@ class AccountCostLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$model->media_channel_code = $mediaChannelCode;
|
||||||
|
$model->media_channel_name = $mediaChannelName;
|
||||||
if ($supportsDeptBinding) {
|
if ($supportsDeptBinding) {
|
||||||
$model->dept_id = $deptId;
|
$model->dept_id = $deptId;
|
||||||
$model->dept_name = $deptName;
|
$model->dept_name = $deptName;
|
||||||
|
|||||||
Reference in New Issue
Block a user