dbsd_kczx/src/views/monitor/mynews/DetailModal.vue

89 lines
2.7 KiB
Vue
Raw Normal View History

2022-03-10 09:47:29 +08:00
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="查看详情" :minHeight="600" :showCancelBtn="false" :showOkBtn="false" :height="88">
2022-06-10 10:44:44 +08:00
<a-card class="daily-article">
<a-card-meta :title="content.titile" :description="'发布人:' + content.sender + ' 发布时间: ' + content.sendTime"> </a-card-meta>
2022-03-10 09:47:29 +08:00
<a-divider />
<span v-html="content.msgContent" class="article-content"></span>
<div>
<a-button v-if="hasHref" @click="jumpToHandlePage">前往办理<ArrowRightOutlined /></a-button>
</div>
2022-03-10 09:47:29 +08:00
</a-card>
</BasicModal>
</template>
<script lang="ts" setup>
2022-06-10 10:44:44 +08:00
import { BasicModal, useModalInner } from '/@/components/Modal';
import { propTypes } from '/@/utils/propTypes';
import { ArrowRightOutlined } from '@ant-design/icons-vue';
import { useRouter } from 'vue-router';
import xss from 'xss';
const router = useRouter();
2022-03-10 09:47:29 +08:00
import { ref, unref } from 'vue';
const isUpdate = ref(true);
const content = ref({});
//表单赋值
2022-06-10 10:44:44 +08:00
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
2022-03-10 09:47:29 +08:00
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
//data.record.msgContent = '<p>2323</p><input onmouseover=alert(1)>xss test';
//update-begin-author:taoyan date:2022-7-14 for: VUEN-1702 【禁止问题】sql注入漏洞
if (data.record.msgContent) {
data.record.msgContent = xss(data.record.msgContent);
}
//update-end-author:taoyan date:2022-7-14 for: VUEN-1702 【禁止问题】sql注入漏洞
2022-06-10 10:44:44 +08:00
content.value = data.record;
showHrefButton();
2022-03-10 09:47:29 +08:00
}
});
const hasHref = ref(false);
//查看消息详情可以跳转
function showHrefButton() {
if (content.value.busId) {
hasHref.value = true;
}
}
//跳转至办理页面
function jumpToHandlePage() {
let temp: any = content.value;
if (temp.busId) {
//这个busId是 任务ID
let jsonStr = temp.msgAbstract;
let query = {};
try {
if (jsonStr) {
let temp = JSON.parse(jsonStr);
if (temp) {
Object.keys(temp).map((k) => {
query[k] = temp[k];
});
}
}
} catch (e) {
console.log('参数解析异常', e);
}
console.log('query', query, jsonStr);
console.log('busId', temp.busId);
if (Object.keys(query).length > 0) {
// taskId taskDefKey procInsId
router.push({ path: '/task/handle/' + temp.busId, query: query });
} else {
router.push({ path: '/task/handle/' + temp.busId });
}
}
closeModal();
}
2022-03-10 09:47:29 +08:00
</script>
<style scoped lang="less">
.detail-iframe {
border: 0;
width: 100%;
height: 100%;
min-height: 600px;
}
</style>