diff --git a/src/views/tested/device/model/components/list.vue b/src/views/tested/device/model/components/list.vue index fa709c8..c31a212 100644 --- a/src/views/tested/device/model/components/list.vue +++ b/src/views/tested/device/model/components/list.vue @@ -16,7 +16,7 @@ category: '', equipmentName: '', helpInstruction: '', - inspectable: '', + inspectable: [], model: '', offset: 1, limit: 20, @@ -72,11 +72,7 @@ // 获取数据 const fetchData = (isNowPage = true) => { listLoading.value = true - if (!isNowPage) { - // 是否显示当前页,否则跳转第一页 - listQuery.offset = 1 - } - getModelList(listQuery).then((response) => { + getModelList({ ...listQuery, inspectable: listQuery.inspectable.join() }).then((response) => { list.value = response.data.rows.map((item: any) => ({ ...item, helpInstruction: item.helpInstruction ? item.helpInstruction : '/' })) total.value = parseInt(response.data.total) listLoading.value = false @@ -96,7 +92,7 @@ if (val && val.page) { listQuery.offset = val.page } - fetchData() + search() } const $router = useRouter() // 新建编辑操作 @@ -136,7 +132,7 @@ } // 导出列表 const exportList = () => { - if (list.value.length) { + if (selectList.value.length) { const loading = ElLoading.service({ lock: true, text: 'Loading', @@ -147,17 +143,20 @@ offset: undefined, limit: undefined, ids: selectList.value.map(item => item.id), + inspectable: listQuery.inspectable.join(), } exportModelList(data).then((res) => { exportFile(res.data, '设备规格型号') loading.close() + // selectList.value = [] + // search() }) .catch((_) => { loading.close() }) } else { - ElMessage.warning('无可导出内容') + ElMessage.warning('请选择需要导出的数据') } } // 打开文件 @@ -227,6 +226,7 @@ helpList.value = Array.from(new Set(res.data.filter((item: any) => item.helpInstruction).map((item: any) => item.helpInstruction))).sort() }) } + // search() }, { deep: true, }) @@ -262,7 +262,7 @@ // 重置 const reset = () => { listQuery.equipmentType = '' - listQuery.inspectable = '' + listQuery.inspectable = [] listQuery.category = '' listQuery.equipmentName = '' listQuery.helpInstruction = ''