middleground_code_v2/src/views/apiLogs/rightDialog.vue

288 lines
6.9 KiB
Vue
Raw Normal View History

2024-04-24 14:14:13 +08:00
<template>
<div>
<base-right-dialog
ref="baseRightDialog"
:footerShow="true"
:dialogVisible.sync="dialogVisible"
:title="dialogTitle + ' 消息管理日志'"
@handleClose="handleDialogClose"
:type="dialogType"
:submitShow="submitShow"
:size="'65%'"
@handleConfirmClick="handleConfirmClick"
2024-04-24 14:14:13 +08:00
>
<base-form
ref="basicsForm"
:formRow="formRow"
:isFunBtn="false"
:rules="basicsRules"
class="dialog_form"
:spanWidth="`120px`"
:loading="vLoading"
style="padding-bottom:20px;"
2024-04-24 14:14:13 +08:00
>
<div slot="sourceData" class="code-json-editor">
<vue-json-editor
class="editor"
v-model="sourceData"
:showBtns="false"
:mode="'code'"
@json-change="onSourceDataJsonChange"
@json-save="onSourceDataSave"
@has-error="onSourceDataError"
2024-04-24 14:14:13 +08:00
/>
</div>
<div slot="targetData" class="code-json-editor">
<vue-json-editor
class="editor"
v-model="targetData"
:showBtns="false"
:mode="'code'"
@json-change="onTargetDataChange"
@json-save="onTargetDataSave"
@has-error="onTargetDataError"
2024-04-24 14:14:13 +08:00
/>
</div>
</base-form>
</base-right-dialog>
</div>
</template>
<script>
import vueJsonEditor from 'vue-json-editor'
import baseRightDialog from '@/components/base/baseRightDialog'
import baseForm from '@/components/base/baseNewForm'
import baseTable from '@/components/base/baseTable'
import configData from './configData'
import { authApi } from '@/api/apis/auth'
import { getApiModuleApi } from '@/api/apiChunks/index.js'
2024-04-24 14:14:13 +08:00
export default {
components: {
baseRightDialog,
baseForm,
baseTable,
vueJsonEditor
2024-04-24 14:14:13 +08:00
},
data() {
return {
dialogVisible: false,
dialogTitle: '',
dialogType: '',
2024-04-24 14:14:13 +08:00
formRow: configData.formRow,
basicsRules: configData.basicsRules,
vLoading: false,
submitShow: true,
sourceData: {},
sourceDataFlag: true,
targetData: {},
targetDataFlag: true
}
2024-04-24 14:14:13 +08:00
},
methods: {
openDialog(type, row) {
this.querysysAppService()
2024-04-24 14:14:13 +08:00
// this.querysysAppApiService();
this.formRow = configData.formRow
this.submitShow = true
2024-04-24 14:14:13 +08:00
// 编辑
if (type == 'edit') {
this.dialogTitle = '编辑'
this.dialogType = 'edit'
this.messageLogGetById(row.id)
2024-04-24 14:14:13 +08:00
}
// 查看
if (type == 'show') {
this.submitShow = false
this.formRow = configData.formRowShow
this.dialogTitle = '查看'
this.dialogType = 'show'
this.messageLogGetById(row.id, row)
2024-04-24 14:14:13 +08:00
}
this.dialogVisible = true
2024-04-24 14:14:13 +08:00
},
// 编辑详情
async messageLogGetById(id, row) {
2024-04-24 14:14:13 +08:00
let params = {
id: id,
status: row.status
}
2024-04-24 14:14:13 +08:00
let res = await authApi(
'sysMessageManageLogService',
'messageManage',
'thirdInterfacequeryEntity',
'',
params
)
if (res.status == '200') {
2024-04-24 14:14:13 +08:00
this.$nextTick(() => {
this.$refs.basicsForm.incomingParameters(res.attribute)
})
2024-04-24 14:14:13 +08:00
}
},
// 实时保存 源数据
onSourceDataJsonChange(value) {
this.onSourceDataSave(value)
2024-04-24 14:14:13 +08:00
},
onSourceDataSave(value) {
this.sourceData = value
this.sourceDataFlag = true
2024-04-24 14:14:13 +08:00
},
onSourceDataError(value) {
this.sourceDataFlag = false
2024-04-24 14:14:13 +08:00
},
checkSourceDataJson() {
if (this.sourceDataFlag === false) {
return false
2024-04-24 14:14:13 +08:00
} else {
return true
2024-04-24 14:14:13 +08:00
}
},
// 实时保存 目标数据
onTargetDataChange(value) {
this.onTargetDataSave(value)
2024-04-24 14:14:13 +08:00
},
onTargetDataSave(value) {
this.targetData = value
this.targetDataFlag = true
2024-04-24 14:14:13 +08:00
},
onTargetDataError(value) {
this.targetDataFlag = false
2024-04-24 14:14:13 +08:00
},
checkTargetDataJson() {
if (this.targetDataFlag === false) {
return false
2024-04-24 14:14:13 +08:00
} else {
return true
2024-04-24 14:14:13 +08:00
}
},
// 弹窗关闭
handleDialogClose() {
this.$refs.basicsForm.resetFields()
this.dialogVisible = false
2024-04-24 14:14:13 +08:00
},
// 弹窗确认按钮
handleConfirmClick() {
let checkSource = this.checkSourceDataJson()
2024-04-24 14:14:13 +08:00
if (!checkSource) {
this.$vmNews('源数据格式应为JSON格式', 'warning')
return
2024-04-24 14:14:13 +08:00
}
let checkTarget = this.checkTargetDataJson()
2024-04-24 14:14:13 +08:00
if (!checkTarget) {
this.$vmNews('目标数据格式应为JSON格式', 'warning')
return
2024-04-24 14:14:13 +08:00
}
let params = {
...this.$refs.basicsForm.ruleForm,
sourceData: this.sourceData,
targetData: this.targetData
}
if (this.dialogType == 'edit') {
this.openLoading('submit')
this.messageLogUpdateDto(params)
2024-04-24 14:14:13 +08:00
}
},
// 编辑保存
async messageLogUpdateDto(params) {
let res = await authApi(
'sysMessageManageLogService',
'messageManage',
'updateEntity',
'',
params
)
if (res.status == '200') {
this.handleDialogClose()
this.$vmNews('更新成功', 'success')
this.$emit('resetTable')
2024-04-24 14:14:13 +08:00
}
},
// 应用
async querysysAppService() {
const res = await getApiModuleApi({
tl: 'sysApplicationService',
as: 'application',
dj: 'thirdInterfacequeryApp'
2024-04-24 14:14:13 +08:00
}, {
'pageNum': 1,
'pageSize': 999
2024-04-24 14:14:13 +08:00
})
this.formRow[0].elCol[0].options = res.attribute.list
// if (res.status == "200") {
// this.formRow[1].elCol[0].options = res.attribute.list;
// this.formRow[2].elCol[0].options = res.attribute.list;
// }
},
// 应用者
async querysysAppApiService() {
let params = {
pageSize: 9999,
pageNum: 1
}
2024-04-24 14:14:13 +08:00
let res = await authApi(
'appApiService',
'appApi',
'queryPage',
'',
params
)
if (res.status == '200') {
2024-04-24 14:14:13 +08:00
// this.formRow[1].elCol[1].options = res.attribute.list;
// this.formRow[2].elCol[1].options = res.attribute.list;
}
}
}
}
2024-04-24 14:14:13 +08:00
</script>
<style lang="less" scoped>
.code-json-editor {
/* jsoneditor右上角默认有一个链接,加css去掉 */
2024-04-24 14:14:13 +08:00
/deep/ .jsoneditor-poweredBy {
display: none !important;
}
2024-04-24 14:14:13 +08:00
/deep/ .ace-jsoneditor {
height: 150px !important;
}
}
</style>
<style scoped lang="scss">
::v-deep textarea.el-textarea__inner {
2024-05-14 10:08:39 +08:00
min-height: 150px !important;
2024-04-24 14:14:13 +08:00
}
2024-04-24 14:14:13 +08:00
.dialogList {
padding: 16px 0;
border-top: 1px solid #dcdfe6;
display: flex;
flex-direction: column;
}
.updateBtn {
border: 1px solid #ebedf1;
padding: 5px 0;
border-radius: 3px;
text-align: center;
font-size: 14px;
cursor: pointer;
width: 100px;
}
.updateBtn:hover {
color: #1890ff;
border-color: #badeff;
background-color: #e8f4ff;
}
::v-deep .el-table__body-wrapper.is-scrolling-none {
height: auto !important;
}
::v-deep .app-container {
height: auto !important;
}
</style>