Skip to content

Commit adaf823

Browse files
committed
添加HTML组件
添加Card组件 添加Steps组件 添加Grid 头部 顶部 自定义组件 修改Grid树形展示
1 parent 13f7992 commit adaf823

31 files changed

+731
-89
lines changed

config/admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
],
9999
//操作日志
100100
'operation_log' => [
101-
'enable' => true,
101+
'enable' => false,
102102
/*
103103
* Only logging allowed methods in the list
104104
*/

docs/components.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,52 @@
88
className('class-1 class-2');
99
style(['width'=>'100px']);
1010
```
11+
## 展示组件
12+
13+
### 步骤条
14+
15+
引导用户按照流程完成任务的分步导航条,可根据实际应用场景设定步骤,步骤不得少于 2 步。
16+
17+
```php
18+
Steps::make()
19+
->simple(false)
20+
->active($order->orderStep())
21+
->processStatus("process")
22+
->alignCenter(true)
23+
->stepList(function (Collection $list) use ($order) {
24+
//下单
25+
$xd = Step::make()->title("下单");
26+
$xd->description($order->created_at);
27+
$list->push($xd);
28+
//付款
29+
$fk = Step::make()->title("付款");
30+
$fk->description($order->pay_time);
31+
$list->push($fk);
32+
//发货
33+
$fh = Step::make()->title("发货");
34+
$fh->description($order->delivery_time);
35+
$list->push($fh);
36+
//收货
37+
$sh = Step::make()->title("收货");
38+
$sh->description($order->receipt_time);
39+
$list->push($sh);
40+
//完成
41+
$wc = Step::make()->title("完成");
42+
$wc->description($order->receipt_time);
43+
$list->push($wc);
44+
}));
45+
```
46+
47+
### HTML
48+
49+
组件使用`v-html`渲染
50+
51+
```php
52+
Html::make()->html("<div>......</div>");
53+
```
54+
55+
56+
1157
## 表格组件
1258

1359
### Tag 标签

docs/form.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,14 @@ $form->saving(function (Form $form) {
229229
return \Admin::responseError("xxxx");
230230
});
231231
$form->saved(function (Form $form) {});
232-
$form->deleting(function (Form $form) {});
233-
$form->deleted(function (Form $form) {});
232+
233+
$form->deleting(function (Form $form,$id) {
234+
235+
});
236+
237+
$form->deleted(function (Form $form) {
238+
239+
});
234240

235241
//表单验证时回调,用于处理复杂的表单验证
236242
$form->validating(function (Form $form, $validator) {

docs/grid.md

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -573,55 +573,25 @@ public function children() {
573573
```
574574
以下代码开启树形展示模式
575575
```php
576-
$grid->tree()
576+
$grid->tree();
577+
$grid->defaultExpandAll();//是否默认展开所有行
577578
```
578-
开启拖拽排序功能
579-
```php
580-
//自定义拖拽完成接受地址
581-
$grid->tree()->draggable(route('admin.auth.menu.order'))
582-
```
583-
后端会接受到三个参数,可参考以下代码示例
584-
```php
585-
public function menuOrder(Request $request)
586-
{
587-
try {
588-
\Admin::validatorData($request->all(), [
589-
'self' => 'required',//当前节点信息
590-
'target' => 'required',//目标节点信息
591-
'type' => ['required', Rule::in(["before", "after", "inner"])],//放置类型 前 后 插入
592-
]);
593-
} catch (\Exception $exception) {
594-
return \Admin::responseError($exception->getMessage());
595-
}
596579

597-
}
598580

599-
```
600581
### 关联模型
601582
>要成功显示关联模型的值,必须设置`with`的值
602583
603584
要显示关联模型的值,使用`.`来获取关联模型的值,可以多级显示,最后一级为要显示的值
604585
#### 一对一
605586
```php
606-
$grid->with(['permissions']);
607587
$grid->column('permissions.name'),
608588
```
609589
#### 一对多
610590
一对多最终得到的是数组,前端会自动循环展示,文本建议使用`Tag`组件,图片建议使用`Avatar``Image`组件
611591
```php
612-
$grid->with(['permissions']);
613592
$grid->column('permissions.name')->displayComponent(Tag::make()->type('info')),
614593
```
615-
#### 多级显示
616-
```php
617-
$grid->with(['permissions','permissions.roles','permissions.roles.administrators']);
618594

619-
$grid->column('permissions.name')->displayComponent(Tag::make()->type('info'));
620-
621-
$grid->column('permissions.roles.name')->displayComponent(Tag::make()->type('info'));
622-
623-
$grid->column('permissions.roles.administrators.name')->displayComponent(Tag::make()->type('info'));
624-
```
625595

626596
## 行操作
627597

@@ -728,3 +698,25 @@ $toolbars->addRight(new MyRoghtTool());//添加在右侧
728698

729699

730700

701+
## 头部内容
702+
703+
可自定义Grid顶部内容,闭包返回一个content组件
704+
705+
```php
706+
$grid->top(function (Content $top){
707+
$top->body(Card::make()->content(Html::make()->html("我是头部内容")));
708+
});
709+
```
710+
711+
712+
713+
## 底部内容
714+
715+
可自定义Grid底部内容,闭包返回一个content组件
716+
717+
```php
718+
$grid->bottom(function (Content $bottom){
719+
$bottom->body(Card::make()->content(Html::make()->html("我是头部内容")));
720+
});
721+
```
722+

public/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=1543085b14bd62d505c1",
2+
"/app.js": "/app.js?id=ebcf5ad45ebf6b98ef46",
33
"/manifest.js": "/manifest.js?id=3c768977c2574a34506e",
44
"/vendor.js": "/vendor.js?id=38a9d2f43b98aaf4f7dd"
55
}

resources/js/components.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,13 @@ Vue.component('ToolButton', ToolButton);
105105

106106
//Widget
107107
import Divider from './components/widgets/Divider'
108-
Vue.component('Divider', Divider)
108+
Vue.component('Divider', Divider)
109+
110+
import Card from './components/widgets/Card'
111+
Vue.component('Card', Card)
112+
113+
import Steps from './components/widgets/Steps'
114+
Vue.component('Steps', Steps)
115+
116+
import Html from './components/widgets/Html'
117+
Vue.component('Html', Html)

resources/js/components/grid/Table.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<template>
22
<div class="grid-container">
3+
<component v-if="attrs.top" :is="attrs.top.componentName" :attrs='attrs.top' />
4+
35
<el-card shadow="never" :body-style="{ padding: 0 }">
46
<div class="grid-top-container">
57
<div class="grid-top-container-left">
@@ -127,7 +129,7 @@
127129
:highlight-current-row="attrs.attributes.highlightCurrentRow"
128130
:empty-text="attrs.attributes.emptyText"
129131
:tooltip-effect="attrs.attributes.tooltipEffect"
130-
:default-expand-all="true"
132+
:default-expand-all="attrs.attributes.defaultExpandAll"
131133
@sort-change="onTableSortChange"
132134
@selection-change="onTableselectionChange"
133135
>
@@ -136,7 +138,8 @@
136138
align="center"
137139
type="selection"
138140
></el-table-column>
139-
141+
<el-table-column v-if="attrs.tree" align="center" width="50">
142+
</el-table-column>
140143
<template v-for="column in attrs.columnAttributes">
141144
<el-table-column
142145
:type="column.type"
@@ -173,9 +176,7 @@
173176
<template slot="header"></template>
174177
<template slot-scope="scope">
175178
<Actions
176-
v-if="
177-
scope.row.grid_actions && !scope.row.grid_actions.hide
178-
"
179+
v-if="scope.row.grid_actions && !scope.row.grid_actions.hide"
179180
:action_list="scope.row.grid_actions.data"
180181
:scope="scope"
181182
:key_name="attrs.keyName"
@@ -198,6 +199,7 @@
198199
/>
199200
</div>
200201
</el-card>
202+
<component v-if="attrs.bottom" :is="attrs.bottom.componentName" :attrs='attrs.bottom' />
201203
</div>
202204
</template>
203205

resources/js/components/layout/Column.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<el-col :span="attrs.width">
2+
<el-col :span="attrs.width" :style="attrs.style" :class="attrs.className">
33
<component
44
v-for="(content, index) in attrs.contents"
55
:key="index"

resources/js/components/layout/Row.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<el-row :gutter="attrs.gutter">
2+
<el-row :gutter="attrs.gutter" :style="attrs.style" :class="attrs.className">
33
<component
4-
v-for="(column,index) in attrs.columns"
4+
v-for="(column, index) in attrs.columns"
55
:key="index"
66
:is="column.componentName"
77
:attrs="column"
@@ -17,5 +17,4 @@ export default {
1717
};
1818
</script>
1919

20-
<style>
21-
</style>
20+
<style></style>

0 commit comments

Comments
 (0)