fix:修改bug

This commit is contained in:
xiongchengqiang 2020-05-21 12:02:49 +08:00
parent 202566144f
commit 3e7112f27a
4 changed files with 48 additions and 23 deletions

View File

@ -65,7 +65,12 @@
></el-input>
</el-form-item>
<el-form-item v-if="dataForm.type !== 2" label="排序号" prop="orderNum">
<el-input-number v-model="dataForm.orderNum" controls-position="right" :min="0" label="排序号"></el-input-number>
<el-input-number
v-model.number="dataForm.orderNum"
controls-position="right"
:min="0"
label="排序号"
></el-input-number>
</el-form-item>
<el-form-item v-if="dataForm.type !== 2" label="菜单图标" prop="icon">

View File

@ -90,7 +90,7 @@ export default {
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
addOrUpdateVisible: true
}
},
components: {
@ -134,6 +134,7 @@ export default {
},
// /
handleAddOrUpdate (id) {
console.log('id: ', id)
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)

View File

@ -72,39 +72,39 @@ export default {
apiType: '' // api
}
},
mounted () {
console.log('Xcq')
},
methods: {
init (id) {
this.handleGetSysMenuList()
async init (id) {
this.dataForm = {}
await this.handleGetSysMenuList()
if (id) {
this.dataForm.id = id || 0
this.handleEdit()
this.apiType = '/update'
} else {
this.dataForm = {
id: 0,
roleName: '',
remark: ''
}
console.log('this.dataForm : ', this.dataForm)
this.apiType = '/save'
}
},
//
handleGetSysMenuList () {
apiSysMenuList({}).then(res => {
this.menuList = treeDataTranslate(res, 'menuId')
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.$refs.menuListTree.setCheckedKeys([])
})
async handleGetSysMenuList () {
let res = await apiSysMenuList({})
this.menuList = treeDataTranslate(res, 'menuId')
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.$refs.menuListTree.setCheckedKeys([])
})
},
//
handleEdit () {
apiSysRoleInfo({}, `/${this.dataForm.id}`).then(res => {
if (res && res.code === 0) {
this.dataForm.roleName = res.role.roleName
this.dataForm.remark = res.role.remark
this.dataForm = Object.assign({}, this.dataForm, res.role, { xcq: 1 })
console.log('res.role: ', res.role)
console.log('this.dataForm: ', this.dataForm)
var idx = res.role.menuIdList.indexOf(this.tempKey)
if (idx !== -1) {
res.role.menuIdList.splice(idx, res.role.menuIdList.length - idx)
@ -112,7 +112,6 @@ export default {
this.dataDemo = res.role.menuIdList
setTimeout(() => {
this.$nextTick(() => {
console.log(' this.dataForm: ', this.dataForm)
this.$refs.menuListTree.setCheckedKeys(res.role.menuIdList)
})
}, 50)

View File

@ -12,12 +12,32 @@
label-width="80px"
>
<el-form-item label="员工姓名" prop="username">
<el-input v-model="dataForm.username" placeholder="登录帐号"></el-input>
<el-input
v-model="dataForm.username"
placeholder="登录帐号"
clearable
maxlength="20"
show-word-limit
></el-input>
</el-form-item>
<el-form-item label="密码" prop="password" :class="{ 'is-required': !dataForm.id }">
<el-form-item
label="密码"
clearable
maxlength="20"
show-word-limit
prop="password"
:class="{ 'is-required': !dataForm.id }"
>
<el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
</el-form-item>
<el-form-item label="确认密码" prop="comfirmPassword" :class="{ 'is-required': !dataForm.id }">
<el-form-item
label="确认密码"
clearable
maxlength="20"
show-word-limit
prop="comfirmPassword"
:class="{ 'is-required': !dataForm.id }"
>
<el-input v-model="dataForm.comfirmPassword" type="password" placeholder="确认密码"></el-input>
</el-form-item>
<el-form-item label="邮箱" prop="email">