This commit is contained in:
u2nyakim 2025-08-22 18:02:56 +08:00
parent a6d9063d52
commit 41600443ed
2 changed files with 13 additions and 0 deletions

View File

@ -19,6 +19,9 @@ export function strToValue(type: string, value: string): any {
return value.split(","); return value.split(",");
case 'text': case 'text':
case 'textarea': case 'textarea':
case 'date':
case 'datetime':
return null;
default: default:
return value return value
} }
@ -54,6 +57,10 @@ export function strToBind(type: string, option: string): any {
case 'text': case 'text':
case 'textarea': case 'textarea':
case 'checkbox': case 'checkbox':
case 'date':
return {format: 'YYYY-MM-DD'}
case 'datetime':
return {format: 'YYYY-MM-DD HH:mm:ss'}
default: default:
if (option) { if (option) {
return JSON.parse(option); return JSON.parse(option);

View File

@ -40,6 +40,12 @@
<el-radio v-for="item in (dataOptions || [])" :label="item.label" :value="item.value" /> <el-radio v-for="item in (dataOptions || [])" :label="item.label" :value="item.value" />
</el-radio-group> </el-radio-group>
</template> </template>
<template v-else-if="props.type === 'date'">
<el-date-picker v-model="dataValue" type="date" :placeholder="'请选择' + props.title" v-bind="dataBind"/>
</template>
<template v-else-if="props.type === 'datetime'">
<el-date-picker v-model="dataValue" type="datetime" :placeholder="'请选择' + props.title" v-bind="dataBind"/>
</template>
</el-form-item> </el-form-item>
</template> </template>