Browse Source

feat: [操作日志] 用户日志

lkf
memorylkf 2 months ago
parent
commit
da97ae8a1c
5 changed files with 96 additions and 16 deletions
  1. +3
    -1
      src/lang/en/system/role.js
  2. +3
    -1
      src/lang/zh/system/role.js
  3. +4
    -0
      src/views/system/menu/index.vue
  4. +45
    -5
      src/views/system/role/index.vue
  5. +41
    -9
      src/views/system/user/index.vue

+ 3
- 1
src/lang/en/system/role.js View File

@ -20,5 +20,7 @@ export default {
filterPlaceholder: 'Name Or Mobile',
unauthorized: 'Uauthorized',
authorized: 'Authorized'
authorized: 'Authorized',
fpjs: 'Role Change'
}

+ 3
- 1
src/lang/zh/system/role.js View File

@ -20,5 +20,7 @@ export default {
filterPlaceholder: '姓名/手机号',
unauthorized: '未授权',
authorized: '已授权'
authorized: '已授权',
fpjs: '分配角色'
}

+ 4
- 0
src/views/system/menu/index.vue View File

@ -435,6 +435,8 @@ export default {
},
/** 新增按钮操作 */
handleAdd(row) {
debugger
// this.saveSimpleLog({name:'',nameEn:'',jcmc:'',jcmcEn:'Add Menu'})
this.reset()
this.getTreeselect()
if (row != null && row.menuId) {
@ -455,6 +457,7 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
// this.saveSimpleLog({name:row.menuName,nameEn:row.menuName,jcmc:'',jcmcEn:'Edit Menu'})
this.reset()
this.getTreeselect()
getMenu(row.menuId).then(response => {
@ -485,6 +488,7 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
// this.saveSimpleLog({name:row.menuName,nameEn:row.menuName,jcmc:'',jcmcEn:'Remove Menu'})
this.$modal.confirm(this.$t('form.confirmDelete')).then(function() {
return delMenu(row.menuId)
}).then(() => {

+ 45
- 5
src/views/system/role/index.vue View File

@ -307,16 +307,20 @@
<el-button @click="transferDialog.visible = false">{{$t('form.cancel')}}</el-button>
</div>
</el-dialog>
<Sign ref="signRef" @callback="doChangRoleUser" />
</div>
</template>
<script>
import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect,allocatedUserList,authUserSetAll } from "@/api/system/role"
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"
import Sign from '@/views/business/study/comp/sign.vue'
export default {
name: "Role",
dicts: ['sys_normal_disable'],
components:{Sign},
data() {
return {
//
@ -407,7 +411,9 @@ export default {
list:[],
selected:[],
roleId:''
roleId:'',
oldIdList:[]
}
}
@ -593,6 +599,9 @@ export default {
/** 修改按钮操作 */
handleUpdate(row,readonly) {
this.readonly = readonly
if(readonly){
this.saveSimpleLog({name:row.roleName,nameEn:row.roleName,jcmc:'角色详情',jcmcEn:'Role Detail'})
}
this.reset()
const roleId = row.roleId || this.ids
const roleMenu = this.getRoleMenuTreeselect(roleId)
@ -642,19 +651,22 @@ export default {
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
this.$modal.loading()
if (this.form.roleId != undefined) {
this.form.menuIds = this.getMenuAllCheckedKeys()
updateRole(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
} else {
this.form.menuIds = this.getMenuAllCheckedKeys()
addRole(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
}
}
@ -699,6 +711,8 @@ export default {
this.transferDialog.selected = response.selected
this.transferDialog.list = list
this.transferDialog.roleId = row.roleId
this.transferDialog.oldIdList = _.cloneDeep(response.selected)
this.transferDialog.visible = true
}
)
@ -707,9 +721,35 @@ export default {
return item.label.indexOf(query) > -1;
},
changRoleUser(){
authUserSetAll({ roleId: this.transferDialog.roleId, userIdList: this.transferDialog.selected && this.transferDialog.selected.length>0 ? this.transferDialog.selected:[] }).then(res => {
let update = false
let userIdList = this.transferDialog.selected && this.transferDialog.selected.length>0 ? this.transferDialog.selected:[]
if(this.transferDialog.oldIdList.length!==userIdList.length){
update = true
}else{
for(let i=0;i<this.transferDialog.oldIdList.length;i++){
if(_.findIndex(userIdList,o=>{return o===this.transferDialog.oldIdList[i]})==-1){
update = true
break
}
}
}
if(update){
this.$refs.signRef.show(
this.$t('page.system.role.fpjs'),
this.$t('page.system.role.fpjs'),
)
}else{
this.transferDialog.visible = false
})
}
},
doChangRoleUser(sign){
this.$modal.loading()
authUserSetAll({ roleId: this.transferDialog.roleId, userIdList: this.transferDialog.selected && this.transferDialog.selected.length>0 ? this.transferDialog.selected:[] ,sign:sign}).then(res => {
this.$refs.signRef.cancel()
this.transferDialog.visible = false
}).finally(()=>{
this.$modal.closeLoading()
})
}
}
}

+ 41
- 9
src/views/system/user/index.vue View File

@ -114,7 +114,7 @@
<el-button
type="text"
@click="handleStatusChange(scope.row)"
@click="showRoleChange(scope.row)"
v-hasPermi="['system:user:edit']"
>{{$t('page.system.user.history')}}</el-button>
@ -259,6 +259,8 @@
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
<Sign ref="signRef" @callback="doUpdate" />
</div>
</template>
@ -269,11 +271,12 @@ import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
import { Splitpanes, Pane } from "splitpanes"
import "splitpanes/dist/splitpanes.css"
import Sign from '@/views/business/study/comp/sign.vue'
export default {
name: "User",
dicts: ['sys_normal_disable', 'sys_user_sex'],
components: { Treeselect, Splitpanes, Pane },
components: { Treeselect, Splitpanes, Pane,Sign },
data() {
return {
//
@ -389,7 +392,8 @@ export default {
// trigger: "blur"
// }
// ]
}
},
oldRoleIdList:[],
}
},
watch: {
@ -481,6 +485,7 @@ export default {
postIds: [],
roleIds: []
}
this.oldRoleIdList = []
this.resetForm("form")
},
/** 搜索按钮操作 */
@ -532,6 +537,7 @@ export default {
const userId = row.userId || this.ids
getUser(userId).then(response => {
this.form = response.data
this.oldRoleIdList = _.cloneDeep(response.roleIds)
this.postOptions = response.posts
this.roleOptions = response.roles
this.$set(this.form, "postIds", response.postIds)
@ -570,14 +576,27 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.userId != undefined) {
updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
let updateRole = false;
if(this.oldRoleIdList.length!==this.form.roleIds.length){
updateRole = true
}else{
for(let i=0;i<this.oldRoleIdList.length;i++){
if(_.findIndex(this.form.roleIds,o=>{return o==this.oldRoleIdList[i]})==-1){
updateRole = true
break
}
}
}
if(updateRole){
this.$refs.signRef.show(
this.$t('page.system.role.fpjs'),
this.$t('page.system.role.fpjs'),
)
}else{
this.doUpdate({})
}
} else {
addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
@ -585,6 +604,16 @@ export default {
}
})
},
doUpdate(sign){
this.$modal.loading()
updateUser({user:this.form,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
},
/** 删除按钮操作 */
handleDelete(row) {
const userIds = row.userId || this.ids
@ -637,6 +666,9 @@ export default {
return _.map(row.roles,'roleName').join(',')
}
return ''
},
showRoleChange(row){
this.saveSimpleLog({name:row.nickName,nameEn:row.nickName,jcmc:this.$t('page.system.user.history','zh_CN'),jcmcEn:this.$t('page.system.user.history','en_US')})
}
}
}

Loading…
Cancel
Save