实训案例管理列表、新增后台init

zqqdev
CherrysChang 5 years ago
parent 63d066d91e
commit 2f2f95f550
  1. 9
      src/api/server.js
  2. 1
      src/common/js/interceptor.js
  3. 15
      src/views/train/case-detail.vue
  4. 31
      src/views/train/case-list.vue

@ -38,6 +38,8 @@ export const Train = new (class {
this.insertCaseApi = trainApi + "/trainCaseManage/add";//添加
this.updCaseApi = trainApi + "/trainCaseManage/edit";//修改
this.delCaseApi = trainApi + "/trainCaseManage/remove";//删除
this.getTargetListApi = trainApi + "/trainCaseManage/targetList";//量化指标列表
}
//实训案例管理列表
@ -64,6 +66,13 @@ export const Train = new (class {
.post(this.delCaseApi, qs.stringify(params))
.then(res => res.data);
}
//量化指标列表
getTargetList(params) {
return axios
.get(this.getTargetListApi, {params: params})
.then(res => res.data);
}
})();
/**

@ -5,7 +5,6 @@ import store from '@/vuex/store.js';
axios.defaults.timeout = 10000;
axios.interceptors.request.use(
function(config){
debugger;
// return config;
// }
// config.url = process.env.BASEAPI+process.env.ROOT+config.url;

@ -25,7 +25,7 @@
<el-row :gutter="20" type="flex">
<el-col :span="1" style="text-align:center;padding-top: 182px;width: 88px;" class="item-required">量化指标</el-col>
<el-col :span="7">
<el-table ref="leftTable" :data="tableData.filter(data => !searchName || data.name.toLowerCase().includes(searchName.toLowerCase()))"
<el-table ref="leftTable" :data="leftListData.filter(data => !searchName || data.name.toLowerCase().includes(searchName.toLowerCase()))"
height="400" border highlight-current-row tooltip-effect="dark" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column header-align="right" label="未选择 10/10">
@ -89,6 +89,8 @@
</template>
<script>
import {Train} from "@/api/server.js";
export default {
name: 'case-detail',
data() {
@ -112,6 +114,7 @@
}
};
return {
leftListData: [],
tableData: [{
name: '王小虎',
}, {
@ -195,12 +198,22 @@
}
});
}
this.initTargetList();
},
methods: {
goBackList() {
// this.$router.push({name: 'CaseList'});
this.$router.go(-1);
},
initTargetList(searchObj) {
Train.getTargetList(searchObj).then(res => {
if (res.code == 200) {
this.leftListData = res.data;
}
}).catch(error => {
console.info(error)
});
},
goBackAdd() {
this.isShowData = false;
},

@ -39,31 +39,26 @@
<el-table-column prop="name" label="实训名称" width="400"></el-table-column>
<el-table-column prop="type" label="实训用途" width="160">
<template slot-scope="scope">
{{ scope.row.type === 1 ? '练习': '' }}
{{ scope.row.type === 2 ? '考核': '' }}
{{ scope.row.type === 1 ? '考核': '' }}
{{ scope.row.type === 2 ? '练习': '' }}
</template>
</el-table-column>
<el-table-column prop="isAdmin" label="创建人" width="160">
<template slot-scope="scope">
{{ scope.row.isAdmin === 1 ? '管理员': '' }}
{{ scope.row.isAdmin === 2 ? '教师': '' }}
{{ scope.row.isAdmin === 0 ? '教师': '' }}
</template>
</el-table-column>
<el-table-column prop="updateTime" label="编辑时间" width="240"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<div v-if="showSearchDiv==1">
<el-button @click="toInputForm(scope.row,0)" type="text" size="small">查看</el-button>
<el-button @click="toInputForm(scope.row,1)" type="text" size="small"
v-if="isShowEditOrDelBtn(scope.row)">编辑
</el-button>
<el-button @click="doSingleDel(scope.row)" type="text" size="small" v-if="isShowEditOrDelBtn(scope.row)">
删除
</el-button>
</div>
<!--<div v-else>
<el-button @click="gotoDb(scope.row)" type="text" size="small">进入</el-button>
</div>-->
<el-button @click="toInputForm(scope.row,0)" type="text" size="small">查看</el-button>
<el-button @click="toInputForm(scope.row,1)" type="text" size="small"
v-if="isShowEditOrDelBtn(scope.row)">编辑
</el-button>
<el-button @click="doSingleDel(scope.row)" type="text" size="small" v-if="isShowEditOrDelBtn(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -89,9 +84,7 @@
searchObj: {
type: '',
isAdmin: '',
name: '',
showSearchDiv: 1,
selfIsAdmin:1
name: ''
},
listData: [],
delProjectItems: [],
@ -108,7 +101,7 @@
initList(searchObj) {
Train.getCaseList(searchObj).then(res => {
if (res.code == 200) {
this.listData = res.data;
this.listData = res.data.rows;
this.totalCount = res.totalCount;
}
}).catch(error => {

Loading…
Cancel
Save