From bc1c74ce55965f30cc250c9c9e6b28eea236cd99 Mon Sep 17 00:00:00 2001 From: rdpnr_hemingxia Date: Mon, 21 Apr 2025 17:54:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/MainContentTable.vue | 91 ++++++++++++------- .../demandManage/components/SidebarTree.vue | 50 ++++++---- src/views/projectBank/projectUser.vue | 17 +++- src/views/worklog/components/rightTable.vue | 12 ++- src/views/worklog/worklog.vue | 4 +- 5 files changed, 109 insertions(+), 65 deletions(-) diff --git a/src/views/project/demandManage/components/MainContentTable.vue b/src/views/project/demandManage/components/MainContentTable.vue index 27b57d4..8cc9036 100644 --- a/src/views/project/demandManage/components/MainContentTable.vue +++ b/src/views/project/demandManage/components/MainContentTable.vue @@ -225,9 +225,10 @@ @close="handleUserClose" /> { + if (newVal?.id != oldVal?.id) { + this.filters = { + title: "", + responsiblePersonName: "", + responsiblePersonId: "", + demandStatus: "", + priority: "", + }; + } + this.currentPage = 1; + this.pageSize = 10; this.getDemandList(); }); }, @@ -495,6 +508,7 @@ export default { }, handleAdd() { // 实现新增逻辑 + this.dialogVisibleAdd = true; this.editData = { id: "", @@ -508,6 +522,11 @@ export default { priority: "", projectId: "", }; + this.$nextTick(() => { + if (this.$refs.ruleForm) { + this.$refs.ruleForm.clearValidate(); + } + }); this.editData.projectId = this.projectId; if (this.version.type == 0) { this.editData.versionId = this.version.id; @@ -541,8 +560,7 @@ export default { type: "success", message: "删除成功!", }); - this.getDemandList(); - this.resetList(); + this.resetList("del"); }); }) .catch(() => {}); @@ -568,8 +586,7 @@ export default { type: "success", message: "删除成功!", }); - this.getDemandList(); - this.resetList(); + this.resetList("del"); }); }); }, @@ -578,6 +595,7 @@ export default { }, handlePageChange(page) { this.currentPage = page; + this.getDemandList(); // 实现页码改变逻辑 }, getStatusClass(status) { @@ -602,15 +620,6 @@ export default { param.id = this.version.id; } else if (this.version.type == 2) { param.projectId = this.version.id; - this.filters = { - title: "", - responsiblePersonName: "", - responsiblePersonId: "", - demandStatus: "", - priority: "", - }; - this.currentPage = 1; - this.pageSize = 10; } demandApi.getDemandList(param).then((res) => { this.tableData = res.rows; @@ -647,7 +656,7 @@ export default { } else if (this.selectType == "change") { this.checkedRow.responsiblePerson = data[0].userId; this.checkedRow.responsiblePersonName = data[0].nickName; - this.eidtDemand(); + this.eidtDemandRow(); } else if (this.selectType == "add") { this.editData.responsiblePersonName = data[0].nickName; this.editData.responsiblePerson = data[0].userId; @@ -755,7 +764,7 @@ export default { message: "操作成功", type: "success", }); - this.resetList(); + this.resetList("edit"); }); } else { demandApi.addDemand(this.editData).then((res) => { @@ -763,21 +772,39 @@ export default { message: "操作成功", type: "success", }); - this.resetList(res.data.id); + this.resetList("add", res.data); }); } } // } }); }, - resetList(id) { + resetList(type, data) { let refreshId = ""; - if (this.editData.versionId) { - refreshId = this.versionList.find( - (ele) => this.editData.versionId == ele.id - ).nodeId; - } else { - refreshId = id + "_1"; + if (type == "edit") { + if (this.editData.versionId) { + refreshId = this.versionList.find( + (ele) => this.editData.versionId == ele.id + ).nodeId; + } else { + refreshId = this.editData.id + "_1"; + } + } else if (type == "add") { + if (this.editData.versionId) { + refreshId = this.versionList.find( + (ele) => this.editData.versionId == ele.id + ).nodeId; + } else { + refreshId = data.id + "_1"; + } + } else if (type == "del") { + if (this.version.type == 0) { + refreshId = this.version.nodeId; + } else if (this.version.type == 1) { + refreshId = ""; + } else if (this.version.type == 2) { + refreshId = "all"; + } } this.$emit("refreshTree", refreshId); this.dialogVisibleAdd = false; @@ -820,8 +847,6 @@ export default { }, setDateRange(day) { let date = new Date(day).getTime(); - console.log(date, Number(this.minDate)); - if (date < Number(this.minDate) || date > Number(this.maxDate)) { return true; } else { @@ -852,12 +877,12 @@ export default { .filter-input, .filter-select { - width: 240px; + width: 18%; } .filter-buttons { display: flex; - gap: 10px; + // gap: 10px; } .table-operations { @@ -1012,7 +1037,7 @@ export default { } .selectedItem1 { &::after { - content: "√"; + content: "✔"; width: 10px; height: 10px; position: absolute; @@ -1024,7 +1049,7 @@ export default { color: #4096ff; position: relative; &::after { - content: "√"; + content: "✔"; width: 10px; height: 10px; position: absolute; diff --git a/src/views/project/demandManage/components/SidebarTree.vue b/src/views/project/demandManage/components/SidebarTree.vue index aea141a..6f89c10 100644 --- a/src/views/project/demandManage/components/SidebarTree.vue +++ b/src/views/project/demandManage/components/SidebarTree.vue @@ -164,6 +164,7 @@ export default { }) .then((res) => { if (!res.data.length) { + this.treeData=[] return; } res.data = res.data.map((ele) => { @@ -174,32 +175,41 @@ export default { ele.hover = false; return ele; }); - if (defaultId && defaultId != "all") { - let searchId = ""; - this.defaultExpend = [defaultId]; - searchId = res.data.find((ele) => ele.nodeId == defaultId); - this.changeVersion(searchId); - this.selectedId = this.defaultExpend[0]; - } else if (defaultId == "all") { - this.selectedId = ""; - this.$emit("changeVersion", { - id: this.projectId, - type: 2, - }); - } else { - this.defaultExpend = [res.data[0].nodeId]; - this.selectedId = this.defaultExpend[0]; - this.setVersionList(res.data.filter((ele) => ele.type == 0)); - this.changeVersion( - res.data.find((ele) => ele.nodeId == this.defaultExpend[0]) - ); - } + this.initTableData(defaultId, res.data); this.treeData = res.data; }); }, changeVersion(data) { + if (!data) { + data = { + id: this.projectId, + type: 2, + }; + } this.$emit("changeVersion", data); }, + initTableData(defaultId, tableList) { + if (defaultId && defaultId != "all") { + let searchNode = {}; + this.defaultExpend = [defaultId]; + searchNode = tableList.find((ele) => ele.nodeId == defaultId); + this.changeVersion(searchNode); + this.selectedId = this.defaultExpend[0]; + } else if (defaultId == "all") { + this.selectedId = ""; + this.changeVersion({ + id: this.projectId, + type: 2, + }); + } else { + this.defaultExpend = [tableList[0].nodeId]; + this.selectedId = this.defaultExpend[0]; + this.setVersionList(tableList.filter((ele) => ele.type == 0)); + this.changeVersion( + tableList.find((ele) => ele.nodeId == this.defaultExpend[0]) + ); + } + }, setVersionList(data) { this.$emit("setVersionList", data); }, diff --git a/src/views/projectBank/projectUser.vue b/src/views/projectBank/projectUser.vue index 4924933..85d6020 100644 --- a/src/views/projectBank/projectUser.vue +++ b/src/views/projectBank/projectUser.vue @@ -74,7 +74,7 @@ import { projectBank, projectApi } from "@/utils/api"; export default { name: "ProjectUser", components: { - CustomTable, + CustomTable, }, data() { return { @@ -167,8 +167,6 @@ export default { endDate: this.dateRange[1] + " 23:59:59", projectId: this.projectInfo.projectId, }); - console.log(123, this.dateRange); - const start = new Date(this.timeRange[0]); const end = new Date(this.timeRange[1]); let index = 0; @@ -228,6 +226,15 @@ export default { this.scrollableColumns = days; }, }, + '$route.query': { + deep: true, + handler(newVal) { + if (newVal.projectId != this.projectInfo.projectId&&newVal.projectId) { + this.selectedProject = Number(newVal.projectId); + this.handleProjectChange(this.selectedProject) + } + }, + }, }, mounted() { this.getProjectList(); @@ -372,10 +379,10 @@ export default { width: 100px; } } -::v-deep .el-table__body{ +::v-deep .el-table__body { height: 100%; } -::v-deep td.el-table__cell{ +::v-deep td.el-table__cell { border-bottom: none; border-top: none; vertical-align: top; diff --git a/src/views/worklog/components/rightTable.vue b/src/views/worklog/components/rightTable.vue index 944d1bd..70c24c1 100644 --- a/src/views/worklog/components/rightTable.vue +++ b/src/views/worklog/components/rightTable.vue @@ -77,7 +77,7 @@
确认 ele.id == row.demandId)) { + row.demandId = ""; + } if (!isOpen) this.$refs.demandSelectRef.toggleMenu(); }, openContent(row) { @@ -436,7 +439,6 @@ export default { this.tableData .map((ele) => Number(ele.workTime)) .reduce((total, now) => { - console.log(now, total); return now * 10 + total; }, 0) / 10 ).toFixed(1); @@ -453,7 +455,7 @@ export default { .container { padding: 20px; background-color: #ffffff; - min-width: 1200px; + min-width: 200px; } .topBox { display: flex; diff --git a/src/views/worklog/worklog.vue b/src/views/worklog/worklog.vue index 5198279..142fa0d 100644 --- a/src/views/worklog/worklog.vue +++ b/src/views/worklog/worklog.vue @@ -72,7 +72,7 @@ export default { .sidebar { flex-grow: 1; - max-width: 360px; + max-width: 320px; width: 360px; height: 100vh; background-color: #fff; @@ -80,7 +80,7 @@ export default { } .main-content { - flex-grow: 3; + flex: 1; background-color: #ffffff; padding: 20px; }