完善修改,版本完成

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" @close="handleUserClose"
/> />
<el-dialog <el-dialog
:title="checkedRow.id ? '新建需求' : '修改需求'" :title="!editData.id ? '新建需求' : '修改需求'"
:visible.sync="dialogVisibleAdd" :visible.sync="dialogVisibleAdd"
width="40%" width="780px"
:close-on-click-modal="false"
> >
<el-form <el-form
:inline="true" :inline="true"
@ -334,6 +335,7 @@
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
value-format="yyyy-MM-dd 23:59:59" value-format="yyyy-MM-dd 23:59:59"
style="width: 240px"
:picker-options="{ :picker-options="{
disabledDate: setDateRange, disabledDate: setDateRange,
}" }"
@ -415,7 +417,7 @@ export default {
}, },
rules: { rules: {
title: [ title: [
{ required: true, message: "请输入标题", trigger: "blur" }, { required: true, message: "请输入标题", trigger: "change" },
{ {
min: 3, min: 3,
max: 50, max: 50,
@ -464,8 +466,19 @@ export default {
}; };
}, },
watch: { watch: {
version(newVal) { version(newVal, oldVal) {
this.$nextTick(() => { this.$nextTick(() => {
if (newVal?.id != oldVal?.id) {
this.filters = {
title: "",
responsiblePersonName: "",
responsiblePersonId: "",
demandStatus: "",
priority: "",
};
}
this.currentPage = 1;
this.pageSize = 10;
this.getDemandList(); this.getDemandList();
}); });
}, },
@ -495,6 +508,7 @@ export default {
}, },
handleAdd() { handleAdd() {
// //
this.dialogVisibleAdd = true; this.dialogVisibleAdd = true;
this.editData = { this.editData = {
id: "", id: "",
@ -508,6 +522,11 @@ export default {
priority: "", priority: "",
projectId: "", projectId: "",
}; };
this.$nextTick(() => {
if (this.$refs.ruleForm) {
this.$refs.ruleForm.clearValidate();
}
});
this.editData.projectId = this.projectId; this.editData.projectId = this.projectId;
if (this.version.type == 0) { if (this.version.type == 0) {
this.editData.versionId = this.version.id; this.editData.versionId = this.version.id;
@ -541,8 +560,7 @@ export default {
type: "success", type: "success",
message: "删除成功!", message: "删除成功!",
}); });
this.getDemandList(); this.resetList("del");
this.resetList();
}); });
}) })
.catch(() => {}); .catch(() => {});
@ -568,8 +586,7 @@ export default {
type: "success", type: "success",
message: "删除成功!", message: "删除成功!",
}); });
this.getDemandList(); this.resetList("del");
this.resetList();
}); });
}); });
}, },
@ -578,6 +595,7 @@ export default {
}, },
handlePageChange(page) { handlePageChange(page) {
this.currentPage = page; this.currentPage = page;
this.getDemandList();
// //
}, },
getStatusClass(status) { getStatusClass(status) {
@ -602,15 +620,6 @@ export default {
param.id = this.version.id; param.id = this.version.id;
} else if (this.version.type == 2) { } else if (this.version.type == 2) {
param.projectId = this.version.id; param.projectId = this.version.id;
this.filters = {
title: "",
responsiblePersonName: "",
responsiblePersonId: "",
demandStatus: "",
priority: "",
};
this.currentPage = 1;
this.pageSize = 10;
} }
demandApi.getDemandList(param).then((res) => { demandApi.getDemandList(param).then((res) => {
this.tableData = res.rows; this.tableData = res.rows;
@ -647,7 +656,7 @@ export default {
} else if (this.selectType == "change") { } else if (this.selectType == "change") {
this.checkedRow.responsiblePerson = data[0].userId; this.checkedRow.responsiblePerson = data[0].userId;
this.checkedRow.responsiblePersonName = data[0].nickName; this.checkedRow.responsiblePersonName = data[0].nickName;
this.eidtDemand(); this.eidtDemandRow();
} else if (this.selectType == "add") { } else if (this.selectType == "add") {
this.editData.responsiblePersonName = data[0].nickName; this.editData.responsiblePersonName = data[0].nickName;
this.editData.responsiblePerson = data[0].userId; this.editData.responsiblePerson = data[0].userId;
@ -755,7 +764,7 @@ export default {
message: "操作成功", message: "操作成功",
type: "success", type: "success",
}); });
this.resetList(); this.resetList("edit");
}); });
} else { } else {
demandApi.addDemand(this.editData).then((res) => { demandApi.addDemand(this.editData).then((res) => {
@ -763,21 +772,39 @@ export default {
message: "操作成功", message: "操作成功",
type: "success", type: "success",
}); });
this.resetList(res.data.id); this.resetList("add", res.data);
}); });
} }
} }
// } // }
}); });
}, },
resetList(id) { resetList(type, data) {
let refreshId = ""; let refreshId = "";
if (this.editData.versionId) { if (type == "edit") {
refreshId = this.versionList.find( if (this.editData.versionId) {
(ele) => this.editData.versionId == ele.id refreshId = this.versionList.find(
).nodeId; (ele) => this.editData.versionId == ele.id
} else { ).nodeId;
refreshId = id + "_1"; } 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.$emit("refreshTree", refreshId);
this.dialogVisibleAdd = false; this.dialogVisibleAdd = false;
@ -820,8 +847,6 @@ export default {
}, },
setDateRange(day) { setDateRange(day) {
let date = new Date(day).getTime(); let date = new Date(day).getTime();
console.log(date, Number(this.minDate));
if (date < Number(this.minDate) || date > Number(this.maxDate)) { if (date < Number(this.minDate) || date > Number(this.maxDate)) {
return true; return true;
} else { } else {
@ -852,12 +877,12 @@ export default {
.filter-input, .filter-input,
.filter-select { .filter-select {
width: 240px; width: 18%;
} }
.filter-buttons { .filter-buttons {
display: flex; display: flex;
gap: 10px; // gap: 10px;
} }
.table-operations { .table-operations {
@ -1012,7 +1037,7 @@ export default {
} }
.selectedItem1 { .selectedItem1 {
&::after { &::after {
content: ""; content: "";
width: 10px; width: 10px;
height: 10px; height: 10px;
position: absolute; position: absolute;
@ -1024,7 +1049,7 @@ export default {
color: #4096ff; color: #4096ff;
position: relative; position: relative;
&::after { &::after {
content: ""; content: "";
width: 10px; width: 10px;
height: 10px; height: 10px;
position: absolute; position: absolute;

View File

@ -164,6 +164,7 @@ export default {
}) })
.then((res) => { .then((res) => {
if (!res.data.length) { if (!res.data.length) {
this.treeData=[]
return; return;
} }
res.data = res.data.map((ele) => { res.data = res.data.map((ele) => {
@ -174,32 +175,41 @@ export default {
ele.hover = false; ele.hover = false;
return ele; return ele;
}); });
if (defaultId && defaultId != "all") { this.initTableData(defaultId, res.data);
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.treeData = res.data; this.treeData = res.data;
}); });
}, },
changeVersion(data) { changeVersion(data) {
if (!data) {
data = {
id: this.projectId,
type: 2,
};
}
this.$emit("changeVersion", data); 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) { setVersionList(data) {
this.$emit("setVersionList", data); this.$emit("setVersionList", data);
}, },

View File

@ -167,8 +167,6 @@ export default {
endDate: this.dateRange[1] + " 23:59:59", endDate: this.dateRange[1] + " 23:59:59",
projectId: this.projectInfo.projectId, projectId: this.projectInfo.projectId,
}); });
console.log(123, this.dateRange);
const start = new Date(this.timeRange[0]); const start = new Date(this.timeRange[0]);
const end = new Date(this.timeRange[1]); const end = new Date(this.timeRange[1]);
let index = 0; let index = 0;
@ -228,6 +226,15 @@ export default {
this.scrollableColumns = days; 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() { mounted() {
this.getProjectList(); this.getProjectList();
@ -372,10 +379,10 @@ export default {
width: 100px; width: 100px;
} }
} }
::v-deep .el-table__body{ ::v-deep .el-table__body {
height: 100%; height: 100%;
} }
::v-deep td.el-table__cell{ ::v-deep td.el-table__cell {
border-bottom: none; border-bottom: none;
border-top: none; border-top: none;
vertical-align: top; vertical-align: top;

View File

@ -77,7 +77,7 @@
<div v-if="scope.row.edit"> <div v-if="scope.row.edit">
<el-select <el-select
v-model="scope.row.demandId" v-model="scope.row.demandId"
placeholder="进行中且时间匹配的需求" placeholder="时间匹配且非已结束的需求"
class="filter-select" class="filter-select"
@change="openContent(scope.row)" @change="openContent(scope.row)"
ref="demandSelectRef" ref="demandSelectRef"
@ -114,7 +114,7 @@
</el-input> </el-input>
<div <div
style="margin-top: 10px; text-align: right" 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 type="primary" @click="saveContent(scope.row, 1)"
>确认</el-button >确认</el-button
@ -143,7 +143,7 @@
<div v-if="scope.row.edit"> <div v-if="scope.row.edit">
<el-select <el-select
v-model="scope.row.workTime" v-model="scope.row.workTime"
placeholder="请选择版本" placeholder="请选择工时"
class="filter-select" class="filter-select"
filterable filterable
allow-create allow-create
@ -390,6 +390,9 @@ export default {
} else { } else {
this.demandList = []; this.demandList = [];
} }
if (!this.demandList.find((ele) => ele.id == row.demandId)) {
row.demandId = "";
}
if (!isOpen) this.$refs.demandSelectRef.toggleMenu(); if (!isOpen) this.$refs.demandSelectRef.toggleMenu();
}, },
openContent(row) { openContent(row) {
@ -436,7 +439,6 @@ export default {
this.tableData this.tableData
.map((ele) => Number(ele.workTime)) .map((ele) => Number(ele.workTime))
.reduce((total, now) => { .reduce((total, now) => {
console.log(now, total);
return now * 10 + total; return now * 10 + total;
}, 0) / 10 }, 0) / 10
).toFixed(1); ).toFixed(1);
@ -453,7 +455,7 @@ export default {
.container { .container {
padding: 20px; padding: 20px;
background-color: #ffffff; background-color: #ffffff;
min-width: 1200px; min-width: 200px;
} }
.topBox { .topBox {
display: flex; display: flex;

View File

@ -72,7 +72,7 @@ export default {
.sidebar { .sidebar {
flex-grow: 1; flex-grow: 1;
max-width: 360px; max-width: 320px;
width: 360px; width: 360px;
height: 100vh; height: 100vh;
background-color: #fff; background-color: #fff;
@ -80,7 +80,7 @@ export default {
} }
.main-content { .main-content {
flex-grow: 3; flex: 1;
background-color: #ffffff; background-color: #ffffff;
padding: 20px; padding: 20px;
} }