Skip to content

Commit 8953ea7

Browse files
committed
新增:Select增加快速编辑模式
1 parent 85edf21 commit 8953ea7

File tree

1 file changed

+39
-12
lines changed

1 file changed

+39
-12
lines changed
Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,44 @@
1-
@if(isset($options[$value]))
2-
@if(isset($options[$value]['label']))
3-
@if(isset($options[$value]['title']))
4-
{{$options[$value]['title']}}
1+
@if(!empty($gridEditable))
2+
<select lay-ignore data-type="{{$name}}_{{$_index}}" class="form-sm">
3+
@foreach($options as $k=>$v)
4+
@if(isset($v['label']))
5+
@if(isset($v['title']))
6+
<option value="{{$v['label']}}" @if($value==$k) selected @endif>{{$v['title']}}</option>
7+
@else
8+
<option value="{{$v['label']}}" @if($value==$k) selected @endif>{{$v['label']}}</option>
9+
@endif
10+
@else
11+
<option value="{{$k}}" @if($value==$k) selected @endif>{{$v}}</option>
12+
@endif
13+
@endforeach
14+
</select>
15+
<script>
16+
$('[data-type={{$name}}_{{$_index}}]').off('change').on('change',function(){
17+
var data = {
18+
ele: this,
19+
index: {{$_index}},
20+
column: '{{$column}}',
21+
value: $(this).val()
22+
};
23+
$(this).closest('[data-grid]').trigger('grid-item-cell-change', data);
24+
});
25+
</script>
26+
@else
27+
@if(isset($options[$value]))
28+
@if(isset($options[$value]['label']))
29+
@if(isset($options[$value]['title']))
30+
{{$options[$value]['title']}}
31+
@else
32+
{{$options[$value]['label']}}
33+
@endif
534
@else
6-
{{$options[$value]['label']}}
35+
{{$options[$value]}}
736
@endif
837
@else
9-
{{$options[$value]}}
10-
@endif
11-
@else
12-
@if($value)
13-
{{$value}}
14-
@else
15-
<span class="ub-text-muted">-</span>
38+
@if($value)
39+
{{$value}}
40+
@else
41+
<span class="ub-text-muted">-</span>
42+
@endif
1643
@endif
1744
@endif

0 commit comments

Comments
 (0)