style: 格式化代码

This commit is contained in:
zyn
2023-12-20 11:00:26 +08:00
parent 0a0f737ad3
commit b489f34a2d
@@ -5,74 +5,61 @@
<div class="tree"> <div class="tree">
<!-- @keyup.enter.native="searchPeople"--> <!-- @keyup.enter.native="searchPeople"-->
<el-input <el-input
v-model="filterText"
class="filter-tree-input" class="filter-tree-input"
placeholder="输入关键字进行过滤" placeholder="输入关键字进行过滤"
v-model="filterText"> />
</el-input>
<!-- <el-tree-->
<!-- node-key="id"-->
<!-- :data="treeData"-->
<!-- :props="defaultProps"-->
<!-- :default-checked-keys="nodeList"-->
<!-- :current-node-key="nodeKeyId"-->
<!-- highlight-current-->
<!-- check-strictly-->
<!-- :expand-on-click-node="false"-->
<!-- ref="tree"-->
<!-- :load="loadNode"-->
<!-- @node-click="handleNodeClick"-->
<!-- lazy>-->
<!-- </el-tree>-->
<el-tree <el-tree
ref="tree"
:data="treeData" :data="treeData"
:props="defaultProps" :props="defaultProps"
:current-node-key="nodeKeyId" :current-node-key="nodeKeyId"
node-key="id" node-key="id"
:filter-node-method="filterNode" :filter-node-method="filterNode"
highlight-current highlight-current
ref="tree"
:expand-on-click-node="false" :expand-on-click-node="false"
@node-click="handleNodeClick"> @node-click="handleNodeClick"
</el-tree> />
</div> </div>
<div class="tree-collapse" @click="treeCollapse" :class="{ 'tree-close': sideClose }"> <div class="tree-collapse" :class="{ 'tree-close': sideClose }" @click="treeCollapse">
<!--切换折叠样式--> <!--切换折叠样式-->
<i class="el-icon-arrow-left" v-if="sideClose === false"></i> <i v-if="sideClose === false" class="el-icon-arrow-left" />
<i class="el-icon-arrow-right" v-if="sideClose === true"></i> <i v-if="sideClose === true" class="el-icon-arrow-right" />
</div> </div>
</div> </div>
<div class="tree-right"> <div class="tree-right">
<div class="content"> <div class="content">
<!--搜索区域--> <!--搜索区域-->
<div class="search-area"> <div class="search-area">
<el-form inline class="label-input-form" v-model="searchForm"> <el-form v-model="searchForm" inline class="label-input-form">
<el-form-item label="姓名" class="search-item"> <el-form-item label="姓名" class="search-item">
<el-input placeholder="根据姓名查询" clearable v-model="searchForm.uname"> <el-input v-model="searchForm.uname" placeholder="根据姓名查询" clearable />
</el-input>
</el-form-item> </el-form-item>
<el-form-item label="邮箱" class="search-item"> <el-form-item label="邮箱" class="search-item">
<el-input placeholder="根据邮箱查询" clearable v-model="searchForm.email"> <el-input v-model="searchForm.email" placeholder="根据邮箱查询" clearable />
</el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" size="mini" <el-button
class="common-button-primary" @click="getDatas('1')" v-btn-permission="'d285ee99b52abcd63d863f6783e350f0'"> v-btn-permission="'d285ee99b52abcd63d863f6783e350f0'"
type="primary"
size="mini"
class="common-button-primary"
@click="getDatas('1')"
>
查询 查询
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="mini" class="common-button-default" @click="clearAllSearch" v-btn-permission="'12a6b1f548cef7b152746c978fc32dbb'"> <el-button v-btn-permission="'12a6b1f548cef7b152746c978fc32dbb'" size="mini" class="common-button-default" @click="clearAllSearch">
清空 清空
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="mini" type="primary" @click="selectEdit" v-btn-permission="'786a941b255a4fe4d13b7e67f100a4e5'"> <el-button v-btn-permission="'786a941b255a4fe4d13b7e67f100a4e5'" size="mini" type="primary" @click="selectEdit">
批量配置角色 批量配置角色
</el-button> </el-button>
<el-button size="mini" type="primary" @click="selectEditOfOrg" v-btn-permission="'786a941b255a4fe4d13b7e67f100a4e5'"> <el-button v-btn-permission="'786a941b255a4fe4d13b7e67f100a4e5'" size="mini" type="primary" @click="selectEditOfOrg">
根据部门批量配置角色 根据部门批量配置角色
</el-button> </el-button>
</el-form-item> </el-form-item>
@@ -86,19 +73,21 @@
style="width: 100%; flex: auto;" style="width: 100%; flex: auto;"
class="drag-table" class="drag-table"
height="100%" height="100%"
@selection-change="selectedData"
:header-cell-style="{background: '#E8E8E8', color: '#333333', fontSize: '16px', :header-cell-style="{background: '#E8E8E8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}"> fontWeight: 'bold', height: '48px'}"
@selection-change="selectedData"
>
<el-table-column <el-table-column
type="selection" type="selection"
width="55" width="55"
align="center" align="center"
/> />
<el-table-column <el-table-column
type="index" type="index"
width="55" width="55"
label="序号" label="序号"
align="center"> align="center"
>
<template slot-scope="{scope, column, $index}"> <template slot-scope="{scope, column, $index}">
{{ ($index + 1) + (page - 1) * pageSize }} {{ ($index + 1) + (page - 1) * pageSize }}
</template> </template>
@@ -106,17 +95,18 @@
<el-table-column <el-table-column
prop="account" prop="account"
label="账号" label="账号"
width="100px"> width="100px"
</el-table-column> />
<el-table-column <el-table-column
prop="uname" prop="uname"
label="姓名" label="姓名"
width="100px"> width="100px"
</el-table-column> />
<el-table-column <el-table-column
prop="sex" prop="sex"
label="性别" label="性别"
width="50px"> width="50px"
>
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.sex === '1'"></div> <div v-if="scope.row.sex === '1'"></div>
<div v-if="scope.row.sex === '2'"></div> <div v-if="scope.row.sex === '2'"></div>
@@ -125,16 +115,17 @@
<el-table-column <el-table-column
prop="phone" prop="phone"
label="电话" label="电话"
width="170px"> width="170px"
</el-table-column> />
<el-table-column <el-table-column
prop="email" prop="email"
label="邮箱" label="邮箱"
width="170px"> width="170px"
</el-table-column> />
<el-table-column <el-table-column
prop="institutionName" prop="institutionName"
label="所属部门"> label="所属部门"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover trigger="hover" placement="top"> <el-popover trigger="hover" placement="top">
{{ scope.row.institutionName }} {{ scope.row.institutionName }}
@@ -148,31 +139,32 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="roles" prop="roles"
label="角色" label="角色"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{getRoleName(scope.row.roles)}} {{ getRoleName(scope.row.roles) }}
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- prop="NameList"--> <!-- prop="NameList"-->
<!-- label="所属岗位">--> <!-- label="所属岗位">-->
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->
<!-- <el-popover trigger="hover" placement="top">--> <!-- <el-popover trigger="hover" placement="top">-->
<!-- {{ scope.row.NameList }}--> <!-- {{ scope.row.NameList }}-->
<!-- <div slot="reference" class="name-wrapper">--> <!-- <div slot="reference" class="name-wrapper">-->
<!-- <p v-if="!scope.row.institutionName ||scope.row.NameList.length<15">--> <!-- <p v-if="!scope.row.institutionName ||scope.row.NameList.length<15">-->
<!-- {{ scope.row.NameList }}--> <!-- {{ scope.row.NameList }}-->
<!-- </p>--> <!-- </p>-->
<!-- <p v-else> {{ scope.row.NameList.substring(0, 15) }}...</p>--> <!-- <p v-else> {{ scope.row.NameList.substring(0, 15) }}...</p>-->
<!-- </div>--> <!-- </div>-->
<!-- </el-popover>--> <!-- </el-popover>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<el-table-column <el-table-column
label="状态" label="状态"
width="100px"> width="100px"
>
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.disableFlag === '1'">已禁用</div> <div v-if="scope.row.disableFlag === '1'">已禁用</div>
<div v-else>已启用</div> <div v-else>已启用</div>
@@ -180,16 +172,17 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="操作" label="操作"
width="50px"> width="50px"
>
<template slot-scope="scope"> <template slot-scope="scope">
<div @click.stop style="display: inline-block"> <div style="display: inline-block" @click.stop>
<el-dropdown trigger="click" @command="handleCommand"> <el-dropdown trigger="click" @command="handleCommand">
<i class="iconfont">&#xe61e;</i> <i class="iconfont">&#xe61e;</i>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-btn-permission="'30db3b395deb5004266cd65d302c2776'" v-if="scope.row.disableFlag === '1'" :command="[scope.row, '启用']" > <el-dropdown-item v-if="scope.row.disableFlag === '1'" v-btn-permission="'30db3b395deb5004266cd65d302c2776'" :command="[scope.row, '启用']">
启用 启用
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-btn-permission="'30db3b395deb5004266cd65d302c2776'" v-if="scope.row.disableFlag === '0'" :command="[scope.row, '禁用']"> <el-dropdown-item v-if="scope.row.disableFlag === '0'" v-btn-permission="'30db3b395deb5004266cd65d302c2776'" :command="[scope.row, '禁用']">
禁用 禁用
</el-dropdown-item> </el-dropdown-item>
@@ -204,7 +197,13 @@
</el-table> </el-table>
</div> </div>
<loading :loading="Loading">加载中...</loading> <loading :loading="Loading">加载中...</loading>
<pagination :page="page" :total="total" :pageSize="pageSize" @pageChange="pageChange" @pageSizeChange="pageSizeChange"></pagination> <pagination
:page="page"
:total="total"
:pageSize="pageSize"
@pageChange="pageChange"
@pageSizeChange="pageSizeChange"
/>
</div> </div>
<el-drawer <el-drawer
class="postPage" class="postPage"
@@ -215,29 +214,42 @@
@close="resetFormPost" @close="resetFormPost"
> >
<el-form ref="" :model="sarPost" inline> <el-form ref="" :model="sarPost" inline>
<el-form-item class="search-item" style="padding-left: 25px"> <el-form-item class="search-item" style="padding-left: 25px">
<el-input v-model="sarPost.name" <el-input
size="small" v-model="sarPost.name"
placeholder="角色名称查找" size="small"
clearable></el-input> placeholder="角色名称查找"
clearable
/>
</el-form-item> </el-form-item>
<el-form-item label="" class="search-item btn-box"> <el-form-item label="" class="search-item btn-box">
<el-button class="common-button-primary" type="primary" size="mini" @click="searchPostName" <el-button
v-btn-permission="''">查询 v-btn-permission="''"
class="common-button-primary"
type="primary"
size="mini"
@click="searchPostName"
>
查询
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item label="" class="search-item btn-box"> <el-form-item label="" class="search-item btn-box">
<el-button class="common-button-default" @click="resetSelect" size="mini" <el-button
v-btn-permission="">清空 v-btn-permission=""
class="common-button-default"
size="mini"
@click="resetSelect"
>
清空
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-tree <el-tree
v-if="modalPost"
ref="tree2" ref="tree2"
node-key="id" node-key="id"
class="filter-tree" class="filter-tree"
style="height: 100%; overflow: auto;" style="height: 100%; overflow: auto;"
v-if="modalPost"
:props="props" :props="props"
:data="postList" :data="postList"
:filter-node-method="filterNode" :filter-node-method="filterNode"
@@ -246,9 +258,16 @@
check-strictly check-strictly
default-expand-all default-expand-all
:expand-on-click-node="false" :expand-on-click-node="false"
show-checkbox> show-checkbox
</el-tree> />
<pagination :auto-size="true" :page="page1" :pageSize="pageSize1" :total="total2" @pageChange="pageChange2" @pageSizeChange="pageSizeChange2"></pagination> <pagination
:auto-size="true"
:page="page1"
:pageSize="pageSize1"
:total="total2"
@pageChange="pageChange2"
@pageSizeChange="pageSizeChange2"
/>
<div id="roleFormButton" class="demo-drawer-footer"> <div id="roleFormButton" class="demo-drawer-footer">
<el-button <el-button
size="mini" size="mini"
@@ -257,7 +276,8 @@
type="primary" type="primary"
:loading="butionLoading" :loading="butionLoading"
@click="PostSubmit" @click="PostSubmit"
>确定 >
确定
</el-button> </el-button>
<el-button size="mini" class="common-button-default" icon="el-icon-close" @click="resetFormPost">取消</el-button> <el-button size="mini" class="common-button-default" icon="el-icon-close" @click="resetFormPost">取消</el-button>
</div> </div>
@@ -268,15 +288,15 @@
<script> <script>
export default { export default {
name: 'mechanism', name: 'Mechanism',
data() { data () {
return { return {
formLoading: true, formLoading: true,
peopleType: '', //1为树结构 2 为全机构 peopleType: '', // 1为树结构 2 为全机构
nodeKeyId: '', nodeKeyId: '',
searchForm: { searchForm: {
uname: "", uname: '',
email: "" email: ''
}, },
userId: '', userId: '',
postList: [], postList: [],
@@ -287,7 +307,7 @@ export default {
nodeList: [], nodeList: [],
modalPost: false, modalPost: false,
sarPost: { sarPost: {
name: "", // 角色名称 name: '', // 角色名称
}, },
filterText: '', // 树结构检索条件 filterText: '', // 树结构检索条件
defaultProps: { defaultProps: {
@@ -299,8 +319,8 @@ export default {
total: 0, total: 0,
total2: 0, total2: 0,
pageSize: this.$store.getters.userInfo.configContent, pageSize: this.$store.getters.userInfo.configContent,
page1:1, page1: 1,
pageSize1:20, pageSize1: 20,
sideClose: false, sideClose: false,
data: [], // table数据 data: [], // table数据
treeLoading: false, treeLoading: false,
@@ -309,31 +329,42 @@ export default {
id: '', id: '',
// 批量配置角色勾选暂存 // 批量配置角色勾选暂存
manageData: [], manageData: [],
configOrgManage:false, configOrgManage: false,
drawerTitle: '配置角色' drawerTitle: '配置角色'
} }
}, },
computed: {},
watch: {
filterText (val) {
this.$refs.tree.filter(val);
},
},
mounted () {
// 获取组织结构树
this.getTree()
this.getTree2()
},
methods: { methods: {
getRoleName(roles){ getRoleName (roles) {
let names=roles.map(item=>{ const names = roles.map(item => {
return item.name return item.name
}) })
return names.join(',') return names.join(',')
}, },
clearAllSearch() { clearAllSearch () {
this.searchForm = { this.searchForm = {
uname: "", uname: '',
email: "" email: ''
} }
this.page = 1 this.page = 1
this.getData() this.getData()
}, },
resetFormPost() { resetFormPost () {
this.modalPost = false this.modalPost = false
this.postList = [] this.postList = []
this.page1 = 1 this.page1 = 1
}, },
PostSubmit() { PostSubmit () {
this.butionLoading = true this.butionLoading = true
if (this.drawerTitle === '配置角色') { if (this.drawerTitle === '配置角色') {
this.$http.postData('sarUser/user/role', { this.$http.postData('sarUser/user/role', {
@@ -347,8 +378,8 @@ export default {
this.getData() this.getData()
} }
}) })
} else if(this.configOrgManage){ } else if(this.configOrgManage) {
//批量配置角色信息 // 批量配置角色信息
this.$http.postData('sarUser/user/roleBatchByOrgId', { this.$http.postData('sarUser/user/roleBatchByOrgId', {
roleIds: this.$refs.tree2.getCheckedKeys(), roleIds: this.$refs.tree2.getCheckedKeys(),
orgId: this.id orgId: this.id
@@ -373,18 +404,17 @@ export default {
} }
}) })
} }
}, },
searchPostName() { searchPostName () {
this.page = 1; this.page = 1;
this.getTree2(); this.getTree2();
this.sarPost.name = ""; this.sarPost.name = '';
}, // 查询 }, // 查询
resetSelect() { resetSelect () {
this.sarPost.name = ""; this.sarPost.name = '';
this.getTree2(); this.getTree2();
}, // 外层清空条件查询 }, // 外层清空条件查询
handleCommand(command) { handleCommand (command) {
switch (command[1]) { switch (command[1]) {
case '启用': case '启用':
this.disableFlagEdit(command[0], 0) this.disableFlagEdit(command[0], 0)
@@ -398,7 +428,7 @@ export default {
} }
}, },
getTree2() { getTree2 () {
this.$http.get('sarRole/role/allPage', { this.$http.get('sarRole/role/allPage', {
current: this.page1, current: this.page1,
pageSize: this.pageSize1, pageSize: this.pageSize1,
@@ -410,10 +440,10 @@ export default {
this.total2 = res.data.total this.total2 = res.data.total
}) })
}, },
postsConfigure(row) { postsConfigure (row) {
this.configOrgManage = false this.configOrgManage = false
this.drawerTitle = '配置角色' this.drawerTitle = '配置角色'
var arr = [] const arr = []
this.userId = row.userId this.userId = row.userId
row.positions.forEach((item) => { row.positions.forEach((item) => {
arr.push(item.id) arr.push(item.id)
@@ -422,8 +452,8 @@ export default {
this.modalPost = true this.modalPost = true
this.getTree2() this.getTree2()
}, },
disableFlagEdit(row, type) { disableFlagEdit (row, type) {
let json = {} const json = {}
json.userId = row.userId json.userId = row.userId
json.disableFlag = type json.disableFlag = type
this.$http.postData('sarUser/user/disable', json, {}, this.$http.postData('sarUser/user/disable', json, {},
@@ -438,14 +468,14 @@ export default {
} }
}) })
}, },
treeCollapse() { treeCollapse () {
this.sideClose = !this.sideClose this.sideClose = !this.sideClose
}, },
filterNode(value, data) { filterNode (value, data) {
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; return data.name.indexOf(value) !== -1;
}, },
handleNodeClick(data) { handleNodeClick (data) {
this.id = data.id this.id = data.id
this.page = 1 this.page = 1
this.getData() this.getData()
@@ -485,7 +515,7 @@ export default {
// }, e => { // }, e => {
// }) // })
// }, // },
getTree() { getTree () {
this.$http.get('SarInstitution/institution', {}, { this.$http.get('SarInstitution/institution', {}, {
_this: this, _this: this,
loading: 'treeLoading' loading: 'treeLoading'
@@ -501,7 +531,7 @@ export default {
console.log(e); console.log(e);
}) })
}, },
getDatas(type) { getDatas (type) {
if (type === '1') { if (type === '1') {
this.page = 1 this.page = 1
} }
@@ -530,7 +560,7 @@ export default {
this.total = res.data.total this.total = res.data.total
}) })
}, },
getData() { getData () {
this.peopleType = 1; this.peopleType = 1;
this.$http.post('SarInstitution/institution/userUnderInstitution', { this.$http.post('SarInstitution/institution/userUnderInstitution', {
current: this.page, current: this.page,
@@ -556,42 +586,42 @@ export default {
this.total = res.data.total this.total = res.data.total
}) })
}, },
pageChange(page) { pageChange (page) {
this.page = page this.page = page
if(this.peopleType === 1){ if(this.peopleType === 1) {
this.getData() this.getData()
}else{ }else{
this.getDatas() this.getDatas()
} }
}, },
pageSizeChange(pageSize) { pageSizeChange (pageSize) {
this.pageSize = pageSize this.pageSize = pageSize
if(this.peopleType === 1){ if(this.peopleType === 1) {
this.getData() this.getData()
}else{ }else{
this.getDatas() this.getDatas()
} }
}, },
pageChange2(page1) { pageChange2 (page1) {
this.page1 = page1 this.page1 = page1
this.getTree2() this.getTree2()
}, },
pageSizeChange2(pageSize1) { pageSizeChange2 (pageSize1) {
this.pageSize1 = pageSize1 this.pageSize1 = pageSize1
this.getTree2() this.getTree2()
}, },
/** 批量编辑角色的勾选数据 */ /** 批量编辑角色的勾选数据 */
selectedData(val) { selectedData (val) {
this.manageData = val this.manageData = val
}, },
selectEdit() { selectEdit () {
this.configOrgManage = false this.configOrgManage = false
this.getTree2() this.getTree2()
if(this.manageData.length){ if(this.manageData.length) {
this.userId = [] this.userId = []
this.manageData.forEach(item=>{ this.manageData.forEach(item => {
this.userId.push(item.userId) this.userId.push(item.userId)
}) })
this.drawerTitle = '批量配置角色' this.drawerTitle = '批量配置角色'
@@ -600,24 +630,13 @@ export default {
this.$message.warning('请选择需要批量配置的角色') this.$message.warning('请选择需要批量配置的角色')
} }
}, },
selectEditOfOrg() { selectEditOfOrg () {
this.configOrgManage = true this.configOrgManage = true
this.getTree2() this.getTree2()
this.drawerTitle = '批量配置角色' this.drawerTitle = '批量配置角色'
this.modalPost = true this.modalPost = true
}, },
},
computed: {},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
mounted() {
// 获取组织结构树
this.getTree()
this.getTree2()
} }
} }
</script> </script>
@@ -728,5 +747,4 @@ export default {
} }
} }
</style> </style>