remove warning of admin editor
This commit is contained in:
parent
ab8019b40a
commit
6e8065ea06
@ -22,7 +22,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="search">查询</el-button>
|
<el-button type="primary" @click="search">查询</el-button>
|
||||||
<el-button @click="resetForm('filterForm')">重置</el-button>
|
<el-button @click="resetFilterForm">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-button
|
<el-button
|
||||||
@ -256,10 +256,17 @@ export default class extends Vue {
|
|||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'title'
|
label: 'title'
|
||||||
}
|
}
|
||||||
|
|
||||||
private filterForm = {
|
private filterForm = {
|
||||||
key: '',
|
key: '',
|
||||||
role: ''
|
role: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$refs!: {
|
||||||
|
modalForm: HTMLFormElement
|
||||||
|
filterForm: HTMLFormElement
|
||||||
|
}
|
||||||
|
|
||||||
private modalRules = {
|
private modalRules = {
|
||||||
username: [{ required: true, message: '请输入用户名', trigger: 'blur' },
|
username: [{ required: true, message: '请输入用户名', trigger: 'blur' },
|
||||||
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' },
|
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' },
|
||||||
@ -293,7 +300,7 @@ export default class extends Vue {
|
|||||||
let result = [...this.adminList]
|
let result = [...this.adminList]
|
||||||
if (this.filterForm.key) {
|
if (this.filterForm.key) {
|
||||||
result = result.filter(user => {
|
result = result.filter(user => {
|
||||||
let reg = new RegExp(this.filterForm.key)
|
const reg = new RegExp(this.filterForm.key)
|
||||||
return (reg.test(user.showname)) || (reg.test(user.username))
|
return (reg.test(user.showname)) || (reg.test(user.username))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -306,9 +313,8 @@ export default class extends Vue {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private resetForm(formName: string) {
|
private resetFilterForm() {
|
||||||
const ref: any = this.$refs[formName]
|
this.$refs.filterForm.resetFields()
|
||||||
ref.resetFields()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pagination
|
// pagination
|
||||||
@ -345,7 +351,7 @@ export default class extends Vue {
|
|||||||
this.roleList = data
|
this.roleList = data
|
||||||
}
|
}
|
||||||
|
|
||||||
private formSex(row: number, column: number, cellValue: string, index: number) {
|
private formSex(row: number, column: number, cellValue: string) {
|
||||||
switch (cellValue) {
|
switch (cellValue) {
|
||||||
case '0':
|
case '0':
|
||||||
return '未指定'
|
return '未指定'
|
||||||
@ -355,11 +361,11 @@ export default class extends Vue {
|
|||||||
return '女'
|
return '女'
|
||||||
default:
|
default:
|
||||||
return '未指定'
|
return '未指定'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
private formatRole(val: string) {
|
||||||
}
|
const data = this.roleList.find(o => {
|
||||||
formatRole(val: string) {
|
|
||||||
let data = this.roleList.find(o => {
|
|
||||||
return o.key === val
|
return o.key === val
|
||||||
})
|
})
|
||||||
return data?.name || ''
|
return data?.name || ''
|
||||||
@ -398,16 +404,15 @@ export default class extends Vue {
|
|||||||
console.log(err)
|
console.log(err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private closeModal() {
|
private closeModal() {
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
let modalForm: any = this.$refs['modalForm']
|
this.$refs.modalForm.clearValidate()
|
||||||
modalForm.clearValidate()
|
|
||||||
}
|
}
|
||||||
// TODO: 验证数据完整性
|
|
||||||
private async confirmRole() {
|
private async confirmRole() {
|
||||||
const isEdit = this.dialogType === 'edit'
|
const isEdit = this.dialogType === 'edit'
|
||||||
const modalForm: any = this.$refs['modalForm']
|
this.$refs.modalForm.validate(async(valid: boolean) => {
|
||||||
modalForm.validate(async (valid: boolean) => {
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
this.$message.error('请按要求填写表单')
|
this.$message.error('请按要求填写表单')
|
||||||
return false
|
return false
|
||||||
@ -437,7 +442,6 @@ export default class extends Vue {
|
|||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user