Skip to content

Commit a7cdf76

Browse files
committed
修复自定义扩展初始化项目文件
1 parent 1b30107 commit a7cdf76

File tree

8 files changed

+22
-128
lines changed

8 files changed

+22
-128
lines changed

src/Components/Component.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Component extends AdminJsonBuilder
1919
protected $componentValue;
2020

2121

22+
2223
public function __construct($value = null)
2324
{
2425
$this->componentValue($value);

src/Console/ExtendCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function handle()
3232

3333

3434
$this->replace('{{ namespace }}', $this->extendNamespace(), $this->extendPath() . '/src/ExtendServiceProvider.stub');
35-
$this->replace('{{ component }}', $this->extendName(), $this->extendPath() . '/src/ExtendServiceProvider.stub');
35+
$this->replace('{{ component }}', $this->extendVendor()."-".$this->extendName(), $this->extendPath() . '/src/ExtendServiceProvider.stub');
3636

3737
(new Filesystem)->move(
3838
$this->extendPath() . '/src/ExtendServiceProvider.stub',

src/Console/extend-stubs/resources/js/components/FormItemTemplate.vue

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/Console/extend-stubs/resources/js/components/FormTemplate.vue

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/Console/extend-stubs/resources/js/components/RowActionTemplate.vue

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
VueAdmin.booting((Vue, router, store) => {
2-
2+
//Vue.component('组件名称',require('./components/xxx.vue').default);
33
});

src/Controllers/MenuController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ protected function grid()
7575
->tree()
7676
->emptyText("暂无菜单")
7777
->quickSearch(["title"])
78-
->defaultExpandAll(false);
78+
->defaultExpandAll(false)
79+
->dialogForm($this->form()->isDialog()->labelPosition("top")->backButtonName("关闭"));
7980

8081
$grid->column('id', "ID")->width(80);
8182
$grid->column('icon', "图标")->component(Icon::make())->width(80);
@@ -100,10 +101,10 @@ protected function form()
100101
return SelectOption::make($item->id, $item->title);
101102
})->prepend(SelectOption::make(0, '根目录'));
102103
}));
103-
$form->item('title', '名称')->required()->inputWidth(4);
104+
$form->item('title', '名称')->required();
104105
$form->item('icon', trans('admin::admin.icon'))->component(IconChoose::make())->inputWidth(3)->required();
105106

106-
$form->item('uri', trans('admin::admin.uri'))->required()->inputWidth(4);
107+
$form->item('uri', trans('admin::admin.uri'))->required();
107108
$form->item('order', trans('admin::admin.order'))->component(InputNumber::make(1)->min(0));
108109
$form->item('roles', trans('admin::admin.roles'))->component(Select::make()->block()->multiple()->options(function () use ($roleModel) {
109110
return $roleModel::all()->map(function ($role) {

src/Form.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class Form extends Component implements JsonSerializable
5050

5151
protected $updates = [];
5252

53+
protected $isEdit = false;
54+
5355
/**
5456
* Data for save to model's relations from input.
5557
*
@@ -219,6 +221,16 @@ public function model()
219221
return $this->model;
220222
}
221223

224+
/**
225+
* @return bool
226+
*/
227+
public function isEdit()
228+
{
229+
return $this->isEdit;
230+
}
231+
232+
233+
222234
/**
223235
* 添加表单验证规则
224236
* @param $rules
@@ -284,10 +296,7 @@ public function input($key, $value = null)
284296
protected function prepare($data = [])
285297
{
286298

287-
//触发表单提交前事件
288-
if (($response = $this->callSubmitted()) instanceof Response) {
289-
return $response;
290-
}
299+
291300
//处理要过滤的字段
292301
$this->inputs = array_merge($this->removeIgnoredFields($data), $this->inputs);
293302
//处理表单提交时事件
@@ -466,6 +475,8 @@ public function destroy($id)
466475
*/
467476
public function update($id, $data = null)
468477
{
478+
$this->isEdit = true;
479+
469480
if (($result = $this->callSubmitted()) instanceof Response) {
470481
return $result;
471482
}

0 commit comments

Comments
 (0)