|
@@ -131,7 +131,7 @@
|
|
|
/>
|
|
|
|
|
|
<!-- 添加或修改目录模板对话框 -->
|
|
|
- <el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
|
|
+ <el-dialog :title="title" v-model="open" width="500px" append-to-body @close="cancelAddTemp">
|
|
|
<el-form ref="dirTemplateRef" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-form-item label="模板名称" prop="tmplName">
|
|
|
<el-input v-model="tempTitle" placeholder="请输入模板名称"/>
|
|
@@ -141,7 +141,7 @@
|
|
|
:data="tempData"
|
|
|
default-expand-all
|
|
|
node-key="id"
|
|
|
- style="width:100%"
|
|
|
+ style="width:100%;height:300px;overflow-y: auto;"
|
|
|
:expand-on-click-node="false"
|
|
|
>
|
|
|
<template #default="{ node, data }">
|
|
@@ -207,7 +207,7 @@ const tempId = ref(1000)
|
|
|
const upNodeData = ref()
|
|
|
const tempTitle = ref('')
|
|
|
const tempData = ref([
|
|
|
- {id:1,label:tempTitle,children:[
|
|
|
+ {id:1,label:tempTitle || '请输入模板名称',children:[
|
|
|
|
|
|
]}
|
|
|
])
|
|
@@ -292,8 +292,21 @@ function handleUpdate(row) {
|
|
|
getDirTemplate(_tmplId).then(response => {
|
|
|
console.log('response',response);
|
|
|
form.value = response.data;
|
|
|
- tempTitle.value = response.data.tmplName
|
|
|
const arr = JSON.parse(response.data.tmplContent)
|
|
|
+ const getNewtempId = (arr)=>{
|
|
|
+ arr.map(item=>{
|
|
|
+ if(item.id >= tempId.value){
|
|
|
+ console.log('1',item.id);
|
|
|
+ tempId.value = item.id +1
|
|
|
+ }
|
|
|
+ if(item.children?.length>0){
|
|
|
+ getNewtempId(item.children)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ getNewtempId(arr)
|
|
|
+ tempTitle.value = response.data.tmplName
|
|
|
+
|
|
|
tempData.value = [{id:1,label:tempTitle,children:[]}]
|
|
|
tempData.value[0].children = arr
|
|
|
open.value = true;
|
|
@@ -415,7 +428,11 @@ const cancelAddTemp = ()=>{
|
|
|
open.value = false
|
|
|
newName.value = ''
|
|
|
tempTitle.value = ''
|
|
|
- tempData.value = []
|
|
|
+ tempData.value = [
|
|
|
+ {id:1,label:tempTitle || '请输入模板名称',children:[
|
|
|
+
|
|
|
+ ]}
|
|
|
+]
|
|
|
}
|
|
|
|
|
|
getList();
|