|
|
@@ -8,7 +8,7 @@
|
|
|
v-for="(item, index) in props.algoList"
|
|
|
:key="index"
|
|
|
class="algo-item"
|
|
|
- :class="{ active: selectedIds.includes(item.id) }"
|
|
|
+ :class="{ active: selectedIds.includes(item.id), disabled: true }"
|
|
|
@click="handleAlgoSelect(item)"
|
|
|
>
|
|
|
<span class="algo-name">{{ item.name }}</span>
|
|
|
@@ -19,8 +19,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+ import { useUserStore } from '@/store/modules/user';
|
|
|
+ import { PERM_ALGO } from '@/types/permission/constants';
|
|
|
import { ElCard } from 'element-plus';
|
|
|
- import { defineEmits } from 'vue';
|
|
|
+ import { computed, defineEmits } from 'vue';
|
|
|
const emit = defineEmits<{
|
|
|
(e: 'select', data: number): void;
|
|
|
}>();
|
|
|
@@ -31,13 +33,18 @@
|
|
|
|
|
|
const props = defineProps<{ algoList: AlgoItemLabel[]; selectedIds: number[] }>();
|
|
|
|
|
|
+ const userStore = useUserStore();
|
|
|
+
|
|
|
// 处理方法
|
|
|
const handleAlgoSelect = (item: AlgoItemLabel) => {
|
|
|
+ if (!hasAddPermission.value) return;
|
|
|
const hasId = props.selectedIds.includes(item.id);
|
|
|
if (!hasId) {
|
|
|
emit('select', item.id);
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ const hasAddPermission = computed(() => false && userStore.checkPermission(PERM_ALGO.CONFIG_ADD));
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
@@ -70,6 +77,11 @@
|
|
|
background: #1890ff;
|
|
|
color: #fff;
|
|
|
border-color: #1890ff;
|
|
|
+ cursor: not-allowed;
|
|
|
+ }
|
|
|
+ &.disabled {
|
|
|
+ cursor: not-allowed;
|
|
|
+ opacity: 0.5;
|
|
|
}
|
|
|
}
|
|
|
}
|