更新完善字典相关功能

This commit is contained in:
2026-02-18 17:15:33 +08:00
parent 5450777bd7
commit 378b9bd71f
23 changed files with 1657 additions and 572 deletions

View File

@@ -20,7 +20,7 @@
<!-- 状态 -->
<a-form-item label="状态" name="status">
<a-switch v-model:checked="statusChecked" checked-children="启用" un-checked-children="禁用" />
<sc-select v-model:value="form.status" source-type="dictionary" dictionary-code="dictionary_status" placeholder="请选择状态" allow-clear />
</a-form-item>
<!-- 描述 -->
@@ -43,6 +43,7 @@
<script setup>
import { ref, computed, watch } from 'vue'
import { message } from 'ant-design-vue'
import scSelect from '@/components/scSelect/index.vue'
import systemApi from '@/api/system'
// ===== Props =====
@@ -79,18 +80,10 @@ const form = ref({
name: '',
code: '',
description: '',
status: true,
status: null,
sort: 0
})
// ===== 计算属性:状态开关 =====
const statusChecked = computed({
get: () => form.value.status === true,
set: (val) => {
form.value.status = val ? true : false
}
})
// ===== 验证规则 =====
// 编码唯一性验证
const validateCodeUnique = async (rule, value) => {
@@ -131,7 +124,7 @@ const resetForm = () => {
name: '',
code: '',
description: '',
status: true,
status: null,
sort: 0
}
formRef.value?.clearValidate()
@@ -145,7 +138,7 @@ const setData = (data) => {
name: data.name || '',
code: data.code || '',
description: data.description || '',
status: data.status !== undefined ? data.status : true,
status: data.status !== undefined ? data.status : null,
sort: data.sort !== undefined ? data.sort : 0
}
}