|
69 | 69 | <div class="col-md-6 col-sm-12 col-xs-12 sizer-item pull-right" :class="{'col-lg-5':options.keywordGroup,'col-lg-4':!options.keywordGroup}">
|
70 | 70 | <div class="box-tools">
|
71 | 71 | <div class="input-group">
|
72 |
| - <div class="input-group-btn" v-if="options.keywordGroup"> |
73 |
| - <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
74 |
| - {{$tp(data.keywordsMap[data.options.where['_key']])}} |
75 |
| - <span class="caret"></span> |
76 |
| - </button> |
77 |
| - <ul class="dropdown-menu"> |
78 |
| - <li v-for="(value,index) in data.keywordsMap" @click="changeKeywords(index)"> |
79 |
| - <a>{{$tp(value)}}</a> |
80 |
| - </li> |
81 |
| - </ul> |
82 |
| - </div> |
83 |
| - <input v-if="options.keywordGroup" @keyup.enter="search" v-model="data.options.where[data.options.where['_key']]" :placeholder="_placeholder" class="form-control" type="text"> |
| 72 | + <div class="input-group-btn" v-if="options.keywordGroup"> |
| 73 | + <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
| 74 | + {{$tp(data.keywordsMap[data.options.where['_key']])}} |
| 75 | + <span class="caret"></span> |
| 76 | + </button> |
| 77 | + <ul class="dropdown-menu"> |
| 78 | + <li v-for="(value,index) in data.keywordsMap" @click="changeKeywords(index)"> |
| 79 | + <a>{{$tp(value)}}</a> |
| 80 | + </li> |
| 81 | + </ul> |
| 82 | + </div> |
| 83 | + <input v-if="options.keywordGroup" @keyup.enter="search" v-model="data.options.where[data.options.where['_key']]" :placeholder="_placeholder" class="form-control" type="text"> |
84 | 84 | <input v-else @keyup.enter="search" v-model="data.options.where[options.keywordKey]" :placeholder="_placeholder" type="text" class="form-control">
|
85 | 85 | <div class="input-group-btn">
|
86 | 86 | <button type="button" :title="$t('Search')" class="btn btn-primary" @click="search">
|
|
89 | 89 | <button type="button" :title="$t('Reset')" class="btn btn-primary " @click="reset">
|
90 | 90 | <i class="fa fa-repeat"></i>
|
91 | 91 | </button>
|
92 |
| - <!-- <button type="button" title="导入数据" class="btn btn-primary import" @click="importExcel" v-show="data.configUrl['importUrl']"> |
93 |
| - <i class="glyphicon glyphicon-folder-open"></i> |
94 |
| - <input type="file" @change="selectExcel" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" v-show="false"></input> |
95 |
| - </button>--> |
96 |
| - <button type="button" :title="$t('Export data')" class="btn btn-primary" @click="download" v-if="data.configUrl['exportUrl']"> |
| 92 | + <!-- <button type="button" title="导入数据" class="btn btn-primary import" @click="importExcel" v-show="data.configUrl['importUrl']"> |
| 93 | + <i class="glyphicon glyphicon-folder-open"></i> |
| 94 | + <input type="file" @change="selectExcel" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" v-show="false"></input> |
| 95 | + </button>--> |
| 96 | + <button type="button" :title="$t('Export data')" class="btn btn-primary" @click="download" v-if="data.configUrl['exportUrl']"> |
97 | 97 | <i class="glyphicon glyphicon-download-alt"></i>
|
98 | 98 | </button>
|
99 | 99 | <slot name="input_group_add_btn" :data="data"></slot>
|
|
173 | 173 | <slot name="table" :data="data" :check_ids="check_ids" :remove="remove">
|
174 | 174 | <table class="table table-hover table-bordered table-striped text-center dataTable">
|
175 | 175 | <thead>
|
176 |
| - <slot name="thead" |
177 |
| - :select-all="select_all" |
178 |
| - :operation="operation" |
179 |
| - :trans-field="transField" |
180 |
| - :checkbox="checkbox" |
181 |
| - :select-all-method="selectAll" |
182 |
| - :order-by-method="orderBy" |
183 |
| - :order-by="orderBy" |
184 |
| - :show-fields="show_fields"> |
185 |
| - <tr> |
186 |
| - <th class="id" v-if="checkbox"> |
187 |
| - <!-- <input type="checkbox" v-model="select_all" @click="selectAll" :value="1">--> |
188 |
| - <icheck v-model="select_all" @change="selectAll" :option="1" :disabled-label="true"></icheck> |
189 |
| - </th> |
190 |
| - <th v-for="(field,index) in show_fields" :class="field['class']" @click="orderBy(index)"> |
191 |
| - {{transField(field.name,index)}} |
192 |
| - </th> |
193 |
| - <slot name="thead-operate" :operation="operation"> |
194 |
| - <th class="operate" v-if="operation">{{$t('Operation')}}</th> |
195 |
| - </slot> |
196 |
| - </tr> |
197 |
| - </slot> |
| 176 | + <slot name="thead" |
| 177 | + :select-all="select_all" |
| 178 | + :operation="operation" |
| 179 | + :trans-field="transField" |
| 180 | + :checkbox="checkbox" |
| 181 | + :select-all-method="selectAll" |
| 182 | + :order-by-method="orderBy" |
| 183 | + :order-by="orderBy" |
| 184 | + :show-fields="show_fields"> |
| 185 | + <tr> |
| 186 | + <th class="id" v-if="checkbox"> |
| 187 | + <!-- <input type="checkbox" v-model="select_all" @click="selectAll" :value="1">--> |
| 188 | + <icheck v-model="select_all" @change="selectAll" :option="1" :disabled-label="true"></icheck> |
| 189 | + </th> |
| 190 | + <th v-for="(field,index) in show_fields" :class="field['class']" @click="orderBy(index)"> |
| 191 | + {{transField(field.name,index)}} |
| 192 | + </th> |
| 193 | + <slot name="thead-operate" :operation="operation"> |
| 194 | + <th class="operate" v-if="operation">{{$t('Operation')}}</th> |
| 195 | + </slot> |
| 196 | + </tr> |
| 197 | + </slot> |
198 | 198 | </thead>
|
199 | 199 | <tbody>
|
200 |
| - <tr v-for="(row,i) in (data.list?data.list.data:[])"> |
201 |
| - <td v-if="checkbox"> |
202 |
| - <!--<input type="checkbox" v-model="check_ids" :value="row[options.primaryKey]" />--> |
203 |
| - <slot name="col-checkbox" :check_ids="check_ids" :data="data" :row="row"> |
204 |
| - <icheck v-model="check_ids" :option="row[options.primaryKey]" class="ids" :disabled-label="true"></icheck> |
205 |
| - </slot> |
206 |
| - </td> |
207 |
| - <td v-for="(field,k) in show_fields" :class="field['class']"> |
208 |
| - <slot name="col" :field="field" :data="data" :maps="_maps" :row="row" :k="k" :getItems="getItems" :checkboxClass="checkboxClass" :labelClass="labelClass"> |
| 200 | + <tr v-for="(row,i) in (data.list?data.list.data:[])"> |
| 201 | + <td v-if="checkbox"> |
| 202 | + <!--<input type="checkbox" v-model="check_ids" :value="row[options.primaryKey]" />--> |
| 203 | + <slot name="col-checkbox" :check_ids="check_ids" :data="data" :row="row"> |
| 204 | + <icheck v-model="check_ids" :option="row[options.primaryKey]" class="ids" :disabled-label="true"></icheck> |
| 205 | + </slot> |
| 206 | + </td> |
| 207 | + <td v-for="(field,k) in show_fields" :class="field['class']"> |
| 208 | + <slot name="col" :field="field" :data="data" :maps="_maps" :row="row" :k="k" :getItems="getItems" :checkboxClass="checkboxClass" :labelClass="labelClass"> |
209 | 209 | <span v-if="field.type =='label' || field.type =='radio'">
|
210 | 210 | <span class="label" :class="labelClass(row,k)">
|
211 | 211 | {{ _maps | array_get(k,[]) | array_get(array_get(row,k,0)) }}
|
212 | 212 | </span>
|
213 | 213 | </span>
|
214 |
| - <span v-else-if="field.type =='labels' || field.type =='checkbox'"> |
| 214 | + <span v-else-if="field.type =='labels' || field.type =='checkbox'"> |
215 | 215 | <span v-for="value in getItems(row,k)" class="label labels-m" :class="checkboxClass(value,2,statusClass,k)">
|
216 | 216 | {{ _maps | array_get(k.replace('.$index','')) | array_get(value) }}
|
217 | 217 | </span>
|
218 | 218 | </span>
|
219 |
| - <span v-else-if="field.type =='icon'"> |
| 219 | + <span v-else-if="field.type =='icon'"> |
220 | 220 | <i class="fa" :class="array_get(row,k,'')"></i>
|
221 | 221 | </span>
|
222 |
| - <span v-else-if="field.type =='color'"> |
| 222 | + <span v-else-if="field.type =='color'"> |
223 | 223 | <span class="input-group-addon1" style="border: none">
|
224 | 224 | <i style="background-color:transparent;" v-if="!array_get(row,k,'')"></i>
|
225 | 225 | <i :style="'background-color:'+array_get(row,k,'')" v-else></i>
|
226 | 226 | </span>
|
227 | 227 | </span>
|
228 |
| - <span v-else-if="field.type =='level'"> |
| 228 | + <span v-else-if="field.type =='level'"> |
229 | 229 | {{ row[field.levelName || 'level'] | deep}}
|
230 | 230 | <span v-if="field.limit" :title="array_get(row,k,'')">
|
231 | 231 | {{row | array_get(k) | str_limit(field.limit)}}
|
|
234 | 234 | {{row | array_get(k)}}
|
235 | 235 | </span>
|
236 | 236 | </span>
|
237 |
| - <span v-else-if="field.type =='code'"> |
| 237 | + <span v-else-if="field.type =='code'"> |
238 | 238 | <code v-if="field.limit">
|
239 | 239 | {{row | array_get(k) | str_limit(field.limit)}}
|
240 | 240 | </code>
|
|
258 | 258 | {{row | array_get(k)}}
|
259 | 259 | </span>
|
260 | 260 | </span>
|
261 |
| - </slot> |
262 |
| - </td> |
263 |
| - <td class="operate" v-if="operation"> |
264 |
| - <slot name="col-operation" :data="data" :row="row" :remove="remove"> |
265 |
| - <button v-show="data.configUrl['deleteUrl']" :title="$t('Delete selected')" type="button" class="btn btn-danger btn-xs" @click="remove([row[options.primaryKey]])"> |
266 |
| - <i class="fa fa-trash-o"></i> |
267 |
| - </button> |
268 |
| - <router-link class="btn btn-info btn-xs" :title="$t('Edit')" :to="data.configUrl['showUrl'].replace('{id}',row[options.primaryKey])" v-if="data.configUrl['showUrl']"> |
269 |
| - <i class="fa fa-edit"></i> |
270 |
| - </router-link> |
271 |
| - </slot> |
272 |
| - </td> |
273 |
| - </tr> |
274 |
| - <tr v-show="is_empty"> |
275 |
| - <td :colspan="col_num" class="empty"> |
276 |
| - {{$t('Temporarily no data')}} |
277 |
| - </td> |
278 |
| - </tr> |
| 261 | + </slot> |
| 262 | + </td> |
| 263 | + <td class="operate" v-if="operation"> |
| 264 | + <slot name="col-operation" :data="data" :row="row" :remove="remove"> |
| 265 | + <button v-show="data.configUrl['deleteUrl']" :title="$t('Delete selected')" type="button" class="btn btn-danger btn-xs" @click="remove([row[options.primaryKey]])"> |
| 266 | + <i class="fa fa-trash-o"></i> |
| 267 | + </button> |
| 268 | + <router-link class="btn btn-info btn-xs" :title="$t('Edit')" :to="data.configUrl['showUrl'].replace('{id}',row[options.primaryKey])" v-if="data.configUrl['showUrl']"> |
| 269 | + <i class="fa fa-edit"></i> |
| 270 | + </router-link> |
| 271 | + </slot> |
| 272 | + </td> |
| 273 | + </tr> |
| 274 | + <tr v-show="is_empty"> |
| 275 | + <td :colspan="col_num" class="empty"> |
| 276 | + {{$t('Temporarily no data')}} |
| 277 | + </td> |
| 278 | + </tr> |
279 | 279 | </tbody>
|
280 | 280 | <tfoot >
|
281 |
| - <tr class="loading" v-if="loading"> |
282 |
| - <td colspan="6" class="overlay"> |
283 |
| - <div class="fa"> |
284 |
| - <i class="fa fa-refresh fa-spin"></i> |
285 |
| - <div class="explain"> |
286 |
| - {{$t('Loading')}}... |
287 |
| - </div> |
| 281 | + <tr class="loading" v-if="loading"> |
| 282 | + <td colspan="6" class="overlay"> |
| 283 | + <div class="fa"> |
| 284 | + <i class="fa fa-refresh fa-spin"></i> |
| 285 | + <div class="explain"> |
| 286 | + {{$t('Loading')}}... |
288 | 287 | </div>
|
289 |
| - </td> |
290 |
| - </tr> |
| 288 | + </div> |
| 289 | + </td> |
| 290 | + </tr> |
291 | 291 | </tfoot>
|
292 | 292 | </table>
|
293 | 293 | </slot>
|
|
510 | 510 | options['page'] = page;
|
511 | 511 | options['per_page'] = per_page;
|
512 | 512 | if(per_page!=this.data.list.per_page){
|
513 |
| - delete options['page']; |
| 513 | + options['page']=1; |
514 | 514 | }
|
| 515 | + delete options['get_count']; |
515 | 516 | this.getData(options);
|
516 | 517 | }
|
517 | 518 | },
|
|
523 | 524 | //过滤为空的数据
|
524 | 525 | if(options.where){
|
525 | 526 | options.where = collect(options.where).filter((value)=>{
|
526 |
| - return value!==''; |
| 527 | + return value!==''; |
527 | 528 | }).all();
|
528 | 529 | }
|
529 | 530 | options = copyObj(options);
|
|
539 | 540 | }
|
540 | 541 | //添加历史记录
|
541 | 542 | if(!options['get_count'] && !flog){
|
542 |
| - let query = copyObj(this.$route.query); |
| 543 | + let query = copyObj(this.$route.query); |
543 | 544 | query[this.options_key] = options_str;
|
544 | 545 | this.$router.push({ path: this.$router.currentRoute.path, query: query}).catch(()=>{});
|
545 | 546 | }
|
|
0 commit comments