Commit 10b99bbd by lijiabin

【需求 25171】refactor: 4 个页面接入 DeptUserPicker,替代企微选人 API

editDialog(后台案例编辑)、publishCase(投稿案例):只选部门,
value-type="string" 直接绑 deptId,@confirm 里拼 deptName。

publishLongArticle、publishVideo:部门+人员都能选,双 v-model 绑 id,
@confirm 拿完整详情拼 pushList。

顺手删掉了 wxUtil 里不再使用的 selectDepOrUser 及其相关类型。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
parent af06f8fb
...@@ -52,46 +52,3 @@ export function isWxShareCancel(error: unknown) { ...@@ -52,46 +52,3 @@ export function isWxShareCancel(error: unknown) {
msg?.includes('shareAppMessage:cancel'), msg?.includes('shareAppMessage:cancel'),
) )
} }
interface ISelectDepOrUser {
err_msg: string
result: IResult
}
interface IResult {
userList: ISelectUser[]
departmentList: ISelectDept[]
}
export interface ISelectUser {
id: string
name: string
avatar: string
}
export interface ISelectDept {
id: string
name: string
}
export async function selectDepOrUser(wxOption = {}): Promise<IResult> {
await initWxConfig()
const defaultOption = {
fromDepartmentId: -1,
mode: 'single',
type: ['user', 'department'],
}
const option = {
...defaultOption,
...wxOption,
}
return new Promise((resolve, reject) => {
ww.invoke('selectEnterpriseContact', option, function (res: ISelectDepOrUser) {
if (res.err_msg == 'selectEnterpriseContact:ok') {
resolve(res.result)
} else {
reject(res)
}
})
})
}
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
import type { BackendCaseListItemDto, BackendEditCaseDto } from '@/api/backend/case/types' import type { BackendCaseListItemDto, BackendEditCaseDto } from '@/api/backend/case/types'
import { useResetData } from '@/hooks' import { useResetData } from '@/hooks'
import SelectTags from '@/components/common/SelectTags/index.vue' import SelectTags from '@/components/common/SelectTags/index.vue'
import DeptUserPicker from '@/components/common/DeptUserPicker/index.vue'
import type { TagItemDto } from '@/api/tag/types' import type { TagItemDto } from '@/api/tag/types'
import { TagLevelEnum, TagTypeEnum } from '@/constants' import { TagLevelEnum, TagTypeEnum } from '@/constants'
import { selectDepOrUser } from '@/utils'
import { backendEditCase } from '@/api/backend' import { backendEditCase } from '@/api/backend'
import { push } from 'notivue' import { push } from 'notivue'
const emit = defineEmits<{ const emit = defineEmits<{
...@@ -28,7 +28,8 @@ const [form] = useResetData<{ ...@@ -28,7 +28,8 @@ const [form] = useResetData<{
yearKeywordSecond: string yearKeywordSecond: string
sceneKeywordMain: string sceneKeywordMain: string
sceneKeywordSecond: number[] sceneKeywordSecond: number[]
departmentList: { id: string; name: string }[] deptId: string
deptName: string
}>({ }>({
id: 0, id: 0,
sourceProject: '', sourceProject: '',
...@@ -44,7 +45,8 @@ const [form] = useResetData<{ ...@@ -44,7 +45,8 @@ const [form] = useResetData<{
yearKeywordSecond: '', yearKeywordSecond: '',
sceneKeywordMain: '', sceneKeywordMain: '',
sceneKeywordSecond: [], sceneKeywordSecond: [],
departmentList: [], deptId: '',
deptName: '',
}) })
const visible = ref(false) const visible = ref(false)
...@@ -71,10 +73,8 @@ const open = (row: BackendCaseListItemDto) => { ...@@ -71,10 +73,8 @@ const open = (row: BackendCaseListItemDto) => {
sceneKeywordMain: String(row.sceneKeywordMain[0]?.id || ''), sceneKeywordMain: String(row.sceneKeywordMain[0]?.id || ''),
sceneKeywordSecond: row.sceneKeywordSecond.map((item) => item.id), sceneKeywordSecond: row.sceneKeywordSecond.map((item) => item.id),
// 关联部门 // 关联部门
departmentList: row.depIdList.map((id, index) => ({ deptId: row.depIdList.join(','),
id: String(id), deptName: row.depNameList.join(','),
name: row.depNameList[index] || '',
})),
} }
} }
...@@ -89,24 +89,6 @@ const filterTagsFn = (tagType: TagTypeEnum, allTags: TagItemDto[]) => { ...@@ -89,24 +89,6 @@ const filterTagsFn = (tagType: TagTypeEnum, allTags: TagItemDto[]) => {
return allTags return allTags
} }
// 选择部门
const selcetDept = async () => {
const { departmentList } = await selectDepOrUser({
mode: 'multi', // single multi
type: ['department'],
selectedDepartmentIds: form.value.departmentList.map((i) => i.id),
})
if (departmentList.length > 3) {
return push.warning('最多只能选择3个部门,请重新选择')
}
form.value.departmentList = departmentList
}
// 删除部门
const delDept = (id: string) => {
form.value.departmentList = form.value.departmentList.filter((i) => i.id !== id)
}
// 数据转换 // 数据转换
const transformData = () => { const transformData = () => {
const { const {
...@@ -116,15 +98,12 @@ const transformData = () => { ...@@ -116,15 +98,12 @@ const transformData = () => {
yearKeywordSecond, yearKeywordSecond,
sceneKeywordMain, sceneKeywordMain,
sceneKeywordSecond, sceneKeywordSecond,
departmentList,
...rest ...rest
} = form.value } = form.value
const data: BackendEditCaseDto = { const data: BackendEditCaseDto = {
...rest, ...rest,
tagRelationDtoList: [], tagRelationDtoList: [],
deptId: departmentList.map((i) => i.id).join(','),
deptName: departmentList.map((i) => i.name).join(','),
} }
// 添加文化关键词数据 // 添加文化关键词数据
...@@ -293,20 +272,21 @@ defineExpose({ ...@@ -293,20 +272,21 @@ defineExpose({
</el-form-item> </el-form-item>
<!-- 关联部门 --> <!-- 关联部门 -->
<el-form-item label="关联部门:"> <el-form-item label="关联部门:">
<div class="flex items-start gap-3"> <DeptUserPicker
<el-button class="button-new-tag" size="small" @click="selcetDept"> v-model:dept-value="form.deptId"
+ 添加部门 selection-mode="department"
</el-button> value-type="string"
<el-tag :max="3"
v-for="tag in form.departmentList" @confirm="(items) => (form.deptName = items.map((i) => i.valueName).join(','))"
:key="tag.id" v-slot="{ echoText }"
closable >
type="primary" <el-input
@close="() => delDept(tag.id)" readonly
> class="w-full cursor-pointer"
{{ tag.name }} placeholder="请选择部门"
</el-tag> :model-value="echoText"
</div> />
</DeptUserPicker>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-scrollbar> </el-scrollbar>
......
...@@ -66,20 +66,21 @@ ...@@ -66,20 +66,21 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="关联部门" class="mb-6"> <el-form-item label="关联部门" class="mb-6">
<div class="flex items-start gap-3"> <DeptUserPicker
<el-button class="button-new-tag" size="small" @click="selcetDept"> v-model:dept-value="form.deptId"
+ 添加部门 selection-mode="department"
</el-button> value-type="string"
<el-tag :max="3"
v-for="tag in form.departmentList" @confirm="(items) => (form.deptName = items.map((i) => i.valueName).join(','))"
:key="tag.id" v-slot="{ echoText }"
closable >
type="primary" <el-input
@close="() => delDept(tag.id)" readonly
> class="w-full cursor-pointer"
{{ tag.name }} placeholder="请选择部门"
</el-tag> :model-value="echoText"
</div> />
</DeptUserPicker>
</el-form-item> </el-form-item>
<!-- 是否同步发布 --> <!-- 是否同步发布 -->
...@@ -126,10 +127,9 @@ import { ...@@ -126,10 +127,9 @@ import {
ReleaseStatusTypeEnum, ReleaseStatusTypeEnum,
AuditStatusEnum, AuditStatusEnum,
} from '@/constants' } from '@/constants'
import { selectDepOrUser } from '@/utils' import DeptUserPicker from '@/components/common/DeptUserPicker/index.vue'
import { useUserStore } from '@/stores' import { useUserStore } from '@/stores'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import type { ISelectDept } from '@/utils/wxUtil'
import BackButton from '@/components/common/BackButton/index.vue' import BackButton from '@/components/common/BackButton/index.vue'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks' import { useMessageBox } from '@/hooks'
...@@ -155,25 +155,10 @@ const [form, resetForm] = useResetData({ ...@@ -155,25 +155,10 @@ const [form, resetForm] = useResetData({
relatedScenariosMainTagId: '', relatedScenariosMainTagId: '',
relatedScenariosSubTagIds: [] as number[], relatedScenariosSubTagIds: [] as number[],
isSync: BooleanFlag.NO, isSync: BooleanFlag.NO,
departmentList: [] as ISelectDept[], deptId: '',
deptName: '',
}) })
// 选择部门
const selcetDept = async () => {
const { departmentList } = await selectDepOrUser({
mode: 'multi', // single multi
type: ['department'],
selectedDepartmentIds: form.value.departmentList.map((i) => i.id),
})
if (departmentList.length > 3) {
return push.warning('最多只能选择3个部门,请重新选择')
}
form.value.departmentList = departmentList
}
const delDept = (id: string) => {
form.value.departmentList = form.value.departmentList.filter((i) => i.id !== id)
}
// 取消 // 取消
const handleCancel = () => { const handleCancel = () => {
resetForm() resetForm()
...@@ -187,7 +172,6 @@ const transformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateCaseDto ...@@ -187,7 +172,6 @@ const transformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateCaseDto
subTagIds, subTagIds,
relatedScenariosMainTagId, relatedScenariosMainTagId,
relatedScenariosSubTagIds, relatedScenariosSubTagIds,
departmentList,
...rest ...rest
} = form.value } = form.value
const obj: AddOrUpdateCaseDto = { const obj: AddOrUpdateCaseDto = {
...@@ -195,8 +179,6 @@ const transformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateCaseDto ...@@ -195,8 +179,6 @@ const transformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateCaseDto
releaseStatus, releaseStatus,
tagRelationDtoList: [], tagRelationDtoList: [],
sourceUser: '', sourceUser: '',
deptId: '',
deptName: '',
} }
// 添加文化标签内容 // 添加文化标签内容
obj.tagRelationDtoList.push({ obj.tagRelationDtoList.push({
...@@ -225,10 +207,6 @@ const transformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateCaseDto ...@@ -225,10 +207,6 @@ const transformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateCaseDto
}) })
}) })
// 添加部门相关字段
obj.deptId = departmentList.map((i) => i.id).join(',')
obj.deptName = departmentList.map((i) => i.name).join(',')
obj.sourceUser = userInfo.value.userId obj.sourceUser = userInfo.value.userId
return obj return obj
} }
...@@ -357,10 +335,8 @@ onActivated(async () => { ...@@ -357,10 +335,8 @@ onActivated(async () => {
.filter((i) => i.keywordType === TagLevelEnum.SUB_TAG) .filter((i) => i.keywordType === TagLevelEnum.SUB_TAG)
.map((i) => i.tagId), .map((i) => i.tagId),
isSync: data.isSync, isSync: data.isSync,
departmentList: data.depIdList.map((id, index) => ({ deptId: data.depIdList.join(','),
id: String(id), deptName: data.depNameList.join(','),
name: data.depNameList[index] || '',
})),
} }
form.value = obj form.value = obj
......
...@@ -187,10 +187,21 @@ ...@@ -187,10 +187,21 @@
</el-radio-group> </el-radio-group>
</div> </div>
<div v-show="form.isPushAll === BooleanFlag.NO" class="flex items-center gap-2"> <div v-show="form.isPushAll === BooleanFlag.NO" class="flex items-center gap-2">
<el-button class="button-new-tag" size="small" @click="handleSelectUserAndDept"> <DeptUserPicker
+ 添加部门/人员 v-model:dept-value="pushDeptIds"
</el-button> v-model:user-value="pushUserIds"
<span class="ml-2 text-sm text-gray-600"> {{ selectedText }}</span> selection-mode="both"
:initial-selected="pushInitialSelected"
@confirm="(items) => (pushSelection = items)"
v-slot="{ echoText }"
>
<el-input
readonly
class="w-80 cursor-pointer"
placeholder="请选择部门/人员"
:model-value="echoText"
/>
</DeptUserPicker>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="推送类型" prop="pushType"> <el-form-item label="推送类型" prop="pushType">
...@@ -251,10 +262,21 @@ ...@@ -251,10 +262,21 @@
</el-radio-group> </el-radio-group>
</div> </div>
<div v-show="form.isPushAll === BooleanFlag.NO" class="flex items-center gap-2"> <div v-show="form.isPushAll === BooleanFlag.NO" class="flex items-center gap-2">
<el-button class="button-new-tag" size="small" @click="handleSelectUserAndDept"> <DeptUserPicker
+ 添加部门/人员 v-model:dept-value="pushDeptIds"
</el-button> v-model:user-value="pushUserIds"
<span class="ml-2 text-sm text-gray-600"> {{ selectedText }}</span> selection-mode="both"
:initial-selected="pushInitialSelected"
@confirm="(items) => (pushSelection = items)"
v-slot="{ echoText }"
>
<el-input
readonly
class="w-80 cursor-pointer"
placeholder="请选择部门/人员"
:model-value="echoText"
/>
</DeptUserPicker>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="推送类型" prop="pushType"> <el-form-item label="推送类型" prop="pushType">
...@@ -381,7 +403,8 @@ import { storeToRefs } from 'pinia' ...@@ -381,7 +403,8 @@ import { storeToRefs } from 'pinia'
import { addOrUpdateArticle, addOrUpdatePractice, getArticleDetail } from '@/api' import { addOrUpdateArticle, addOrUpdatePractice, getArticleDetail } from '@/api'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { selectDepOrUser } from '@/utils' import DeptUserPicker from '@/components/common/DeptUserPicker/index.vue'
import type { DepartmentUserSelection } from '@/components/common/DepartmentUserModal/types'
import type { FormItemRule } from 'element-plus' import type { FormItemRule } from 'element-plus'
import { push } from 'notivue' import { push } from 'notivue'
import BackButton from '@/components/common/BackButton/index.vue' import BackButton from '@/components/common/BackButton/index.vue'
...@@ -475,37 +498,13 @@ const rules: Record<string, FormItemRule[]> = { ...@@ -475,37 +498,13 @@ const rules: Record<string, FormItemRule[]> = {
pushList: [{ required: true, message: '请选择推送对象', trigger: 'trigger' }], pushList: [{ required: true, message: '请选择推送对象', trigger: 'trigger' }],
} }
// 选中的部门 // “推送给”选中的部门/人员:*Ids 是给 DeptUserPicker 用的 id 数组,
const selectedDepts = ref<{ id: string; name: string }[]>([]) // pushSelection 是 @confirm 拿到的完整详情(带名字),提交时直接用它拼 pushList。
// 选中的成员 const pushDeptIds = ref<string[]>([])
const selectedUsers = ref<{ id: string; name: string }[]>([]) const pushUserIds = ref<string[]>([])
const selectedText = computed(() => { const pushSelection = ref<DepartmentUserSelection[]>([])
let text = '' // 编辑回显用,给 DeptUserPicker 做首次回显的名字种子(不传的话首次打开只能看到 id)。
if (selectedDepts.value.length > 0) { const pushInitialSelected = ref<DepartmentUserSelection[]>([])
text += `已选择${selectedDepts.value.length}个部门`
}
if (selectedUsers.value.length > 0) {
text += `已选择${selectedUsers.value.length}个成员`
}
return text
})
const handleSelectUserAndDept = async () => {
const { departmentList, userList } = await selectDepOrUser({
mode: 'multi',
type: ['user', 'department'],
selectedDepartmentIds: selectedDepts.value.map((item) => item.id),
selectedUserIds: selectedUsers.value.map((item) => item.id),
})
selectedDepts.value = departmentList.map((item) => ({
id: item.id,
name: item.name,
}))
selectedUsers.value = userList.map((item) => ({
id: item.id,
name: item.name,
}))
}
const filterTagsFn = (allTags: any[]) => { const filterTagsFn = (allTags: any[]) => {
return allTags.filter((tag) => tag.id !== Number(form.value.mainTagId)) return allTags.filter((tag) => tag.id !== Number(form.value.mainTagId))
...@@ -541,18 +540,11 @@ const transFormData = (releaseStatus: ReleaseStatusTypeEnum) => { ...@@ -541,18 +540,11 @@ const transFormData = (releaseStatus: ReleaseStatusTypeEnum) => {
}, },
] ]
} else { } else {
data.pushList = [ data.pushList = pushSelection.value.map((item) => ({
...selectedDepts.value.map((item) => ({ valueId: item.valueId,
valueId: item.id, valueType: item.valueType,
valueType: 1, valueName: item.valueName,
valueName: item.name, }))
})),
...selectedUsers.value.map((item) => ({
valueId: item.id,
valueType: 2,
valueName: item.name,
})),
]
} }
} }
...@@ -606,8 +598,10 @@ const isEdit = computed(() => !!route.query.id) ...@@ -606,8 +598,10 @@ const isEdit = computed(() => !!route.query.id)
onActivated(async () => { onActivated(async () => {
key.value++ key.value++
resetForm() resetForm()
selectedDepts.value = [] pushDeptIds.value = []
selectedUsers.value = [] pushUserIds.value = []
pushSelection.value = []
pushInitialSelected.value = []
await nextTick() await nextTick()
if (isEdit.value) { if (isEdit.value) {
...@@ -669,24 +663,21 @@ onActivated(async () => { ...@@ -669,24 +663,21 @@ onActivated(async () => {
) { ) {
if (data.pushList?.find((item) => item.valueId == '1')) { if (data.pushList?.find((item) => item.valueId == '1')) {
form.value.isPushAll = BooleanFlag.YES form.value.isPushAll = BooleanFlag.YES
selectedDepts.value = [] pushDeptIds.value = []
selectedUsers.value = [] pushUserIds.value = []
pushSelection.value = []
pushInitialSelected.value = []
} else { } else {
form.value.isPushAll = BooleanFlag.NO form.value.isPushAll = BooleanFlag.NO
selectedDepts.value = const items: DepartmentUserSelection[] = (data.pushList || []).map((item) => ({
data.pushList valueType: item.valueType as 1 | 2,
?.filter((item) => item.valueType === 1) valueId: String(item.valueId),
.map((item) => ({ valueName: item.valueName,
id: item.valueId, }))
name: item.valueName, pushDeptIds.value = items.filter((item) => item.valueType === 1).map((item) => item.valueId)
})) || [] pushUserIds.value = items.filter((item) => item.valueType === 2).map((item) => item.valueId)
selectedUsers.value = pushSelection.value = items
data.pushList pushInitialSelected.value = items
?.filter((item) => item.valueType === 2)
.map((item) => ({
id: item.valueId,
name: item.valueName,
})) || []
} }
} }
......
...@@ -165,14 +165,21 @@ ...@@ -165,14 +165,21 @@
v-show="form.isPushAll === BooleanFlag.NO" v-show="form.isPushAll === BooleanFlag.NO"
class="flex items-center gap-2" class="flex items-center gap-2"
> >
<el-button <DeptUserPicker
class="button-new-tag" v-model:dept-value="pushDeptIds"
size="small" v-model:user-value="pushUserIds"
@click="handleSelectUserAndDept" selection-mode="both"
:initial-selected="pushInitialSelected"
@confirm="(items) => (pushSelection = items)"
v-slot="{ echoText }"
> >
+ 添加部门 <el-input
</el-button> readonly
<span class="ml-2 text-sm text-gray-600"> {{ selectedText }}</span> class="w-80 cursor-pointer"
placeholder="请选择部门/人员"
:model-value="echoText"
/>
</DeptUserPicker>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
...@@ -390,7 +397,8 @@ import SelectTags from '@/components/common/SelectTags/index.vue' ...@@ -390,7 +397,8 @@ import SelectTags from '@/components/common/SelectTags/index.vue'
import type { TagItemDto, AddOrUpdateVideoDto} from '@/api' import type { TagItemDto, AddOrUpdateVideoDto} from '@/api'
import { useVideoStore, useUserStore } from '@/stores' import { useVideoStore, useUserStore } from '@/stores'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { selectDepOrUser } from '@/utils' import DeptUserPicker from '@/components/common/DeptUserPicker/index.vue'
import type { DepartmentUserSelection } from '@/components/common/DepartmentUserModal/types'
import BackButton from '@/components/common/BackButton/index.vue' import BackButton from '@/components/common/BackButton/index.vue'
import { push } from 'notivue' import { push } from 'notivue'
...@@ -436,34 +444,13 @@ const disabledSecondsOnlyZero = () => Array.from({ length: 59 }, (_, i) => i + 1 ...@@ -436,34 +444,13 @@ const disabledSecondsOnlyZero = () => Array.from({ length: 59 }, (_, i) => i + 1
const disabledMinutesOnlyTens = () => const disabledMinutesOnlyTens = () =>
Array.from({ length: 60 }, (_, i) => i).filter((m) => m % 10 !== 0) Array.from({ length: 60 }, (_, i) => i).filter((m) => m % 10 !== 0)
const selectedDepts = ref<{ id: string; name: string }[]>([]) // “推送给”选中的部门/人员:*Ids 是给 DeptUserPicker 用的 id 数组,
const selectedUsers = ref<{ id: string; name: string }[]>([]) // pushSelection 是 @confirm 拿到的完整详情(带名字),提交时直接用它拼 pushList。
const selectedText = computed(() => { const pushDeptIds = ref<string[]>([])
let text = '' const pushUserIds = ref<string[]>([])
if (selectedDepts.value.length > 0) { const pushSelection = ref<DepartmentUserSelection[]>([])
text += `已选择${selectedDepts.value.length}个部门` // 编辑回显用,给 DeptUserPicker 做首次回显的名字种子(不传的话首次打开只能看到 id)。
} const pushInitialSelected = ref<DepartmentUserSelection[]>([])
if (selectedUsers.value.length > 0) {
text += `已选择${selectedUsers.value.length}个成员`
}
return text
})
const handleSelectUserAndDept = async () => {
const { departmentList, userList } = await selectDepOrUser({
mode: 'multi',
type: ['user', 'department'],
selectedDepartmentIds: selectedDepts.value.map((item) => item.id),
selectedUserIds: selectedUsers.value.map((item) => item.id),
})
selectedDepts.value = departmentList.map((item) => ({
id: item.id,
name: item.name,
}))
selectedUsers.value = userList.map((item) => ({
id: item.id,
name: item.name,
}))
}
// 封面选择相关 // 封面选择相关
...@@ -588,18 +575,11 @@ const tansformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateVideoDto ...@@ -588,18 +575,11 @@ const tansformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateVideoDto
}, },
] ]
} else { } else {
data.pushList = [ data.pushList = pushSelection.value.map((item) => ({
...selectedDepts.value.map((item) => ({ valueId: item.valueId,
valueId: item.id, valueType: item.valueType,
valueType: 1, valueName: item.valueName,
valueName: item.name, }))
})),
...selectedUsers.value.map((item) => ({
valueId: item.id,
valueType: 2,
valueName: item.name,
})),
]
} }
} }
return data as AddOrUpdateVideoDto return data as AddOrUpdateVideoDto
...@@ -607,8 +587,10 @@ const tansformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateVideoDto ...@@ -607,8 +587,10 @@ const tansformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateVideoDto
const loading = ref(false) const loading = ref(false)
const resetPageData = () => { const resetPageData = () => {
selectedDepts.value = [] pushDeptIds.value = []
selectedUsers.value = [] pushUserIds.value = []
pushSelection.value = []
pushInitialSelected.value = []
resetData() resetData()
locationVideoBlolUrl.value = '' locationVideoBlolUrl.value = ''
} }
...@@ -676,24 +658,21 @@ onActivated(async () => { ...@@ -676,24 +658,21 @@ onActivated(async () => {
// 回显推送的部门 这个后端没有返回相关数据 需要返回 // 回显推送的部门 这个后端没有返回相关数据 需要返回
if (data.pushList?.find((item) => item.valueId == '1')) { if (data.pushList?.find((item) => item.valueId == '1')) {
form.value.isPushAll = BooleanFlag.YES form.value.isPushAll = BooleanFlag.YES
selectedDepts.value = [] pushDeptIds.value = []
selectedUsers.value = [] pushUserIds.value = []
pushSelection.value = []
pushInitialSelected.value = []
} else { } else {
form.value.isPushAll = BooleanFlag.NO form.value.isPushAll = BooleanFlag.NO
selectedDepts.value = const items: DepartmentUserSelection[] = (data.pushList || []).map((item) => ({
data.pushList valueType: item.valueType as 1 | 2,
?.filter((item) => item.valueType === 1) valueId: String(item.valueId),
.map((item) => ({ valueName: item.valueName,
id: item.valueId, }))
name: item.valueName, pushDeptIds.value = items.filter((item) => item.valueType === 1).map((item) => item.valueId)
})) || [] pushUserIds.value = items.filter((item) => item.valueType === 2).map((item) => item.valueId)
selectedUsers.value = pushSelection.value = items
data.pushList pushInitialSelected.value = items
?.filter((item) => item.valueType === 2)
.map((item) => ({
id: item.valueId,
name: item.valueName,
})) || []
} }
} }
}) })
......
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