vue2-components-plus 1.0.70 → 1.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -121,19 +121,11 @@
121
121
  :columns="columns"
122
122
  :action-buttons="actionButtons"
123
123
  :total="total"
124
- :current-page.sync="paginationState.currentPage"
125
- :page-size.sync="paginationState.pageSize"
126
124
  :table-props="mergedTableProps"
127
- :load-data="loadData"
128
- @search="handleSearch"
125
+ @search="loadData"
129
126
  @reset="handleReset"
130
127
  @add="handleAdd"
131
128
  @selection-change="handleSelectionChange"
132
- @sort-change="handleSortChange"
133
- @row-click="handleRowClick"
134
- @size-change="handleSizeChange"
135
- @current-change="handleCurrentChange"
136
- @page-change="handlePageChange"
137
129
  @link-click="handleLinkClick"
138
130
  >
139
131
  <!-- 容器扩展插槽示例:extend(位于搜索区与表格之间) -->
@@ -151,9 +143,9 @@
151
143
  <!-- 搜索项插槽示例:slot=item.slot -->
152
144
  <template v-slot:emailKeywordSlot="{ formData }">
153
145
  <el-input
154
- v-model="formData.emailKeyword"
146
+ v-model="formData.body"
155
147
  clearable
156
- placeholder="请输入邮箱关键字(自定义插槽)"
148
+ placeholder="请输入正文关键字(自定义插槽)"
157
149
  @keyup.enter.native="triggerSearchByEnter"
158
150
  />
159
151
  </template>
@@ -180,26 +172,13 @@
180
172
  <template v-slot:usernameHeader>
181
173
  <span>
182
174
  <i class="el-icon-link" />
183
- 用户名(link)
175
+ 标题(link)
184
176
  </span>
185
177
  </template>
186
178
 
187
- <!-- 单元格插槽示例:column.slot -->
188
- <template v-slot:status="{ row }">
189
- <el-tag size="small" :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag>
190
- </template>
191
- <template v-slot:gender="{ row }">
192
- <el-tag size="small" :type="row.gender === 1 ? 'primary' : 'danger'">
193
- {{ row.gender === 1 ? '男' : '女' }}
194
- </el-tag>
195
- </template>
196
- <template v-slot:department="{ row }">
197
- <el-tag size="small" effect="plain">{{ getDepartmentText(row.department) }}</el-tag>
198
- </template>
199
-
200
179
  <!-- action 按钮插槽示例:button.slot -->
201
180
  <template v-slot:deleteAction="{ row }">
202
- <el-button type="text" style="color: #f56c6c" :disabled="row.status === 0" @click="handleDelete(row)">
181
+ <el-button type="text" style="color: #f56c6c" @click="handleDelete(row)">
203
182
  删除
204
183
  </el-button>
205
184
  </template>
@@ -224,6 +203,8 @@
224
203
  <el-button @click="checkSelection">检查选择状态</el-button>
225
204
  <el-button @click="setSearchForm">回填搜索条件</el-button>
226
205
  <el-button @click="resetSearchForm">重置搜索表单</el-button>
206
+ <el-button type="primary" @click="showSearchParams">获取请求参数</el-button>
207
+ <el-button type="success" @click="refreshTable">刷新</el-button>
227
208
  </div>
228
209
  </el-card>
229
210
 
@@ -243,50 +224,53 @@
243
224
 
244
225
  <script setup>
245
226
  import { computed, getCurrentInstance, nextTick, onMounted, ref, watch } from 'vue'
246
- import { departmentOptions, fetchDepartmentOptions, fetchStatusOptions, filterUsers, mockUsers } from './mockData'
227
+
228
+ const POSTS_API = 'https://jsonplaceholder.typicode.com/posts'
247
229
 
248
230
  function createSearchItems() {
249
231
  return [
250
232
  {
251
- prop: 'month',
252
- label: '归属月',
233
+ prop: 'id',
234
+ label: '帖子 ID',
253
235
  span: 6,
254
- component: 'ElSelect',
236
+ component: 'ElInputNumber',
255
237
  attrs: {
256
- placeholder: '请选择归属月',
257
- clearable: true,
238
+ placeholder: '精确匹配(?id=)',
239
+ controlsPosition: 'right',
240
+ min: 1,
241
+ max: 100,
258
242
  },
259
- children: Array.from({ length: 12 }, function (_, index) {
260
- return {
261
- label: index + 1 + '月',
262
- value: String(index + 1),
263
- }
264
- }),
265
243
  },
266
244
  {
267
- prop: 'username',
268
- label: '用户名',
245
+ prop: 'userId',
246
+ label: '用户 ID',
269
247
  span: 6,
270
- component: 'ElInput',
248
+ component: 'ElSelect',
271
249
  attrs: {
272
- placeholder: '请输入用户名',
250
+ placeholder: '精确匹配(?userId=)',
273
251
  clearable: true,
274
252
  },
253
+ children: Array.from({ length: 10 }, function (_, index) {
254
+ return {
255
+ label: '用户 ' + (index + 1),
256
+ value: index + 1,
257
+ }
258
+ }),
275
259
  events: {},
276
260
  },
277
261
  {
278
- prop: 'realName',
279
- label: '真实姓名',
262
+ prop: 'q',
263
+ label: '关键字',
280
264
  span: 6,
281
265
  component: 'ElInput',
282
266
  attrs: {
283
- placeholder: '请输入真实姓名',
267
+ placeholder: '在 title / body 中模糊匹配(?q=)',
284
268
  clearable: true,
285
269
  },
286
270
  },
287
271
  {
288
- prop: 'emailKeyword',
289
- label: '邮箱关键字',
272
+ prop: 'body',
273
+ label: '正文关键字',
290
274
  span: 6,
291
275
  type: 'slot',
292
276
  slot: 'emailKeywordSlot',
@@ -294,79 +278,6 @@ function createSearchItems() {
294
278
  required: false,
295
279
  },
296
280
  },
297
- {
298
- prop: 'status',
299
- label: '状态',
300
- span: 6,
301
- component: 'ElSelect',
302
- attrs: {
303
- placeholder: '请选择状态',
304
- clearable: true,
305
- },
306
- children: [],
307
- },
308
- {
309
- prop: 'department',
310
- label: '部门',
311
- span: 6,
312
- component: 'ElSelect',
313
- attrs: {
314
- placeholder: '请选择部门',
315
- clearable: true,
316
- filterable: true,
317
- },
318
- children: [],
319
- },
320
- {
321
- prop: 'gender',
322
- label: '性别',
323
- span: 6,
324
- component: 'ElSelect',
325
- attrs: {
326
- placeholder: '请选择性别',
327
- clearable: true,
328
- },
329
- children: [
330
- { label: '全部', value: '' },
331
- { label: '男', value: 1 },
332
- { label: '女', value: 2 },
333
- ],
334
- },
335
- {
336
- prop: 'createTime',
337
- label: '创建时间',
338
- span: 6,
339
- component: 'ElDatePicker',
340
- attrs: {
341
- type: 'daterange',
342
- clearable: true,
343
- rangeSeparator: '至',
344
- startPlaceholder: '开始日期',
345
- endPlaceholder: '结束日期',
346
- valueFormat: 'yyyy-MM-dd',
347
- },
348
- },
349
- {
350
- prop: 'phone',
351
- label: '手机号',
352
- span: 6,
353
- component: 'ElInput',
354
- attrs: {
355
- placeholder: '请输入手机号',
356
- clearable: true,
357
- },
358
- },
359
- {
360
- prop: 'active',
361
- label: '是否激活',
362
- span: 6,
363
- component: 'ElSwitch',
364
- attrs: {
365
- activeText: '是',
366
- inactiveText: '否',
367
- },
368
- defaultValue: true,
369
- },
370
281
  ]
371
282
  }
372
283
 
@@ -375,94 +286,38 @@ function createColumns(context) {
375
286
  {
376
287
  prop: 'id',
377
288
  label: 'ID',
378
- width: 70,
379
- sortable: true,
289
+ width: 80,
290
+ sortable: 'custom',
380
291
  fixed: 'left',
292
+ align: 'center',
381
293
  },
382
294
  {
383
- prop: 'avatar',
384
- label: '头像(image)',
385
- width: 110,
386
- type: 'image',
387
- imageWidth: '34px',
388
- imageHeight: '34px',
389
- },
390
- {
391
- label: '基本信息',
392
- children: [
393
- {
394
- prop: 'username',
395
- label: '用户名',
396
- minWidth: 150,
397
- type: 'link',
398
- headerSlot: 'usernameHeader',
399
- linkText: '查看用户',
400
- },
401
- {
402
- prop: 'realName',
403
- label: '真实姓名',
404
- width: 120,
405
- },
406
- {
407
- prop: 'gender',
408
- label: '性别',
409
- width: 90,
410
- slot: 'gender',
411
- },
412
- {
413
- prop: 'level',
414
- label: '级别(enum)',
415
- width: 120,
416
- enum: [
417
- { label: '初级', value: 1 },
418
- { label: '中级', value: 2 },
419
- { label: '高级', value: 3 },
420
- ],
421
- },
422
- ],
295
+ prop: 'userId',
296
+ label: '用户 ID',
297
+ width: 100,
298
+ sortable: 'custom',
299
+ align: 'center',
423
300
  },
424
301
  {
425
- label: '组织信息',
426
- children: [
427
- {
428
- prop: 'department',
429
- label: '部门',
430
- width: 130,
431
- slot: 'department',
432
- },
433
- {
434
- prop: 'status',
435
- label: '状态(slot)',
436
- width: 110,
437
- slot: 'status',
438
- },
439
- ],
440
- },
441
- {
442
- label: '联系方式',
443
- children: [
444
- {
445
- prop: 'phone',
446
- label: '手机号',
447
- width: 140,
448
- },
449
- {
450
- prop: 'email',
451
- label: '邮箱',
452
- minWidth: 220,
453
- },
454
- ],
302
+ prop: 'title',
303
+ label: '标题(link)',
304
+ minWidth: 260,
305
+ type: 'link',
306
+ headerSlot: 'usernameHeader',
307
+ linkText: function (row) {
308
+ return row.title
309
+ },
455
310
  },
456
311
  {
457
- prop: 'createTime',
458
- label: '创建时间',
459
- width: 180,
460
- sortable: true,
312
+ prop: 'body',
313
+ label: '正文',
314
+ minWidth: 320,
315
+ showOverflowTooltip: true,
461
316
  },
462
317
  {
463
318
  type: 'action',
464
319
  label: '操作(action)',
465
- width: 300,
320
+ width: 220,
466
321
  fixed: 'right',
467
322
  buttons: [
468
323
  {
@@ -481,19 +336,6 @@ function createColumns(context) {
481
336
  context.handleEdit(row)
482
337
  },
483
338
  },
484
- {
485
- label: '禁用',
486
- type: 'text',
487
- show: function (row) {
488
- return row.status === 1
489
- },
490
- disabled: function (row) {
491
- return row.id % 2 === 0
492
- },
493
- handler: function (row) {
494
- context.handleDisable(row)
495
- },
496
- },
497
339
  {
498
340
  label: '删除',
499
341
  type: 'text',
@@ -509,26 +351,12 @@ const containerRef = ref()
509
351
  const loading = ref(false)
510
352
  const total = ref(0)
511
353
  const tableData = ref([])
512
- const searchParams = ref({})
513
- const sortState = ref({
514
- prop: '',
515
- order: '',
516
- })
517
354
  const selectedKeys = ref([])
518
355
  const eventLogs = ref([])
519
- const paginationMode = ref('backend')
520
- const mockUserCount = mockUsers.length
521
- const externalSearchParams = {
522
- source: 'vue2-demo',
523
- active: true,
524
- }
356
+ const externalSearchParams = {}
525
357
  const actionButtons = [{ label: '导出', key: 'export' }]
526
358
  const searchItems = ref(createSearchItems())
527
359
  const columns = ref([])
528
- const paginationState = ref({
529
- currentPage: 1,
530
- pageSize: 10,
531
- })
532
360
  const featureState = ref({
533
361
  showSearch: true,
534
362
  showSearchCollapse: true,
@@ -561,7 +389,7 @@ const mergedSearchProps = computed(function () {
561
389
  actionsWidth: featureState.value.searchActionsWidth,
562
390
  collapseToggleText: [featureState.value.searchCollapseExpandText, featureState.value.searchCollapseFoldText],
563
391
  showCollapse: featureState.value.showSearchCollapse,
564
- collapseLimit: 4,
392
+ collapseLimit: 3,
565
393
  actionsAlign: featureState.value.searchActionsAlign,
566
394
  }
567
395
  })
@@ -611,164 +439,89 @@ function logEvent(name, payload) {
611
439
  eventLogs.value = eventLogs.value.slice(0, 20)
612
440
  }
613
441
 
614
- function enrichRows(list) {
615
- return (list || []).map(function (item) {
616
- return {
617
- ...item,
618
- level: (item.id % 3) + 1,
619
- }
620
- })
621
- }
622
-
623
- function normalizeSearchParams(params) {
624
- const next = Object.assign({}, params)
625
- if (typeof next.emailKeyword === 'string') {
626
- next.emailKeyword = next.emailKeyword.trim()
627
- }
628
- if (typeof next.username === 'string') {
629
- next.username = next.username.trim()
630
- }
631
- return next
632
- }
633
-
634
- function applyExtraFilters(list) {
635
- if (!searchParams.value.emailKeyword) return list
636
- return list.filter(function (item) {
637
- return String(item.email || '').toLowerCase().indexOf(String(searchParams.value.emailKeyword).toLowerCase()) > -1
638
- })
639
- }
640
-
641
- function compareValue(a, b) {
642
- if (a === b) return 0
643
- if (a === undefined || a === null) return -1
644
- if (b === undefined || b === null) return 1
645
- const maybeDateA = new Date(a).getTime()
646
- const maybeDateB = new Date(b).getTime()
647
- if (!Number.isNaN(maybeDateA) && !Number.isNaN(maybeDateB)) {
648
- return maybeDateA - maybeDateB
649
- }
650
- if (typeof a === 'number' && typeof b === 'number') {
651
- return a - b
652
- }
653
- return String(a).localeCompare(String(b))
654
- }
655
-
656
- function applySort(list) {
657
- if (!sortState.value.prop || !sortState.value.order) {
658
- return list
659
- }
660
- const direction = sortState.value.order === 'ascending' ? 1 : -1
661
- return (list || []).slice().sort(function (left, right) {
662
- return compareValue(left[sortState.value.prop], right[sortState.value.prop]) * direction
663
- })
664
- }
665
-
666
442
  function triggerSearchByEnter() {
667
- handleSearch(containerRef.value ? containerRef.value.getSearchFormData() : {})
443
+ if (containerRef.value && containerRef.value.reload) {
444
+ containerRef.value.reload()
445
+ }
668
446
  }
669
447
 
670
448
  function applyEnabledQuickFilter(formData, doSearch) {
671
449
  if (!formData) return
672
- formData.active = true
450
+ formData.userId = 1
673
451
  if (typeof doSearch === 'function') {
674
452
  doSearch()
675
453
  }
676
454
  }
677
455
 
678
- function getStatusType(status) {
679
- return status === 1 ? 'success' : 'danger'
680
- }
681
-
682
- function getStatusText(status) {
683
- return status === 1 ? '启用' : '禁用'
684
- }
685
-
686
- function getDepartmentText(value) {
687
- const matched = departmentOptions.find(function (item) {
688
- return item.value === value
456
+ function buildQuery(params) {
457
+ const usp = new URLSearchParams()
458
+ Object.keys(params).forEach(function (key) {
459
+ const value = params[key]
460
+ if (value === undefined || value === null || value === '') return
461
+ usp.append(key, String(value))
689
462
  })
690
- return matched ? matched.label : value
691
- }
692
-
693
- function getCurrentPagination() {
694
- return containerRef.value && containerRef.value.getPagination
695
- ? containerRef.value.getPagination()
696
- : { currentPage1: 1, pageSize1: paginationState.value.pageSize }
697
- }
698
-
699
- function paginateList(list, pagination) {
700
- const currentPage = Number(pagination.currentPage1 || 1)
701
- const pageSize = Number(pagination.pageSize1 || 10)
702
- const start = (currentPage - 1) * pageSize
703
- return (list || []).slice(start, start + pageSize)
463
+ return usp.toString()
704
464
  }
705
465
 
706
- function resetContainerPage() {
707
- paginationState.value.currentPage = 1
708
- if (containerRef.value && containerRef.value.internalPagination) {
709
- containerRef.value.internalPagination.currentPage = 1
466
+ async function fetchPosts(query) {
467
+ const params = query || {}
468
+ const requestParams = {
469
+ _page: params.currentPage1 || 1,
470
+ _limit: params.pageSize1 || 10,
471
+ }
472
+ const keyword = String(params.q || '').trim()
473
+ if (keyword) requestParams.q = keyword
474
+ if (params.id) requestParams.id = params.id
475
+ if (params.userId) requestParams.userId = params.userId
476
+ const body = String(params.body || '').trim()
477
+ if (body) requestParams.body_like = body
478
+ const sort = params.sort || {}
479
+ if (sort.prop && sort.order) {
480
+ requestParams._sort = sort.prop
481
+ requestParams._order = sort.order === 'ascending' ? 'asc' : 'desc'
710
482
  }
711
- }
712
483
 
713
- function handlePaginationModeChange() {
714
- if (containerRef.value) {
715
- containerRef.value.clearAllSelection()
484
+ const response = await fetch(POSTS_API + '?' + buildQuery(requestParams), {
485
+ method: 'GET',
486
+ headers: { Accept: 'application/json' },
487
+ })
488
+ if (!response.ok) {
489
+ throw new Error('HTTP ' + response.status)
716
490
  }
717
- selectedKeys.value = []
718
- resetContainerPage()
719
- logEvent('pagination-mode-change', paginationMode.value)
720
- loadData()
721
- proxy.$message.success('已切换为' + (paginationMode.value === 'frontend' ? '前端分页' : '后端分页'))
491
+ const list = await response.json()
492
+ const totalHeader = Number(response.headers.get('x-total-count')) || (Array.isArray(list) ? list.length : 0)
493
+ return { list: Array.isArray(list) ? list : [], total: totalHeader }
722
494
  }
723
495
 
724
- async function loadData() {
496
+ async function loadData(query) {
725
497
  loading.value = true
726
498
  try {
727
- await new Promise(function (resolve) {
728
- setTimeout(resolve, 250)
729
- })
730
-
731
- const pageConfig = {
732
- pageNumberKey: 'currentPage1',
733
- pageSizeKey: 'pageSize1',
499
+ logEvent('search', query)
500
+ const result = await fetchPosts(query)
501
+ let list = result.list
502
+ if (query && query.body) {
503
+ const keyword = String(query.body).trim().toLowerCase()
504
+ if (keyword) {
505
+ list = list.filter(function (item) {
506
+ return String(item.body || '').toLowerCase().indexOf(keyword) !== -1
507
+ })
508
+ }
734
509
  }
735
-
736
- const filtered = filterUsers(
737
- mockUsers,
738
- searchParams.value,
739
- { currentPage1: 1, pageSize1: mockUserCount || 10 },
740
- pageConfig,
741
- )
742
- const enrichedList = enrichRows(filtered.list)
743
- const extraFilteredList = applyExtraFilters(enrichedList)
744
- const sortedList = applySort(extraFilteredList)
745
-
746
- if (paginationMode.value === 'frontend') {
747
- const pagination = getCurrentPagination()
748
- tableData.value = paginateList(sortedList, pagination)
749
- total.value = sortedList.length
750
- return
751
- }
752
-
753
- const pagination = getCurrentPagination()
754
- tableData.value = paginateList(sortedList, pagination)
755
- total.value = sortedList.length
510
+ tableData.value = list
511
+ total.value = result.total
756
512
  } catch (error) {
757
- proxy.$message.error('加载表格数据失败')
513
+ if (proxy && proxy.$message) {
514
+ proxy.$message.error('加载表格数据失败:' + (error && error.message ? error.message : ''))
515
+ }
516
+ tableData.value = []
517
+ total.value = 0
758
518
  } finally {
759
519
  loading.value = false
760
520
  }
761
521
  }
762
522
 
763
- function handleSearch(params) {
764
- const normalized = normalizeSearchParams(params)
765
- searchParams.value = normalized
766
- logEvent('search', normalized)
767
- loadData()
768
- }
769
-
770
523
  function handleReset() {
771
- logEvent('reset', searchParams.value)
524
+ logEvent('reset', {})
772
525
  proxy.$message.info('搜索条件已重置')
773
526
  }
774
527
 
@@ -780,37 +533,12 @@ function handleSelectionChange(selection) {
780
533
  logEvent('selection-change', keys)
781
534
  }
782
535
 
783
- function handleSortChange(sort) {
784
- sortState.value = sort || { prop: '', order: '' }
785
- logEvent('sort-change', sortState.value)
786
- loadData()
787
- }
788
-
789
- function handleRowClick(row, column) {
790
- logEvent('row-click', {
791
- id: row.id,
792
- column: column && column.property,
793
- })
794
- }
795
-
796
- function handleSizeChange(size) {
797
- logEvent('size-change', size)
798
- }
799
-
800
- function handleCurrentChange(page) {
801
- logEvent('current-change', page)
802
- }
803
-
804
- function handlePageChange(payload) {
805
- logEvent('page-change', payload)
806
- }
807
-
808
536
  function handleLinkClick(row, column) {
809
537
  logEvent('link-click', {
810
538
  id: row.id,
811
539
  prop: column && column.prop,
812
540
  })
813
- proxy.$message.info('点击了链接列:' + row.username)
541
+ proxy.$message.info('点击了标题链接:#' + row.id)
814
542
  }
815
543
 
816
544
  function getSelectedRows() {
@@ -854,9 +582,9 @@ function checkSelection() {
854
582
  function setSearchForm() {
855
583
  if (!containerRef.value) return
856
584
  containerRef.value.setSearchFormData({
857
- username: 'zhang',
858
- status: 1,
859
- emailKeyword: 'example',
585
+ userId: 1,
586
+ q: 'qui',
587
+ body: 'rerum',
860
588
  })
861
589
  proxy.$message.success('已回填搜索条件,可点击“查询”查看效果')
862
590
  }
@@ -867,17 +595,34 @@ function resetSearchForm() {
867
595
  proxy.$message.success('已重置搜索表单')
868
596
  }
869
597
 
598
+ function showSearchParams() {
599
+ if (!containerRef.value || !containerRef.value.getSearchParams) return
600
+ const params = containerRef.value.getSearchParams()
601
+ proxy.$alert(JSON.stringify(params, null, 2), '当前请求参数(getSearchParams)', {
602
+ confirmButtonText: '知道了',
603
+ })
604
+ }
605
+
606
+ function refreshTable() {
607
+ if (!containerRef.value || !containerRef.value.refresh) return
608
+ containerRef.value.refresh()
609
+ proxy.$message.success('已触发刷新')
610
+ }
611
+
870
612
  function reloadWithMessage() {
871
- loadData()
613
+ if (containerRef.value && containerRef.value.reload) {
614
+ containerRef.value.reload()
615
+ }
872
616
  proxy.$message.success('已刷新数据')
873
617
  }
874
618
 
875
619
  function clearSortState() {
876
- sortState.value = {
877
- prop: '',
878
- order: '',
620
+ if (containerRef.value && containerRef.value.$refs && containerRef.value.$refs.tableRef && containerRef.value.$refs.tableRef.clearSort) {
621
+ containerRef.value.$refs.tableRef.clearSort()
622
+ }
623
+ if (containerRef.value && containerRef.value.reload) {
624
+ containerRef.value.reload()
879
625
  }
880
- loadData()
881
626
  proxy.$message.success('已重置排序')
882
627
  }
883
628
 
@@ -887,28 +632,22 @@ function handleAdd() {
887
632
  }
888
633
 
889
634
  function handleView(row) {
890
- proxy.$message.info('查看:' + row.username)
635
+ proxy.$message.info('查看:#' + row.id + ' ' + row.title)
891
636
  }
892
637
 
893
638
  function handleEdit(row) {
894
- proxy.$message.success('编辑:' + row.username)
895
- }
896
-
897
- function handleDisable(row) {
898
- proxy.$message.warning('已模拟禁用:' + row.username)
639
+ proxy.$message.success('编辑:#' + row.id + ' ' + row.title)
899
640
  }
900
641
 
901
642
  function handleDelete(row) {
902
- if (row.status === 0) {
903
- proxy.$message.warning('禁用状态用户不可删除')
904
- return
905
- }
906
- proxy.$confirm('确认删除用户“' + row.username + '”吗?', '提示', {
643
+ proxy.$confirm('确认删除帖子“' + row.title + '”吗?', '提示', {
907
644
  type: 'warning',
908
645
  })
909
646
  .then(() => {
910
- proxy.$message.success('已模拟删除:' + row.username)
911
- loadData()
647
+ proxy.$message.success('已模拟删除:#' + row.id)
648
+ if (containerRef.value && containerRef.value.reload) {
649
+ containerRef.value.reload()
650
+ }
912
651
  })
913
652
  .catch(function () {})
914
653
  }
@@ -925,7 +664,6 @@ watch(
925
664
  columns.value = createColumns({
926
665
  handleView,
927
666
  handleEdit,
928
- handleDisable,
929
667
  handleDelete,
930
668
  })
931
669
  searchItems.value[1].events.keyup = function (event) {
@@ -935,12 +673,8 @@ searchItems.value[1].events.keyup = function (event) {
935
673
  }
936
674
 
937
675
  onMounted(async () => {
938
- const statusOptions = await fetchStatusOptions()
939
- const departmentList = await fetchDepartmentOptions()
940
- searchItems.value[4].children = statusOptions
941
- searchItems.value[5].children = departmentList
942
676
  await nextTick()
943
- if (containerRef.value) {
677
+ if (containerRef.value && containerRef.value.initSearchAndLoad) {
944
678
  containerRef.value.initSearchAndLoad()
945
679
  }
946
680
  })