From b924a179def592e2afac226c3f025889a05ffa90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=9C=84?= Date: Mon, 29 Jan 2024 13:42:11 +0800 Subject: [PATCH] fix 81391 --- src/pages/page1/saicComponents/Init.vue | 203 +++--------------------- 1 file changed, 22 insertions(+), 181 deletions(-) diff --git a/src/pages/page1/saicComponents/Init.vue b/src/pages/page1/saicComponents/Init.vue index 7ddfa49..6af8789 100644 --- a/src/pages/page1/saicComponents/Init.vue +++ b/src/pages/page1/saicComponents/Init.vue @@ -220,10 +220,6 @@ export default { Asc.scope.issueDate = this.form.issueTime || 'xxxx-xx-xx' Asc.scope.impDate = this.form.putTime || 'xxxx-xx-xx' Asc.scope.standardNumberPrefix = this.form.standardNumberPrefix || 'X/XX' - // Asc.scope.that = {} - // Asc.scope.that.handleInitForeword = this.handleInitForeword() - // console.log(Asc.scope.that); - // console.log(window.Asc); window.Asc.plugin.callCommand(() => { try { const oDocument = Api.GetDocument() @@ -536,9 +532,9 @@ export default { console.log(e) } }) - setTimeout(() => { - // 初始化前言,带有福田内容的版本 - // this.handleInitForeword() + let timer = setTimeout(() => { + clearTimeout(timer) + timer = null // 初始化前言,只有前言标题的版本 this.initForeword() }, 500) @@ -811,170 +807,6 @@ export default { } }) }, - // 初始化前言 - handleInitForeword () { - window.Asc.scope.BORDER_DISABLE = BORDER_DISABLE - this.ctx.callCommand(() => { - try { - const oDocument = Api.GetDocument() - const AllContentControls = oDocument.GetAllContentControls() - let flag = false - for (let i = 0; i < AllContentControls.length; i++) { - if (AllContentControls[i].GetAlias() === 'foton.standardName') { - flag = true - break - } - } - if (flag) { - return - } - DE.controllers.Toolbar.api.put_AddPageBreak() - const oParagraph20 = Api.CreateParagraph() - oDocument.InsertContent([oParagraph20]) - // const oRunStandENName = Api.CreateRun(); - // oRunStandENName.AddText("前 言"); - // const oInlineLvlSdtStandCode = Api.CreateInlineLvlSdt(); - // oInlineLvlSdtStandCode.SetAlias("foton.preface"); - // oInlineLvlSdtStandCode.AddElement(oRunStandENName, 0); - const oParagraph2 = Api.CreateParagraph() - // oParagraph2.AddInlineLvlSdt(oInlineLvlSdtStandCode); - let oNewDocumentStyle = oDocument.GetStyle('Heading 1') - oParagraph2.SetStyle(oNewDocumentStyle) - oParagraph2.AddText('前 言') - oParagraph2.SetFontSize(32) - oParagraph2.SetSpacing(1.8) - // oParagraph2.SetPosition(-12); - oParagraph2.SetSpacingBefore(549) - oParagraph2.SetSpacingAfter(597) - oParagraph2.SetFontFamily('黑体') - oParagraph2.SetColor(0, 0, 0) - oParagraph2.SetJc('center') - oParagraph2.SetBold(false) - oDocument.InsertContent([oParagraph2]) - - for (let i = 0; i < 2; i++) { - let text = '' - switch (i) { - case 0: - text = ' 本文件按照GB/T 1.1-2020《标准化工作导则 第1部分:标准化文件的结构和起草规则》的规定起草。' - break - case 1: - text = ' 本文件代替代替Q/FT XXXX-2011《XXXXXX》,除结构调整和编辑性改动外,主要技术变化如下:' - break - } - const oParagraph3 = Api.CreateParagraph() - oParagraph3.AddText(text) - oParagraph3.SetFontSize(21) - oParagraph3.SetFontFamily('宋体') - oParagraph3.SetColor(0, 0, 0) - oParagraph3.SetSpacingAfter(0) - oParagraph3.SetBold(false) - oDocument.InsertContent([oParagraph3]) - } - for (let i = 0; i < 7; i++) { - let text = '' - switch (i) { - case 0: - text = '关于XXXX的试验方法修改为:XXXXXX(见X.X.X,2011版的X.XX);' - break - case 1: - text = '增加了 XXXXXXX(见X.X.X);' - break - case 2: - text = '修改了 XXXXXXX(见X.X.X);' - break - case 3: - text = '增加了 XXXXXXX(见X.X.X);' - break - case 4: - text = '删除了 XXXXXXX(见X.X.X,2011版的X.XX);' - break - case 5: - text = '在附录A中,删除了…….的资料性附录A“XXXXX”' - break - case 6: - text = '增加了资料性附录C“XXXXX”' - break - } - let oNumbering = oDocument.CreateNumbering('numbered') - const oNumLvl = oNumbering.GetLevel(0) - oNumLvl.SetCustomType('decimalZero', '——', 'right') - oNumLvl.SetSuff('tab') - var oParaPr = oNumLvl.GetParaPr() - oParaPr.SetSpacingLine(280, 'auto') - oParaPr.SetIndFirstLine(0) - const oParagraph3 = Api.CreateParagraph() - oParagraph3.AddText(text) - oParagraph3.SetNumbering(oNumLvl) - oParagraph3.SetFontSize(21) - oParagraph3.SetIndLeft(840) - oParagraph3.SetFontFamily('宋体') - oParagraph3.SetColor(0, 0, 0) - oParagraph3.SetSpacingAfter(0) - oParagraph3.SetBold(false) - oDocument.InsertContent([oParagraph3]) - } - for (let i = 0; i < 5; i++) { - let text = '' - switch (i) { - case 0: - text = ' 本文件不涉及专利。' - break - case 1: - text = ' 本文件由中国重型汽车集团有限公司工程研究总院标准法规部提出并归口。' - break - case 2: - text = ' 本文件主要起草单位:中国重型汽车集团有限公司XXXXXXX。' - break - case 3: - text = ' 本文件主要起草人:XXX、XX、……。' - break - case 4: - text = ' 本文件及其所代替版本历次发布情况:' - break - } - const oParagraph3 = Api.CreateParagraph() - oParagraph3.AddText(text) - oParagraph3.SetFontSize(21) - oParagraph3.SetFontFamily('宋体') - oParagraph3.SetColor(0, 0, 0) - oParagraph3.SetSpacingAfter(0) - oParagraph3.SetBold(false) - oDocument.InsertContent([oParagraph3]) - } - for (let i = 0; i < 1; i++) { - let text = '' - switch (i) { - case 0: - text = 'Q/FT XXXX-XXXX' - break - } - let oNumbering = oDocument.CreateNumbering('numbered') - const oNumLvl = oNumbering.GetLevel(0) - oNumLvl.SetCustomType('decimalZero', '——', 'right') - oNumLvl.SetSuff('tab') - var oParaPr = oNumLvl.GetParaPr() - oParaPr.SetSpacingLine(280, 'auto') - oParaPr.SetIndFirstLine(0) - const oParagraph3 = Api.CreateParagraph() - oParagraph3.AddText(text) - oParagraph3.SetNumbering(oNumLvl) - oParagraph3.SetFontSize(21) - oParagraph3.SetIndLeft(840) - oParagraph3.SetFontFamily('宋体') - oParagraph3.SetColor(0, 0, 0) - oParagraph3.SetSpacingAfter(0) - oParagraph3.SetBold(false) - oDocument.InsertContent([oParagraph3]) - } - } catch (e) { - console.log(e) - } - }) - setTimeout(() => { - this.handleInit() - }, 500) - }, /** * 初始化前言,仅包含前言两个字,下面的内容由客户选择创建 */ @@ -1014,7 +846,9 @@ export default { console.log(e) } }) - setTimeout(() => { + let timer = setTimeout(() => { + clearTimeout(timer) + timer = null this.initIntroduction() }, 500) }, @@ -1066,7 +900,9 @@ export default { console.log(e) } }) - setTimeout(() => { + let timer = setTimeout(() => { + clearTimeout(timer) + timer = null this.handleInit() }, 500) }, @@ -1287,7 +1123,9 @@ export default { console.log(e) } }) - setTimeout(() => { + let timer = setTimeout(() => { + clearTimeout(timer) + timer = null this.reorderSort() this.equationOne() this.replaceData() @@ -1307,12 +1145,13 @@ export default { }) }, replaceData () { - Asc.scope.standCode = this.form.standCode - Asc.scope.replaceStandCode = this.form.dtqbbhbuss - Asc.scope.standCNName = this.form.standName - Asc.scope.standENName = this.form.standEnName - Asc.scope.issueDate = this.form.issueTime - Asc.scope.impDate = this.form.putTime + Asc.scope.standCode = this.form.standCode || 'X/XX xxxx-xxxx' + Asc.scope.replaceStandCode = this.form.dtqbbhbuss || 'X/XX xxxx-xxxx' + Asc.scope.standCNName = this.form.standName || 'xx' + Asc.scope.standENName = this.form.standEnName || 'xx' + Asc.scope.issueDate = this.form.issueTime || 'xxxx-xx-xx' + Asc.scope.impDate = this.form.putTime || 'xxxx-xx-xx' + Asc.scope.standardNumberPrefix = this.form.standardNumberPrefix || 'X/XX' window.Asc.plugin.callCommand(() => { try { const oDocument = Api.GetDocument() @@ -2200,7 +2039,9 @@ export default { return obj } - setTimeout(() => { + let timer = setTimeout(() => { + clearTimeout(timer) + timer = null let documentCallbackUrl = window.Asc.plugin.info.documentCallbackUrl console.log(documentCallbackUrl) let query = param2Obj(documentCallbackUrl)