|
|
@ -81,7 +81,12 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="jsx"> |
|
|
|
import { addUserApi, userListApi, deleteUserApi } from '@/api/user' |
|
|
|
import { |
|
|
|
addUserApi, |
|
|
|
userListApi, |
|
|
|
deleteUserApi, |
|
|
|
updateUserInfoApi, |
|
|
|
} from '@/api/user' |
|
|
|
import moment from 'moment' |
|
|
|
const INITIAL_DATA = { |
|
|
|
username: '', |
|
|
@ -92,6 +97,7 @@ const INITIAL_DATA = { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
updateUserInfo: {}, |
|
|
|
operType: 1, |
|
|
|
formData: { ...INITIAL_DATA }, |
|
|
|
rules: { |
|
|
@ -189,7 +195,7 @@ export default { |
|
|
|
this.visible = true |
|
|
|
}, |
|
|
|
updateUser(row) { |
|
|
|
console.log(row) |
|
|
|
this.updateUserInfo = row |
|
|
|
this.formData = { |
|
|
|
username: row.username, |
|
|
|
role: row.role, |
|
|
@ -243,7 +249,22 @@ export default { |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 更新用户 |
|
|
|
console.log(123) |
|
|
|
const res = await updateUserInfoApi({ |
|
|
|
...this.updateUserInfo, |
|
|
|
...this.formData, |
|
|
|
}) |
|
|
|
if (res?.code == 200) { |
|
|
|
if (res?.data?.result) { |
|
|
|
this.formData = { ...INITIAL_DATA } |
|
|
|
this.visible = false |
|
|
|
this.$message.success('修改成功') |
|
|
|
this.getUserList() |
|
|
|
} else { |
|
|
|
this.$message.error(res.msg) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message.error(res.msg) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message.warning(firstError) |
|
|
|