Files
income_payments_client/src/views/projectManagement/modules/PublishRemindModal.vue
T

400 lines
13 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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="8" :lg="8" :md="8" :sm="12" v-if="$route.query.meetingType === '5' || $route.query.meetingType === '6' ">
<a-form-item label="成员单位" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入成员单位" v-model="queryParam.companyName"></a-input>
</a-form-item>
</a-col>
<!--工作组发布显示这个-->
<a-col :xl="8" :lg="8" :md="8" :sm="12" v-else>
<a-form-item label="成员单位" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入成员单位" v-model="queryParam.chargeCompanyTemporaryName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="6" :md="6" :sm="12">
<a-form-item label="已提醒" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag style="width: 100%"
dict-code="yn"
v-model="queryParam.remind"
placeholder="请选择提醒类型"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="6" :md="6" :sm="12">
<a-form-item label="邮件提醒" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag style="width: 100%"
dict-code="yn"
v-model="queryParam.mailRemind"
placeholder="请选择邮件提醒类型"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :xl="4" :lg="8" :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" class="reset-button">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="newColumns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<!-- 项目名称-->
<template slot="projectName" slot-scope="text, record">
<j-ellipsis :value="text" :length="18" class="primary-color" @click="openDetailModal(record)"></j-ellipsis>
</template>
<template slot="text" slot-scope="text">
<j-ellipsis v-if="!!text" :value="text" :length="20"></j-ellipsis>
<span v-else></span>
</template>
<span slot="action" class="action-span-cell" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a @click="handleDelete(record.id)">删除</a>
</span>
</a-table>
<email-error-msg-modal ref="emailError"></email-error-msg-modal>
</j-modal>
</template>
<script>
import {JeroListMixin} from '@/mixins/JeroListMixin'
import {publishRemind,commitePublishRemind,councilPublishRemind} from '@api/incomePaymentsApi'
import EmailErrorMsgModal from '@views/projectManagement/modules/EmailErrorMsgModal'
import { judgeEmailStatus } from "../../../api/incomePaymentsApi";
export default {
name: 'PublishRemindModal',
mixins: [JeroListMixin],
components:{
EmailErrorMsgModal
},
data() {
return {
title: '操作',
width: 1200,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
disableMixinCreated: true,
// 工作组发布提醒 表头
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '成员单位',
align: 'center',
width: 200,
dataIndex: 'chargeCompanyTemporaryName',
scopedSlots: {customRender: 'text'}
},
{
title: '企业联系人',
align: 'center',
width: 200,
dataIndex: 'contactsTemporaryNameOne',
scopedSlots: {customRender: 'text'}
},
{
title: '是否提醒',
align: 'center',
width: 200,
dataIndex: 'remind_dictText',
// scopedSlots: {customRender: 'text'}
},
{
title: '邮件提醒',
align: 'center',
width: 200,
dataIndex: 'mailRemind_dictText',
// scopedSlots: {customRender: 'text'}
},
],
// 分标委发布提醒 表头
commitColumns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '成员单位',
align: 'center',
width: 200,
dataIndex: 'companyName',
scopedSlots: {customRender: 'text'}
},
{
title: '企业联系人',
align: 'center',
width: 200,
dataIndex: 'contactsName',
scopedSlots: {customRender: 'text'}
},
{
title: '是否提醒',
align: 'center',
width: 200,
dataIndex: 'remind_dictText',
// scopedSlots: {customRender: 'text'}
},
{
title: '邮件提醒',
align: 'center',
width: 200,
dataIndex: 'mailRemind_dictText',
// scopedSlots: {customRender: 'text'}
},
],
// 理事会成员的表头
councilColumns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '成员单位',
align: 'center',
width: 200,
dataIndex: 'companyName',
scopedSlots: {customRender: 'text'}
},
{
title: '企业联系人',
align: 'center',
width: 200,
dataIndex: 'peopleName',
scopedSlots: {customRender: 'text'}
},
{
title: '是否提醒',
align: 'center',
width: 200,
dataIndex: 'remind_dictText',
// scopedSlots: {customRender: 'text'}
},
{
title: '邮件提醒',
align: 'center',
width: 200,
dataIndex: 'mailRemind_dictText',
// scopedSlots: {customRender: 'text'}
},
],
model: {},
labelCol: {
xs: {span: 24},
sm: {span: 6}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 18}
},
url: {
add: '/project/payCommonProject/add',
edit: '/project/payCommonProject/edit',
list: '/project/payWorkingGroupSubitem/publishReminderList',
},
// 会议维护选中的会议
selectedMetingList: [],
newColumns: [],
// 提醒类型 1 是工作组 2 是分标委 3是理事会
remindType:'',
// 是否需要发邮件
needMail: false,
// 发消息需要验证的模板code码
mailTemplateCode: ''
}
},
methods: {
open(meetingList) {
this.onClearSelected()
this.visible = true
// 保存选中的会议
this.selectedMetingList = [...meetingList]
// 设置请求的模板CODE 一样的
this.mailTemplateCode = 'QY_1_HYTZ_WORK_GROUP_CREATE'
// 分标委会议需要分标标委的id
if (this.$route.query.meetingType === '5') {
// 分标委
this.newColumns = [...this.commitColumns]
this.filters.id = this.$route.query.id
this.remindType = 2
// 分标委成员
this.url.list = '/payCaseCommitteeSubitem/payCaseCommitteeSubitem/list'
} else if(this.$route.query.meetingType === '6') {
this.newColumns = [...this.councilColumns]
this.filters.id = this.$route.query.councilId
//理事会成员的接口
this.url.list = '/payCaseCouncilSubitem/payCaseCouncilSubitem/list'
this.remindType = 3
} else {
// 列表需要工作组id参数
this.filters.workingGroupId = this.$route.query.workingGroupProjectId
// 工作组
this.remindType = 1
this.newColumns = [...this.columns]
}
// 发布提醒需要会议id 只有选择一个会议的时候 才会有这个参数
if (meetingList.length === 1) {
this.filters.meetingId = meetingList[0]
}
// 选择多个会议的时候不需要提醒字段 这样写是因为无法精准定位每一个人对应的每一个会议 这个人是否被提醒
if (meetingList.length > 1) {
// 去掉列表的提醒字段
this.newColumns = this.newColumns.filter(item => item.dataIndex !== 'remind_dictText')
}
this.searchReset()
this.judgeEmailStatusFunc()
},
close() {
this.$emit('close')
this.newColumns = []
this.visible = false
},
handleOk() {
if (this.confirmLoading) {
return
}
this.confirmLoading = true
if (this.selectionRows.length === 0) {
this.$message.warn('请至少选择一个成员')
this.confirmLoading = false
return
}
// 定义请求成功的方法 sendEmailFlag 0-不发送 1-发送
const callbackFunc = (sendEmailFlag) => {
// TODO 分标委、理事会是否需要验证 再定
const param = {
meetingIds: this.selectedMetingList,
subitemIds: this.selectedRowKeys,
projectType:this.remindType
}
let requestFun
param.sendEmailFlag = sendEmailFlag
// 分标委用分标委的接口
if(this.$route.query.meetingType === '5' ){
requestFun = commitePublishRemind
}else if(this.$route.query.meetingType === '6'){
// 理事会的用理事会的发布提醒
requestFun = councilPublishRemind
} else {
// 工作组
param.workingGroupId = this.$route.query.workingGroupProjectId
requestFun = publishRemind
}
requestFun(param).then(res => {
if (res.success) {
if (sendEmailFlag && Array.isArray(res.result) && res.result.length > 0) {
this.$refs.emailError.open()
this.$refs.emailError.msgList = res.result
console.log(this.$refs.emailError.msgList, 'this.$refs.emailError.msgList ')
} else {
this.$message.success(res.message)
}
this.$emit('ok')
this.confirmLoading = false
this.handleCancel()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
}
if(this.needMail) {
this.$confirm({
title: '消息确认',
content: '确认要向选择的成员发送邮件吗?',
cancelText: '不发送',
okText: '确认发送',
onOk: function () {
callbackFunc(1)
},
onCancel: function() {
callbackFunc(0)
}
})
} else {
// 若全局没有配置则不发送邮件信息
callbackFunc(0)
}
},
handleCancel() {
this.close()
},
// 判断全局设置的是否需要发邮件
judgeEmailStatusFunc() {
this.needMail = false
if(!this.mailTemplateCode) return
// 工作组的会议通知模板 --QY_1_HYTZ_WORK_GROUP_CREATE
const params = {
code: this.mailTemplateCode
}
judgeEmailStatus(params).then(res => {
if(res.success) {
// 发送邮件的类型 1-短信 2-邮件 3-系统 数据字典codem sgType
this.needMail = (res.result || {}).templateType.indexOf(2) > -1
}
})
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>