diff --git a/lang/en/admin.php b/lang/en/admin.php index 274a6bf9..8fd0b7fd 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -46,8 +46,8 @@ 'order_desc' => 'Order Desc', 'order_asc' => 'Order Asc', 'menus' => 'Menus', - 'successfully' => '成功', - 'failed' => '失败', + 'successfully' => 'Successfully', + 'failed' => 'Failed', 'successfully_message' => ':attribute Successfully', 'failed_message' => ':attribute Failed', 'action_success' => 'Action Success', @@ -124,6 +124,12 @@ 'import_record' => 'Import Record', 'import_record_placeholder' => 'Please enter the imported json record', 'import_record_desc' => 'You can find some records shared by others on Github', + 'load_config' => 'Load Config', + 'load_component_config' => 'Load :c Config', + 'fill' => 'Fill', + 'save_current_config' => 'Save Current Config', + 'input_config_name' => 'Please Input Config Name', + 'same_name_tips' => 'Configurations with the same name will be overwritten', ], 'admin_users' => 'Admin Users', diff --git a/lang/zh_CN/admin.php b/lang/zh_CN/admin.php index 1f93a28f..b807315e 100644 --- a/lang/zh_CN/admin.php +++ b/lang/zh_CN/admin.php @@ -124,6 +124,12 @@ 'import_record' => '导入记录', 'import_record_placeholder' => '请输入导入的json记录', 'import_record_desc' => '你可以在 Github 找到一些其他人分享的记录', + 'load_config' => '加载配置', + 'load_component_config' => '加载 :c 配置', + 'fill' => '填充', + 'save_current_config' => '保存当前配置', + 'input_config_name' => '请填写配置名称', + 'same_name_tips' => '相同名称的配置将会被覆盖' ], 'admin_users' => '管理员', diff --git a/src/Controllers/DevTools/CodeGeneratorController.php b/src/Controllers/DevTools/CodeGeneratorController.php index a593b14f..7afdd5aa 100644 --- a/src/Controllers/DevTools/CodeGeneratorController.php +++ b/src/Controllers/DevTools/CodeGeneratorController.php @@ -104,8 +104,7 @@ public function list() amis()->TableColumn('table_name', __('admin.code_generators.table_name')), amis()->TableColumn('updated_at', __('admin.updated_at'))->sortable(), $this->rowActions([ - amis() - ->AjaxAction() + amis()->AjaxAction() ->label(__('admin.code_generators.generate_code')) ->level('link') ->confirmText(__('admin.code_generators.confirm_generate_code')) @@ -127,15 +126,13 @@ public function list() ]) ) ->icon('fa fa-code'), - amis() - ->DialogAction() + amis()->DialogAction() ->label(__('admin.code_generators.copy_record')) ->icon('fa fa-copy') ->level('link') ->dialog( amis()->Dialog()->title(false)->body( - amis() - ->Form() + amis()->Form() ->initApi('post:/dev_tools/code_generator/get_record?id=${id}') ->mode('normal') ->body( @@ -146,23 +143,20 @@ public function list() ), )->actions([ amis()->VanillaAction()->actionType('cancel')->label(__('admin.cancel')), - amis() - ->CopyAction() + amis()->CopyAction() ->label(__('admin.copy')) ->level('success') ->content('${ENCODEJSON(record)}'), ]) ), - amis() - ->DialogAction() + amis()->DialogAction() ->label(__('admin.code_generators.preview')) ->icon('fa fa-eye') ->level('link') ->dialog( $this->previewCodeDialog() ), - amis() - ->DialogAction() + amis()->DialogAction() ->label(__('admin.edit')) ->icon('fa-regular fa-pen-to-square') ->level('link') @@ -712,59 +706,66 @@ public function getPropertyOptions(Request $request) ]); $cacheAction = amis()->Flex()->justify('start')->items([ - amis()->DialogAction()->className('mr-3')->label('加载配置')->level('primary')->dialog( - amis()->Dialog() - ->title("加载{$request->c}配置") - ->actions([]) - ->id('load_config_dialog') - ->closeOnOutside() - ->body( - amis()->Service() - ->name('component_property_list_service') - ->api('post:/dev_tools/code_generator/component_property/list?key=' . $comboName . '&c=' . $request->c) - ->body( - amis()->Table()->source('${component_property_list}')->columns([ - amis()->TableColumn('label'), - - amis()->Operation()->buttons([ - amis()->VanillaAction()->label('填充')->level('primary')->onEvent([ - 'click' => [ - 'actions' => [ - [ - 'actionType' => 'setValue', - 'componentId' => $comboId, - 'args' => ['value' => '${value}',], - ], - [ - 'actionType' => 'closeDialog', - 'componentId' => 'load_config_dialog', + amis()->DialogAction() + ->className('mr-3') + ->label(__('admin.code_generators.load_config')) + ->level('primary') + ->dialog( + amis()->Dialog() + ->title(__('admin.code_generators.load_component_config', ['c' => $request->c])) + ->actions([]) + ->id('load_config_dialog') + ->closeOnOutside() + ->body( + amis()->Service() + ->name('component_property_list_service') + ->api('post:/dev_tools/code_generator/component_property/list?key=' . $comboName . '&c=' . $request->c) + ->body( + amis()->Table()->source('${component_property_list}')->columns([ + amis()->TableColumn('label'), + + amis()->Operation()->buttons([ + amis()->VanillaAction() + ->label(__('admin.code_generators.fill')) + ->level('primary') + ->onEvent([ + 'click' => [ + 'actions' => [ + [ + 'actionType' => 'setValue', + 'componentId' => $comboId, + 'args' => ['value' => '${value}',], + ], + [ + 'actionType' => 'closeDialog', + 'componentId' => 'load_config_dialog', + ], + ], ], - ], - ], - ]), - - amis()->AjaxAction() - ->label('删除') - ->level('danger') - ->confirmText(__('admin.confirm_delete')) - ->reload('component_property_list_service') - ->api('post:/dev_tools/code_generator/component_property/del?name=' . $comboName), - ])->set('width', 150), - ]) - ) - ) - ), + ]), + + amis()->AjaxAction() + ->label(__('admin.delete')) + ->level('danger') + ->confirmText(__('admin.confirm_delete')) + ->reload('component_property_list_service') + ->api('post:/dev_tools/code_generator/component_property/del?name=' . $comboName), + ])->set('width', 150), + ]) + ) + ) + ), - amis()->DialogAction()->label('保存当前配置')->level('success')->dialog( - amis()->Dialog()->title('保存当前配置')->body( + amis()->DialogAction()->label(__('admin.code_generators.save_current_config'))->level('success')->dialog( + amis()->Dialog()->title(__('admin.code_generators.save_current_config'))->body( amis()->Form()->mode('normal')->api('post:/dev_tools/code_generator/component_property')->body([ amis()->HiddenControl('key')->value($comboName), amis()->ComboControl('value')->items([ amis()->TextControl('label') ->inline(false) ->required() - ->placeholder('请输入组件配置名称') - ->description('相同名称的配置将会被覆盖'), + ->placeholder(__('admin.code_generators.input_config_name')) + ->description(__('admin.code_generators.same_name_tips')), amis()->HiddenControl('key')->value($request->c), amis()->HiddenControl('value')->value('${' . $comboName . '}'), ]),