【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
+129 -129
View File
@@ -80,149 +80,149 @@
</template>
<script>
import PermissionModal from './modules/PermissionModal'
import { getSystemMenuList, getSystemSubmenu, getSystemSubmenuBatch } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import PermissionDataRuleList from './PermissionDataRuleList'
import JEllipsis from '@/components/jero/JEllipsis'
import PermissionModal from './modules/PermissionModal'
import { getSystemMenuList, getSystemSubmenu, getSystemSubmenuBatch } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import PermissionDataRuleList from './PermissionDataRuleList'
import JEllipsis from '@/components/jero/JEllipsis'
const columns = [
{
title: '菜单名称',
dataIndex: 'name',
key: 'name'
}, {
title: '菜单类型',
dataIndex: 'menuType',
key: 'menuType',
customRender: function(text) {
if (text == 0) {
return '菜单'
} else if (text == 1) {
return '菜单'
} else if (text == 2) {
return '按钮/权限'
} else {
return text
}
const columns = [
{
title: '菜单名称',
dataIndex: 'name',
key: 'name'
}, {
title: '菜单类型',
dataIndex: 'menuType',
key: 'menuType',
customRender: function (text) {
if (text == 0) {
return '菜单'
} else if (text == 1) {
return '菜单'
} else if (text == 2) {
return '按钮/权限'
} else {
return text
}
},/*{
}
}, /* {
title: '权限编码',
dataIndex: 'perms',
key: 'permissionCode',
},*/{
title: 'icon',
dataIndex: 'icon',
key: 'icon'
},
{
title: '组件',
dataIndex: 'component',
key: 'component',
scopedSlots: { customRender: 'component' }
},
{
title: '路径',
dataIndex: 'url',
key: 'url',
scopedSlots: { customRender: 'url' }
},
{
title: '排序',
dataIndex: 'sortNo',
key: 'sortNo'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 150
}
]
}, */{
title: 'icon',
dataIndex: 'icon',
key: 'icon'
},
{
title: '组件',
dataIndex: 'component',
key: 'component',
scopedSlots: { customRender: 'component' }
},
{
title: '路径',
dataIndex: 'url',
key: 'url',
scopedSlots: { customRender: 'url' }
},
{
title: '排序',
dataIndex: 'sortNo',
key: 'sortNo'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 150
}
]
export default {
name: 'PermissionListAsync',
mixins: [JeroListMixin],
components: {
PermissionDataRuleList,
PermissionModal,
JEllipsis
},
data() {
return {
description: '这是菜单管理页面',
// 表头
columns: columns,
loading: false,
// 展开的行,受控属性
expandedRowKeys: [],
url: {
list: '/sys/permission/page',
delete: '/sys/permission/delete',
deleteBatch: '/sys/permission/deleteBatch'
export default {
name: 'PermissionListAsync',
mixins: [JeroListMixin],
components: {
PermissionDataRuleList,
PermissionModal,
JEllipsis
},
data () {
return {
description: '这是菜单管理页面',
// 表头
columns: columns,
loading: false,
// 展开的行,受控属性
expandedRowKeys: [],
url: {
list: '/sys/permission/page',
delete: '/sys/permission/delete',
deleteBatch: '/sys/permission/deleteBatch'
}
}
},
methods: {
loadData () {
this.loading = true
getSystemMenuList().then((res) => {
if (res.success) {
this.dataSource = res.result
return this.loadDataByExpandedRows(this.dataSource)
}
}).finally(() => {
this.loading = false
})
},
expandSubmenu (expanded, record) {
if (expanded && (!record.children || record.children.length === 0)) {
getSystemSubmenu({ parentId: record.id }).then((res) => {
if (res.success) {
record.children = res.result
}
})
}
},
methods: {
loadData() {
this.loading = true
getSystemMenuList().then((res) => {
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
loadDataByExpandedRows (dataList) {
if (this.expandedRowKeys.length > 0) {
return getSystemSubmenuBatch({ parentIds: this.expandedRowKeys.join(',') }).then((res) => {
if (res.success) {
this.dataSource = res.result
return this.loadDataByExpandedRows(this.dataSource)
}
}).finally(()=>{
this.loading = false
})
},
expandSubmenu(expanded, record){
if (expanded && (!record.children || record.children.length === 0)) {
getSystemSubmenu({parentId:record.id}).then((res) => {
if (res.success) {
record.children = res.result
}
})
}
},
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
loadDataByExpandedRows(dataList) {
if (this.expandedRowKeys.length > 0) {
return getSystemSubmenuBatch({ parentIds: this.expandedRowKeys.join(',') }).then((res) => {
if (res.success) {
let childrenMap = res.result
let fn = (list) => {
if(list&&list.length>0){
list.forEach(data => {
if (this.expandedRowKeys.includes(data.id)) {
data.children = childrenMap[data.id]
fn(data.children)
}
})
}
const childrenMap = res.result
const fn = (list) => {
if (list && list.length > 0) {
list.forEach(data => {
if (this.expandedRowKeys.includes(data.id)) {
data.children = childrenMap[data.id]
fn(data.children)
}
})
}
fn(dataList)
}
})
} else {
return Promise.resolve()
}
},
// 打开数据规则编辑
handleDataRule(record) {
this.$refs.PermissionDataRuleList.edit(record)
},
handleAddSub(record) {
this.$refs.modalForm.title = "添加子菜单";
this.$refs.modalForm.disableSubmit = false;
this.$refs.modalForm.edit({status:'1',permsType:'1',route:true,'parentId':record.id,menuType:1});
},
handleExpandedRowsChange(expandedRows) {
this.expandedRowKeys = expandedRows
},
fn(dataList)
}
})
} else {
return Promise.resolve()
}
},
// 打开数据规则编辑
handleDataRule (record) {
this.$refs.PermissionDataRuleList.edit(record)
},
handleAddSub (record) {
this.$refs.modalForm.title = '添加子菜单'
this.$refs.modalForm.disableSubmit = false
this.$refs.modalForm.edit({ status: '1', permsType: '1', route: true, parentId: record.id, menuType: 1 })
},
handleExpandedRowsChange (expandedRows) {
this.expandedRowKeys = expandedRows
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
</style>