[update] 修改UAT问题,内部工作组左侧选中二级节点可以新增删除领导,选中一级或二级可以tab切换查看领导数据

This commit is contained in:
lideqin
2024-08-23 11:44:52 +08:00
parent 60054e32bc
commit d90557b645
3 changed files with 233 additions and 23 deletions
+3 -1
View File
@@ -68,7 +68,9 @@ module.exports = {
adminAuthority: '管理权限',
workGroupName: '工作组名称',
user: '用户',
pleaseSelectASystem: '请选择左侧体系'
pleaseSelectASystem: '请选择左侧体系',
leader: '领导',
member: '成员'
},
// 企标级别映射
enterpriseLevelMap: {
@@ -83,6 +83,17 @@
</div>
</div>
<div class="page-right-box">
<!-- 选中1级或2级有领导和成员的tab切换 -->
<a-tabs v-if="['1', '2'].includes(currentNodeObj.level + '')" default-active-key="leader" v-model="activeTab" @change="tabChange">
<template v-for="tab in tabList">
<a-tab-pane :key="tab.key">
<template v-slot:tab>
<div>{{ tab.label }}</div>
</template>
</a-tab-pane>
</template>
</a-tabs>
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
@@ -97,7 +108,7 @@
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :span="8">
<a-col v-if="activeTab === 'member'" :span="8">
<a-form-item :label="$t('system.internalWorkGroup.role')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('system.internalWorkGroup.role')" v-model="queryParam.userRoleName"></a-input>
</a-form-item>
@@ -138,7 +149,7 @@
</a-button>
</a-upload>
<!-- 导出-->
<a-button icon="upload" type="primary" ghost @click="handleExportXls($t('system.internalWorkGroup.exportName'))"
<a-button v-if="activeTab === 'member'" icon="upload" type="primary" ghost @click="handleExportXls($t('system.internalWorkGroup.exportName'))"
v-has="'sys:innerWorkingGroup:export'">
{{ $t('export') }}
</a-button>
@@ -148,6 +159,12 @@
@click="downTemplate($t('system.internalWorkGroup.templateName'), '.xls')">
{{ $t('templateDownload') }}
</a-button>
<!-- 2级节点并且tab是领导时候的操作按钮 -->
<template v-if="currentNodeObj.level + '' === '2' && activeTab === 'leader'">
<a-button v-if="isHasPermission('sys:innerWorkingGroup:operate')" icon="plus" type="primary" @click="handleAdd('leader')">
{{ $t('newlyAdded') }}
</a-button>
</template>
</div>
<div>
<j-table
@@ -167,6 +184,11 @@
<a v-if="currentNodeObj.userId === currentUserId && currentNodeObj.level === 3 && isHasPermission('sys:innerWorkingGroup:operate')" @click="handleDelete(record.id)">{{ $t('delete') }}</a>
</template>
<!-- 领导的操作列 -->
<template v-slot:leaderAction="{text, record}">
<a v-if="isHasPermission('sys:innerWorkingGroup:operate')" @click="handleDelete(record.id, 'leader')">{{ $t('delete') }}</a>
</template>
</j-table>
</div>
</div>
@@ -184,7 +206,7 @@
import JTable from '@/components/jero/JTable'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import TreeNodeModal from './modules/TreeNodeModal'
import { postAction, downFile } from '@/api/manage'
import { postAction, downFile, getAction } from '@/api/manage'
import WorkingGroupModal from './modules/WorkingGroupModal'
import { getWorkGroupTreeList } from '@/api/api'
import TreeNodeWorkGroupModal from './modules/TreeNodeWorkGroupModal'
@@ -196,6 +218,30 @@ export default {
name: 'WorkingGroupList',
components: { TreeNodeWorkGroupModal, WorkingGroupModal, TreeNodeModal, JTable },
mixins: [JeroListMixin],
computed: {
yScrollHeight () {
/**
* 前几个使用变量是为了配合iframe嵌套,算出页面显示范围的高度
* 48px:分页器的高度
* 48pxa-card的padding(上24+下24
* 54px:表头行的高度
*/
return `calc(100vh - ${this.defaultHeight['user-info-height']} - ${this.defaultHeight['breadcrumb-height']} - ${this.defaultHeight.oneLineSearchHeight} - ${this.defaultHeight.oneLineOperationHeight} - 48px - 48px - 54px - ${this.isBackTitle ? '56px' : '0px'} - ${['1', '2'].includes(this.currentNodeObj.level + '') ? '64px' : '0px'})`
}
},
watch: {
activeTab: {
immediate: true,
handler (val) {
if (['1', '2'].includes(this.currentNodeObj.level + '') && val === 'leader') {
// 是1,2级的领导
this.columns = this.leaderColumns
} else {
this.columns = this.memberColumns
}
}
}
},
data () {
return {
treeInput: null, // 树查询绑定值
@@ -241,6 +287,73 @@ export default {
width: 170
}
],
memberColumns: [
{
title: this.$t('system.internalWorkGroup.name'),
align: 'center',
width: 180,
dataIndex: 'realname',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('system.internalWorkGroup.workNo'),
align: 'center',
width: 180,
dataIndex: 'username',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('system.internalWorkGroup.role'),
align: 'center',
width: 180,
dataIndex: 'userRoleName',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('system.internalWorkGroup.post'),
align: 'center',
width: 180,
dataIndex: 'userPostName',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
fixed: 'right',
width: 170
}
],
leaderColumns: [
{ // 姓名
title: this.$t('system.internalWorkGroup.name'),
align: 'center',
width: 180,
dataIndex: 'realname',
scopedSlots: { customRender: 'text' }
},
{ // 工号
title: this.$t('system.internalWorkGroup.workNo'),
align: 'center',
width: 180,
dataIndex: 'username',
scopedSlots: { customRender: 'text' }
},
{ // 岗位
title: this.$t('system.internalWorkGroup.post'),
align: 'center',
width: 180,
dataIndex: 'userPostName',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'leaderAction' },
align: 'center',
fixed: 'right',
width: 170
}
],
labelCol: {
span: 4
},
@@ -258,7 +371,12 @@ export default {
treeWorkGroupDelete: '/sys/lawsWorkingGroup/deleteWorkGroup'
},
currentUserId: '',
currentNodeObj: {} // 当前左侧树节点对象
currentNodeObj: {}, // 当前左侧树节点对象
tabList: [
{ key: 'leader', label: this.$t('system.internalWorkGroup.leader') }, // 领导
{ key: 'member', label: this.$t('system.internalWorkGroup.member') } // 成员
],
activeTab: 'member' // tab默认成员
}
},
mounted () {
@@ -294,6 +412,42 @@ export default {
return item
})
},
loadData (arg) {
if (!this.url.list) {
this.$message.warning('请设置url.list属性!')
return
}
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
const params = this.getQueryParams()// 查询条件
if (['1', '2'].includes(this.currentNodeObj.level + '') && this.activeTab === 'leader') {
// 是1,2级的领导,加参数表示查领导
params.searchType = '1'
} else {
// 加参数表示查成员
params.searchType = '2'
}
console.log(params)
this.loading = true
getAction(this.url.list, params).then((res) => {
if (res.success) {
// update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
this.dataSource = res.result.records || res.result
if (res.result.total) {
this.ipagination.total = res.result.total
} else {
this.ipagination.total = 0
}
// update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 左侧树搜索框搜索
handleTreeSearch () {
this.treeData = []
@@ -376,41 +530,84 @@ export default {
this.initTreeData()
},
// 根据当前节点key设置当前节点对象
setCurrNodeObjByKey (treeData) {
for (const item of treeData) {
if (item.id === this.currentTreeNode[0]) {
this.currentNodeObj = item
break
}
if (item.subset && item.subset.length > 0) {
this.setCurrNodeObjByKey(item.subset)
}
}
},
// setCurrNodeObjByKey (treeData) {
// for (const item of treeData) {
// if (item.id === this.currentTreeNode[0]) {
// this.currentNodeObj = item
// break
// }
// if (item.subset && item.subset.length > 0) {
// this.setCurrNodeObjByKey(item.subset)
// }
// }
// },
// 左侧树点击选中
treeSelect (selectedKeys) {
console.log(selectedKeys)
treeSelect (selectedKeys, event) {
console.log('--------selectedKeys', selectedKeys)
console.log('--------event', event)
this.currentTreeNode = selectedKeys
// 设置当前左侧树节点对象,为了右侧表格操作判断权限
this.setCurrNodeObjByKey(this.treeData)
this.currentNodeObj = JSON.parse(JSON.stringify(event.node.dataRef))
// 如果是1,2级,activeTab设置为领导,否则是成员
if (['1', '2'].includes(this.currentNodeObj.level + '')) {
this.activeTab = 'leader'
} else {
this.activeTab = 'member'
}
// this.setCurrNodeObjByKey(this.treeData)
this.queryParam.workingGroupId = selectedKeys[0]
this.ipagination.current = 1
this.loadData()
},
// tab切换
tabChange () {
this.loadData(1)
},
// 右侧新增
handleAdd () {
handleAdd (type) {
console.log(this.currentTreeNode)
if (!this.currentTreeNode || this.currentTreeNode.length <= 0) {
this.$message.warning(this.$t('system.internalWorkGroup.pleaseSelectASystem'))
return
}
this.$refs.modalForm.add(this.currentTreeNode[0])
this.$refs.modalForm.add(this.currentTreeNode[0], type)
this.$refs.modalForm.title = this.$t('newlyAdded')
},
handleDelete: function (id, type) {
if (!this.url.delete) {
this.$message.warning('请设置url.delete属性!')
return
}
const that = this
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: function () {
const params = {}
params.id = id
if (type === 'leader') {
params.searchType = '1'
}
postAction(that.url.delete, params).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) {
that.ipagination.current -= 1
}
that.loadData()
} else {
that.$message.warning(res.message)
}
})
}
})
},
// 清空
searchReset () {
this.queryParam = {}
this.currentTreeNode = null
this.currentNodeObj = {}
this.initTreeData()
this.loadData(1)
},
@@ -496,4 +693,5 @@ export default {
/deep/ .ant-form-item-label{
min-width: 40px !important;
}
</style>
@@ -59,14 +59,21 @@ export default {
add: '/sys/lawsWorkingGroupUser/add'
},
nameStr: '',
treeNodeKey: '' // 传入的树节点key值
treeNodeKey: '', // 传入的树节点key值
searchType: '' // 1的时候表示领导的新增,没有值说明是成员,新增时需要传给后端
}
},
methods: {
add (treeNodeKey) {
add (treeNodeKey, type) {
this.visible = true
this.form.resetFields()
this.treeNodeKey = treeNodeKey
if (type === 'leader') {
// 是领导的新增
this.searchType = '1'
} else {
this.searchType = ''
}
},
userSelectNameChange (value) {
this.nameStr = value
@@ -85,6 +92,9 @@ export default {
this.confirmLoading = true
const param = Object.assign({}, values)
param.workingGroupId = this.treeNodeKey
if (this.searchType === '1') {
param.searchType = this.searchType
}
console.log(param)
let url = ''
url = this.url.add