|
@@ -554,22 +554,19 @@ export default {
|
|
|
|
|
|
// 更新导出方法
|
|
// 更新导出方法
|
|
async exportDocumentWithHtmlDocx(template) {
|
|
async exportDocumentWithHtmlDocx(template) {
|
|
- /* console.log(template); */
|
|
|
|
- const res = await searchlistDocTemplate({
|
|
|
|
- /* page: 1,
|
|
|
|
- pageSize: 10, */
|
|
|
|
- project_id:this.currentData.id,
|
|
|
|
|
|
+ const res = await searchlistDocTemplate({
|
|
|
|
+ project_id: this.currentData.id,
|
|
id: template.id
|
|
id: template.id
|
|
})
|
|
})
|
|
- if(res.status!==200) return
|
|
|
|
|
|
+ if(res.status !== 200) return
|
|
let templateData
|
|
let templateData
|
|
try {
|
|
try {
|
|
- if(res.data.documents.length!==0){
|
|
|
|
- templateData = JSON.parse(res.data.documents[0].data || '[]')
|
|
|
|
- }else{
|
|
|
|
- const template_Data = await getDocumentInfo({id:template.id})
|
|
|
|
- if(template_Data.status!==200) return
|
|
|
|
- templateData = JSON.parse(template_Data.data.data || '[]')
|
|
|
|
|
|
+ if(res.data.documents.length !== 0) {
|
|
|
|
+ templateData = JSON.parse(res.data.documents[0].data || '[]')
|
|
|
|
+ } else {
|
|
|
|
+ const template_Data = await getDocumentInfo({id:template.id})
|
|
|
|
+ if(template_Data.status !== 200) return
|
|
|
|
+ templateData = JSON.parse(template_Data.data.data || '[]')
|
|
}
|
|
}
|
|
const contentContainer = document.createElement('div')
|
|
const contentContainer = document.createElement('div')
|
|
contentContainer.className = 'content'
|
|
contentContainer.className = 'content'
|
|
@@ -594,10 +591,44 @@ export default {
|
|
<w:View>Print</w:View>
|
|
<w:View>Print</w:View>
|
|
<w:Zoom>100</w:Zoom>
|
|
<w:Zoom>100</w:Zoom>
|
|
<w:DoNotOptimizeForBrowser/>
|
|
<w:DoNotOptimizeForBrowser/>
|
|
|
|
+ <w:SpaceForUL/>
|
|
|
|
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
|
|
</w:WordDocument>
|
|
</w:WordDocument>
|
|
</xml>
|
|
</xml>
|
|
<style>
|
|
<style>
|
|
- /* 基础表格样式 */
|
|
|
|
|
|
+ /* 基础样式 */
|
|
|
|
+ body {
|
|
|
|
+ font-family: "Times New Roman", SimSun;
|
|
|
|
+ line-height: 1.0; /* 单倍行距 */
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* 段落样式 */
|
|
|
|
+ p {
|
|
|
|
+ margin-top: 0.5em; /* 段前0.5行 */
|
|
|
|
+ margin-bottom: 0.5em; /* 段后0.5行 */
|
|
|
|
+ line-height: 1.0 !important; /* 强制单倍行距 */
|
|
|
|
+ mso-line-height-rule: exactly; /* Word特定的行距规则 */
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* 保持表格内容行距正常 */
|
|
|
|
+ table p {
|
|
|
|
+ margin: 0;
|
|
|
|
+ line-height: inherit;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* 列表样式 */
|
|
|
|
+ ul, ol {
|
|
|
|
+ margin-top: 0.5em;
|
|
|
|
+ margin-bottom: 0.5em;
|
|
|
|
+ line-height: 1.0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ li {
|
|
|
|
+ line-height: 1.0;
|
|
|
|
+ margin: 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* 保持原有表格样式 */
|
|
table {
|
|
table {
|
|
width: 100%;
|
|
width: 100%;
|
|
border-collapse: collapse !important;
|
|
border-collapse: collapse !important;
|
|
@@ -638,15 +669,6 @@ export default {
|
|
mso-tstyle-colband-size: 0;
|
|
mso-tstyle-colband-size: 0;
|
|
mso-padding-alt: 0cm 5.4pt 0cm 5.4pt;
|
|
mso-padding-alt: 0cm 5.4pt 0cm 5.4pt;
|
|
}
|
|
}
|
|
-
|
|
|
|
- /* 确保分页时边框正确显示 */
|
|
|
|
- tr {
|
|
|
|
- page-break-inside: avoid !important;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- td, th {
|
|
|
|
- page-break-inside: avoid !important;
|
|
|
|
- }
|
|
|
|
</style>
|
|
</style>
|
|
</head>
|
|
</head>
|
|
<body>
|
|
<body>
|