|
@@ -71,7 +71,7 @@
|
|
|
</el-form-item>
|
|
|
<div class="add-condition" @click="addCondition()"><i class="el-icon-circle-plus-outline" /> 添加条件</div>
|
|
|
</el-form>
|
|
|
- <h2 class="form-title">通知方式</h2>
|
|
|
+ <h2 class="form-title">通知方式(必选)</h2>
|
|
|
<el-form ref="form" :model="formData" label-width="100px" label-position="left">
|
|
|
<!-- 邮件方式 -->
|
|
|
<el-checkbox v-model="noticeList.Email" class="notice-check">邮件</el-checkbox>
|
|
@@ -138,7 +138,7 @@
|
|
|
</section>
|
|
|
</div>
|
|
|
</el-form>
|
|
|
- <h2 class="form-title">通知方式</h2>
|
|
|
+ <h2 class="form-title">通知时刻</h2>
|
|
|
<div class="notice-time">
|
|
|
<el-time-picker
|
|
|
v-model="formData.noticeTime"
|
|
@@ -154,7 +154,8 @@
|
|
|
import {
|
|
|
showRequireStatusEnum,
|
|
|
showTaskStatusEnum,
|
|
|
- getBizNoticeSettingEnum
|
|
|
+ getBizNoticeSettingEnum,
|
|
|
+ addBizNoticeSetting
|
|
|
} from '@/api/configure'
|
|
|
import { settingQueryBizRqmtOrntList } from '@/api/requirement.js'
|
|
|
import { settingQueryBizModuleList } from '@/api/defectManage'
|
|
@@ -183,7 +184,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- bizId: localStorage.getItem('bizId'),
|
|
|
+ bizId: Number(localStorage.getItem('bizId')),
|
|
|
title: this.type === 'require' ? '新建需求定时通知' : '新建任务定时通知',
|
|
|
requireProps: {
|
|
|
value: 'id',
|
|
@@ -194,12 +195,13 @@ export default {
|
|
|
directionList: [], // 需求方面列表
|
|
|
modulesList: [], // 任务模块列表
|
|
|
formData: {
|
|
|
+ bizId: Number(localStorage.getItem('bizId')),
|
|
|
requireOrientId: [], // 需求方向
|
|
|
techModuleId: [], // 技术模块
|
|
|
clientId: null, // 客户端
|
|
|
clientVersionId: null, // 版本
|
|
|
noticeConditionList: [], // 条件列表
|
|
|
- noticeSetting: [], // 通知方式
|
|
|
+ noticeSetting: {}, // 通知方式
|
|
|
noticeTime: null // 通知时刻
|
|
|
},
|
|
|
EmailList: [], // Email通知列表
|
|
@@ -249,7 +251,7 @@ export default {
|
|
|
data: {
|
|
|
handler(newV) {
|
|
|
if (newV) {
|
|
|
- this.formData = newV
|
|
|
+ this.initData(newV)
|
|
|
}
|
|
|
},
|
|
|
deep: true,
|
|
@@ -291,6 +293,30 @@ export default {
|
|
|
this.init()
|
|
|
},
|
|
|
methods: {
|
|
|
+ initData(data) {
|
|
|
+ this.formData = {
|
|
|
+ bizId: data.bizId,
|
|
|
+ requireOrientId: data.requireOrientId, // 需求方向
|
|
|
+ techModuleId: data.techModuleId, // 技术模块
|
|
|
+ clientId: data.clientId || null, // 客户端
|
|
|
+ clientVersionId: data.clientVersionId, // 版本
|
|
|
+ noticeConditionList: data.noticeConditionList || [], // 条件列表
|
|
|
+ noticeSetting: {}, // 通知方式
|
|
|
+ noticeTime: data.noticeTime // 通知时刻
|
|
|
+ }
|
|
|
+ if (data.email.length > 0) {
|
|
|
+ this.EmailList = data.email
|
|
|
+ this.noticeList.Email = true
|
|
|
+ }
|
|
|
+ if (data.dChart.length > 0) {
|
|
|
+ this.DChartList = data.email
|
|
|
+ this.noticeList.DChart = true
|
|
|
+ }
|
|
|
+ if (data.dChartGroup.length > 0) {
|
|
|
+ this.GroupList = data.email
|
|
|
+ this.noticeList.Group = true
|
|
|
+ }
|
|
|
+ },
|
|
|
async getBizNoticeSettingEnum() { // 任务需求事件列表
|
|
|
const res = await getBizNoticeSettingEnum(this.bizId)
|
|
|
if (res.code === 200) {
|
|
@@ -407,23 +433,54 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
addGroup() { // 添加DChart群
|
|
|
- this.GroupList.push({
|
|
|
- ...this.GroupItem
|
|
|
+ this.$refs['groupForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.GroupList.push({
|
|
|
+ type: 3,
|
|
|
+ ...this.GroupItem
|
|
|
+ })
|
|
|
+ this.GroupItem = { name: null, url: null }
|
|
|
+ this.showGroupForm = false
|
|
|
+ }
|
|
|
})
|
|
|
- this.GroupItem = { name: null, url: null }
|
|
|
- this.showGroupForm = false
|
|
|
},
|
|
|
removeGroup(index) { // 移除DChart群
|
|
|
this.GroupList.splice(index, 1)
|
|
|
},
|
|
|
- confirmForm() {
|
|
|
+ validate() { // 校验入参
|
|
|
+ if (this.formData.requireOrientId.length < 1 && this.type === 'require') {
|
|
|
+ this.$message({ message: '请选择需求方向', type: 'error', duration: 1000, offset: 150 })
|
|
|
+ }
|
|
|
+ if (this.formData.techModuleId.length < 1 && this.type === 'task') {
|
|
|
+ this.$message({ message: '请选择技术方向', type: 'error', duration: 1000, offset: 150 })
|
|
|
+ }
|
|
|
+ if (!this.formData.clientId) {
|
|
|
+ this.$message({ message: '请选择客户端', type: 'error', duration: 1000, offset: 150 })
|
|
|
+ }
|
|
|
+ if (!this.EmailList && !this.DChartList && !this.GroupList) {
|
|
|
+ this.$message({ message: '请选择一种通知方式', type: 'error', duration: 1000, offset: 150 })
|
|
|
+ }
|
|
|
+ if (!this.formData.noticeTime) {
|
|
|
+ this.$message({ message: '请选择通知时刻', type: 'error', duration: 1000, offset: 150 })
|
|
|
+ }
|
|
|
this.formData.noticeSetting = {
|
|
|
email: this.noticeList.Email ? this.EmailList : [],
|
|
|
dChart: this.noticeList.DChart ? this.DChartList : [],
|
|
|
- dchartGroup: this.noticeList.Group ? this.GroupList : []
|
|
|
+ dChartGroup: this.noticeList.Group ? this.GroupList : []
|
|
|
+ }
|
|
|
+ this.addBizNoticeSetting()
|
|
|
+ },
|
|
|
+ async addBizNoticeSetting() { // 新增通知
|
|
|
+ const res = await addBizNoticeSetting(this.formData)
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.data
|
|
|
+ ? this.$message({ message: '修改成功', type: 'success', duration: 1000, offset: 150 })
|
|
|
+ : this.$message({ message: '添加成功', type: 'success', duration: 1000, offset: 150 })
|
|
|
+ this.$emit('confirm')
|
|
|
}
|
|
|
- console.log(this.formData)
|
|
|
- this.$emit('confirm')
|
|
|
+ },
|
|
|
+ confirmForm() {
|
|
|
+ this.validate()
|
|
|
},
|
|
|
cancel() {
|
|
|
this.show = false
|