Commit 5ab0fe2d3bf24238cd65cf6f7574ce73ccaf15d0

Authored by ww
1 parent 777e82cd

fix: 修改产品详情跳转设备列表查询pageSize参数不正确

@@ -182,7 +182,7 @@ @@ -182,7 +182,7 @@
182 </div> 182 </div>
183 </template> 183 </template>
184 <script lang="ts"> 184 <script lang="ts">
185 - import { defineComponent, reactive, unref, nextTick, h, onUnmounted, ref } from 'vue'; 185 + import { defineComponent, reactive, unref, h, onMounted } from 'vue';
186 import { 186 import {
187 DeviceModel, 187 DeviceModel,
188 DeviceRecord, 188 DeviceRecord,
@@ -216,7 +216,7 @@ @@ -216,7 +216,7 @@
216 import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; 216 import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
217 import { QuestionCircleOutlined } from '@ant-design/icons-vue'; 217 import { QuestionCircleOutlined } from '@ant-design/icons-vue';
218 import { Authority } from '/@/components/Authority'; 218 import { Authority } from '/@/components/Authority';
219 - import { useRouter } from 'vue-router'; 219 + import { useRoute, useRouter } from 'vue-router';
220 import { useBatchOperation } from '/@/utils/useBatchOperation'; 220 import { useBatchOperation } from '/@/utils/useBatchOperation';
221 221
222 export default defineComponent({ 222 export default defineComponent({
@@ -243,7 +243,7 @@ @@ -243,7 +243,7 @@
243 const { createMessage } = useMessage(); 243 const { createMessage } = useMessage();
244 const go = useGo(); 244 const go = useGo();
245 const ROUTER = useRouter(); 245 const ROUTER = useRouter();
246 - const immediateStatus = ref(false); 246 + const ROUTE = useRoute();
247 const searchInfo = reactive<Recordable>({}); 247 const searchInfo = reactive<Recordable>({});
248 const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); 248 const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
249 const [registerModal, { openModal }] = useModal(); 249 const [registerModal, { openModal }] = useModal();
@@ -259,9 +259,7 @@ @@ -259,9 +259,7 @@
259 reload, 259 reload,
260 setLoading, 260 setLoading,
261 setSelectedRowKeys, 261 setSelectedRowKeys,
262 - setTableData,  
263 getForm, 262 getForm,
264 - setPagination,  
265 getSelectRowKeys, 263 getSelectRowKeys,
266 getSelectRows, 264 getSelectRows,
267 getRowSelection, 265 getRowSelection,
@@ -269,17 +267,13 @@ @@ -269,17 +267,13 @@
269 ] = useTable({ 267 ] = useTable({
270 title: '设备列表', 268 title: '设备列表',
271 api: devicePage, 269 api: devicePage,
272 - immediate: immediateStatus.value,  
273 columns, 270 columns,
274 beforeFetch: (params) => { 271 beforeFetch: (params) => {
275 const { deviceProfileId } = params; 272 const { deviceProfileId } = params;
276 const obj = { 273 const obj = {
277 ...params, 274 ...params,
278 ...{ 275 ...{
279 - deviceProfileIds:  
280 - deviceProfileId === undefined || deviceProfileId === null || deviceProfileId == ''  
281 - ? null  
282 - : [deviceProfileId], 276 + deviceProfileIds: deviceProfileId ? [deviceProfileId] : null,
283 }, 277 },
284 }; 278 };
285 delete obj.deviceProfileId; 279 delete obj.deviceProfileId;
@@ -313,54 +307,6 @@ @@ -313,54 +307,6 @@
313 307
314 const { isExistOption } = useBatchOperation(getRowSelection, setSelectedRowKeys); 308 const { isExistOption } = useBatchOperation(getRowSelection, setSelectedRowKeys);
315 309
316 - function getParams(keyword) {  
317 - const reg = new RegExp('(^|&)' + keyword + '=([^&]*)(&|$)', 'i');  
318 - const r = window.location.search.substr(1).match(reg);  
319 - if (r != null) return unescape(r[2]);  
320 - return null; //注意此处参数是中文,解码使用的方法是unescape ,那么在传值的时候如果是中文,需要使用escape('曲浩')方法来编码。  
321 - }  
322 -  
323 - const count = ref(0);  
324 - const onCloseVal = ref(0);  
325 - const deviceProfileId = ref('');  
326 - count.value = Number(getParams('count'));  
327 - deviceProfileId.value = getParams('deviceProfileId') || '';  
328 - const setRowClassName = async () => {  
329 - if (deviceProfileId.value !== undefined) {  
330 - const { items, total } = await devicePage({  
331 - page: 1,  
332 - pageSize: count.value === 0 ? 10 : count.value,  
333 - deviceProfileIds:  
334 - deviceProfileId.value === undefined ||  
335 - deviceProfileId.value === null ||  
336 - deviceProfileId.value == ''  
337 - ? null  
338 - : [deviceProfileId.value],  
339 - });  
340 - setPagination({ total });  
341 - nextTick(() => {  
342 - setTableData(items);  
343 - const { setFieldsValue, resetFields } = getForm();  
344 - setFieldsValue({  
345 - deviceProfileId: deviceProfileId.value || null,  
346 - });  
347 - if (onCloseVal.value == 1) {  
348 - resetFields();  
349 - }  
350 - });  
351 - } else {  
352 - setTimeout(() => {  
353 - reload();  
354 - }, 80);  
355 - }  
356 - };  
357 - setRowClassName();  
358 - onUnmounted(() => {  
359 - deviceProfileId.value = '';  
360 - count.value = 10;  
361 - onCloseVal.value = 1;  
362 - });  
363 -  
364 const userInfo: any = getAuthCache(USER_INFO_KEY); 310 const userInfo: any = getAuthCache(USER_INFO_KEY);
365 const role: string = userInfo.roles[0]; 311 const role: string = userInfo.roles[0];
366 312
@@ -494,6 +440,11 @@ @@ -494,6 +440,11 @@
494 reload(); 440 reload();
495 }; 441 };
496 442
  443 + onMounted(() => {
  444 + const queryParams = ROUTE.query as Record<'deviceProfileId', undefined | string>;
  445 + const { setFieldsValue } = getForm();
  446 + setFieldsValue({ deviceProfileId: queryParams.deviceProfileId });
  447 + });
497 return { 448 return {
498 registerTable, 449 registerTable,
499 handleCreate, 450 handleCreate,
@@ -66,6 +66,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { @@ -66,6 +66,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
66 build: { 66 build: {
67 target: 'es2015', 67 target: 'es2015',
68 outDir: OUTPUT_DIR, 68 outDir: OUTPUT_DIR,
  69 + // minify: 'terser', // The minify mode is set to use terser to remove console
69 terserOptions: { 70 terserOptions: {
70 compress: { 71 compress: {
71 keep_infinity: true, 72 keep_infinity: true,