Commit ba70837e authored by 郭铭瑶's avatar 郭铭瑶 🤘

新增标签选择名称则代入数据并disable

parent c526d3a6
...@@ -114,7 +114,11 @@ export default { ...@@ -114,7 +114,11 @@ export default {
const handleLinkClick = (d) => { const handleLinkClick = (d) => {
const { nodeLabel } = d.target const { nodeLabel } = d.target
if (nodeLabel === 'System' || nodeLabel === 'Subject') { if (
nodeLabel === 'System' ||
nodeLabel === 'Subject' ||
nodeLabel === 'SubjectLabel'
) {
ctx.emit('del-link', d) ctx.emit('del-link', d)
} }
} }
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
filterable filterable
tag tag
:options="tagOptions" :options="tagOptions"
:on-update:value="(e) => selectTag(e, i)"
/> />
</n-form-item> </n-form-item>
<n-form-item label="标签分类" path="classification"> <n-form-item label="标签分类" path="classification">
...@@ -61,12 +62,16 @@ ...@@ -61,12 +62,16 @@
v-model:value="data.classification" v-model:value="data.classification"
placeholder="请选择" placeholder="请选择"
:options="tagClassOptions" :options="tagClassOptions"
:disabled="disableTag"
/> />
</n-form-item> </n-form-item>
<n-form-item path="isPositive" :show-label="false"> <n-form-item path="isPositive" :show-label="false">
<n-checkbox v-model:checked="data.isPositive" <n-checkbox
>是否为积极的标签</n-checkbox v-model:checked="data.isPositive"
:disabled="disableTag"
> >
是否为积极的标签
</n-checkbox>
</n-form-item> </n-form-item>
</template> </template>
<template v-else> <template v-else>
...@@ -333,10 +338,11 @@ function fetchTags() { ...@@ -333,10 +338,11 @@ function fetchTags() {
.then((res) => { .then((res) => {
const data = (res.data && res.data.content) || [] const data = (res.data && res.data.content) || []
tagOptions.value = data.map((e) => ({ tagOptions.value = data.map((e) => ({
// TODO ...e,
label: e.labelName, label: e.labelName,
value: e.id + '', value: e.nodeId + '',
})) }))
console.log(tagOptions.value)
}) })
} }
fetchTags() fetchTags()
...@@ -419,6 +425,21 @@ function getTagName(relationId) { ...@@ -419,6 +425,21 @@ function getTagName(relationId) {
return tag && tag.label return tag && tag.label
} }
const disableTag = ref(false)
function selectTag(nodeId, i) {
formData.value[i].labelName = nodeId
const curTag = tagOptions.value.find((e) => e.value == nodeId)
if (curTag) {
formData.value[i].isPositive = curTag.isPositive
formData.value[i].classification = curTag.classification
disableTag.value = true
} else {
formData.value[i].isPositive = null
formData.value[i].classification = null
disableTag.value = false
}
}
function submitNewNode(e) { function submitNewNode(e) {
e.preventDefault() e.preventDefault()
console.log(formData.value) console.log(formData.value)
...@@ -533,9 +554,12 @@ function deleteNode(data) { ...@@ -533,9 +554,12 @@ function deleteNode(data) {
function deleteLink(data) { function deleteLink(data) {
const { source, target } = data const { source, target } = data
const name = `'${source.propertyName || target.subjectName}_${ let name = `'${source.propertyName || target.subjectName}_${
target.systemName || source.subjectName target.systemName || source.subjectName
}'` }'`
if (target.nodeLabel === 'SubjectLabel') {
name = `'${source.subjectName}_${target.labelName}'`
}
dialog.error({ dialog.error({
title: '提示', title: '提示',
content: `是否删除 ${name} 关联关系?`, content: `是否删除 ${name} 关联关系?`,
......
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