|
@@ -205,7 +205,7 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
- <div class="event-media" v-if="form.imgList.length">
|
|
|
+ <div class="event-media" v-if="form.imgList && form.imgList.length">
|
|
|
<div class="event-media-title">现场画面</div>
|
|
|
<div class="event-media-content">
|
|
|
<div class="imgs">
|
|
@@ -213,7 +213,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="event-media" v-if="form.videoList.length" style="margin-top: 10px">
|
|
|
+ <div class="event-media" v-if="form.videoList && form.videoList.length" style="margin-top: 10px">
|
|
|
<div class="event-media-title">现场视频</div>
|
|
|
<div class="event-media-content">
|
|
|
<div class="videos">
|
|
@@ -296,9 +296,10 @@ import DPlayer from 'dplayer';
|
|
|
import '@wangeditor/editor/dist/css/style.css'; // 引入 css
|
|
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
|
|
|
import { downloadFile } from '@/utils/download.js';
|
|
|
-import { listEvent, generateReport, updateEvent } from '@/api/system/event';
|
|
|
+import { listEvent, generateReport, updateEvent, getEvent } from '@/api/system/event';
|
|
|
import { dateFormat } from '@/utils/index';
|
|
|
import { ElLoading } from 'element-plus';
|
|
|
+import { base64Encoded, base64Decoded } from '@/utils/crypto';
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const bdmap = ref(null);
|
|
|
const downLoading = ref(false);
|
|
@@ -670,23 +671,40 @@ const showMarks = () => {
|
|
|
});
|
|
|
};
|
|
|
const showDetails = (row) => {
|
|
|
- dialog.visible = true;
|
|
|
- let imgList = [];
|
|
|
- let videoList = [];
|
|
|
- if (row.ext1 && row.ext1.length) {
|
|
|
- videoList = row.ext1.filter((item) => item.includes('mp4')).map((item) => `${import.meta.env.VITE_APP_BASE_HOST}/api/oss/local/upload/${item}`);
|
|
|
- imgList = row.ext1.filter((item) => !item.includes('mp4')).map((item) => `${import.meta.env.VITE_APP_BASE_HOST}/api/oss/local/upload/${item}`);
|
|
|
- }
|
|
|
- Object.assign(form.value, JSON.parse(JSON.stringify(row)), { imgList, videoList });
|
|
|
- nextTick(() => {
|
|
|
- form.value.videoList.forEach((item, index) => {
|
|
|
- new DPlayer({
|
|
|
- container: document.getElementById(`dplayer${index}`),
|
|
|
- video: {
|
|
|
- url: item
|
|
|
- }
|
|
|
+ getEvent(row.id).then(({ code, data }) => {
|
|
|
+ if (code === 200) {
|
|
|
+ data.ext1 = JSON.parse(data.ext1) || [];
|
|
|
+ data.ext2 = JSON.parse(data.ext2) || {};
|
|
|
+ data.status = data.status || '2';
|
|
|
+ let imgList = [];
|
|
|
+ let videoList = [];
|
|
|
+ if (data.ext1.length) {
|
|
|
+ videoList = data.ext1
|
|
|
+ .filter((item) => item.includes('mp4'))
|
|
|
+ .map((item) => `${import.meta.env.VITE_APP_BASE_HOST}/api/oss/local/upload/${item}`);
|
|
|
+ imgList = data.ext1
|
|
|
+ .filter((item) => !item.includes('mp4'))
|
|
|
+ .map((item) => `${import.meta.env.VITE_APP_BASE_HOST}/api/oss/local/upload/${item}`);
|
|
|
+ }
|
|
|
+ form.value = data;
|
|
|
+ Object.assign(form.value, { imgList, videoList });
|
|
|
+ dialog.visible = true;
|
|
|
+ nextTick(() => {
|
|
|
+ form.value.videoList.forEach((item, index) => {
|
|
|
+ new DPlayer({
|
|
|
+ container: document.getElementById(`dplayer${index}`),
|
|
|
+ video: {
|
|
|
+ url: item
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
+ const { content, ext2 } = form.value;
|
|
|
+ if (content) {
|
|
|
+ showReport.value = true;
|
|
|
+ dealReportData(base64Decoded(content), ext2.reportTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -703,20 +721,32 @@ const generateClick = () => {
|
|
|
if (code == 200 && msg) {
|
|
|
showReport.value = true;
|
|
|
const { report, time } = JSON.parse(msg).data.outputs;
|
|
|
- const res = await proxy?.getConfigKey('report_seq');
|
|
|
- reportSeq.value = Number(res.data);
|
|
|
- valueHtml.value = report.replace(/```/g, '').replace(/html\n/, '');
|
|
|
- const [year, month, day] = time.split(' ')[0].split('-');
|
|
|
- reportForm.year = year;
|
|
|
- reportForm.month = month;
|
|
|
- reportForm.day = day;
|
|
|
- reportForm.seq = reportSeq.value;
|
|
|
+ const reportHtml = report.replace(/```/g, '').replace(/html\n/, '');
|
|
|
+ updateEvent({
|
|
|
+ id: form.value.id,
|
|
|
+ content: base64Encoded(reportHtml),
|
|
|
+ ext2: JSON.stringify({
|
|
|
+ ...form.value.ext2,
|
|
|
+ reportTime: time
|
|
|
+ })
|
|
|
+ });
|
|
|
+ dealReportData(reportHtml, time);
|
|
|
proxy?.$modal.msgSuccess('报告生成成功');
|
|
|
} else {
|
|
|
proxy?.$modal.msgError('报告生成失败');
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
+const dealReportData = async (reportHtml, time) => {
|
|
|
+ const res = await proxy?.getConfigKey('report_seq');
|
|
|
+ reportSeq.value = Number(res.data);
|
|
|
+ valueHtml.value = reportHtml;
|
|
|
+ const [year, month, day] = time.split(' ')[0].split('-');
|
|
|
+ reportForm.year = year;
|
|
|
+ reportForm.month = month;
|
|
|
+ reportForm.day = day;
|
|
|
+ reportForm.seq = reportSeq.value;
|
|
|
+};
|
|
|
const extractTitleAndContents = (htmlString) => {
|
|
|
// 提取标题(从 <h2><strong> 中获取)
|
|
|
const titleMatch = htmlString.match(/<h2[^>]*>.*?<strong>(.*?)<\/strong>.*?<\/h2>/is);
|