|
@@ -6,6 +6,10 @@
|
|
|
<span>当前打开文档:</span
|
|
|
>{{ docAttr.title == "" ? "新建文档" : docAttr.title }}
|
|
|
</div>
|
|
|
+ <div class="doc" v-else-if="type == 'module'">
|
|
|
+ <span>当前打开模块:</span
|
|
|
+ >{{ coms[0].name == "" ? "新建模块" : coms[0].name }}
|
|
|
+ </div>
|
|
|
<div class="doc" v-else>
|
|
|
<span>当前打开模版:</span
|
|
|
>{{ docAttr.title == "" ? "新建模版" : docAttr.title }}
|
|
@@ -113,7 +117,7 @@
|
|
|
</el-collapse>
|
|
|
</div>
|
|
|
<div v-if="showView == 1">
|
|
|
- <el-collapse
|
|
|
+ <!-- <el-collapse
|
|
|
v-model="activeModel"
|
|
|
:accordion="true"
|
|
|
@change="handleItemClick"
|
|
@@ -177,6 +181,149 @@
|
|
|
</transition-group>
|
|
|
</draggable>
|
|
|
</el-collapse-item>
|
|
|
+ </el-collapse> -->
|
|
|
+ <el-collapse
|
|
|
+ v-model="activeModel"
|
|
|
+ :accordion="true"
|
|
|
+ @change="handleItemClick"
|
|
|
+ class="borderless-collapse"
|
|
|
+ >
|
|
|
+ <el-collapse-item
|
|
|
+ v-for="(item, itemIndex) in categoryList"
|
|
|
+ :key="itemIndex"
|
|
|
+ :title="item.name"
|
|
|
+ :name="item.id"
|
|
|
+ class="min-width-content"
|
|
|
+ >
|
|
|
+ <el-collapse
|
|
|
+ v-if="item.children && item.children.length"
|
|
|
+ v-model="item.activeChildren"
|
|
|
+ @change="handleItemVal"
|
|
|
+ v-show="item.children"
|
|
|
+ class="borderless-collapse"
|
|
|
+ >
|
|
|
+ <el-collapse-item
|
|
|
+ v-for="(child, childIndex) in item.children"
|
|
|
+ :key="childIndex"
|
|
|
+ :title="child.name"
|
|
|
+ :name="child.id"
|
|
|
+ class="min-width-content"
|
|
|
+ >
|
|
|
+ <el-collapse
|
|
|
+ v-if="child.children && child.children.length"
|
|
|
+ v-model="child.activeChildren"
|
|
|
+ @change="handleChildItemVal"
|
|
|
+ v-show="child.children"
|
|
|
+ class="borderless-collapse"
|
|
|
+ >
|
|
|
+ <el-collapse-item
|
|
|
+ v-for="(
|
|
|
+ grandChild, grandChildIndex
|
|
|
+ ) in child.children"
|
|
|
+ :key="grandChildIndex"
|
|
|
+ :title="grandChild.name"
|
|
|
+ :name="grandChild.id"
|
|
|
+ class="min-width-content"
|
|
|
+ >
|
|
|
+ <el-collapse
|
|
|
+ v-if="
|
|
|
+ grandChild.children && grandChild.children.length
|
|
|
+ "
|
|
|
+ v-model="grandChild.activeChildren"
|
|
|
+ @change="handleGrandChildItemVal"
|
|
|
+ v-show="grandChild.children"
|
|
|
+ class="borderless-collapse"
|
|
|
+ >
|
|
|
+ <el-collapse-item
|
|
|
+ v-for="(
|
|
|
+ greatGrandChild, greatGrandChildIndex
|
|
|
+ ) in grandChild.children"
|
|
|
+ :key="greatGrandChildIndex"
|
|
|
+ :title="greatGrandChild.name"
|
|
|
+ :name="greatGrandChild.id"
|
|
|
+ class="min-width-content"
|
|
|
+ >
|
|
|
+ <draggable
|
|
|
+ v-model="greatGrandChild.dataList"
|
|
|
+ :options="{
|
|
|
+ group: { name: 'itxst', pull: 'clone' },
|
|
|
+ sort: true,
|
|
|
+ }"
|
|
|
+ :disabled="type == 'module'"
|
|
|
+ >
|
|
|
+ <transition-group>
|
|
|
+ <div
|
|
|
+ class="sub-menus min-width-content"
|
|
|
+ v-for="(
|
|
|
+ its, index
|
|
|
+ ) in greatGrandChild.dataList"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <div>{{ its.name }}</div>
|
|
|
+ </div>
|
|
|
+ </transition-group>
|
|
|
+ </draggable>
|
|
|
+ </el-collapse-item>
|
|
|
+ </el-collapse>
|
|
|
+ <draggable
|
|
|
+ v-model="grandChild.dataList"
|
|
|
+ :options="{
|
|
|
+ group: { name: 'itxst', pull: 'clone' },
|
|
|
+ sort: true,
|
|
|
+ }"
|
|
|
+ :disabled="type == 'module'"
|
|
|
+ >
|
|
|
+ <transition-group>
|
|
|
+ <div
|
|
|
+ class="sub-menus min-width-content"
|
|
|
+ v-for="(it, index) in grandChild.dataList"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <div>{{ it.name }}</div>
|
|
|
+ </div>
|
|
|
+ </transition-group>
|
|
|
+ </draggable>
|
|
|
+ </el-collapse-item>
|
|
|
+ </el-collapse>
|
|
|
+ <draggable
|
|
|
+ v-model="child.dataList"
|
|
|
+ :options="{
|
|
|
+ group: { name: 'itxst', pull: 'clone' },
|
|
|
+ sort: true,
|
|
|
+ }"
|
|
|
+ :disabled="type == 'module'"
|
|
|
+ >
|
|
|
+ <transition-group>
|
|
|
+ <div
|
|
|
+ class="sub-menus min-width-content"
|
|
|
+ v-for="(it, index) in child.dataList"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <div>{{ it.name }}</div>
|
|
|
+ </div>
|
|
|
+ </transition-group>
|
|
|
+ </draggable>
|
|
|
+ </el-collapse-item>
|
|
|
+ </el-collapse>
|
|
|
+ <draggable
|
|
|
+ v-model="item.dataList"
|
|
|
+ :options="{
|
|
|
+ group: { name: 'itxst', pull: 'clone' },
|
|
|
+ sort: true,
|
|
|
+ }"
|
|
|
+ :disabled="type == 'module'"
|
|
|
+ >
|
|
|
+ <transition-group>
|
|
|
+ <div
|
|
|
+ class="sub-menus min-width-content"
|
|
|
+ v-for="(it, index) in item.dataList"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <div>{{ it.name }}</div>
|
|
|
+ </div>
|
|
|
+ </transition-group>
|
|
|
+ </draggable>
|
|
|
+ </el-collapse-item>
|
|
|
</el-collapse>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -481,7 +628,9 @@ export default {
|
|
|
},
|
|
|
docRules: {
|
|
|
title: [{ required: true, message: "请输文档名称", trigger: "blur" }],
|
|
|
- category_id: [{ required: true, message: "请选择文档分类", trigger: "change" }],
|
|
|
+ category_id: [
|
|
|
+ { required: true, message: "请选择文档分类", trigger: "change" },
|
|
|
+ ],
|
|
|
},
|
|
|
articleCategoryList: [],
|
|
|
};
|
|
@@ -510,19 +659,78 @@ export default {
|
|
|
if (this.type == "module") {
|
|
|
this.showView = 1;
|
|
|
}
|
|
|
- let _this = this;
|
|
|
+
|
|
|
this.searchArticle();
|
|
|
await this.initCategoryList();
|
|
|
await this.initCurrentUser();
|
|
|
let templateId = this.$route.query.templateId;
|
|
|
if (templateId > 0) {
|
|
|
- _this.loadTemplateInfo(templateId);
|
|
|
+ this.loadTemplateInfo(templateId);
|
|
|
}
|
|
|
- _this.isAdmin = _this.userInfo.roleInfo.is_admin;
|
|
|
+ this.isAdmin = this.userInfo ? this.userInfo.roleInfo.is_admin : 2;
|
|
|
this.initArticleCategoryList();
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ handleItemVal(value) {
|
|
|
+ this.$forceUpdate();
|
|
|
+ this.loadChildren(value);
|
|
|
+ },
|
|
|
+ handleChildItemClick(child) {
|
|
|
+ if (!child.children) {
|
|
|
+ this.loadChildren(child);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleChildItemVal(value) {
|
|
|
+ this.$forceUpdate();
|
|
|
+ this.loadChildren(value);
|
|
|
+ },
|
|
|
+ handleGrandChildItemClick(grandChild) {
|
|
|
+ if (!grandChild.children) {
|
|
|
+ this.loadChildren(grandChild);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleGrandChildItemVal(value) {
|
|
|
+ this.$forceUpdate();
|
|
|
+ this.loadChildren(value);
|
|
|
+ },
|
|
|
+ handleGreatGrandChildItemClick(greatGrandChild) {
|
|
|
+ if (!greatGrandChild.children) {
|
|
|
+ this.loadChildren(greatGrandChild);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async loadChildren(category) {
|
|
|
+ const category_id = category[category.length - 1];
|
|
|
+ console.log(this.categoryList);
|
|
|
+ try {
|
|
|
+ const res = await searchTemplateCategory({ parent_id: category_id });
|
|
|
+ if (res.status != 200 || res.data.length == 0) return;
|
|
|
+ const newChildren = res.data;
|
|
|
+ for (let i = 0; i < newChildren.length; i++) {
|
|
|
+ newChildren[i].dataList = await this.getTemplateList(
|
|
|
+ newChildren[i].id
|
|
|
+ );
|
|
|
+ }
|
|
|
+ this.insertChildrenById(this.categoryList, category_id, newChildren);
|
|
|
+ this.$forceUpdate(); // Force Vue to re-render the component
|
|
|
+ } catch (error) {
|
|
|
+ console.error("Error fetching template categories:", error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ insertChildrenById(list, id, newChildren) {
|
|
|
+ for (let item of list) {
|
|
|
+ if (item.id === id) {
|
|
|
+ this.$set(item, "children", newChildren); // Use Vue.set to ensure reactivity
|
|
|
+ return true; // Stop searching once the item is found
|
|
|
+ }
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ const found = this.insertChildrenById(item.children, id, newChildren);
|
|
|
+ if (found) return true; // Stop searching if the item is found in deeper levels
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false; // Continue searching
|
|
|
+ },
|
|
|
/* 取消新增 */
|
|
|
closeDoc() {
|
|
|
this.docVisible = false;
|
|
@@ -768,10 +976,11 @@ export default {
|
|
|
|
|
|
return result;
|
|
|
},
|
|
|
-
|
|
|
+ /*
|
|
|
handleItemVal(value) {
|
|
|
+ console.log(value);
|
|
|
this.$forceUpdate();
|
|
|
- },
|
|
|
+ }, */
|
|
|
async handleItemClick(item) {
|
|
|
const category = this.categoryList.find((cat) => cat.id === item);
|
|
|
if (!category) return;
|
|
@@ -873,18 +1082,23 @@ export default {
|
|
|
let par = {
|
|
|
id: e,
|
|
|
};
|
|
|
- getTemplateInfo(par).then((res) => {
|
|
|
- if (res.status != 200) return;
|
|
|
- if (res.data.attrs == null || res.data.type == "") {
|
|
|
- res.data.attrs = "[]";
|
|
|
- res.data.content = "请填写内容";
|
|
|
- res.data.lay_id = "textArea";
|
|
|
- res.data.type = "TextArea";
|
|
|
- }
|
|
|
- console.log(res.data);
|
|
|
- res.data.attrs = JSON.parse(res.data.attrs);
|
|
|
- _this.coms = [res.data];
|
|
|
- });
|
|
|
+ getTemplateInfo(par)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.status != 200) return;
|
|
|
+ if (res.data.attrs == null || res.data.type == "") {
|
|
|
+ res.data.attrs = "[]";
|
|
|
+ res.data.content = "请填写内容";
|
|
|
+ res.data.lay_id = "textArea";
|
|
|
+ res.data.type = "TextArea";
|
|
|
+ }
|
|
|
+ document.title =
|
|
|
+ res.data.name == ""
|
|
|
+ ? "新建模块-轻良实业"
|
|
|
+ : res.data.name + "-轻良实业";
|
|
|
+ res.data.attrs = JSON.parse(res.data.attrs);
|
|
|
+ _this.coms = [res.data];
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
onExport(e) {
|
|
|
let _this = this;
|
|
@@ -1241,11 +1455,44 @@ export default {
|
|
|
case "addNew": //插入新记录
|
|
|
_this.insertNew(e);
|
|
|
break;
|
|
|
+ case "InsertNull":
|
|
|
+ _this.insertVal();
|
|
|
+ break;
|
|
|
case "ai": //插入ai
|
|
|
_this.insertAI(e);
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
+ /* 插入空值 */
|
|
|
+ insertVal() {
|
|
|
+ let _this = this;
|
|
|
+ if (_this.comIndex < 0) {
|
|
|
+ _this.$alert("请选择插入图层");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let com = _this.coms[_this.comIndex];
|
|
|
+ let data = {
|
|
|
+ type: "variable",
|
|
|
+ id: "val" + (com.attrs.length + 1),
|
|
|
+ dataId: "",
|
|
|
+ name: "非变量",
|
|
|
+ intro: "",
|
|
|
+ content: "",
|
|
|
+ data: "",
|
|
|
+ };
|
|
|
+ com.attrs.push(data);
|
|
|
+ if (com.type == "TextArea") {
|
|
|
+ //如果是图文,更新内容
|
|
|
+ _this.insertCmd = {
|
|
|
+ content: "{{" + data.id + "}}",
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ //仅对图表中插入有效
|
|
|
+ if (_this.comIndex >= 0) {
|
|
|
+ _this.setTableData(data.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
/* 插入ai */
|
|
|
insertAI(e) {
|
|
|
let _this = this;
|
|
@@ -1265,7 +1512,6 @@ export default {
|
|
|
search: e.content.searchTerm,
|
|
|
};
|
|
|
com.attrs.push(data);
|
|
|
- console.log(com.attrs);
|
|
|
if (com.type == "TextArea") {
|
|
|
//如果是图文,更新内容
|
|
|
_this.insertCmd = {
|
|
@@ -1605,15 +1851,40 @@ export default {
|
|
|
|
|
|
<style lang="scss">
|
|
|
@import "./create.scss";
|
|
|
-.borderless-collapse {
|
|
|
+/* .borderless-collapse {
|
|
|
border: none;
|
|
|
-
|
|
|
- ::v-deep .el-collapse-item__header,
|
|
|
+ ::v-deep.el-collapse-item .el-collapse-item__header{
|
|
|
+ border-bottom: none;
|
|
|
+ }
|
|
|
::v-deep .el-collapse-item__wrap {
|
|
|
border-bottom: none;
|
|
|
}
|
|
|
- ::v-deep .el-collapse-item .el-collapse-item__header{
|
|
|
+ ::v-deep .el-collapse-item .el-collapse-item__header {
|
|
|
border-bottom: none;
|
|
|
}
|
|
|
+} */
|
|
|
+.min-width-content {
|
|
|
+ min-width: 150px; /* Set your desired minimum width here */
|
|
|
+}
|
|
|
+
|
|
|
+.el-collapse,
|
|
|
+.el-collapse-item__wrap {
|
|
|
+ border: none;
|
|
|
+}
|
|
|
+.el-collapse,
|
|
|
+.el-collapse-item__header {
|
|
|
+ border: none;
|
|
|
+}
|
|
|
+.borderless-collapse {
|
|
|
+ border: none;
|
|
|
+ ::v-deep .el-collapse-item__header,
|
|
|
+ ::v-deep .el-collapse-item__wrap,
|
|
|
+ ::v-deep .el-collapse-item__content,
|
|
|
+ ::v-deep .el-collapse-item {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ ::v-deep .el-collapse-item__wrap {
|
|
|
+ border-bottom: none !important;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|