Files
income_payments_client/src/views/contractManagement/revenueContract/modules/SelectProjectModule.vue
T

406 lines
12 KiB
Vue

<template>
<j-modal :title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row>
<!-- 普通项目管理查询-->
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="科室" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-tree-select
style="width:100%"
:dropdownStyle="{ maxHeight: '200px',maxWidth:'100px','overflow-x':'hidden',' overflow-y': 'auto' }"
:treeData="treeDepartData"
v-model="queryParam.departId"
placeholder="请选择科室"
:disabled="pack === 0"
allowClear
@change="departChange">
</a-tree-select>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="负责人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-model="queryParam.principalId"
show-search
allowClear
placeholder="请选择负责人"
option-filter-prop="children"
@change="principalChange"
:filter-option="filterOption">
<a-select-option v-for="item in userList" :key="item.id" :value="item.id">
{{ item.realname }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="运行年份" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-year-date style="width:100%"
placeholder="请选择运行年份"
allowClear
v-model="queryParam.year"
@change="dateChange"></j-year-date>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span class="table-page-search-submitButtons">
<a-button type="primary" icon="search" @click="searchQuery">查询</a-button>
<a-button icon="reload" @click="searchReset">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- /查询区域-->
<!-- 操作按钮区域-->
<div class="table-operator">
<a-button type="primary" icon="plus" @click="handleAdd" v-has="'generalProject:add'">新增</a-button>
</div>
<!-- 操作按钮区域-end-->
<!-- 表格区域-->
<div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:scroll="{x: 800}"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="confirmLoading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange"
class="j-table-force-nowrap">
<template slot="text" slot-scope="text">
<j-ellipsis :value="text" :length="18"></j-ellipsis>
</template>
<!-- 打包需要发票到账开票邮寄状态-->
<template slot="status" slot-scope="text,record">
<status-slot :statu-obj="record" :status-no="text" :status-type="true"></status-slot>
</template>
<template slot="status-pack" slot-scope="text,record">
<status-slot :statu-obj="record" :status-no="text"></status-slot>
</template>
</a-table>
</div>
<!-- /表格区域-->
<!-- 普通项目新增-->
<general-project-module ref="generalProjectForm"
v-bind="$attrs"
:disabled-charge-company="true"
:default-charge-way="2"
:is-contract-num-disabled="true"
:flag="1"
@ok="selectProjectOk"></general-project-module>
</j-modal>
</template>
<script>
import { JeroListMixin } from '../../../../mixins/JeroListMixin'
import JYearDate from '../../../../components/jero/JYearDate'
import GeneralProjectModule from '../../../projectManagement/modules/GeneralProjectModule'
import StatusSlot from '../../../../components/tools/StatusSlot'
import { associatedProject, queryUserByDepartId } from '../../../../api/incomePaymentsApi'
import { getAllDepartTreeList } from '../../../../api/incomePaymentsApi'
export default {
name: 'SelectProjectModule',
components: {
JYearDate,
GeneralProjectModule,
StatusSlot
},
mixins: [JeroListMixin],
props: {
// 部门id,用于查询
departId: {
type: String,
requird: false,
default: null
},
// 打包状态
pack: {
type: Number,
requird: false,
default: null
},
// 收入合同id
contractId: {
type: String,
requird: false,
default: null
},
// 项目类型,1--普通项目;2--工作组项目;3--会议项目;4--会员项目
projectType: {
type: Number,
requird: false,
default: null
},
// 负责人id
principal: {
type: String,
requird: false,
default: ''
}
},
data() {
return {
title: '普通项目列表',
width: 1200,
visible: false,
confirmLoading: false,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 10 }
},
disableMixinCreated: true,
url: {
list: '/project/payCommonProject/listAll'
},
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
}, {
title: '来款项目',
align: 'center',
width: 280,
dataIndex: 'chargeProject',
scopedSlots: { customRender: 'text' }
}, {
title: '来款用途',
align: 'center',
width: 180,
dataIndex: 'chargeUse_dictText',
scopedSlots: { customRender: 'text' }
}, {
title: '来款单位',
align: 'center',
width: 280,
dataIndex: 'chargeCompanyTemporaryName',
scopedSlots: { customRender: 'text' }
}, {
title: '应收金额',
align: 'center',
width: 100,
dataIndex: 'receivableAmount'
}, {
title: '实收金额',
align: 'center',
width: 100,
dataIndex: 'paidAmount'
}, {
title: '负责人',
align: 'center',
width: 140,
dataIndex: 'principalName',
scopedSlots: { customRender: 'text' }
}, {
title: '企业联系人',
align: 'center',
width: 280,
dataIndex: 'contactsTemporaryName',
scopedSlots: { customRender: 'text' }
}, {
title: '打包',
align: 'center',
width: 80,
dataIndex: 'pack',
scopedSlots: { customRender: 'status-pack' }
}, {
title: '需要发票',
align: 'center',
width: 80,
dataIndex: 'needInvoice',
scopedSlots: { customRender: 'status-pack' }
}, {
title: '到账',
align: 'center',
width: 80,
dataIndex: 'inAccount',
scopedSlots: { customRender: 'status' }
}, {
title: '开票',
align: 'center',
width: 80,
dataIndex: 'makeInvoice',
scopedSlots: { customRender: 'status' }
}, {
title: '邮寄',
align: 'center',
width: 80,
dataIndex: 'mail',
scopedSlots: { customRender: 'status' }
}
],
treeDepartData: [], // 部门列表
userList: [] // 用户列表
}
},
methods: {
/**
* 运行年份变化
*/
dateChange() {
this.$forceUpdate()
},
/**
* 负责人变化
*/
principalChange() {
this.$forceUpdate()
},
open() {
// 运行年份默认为当年
this.queryParam.year = new Date().getFullYear().toString()
this.lastQueryParam.year = new Date().getFullYear().toString()
// 默认科室、负责人
this.queryParam.principalId = this.principal
this.lastQueryParam.principalId = this.principal
this.queryParam.departId = this.departId
this.lastQueryParam.departId = this.departId
this.loadDepartTreeData()
this.visible = true
this.loadData()
},
/**
* 获取科室(部门)数据
*/
loadDepartTreeData() {
getAllDepartTreeList().then((res) => {
if (res.success) {
this.treeDepartData = []
let treeList = res.result
for (let a = 0; a < treeList.length; a++) {
let temp = treeList[a]
temp.isLeaf = temp.leaf
this.treeDepartData.push(temp)
}
} else {
this.$message.warn(res.message)
}
})
},
close() {
this.queryParam = {}
this.selectedRowKeys = []
this.visible = false
this.$emit('ok')
},
handleOk() {
if (this.confirmLoading) {
return
}
this.confirmLoading = true
if (this.selectedRowKeys.length <= 0) {
this.$message.warn('请选择项目后再提交关联')
this.confirmLoading = false
return
}
let submitData = []
let projectItem
this.selectedRowKeys.forEach(item => {
projectItem = {
contractId: this.contractId,
projectId: item,
projectType: this.projectType
}
submitData.push(projectItem)
})
associatedProject(submitData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.close()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
},
handleCancel() {
this.close()
},
/**
* 打开新增module
*/
handleAdd() {
this.$refs.generalProjectForm.add()
this.$refs.generalProjectForm.title = '新增'
this.$refs.generalProjectForm.disableSubmit = false
},
// 下拉框的搜索
filterOption(input, option) {
return (
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
)
},
/**
* 部门变化,负责人列表变化
* @param value
*/
departChange(value) {
let param = {
departId: value
}
queryUserByDepartId(param).then(res => {
if (res.success) {
this.userList = res.result
} else {
this.$message.warn(res.message)
}
})
},
/**
* 重置
*/
searchReset() {
let obj = {
departId: this.departId,
principalId: this.principal,
year: new Date().getFullYear().toString(),
}
this.queryParam = Object.assign(this.queryParam, obj)
this.lastQueryParam = Object.assign(this.lastQueryParam, obj)
this.loadData(1)
},
/**
* 新建项目完成后关闭两个模态框
*/
selectProjectOk() {
this.close()
this.$emit('ok')
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>