删除权限

This commit is contained in:
砂糖
2025-07-19 17:29:15 +08:00
parent 245bc4973b
commit 5bd163d8cd
19 changed files with 253 additions and 221 deletions

View File

@@ -17,7 +17,7 @@
</template>
<script>
import { listCategory } from '@/api/wms/category';
import { mapState, mapActions } from 'vuex';
export default {
name: 'CategorySelect',
@@ -55,30 +55,29 @@ export default {
},
data() {
return {
categoryOptions: [],
innerValue: this.value
};
},
computed: {
...mapState('category', ['categoryList']),
categoryOptions() {
return this.categoryList.filter(
item => item.categoryType === this.categoryType && item.isEnabled === 1
);
}
},
watch: {
value(val) {
this.innerValue = val;
},
categoryType: {
handler() {
this.loadOptions();
},
immediate: true
}
},
mounted() {
this.loadOptions();
created() {
if (!this.categoryList || this.categoryList.length === 0) {
this.getCategoryList();
}
},
methods: {
loadOptions() {
listCategory({ categoryType: this.categoryType, isEnabled: 1 }).then(res => {
this.categoryOptions = res.rows || [];
});
},
...mapActions('category', ['getCategoryList']),
onChange(val) {
this.$emit('input', val);
this.$emit('change', val);

View File

@@ -0,0 +1,28 @@
<template>
<span v-if="category">
<slot :category="category">
{{ category.categoryName }}
</slot>
</span>
<span v-else>--</span>
</template>
<script>
import { mapState } from 'vuex';
export default {
name: 'CategoryRenderer',
props: {
categoryId: {
type: [String, Number],
required: true
}
},
computed: {
...mapState('category', ['categoryList']),
category() {
return this.categoryList.find(cat => String(cat.categoryId) === String(this.categoryId));
}
}
};
</script>