Commit 2c52c3682c8a047847a6580eee2e67a7084f6ada

Authored by 杨泽宇
1 parent 581ab9d6

debug 分页

src/api/request.ts
... ... @@ -35,7 +35,7 @@ instance.interceptors.response.use(
35 35 case 10002:
36 36 ElMessage.error(response?.data?.errorMessage || '登录失效');
37 37 router.replace({
38   - path: 'login'
  38 + path: '/login'
39 39 })
40 40 break;
41 41 case 500:
... ...
src/views/notify/index.vue
... ... @@ -60,22 +60,6 @@ const getList = async () => {
60 60 }
61 61 };
62 62 /**
63   - * 分页回调
64   - * @param {number} page 当前页码
65   - * @param {number} size 每页内容条数
66   - */
67   -const handlePageChange = (page, size) => {
68   - data.params.query.page = page;
69   - data.params.query.pageSize = size;
70   - getList();
71   -};
72   -/**
73   - * 查询
74   - */
75   -const handleSearch = () => {
76   - getList();
77   -};
78   -/**
79 63 * 表格选中响应
80 64 * @param {array} data 选中的一条数据
81 65 */
... ... @@ -158,7 +142,7 @@ onMounted(() => {
158 142 </el-date-picker>
159 143 </el-form-item>
160 144 <el-form-item>
161   - <el-button type="primary" @click="handleSearch">查询</el-button>
  145 + <el-button type="primary" @click="getList">查询</el-button>
162 146 <el-button type="primary">
163 147 <router-link to="/notify/edit">添加公告</router-link>
164 148 </el-button>
... ... @@ -246,9 +230,9 @@ onMounted(() =&gt; {
246 230 </el-table>
247 231 <Pagination
248 232 :total="data.params.total"
249   - :currentPage="data.params.query.page"
250   - :pageSize="data.params.query.pageSize"
251   - @pageChange="handlePageChange"
  233 + v-model:currentPage="data.params.query.page"
  234 + v-model:pageSize="data.params.query.pageSize"
  235 + @pageChange="getList"
252 236 ></Pagination>
253 237 </div>
254 238 </template>
... ...
src/views/property/index.vue
... ... @@ -53,20 +53,6 @@ const getList = async () =&gt; {
53 53 }
54 54 };
55 55 /**
56   - * 分页
57   - */
58   -const handlePageChange = (page, size) => {
59   - data.params.query.page = page;
60   - data.params.query.pageSize = size;
61   - getList();
62   -};
63   -/**
64   - * 查询
65   - */
66   -const handleSearch = () => {
67   - getList();
68   -};
69   -/**
70 56 * 切换状态
71 57 * @param {object} 单条数据对象
72 58 */
... ... @@ -139,11 +125,11 @@ onMounted(() =&gt; {
139 125 v-model.trim="data.params.query.name"
140 126 placeholder="请填写物业名称"
141 127 maxlength="15"
142   - @change="handleSearch"
  128 + @change="getList"
143 129 />
144 130 </el-form-item>
145 131 <el-form-item>
146   - <el-button type="primary" @click="handleSearch">查询</el-button>
  132 + <el-button type="primary" @click="getList">查询</el-button>
147 133 <el-button type="primary">
148 134 <router-link to="/property/edit">创建物业</router-link>
149 135 </el-button>
... ... @@ -215,7 +201,7 @@ onMounted(() =&gt; {
215 201 :total="data.params.total"
216 202 v-model:currentPage="data.params.query.page"
217 203 v-model:pageSize="data.params.query.pageSize"
218   - @pageChange="handlePageChange"
  204 + @pageChange="getList"
219 205 ></Pagination>
220 206 </div>
221 207 </template>
... ...
src/views/role/index.vue
... ... @@ -56,22 +56,6 @@ const getList = async () =&gt; {
56 56 }
57 57 };
58 58 /**
59   - * 分页回调
60   - * @param {number} page 当前页码
61   - * @param {number} size 每页内容条数
62   - */
63   -const handlePageChange = (page, size) => {
64   - data.params.query.page = page;
65   - data.params.query.pageSize = size;
66   - getList();
67   -};
68   -/**
69   - * 查询
70   - */
71   -const handleSearch = () => {
72   - getList();
73   -};
74   -/**
75 59 * 删除
76 60 * @param {object} obj 要删除的数据对象
77 61 */
... ... @@ -145,11 +129,11 @@ onMounted(() =&gt; {
145 129 v-model.trim="data.params.query.roleName"
146 130 placeholder="请填写角色名"
147 131 maxlength="15"
148   - @change="handleSearch"
  132 + @change="getList"
149 133 />
150 134 </el-form-item>
151 135 <el-form-item>
152   - <el-button type="primary" @click="handleSearch">查询</el-button>
  136 + <el-button type="primary" @click="getList">查询</el-button>
153 137 <!-- 超管不能创建角色 -->
154 138 <el-button
155 139 type="primary"
... ... @@ -234,9 +218,9 @@ onMounted(() =&gt; {
234 218 </el-table>
235 219 <Pagination
236 220 :total="data.params.total"
237   - :currentPage="data.params.query.page"
238   - :pageSize="data.params.query.pageSize"
239   - @pageChange="handlePageChange"
  221 + v-model:currentPage="data.params.query.page"
  222 + v-model:pageSize="data.params.query.pageSize"
  223 + @pageChange="getList"
240 224 ></Pagination>
241 225 </div>
242 226 </template>
... ...
src/views/role/user.vue
... ... @@ -52,16 +52,6 @@ const getList = async () =&gt; {
52 52 data.loading = false;
53 53 }
54 54 };
55   -/**
56   - * 分页
57   - * @param {number} page 当前页数
58   - * @param {number} size 每页内容条数
59   - */
60   -const handlePageChange = (page, size) => {
61   - data.params.query.page = page;
62   - data.params.query.pageSize = size;
63   - getList();
64   -};
65 55 onMounted(() => {
66 56 data.params.query.roleId = useRoute().query.id;
67 57 getList();
... ... @@ -95,9 +85,9 @@ onMounted(() =&gt; {
95 85 </el-table>
96 86 <Pagination
97 87 :total="data.params.total"
98   - :currentPage="data.params.query.page"
99   - :pageSize="data.params.query.pageSize"
100   - @pageChange="handlePageChange"
  88 + v-model:currentPage="data.params.query.page"
  89 + v-model:pageSize="data.params.query.pageSize"
  90 + @pageChange="getList"
101 91 ></Pagination>
102 92 </div>
103 93 </template>
... ...
src/views/user/index.vue
... ... @@ -53,22 +53,6 @@ const getList = async () =&gt; {
53 53 }
54 54 };
55 55 /**
56   - * 分页回调
57   - * @param {number} page 当前页码
58   - * @param {number} size 每页内容条数
59   - */
60   -const handlePageChange = (page, size) => {
61   - data.params.query.page = page;
62   - data.params.query.pageSize = size;
63   - getList();
64   -};
65   -/**
66   - * 查询
67   - */
68   -const handleSearch = () => {
69   - getList();
70   -};
71   -/**
72 56 * 删除
73 57 * @param {object} obj 要删除的数据对象
74 58 */
... ... @@ -163,7 +147,7 @@ onMounted(() =&gt; {
163 147 v-model.trim="data.params.query.userName"
164 148 placeholder="请填写用户名"
165 149 maxlength="15"
166   - @change="handleSearch"
  150 + @change="getList"
167 151 />
168 152 </el-form-item>
169 153 <el-form-item label="手机号">
... ... @@ -171,11 +155,11 @@ onMounted(() =&gt; {
171 155 v-model.trim="data.params.query.cellphone"
172 156 placeholder="请填写用户手机号"
173 157 maxlength="15"
174   - @change="handleSearch"
  158 + @change="getList"
175 159 />
176 160 </el-form-item>
177 161 <el-form-item>
178   - <el-button type="primary" @click="handleSearch">查询</el-button>
  162 + <el-button type="primary" @click="getList">查询</el-button>
179 163 <el-button type="primary">
180 164 <router-link to="/user/edit">添加用户</router-link>
181 165 </el-button>
... ... @@ -280,9 +264,9 @@ onMounted(() =&gt; {
280 264 </el-table>
281 265 <Pagination
282 266 :total="data.params.total"
283   - :currentPage="data.params.query.page"
284   - :pageSize="data.params.query.pageSize"
285   - @pageChange="handlePageChange"
  267 + v-model:currentPage="data.params.query.page"
  268 + v-model:pageSize="data.params.query.pageSize"
  269 + @pageChange="getList"
286 270 ></Pagination>
287 271 </div>
288 272 </template>
... ...