Commit a30d8a85 by lijiabin

【需求 20331】 feat: 推送人员新增推送全员

parent ca761014
...@@ -169,10 +169,18 @@ ...@@ -169,10 +169,18 @@
<!-- 如果是官方账号的话还有推送相关的配置 以及能上传视频--> <!-- 如果是官方账号的话还有推送相关的配置 以及能上传视频-->
<template v-if="userInfo.isOfficialAccount"> <template v-if="userInfo.isOfficialAccount">
<el-form-item label="推送给"> <el-form-item label="推送给">
<el-button class="button-new-tag" size="small" @click="handleSelectUserAndDept"> <div class="w-full flex items-center gap-2">
+ 添加部门 <el-radio-group v-model="form.isPushAll">
</el-button> <el-radio :value="BooleanFlag.YES">全员</el-radio>
<span class="ml-2 text-sm text-gray-600"> {{ selectedText }}已选择下属部门</span> <el-radio :value="BooleanFlag.NO">指定部门/人员</el-radio>
</el-radio-group>
</div>
<div v-show="form.isPushAll === BooleanFlag.NO" class="flex items-center gap-2">
<el-button class="button-new-tag" size="small" @click="handleSelectUserAndDept">
+ 添加部门/人员
</el-button>
<span class="ml-2 text-sm text-gray-600"> {{ selectedText }}</span>
</div>
</el-form-item> </el-form-item>
<el-form-item label="推送类型" prop="pushType"> <el-form-item label="推送类型" prop="pushType">
<el-radio-group v-model="form.pushType"> <el-radio-group v-model="form.pushType">
...@@ -204,7 +212,38 @@ ...@@ -204,7 +212,38 @@
</template> </template>
</div> </div>
</template> </template>
<!-- 如果是官方账号的话还有推送相关的配置 帖子也要加推送-->
<template v-if="userInfo.isOfficialAccount && form.type === ArticleTypeEnum.POST">
<el-form-item label="推送给">
<div class="w-full flex items-center gap-2">
<el-radio-group v-model="form.isPushAll">
<el-radio :value="BooleanFlag.YES">全员</el-radio>
<el-radio :value="BooleanFlag.NO">指定部门/人员</el-radio>
</el-radio-group>
</div>
<div v-show="form.isPushAll === BooleanFlag.NO" class="flex items-center gap-2">
<el-button class="button-new-tag" size="small" @click="handleSelectUserAndDept">
+ 添加部门/人员
</el-button>
<span class="ml-2 text-sm text-gray-600"> {{ selectedText }}</span>
</div>
</el-form-item>
<el-form-item label="推送类型" prop="pushType">
<el-radio-group v-model="form.pushType">
<el-radio :value="SendTypeEnum.IMMEDIATE">立即推送</el-radio>
<el-radio :value="SendTypeEnum.SCHEDULED">定时推送</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.pushType === SendTypeEnum.SCHEDULED" prop="pushTime">
<el-date-picker
v-model="form.pushTime"
type="datetime"
placeholder="选择推送时间"
:disabled-date="(time: Date) => time.getTime() < Date.now() - 1000 * 60 * 60 * 24"
value-format="X"
/>
</el-form-item>
</template>
<!-- 发布设置 --> <!-- 发布设置 -->
<div> <div>
<el-form-item label="发布时间" prop="sendType"> <el-form-item label="发布时间" prop="sendType">
...@@ -311,6 +350,7 @@ const [form, resetForm] = useResetData({ ...@@ -311,6 +350,7 @@ const [form, resetForm] = useResetData({
sendTime: '', sendTime: '',
releaseStatus: ReleaseStatusTypeEnum.PUBLISH, releaseStatus: ReleaseStatusTypeEnum.PUBLISH,
isPushAll: BooleanFlag.YES,
// 推送设置 // 推送设置
pushType: SendTypeEnum.IMMEDIATE, pushType: SendTypeEnum.IMMEDIATE,
pushTime: '', pushTime: '',
...@@ -404,21 +444,33 @@ const transFormData = (releaseStatus: ReleaseStatusTypeEnum) => { ...@@ -404,21 +444,33 @@ const transFormData = (releaseStatus: ReleaseStatusTypeEnum) => {
} }
if ( if (
(data.type === ArticleTypeEnum.COLUMN || data.type === ArticleTypeEnum.INTERVIEW) && (data.type === ArticleTypeEnum.COLUMN ||
data.type === ArticleTypeEnum.INTERVIEW ||
data.type === ArticleTypeEnum.POST) &&
userInfo.value.isOfficialAccount userInfo.value.isOfficialAccount
) { ) {
data.pushList = [ if (data.isPushAll === BooleanFlag.YES) {
...selectedDepts.value.map((item) => ({ data.pushList = [
valueId: item.id, {
valueType: 1, valueId: '1',
valueName: item.name, valueType: 1,
})), valueName: '亚声威格',
...selectedUsers.value.map((item) => ({ },
valueId: item.id, ]
valueType: 2, } else {
valueName: item.name, data.pushList = [
})), ...selectedDepts.value.map((item) => ({
] valueId: item.id,
valueType: 1,
valueName: item.name,
})),
...selectedUsers.value.map((item) => ({
valueId: item.id,
valueType: 2,
valueName: item.name,
})),
]
}
} }
return data return data
...@@ -468,6 +520,8 @@ const isEdit = computed(() => !!route.query.id) ...@@ -468,6 +520,8 @@ const isEdit = computed(() => !!route.query.id)
onActivated(async () => { onActivated(async () => {
key.value++ key.value++
resetForm() resetForm()
selectedDepts.value = []
selectedUsers.value = []
await nextTick() await nextTick()
if (isEdit.value) { if (isEdit.value) {
...@@ -519,23 +573,31 @@ onActivated(async () => { ...@@ -519,23 +573,31 @@ onActivated(async () => {
} }
// 4回显推送人员设置 // 4回显推送人员设置
if ( if (
(type === ArticleTypeEnum.COLUMN || type === ArticleTypeEnum.INTERVIEW) && (type === ArticleTypeEnum.COLUMN ||
type === ArticleTypeEnum.INTERVIEW ||
type === ArticleTypeEnum.POST) &&
userInfo.value.isOfficialAccount userInfo.value.isOfficialAccount
) { ) {
selectedDepts.value = if (data.pushList?.find((item) => item.valueId == '1')) {
data.pushList form.value.isPushAll = BooleanFlag.YES
?.filter((item) => item.valueType === 1) selectedDepts.value = []
.map((item) => ({ selectedUsers.value = []
id: item.valueId, } else {
name: item.valueName, selectedDepts.value =
})) || [] data.pushList
selectedUsers.value = ?.filter((item) => item.valueType === 1)
data.pushList .map((item) => ({
?.filter((item) => item.valueType === 2) id: item.valueId,
.map((item) => ({ name: item.valueName,
id: item.valueId, })) || []
name: item.valueName, selectedUsers.value =
})) || [] data.pushList
?.filter((item) => item.valueType === 2)
.map((item) => ({
id: item.valueId,
name: item.valueName,
})) || []
}
} }
} }
}) })
......
...@@ -139,17 +139,24 @@ ...@@ -139,17 +139,24 @@
<div class="mb-8"> <div class="mb-8">
<el-form-item> <el-form-item>
<label class="block text-sm font-semibold text-gray-700 mb-3"> 推送对象 </label> <label class="block text-sm font-semibold text-gray-700 mb-3"> 推送对象 </label>
<div class="w-full"> <div class="w-full flex items-center gap-2">
<el-button <el-radio-group v-model="form.isPushAll">
class="button-new-tag" <el-radio :value="BooleanFlag.YES">全员</el-radio>
size="small" <el-radio :value="BooleanFlag.NO">指定部门/人员</el-radio>
@click="handleSelectUserAndDept" </el-radio-group>
> <div
+ 添加部门 v-show="form.isPushAll === BooleanFlag.NO"
</el-button> class="flex items-center gap-2"
<span class="ml-2 text-sm text-gray-600">
{{ selectedText }}已选择下属部门</span
> >
<el-button
class="button-new-tag"
size="small"
@click="handleSelectUserAndDept"
>
+ 添加部门
</el-button>
<span class="ml-2 text-sm text-gray-600"> {{ selectedText }}</span>
</div>
</div> </div>
</el-form-item> </el-form-item>
</div> </div>
...@@ -347,7 +354,7 @@ ...@@ -347,7 +354,7 @@
<script setup lang="ts"> <script setup lang="ts">
import UploadVideo from '@/components/common/UploadVideo/index.vue' import UploadVideo from '@/components/common/UploadVideo/index.vue'
import { useResetData } from '@/hooks' import { useResetData } from '@/hooks'
import { ArticleTypeEnum, ReleaseStatusTypeEnum, SendTypeEnum } from '@/constants' import { ArticleTypeEnum, ReleaseStatusTypeEnum, SendTypeEnum, BooleanFlag } from '@/constants'
import { addOrUpdateArticle, uploadFile, getArticleDetail } from '@/api' import { addOrUpdateArticle, uploadFile, getArticleDetail } from '@/api'
import SelectTags from '@/components/common/SelectTags/index.vue' import SelectTags from '@/components/common/SelectTags/index.vue'
import type { TagItemDto, AddOrUpdateVideoDto } from '@/api' import type { TagItemDto, AddOrUpdateVideoDto } from '@/api'
...@@ -386,6 +393,7 @@ const [form, resetData] = useResetData({ ...@@ -386,6 +393,7 @@ const [form, resetData] = useResetData({
videoDuration: '', videoDuration: '',
relateColumnId: '' as string | number, relateColumnId: '' as string | number,
isPushAll: BooleanFlag.YES,
// 推送设置 // 推送设置
pushType: SendTypeEnum.IMMEDIATE, pushType: SendTypeEnum.IMMEDIATE,
pushTime: '', pushTime: '',
...@@ -534,24 +542,36 @@ const tansformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateVideoDto ...@@ -534,24 +542,36 @@ const tansformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateVideoDto
releaseStatus, releaseStatus,
} }
if (userInfo.value.isOfficialAccount) { if (userInfo.value.isOfficialAccount) {
data.pushList = [ if (form.value.isPushAll === BooleanFlag.YES) {
...selectedDepts.value.map((item) => ({ data.pushList = [
valueId: item.id, {
valueType: 1, valueId: '1',
valueName: item.name, valueType: 1,
})), valueName: '亚声威格',
...selectedUsers.value.map((item) => ({ },
valueId: item.id, ]
valueType: 2, } else {
valueName: item.name, data.pushList = [
})), ...selectedDepts.value.map((item) => ({
] valueId: item.id,
valueType: 1,
valueName: item.name,
})),
...selectedUsers.value.map((item) => ({
valueId: item.id,
valueType: 2,
valueName: item.name,
})),
]
}
} }
return data as AddOrUpdateVideoDto return data as AddOrUpdateVideoDto
} }
const loading = ref(false) const loading = ref(false)
const resetPageData = () => { const resetPageData = () => {
selectedDepts.value = []
selectedUsers.value = []
resetData() resetData()
locationVideoBlolUrl.value = '' locationVideoBlolUrl.value = ''
} }
...@@ -616,21 +636,27 @@ onActivated(async () => { ...@@ -616,21 +636,27 @@ onActivated(async () => {
tagList: data.tagIdList?.slice(1), tagList: data.tagIdList?.slice(1),
} }
// 回显推送的部门 这个后端没有返回相关数据 需要返回 // 回显推送的部门 这个后端没有返回相关数据 需要返回
console.log(data.pushList, 'data.pushList') if (data.pushList?.find((item) => item.valueId == '1')) {
selectedDepts.value = form.value.isPushAll = BooleanFlag.YES
data.pushList selectedDepts.value = []
?.filter((item) => item.valueType === 1) selectedUsers.value = []
.map((item) => ({ } else {
id: item.valueId, form.value.isPushAll = BooleanFlag.NO
name: item.valueName, selectedDepts.value =
})) || [] data.pushList
selectedUsers.value = ?.filter((item) => item.valueType === 1)
data.pushList .map((item) => ({
?.filter((item) => item.valueType === 2) id: item.valueId,
.map((item) => ({ name: item.valueName,
id: item.valueId, })) || []
name: item.valueName, selectedUsers.value =
})) || [] data.pushList
?.filter((item) => item.valueType === 2)
.map((item) => ({
id: item.valueId,
name: item.valueName,
})) || []
}
} }
}) })
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment