权限按钮处理

This commit is contained in:
ym1026
2025-09-15 15:47:38 +08:00
parent 60aa1a33ef
commit 7c2e7d4547
12 changed files with 58 additions and 39 deletions

View File

@@ -277,7 +277,6 @@
/> />
<a-tree-select <a-tree-select
:allow-clear="true"
:disabled="props.disabled" :disabled="props.disabled"
v-if="item.type === 'tree-check-org'" v-if="item.type === 'tree-check-org'"
v-model:value="propsInfo.ruleForm.value[item.key]" v-model:value="propsInfo.ruleForm.value[item.key]"
@@ -515,7 +514,11 @@ function cascaderChange(value, cascaderItem) {
function filter(inputValue, path) { function filter(inputValue, path) {
return path.some((option) => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1) return path.some((option) => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
} }
function getBase64(img, callback) {
const reader = new FileReader()
reader.addEventListener('load', () => callback(reader.result))
reader.readAsDataURL(img)
}
function avatarUploadChange(info) { function avatarUploadChange(info) {
if (info.file.status === 'uploading') { if (info.file.status === 'uploading') {
data.loading = true data.loading = true
@@ -532,11 +535,7 @@ function avatarUploadChange(info) {
function onFieldsChange() {} function onFieldsChange() {}
function handleSubmit() {} function handleSubmit() {}
function getBase64(img, callback) {
const reader = new FileReader()
reader.addEventListener('load', () => callback(reader.result))
reader.readAsDataURL(img)
}
// 主动暴露方法 // 主动暴露方法
defineExpose({ defineExpose({

View File

@@ -57,17 +57,17 @@
scroll: { y: 500 } scroll: { y: 500 }
}" }"
> >
<template #is_add="{ record, index }"> <template #is_add="{ record }">
<a-checkbox v-model:checked="record.is_add"></a-checkbox> <a-checkbox v-model:checked="record.is_add"></a-checkbox>
</template> </template>
<template #is_del="{ record, index }"> <template #is_del="{ record }">
<a-checkbox v-model:checked="record.is_del"></a-checkbox> <a-checkbox v-model:checked="record.is_del"></a-checkbox>
</template> </template>
<template #is_edit="{ record, index }"> <template #is_edit="{ record }">
<a-checkbox v-model:checked="record.is_edit"></a-checkbox> <a-checkbox v-model:checked="record.is_edit"></a-checkbox>
</template> </template>
<template #is_view="{ record, index }"> <template #is_view="{ record }">
<a-checkbox v-model:checked="record.is_view"></a-checkbox> <a-checkbox v-model:checked="record.is_view"></a-checkbox>
</template> </template>
</TreeTable> </TreeTable>

View File

@@ -29,28 +29,28 @@ export default {
return { return {
curList: [ curList: [
{ {
name: '光伏设备告警', name: '光伏设备告警',
key: 'solar_num_err', key: 'solar_num_err',
lineColor: '#22E4FF', lineColor: '#22E4FF',
value: 1111, value: 1111,
d: '' d: ''
}, },
{ {
name: '储能设备告警', name: '储能设备告警',
key: 'storage_num_err', key: 'storage_num_err',
lineColor: '#0E68E4', lineColor: '#0E68E4',
value: 0, value: 0,
d: '' d: ''
}, },
{ {
name: '充电设备告警', name: '充电设备告警',
key: 'charge_num_err', key: 'charge_num_err',
lineColor: '#00BAAD', lineColor: '#00BAAD',
value: 0, value: 0,
d: '' d: ''
}, },
// { // {
// name: '负荷设备告警', // name: '负荷设备告警',
// key: 'key4', // key: 'key4',
// lineColor: '#FF8D1A', // lineColor: '#FF8D1A',
// value: 0, // value: 0,

View File

@@ -30,7 +30,7 @@ export default {
return { return {
curList: [ curList: [
{ {
name: '充电电量', name: '充电电量',
key: 'charge_elect', key: 'charge_elect',
lineColor: '#00BBA3', lineColor: '#00BBA3',
colorStart: ' rgba(10, 250, 106, 0.15)', colorStart: ' rgba(10, 250, 106, 0.15)',
@@ -39,7 +39,7 @@ export default {
d: 'kW·h' d: 'kW·h'
}, },
{ {
name: '充电次数', name: '充电次数',
key: 'charge_num', key: 'charge_num',
lineColor: '#3F80F2', lineColor: '#3F80F2',
colorStart: ' rgba(99, 151, 235, 0.3)', colorStart: ' rgba(99, 151, 235, 0.3)',
@@ -50,7 +50,7 @@ export default {
], ],
curListEcharts: [ curListEcharts: [
{ {
name: '充电电量', name: '充电电量',
key: 'charge_elect', key: 'charge_elect',
lineColor: '#00BBA3', lineColor: '#00BBA3',
colorStart: ' rgba(10, 250, 106, 0.15)', colorStart: ' rgba(10, 250, 106, 0.15)',
@@ -59,7 +59,7 @@ export default {
d: 'kW·h' d: 'kW·h'
}, },
{ {
name: '充电收益', name: '充电收益',
key: 'income_charge', key: 'income_charge',
lineColor: '#3F80F2', lineColor: '#3F80F2',
colorStart: ' rgba(99, 151, 235, 0.3)', colorStart: ' rgba(99, 151, 235, 0.3)',

View File

@@ -33,14 +33,14 @@ export default {
uid:'1', uid:'1',
curList: [ curList: [
{ {
name: '充电电量', name: '充电电量',
key: 'storage_elect_in', key: 'storage_elect_in',
lineColor: '#22E4FF', lineColor: '#22E4FF',
value: 0, value: 0,
d: 'kW·h' d: 'kW·h'
}, },
{ {
name: '放电电量', name: '放电电量',
key: 'storage_elect_out', key: 'storage_elect_out',
lineColor: '#0E68E4', lineColor: '#0E68E4',
value: 0, value: 0,

View File

@@ -12,7 +12,7 @@
:props-info="modalInfo[item.infoKey]" :props-info="modalInfo[item.infoKey]"
:props-total=" :props-total="
['prefab', 'dataTotal'].includes(item.infoKey) ['prefab', 'dataTotal'].includes(item.infoKey)
? item.key == 'prefab' ? item.infoKey == 'prefab'
? modalInfo.prefabTotal ? modalInfo.prefabTotal
: modalInfo.dataTotal : modalInfo.dataTotal
: modalInfo.allTotal : modalInfo.allTotal

View File

@@ -19,14 +19,14 @@ export default {
return { return {
curList: [ curList: [
{ {
name: '充电电量', name: '充电电量',
key: 'storage_elect_in', key: 'storage_elect_in',
lineColor: '#9BD801', lineColor: '#9BD801',
value: 0, value: 0,
d: 'kW·h' d: 'kW·h'
}, },
{ {
name: '放电电量', name: '放电电量',
key: 'storage_elect_out', key: 'storage_elect_out',
lineColor: '#3DFEFA', lineColor: '#3DFEFA',
value: 0, value: 0,

View File

@@ -31,14 +31,14 @@ export default {
return { return {
curList: [ curList: [
{ {
name: '发电量', name: '发电量',
key: 'solar_elect_gen', key: 'solar_elect_gen',
lineColor: '#22E4FF', lineColor: '#22E4FF',
value: 0, value: 0,
d: 'kW·h' d: 'kW·h'
}, },
{ {
name: '入网电量', name: '入网电量',
key: 'solar_elect_grid', key: 'solar_elect_grid',
lineColor: '#0E68E4', lineColor: '#0E68E4',
value: 0, value: 0,

View File

@@ -97,12 +97,12 @@ $page-border: #cad2dd;
opacity: 0.8; opacity: 0.8;
} }
&:active { &:active {
background: #0f6f6a; background: $btn-confirm;
} }
&:disabled { &:disabled {
border: none; border: none;
// color: #fff; color: #fff;
background: $btn-confirm; background: $btn-confirm;
} }
} }
@@ -115,6 +115,11 @@ $page-border: #cad2dd;
&:active { &:active {
background: $btn-del; background: $btn-del;
} }
&:disabled {
border: none;
color: #fff;
background: $btn-del;
}
} }
.btn-edit { .btn-edit {
background: $btn-edit; background: $btn-edit;
@@ -125,6 +130,11 @@ $page-border: #cad2dd;
&:active { &:active {
background: $btn-edit; background: $btn-edit;
} }
&:disabled {
border: none;
color: #fff;
background: $btn-edit;
}
} }
//modal样式 //modal样式
// 删除弹框 // 删除弹框

View File

@@ -5,23 +5,33 @@ const btnList = [
{ label: '修改', type: 'edit', disFlag: 'is_edit' }, { label: '修改', type: 'edit', disFlag: 'is_edit' },
{ label: '删除', type: 'del', disFlag: 'is_del', icon: 'icon-del' } { label: '删除', type: 'del', disFlag: 'is_del', icon: 'icon-del' }
] ]
function findNodeByRoute(tree, targetRoute) {
for (const node of tree) {
if (node.route === targetRoute) {
return node // 找到目标节点
}
if (node.children && node.children.length > 0) {
const found = findNodeByRoute(node.children, targetRoute) // 递归检查子节点
if (found) return found
}
}
return null // 未找到
}
function getBtns(arr) { function getBtns(arr) {
// console.log(this.$route, JSON.parse(localStorage.getItem('permission')), 'this.$route') const curPermission = findNodeByRoute(JSON.parse(localStorage.getItem('permission')), '/user')
// const curPermission = // console.log(findNodeByRoute(JSON.parse(localStorage.getItem('permission')), '/user'), '55')
// JSON.parse(localStorage.getItem('permission')).find(
// (item) => item.route == '/' + this.$route.name
// ) || {}
// console.log(this.$route, curPermission, localStorage.getItem('permission'), 'curPermission') // console.log(this.$route, curPermission, localStorage.getItem('permission'), 'curPermission')
const btns = [] const btns = []
// console.log(curPermission, 'curPermission') // console.log(curPermission, 'curPermission')
btnList.forEach((item) => { btnList.forEach((item) => {
if (arr.includes(item.label)) { if (arr.includes(item.label)) {
// item.disabled = !Boolean(+curPermission[item.disFlag]) // item.disabled = true
item.disabled = !Boolean(+curPermission[item.disFlag])
btns.push(item) btns.push(item)
} }
}) })
return btns return btns
} }
export { btnList, getBtns } export { btnList, getBtns }

View File

@@ -18,7 +18,7 @@
:title-option="{ title: '', info: '' }" :title-option="{ title: '', info: '' }"
@onSearch="onSearch" @onSearch="onSearch"
> >
<template #stationSelect="item"> <template #stationSelect="">
<a-select <a-select
style="width: 200px" style="width: 200px"
:dropdown-match-select-width="false" :dropdown-match-select-width="false"

View File

@@ -119,9 +119,9 @@ export default {
this.getStatDayList(3) this.getStatDayList(3)
]).then((r) => { ]).then((r) => {
if ( if (
this.deviceInfo.energy.length && this.deviceInfo.energy &&
this.deviceInfo.charge.length && this.deviceInfo.charge &&
this.deviceInfo.pv.length this.deviceInfo.pv
) { ) {
const newArr = this.mergedArray( const newArr = this.mergedArray(
this.deviceInfo.energy, this.deviceInfo.energy,