sso登录

This commit is contained in:
qq787203167
2022-06-09 18:39:21 +08:00
parent 56563b7ab4
commit 5a5974c7c0
4 changed files with 221 additions and 2 deletions
+2 -1
View File
@@ -928,5 +928,6 @@ module.exports = {
and: 'and',
judge: 'Judge',
pleaseWaitWhileRunning: 'Please wait while running',
roleSwitching: 'Role switching'
roleSwitching: 'Role switching',
setCreator:'Set Creator',
}
+1
View File
@@ -934,4 +934,5 @@ module.exports = {
and: '并且',
pleaseWaitWhileRunning: '运行中请稍等',
roleSwitching:'角色切换',
setCreator:'设置创建人',
}
@@ -0,0 +1,198 @@
<template>
<div>
<a-drawer
:title="$t('setCreator')"
:maskClosable="false"
:width="600"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<a-spin :spinning="confirmLoading">
<a-input-search style="margin-bottom: 8px" v-model="searchModel"
@search="onSearch"
allowClear
:placeholder="$t('NodeQuickLookup')"/>
<div class="drawer-content">
<a-tree
v-if="visibleTree"
style="margin-bottom: 60px;height: 600px"
checkable
:autoExpandParent="false"
:tree-data="gData"
@select="onSelect"
@check="checkChange"
@expand="onExpand"
:defaultExpandedKeys="defaultExpandedKeys"
>
</a-tree>
</div>
</a-spin>
<div class="drawer-bootom-button">
<a-button @click="handleCancel" type="danger" style="margin-right: 16px">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="submitLoading">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
import eventBUs from '../../common/event'
export default {
name: 'index',
data() {
return {
gData: [],
searchModel: '',
autoExpandParent: true,
expandedKeys: [],
visible: false,
confirmLoading: false,
selectedKey: [],
tableKey: '',
userIds: [],
departId: '',
defaultExpandedKeys: [],
submitLoading: false,
visibleTree: false
}
},
mounted() {
},
methods: {
getPush(data) {
this.tableKey = data
this.searchModel = ''
this.visible = true
this.visibleTree = false
this.$nextTick(() => {
this.departId = ''
this.queryDepartUserTreeList()
})
},
onSelect(selectedKeys) {
this.selectedKey = selectedKeys
},
onExpand(selectedKeys, val) {
if (this.searchModel == '' || !this.searchModel) {
if (val.expanded) {
if (this.departId == val.node.value) {
} else {
this.departId = val.node.value
this.queryDepartUserTreeList()
}
}
}
},
handleCancel() {
this.visible = false
this.visibleTree = false
},
handleSubmit() {
let query = {
id: this.tableKey,
createBy: this.userIds.join(','),
}
this.submitLoading = true
this.confirmLoading = true
postAction('/dummy/dummyInventoryBaseEO/edit', query).then((res) => {
this.confirmLoading = false
this.submitLoading = false
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.userIds = []
this.visible = false
this.visibleTree = false
this.$emit('clearSelected')
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
},
onSearch(e) {
this.gData = []
this.departId = ''
this.visibleTree = false
if (e) {
this.getUserAndDepart()
} else {
this.queryDepartUserTreeList()
}
},
getUserAndDepart() {
getAction('sys/user/getUserAndDepart', { name: this.searchModel }).then((res) => {
this.gData = res || []
this.visibleTree = true
})
},
queryDepartUserTreeList() {
let gData = JSON.parse(JSON.stringify(this.gData))
if (gData && gData.length > 0) {
gData = JSON.stringify(gData)
} else {
gData = ''
}
this.confirmLoading = true
postAction('sys/user/queryDepartUserTreeList', {
departId: this.departId,
flag: '1',
json: gData
}).then((res) => {
this.confirmLoading = false
if (res.success) {
this.gData = res.result
this.defaultExpandedKeys = [this.departId]
this.visibleTree = true
} else {
this.gData = []
}
})
},
checkChange(e) {
this.userIds = e
}
}
}
</script>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.button-box {
margin-left: 10px;
height: 38px;
line-height: 38px;
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
z-index:100;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
.drawer-content {
height: calc(100% - 60px);
overflow: auto;
}
</style>
@@ -33,6 +33,10 @@
</a-form>
</div>
<div class="table-operator">
<div @click="setCreatorClick" class="operator-text" v-has="'dummyInventoryBase:add'">
<a-icon type="plus"/>
{{$t('setCreator')}}
</div>
<div @click="handleAdd" class="operator-text" v-has="'dummyInventoryBase:add'">
<a-icon type="plus"/>
{{$t('newlyAdded')}}
@@ -138,6 +142,7 @@
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div>
</a-drawer>
<setCreator ref="setCreatorRef" @clearSelected="clearSelected"/>
</a-card>
</template>
@@ -147,11 +152,13 @@
import Vue from 'vue'
import VueDraggableResizable from 'vue-draggable-resizable'
import tableDragResize from '@/mixins/tableDragResize'
import setCreator from '@/components/setCreator/index'
export default {
name: 'index',
components: {
VueDraggableResizable
VueDraggableResizable,
setCreator
},
mixins: [tableDragResize],
data() {
@@ -241,6 +248,18 @@
onSelectChange(value) {
this.selectedRowKeys = value
},
clearSelected() {
this.selectedRowKeys = []
this.getList()
},
setCreatorClick() {
if (this.selectedRowKeys.length > 0) {
let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
this.$refs.setCreatorRef.getPush(selectedRowKeys.join(','))
} else {
this.$message.warning(this.$t('PleaseSelectData'))
}
},
//添加
handleAdd() {
this.title = this.$t('newlyAdded')