Skip to content

Commit 7931b73

Browse files
committed
添加 VueRouteAction 组件
添加 Action 排序属性 修改 Content 组件默认className 修复 RadioGroup
1 parent b263636 commit 7931b73

File tree

17 files changed

+415
-49
lines changed

17 files changed

+415
-49
lines changed

docs/components.md

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,39 @@ Avatar::make();
126126
```php
127127
Icon::make()
128128
```
129+
130+
131+
### 操作组件
132+
133+
#### 导航操作
134+
135+
用于跳转到其他页面的操作
136+
137+
```php
138+
VueRouteAction::make()
139+
->order(3) //排序 越大越靠前
140+
->name("公众号管理") //操作名称
141+
->icon("icon-class-name")//图标
142+
->path("WeChat/manage/{app_id}")//vue路由路径,{xxx}会被自动替换成当前行的对应值,支持 ?x=x 参数
143+
->httpPath("http://www.baodu.com")//打开新的连接
144+
//调用代码
145+
$grid->actions(function (Grid\Actions $actions) {
146+
$actions->add(...);
147+
});
148+
```
149+
150+
### 工具栏组件
151+
152+
#### VueRouteButton
153+
154+
用于跳转到其他页面的操作
155+
156+
```php
157+
VueRouteButton::make("/adv/loc", "广告位管理")->type("text")
158+
```
159+
160+
161+
129162
## 表单组件
130163

131164
### Radio 单选框
@@ -137,7 +170,7 @@ Icon::make()
137170

138171
当一个数据集合有清晰的层级结构时,可通过级联选择器逐级查看并选择
139172

140-
#### 基础用法
173+
基础用法
141174

142175
模型导入`ModelTree`
143176

@@ -178,7 +211,7 @@ $form->item("goods_class_path", "产品分类")->displayComponent(function () {
178211
}),
179212
```
180213

181-
#### 属性
214+
属性
182215

183216
显示为面板模式
184217

@@ -202,68 +235,80 @@ $form->item('avatar', '头像')->displayComponent(function(){
202235
return Upload::make()->pictureCard()->avatar()->path('avatar')->uniqueName();
203236
})
204237
```
205-
#### 上传地址
238+
上传地址
239+
206240
自定义上传地址
207241
```php
208242
Upload::make()->action("http://xxxx")
209243
```
210-
#### 文件URL前缀
244+
文件URL前缀
245+
211246
如果数据库保存的是相对地址,则这个就是它的URL前面部分。默认为disk的路径
212247
```php
213248
Upload::make()->host("http://xxxx")
214249
```
215-
#### 支持多文件
250+
支持多文件
251+
216252
支持多个文件上传,数据格式为数组
217253
```php
218254
Upload::make()->multiple();
219255
//如果是一对多情况下,并且是对象数组,需要指定文件组件,文件路径字段
220256
Upload::make()->multiple(true,"keyName","valueName");
221257
```
222-
#### 上传附加数据
258+
上传附加数据
259+
223260
```php
224261
Upload::make()->data(['key'=>'value','key_2'=>'value'])
225262
```
226-
#### 保存目录
263+
保存目录
264+
227265
```php
228266
Upload::make()->path("path_name")
229267
```
230-
#### 自动生成文件名
268+
自动生成文件名
269+
231270
默认为上传的文件名
232271
```php
233272
Upload::make()->uniqueName()
234273
```
235-
#### 拖拽上传
274+
拖拽上传
236275

237276
```php
238277
Upload::make()->drag()
239278
```
240-
#### 文件类型
279+
文件类型
280+
241281
接受上传的[文件类型](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept)
242282
```php
243283
Upload::make()->accept("xx")
244284
```
245-
#### 文件个数
285+
文件个数
286+
246287
默认为一个
247288
```php
248289
Upload::make()->limit(10)
249290
```
250-
#### 禁用
291+
禁用
292+
251293
```php
252294
Upload::make()->disabled()
253295
```
254-
#### 组件类型
296+
组件类型
297+
255298
支持 `image` `avatar` `file`
256299
```php
257300
Upload::make()->image()
258301
Upload::make()->avatar()
259302
Upload::make()->file()
260303
```
261-
#### 组件大小
304+
组件大小
305+
262306
组件item的高宽,默认 `100x100`
263307
```php
264308
Upload::make()->width(150)
265309
Upload::make()->height(120)
266310
```
267311
### Rate 评分
268312
### ColorPicker 颜色选择器
269-
### Transfer 穿梭框
313+
### Transfer 穿梭框
314+

public/app.js

Lines changed: 180 additions & 14 deletions
Large diffs are not rendered by default.

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=5406de530ea0e352a744",
2+
"/app.js": "/app.js?id=1be6ff1deacba4b06103",
33
"/manifest.js": "/manifest.js?id=d9708e48a6c10ccee4bb",
44
"/vendor.js": "/vendor.js?id=f4679ac178c0e413cb28"
55
}

resources/js/components.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ Vue.component('MenuItem', MenuItem);
8989
//Actions
9090
import EditAction from './components/widgets/Actions/EditAction'
9191
import DeleteAction from './components/widgets/Actions/DeleteAction'
92+
import VueRouteAction from './components/widgets/Actions/VueRouteAction'
9293
Vue.component('EditAction', EditAction);
9394
Vue.component('DeleteAction', DeleteAction);
95+
Vue.component('VueRouteAction', VueRouteAction);
9496

9597
//Tools
9698
import GridCreateButton from './components/widgets/Tools/Create'

resources/js/components/Root.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ $header-bar-height: 55px;
455455
margin-top: $header-bar-height;
456456
}
457457
.layout-content-main {
458-
margin: 15px;
458+
margin: 0px;
459459
460460
.layout-page-header {
461461
margin: -15px -15px 0;

resources/js/components/grid/Actions/Index.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="grid-actions">
3-
<template v-for="action in action_list">
4-
<span :key="action.componentName">
3+
<template v-for="(action, index) in order_action_list">
4+
<span :key="action.componentName + index">
55
<component
66
:is="action.componentName"
77
:scope="scope"
@@ -24,7 +24,11 @@ export default {
2424
scope: Object
2525
},
2626
mounted() {},
27-
computed: {}
27+
computed: {
28+
order_action_list(){
29+
return window._.orderBy(this.action_list,['order'],['desc'])
30+
}
31+
}
2832
};
2933
</script>
3034
<style lang="scss">

resources/js/components/widgets/Actions/EditAction.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ export default {
2121
},
2222
methods: {
2323
onHandle() {
24-
console.log(this.scope);
25-
2624
this.$router.push(this.$route.path + "/" + this.key + "/edit");
2725
}
2826
},
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template>
2+
<el-button type="text" :icon="action.icon" @click="onHandle">{{
3+
action.name
4+
}}</el-button>
5+
</template>
6+
<script>
7+
export default {
8+
props: {
9+
scope: Object,
10+
action: Object,
11+
key_name: String
12+
},
13+
methods: {
14+
onHandle() {
15+
if (this.action.httpPath) {
16+
} else {
17+
//this.$router.push(this.path);
18+
}
19+
}
20+
},
21+
computed: {
22+
path() {
23+
let path = this.action.path;
24+
this._.forEach(this.row, (value, key) => {
25+
path = this._.replace(path, "{" + key + "}", value);
26+
});
27+
return path;
28+
},
29+
http_path() {},
30+
colum() {
31+
return this.scope.colum;
32+
},
33+
row() {
34+
return this.scope.row;
35+
},
36+
key() {
37+
return this.scope.row[this.key_name];
38+
}
39+
}
40+
};
41+
</script>
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
<template>
2-
<el-radio-group v-model="vm" @change="onChange" :style="attrs.style" :class="attrs.className">
2+
<el-radio-group
3+
v-model="vm"
4+
:style="attrs.style"
5+
:class="attrs.className"
6+
@change="onChange"
7+
>
38
<el-radio
9+
v-for="(radio, index) in attrs.options"
410
:style="radio.style"
511
:class="radio.className"
6-
v-for="(radio,index) in attrs.options"
712
:key="index"
813
:label="radio.label"
914
:disabled="radio.disabled"
1015
:border="radio.border"
1116
:size="radio.size"
12-
>{{radio.title}}</el-radio>
17+
>{{ radio.title }}</el-radio
18+
>
1319
</el-radio-group>
1420
</template>
1521
<script>
1622
export default {
1723
props: {
1824
attrs: Object,
25+
form_data: Object,
1926
value: {
2027
default: null
2128
}
2229
},
2330
data() {
2431
return {
25-
vm: ""
32+
vm: this._.clone(this.value)
2633
};
2734
},
2835
model: {
@@ -35,4 +42,4 @@ export default {
3542
}
3643
}
3744
};
38-
</script>
45+
</script>

resources/js/styles/admin.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ body {
2323
.mt-5{
2424
margin-top: 5px;
2525
}
26-
26+
.m-10{
27+
margin: 10px;
28+
}
2729
.ml-10 {
2830
margin-left: 10px;
2931
}
@@ -40,6 +42,9 @@ body {
4042
margin-top: 10px;
4143
}
4244

45+
.m-15{
46+
margin: 15px;
47+
}
4348
.mb-15 {
4449
margin-bottom: 15px;
4550
}

0 commit comments

Comments
 (0)