fix(系统设置): 消息设置的操作日志记录问题
--bug=1018658 --user=李玉号 【系统设置】操作日志-“新建”消息通知的消息设置日志显示的是“更新” https://www.tapd.cn/55049933/s/1289890
This commit is contained in:
parent
5dfcafd6d1
commit
9cdf24b47f
|
@ -28,7 +28,7 @@
|
||||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||||
import MsCodeEdit from "@/business/definition/components/MsCodeEdit";
|
import MsCodeEdit from "@/business/definition/components/MsCodeEdit";
|
||||||
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
|
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
|
||||||
import NotificationTable from "@/business/commons/NotificationTable";
|
import NotificationTable from "metersphere-frontend/src/components/notification/NotificationTable";
|
||||||
import {getMessageById} from "@/api/notice";
|
import {getMessageById} from "@/api/notice";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -1,215 +0,0 @@
|
||||||
<template>
|
|
||||||
<el-table
|
|
||||||
:data="tableData"
|
|
||||||
class="tb-edit"
|
|
||||||
border
|
|
||||||
:cell-style="rowClass"
|
|
||||||
:header-cell-style="headClass"
|
|
||||||
>
|
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')" size="mini"
|
|
||||||
@change="handleReceivers(scope.row)"
|
|
||||||
prop="event" :disabled="!scope.row.isSet">
|
|
||||||
<el-option
|
|
||||||
v-for="item in eventOptions"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%">
|
|
||||||
<template v-slot:default="{row}">
|
|
||||||
<el-select v-model="row.userIds" filterable multiple size="mini"
|
|
||||||
:placeholder="$t('commons.please_select')"
|
|
||||||
style="width: 100%;" :disabled="!row.isSet">
|
|
||||||
<el-option
|
|
||||||
v-for="item in row.receiverOptions"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.id">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"
|
|
||||||
size="mini"
|
|
||||||
style="width: 100%;"
|
|
||||||
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)">
|
|
||||||
<el-option
|
|
||||||
v-for="item in (hasLicense() ? receiveTypeOptions: receiveTypeOptions.filter(v => v.value !=='WEBHOOK'))"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="webhook" min-width="25%">
|
|
||||||
<template v-slot:header>
|
|
||||||
Webhook
|
|
||||||
<el-tooltip effect="dark" placement="top-start"
|
|
||||||
style="padding-left: 10px;">
|
|
||||||
<template v-slot:content>
|
|
||||||
支持企业微信、钉钉、飞书以及自定义Webhook(X-Pack)
|
|
||||||
<div>
|
|
||||||
自定义 Webhook 需要配置自定义模版才能发送成功,请自行查询对应的消息模版
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<i class="el-icon-info pointer"/>
|
|
||||||
</el-tooltip>
|
|
||||||
</template>
|
|
||||||
<template v-slot:default="scope">
|
|
||||||
<el-input v-model="scope.row.webhook" size="mini"
|
|
||||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="$t('commons.operating')" width="150" prop="result">
|
|
||||||
<template v-slot:default="scope">
|
|
||||||
<ms-tip-button
|
|
||||||
circle
|
|
||||||
type="success"
|
|
||||||
size="mini"
|
|
||||||
v-if="scope.row.isSet"
|
|
||||||
v-xpack
|
|
||||||
@click="handleTemplate(scope.$index,scope.row)"
|
|
||||||
:tip="$t('organization.message.template')"
|
|
||||||
icon="el-icon-tickets"/>
|
|
||||||
<ms-tip-button
|
|
||||||
circle
|
|
||||||
type="primary"
|
|
||||||
size="mini"
|
|
||||||
v-show="scope.row.isSet"
|
|
||||||
@click="handleAddTask(scope.$index,scope.row)"
|
|
||||||
:tip="$t('commons.add')"
|
|
||||||
icon="el-icon-check"/>
|
|
||||||
<ms-tip-button
|
|
||||||
circle
|
|
||||||
size="mini"
|
|
||||||
v-show="scope.row.isSet"
|
|
||||||
@click="removeRowTask(scope.$index,tableData)"
|
|
||||||
:tip="$t('commons.cancel')"
|
|
||||||
icon="el-icon-refresh-left"/>
|
|
||||||
<ms-tip-button
|
|
||||||
el-button
|
|
||||||
circle
|
|
||||||
type="primary"
|
|
||||||
size="mini"
|
|
||||||
icon="el-icon-edit"
|
|
||||||
v-show="!scope.row.isSet"
|
|
||||||
:tip="$t('commons.edit')"
|
|
||||||
@click="handleEditTask(scope.$index,scope.row)"
|
|
||||||
v-permission="['PROJECT_MESSAGE:READ+EDIT']"/>
|
|
||||||
<ms-tip-button
|
|
||||||
circle
|
|
||||||
type="danger"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
v-show="!scope.row.isSet"
|
|
||||||
@click="deleteRowTask(scope.$index,scope.row)"
|
|
||||||
:tip="$t('commons.delete')"
|
|
||||||
v-permission="['PROJECT_MESSAGE:READ+EDIT']"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {delMessage, saveMessage} from "@/api/notice";
|
|
||||||
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
|
|
||||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "NotificationTable",
|
|
||||||
components: {MsTipButton},
|
|
||||||
props: {
|
|
||||||
eventOptions: {
|
|
||||||
type: Array
|
|
||||||
},
|
|
||||||
receiveTypeOptions: {
|
|
||||||
type: Array
|
|
||||||
},
|
|
||||||
tableData: {
|
|
||||||
type: Array
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
hasLicense,
|
|
||||||
rowClass() {
|
|
||||||
return "text-align:center";
|
|
||||||
},
|
|
||||||
headClass() {
|
|
||||||
return "text-align:center;background:'#ededed'";
|
|
||||||
},
|
|
||||||
handleReceivers(row) {
|
|
||||||
this.$emit('handleReceivers', row);
|
|
||||||
},
|
|
||||||
handleTemplate(index, row) {
|
|
||||||
this.$emit('handleTemplate', index, row);
|
|
||||||
},
|
|
||||||
handleEdit(index, data) {
|
|
||||||
data.isReadOnly = true;
|
|
||||||
if (data.type === 'EMAIL' || data.type === 'IN_SITE') {
|
|
||||||
data.isReadOnly = !data.isReadOnly;
|
|
||||||
data.webhook = '';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleAddTask(index, data) {
|
|
||||||
if (data.event && data.userIds.length > 0 && data.type) {
|
|
||||||
if (data.type === 'WEBHOOK') {
|
|
||||||
if (!data.webhook) {
|
|
||||||
this.$warning(this.$t('organization.message.message_webhook'));
|
|
||||||
} else {
|
|
||||||
this.addTask(data);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.addTask(data);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.$warning(this.$t('organization.message.message'));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
addTask(data) {
|
|
||||||
this.result = saveMessage(data).then(() => {
|
|
||||||
data.isSet = false;
|
|
||||||
this.$emit('refresh');
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
removeRowTask(index, data) { //移除
|
|
||||||
if (!data[index].identification) {
|
|
||||||
data.splice(index, 1);
|
|
||||||
} else {
|
|
||||||
data[index].isSet = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
deleteRowTask(index, data) { //删除
|
|
||||||
this.result = delMessage(data.identification).then(response => {
|
|
||||||
this.$success(this.$t('commons.delete_success'));
|
|
||||||
this.$emit('refresh');
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleEditTask(index, data) {
|
|
||||||
this.handleReceivers(data);
|
|
||||||
data.isSet = true;
|
|
||||||
if (data.type === 'EMAIL' || data.type === 'IN_SITE') {
|
|
||||||
data.isReadOnly = false;
|
|
||||||
data.webhook = '';
|
|
||||||
} else {
|
|
||||||
data.isReadOnly = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
|
@ -28,7 +28,7 @@
|
||||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||||
import MsCodeEdit from "@/business/definition/components/MsCodeEdit";
|
import MsCodeEdit from "@/business/definition/components/MsCodeEdit";
|
||||||
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
|
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
|
||||||
import NotificationTable from "./NotificationTable";
|
import NotificationTable from "metersphere-frontend/src/components/notification/NotificationTable";
|
||||||
import {getMessageById} from "../../api/notice";
|
import {getMessageById} from "../../api/notice";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||||
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
|
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
|
||||||
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
|
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
|
||||||
import NotificationTable from "@/business/commons/NotificationTable";
|
import NotificationTable from "metersphere-frontend/src/components/notification/NotificationTable";
|
||||||
import {getMessageById} from "@/api/notice";
|
import {getMessageById} from "@/api/notice";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -38,6 +38,10 @@ export function saveNoticeTask(task) {
|
||||||
return post('/notice/save/message/task', task);
|
return post('/notice/save/message/task', task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function updateNoticeTask(task) {
|
||||||
|
return post('/notice/update/message/task', task);
|
||||||
|
}
|
||||||
|
|
||||||
export function deleteNoticeTask(taskId) {
|
export function deleteNoticeTask(taskId) {
|
||||||
return get(`/notice/delete/message/${taskId}`);
|
return get(`/notice/delete/message/${taskId}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
<script>
|
<script>
|
||||||
import MsTipButton from "../MsTipButton";
|
import MsTipButton from "../MsTipButton";
|
||||||
import {hasLicense} from "../../utils/permission";
|
import {hasLicense} from "../../utils/permission";
|
||||||
import {deleteNoticeTask, saveNoticeTask} from "../../api/notification";
|
import {deleteNoticeTask, saveNoticeTask, updateNoticeTask} from "../../api/notification";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "NotificationTable",
|
name: "NotificationTable",
|
||||||
|
@ -180,8 +180,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addTask(data) {
|
addTask(data) {
|
||||||
this.loading = saveNoticeTask(data).then(() => {
|
let promise = data.isUpdate ? updateNoticeTask(data) : saveNoticeTask(data);
|
||||||
|
this.loading = promise.then(() => {
|
||||||
data.isSet = false;
|
data.isSet = false;
|
||||||
|
this.$set(data, "isUpdate", false);
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
});
|
});
|
||||||
|
@ -202,6 +204,7 @@ export default {
|
||||||
handleEditTask(index, data) {
|
handleEditTask(index, data) {
|
||||||
this.handleReceivers(data);
|
this.handleReceivers(data);
|
||||||
data.isSet = true;
|
data.isSet = true;
|
||||||
|
this.$set(data, "isUpdate", true);
|
||||||
if (data.type === 'EMAIL' || data.type === 'IN_SITE') {
|
if (data.type === 'EMAIL' || data.type === 'IN_SITE') {
|
||||||
data.isReadOnly = false;
|
data.isReadOnly = false;
|
||||||
data.webhook = '';
|
data.webhook = '';
|
||||||
|
|
|
@ -18,11 +18,17 @@ public class NoticeController {
|
||||||
private NoticeService noticeService;
|
private NoticeService noticeService;
|
||||||
|
|
||||||
@PostMapping("save/message/task")
|
@PostMapping("save/message/task")
|
||||||
@MsAuditLog(module = OperLogModule.WORKSPACE_MESSAGE_SETTINGS, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#messageDetail.id)", content = "#msClass.getLogDetails(#messageDetail.id)", msClass = NoticeService.class)
|
@MsAuditLog(module = OperLogModule.WORKSPACE_MESSAGE_SETTINGS, type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#messageDetail.id)", msClass = NoticeService.class)
|
||||||
public void saveMessage(@RequestBody MessageDetail messageDetail) {
|
public void saveMessage(@RequestBody MessageDetail messageDetail) {
|
||||||
noticeService.saveMessageTask(messageDetail);
|
noticeService.saveMessageTask(messageDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("update/message/task")
|
||||||
|
@MsAuditLog(module = OperLogModule.WORKSPACE_MESSAGE_SETTINGS, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#messageDetail.id)", content = "#msClass.getLogDetails(#messageDetail.id)", msClass = NoticeService.class)
|
||||||
|
public void updateMessage(@RequestBody MessageDetail messageDetail) {
|
||||||
|
noticeService.saveMessageTask(messageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/search/message/type/{type}")
|
@GetMapping("/search/message/type/{type}")
|
||||||
public List<MessageDetail> searchMessage(@PathVariable String type) {
|
public List<MessageDetail> searchMessage(@PathVariable String type) {
|
||||||
String projectId = SessionUtils.getCurrentProjectId();
|
String projectId = SessionUtils.getCurrentProjectId();
|
||||||
|
|
|
@ -147,6 +147,7 @@ public class NoticeService {
|
||||||
MessageDetail messageDetail = new MessageDetail();
|
MessageDetail messageDetail = new MessageDetail();
|
||||||
for (MessageTask m : messageTasks) {
|
for (MessageTask m : messageTasks) {
|
||||||
userIds.add(m.getUserId());
|
userIds.add(m.getUserId());
|
||||||
|
messageDetail.setId(m.getId());
|
||||||
messageDetail.setEvent(m.getEvent());
|
messageDetail.setEvent(m.getEvent());
|
||||||
messageDetail.setTaskType(m.getTaskType());
|
messageDetail.setTaskType(m.getTaskType());
|
||||||
messageDetail.setWebhook(m.getWebhook());
|
messageDetail.setWebhook(m.getWebhook());
|
||||||
|
|
Loading…
Reference in New Issue