From 8ab2376871bfca1dfdd8066d949d6baf84723aba Mon Sep 17 00:00:00 2001 From: liushilong <2224574157@qq.com> Date: Sat, 13 Apr 2024 09:59:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=86=B2=E7=AA=81=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 9 +- eslint.config.js | 1 + src/views/task/aside/TaskList.vue | 67 ++- src/views/worksheet/content/Content.vue | 601 ++++++++++++------------ 4 files changed, 345 insertions(+), 333 deletions(-) diff --git a/components.d.ts b/components.d.ts index 11049e1..e12f925 100644 --- a/components.d.ts +++ b/components.d.ts @@ -11,6 +11,7 @@ declare module 'vue' { BasicModal: typeof import('./src/components/Modal/BasicModal.vue')['default'] DataHeader: typeof import('./src/components/DataHeader/index.vue')['default'] NAvatar: typeof import('naive-ui')['NAvatar'] + NBackTop: typeof import('naive-ui')['NBackTop'] NButton: typeof import('naive-ui')['NButton'] NCard: typeof import('naive-ui')['NCard'] NCheckbox: typeof import('naive-ui')['NCheckbox'] @@ -21,6 +22,8 @@ declare module 'vue' { NDialogProvider: typeof import('naive-ui')['NDialogProvider'] NDivider: typeof import('naive-ui')['NDivider'] NDropdown: typeof import('naive-ui')['NDropdown'] + NEllipsis: typeof import('naive-ui')['NEllipsis'] + NEmpty: typeof import('naive-ui')['NEmpty'] NForm: typeof import('naive-ui')['NForm'] NFormItem: typeof import('naive-ui')['NFormItem'] NGi: typeof import('naive-ui')['NGi'] @@ -32,16 +35,20 @@ declare module 'vue' { NModal: typeof import('naive-ui')['NModal'] NNotificationProvider: typeof import('naive-ui')['NNotificationProvider'] NotPassed: typeof import('./src/components/NotPassed.vue')['default'] + NPopconfirm: typeof import('naive-ui')['NPopconfirm'] NPopover: typeof import('naive-ui')['NPopover'] NPopselect: typeof import('naive-ui')['NPopselect'] - NProgress: typeof import('naive-ui')['NProgress'] NScrollbar: typeof import('naive-ui')['NScrollbar'] NSelect: typeof import('naive-ui')['NSelect'] NSlider: typeof import('naive-ui')['NSlider'] NSpace: typeof import('naive-ui')['NSpace'] NSpin: typeof import('naive-ui')['NSpin'] NSwitch: typeof import('naive-ui')['NSwitch'] + NTabPane: typeof import('naive-ui')['NTabPane'] + NTabs: typeof import('naive-ui')['NTabs'] NTag: typeof import('naive-ui')['NTag'] + NTimeline: typeof import('naive-ui')['NTimeline'] + NTimelineItem: typeof import('naive-ui')['NTimelineItem'] NTooltip: typeof import('naive-ui')['NTooltip'] NUpload: typeof import('naive-ui')['NUpload'] NUploadDragger: typeof import('naive-ui')['NUploadDragger'] diff --git a/eslint.config.js b/eslint.config.js index ffa7b3b..ccea1a7 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -26,6 +26,7 @@ module.exports = antfu( // eslint-disable-next-line node/prefer-global/process process.env.MODE === 'production' ? 2 : 0, ], + 'array-callback-return': ['error', { allowImplicit: true }], }, }, ) diff --git a/src/views/task/aside/TaskList.vue b/src/views/task/aside/TaskList.vue index acb1bba..024f8d4 100644 --- a/src/views/task/aside/TaskList.vue +++ b/src/views/task/aside/TaskList.vue @@ -4,7 +4,6 @@ import { defineProps, onMounted, onUnmounted, reactive, ref, watch } from 'vue' import ListItem from './ListItem.vue' import emitter from '@/utils/mitt' import { useTaskStore } from '@/store/modules/task' -import { filter } from 'lodash' defineProps({ showFieldList: { @@ -27,10 +26,10 @@ const pagination = reactive({ }) function selectHandler(item, index: number) { - activeId.value = item.id - console.log(activeId.value,item.id) + activeId.value = item.id + console.log(activeId.value, item.id) console.log(index) - taskStore.setActive(index,item.id) + taskStore.setActive(index, item.id) } useInfiniteScroll( @@ -61,7 +60,7 @@ async function fetchList() { const result = await taskStore.fetchApprovalList({ ...pagination, keyword: keyword.value, - userSearchId:searchId.value + userSearchId: searchId.value, }) const { data, pageCount } = result canloadMore.value = pageCount >= pagination.pageNo @@ -80,35 +79,36 @@ watch( }, ) - watch( - () => taskStore.inFileId, - async (newVal) => { - let newlist=[] - let filterid=newVal.taskname - console.log(filterid) - const index = data.value.findIndex(person => person.fromtaskname === filterid); -let ovelist = data.value.filter(item => item. fromtaskname !== filterid); - - ovelist.map((item)=>{ +watch( + () => taskStore.inFileId, + async (newVal) => { + const newlist = [] + const filterid = newVal.taskname + console.log(filterid) + const index = data.value.findIndex(person => person.fromtaskname === filterid) + const ovelist = data.value.filter(item => item.fromtaskname !== filterid) + + ovelist.map((item) => { newlist.push(item) + return item }) - data.value=newlist - activeId.value = newlist[index].id - - taskStore.setActive(index,newlist[index].id) - //taskStore.setActive(index) - // activeId.value = data[index+1].id -//selectHandler(data[index].id, index) - /* let ovelist = data.value.filter(item => item. fromtaskname !== filterid); + data.value = newlist + activeId.value = newlist[index].id + + taskStore.setActive(index, newlist[index].id) + // taskStore.setActive(index) + // activeId.value = data[index+1].id + // selectHandler(data[index].id, index) + /* let ovelist = data.value.filter(item => item. fromtaskname !== filterid); let newlist=[] ovelist.map((item)=>{ newlist.push(item) }) data.value=newlist taskStore.setActive(2) - alert(1)*/ - } - ); + alert(1) */ + }, +) function reset() { pagination.pageNo = 0 pagination.pageSize = 30 @@ -131,11 +131,11 @@ async function search(word: string) { onMounted(() => { emitter.on('refresh', refreshHandler) - emitter.on('filter',async(id)=>{ - await reset(); - searchId.value = id; - data.value = await fetchList(); - activeId.value = data.value[0].id + emitter.on('filter', async (id) => { + await reset() + searchId.value = id + data.value = await fetchList() + activeId.value = data.value[0].id console.log(data.value) }) }) @@ -162,7 +162,6 @@ defineExpose({ diff --git a/src/views/worksheet/content/Content.vue b/src/views/worksheet/content/Content.vue index 7f57b74..4b735be 100644 --- a/src/views/worksheet/content/Content.vue +++ b/src/views/worksheet/content/Content.vue @@ -1,18 +1,18 @@