http全局拦截

dev_2022-05-11
yujialong 3 years ago
parent 7d760a428c
commit c7e5289a06
  1. 8
      src/layouts/header/index.vue
  2. 12
      src/pages/assessment/add/index.vue
  3. 12
      src/pages/assessment/list/index.vue
  4. 48
      src/pages/evaluation/list/index.vue
  5. 72
      src/pages/project/add/index.vue
  6. 47
      src/pages/project/list/index.vue
  7. 22
      src/pages/setting/list/index.vue
  8. 98
      src/pages/student/list/index.vue
  9. 38
      src/pages/system/list/logo.vue
  10. 39
      src/pages/system/list/role.vue
  11. 98
      src/pages/system/list/staff.vue
  12. 108
      src/pages/system/list/staffSide.vue
  13. 4
      src/plugins/requests/index.js
  14. 4
      src/setting.js

@ -49,11 +49,9 @@ export default {
}, },
getSystemDetail () { // logo getSystemDetail () { // logo
this.$get(this.api.logoDetail).then(res => { this.$get(this.api.logoDetail).then(res => {
if (res.status === 200) { if (res.data) {
if (res.data) { this.setTitle(res.data.title);
this.setTitle(res.data.title); this.setLogoUrl(res.data.logoUrl);
this.setLogoUrl(res.data.logoUrl);
}
} }
}).catch(res => {}); }).catch(res => {});
}, },

@ -458,10 +458,8 @@ export default {
}); });
} else { } else {
this.$post(this.api.saveAssessment, this.form).then(res => { this.$post(this.api.saveAssessment, this.form).then(res => {
if (res.status === 200) { util.successMsg("创建成功");
util.successMsg("创建成功"); this.$router.back();
this.$router.back();
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -469,10 +467,8 @@ export default {
}, },
getData() { // getData() { //
this.$get(`${this.api.getDetailById}?id=${this.form.id}`).then(res => { this.$get(`${this.api.getDetailById}?id=${this.form.id}`).then(res => {
if (res.status == 200) { this.form = res.data;
this.form = res.data; this.formatDuration();
this.formatDuration();
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });

@ -331,10 +331,8 @@ export default {
status: 1 status: 1
}; };
this.$post(this.api.modifyAssessment, data).then(res => { this.$post(this.api.modifyAssessment, data).then(res => {
if (res.status === 200) { util.successMsg("启动成功!");
util.successMsg("启动成功!"); this.getData();
this.getData();
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -350,10 +348,8 @@ export default {
status: 2 status: 2
}; };
this.$post(`${this.api.collectPaper}?id=${row.id}`).then(res => { this.$post(`${this.api.collectPaper}?id=${row.id}`).then(res => {
if (res.status === 200) { util.successMsg("提前结束成功!");
util.successMsg("提前结束成功!"); this.getData();
this.getData();
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });

@ -323,12 +323,8 @@ export default {
questionType: this.subject questionType: this.subject
}) })
.then(res => { .then(res => {
if (res.status === 200) { this.listData = res.page.records;
this.listData = res.page.records; this.total = res.page.total;
this.total = res.page.total;
} else {
util.errorMsg(res.message);
}
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
@ -373,14 +369,10 @@ export default {
}, },
getDetail(id) { getDetail(id) {
this.$get(`${this.api.questionsDetail}`, { id }).then(res => { this.$get(`${this.api.questionsDetail}`, { id }).then(res => {
if (res.status === 200) { this.topicForm = res.questions;
this.topicForm = res.questions; this.topicForm.id = id;
this.topicForm.id = id; this.topicForm.questionType = res.questions.questionTypeName;
this.topicForm.questionType = res.questions.questionTypeName; this.NewTopics = true;
this.NewTopics = true;
} else {
util.errorMsg(res.message);
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -490,12 +482,8 @@ export default {
this.info.isMultipleEnable = Number(this.info.isMultipleEnable); this.info.isMultipleEnable = Number(this.info.isMultipleEnable);
this.info.isJudgmentEnable = Number(this.info.isJudgmentEnable); this.info.isJudgmentEnable = Number(this.info.isJudgmentEnable);
this.$post(this.api.questionsUpdateRules, this.info).then(res => { this.$post(this.api.questionsUpdateRules, this.info).then(res => {
if (res.status === 200) { util.successMsg("提交成功!");
util.successMsg("提交成功!"); this.SetEvaluation = false;
this.SetEvaluation = false;
} else {
util.errorMsg(res.message);
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -526,25 +514,17 @@ export default {
if (this.topicForm.id) { if (this.topicForm.id) {
this.$post(this.api.questionsUpdate, this.topicForm).then(res => { this.$post(this.api.questionsUpdate, this.topicForm).then(res => {
if (res.status === 200) { util.successMsg("提交成功!");
util.successMsg("提交成功!"); this.NewTopics = false;
this.NewTopics = false; this.getData();
this.getData();
} else {
util.errorMsg(res.message);
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
} else { } else {
this.$post(this.api.questionsSave, this.topicForm).then(res => { this.$post(this.api.questionsSave, this.topicForm).then(res => {
if (res.status === 200) { util.successMsg("提交成功!");
util.successMsg("提交成功!"); this.NewTopics = false;
this.NewTopics = false; this.getData();
this.getData();
} else {
util.errorMsg(res.message);
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });

@ -308,16 +308,12 @@ export default {
}, },
getInfoData() { // getInfoData() { //
this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}`).then(res => { this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}`).then(res => {
if (res.status === 200) { let { projectManage, projectJudgmentVos } = res;
let { projectManage, projectJudgmentVos } = res; this.projectManage = projectManage;
this.projectManage = projectManage; this.projectJudgmentData = projectJudgmentVos;
this.projectJudgmentData = projectJudgmentVos; this.projectJudgmentData.forEach((e, i) => {
this.projectJudgmentData.forEach((e, i) => { e.sort = i + 1;
e.sort = i + 1; });
});
} else {
util.warningMsg(res.message);
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -327,8 +323,6 @@ export default {
this.$post(this.api.queryNameIsExist, { projectName: this.projectManage.projectName }).then(res => { this.$post(this.api.queryNameIsExist, { projectName: this.projectManage.projectName }).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.projectNameRepeat = false; this.projectNameRepeat = false;
} else {
this.projectNameRepeat = true;
} }
}).catch(err => { }).catch(err => {
this.projectNameRepeat = true; this.projectNameRepeat = true;
@ -431,20 +425,16 @@ export default {
}, },
updateProject(params) { // updateProject(params) { //
this.$post(`${this.api.updateProjectManage}`, params).then(res => { this.$post(`${this.api.updateProjectManage}`, params).then(res => {
if (res.status === 200) { util.successMsg("更新实验项目成功");
util.successMsg("更新实验项目成功"); this.$router.back();
this.$router.back();
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
}, },
addProject(params) { // addProject(params) { //
this.$post(`${this.api.addProjectManage}`, params).then(res => { this.$post(`${this.api.addProjectManage}`, params).then(res => {
if (res.status === 200) { util.successMsg("添加实验项目成功");
util.successMsg("添加实验项目成功"); this.$router.back();
this.$router.back();
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -458,7 +448,7 @@ export default {
this.$get(this.api.avgValues, { this.$get(this.api.avgValues, {
number: this.projectJudgmentData.length number: this.projectJudgmentData.length
}).then(res => { }).then(res => {
if (res.status === 200 && res.data) { if (res.data) {
this.projectJudgmentData = this.projectJudgmentData.map((item, index) => { this.projectJudgmentData = this.projectJudgmentData.map((item, index) => {
item.score = res.data[index]; item.score = res.data[index];
return item; return item;
@ -536,16 +526,14 @@ export default {
getProcessClassData(params) { // getProcessClassData(params) { //
this.visibleLoading = true; this.visibleLoading = true;
this.$post(`${this.api.getLcJudgmentPoint}`, params).then(res => { this.$post(`${this.api.getLcJudgmentPoint}`, params).then(res => {
if (res.status === 200) { let list = res.message.records;
let list = res.message.records; let result = [];
let result = []; list.map(i => {
list.map(i => { i.judgmentId = i.lcId;
i.judgmentId = i.lcId; this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i);
this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); });
}); this.visibleLoading = false;
this.visibleLoading = false; this.judgementData = result;
this.judgementData = result;
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -553,18 +541,16 @@ export default {
getProgrammingClassData(params) { // getProgrammingClassData(params) { //
this.visibleLoading = true; this.visibleLoading = true;
this.$post(this.api.getBcJudgmentPoint, params).then(res => { this.$post(this.api.getBcJudgmentPoint, params).then(res => {
if (res.status === 200) { let list = res.message.records;
let list = res.message.records; let result = [];
let result = []; list.map(i => {
list.map(i => { i.judgmentId = i.bcId;
i.judgmentId = i.bcId; this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i);
this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); });
}); this.visibleLoading = false;
this.visibleLoading = false; this.judgementData = result;
this.judgementData = result; // console.log(res, "res");
// console.log(res, "res"); // console.log(this.projectJudgmentData, "projectJudgmentData");
// console.log(this.projectJudgmentData, "projectJudgmentData");
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });

@ -248,11 +248,8 @@ export default {
systemId: this.systemId systemId: this.systemId
}; };
this.$post(this.api.queryProjectManage, data).then(res => { this.$post(this.api.queryProjectManage, data).then(res => {
let { status, data } = res; this.listData = res.data.records;
if (status === 200 && data) { this.total = res.data.total;
this.listData = data.records;
this.total = data.total;
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -292,12 +289,8 @@ export default {
type: "warning" type: "warning"
}).then(() => { }).then(() => {
this.$post(`${this.api.deleteProjectManage}?projectIds=${ids}&platformId=${this.queryData.platformId}`).then(res => { this.$post(`${this.api.deleteProjectManage}?projectIds=${ids}&platformId=${this.queryData.platformId}`).then(res => {
if (res.status === 200) { util.successMsg("删除成功");
util.successMsg("删除成功"); this.getData();
this.getData();
} else {
util.errorMsg(res.message);
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -307,12 +300,8 @@ export default {
}, },
switchOff(row) { // switchOff(row) { //
this.$get(`${this.api.updateIsOpen}?isOpen=${row.isOpen}&projectId=${row.projectId}&platformId=${this.queryData.platformId}`).then(res => { this.$get(`${this.api.updateIsOpen}?isOpen=${row.isOpen}&projectId=${row.projectId}&platformId=${this.queryData.platformId}`).then(res => {
if (res.status === 200) { util.successMsg("更新启用状态成功");
util.successMsg("更新启用状态成功"); this.getData();
this.getData();
} else {
util.errorMsg(res.message);
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -322,8 +311,6 @@ export default {
this.$post(this.api.queryNameIsExist, { projectName: this.projectName }).then(res => { this.$post(this.api.queryNameIsExist, { projectName: this.projectName }).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.projectNameRepeat = false; this.projectNameRepeat = false;
} else {
this.projectNameRepeat = true;
} }
}).catch(err => { }).catch(err => {
this.projectNameRepeat = true; this.projectNameRepeat = true;
@ -335,13 +322,11 @@ export default {
copyData(projectId) { // id copyData(projectId) { // id
this.copyVisible = true; this.copyVisible = true;
this.$get(`${this.api.getProjectDetail}?projectId=${projectId}`).then(res => { this.$get(`${this.api.getProjectDetail}?projectId=${projectId}`).then(res => {
if (res.status === 200) { this.projectName = res.projectManage.projectName;
this.projectName = res.projectManage.projectName; this.currentRow = {
this.currentRow = { projectManage: res.projectManage,
projectManage: res.projectManage, projectJudgmentList: res.projectJudgmentVos
projectJudgmentList: res.projectJudgmentVos };
};
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
@ -362,13 +347,9 @@ export default {
i.projectId = ""; i.projectId = "";
}); });
this.$post(`${this.api.copyProjectManage}`, this.currentRow).then(res => { this.$post(`${this.api.copyProjectManage}`, this.currentRow).then(res => {
if (res.status === 200) { this.initData();
this.initData(); util.successMsg("复制实验项目成功");
util.successMsg("复制实验项目成功"); this.copyVisible = false;
this.copyVisible = false;
} else {
util.errorMsg(res.message);
}
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });

@ -715,10 +715,8 @@ export default {
data.userid = this.userId; data.userid = this.userId;
this.$post(this.api.examinePassword, data) this.$post(this.api.examinePassword, data)
.then(res => { .then(res => {
if (res.status === 200) { util.successMsg("更换成功");
util.successMsg("更换成功"); this.passwordVisible = false;
this.passwordVisible = false;
}
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
@ -1000,11 +998,9 @@ export default {
opener: this.emailOpener opener: this.emailOpener
}; };
this.$put(this.api.bindPhoneOrEmail, data).then(res => { this.$put(this.api.bindPhoneOrEmail, data).then(res => {
if (res.status == 200) { util.successMsg("绑定成功");
util.successMsg("绑定成功"); this.personalInformation.email = this.email;
this.personalInformation.email = this.email; this.emailVisible = false;
this.emailVisible = false;
}
}).catch(res => { }).catch(res => {
}); });
}, },
@ -1043,11 +1039,9 @@ export default {
opener: this.phoneOpener opener: this.phoneOpener
}; };
this.$put(this.api.bindPhoneOrEmail, data).then(res => { this.$put(this.api.bindPhoneOrEmail, data).then(res => {
if (res.status == 200) { util.successMsg("绑定成功");
util.successMsg("绑定成功"); this.personalInformation.phone = this.phone;
this.personalInformation.phone = this.phone; this.phoneVisible = false;
this.phoneVisible = false;
}
}).catch(res => { }).catch(res => {
}); });
}, },

@ -679,16 +679,12 @@ export default {
this.showTree = false; this.showTree = false;
this.studentVisible = true; this.studentVisible = true;
this.$post(`${this.api.getStudentInfoByAccountId}?stuAccountId=${row.accountId}`).then(res => { this.$post(`${this.api.getStudentInfoByAccountId}?stuAccountId=${row.accountId}`).then(res => {
if (res.status === 200) { this.form = res.data;
this.form = res.data; this.showTree = true;
this.showTree = true;
} else {
util.errorMsg(res.message);
}
}).catch(res => { }).catch(res => {
}); });
}, },
async accountChange() { accountChange() {
if (this.form.account) { if (this.form.account) {
let url = ""; let url = "";
if (this.isAdd) { if (this.isAdd) {
@ -696,16 +692,16 @@ export default {
} else { } else {
url = `${this.api.checkWorkNumOrAccount}?accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`; url = `${this.api.checkWorkNumOrAccount}?accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`;
} }
let res = await this.$post(url); this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.accountReapeat = false; this.accountReapeat = false;
} else { }
util.warningMsg("该账号已存在"); }).catch(err => {
this.accountReapeat = true; this.accountReapeat = true;
} });
} }
}, },
async worknumberChange() { worknumberChange() {
if (this.form.workNumber) { if (this.form.workNumber) {
let url = ""; let url = "";
if (this.isAdd) { if (this.isAdd) {
@ -713,16 +709,16 @@ export default {
} else { } else {
url = `${this.api.checkWorkNumOrAccount}?accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`; url = `${this.api.checkWorkNumOrAccount}?accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`;
} }
let res = await this.$post(url); this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.workNumberReapeat = false; this.workNumberReapeat = false;
} else { }
util.warningMsg("该学生学号已存在"); }).catch(err => {
this.workNumberReapeat = true; this.workNumberReapeat = true;
} });
} }
}, },
async phoneChange() { phoneChange() {
let regex = /^1[3456789]\d{9}$/; let regex = /^1[3456789]\d{9}$/;
if (regex.test(this.form.phone)) { if (regex.test(this.form.phone)) {
let url = ""; let url = "";
@ -731,16 +727,16 @@ export default {
} else { } else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&phone=${this.form.phone}&email=`; url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&phone=${this.form.phone}&email=`;
} }
let res = await this.$post(url); this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.phoneRepeat = false; this.phoneRepeat = false;
} else { }
util.warningMsg("该手机号已存在"); }).catch(err => {
this.phoneRepeat = true; this.phoneRepeat = true;
} });
} }
}, },
async emailChange() { emailChange() {
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
if (regex.test(this.form.email)) { if (regex.test(this.form.email)) {
let url = ""; let url = "";
@ -749,13 +745,13 @@ export default {
} else { } else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&email=${this.form.email}&phone=`; url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&email=${this.form.email}&phone=`;
} }
let res = await this.$post(url); this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.emailRepeat = false; this.emailRepeat = false;
} else { }
util.warningMsg("该邮箱已存在"); }).catch(err => {
this.emailRepeat = true; this.emailRepeat = true;
} });
} }
}, },
loadClassTree(node, resolve) { // loadClassTree(node, resolve) { //
@ -822,36 +818,28 @@ export default {
} }
if (this.form.accountId) { if (this.form.accountId) {
this.$post(this.api.modifyStudent, this.form).then(res => { this.$post(this.api.modifyStudent, this.form).then(res => {
if (res.status === 200) { util.successMsg("编辑成功!");
util.successMsg("编辑成功!"); this.closeStudent();
this.closeStudent(); if (this.studentType) {
if (this.studentType) { this.getData();
this.getData();
} else {
this.getOrgStudentData();
}
} else { } else {
util.errorMsg(res.message); this.getOrgStudentData();
} }
}).catch(res => { }).catch(res => {
}); });
} else { } else {
this.form.uniqueIdentification = new Date().getTime(); this.form.uniqueIdentification = new Date().getTime();
this.$post(this.api.addStudent, this.form).then(res => { this.$post(this.api.addStudent, this.form).then(res => {
if (res.status === 200) { util.successMsg("新增成功!");
util.successMsg("新增成功!"); if (type) {
if (type) { this.resetStudent();
this.resetStudent(); } else {
this.closeStudent();
if (this.studentType) {
this.getData();
} else { } else {
this.closeStudent(); this.getOrgStudentData();
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
}
} }
} else {
util.errorMsg(res.message);
} }
}).catch(res => { }).catch(res => {
}); });

@ -67,19 +67,15 @@ export default {
]), ]),
getSystemDetail () { getSystemDetail () {
this.$get(this.api.logoDetail).then(res => { this.$get(this.api.logoDetail).then(res => {
if (res.status === 200) { if (res.data) {
if (res.data) { this.form = res.data;
this.form = res.data; this.coverUrl = res.data.logoUrl;
this.coverUrl = res.data.logoUrl; this.uploadList.push({
this.uploadList.push({ name: "logo.jpg",
name: "logo.jpg", url: this.coverUrl
url: this.coverUrl });
}); this.setTitle(res.data.title);
this.setTitle(res.data.title); this.setLogoUrl(res.data.logoUrl);
this.setLogoUrl(res.data.logoUrl);
}
} else {
util.errorMsg(res.message);
} }
}).catch(res => {}); }).catch(res => {});
}, },
@ -110,21 +106,13 @@ export default {
this.form.logoUrl = this.coverUrl; this.form.logoUrl = this.coverUrl;
if (this.form.id) { if (this.form.id) {
this.$post(this.api.logoUpdate, this.form).then(res => { this.$post(this.api.logoUpdate, this.form).then(res => {
if (res.status === 200) { util.successMsg("更新成功");
util.successMsg("更新成功"); this.getSystemDetail();
this.getSystemDetail();
} else {
util.errorMsg(res.message);
}
}).catch(res => {}); }).catch(res => {});
} else { } else {
this.$post(this.api.logoSave, this.form).then(res => { this.$post(this.api.logoSave, this.form).then(res => {
if (res.status === 200) { util.successMsg("新增成功");
util.successMsg("新增成功"); this.getSystemDetail();
this.getSystemDetail();
} else {
util.errorMsg(res.message);
}
}).catch(res => {}); }).catch(res => {});
} }
} }

@ -210,12 +210,10 @@ export default {
}, },
async getDetail(row) { // async getDetail(row) { //
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`);
if (res.status === 200) { this.form = res.role;
this.form = res.role; this.form.id = row.id;
this.form.id = row.id; this.checkedIds = this.handleRolePer(res.permissionList, this.permissions);
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); this.$refs.per.setCheckedNodes(this.checkedIds);
this.$refs.per.setCheckedNodes(this.checkedIds);
}
}, },
showRole(row) { showRole(row) {
this.isDetail = true; this.isDetail = true;
@ -228,15 +226,6 @@ export default {
this.getPer(row); this.getPer(row);
this.roleVisible = true; this.roleVisible = true;
}, },
async roleNameChange() {
let res = await this.$post(`${this.api.checkRoleIsExist}?roleName=${this.form.roleName}`);
if (res.status === 200) {
this.roleNameReapeat = false;
} else {
util.warningMsg("该角色已存在");
this.roleNameReapeat = true;
}
},
async saveData() { async saveData() {
if (!this.form.roleName) return util.warningMsg("请填写角色名称"); if (!this.form.roleName) return util.warningMsg("请填写角色名称");
if (!this.form.remark) return util.warningMsg("请填写角色描述"); if (!this.form.remark) return util.warningMsg("请填写角色描述");
@ -249,23 +238,15 @@ export default {
}; };
if (this.form.id) { if (this.form.id) {
this.$post(this.api.saveOrUpdate, data).then(res => { this.$post(this.api.saveOrUpdate, data).then(res => {
if (res.status === 200) { util.successMsg("修改成功");
util.successMsg("修改成功"); this.getData();
this.getData(); this.roleVisible = false;
this.roleVisible = false;
} else {
util.errorMsg(res.message);
}
}).catch(res => {}); }).catch(res => {});
} else { } else {
this.$post(this.api.saveOrUpdate, data).then(res => { this.$post(this.api.saveOrUpdate, data).then(res => {
if (res.status === 200) { util.successMsg("新增成功");
util.successMsg("新增成功"); this.getData();
this.getData(); this.roleVisible = false;
this.roleVisible = false;
} else {
util.errorMsg(res.message);
}
}).catch(res => {}); }).catch(res => {});
} }
} }

@ -317,25 +317,19 @@ export default {
}, },
getStaffDetail(accountId) { // getStaffDetail(accountId) { //
this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => { this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => {
let { data, status} = res; let { data } = res;
if (status === 200) { this.teacherForm = data;
this.teacherForm = data; this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId);
this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId); this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => {
this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => { i.cascaderValue = [i.staffArchitectureId, i.gradeId]
i.cascaderValue = [i.staffArchitectureId, i.gradeId] return i;
return i; });
});
}
}).catch(res => {}); }).catch(res => {});
}, },
resetPassword(row) { // resetPassword(row) { //
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => { this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => {
this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => { this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => {
if (res.status === 200) { util.successMsg("重置成功");
util.successMsg("重置成功");
} else {
util.errorMsg(res.message);
}
}).catch(res => { }).catch(res => {
}); });
}).catch(() => { }).catch(() => {
@ -355,7 +349,7 @@ export default {
this.majorList = this.$refs.getSelectData.majorList; this.majorList = this.$refs.getSelectData.majorList;
this.getStaffDetail(row.accountId); this.getStaffDetail(row.accountId);
}, },
async accountChange() { // accountChange() { //
if (this.teacherForm.account) { if (this.teacherForm.account) {
let url = ""; let url = "";
if (this.isAdd) { if (this.isAdd) {
@ -363,16 +357,16 @@ export default {
} else { } else {
url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&account=${this.teacherForm.account}&workNumber=`; url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&account=${this.teacherForm.account}&workNumber=`;
} }
let res = await this.$post(url); this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.accountReapeat = false; this.accountReapeat = false;
} else { }
util.warningMsg("该账号已存在"); }).catch( err => {
this.accountReapeat = true; this.accountReapeat = true;
} });
} }
}, },
async workNumberChange() { // workNumberChange() { //
if (this.teacherForm.workNumber) { if (this.teacherForm.workNumber) {
let url = ""; let url = "";
if (this.isAdd) { if (this.isAdd) {
@ -380,16 +374,16 @@ export default {
} else { } else {
url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&workNumber=${this.teacherForm.workNumber}&account=`; url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&workNumber=${this.teacherForm.workNumber}&account=`;
} }
let res = await this.$post(url); this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.workNumberReapeat = false; this.workNumberReapeat = false;
} else { }
util.warningMsg("该员工工号已存在"); }).catch( err => {
this.workNumberReapeat = true; this.workNumberReapeat = true;
} });
} }
}, },
async phoneChange() { // phoneChange() { //
let regex = /^1[3456789]\d{9}$/; let regex = /^1[3456789]\d{9}$/;
if (regex.test(this.teacherForm.phone)) { if (regex.test(this.teacherForm.phone)) {
let url = ""; let url = "";
@ -398,16 +392,16 @@ export default {
} else { } else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&phone=${this.teacherForm.phone}&email=`; url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&phone=${this.teacherForm.phone}&email=`;
} }
let res = await this.$post(url); this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.phoneRepeat = false; this.phoneRepeat = false;
} else { }
util.warningMsg("该手机号已存在"); }).catch( err => {
this.phoneRepeat = true; this.phoneRepeat = true;
} });
} }
}, },
async emailChange() { // emailChange() { //
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
if (regex.test(this.teacherForm.email)) { if (regex.test(this.teacherForm.email)) {
let url = ""; let url = "";
@ -416,13 +410,13 @@ export default {
} else { } else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&email=${this.teacherForm.email}&phone=`; url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&email=${this.teacherForm.email}&phone=`;
} }
let res = await this.$post(url); this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.emailRepeat = false; this.emailRepeat = false;
} else { }
util.warningMsg("该邮箱已存在"); }).catch( err => {
this.emailRepeat = true; this.emailRepeat = true;
} });
} }
}, },
roleChange(value) { // roleChange(value) { //
@ -484,23 +478,15 @@ export default {
} }
if (this.teacherForm.accountId) { if (this.teacherForm.accountId) {
this.$post(this.api.modifyStaff, data).then(res => { this.$post(this.api.modifyStaff, data).then(res => {
if (res.status === 200) { util.successMsg("编辑成功");
util.successMsg("编辑成功"); this.closeTeacher();
this.closeTeacher(); this.getData();
this.getData();
} else {
util.errorMsg(res.message);
}
}).catch(res => {}); }).catch(res => {});
} else { } else {
this.$post(this.api.saveStaff, data).then(res => { this.$post(this.api.saveStaff, data).then(res => {
if (res.status === 200) { util.successMsg("添加成功");
util.successMsg("添加成功"); this.closeTeacher();
this.closeTeacher(); this.getData();
this.getData();
} else {
util.errorMsg(res.message);
}
}).catch(res => {}); }).catch(res => {});
} }
} else { } else {

@ -127,39 +127,31 @@ export default {
}; };
if (this.Form.staffArchitectureId) { if (this.Form.staffArchitectureId) {
this.$post(this.api.updateProfessional, data).then(res => { this.$post(this.api.updateProfessional, data).then(res => {
if (res.status === 200) { util.successMsg("编辑成功");
util.successMsg("编辑成功"); this.isaddMajor = false;
this.isaddMajor = false; this.majorList.map(e => {
this.majorList.map(e => { if (e.staffArchitectureId == this.Form.staffArchitectureId) {
if (e.staffArchitectureId == this.Form.staffArchitectureId) { e.staffArchitectureName = this.Form.staffArchitectureName;
e.staffArchitectureName = this.Form.staffArchitectureName; e.label = this.Form.staffArchitectureName;
e.label = this.Form.staffArchitectureName; }
} });
}); this.$emit("getData");
this.$emit("getData");
} else {
util.errorMsg(res.message);
}
}).catch(res => { }).catch(res => {
}); });
} else { } else {
this.$post(this.api.saveProfessional, data).then(res => { this.$post(this.api.saveProfessional, data).then(res => {
if (res.status === 200) { util.successMsg("添加成功");
util.successMsg("添加成功"); this.isaddMajor = false;
this.isaddMajor = false; let newData = {
let newData = { staffArchitectureId: res.staffArchitectureId,
staffArchitectureId: res.staffArchitectureId, staffArchitectureName: this.Form.staffArchitectureName,
staffArchitectureName: this.Form.staffArchitectureName, label: this.Form.staffArchitectureName,
label: this.Form.staffArchitectureName, value: res.staffArchitectureId,
value: res.staffArchitectureId, ifVisible: false,
ifVisible: false, ischeck: false,
ischeck: false, children: []
children: [] };
}; this.majorList.push(newData);
this.majorList.push(newData);
} else {
util.errorMsg(res.message);
}
}).catch(res => { }).catch(res => {
}); });
} }
@ -197,44 +189,36 @@ export default {
}; };
if (this.Form.gradeId) { if (this.Form.gradeId) {
this.$post(this.api.updateGrade, data).then(res => { this.$post(this.api.updateGrade, data).then(res => {
if (res.status === 200) { util.successMsg("编辑成功");
util.successMsg("编辑成功"); this.isAddDepartment = false;
this.isAddDepartment = false; this.majorList.map(e => {
this.majorList.map(e => { e.children.map(r => {
e.children.map(r => { if (r.gradeId == this.Form.gradeId) {
if (r.gradeId == this.Form.gradeId) { r.gradeName = this.Form.gradeName;
r.gradeName = this.Form.gradeName; r.label = this.Form.gradeName;
r.label = this.Form.gradeName; }
}
});
}); });
} else { });
util.errorMsg(res.message);
}
}).catch(res => { }).catch(res => {
}); });
} else { } else {
this.$post(this.api.saveGrade, data).then(res => { this.$post(this.api.saveGrade, data).then(res => {
if (res.status === 200) { util.successMsg("添加成功");
util.successMsg("添加成功"); this.isAddDepartment = false;
this.isAddDepartment = false; let newData = {
let newData = { gradeId: res.gradeId,
gradeId: res.gradeId, gradeName: this.Form.gradeName,
gradeName: this.Form.gradeName, label: this.Form.gradeName,
label: this.Form.gradeName, value: res.gradeId,
value: res.gradeId, ifVisible: false,
ifVisible: false, ischeck: false
ischeck: false };
}; this.majorList.map(e => {
this.majorList.map(e => { if (e.staffArchitectureId == this.Form.staffArchitectureId) {
if (e.staffArchitectureId == this.Form.staffArchitectureId) { e.ifVisible = true;
e.ifVisible = true; e.children.push(newData);
e.children.push(newData); }
} });
});
} else {
util.errorMsg(res.message);
}
}).catch(res => { }).catch(res => {
}); });
} }

@ -36,8 +36,8 @@ service.interceptors.response.use(
return Promise.resolve(res).catch(e => {}); return Promise.resolve(res).catch(e => {});
} else { } else {
util.errorMsg(res.message); util.errorMsg(res.message);
// return Promise.reject(res) return Promise.reject(res)
return Promise.resolve(res).catch(e => {}); // return Promise.resolve(res).catch(e => {});
} }
}, },
// 服务器状态码不是200的情况 // 服务器状态码不是200的情况

@ -41,8 +41,8 @@ if (isHh) {
schoolId = 2105; schoolId = 2105;
} else if (isDev) { } else if (isDev) {
jumpPath = "http://192.168.31.154:8087/"; jumpPath = "http://192.168.31.154:8087/";
host = "http://39.108.250.202:9000/"; // 中台测试服 // host = "http://39.108.250.202:9000/"; // 中台测试服
// host = "http://192.168.31.151:9000/"; // 榕 host = "http://192.168.31.151:9000/"; // 榕
// host = "http://192.168.31.125:9000/"; // 坤 // host = "http://192.168.31.125:9000/"; // 坤
// host = 'http://192.168.31.137:9000/'; // 赓 // host = 'http://192.168.31.137:9000/'; // 赓
title = "职站服务端管理系统"; title = "职站服务端管理系统";

Loading…
Cancel
Save