<template>
|
<a-card :bordered="false">
|
<!-- 抽屉 -->
|
<a-drawer
|
title="人员列表"
|
:width="screenWidth"
|
@close="onClose"
|
:visible="visible"
|
>
|
<!-- 抽屉内容的border -->
|
<div
|
:style="{
|
padding:'10px',
|
border: '1px solid #e9e9e9',
|
background: '#fff',
|
}">
|
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" :form="form" @keyup.enter.native="searchQuery">
|
<!-- <a-row :gutter="10">
|
<a-col :md="8" :sm="12">
|
<a-form-item label="用户姓名">
|
<a-input style="width: 120px;" placeholder="请输入用户姓名" v-model="queryParam.username"></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :md="7" :sm="24">
|
<span style="float: left;" class="table-page-search-submitButtons">
|
<a-button type="primary" @click="searchQuery">搜索</a-button>
|
<a-button type="primary" @click="searchReset" style="margin-left: 8px">重置</a-button>
|
</span>
|
</a-col>
|
</a-row>-->
|
<a-row>
|
<a-col :md="2" :sm="24">
|
<a-button style="margin-bottom: 10px" type="primary" :loading="aLoading" @click="handleAdd">新增
|
</a-button>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
<div>
|
<a-table
|
ref="table"
|
rowKey="id"
|
size="middle"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
@change="handleTableChange"
|
:rowClassName="getRowClassname"
|
>
|
|
<span slot="action" slot-scope="text, record">
|
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
<a>删除</a>
|
</a-popconfirm>
|
</span>
|
|
</a-table>
|
</div>
|
</div>
|
</a-drawer>
|
|
<select-user-modal ref="selectUserModal" @selectOk="selectOK"></select-user-modal>
|
</a-card>
|
</template>
|
|
<script>
|
import pick from 'lodash.pick'
|
import {filterObj} from '@/utils/util';
|
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
|
import SelectUserModal from "@views/system/modules/SelectUserModal";
|
import {getAction, postAction} from "@api/manage";
|
|
export default {
|
name: "DepartTeamUserList",
|
mixins: [JeecgListMixin],
|
components: {SelectUserModal},
|
data() {
|
return {
|
columns: [
|
{
|
title: '小组',
|
align: "center",
|
dataIndex: 'dteamId_dictText',
|
},
|
{
|
title: '姓名',
|
align: "center",
|
dataIndex: 'userId_dictText',
|
},
|
{
|
title: '操作',
|
dataIndex: 'action',
|
align: "center",
|
scopedSlots: {customRender: 'action'},
|
}
|
],
|
queryParam: {},
|
title: "操作",
|
visible: false,
|
screenWidth: 800,
|
dteamId: null,
|
orgCode: null,
|
aLoading: false,
|
model: {},
|
|
labelCol: {
|
xs: {span: 5},
|
sm: {span: 5},
|
},
|
wrapperCol: {
|
xs: {span: 12},
|
sm: {span: 12},
|
},
|
form: this.$form.createForm(this),
|
url: {
|
list: "/sys/sysDepartTeam/teamUserList",
|
delete: "/sys/sysDepartTeam/deleteTeamUser",
|
add: "/sys/sysDepartTeam/addTeamUser",
|
},
|
}
|
},
|
created() {
|
// 当页面初始化时,根据屏幕大小来给抽屉设置宽度
|
this.resetScreenSize();
|
},
|
methods: {
|
|
getQueryParams() {
|
//update--begin--autor:wangshuai-----date:20191204------for:清空总条数 teambition JT-113------
|
this.ipagination.total = 0;
|
//update--end--autor:wangshuai-----date:20191204------for:清空总条数 teambition JT-113------
|
var param = Object.assign({}, this.queryParam);
|
param.field = this.getQueryField();
|
param.dteamId = this.dteamId
|
param.pageNo = this.ipagination.current;
|
param.pageSize = this.ipagination.pageSize;
|
if (this.superQueryParams) {
|
param['superQueryParams'] = encodeURI(this.superQueryParams)
|
param['superQueryMatchType'] = this.superQueryMatchType
|
}
|
return filterObj(param);
|
},
|
|
// 添加
|
handleAdd() {
|
this.$refs.selectUserModal.customShow(this.orgCode)
|
|
},
|
|
|
|
selectOK(data) {
|
let params = {}
|
params.dteamId = this.dteamId
|
const namesString = data.map(user => user.username).join(',');
|
params.userId = namesString
|
postAction(this.url.add, params).then((res) => {
|
if (res.success) {
|
this.loadData()
|
this.$message.success(res.message)
|
} else {
|
this.$message.warning(res.message)
|
}
|
})
|
},
|
showDrawer(record, orgCode) {
|
this.visible = true
|
this.dteamId = record.id
|
this.orgCode = orgCode
|
this.loadData()
|
},
|
onClose() {
|
this.visible = false
|
this.form.resetFields();
|
this.dataSource = [];
|
},
|
// 抽屉的宽度随着屏幕大小来改变
|
resetScreenSize() {
|
let screenWidth = document.body.clientWidth;
|
if (screenWidth < 600) {
|
this.screenWidth = screenWidth;
|
} else {
|
this.screenWidth = 600;
|
}
|
},
|
//update--begin--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
|
//增加样式方法返回值
|
getRowClassname(record) {
|
if (record.status == 0) {
|
return "data-rule-invalid"
|
}
|
}
|
//update--end--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
|
}
|
}
|
</script>
|
<style lang="less" scoped>
|
//update--begin--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
|
/deep/ .data-rule-invalid {
|
background: #f4f4f4;
|
color: #bababa;
|
}
|
|
//update--begin--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
|
</style>
|