lcw
This commit is contained in:
@ -3,30 +3,21 @@
|
||||
<div class="head_box">
|
||||
<span class="title">报告{{ title }} </span>
|
||||
<div>
|
||||
<el-button type="primary" size="small" :loading="loading" @click="submit" v-if="title!='详情'">保存</el-button>
|
||||
<el-button type="primary" size="small" :loading="loading" @click="submit" v-if="title != '详情'">保存</el-button>
|
||||
<el-button size="small" @click="close">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form_cnt">
|
||||
<FormMessage :formList="formData" :disabled="title=='详情'" v-model="listQuery" ref="elform" :rules="rules">
|
||||
<FormMessage :formList="formData" :disabled="title == '详情'" v-model="listQuery" ref="elform" :rules="rules">
|
||||
<template #fj><el-button type="primary" @click="showText = true">附件上传</el-button></template>
|
||||
</FormMessage>
|
||||
<div class="cntBox">
|
||||
<!-- 工具栏 -->
|
||||
<Toolbar
|
||||
style="border-bottom: 1px solid #ccc"
|
||||
:editor="editorRef"
|
||||
:defaultConfig="toolbarConfig"
|
||||
<Toolbar style="border-bottom: 1px solid #ccc" :editor="editorRef" :defaultConfig="toolbarConfig"
|
||||
:mode="mode" />
|
||||
<!-- 编辑器 -->
|
||||
<Editor
|
||||
:style="`height: 480px; overflow-y: hidden`"
|
||||
v-model="textContent"
|
||||
:defaultConfig="editorConfig"
|
||||
:mode="mode"
|
||||
@onCreated="handleCreated"
|
||||
@onChange="handChange"
|
||||
/>
|
||||
<Editor :style="`height: 480px; overflow-y: hidden`" v-model="textContent" :defaultConfig="editorConfig"
|
||||
:mode="mode" @onCreated="handleCreated" @onChange="handChange" />
|
||||
</div>
|
||||
<div v-if="listQuery.id" style="display: flex; justify-content: center;">
|
||||
<!-- <el-button style="display: block;" type="primary" @click="ConsultationShow = true">网上会商</el-button> -->
|
||||
@ -120,7 +111,7 @@ const title = ref("");
|
||||
// 初始化数据
|
||||
const init = (type, row) => {
|
||||
dialogForm.value = true;
|
||||
title.value = type == "add" ? "新增" :type == "edit"? "编辑" : "详情";
|
||||
title.value = type == "add" ? "新增" : type == "edit" ? "编辑" : "详情";
|
||||
|
||||
|
||||
if (row) {
|
||||
@ -132,8 +123,9 @@ const init = (type, row) => {
|
||||
};
|
||||
// 根据id查询详情
|
||||
const getDataById = (id) => {
|
||||
qcckGet({},'/mosty-gsxt/gsxtYpbg/'+id).then((res) => {
|
||||
qcckGet({}, '/mosty-gsxt/gsxtYpbg/' + id).then((res) => {
|
||||
listQuery.value = res || {};
|
||||
textContent.value = res.bgnr
|
||||
// /** @type {Array<JudgmentDept>} 参与研判部门数据数组 */
|
||||
// const cyypList = Array.isArray(res.cyypList) ? res.cyypList : []
|
||||
// listQuery.value.jsdxBmDm = cyypList.map(item => {
|
||||
@ -150,18 +142,18 @@ const getText = (val) => {
|
||||
setEditorTextContent()
|
||||
}
|
||||
|
||||
function stripReportHeader(html) {
|
||||
const source = typeof html === "string" ? html : "";
|
||||
if (!source) return "";
|
||||
const hrMatch = source.match(/<hr\b[^>]*\/?>/i);
|
||||
if (hrMatch && typeof hrMatch.index === "number") {
|
||||
return source.slice(hrMatch.index + hrMatch[0].length).trim();
|
||||
}
|
||||
if (typeof dataBt.value === "string" && source.startsWith(dataBt.value)) {
|
||||
return source.slice(dataBt.value.length).trim();
|
||||
}
|
||||
return source.trim();
|
||||
}
|
||||
// function stripReportHeader(html) {
|
||||
// const source = typeof html === "string" ? html : "";
|
||||
// if (!source) return "";
|
||||
// const hrMatch = source.match(/<hr\b[^>]*\/?>/i);
|
||||
// if (hrMatch && typeof hrMatch.index === "number") {
|
||||
// return source.slice(hrMatch.index + hrMatch[0].length).trim();
|
||||
// }
|
||||
// if (typeof dataBt.value === "string" && source.startsWith(dataBt.value)) {
|
||||
// return source.slice(dataBt.value.length).trim();
|
||||
// }
|
||||
// return source.trim();
|
||||
// }
|
||||
|
||||
function setEditorTextContent() {
|
||||
let html = dataBt.value;
|
||||
@ -172,11 +164,11 @@ function setEditorTextContent() {
|
||||
|
||||
// 提交
|
||||
const submit = () => {
|
||||
elform.value.submit( async (data) => {
|
||||
elform.value.submit(async (data) => {
|
||||
loading.value = true;
|
||||
const params = {
|
||||
...data,
|
||||
bgnr: stripReportHeader(textContent.value)
|
||||
bgnr: textContent.value
|
||||
};
|
||||
const apiFun = !listQuery.value.id ? gsxtYpbgAddEntity : gsxtYpbgEditEntity;
|
||||
if (!listQuery.value.id) delete params.id;
|
||||
@ -211,7 +203,7 @@ const close = () => {
|
||||
loading.value = false;
|
||||
dialogForm.value = false;
|
||||
listQuery.value = {}
|
||||
router.replace({ path: '/strategicResearchs' })// 移除id 避免刷新一直带参数
|
||||
router.replace({ path: '/strategicResearchs' })// 移除id 避免刷新一直带参数
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user