diff --git a/src/common/lang/system/zh.js b/src/common/lang/system/zh.js
index 3376d3dc..aefde83f 100644
--- a/src/common/lang/system/zh.js
+++ b/src/common/lang/system/zh.js
@@ -68,7 +68,9 @@ module.exports = {
adminAuthority: '管理权限',
workGroupName: '工作组名称',
user: '用户',
- pleaseSelectASystem: '请选择左侧体系'
+ pleaseSelectASystem: '请选择左侧体系',
+ leader: '领导',
+ member: '成员'
},
// 企标级别映射
enterpriseLevelMap: {
diff --git a/src/views/system/internalWorkGroup/WorkingGroupList.vue b/src/views/system/internalWorkGroup/WorkingGroupList.vue
index 12a15742..64a796a4 100644
--- a/src/views/system/internalWorkGroup/WorkingGroupList.vue
+++ b/src/views/system/internalWorkGroup/WorkingGroupList.vue
@@ -83,6 +83,17 @@
+
+
+
+
+
+
+ {{ tab.label }}
+
+
+
+
@@ -97,7 +108,7 @@
-
+
@@ -138,7 +149,7 @@
-
{{ $t('export') }}
@@ -148,6 +159,12 @@
@click="downTemplate($t('system.internalWorkGroup.templateName'), '.xls')">
{{ $t('templateDownload') }}
+
+
+
+ {{ $t('newlyAdded') }}
+
+
@@ -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:分页器的高度
+ * 48px:a-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;
}
+
diff --git a/src/views/system/internalWorkGroup/modules/WorkingGroupModal.vue b/src/views/system/internalWorkGroup/modules/WorkingGroupModal.vue
index c9306517..dc686be0 100644
--- a/src/views/system/internalWorkGroup/modules/WorkingGroupModal.vue
+++ b/src/views/system/internalWorkGroup/modules/WorkingGroupModal.vue
@@ -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