【modify】使用ESLint格式化代码

This commit is contained in:
zer0Black
2023-03-01 09:33:58 +08:00
parent 694855ae8b
commit 63369b8b87
400 changed files with 42942 additions and 43132 deletions
@@ -55,133 +55,133 @@
</template>
<script>
import {queryTreeListForRole,queryRolePermission,saveRolePermission} from '@/api/api'
import RoleDataruleModal from './RoleDataruleModal.vue'
import { queryTreeListForRole, queryRolePermission, saveRolePermission } from '@/api/api'
import RoleDataruleModal from './RoleDataruleModal.vue'
export default {
name: "RoleModal",
components:{
RoleDataruleModal
export default {
name: 'RoleModal',
components: {
RoleDataruleModal
},
data () {
return {
roleId: '',
treeData: [],
defaultCheckedKeys: [],
checkedKeys: [],
expandedKeysss: [],
allTreeKeys: [],
autoExpandParent: true,
checkStrictly: true,
title: '角色权限配置',
visible: false,
loading: false,
selectedKeys: []
}
},
methods: {
onTreeNodeSelect (id) {
if (id && id.length > 0) {
this.selectedKeys = id
}
this.$refs.datarule.show(this.selectedKeys[0], this.roleId)
},
data(){
return {
roleId:"",
treeData: [],
defaultCheckedKeys:[],
checkedKeys:[],
expandedKeysss:[],
allTreeKeys:[],
autoExpandParent: true,
checkStrictly: true,
title:"角色权限配置",
visible: false,
loading: false,
selectedKeys:[]
onCheck (o) {
if (this.checkStrictly) {
this.checkedKeys = o.checked
} else {
this.checkedKeys = o
}
},
methods: {
onTreeNodeSelect(id){
if(id && id.length>0){
this.selectedKeys = id
}
this.$refs.datarule.show(this.selectedKeys[0],this.roleId)
},
onCheck (o) {
if(this.checkStrictly){
this.checkedKeys = o.checked;
}else{
this.checkedKeys = o
}
},
show(roleId){
this.roleId=roleId
this.visible = true;
},
close () {
this.reset()
this.$emit('close');
this.visible = false;
},
onExpand(expandedKeys){
this.expandedKeysss = expandedKeys;
this.autoExpandParent = false
},
reset () {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
expandAll () {
this.expandedKeysss = this.allTreeKeys
},
closeAll () {
this.expandedKeysss = []
},
checkALL () {
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
//this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if(v==1){
this.checkStrictly = false
}else if(v==2){
this.checkStrictly = true
}
},
handleCancel () {
this.close()
},
handleSubmit(exit) {
let that = this;
let params = {
roleId:that.roleId,
permissionIds:that.checkedKeys.join(","),
lastpermissionIds:that.defaultCheckedKeys.join(","),
};
that.loading = true;
console.log("请求参数",params);
saveRolePermission(params).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loading = false;
if (exit) {
that.close()
}
}else {
that.$message.error(res.message);
that.loading = false;
if (exit) {
that.close()
}
show (roleId) {
this.roleId = roleId
this.visible = true
},
close () {
this.reset()
this.$emit('close')
this.visible = false
},
onExpand (expandedKeys) {
this.expandedKeysss = expandedKeys
this.autoExpandParent = false
},
reset () {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
expandAll () {
this.expandedKeysss = this.allTreeKeys
},
closeAll () {
this.expandedKeysss = []
},
checkALL () {
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
// this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if (v == 1) {
this.checkStrictly = false
} else if (v == 2) {
this.checkStrictly = true
}
},
handleCancel () {
this.close()
},
handleSubmit (exit) {
const that = this
const params = {
roleId: that.roleId,
permissionIds: that.checkedKeys.join(','),
lastpermissionIds: that.defaultCheckedKeys.join(',')
}
that.loading = true
console.log('请求参数:', params)
saveRolePermission(params).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loading = false
if (exit) {
that.close()
}
this.loadData();
})
},
loadData(){
queryTreeListForRole().then((res) => {
this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids
queryRolePermission({roleId:this.roleId}).then((res)=>{
this.checkedKeys = [...res.result];
this.defaultCheckedKeys = [...res.result];
this.expandedKeysss = this.allTreeKeys;
console.log(this.defaultCheckedKeys)
})
})
}
} else {
that.$message.error(res.message)
that.loading = false
if (exit) {
that.close()
}
}
this.loadData()
})
},
loadData () {
queryTreeListForRole().then((res) => {
this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids
queryRolePermission({ roleId: this.roleId }).then((res) => {
this.checkedKeys = [...res.result]
this.defaultCheckedKeys = [...res.result]
this.expandedKeysss = this.allTreeKeys
console.log(this.defaultCheckedKeys)
})
})
}
},
watch: {
visible () {
if (this.visible) {
this.loadData();
this.loadData()
}
}
}
}
}
</script>
<style lang="less" scoped>
@@ -197,4 +197,4 @@
border-radius: 0 0 2px 2px;
}
</style>
</style>