fix: 处理 model 报错

This commit is contained in:
奔跑的面条 2023-01-08 19:20:44 +08:00
parent ef5d861a96
commit ddf0c02b75
6 changed files with 44 additions and 15 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<n-modal v-model:show="modelShow" @afterLeave="closeHandle"> <n-modal v-model:show="modelShowRef" @afterLeave="closeHandle">
<n-list bordered class="go-system-info"> <n-list bordered class="go-system-info">
<template #header> <template #header>
<n-space justify="space-between"> <n-space justify="space-between">
@ -51,10 +51,10 @@ const props = defineProps({
const emit = defineEmits(['update:modelShow']) const emit = defineEmits(['update:modelShow'])
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5 const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
const modelShow = ref(false) const modelShowRef = ref(false)
watch(() => props.modelShow, (newValue) => { watch(() => props.modelShow, (newValue) => {
modelShow.value = newValue modelShowRef.value = newValue
}) })
const closeHandle = () => { const closeHandle = () => {

View File

@ -1,5 +1,5 @@
<template> <template>
<n-modal v-model:show="modelShow" @afterLeave="closeHandle"> <n-modal v-model:show="modelShowRef" @afterLeave="closeHandle">
<n-list bordered class="go-system-setting"> <n-list bordered class="go-system-setting">
<template #header> <template #header>
<n-space justify="space-between"> <n-space justify="space-between">
@ -82,7 +82,7 @@ const props = defineProps({
const emit = defineEmits(['update:modelShow']) const emit = defineEmits(['update:modelShow'])
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5 const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
const settingStore = useSettingStore() const settingStore = useSettingStore()
const modelShow = ref(false) const modelShowRef = ref(false)
const list = reactive<ListType[]>([ const list = reactive<ListType[]>([
{ {
@ -168,7 +168,7 @@ const list = reactive<ListType[]>([
]) ])
watch(() => props.modelShow, (newValue) => { watch(() => props.modelShow, (newValue) => {
modelShow.value = newValue modelShowRef.value = newValue
}) })
const closeHandle = () => { const closeHandle = () => {

View File

@ -1,5 +1,5 @@
<template> <template>
<n-modal class="go-chart-data-pond-control" v-model:show="modelShow" :mask-closable="false"> <n-modal class="go-chart-data-pond-control" v-model:show="modelShowRef" :mask-closable="false">
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 900px; height: 650px"> <n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 900px; height: 650px">
<template #header></template> <template #header></template>
<template #header-extra> </template> <template #header-extra> </template>
@ -37,7 +37,6 @@
<!-- 请求配置model --> <!-- 请求配置model -->
<pond-data-request <pond-data-request
v-if="requestShow"
v-model:modelShow="requestShow" v-model:modelShow="requestShow"
:targetDataRequest="editData" :targetDataRequest="editData"
:isEdit="isEdit" :isEdit="isEdit"
@ -59,7 +58,7 @@ import { icon } from '@/plugins'
import { getUUID, goDialog } from '@/utils' import { getUUID, goDialog } from '@/utils'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
defineProps({ const props = defineProps({
modelShow: Boolean modelShow: Boolean
}) })
@ -68,6 +67,7 @@ const { PencilIcon } = icon.ionicons5
const { chartEditStore, targetData } = useTargetData() const { chartEditStore, targetData } = useTargetData()
const { requestDataPond } = toRefs(chartEditStore.getRequestGlobalConfig) const { requestDataPond } = toRefs(chartEditStore.getRequestGlobalConfig)
const requestShow = ref(false) const requestShow = ref(false)
const modelShowRef = ref(false)
const loading = ref(false) const loading = ref(false)
const isEdit = ref(false) const isEdit = ref(false)
const editData = ref<RequestDataPondItemType>() const editData = ref<RequestDataPondItemType>()
@ -82,6 +82,10 @@ const pondData = computed(() => {
return data[0] return data[0]
}) })
watch(() => props.modelShow, (newValue) => {
modelShowRef.value = newValue
})
watch( watch(
() => pondData.value, () => pondData.value,
newValue => { newValue => {

View File

@ -1,5 +1,5 @@
<template> <template>
<n-modal class="go-chart-data-request" v-model:show="modelShow" :mask-closable="false" :closeOnEsc="false"> <n-modal class="go-chart-data-request" v-model:show="modelShowRef" :mask-closable="false" :closeOnEsc="false">
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 800px"> <n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 800px">
<template #header></template> <template #header></template>
<template #header-extra> </template> <template #header-extra> </template>
@ -29,7 +29,7 @@
</template> </template>
<script script lang="ts" setup> <script script lang="ts" setup>
import { toRefs, PropType } from 'vue' import { ref, toRefs, PropType, watch } from 'vue'
import { RequestContentTypeEnum } from '@/enums/httpEnum' import { RequestContentTypeEnum } from '@/enums/httpEnum'
import { useTargetData } from '../../../hooks/useTargetData.hook' import { useTargetData } from '../../../hooks/useTargetData.hook'
import { RequestGlobalConfig } from './components/RequestGlobalConfig' import { RequestGlobalConfig } from './components/RequestGlobalConfig'
@ -46,11 +46,22 @@ const emit = defineEmits(['update:modelShow', 'sendHandle'])
// //
const { chartConfig } = toRefs(props.targetData as CreateComponentType) const { chartConfig } = toRefs(props.targetData as CreateComponentType)
const { requestContentType } = toRefs((props.targetData as CreateComponentType).request) const { requestContentType } = toRefs((props.targetData as CreateComponentType).request)
const modelShowRef = ref(false)
const requestContentTypeObj = { const requestContentTypeObj = {
[RequestContentTypeEnum.DEFAULT]: '普通请求', [RequestContentTypeEnum.DEFAULT]: '普通请求',
[RequestContentTypeEnum.SQL]: 'SQL 请求' [RequestContentTypeEnum.SQL]: 'SQL 请求'
} }
watch(
() => props.modelShow,
newValue => {
modelShowRef.value = newValue
},
{
immediate: true
}
)
const closeHandle = () => { const closeHandle = () => {
emit('update:modelShow', false) emit('update:modelShow', false)
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<n-modal class="go-chart-data-request" v-model:show="modelShow" :mask-closable="false" :closeOnEsc="false"> <n-modal class="go-chart-data-request" v-model:show="modelShowRef" :mask-closable="false" :closeOnEsc="false">
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 800px"> <n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 800px">
<template #header></template> <template #header></template>
<template #header-extra> </template> <template #header-extra> </template>
@ -42,7 +42,7 @@
</template> </template>
<script script lang="ts" setup> <script script lang="ts" setup>
import { PropType, ref, watchEffect } from 'vue' import { PropType, ref, watch } from 'vue'
import { RequestContentTypeEnum } from '@/enums/httpEnum' import { RequestContentTypeEnum } from '@/enums/httpEnum'
import { useTargetData } from '../../../hooks/useTargetData.hook' import { useTargetData } from '../../../hooks/useTargetData.hook'
import { RequestGlobalConfig } from './components/RequestGlobalConfig' import { RequestGlobalConfig } from './components/RequestGlobalConfig'
@ -58,6 +58,12 @@ const emit = defineEmits(['update:modelShow', 'editSaveHandle'])
const pondName = ref() const pondName = ref()
const inputInstRef = ref() const inputInstRef = ref()
const modelShowRef = ref(false)
watch(() => props.modelShow, (newValue) => {
modelShowRef.value = newValue
})
const closeHandle = () => { const closeHandle = () => {
emit('update:modelShow', false) emit('update:modelShow', false)

View File

@ -1,5 +1,5 @@
<template> <template>
<n-modal v-model:show="modelShow" :mask-closable="true" @afterLeave="closeHandle"> <n-modal v-model:show="modelShowRef" :mask-closable="true" @afterLeave="closeHandle">
<n-table class="model-content" :bordered="false" :single-line="false"> <n-table class="model-content" :bordered="false" :single-line="false">
<thead> <thead>
<tr> <tr>
@ -31,17 +31,24 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { watch, ref } from 'vue'
import { icon } from '@/plugins' import { icon } from '@/plugins'
import { WinKeyboard, MacKeyboard } from '@/enums/editPageEnum' import { WinKeyboard, MacKeyboard } from '@/enums/editPageEnum'
const { CloseIcon } = icon.ionicons5 const { CloseIcon } = icon.ionicons5
const modelShowRef = ref(false)
const emit = defineEmits(['update:modelShow']) const emit = defineEmits(['update:modelShow'])
defineProps({ const props = defineProps({
modelShow: Boolean modelShow: Boolean
}) })
watch(() => props.modelShow, (newValue) => {
modelShowRef.value = newValue
})
// //
const shortcutKeyOptions = [ const shortcutKeyOptions = [
{ {
@ -121,6 +128,7 @@ const shortcutKeyOptions = [
mac: `${MacKeyboard.CTRL_SOURCE_KEY.toUpperCase()} + ${WinKeyboard.SHIFT.toUpperCase()} + G ` mac: `${MacKeyboard.CTRL_SOURCE_KEY.toUpperCase()} + ${WinKeyboard.SHIFT.toUpperCase()} + G `
} }
] ]
const closeHandle = () => { const closeHandle = () => {
emit('update:modelShow', false) emit('update:modelShow', false)
} }