Просмотр исходного кода

公众号编辑用户反显问题

master
wangxyi 2 дней назад
Родитель
Сommit
144d968411

+ 29
- 9
src/views/messagePush/pushManagement/components/selectUserId/index.vue Просмотреть файл

@@ -1,6 +1,7 @@
<template>
<el-popover placement="bottom-start" :width="width" trigger="click" v-model:visible="visible">
<template #reference>
<!-- {{ userInfo }} -->
<el-select clearable v-model="userInfo" placeholder="请选择接收消息的用户" popper-class="popper-content" style="width: 100%"
collapse-tags collapse-tags-tooltip @remove-tag="removeTag" multiple value-key="value"></el-select>
</template>
@@ -36,7 +37,8 @@ const props = defineProps({
default: 400,
},
modelValue: {
default: '',
type: Array,
default: () => [],
},
type: {
default: '',
@@ -47,6 +49,14 @@ const props = defineProps({
},
})
let isNum = false

// 监听 props.modelValue 变化,同步到本地变量
watchEffect(() => {
if (props.modelValue && props.modelValue.length > 0) {
localUserInfo.value = [...props.modelValue]
}
})

// 处理idList
watchEffect(() => {
const userList = props.userList
@@ -70,15 +80,17 @@ const handleId = (userList) => {
// 支持多种匹配方式:openId、value、wxOpenid
let data = tableData.value.find(
(tableItem) =>
tableItem.wxOpenid == item.openId
tableItem.wxOpenid == item.openId||
tableItem.mpOpenid == item.openId
)
console.log(data,'table.data')
// 如果找到了匹配的用户,使用实际的用户名,否则使用传入的标签
const label = data ? (data.userName || data.mobile) : (item.label || item.openId || item.value)
console.log(label,'label')
// const label = data ? (data.userName || data.mobile) : (item.label || item.openId || item.value)
// console.log(label,'label')
userInfoData.push({
label: label,
value: item.openId || item.value,
label: data?data.userName || data.mobile:'',
value:data?data.openId||data.mpOpenid:'',
// value: (data && (data.mpOpenid || data.wxOpenid || data.openId)) || item.mpOpenid || item.wxOpenid || item.openId || item.value,
})
console.log(userInfoData,'userInfoData')
if (data) {
@@ -101,8 +113,11 @@ const handleId = (userList) => {
} else {
otherList.data = other
}
userInfo.value = userInfoData
handleInitSelect() //选择当前页数据
userInfo.value = [...userInfoData]
nextTick(() => {
console.log(userInfo.value,'userInfo.value')
handleInitSelect() //选择当前页数据
})
}
// 切换页数
const switchPage = () => {
@@ -139,11 +154,16 @@ const switchPage = () => {
}
}

// 本地管理显示的数据
const localUserInfo = ref<any[]>([])

const userInfo = computed({
get: function () {
return props.modelValue
return localUserInfo.value
},
set: function (newValue) {
console.log(newValue,'newValue')
localUserInfo.value = newValue
emit('update:modelValue', newValue)
},
})

+ 2
- 1
src/views/messagePush/pushManagement/wechatOfficialAccounts/components/stepFrom/oneBasicInformation.vue Просмотреть файл

@@ -85,8 +85,9 @@
console.log(ruleForm.mpOpenidList,'ruleForm.mpOpenidList')
}
// 然后处理其他字段
// 然后处理其他字段(避免覆盖已由子组件控制的 userInfo)
for (const key in ruleForm) {
if (key === 'userInfo') continue
const data = props.dataList[key]
if (data || data === 0) {
ruleForm[key] = props.dataList[key]

+ 6
- 6
src/views/messagePush/pushManagement/wechatOfficialAccounts/components/stepFrom/twoBasicInformation.vue Просмотреть файл

@@ -134,17 +134,17 @@ const selectChange = (val) => {
console.error('Template data not found or content is empty')
return
}
console.log(data, 'data不知道是啥')
console.log(data.content, 'data.content')
// console.log(data, 'data不知道是啥')
// console.log(data.content, 'data.content')
let content = data.content.split('\n')
console.log(content, 'content')
// console.log(content, 'content')
let dataArr: any = []
content.forEach((item) => {
// 业务名称:{{thing1.DATA}}
if (item && item.trim()) {
console.log(item, 'item')
// console.log(item, 'item')
const arr = item.split(':')
console.log(arr, 'arr')
// console.log(arr, 'arr')
if (arr.length >= 2 && arr[1]) {
const keyPart = arr[1].split('.')[0]
const key = keyPart && keyPart.length > 2 ? keyPart.substr(2) : arr[0]
@@ -159,7 +159,7 @@ const selectChange = (val) => {
key: arr[0] || item,
})
}
console.log(dataArr, 'dataArr')
// console.log(dataArr, 'dataArr')
}
})
// 过滤掉第一个和最后一个元素,但要确保数组有足够的元素

Загрузка…
Отмена
Сохранить