完善修改,版本完成

v1.2.0
rdpnr_hemingxia 2025-04-21 17:54:57 +08:00
parent 659108a7ac
commit bc1c74ce55
5 changed files with 109 additions and 65 deletions

View File

@ -225,9 +225,10 @@
@close="handleUserClose"
/>
<el-dialog
:title="checkedRow.id ? '新建需求' : '修改需求'"
:title="!editData.id ? '新建需求' : '修改需求'"
:visible.sync="dialogVisibleAdd"
width="40%"
width="780px"
:close-on-click-modal="false"
>
<el-form
:inline="true"
@ -334,6 +335,7 @@
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd 23:59:59"
style="width: 240px"
:picker-options="{
disabledDate: setDateRange,
}"
@ -415,7 +417,7 @@ export default {
},
rules: {
title: [
{ required: true, message: "请输入标题", trigger: "blur" },
{ required: true, message: "请输入标题", trigger: "change" },
{
min: 3,
max: 50,
@ -464,8 +466,19 @@ export default {
};
},
watch: {
version(newVal) {
version(newVal, oldVal) {
this.$nextTick(() => {
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;

View File

@ -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);
},

View File

@ -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;

View File

@ -77,7 +77,7 @@
<div v-if="scope.row.edit">
<el-select
v-model="scope.row.demandId"
placeholder="进行中且时间匹配的需求"
placeholder="时间匹配且非已结束的需求"
class="filter-select"
@change="openContent(scope.row)"
ref="demandSelectRef"
@ -114,7 +114,7 @@
</el-input>
<div
style="margin-top: 10px; text-align: right"
v-show="!disableTable"
v-show="!disableTable&&scope.row.edit"
>
<el-button type="primary" @click="saveContent(scope.row, 1)"
>确认</el-button
@ -143,7 +143,7 @@
<div v-if="scope.row.edit">
<el-select
v-model="scope.row.workTime"
placeholder="请选择版本"
placeholder="请选择工时"
class="filter-select"
filterable
allow-create
@ -390,6 +390,9 @@ export default {
} else {
this.demandList = [];
}
if (!this.demandList.find((ele) => 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;

View File

@ -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;
}