Browse Source

新增频道列表

zhangrenyuan/feature-20251104133449-现金管理二期
ZhangYong 3 weeks ago
parent
commit
459190a218
  1. 36
      src/views/permissions/rolePermission.vue

36
src/views/permissions/rolePermission.vue

@ -9,6 +9,7 @@ import { storeToRefs } from "pinia"
const adminStore = useAdminStore(); const adminStore = useAdminStore();
const { adminData, menuTree } = storeToRefs(adminStore); const { adminData, menuTree } = storeToRefs(adminStore);
import { permissionMapping, findMenuById } from "@/utils/menuTreePermission.js" import { permissionMapping, findMenuById } from "@/utils/menuTreePermission.js"
import { tr } from 'element-plus/es/locales.mjs'
// ref // ref
const Ref = ref(null) const Ref = ref(null)
@ -35,7 +36,7 @@ const addRole = ref({
market: '' market: ''
}) })
const addRoleMarket = ref([]) const addRoleMarket = ref([])
const channelList = ref(['美股', '港股', 'hc第一频道'])
const getRoleList = async function (val) { const getRoleList = async function (val) {
if (!findMenuById(menuTree.value, permissionMapping.view_role_information)) { if (!findMenuById(menuTree.value, permissionMapping.view_role_information)) {
ElMessage.error('无此权限') ElMessage.error('无此权限')
@ -317,6 +318,7 @@ const handleEditRolePermissionCheck = (checkedNodes, checkedInfo) => {
// //
if (allCheckedNodes.length === 0) { if (allCheckedNodes.length === 0) {
permissionEditRoleObj.value.checkedKeys = [] permissionEditRoleObj.value.checkedKeys = []
ifHasChannel.value = false
return return
} }
@ -326,13 +328,22 @@ const handleEditRolePermissionCheck = (checkedNodes, checkedInfo) => {
console.log('编辑角色选中的权限ID:', checkedKeys) console.log('编辑角色选中的权限ID:', checkedKeys)
console.log('选中的节点数量:', allCheckedNodes.length) console.log('选中的节点数量:', allCheckedNodes.length)
if (checkedKeys.includes(124)||checkedKeys.includes(125)||checkedKeys.includes(126)||checkedKeys.includes(127)) {
ifHasChannel.value = true
} else {
ifHasChannel.value = false
}
}; };
//
const ifHasChannel = ref(false)
const handleCheckChange = async (checkedNodes, checkedInfo) => { const handleCheckChange = async (checkedNodes, checkedInfo) => {
const { checkedKeys, checkedNodes: allCheckedNodes } = checkedInfo const { checkedKeys, checkedNodes: allCheckedNodes } = checkedInfo
// //
if (allCheckedNodes.length === 0) { if (allCheckedNodes.length === 0) {
addRole.value.checkedKeys = [] addRole.value.checkedKeys = []
ifHasChannel.value = false
return return
} }
@ -348,6 +359,12 @@ const handleCheckChange = async (checkedNodes, checkedInfo) => {
// Set // Set
addRole.value.checkedKeys = Array.from(allKeys) addRole.value.checkedKeys = Array.from(allKeys)
console.log('新增角色包含所有父级的选中项:', addRole.value.checkedKeys) console.log('新增角色包含所有父级的选中项:', addRole.value.checkedKeys)
if (addRole.value.checkedKeys.includes(124)) {
ifHasChannel.value = true
console.log('勾选了频道');
} else {
ifHasChannel.value = false
}
} }
const selectParentNodes = (treeData, nodeId, checkedKeys) => { const selectParentNodes = (treeData, nodeId, checkedKeys) => {
if (!Array.isArray(treeData)) return false if (!Array.isArray(treeData)) return false
@ -636,9 +653,9 @@ onMounted(async function () {
</div> </div>
<div style="margin-top: 20px;display: flex;"> <div style="margin-top: 20px;display: flex;">
<el-pagination background :current-page="getRoleObj.pageNum" :page-size="getRoleObj.pageSize" :page-sizes="[5, 10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper" :total="roleTotal" @size-change="handleRolePageSizeChange"
@current-change="handleRoleCurrentChange"></el-pagination>
<el-pagination background :current-page="getRoleObj.pageNum" :page-size="getRoleObj.pageSize"
:page-sizes="[5, 10, 20, 50, 100]" layout="total, sizes, prev, pager, next, jumper" :total="roleTotal"
@size-change="handleRolePageSizeChange" @current-change="handleRoleCurrentChange"></el-pagination>
</div> </div>
</el-card> </el-card>
</div> </div>
@ -686,6 +703,11 @@ onMounted(async function () {
<span style="color: #999;">暂无数据</span> <span style="color: #999;">暂无数据</span>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-show="ifHasChannel" prop="channel" label="频道名称:" required>
<el-select v-model="addRole.channel" placeholder="请选择频道" style="width: 220px" clearable>
<el-option v-for="item in channelList" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
</el-form> </el-form>
<div> <div>
@ -729,6 +751,12 @@ onMounted(async function () {
<span style="color: #999;">暂无数据</span> <span style="color: #999;">暂无数据</span>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-show="ifHasChannel" prop="channel" label="频道名称:" required>
<el-select v-model="permissionEditRoleObj.channel" placeholder="请选择频道" style="width: 220px" clearable>
<el-option v-for="item in channelList" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
</el-form> </el-form>
<div> <div>

Loading…
Cancel
Save