From d5ebb1758471fc1b6f8c3271a852ba3398b72a42 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Tue, 29 Mar 2022 18:09:32 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=96=B0=E5=A2=9E=E7=AD=89?=
=?UTF-8?q?=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/index.js | 1 +
src/layouts/header/index.vue | 18 +++--
src/libs/util.cookies.js | 6 +-
src/pages/achievement/list/index.vue | 4 +-
src/pages/project/add/index.vue | 107 +++++++++++++--------------
src/pages/project/list/index.vue | 18 ++---
src/setting.js | 1 +
7 files changed, 80 insertions(+), 75 deletions(-)
diff --git a/src/api/index.js b/src/api/index.js
index 2d1ee0f..222a960 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -90,6 +90,7 @@ export default {
saveProjectDraft: `${host}occupationlab/projectManage/saveProjectDraft`, // 新增项目管理
addProjectManage: `${host}occupationlab/projectManage/addProjectManage`, // 新增项目管理
updateProjectManage: `${host}occupationlab/projectManage/updateProjectManage`, // 修改项目管理
+ editProjectDraft: `${host}occupationlab/projectManage/editProjectDraft`, // 修改项目管理
copyProjectManage: `${host}occupationlab/projectManage/copyProjectManage`, // 复制项目管理
// 判分点
diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue
index e2f07f3..97dd649 100644
--- a/src/layouts/header/index.vue
+++ b/src/layouts/header/index.vue
@@ -75,12 +75,18 @@ export default {
});
},
getUserDetail() { // 获取用户详情
- this.$get(this.api.queryUserInfoDetails).then(res => {
- let { userAvatars, userName } = res.result.hrUserInfo;
- userAvatars && this.setAvatar(userAvatars);
- this.setUserName(userName);
- }).catch(res => {
- });
+ this.$get(this.api.queryUserInfoDetails).then(res => {
+ let { hrUserInfo } = res.result
+ if (hrUserInfo) {
+ const { userAvatars, userName } = hrUserInfo
+ userAvatars && this.setAvatar(userAvatars)
+ this.setUserName(userName)
+ } else {
+ this.$get(this.api.isClient).then(res => {
+ res.customerName && this.setUserName(res.customerName)
+ }).catch(res => {})
+ }
+ }).catch(res => {})
},
userCommand(command) { // 切换下拉菜单
if (command == "person") {
diff --git a/src/libs/util.cookies.js b/src/libs/util.cookies.js
index 17423b8..75c1c8d 100644
--- a/src/libs/util.cookies.js
+++ b/src/libs/util.cookies.js
@@ -14,7 +14,7 @@ cookies.set = function(name = "default", value = "", cookieSetting = {}) {
expires: Setting.cookiesExpires
};
Object.assign(currentCookieSetting, cookieSetting);
- Cookies.set(name, value, currentCookieSetting);
+ Cookies.set(`admin-${name}`, value, currentCookieSetting);
};
/**
@@ -22,7 +22,7 @@ cookies.set = function(name = "default", value = "", cookieSetting = {}) {
* @param {String} name cookie name
*/
cookies.get = function(name = "default") {
- return Cookies.get(name);
+ return Cookies.get(`admin-${name}`);
};
/**
@@ -37,7 +37,7 @@ cookies.getAll = function() {
* @param {String} name cookie name
*/
cookies.remove = function(name = "default") {
- return Cookies.remove(name);
+ return Cookies.remove(`admin-${name}`);
};
export default cookies;
diff --git a/src/pages/achievement/list/index.vue b/src/pages/achievement/list/index.vue
index 7ed681b..660d797 100644
--- a/src/pages/achievement/list/index.vue
+++ b/src/pages/achievement/list/index.vue
@@ -52,7 +52,7 @@
-
+
@@ -71,7 +71,7 @@
-
+
{{ scope.row.experimentalName }}
diff --git a/src/pages/project/add/index.vue b/src/pages/project/add/index.vue
index 655253d..2cfb63c 100644
--- a/src/pages/project/add/index.vue
+++ b/src/pages/project/add/index.vue
@@ -3,10 +3,10 @@
-
+
- 保存为草稿
- 确定并发布
+ 保存为草稿
+ 确定并发布
@@ -14,10 +14,10 @@
基本信息
-
+
-
+
-
+
-
+
@@ -46,7 +46,7 @@
-
+
@@ -57,7 +57,7 @@
-
+
@@ -76,13 +76,13 @@
- 平均分配分值
- 手动分配分值
+ 平均分配分值
+ 手动分配分值
(待分配分值: {{ handDistributionScore }}/100分)
- 判分点
- 批量删除
+ 判分点
+ 批量删除
-
+
- 删除
+ 删除
@@ -128,13 +128,13 @@
实验提示
启用
-
+
-
+
@@ -194,7 +194,6 @@ export default {
data() {
return {
projectId: this.$route.query.projectId,
- item: this.$route.query.item,
founder: this.$route.query.founder,
systemList: [],
token: btoa(util.local.get(Setting.tokenKey)),
@@ -231,7 +230,8 @@ export default {
isToPoint: false, // 判断是否是跳转到判分点系统
visibleLoading: false, // 加载弹框
listLoading:false,// 列表加载
- submiting: false // 新增编辑员工防抖标识
+ submiting: false, // 新增编辑员工防抖标识
+ updateTime: 0
};
},
computed: {
@@ -256,18 +256,19 @@ export default {
}
},
watch: {
- // projectJudgmentData: {
- // handler(newValue) {
- // console.log("newValue:", newValue);
- // },
- // deep: true
- // },
- judgementpointsquery(n) {
- clearTimeout(this.searchTimer);
- this.searchTimer = setTimeout(() => {
- this.handleQueryJudgment();
- }, 500);
- }
+ // 监听信息是否有更改,有的话页面离开的时候要询问是否要保存
+ projectManage: {
+ handler(){
+ this.updateTime++
+ },
+ deep:true
+ },
+ judgementpointsquery(n) {
+ clearTimeout(this.searchTimer);
+ this.searchTimer = setTimeout(() => {
+ this.handleQueryJudgment();
+ }, 500);
+ }
},
created() {
this.getSystemData();
@@ -295,19 +296,6 @@ export default {
...mapActions("project", [
"setSystemId", "setProject"
]),
- goBack() { // 返回
- if (this.isDetail || this.item == 0) {
- this.$router.push(`/project/list?founder=${this.founder}`);
- } else {
- this.$confirm("确定返回?未更新的信息将不会保存。", "提示", {
- type: "warning"
- }).then(() => {
- this.$router.push(`/project/list?founder=${this.founder}`);
- // this.$router.back();
- }).catch(() => {
- });
- }
- },
getSystemData() {
this.$get(this.api.getSystemIdBySchool).then(res => {
this.systemList = res.data;
@@ -444,7 +432,7 @@ export default {
}
},
updateProject(params) { // 更新项目
- this.$post(`${this.api.updateProjectManage}`, params).then(res => {
+ this.$post(this.api[params.projectManage.state ? 'updateProjectManage' : 'editProjectDraft'], params).then(res => {
util.successMsg("更新实验项目成功");
this.$router.back();
}).catch(err => {
@@ -479,16 +467,6 @@ export default {
});
}
},
- // handleMoveUp(index) { // 处理上移
- // let x = index;
- // let y = index + 1;
- // this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1]));
- // },
- // handleMoveDown(index) { // 处理下移
- // let x = index + 1;
- // let y = index + 2;
- // this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1]));
- // },
scoreChange(row, index, val) { // 暂时解决,输入分数,页面没有更新
this.projectJudgmentData.splice(index, 1, row);
},
@@ -698,6 +676,25 @@ export default {
}).catch(err => {
console.log(err);
});
+ },
+ // 返回列表
+ toList() {
+ this.$router.push(`/project/list?founder=${this.founder}`)
+ },
+ // 返回
+ back() {
+ // 更改了信息才需要提示
+ if(this.updateTime > 1){
+ this.$confirm('编辑的内容未保存,是否保存?', "提示", {
+ type: "warning"
+ }).then(() => {
+ this.handleSubmit(this.projectManage.state)
+ }).catch(() => {
+ this.toList()
+ })
+ } else {
+ this.toList()
+ }
}
}
};
diff --git a/src/pages/project/list/index.vue b/src/pages/project/list/index.vue
index 9c13676..3aa006f 100644
--- a/src/pages/project/list/index.vue
+++ b/src/pages/project/list/index.vue
@@ -67,27 +67,27 @@
{{ scope.$index + (page - 1) * pageSize + 1 }}
-
-
+
+
{{ founderKeys[scope.row.founder] }}
-
+
{{ permissionsKeys[scope.row.permissions] }}
-
-
+
+
{{ stateKeys[scope.row.state] }}
- 查看
- 编辑
+ 查看
+ 编辑
删除
复制