Quellcode durchsuchen

小程序编辑

master
wangxyi vor 3 Tagen
Ursprung
Commit
230e0d7fa7

+ 7
- 2
src/views/messagePush/pushManagement/wechatApplet/components/addOrEditDialog.vue Datei anzeigen

@@ -41,8 +41,11 @@
// @ts-ignore
import BaseService from '@/utils/baseService'
import { computed, ref } from 'vue'
// @ts-ignore
import oneBasicInformation from './stepFrom/oneBasicInformation.vue'
// @ts-ignore
import twoBasicInformation from './stepFrom/twoBasicInformation.vue'
// @ts-ignore
import threeBasicInformation from './stepFrom/threeBasicInformation.vue'
import { ElMessage } from 'element-plus'

@@ -162,9 +165,9 @@ const submitHandle = (data) => {
if (props.dataList.id) {
allData = {
...allData,
id: props.dataList.id,
applyId: props.dataList.id,
}
ifcode = '/msgw/channel/wxminisendmessageedit'
ifcode = '/msgw/importReview/modify'
text = '编辑'
} else {
ifcode = '/msgw/wxMini/push/add'
@@ -272,6 +275,8 @@ const getList = () => {
sendTime: applyData.sendTime,
title: requestData.title || applyData.title,
message: requestData.message,
// 将模板数据转换为 dataObject 格式,用于编辑时反显
dataObject: requestData.dataObject || requestData
}
// 将处理好的用户列表传递给子组件

+ 7
- 2
src/views/messagePush/pushManagement/wechatApplet/components/stepFrom/temGeneration.vue Datei anzeigen

@@ -1,5 +1,5 @@
<template>
<template v-for="(item, index) in itemData">
<template v-for="(item, index) in itemData" :key="index">
<el-form-item :label="item.label" :prop="`temObj.${item.key}`" :rules="[
{
required: true,
@@ -13,12 +13,17 @@
</template>
<!-- 根据模板生成表单 -->
<script setup lang="ts">
import { computed, ref } from 'vue'
import { computed, ref, watch } from 'vue'

interface PropsType {
form: any
itemData: any
}
const props = defineProps<PropsType>()

// 监听 form 的变化,确保数据能正确显示
watch(() => props.form, (newForm) => {
console.log('temGeneration form changed:', newForm)
}, { deep: true, immediate: true })
</script>
<style scoped></style>

+ 15
- 2
src/views/messagePush/pushManagement/wechatApplet/components/stepFrom/twoBasicInformation.vue Datei anzeigen

@@ -86,12 +86,22 @@ watch(
) => {
if (newtemData > 0) {
if (newclientId && newisShow) {
// 编辑情况下,设置表单数据
for (const key in ruleForm) {
const data = props.dataList[key]
if (data || data === 0) {
ruleForm[key] = props.dataList[key]
}
}
// 确保编辑时能正确反显模板数据
if (props.dataList.dataObject && Object.keys(props.dataList.dataObject).length > 0) {
const dataObject = props.dataList.dataObject
for (const key in dataObject) {
if (dataObject[key] && dataObject[key].value) {
ruleForm.temObj[key] = dataObject[key].value
}
}
}
} else {
ruleForm.templateId = props.temData[0].priTmplId
}
@@ -105,14 +115,17 @@ const itemData = ref<any>([])
// 处理诗句
const selectChange = (val) => {
ruleForm.temObj = {}
if (val === props.dataList.templateId) {
// 编辑情况下,从父页面传入的 dataObject 中获取数据
if (props.dataList.dataObject && Object.keys(props.dataList.dataObject).length > 0) {
const dataObject = props.dataList.dataObject
for (const key in dataObject) {
if (dataObject[key]) {
if (dataObject[key] && dataObject[key].value) {
ruleForm.temObj[key] = dataObject[key].value
}
}
}
nextTick(() => {
let priTmplId = val
if (priTmplId) {

Laden…
Abbrechen
Speichern