|
@@ -5,7 +5,7 @@
|
|
|
class="permissionSettingDialog"
|
|
|
:visible.sync="show"
|
|
|
:close-on-click-modal="false"
|
|
|
- width="1000px"
|
|
|
+ width="1400px"
|
|
|
top="8vh"
|
|
|
>
|
|
|
<div v-loading="loading" class="ps_area">
|
|
@@ -42,13 +42,20 @@
|
|
|
@click="changeTagType('admin-sidebar')"
|
|
|
>平台侧边栏</span
|
|
|
>
|
|
|
+ <span
|
|
|
+ :class="{ pa_a_h_active: tagType == 'admin-school' }"
|
|
|
+ @click="changeTagType('admin-school')"
|
|
|
+ v-if="type == 'org'"
|
|
|
+ >学校设置</span
|
|
|
+ >
|
|
|
+ <!-- v-if="data.parentid" -->
|
|
|
</div>
|
|
|
<div class="ea_add">
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
- v-if="['admin-sidebar'].includes(tagType)"
|
|
|
+ v-if="['admin-sidebar', 'admin-school'].includes(tagType)"
|
|
|
type="primary"
|
|
|
- @click="addMenu()"
|
|
|
+ @click="addMenu(tagType)"
|
|
|
>添加菜单</el-button
|
|
|
>
|
|
|
<el-button
|
|
@@ -1020,6 +1027,158 @@
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div
|
|
|
+ class="editArea pa_a_eb_admin-sidebar"
|
|
|
+ v-show="tagType == 'admin-school'"
|
|
|
+ >
|
|
|
+ <div class="ea_table">
|
|
|
+ <el-table
|
|
|
+ :data="form.admin.school.list"
|
|
|
+ stripe
|
|
|
+ border
|
|
|
+ style="width: 100%"
|
|
|
+ row-key="typeId"
|
|
|
+ :header-cell-style="headerCellStyle"
|
|
|
+ :tree-props="{
|
|
|
+ children: 'children',
|
|
|
+ hasChildren: 'hasChildren',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ label="菜单名称"
|
|
|
+ min-width="200"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">{{
|
|
|
+ scope.row.menuName ? scope.row.menuName : "-"
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="菜单默认图标"
|
|
|
+ min-width="200"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-image
|
|
|
+ v-if="scope.row.menuIcon"
|
|
|
+ style="width: 50px; height: 50px"
|
|
|
+ :src="scope.row.menuIcon"
|
|
|
+ fit="cover"
|
|
|
+ >
|
|
|
+ <div slot="error" class="image-slot">
|
|
|
+ <i class="el-icon-picture-outline"></i>
|
|
|
+ </div>
|
|
|
+ </el-image>
|
|
|
+ <span v-else>-</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="学校名称"
|
|
|
+ min-width="200"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">{{
|
|
|
+ scope.row.name ? scope.row.name : "-"
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="编码"
|
|
|
+ min-width="100"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">{{
|
|
|
+ scope.row.code ? scope.row.code : "-"
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="组织名称"
|
|
|
+ min-width="300"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">{{
|
|
|
+ scope.row.orgName ? scope.row.orgName : "-"
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ width="320px"
|
|
|
+ fixed="right"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <button
|
|
|
+ @click="addSchool(scope.row.id)"
|
|
|
+ v-if="scope.row.menuName"
|
|
|
+ style="
|
|
|
+ color: #308fff;
|
|
|
+ background: none;
|
|
|
+ border: none;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-left: 25px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 添加学校
|
|
|
+ </button>
|
|
|
+
|
|
|
+ <button
|
|
|
+ @click="editMenu(scope.row)"
|
|
|
+ v-if="scope.row.s"
|
|
|
+ style="
|
|
|
+ color: #308fff;
|
|
|
+ background: none;
|
|
|
+ border: none;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-left: 25px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </button>
|
|
|
+ <button
|
|
|
+ @click="moveUp(scope.row, scope.row.typeId)"
|
|
|
+ style="
|
|
|
+ color: #308fff;
|
|
|
+ background: none;
|
|
|
+ border: none;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-left: 25px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 上移
|
|
|
+ </button>
|
|
|
+ <button
|
|
|
+ @click="moveDown(scope.row, scope.row.typeId)"
|
|
|
+ style="
|
|
|
+ color: #308fff;
|
|
|
+ background: none;
|
|
|
+ border: none;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-left: 25px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 下移
|
|
|
+ </button>
|
|
|
+
|
|
|
+ <button
|
|
|
+ @click="del(scope.row, scope.row.typeId)"
|
|
|
+ style="
|
|
|
+ color: #ff2570;
|
|
|
+ background: none;
|
|
|
+ border: none;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-left: 25px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 按钮区域 -->
|
|
@@ -1032,6 +1191,11 @@
|
|
|
<addMenuDialog ref="addMenuDialogRef" @success="addMenuSuccess" />
|
|
|
<selectAppDialog ref="selectAppDialogRef" @success="selectAppSuccess" />
|
|
|
<addBannerDialog ref="addBannerDialogRef" @success="addBannerSuccess" />
|
|
|
+ <selectSchoolDialog
|
|
|
+ ref="selectSchoolDialogRef"
|
|
|
+ @success="selectSchoolSuccess"
|
|
|
+ :id="data?data.id:''"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -1043,7 +1207,7 @@ import addMenuDialog from "./addMenuDialog.vue";
|
|
|
import { addOp } from "@/api/user";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import selectAppDialog from "./selectAppDialog.vue";
|
|
|
-
|
|
|
+import selectSchoolDialog from "./selectSchoolDialog.vue";
|
|
|
import addBannerDialog from "./addBannerDialog";
|
|
|
export default {
|
|
|
components: {
|
|
@@ -1051,6 +1215,7 @@ export default {
|
|
|
addMenuDialog,
|
|
|
selectAppDialog,
|
|
|
addBannerDialog,
|
|
|
+ selectSchoolDialog,
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(["userid"]),
|
|
@@ -1083,6 +1248,9 @@ export default {
|
|
|
sidebar: {
|
|
|
list: [],
|
|
|
},
|
|
|
+ school: {
|
|
|
+ list: [],
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -1092,12 +1260,14 @@ export default {
|
|
|
this.init();
|
|
|
let _data = JSON.parse(JSON.stringify(data));
|
|
|
if (_data.json) {
|
|
|
- this.form = JSON.parse(_data.json);
|
|
|
+ let _form = JSON.parse(_data.json);
|
|
|
+ if (!_form.admin.school) {
|
|
|
+ _form.admin.school = { list: [] };
|
|
|
+ }
|
|
|
+ this.form = _form;
|
|
|
}
|
|
|
- // this.getToolData();
|
|
|
Promise.all([this.getToolData(), this.getAppData()])
|
|
|
.then(() => {
|
|
|
- // console.log(JSON.parse(JSON.stringify([this.toolList,this.appList])))
|
|
|
this.setDataListToo(this.toolList, this.appList);
|
|
|
})
|
|
|
.catch((e) => {
|
|
@@ -1132,6 +1302,9 @@ export default {
|
|
|
sidebar: {
|
|
|
list: [],
|
|
|
},
|
|
|
+ school: {
|
|
|
+ list: [],
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
this.type = null;
|
|
@@ -1363,6 +1536,36 @@ export default {
|
|
|
const itemToMove = this.form.admin.banner.splice(_index, 1)[0];
|
|
|
this.form.admin.banner.splice(_index - 1, 0, itemToMove);
|
|
|
}
|
|
|
+ } else if (this.tagType == "admin-school") {
|
|
|
+ let typeIdList = typeId.split("-");
|
|
|
+ console.log(typeIdList);
|
|
|
+ if (typeIdList.length == 1) {
|
|
|
+ let _index = this.form.admin.school.list.findIndex(
|
|
|
+ (i) => i.typeId == typeIdList[0]
|
|
|
+ );
|
|
|
+ if (_index > 0) {
|
|
|
+ const itemToMove = this.form.admin.school.list.splice(_index, 1)[0];
|
|
|
+ this.form.admin.school.list.splice(_index - 1, 0, itemToMove);
|
|
|
+ }
|
|
|
+ } else if (typeIdList.length == 2) {
|
|
|
+ let _index = this.form.admin.school.list.findIndex(
|
|
|
+ (i) => i.typeId == typeIdList[0]
|
|
|
+ );
|
|
|
+ let _index2 = this.form.admin.school.list[_index].children.findIndex(
|
|
|
+ (i) => i.code == typeIdList[1]
|
|
|
+ );
|
|
|
+ console.log(_index2);
|
|
|
+ if (_index2 > 0) {
|
|
|
+ const itemToMove = this.form.admin.school.list[
|
|
|
+ _index
|
|
|
+ ].children.splice(_index2, 1)[0];
|
|
|
+ this.form.admin.school.list[_index].children.splice(
|
|
|
+ _index2 - 1,
|
|
|
+ 0,
|
|
|
+ itemToMove
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
moveDown(row, typeId) {
|
|
@@ -1421,6 +1624,37 @@ export default {
|
|
|
const itemToMove = this.form.admin.banner.splice(_index, 1)[0];
|
|
|
this.form.admin.banner.splice(_index + 1, 0, itemToMove);
|
|
|
}
|
|
|
+ } else if (this.tagType == "admin-school") {
|
|
|
+ let typeIdList = typeId.split("-");
|
|
|
+ if (typeIdList.length == 1) {
|
|
|
+ let _index = this.form.admin.school.list.findIndex(
|
|
|
+ (i) => i.typeId == typeIdList[0]
|
|
|
+ );
|
|
|
+ if (_index < this.form.admin.school.list.length - 1) {
|
|
|
+ const itemToMove = this.form.admin.school.list.splice(_index, 1)[0];
|
|
|
+ this.form.admin.school.list.splice(_index + 1, 0, itemToMove);
|
|
|
+ }
|
|
|
+ } else if (typeIdList.length == 2) {
|
|
|
+ let _index = this.form.admin.school.list.findIndex(
|
|
|
+ (i) => i.typeId == typeIdList[0]
|
|
|
+ );
|
|
|
+ let _index2 = this.form.admin.school.list[_index].children.findIndex(
|
|
|
+ (i) => i.code == typeIdList[1]
|
|
|
+ );
|
|
|
+ if (
|
|
|
+ _index2 <
|
|
|
+ this.form.admin.school.list[_index].children.length - 1
|
|
|
+ ) {
|
|
|
+ const itemToMove = this.form.admin.school.list[
|
|
|
+ _index
|
|
|
+ ].children.splice(_index2, 1)[0];
|
|
|
+ this.form.admin.school.list[_index].children.splice(
|
|
|
+ _index2 + 1,
|
|
|
+ 0,
|
|
|
+ itemToMove
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
del(row, typeId) {
|
|
@@ -1453,13 +1687,28 @@ export default {
|
|
|
this.form.admin.sidebar.list[_index].children.splice(_index2, 1);
|
|
|
}
|
|
|
// this.form.admin.sidebar.list.splice(_index, 1);
|
|
|
- }else if(this.tagType == "admin-banner"){
|
|
|
- const index = this.form.admin.banner.findIndex(
|
|
|
- (i) => i.id === row.id
|
|
|
- );
|
|
|
+ } else if (this.tagType == "admin-banner") {
|
|
|
+ const index = this.form.admin.banner.findIndex((i) => i.id === row.id);
|
|
|
if (index > -1) {
|
|
|
this.form.admin.banner.splice(index, 1);
|
|
|
}
|
|
|
+ } else if (this.tagType == "admin-school") {
|
|
|
+ let typeIdList = typeId.split("-");
|
|
|
+ if (typeIdList.length == 1) {
|
|
|
+ let _index = this.form.admin.school.list.findIndex(
|
|
|
+ (i) => i.typeId == typeIdList[0]
|
|
|
+ );
|
|
|
+ this.form.admin.school.list.splice(_index, 1);
|
|
|
+ } else if (typeIdList.length == 2) {
|
|
|
+ let _index = this.form.admin.school.list.findIndex(
|
|
|
+ (i) => i.typeId == typeIdList[0]
|
|
|
+ );
|
|
|
+ let _index2 = this.form.admin.school.list[_index].children.findIndex(
|
|
|
+ (i) => i.code == typeIdList[1]
|
|
|
+ );
|
|
|
+ this.form.admin.school.list[_index].children.splice(_index2, 1);
|
|
|
+ }
|
|
|
+ // this.form.admin.sidebar.list.splice(_index, 1);
|
|
|
}
|
|
|
},
|
|
|
getToolData() {
|
|
@@ -1653,42 +1902,74 @@ export default {
|
|
|
this.form.desktop.list
|
|
|
);
|
|
|
},
|
|
|
- async addMenuSuccess({ item, type }) {
|
|
|
+ async addMenuSuccess({ item, type, tagType }) {
|
|
|
console.log(item, type);
|
|
|
- if (type == "add") {
|
|
|
- this.form.admin.sidebar.list.push(item);
|
|
|
- item.id = String(new Date().getTime());
|
|
|
- item.typeId = item.id;
|
|
|
- await addOp({
|
|
|
- uid: this.userid,
|
|
|
- cid: "",
|
|
|
- type: "user_op",
|
|
|
- content: `添加了一级菜单:${item.menuName}`,
|
|
|
- });
|
|
|
- } else if (type == "edit") {
|
|
|
- let _index = this.form.admin.sidebar.list.findIndex(
|
|
|
- (i) => i.typeId == item.typeId
|
|
|
- );
|
|
|
- if (_index != -1) {
|
|
|
- let _sidebar = JSON.parse(JSON.stringify(this.form.admin.sidebar));
|
|
|
- _sidebar.list[_index] = item;
|
|
|
- this.form.admin.sidebar = JSON.parse(JSON.stringify(_sidebar));
|
|
|
- this.$forceUpdate();
|
|
|
+ if (tagType == "admin-sidebar") {
|
|
|
+ if (type == "add") {
|
|
|
+ item.id = String(new Date().getTime());
|
|
|
+ item.typeId = item.id;
|
|
|
+ this.form.admin.sidebar.list.push(item);
|
|
|
await addOp({
|
|
|
uid: this.userid,
|
|
|
cid: "",
|
|
|
type: "user_op",
|
|
|
- content: `修改了了一级菜单:${item.menuName}`,
|
|
|
+ content: `添加了侧边栏一级菜单:${item.menuName}`,
|
|
|
});
|
|
|
+ } else if (type == "edit") {
|
|
|
+ let _index = this.form.admin.sidebar.list.findIndex(
|
|
|
+ (i) => i.typeId == item.typeId
|
|
|
+ );
|
|
|
+ if (_index != -1) {
|
|
|
+ let _sidebar = JSON.parse(JSON.stringify(this.form.admin.sidebar));
|
|
|
+ _sidebar.list[_index] = item;
|
|
|
+ this.form.admin.sidebar = JSON.parse(JSON.stringify(_sidebar));
|
|
|
+ this.$forceUpdate();
|
|
|
+ await addOp({
|
|
|
+ uid: this.userid,
|
|
|
+ cid: "",
|
|
|
+ type: "user_op",
|
|
|
+ content: `修改了侧边栏一级菜单:${item.menuName}`,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (tagType == "admin-school") {
|
|
|
+ if (type == "add") {
|
|
|
+ item.id = String(new Date().getTime());
|
|
|
+ item.typeId = item.id;
|
|
|
+ delete item.menuActiveIcon;
|
|
|
+ this.form.admin.school.list.push(item);
|
|
|
+ await addOp({
|
|
|
+ uid: this.userid,
|
|
|
+ cid: "",
|
|
|
+ type: "user_op",
|
|
|
+ content: `添加了学校一级菜单:${item.menuName}`,
|
|
|
+ });
|
|
|
+ } else if (type == "edit") {
|
|
|
+ let _index = this.form.admin.school.list.findIndex(
|
|
|
+ (i) => i.typeId == item.typeId
|
|
|
+ );
|
|
|
+ if (_index != -1) {
|
|
|
+ let _school = JSON.parse(JSON.stringify(this.form.admin.school));
|
|
|
+ _school.list[_index] = item;
|
|
|
+ this.form.admin.school = JSON.parse(JSON.stringify(_school));
|
|
|
+ this.$forceUpdate();
|
|
|
+ await addOp({
|
|
|
+ uid: this.userid,
|
|
|
+ cid: "",
|
|
|
+ type: "user_op",
|
|
|
+ content: `修改了了学校一级菜单:${item.menuName}`,
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
this.$refs.addMenuDialogRef.close();
|
|
|
},
|
|
|
- addMenu() {
|
|
|
- this.$refs.addMenuDialogRef.open();
|
|
|
+ addMenu(type) {
|
|
|
+ this.$refs.addMenuDialogRef.open("", "add", type);
|
|
|
},
|
|
|
editMenu(row) {
|
|
|
- this.$refs.addMenuDialogRef.open(row, "edit");
|
|
|
+ this.$refs.addMenuDialogRef.open(row, "edit", this.tagType);
|
|
|
},
|
|
|
addApp() {
|
|
|
this.$refs.selectAppDialogRef.open({
|
|
@@ -1714,6 +1995,22 @@ export default {
|
|
|
this.$forceUpdate();
|
|
|
this.$refs.selectAppDialogRef.close();
|
|
|
},
|
|
|
+ addSchool(id) {
|
|
|
+ console.log("👉", id);
|
|
|
+ let _children = this.form.admin.school.list.find(
|
|
|
+ (i) => i.id == id
|
|
|
+ ).children;
|
|
|
+ this.$refs.selectSchoolDialogRef.open(_children, id);
|
|
|
+ },
|
|
|
+ selectSchoolSuccess({ data, type }) {
|
|
|
+ let _data = JSON.parse(JSON.stringify(data));
|
|
|
+ _data.forEach((i) => {
|
|
|
+ delete i.json;
|
|
|
+ i.typeId = `${type}-${i.code}`
|
|
|
+ });
|
|
|
+ this.form.admin.school.list.find((i) => i.id == type).children = _data;
|
|
|
+ this.$refs.selectSchoolDialogRef.close();
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|