点线标注
This commit is contained in:
@ -17,9 +17,9 @@
|
||||
label-width="80px"
|
||||
@keyup.enter.native="submitForm(ruleForm)"
|
||||
>
|
||||
<el-form-item label="名称:" prop="source_name">
|
||||
<el-form-item label="名称:" prop="sourceName">
|
||||
<!-- @input="removeSpaces" -->
|
||||
<el-input v-model.trim="form.source_name" placeholder="图层文件夹"></el-input>
|
||||
<el-input v-model.trim="form.sourceName" placeholder="图层文件夹"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="btnOption">
|
||||
@ -42,14 +42,14 @@ import { useTreeNode } from '@/views/components/tree/hooks/treeNode'
|
||||
const { getKeyOfSelectedNode, getSelectedNode, cusAddNodes, getSameLevel } = useTreeNode()
|
||||
const title = ref('添加文件夹')
|
||||
let form: any = reactive({
|
||||
source_name: '图层'
|
||||
sourceName: '图层'
|
||||
})
|
||||
const ruleForm = ref()
|
||||
const rules = reactive({
|
||||
source_name: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
||||
sourceName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
||||
})
|
||||
const removeSpaces = (value: string) => {
|
||||
form.source_name = value.replace(/\s/g, '')
|
||||
form.sourceName = value.replace(/\s/g, '')
|
||||
}
|
||||
const close = () => {
|
||||
$changeComponentPop('.adddirectory', false)
|
||||
@ -65,11 +65,11 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
})
|
||||
}
|
||||
const add = throttle(async () => {
|
||||
let p_id = getKeyOfSelectedNode(window.treeObj, 'source_id')
|
||||
let parentId = getKeyOfSelectedNode(window.treeObj, 'id')
|
||||
let fnone = getSelectedNode(window.treeObj)
|
||||
const res = await TreeApi.addDirectory({
|
||||
source_name: form.source_name,
|
||||
p_id
|
||||
sourceName: form.sourceName,
|
||||
parentId
|
||||
})
|
||||
if (res.code == 0) {
|
||||
const node = {
|
||||
@ -99,9 +99,9 @@ const add = throttle(async () => {
|
||||
const updateTree = async (newNode: any) => {
|
||||
const list = newNode.map((item: any) => {
|
||||
return {
|
||||
source_id: item.source_id,
|
||||
id: item.id,
|
||||
tree_index: item.tree_index,
|
||||
p_id: item.p_id
|
||||
parentId: item.parentId
|
||||
}
|
||||
})
|
||||
console.log(list)
|
||||
@ -123,7 +123,7 @@ const updateTree = async (newNode: any) => {
|
||||
|
||||
const cancel = () => {
|
||||
$changeComponentPop('.adddirectory', false)
|
||||
form.source_name = '图层'
|
||||
form.sourceName = '图层'
|
||||
ruleForm.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user