卡片data更新
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { NODE_DATATYPE, NODE_DATATIER } from '../../../tools/index.d'
|
||||
import { computed, ref, useAttrs, onMounted, inject } from 'vue'
|
||||
import { computed, ref, useAttrs, onMounted, inject, watch } from 'vue'
|
||||
import CardsSelect from './cards-select.vue'
|
||||
import ToRealStyle from './to-real-style.vue'
|
||||
import SurfaceEdit from './surface-edit.vue'
|
||||
@@ -90,6 +90,7 @@
|
||||
]
|
||||
const nodeManager = inject('nodeManager') as any
|
||||
const stateManager = inject('stateManager') as any
|
||||
const emit = defineEmits(['update-data'])
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String as () =>
|
||||
@@ -113,9 +114,9 @@
|
||||
})
|
||||
const componentRef = ref(null)
|
||||
const onGenerateClick = () => {
|
||||
const data = { ...componentRef.value.data }
|
||||
const data = componentRef.value.data
|
||||
const subordNode = stateManager.getSubordNodeByID(attrs.node.id)
|
||||
if (attrs.node.data) attrs.node.data.data = data
|
||||
emit('update-data', data)
|
||||
if (!subordNode) {
|
||||
nodeManager.createResultNode({
|
||||
data: {
|
||||
@@ -129,28 +130,35 @@
|
||||
} else {
|
||||
subordNode.data.data.url =
|
||||
'https://s3-alpha-sig.figma.com/img/8ce2/f1a4/12b93da90e5f17109e7430f14837fd14?Expires=1773619200&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=kmLsTFtXJqfvuxj6husWlDkRDMOIRDjzUUjb7zh79GkBKihUHc0f59k5OAImHTPdaiEREUCCpn~8sQ-si5lenuauJpApCmAU~NsxjfQhuh9m5O~GiHenr2fKu0DIJ75-oCE3859fyxoSFXQgZ9PRmeb98kikMR6uRX9nI5TPUHgKO8ZgkhDBTW~iyaDT~1ybnoK7elPa6T2VzfO-bpIyY-MZ71VRq3RxwmZRxduqHEb3Dh-jjrHyh2SoQsHmUjSJOf-uYilfvpGUResZAjAq8ZVLEjvhzKC2bmCNZIp3RmhYO8ctU7pd5t91J6Xaa6jBLtGfMxbqIm652EC79K0RoA__'
|
||||
setTimeout(() => stateManager.recordState())
|
||||
}
|
||||
}
|
||||
//删除功能卡片
|
||||
const onDeleteClick = ()=>{
|
||||
ElMessageBox.confirm(
|
||||
$t('flowCanvas.deleteCardConfirm'),
|
||||
'',
|
||||
{
|
||||
confirmButtonText: $t('flowCanvas.confirm'),
|
||||
cancelButtonText: $t('flowCanvas.cancel'),
|
||||
}
|
||||
).then(() => {
|
||||
stateManager.deleteNode(attrs.node.id)
|
||||
}).catch(() => {
|
||||
const onDeleteClick = () => {
|
||||
ElMessageBox.confirm($t('flowCanvas.deleteCardConfirm'), '', {
|
||||
confirmButtonText: $t('flowCanvas.confirm'),
|
||||
cancelButtonText: $t('flowCanvas.cancel')
|
||||
})
|
||||
.then(() => {
|
||||
stateManager.deleteNode(attrs.node.id)
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
onMounted(() => {
|
||||
const setDate = () => {
|
||||
for (const key in props.data) {
|
||||
if (componentRef.value?.data?.hasOwnProperty(key)) {
|
||||
componentRef.value.data[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
watch(
|
||||
() => props.data,
|
||||
(newVal) => {
|
||||
setDate()
|
||||
}
|
||||
)
|
||||
onMounted(() => {
|
||||
setDate()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user