<template>
|
<div>
|
<a-modal
|
centered
|
:title="title"
|
:width="1000"
|
:visible="visible"
|
@ok="handleOk"
|
@cancel="handleCancel"
|
cancelText="关闭">
|
|
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
|
<a-col :span="8">
|
<a-form-item label="项目名称">
|
<j-input placeholder="输入项目名称模糊查询" v-model="queryParam.xmmc"></j-input>
|
<a-input v-show='false' placeholder="是否已发放奖金 0-否 1-是" v-model="queryParam.bonus"></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-item label="项目编号">
|
<j-input placeholder="输入项目编号模糊查询" v-model="queryParam.xmbh"></j-input>
|
</a-form-item>
|
</a-col>
|
|
<a-col :span="8">
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
</span>
|
</a-col>
|
|
</a-row>
|
</a-form>
|
</div>
|
<!-- table区域-begin -->
|
<div>
|
<a-table
|
size="small"
|
bordered
|
rowKey="id"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
:scroll="{ y: 240 }"
|
:rowSelection="{selectedRowKeys: selectedRowKeys,onChange: onSelectChange}"
|
@change="handleTableChange">
|
|
<!-- 字符串超长截取省略号显示-->
|
<span slot="esContent" slot-scope="text">
|
<j-ellipsis :value="text" :length="20" />
|
</span>
|
|
<span slot="esContent6" slot-scope="text">
|
<j-ellipsis :value="text" :length="6" />
|
</span>
|
|
</a-table>
|
</div>
|
<!-- table区域-end -->
|
|
|
</a-modal>
|
</div>
|
</template>
|
|
<script>
|
import {filterObj} from '@/utils/util'
|
import {getAction} from '@/api/manage'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
|
export default {
|
name: "PaymentProjectModal",
|
components: {
|
JEllipsis
|
},
|
data() {
|
return {
|
title: "选择发放项目",
|
names: [],
|
visible: false,
|
placement: 'right',
|
description: '',
|
// 查询条件
|
queryParam: {
|
//只查询没有发放奖金的项目
|
bonus:0
|
},
|
// 表头
|
columns: [
|
{
|
title: '序号',
|
dataIndex: '',
|
key: 'rowIndex',
|
width: 50,
|
align: "center",
|
customRender: function (t, r, index) {
|
return parseInt(index) + 1;
|
}
|
},
|
{
|
title: '项目编号',
|
align: "center",
|
width: 100,
|
dataIndex: 'xmbh'
|
},
|
{
|
title: '项目名称',
|
align: "center",
|
width: 200,
|
dataIndex: 'xmmc',
|
scopedSlots: { customRender: 'esContent' }
|
},
|
{
|
title: '负责人',
|
align: "center",
|
width: 100,
|
dataIndex: 'xmfzr_dictText',
|
scopedSlots: { customRender: 'esContent' }
|
},
|
{
|
title: '项目状态',
|
align: "center",
|
width: 60,
|
dataIndex: 'xmzt_dictText',
|
},
|
|
],
|
|
//数据集
|
dataSource: [],
|
|
// 分页参数
|
ipagination: {
|
current: 1,
|
pageSize: 10,
|
pageSizeOptions: ['10', '20', '30'],
|
showTotal: (total, range) => {
|
return range[0] + "-" + range[1] + " 共" + total + "条"
|
},
|
showQuickJumper: true,
|
showSizeChanger: true,
|
total: 0
|
},
|
isorter: {
|
column: 'id',
|
order: 'desc',
|
},
|
loading: false,
|
selectedRowKeys: [],
|
selectedRows: [],
|
url: {
|
list: "/pro/project/list",
|
}
|
}
|
},
|
created() {
|
|
},
|
mounted() {
|
|
},
|
methods: {
|
show(){
|
this.visible = true ;
|
this.onClearSelected()
|
this.loadData(1);
|
},
|
searchQuery() {
|
this.loadData(1);
|
},
|
searchReset() {
|
this.queryParam = {
|
bonus: 0
|
};
|
this.loadData(1);
|
},
|
handleCancel() {
|
this.visible = false;
|
},
|
handleOk() {
|
if(this.selectedRowKeys.length != 1 ){
|
this.$message.error('请选择一个项目!')
|
return
|
}
|
this.$emit("ok", this.selectionRows[0]);
|
this.visible = false;
|
},
|
add() {
|
this.visible = true;
|
},
|
loadData(arg) {
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1;
|
}
|
|
var params = this.getQueryParams();//查询条件
|
getAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
this.dataSource = res.result.records;
|
this.ipagination.total = res.result.total;
|
}
|
})
|
},
|
getQueryParams() {
|
var param = Object.assign({}, this.queryParam, this.isorter);
|
param.field = this.getQueryField();
|
param.pageNo = this.ipagination.current;
|
param.pageSize = this.ipagination.pageSize;
|
return filterObj(param);
|
},
|
getQueryField() {
|
//TODO 字段权限控制
|
},
|
|
onSelectChange(selectedRowKeys, selectedRows) {
|
this.selectedRowKeys = selectedRowKeys;
|
this.selectionRows = selectedRows;
|
},
|
onClearSelected() {
|
this.selectedRowKeys = [];
|
this.selectionRows = [];
|
},
|
handleDelete: function (record) {
|
|
},
|
handleTableChange(pagination, filters, sorter) {
|
//分页、排序、筛选变化时触发
|
console.log(sorter);
|
//TODO 筛选
|
if (Object.keys(sorter).length > 0) {
|
this.isorter.column = sorter.field;
|
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
|
}
|
this.ipagination = pagination;
|
this.loadData();
|
}
|
}
|
}
|
</script>
|
<style lang="less" scoped>
|
.ant-card-body .table-operator {
|
margin-bottom: 18px;
|
}
|
|
.ant-table-tbody .ant-table-row td {
|
padding-top: 15px;
|
padding-bottom: 15px;
|
}
|
|
.anty-row-operator button {
|
margin: 0 5px
|
}
|
|
.ant-btn-danger {
|
background-color: #ffffff
|
}
|
|
.ant-modal-cust-warp {
|
height: 100%
|
}
|
|
.ant-modal-cust-warp .ant-modal-body {
|
height: calc(100% - 110px) !important;
|
overflow-y: auto
|
}
|
|
.ant-modal-cust-warp .ant-modal-content {
|
height: 90% !important;
|
overflow-y: hidden
|
}
|
</style>
|