refactor(物料管理): 统一状态选项的值类型和默认值
- 将物料和物料分类的状态选项值类型统一为数字 - 修正物料分类状态选项的绑定值 - 调整默认状态值为数字类型
This commit is contained in:
@@ -46,7 +46,7 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
const dataList = computed(() => {
|
||||
if (props.config) {
|
||||
if (props.config && typeof props.config === 'object' && props.config.label && props.config.value && props.options) {
|
||||
let config = props.config
|
||||
var newList = []
|
||||
|
||||
@@ -58,7 +58,7 @@ const dataList = computed(() => {
|
||||
}
|
||||
return newList
|
||||
}
|
||||
return props.options
|
||||
return props.options || []
|
||||
})
|
||||
const values = computed(() => {
|
||||
if (props.value !== null && typeof props.value !== 'undefined') {
|
||||
|
||||
@@ -164,8 +164,9 @@
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio :label="1">停用</el-radio>
|
||||
<el-radio :label="2">启用</el-radio>
|
||||
<el-radio v-for="item in options.statusOptions" :key="item.dictValue" :value="item.dictValue">
|
||||
{{ item.dictLabel }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -294,7 +295,7 @@ const state = reactive({
|
||||
single: true,
|
||||
multiple: true,
|
||||
form: {
|
||||
status: 2
|
||||
status: '1'
|
||||
},
|
||||
rules: {
|
||||
materialCode: [{ required: true, message: '物料编码不能为空', trigger: 'blur' }],
|
||||
@@ -326,11 +327,11 @@ const state = reactive({
|
||||
],
|
||||
statusOptions: [
|
||||
{
|
||||
dictValue: '0',
|
||||
dictValue: '停用',
|
||||
dictLabel: '停用'
|
||||
},
|
||||
{
|
||||
dictValue: '1',
|
||||
dictValue: '启用',
|
||||
dictLabel: '启用'
|
||||
}
|
||||
]
|
||||
@@ -359,7 +360,7 @@ function reset() {
|
||||
supplierCode: null,
|
||||
supplierName: null,
|
||||
safetyStock: null,
|
||||
status: null,
|
||||
status: '1',
|
||||
createdTime: null,
|
||||
updatedTime: null,
|
||||
description: null
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="状态(0/1)" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="item in options.statusOptions" :key="item.dictValue" :value="item.dictValue">
|
||||
<el-radio v-for="item in options.statusOptions" :key="item.dictValue" :value="item.dictLabel">
|
||||
{{ item.dictLabel }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
@@ -232,7 +232,7 @@ const state = reactive({
|
||||
single: true,
|
||||
multiple: true,
|
||||
form: {
|
||||
status: '1'
|
||||
status: 1
|
||||
},
|
||||
rules: {
|
||||
categoryCode: [{ required: true, message: '分类编码不能为空', trigger: 'blur' }],
|
||||
@@ -242,11 +242,11 @@ const state = reactive({
|
||||
// 状态(0/1) 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
|
||||
statusOptions: [
|
||||
{
|
||||
dictValue: '0',
|
||||
dictValue: 0,
|
||||
dictLabel: '停用'
|
||||
},
|
||||
{
|
||||
dictValue: '1',
|
||||
dictValue: 1,
|
||||
dictLabel: '启用'
|
||||
}
|
||||
]
|
||||
@@ -270,7 +270,7 @@ function reset() {
|
||||
parentCode: null,
|
||||
levelNo: null,
|
||||
description: null,
|
||||
status: '1', // 设置默认值为'1'(启用)
|
||||
status: 1, // 设置默认值为'1'(启用)
|
||||
createdTime: null,
|
||||
updatedTime: null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user