【update】-工作组资料分发、会议发布、设置标签功能

This commit is contained in:
fengchenchen
2023-07-13 18:05:54 +08:00
parent 3de3b8476d
commit d99d6b488b
7 changed files with 704 additions and 149 deletions
@@ -11,6 +11,28 @@
<a-spin :spinning="confirmLoading">
<template v-if="dataSourceInit.length > 0">
<!--查询条件 单个文件分发的时候才存在-->
<div class="table-page-search-wrapper" v-if="!isBatch">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row>
<a-col :xl="8" :lg="8" :md="8" :sm="24">
<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="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>
<!-- 操作按钮区域-->
<div class="table-operator">
<a-button type="primary" @click="checkAll()">全选</a-button>
@@ -47,9 +69,112 @@
</template>
<script>
import { distribute, batchDistribute, distributeMemberList } from '../../../api/incomePaymentsApi'
import { distribute, batchDistribute, distributeMemberList, judgeEmailStatus } from '../../../api/incomePaymentsApi'
import EmailErrorMsgModal from '@views/projectManagement/modules/EmailErrorMsgModal.vue'
// 工作组发布提醒 表头
const columns = [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '联系人',
align: 'center',
width: 200,
dataIndex: 'name',
scopedSlots: {customRender: 'text'}
},
{
title: '成员单位',
align: 'center',
dataIndex: 'companyName',
width: 280,
scopedSlots: { customRender: 'text' }
},
{
title: '邮件通知',
align: 'center',
width: 200,
dataIndex: 'remind_dictText',
scopedSlots: {customRender: 'text'}
}
]
// 分标委发布提醒 表头
const commitColumns = [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '联系人',
align: 'center',
width: 200,
dataIndex: 'name',
scopedSlots: {customRender: 'text'}
},
// {
// title: '成员单位',
// align: 'center',
// dataIndex: 'companyName',
// width: 280,
// scopedSlots: { customRender: 'text' }
// },
{
title: '邮件通知',
align: 'center',
width: 200,
dataIndex: 'remind_dictText',
scopedSlots: {customRender: 'text'}
}
]
// 理事会成员的表头
const councilColumns = [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '联系人',
align: 'center',
width: 200,
dataIndex: 'name',
scopedSlots: {customRender: 'text'}
},
// {
// title: '成员单位',
// align: 'center',
// dataIndex: 'companyName',
// width: 280,
// scopedSlots: { customRender: 'text' }
// },
{
title: '邮件通知',
align: 'center',
width: 200,
dataIndex: 'remind_dictText',
scopedSlots: {customRender: 'text'}
}
]
export default {
name: 'WorkGroupDistributeModule',
components: { EmailErrorMsgModal },
@@ -96,24 +221,10 @@ export default {
title: '分发',
width: 1000,
confirmLoading: false,
columns: [
{
title: '联系人',
align: 'center',
dataIndex: 'name',
width: 280,
scopedSlots: { customRender: 'text' }
},
{
title: '成员单位',
align: 'center',
dataIndex: 'companyName',
width: 280,
scopedSlots: { customRender: 'text' }
}
],
columns: [],
dataSource: [], // 表格中显示的数据
dataSourceInit: [], // 所有分发单位的数据
dataSourceInitShow: [], // 拥有过滤条件后显示的所有数据
/* 分页参数 */
ipagination: {
current: 1,
@@ -127,7 +238,19 @@ export default {
total: 0
},
/* table选中keys*/
selectedRowKeys: []
selectedRowKeys: [],
// 查询条件
queryParam: {},
lastQueryParam: {},
labelCol: {
xs: {span: 24},
sm: {span: 6}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 18}
},
needMail: false // 消息模板中是否设置了可以发邮件 重要
}
},
methods: {
@@ -143,6 +266,7 @@ export default {
distributeMemberList(param).then(res => {
if (res.success) {
this.dataSourceInit = res.result || []
this.dataSourceInitShow = res.result || []
this.loadData(1)
} else {
this.$message.warn(res.message)
@@ -162,7 +286,22 @@ export default {
this.selectedRowKeys = []
this.ipagination.current = 1
this.ipagination.pageSize = 10
// 通过不同的项目类型 展示不同的columns 目前里面的信息是一致的
// 项目类型:1--工作组;2--分标委;3--理事会
if(this.projectType === 1) {
this.columns = [...columns]
} else if(this.projectType === 2) {
this.columns = [...commitColumns]
} else {
this.columns = [...councilColumns]
}
// 选择多个资料的时候不需要提醒字段 这样写是因为无法精准定位每一个人对应的每一个资料 这个人是否被提醒
if (this.isBatch) {
// 去掉列表的提醒字段
this.columns = this.columns.filter(item => item.dataIndex !== 'remind_dictText')
}
this.getMemberList()
this.judgeEmailStatusFunc()
},
handleTableChange(pagination) {
@@ -185,13 +324,27 @@ export default {
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
if(this.lastQueryParam.remind === undefined) {
this.dataSourceInitShow = this.dataSourceInit
} else {
this.dataSourceInitShow = this.dataSourceInit.filter(tt => tt.remind + '' === this.lastQueryParam.remind + '')
}
}
var params = this.getQueryParams()//查询条件
this.ipagination.total = this.dataSourceInit.length
this.dataSource = this.dataSourceInit.slice((params.pageNo - 1) * params.pageSize, (params.pageNo * params.pageSize))
this.ipagination.total = this.dataSourceInitShow.length
this.dataSource = this.dataSourceInitShow.slice((params.pageNo - 1) * params.pageSize, (params.pageNo * params.pageSize))
},
searchQuery() {
this.lastQueryParam = {...this.queryParam}
this.loadData(1)
},
searchReset() {
this.lastQueryParam = {}
this.queryParam = {}
this.loadData(1)
},
checkAll() {
this.selectedRowKeys = this.dataSourceInit.map(tt => tt.id)
this.selectedRowKeys = this.dataSourceInitShow.map(tt => tt.id)
},
close() {
this.$emit('update:visible', false)
@@ -212,68 +365,105 @@ export default {
this.confirmLoading = false
return
}
if (this.isBatch) {
let str = this.selectedRowKeys.join(',')
// 批量分发
const formData = {
contactsIds: str,
dataIds: this.recordId,
projectId: this.projectId,
projectType: this.projectType
}
batchDistribute(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
// 是否有邮件发送失败 有就给出提示信息
if (Array.isArray(res.result) && res.result.length > 0) {
// msgWarn(this,res.result,0)
this.$refs.emailError.open()
this.$refs.emailError.msgList = res.result
console.log(this.$refs.emailError.msgList, 'this.$refs.emailError.msgList ')
}
this.close()
this.$emit('ok')
} else {
this.$message.warn(res.message)
if(this.needMail) {
this.$confirm({
title: '消息确认',
content: '确认要向选择的成员发送邮件吗?',
cancelText: '不发送',
okText: '确认发送',
onOk: function () {
callbackFunc(1)
},
onCancel: function() {
callbackFunc(0)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
} else {
// 单个分发
const formData = {
contactsIds: this.selectedRowKeys.join(','),
dataId: this.recordId,
projectId: this.projectId,
projectType: this.projectType
}
distribute(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
if (Array.isArray(res.result) && res.result.length > 0) {
// msgWarn(this,res.result,0)
this.$refs.emailError.open()
this.$refs.emailError.msgList = res.result
console.log(this.$refs.emailError.msgList, 'this.$refs.emailError.msgList ')
}
this.close()
this.$emit('ok')
} else {
this.$message.warn(res.message)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
// 若全局没有配置则不发送邮件信息
callbackFunc(0)
}
// 定义请求成功的方法 sendEmailFlag 0-不发送 1-发送
const callbackFunc = (sendEmailFlag) => {
if (this.isBatch) {
let str = this.selectedRowKeys.join(',')
// 批量分发
const formData = {
contactsIds: str,
dataIds: this.recordId,
projectId: this.projectId,
projectType: this.projectType,
sendEmailFlag
}
batchDistribute(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
// 是否有邮件发送失败 有就给出提示信息
if (Array.isArray(res.result) && res.result.length > 0) {
// msgWarn(this,res.result,0)
this.$refs.emailError.open()
this.$refs.emailError.msgList = res.result
console.log(this.$refs.emailError.msgList, 'this.$refs.emailError.msgList ')
}
this.close()
this.$emit('ok')
} else {
this.$message.warn(res.message)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
} else {
// 单个分发
const formData = {
contactsIds: this.selectedRowKeys.join(','),
dataId: this.recordId,
projectId: this.projectId,
projectType: this.projectType,
sendEmailFlag
}
distribute(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
if (Array.isArray(res.result) && res.result.length > 0) {
// msgWarn(this,res.result,0)
this.$refs.emailError.open()
this.$refs.emailError.msgList = res.result
console.log(this.$refs.emailError.msgList, 'this.$refs.emailError.msgList ')
}
this.close()
this.$emit('ok')
} else {
this.$message.warn(res.message)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
}
}
},
handleCancel() {
this.close()
},
// 判断全局设置的是否需要发邮件
judgeEmailStatusFunc() {
this.needMail = false
// 非工作组项目的情况 不进行请求
if(this.projectType !== 1) return
const params = {
code: 'QY_12_WJTZ_WORK_GROUP_SEND'
}
judgeEmailStatus(params).then(res => {
if(res.success) {
// 发送邮件的类型 1-短信 2-邮件 3-系统 数据字典codem sgType
this.needMail = (res.result || {}).templateType.indexOf(2) > -1
}
})
}
}
}