123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <style>
- .el-select-group__wrap:not(:last-of-type)::after {
- content: '';
- position: absolute;
- display: none;
- left: 20px;
- right: 20px;
- bottom: 0px !important;
- height: 0px !important;
- background: #e4e7ed;
- }
- .el-select-group__wrap:not(:last-of-type){
- padding-bottom: 0px !important;
- }
- </style>
- <div id="{$name}">
- {if $multi==0} <!--多选-->
- <input type="hidden" name="{$name}" :value="value">
- <el-select v-model="value" filterable multiple clearable placeholder="请选择" size="small"
- style="width:100%">
- <el-option-group
- v-for="group in options"
- :key="group.id"
- :label="group.name">
- <el-option
- v-for="item in group.user"
- :key="item.id"
- :label="item.real_name"
- :value="item.id.toString()">
- </el-option>
- </el-option-group>
- </el-select>
- {if $msg}
- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> {$msg}</span>
- {/if}
- </div>
- {else}<!--单选-->
- <input type="hidden" name="{$name}" :value="value">
- <el-select v-model="value" filterable clearable placeholder="请选择" size="small"
- style="width:100%">
- <el-option-group
- v-for="group in options"
- :key="group.id"
- :label="group.name">
- <el-option
- v-for="item in group.user"
- :key="item.id"
- :label="item.real_name"
- :value="item.id.toString()">
- </el-option>
- </el-option-group>
- </el-select>
- {if $msg}
- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> {$msg}</span>
- {/if}
- </div>
- {/if}
- <script>
- new Vue({
- el: '#{$name}',
- data: function() {
- return {
- options: {:json_encode($lists)},
- value: '{$val}',
- }
- },
- watch: {
- value: function (newVal, oldVal) {
- if("{$multi}"==="0"){
- $('input[name={$name}]').val(newVal.join(','));
- }else {
- $('input[name={$name}]').val(newVal);
- }
- }
- },
- created(){
- const vals = this.value;
- if("{$multi}"==="0"){
- this.value = [];
- if(vals){
- this.value = vals.split(',');
- }
- }
- }
- })
- </script>
|