From d8a72c9563dc8be245604fcb31047b7be8d52e12 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 22 Oct 2021 18:37:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/achievement/list/index.vue | 26 +++- src/pages/project/add/index.vue | 187 +++++++++------------------ src/pages/student/list/index.vue | 8 +- src/setting.js | 4 +- 4 files changed, 87 insertions(+), 138 deletions(-) diff --git a/src/pages/achievement/list/index.vue b/src/pages/achievement/list/index.vue index d3eb515..bc4039a 100644 --- a/src/pages/achievement/list/index.vue +++ b/src/pages/achievement/list/index.vue @@ -76,7 +76,7 @@ @@ -217,7 +217,7 @@ export default { this.getData(); }, disabledSelection(row, index) { // 禁用勾选 - if (row.isDel === 0) return false; + if (row.isDel === 1) return false; return true; }, entry(row) { // 成绩管理 @@ -234,7 +234,13 @@ export default { this.$confirm("该项目下的所有成绩报告将会删除,是否继续?", "提示", { type: "warning" }).then(() => { - this.$post(`${this.api.deleteReportById}?ids=${row.assessmentId}&projectIds=${row.projectId}&projectPermissions=${this.projectPermissions}`).then(res => { + let url = ""; + if (this.projectPermissions === 0) { + url = `${this.api.deleteReportById}?ids=&projectIds=${row.projectId}&projectPermissions=${this.projectPermissions}`; + } else { + url = `${this.api.deleteReportById}?ids=${row.assessmentId}&projectIds=${row.projectId}&projectPermissions=${this.projectPermissions}`; + } + this.$get(url).then(res => { util.successMsg("删除成功"); this.getData(); }).catch(res => { @@ -247,11 +253,17 @@ export default { this.$confirm("该项目下的所有成绩报告将会删除,是否继续?", "提示", { type: "warning" }).then(() => { + let url = ""; let ids = []; - let projectIds = this.multipleSelection.map(item => { - return item.projectId; - }); - this.$post(`${this.api.deleteReportById}?ids=${ids.toString()}&projectIds=${projectIds.toString()}&projectPermissions=${this.projectPermissions}`).then(res => { + ids = this.multipleSelection.map(item => item.assessmentId); + let projectIds = []; + projectIds = this.multipleSelection.map(item => item.projectId); + if (this.projectPermissions === 0) { + url = `${this.api.deleteReportById}?ids=&projectIds=${projectIds.toString()}&projectPermissions=${this.projectPermissions}` + } else { + url = `${this.api.deleteReportById}?ids=${ids.toString()}&projectIds=${projectIds.toString()}&projectPermissions=${this.projectPermissions}` + } + this.$get(url).then(res => { this.multipleSelection = []; this.$refs.table.clearSelection(); util.successMsg("删除成功"); diff --git a/src/pages/project/add/index.vue b/src/pages/project/add/index.vue index 80371f4..651d865 100644 --- a/src/pages/project/add/index.vue +++ b/src/pages/project/add/index.vue @@ -115,8 +115,8 @@ @@ -398,34 +398,33 @@ export default { } this.setSystemId(this.projectManage.systemId); this.projectManage.state = state; - let tempArr = this.projectJudgmentData.map(i => { - let obj = { - projectId: this.projectId ? this.projectId : "", - judgmentId: i.judgmentId, - score: i.score, - sort: i.sort - }; - return obj; - }); - - let params = { - projectManage: this.projectManage, - projectJudgmentList: tempArr - }; - let { systemId } = this.projectManage; if (this.projectId) { if (systemId == 2 || systemId == 3) { console.log("系统id:", systemId); } else { // 更新 - this.updateProject(params); + this.updateProjectJudgment(); } } else { if (systemId == 2 || systemId == 3) { console.log("系统id:", systemId); } else { // 添加 + let tempArr = this.projectJudgmentData.map(i => { + let obj = { + projectId: this.projectId ? this.projectId : "", + judgmentId: i.judgmentId, + score: i.score, + sort: i.sort + }; + return obj; + }); + + let params = { + projectManage: this.projectManage, + projectJudgmentList: tempArr + }; this.addProject(params); } } @@ -464,7 +463,7 @@ export default { item.score = res.data[index]; return item; }); - this.updateProjectJudgment(); + // this.updateProjectJudgment(); } }); } @@ -486,11 +485,7 @@ export default { this.$confirm("确定要删除吗?", "提示", { type: "warning" }).then(() => { - if (this.projectId) { - this.deleteProjectJudgment([this.projectJudgmentData[index].id]); - } else { - this.projectJudgmentData.splice(index, 1); - } + this.projectJudgmentData.splice(index, 1); }).catch(() => { }); }, @@ -502,18 +497,12 @@ export default { this.$confirm("确定要删除吗?", "提示", { type: "warning" }).then(() => { - // this.projectJudgmentData.splice(index, 1); - if (this.projectId) {// 编辑项目的时候 - let param = this.selectedProjectJudgment.map(e => e.id); - this.deleteProjectJudgment(param);// 调删除接口 - } else { - let list = this.projectJudgmentData; - let result = []; - list.map(i => { - this.selectedProjectJudgment.find(j => j.judgmentId === i.judgmentId) || result.push(i); - }); - this.projectJudgmentData = result; - } + let list = this.projectJudgmentData; + let result = []; + list.map(i => { + this.selectedProjectJudgment.find(j => j.judgmentId === i.judgmentId) || result.push(i); + }); + this.projectJudgmentData = result; }).catch(() => { }); } else { @@ -587,22 +576,17 @@ export default { if (this.selectedJudgment.length) { // console.log(this.selectedJudgment, "queren"); this.dialogVisible = false; - if (this.projectId) { // 编辑的时候,新增调接口 - this.addProjectJudgment(); - } else { - // 新增时,假添加 - let tempArr = this.selectedJudgment.map(i => { - i.score = 0; - return i; - }); - this.projectJudgmentData = this.projectJudgmentData.concat(tempArr); - this.projectJudgmentData.map((e, i) => { - e.sort = i + 1; - }); - this.$nextTick(() => { - this.$refs.projectJudgementTable.clearSelection(); - }); - } + let tempArr = this.selectedJudgment.map(i => { + i.score = 0; + return i; + }); + this.projectJudgmentData = this.projectJudgmentData.concat(tempArr); + this.projectJudgmentData.map((e, i) => { + e.sort = i + 1; + }); + this.$nextTick(() => { + this.$refs.projectJudgementTable.clearSelection(); + }); } else { util.warningMsg("请选择判分点"); } @@ -662,48 +646,22 @@ export default { // 指定父元素下可被拖拽的子元素 draggable: ".draggable .el-table__row", onEnd({ newIndex, oldIndex }) { - let newItem = _this.projectJudgmentData[newIndex]; - _this.projectJudgmentData[newIndex] = _this.projectJudgmentData[oldIndex]; - _this.projectJudgmentData[oldIndex] = newItem; - // 循环,重新赋值排序赋值 - _this.projectJudgmentData.forEach((e, i) => { - _this.$set(e, "sort", i + 1);// 不更新 - _this.$set(e, "name", e.name + "?"); - _this.$set(e, "name", e.name.slice(0, e.name.length - 1)); // 不更新的解决方案 + _this.projectJudgmentData.splice(newIndex, 0, _this.projectJudgmentData.splice(oldIndex, 1)[0]); + let newArray = _this.projectJudgmentData.slice(0); + _this.projectJudgmentData = []; + _this.$nextTick(function () { + newArray.forEach((e, i) => { + _this.$set(e, "sort", i + 1);// 不更新 + _this.$set(e, "name", e.name + "?"); + _this.$set(e, "name", e.name.slice(0, e.name.length - 1)); // 不更新的解决方案 + }); + _this.projectJudgmentData = newArray; }); - // 调修改接口,更新列表 - if (_this.projectId) {// 如果是编辑项目,则调编辑接口 - _this.updateProjectJudgment(); - } } }); }, - // 添加判分点中间表 - addProjectJudgment() { - let param = this.selectedJudgment.map((e, i) => { - let obj = { - judgmentId: e.judgmentId, - projectId: this.projectId || "", - score: 0, - sort: i + 1 - }; - return obj; - }); - // console.log(param, "param", this.projectId); - this.$post(this.api.addProjectJudgment, param).then(res => { - // 重新调接口 - // console.log("添加成功", res); - if (this.projectId) { // 有项目id,调接口,没有项目id,手动更新 - this.listAgain(); - } - }).catch(err => { - console.log(err); - }); - - }, // 修改判分点中间表 - updateProjectJudgment() { - // 直接传data回去 + async updateProjectJudgment() { let param = this.projectJudgmentData.map((e, i) => { let obj = { judgmentId: e.judgmentId, @@ -714,45 +672,24 @@ export default { }; return obj; }); - this.$post(this.api.updateProjectJudgment, param).then(res => { - // 重新调接口 - if (this.projectId) { // 有项目id,调接口,没有项目id,手动更新 - this.listAgain(); - } + await this.$post(this.api.updateProjectJudgment, param).then(res => { + let tempArr = this.projectJudgmentData.map(i => { + let obj = { + projectId: this.projectId ? this.projectId : "", + judgmentId: i.judgmentId, + score: i.score, + sort: i.sort + }; + return obj; + }); + let params = { + projectManage: this.projectManage, + projectJudgmentList: tempArr + }; + this.updateProject(params); }).catch(err => { console.log(err); }); - }, - // 批量删除判分点中间表 - deleteProjectJudgment(values) { - if (values && values.length > 0) { - this.$post(this.api.deleteProjectJudgment + "?projectJudgmentIds=" + `${values}`).then(res => { - // 重新调接口 - if (this.projectId) { // 有项目id,调接口,没有项目id,手动更新 - this.listAgain(); - } - }).catch(err => { - }); - } - }, - // 重新调接口,专门赋值列表 - listAgain() { - this.listLoading = true - let scrollTop = this.$refs.main.scrollTop - this.projectJudgmentData = [] - this.$refs.main.scrollTop = scrollTop - this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}`).then(res => { - let { projectManage, projectJudgmentVos } = res; - projectJudgmentVos.map((e,i)=>{ - this.$set(e,'sort',i+1)// 不更新 - this.$set(e,'name',e.name+"?") - this.$set(e,'name',e.name.slice(0,e.name.length-1)) // 不更新的解决方案 - }); - this.projectJudgmentData = projectJudgmentVos; - this.listLoading = false - }).catch(()=>{ - this.listLoading = false - }) } } }; diff --git a/src/pages/student/list/index.vue b/src/pages/student/list/index.vue index a63e655..44dc547 100644 --- a/src/pages/student/list/index.vue +++ b/src/pages/student/list/index.vue @@ -94,7 +94,7 @@
@@ -287,7 +287,7 @@ export default { treeNode: {}, treeResolve: [], isDetail: false, - keyword: "", + keyWord: "", form: { userName: "", phone: "", @@ -366,7 +366,7 @@ export default { // this.auth(); }, watch: { - keyword: function(val) { + keyWord: function(val) { clearTimeout(this.searchTimer); this.searchTimer = setTimeout(() => { if (this.studentType) { @@ -889,7 +889,7 @@ export default { uploadSure() { this.importVisible = false; this.studentType = 1; - this.keyword = ""; + this.keyWord = ""; this.initData(); } } diff --git a/src/setting.js b/src/setting.js index d47d0f5..a0aa5cb 100644 --- a/src/setting.js +++ b/src/setting.js @@ -41,8 +41,8 @@ if (isHh) { schoolId = 2105; } else if (isDev) { jumpPath = "http://192.168.31.154:8087/"; - host = "http://39.108.250.202:9000/"; // 中台测试服 - // host = "http://192.168.31.151:9000/"; // 榕 + // host = "http://39.108.250.202:9000/"; // 中台测试服 + host = "http://192.168.31.151:9000/"; // 榕 // host = "http://192.168.31.125:9000/"; // 坤 // host = 'http://192.168.31.137:9000/'; // 赓 title = "职站服务端管理系统";