1.添加无题一

2.自定义编辑器自动换行
3.标题带出XXX名称
This commit is contained in:
范强强
2023-09-06 09:50:56 +08:00
parent b74f441e27
commit ba8c879dec
3 changed files with 267 additions and 262 deletions
+265 -261
View File
@@ -51,284 +51,288 @@
</div>
</template>
<script>
import Vue from 'vue'
import {SEPARATOR_TYPE} from '@/pages/page1/common/utils'
import InsertTableRow from './components/InsertTableRow.vue'
import InsertGuideText from './components/InsertGuideText.vue'
import FirstLevelListing from './components/FirstLevelListing.vue'
import AddFootnote from './components/AddFootnote.vue'
import InsertImage from './components/InsertImage.vue'
import HelloWorld from './components/HelloWorld.vue'
import Init from './saicComponents/Init'
import contentOne from './saicComponents/Content'
import SaicFunc from './saicComponents/SaicFunc'
import SaicTable from './saicComponents/SaicTable'
import SaicImg from './components/InsertImage'
import InsertNotes from './saicComponents/InsertNotes'
import SaicExample from './saicComponents/SaicExample'
import SaicFile from './saicComponents/SaicFile'
import RevisInformation from './saicComponents/RevisInformation'
import Appendix from './saicComponents/Appendix'
import chapterData from './saicComponents/chapterData'
import Chapter from './saicComponents/Chapter'
import _axios from '@/plugins/axios2'
import Vue from 'vue'
import {SEPARATOR_TYPE} from '@/pages/page1/common/utils'
import InsertTableRow from './components/InsertTableRow.vue'
import InsertGuideText from './components/InsertGuideText.vue'
import FirstLevelListing from './components/FirstLevelListing.vue'
import AddFootnote from './components/AddFootnote.vue'
import InsertImage from './components/InsertImage.vue'
import HelloWorld from './components/HelloWorld.vue'
import Init from './saicComponents/Init'
import contentOne from './saicComponents/Content'
import SaicFunc from './saicComponents/SaicFunc'
import SaicTable from './saicComponents/SaicTable'
import SaicImg from './components/InsertImage'
import InsertNotes from './saicComponents/InsertNotes'
import SaicExample from './saicComponents/SaicExample'
import SaicFile from './saicComponents/SaicFile'
import RevisInformation from './saicComponents/RevisInformation'
import Appendix from './saicComponents/Appendix'
import chapterData from './saicComponents/chapterData'
import Chapter from './saicComponents/Chapter'
import _axios from '@/plugins/axios2'
export default {
components: {
InsertTableRow,
InsertGuideText,
FirstLevelListing,
AddFootnote,
InsertImage,
HelloWorld,
Init,
contentOne,
SaicFunc,
SaicTable,
SaicImg,
InsertNotes,
SaicExample,
SaicFile,
RevisInformation,
Appendix,
chapterData,
Chapter
},
data() {
let Ps
function updateScroll() {
Ps.update()
}
return {
// SEPARATOR_TYPE,
data: [
{
title: '术语和定义',
list: [
'下列术语和定义适用于本文件。',
'......界定的术语和定义适用于本文件。',
'......界定的以及下列术语和定义适用于本文件。',
'本文件没有需要界定的术语和定义。'
],
separatorText: SEPARATOR_TYPE.STRIKETHROUGH
},
{
title: '符号、代号和缩略语',
list: [
'下列代号适用于本文件。',
'下列符号适用于本文件。',
'下列缩略语适用于本文件。',
'下列代号和缩略语适用于本文件。'
],
separatorText: SEPARATOR_TYPE.COLON
}
],
isDisplay: false,
num: 0
}
},
created() {
window.Asc.plugin.init = function () {
Vue.prototype.ctx = this
// console.log(this)
const container = document.getElementById('app')
// eslint-disable-next-line no-undef
Ps = new PerfectScrollbar(`#${container.id}`, {})
this.callCommand(() => {
try {
var oDocument = Api.GetDocument()
const oHeading1Style6 = oDocument.CreateStyle('Normal')
const oTextPr7 = oHeading1Style6.GetTextPr()
oTextPr7.SetFontFamily('宋体')
oTextPr7.SetColor(0, 0, 0)
oTextPr7.SetFontSize(21)
const oTextPr9 = oHeading1Style6.GetParaPr()
oTextPr9.SetSpacingAfter(10)
// var oHeading1Style = oDocument.CreateStyle("Heading 1");
// const oTextPr = oHeading1Style.GetTextPr();
// oTextPr.SetFontFamily("黑体");
// oTextPr.SetColor(0, 0, 0);
//
//
// var oHeading1Style1 = oDocument.CreateStyle("Heading 2");
// const oTextPr1 = oHeading1Style1.GetTextPr();
// oTextPr1.SetFontFamily("黑体");
// oTextPr1.SetColor(0, 0, 0);
//
//
// var oHeading1Style2 = oDocument.CreateStyle("Heading 3");
// const oTextPr2 = oHeading1Style2.GetTextPr();
// oTextPr2.SetFontFamily("黑体");
// oTextPr2.SetColor(0, 0, 0);
//
//
// var oHeading1Style3 = oDocument.CreateStyle("Heading 4");
// const oTextPr3 = oHeading1Style3.GetTextPr();
// oTextPr3.SetFontFamily("黑体");
// oTextPr3.SetColor(0, 0, 0);
//
//
// var oHeading1Style4 = oDocument.CreateStyle("Heading 5");
// const oTextPr4 = oHeading1Style4.GetTextPr();
// oTextPr4.SetFontFamily("黑体");
// oTextPr4.SetColor(0, 0, 0);
//
// var oHeading1Style5 = oDocument.CreateStyle("Heading 6");
// const oTextPr5 = oHeading1Style5.GetTextPr();
// oTextPr5.SetFontFamily("黑体");
// oTextPr5.SetColor(0, 0, 0);
var oNormalStyle = oDocument.GetDefaultStyle('numbering')
const oTextPr6 = oNormalStyle.GetTextPr()
oTextPr6.SetFontFamily('黑体')
const oParagraph = Api.CreateParagraph()
oParagraph.SetStyle(oNormalStyle)
Api.HeadersAndFooters_DifferentOddandEvenPage(true)
// Api.HeadersAndFooters_DifferentFirstPage(true)
} catch (e) {
console.log('init err:', e)
}
})
}
window.addEventListener('message', (e) => {
// console.log(e)
}, false)
window.Asc.plugin.button = function (id) {
// console.log('wx2', id)
if (id === -1) this.executeCommand('close', '')
}
},
methods: {
param2Obj(url) {
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
if (!search) {
return {}
}
const obj = {}
const searchArr = search.split('&')
searchArr.forEach(v => {
const index = v.indexOf('=')
if (index !== -1) {
const name = v.substring(0, index)
let val = v.substring(index + 1, v.length)
if (val == 'undefined' || !val) {
val = ''
}
obj[name] = val
}
})
return obj
export default {
components: {
InsertTableRow,
InsertGuideText,
FirstLevelListing,
AddFootnote,
InsertImage,
HelloWorld,
Init,
contentOne,
SaicFunc,
SaicTable,
SaicImg,
InsertNotes,
SaicExample,
SaicFile,
RevisInformation,
Appendix,
chapterData,
Chapter
},
save() {
data() {
let Ps
let documentCallbackUrl = window.Asc.plugin.info.documentCallbackUrl
let query = this.param2Obj(documentCallbackUrl)
let formData = (data) => {
let _formData = new FormData()
for (let i in data) {
_formData.append(i, data[i])
}
return _formData
function updateScroll() {
Ps.update()
}
this.num = 10
this.isDisplay = true
_axios({
url: 'api/lawss/activiti/recieveFile',
method: 'post',
data: formData(query)
}).then(res => {
}).catch(e => {
})
this.setIntervalOne = setInterval(() => {
this.num--
if (this.num == 0) {
clearInterval(this.setIntervalOne)
this.isDisplay = false
return {
// SEPARATOR_TYPE,
data: [
{
title: '术语和定义',
list: [
'下列术语和定义适用于本文件。',
'......界定的术语和定义适用于本文件。',
'......界定的以及下列术语和定义适用于本文件。',
'本文件没有需要界定的术语和定义。'
],
separatorText: SEPARATOR_TYPE.STRIKETHROUGH
},
{
title: '符号、代号和缩略语',
list: [
'下列代号适用于本文件。',
'下列符号适用于本文件。',
'下列缩略语适用于本文件。',
'下列代号和缩略语适用于本文件。'
],
separatorText: SEPARATOR_TYPE.COLON
}
],
isDisplay: false,
num: 0
}
},
created() {
window.Asc.plugin.init = function () {
Vue.prototype.ctx = this
// console.log(this)
const container = document.getElementById('app')
// eslint-disable-next-line no-undef
Ps = new PerfectScrollbar(`#${container.id}`, {})
this.callCommand(() => {
try {
var oDocument = Api.GetDocument()
const oHeading1Style6 = oDocument.CreateStyle('Normal')
const oTextPr7 = oHeading1Style6.GetTextPr()
oTextPr7.SetFontFamily('宋体')
oTextPr7.SetColor(0, 0, 0)
oTextPr7.SetFontSize(21)
const oTextPr9 = oHeading1Style6.GetParaPr()
oTextPr9.SetSpacingAfter(10)
// var oHeading1Style = oDocument.CreateStyle("Heading 1");
// const oTextPr = oHeading1Style.GetTextPr();
// oTextPr.SetFontFamily("黑体");
// oTextPr.SetColor(0, 0, 0);
//
//
// var oHeading1Style1 = oDocument.CreateStyle("Heading 2");
// const oTextPr1 = oHeading1Style1.GetTextPr();
// oTextPr1.SetFontFamily("黑体");
// oTextPr1.SetColor(0, 0, 0);
//
//
// var oHeading1Style2 = oDocument.CreateStyle("Heading 3");
// const oTextPr2 = oHeading1Style2.GetTextPr();
// oTextPr2.SetFontFamily("黑体");
// oTextPr2.SetColor(0, 0, 0);
//
//
// var oHeading1Style3 = oDocument.CreateStyle("Heading 4");
// const oTextPr3 = oHeading1Style3.GetTextPr();
// oTextPr3.SetFontFamily("黑体");
// oTextPr3.SetColor(0, 0, 0);
//
//
// var oHeading1Style4 = oDocument.CreateStyle("Heading 5");
// const oTextPr4 = oHeading1Style4.GetTextPr();
// oTextPr4.SetFontFamily("黑体");
// oTextPr4.SetColor(0, 0, 0);
//
// var oHeading1Style5 = oDocument.CreateStyle("Heading 6");
// const oTextPr5 = oHeading1Style5.GetTextPr();
// oTextPr5.SetFontFamily("黑体");
// oTextPr5.SetColor(0, 0, 0);
var oNormalStyle = oDocument.GetDefaultStyle('numbering')
const oTextPr6 = oNormalStyle.GetTextPr()
oTextPr6.SetFontFamily('黑体')
const oParagraph = Api.CreateParagraph()
oParagraph.SetStyle(oNormalStyle)
Api.HeadersAndFooters_DifferentOddandEvenPage(true)
// Api.HeadersAndFooters_DifferentFirstPage(true)
} catch (e) {
console.log('init err:', e)
}
})
}
window.addEventListener('message', (e) => {
// console.log(e)
}, false)
window.Asc.plugin.button = function (id) {
// console.log('wx2', id)
if (id === -1) this.executeCommand('close', '')
}
},
methods: {
param2Obj(url) {
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
if (!search) {
return {}
}
}, 1000)
const obj = {}
const searchArr = search.split('&')
searchArr.forEach(v => {
const index = v.indexOf('=')
if (index !== -1) {
const name = v.substring(0, index)
let val = v.substring(index + 1, v.length)
if (val == 'undefined' || !val) {
val = ''
}
obj[name] = val
}
})
return obj
},
save() {
let documentCallbackUrl = window.Asc.plugin.info.documentCallbackUrl
let query = this.param2Obj(documentCallbackUrl)
let formData = (data) => {
let _formData = new FormData()
for (let i in data) {
_formData.append(i, data[i])
}
return _formData
}
this.num = 10
this.isDisplay = true
_axios({
url: 'api/lawss/activiti/recieveFile',
method: 'post',
data: formData(query)
}).then(res => {
}).catch(e => {
})
this.setIntervalOne = setInterval(() => {
this.num--
if (this.num == 0) {
clearInterval(this.setIntervalOne)
this.isDisplay = false
}
}, 1000)
}
}
}
}
</script>
<style lang="less">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: left;
color: #2c3e50;
padding: 10px;
}
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: left;
color: #2c3e50;
padding: 10px;
}
#app {
height: 100%;
overflow: hidden;
}
#app {
height: 100%;
overflow: auto;
}
* {
user-select: none;
}
* {
user-select: none;
}
h1, h2, h3, h4, h5 {
color: rgba(0, 0, 0, .85);
font-weight: 500;
}
h1, h2, h3, h4, h5 {
color: rgba(0, 0, 0, .85);
font-weight: 500;
}
body {
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC,
Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif,
Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
font-variant: tabular-nums;
}
body {
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC,
Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif,
Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
font-variant: tabular-nums;
}
.ant-btn-group {
display: block!important;
}
</style>
<style scoped>
.ant-drawer-index {
width: 210px;
height: 40px;
text-align: center;
line-height: 40px;
background: #000;
color: #fff;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 6px;
z-index: 10;
}
.ant-drawer-index {
width: 210px;
height: 40px;
text-align: center;
line-height: 40px;
background: #000;
color: #fff;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 6px;
z-index: 10;
}
.ant-drawer-text {
width: 10px;
display: inline-block;
color: #ffff00;
}
.ant-drawer-text {
width: 10px;
display: inline-block;
color: #ffff00;
}
.app-header {
width: 100%;
height: 46px;
position: fixed;
left: 0;
top: 0;
padding-left: 10px;
line-height: 46px;
text-align: left;
background: #f1f1f1;
z-index: 100;
border-bottom: 1px #e8e8e8 solid;
}
.app-header {
width: 100%;
height: 46px;
position: fixed;
left: 0;
top: 0;
padding-left: 10px;
line-height: 46px;
text-align: left;
background: #f1f1f1;
z-index: 100;
border-bottom: 1px #e8e8e8 solid;
}
.app-header-button {
background: #66b1ff;
border-color: #66b1ff;
color: #FFF;
}
.app-header-button {
background: #66b1ff;
border-color: #66b1ff;
color: #FFF;
}
</style>
@@ -602,6 +602,7 @@
oParagraph.SetFontFamily("黑体");
oParagraph.SetSpacingAfter(33,false)
oParagraph.SetNumbering(oNumLvl);
oParagraph.AddText('XXX')
oDocument.InsertContent([oParagraph])
let GetNext = oParagraph.GetNext()
GetNext.Delete()
@@ -34,7 +34,7 @@
<!-- </a-dropdown>-->
</a-button-group>
<a-button-group style="margin-bottom: 10px">
<!-- <a-button @click="insertBarOne(1,false)">无题一</a-button>-->
<a-button @click="insertBarOne(1,false)">无题一</a-button>
<a-button @click="insertBarOne(2,false)">无题二</a-button>
<a-button @click="insertBarOne(3,false)">无题三</a-button>
<a-button @click="insertBarOne(4,false)">无题四</a-button>