diff --git a/src/components/XyDialog/index.vue b/src/components/XyDialog/index.vue index 36e089d..3f09fed 100644 --- a/src/components/XyDialog/index.vue +++ b/src/components/XyDialog/index.vue @@ -33,6 +33,10 @@ export default { }, okText:{ type:String + }, + hasIscheck:{ + type:Boolean, + default:false } }, data() { @@ -53,7 +57,7 @@ export default { if(this.type === 'normal'){ return (
- +
) @@ -62,6 +66,8 @@ export default { showChange(e){ this.$emit('update:isShow',e) this.$emit('on-visible-change',e) + this.$emit('update:hasIscheck',e) + }, validate(){ return new Promise((resolve,reject)=>{ @@ -94,20 +100,21 @@ export default { } this.$refs['elForm'].validate().then(res=>{ if(res){ - if(ischeck){ + console.log("res",res) + console.log("ischeck",this.hasIscheck) + if(this.hasIscheck){ this.$emit('mysubmit',true) }else{ this.$emit('submit') } } }).catch(err => { - console.log("456") this.$Message.warning({ content: "请填写完整信息", background: true, duration: 1 }) - if(ischeck){ + if(this.hasIscheck){ this.$emit('mysubmit',false) } }) @@ -123,6 +130,7 @@ export default { isShow(val){ if(!val && this.type === 'form'){ this.reset() + } } }, diff --git a/src/views/component/imports.vue b/src/views/component/imports.vue index 8158371..386c79c 100644 --- a/src/views/component/imports.vue +++ b/src/views/component/imports.vue @@ -19,6 +19,7 @@ :action="action" :data="{ table_name: tableName, + course_id:course_id?course_id:'' }" :headers="{ Authorization: `Bearer ${getToken()}`, @@ -53,6 +54,7 @@ export default { default: () => [], }, tableName: String, + course_id: String }, data() { return { @@ -84,7 +86,18 @@ export default { b.push({ key: key, title: res[key] }); } } + // 课表 + if(this.tableName==='course_contents'){ + b.push({ key: '', title: '老师简介' }); + b.map(item=>{ + if(item.key==='teacher_id'){ + item.key = 'teacher_name' + } + }) + } + this.table = this.headers = b + console.log("table",this.table) }, //上传 uploadFail(err) { @@ -124,6 +137,7 @@ export default { url: this.import_action, data:{ table_name: this.tableName, + course_id:this.course_id?this.course_id:'', data: this.tableList } }).then(res => { @@ -132,9 +146,10 @@ export default { type: 'success', message: `成功导入${res.total}条` }) + this.hidden(); + this.$emit('refresh') }) - this.hidden(); - this.$emit('refresh') + } }, computed: {}, @@ -152,8 +167,9 @@ export default { dialogVisible(newval){ console.log("newval",newval,this.tableName) if(newval){ - this.action = `${process.env.VUE_APP_BASE_API}/api/admin/${this.tableName}/excel-show` - this.import_action = `/api/admin/${this.tableName}/import` + let changeTableName = this.tableName.replace('_','-') + this.action = `${process.env.VUE_APP_BASE_API}/api/admin/${changeTableName}/excel-show` + this.import_action = `/api/admin/${changeTableName}/import` this.getHeaders() console.log("action",this.action,this.import_action) } diff --git a/src/views/course/class.vue b/src/views/course/class.vue index 6c491a5..88f199f 100644 --- a/src/views/course/class.vue +++ b/src/views/course/class.vue @@ -67,9 +67,9 @@ diff --git a/src/views/course/components/addCourse.vue b/src/views/course/components/addCourse.vue index 2294644..3a20cc9 100644 --- a/src/views/course/components/addCourse.vue +++ b/src/views/course/components/addCourse.vue @@ -1,7 +1,7 @@