|
|
|
@ -76,17 +76,24 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 获取表头
|
|
|
|
// 获取表头
|
|
|
|
async getHeaders() {
|
|
|
|
async getHeaders() {
|
|
|
|
|
|
|
|
let _except = []
|
|
|
|
//
|
|
|
|
// 学员去除一些信息
|
|
|
|
|
|
|
|
if (this.tableName === 'users') {
|
|
|
|
|
|
|
|
_except = ['plate', 'is_import', 'is_vip', 'is_schoolmate', 'appointment_total', 'letter', 'score', 'code',
|
|
|
|
|
|
|
|
'pid'
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
const res = await realTableShow({
|
|
|
|
const res = await realTableShow({
|
|
|
|
table_name: this.tableName
|
|
|
|
table_name: this.tableName,
|
|
|
|
|
|
|
|
except: _except
|
|
|
|
})
|
|
|
|
})
|
|
|
|
let b = [];
|
|
|
|
let b = [];
|
|
|
|
for (let key in res) {
|
|
|
|
for (let key in res) {
|
|
|
|
if (!this.base.isNull(res[key])) {
|
|
|
|
if (!this.base.isNull(res[key])) {
|
|
|
|
b.push({
|
|
|
|
b.push({
|
|
|
|
key: key,
|
|
|
|
key: key,
|
|
|
|
title: res[key]
|
|
|
|
title: res[key],
|
|
|
|
|
|
|
|
width:120
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -94,7 +101,8 @@
|
|
|
|
if (this.tableName === 'course_contents') {
|
|
|
|
if (this.tableName === 'course_contents') {
|
|
|
|
b.push({
|
|
|
|
b.push({
|
|
|
|
key: '',
|
|
|
|
key: '',
|
|
|
|
title: '老师简介'
|
|
|
|
title: '老师简介',
|
|
|
|
|
|
|
|
width:120
|
|
|
|
});
|
|
|
|
});
|
|
|
|
b.map(item => {
|
|
|
|
b.map(item => {
|
|
|
|
if (item.key === 'teacher_id') {
|
|
|
|
if (item.key === 'teacher_id') {
|
|
|
|
@ -117,7 +125,8 @@
|
|
|
|
if (this.tableName === 'users') {
|
|
|
|
if (this.tableName === 'users') {
|
|
|
|
b.unshift({
|
|
|
|
b.unshift({
|
|
|
|
key: 'course_name',
|
|
|
|
key: 'course_name',
|
|
|
|
title: '课程名字'
|
|
|
|
title: '课程名字',
|
|
|
|
|
|
|
|
width:120
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -133,12 +142,12 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
uploadSuccess(response, file, fileList) {
|
|
|
|
uploadSuccess(response, file, fileList) {
|
|
|
|
console.log(response, file, fileList)
|
|
|
|
console.log(response, file, fileList)
|
|
|
|
console.log("window.screen.height",window.screen.height)
|
|
|
|
console.log("window.screen.height", window.screen.height)
|
|
|
|
if (response && response.hasOwnProperty("errcode")) {
|
|
|
|
if (response && response.hasOwnProperty("errcode")) {
|
|
|
|
this.$message({
|
|
|
|
this.$message({
|
|
|
|
message: response.errmsg || "上传失败",
|
|
|
|
message: response.errmsg || "上传失败",
|
|
|
|
type: "error",
|
|
|
|
type: "error",
|
|
|
|
duration:2000,
|
|
|
|
duration: 2000,
|
|
|
|
offset: window.screen.height / 4
|
|
|
|
offset: window.screen.height / 4
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.fileList = []
|
|
|
|
this.fileList = []
|
|
|
|
@ -167,7 +176,7 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
exportExcel(sheetName) {
|
|
|
|
exportExcel(sheetName) {
|
|
|
|
const data = [this.headers.map((header) =>header.title)];
|
|
|
|
const data = [this.headers.map((header) => header.title)];
|
|
|
|
const wb = XLSX.utils.book_new();
|
|
|
|
const wb = XLSX.utils.book_new();
|
|
|
|
const ws = XLSX.utils.aoa_to_sheet(data);
|
|
|
|
const ws = XLSX.utils.aoa_to_sheet(data);
|
|
|
|
XLSX.utils.book_append_sheet(wb, ws, sheetName);
|
|
|
|
XLSX.utils.book_append_sheet(wb, ws, sheetName);
|
|
|
|
@ -185,6 +194,11 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
imports() {
|
|
|
|
imports() {
|
|
|
|
|
|
|
|
if(this.tableName=='users'){
|
|
|
|
|
|
|
|
this.tableList.map(item=>{
|
|
|
|
|
|
|
|
item.username = item.name
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
request({
|
|
|
|
request({
|
|
|
|
method: "post",
|
|
|
|
method: "post",
|
|
|
|
url: this.import_action,
|
|
|
|
url: this.import_action,
|
|
|
|
@ -219,13 +233,13 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
dialogVisible(newval) {
|
|
|
|
dialogVisible(newval) {
|
|
|
|
console.log("newval", newval, this.tableName,this.formInfo)
|
|
|
|
console.log("newval", newval, this.tableName, this.formInfo)
|
|
|
|
if (newval) {
|
|
|
|
if (newval) {
|
|
|
|
let changeTableName = this.tableName.replace('_', '-')
|
|
|
|
let changeTableName = this.tableName.replace('_', '-')
|
|
|
|
this.action = `${process.env.VUE_APP_BASE_API}/api/admin/${changeTableName}/excel-show`
|
|
|
|
this.action = `${process.env.VUE_APP_BASE_API}/api/admin/${changeTableName}/excel-show`
|
|
|
|
this.import_action = `/api/admin/${changeTableName}/import`
|
|
|
|
this.import_action = `/api/admin/${changeTableName}/import`
|
|
|
|
// 学员导入
|
|
|
|
// 学员导入
|
|
|
|
if(this.tableName==='users'){
|
|
|
|
if (this.tableName === 'users') {
|
|
|
|
this.import_action = `/api/admin/${changeTableName}/import-study`
|
|
|
|
this.import_action = `/api/admin/${changeTableName}/import-study`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|