重构代码, 移除warning

This commit is contained in:
zhl 2021-05-18 15:16:42 +08:00
parent 185feb5d72
commit bad0f18620

View File

@ -309,8 +309,8 @@ export default class extends Vue {
private tableData: IExamQuerstion[] = [] private tableData: IExamQuerstion[] = []
private loading = false private loading = false
private downloadLoading = false private downloadLoading = false
private filename = '' private filename : string | null= ''
private multipleSelection = [] private multipleSelection : IExamQuerstion[] = []
private deleteBtnName = '删除所有' private deleteBtnName = '删除所有'
private exportBtnName = '导出所有' private exportBtnName = '导出所有'
private dialogVisible = false private dialogVisible = false
@ -338,7 +338,6 @@ export default class extends Vue {
await this.getRemoteDeptList() await this.getRemoteDeptList()
} else if (UserModule.department) { } else if (UserModule.department) {
this.shop = UserModule.department this.shop = UserModule.department
} }
} }
@ -368,8 +367,12 @@ export default class extends Vue {
private defaultPuzzle() { private defaultPuzzle() {
return { return {
_id: '',
question: '', question: '',
a1: '' a1: '',
a2: '',
a3: '',
a4: ''
} }
} }
@ -389,7 +392,6 @@ export default class extends Vue {
} }
private handleEditQuestion(scope: any) { private handleEditQuestion(scope: any) {
const { $index, row } = scope
this.dialogType = 'edit' this.dialogType = 'edit'
this.dialogVisible = true this.dialogVisible = true
this.record = cloneDeep(scope.row) this.record = cloneDeep(scope.row)
@ -408,8 +410,8 @@ export default class extends Vue {
type: 'warning' type: 'warning'
}) })
if (this.multipleSelection.length > 0) { if (this.multipleSelection.length > 0) {
this.questions = this.questions.filter(o => this.multipleSelection.indexOf(o) === -1) this.questions = this.questions.filter(o => this.multipleSelection.indexOf(o) === -1);
this.$refs.question_table.clearSelection() (this.$refs.question_table as any).clearSelection()
} else { } else {
this.questions.length = 0 this.questions.length = 0
} }
@ -565,7 +567,7 @@ export default class extends Vue {
this.filename = parseTime(new Date(), '{y}{m}{d}{h}{i}{s}') this.filename = parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')
const data = formatJson(tHeader, list) const data = formatJson(tHeader, list)
console.log('begin generate excel') console.log('begin generate excel')
exportJson2Excel(tHeader, data, this.filename !== '' ? this.filename : undefined, undefined, undefined, true, 'xlsx') exportJson2Excel(tHeader, data, this.filename ? this.filename : undefined, undefined, undefined, true, 'xlsx')
this.downloadLoading = false this.downloadLoading = false
} }
@ -642,7 +644,8 @@ export default class extends Vue {
shop: this.shop shop: this.shop
}) })
this.listLoading = false this.listLoading = false
this.shopExamList = data.records.filter(o => o._id !== this.examid) const records: IExamData[] = data.records
this.shopExamList = records.filter(o => o._id !== this.examid)
} }
private clickChange(item: any) { private clickChange(item: any) {