|
@@ -11,6 +11,7 @@
|
|
placeholder="请选择是否为管理员"
|
|
placeholder="请选择是否为管理员"
|
|
size="large"
|
|
size="large"
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
|
+ @change="selChange"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="item in adminOptions"
|
|
v-for="item in adminOptions"
|
|
@@ -20,119 +21,112 @@
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="权限配置:">
|
|
|
|
- <div
|
|
|
|
- style="
|
|
|
|
- width: 100%;
|
|
|
|
- height: 150px;
|
|
|
|
- overflow: hidden;
|
|
|
|
- border: 1px solid #ccc;
|
|
|
|
- overflow-y: auto;
|
|
|
|
- padding: 10px;
|
|
|
|
- "
|
|
|
|
- >
|
|
|
|
- <el-checkbox
|
|
|
|
- v-model="allChecked.nodeTree"
|
|
|
|
- @change="handleCheckAllChange('nodeTree')"
|
|
|
|
- >全选</el-checkbox
|
|
|
|
- >
|
|
|
|
- <el-tree
|
|
|
|
- ref="nodeTree"
|
|
|
|
- style="max-width: 600px"
|
|
|
|
- :props="defaultProps"
|
|
|
|
- :data="treeData"
|
|
|
|
- default-expand-all
|
|
|
|
- node-key="value"
|
|
|
|
- show-checkbox
|
|
|
|
- @check="handleNodeCheck"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
- </el-form-item>
|
|
|
|
-
|
|
|
|
- <!-- <el-form-item label="模板分类授权:">
|
|
|
|
- <div
|
|
|
|
- style="
|
|
|
|
- width: 100%;
|
|
|
|
- height: 150px;
|
|
|
|
- overflow: hidden;
|
|
|
|
- border: 1px solid #ccc;
|
|
|
|
- overflow-y: auto;
|
|
|
|
- padding: 10px;
|
|
|
|
- "
|
|
|
|
- >
|
|
|
|
- <el-checkbox
|
|
|
|
- v-model="allChecked.templateCate"
|
|
|
|
- @change="handleTemplateAllChange('templateCate')"
|
|
|
|
- >全选</el-checkbox
|
|
|
|
- >
|
|
|
|
- <el-tree
|
|
|
|
- ref="templateCate"
|
|
|
|
- style="max-width: 600px"
|
|
|
|
- :props="defaultProps"
|
|
|
|
- :data="templateCate"
|
|
|
|
- default-expand-all
|
|
|
|
- node-key="value"
|
|
|
|
- show-checkbox
|
|
|
|
- @check="handleTemplateCheck"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="文档分类授权:">
|
|
|
|
- <div
|
|
|
|
- style="
|
|
|
|
- width: 100%;
|
|
|
|
- height: 150px;
|
|
|
|
- overflow: hidden;
|
|
|
|
- border: 1px solid #ccc;
|
|
|
|
- overflow-y: auto;
|
|
|
|
- padding: 10px;
|
|
|
|
- "
|
|
|
|
- >
|
|
|
|
- <el-checkbox
|
|
|
|
- v-model="allChecked.docCate"
|
|
|
|
- @change="handleDocAllChange('docCate')"
|
|
|
|
- >全选</el-checkbox
|
|
|
|
- >
|
|
|
|
- <el-tree
|
|
|
|
- ref="docCate"
|
|
|
|
- style="max-width: 600px"
|
|
|
|
- :props="defaultProps"
|
|
|
|
- :data="documentCate"
|
|
|
|
- default-expand-all
|
|
|
|
- node-key="value"
|
|
|
|
- show-checkbox
|
|
|
|
- @check="handleDocCheck"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="原始数据分类授权:">
|
|
|
|
- <div
|
|
|
|
- style="
|
|
|
|
- width: 100%;
|
|
|
|
- height: 150px;
|
|
|
|
- overflow: hidden;
|
|
|
|
- border: 1px solid #ccc;
|
|
|
|
- overflow-y: auto;
|
|
|
|
- padding: 10px;
|
|
|
|
- "
|
|
|
|
- >
|
|
|
|
- <el-checkbox
|
|
|
|
- v-model="allChecked.sourceDataTree"
|
|
|
|
- @change="handleSourceDataAllChange('sourceDataTree')"
|
|
|
|
- >全选</el-checkbox
|
|
|
|
- >
|
|
|
|
- <el-tree
|
|
|
|
- ref="sourceDataTree"
|
|
|
|
- style="max-width: 600px"
|
|
|
|
- :props="defaultProps"
|
|
|
|
- :data="sourceDataCate"
|
|
|
|
- default-expand-all
|
|
|
|
- node-key="value"
|
|
|
|
- show-checkbox
|
|
|
|
- @check="handleSourceDataCheck"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
- </el-form-item> -->
|
|
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="权限配置:">
|
|
|
|
+ <div
|
|
|
|
+ style="
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 300px;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ overflow-y: auto;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ "
|
|
|
|
+ >
|
|
|
|
+ <el-checkbox
|
|
|
|
+ v-model="allChecked.nodeTree"
|
|
|
|
+ @change="(val) => handleCheckAllChange('nodeTree', val)"
|
|
|
|
+ >全选</el-checkbox
|
|
|
|
+ >
|
|
|
|
+ <el-tree
|
|
|
|
+ ref="nodeTree"
|
|
|
|
+ style="max-width: 600px"
|
|
|
|
+ :props="treeProps"
|
|
|
|
+ :data="treeData"
|
|
|
|
+ default-expand-all
|
|
|
|
+ node-key="value"
|
|
|
|
+ show-checkbox
|
|
|
|
+ @check="handleNodeCheck"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="模板分类授权:">
|
|
|
|
+ <div
|
|
|
|
+ style="
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 150px;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ overflow-y: auto;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ "
|
|
|
|
+ >
|
|
|
|
+ <el-tree
|
|
|
|
+ ref="templateCate"
|
|
|
|
+ style="max-width: 600px"
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ :data="templateCate"
|
|
|
|
+ default-expand-all
|
|
|
|
+ node-key="id"
|
|
|
|
+ :default-checked-keys="defaultCheckedKeys.templateCate"
|
|
|
|
+ show-checkbox
|
|
|
|
+ @check="handleTemplateCheck"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="文档分类授权:">
|
|
|
|
+ <div
|
|
|
|
+ style="
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 150px;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ overflow-y: auto;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ "
|
|
|
|
+ >
|
|
|
|
+ <el-tree
|
|
|
|
+ ref="docCate"
|
|
|
|
+ style="max-width: 600px"
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ :data="documentCate"
|
|
|
|
+ default-expand-all
|
|
|
|
+ :default-checked-keys="defaultCheckedKeys.documentCate"
|
|
|
|
+ node-key="id"
|
|
|
|
+ show-checkbox
|
|
|
|
+ @check="handleDocCheck"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="原始数据分类授权:">
|
|
|
|
+ <div
|
|
|
|
+ style="
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 150px;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ overflow-y: auto;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ "
|
|
|
|
+ >
|
|
|
|
+ <el-tree
|
|
|
|
+ ref="sourceDataTree"
|
|
|
|
+ style="max-width: 600px"
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ :data="sourceDataCate"
|
|
|
|
+ default-expand-all
|
|
|
|
+ node-key="id"
|
|
|
|
+ show-checkbox
|
|
|
|
+ :default-checked-keys="defaultCheckedKeys.sourceDataCate"
|
|
|
|
+ @check="handleSourceDataCheck"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
<el-form-item label="角色状态:">
|
|
<el-form-item label="角色状态:">
|
|
<el-select
|
|
<el-select
|
|
v-model="dataForm.status"
|
|
v-model="dataForm.status"
|
|
@@ -148,6 +142,7 @@
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+
|
|
<el-form-item label="介绍:">
|
|
<el-form-item label="介绍:">
|
|
<el-input type="textarea" v-model="dataForm.intro"></el-input>
|
|
<el-input type="textarea" v-model="dataForm.intro"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -165,6 +160,7 @@ import {
|
|
createAdminRole,
|
|
createAdminRole,
|
|
updateAdminRole,
|
|
updateAdminRole,
|
|
getAdminRoleInfo,
|
|
getAdminRoleInfo,
|
|
|
|
+ selectPermissions,
|
|
} from "@/api/AdminRole";
|
|
} from "@/api/AdminRole";
|
|
|
|
|
|
import { searchDocumentCategory } from "@/api/document";
|
|
import { searchDocumentCategory } from "@/api/document";
|
|
@@ -193,10 +189,14 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
activeName: "base",
|
|
activeName: "base",
|
|
- defaultProps: {
|
|
|
|
|
|
+ treeProps: {
|
|
children: "children",
|
|
children: "children",
|
|
label: "label",
|
|
label: "label",
|
|
},
|
|
},
|
|
|
|
+ defaultProps: {
|
|
|
|
+ children: "children",
|
|
|
|
+ label: "codename",
|
|
|
|
+ },
|
|
treeData: [],
|
|
treeData: [],
|
|
dataForm: {
|
|
dataForm: {
|
|
id: "",
|
|
id: "",
|
|
@@ -235,6 +235,11 @@ export default {
|
|
docCate: false,
|
|
docCate: false,
|
|
sourceDataTree: false,
|
|
sourceDataTree: false,
|
|
},
|
|
},
|
|
|
|
+ defaultCheckedKeys: {
|
|
|
|
+ templateCate: [],
|
|
|
|
+ documentCate: [],
|
|
|
|
+ sourceDataTree: [],
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
|
|
@@ -245,75 +250,72 @@ export default {
|
|
this.initSourceDataCate();
|
|
this.initSourceDataCate();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ /* 管理选选择 */
|
|
|
|
+ selChange(val) {
|
|
|
|
+ if (val == 1) {
|
|
|
|
+ this.handleCheckAllChange("nodeTree", true);
|
|
|
|
+ this.handleTemplateAllChange(true);
|
|
|
|
+ this.handleSourceDataAllChange(true);
|
|
|
|
+ this.handleDocumentCateAllChange(true);
|
|
|
|
+ } else {
|
|
|
|
+ this.handleCheckAllChange("nodeTree", false);
|
|
|
|
+ this.handleTemplateAllChange(false);
|
|
|
|
+ this.handleSourceDataAllChange(false);
|
|
|
|
+ this.handleDocumentCateAllChange(false);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ handleTemplateAllChange(checked) {
|
|
|
|
+ const tree = this.$refs.templateCate;
|
|
|
|
+ if (checked) {
|
|
|
|
+ this.defaultCheckedKeys.templateCate = [1, 2, 3, 4];
|
|
|
|
+ tree.setCheckedKeys(this.defaultCheckedKeys.templateCate);
|
|
|
|
+ } else {
|
|
|
|
+ this.defaultCheckedKeys.templateCate = [];
|
|
|
|
+ tree.setCheckedKeys([]);
|
|
|
|
+ }
|
|
|
|
+ this.allChecked.templateCate = checked;
|
|
|
|
+ },
|
|
|
|
+
|
|
/* 全选原始数据分类 */
|
|
/* 全选原始数据分类 */
|
|
- handleSourceDataAllChange(treeRef) {
|
|
|
|
- const tree = this.$refs[treeRef];
|
|
|
|
- const data = this.sourceDataCate;
|
|
|
|
- tree.setCheckedNodes(
|
|
|
|
- this.allChecked[treeRef] ? this.flattenTree(data) : []
|
|
|
|
- );
|
|
|
|
|
|
+ handleSourceDataAllChange(checked) {
|
|
|
|
+ const tree = this.$refs.sourceDataTree;
|
|
|
|
+ if (checked) {
|
|
|
|
+ this.defaultCheckedKeys.sourceDataCate = [9, 10, 11, 12];
|
|
|
|
+ tree.setCheckedKeys(this.defaultCheckedKeys.sourceDataCate);
|
|
|
|
+ } else {
|
|
|
|
+ this.defaultCheckedKeys.sourceDataCate = [];
|
|
|
|
+ tree.setCheckedKeys([]);
|
|
|
|
+ }
|
|
|
|
+ this.allChecked.sourceDataTree = checked;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleDocumentCateAllChange(checked) {
|
|
|
|
+ const tree = this.$refs.docCate;
|
|
|
|
+ if (checked) {
|
|
|
|
+ this.defaultCheckedKeys.documentCate = [5, 6, 7, 8];
|
|
|
|
+ tree.setCheckedKeys(this.defaultCheckedKeys.documentCate);
|
|
|
|
+ } else {
|
|
|
|
+ this.defaultCheckedKeys.documentCate = [];
|
|
|
|
+ tree.setCheckedKeys([]);
|
|
|
|
+ }
|
|
|
|
+ this.allChecked.docCate = checked;
|
|
},
|
|
},
|
|
|
|
|
|
handleSourceDataCheck() {
|
|
handleSourceDataCheck() {
|
|
const tree = this.$refs.sourceDataTree;
|
|
const tree = this.$refs.sourceDataTree;
|
|
|
|
+ console.log(tree);
|
|
const checkedCount = tree.getCheckedNodes(true).length;
|
|
const checkedCount = tree.getCheckedNodes(true).length;
|
|
const totalCount = this.countAllNodes(this.sourceDataCate);
|
|
const totalCount = this.countAllNodes(this.sourceDataCate);
|
|
this.allChecked.sourceDataTree =
|
|
this.allChecked.sourceDataTree =
|
|
checkedCount === totalCount && totalCount > 0;
|
|
checkedCount === totalCount && totalCount > 0;
|
|
},
|
|
},
|
|
|
|
+ /* 原始数据分类 */
|
|
initSourceDataCate() {
|
|
initSourceDataCate() {
|
|
let _this = this;
|
|
let _this = this;
|
|
- searchSourceDataCategory({ page: 1, pageSize: 9999, status: 5 }).then(
|
|
|
|
- (res) => {
|
|
|
|
- if (res.status != 200) return;
|
|
|
|
- _this.sourceDataCate = res.data.sourcecategories.map((res) => {
|
|
|
|
- let item = {
|
|
|
|
- id: res.id,
|
|
|
|
- label: res.name,
|
|
|
|
- name: res.name,
|
|
|
|
- children: [
|
|
|
|
- {
|
|
|
|
- action: "view",
|
|
|
|
- cateId: res.id,
|
|
|
|
- value: "view-source-data" + res.id,
|
|
|
|
- type: "sourceCate",
|
|
|
|
- isMain: true,
|
|
|
|
- name: "查看",
|
|
|
|
- label: "查看",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- action: "create",
|
|
|
|
- cateId: res.id,
|
|
|
|
- value: "create-source-data" + res.id,
|
|
|
|
- type: "sourceCate",
|
|
|
|
- isMain: true,
|
|
|
|
- name: "创建",
|
|
|
|
- label: "创建",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- action: "edit",
|
|
|
|
- cateId: res.id,
|
|
|
|
- value: "edit-source-data" + res.id,
|
|
|
|
- type: "sourceCate",
|
|
|
|
- isMain: true,
|
|
|
|
- name: "编辑",
|
|
|
|
- label: "编辑",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- action: "delete",
|
|
|
|
- cateId: res.id,
|
|
|
|
- value: "delete-source-data" + res.id,
|
|
|
|
- type: "sourceCate",
|
|
|
|
- isMain: true,
|
|
|
|
- name: "删除",
|
|
|
|
- label: "删除",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- };
|
|
|
|
- return item;
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
|
|
+ selectPermissions({ content_type_id: 3 }).then((res) => {
|
|
|
|
+ if (res.status !== 200) return;
|
|
|
|
+ _this.sourceDataCate = res.data;
|
|
|
|
+ });
|
|
},
|
|
},
|
|
/* 全选文档分类 */
|
|
/* 全选文档分类 */
|
|
handleDocAllChange(treeRef) {
|
|
handleDocAllChange(treeRef) {
|
|
@@ -330,68 +332,57 @@ export default {
|
|
const totalCount = this.countAllNodes(this.documentCate);
|
|
const totalCount = this.countAllNodes(this.documentCate);
|
|
this.allChecked.docCate = checkedCount === totalCount && totalCount > 0;
|
|
this.allChecked.docCate = checkedCount === totalCount && totalCount > 0;
|
|
},
|
|
},
|
|
|
|
+ /* 文档分类 */
|
|
initDocCategory() {
|
|
initDocCategory() {
|
|
let _this = this;
|
|
let _this = this;
|
|
- searchDocumentCategory({ page: 1, pageSize: 9999, status: 5 }).then(
|
|
|
|
|
|
+ selectPermissions({ content_type_id: 2 }).then((res) => {
|
|
|
|
+ if (res.status !== 200) return;
|
|
|
|
+ _this.documentCate = res.data;
|
|
|
|
+ });
|
|
|
|
+ /* searchDocumentCategory({ page: 1, pageSize: 9999, status: 5 }).then(
|
|
(res) => {
|
|
(res) => {
|
|
if (res.status != 200) return;
|
|
if (res.status != 200) return;
|
|
- _this.documentCate = res.data.dataList.map((res) => {
|
|
|
|
- let item = {
|
|
|
|
- id: res.id,
|
|
|
|
- label: res.name,
|
|
|
|
- name: res.name,
|
|
|
|
- children: [
|
|
|
|
- {
|
|
|
|
- action: "view",
|
|
|
|
- cateId: res.id,
|
|
|
|
- type: "docCate",
|
|
|
|
- value: "view-doc-cate-" + res.id,
|
|
|
|
- isMain: true,
|
|
|
|
- name: "查看",
|
|
|
|
- label: "查看",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- action: "create",
|
|
|
|
- cateId: res.id,
|
|
|
|
- type: "docCate",
|
|
|
|
- value: "create-doc-cate-" + res.id,
|
|
|
|
- isMain: true,
|
|
|
|
- name: "创建",
|
|
|
|
- label: "创建",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- action: "edit",
|
|
|
|
- cateId: res.id,
|
|
|
|
- type: "docCateg",
|
|
|
|
- value: "edit-doc-cate-" + res.id,
|
|
|
|
- isMain: true,
|
|
|
|
- name: "编辑",
|
|
|
|
- label: "编辑",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- action: "delete",
|
|
|
|
- cateId: res.id,
|
|
|
|
- type: "docCateg",
|
|
|
|
- value: "delete-doc-cate-" + res.id,
|
|
|
|
- isMain: true,
|
|
|
|
- name: "删除",
|
|
|
|
- label: "删除",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- };
|
|
|
|
- return item;
|
|
|
|
- });
|
|
|
|
|
|
+ _this.documentCate = [
|
|
|
|
+ {
|
|
|
|
+ action: "view",
|
|
|
|
+ type: "docCate",
|
|
|
|
+ isMain: true,
|
|
|
|
+ name: "查看",
|
|
|
|
+ label: "查看",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ action: "create",
|
|
|
|
+ type: "docCate",
|
|
|
|
+ isMain: true,
|
|
|
|
+ name: "创建",
|
|
|
|
+ label: "创建",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ action: "edit",
|
|
|
|
+ type: "docCateg",
|
|
|
|
+ isMain: true,
|
|
|
|
+ name: "编辑",
|
|
|
|
+ label: "编辑",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ action: "delete",
|
|
|
|
+ type: "docCateg",
|
|
|
|
+ isMain: true,
|
|
|
|
+ name: "删除",
|
|
|
|
+ label: "删除",
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
}
|
|
}
|
|
- );
|
|
|
|
|
|
+ ); */
|
|
},
|
|
},
|
|
- /* 全选模版分类 */
|
|
|
|
|
|
+ /* 全选模版分类
|
|
handleTemplateAllChange(treeRef) {
|
|
handleTemplateAllChange(treeRef) {
|
|
const tree = this.$refs[treeRef];
|
|
const tree = this.$refs[treeRef];
|
|
const data = this.templateCate;
|
|
const data = this.templateCate;
|
|
tree.setCheckedNodes(
|
|
tree.setCheckedNodes(
|
|
this.allChecked[treeRef] ? this.flattenTree(data) : []
|
|
this.allChecked[treeRef] ? this.flattenTree(data) : []
|
|
);
|
|
);
|
|
- },
|
|
|
|
|
|
+ },*/
|
|
|
|
|
|
handleTemplateCheck() {
|
|
handleTemplateCheck() {
|
|
const tree = this.$refs.templateCate;
|
|
const tree = this.$refs.templateCate;
|
|
@@ -421,71 +412,16 @@ export default {
|
|
//初始化模板分类
|
|
//初始化模板分类
|
|
initTemplateCate() {
|
|
initTemplateCate() {
|
|
let _this = this;
|
|
let _this = this;
|
|
- getAllCategory({}).then((res) => {
|
|
|
|
- if (res.status != 200) return;
|
|
|
|
- _this.templateCate = res.data.map((item) => {
|
|
|
|
- let data = {
|
|
|
|
- id: item.parent.id,
|
|
|
|
- label: item.parent.name,
|
|
|
|
- name: item.parent.name,
|
|
|
|
- children: item.children.map((subItem) => {
|
|
|
|
- return {
|
|
|
|
- id: subItem.id,
|
|
|
|
- name: subItem.name,
|
|
|
|
- label: subItem.name,
|
|
|
|
- children: [
|
|
|
|
- {
|
|
|
|
- action: "view",
|
|
|
|
- cateId: subItem.id,
|
|
|
|
- pCateId: item.parent.id,
|
|
|
|
- isMain: true,
|
|
|
|
- value: "view-template-cate-" + subItem.id,
|
|
|
|
- type: "templateCategory",
|
|
|
|
- name: "查看",
|
|
|
|
- label: "查看",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- action: "create",
|
|
|
|
- cateId: subItem.id,
|
|
|
|
- pCateId: item.parent.id,
|
|
|
|
- isMain: true,
|
|
|
|
- value: "create-template-cate-" + subItem.id,
|
|
|
|
- type: "templateCategory",
|
|
|
|
- name: "创建",
|
|
|
|
- label: "创建",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- action: "edit",
|
|
|
|
- cateId: subItem.id,
|
|
|
|
- pCateId: item.parent.id,
|
|
|
|
- isMain: true,
|
|
|
|
- value: "edit-template-cate-" + subItem.id,
|
|
|
|
- type: "templateCategory",
|
|
|
|
- name: "编辑",
|
|
|
|
- label: "编辑",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- action: "delete",
|
|
|
|
- cateId: subItem.id,
|
|
|
|
- pCateId: item.parent.id,
|
|
|
|
- isMain: true,
|
|
|
|
- value: "delete-template-cate-" + subItem.id,
|
|
|
|
- type: "templateCategory",
|
|
|
|
- name: "删除",
|
|
|
|
- label: "删除",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- };
|
|
|
|
- }),
|
|
|
|
- };
|
|
|
|
- return data;
|
|
|
|
- });
|
|
|
|
|
|
+ selectPermissions({ content_type_id: 1 }).then((res) => {
|
|
|
|
+ if (res.status !== 200) return;
|
|
|
|
+ _this.templateCate = res.data;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
/* 权限配置全选 */
|
|
/* 权限配置全选 */
|
|
- handleCheckAllChange(treeRef) {
|
|
|
|
|
|
+ handleCheckAllChange(treeRef, checked = true) {
|
|
const tree = this.$refs[treeRef];
|
|
const tree = this.$refs[treeRef];
|
|
- tree.setCheckedNodes(this.allChecked[treeRef] ? this.treeData : []);
|
|
|
|
|
|
+ tree.setCheckedNodes(checked ? this.treeData : []);
|
|
|
|
+ this.allChecked.nodeTree = checked;
|
|
},
|
|
},
|
|
|
|
|
|
handleNodeCheck() {
|
|
handleNodeCheck() {
|
|
@@ -586,19 +522,29 @@ export default {
|
|
btnSave(e) {
|
|
btnSave(e) {
|
|
let _this = this;
|
|
let _this = this;
|
|
let items = _this.$refs.nodeTree.getCheckedNodes();
|
|
let items = _this.$refs.nodeTree.getCheckedNodes();
|
|
- /*
|
|
|
|
|
|
+
|
|
let templateCate = _this.$refs.templateCate.getCheckedNodes();
|
|
let templateCate = _this.$refs.templateCate.getCheckedNodes();
|
|
let docCate = _this.$refs.docCate.getCheckedNodes();
|
|
let docCate = _this.$refs.docCate.getCheckedNodes();
|
|
let sourceDataTree = _this.$refs.sourceDataTree.getCheckedNodes();
|
|
let sourceDataTree = _this.$refs.sourceDataTree.getCheckedNodes();
|
|
|
|
|
|
- templateCate = templateCate.filter((o) => o.isMain);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ let operation_id;
|
|
|
|
+ templateCate = templateCate.map((el) => {
|
|
|
|
+ operation_id = el.id;
|
|
|
|
+ return { operation_id: el.id };
|
|
|
|
+ });
|
|
|
|
+ docCate = docCate.map((el) => {
|
|
|
|
+ el.operation_id = el.id;
|
|
|
|
+ return { operation_id: el.id };
|
|
|
|
+ });
|
|
|
|
+ sourceDataTree = sourceDataTree.map((el) => {
|
|
|
|
+ el.operation_id = el.id;
|
|
|
|
+ return { operation_id: el.id };
|
|
|
|
+ });
|
|
|
|
|
|
_this.dataForm.template_cate_auth = JSON.stringify(templateCate);
|
|
_this.dataForm.template_cate_auth = JSON.stringify(templateCate);
|
|
_this.dataForm.doc_cate_auth = JSON.stringify(docCate);
|
|
_this.dataForm.doc_cate_auth = JSON.stringify(docCate);
|
|
_this.dataForm.source_cate_auth = JSON.stringify(sourceDataTree);
|
|
_this.dataForm.source_cate_auth = JSON.stringify(sourceDataTree);
|
|
- */ let pickedItem = items.filter((o) => o.sub == true);
|
|
|
|
|
|
+ let pickedItem = items.filter((o) => o.sub == true);
|
|
_this.dataForm.authList = JSON.stringify(pickedItem);
|
|
_this.dataForm.authList = JSON.stringify(pickedItem);
|
|
let data = { ..._this.dataForm };
|
|
let data = { ..._this.dataForm };
|
|
data.attrs = JSON.stringify(data.attrs);
|
|
data.attrs = JSON.stringify(data.attrs);
|
|
@@ -642,44 +588,35 @@ export default {
|
|
} else {
|
|
} else {
|
|
_this.$refs.nodeTree.setCheckedNodes([]);
|
|
_this.$refs.nodeTree.setCheckedNodes([]);
|
|
}
|
|
}
|
|
- /*
|
|
|
|
|
|
+
|
|
let tempCate = res.data.templateCategoryUsers; //JSON.parse();
|
|
let tempCate = res.data.templateCategoryUsers; //JSON.parse();
|
|
if (tempCate.length > 0) {
|
|
if (tempCate.length > 0) {
|
|
- _this.$refs.templateCate.setCheckedNodes(tempCate);
|
|
|
|
|
|
+ _this.$refs.templateCate.setCheckedKeys(
|
|
|
|
+ tempCate.map((el) => (el.type == 1 ? el.id : ""))
|
|
|
|
+ );
|
|
} else {
|
|
} else {
|
|
- _this.$refs.templateCate.setCheckedNodes([]);
|
|
|
|
|
|
+ _this.$refs.templateCate.setCheckedKeys([]);
|
|
}
|
|
}
|
|
|
|
|
|
let sourceCate = res.data.source_cate_auth; //JSON.parse();
|
|
let sourceCate = res.data.source_cate_auth; //JSON.parse();
|
|
if (sourceCate.length > 0) {
|
|
if (sourceCate.length > 0) {
|
|
- let list = sourceCate.flatMap((el) =>
|
|
|
|
- el.children.map((e) => {
|
|
|
|
- if (e.isMain == "True") {
|
|
|
|
- e.isMain = true;
|
|
|
|
- }
|
|
|
|
- return e;
|
|
|
|
- })
|
|
|
|
|
|
+ _this.$refs.sourceDataTree.setCheckedKeys(
|
|
|
|
+ sourceCate.map((el) => (el.type == 1 ? el.id : ""))
|
|
);
|
|
);
|
|
- _this.$refs.sourceDataTree.setCheckedNodes(list);
|
|
|
|
} else {
|
|
} else {
|
|
- _this.$refs.sourceDataTree.setCheckedNodes([]);
|
|
|
|
|
|
+ _this.$refs.sourceDataTree.setCheckedKeys([]);
|
|
}
|
|
}
|
|
|
|
|
|
- let docCate = res.data.doc_cate_auth; //JSON.parse();
|
|
|
|
|
|
+ // 设置文档分类树的默认选中节点
|
|
|
|
+ let docCate = res.data.doc_cate_auth;
|
|
if (docCate.length > 0) {
|
|
if (docCate.length > 0) {
|
|
- let list = docCate.flatMap((el) =>
|
|
|
|
- el.children.map((e) => {
|
|
|
|
- if (e.isMain == "True") {
|
|
|
|
- e.isMain = true;
|
|
|
|
- }
|
|
|
|
- return e;
|
|
|
|
- })
|
|
|
|
|
|
+ _this.$refs.docCate.setCheckedKeys(
|
|
|
|
+ docCate.map((el) => (el.type == 1 ? el.id : ""))
|
|
);
|
|
);
|
|
- _this.$refs.docCate.setCheckedNodes(list);
|
|
|
|
} else {
|
|
} else {
|
|
- _this.$refs.docCate.setCheckedNodes([]);
|
|
|
|
|
|
+ _this.$refs.docCate.setCheckedKeys([]);
|
|
}
|
|
}
|
|
- */
|
|
|
|
|
|
+
|
|
// _this.$refs.docCate.setCheckedNodes(JSON.parse(res.data.doc_cate_auth));
|
|
// _this.$refs.docCate.setCheckedNodes(JSON.parse(res.data.doc_cate_auth));
|
|
// _this.$refs.sourceDataTree.setCheckedNodes(JSON.parse(res.data.source_cate_auth));
|
|
// _this.$refs.sourceDataTree.setCheckedNodes(JSON.parse(res.data.source_cate_auth));
|
|
});
|
|
});
|