案例编辑

zqqdev
CherrysChang 5 years ago
parent 59bfd06560
commit 788dfa3125
  1. 6
      src/api/server.js
  2. 35
      src/views/train/case-detail.vue

@ -36,7 +36,7 @@ export const Train = new (class {
constructor() {
this.getCaseListApi = trainApi + "/trainCaseManage/list"; //实训管理列表
this.insertCaseApi = trainApi + "/trainCaseManage/add";//添加实训案例
this.updCaseApi = trainApi + "/trainCaseManage/edit";//修改实训案例
this.updateCaseApi = trainApi + "/trainCaseManage/edit";//修改实训案例
this.delCaseApi = trainApi + "/trainCaseManage/remove";//删除实训案例
this.getCaseDetailApi = trainApi + "/trainCaseManage/detail";//获取实训案例详情
this.getTargetListApi = trainApi + "/trainCaseManage/targetList";//量化指标列表
@ -55,9 +55,9 @@ export const Train = new (class {
.then(res => res.data);
}
//修改
updCase(params) {
updateCase(params) {
return axios
.post(this.updCaseApi, qs.stringify(params))
.post(this.updateCaseApi, qs.stringify(params))
.then(res => res.data);
}
//删除

@ -164,7 +164,26 @@
Train.getCaseDetail({id: this.dataForm.id}).then((res) => {
this.dataForm = res.data;
//
this.dataForm.type = String(res.type);
this.dataForm.type = String(res.data.type);
//
this.dataForm.taskList = res.data.taskList;
this.dataForm.taskList.forEach(item => {
item.taskOperate = String(item.taskOperate)
});
//
this.rightTargetList = this.dataForm.taskList;//taskList rightTargetList
//
this.rightTargetList.forEach(rItem => {
let index = this.leftDictTargetList.findIndex(lItem => {
if(rItem.id == lItem.id){
this.$set(rItem,"seq",lItem.seq);
return true;
}
});
this.leftDictTargetList.splice(index, 1);
});
if (this.$route.query.isEdit === 1) {
//
this.formAction = 1;
@ -343,10 +362,10 @@
// if (self.formAction == 0 && self.$store.state.app.user.userType) {
// self.dataForm.isAdmin = self.$store.state.app.user.userType == 1 ? 0 : 1;
// }
if(this.formAction == 0){//
Train.insertCase(self.dataForm).then(res => {
if (res.code == 200) {
// self.dataForm = Object.assign({}, self.dataForm, response.id);
self.formAction = 1;
self.$message.success("操作成功!");
self.goBackList();
} else {
@ -355,6 +374,18 @@
}).catch(error => {
self.$message.error(error);
});
}else if(this.formAction == 1){//
Train.updateCase(self.dataForm).then(res => {
if (res.code == 200) {
self.$message.success("操作成功!");
self.goBackList();
} else {
self.$message.error(res.msg);
}
}).catch(error => {
self.$message.error(error);
});
}
} else {
self.$message.error('系统输入验证失败!');
return false;

Loading…
Cancel
Save