From 551b166b79161681147bbbdf255d06a62497fc56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CXCYH=E2=80=9D?= <“1561381013@qq.com”> Date: Fri, 19 Apr 2024 20:13:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=90=9C=E7=B4=A2=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E5=85=A8=E9=83=A8=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../personal/project/childSystem/manage.vue | 46 ++++- .../project/childSystem/participate.vue | 36 ++-- .../personal/project/childmodel/manage.vue | 45 ++++- .../project/childmodel/participate.vue | 44 ++-- src/views/personal/project/manage.vue | 188 +++++++----------- src/views/personal/project/participate.vue | 85 +++----- 6 files changed, 206 insertions(+), 238 deletions(-) diff --git a/src/views/personal/project/childSystem/manage.vue b/src/views/personal/project/childSystem/manage.vue index 1305120..b6cb93d 100644 --- a/src/views/personal/project/childSystem/manage.vue +++ b/src/views/personal/project/childSystem/manage.vue @@ -5,15 +5,15 @@
名称 - +
状态 - +
- 查询 - 重置 + 查询 + 重置
@@ -34,7 +34,7 @@ @@ -69,7 +69,7 @@ const toChildModel = (id) => { router.push({ name: 'ChildModManage' , query: { id: 3 } }) }; -const input = ref(''); + interface User { cycle:number @@ -97,6 +97,9 @@ const handleSelectionChange = (val: User[]) => { // console.log(searchSys); +const input1 = ref(''); +const input2 = ref(''); + const tableData = ref([ ]); @@ -108,12 +111,12 @@ const initialTableData = ref([]); //处理数据函数 const parseData = (data)=>{ - const description = JSON.parse(data.description); + return{ cycle:data.cycle, deadLine:data.deadLine, - description:description, + description: data.description, id:data.id, isDelete:data.isDelete, name:data.name, @@ -130,6 +133,8 @@ const initialTableData = ref([]); //处理数据 project.then(res=>{ + console.log(res); + const data = res.data.data console.log(data); @@ -149,7 +154,30 @@ const initialTableData = ref([]); fetchData(); - +// 统一检索函数 +const search = () => { + const keyword = input1.value.trim().toLowerCase(); + const status = input2.value.trim().toLowerCase(); + + // 如果搜索关键词和状态都为空,则恢复初始数据 + if (keyword === '' && status === '') { + tableData.value = initialTableData.value.slice(); + return; + } + + // 根据关键词和状态进行检索 + tableData.value = initialTableData.value.filter(item => { + const matchKeyword = (keyword === '' || item.name.toLowerCase().includes(keyword)); + const matchStatus = (status === '' || item.status.toLowerCase().includes(status)); + return matchKeyword && matchStatus; + }); +}; + +const reset = () => { + input1.value = ''; + input2.value = ''; + tableData.value = initialTableData.value.slice(); +}; diff --git a/src/views/personal/project/childSystem/participate.vue b/src/views/personal/project/childSystem/participate.vue index 7f5eef3..1f795c1 100644 --- a/src/views/personal/project/childSystem/participate.vue +++ b/src/views/personal/project/childSystem/participate.vue @@ -34,7 +34,7 @@ @@ -98,25 +98,11 @@ const handleSelectionChange = (val: User[]) => { multipleSelection.value = val; }; -const tableData = ref([ - { - id: 1, - deadLine: '2022-01-01', - cycle: 1, - description: { description: '子系统1的简介' }, - isDeleted: 0, - name: '子系统1', - principalId: 1, - projectId: 1, - workLoad: 1, - status: '待定', - principalName: '测试数据' - } -]); +const tableData = ref([]); const initialTableData = ref([]); const parseData = (data) => { - const description = JSON.parse(data.description); + @@ -125,7 +111,7 @@ const parseData = (data) => { id: data.id, deadLine: data.deadLine, cycle: data.cycle, - description: description, + description: data.description, isDeleted: data.isDeleted, name: data.name, principalId: data.principalId, @@ -139,9 +125,12 @@ const parseData = (data) => { //获取子系统列表 const fetchData = () => { //调用接口 - const project = getParticipateSystemList(projectid-1, getToken()); + const project = getParticipateSystemList(projectid, getToken()); project.then((res) => { + console.log(res); + + const data = res.data.data; console.log(data); @@ -161,6 +150,9 @@ const fetchData = () => { fetchData(); +const input1 = ref(''); +const input2 = ref(''); + // 统一检索函数 const search = () => { const keyword = input1.value.trim().toLowerCase(); @@ -180,14 +172,10 @@ const search = () => { }); }; -const input1 = ref(''); -const input2 = ref(''); - -// 重置检索条件 const reset = () => { input1.value = ''; input2.value = ''; - tableData.value = initialTableData.value.slice(); // 恢复初始数据 + tableData.value = initialTableData.value.slice(); }; diff --git a/src/views/personal/project/childmodel/manage.vue b/src/views/personal/project/childmodel/manage.vue index 355f1dd..fe7548b 100644 --- a/src/views/personal/project/childmodel/manage.vue +++ b/src/views/personal/project/childmodel/manage.vue @@ -5,15 +5,15 @@
名称 - +
状态 - +
- 查询 - 重置 + 查询 + 重置
@@ -37,7 +37,7 @@ - {{row.description.description}} + {{row.description}} {{ new Date(row.deadLine).toLocaleDateString() }} @@ -80,6 +80,7 @@ interface User { description: { description: string } status: string deadLine: string + cycle: number } const multipleTableRef = ref>(); @@ -89,7 +90,7 @@ const handleSelectionChange = (val: User[]) => { multipleSelection.value = val; }; -const input = ref(''); + const initialTableData = ref([]); const tableData = ref([ @@ -106,7 +107,7 @@ const sysId = route.query.id; //处理接口方法 const parseData = (data) => { - const description = JSON.parse(data.description); + return{ @@ -115,9 +116,10 @@ const parseData = (data) => { principalId: data.principalId, principalUser: data.principalUser, workLoad: data.workLoad, - description: description, + description: data.description, status: data.status, deadLine: data.deadLine, + cycle: data.cycle, } @@ -146,6 +148,33 @@ const fetchData = ()=>{ } fetchData(); +const input1 = ref(''); +const input2 = ref(''); + +// 统一检索函数 +const search = () => { + const keyword = input1.value.trim().toLowerCase(); + const status = input2.value.trim().toLowerCase(); + + // 如果搜索关键词和状态都为空,则恢复初始数据 + if (keyword === '' && status === '') { + tableData.value = initialTableData.value.slice(); + return; + } + + // 根据关键词和状态进行检索 + tableData.value = initialTableData.value.filter(item => { + const matchKeyword = (keyword === '' || item.name.toLowerCase().includes(keyword)); + const matchStatus = (status === '' || item.status.toLowerCase().includes(status)); + return matchKeyword && matchStatus; + }); +}; + +const reset = () => { + input1.value = ''; + input2.value = ''; + tableData.value = initialTableData.value.slice(); +}; diff --git a/src/views/personal/project/childmodel/participate.vue b/src/views/personal/project/childmodel/participate.vue index a49c2e7..656047f 100644 --- a/src/views/personal/project/childmodel/participate.vue +++ b/src/views/personal/project/childmodel/participate.vue @@ -33,9 +33,9 @@ - - {{ row.description.description }} - + + + {{ new Date(row.deadLine).toLocaleDateString() }} @@ -74,7 +74,7 @@ interface User { childSystemName: string; completeTime: string; cycle: string; - description: { description: string }; + description: string; id: number; isDelete: number isFinishi: string @@ -86,6 +86,7 @@ interface User { status: string type: string workLoad: number + deadLine: string } const multipleTableRef = ref>(); @@ -98,38 +99,18 @@ const handleSelectionChange = (val: User[]) => { //列表 -const tableData = ref([ - { - beginTime: '2021-11-11', - childSystemName: '子系统1', - completeTime: '2021-11-11', - cycle: "10tian", - description: { description: '子系统1描述' }, - id: 1, - isDelete: 0, - isFinishi: '否', - name: '子模块1', - pid: '1', - principalId: 1, - principalUser: '负责人1', - projectId: 1, - status: '待完成', - type: '子系统', - workLoad: 10 - } - - -]); +const tableData = ref([]); const initialTableData = ref([]); + const parseData = (data) => { - const descripation = JSON.parse(data.description); + return { beginTime: data.beginTime, childSystemName: data.childSystemName, completeTime: data.completeTime, cycle: data.cycle, - description: descripation, + description: data.description, id: data.id, isDelete: data.isDelete, isFinishi: data.isFinishi, @@ -138,9 +119,10 @@ const parseData = (data) => { principalId: data.principalId, principalUser: data.principalUser, projectId: data.projectId, - status: '待完成', + status: data.status, type: data.type, - workLoad: data.workLoad + workLoad: data.workLoad, + deadLine: data.deadLine } } @@ -194,6 +176,8 @@ const input2 = ref(''); const reset = () => { input1.value = ''; input2.value = ''; + console.log(tableData.value); + tableData.value = initialTableData.value.slice(); // 恢复初始数据 }; diff --git a/src/views/personal/project/manage.vue b/src/views/personal/project/manage.vue index 7be040b..a98c8e3 100644 --- a/src/views/personal/project/manage.vue +++ b/src/views/personal/project/manage.vue @@ -12,8 +12,8 @@
- 查询 - 重置 + 查询 + 重置
@@ -81,7 +81,7 @@ - +