Commit 424b171e0db727f5e0157cbcfd5460f15f8ea609

Authored by 无木
1 parent 9de6ac11

fix(demo): account list fetch loss param

修复账号管理列表发起请求时可能缺少当前选中的部门ID参数的问题

fixed: #830
src/views/demo/system/account/index.vue
1 <template> 1 <template>
2 <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> 2 <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
3 <DeptTree class="w-1/4 xl:w-1/5" @select="handleSelect" /> 3 <DeptTree class="w-1/4 xl:w-1/5" @select="handleSelect" />
4 - <BasicTable @register="registerTable" class="w-3/4 xl:w-4/5"> 4 + <BasicTable @register="registerTable" class="w-3/4 xl:w-4/5" :searchInfo="searchInfo">
5 <template #toolbar> 5 <template #toolbar>
6 <a-button type="primary" @click="handleCreate">新增账号</a-button> 6 <a-button type="primary" @click="handleCreate">新增账号</a-button>
7 </template> 7 </template>
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 </PageWrapper> 35 </PageWrapper>
36 </template> 36 </template>
37 <script lang="ts"> 37 <script lang="ts">
38 - import { defineComponent } from 'vue'; 38 + import { defineComponent, reactive } from 'vue';
39 39
40 import { BasicTable, useTable, TableAction } from '/@/components/Table'; 40 import { BasicTable, useTable, TableAction } from '/@/components/Table';
41 import { getAccountList } from '/@/api/demo/system'; 41 import { getAccountList } from '/@/api/demo/system';
@@ -54,6 +54,7 @@ @@ -54,6 +54,7 @@
54 setup() { 54 setup() {
55 const go = useGo(); 55 const go = useGo();
56 const [registerModal, { openModal }] = useModal(); 56 const [registerModal, { openModal }] = useModal();
  57 + const searchInfo = reactive<Recordable>({});
57 const [registerTable, { reload, updateTableDataRecord }] = useTable({ 58 const [registerTable, { reload, updateTableDataRecord }] = useTable({
58 title: '账号列表', 59 title: '账号列表',
59 api: getAccountList, 60 api: getAccountList,
@@ -104,7 +105,8 @@ @@ -104,7 +105,8 @@
104 } 105 }
105 106
106 function handleSelect(deptId = '') { 107 function handleSelect(deptId = '') {
107 - reload({ searchInfo: { deptId } }); 108 + searchInfo.deptId = deptId;
  109 + reload();
108 } 110 }
109 111
110 function handleView(record: Recordable) { 112 function handleView(record: Recordable) {
@@ -120,6 +122,7 @@ @@ -120,6 +122,7 @@
120 handleSuccess, 122 handleSuccess,
121 handleSelect, 123 handleSelect,
122 handleView, 124 handleView,
  125 + searchInfo,
123 }; 126 };
124 }, 127 },
125 }); 128 });