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

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

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