fix: edu.js train.vue 新增线下培训
This commit is contained in:
parent
d1844a2104
commit
cc20b723fa
|
@ -34,10 +34,12 @@
|
||||||
label="培训名称"
|
label="培训名称"
|
||||||
prop="name"
|
prop="name"
|
||||||
></el-table-column>
|
></el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="等级">
|
||||||
label="等级"
|
<template v-slot="scope">
|
||||||
prop="level"
|
<div v-for="(item, index) in levelOptions" :key="index">
|
||||||
>
|
<span v-if="item.value == scope.row.level">{{ item.key }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="时长(h)"
|
label="时长(h)"
|
||||||
|
@ -59,10 +61,6 @@
|
||||||
label="内容描述"
|
label="内容描述"
|
||||||
prop="description"
|
prop="description"
|
||||||
></el-table-column>
|
></el-table-column>
|
||||||
<el-table-column
|
|
||||||
label="参与部门"
|
|
||||||
prop="attend_departs"
|
|
||||||
></el-table-column>
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="是否公开"
|
label="是否公开"
|
||||||
width="80"
|
width="80"
|
||||||
|
@ -80,21 +78,21 @@
|
||||||
width="150"
|
width="150"
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<!-- <el-button
|
<el-button
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="table_edit(scope.row)"
|
@click="table_edit(scope.row)"
|
||||||
v-auth="'exam.update'"
|
v-auth="'train.update'"
|
||||||
type="primary"
|
type="primary"
|
||||||
>编辑</el-button
|
>编辑</el-button
|
||||||
> -->
|
>
|
||||||
<el-button
|
<!-- <el-button
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="row_detail(scope.row)"
|
@click="row_detail(scope.row)"
|
||||||
type="primary"
|
type="primary"
|
||||||
>详情</el-button
|
>详情</el-button
|
||||||
>
|
> -->
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
title="确定删除吗?"
|
title="确定删除吗?"
|
||||||
@confirm="table_del(scope.row, scope.$index)"
|
@confirm="table_del(scope.row, scope.$index)"
|
||||||
|
@ -103,7 +101,7 @@
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
v-auth="'exam.delete'"
|
v-auth="'train.delete'"
|
||||||
type="danger"
|
type="danger"
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
>
|
>
|
||||||
|
@ -122,7 +120,7 @@
|
||||||
<el-form-item label="培训名称" prop="name" required>
|
<el-form-item label="培训名称" prop="name" required>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="trainForm.name"
|
v-model="trainForm.name"
|
||||||
clearable
|
style="width: 80%;"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-row>
|
<el-row>
|
||||||
|
@ -144,21 +142,30 @@
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-form-item label="地点" prop="place" required>
|
||||||
<el-col :span="8">
|
<el-input
|
||||||
|
v-model="trainForm.place"
|
||||||
<!-- <el-form-item
|
clearable
|
||||||
label="级别"
|
></el-input>
|
||||||
prop="level"
|
</el-form-item>
|
||||||
required
|
<el-form-item label="时长(h)" prop="duration" required>
|
||||||
>
|
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="examForm.chance"
|
v-model="trainForm.duration"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
:min="1"
|
:step="0.5"
|
||||||
style="width: 100%"
|
step-strictly="true"
|
||||||
></el-input-number>
|
/>
|
||||||
</el-form-item> -->
|
</el-form-item>
|
||||||
|
<el-form-item label="内容描述" prop="description" required>
|
||||||
|
<el-input
|
||||||
|
v-model="trainForm.description"
|
||||||
|
clearable
|
||||||
|
autisize
|
||||||
|
type="textarea"
|
||||||
|
style="width: 240%;"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-col :span="8">
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<el-form-item label="级别" prop="level" required>
|
<el-form-item label="级别" prop="level" required>
|
||||||
|
@ -170,12 +177,14 @@
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in levelOptions"
|
v-for="item in levelOptions"
|
||||||
:key="item.id"
|
:key="item.key"
|
||||||
:label="item.name"
|
:label="item.key"
|
||||||
:value="item.id"
|
:value="item.value"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
|
@ -186,13 +195,23 @@
|
||||||
<el-switch v-model="trainForm.is_public"/>
|
<el-switch v-model="trainForm.is_public"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-form-item label="附件" prop="files">
|
||||||
|
<sc-upload-file
|
||||||
|
:multiple="false"
|
||||||
|
:on-success="handleUpSuccess"
|
||||||
|
:limit="1"
|
||||||
|
tip="最多上传10个文件,单个文件不要超过10M"
|
||||||
|
>
|
||||||
|
<el-button type="primary" icon="el-icon-upload"> </el-button>
|
||||||
|
</sc-upload-file>
|
||||||
|
</el-form-item>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:loading="examSaving"
|
:loading="trainSaving"
|
||||||
@click="examSubmit()"
|
@click="TrainSubmit()"
|
||||||
>保 存</el-button
|
>保 存</el-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
|
@ -200,12 +219,12 @@
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
const defaultExam = {chance: 1, is_public:false}
|
const defaultTrain = {chance: 1, is_public:false}
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
paperOptions:[],
|
paperOptions:[],
|
||||||
examDialog: false,
|
trainDialog: false,
|
||||||
apiObj: this.$API.edu.training.list,
|
apiObj: this.$API.edu.training.list,
|
||||||
query: {
|
query: {
|
||||||
search: "",
|
search: "",
|
||||||
|
@ -216,7 +235,7 @@ export default {
|
||||||
{key:'部门',value:30},
|
{key:'部门',value:30},
|
||||||
{key:'公司',value:40}
|
{key:'公司',value:40}
|
||||||
],
|
],
|
||||||
examForm: Object.assign({}, defaultExam),
|
trainForm: Object.assign({}, defaultTrain),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -224,7 +243,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getPaperOptions() {
|
getPaperOptions() {
|
||||||
this.$API.edu.paper.list.req({
|
this.$API.edu.training.list.req({
|
||||||
page: 0
|
page: 0
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.paperOptions = res;
|
this.paperOptions = res;
|
||||||
|
@ -234,35 +253,40 @@ export default {
|
||||||
this.$refs.table.queryData(this.query);
|
this.$refs.table.queryData(this.query);
|
||||||
},
|
},
|
||||||
table_add() {
|
table_add() {
|
||||||
this.examForm = Object.assign({}, defaultExam);
|
this.trainForm = Object.assign({}, defaultTrain);
|
||||||
this.examDialog = true;
|
this.trainDialog = true;
|
||||||
},
|
},
|
||||||
table_edit(row) {
|
table_edit(row) {
|
||||||
this.examForm = Object.assign({}, row);
|
this.trainForm = Object.assign({}, row);
|
||||||
this.examDialog = true;
|
this.trainDialog = true;
|
||||||
},
|
},
|
||||||
table_del(row) {
|
table_del(row) {
|
||||||
this.$API.edu.exam.delete.req(row.id).then(() => {
|
this.$API.edu.training.delete.req(row.id).then(() => {
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
examSubmit() {
|
handleUpSuccess(res, file){
|
||||||
this.examSaving = true;
|
this.trainForm.files = [];
|
||||||
if (this.examForm.id){
|
this.trainForm.files.push(res.id)
|
||||||
this.$API.edu.exam.update.req(this.examForm.id, this.examForm).then(res=>{
|
},
|
||||||
|
TrainSubmit() {
|
||||||
|
this.trainSaving = true;
|
||||||
|
if (this.trainForm.id){
|
||||||
|
this.$API.edu.training.update.req(this.trainForm.id, this.trainForm).then(res=>{
|
||||||
this.$message.success("更新成功");
|
this.$message.success("更新成功");
|
||||||
this.examSaving = false;
|
this.trainSaving = false;
|
||||||
this.examDialog = false;
|
this.trainDialog = false;
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
}).catch(e=>{this.examSaving=false})
|
}).catch(e=>{this.trainSaving=false})
|
||||||
}else{
|
}else{
|
||||||
this.$API.edu.exam.create.req(this.examForm).then(res=>{
|
console.log(this.trainForm)
|
||||||
|
this.$API.edu.training.create.req(this.trainForm).then(res=>{
|
||||||
this.$message.success("创建成功");
|
this.$message.success("创建成功");
|
||||||
this.examSaving = false;
|
this.trainSaving = false;
|
||||||
this.examDialog = false;
|
this.trainDialog = false;
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
this.examSaving = false;
|
this.trainSaving = false;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue