File tree Expand file tree Collapse file tree 13 files changed +40246
-80
lines changed Expand file tree Collapse file tree 13 files changed +40246
-80
lines changed Original file line number Diff line number Diff line change @@ -212,11 +212,23 @@ $form->footerComponent(Divider::make("详细信息"));
212
212
$form->editing(function (Form $form) {});
213
213
$form->submitted(function (Form $form) {});
214
214
$form->submitted(function (Form $form) {});
215
- $form->saving(function (Form $form) {});
215
+ $form->saving(function (Form $form) {
216
+
217
+ //返回错误信息
218
+ return \Admin::responseError("xxxx");
219
+ });
216
220
$form->saved(function (Form $form) {});
217
221
$form->deleting(function (Form $form) {});
218
222
$form->deleted(function (Form $form) {});
219
223
224
+ //表单验证时回调,用于处理复杂的表单验证
225
+ $form->validating(function (Form $form, $validator) {
226
+ //-------例如
227
+ $validator->sometimes('end_time', 'email', function ($input) {
228
+ return true;
229
+ });
230
+ });
231
+
220
232
//表单要编辑的数据查询并处理后,可用于对不存在的关联模型字段提供数据
221
233
$form->editQuery(function (Form $form,$data) {
222
234
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1
1
{
2
- "/app.js" : " /app.js?id=b0257459c04305121b88 " ,
3
- "/manifest.js" : " /manifest.js?id=3c768977c2574a34506e " ,
4
- "/vendor.js" : " /vendor.js?id=5a30bc9bc2e005aa1c33 "
2
+ "/app.js" : " /app.js?id=23a4859c644d4b2b623b " ,
3
+ "/manifest.js" : " /manifest.js?id=d9708e48a6c10ccee4bb " ,
4
+ "/vendor.js" : " /vendor.js?id=f4679ac178c0e413cb28 "
5
5
}
Original file line number Diff line number Diff line change 22
22
:disabled =" attrs.attrs.disabled"
23
23
>
24
24
<template v-for =" (item , index ) in attrs .formItems " >
25
- <div :key =" index" >
25
+ <ItemIf
26
+ :key =" index"
27
+ :form_item =" item"
28
+ :form_items =" attrs.formItems"
29
+ :form_data =" formData"
30
+ >
26
31
<component
27
32
v-if =" item.topComponent"
28
33
:is =" item.topComponent.componentName"
75
80
:is =" item.footerComponent.componentName"
76
81
:attrs =" item.footerComponent"
77
82
/>
78
- </div >
83
+ </ItemIf >
79
84
</template >
80
85
<div class =" form-bottom-actions" >
81
86
<div ></div >
98
103
</template >
99
104
<script >
100
105
import ItemDiaplsy from " ./ItemDiaplsy" ;
106
+ import ItemIf from " ./ItemIf" ;
101
107
export default {
102
108
components: {
103
- ItemDiaplsy
109
+ ItemDiaplsy,
110
+ ItemIf
104
111
},
105
112
props: {
106
113
attrs: Object
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div v-if =" ifShow" >
3
+ <slot ></slot >
4
+ </div >
5
+ </template >
6
+ <script >
7
+ export default {
8
+ props: {
9
+ form_item: Object ,
10
+ form_items: Array ,
11
+ form_data: Object
12
+ },
13
+ computed: {
14
+ ifShow () {
15
+ let key = this .form_item .vif .key ;
16
+ let value = this .form_item .vif .value ;
17
+
18
+ if (key) {
19
+ let cValue = window ._ .get (this .form_data , key);
20
+ if (cValue == value) {
21
+ return true ;
22
+ } else {
23
+ return false ;
24
+ }
25
+ }
26
+
27
+ return true ;
28
+ }
29
+ }
30
+ };
31
+ </script >
Original file line number Diff line number Diff line change 10
10
:rows =" selectionRows"
11
11
v-if =" attrs.selection"
12
12
/>
13
- <div class =" search-view mr-10" >
13
+ <div class =" search-view mr-10" v-if = " attrs.quickSearch " >
14
14
<el-input
15
15
v-model =" quickSearch"
16
16
:placeholder =" attrs.quickSearch.placeholder"
17
17
:clearable =" true"
18
18
@clear =" getData"
19
19
@keyup.enter.native =" getData"
20
- v-if = " attrs.quickSearch "
20
+
21
21
>
22
22
<el-button @click =" getData" :loading =" loading" slot =" append"
23
23
>搜索</el-button
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<el-col :span =" attrs.width" >
3
3
<component
4
- v-for =" (content,index) in attrs.contents"
4
+ v-for =" (content, index) in attrs.contents"
5
5
:key =" index"
6
6
:is =" content.componentName"
7
7
:attrs =" content"
@@ -17,5 +17,4 @@ export default {
17
17
};
18
18
</script >
19
19
20
- <style >
21
- </style >
20
+ <style ></style >
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ export default {
32
32
vm: this ._ .clone (this .value )
33
33
};
34
34
},
35
+ watch: {
36
+ value (value ) {
37
+ this .vm = value;
38
+ }
39
+ },
35
40
model: {
36
41
prop: " value" ,
37
42
event : " change"
Original file line number Diff line number Diff line change 54
54
:name =" attrs.name"
55
55
:prefix-icon =" attrs.prefixIcon"
56
56
:clear-icon =" attrs.clearIcon"
57
- :start =" attrs.start"
58
- :end =" attrs.end"
59
- :step =" attrs.step"
60
- :minTime =" attrs.minTime"
61
- :maxTime =" attrs.maxTime"
62
57
@change =" onChange"
63
58
></el-time-select >
64
59
</template >
Original file line number Diff line number Diff line change @@ -31,11 +31,6 @@ class TimePicker extends Component
31
31
protected $ format = "HH:mm:ss " ;
32
32
protected $ type = "select " ;
33
33
34
- protected $ start = "09:00 " ;
35
- protected $ end = "18:00 " ;
36
- protected $ step = "00:30 " ;
37
- protected $ minTime = "00:00 " ;
38
- protected $ maxTime ;
39
34
40
35
static public function make ($ value = '' , $ type = "select " )
41
36
{
@@ -284,60 +279,6 @@ public function type($type)
284
279
return $ this ;
285
280
}
286
281
287
- /**
288
- * 开始时间
289
- * @param string $start
290
- * @return $this
291
- */
292
- public function start ($ start )
293
- {
294
- $ this ->start = $ start ;
295
- return $ this ;
296
- }
297
-
298
- /**
299
- * 结束时间
300
- * @param string $end
301
- * @return $this
302
- */
303
- public function end ($ end )
304
- {
305
- $ this ->end = $ end ;
306
- return $ this ;
307
- }
308
-
309
- /**
310
- * 间隔时间
311
- * @param string $step
312
- * @return $this
313
- */
314
- public function step ($ step )
315
- {
316
- $ this ->step = $ step ;
317
- return $ this ;
318
- }
319
-
320
- /**
321
- * 最小时间,小于该时间的时间段将被禁用
322
- * @param string $minTime
323
- * @return $this
324
- */
325
- public function minTime ($ minTime )
326
- {
327
- $ this ->minTime = $ minTime ;
328
- return $ this ;
329
- }
330
-
331
- /**
332
- * 最大时间,大于该时间的时间段将被禁用
333
- * @param mixed $maxTime
334
- * @return $this
335
- */
336
- public function maxTime ($ maxTime )
337
- {
338
- $ this ->maxTime = $ maxTime ;
339
- return $ this ;
340
- }
341
282
342
283
343
284
}
You can’t perform that action at this time.
0 commit comments