This commit is contained in:
u2nyakim 2025-08-22 17:50:07 +08:00
parent 3da7dee576
commit fc409477d6
3 changed files with 16 additions and 3 deletions

View File

@ -41,6 +41,8 @@ class ConfigController extends BaseController
'group'=> '', 'group'=> '',
'bind'=>'' 'bind'=>''
]); ]);
$data['v_bind'] = $this->request->post('vBind');
$user = new SysConfig(); $user = new SysConfig();
$user->save($data); $user->save($data);
@ -49,7 +51,7 @@ class ConfigController extends BaseController
public function update() public function update()
{ {
$data = $this->request->post([ $data = $this->request->put([
'id' => 0, 'id' => 0,
'title' => '', 'title' => '',
'value' => '', 'value' => '',
@ -59,8 +61,9 @@ class ConfigController extends BaseController
'name' => '', 'name' => '',
'comments' => '', 'comments' => '',
'group'=> '', 'group'=> '',
'bind'=>''
]); ]);
$data['v_bind'] = $this->request->put('vBind');
$user = SysConfig::findOrFail($data['id']); $user = SysConfig::findOrFail($data['id']);
$user->save($data); $user->save($data);

View File

@ -33,6 +33,7 @@ export function strToOption(type: string, option: string): any {
case 'text': case 'text':
case 'textarea': case 'textarea':
case 'checkbox': case 'checkbox':
case 'radio':
default: default:
if (option) { if (option) {
return JSON.parse(option); return JSON.parse(option);

View File

@ -37,6 +37,15 @@
</template> </template>
</el-checkbox-group> </el-checkbox-group>
</template> </template>
<template v-else-if="props.type === 'radio'">
<el-checkbox-group v-model="dataValue" v-bind="dataBind">
<template v-if="dataOptions">
<el-checkbox v-for="item in dataOptions" :label="item.label" :value="item.value" />
</template>
</el-checkbox-group>
</template>
</el-form-item> </el-form-item>
</template> </template>
@ -57,7 +66,7 @@ const dataValue = ref<any>();
const dataOptions = ref<any>() const dataOptions = ref<any>()
const dataBind = ref<any>({}) const dataBind = ref<any>({})
onMounted(() => { onMounted(() => {
dataBind.value = strToBind(props.type, props.bind); dataBind.value = props.vBind ? strToBind(props.type, props.vBind) : {};
dataValue.value = strToValue(props.type, props.value); dataValue.value = strToValue(props.type, props.value);
dataOptions.value = strToOption(props.type, props.options); dataOptions.value = strToOption(props.type, props.options);