v3.14.0 更新;【新增】EasyExcel重磅升级为FastExcel;【新增】使用最强Argon2算法作为密码存储;【新增】大家吐槽的数据字典改为可重复;【新增】前端布局再增加多种样式;

This commit is contained in:
zhuoda
2025-03-12 21:30:24 +08:00
parent e74f179a91
commit fecb3a9d81
207 changed files with 4260 additions and 2019 deletions

View File

@@ -20,7 +20,12 @@
@change="onChange"
:disabled="disabled"
>
<a-select-option v-for="item in dictValueList" :key="item.valueCode" :value="item.valueCode">
<a-select-option
v-for="item in dictValueList"
:key="item.valueCode"
:value="item.valueCode"
:disabled="disabledOption.includes(item.valueCode)"
>
{{ item.valueName }}
</a-select-option>
</a-select>
@@ -28,7 +33,7 @@
</template>
<script setup>
import { computed, onMounted, ref, watch } from 'vue';
import { onMounted, ref, watch } from 'vue';
import { dictApi } from '/@/api/support/dict-api';
const props = defineProps({
@@ -50,10 +55,21 @@
type: String,
default: 'default',
},
// 禁用整个下拉选择框
disabled: {
type: Boolean,
default: false,
},
// 需要禁用的选项字典值编码
disabledOption: {
type: Array,
default: () => [],
},
// 需要隐藏的选项字典值编码
hiddenOption: {
type: Array,
default: () => [],
},
});
// -------------------------- 查询 字典数据 --------------------------
@@ -61,7 +77,7 @@
const dictValueList = ref([]);
async function queryDict() {
let res = await dictApi.valueList(props.keyCode);
dictValueList.value = res.data;
dictValueList.value = res.data.filter((item) => !props.hiddenOption.includes(item.valueCode));
}
onMounted(queryDict);
@@ -69,26 +85,24 @@
// -------------------------- 选中 相关、事件 --------------------------
const selectValue = ref(props.value);
watch(
() => props.value,
(value) => {
selectValue.value = value;
}
(newValue) => {
// 如果传入的值是被禁用或被隐藏的选项,则移除这些选项
if (Array.isArray(newValue)) {
selectValue.value = newValue.filter((item) => !props.disabledOption.includes(item) && !props.hiddenOption.includes(item));
} else {
selectValue.value = props.hiddenOption.includes(newValue) || props.disabledOption.includes(newValue) ? undefined : newValue;
}
},
{ immediate: true }
);
const emit = defineEmits(['update:value', 'change']);
function onChange(value) {
if (!value) {
emit('update:value', []);
emit('change', []);
return;
}
if (Array.isArray(value)) {
emit('update:value', value);
emit('change', value);
} else {
emit('update:value', value);
emit('change', value);
}
emit('update:value', value);
emit('change', value);
}
</script>