|
@@ -5,7 +5,7 @@ import {
|
|
|
httpUpdate,
|
|
|
httpDetail
|
|
|
} from "/@/api/interest/action";
|
|
|
-import { reactive, ref, onMounted, computed } from "vue";
|
|
|
+import { reactive, ref, onMounted, computed, nextTick } from "vue";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
|
|
import { useNav } from "/@/layout/hooks/nav";
|
|
@@ -16,6 +16,7 @@ defineOptions({
|
|
|
|
|
|
const roleList = ref([]);
|
|
|
const loading = ref(true);
|
|
|
+const backupMenuactionList = ref([]);
|
|
|
const menuactionList = ref([]);
|
|
|
const editType = ref("add");
|
|
|
const action_list = ref([]);
|
|
@@ -126,6 +127,14 @@ const handleFieldChange = (checked, id, index, subIndex, item) => {
|
|
|
// this.$set(menuactionList.value, index, item);
|
|
|
// console.log(menuactionList.value[index].child[subIndex]);
|
|
|
};
|
|
|
+//选择角色
|
|
|
+const switchRoleHandle = async item => {
|
|
|
+ const { id } = item;
|
|
|
+ ruleForm.roleid = id;
|
|
|
+ await nextTick(async () => {
|
|
|
+ await refreshRoleDetail(id);
|
|
|
+ });
|
|
|
+};
|
|
|
// 保存
|
|
|
const submitForm = async () => {
|
|
|
action_list.value = [];
|
|
@@ -174,6 +183,7 @@ const getMenuAll = async () => {
|
|
|
if (code === 0) {
|
|
|
let arr = JSON.parse(JSON.stringify(data ?? []));
|
|
|
arr = arr.filter(item => item.child && item.child.length > 0);
|
|
|
+
|
|
|
arr = arr.map(x => {
|
|
|
x.child.map(y => {
|
|
|
y.checkAll = false;
|
|
@@ -199,7 +209,8 @@ const getMenuAll = async () => {
|
|
|
});
|
|
|
return x;
|
|
|
});
|
|
|
- menuactionList.value = arr;
|
|
|
+ backupMenuactionList.value = arr;
|
|
|
+ // menuactionList.value = arr;
|
|
|
} else if (code > 100 && code < 140) {
|
|
|
logout();
|
|
|
} else {
|
|
@@ -242,43 +253,17 @@ const refreshRoleDetail = async roleid => {
|
|
|
};
|
|
|
// 刷新选择状态
|
|
|
const refreshRoleCheckAllStatus = async () => {
|
|
|
- const list = JSON.parse(JSON.stringify(menuactionList.value));
|
|
|
- let arr = list.filter(item => item.child && item.child.length > 0);
|
|
|
- arr = arr.map(x => {
|
|
|
- x.child.map(y => {
|
|
|
- y.checkAll = false;
|
|
|
- y.checkList = [];
|
|
|
- y.fieldAll = false;
|
|
|
- y.fieldList = [];
|
|
|
- y.is_private_change = "0";
|
|
|
- if (y.is_private === "0") {
|
|
|
- y.private = [];
|
|
|
- } else {
|
|
|
- y.private = [
|
|
|
- {
|
|
|
- id: "0",
|
|
|
- label: "公有数据"
|
|
|
- },
|
|
|
- {
|
|
|
- id: "1",
|
|
|
- label: "私有数据"
|
|
|
- }
|
|
|
- ];
|
|
|
- }
|
|
|
- return y;
|
|
|
- });
|
|
|
- return x;
|
|
|
- });
|
|
|
- this.actionList = arr;
|
|
|
- this.actionList.forEach((x, xi) => {
|
|
|
+ menuactionList.value = JSON.parse(JSON.stringify(backupMenuactionList.value));
|
|
|
+ console.log(private_data_list.value);
|
|
|
+ menuactionList.value.forEach((x, xi) => {
|
|
|
if (x.child && x.child.length > 0) {
|
|
|
x.child.forEach((y, yi) => {
|
|
|
- let id = y.id;
|
|
|
+ // let id = y.id;
|
|
|
if (y.action && y.action.length > 0) {
|
|
|
y.action.forEach(z => {
|
|
|
- const Aindex = this.action.findIndex(a => a === z.id);
|
|
|
+ const Aindex = action_list.value.findIndex(a => a === z.id);
|
|
|
if (Aindex !== -1) {
|
|
|
- y.checkList.push(this.action[Aindex]);
|
|
|
+ y.checkList.push(action_list.value[Aindex]);
|
|
|
}
|
|
|
if (y.action.length === y.checkList.length) {
|
|
|
y.checkAll = true;
|
|
@@ -287,9 +272,9 @@ const refreshRoleCheckAllStatus = async () => {
|
|
|
}
|
|
|
if (y.action_data && y.action_data.length > 0) {
|
|
|
y.action_data.map(z => {
|
|
|
- const Bindex = this.action_data.findIndex(a => a === z.id);
|
|
|
+ const Bindex = action_data_list.value.findIndex(a => a === z.id);
|
|
|
if (Bindex !== -1) {
|
|
|
- y.fieldList.push(this.action_data[Bindex]);
|
|
|
+ y.fieldList.push(action_data_list.value[Bindex]);
|
|
|
}
|
|
|
});
|
|
|
if (y.action_data.length === y.fieldList.length) {
|
|
@@ -297,7 +282,10 @@ const refreshRoleCheckAllStatus = async () => {
|
|
|
}
|
|
|
}
|
|
|
if (y.private && y.private.length === 2) {
|
|
|
- let Cindex = this.private_data.findIndex(a => a === y.id);
|
|
|
+ let Cindex =
|
|
|
+ private_data_list.value.length > 0
|
|
|
+ ? private_data_list.value.findIndex(a => a === y.id)
|
|
|
+ : -1;
|
|
|
if (Cindex !== -1) {
|
|
|
y.is_private_change = "1";
|
|
|
} else {
|
|
@@ -308,7 +296,7 @@ const refreshRoleCheckAllStatus = async () => {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- this.$set(this.actionList, xi, x);
|
|
|
+ // this.$set(this.actionList, xi, x);
|
|
|
});
|
|
|
};
|
|
|
async function onSearch() {
|
|
@@ -368,12 +356,12 @@ onMounted(() => {
|
|
|
<div class="action_show_box">
|
|
|
<ul class="role-list">
|
|
|
<p class="role-list__title">角色列表</p>
|
|
|
- <!-- :class="{ active: item.id == roleActive.id }" -->
|
|
|
- <!-- @click="!isBtnDisabled && switchRoleHandle(item)" -->
|
|
|
+ <!-- -->
|
|
|
+ <!-- -->
|
|
|
<!-- v-if="isBtnDisabled && item.id == roleActive.id" -->
|
|
|
<p
|
|
|
v-if="roleList.length == 0"
|
|
|
- style="line-height: 60px; text-align: center; color: #909399"
|
|
|
+ style="line-height: 60px; text-align: center; color: #858599"
|
|
|
>
|
|
|
暂无数据
|
|
|
</p>
|
|
@@ -381,9 +369,12 @@ onMounted(() => {
|
|
|
v-for="(item, index) in roleList"
|
|
|
:key="'role' + index"
|
|
|
class="role-list__item"
|
|
|
+ :class="{ active: item.id == ruleForm.roleid }"
|
|
|
+ @click="!loading && switchRoleHandle(item)"
|
|
|
>
|
|
|
{{ item.role_name }}
|
|
|
<el-button
|
|
|
+ v-if="loading && item.id == ruleForm.roleid"
|
|
|
class="fr"
|
|
|
link
|
|
|
:size="'mini'"
|
|
@@ -392,7 +383,7 @@ onMounted(() => {
|
|
|
</li>
|
|
|
</ul>
|
|
|
<div class="rule-view">
|
|
|
- <div class="rule-list">
|
|
|
+ <div class="rule-list" style="padding: 0 0 100px 0">
|
|
|
<el-row
|
|
|
v-for="(item, index) in menuactionList"
|
|
|
:key="'menu' + item.id + index"
|
|
@@ -561,7 +552,7 @@ onMounted(() => {
|
|
|
</div>
|
|
|
|
|
|
<div class="rule-bottom">
|
|
|
- <el-button size="small" class="fr" type="primary" @click="submitForm"
|
|
|
+ <el-button size="small" type="primary" @click="submitForm"
|
|
|
>提 交</el-button
|
|
|
>
|
|
|
</div>
|
|
@@ -571,23 +562,27 @@ onMounted(() => {
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
.action {
|
|
|
- height: calc(100vh - 84px);
|
|
|
+ height: calc(100vh - 85px);
|
|
|
position: relative;
|
|
|
background: #fff;
|
|
|
width: 100%;
|
|
|
text-align: center;
|
|
|
+ overflow: hidden;
|
|
|
.action_show {
|
|
|
position: relative;
|
|
|
width: 100%;
|
|
|
- height: calc(100vh - 122px);
|
|
|
+ height: calc(100vh - 85px);
|
|
|
.rule-bottom {
|
|
|
- padding: 18px 16px 0 18%;
|
|
|
- background: #fff;
|
|
|
- width: 100%;
|
|
|
- text-align: left;
|
|
|
+ padding: 20px 30px 8px 0;
|
|
|
+ // background: #fff;
|
|
|
+ // width: 100px;
|
|
|
+ text-align: right;
|
|
|
+ position: fixed;
|
|
|
+ right: 0px;
|
|
|
+ bottom: 0px;
|
|
|
&::before {
|
|
|
content: "";
|
|
|
- position: absolute;
|
|
|
+
|
|
|
top: 0;
|
|
|
right: 0;
|
|
|
height: 2px;
|
|
@@ -598,8 +593,10 @@ onMounted(() => {
|
|
|
}
|
|
|
.action_show_box {
|
|
|
position: relative;
|
|
|
- height: calc(100% - 50px);
|
|
|
- min-height: calc(100% - 50px);
|
|
|
+ height: 100%;
|
|
|
+ // calc(100% - 50px);
|
|
|
+ min-height: 100%;
|
|
|
+ //calc(100% - 50px);
|
|
|
|
|
|
display: flex;
|
|
|
text-align: left;
|