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-input>
</el-form-item> </el-form-item>
<el-form-item v-if="dataForm.type !== 2" label="排序号" prop="orderNum"> <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>
<el-form-item v-if="dataForm.type !== 2" label="菜单图标" prop="icon"> <el-form-item v-if="dataForm.type !== 2" label="菜单图标" prop="icon">

View File

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

View File

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

View File

@ -12,12 +12,32 @@
label-width="80px" label-width="80px"
> >
<el-form-item label="员工姓名" prop="username"> <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>
<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-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
</el-form-item> </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-input v-model="dataForm.comfirmPassword" type="password" placeholder="确认密码"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="邮箱" prop="email"> <el-form-item label="邮箱" prop="email">