[add] init
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
[*.{js,jsx,ts,tsx,vue}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
max_line_length = 100
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
NODE_ENV=development
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
NODE_ENV=production
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/dist
|
||||||
|
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
/onlyofficeplugins/
|
||||||
@@ -1,92 +1,26 @@
|
|||||||
# plugins_vue
|
# plugins_vue
|
||||||
|
|
||||||
|
onlyoffice自定义插件
|
||||||
|
|
||||||
|
## Project setup
|
||||||
## Getting started
|
|
||||||
|
|
||||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
||||||
|
|
||||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
||||||
|
|
||||||
## Add your files
|
|
||||||
|
|
||||||
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
|
||||||
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cd existing_repo
|
npm install
|
||||||
git remote add origin http://10.10.10.43:19090/laws-chery/plugins_vue.git
|
|
||||||
git branch -M master
|
|
||||||
git push -uf origin master
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Integrate with your tools
|
### Compiles and hot-reloads for development
|
||||||
|
```
|
||||||
|
npm run serve
|
||||||
|
```
|
||||||
|
|
||||||
- [ ] [Set up project integrations](http://10.10.10.43:19090/laws-chery/plugins_vue/-/settings/integrations)
|
### Compiles and minifies for production
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
## Collaborate with your team
|
### Lints and fixes files
|
||||||
|
```
|
||||||
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
### Customize configuration
|
||||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
|
||||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
|
||||||
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
|
||||||
|
|
||||||
## Test and Deploy
|
|
||||||
|
|
||||||
Use the built-in continuous integration in GitLab.
|
|
||||||
|
|
||||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
|
||||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
|
||||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
|
||||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
|
||||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
# Editing this README
|
|
||||||
|
|
||||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
||||||
|
|
||||||
## Suggestions for a good README
|
|
||||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
||||||
|
|
||||||
## Name
|
|
||||||
Choose a self-explaining name for your project.
|
|
||||||
|
|
||||||
## Description
|
|
||||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
||||||
|
|
||||||
## Badges
|
|
||||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
||||||
|
|
||||||
## Visuals
|
|
||||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
||||||
|
|
||||||
## Support
|
|
||||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
||||||
|
|
||||||
## Roadmap
|
|
||||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
State if you are open to contributions and what your requirements are for accepting them.
|
|
||||||
|
|
||||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
||||||
|
|
||||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
||||||
|
|
||||||
## Authors and acknowledgment
|
|
||||||
Show your appreciation to those who have contributed to the project.
|
|
||||||
|
|
||||||
## License
|
|
||||||
For open source projects, say how it is licensed.
|
|
||||||
|
|
||||||
## Project status
|
|
||||||
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
'@vue/cli-plugin-babel/preset',
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
[
|
||||||
|
'import',
|
||||||
|
{ libraryName: 'ant-design-vue', libraryDirectory: 'es', style: true }
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es6",
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
Generated
+13072
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"name": "plugins_vue",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"serve": "vue-cli-service serve",
|
||||||
|
"build": "vue-cli-service build",
|
||||||
|
"build:test": "vue-cli-service build --mode test"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ant-design-vue": "^1.7.5",
|
||||||
|
"axios": "^0.18.1",
|
||||||
|
"core-js": "^3.6.5",
|
||||||
|
"element-ui": "^2.15.6",
|
||||||
|
"glob": "^7.1.7",
|
||||||
|
"moment": "^2.29.1",
|
||||||
|
"vue": "^2.6.11",
|
||||||
|
"vue-router": "^3.2.0",
|
||||||
|
"vuex": "^3.6.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vue/cli-plugin-babel": "~4.5.0",
|
||||||
|
"@vue/cli-plugin-router": "~4.5.0",
|
||||||
|
"@vue/cli-service": "~4.5.0",
|
||||||
|
"babel-plugin-import": "^1.13.3",
|
||||||
|
"copy-webpack-plugin": "^5.1.2",
|
||||||
|
"less": "^3.0.4",
|
||||||
|
"less-loader": "^5.0.0",
|
||||||
|
"vue-cli-plugin-axios": "~0.0.4",
|
||||||
|
"vue-template-compiler": "^2.6.11"
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions",
|
||||||
|
"not dead"
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
|||||||
|
window._CONFIG = {}
|
||||||
|
// 后端地址
|
||||||
|
window._CONFIG.interfaceUrl = 'http://10.0.10.87:8184'
|
||||||
|
// 后端地址
|
||||||
|
window._CONFIG.downloadUrl = 'http://10.0.10.87:8184'
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,34 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
|
<script type="text/javascript" src="<%= BASE_URL %>v1/plugins.js"></script>
|
||||||
|
<script type="text/javascript" src="<%= BASE_URL %>v1/plugins-ui.js"></script>
|
||||||
|
<link rel="stylesheet" href="<%= BASE_URL %>v1/plugins.css">
|
||||||
|
<!-- 全局配置 -->
|
||||||
|
<!--开发环境-->
|
||||||
|
<% if (process.env.NODE_ENV === 'development' ) { %>
|
||||||
|
<script src="<%= BASE_URL %>dev_api_config.js"></script>
|
||||||
|
<% } %>
|
||||||
|
<!--生产环境-->
|
||||||
|
<% if (process.env.NODE_ENV === 'production' ) { %>
|
||||||
|
<script src="<%= BASE_URL %>prod_api_config.js"></script>
|
||||||
|
<% } %>
|
||||||
|
<!--测试环境-->
|
||||||
|
<% if (process.env.NODE_ENV === 'test' ) { %>
|
||||||
|
<script src="<%= BASE_URL %>test_api_config.js"></script>
|
||||||
|
<% } %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
|
||||||
|
Please enable it to continue.</strong>
|
||||||
|
</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<!-- built files will be auto injected -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
|||||||
|
window._CONFIG = {}
|
||||||
|
// 后端地址
|
||||||
|
window._CONFIG.interfaceUrl = 'http://srms-test.sinotruk.com'
|
||||||
|
// 后端地址
|
||||||
|
window._CONFIG.downloadUrl = 'http://laws-sinotruk-server-kmc2c.yf-grp:8080'
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"standSort": "Q/FT",
|
||||||
|
"standCode": "Q/FT A001-2020",
|
||||||
|
"replaceStandCode": "",
|
||||||
|
"standCNName": "汽车产品车门内饰板技术条件",
|
||||||
|
"standENName": "Technical requirements for door interior panels for automotive products",
|
||||||
|
"version": "草稿",
|
||||||
|
"issueDate": "2020-12-31",
|
||||||
|
"impDate": "2021-07-01",
|
||||||
|
"primaryDrafter": "孟霞龙",
|
||||||
|
"drafterDeptName": "工程质量部"
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
window._CONFIG = {}
|
||||||
|
// 后端地址
|
||||||
|
window._CONFIG.interfaceUrl = 'http://10.10.10.46:9901'
|
||||||
|
// 后端地址
|
||||||
|
window._CONFIG.downloadUrl = 'http://10.10.10.46:9901'
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -0,0 +1,595 @@
|
|||||||
|
body {
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* button */
|
||||||
|
|
||||||
|
.btn-text-default {
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #cfcfcf;
|
||||||
|
border-radius: 2px;
|
||||||
|
color: #444444;
|
||||||
|
font-size: 11px;
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
height: 22px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default::-moz-focus-inner {
|
||||||
|
border: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default.submit {
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #d8dadc;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default.submit.primary {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #7d858c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default:focus {
|
||||||
|
outline: 0;
|
||||||
|
outline-offset: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default:hover {
|
||||||
|
background-color: #d8dadc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default.submit:hover {
|
||||||
|
background-color: #cbced1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default.primary:hover {
|
||||||
|
background-color: #666d73 !important;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default:active,
|
||||||
|
.btn-text-default.active {
|
||||||
|
background-color: #7d858c !important;
|
||||||
|
color: white;
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default[disabled]:hover,
|
||||||
|
.btn-text-default.disabled:hover,
|
||||||
|
.btn-text-default[disabled]:active,
|
||||||
|
.btn-text-default[disabled].active,
|
||||||
|
.btn-text-default.disabled:active,
|
||||||
|
.btn-text-default.disabled.active {
|
||||||
|
background-color: #fff !important;
|
||||||
|
color: #444444;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text-default[disabled],
|
||||||
|
.btn-text-default.disabled {
|
||||||
|
opacity: 0.65;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit {
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGZSURBVHgBfZI/y4FRGMavx7+SRQaTTQab74CVlBKL/FukDGQhEgsDNh/Apiw+gcXm70DJoEikKMUk7vec8/Yi75O7Tj2d+/4913Wuc6Tz+UyQqev1itvtBr1e/6+nkgP2+z0qlYr4DgaDsNls36HtdotisYhoNAqLxYJyuSz230HFO7DZbISC0+lEp9OBRqNBLpdDq9XCeDx+DfIz8TWZTIhZodFoRMvlknw+H8XjcdrtdrRarYgpU6/XE7MC4oMc4OB8Pie/30/ZbJba7TYlk0k6HA4CDIVCxNyQYrFYoNFoIJ1OQ5Ik5PN5WK1WpFIprNdr8H61WhVn5X2VisXg8XhoNpvRYDAgt9tNbICOxyOVSiVyuVzU7/epXq9TIBAQtrkzxeVygclkQrfbhd1uRzgcRq1Ww3A4FKparRbspyJRo9H4G4TD4RD06XQS3pkt8nq9NJ1OiSVGsVjsqfC3nvekVCrxeDxgMBgQiUTEa2g2m8hkMi8FuXtSq9VIJBK43+8iHB7GJ8BL4vY+N3U6HQqFAsxmM+TqB5Je/SVNoN18AAAAAElFTkSuQmCC');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* input, textarea */
|
||||||
|
|
||||||
|
.form-control {
|
||||||
|
border: 1px solid #cfcfcf;
|
||||||
|
border-radius: 2px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #444444;
|
||||||
|
font-size: 11px;
|
||||||
|
height: 22px;
|
||||||
|
padding: 1px 3px;
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
-webkit-user-select: text;
|
||||||
|
-moz-user-select: text;
|
||||||
|
-ms-user-select: text;
|
||||||
|
user-select: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control:focus {
|
||||||
|
border-color: #848484;
|
||||||
|
outline: 0;
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control[readonly] {
|
||||||
|
background-color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control[disabled] {
|
||||||
|
background-color: #fff;
|
||||||
|
cursor: default;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
opacity: 0.65;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea.form-control {
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='checkbox'].form-control {
|
||||||
|
height: auto;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@supports(-webkit-appearance: none) or (-moz-appearance: none) {
|
||||||
|
input[type='checkbox'].form-control {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #cfcfcf;
|
||||||
|
border-radius: 2px;
|
||||||
|
padding: 0;
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='checkbox'].form-control:checked:after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
border: solid #444444;
|
||||||
|
border-width: 0 2px 2px 0;
|
||||||
|
transform: rotate(45deg);
|
||||||
|
width: 3px;
|
||||||
|
height: 7px;
|
||||||
|
left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='checkbox'].form-control:disabled {
|
||||||
|
opacity: .5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* label */
|
||||||
|
|
||||||
|
label.link {
|
||||||
|
border-bottom: 1px dotted #aaa;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
label.for-combo {
|
||||||
|
height: 22px;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label.header {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* comments */
|
||||||
|
|
||||||
|
.user-comment-item {
|
||||||
|
padding: 5px 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .main-actions{
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .form-control.user-check {
|
||||||
|
margin-right: 5px;
|
||||||
|
flex-grow: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .user-name {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-weight: bold;
|
||||||
|
max-width: 40%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .user-message {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-grow: 1;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .btn-edit {
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
margin-left: 5px;
|
||||||
|
flex-grow: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGZSURBVHgBfZI/y4FRGMavx7+SRQaTTQab74CVlBKL/FukDGQhEgsDNh/Apiw+gcXm70DJoEikKMUk7vec8/Yi75O7Tj2d+/4913Wuc6Tz+UyQqev1itvtBr1e/6+nkgP2+z0qlYr4DgaDsNls36HtdotisYhoNAqLxYJyuSz230HFO7DZbISC0+lEp9OBRqNBLpdDq9XCeDx+DfIz8TWZTIhZodFoRMvlknw+H8XjcdrtdrRarYgpU6/XE7MC4oMc4OB8Pie/30/ZbJba7TYlk0k6HA4CDIVCxNyQYrFYoNFoIJ1OQ5Ik5PN5WK1WpFIprNdr8H61WhVn5X2VisXg8XhoNpvRYDAgt9tNbICOxyOVSiVyuVzU7/epXq9TIBAQtrkzxeVygclkQrfbhd1uRzgcRq1Ww3A4FKparRbspyJRo9H4G4TD4RD06XQS3pkt8nq9NJ1OiSVGsVjsqfC3nvekVCrxeDxgMBgQiUTEa2g2m8hkMi8FuXtSq9VIJBK43+8iHB7GJ8BL4vY+N3U6HQqFAsxmM+TqB5Je/SVNoN18AAAAAElFTkSuQmCC');
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .reply-actions,
|
||||||
|
.user-comment-item .comment-edit {
|
||||||
|
padding-left: 18px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .reply-view {
|
||||||
|
padding-left: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .reply-view .comment-edit{
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .msg-edit {
|
||||||
|
width: 100%;
|
||||||
|
height: 45px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .reply-accept {
|
||||||
|
margin-bottom: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-comment-item .reply-accept label,
|
||||||
|
.user-comment-item .reply-accept .user-check {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* common styles */
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.separator.horizontal {
|
||||||
|
width: 100%;
|
||||||
|
height: 0;
|
||||||
|
border-left: none;
|
||||||
|
border-right: none;
|
||||||
|
border-top: 1px solid #cbcbcb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.defaultlable {
|
||||||
|
color: #444444;
|
||||||
|
cursor: default;
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: normal;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.defaultcenterlable {
|
||||||
|
color: #444444;
|
||||||
|
cursor: default;
|
||||||
|
text-align: center;
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.aboutlable {
|
||||||
|
color: #444444;
|
||||||
|
cursor: default;
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: normal;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.aboutlink {
|
||||||
|
color: #444444;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.aboutlink:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
a.aboutlink:active {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.noselect{
|
||||||
|
-khtml-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-dropdown,
|
||||||
|
.select2-container--default .select2-selection--single {
|
||||||
|
border: 1px solid #cfcfcf !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default.select2-container--open .select2-selection--single,
|
||||||
|
.select2-container--default.select2-container--focus:not(.select2-container--disabled) .select2-selection--single{
|
||||||
|
border-color: #848484 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container .select2-selection--single .select2-selection__rendered,
|
||||||
|
.select2-results__options {
|
||||||
|
font-size: 11px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||||
|
line-height: 20px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-results__option[aria-selected=true] {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-selection--single .select2-selection__arrow b{
|
||||||
|
width: 4px !important;
|
||||||
|
height: 4px !important;
|
||||||
|
margin: -1px 1px !important;
|
||||||
|
border: solid 1px #444 !important;
|
||||||
|
border-bottom: none !important;
|
||||||
|
border-right: none !important;
|
||||||
|
background-image: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
transform: rotate(-135deg) translate(1px,1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default.select2-container--open .select2-selection__arrow b{
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||||
|
outline: none;
|
||||||
|
border-color: #cfcfcf;
|
||||||
|
border-radius: 2px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
||||||
|
background-color: #d8dadc !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-results__option--highlighted[aria-selected=true] {
|
||||||
|
background-color: #7d858c !important;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Container style
|
||||||
|
*/
|
||||||
|
.ps {
|
||||||
|
overflow: hidden !important;
|
||||||
|
overflow-anchor: none;
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
touch-action: auto;
|
||||||
|
-ms-touch-action: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Scrollbar rail styles
|
||||||
|
*/
|
||||||
|
.ps__rail-x {
|
||||||
|
display: none;
|
||||||
|
bottom: 2px; /* there must be 'right' for ps-scrollbar-y-rail */
|
||||||
|
height: 9px;
|
||||||
|
margin: 0 2px 0 2px;
|
||||||
|
/* please don't change 'position' */
|
||||||
|
position: absolute;
|
||||||
|
-webkit-border-radius: 2px;
|
||||||
|
-moz-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
transition: background-color .2s linear, opacity .2s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ps__rail-y {
|
||||||
|
display: none;
|
||||||
|
right: 2px; /* there must be 'right' for ps-scrollbar-y-rail */
|
||||||
|
width: 9px;
|
||||||
|
margin: 2px 0 2px 0;
|
||||||
|
/* please don't change 'position' */
|
||||||
|
position: absolute;
|
||||||
|
-webkit-border-radius: 2px;
|
||||||
|
-moz-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
transition: background-color .2s linear, opacity .2s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ps--active-x > .ps__rail-x,
|
||||||
|
.ps--active-y > .ps__rail-y {
|
||||||
|
display: block;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ps .ps__rail-x:hover,
|
||||||
|
.ps .ps__rail-y:hover,
|
||||||
|
.ps .ps__rail-x:focus,
|
||||||
|
.ps .ps__rail-y:focus,
|
||||||
|
.ps .ps__rail-x.ps--clicking,
|
||||||
|
.ps .ps__rail-y.ps--clicking {
|
||||||
|
background-color: #EEEEEE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Scrollbar thumb styles
|
||||||
|
*/
|
||||||
|
.ps__thumb-x {
|
||||||
|
position: absolute; /* please don't change 'position' */
|
||||||
|
bottom: 0; /* there must be 'bottom' for ps-scrollbar-x */
|
||||||
|
height: 9px;
|
||||||
|
background-color: rgb(241, 241, 241);
|
||||||
|
-webkit-border-radius: 2px;
|
||||||
|
-moz-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
visibility: visible;
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAB2HAAAdhwGP5fFlAAAALElEQVQokWNgoBs4f/78f1JpJnIsIkvTsAQfP378TypNxyD/+PEjyRrJsgkAKS81km7nDNQAAAAASUVORK5CYII=);
|
||||||
|
image-rendering: pixelated;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center 0;
|
||||||
|
border: 1px solid #cfcfcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ps__thumb-y {
|
||||||
|
position: absolute; /* please don't change 'position' */
|
||||||
|
right: 0; /* there must be 'right' for ps-scrollbar-y */
|
||||||
|
width: 9px;
|
||||||
|
background-color: rgb(241, 241, 241);
|
||||||
|
-webkit-border-radius: 2px;
|
||||||
|
-moz-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
visibility: visible;
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAANCAQAAAAz1Zf0AAAAIUlEQVR42mNgAILz/0GQAQo+/gdBBqLAqE5ydH5k+sgEANHgUH2JtDRHAAAAAElFTkSuQmCC);
|
||||||
|
image-rendering: pixelated;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: 0 center;
|
||||||
|
border: 1px solid #cfcfcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ps__rail-x:hover > .ps__thumb-x {
|
||||||
|
background-color: rgb(207, 207, 207);
|
||||||
|
}
|
||||||
|
.ps__thumb-x:hover {
|
||||||
|
background-position: center -7px;
|
||||||
|
}
|
||||||
|
.ps__rail-x:focus > .ps__thumb-x,
|
||||||
|
.ps__rail-x.ps--clicking .ps__thumb-x {
|
||||||
|
background-color: #adadad;
|
||||||
|
border-color: #adadad;
|
||||||
|
background-position: center -7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ps__rail-y:hover > .ps__thumb-y {
|
||||||
|
background-color: rgb(207, 207, 207);
|
||||||
|
}
|
||||||
|
.ps__thumb-y:hover {
|
||||||
|
background-position: -7px center;
|
||||||
|
}
|
||||||
|
.ps__rail-y:focus > .ps__thumb-y,
|
||||||
|
.ps__rail-y.ps--clicking .ps__thumb-y {
|
||||||
|
background-color: #adadad;
|
||||||
|
border-color: #adadad;
|
||||||
|
background-position: -7px center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* MS supports */
|
||||||
|
@supports (-ms-overflow-style: none) {
|
||||||
|
.ps {
|
||||||
|
overflow: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
||||||
|
.ps {
|
||||||
|
overflow: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* loader */
|
||||||
|
@keyframes rotation {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.asc-loader-container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.asc-plugin-loader {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
margin-top: -10px;
|
||||||
|
z-index: 10000;
|
||||||
|
line-height: 20px;
|
||||||
|
background-image: none;
|
||||||
|
background-color: transparent;
|
||||||
|
color: #444444;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
.asc-plugin-loader .asc-loader-image {
|
||||||
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCI+PGNpcmNsZSBjeD0iMTAiIGN5PSIxMCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNDQ0IiBzdHJva2Utd2lkdGg9IjEuNSIgcj0iNy4yNSIgc3Ryb2tlLWRhc2hhcnJheT0iMTYwJSwgNDAlIiAvPjwvc3ZnPg==);
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
float: left;
|
||||||
|
margin-top: -1px;
|
||||||
|
|
||||||
|
|
||||||
|
animation-duration: .8s;
|
||||||
|
animation-name: rotation;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.asc-plugin-loader .asc-loader-title {
|
||||||
|
font-size: 13px;
|
||||||
|
padding-left: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* default scroll */
|
||||||
|
|
||||||
|
* {
|
||||||
|
scrollbar-width: thin;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar {
|
||||||
|
width: 9px;
|
||||||
|
height: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-thumb {
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid;
|
||||||
|
image-rendering: pixelated;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-thumb:vertical {
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAANCAQAAAAz1Zf0AAAAIUlEQVR42mNgAILz/0GQAQo+/gdBBqLAqE5ydH5k+sgEANHgUH2JtDRHAAAAAElFTkSuQmCC);
|
||||||
|
background-position: 0px center;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-thumb:horizontal {
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAB2HAAAdhwGP5fFlAAAALElEQVQokWNgoBs4f/78f1JpJnIsIkvTsAQfP378TypNxyD/+PEjyRrJsgkAKS81km7nDNQAAAAASUVORK5CYII=);
|
||||||
|
background-position: center 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-thumb:vertical:hover {
|
||||||
|
background-position: -7px center;
|
||||||
|
}
|
||||||
|
*::-webkit-scrollbar-thumb:horizontal:hover {
|
||||||
|
background-position: center -7px;
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,158 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* (c) Copyright Ascensio System SIA 2021
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function(window, undefined){
|
||||||
|
|
||||||
|
window.Asc = window.Asc || {};
|
||||||
|
window.Asc.plugin = {};
|
||||||
|
|
||||||
|
// ie channel
|
||||||
|
window.Asc.plugin.ie_channel = null;
|
||||||
|
window.Asc.plugin.ie_channel_check = function(e) {
|
||||||
|
var uagent = navigator.userAgent.toLowerCase();
|
||||||
|
if (uagent.indexOf("msie") > -1 || uagent.indexOf("trident") > -1)
|
||||||
|
{
|
||||||
|
if (e.ports && e.ports[0])
|
||||||
|
this.ie_channel = e.ports[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.Asc.plugin.tr_init = false;
|
||||||
|
window.Asc.plugin.tr = function(val) { return val; }
|
||||||
|
|
||||||
|
window.Asc.scope = {};
|
||||||
|
window.Asc.scope.prototype = {
|
||||||
|
clear : function() {
|
||||||
|
for (var i in window.Asc.scope)
|
||||||
|
delete window.Asc.scope[i];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function extend(obj, plugin) {
|
||||||
|
if (!obj || !("object" == typeof(obj) || "array" == typeof(obj)))
|
||||||
|
return obj;
|
||||||
|
|
||||||
|
var dst = (plugin === undefined) ? {} : plugin;
|
||||||
|
for (var prop in obj) {
|
||||||
|
if (obj.hasOwnProperty(prop)) {
|
||||||
|
dst[prop] = (obj[prop] && "object" === typeof obj[prop]) ? extend(obj[prop]) : obj[prop];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = function()
|
||||||
|
{
|
||||||
|
if (!window.Asc || !window.Asc.plugin)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("get", "./config.json", true);
|
||||||
|
xhr.responseType = "json";
|
||||||
|
xhr.onload = function() {
|
||||||
|
if (!window.Asc || !window.Asc.plugin)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (xhr.status == 200 || (xhr.status == 0 && xhr.readyState == 4)) {
|
||||||
|
var objConfig = xhr.response;
|
||||||
|
if ((typeof objConfig) == "string")
|
||||||
|
objConfig = JSON.parse(objConfig);
|
||||||
|
|
||||||
|
extend(objConfig, window.Asc.plugin);
|
||||||
|
|
||||||
|
var obj = {
|
||||||
|
type : "initialize",
|
||||||
|
guid : window.Asc.plugin.guid
|
||||||
|
};
|
||||||
|
|
||||||
|
var _body = document.body;
|
||||||
|
if (_body && true !== window.Asc.plugin.enableDrops) {
|
||||||
|
_body.ondrop = function(e) {
|
||||||
|
if (e && e.preventDefault)
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
_body.ondragenter = function(e) {
|
||||||
|
if (e && e.preventDefault)
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
_body.ondragover = function(e) {
|
||||||
|
if (e && e.preventDefault)
|
||||||
|
e.preventDefault();
|
||||||
|
if (e && e.dataTransfer)
|
||||||
|
e.dataTransfer.dropEffect = "none";
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// ie11 not support message from another domain
|
||||||
|
window.Asc.plugin._initInternal = true;
|
||||||
|
|
||||||
|
window.parent.postMessage(JSON.stringify(obj), "*");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
};
|
||||||
|
|
||||||
|
window.Asc.supportOrigins = {};
|
||||||
|
window.Asc.supportOrigins[window.origin] = true;
|
||||||
|
|
||||||
|
function onMessage(event) {
|
||||||
|
if (!window.Asc || !window.Asc.plugin)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (window.plugin_onMessage) {
|
||||||
|
if (!window.Asc.supportOrigins[event.origin])
|
||||||
|
return;
|
||||||
|
window.plugin_onMessage(event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!window.Asc.plugin._initInternal)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (typeof(event.data) == "string") {
|
||||||
|
var pluginData = {};
|
||||||
|
try {
|
||||||
|
pluginData = JSON.parse(event.data);
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
pluginData = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pluginData.type == "plugin_init") {
|
||||||
|
window.Asc.supportOrigins[event.origin] = true;
|
||||||
|
window.Asc.plugin.ie_channel_check(event);
|
||||||
|
eval(pluginData.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.addEventListener)
|
||||||
|
window.addEventListener("message", onMessage, false);
|
||||||
|
else
|
||||||
|
window.attachEvent("onmessage", onMessage);
|
||||||
|
|
||||||
|
window.onunload = function() {
|
||||||
|
if (window.addEventListener)
|
||||||
|
window.removeEventListener("message", onMessage, false);
|
||||||
|
else
|
||||||
|
window.detachEvent("onmessage", onMessage);
|
||||||
|
};
|
||||||
|
})(window, undefined);
|
||||||
Binary file not shown.
+32
@@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<div id="app">
|
||||||
|
<div id="nav">
|
||||||
|
<router-link to="/">Home</router-link> |
|
||||||
|
<router-link to="/about">About</router-link>
|
||||||
|
</div>
|
||||||
|
<router-view/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
#app {
|
||||||
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
text-align: center;
|
||||||
|
color: #2c3e50;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav {
|
||||||
|
padding: 30px;
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #2c3e50;
|
||||||
|
|
||||||
|
&.router-link-exact-active {
|
||||||
|
color: #42b983;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
@@ -0,0 +1,59 @@
|
|||||||
|
<template>
|
||||||
|
<div class="hello">
|
||||||
|
<h1>{{ msg }}</h1>
|
||||||
|
<p>
|
||||||
|
For a guide and recipes on how to configure / customize this project,<br>
|
||||||
|
check out the
|
||||||
|
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
||||||
|
</p>
|
||||||
|
<h3>Installed CLI Plugins</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
|
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
|
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
|
||||||
|
</ul>
|
||||||
|
<h3>Essential Links</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
|
||||||
|
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
|
||||||
|
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
|
||||||
|
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
|
||||||
|
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
|
||||||
|
</ul>
|
||||||
|
<h3>Ecosystem</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
|
||||||
|
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
|
||||||
|
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
|
||||||
|
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
|
||||||
|
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'HelloWorld',
|
||||||
|
props: {
|
||||||
|
msg: String,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
|
<style scoped lang="less">
|
||||||
|
h3 {
|
||||||
|
margin: 40px 0 0;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 10px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #42b983;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* @description: 系统配置文件
|
||||||
|
* @author: chenxiaoxi
|
||||||
|
* @date: 2021-08-18 17:47:46
|
||||||
|
*/
|
||||||
|
const interfaceUrl = window._CONFIG.interfaceUrl + '/laws-sinotruk/' //本地
|
||||||
|
// const interfaceUrl = 'https://srms.foton.com.cn/api/' //线上
|
||||||
|
|
||||||
|
const uploadFilePath = '/laws-sinotruk/onlyOffice/upload' // 上传文件地址
|
||||||
|
const downloadFilePath = window._CONFIG.downloadUrl + '/laws-sinotruk/onlyOffice/downLoadFile' // 下载文件地址
|
||||||
|
|
||||||
|
const staticFilePath = window._CONFIG.interfaceUrl + '/laws-sinotruk/onlyOffice/downLoadFile' //本地
|
||||||
|
// const staticFilePath = 'https://srms.foton.com.cn/api/att/attFile/downloadFile' //线上
|
||||||
|
module.exports = {
|
||||||
|
interfaceUrl,
|
||||||
|
uploadFilePath,
|
||||||
|
staticFilePath,
|
||||||
|
downloadFilePath
|
||||||
|
}
|
||||||
+120
@@ -0,0 +1,120 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
// base library
|
||||||
|
import {
|
||||||
|
ConfigProvider,
|
||||||
|
Layout,
|
||||||
|
Input,
|
||||||
|
InputNumber,
|
||||||
|
Button,
|
||||||
|
Switch,
|
||||||
|
Radio,
|
||||||
|
Checkbox,
|
||||||
|
Select,
|
||||||
|
Card,
|
||||||
|
Form,
|
||||||
|
FormModel,
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Modal,
|
||||||
|
Table,
|
||||||
|
Tabs,
|
||||||
|
Icon,
|
||||||
|
Badge,
|
||||||
|
Popover,
|
||||||
|
Dropdown,
|
||||||
|
List,
|
||||||
|
Avatar,
|
||||||
|
Breadcrumb,
|
||||||
|
Steps,
|
||||||
|
Spin,
|
||||||
|
Menu,
|
||||||
|
Drawer,
|
||||||
|
Tooltip,
|
||||||
|
Alert,
|
||||||
|
Tag,
|
||||||
|
Divider,
|
||||||
|
DatePicker,
|
||||||
|
TimePicker,
|
||||||
|
Upload,
|
||||||
|
Progress,
|
||||||
|
Skeleton,
|
||||||
|
Popconfirm,
|
||||||
|
PageHeader,
|
||||||
|
Result,
|
||||||
|
Statistic,
|
||||||
|
Descriptions,
|
||||||
|
Space,
|
||||||
|
message,
|
||||||
|
notification
|
||||||
|
} from 'ant-design-vue'
|
||||||
|
// import Viser from 'viser-vue'
|
||||||
|
|
||||||
|
// ext library
|
||||||
|
// import VueCropper from 'vue-cropper'
|
||||||
|
// import Dialog from '@/components/Dialog'
|
||||||
|
// import MultiTab from '@/components/MultiTab'
|
||||||
|
// import PageLoading from '@/components/PageLoading'
|
||||||
|
// import PermissionHelper from '@/core/permission/permission'
|
||||||
|
// import './directives/action'
|
||||||
|
|
||||||
|
Vue.use(ConfigProvider)
|
||||||
|
Vue.use(Layout)
|
||||||
|
Vue.use(Input)
|
||||||
|
Vue.use(InputNumber)
|
||||||
|
Vue.use(Button)
|
||||||
|
Vue.use(Switch)
|
||||||
|
Vue.use(Radio)
|
||||||
|
Vue.use(Checkbox)
|
||||||
|
Vue.use(Select)
|
||||||
|
Vue.use(Card)
|
||||||
|
Vue.use(Form)
|
||||||
|
Vue.use(FormModel)
|
||||||
|
Vue.use(Row)
|
||||||
|
Vue.use(Col)
|
||||||
|
Vue.use(Modal)
|
||||||
|
Vue.use(Table)
|
||||||
|
Vue.use(Tabs)
|
||||||
|
Vue.use(Icon)
|
||||||
|
Vue.use(Badge)
|
||||||
|
Vue.use(Popover)
|
||||||
|
Vue.use(Dropdown)
|
||||||
|
Vue.use(List)
|
||||||
|
Vue.use(Avatar)
|
||||||
|
Vue.use(Breadcrumb)
|
||||||
|
Vue.use(Steps)
|
||||||
|
Vue.use(Spin)
|
||||||
|
Vue.use(Menu)
|
||||||
|
Vue.use(Drawer)
|
||||||
|
Vue.use(Tooltip)
|
||||||
|
Vue.use(Alert)
|
||||||
|
Vue.use(Tag)
|
||||||
|
Vue.use(Divider)
|
||||||
|
Vue.use(DatePicker)
|
||||||
|
Vue.use(TimePicker)
|
||||||
|
Vue.use(Upload)
|
||||||
|
Vue.use(Progress)
|
||||||
|
Vue.use(Skeleton)
|
||||||
|
Vue.use(Popconfirm)
|
||||||
|
Vue.use(PageHeader)
|
||||||
|
Vue.use(Result)
|
||||||
|
Vue.use(Statistic)
|
||||||
|
Vue.use(Descriptions)
|
||||||
|
Vue.use(Space)
|
||||||
|
|
||||||
|
Vue.prototype.$confirm = Modal.confirm
|
||||||
|
Vue.prototype.$message = message
|
||||||
|
Vue.prototype.$notification = notification
|
||||||
|
Vue.prototype.$info = Modal.info
|
||||||
|
Vue.prototype.$success = Modal.success
|
||||||
|
Vue.prototype.$error = Modal.error
|
||||||
|
Vue.prototype.$warning = Modal.warning
|
||||||
|
|
||||||
|
// Vue.use(Viser)
|
||||||
|
// Vue.use(Dialog) // this.$dialog func
|
||||||
|
// Vue.use(MultiTab)
|
||||||
|
// Vue.use(PageLoading)
|
||||||
|
// Vue.use(PermissionHelper)
|
||||||
|
// Vue.use(VueCropper)
|
||||||
|
|
||||||
|
// process.env.NODE_ENV !== 'production' && console.warn('[antd-pro] NOTICE: Antd use lazy-load.')
|
||||||
Binary file not shown.
+11
@@ -0,0 +1,11 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import './plugins/axios'
|
||||||
|
import App from './App.vue'
|
||||||
|
import router from './router'
|
||||||
|
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
router,
|
||||||
|
render: (h) => h(App),
|
||||||
|
}).$mount('#app')
|
||||||
Binary file not shown.
@@ -0,0 +1,351 @@
|
|||||||
|
<template>
|
||||||
|
<a-config-provider :locale="locale">
|
||||||
|
<div id="app">
|
||||||
|
<!-- <template v-for="item in data">
|
||||||
|
<insert-text :title="item.title" :key="item.title" :list="item.list" />
|
||||||
|
</template> -->
|
||||||
|
<!-- <div class="app-header">-->
|
||||||
|
<!-- <a-button @click="save" class="app-header-button">保存</a-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
|
<!-- <div class="ant-drawer-index" v-if="isDisplay">-->
|
||||||
|
<!-- 数据保存中;请勿关闭页面 <span class="ant-drawer-text">{{num}}</span>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<template v-for="item in data">
|
||||||
|
<insert-guide-text
|
||||||
|
:title="item.title"
|
||||||
|
:key="`insert-guide-text${item.title}`"
|
||||||
|
:list="item.list"
|
||||||
|
:separatorText="item.separatorText"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<a-divider>初始化</a-divider>
|
||||||
|
<Init />
|
||||||
|
<a-divider>正文</a-divider>
|
||||||
|
<terminology />
|
||||||
|
<chapterData />
|
||||||
|
<first-level-listing />
|
||||||
|
<SaicFunc />
|
||||||
|
<!-- <a-divider>正文</a-divider>-->
|
||||||
|
<!-- <contentOne />-->
|
||||||
|
<!-- <a-divider>列项</a-divider>-->
|
||||||
|
<!-- <a-divider>函数</a-divider>-->
|
||||||
|
<a-divider>表格、图片</a-divider>
|
||||||
|
<SaicTable />
|
||||||
|
<SaicImg />
|
||||||
|
<!-- <a-divider>图</a-divider>-->
|
||||||
|
<!-- <SaicImg/>-->
|
||||||
|
<!-- <insert-image />-->
|
||||||
|
<a-divider>脚注、注、示例</a-divider>
|
||||||
|
<add-footnote />
|
||||||
|
<SaicExample />
|
||||||
|
<!-- <InsertNotes />-->
|
||||||
|
<!-- <a-divider>示例</a-divider>-->
|
||||||
|
<!-- <SaicExample/>-->
|
||||||
|
<!-- <a-divider>上传</a-divider>-->
|
||||||
|
<!-- <SaicFile />-->
|
||||||
|
<!-- <a-divider>修订信息</a-divider>-->
|
||||||
|
<!-- <RevisInformation />-->
|
||||||
|
<a-divider>附录</a-divider>
|
||||||
|
<Appendix />
|
||||||
|
<!-- <insert-table-row />-->
|
||||||
|
<!-- <hello-world />-->
|
||||||
|
</div>
|
||||||
|
</a-config-provider>
|
||||||
|
</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 Terminology from './saicComponents/Terminology'
|
||||||
|
import chapterData from './saicComponents/chapterData'
|
||||||
|
import Chapter from './saicComponents/Chapter'
|
||||||
|
import _axios from '@/plugins/axios2'
|
||||||
|
import zh_CN from 'ant-design-vue/lib/locale/zh_CN'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
InsertTableRow,
|
||||||
|
InsertGuideText,
|
||||||
|
FirstLevelListing,
|
||||||
|
AddFootnote,
|
||||||
|
InsertImage,
|
||||||
|
HelloWorld,
|
||||||
|
Init,
|
||||||
|
contentOne,
|
||||||
|
SaicFunc,
|
||||||
|
SaicTable,
|
||||||
|
SaicImg,
|
||||||
|
InsertNotes,
|
||||||
|
SaicExample,
|
||||||
|
SaicFile,
|
||||||
|
RevisInformation,
|
||||||
|
Appendix,
|
||||||
|
Terminology,
|
||||||
|
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,
|
||||||
|
locale: zh_CN
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.SetFontSize(21)
|
||||||
|
oTextPr.SetColor(0, 0, 0)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
var oHeading1Style1 = oDocument.CreateStyle('Heading 2')
|
||||||
|
const oTextPr1 = oHeading1Style1.GetTextPr()
|
||||||
|
oTextPr1.SetFontFamily('黑体')
|
||||||
|
oTextPr1.SetFontSize(21)
|
||||||
|
oTextPr1.SetColor(0, 0, 0)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
var oHeading1Style2 = oDocument.CreateStyle('Heading 3')
|
||||||
|
const oTextPr2 = oHeading1Style2.GetTextPr()
|
||||||
|
oTextPr2.SetFontFamily('黑体')
|
||||||
|
oTextPr2.SetFontSize(21)
|
||||||
|
oTextPr2.SetColor(0, 0, 0)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
var oHeading1Style3 = oDocument.CreateStyle('Heading 4')
|
||||||
|
const oTextPr3 = oHeading1Style3.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oTextPr3.SetFontSize(21)
|
||||||
|
// oTextPr3.SetColor(0, 0, 0);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
var oHeading1Style4 = oDocument.CreateStyle('Heading 5')
|
||||||
|
const oTextPr4 = oHeading1Style4.GetTextPr()
|
||||||
|
oTextPr4.SetFontFamily('黑体')
|
||||||
|
oTextPr4.SetFontSize(21)
|
||||||
|
oTextPr4.SetColor(0, 0, 0)
|
||||||
|
//
|
||||||
|
var oHeading1Style5 = oDocument.CreateStyle('Heading 6')
|
||||||
|
const oTextPr5 = oHeading1Style5.GetTextPr()
|
||||||
|
oTextPr5.SetFontFamily('黑体')
|
||||||
|
oTextPr5.SetFontSize(21)
|
||||||
|
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
|
||||||
|
},
|
||||||
|
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 {
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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-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-button {
|
||||||
|
background: #66b1ff;
|
||||||
|
border-color: #66b1ff;
|
||||||
|
color: #FFF;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,25 @@
|
|||||||
|
// px转mm
|
||||||
|
|
||||||
|
const conversion_getDPI = () => {
|
||||||
|
var arrDPI = new Array;
|
||||||
|
if (window.screen.deviceXDPI) {
|
||||||
|
arrDPI[0] = window.screen.deviceXDPI
|
||||||
|
arrDPI[1] = window.screen.deviceYDPI
|
||||||
|
} else {
|
||||||
|
var tmpNode = document.createElement('DIV');
|
||||||
|
tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden"
|
||||||
|
document.body.appendChild(tmpNode)
|
||||||
|
arrDPI[0] = parseInt(tmpNode.offsetWidth)
|
||||||
|
arrDPI[1] = parseInt(tmpNode.offsetHeight)
|
||||||
|
tmpNode.parentNode.removeChild(tmpNode)
|
||||||
|
}
|
||||||
|
return arrDPI;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pxConversionMm = (val) => {
|
||||||
|
var inch = val / conversion_getDPI()[0]
|
||||||
|
var c_value = inch * 25.4;
|
||||||
|
return c_value
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pxConversionMm
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export const SEPARATOR_TYPE = {
|
||||||
|
STRIKETHROUGH: '——',
|
||||||
|
COLON: ':'
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
SEPARATOR_TYPE
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,195 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-button-group style="margin-bottom: 10px;display: block">
|
||||||
|
<a-button @click="handleClick">添加脚注</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
<a-button-group style="margin-bottom: 10px;">
|
||||||
|
<a-button @click="handleInsertNoteOne('CN')">注</a-button>
|
||||||
|
<a-button @click="handleInsertMultNotTwo('CN')">注X</a-button>
|
||||||
|
<a-button @click="handleInsertMultNoteThe('CN')">首注</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 需求是括号结尾,参考word并没有脚注加括号的情况,需确认
|
||||||
|
* 时间过长以后研究
|
||||||
|
*/
|
||||||
|
handleClick() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
// Api.asc_AddFootnote()
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
oDocument.AddFootnote();
|
||||||
|
var aFootnotesFirstParagraphs = oDocument.GetFootnotesFirstParagraphs();
|
||||||
|
for (let i = 0; i < aFootnotesFirstParagraphs.length; i++) {
|
||||||
|
aFootnotesFirstParagraphs[i].SetVertAlign('baseline')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleClick2() {
|
||||||
|
this.ctx.executeMethod('InputText', ['wx', 'wx2'])
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInsertNoteOne() {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetCustomType('decimalZero', "注: ", "right")
|
||||||
|
oNumLvl.SetSuff("space");
|
||||||
|
var oParaPr = oNumLvl.GetParaPr();
|
||||||
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
// oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(-86);
|
||||||
|
var textPr = oNumLvl.GetTextPr();
|
||||||
|
textPr.SetFontFamily("黑体");
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetIndLeft(860);
|
||||||
|
oParagraph.SetFontSize(18)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0);
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text){
|
||||||
|
let aSearch = oParagraph.Search(text);
|
||||||
|
if (aSearch && aSearch.length > 0){
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleInsertMultNotTwo() {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
let currentNumbering = null
|
||||||
|
for (let index = 0; index < allElement; index++) {
|
||||||
|
const element = oDocument.GetElement(index)
|
||||||
|
if ("paragraph" === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingBefore()
|
||||||
|
if (text == 50) {
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
currentNumbering = getNumbering;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!numbering) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '注%1:';
|
||||||
|
numbering.SetCustomType("decimal", sFormatString, "right");
|
||||||
|
numbering.SetSuff("space");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
// oParagraph.SetSpacingLine(400, "auto");
|
||||||
|
var oParaPr = numbering.GetParaPr();
|
||||||
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
// oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(-86);
|
||||||
|
var textPr = numbering.GetTextPr();
|
||||||
|
textPr.SetFontFamily("黑体");
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetSpacingBefore(50)
|
||||||
|
oParagraph.SetSpacingAfter(50)
|
||||||
|
oParagraph.SetFontSize(18)
|
||||||
|
oParagraph.SetBold(false);
|
||||||
|
oParagraph.SetJc("left");
|
||||||
|
oParagraph.SetIndLeft(860);
|
||||||
|
oParagraph.SetHighlight(255, 255, 0);
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text){
|
||||||
|
let aSearch = oParagraph.Search(text);
|
||||||
|
if (aSearch && aSearch.length > 0){
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
// oNumbering = oParagraph.GetNumbering().GetNumbering()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleInsertMultNoteThe() {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetCustomType('decimal', "注%1:", "right")
|
||||||
|
oNumLvl.SetSuff("space");
|
||||||
|
var oParaPr = oNumLvl.GetParaPr();
|
||||||
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
// oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(-86);
|
||||||
|
var textPr = oNumLvl.GetTextPr();
|
||||||
|
textPr.SetFontFamily("黑体");
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetSpacingBefore(50)
|
||||||
|
oParagraph.SetSpacingAfter(50)
|
||||||
|
oParagraph.SetBold(false);
|
||||||
|
oParagraph.SetFontSize(18)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0);
|
||||||
|
oParagraph.SetIndLeft(860);
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text){
|
||||||
|
let aSearch = oParagraph.Search(text);
|
||||||
|
if (aSearch && aSearch.length > 0){
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,229 @@
|
|||||||
|
<template>
|
||||||
|
<div class="button-group__wrap">
|
||||||
|
<a-button-group style="margin-bottom: 10px">
|
||||||
|
<a-button @click="paragraphClick">段</a-button>
|
||||||
|
<a-button @click="handleClickOne()">项一</a-button>
|
||||||
|
<a-button @click="handleClickTwo1()">项二</a-button>
|
||||||
|
<a-button @click="handleClick('space')">字母列项</a-button>
|
||||||
|
<a-button @click="handleClickTwo">数字列项</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
handleClickOne () {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetCustomType('decimalZero', '——', 'right')
|
||||||
|
oNumLvl.SetSuff('none')
|
||||||
|
const oTextPr = oNumLvl.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('宋体')
|
||||||
|
oTextPr.SetFontSize(21)
|
||||||
|
const oParaPr = oNumLvl.GetParaPr()
|
||||||
|
oParaPr.SetSpacingLine(280, 'auto')
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
|
||||||
|
const oParagraphTemp = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraphTemp])
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.AddText(oParagraphTemp.GetText())
|
||||||
|
oParagraphTemp.Delete()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
|
oParagraph.SetIndLeft(840)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(10.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// let GetNext = oParagraph.GetNext()
|
||||||
|
// GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
paragraphClick () {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
|
oParagraph.SetIndFirstLine(420)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(10.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// let GetNext = oParagraph.GetNext()
|
||||||
|
// GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleClickTwo1 () {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('bullet')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetSuff('none')
|
||||||
|
const oParagraphTemp = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraphTemp])
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.AddText(' ' + oParagraphTemp.GetText().replace(' ', ''))
|
||||||
|
oParagraphTemp.Delete()
|
||||||
|
const oParaPr = oNumLvl.GetParaPr()
|
||||||
|
oParaPr.SetSpacingLine(280, 'auto')
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetIndLeft(1270)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(10.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// let GetNext = oParagraph.GetNext()
|
||||||
|
// GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleClick (suffType) {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let numbering = null
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(0)
|
||||||
|
numbering.SetTemplateType('a)')
|
||||||
|
numbering.SetCustomType('lowerLetter', '%1) ', 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
const oParagraphTemp = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraphTemp])
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.AddText(oParagraphTemp.GetText())
|
||||||
|
oParagraphTemp.Delete()
|
||||||
|
// oParagraph.SetSpacingLine(400, "auto");
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('宋体')
|
||||||
|
var oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetSpacingLine(240, 'auto')
|
||||||
|
oParaPr.SetJc('tab')
|
||||||
|
oParaPr.SetIndFirstLine(-420)
|
||||||
|
// oParaPr.SetIndFirstLine(0);
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetIndLeft(840)
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(10.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleClickTwo () {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
let currentNumbering = null
|
||||||
|
if (!numbering) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(0)
|
||||||
|
numbering.SetCustomType('decimal', '%1) ', 'left')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('宋体')
|
||||||
|
const oParaPr = numbering.GetParaPr()
|
||||||
|
// oParaPr.SetIndLeft(1310)
|
||||||
|
oParaPr.SetJc('left')
|
||||||
|
oParaPr.SetSpacingLine(240, 'auto')
|
||||||
|
oParaPr.SetIndFirstLine(-420)
|
||||||
|
const oParagraphTemp = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraphTemp])
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.AddText(oParagraphTemp.GetText())
|
||||||
|
oParagraphTemp.Delete()
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetIndLeft(1260)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(10.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
<template>
|
||||||
|
<div id="helloWorld">
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="handleDeleteBlockLVlSdt">cxx-删除全部BlockLVlSdt</a-button>
|
||||||
|
<a-button @click="handleDuanluo">cxx-插入段落编号</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="handleHelloWorld">cxx-插入文本</a-button>
|
||||||
|
<a-button @click="handleDuanluo">cxx-插入段落编号</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="handleReadOnlyBlock">cxx-插入只读文本</a-button>
|
||||||
|
<a-button @click="handleSetting">cxx-设置文字样式</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="handleLiexiang">cxx-插入列项</a-button>
|
||||||
|
<a-button @click="handleTest1">cxx-固定格式区域</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import moment from 'moment'
|
||||||
|
export default {
|
||||||
|
name: 'HelloWorld',
|
||||||
|
methods: {
|
||||||
|
handleDeleteBlockLVlSdt() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
oDocument = Api.GetDocument();
|
||||||
|
oParagraph = oDocument.GetElement(0);
|
||||||
|
oContentControls = oDocument.GetAllContentControls();
|
||||||
|
console.log(oContentControls)
|
||||||
|
for (let i = 0; i < oContentControls.length; i++) {
|
||||||
|
try {
|
||||||
|
oContentControls[0].Delete();
|
||||||
|
} catch(e) {
|
||||||
|
console.log('del err:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleHelloWorld() {
|
||||||
|
const text = 'Hello world!'
|
||||||
|
window.Asc.scope.text = text // export variable to plugin scope
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.AddText(Asc.scope.text)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDuanluo() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
const oDocument = Api.GetDocument();
|
||||||
|
const oNumbering = oDocument.CreateNumbering("test");
|
||||||
|
for (nLvl = 0 ; nLvl < 5 ; ++nLvl) {
|
||||||
|
oNumLvl = oNumbering.GetLevel(nLvl);
|
||||||
|
oParagraph = Api.CreateParagraph();
|
||||||
|
oParagraph.AddText( "这是带项目符号的示例" + (nLvl + 1 ));
|
||||||
|
oParagraph.SetNumbering(oNumLvl);
|
||||||
|
oDocument.Push(oParagraph);
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleReadOnlyBlock() {
|
||||||
|
window.Asc.scope.text = `当前时间是: ${moment(new Date()).format('YYYY-MM-DD HH:mm:ss')}`
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
const oDocument = Api.GetDocument();
|
||||||
|
const oBlockLvlSdt = Api.CreateBlockLvlSdt();
|
||||||
|
oBlockLvlSdt.GetContent().GetElement(0).AddText(Asc.scope.text);
|
||||||
|
oBlockLvlSdt.SetLock( "sdtLocked" );
|
||||||
|
oDocument.AddElement( 0 , oBlockLvlSdt);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSetting() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
const oDocument = Api.GetDocument();
|
||||||
|
const oBlockLvlSdt = Api.CreateBlockLvlSdt();
|
||||||
|
oBlockLvlSdt.GetContent().GetElement( 0 ).AddText( "这是一个块文本内容控件,字体大小设置为30,字体粗细设置为粗体。" );
|
||||||
|
oDocument.AddElement( 0 , oBlockLvlSdt);
|
||||||
|
oTextPr = oDocument.GetDefaultTextPr();
|
||||||
|
oTextPr.SetFontSize( 30 );
|
||||||
|
oTextPr.SetBold( true );
|
||||||
|
// oTextPr.SetCaps(true);
|
||||||
|
oBlockLvlSdt.SetTextPr(oTextPr);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleLiexiang() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
oDocument = Api.GetDocument();
|
||||||
|
oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.AddText("We create a 3x3 table and set the bold font weight to the text in cell #1:");
|
||||||
|
oDocument.AddElement(oParagraph)
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleTest1() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
oDocument = Api.GetDocument();
|
||||||
|
oBlockLvlSdt = Api.CreateBlockLvlSdt();
|
||||||
|
oBlockLvlSdt.GetContent().GetElement(0)
|
||||||
|
.AddText("This is a block text content control with the content lock set to it.")
|
||||||
|
.SetBold(false)
|
||||||
|
.SetColor(0, 0, 255,false);
|
||||||
|
oBlockLvlSdt.SetLock("sdtLocked");
|
||||||
|
oDocument.AddElement(0, oBlockLvlSdt);
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
#helloWorld {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<template>
|
||||||
|
<!-- style="margin-top:43px"-->
|
||||||
|
<div>
|
||||||
|
<h3 :style="{ margin: '16px 0' }" v-show="!!title">
|
||||||
|
{{ title }}
|
||||||
|
</h3>
|
||||||
|
<a-list size="small" bordered :data-source="list">
|
||||||
|
<a-list-item slot="renderItem" slot-scope="item, index">
|
||||||
|
<span style="cursor: pointer;" @click="handleClick(item, index)">
|
||||||
|
{{ item }}
|
||||||
|
</span>
|
||||||
|
</a-list-item>
|
||||||
|
</a-list>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Vue from 'vue'
|
||||||
|
import { SEPARATOR_TYPE } from '@/pages/page1/common/utils'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
// ctx: {
|
||||||
|
// type: Object,
|
||||||
|
// required: true
|
||||||
|
// }
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
separatorText: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: ' '
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
data: [
|
||||||
|
'下列术语和定义适用于本标准',
|
||||||
|
'××××××(标准编号)中确立的以及下列术语和定义适用于本标准'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClick(item, index) {
|
||||||
|
window.Asc.scope.text = item // export variable to plugin scope
|
||||||
|
window.Asc.scope.separatorText = this.separatorText // export variable to plugin scope
|
||||||
|
// window.Asc.plugin.init = function () {
|
||||||
|
// eslint-disable-next-line func-names
|
||||||
|
// eslint-disable-next-line prefer-arrow-callback
|
||||||
|
this.ctx.callCommand(function () {
|
||||||
|
try {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
oParagraph.AddText(Asc.scope.text) // or oParagraph.AddText(scope.text);
|
||||||
|
// const oRun = oParagraph.AddLineBreak()
|
||||||
|
// oRun.AddText(`xxxxxx${Asc.scope.separatorText}xxxxxx`)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,683 @@
|
|||||||
|
<template>
|
||||||
|
<div class="wrap">
|
||||||
|
<a-button-group>
|
||||||
|
<!-- <a-button @click="handleClick">插入图</a-button>-->
|
||||||
|
<!-- <a-button @click="handleCaptionClick">插入图题注</a-button>-->
|
||||||
|
<a-button @click="openImageName">图题</a-button>
|
||||||
|
<a-button @click="openImageDialog">插入图片</a-button>
|
||||||
|
<a-button @click="openImageNoteFou">图片脚注</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
<!-- <a-button-group>-->
|
||||||
|
<!-- <a-button @click="handleTest">测试</a-button>-->
|
||||||
|
<!-- </a-button-group>-->
|
||||||
|
|
||||||
|
<a-modal v-model="visible" title="插入图片" @ok="handleOk" @cancel="handleCancel">
|
||||||
|
<a-form-model
|
||||||
|
id="components-form-demo-validate-other"
|
||||||
|
:model="form"
|
||||||
|
v-bind="formItemLayout"
|
||||||
|
@submit="handleSubmit"
|
||||||
|
>
|
||||||
|
<!-- <a-form-item label="标题">-->
|
||||||
|
<!-- <a-input-->
|
||||||
|
<!-- v-model="form.title"-->
|
||||||
|
<!-- placeholder="请输入标题"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<a-form-item label="图片">
|
||||||
|
<a-upload
|
||||||
|
ref="upload"
|
||||||
|
name="file"
|
||||||
|
list-type="picture-card"
|
||||||
|
class="avatar-uploader"
|
||||||
|
:show-upload-list="false"
|
||||||
|
action="/laws-sinotruk/onlyoffice/upload"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
:customRequest="uploadFile"
|
||||||
|
@change="handleChange"
|
||||||
|
v-decorator="[
|
||||||
|
'file',
|
||||||
|
{
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请上传图片',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<img ref="myImg" v-if="imageUrl" :src="imageUrl" style="width: 300px; height: 300px;" />
|
||||||
|
<div v-else>
|
||||||
|
<a-icon :type="loading ? 'loading' : 'plus'" />
|
||||||
|
<div class="ant-upload-text">
|
||||||
|
Upload
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-upload>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="图片大小">
|
||||||
|
<a-radio-group :options="plainOptions" v-model="form.size" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-form-model>
|
||||||
|
</a-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import _axios from '@/plugins/axios2'
|
||||||
|
import pxConversionMm from '../common/unitConversion'
|
||||||
|
|
||||||
|
function getBase64 (img, callback) {
|
||||||
|
console.log(img)
|
||||||
|
const reader = new FileReader()
|
||||||
|
reader.addEventListener('load', () => callback(reader.result))
|
||||||
|
reader.readAsDataURL(img)
|
||||||
|
}
|
||||||
|
|
||||||
|
const plainOptions = ['原图', '小', '中', '大']
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
formItemLayout: {
|
||||||
|
labelCol: { span: 6 },
|
||||||
|
wrapperCol: { span: 14 }
|
||||||
|
},
|
||||||
|
loading: false,
|
||||||
|
imageUrl: '',
|
||||||
|
imageIpUrl: '', // 用IP的图片,给onlyoffice的
|
||||||
|
plainOptions,
|
||||||
|
form: {
|
||||||
|
title: '',
|
||||||
|
size: '中'
|
||||||
|
},
|
||||||
|
numData: {
|
||||||
|
1: 'A',
|
||||||
|
2: 'B',
|
||||||
|
3: 'C',
|
||||||
|
4: 'D',
|
||||||
|
5: 'E',
|
||||||
|
6: 'F',
|
||||||
|
7: 'G',
|
||||||
|
8: 'H',
|
||||||
|
9: 'I',
|
||||||
|
10: 'J',
|
||||||
|
11: 'K',
|
||||||
|
12: 'L',
|
||||||
|
13: 'M',
|
||||||
|
14: 'N',
|
||||||
|
15: 'O',
|
||||||
|
16: 'P',
|
||||||
|
17: 'Q',
|
||||||
|
18: 'R',
|
||||||
|
19: 'S',
|
||||||
|
20: 'T',
|
||||||
|
21: 'U',
|
||||||
|
22: 'V',
|
||||||
|
23: 'W',
|
||||||
|
24: 'X',
|
||||||
|
25: 'Y',
|
||||||
|
26: 'Z'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClick () {
|
||||||
|
// console.log(window.Asc.plugin.info)
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
// console.log(document.getElementById(`iframe_${Asc.scope.guid}`))
|
||||||
|
try {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// Api.asc_addImage()
|
||||||
|
console.log(Api)
|
||||||
|
Api.AddImage()
|
||||||
|
// const cb = (type, id) => {
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
// // this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
|
||||||
|
// // c_oAscAsyncActionType.BlockInteraction: 1
|
||||||
|
// // c_oAscAsyncAction.LoadImage: 8
|
||||||
|
// if (type === 1 && id === 8) {
|
||||||
|
// // 图片加载完成
|
||||||
|
// console.log('图片加载完成')
|
||||||
|
// const props = new window.Asc.CAscCaptionProperties()
|
||||||
|
// props.put_Before(false)
|
||||||
|
// props.put_Label('图')
|
||||||
|
// props.put_ExcludeLabel(false)
|
||||||
|
// props.put_Format(window.Asc.c_oAscNumberingFormat.Decimal)
|
||||||
|
// props.put_IncludeChapterNumber(false) // 是否包括章节号,
|
||||||
|
// // props.put_HeadingLvl(this.cmbChapter.getValue()) // 章节的风格,不包括章节号时不用填
|
||||||
|
// // props.put_Separator(this.cmbSeparator.getValue()) // 分隔符,不包括章节号时不用填
|
||||||
|
// props.updateName()
|
||||||
|
// // eslint-disable-next-line no-undef
|
||||||
|
// DE.controllers.Viewport.api.asc_AddObjectCaption(props)
|
||||||
|
// Api.asc_unregisterCallback('asc_onEndAction', cb)
|
||||||
|
// }
|
||||||
|
// // console.log(rest)
|
||||||
|
// }
|
||||||
|
const props = new window.Asc.CAscCaptionProperties()
|
||||||
|
props.put_Before(false)
|
||||||
|
props.put_Label('图')
|
||||||
|
props.put_ExcludeLabel(false)
|
||||||
|
props.put_Format(window.Asc.c_oAscNumberingFormat.Decimal)
|
||||||
|
props.put_IncludeChapterNumber(false) // 是否包括章节号,
|
||||||
|
// Api.asc_registerCallback('asc_onEndAction', cb)
|
||||||
|
// }, 1)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
// window.postMessage()
|
||||||
|
// document.getElementById(`iframe_${Asc.scope.guid}`).
|
||||||
|
// contentWindow.postMessage({ m: 'Wx Success' }, '*')
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleCaptionClick () {
|
||||||
|
// console.log(window.Asc.plugin.info)
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
// console.log(document.getElementById(`iframe_${Asc.scope.guid}`))
|
||||||
|
try {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// Api.asc_addImage()
|
||||||
|
Api.AddImage()
|
||||||
|
const cb = (type, id) => {
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
// this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
|
||||||
|
// c_oAscAsyncActionType.BlockInteraction: 1
|
||||||
|
// c_oAscAsyncAction.LoadImage: 8
|
||||||
|
if (type === 1 && id === 8) {
|
||||||
|
// 图片加载完成
|
||||||
|
console.log('图片加载完成')
|
||||||
|
const props = new window.Asc.CAscCaptionProperties()
|
||||||
|
props.put_Before(false)
|
||||||
|
props.put_Label('图')
|
||||||
|
props.put_ExcludeLabel(false)
|
||||||
|
props.put_Format(window.Asc.c_oAscNumberingFormat.Decimal)
|
||||||
|
props.put_IncludeChapterNumber(false) // 是否包括章节号,
|
||||||
|
// props.put_HeadingLvl(this.cmbChapter.getValue()) // 章节的风格,不包括章节号时不用填
|
||||||
|
// props.put_Separator(this.cmbSeparator.getValue()) // 分隔符,不包括章节号时不用填
|
||||||
|
props.updateName()
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
DE.controllers.Viewport.api.asc_AddObjectCaption(props)
|
||||||
|
Api.asc_unregisterCallback('asc_onEndAction', cb)
|
||||||
|
}
|
||||||
|
// console.log(rest)
|
||||||
|
}
|
||||||
|
Api.asc_registerCallback('asc_onEndAction', cb)
|
||||||
|
// }, 1)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
// window.postMessage()
|
||||||
|
// document.getElementById(`iframe_${Asc.scope.guid}`).
|
||||||
|
// contentWindow.postMessage({ m: 'Wx Success' }, '*')
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleCaptionClick2 () {
|
||||||
|
// _api.init(oWordControl);
|
||||||
|
// this.ctx.callCommand(function () {
|
||||||
|
// try {
|
||||||
|
// // eslint-disable-next-line new-cap
|
||||||
|
// // const _api = new window.Asc.asc_docs_api()
|
||||||
|
// console.log(this.DE.controllers.Viewport.api.asc_AddObjectCaption)
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error(error)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const props = new window.Asc.CAscCaptionProperties()
|
||||||
|
props.put_Before(false)
|
||||||
|
props.put_Label('图')
|
||||||
|
props.put_ExcludeLabel(false)
|
||||||
|
props.put_Format(window.Asc.c_oAscNumberingFormat.Decimal)
|
||||||
|
props.put_IncludeChapterNumber(false) // 是否包括章节号,
|
||||||
|
// props.put_HeadingLvl(this.cmbChapter.getValue()) // 章节的风格,不包括章节号时不用填
|
||||||
|
// props.put_Separator(this.cmbSeparator.getValue()) // 分隔符,不包括章节号时不用填
|
||||||
|
props.updateName()
|
||||||
|
|
||||||
|
// console.log(props)
|
||||||
|
// console.log(window)
|
||||||
|
// const oDocument = Api.GetDocument()
|
||||||
|
// const oParagraph = oDocument.GetElement(0)
|
||||||
|
// const oImage = Api.CreateImage('https://www.onlyoffice.com/blog/wp-content/uploads/2021/05/Blog_docs_63.jpg', 60 * 36000, 35 * 36000)
|
||||||
|
// oParagraph.AddDrawing(oImage)
|
||||||
|
// console.log(oImage)
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
DE.controllers.Viewport.api.asc_AddObjectCaption(props)
|
||||||
|
// oDocument.Push(oImage)
|
||||||
|
// window.Asc.asc_docs_api.asc_AddObjectCaption(props)
|
||||||
|
// console.log(window.Asc.asc_docs_api.prototype.asc_AddObjectCaption(props))
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
|
||||||
|
openImageDialog () {
|
||||||
|
this.visible = true
|
||||||
|
},
|
||||||
|
openImageNoteFou () {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let GetPrevious = oParagraph.GetPrevious()
|
||||||
|
let oNumLvl
|
||||||
|
let currentNumbering
|
||||||
|
const getNumbering = GetPrevious.GetNumbering()
|
||||||
|
const text = GetPrevious.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 32) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
}
|
||||||
|
const sFormatString = '%1'
|
||||||
|
oNumLvl.SetCustomType('lowerLetter', sFormatString, 'left')
|
||||||
|
oNumLvl.SetSuff('space')
|
||||||
|
const textPr = oNumLvl.GetTextPr()
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
textPr.SetFontFamily('黑体')
|
||||||
|
textPr.SetSmallCaps(true)
|
||||||
|
textPr.SetVertAlign('superscript')
|
||||||
|
const paraPr = oNumLvl.GetParaPr()
|
||||||
|
paraPr.SetSpacingBefore(0)
|
||||||
|
paraPr.SetJc('left')
|
||||||
|
paraPr.SetIndFirstLine(-150)
|
||||||
|
const oParagraph1 = Api.CreateParagraph()
|
||||||
|
oParagraph1.AddText(oParagraph.GetText())
|
||||||
|
oParagraph1.SetIndLeft(574)
|
||||||
|
oParagraph1.SetNumbering(oNumLvl)
|
||||||
|
oParagraph1.SetSpacingAfter(32)
|
||||||
|
oParagraph1.SetFontSize(18)
|
||||||
|
oDocument.InsertContent([oParagraph1])
|
||||||
|
oParagraph.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
openImageName () {
|
||||||
|
Asc.scope.numData = this.numData
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let num = oParagraph.GetPosInParent()
|
||||||
|
let oNumLvl
|
||||||
|
let currentNumbering
|
||||||
|
let table
|
||||||
|
let SpacingBefore
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 34) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
if (table) {
|
||||||
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
|
}
|
||||||
|
if (SpacingBefore) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 34) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '图' + Asc.scope.numData[SpacingBefore] + '.%1'
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'center')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 34) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '图 %1'
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'center')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
oNumLvl.SetSuff('tab')
|
||||||
|
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
const textPr = oNumLvl.GetTextPr()
|
||||||
|
textPr.SetFontFamily('黑体')
|
||||||
|
textPr.SetFontSize(21)
|
||||||
|
// const CNParagraph = Api.CreateParagraph();
|
||||||
|
oParagraph.SetJc('center')
|
||||||
|
// oParagraph.AddText("图片");
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetStyle(oNewDocumentStyle)
|
||||||
|
oParagraph.SetFontFamily('黑体')
|
||||||
|
oParagraph.SetSpacingBefore(34, false)
|
||||||
|
oParagraph.SetSpacingAfter(34, false)
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
// let GetNext = oParagraph.GetNext()
|
||||||
|
// GetNext.Delete()
|
||||||
|
// oParagraph.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleOk () {
|
||||||
|
console.log('图片上传和了')
|
||||||
|
this.visible = false
|
||||||
|
if (!this.imageIpUrl) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.Asc.scope.imageUrl = this.imageIpUrl
|
||||||
|
window.Asc.scope.title = this.form.title
|
||||||
|
window.Asc.scope.imgSize = this.form.size
|
||||||
|
const width = pxConversionMm(this.imgOrigin.width)
|
||||||
|
const height = pxConversionMm(this.imgOrigin.height)
|
||||||
|
window.Asc.scope.imgOrigin = {
|
||||||
|
width,
|
||||||
|
height
|
||||||
|
}
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const imgOParagraph = Api.CreateParagraph()
|
||||||
|
let imgSize = {
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
}
|
||||||
|
switch (Asc.scope.imgSize) {
|
||||||
|
case '原图':
|
||||||
|
imgSize.width = Asc.scope.imgOrigin.width
|
||||||
|
imgSize.height = Asc.scope.imgOrigin.height
|
||||||
|
break
|
||||||
|
case '小':
|
||||||
|
imgSize.width = 165 / 3
|
||||||
|
imgSize.height = 89.3 / 3
|
||||||
|
break
|
||||||
|
case '中':
|
||||||
|
imgSize.width = 165 / 2
|
||||||
|
imgSize.height = 89.3 / 2
|
||||||
|
break
|
||||||
|
case '大':
|
||||||
|
imgSize.width = 165
|
||||||
|
imgSize.height = 89.3
|
||||||
|
break
|
||||||
|
}
|
||||||
|
console.log('创建文档图片的地址', Asc.scope.imageUrl)
|
||||||
|
const oDrawing = Api.CreateImage(Asc.scope.imageUrl, imgSize.width * 36000, imgSize.height * 36000)
|
||||||
|
imgOParagraph.AddDrawing(oDrawing)
|
||||||
|
// const allElement = oDocument.GetElementsCount()
|
||||||
|
// let numbering = null
|
||||||
|
// let currentNumbering = null
|
||||||
|
// for (let index = 0; index < allElement; index++) {
|
||||||
|
// const element = oDocument.GetElement(index)
|
||||||
|
// if ("paragraph" === element.GetClassType()) {
|
||||||
|
// const text = element.GetSpacingBefore()
|
||||||
|
// const getNumbering = element.GetNumbering()
|
||||||
|
// if (getNumbering !== null) {
|
||||||
|
// if (text == 10) {
|
||||||
|
// currentNumbering = getNumbering;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (!numbering) {
|
||||||
|
// if (currentNumbering) {
|
||||||
|
// numbering = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
// } else {
|
||||||
|
// let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
// numbering = oNumbering.GetLevel(0)
|
||||||
|
// const sFormatString = '图 %1';
|
||||||
|
// numbering.SetCustomType("decimal", sFormatString, "right");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// const imgText = Api.CreateParagraph();
|
||||||
|
// var textPr = numbering.GetTextPr();
|
||||||
|
// textPr.SetFontFamily("黑体");
|
||||||
|
// textPr.SetFontSize(21)
|
||||||
|
// imgText.SetNumbering(numbering);
|
||||||
|
// imgText.AddText(`${Asc.scope.title}`);
|
||||||
|
// imgText.SetFontSize(21)
|
||||||
|
// imgText.SetFontFamily("黑体");
|
||||||
|
// imgText.SetBold(false)
|
||||||
|
// imgText.SetContextualSpacing(true);
|
||||||
|
// imgText.SetJc("center");
|
||||||
|
// imgText.SetSpacingBefore(10)
|
||||||
|
// imgText.SetSmallCaps(true);
|
||||||
|
imgOParagraph.SetJc('center')
|
||||||
|
imgOParagraph.SetSmallCaps(true)
|
||||||
|
const breakLine = Api.CreateParagraph()
|
||||||
|
breakLine.SetJc('left')
|
||||||
|
oDocument.InsertContent([imgOParagraph])
|
||||||
|
|
||||||
|
// oDocument.InsertContent([imgText]);
|
||||||
|
// 创建表格 包裹文字和列项
|
||||||
|
// oDocument.InsertContent([breakLine]);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.form = {
|
||||||
|
title: '',
|
||||||
|
size: '中'
|
||||||
|
}
|
||||||
|
this.imageIpUrl = ''
|
||||||
|
this.imageUrl = ''
|
||||||
|
}, 200)
|
||||||
|
|
||||||
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.visible = false
|
||||||
|
this.form = {
|
||||||
|
title: '',
|
||||||
|
size: '中'
|
||||||
|
}
|
||||||
|
this.imageIpUrl = ''
|
||||||
|
this.imageUrl = ''
|
||||||
|
},
|
||||||
|
|
||||||
|
handleChange (info) {
|
||||||
|
if (info.file.status === 'uploading') {
|
||||||
|
this.loading = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (info.file.status === 'done') {
|
||||||
|
// Get this url from response in real world.
|
||||||
|
getBase64(info.file.originFileObj, imageUrl => {
|
||||||
|
console.log(imageUrl)
|
||||||
|
this.imageUrl = imageUrl
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeUpload (file) {
|
||||||
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
|
||||||
|
if (!isJpgOrPng) {
|
||||||
|
this.$message.error('只能上传图片')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 2
|
||||||
|
if (!isLt2M) {
|
||||||
|
this.$message.error('图片大小不能超过2MB')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return isJpgOrPng && isLt2M
|
||||||
|
},
|
||||||
|
|
||||||
|
uploadFile (fileObj) {
|
||||||
|
let { file } = fileObj
|
||||||
|
const _data = new FormData()
|
||||||
|
var renameReportFile = new File([file], '新名称.jpg', { type: file.type })
|
||||||
|
_data.append('file', renameReportFile)
|
||||||
|
_axios({
|
||||||
|
url: this.uploadFilePath,
|
||||||
|
method: 'post',
|
||||||
|
data: _data
|
||||||
|
}).then(res => {
|
||||||
|
this.loading = false
|
||||||
|
this.imageUrl = this.staticFilePath + '?path=' + res.result.url
|
||||||
|
this.imageIpUrl = this.downloadFilePath + '?path=' + res.result.url
|
||||||
|
const img = new Image()
|
||||||
|
img.src = this.staticFilePath + '?path=' + res.result.url
|
||||||
|
console.log('给onlyoffice的', this.imageIpUrl)
|
||||||
|
console.log('页面显示的', img.src)
|
||||||
|
console.log('页面显示的true', this.imageUrl)
|
||||||
|
if (img.complete) {
|
||||||
|
this.imgOrigin = {
|
||||||
|
width: img.width,
|
||||||
|
height: img.height
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
img.onload = () => {
|
||||||
|
console.log(12)
|
||||||
|
this.imgOrigin = {
|
||||||
|
width: img.width,
|
||||||
|
height: img.height
|
||||||
|
}
|
||||||
|
console.log(this.imgOrigin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSubmit () {
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
|
||||||
|
handleTest () {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
window.imgNumOParagraph = window.imgNumOParagraph || null
|
||||||
|
var oNumbering, oNumLvl
|
||||||
|
oDocument = Api.GetDocument()
|
||||||
|
// 未创建图片列项
|
||||||
|
if (window.imgNumOParagraph) {
|
||||||
|
oNumbering = window.imgNumOParagraph
|
||||||
|
} else {
|
||||||
|
// 图片
|
||||||
|
oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
window.imgNumOParagraph = oNumbering
|
||||||
|
}
|
||||||
|
oNumLvl = oNumbering.GetLevel(oNumbering.GetLevel(0).GetLevelIndex())
|
||||||
|
// console.log('this', this)
|
||||||
|
var num = oNumLvl.GetNumbering()
|
||||||
|
// console.log(oDocument.GetNumbering())
|
||||||
|
// console.log(Api.GetDocument())
|
||||||
|
// console.log(Api.GetNumbering())
|
||||||
|
oNumLvl.SetRestart(false)
|
||||||
|
// title = '图' + oNumLvl.GetNumbering()
|
||||||
|
// oNumLvl.SetCustomType('lowerRoman', oNumLvl.GetNumbering(), 'left')
|
||||||
|
oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.AddText('测试段落')
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oDocument.Push(oParagraph)
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
mounted () {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.avatar-uploader > .ant-upload {
|
||||||
|
width: 128px;
|
||||||
|
height: 128px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-upload-select-picture-card i {
|
||||||
|
font-size: 32px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-upload-select-picture-card .ant-upload-text {
|
||||||
|
margin-top: 8px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-upload-select-picture-card {
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,487 @@
|
|||||||
|
<template>
|
||||||
|
<div class="wrap">
|
||||||
|
<a-button-group>
|
||||||
|
<!-- <a-button @click="handleClick">插入图</a-button>-->
|
||||||
|
<!-- <a-button @click="handleCaptionClick">插入图题注</a-button>-->
|
||||||
|
<a-button @click="openImageDialog">插入图片</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
<!-- <a-button-group>-->
|
||||||
|
<!-- <a-button @click="handleTest">测试</a-button>-->
|
||||||
|
<!-- </a-button-group>-->
|
||||||
|
|
||||||
|
<a-modal v-model="visible" title="插入图片" @ok="handleOk">
|
||||||
|
<a-form-model
|
||||||
|
id="components-form-demo-validate-other"
|
||||||
|
:model="form"
|
||||||
|
v-bind="formItemLayout"
|
||||||
|
@submit="handleSubmit"
|
||||||
|
>
|
||||||
|
<a-form-item label="标题">
|
||||||
|
<a-input
|
||||||
|
v-model="form.title"
|
||||||
|
placeholder="请输入标题"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="图片">
|
||||||
|
<a-upload
|
||||||
|
ref="upload"
|
||||||
|
name="file"
|
||||||
|
list-type="picture-card"
|
||||||
|
class="avatar-uploader"
|
||||||
|
:show-upload-list="false"
|
||||||
|
action="api/att/attFile/upload"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
:customRequest="uploadFile"
|
||||||
|
@change="handleChange"
|
||||||
|
v-decorator="[
|
||||||
|
'file',
|
||||||
|
{
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请上传图片',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<img ref="myImg" v-if="imageUrl" :src="imageUrl" style="width: 300px; height: 300px;"/>
|
||||||
|
<div v-else>
|
||||||
|
<a-icon :type="loading ? 'loading' : 'plus'"/>
|
||||||
|
<div class="ant-upload-text">
|
||||||
|
Upload
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-upload>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="图片大小">
|
||||||
|
<a-radio-group :options="plainOptions" v-model="form.size"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form-model>
|
||||||
|
</a-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import _axios from '@/plugins/axios2'
|
||||||
|
import pxConversionMm from '../common/unitConversion'
|
||||||
|
|
||||||
|
function getBase64(img, callback) {
|
||||||
|
console.log(img);
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.addEventListener('load', () => callback(reader.result));
|
||||||
|
reader.readAsDataURL(img);
|
||||||
|
}
|
||||||
|
|
||||||
|
const plainOptions = ['原图', '小', '中', '大'];
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
formItemLayout: {
|
||||||
|
labelCol: {span: 6},
|
||||||
|
wrapperCol: {span: 14},
|
||||||
|
},
|
||||||
|
loading: false,
|
||||||
|
imageUrl: '',
|
||||||
|
plainOptions,
|
||||||
|
form: {
|
||||||
|
title: '',
|
||||||
|
size: '中'
|
||||||
|
},
|
||||||
|
numData: {
|
||||||
|
1: 'A',
|
||||||
|
2: 'B',
|
||||||
|
3: 'C',
|
||||||
|
4: 'D',
|
||||||
|
5: 'E',
|
||||||
|
6: 'F',
|
||||||
|
7: 'G',
|
||||||
|
8: 'H',
|
||||||
|
9: 'I',
|
||||||
|
10: 'J',
|
||||||
|
11: 'K',
|
||||||
|
12: 'L',
|
||||||
|
13: 'M',
|
||||||
|
14: 'N',
|
||||||
|
15: 'O',
|
||||||
|
16: 'P',
|
||||||
|
17: 'Q',
|
||||||
|
18: 'R',
|
||||||
|
19: 'S',
|
||||||
|
20: 'T',
|
||||||
|
21: 'U',
|
||||||
|
22: 'V',
|
||||||
|
23: 'W',
|
||||||
|
24: 'X',
|
||||||
|
25: 'Y',
|
||||||
|
26: 'Z'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClick() {
|
||||||
|
// console.log(window.Asc.plugin.info)
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
// console.log(document.getElementById(`iframe_${Asc.scope.guid}`))
|
||||||
|
try {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// Api.asc_addImage()
|
||||||
|
console.log(Api)
|
||||||
|
Api.AddImage()
|
||||||
|
const props = new window.Asc.CAscCaptionProperties()
|
||||||
|
props.put_Before(false)
|
||||||
|
props.put_Label('图')
|
||||||
|
props.put_ExcludeLabel(false)
|
||||||
|
props.put_Format(window.Asc.c_oAscNumberingFormat.Decimal)
|
||||||
|
props.put_IncludeChapterNumber(false) // 是否包括章节号,
|
||||||
|
// Api.asc_registerCallback('asc_onEndAction', cb)
|
||||||
|
// }, 1)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
// window.postMessage()
|
||||||
|
// document.getElementById(`iframe_${Asc.scope.guid}`).
|
||||||
|
// contentWindow.postMessage({ m: 'Wx Success' }, '*')
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleCaptionClick() {
|
||||||
|
// console.log(window.Asc.plugin.info)
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
// console.log(document.getElementById(`iframe_${Asc.scope.guid}`))
|
||||||
|
try {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// Api.asc_addImage()
|
||||||
|
Api.AddImage()
|
||||||
|
const cb = (type, id) => {
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
// this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
|
||||||
|
// c_oAscAsyncActionType.BlockInteraction: 1
|
||||||
|
// c_oAscAsyncAction.LoadImage: 8
|
||||||
|
if (type === 1 && id === 8) {
|
||||||
|
// 图片加载完成
|
||||||
|
console.log('图片加载完成')
|
||||||
|
const props = new window.Asc.CAscCaptionProperties()
|
||||||
|
props.put_Before(false)
|
||||||
|
props.put_Label('图')
|
||||||
|
props.put_ExcludeLabel(false)
|
||||||
|
props.put_Format(window.Asc.c_oAscNumberingFormat.Decimal)
|
||||||
|
props.put_IncludeChapterNumber(false) // 是否包括章节号,
|
||||||
|
// props.put_HeadingLvl(this.cmbChapter.getValue()) // 章节的风格,不包括章节号时不用填
|
||||||
|
// props.put_Separator(this.cmbSeparator.getValue()) // 分隔符,不包括章节号时不用填
|
||||||
|
props.updateName()
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
DE.controllers.Viewport.api.asc_AddObjectCaption(props)
|
||||||
|
Api.asc_unregisterCallback('asc_onEndAction', cb)
|
||||||
|
}
|
||||||
|
// console.log(rest)
|
||||||
|
}
|
||||||
|
Api.asc_registerCallback('asc_onEndAction', cb)
|
||||||
|
// }, 1)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
// window.postMessage()
|
||||||
|
// document.getElementById(`iframe_${Asc.scope.guid}`).
|
||||||
|
// contentWindow.postMessage({ m: 'Wx Success' }, '*')
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleCaptionClick2() {
|
||||||
|
// _api.init(oWordControl);
|
||||||
|
// this.ctx.callCommand(function () {
|
||||||
|
// try {
|
||||||
|
// // eslint-disable-next-line new-cap
|
||||||
|
// // const _api = new window.Asc.asc_docs_api()
|
||||||
|
// console.log(this.DE.controllers.Viewport.api.asc_AddObjectCaption)
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error(error)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const props = new window.Asc.CAscCaptionProperties()
|
||||||
|
props.put_Before(false)
|
||||||
|
props.put_Label('图')
|
||||||
|
props.put_ExcludeLabel(false)
|
||||||
|
props.put_Format(window.Asc.c_oAscNumberingFormat.Decimal)
|
||||||
|
props.put_IncludeChapterNumber(false) // 是否包括章节号,
|
||||||
|
// props.put_HeadingLvl(this.cmbChapter.getValue()) // 章节的风格,不包括章节号时不用填
|
||||||
|
// props.put_Separator(this.cmbSeparator.getValue()) // 分隔符,不包括章节号时不用填
|
||||||
|
props.updateName()
|
||||||
|
|
||||||
|
// console.log(props)
|
||||||
|
// console.log(window)
|
||||||
|
// const oDocument = Api.GetDocument()
|
||||||
|
// const oParagraph = oDocument.GetElement(0)
|
||||||
|
// const oImage = Api.CreateImage('https://www.onlyoffice.com/blog/wp-content/uploads/2021/05/Blog_docs_63.jpg', 60 * 36000, 35 * 36000)
|
||||||
|
// oParagraph.AddDrawing(oImage)
|
||||||
|
// console.log(oImage)
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
DE.controllers.Viewport.api.asc_AddObjectCaption(props)
|
||||||
|
// oDocument.Push(oImage)
|
||||||
|
// window.Asc.asc_docs_api.asc_AddObjectCaption(props)
|
||||||
|
// console.log(window.Asc.asc_docs_api.prototype.asc_AddObjectCaption(props))
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
|
||||||
|
openImageDialog() {
|
||||||
|
this.visible = true
|
||||||
|
},
|
||||||
|
|
||||||
|
handleOk() {
|
||||||
|
this.visible = false
|
||||||
|
window.Asc.scope.imageUrl = this.imageUrl
|
||||||
|
window.Asc.scope.title = this.form.title
|
||||||
|
window.Asc.scope.imgSize = this.form.size
|
||||||
|
const width = pxConversionMm(this.imgOrigin.width)
|
||||||
|
const height = pxConversionMm(this.imgOrigin.height)
|
||||||
|
window.Asc.scope.imgOrigin = {
|
||||||
|
width,
|
||||||
|
height
|
||||||
|
}
|
||||||
|
Asc.scope.numData = this.numData;
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument();
|
||||||
|
const imgOParagraph = Api.CreateParagraph()
|
||||||
|
let imgSize = {
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
}
|
||||||
|
switch (Asc.scope.imgSize) {
|
||||||
|
case '原图':
|
||||||
|
imgSize.width = Asc.scope.imgOrigin.width
|
||||||
|
imgSize.height = Asc.scope.imgOrigin.height
|
||||||
|
break
|
||||||
|
case '小':
|
||||||
|
imgSize.width = 165 / 3
|
||||||
|
imgSize.height = 89.3 / 3
|
||||||
|
break
|
||||||
|
case '中':
|
||||||
|
imgSize.width = 165 / 2
|
||||||
|
imgSize.height = 89.3 / 2
|
||||||
|
break
|
||||||
|
case '大':
|
||||||
|
imgSize.width = 165
|
||||||
|
imgSize.height = 89.3
|
||||||
|
break
|
||||||
|
}
|
||||||
|
const oDrawing = Api.CreateImage(Asc.scope.imageUrl, imgSize.width * 36000, imgSize.height * 36000);
|
||||||
|
imgOParagraph.AddDrawing(oDrawing);
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
let currentNumbering = null
|
||||||
|
const CreateParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([CreateParagraph])
|
||||||
|
let GetPrevious = CreateParagraph.GetPrevious()
|
||||||
|
let numIndex
|
||||||
|
for (let index = 0; index < 1000000000; index++) {
|
||||||
|
let ContentControls = GetPrevious.GetParaPr().GetStyle()
|
||||||
|
if (ContentControls && ContentControls.GetName() == 'Heading 1') {
|
||||||
|
numIndex = GetPrevious.GetSpacingBefore()
|
||||||
|
break;
|
||||||
|
} else if (GetPrevious.GetSpacingBefore() == 30) {
|
||||||
|
const getNumbering = GetPrevious.GetNumbering()
|
||||||
|
currentNumbering = getNumbering;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
GetPrevious = GetPrevious.GetPrevious()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CreateParagraph.Delete()
|
||||||
|
|
||||||
|
// for (let index = 0; index < allElement; index++) {
|
||||||
|
// const element = oDocument.GetElement(index)
|
||||||
|
// if ("paragraph" === element.GetClassType()) {
|
||||||
|
// const getNumbering = element.GetNumbering()
|
||||||
|
// if (getNumbering !== null) {
|
||||||
|
// const text = element.GetSpacingBefore()
|
||||||
|
// if (GetPrevious.GetSpacingBefore() == 1) {
|
||||||
|
// if (text == 10) {
|
||||||
|
// currentNumbering = getNumbering;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// } else if (GetPrevious.GetSpacingBefore() == 2) {
|
||||||
|
// if (text == 11) {
|
||||||
|
// currentNumbering = getNumbering;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (!numbering) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(0)
|
||||||
|
let sFormatString = '图'+Asc.scope.numData[numIndex]+'.%1';
|
||||||
|
numbering.SetCustomType("decimal", sFormatString, "right");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const imgText = Api.CreateParagraph();
|
||||||
|
var textPr = numbering.GetTextPr();
|
||||||
|
textPr.SetFontFamily("黑体");
|
||||||
|
textPr.SetFontSize(21)
|
||||||
|
imgText.SetNumbering(numbering);
|
||||||
|
imgText.AddText(`${Asc.scope.title}`);
|
||||||
|
imgText.SetFontSize(21)
|
||||||
|
imgText.SetFontFamily("黑体");
|
||||||
|
imgText.SetBold(false)
|
||||||
|
imgText.SetContextualSpacing(true);
|
||||||
|
imgText.SetJc("center");
|
||||||
|
imgText.SetSpacingBefore(30, true)
|
||||||
|
imgText.SetSmallCaps(true);
|
||||||
|
imgOParagraph.SetJc("center");
|
||||||
|
imgOParagraph.SetSmallCaps(true);
|
||||||
|
const breakLine = Api.CreateParagraph()
|
||||||
|
breakLine.SetJc('left')
|
||||||
|
oDocument.InsertContent([imgOParagraph]);
|
||||||
|
|
||||||
|
oDocument.InsertContent([imgText]);
|
||||||
|
// 创建表格 包裹文字和列项
|
||||||
|
oDocument.InsertContent([breakLine]);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.form = {}
|
||||||
|
this.imageUrl = ''
|
||||||
|
}, 200)
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
handleChange(info) {
|
||||||
|
if (info.file.status === 'uploading') {
|
||||||
|
this.loading = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (info.file.status === 'done') {
|
||||||
|
// Get this url from response in real world.
|
||||||
|
getBase64(info.file.originFileObj, imageUrl => {
|
||||||
|
console.log(imageUrl);
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeUpload(file) {
|
||||||
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
||||||
|
if (!isJpgOrPng) {
|
||||||
|
this.$message.error('You can only upload JPG file!');
|
||||||
|
}
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||||
|
if (!isLt2M) {
|
||||||
|
this.$message.error('Image must smaller than 2MB!');
|
||||||
|
}
|
||||||
|
return isJpgOrPng && isLt2M;
|
||||||
|
},
|
||||||
|
|
||||||
|
uploadFile(fileObj) {
|
||||||
|
let {file} = fileObj
|
||||||
|
const _data = new FormData()
|
||||||
|
var renameReportFile = new File([file], '新名称.jpg', {type: file.type});
|
||||||
|
_data.append('file', renameReportFile)
|
||||||
|
_axios({
|
||||||
|
url: this.uploadFilePath,
|
||||||
|
method: 'post',
|
||||||
|
data: _data
|
||||||
|
}).then(res => {
|
||||||
|
this.loading = false
|
||||||
|
console.log(res);
|
||||||
|
this.imageUrl = this.staticFilePath + '?fileId=' + res.data.id
|
||||||
|
const img = new Image()
|
||||||
|
img.src = this.staticFilePath + '?fileId=' + res.data.id
|
||||||
|
if (img.complete) {
|
||||||
|
this.imgOrigin = {
|
||||||
|
width: img.width,
|
||||||
|
height: img.height
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
img.onload = () => {
|
||||||
|
console.log(12);
|
||||||
|
this.imgOrigin = {
|
||||||
|
width: img.width,
|
||||||
|
height: img.height
|
||||||
|
}
|
||||||
|
console.log(this.imgOrigin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSubmit() {
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
|
||||||
|
handleTest() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
window.imgNumOParagraph = window.imgNumOParagraph || null
|
||||||
|
var oNumbering, oNumLvl
|
||||||
|
oDocument = Api.GetDocument();
|
||||||
|
// 未创建图片列项
|
||||||
|
if (window.imgNumOParagraph) {
|
||||||
|
oNumbering = window.imgNumOParagraph
|
||||||
|
} else {
|
||||||
|
// 图片
|
||||||
|
oNumbering = oDocument.CreateNumbering("numbered");
|
||||||
|
window.imgNumOParagraph = oNumbering
|
||||||
|
}
|
||||||
|
oNumLvl = oNumbering.GetLevel(oNumbering.GetLevel(0).GetLevelIndex());
|
||||||
|
// console.log('this', this)
|
||||||
|
var num = oNumLvl.GetNumbering()
|
||||||
|
// console.log(oDocument.GetNumbering())
|
||||||
|
// console.log(Api.GetDocument())
|
||||||
|
// console.log(Api.GetNumbering())
|
||||||
|
oNumLvl.SetRestart(false)
|
||||||
|
// title = '图' + oNumLvl.GetNumbering()
|
||||||
|
// oNumLvl.SetCustomType('lowerRoman', oNumLvl.GetNumbering(), 'left')
|
||||||
|
oParagraph = Api.CreateParagraph();
|
||||||
|
oParagraph.SetNumbering(oNumLvl);
|
||||||
|
oParagraph.AddText("测试段落");
|
||||||
|
oParagraph.SetContextualSpacing(true);
|
||||||
|
oDocument.Push(oParagraph);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
mounted() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.avatar-uploader > .ant-upload {
|
||||||
|
width: 128px;
|
||||||
|
height: 128px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-upload-select-picture-card i {
|
||||||
|
font-size: 32px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-upload-select-picture-card .ant-upload-text {
|
||||||
|
margin-top: 8px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-button @click="handleClick">插入表格</a-button>
|
||||||
|
<a-button @click="handleClickCaption">插入表格题注</a-button>
|
||||||
|
<a-button @click="handleClickTableAndCaption">插入表格含题注</a-button>
|
||||||
|
<a-button @click="handleClickFenlan">cxx-插入分栏</a-button>
|
||||||
|
<a-button @click="handleTest">cxx-测试按钮</a-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function insertTableCommandFunction() {
|
||||||
|
return `const oDocument = Api.GetDocument();
|
||||||
|
const oTableStyle = oDocument.CreateStyle('CustomTableStyle', 'table');
|
||||||
|
oTableStyle.SetBasedOn(oDocument.GetStyle('Bordered - Accent 5'));
|
||||||
|
const oTable = Api.CreateTable(5, 5);oTable.SetWidth('percent', 100);
|
||||||
|
oTable.SetStyle(oTableStyle);const oCell = oTable.MergeCells([oTable.GetRow(1).GetCell(1), oTable.GetRow(1).GetCell(2), oTable.GetRow(2).GetCell(1), oTable.GetRow(2).GetCell(2)]);
|
||||||
|
oCell.GetContent().GetElement(0).AddText('Merged cell');
|
||||||
|
oDocument.Push(oTable);`
|
||||||
|
}
|
||||||
|
|
||||||
|
function createTextBlockLvlSdt(text) {
|
||||||
|
const oBlockLvlSdt = Api.CreateBlockLvlSdt()
|
||||||
|
oBlockLvlSdt.GetContent().GetElement(0).AddText('包含文字的BlockLvlSdt')
|
||||||
|
return oBlockLvlSdt
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
style: 'Table Grid'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClick() {
|
||||||
|
window.Asc.scope.text = this.style
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oTableStyle = oDocument.CreateStyle('CustomTableStyle', 'table')
|
||||||
|
oTableStyle.SetBasedOn(oDocument.GetStyle(Asc.scope.text))
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const oTable = Api.CreateTable(4, 5)
|
||||||
|
oTable.SetWidth('percent', 100)
|
||||||
|
oTable.SetStyle(oTableStyle)
|
||||||
|
|
||||||
|
// 构建表头
|
||||||
|
const btRow = oTable.GetRow(0)
|
||||||
|
// 0
|
||||||
|
const oBlockLvlSdt00 = Api.CreateBlockLvlSdt()
|
||||||
|
oBlockLvlSdt00.GetContent().GetElement(0).AddText('#')
|
||||||
|
btRow.GetCell(0).AddElement(0, oBlockLvlSdt00)
|
||||||
|
// 1
|
||||||
|
const oBlockLvlSdt01 = Api.CreateBlockLvlSdt()
|
||||||
|
oBlockLvlSdt01.GetContent().GetElement(0).AddText('标准编号/Standard No.')
|
||||||
|
btRow.GetCell(1).AddElement(0, oBlockLvlSdt01)
|
||||||
|
// 2
|
||||||
|
const oBlockLvlSdt02 = Api.CreateBlockLvlSdt()
|
||||||
|
oBlockLvlSdt02.GetContent().GetElement(0).AddText('起草人/Drafter')
|
||||||
|
btRow.GetCell(2).AddElement(0, oBlockLvlSdt02)
|
||||||
|
// 3
|
||||||
|
const oBlockLvlSdt03 = Api.CreateBlockLvlSdt()
|
||||||
|
oBlockLvlSdt03.GetContent().GetElement(0).AddText('主要修订内容/Revision information 采用标准/Applicable Standard')
|
||||||
|
btRow.GetCell(3).AddElement(0, oBlockLvlSdt03)
|
||||||
|
|
||||||
|
oDocument.InsertContent([oTable])
|
||||||
|
console.log('插入完成')
|
||||||
|
}, false)
|
||||||
|
|
||||||
|
// const command = insertTableCommandFunction()
|
||||||
|
// this.ctx.executeCommand('command', command)
|
||||||
|
},
|
||||||
|
handleClickCaption() {
|
||||||
|
// _api.init(oWordControl);
|
||||||
|
// this.ctx.callCommand(function () {
|
||||||
|
// try {
|
||||||
|
// // eslint-disable-next-line new-cap
|
||||||
|
// // const _api = new window.Asc.asc_docs_api()
|
||||||
|
// console.log(this.DE.controllers.Viewport.api.asc_AddObjectCaption)
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error(error)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const props = new window.Asc.CAscCaptionProperties()
|
||||||
|
props.put_Before(true)
|
||||||
|
props.put_Label('表格')
|
||||||
|
props.put_ExcludeLabel(false)
|
||||||
|
props.put_Format(window.Asc.c_oAscNumberingFormat.Decimal)
|
||||||
|
props.put_IncludeChapterNumber(false) // 是否包括章节号,
|
||||||
|
// props.put_HeadingLvl(this.cmbChapter.getValue()) // 章节的风格,不包括章节号时不用填
|
||||||
|
// props.put_Separator(this.cmbSeparator.getValue()) // 分隔符,不包括章节号时不用填
|
||||||
|
props.updateName()
|
||||||
|
|
||||||
|
console.log(props)
|
||||||
|
console.log(window)
|
||||||
|
// const oDocument = Api.GetDocument()
|
||||||
|
// const oParagraph = oDocument.GetElement(0)
|
||||||
|
// const oImage = Api.CreateImage('https://www.onlyoffice.com/blog/wp-content/uploads/2021/05/Blog_docs_63.jpg', 60 * 36000, 35 * 36000)
|
||||||
|
// oParagraph.AddDrawing(oImage)
|
||||||
|
// console.log(oImage)
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
DE.controllers.Viewport.api.asc_AddObjectCaption(props)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleClickTableAndCaption() {
|
||||||
|
window.Asc.scope.text = this.style
|
||||||
|
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const props = new window.Asc.CAscCaptionProperties()
|
||||||
|
props.put_Before(true)
|
||||||
|
props.put_Label('表格')
|
||||||
|
props.put_ExcludeLabel(false)
|
||||||
|
props.put_Format(window.Asc.c_oAscNumberingFormat.Decimal)
|
||||||
|
props.put_IncludeChapterNumber(false) // 是否包括章节号,
|
||||||
|
// props.put_HeadingLvl(this.cmbChapter.getValue()) // 章节的风格,不包括章节号时不用填
|
||||||
|
// props.put_Separator(this.cmbSeparator.getValue()) // 分隔符,不包括章节号时不用填
|
||||||
|
props.updateName()
|
||||||
|
|
||||||
|
console.log(props)
|
||||||
|
console.log(window)
|
||||||
|
// const oDocument = Api.GetDocument()
|
||||||
|
// const oParagraph = oDocument.GetElement(0)
|
||||||
|
// const oImage = Api.CreateImage('https://www.onlyoffice.com/blog/wp-content/uploads/2021/05/Blog_docs_63.jpg', 60 * 36000, 35 * 36000)
|
||||||
|
// oParagraph.AddDrawing(oImage)
|
||||||
|
// console.log(oImage)
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
DE.controllers.Viewport.api.asc_AddObjectCaption(props)
|
||||||
|
// 插入表格
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oTableStyle = oDocument.CreateStyle('CustomTableStyle', 'table')
|
||||||
|
oTableStyle.SetBasedOn(oDocument.GetStyle(Asc.scope.text))
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const oTable = Api.CreateTable(4, 60)
|
||||||
|
oTable.SetWidth('percent', 100)
|
||||||
|
oTable.SetStyle(oTableStyle)
|
||||||
|
// 设置重复表头
|
||||||
|
console.log(oTable)
|
||||||
|
const properties = new window.Asc.CTableProp()
|
||||||
|
properties.put_RowsInHeader(true)
|
||||||
|
// oTable.Table.eS(properties)
|
||||||
|
oTable.Table.SetTableProps(properties)
|
||||||
|
|
||||||
|
// 构建表头
|
||||||
|
const btRow = oTable.GetRow(0)
|
||||||
|
// 0
|
||||||
|
const oBlockLvlSdt00 = Api.CreateBlockLvlSdt()
|
||||||
|
oBlockLvlSdt00.GetContent().GetElement(0).AddText('#')
|
||||||
|
btRow.GetCell(0).AddElement(0, oBlockLvlSdt00)
|
||||||
|
// 1
|
||||||
|
const oBlockLvlSdt01 = Api.CreateBlockLvlSdt()
|
||||||
|
oBlockLvlSdt01.GetContent().GetElement(0).AddText('标准编号/Standard No.')
|
||||||
|
btRow.GetCell(1).AddElement(0, oBlockLvlSdt01)
|
||||||
|
// 2
|
||||||
|
const oBlockLvlSdt02 = Api.CreateBlockLvlSdt()
|
||||||
|
oBlockLvlSdt02.GetContent().GetElement(0).AddText('起草人/Drafter')
|
||||||
|
btRow.GetCell(2).AddElement(0, oBlockLvlSdt02)
|
||||||
|
// 3
|
||||||
|
const oBlockLvlSdt03 = Api.CreateBlockLvlSdt()
|
||||||
|
oBlockLvlSdt03.GetContent().GetElement(0).AddText('主要修订内容/Revision information 采用标准/Applicable Standard')
|
||||||
|
btRow.GetCell(3).AddElement(0, oBlockLvlSdt03)
|
||||||
|
|
||||||
|
oDocument.InsertContent([oTable])
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 插入分栏
|
||||||
|
handleClickFenlan() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const title = Api.CreateParagraph()
|
||||||
|
title.AddText('分栏解决方案')
|
||||||
|
title.SetJc('center')
|
||||||
|
title.SetFontSize(18)
|
||||||
|
oDocument.InsertContent([title])
|
||||||
|
const oTableStyle = oDocument.CreateStyle('CustomTableStyle', 'table')
|
||||||
|
oTableStyle.SetBasedOn(oDocument.GetStyle('Table Grid'))
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const oTable = Api.CreateTable(3, 1)
|
||||||
|
const btRow = oTable.GetRow(0)
|
||||||
|
const oBlockLvlSdt00 = Api.CreateBlockLvlSdt()
|
||||||
|
oTablePr = oTableStyle.GetTablePr();
|
||||||
|
oTablePr.SetTableLayout("fixed");
|
||||||
|
|
||||||
|
const tableCell1 = btRow.GetCell(0)
|
||||||
|
tableCell1.SetWidth('percent', 45)
|
||||||
|
tableCell1.SetCellBorderRight('single', 1, 0, 255, 255, 255);
|
||||||
|
// tableCell1.AddElement(0, oBlockLvlSdt00)
|
||||||
|
|
||||||
|
const tableCell2 = btRow.GetCell(1)
|
||||||
|
tableCell2.SetWidth('percent', 10)
|
||||||
|
tableCell2.SetCellBorderLeft('single', 1, 0, 255, 255, 255);
|
||||||
|
tableCell2.SetCellBorderRight('single', 1, 0, 255, 255, 255);
|
||||||
|
// tableCell2.AddElement(0, oBlockLvlSdt00)
|
||||||
|
|
||||||
|
const tableCell3 = btRow.GetCell(2)
|
||||||
|
tableCell3.SetWidth('percent', 45)
|
||||||
|
tableCell3.SetCellBorderLeft('single', 1, 0, 255, 255, 255);
|
||||||
|
// tableCell3.AddElement(0, oBlockLvlSdt00)
|
||||||
|
|
||||||
|
oTable.SetTableBorderTop("single", 1, 0, 255, 255, 255);
|
||||||
|
oTable.SetTableBorderRight("single", 1, 0, 255, 255, 255);
|
||||||
|
oTable.SetTableBorderBottom("single", 1, 0, 255, 255, 255);
|
||||||
|
oTable.SetTableBorderLeft("single", 1, 0, 255, 255, 255);
|
||||||
|
|
||||||
|
oTable.SetStyle(oTableStyle)
|
||||||
|
oDocument.Push(oTable)
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleTest() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
console.log(oDocument.Document)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-input v-model="colNumber">请输入列数</a-input>
|
||||||
|
<a-button @click="handleClick">InsertTableRow</a-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
colNumber: '1'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClick() {
|
||||||
|
window.Asc.plugin.onMethodReturn = function (...args) {
|
||||||
|
const { plugin } = window.Asc
|
||||||
|
console.log(args)
|
||||||
|
// plugin.executeCommand('close', '')
|
||||||
|
}
|
||||||
|
// console.log(this.style)
|
||||||
|
window.Asc.scope.colNumber = this.colNumber
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
// console.log(Api)
|
||||||
|
const colNumber = 3
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
console.log(oDocument)
|
||||||
|
// 获取当前Paragraph
|
||||||
|
// GetCurrentParagraph => Cl
|
||||||
|
const oParagraph = oDocument.Document.GetCurrentParagraph(undefined, undefined, { CheckDocContent: true })
|
||||||
|
// 利用ApiParagraph获取Parent
|
||||||
|
const newParagraph = Api.CreateParagraph()
|
||||||
|
// newParagraph.Ma = oParagraph
|
||||||
|
newParagraph.SetParagraphWx(oParagraph)
|
||||||
|
const parentTable = newParagraph.GetParentTable()
|
||||||
|
// console.log(parentTable)
|
||||||
|
// if (!parentTable) return new Error('当前父元素ClassType不是Table')
|
||||||
|
if (!parentTable) {
|
||||||
|
// console.log(window.Asc)
|
||||||
|
// Asc.plugin.info.data = '当前父元素ClassType不是Table'
|
||||||
|
return '当前父元素ClassType不是Table'
|
||||||
|
}
|
||||||
|
|
||||||
|
const parentTableCell = newParagraph.GetParentTableCell()
|
||||||
|
const oTableRow = parentTable.AddRow(parentTableCell, false)
|
||||||
|
const oCellsCount = oTableRow.GetCellsCount()
|
||||||
|
if (oCellsCount !== 1) {
|
||||||
|
oTableRow.MergeCells()
|
||||||
|
}
|
||||||
|
// 将这一行拆分为几行几列
|
||||||
|
const cellTable = oTableRow.GetCell(0).Split(1, colNumber)
|
||||||
|
cellTable.SetTableLayout('fixed')
|
||||||
|
// 获取当前位置
|
||||||
|
// Get_ParaContentPos => fh : oParagraph.Get_ParaContentPos(false, false)
|
||||||
|
// oParagraph.fh(false, false)
|
||||||
|
// console.log(oParagraph.fh(false, false))
|
||||||
|
// oDocument.InsertContent([])
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
return 'Success'
|
||||||
|
}, false)
|
||||||
|
|
||||||
|
// const command = insertTableCommandFunction()
|
||||||
|
// this.ctx.executeCommand('command', command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<template>
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="handleClick">插入二级列项</a-button>
|
||||||
|
<a-button @click="handleClickEn">插入二级列项(英)</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
handleClick() {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(1)
|
||||||
|
oNumLvl.SetTemplateType('1)')
|
||||||
|
|
||||||
|
oNumLvl.SetSuff('space')
|
||||||
|
for (let nLvl = 1; nLvl < 4; nLvl++) {
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.AddText('二级列项示例')
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetSpacing(10)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
// oNumbering = oParagraph.GetNumbering().GetNumbering()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleClickEn() {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(1)
|
||||||
|
oNumLvl.SetTemplateType('1)')
|
||||||
|
|
||||||
|
oNumLvl.SetSuff('space')
|
||||||
|
for (let nLvl = 1; nLvl < 4; nLvl++) {
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.AddText('Custom numbered')
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
oNumbering = oParagraph.GetNumbering().GetNumbering()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleClick2() {
|
||||||
|
this.ctx.executeMethod('InputText', ['wx', 'wx2'])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name" : "自定义编辑器",
|
||||||
|
"guid" : "asc.{0616AE85-5DBE-4B6B-A0A9-455C4F1503AD}",
|
||||||
|
"baseUrl" : "",
|
||||||
|
"group": {
|
||||||
|
"name": "自定义编辑器",
|
||||||
|
"rank": 2
|
||||||
|
},
|
||||||
|
"variations" : [
|
||||||
|
{
|
||||||
|
"description" : "hello world",
|
||||||
|
"url" : "index.html",
|
||||||
|
"icons" : ["../favicon.ico"],
|
||||||
|
"isViewer" : false,
|
||||||
|
"EditorsSupport" : ["word"],
|
||||||
|
"isVisual" : true,
|
||||||
|
"isModal" : false,
|
||||||
|
"isInsideMode" : true,
|
||||||
|
"initDataType" : "",
|
||||||
|
"initData" : "",
|
||||||
|
"isUpdateOleOnResize" : false,
|
||||||
|
"buttons" : []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,20 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
import App from './App.vue'
|
||||||
|
import { interfaceUrl, uploadFilePath, staticFilePath, downloadFilePath } from '@/config'
|
||||||
|
// eslint-disable-next-line import/extensions
|
||||||
|
import '@/core/use.js'
|
||||||
|
import axios from '../../plugins/axios2'
|
||||||
|
import store from '@/store'
|
||||||
|
|
||||||
|
Vue.prototype.interfaceUrl = interfaceUrl
|
||||||
|
Vue.prototype.uploadFilePath = uploadFilePath
|
||||||
|
Vue.prototype.downloadFilePath = downloadFilePath
|
||||||
|
Vue.prototype.staticFilePath = staticFilePath
|
||||||
|
Vue.prototype.$axios = axios
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
store,
|
||||||
|
render: (h) => h(App)
|
||||||
|
}).$mount('#app')
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,217 @@
|
|||||||
|
<template>
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="handleClick(1)">插入章标题</a-button>
|
||||||
|
<a-button @click="handleClick(2)">插入节标题</a-button>
|
||||||
|
<a-button @click="handleClick(3)">插入段落标题</a-button>
|
||||||
|
<a-button @click="handleClick(4)">测试查找内容控件</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapMutations, mapGetters } from 'vuex'
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
handleClick(type) {
|
||||||
|
switch(type) {
|
||||||
|
case 1:
|
||||||
|
this.handleCreateCapter()
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
this.handleCreateSection()
|
||||||
|
break
|
||||||
|
case 4:
|
||||||
|
this.handlemodifyColltor()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleCreateCapter() {
|
||||||
|
window.Asc.scope.chapterNumbering = this.chapterNumbering
|
||||||
|
if (sessionStorage.getItem('chapterNumbering') !== undefined && sessionStorage.getItem('chapterNumbering') !== 'undefined') {
|
||||||
|
window.chapterNumbering = JSON.parse(sessionStorage.getItem('chapterNumbering'))
|
||||||
|
console.log(window.chapterNumbering)
|
||||||
|
}
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
// const oParagraph = oDocument.Document.GetCurrentParagraph(undefined, undefined, { CheckDocContent: true })
|
||||||
|
const newParagraph = Api.CreateParagraph()
|
||||||
|
// newParagraph.SetParagraphWx(oParagraph)
|
||||||
|
// 获取到父Table
|
||||||
|
const parentTable = newParagraph.GetParentTable()
|
||||||
|
if (!parentTable) {
|
||||||
|
console.log(123);
|
||||||
|
return '当前父元素ClassType不是Table'
|
||||||
|
}
|
||||||
|
// DE.controllers.Toolbar.api.put_ListType(2, 2)
|
||||||
|
const parentTableCell = newParagraph.GetParentTableCell()
|
||||||
|
// 在最后一个单元格之后插入一个新行
|
||||||
|
const oTableRow = parentTable.AddRow(parentTableCell, false)
|
||||||
|
// 插入新单元格的内容
|
||||||
|
window.chapterNumbering = window.chapterNumbering || null
|
||||||
|
// 未创建章节列项
|
||||||
|
if (window.chapterNumbering) {
|
||||||
|
const oNumbering = window.chapterNumbering
|
||||||
|
} else {
|
||||||
|
console.log('48执行')
|
||||||
|
const oNumbering = oDocument.CreateNumbering("numbered");
|
||||||
|
window.chapterNumbering = oNumbering
|
||||||
|
// console.log(oNumbering)
|
||||||
|
// // 声明cache变量,便于匹配是否有循环引用的情况
|
||||||
|
// var cache = [];
|
||||||
|
// var str = JSON.stringify(oNumbering, function(key, value) {
|
||||||
|
// if (typeof value === 'object' && value !== null) {
|
||||||
|
// if (cache.indexOf(value) !== -1) {
|
||||||
|
// // 移除
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// // 收集所有的值
|
||||||
|
// cache.push(value);
|
||||||
|
// }
|
||||||
|
// return value;
|
||||||
|
// });
|
||||||
|
// cache = null; // 清空变量,便于垃圾回收机制回收
|
||||||
|
// console.log('str:', str)
|
||||||
|
|
||||||
|
// function decycle (target) {
|
||||||
|
// var map = new WeakMap()
|
||||||
|
// function _cycle (obj) {
|
||||||
|
// if (!map.has(obj)) {
|
||||||
|
// map.set(obj, obj)
|
||||||
|
// }
|
||||||
|
// let keys = Object.keys(obj)
|
||||||
|
// for (let i = 0, len = keys.length; i < len; i++) {
|
||||||
|
// if (typeof obj[keys[i]] === 'object') {
|
||||||
|
// if (map.has(obj[keys[i]])) {
|
||||||
|
// obj[keys[i]] = '$'
|
||||||
|
// continue
|
||||||
|
// } else {
|
||||||
|
// map.set(obj[keys[i]], obj[keys[i]])
|
||||||
|
// }
|
||||||
|
// _cycle(obj[keys[i]])
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// _cycle(target)
|
||||||
|
// }
|
||||||
|
// decycle(oNumbering)
|
||||||
|
// console.log('oNumbering:', oNumbering)
|
||||||
|
// sessionStorage.setItem('chapterNumbering', JSON.stringify(window.chapterNumbering))
|
||||||
|
}
|
||||||
|
const oNumLvl = oNumbering.GetLevel(oNumbering.GetLevel(0).GetLevelIndex());
|
||||||
|
oNumLvl.SetRestart(false)
|
||||||
|
const myParagraph = Api.CreateParagraph()
|
||||||
|
myParagraph.SetNumbering(oNumLvl)
|
||||||
|
|
||||||
|
const cn = Api.CreateRun();
|
||||||
|
cn.AddText('中文章标题 ')
|
||||||
|
cn.SetBold(true)
|
||||||
|
cn.SetFontSize(21)
|
||||||
|
cn.SetFontFamily("SimHei")
|
||||||
|
|
||||||
|
const en = Api.CreateRun();
|
||||||
|
en.AddText('English Chapter.')
|
||||||
|
en.SetBold(false)
|
||||||
|
en.SetFontSize(21)
|
||||||
|
en.SetFontFamily("Arial")
|
||||||
|
|
||||||
|
myParagraph.Push(cn)
|
||||||
|
myParagraph.Push(en)
|
||||||
|
oTableRow.GetCell(0).AddElement(0, myParagraph)
|
||||||
|
// myParagraph.SetSpacingBefore(540);
|
||||||
|
// myParagraph.SetSpacingAfter(540);
|
||||||
|
|
||||||
|
// const oCellCN = oTableRow.GetCell(0).GetContent().GetElement(0)
|
||||||
|
// oCellCN.AddText('中文章标题 ')
|
||||||
|
// oCellCN.SetBold(true)
|
||||||
|
// oCellCN.SetFontSize(21)
|
||||||
|
// oCellCN.SetFontFamily("SimHei")
|
||||||
|
|
||||||
|
// const oCellEN = oTableRow.GetCell(0).GetContent().GetElement(0)
|
||||||
|
// oCellEN.AddText('English Chapter.')
|
||||||
|
// oCellEN.SetBold(false)
|
||||||
|
// oCellEN.SetFontSize(21)
|
||||||
|
// oCellEN.SetFontFamily("Arial")
|
||||||
|
|
||||||
|
oTableRow.GetCell(0).SetVerticalAlign("center")
|
||||||
|
// 获取插入的行共有几列
|
||||||
|
const oCellsCount = oTableRow.GetCellsCount()
|
||||||
|
// 如果列数大于1 默认合并
|
||||||
|
if (oCellsCount !== 1) {
|
||||||
|
oTableRow.MergeCells()
|
||||||
|
}
|
||||||
|
// 将这一行拆分为几行几列
|
||||||
|
const cellTable = oTableRow.GetCell(0).Split(1, 1)
|
||||||
|
cellTable.SetTableLayout('fixed')
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleCreateSection() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allElement= oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
let currentNumbering = null
|
||||||
|
for(var index =0; index<allElement; index++){
|
||||||
|
const element= oDocument.GetElement(index)
|
||||||
|
if("paragraph" === element.GetClassType()){
|
||||||
|
getNumbering = element.GetNumbering()
|
||||||
|
if(getNumbering !==null){
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
if(getNumbering.GetLevelIndex() === 1){
|
||||||
|
numbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!numbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(1)
|
||||||
|
}
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.AddText('This is test section')
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
}catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handlemodifyColltor() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allControls= oDocument.GetAllContentControls();
|
||||||
|
console.log(allControls)
|
||||||
|
const controlsCount = allControls.length
|
||||||
|
for(var index =0; index<controlsCount; index++){
|
||||||
|
const kj = allControls[index]
|
||||||
|
if("PAGE1_NUMBER" ===kj.GetTag()){
|
||||||
|
console.log(kj.GetAllParagraphs())
|
||||||
|
const paragraphs = kj.GetAllParagraphs()[0]
|
||||||
|
paragraphs.GetStyle();
|
||||||
|
paragraphs.Delete()
|
||||||
|
kj.AddText("SMTC 1111111111")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
...mapMutations(['updateChapterNumbering'])
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['chapterNumbering'])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<template>
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="handleCreateLevelOne">一级列项</a-button>
|
||||||
|
<a-button @click="handleCreateLevelTwo">二级列项</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { BORDER_DISABLE } from '@/config'
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
// 插入一级列项
|
||||||
|
handleCreateLevelOne() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
oDocument = Api.GetDocument();
|
||||||
|
oNumbering = oDocument.CreateNumbering("numbered");
|
||||||
|
oNumLvl = oNumbering.GetLevel(0);
|
||||||
|
oNumLvl.SetTemplateType("a)");
|
||||||
|
oNumLvl.SetSuff('space');
|
||||||
|
for (let nLvl = 1; nLvl < 4; nLvl++) {
|
||||||
|
const oParagraph = Api.CreateParagraph();
|
||||||
|
oParagraph.AddText("字母列项");
|
||||||
|
oParagraph.SetContextualSpacing(true);
|
||||||
|
oParagraph.SetNumbering(oNumLvl);
|
||||||
|
oParagraph.SetFontFamily("SimHei");
|
||||||
|
oParagraph.SetFontSize(21);
|
||||||
|
oDocument.InsertContent([oParagraph]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 插入二级列项
|
||||||
|
handleCreateLevelTwo() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
oDocument = Api.GetDocument();
|
||||||
|
oNumbering = oDocument.CreateNumbering("numbered");
|
||||||
|
oNumLvl = oNumbering.GetLevel(1);
|
||||||
|
oNumLvl.SetTemplateType("1)");
|
||||||
|
oNumLvl.SetSuff('space');
|
||||||
|
for (let nLvl = 1; nLvl < 4; nLvl++) {
|
||||||
|
const oParagraph = Api.CreateParagraph();
|
||||||
|
oParagraph.AddText("数字列项");
|
||||||
|
oParagraph.SetContextualSpacing(true);
|
||||||
|
oParagraph.SetNumbering(oNumLvl);
|
||||||
|
oParagraph.SetFontFamily("SimHei");
|
||||||
|
oParagraph.SetFontSize(21);
|
||||||
|
oDocument.InsertContent([oParagraph]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
<template>
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="handleClick(1)">插入正文</a-button>
|
||||||
|
<!-- <a-button @click="handleClick(2)">序号测试</a-button>-->
|
||||||
|
<!-- <a-button @click="handleClick(3)">新功能测试</a-button>-->
|
||||||
|
<!-- <a-button @click="handleClick(4)">章功能测试</a-button>-->
|
||||||
|
<!-- <a-button @click="handleClick(5)">节功能测试</a-button>-->
|
||||||
|
</a-button-group>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
handleClick(type) {
|
||||||
|
switch(type) {
|
||||||
|
case 1:
|
||||||
|
this.handleCreateContent()
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
this.handleNumberTest()
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
this.handleTest()
|
||||||
|
break
|
||||||
|
case 4:
|
||||||
|
this.replaceTest()
|
||||||
|
break
|
||||||
|
case 5:
|
||||||
|
this.handleNumberJie()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleNumberTest() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
// DE.controllers.Toolbar.onSelectBullets()
|
||||||
|
DE.controllers.Toolbar.api.put_ListType(2, 2)
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleTest() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
// DE.controllers.Toolbar.onSelectBullets()
|
||||||
|
DE.controllers.Toolbar.api.put_ListType(2, 2)
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleCreateContent() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
// const oParagraph = oDocument.Document.GetCurrentParagraph(undefined, undefined, { CheckDocContent: true })
|
||||||
|
const newParagraph = Api.CreateParagraph()
|
||||||
|
// newParagraph.SetParagraphWx(oParagraph)
|
||||||
|
// 获取到父Table
|
||||||
|
const parentTable = newParagraph.GetParentTable()
|
||||||
|
console.log(parentTable);
|
||||||
|
if (!parentTable) {
|
||||||
|
console.log(123);
|
||||||
|
return '当前父元素ClassType不是Table'
|
||||||
|
}
|
||||||
|
const parentTableCell = newParagraph.GetParentTableCell()
|
||||||
|
// 在最后一个单元格之后插入一个新行
|
||||||
|
const oTableRow = parentTable.AddRow(parentTableCell, false)
|
||||||
|
// 获取插入的行共有几列
|
||||||
|
const oCellsCount = oTableRow.GetCellsCount()
|
||||||
|
// 如果列数大于1 默认合并
|
||||||
|
if (oCellsCount !== 1) {
|
||||||
|
oTableRow.MergeCells()
|
||||||
|
}
|
||||||
|
// 将这一行拆分为几行几列
|
||||||
|
const cellTable = oTableRow.GetCell(0).Split(1, 3)
|
||||||
|
cellTable.SetTableLayout('fixed')
|
||||||
|
const CNCell = oTableRow.GetCell(0)
|
||||||
|
CNCell.SetWidth('twips', 4762)
|
||||||
|
const CNParagraph = Api.CreateParagraph()
|
||||||
|
CNParagraph.AddText('这是中文的内容')
|
||||||
|
CNCell.AddElement(0, CNParagraph)
|
||||||
|
|
||||||
|
console.log(cellTable)
|
||||||
|
const MidCell = oTableRow.GetCell(1)
|
||||||
|
MidCell.SetWidth('twips', 226)
|
||||||
|
|
||||||
|
const ENCell = oTableRow.GetCell(2)
|
||||||
|
ENCell.SetWidth('twips', 4762)
|
||||||
|
const ENParagraph = Api.CreateParagraph()
|
||||||
|
ENParagraph.AddText('This is a new content')
|
||||||
|
ENCell.AddElement(0, ENParagraph)
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
replaceTest() {
|
||||||
|
console.log('章节功能测试')
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allElement= oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
for(var index =0; index<allElement; index++){
|
||||||
|
const element= oDocument.GetElement(index)
|
||||||
|
if("paragraph" === element.GetClassType()){
|
||||||
|
const getNumbering= element.GetNumbering()
|
||||||
|
if(getNumbering !==null){
|
||||||
|
if(getNumbering.GetLevelIndex() === 0){
|
||||||
|
numbering = getNumbering
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
console.log('oNumbering:', numbering)
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.AddText('This is test text')
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
}catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleNumberJie(){
|
||||||
|
console.log('节功能测试')
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allElement= oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
for(var index =0; index<allElement; index++){
|
||||||
|
const element= oDocument.GetElement(index)
|
||||||
|
if("paragraph" === element.GetClassType()){
|
||||||
|
const getNumbering= element.GetNumbering()
|
||||||
|
if(getNumbering !==null){
|
||||||
|
if(getNumbering.GetLevelIndex() === 1){
|
||||||
|
console.log(getNumbering)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
// this.replaceTest()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,223 @@
|
|||||||
|
<template>
|
||||||
|
<div class="note">
|
||||||
|
<a-button-group style="margin-bottom: 10px;">
|
||||||
|
<a-button @click="handleInsertNoteOne('CN')">注</a-button>
|
||||||
|
<a-button @click="handleInsertMultNotTwo('CN')">注X</a-button>
|
||||||
|
<a-button @click="handleInsertMultNoteThe('CN')">首注</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
<!-- <a-button-group>-->
|
||||||
|
<!-- <a-button @click="handleInsertNote('EN')">插入单个注(English)</a-button>-->
|
||||||
|
<!-- <a-button @click="handleInsertMultNote('EN')">插入多个注(English)</a-button>-->
|
||||||
|
<!-- </a-button-group>-->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
// 插入单个注释
|
||||||
|
handleInsertNote(lang) {
|
||||||
|
window.Asc.scope.lang = lang
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument();
|
||||||
|
const newParagraph = Api.CreateParagraph();
|
||||||
|
const oTableCell = newParagraph.GetParentTableCell();
|
||||||
|
const elementsCount = oTableCell.GetContent().GetElementsCount();
|
||||||
|
let noteNumLevel = null;
|
||||||
|
for (let i = 0; i < elementsCount; i++) {
|
||||||
|
if (noteNumLevel) { break; }
|
||||||
|
const ele = oTableCell.GetContent().GetElement(i);
|
||||||
|
if (ele && ele.GetClassType() === 'paragraph' && ele.GetNumbering()) {
|
||||||
|
const contentControls = ele.GetAllContentControls();
|
||||||
|
for (let j = 0; j < contentControls.length; j++) {
|
||||||
|
if (contentControls[j] && contentControls[j].GetAlias() === 'smtc.note') {
|
||||||
|
noteNumLevel = ele.GetNumbering();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (noteNumLevel) {
|
||||||
|
const sFormatString = Asc.scope.lang === 'CN' ? '注%1:' : 'Note%1:'
|
||||||
|
noteNumLevel.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
} else {
|
||||||
|
const oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
noteNumLevel = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = Asc.scope.lang === 'CN' ? '注:' : 'Note:'
|
||||||
|
noteNumLevel.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
noteNumLevel.SetSuff('space')
|
||||||
|
}
|
||||||
|
|
||||||
|
const oParagraphNote = Api.CreateParagraph();
|
||||||
|
const oInlineLvlSdtNote = Api.CreateInlineLvlSdt();
|
||||||
|
oInlineLvlSdtNote.SetAlias("smtc.note");
|
||||||
|
oParagraphNote.AddInlineLvlSdt(oInlineLvlSdtNote);
|
||||||
|
oParagraphNote.AddText('XXX');
|
||||||
|
oParagraphNote.SetNumbering(noteNumLevel);
|
||||||
|
oParagraphNote.SetContextualSpacing(true);
|
||||||
|
oParagraphNote.SetFontSize(18);
|
||||||
|
if (Asc.scope.lang === 'CN') {
|
||||||
|
oParagraphNote.SetFontFamily('Arial');
|
||||||
|
} else {
|
||||||
|
oParagraphNote.SetFontFamily('SimSun');
|
||||||
|
}
|
||||||
|
oParagraphNote.SetSpacingAfter(60);
|
||||||
|
oTableCell.AddElement(oTableCell.GetContent().GetElementsCount() - 1, oParagraphNote);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 插入多个注释
|
||||||
|
handleInsertMultNote(lang) {
|
||||||
|
window.Asc.scope.lang = lang
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = Asc.scope.lang === 'CN' ? '注%1:' : 'Note%1:'
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
oNumLvl.SetSuff('space')
|
||||||
|
for (let nLvl = 1; nLvl < 4; nLvl++) {
|
||||||
|
const oParagraphNote = Api.CreateParagraph()
|
||||||
|
const oInlineLvlSdt = Api.CreateInlineLvlSdt();
|
||||||
|
oInlineLvlSdt.SetAlias("smtc.note");
|
||||||
|
oParagraphNote.AddInlineLvlSdt(oInlineLvlSdt);
|
||||||
|
if (Asc.scope.lang === 'CN') {
|
||||||
|
oParagraphNote.AddText('XXXXXX')
|
||||||
|
} else {
|
||||||
|
oParagraphNote.AddText('XXXXXX.')
|
||||||
|
}
|
||||||
|
oParagraphNote.SetNumbering(oNumLvl)
|
||||||
|
oParagraphNote.SetContextualSpacing(true)
|
||||||
|
oParagraphNote.SetFontSize(18);
|
||||||
|
if (Asc.scope.lang === 'CN') {
|
||||||
|
oParagraphNote.SetFontFamily('Arial');
|
||||||
|
} else {
|
||||||
|
oParagraphNote.SetFontFamily('SimSun');
|
||||||
|
}
|
||||||
|
oParagraphNote.SetSpacingAfter(60);
|
||||||
|
oDocument.InsertContent([oParagraphNote]);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInsertNoteOne(){
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetCustomType('decimalZero', "注:", "left")
|
||||||
|
oNumLvl.SetSuff("space");
|
||||||
|
var oParaPr = oNumLvl.GetParaPr();
|
||||||
|
oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(0);
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0);
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleInsertMultNotTwo(){
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
let currentNumbering = null
|
||||||
|
for (let index = 0; index < allElement; index++) {
|
||||||
|
const element = oDocument.GetElement(index)
|
||||||
|
if ("paragraph" === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingBefore()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 50) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!numbering) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '注 %1:';
|
||||||
|
numbering.SetCustomType("decimal", sFormatString, "left");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
// oParagraph.SetSpacingLine(400, "auto");
|
||||||
|
var oParaPr = numbering.GetParaPr();
|
||||||
|
oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(0);
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetSpacingBefore(50)
|
||||||
|
oParagraph.SetSpacingAfter(50)
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetBold(false);
|
||||||
|
oParagraph.SetJc("left");
|
||||||
|
oParagraph.SetHighlight(255, 255, 0);
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
// oNumbering = oParagraph.GetNumbering().GetNumbering()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleInsertMultNoteThe(){
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetCustomType('decimal', "注 %1:", "left")
|
||||||
|
oNumLvl.SetSuff("space");
|
||||||
|
var oParaPr = oNumLvl.GetParaPr();
|
||||||
|
oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(0);
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetSpacingBefore(50)
|
||||||
|
oParagraph.SetSpacingAfter(50)
|
||||||
|
oParagraph.SetBold(false);
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0);
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
<template>
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="handleCreateRevisInformation">插入修订信息</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "RevisInformation",
|
||||||
|
methods: {
|
||||||
|
handleCreateRevisInformation() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument();
|
||||||
|
// const oParagraph = oDocument.Document.GetCurrentParagraph(
|
||||||
|
// undefined,
|
||||||
|
// undefined,
|
||||||
|
// { CheckDocContent: true }
|
||||||
|
// );
|
||||||
|
const newParagraph = Api.CreateParagraph();
|
||||||
|
// newParagraph.SetParagraphWx(oParagraph);
|
||||||
|
// 获取到父Table
|
||||||
|
let parentTable = newParagraph.GetParentTable();
|
||||||
|
let parentTableCell = newParagraph.GetParentTableCell();
|
||||||
|
// if (!parentTable) {
|
||||||
|
// return "当前父元素ClassType不是Table";
|
||||||
|
// }
|
||||||
|
const oTable = Api.CreateTable(4, 5);
|
||||||
|
oTable.SetWidth("percent", 100);
|
||||||
|
oTable.SetTableLayout('fixed');
|
||||||
|
|
||||||
|
oTable.SetTableCellMarginRight(0.2 * (1440 / 2.54));
|
||||||
|
oTable.SetTableCellMarginTop(0.2 * (1440 / 2.54));
|
||||||
|
oTable.SetTableCellMarginLeft(0.2 * (1440 / 2.54));
|
||||||
|
oTable.SetTableCellMarginBottom(0.2 * (1440 / 2.54));
|
||||||
|
|
||||||
|
oTable.SetTableBorderTop("single", 9, 0, 0, 0, 0);
|
||||||
|
oTable.SetTableBorderBottom("single", 6, 0, 0, 0, 0);
|
||||||
|
oTable.SetTableBorderLeft("single", 6, 0, 0, 0, 0);
|
||||||
|
oTable.SetTableBorderRight("single", 6, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
oTable.SetTableBorderInsideV("single", 6, 0, 0, 0, 0);
|
||||||
|
oTable.SetTableBorderInsideH("single", 6, 0, 0, 0, 0);
|
||||||
|
oDocument.Push(oTable);
|
||||||
|
// 构建表头
|
||||||
|
const btRow = oTable.GetRow(0);
|
||||||
|
// 0
|
||||||
|
// const oBlockLvlSdt00 = Api.CreateBlockLvlSdt();
|
||||||
|
// oBlockLvlSdt00.GetContent().GetElement(0).AddText("No.");
|
||||||
|
btRow.GetCell(0).SetWidth("percent", 5);
|
||||||
|
btRow.GetCell(0).GetContent().GetElement(0).AddText("No.");
|
||||||
|
btRow.GetCell(0).SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
||||||
|
// btRow.GetCell(0).AddElement(0, oBlockLvlSdt00);
|
||||||
|
// 1
|
||||||
|
// const oBlockLvlSdt01 = Api.CreateBlockLvlSdt();
|
||||||
|
// oBlockLvlSdt01
|
||||||
|
// .GetContent()
|
||||||
|
// .GetElement(0)
|
||||||
|
// .AddText("标准编号/Standard No.");
|
||||||
|
// btRow.GetCell(1).AddElement(0, oBlockLvlSdt01);
|
||||||
|
btRow.GetCell(1).SetWidth("percent", 30);
|
||||||
|
btRow.GetCell(1).GetContent().GetElement(0).AddText("标准编号/Standard No.");
|
||||||
|
btRow.GetCell(1).SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
||||||
|
// 2
|
||||||
|
// const oBlockLvlSdt02 = Api.CreateBlockLvlSdt();
|
||||||
|
// oBlockLvlSdt02.GetContent().GetElement(0).AddText("起草人/Drafter");
|
||||||
|
// btRow.GetCell(2).AddElement(0, oBlockLvlSdt02);
|
||||||
|
btRow.GetCell(2).SetWidth("percent", 20);
|
||||||
|
btRow.GetCell(2).GetContent().GetElement(0).AddText("起草人/Drafter");
|
||||||
|
btRow.GetCell(2).SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
||||||
|
// 3
|
||||||
|
// const oBlockLvlSdt03 = Api.CreateBlockLvlSdt();
|
||||||
|
// oBlockLvlSdt03
|
||||||
|
// .GetContent()
|
||||||
|
// .GetElement(0)
|
||||||
|
// .AddText(
|
||||||
|
// "主要修订内容/Revision information"
|
||||||
|
// );
|
||||||
|
// btRow.GetCell(3).AddElement(0, oBlockLvlSdt03);
|
||||||
|
btRow.GetCell(3).SetWidth("percent", 40);
|
||||||
|
btRow.GetCell(3).GetContent().GetElement(0).SetJc("center");
|
||||||
|
btRow.GetCell(3).GetContent().GetElement(0).AddText("主要修订内容/Revision information");
|
||||||
|
btRow.GetCell(3).SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
for (let i = 0; i < oTable.GetRowsCount(); i++) {
|
||||||
|
for (let j = 0; j < oTable.GetRow(i).GetCellsCount(); j++) {
|
||||||
|
const oParagraph = oTable.GetCell(i, j).GetContent().GetElement(0);
|
||||||
|
if (i > 0) {
|
||||||
|
oParagraph.SetColor(0, 0, 255);
|
||||||
|
}
|
||||||
|
oParagraph.SetJc("center");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parentTableCell.AddElement(0, oTable);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
<template>
|
||||||
|
<div class="example">
|
||||||
|
<a-button-group style="margin-bottom: 10px;">
|
||||||
|
<a-button @click="handleInsertExampleOne()">例</a-button>
|
||||||
|
<a-button @click="handleInsertExampleTwo()">例X</a-button>
|
||||||
|
<a-button @click="handleInsertExampleThe()">首例</a-button>
|
||||||
|
<!-- <a-button @click="handleInsertExample('CN')">插入单个示例(中文)</a-button>-->
|
||||||
|
<!-- <a-button @click="handleInsertMultExample('CN')">插入多个示例(中文)</a-button>-->
|
||||||
|
</a-button-group>
|
||||||
|
<a-button-group>
|
||||||
|
<!-- <a-button @click="handleInsertExample('EN')">插入单个示例(English)</a-button>-->
|
||||||
|
<!-- <a-button @click="handleInsertMultExample('EN')">插入多个示例(English)</a-button>-->
|
||||||
|
</a-button-group>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
// 插入单个示例
|
||||||
|
handleInsertExample(lang) {
|
||||||
|
window.Asc.scope.lang = lang
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument();
|
||||||
|
// const oParagraph = oDocument.Document.GetCurrentParagraph(
|
||||||
|
// undefined,
|
||||||
|
// undefined,
|
||||||
|
// { CheckDocContent: true }
|
||||||
|
// );
|
||||||
|
const newParagraph = Api.CreateParagraph();
|
||||||
|
// newParagraph.SetParagraphWx(oParagraph);
|
||||||
|
const oTableCell = newParagraph.GetParentTableCell();
|
||||||
|
console.log(oTableCell);
|
||||||
|
const elementsCount = oTableCell.GetContent().GetElementsCount();
|
||||||
|
console.log(elementsCount);
|
||||||
|
let exampleNumLevel = null;
|
||||||
|
for (let i = 0; i < elementsCount; i++) {
|
||||||
|
const ele = oTableCell.GetContent().GetElement(i);
|
||||||
|
if (ele && ele.GetClassType() === 'paragraph' && ele.GetNumbering()) {
|
||||||
|
const contentControls = ele.GetAllContentControls();
|
||||||
|
if (contentControls && contentControls.length) {
|
||||||
|
for (let j = 0; j < contentControls.length; j++) {
|
||||||
|
if (contentControls[j] && contentControls[j].GetAlias() === 'smtc.example') {
|
||||||
|
exampleNumLevel = ele.GetNumbering();
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (exampleNumLevel) {
|
||||||
|
const sFormatString = Asc.scope.lang === 'CN' ? '例%1:' : 'Example%1:'
|
||||||
|
exampleNumLevel.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
} else {
|
||||||
|
const oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
exampleNumLevel = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = Asc.scope.lang === 'CN' ? '例:' : 'Example:'
|
||||||
|
exampleNumLevel.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
exampleNumLevel.SetSuff('space')
|
||||||
|
}
|
||||||
|
|
||||||
|
const oParagraphExample = Api.CreateParagraph();
|
||||||
|
const oInlineLvlSdt = Api.CreateInlineLvlSdt();
|
||||||
|
oInlineLvlSdt.SetAlias("smtc.example");
|
||||||
|
oParagraphExample.AddInlineLvlSdt(oInlineLvlSdt);
|
||||||
|
oParagraphExample.AddText('XXX');
|
||||||
|
oParagraphExample.SetNumbering(exampleNumLevel);
|
||||||
|
oParagraphExample.SetContextualSpacing(true);
|
||||||
|
oParagraphExample.SetFontSize(18);
|
||||||
|
if (Asc.scope.lang === 'CN') {
|
||||||
|
oParagraphExample.SetFontFamily('Arial');
|
||||||
|
} else {
|
||||||
|
oParagraphExample.SetFontFamily('SimSun');
|
||||||
|
}
|
||||||
|
oParagraphExample.SetSpacingAfter(60);
|
||||||
|
oTableCell.AddElement(oTableCell.GetContent().GetElementsCount() - 1, oParagraphExample);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 插入多个示例
|
||||||
|
handleInsertMultExample(lang) {
|
||||||
|
window.Asc.scope.lang = lang
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = Asc.scope.lang === 'CN' ? '例%1:' : 'Example%1:'
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
oNumLvl.SetSuff('space')
|
||||||
|
for (let nLvl = 1; nLvl < 4; nLvl++) {
|
||||||
|
const oParagraphExample = Api.CreateParagraph()
|
||||||
|
const oInlineLvlSdt = Api.CreateInlineLvlSdt();
|
||||||
|
oInlineLvlSdt.SetAlias("smtc.example");
|
||||||
|
oParagraphExample.AddInlineLvlSdt(oInlineLvlSdt);
|
||||||
|
if (Asc.scope.lang === 'CN') {
|
||||||
|
oParagraphExample.AddText('XXXXXX')
|
||||||
|
} else {
|
||||||
|
oParagraphExample.AddText('XXXXXX.')
|
||||||
|
}
|
||||||
|
oParagraphExample.SetNumbering(oNumLvl)
|
||||||
|
oParagraphExample.SetContextualSpacing(true)
|
||||||
|
oParagraphExample.SetFontSize(18);
|
||||||
|
if (Asc.scope.lang === 'CN') {
|
||||||
|
oParagraphExample.SetFontFamily('Arial');
|
||||||
|
} else {
|
||||||
|
oParagraphExample.SetFontFamily('SimSun');
|
||||||
|
}
|
||||||
|
oParagraphExample.SetSpacingAfter(60);
|
||||||
|
oDocument.InsertContent([oParagraphExample]);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleInsertExampleOne(){
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetCustomType('decimalZero', "示例: ", "right")
|
||||||
|
oNumLvl.SetSuff("space");
|
||||||
|
var oParaPr = oNumLvl.GetParaPr();
|
||||||
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
oParaPr.SetIndFirstLine(-86);
|
||||||
|
var textPr = oNumLvl.GetTextPr();
|
||||||
|
textPr.SetFontFamily("黑体");
|
||||||
|
// oParaPr.SetJc("both");
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
textPr.SetBold(false)
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetFontSize(18)
|
||||||
|
oParagraph.SetIndLeft(1040);
|
||||||
|
oParagraph.SetHighlight(255, 255, 0);
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text){
|
||||||
|
let aSearch = oParagraph.Search(text);
|
||||||
|
if (aSearch && aSearch.length > 0){
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleInsertExampleTwo(){
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
let currentNumbering = null
|
||||||
|
for (let index = 0; index < allElement; index++) {
|
||||||
|
const element = oDocument.GetElement(index)
|
||||||
|
if ("paragraph" === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingBefore()
|
||||||
|
if (text == 51) {
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!numbering) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '示例%1:';
|
||||||
|
numbering.SetCustomType("decimal", sFormatString, "right");
|
||||||
|
numbering.SetSuff("space");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
// oParagraph.SetSpacingLine(400, "auto");
|
||||||
|
var oParaPr = numbering.GetParaPr();
|
||||||
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
// oParaPr.SetJc("left");
|
||||||
|
oParaPr.SetIndFirstLine(-86)
|
||||||
|
var textPr = numbering.GetTextPr();
|
||||||
|
textPr.SetFontFamily("黑体");
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
|
||||||
|
oParagraph.SetSpacingBefore(51)
|
||||||
|
oParagraph.SetSpacingAfter(50)
|
||||||
|
oParagraph.SetFontSize(18)
|
||||||
|
oParagraph.SetBold(false);
|
||||||
|
oParagraph.SetJc("left");
|
||||||
|
oParagraph.SetIndLeft(1040);
|
||||||
|
oParagraph.SetHighlight(255, 255, 0);
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text){
|
||||||
|
let aSearch = oParagraph.Search(text);
|
||||||
|
if (aSearch && aSearch.length > 0){
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
// oNumbering = oParagraph.GetNumbering().GetNumbering()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleInsertExampleThe(){
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetCustomType('decimal', "示例%1:", "right")
|
||||||
|
oNumLvl.SetSuff("space");
|
||||||
|
var oParaPr = oNumLvl.GetParaPr();
|
||||||
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
// oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(-86)
|
||||||
|
// oParaPr.SetIndFirstLine(0);
|
||||||
|
var textPr = oNumLvl.GetTextPr();
|
||||||
|
textPr.SetFontFamily("黑体");
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetSpacingBefore(51)
|
||||||
|
oParagraph.SetSpacingAfter(50)
|
||||||
|
oParagraph.SetBold(false);
|
||||||
|
oParagraph.SetFontSize(18)
|
||||||
|
oParagraph.SetIndLeft(1040);
|
||||||
|
oParagraph.SetHighlight(255, 255, 0);
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text){
|
||||||
|
let aSearch = oParagraph.Search(text);
|
||||||
|
if (aSearch && aSearch.length > 0){
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
<template>
|
||||||
|
<a-upload
|
||||||
|
name="file"
|
||||||
|
:customRequest="uploadFile"
|
||||||
|
:showUploadList="false"
|
||||||
|
>
|
||||||
|
<a-button> <a-icon type="upload" /> 附件上传 </a-button>
|
||||||
|
</a-upload>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import _axios from "@/plugins/axios2";
|
||||||
|
import pxConversionMm from "../common/unitConversion";
|
||||||
|
export default {
|
||||||
|
name: "SaicFile",
|
||||||
|
methods: {
|
||||||
|
uploadFile(fileObj) {
|
||||||
|
let { file } = fileObj;
|
||||||
|
const _data = new FormData();
|
||||||
|
_data.append("file", file);
|
||||||
|
_axios({
|
||||||
|
url: this.uploadFilePath,
|
||||||
|
method: "post",
|
||||||
|
data: _data,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
this.loading = false;
|
||||||
|
Asc.scope.fileName = res.data.oldFileName;
|
||||||
|
Asc.scope.attId = res.data.attId;
|
||||||
|
Asc.scope.fileSuffix = res.data.fileSuffix;
|
||||||
|
Asc.scope.filePath = this.staticFilePath + res.data.filePath + res.data.fileName;
|
||||||
|
window.Asc.scope.fileIcon = {
|
||||||
|
width: pxConversionMm(128),
|
||||||
|
height: pxConversionMm(171),
|
||||||
|
};
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument();
|
||||||
|
const oParagraph = oDocument.Document.GetCurrentParagraph(
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
{ CheckDocContent: true }
|
||||||
|
);
|
||||||
|
const newParagraph = Api.CreateParagraph();
|
||||||
|
newParagraph.SetParagraphWx(oParagraph);
|
||||||
|
const oTableCell = newParagraph.GetParentTableCell();
|
||||||
|
|
||||||
|
const fileIconParagraph = Api.CreateParagraph();
|
||||||
|
let standIcon = '';
|
||||||
|
switch (Asc.scope.fileSuffix) {
|
||||||
|
case 'xlsx':
|
||||||
|
case 'xls':
|
||||||
|
standIcon = 'excel'
|
||||||
|
break
|
||||||
|
case 'docx':
|
||||||
|
case 'doc':
|
||||||
|
standIcon = 'word'
|
||||||
|
break
|
||||||
|
case 'txt':
|
||||||
|
standIcon = 'txt'
|
||||||
|
break
|
||||||
|
case 'pdf':
|
||||||
|
standIcon = 'pdf'
|
||||||
|
break
|
||||||
|
case 'rar':
|
||||||
|
case 'zip':
|
||||||
|
standIcon = 'ziprar'
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
standIcon = 'video'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
const oDrawing = Api.CreateImage(
|
||||||
|
`http://39.98.140.126:10005/uploadPath/standIcon/${standIcon}.png`,
|
||||||
|
Asc.scope.fileIcon.width / 3 * 36000,
|
||||||
|
Asc.scope.fileIcon.height / 3 * 36000
|
||||||
|
);
|
||||||
|
fileIconParagraph.AddDrawing(oDrawing);
|
||||||
|
fileIconParagraph.SetJc("center");
|
||||||
|
|
||||||
|
const fileNameParagraph = Api.CreateParagraph();
|
||||||
|
fileNameParagraph.SetJc("center");
|
||||||
|
fileNameParagraph.AddText(Asc.scope.fileName);
|
||||||
|
const filePath = `http://39.98.140.126:10005/api/att/attFile/downloadFileForSar?fileId=${Asc.scope.attId}`;
|
||||||
|
fileNameParagraph.AddHyperlink(filePath, "附件下载");
|
||||||
|
|
||||||
|
oTableCell.AddElement(0, fileIconParagraph);
|
||||||
|
oTableCell.AddElement(1, fileNameParagraph);
|
||||||
|
} catch(e) {}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
<template>
|
||||||
|
<a-button-group>
|
||||||
|
<!-- <a-button @click="handleInsertEquation">插入方程式</a-button> -->
|
||||||
|
<a-button @click="handleInsertSymbol">插入符号</a-button>
|
||||||
|
<a-button @click="equationClick">方程式编号</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'SaicFunc',
|
||||||
|
data(){
|
||||||
|
return{
|
||||||
|
numData: {
|
||||||
|
1: 'A',
|
||||||
|
2: 'B',
|
||||||
|
3: 'C',
|
||||||
|
4: 'D',
|
||||||
|
5: 'E',
|
||||||
|
6: 'F',
|
||||||
|
7: 'G',
|
||||||
|
8: 'H',
|
||||||
|
9: 'I',
|
||||||
|
10: 'J',
|
||||||
|
11: 'K',
|
||||||
|
12: 'L',
|
||||||
|
13: 'M',
|
||||||
|
14: 'N',
|
||||||
|
15: 'O',
|
||||||
|
16: 'P',
|
||||||
|
17: 'Q',
|
||||||
|
18: 'R',
|
||||||
|
19: 'S',
|
||||||
|
20: 'T',
|
||||||
|
21: 'U',
|
||||||
|
22: 'V',
|
||||||
|
23: 'W',
|
||||||
|
24: 'X',
|
||||||
|
25: 'Y',
|
||||||
|
26: 'Z'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 插入方程式
|
||||||
|
handleInsertEquation() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
console.log(DE.controllers.Toolbar)
|
||||||
|
// DE.controllers.Toolbar.onInsertEquationClick();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
equationClick() {
|
||||||
|
// this.isTrue = !this.isTrue
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument();
|
||||||
|
const oParagraph = Api.CreateParagraph();
|
||||||
|
oDocument.InsertContent([oParagraph]);
|
||||||
|
let num = oParagraph.GetPosInParent()
|
||||||
|
let oNumLvl
|
||||||
|
let currentNumbering
|
||||||
|
let table
|
||||||
|
let SpacingBefore
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ("table" === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
} else if (element.GetTableDescription() == 'Empty table') {
|
||||||
|
let number = element.GetCell(0, 1).GetContent().GetElement(0);
|
||||||
|
const getNumbering = number.GetNumbering()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
currentNumbering = getNumbering;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
if (table) {
|
||||||
|
let number = table.GetCell(0, 0).GetContent().GetElement(1);
|
||||||
|
SpacingBefore = number.GetSpacingBefore();
|
||||||
|
}
|
||||||
|
let Previous = oParagraph.GetPrevious()
|
||||||
|
// Previous.Delete()
|
||||||
|
if (Previous) {
|
||||||
|
Previous.SetJc('right')
|
||||||
|
var oParagraph2 = Previous.Copy();
|
||||||
|
const oTable = Api.CreateTable(2, 1);
|
||||||
|
oTable.SetWidth("percent", 100);
|
||||||
|
oTable.SetTableLayout('fixed');
|
||||||
|
oTable.SetTableCellMarginRight(0.2 * (1440 / 2.54));
|
||||||
|
oTable.SetTableCellMarginTop(0.2 * (1440 / 2.54));
|
||||||
|
oTable.SetTableCellMarginLeft(0.2 * (1440 / 2.54));
|
||||||
|
oTable.SetTableCellMarginBottom(0.2 * (1440 / 2.54));
|
||||||
|
oTable.SetTableBorderTop("single", 0, 0, 255, 255, 255);
|
||||||
|
oTable.SetTableBorderBottom("single", 0, 0, 255, 255, 255);
|
||||||
|
oTable.SetTableBorderLeft("single", 0, 0, 255, 255, 255);
|
||||||
|
oTable.SetTableBorderRight("single", 0, 0, 255, 255, 255);
|
||||||
|
oTable.SetTableBorderInsideV("single", 0, 0, 255, 255, 255);
|
||||||
|
oTable.SetTableBorderInsideH("single", 0, 0, 255, 255, 255);
|
||||||
|
oTable.SetTableDescription("Empty table");
|
||||||
|
oDocument.InsertContent([oTable]);
|
||||||
|
const oCell = oTable.GetRow(0).GetCell(0);
|
||||||
|
const oCell1 = oTable.GetRow(0).GetCell(1);
|
||||||
|
const oParagraph1 = Api.CreateParagraph();
|
||||||
|
if (SpacingBefore) {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ("table" === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
} else if (element.GetTableDescription() == 'Empty table') {
|
||||||
|
let number = element.GetCell(0, 1).GetContent().GetElement(0);
|
||||||
|
const getNumbering = number.GetNumbering()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
currentNumbering = getNumbering;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = "..................(" + Asc.scope.numData[SpacingBefore] + ".%1)";
|
||||||
|
oNumLvl.SetCustomType("decimal", sFormatString, "left");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ("table" === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
} else if (element.GetTableDescription() == 'Empty table') {
|
||||||
|
let number = element.GetCell(0, 1).GetContent().GetElement(0);
|
||||||
|
const getNumbering = number.GetNumbering()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
currentNumbering = getNumbering;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = "..................(%1)";
|
||||||
|
oNumLvl.SetCustomType("decimal", sFormatString, "left");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const paraPr = oNumLvl.GetParaPr()
|
||||||
|
paraPr.SetJc('right')
|
||||||
|
const textPr = oNumLvl.GetTextPr()
|
||||||
|
textPr.SetVertAlign('baseline')
|
||||||
|
textPr.SetSmallCaps(false);
|
||||||
|
textPr.SetFontSize(21);
|
||||||
|
textPr.SetFontFamily("黑体");
|
||||||
|
oParagraph1.SetNumbering(oNumLvl)
|
||||||
|
oParagraph2.GetParaPr().SetJc('right')
|
||||||
|
oParagraph2.AddText(' ')
|
||||||
|
oParagraph2.SetSpacingAfter(10)
|
||||||
|
oParagraph2.SetSpacingBefore(9)
|
||||||
|
oCell.AddElement(0, oParagraph2)
|
||||||
|
oCell1.AddElement(0, oParagraph1)
|
||||||
|
oCell.GetContent().GetElement(0).GetParaPr().SetJc('right')
|
||||||
|
oCell.GetContent().GetElement(0).GetParaPr().SetIndRight(800)
|
||||||
|
// let text = oCell.GetContent().GetElement(0).GetText()
|
||||||
|
// if (text){
|
||||||
|
// let aSearch = oCell.GetContent().GetElement(0).Search(text);
|
||||||
|
// if (aSearch && aSearch.length > 0){
|
||||||
|
// aSearch[0].SetFontFamily('宋体')
|
||||||
|
// aSearch[0].SetFontSize(10.5)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
oCell.SetWidth("percent", 130);
|
||||||
|
oCell1.SetWidth("percent", 65);
|
||||||
|
oCell.SetVerticalAlign("center");
|
||||||
|
oCell1.SetVerticalAlign("center");
|
||||||
|
oCell.GetContent().GetElement(1).Delete()
|
||||||
|
oCell1.GetContent().GetElement(1).Delete()
|
||||||
|
}
|
||||||
|
Previous.Delete()
|
||||||
|
oParagraph.Delete()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 插入符号
|
||||||
|
handleInsertSymbol() {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
DE.controllers.Toolbar.onInsertSymbolClick();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,323 @@
|
|||||||
|
<template>
|
||||||
|
<div class="wrap">
|
||||||
|
<a-button-group>
|
||||||
|
<a-button @click="openImageDialog">插入图片</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
|
||||||
|
<a-modal
|
||||||
|
v-model="visible"
|
||||||
|
title="插入图片"
|
||||||
|
@ok="handleOk"
|
||||||
|
class="img-dialog"
|
||||||
|
>
|
||||||
|
<a-form-model
|
||||||
|
id="components-form-demo-validate-other"
|
||||||
|
:model="form"
|
||||||
|
v-bind="formItemLayout"
|
||||||
|
@submit="handleSubmit"
|
||||||
|
>
|
||||||
|
<a-form-item label="标题">
|
||||||
|
<a-input v-model="form.title" placeholder="请输入标题" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="图片大小">
|
||||||
|
<a-radio-group :options="plainOptions" v-model="form.size" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="图片">
|
||||||
|
<a-upload
|
||||||
|
ref="upload"
|
||||||
|
name="file"
|
||||||
|
list-type="picture-card"
|
||||||
|
class="avatar-uploader"
|
||||||
|
:show-upload-list="false"
|
||||||
|
action="api/att/attFile/upload"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
:customRequest="uploadFile"
|
||||||
|
@change="handleChange"
|
||||||
|
v-decorator="[
|
||||||
|
'file',
|
||||||
|
{
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请上传图片',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
ref="myImg"
|
||||||
|
v-if="imageUrl"
|
||||||
|
:src="imageUrl"
|
||||||
|
style="width: 300px; height: 300px"
|
||||||
|
/>
|
||||||
|
<div v-else>
|
||||||
|
<a-icon :type="loading ? 'loading' : 'plus'" />
|
||||||
|
<div class="ant-upload-text">Upload</div>
|
||||||
|
</div>
|
||||||
|
</a-upload>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form-model>
|
||||||
|
</a-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import _axios from "@/plugins/axios2";
|
||||||
|
import pxConversionMm from "../common/unitConversion";
|
||||||
|
const plainOptions = ["原图", "小", "中", "大"];
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
formItemLayout: {
|
||||||
|
labelCol: { span: 6 },
|
||||||
|
wrapperCol: { span: 14 },
|
||||||
|
},
|
||||||
|
plainOptions,
|
||||||
|
loading: false,
|
||||||
|
imageUrl: "",
|
||||||
|
form: {
|
||||||
|
title: "",
|
||||||
|
size: "中",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openImageDialog() {
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
handleChange(info) {
|
||||||
|
if (info.file.status === "uploading") {
|
||||||
|
this.loading = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (info.file.status === "done") {
|
||||||
|
// Get this url from response in real world.
|
||||||
|
getBase64(info.file.originFileObj, (imageUrl) => {
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeUpload(file) {
|
||||||
|
const isJpgOrPng =
|
||||||
|
file.type === "image/jpeg" || file.type === "image/png";
|
||||||
|
if (!isJpgOrPng) {
|
||||||
|
this.$message.error("You can only upload JPG file!");
|
||||||
|
}
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||||
|
if (!isLt2M) {
|
||||||
|
this.$message.error("Image must smaller than 2MB!");
|
||||||
|
}
|
||||||
|
return isJpgOrPng && isLt2M;
|
||||||
|
},
|
||||||
|
|
||||||
|
uploadFile(fileObj) {
|
||||||
|
let { file } = fileObj;
|
||||||
|
const _data = new FormData();
|
||||||
|
var renameReportFile = new File([file], "新名称.jpg", {
|
||||||
|
type: file.type,
|
||||||
|
});
|
||||||
|
_data.append("file", renameReportFile);
|
||||||
|
_axios({
|
||||||
|
url: this.uploadFilePath,
|
||||||
|
method: "post",
|
||||||
|
data: _data,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
this.loading = false;
|
||||||
|
this.imageUrl =
|
||||||
|
this.staticFilePath + res.data.filePath + res.data.fileName;
|
||||||
|
const img = new Image();
|
||||||
|
img.src = this.staticFilePath + res.data.filePath + res.data.fileName;
|
||||||
|
if (img.complete) {
|
||||||
|
this.imgOrigin = {
|
||||||
|
width: img.width,
|
||||||
|
height: img.height,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
img.onload = () => {
|
||||||
|
this.imgOrigin = {
|
||||||
|
width: img.width,
|
||||||
|
height: img.height,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSubmit() {
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
handleOk() {
|
||||||
|
this.visible = false;
|
||||||
|
window.Asc.scope.imageUrl = this.imageUrl;
|
||||||
|
window.Asc.scope.title = this.form.title;
|
||||||
|
window.Asc.scope.imgSize = this.form.size;
|
||||||
|
const width = pxConversionMm(this.imgOrigin.width);
|
||||||
|
const height = pxConversionMm(this.imgOrigin.height);
|
||||||
|
window.Asc.scope.imgOrigin = {
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
};
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
oDocument = Api.GetDocument();
|
||||||
|
var oNumbering, oNumLvl;
|
||||||
|
// const AllElementCount = oDocument.GetElementsCount();
|
||||||
|
const AllImages = oDocument.GetAllImages();
|
||||||
|
for (let i = 0; i < AllImages.length; i++) {
|
||||||
|
const ParentCellContent = AllImages[i]
|
||||||
|
.GetParentTableCell()
|
||||||
|
.GetContent();
|
||||||
|
for (let j = 0; j < ParentCellContent.GetElementsCount(); j++) {
|
||||||
|
// 找到paragraph
|
||||||
|
const Element = ParentCellContent.GetElement(j);
|
||||||
|
if ("paragraph" === Element.GetClassType()) {
|
||||||
|
if (Element.GetAllContentControls().length > 0) {
|
||||||
|
for (
|
||||||
|
let k = 0;
|
||||||
|
k < Element.GetAllContentControls().length;
|
||||||
|
k++
|
||||||
|
) {
|
||||||
|
if (
|
||||||
|
Element.GetAllContentControls()[k].GetAlias() ===
|
||||||
|
"smtc.img"
|
||||||
|
) {
|
||||||
|
const getNumbering = Element.GetNumbering();
|
||||||
|
// 找到编号段落
|
||||||
|
if (getNumbering) {
|
||||||
|
// 无论有没有一级列项,都把numbering存起来,后边如果没有找到一级列项,就get一级
|
||||||
|
oNumbering = getNumbering;
|
||||||
|
// 找到一级列项
|
||||||
|
if (getNumbering.GetLevelIndex() === 0) {
|
||||||
|
oNumLvl = getNumbering;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
imgOParagraph = Api.CreateParagraph();
|
||||||
|
let imgSize = {
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
};
|
||||||
|
switch (Asc.scope.imgSize) {
|
||||||
|
case "原图":
|
||||||
|
imgSize.width = Asc.scope.imgOrigin.width;
|
||||||
|
imgSize.height = Asc.scope.imgOrigin.height;
|
||||||
|
break;
|
||||||
|
case "小":
|
||||||
|
imgSize.width = 165 / 3;
|
||||||
|
imgSize.height = 89.3 / 3;
|
||||||
|
break;
|
||||||
|
case "中":
|
||||||
|
imgSize.width = 165 / 2;
|
||||||
|
imgSize.height = 89.3 / 2;
|
||||||
|
break;
|
||||||
|
case "大":
|
||||||
|
imgSize.width = 165;
|
||||||
|
imgSize.height = 89.3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
oDrawing = Api.CreateImage(
|
||||||
|
Asc.scope.imageUrl,
|
||||||
|
imgSize.width * 36000,
|
||||||
|
imgSize.height * 36000
|
||||||
|
);
|
||||||
|
imgOParagraph.AddLineBreak();
|
||||||
|
imgOParagraph.AddDrawing(oDrawing);
|
||||||
|
if (!oNumbering) {
|
||||||
|
oNumbering = oDocument.CreateNumbering("numbered");
|
||||||
|
oNumLvl = oNumbering.GetLevel(0);
|
||||||
|
}
|
||||||
|
imgText = Api.CreateParagraph();
|
||||||
|
const sFormatString = "图%1.";
|
||||||
|
oNumLvl.SetCustomType("decimal", sFormatString, "left");
|
||||||
|
oInlineLvlSdt = Api.CreateInlineLvlSdt();
|
||||||
|
|
||||||
|
imgText.SetNumbering(oNumLvl);
|
||||||
|
imgText.AddText(`${Asc.scope.title}`);
|
||||||
|
imgText.SetFontSize(21);
|
||||||
|
imgText.SetFontFamily("SimHei");
|
||||||
|
imgText.SetContextualSpacing(true);
|
||||||
|
imgText.SetJc("center");
|
||||||
|
|
||||||
|
oInlineLvlSdt.SetAlias("smtc.img");
|
||||||
|
imgText.AddInlineLvlSdt(oInlineLvlSdt);
|
||||||
|
imgOParagraph.SetJc("center");
|
||||||
|
imgOParagraph.SetSmallCaps(true);
|
||||||
|
oDocument.InsertContent([imgOParagraph]);
|
||||||
|
oDocument.InsertContent([imgText]);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.avatar-uploader > .ant-upload {
|
||||||
|
width: 128px;
|
||||||
|
height: 128px;
|
||||||
|
}
|
||||||
|
.ant-upload-select-picture-card i {
|
||||||
|
font-size: 32px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-upload-select-picture-card .ant-upload-text {
|
||||||
|
margin-top: 8px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-box {
|
||||||
|
& > div {
|
||||||
|
width: 128px;
|
||||||
|
height: 128px;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: top;
|
||||||
|
background-color: #fafafa;
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
&:hover {
|
||||||
|
border-color: #1890ff;
|
||||||
|
}
|
||||||
|
.anticon-plus {
|
||||||
|
font-size: 32px;
|
||||||
|
color: #999 !important;
|
||||||
|
display: inline-block;
|
||||||
|
color: inherit;
|
||||||
|
font-style: normal;
|
||||||
|
line-height: 0;
|
||||||
|
text-align: center;
|
||||||
|
text-transform: none;
|
||||||
|
vertical-align: -0.125em;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,666 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-button-group style="margin-bottom: 10px">
|
||||||
|
<a-button @click="handleInsertName">表题</a-button>
|
||||||
|
<a-button @click="handleInsertTableClick(1)">插入表格</a-button>
|
||||||
|
<a-button @click="handleInsertNoteFou">表格脚注</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
<a-button-group style="margin-bottom: 10px">
|
||||||
|
<a-button @click="handleInsertNoteThe">表格注</a-button>
|
||||||
|
<a-button @click="handleInsertNoteOne">表格注X</a-button>
|
||||||
|
<a-button @click="handleInsertNoteTwo">表格首注</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
<a-modal v-model="visible" title="插入表格" @ok="handleOk">
|
||||||
|
<a-form-model ref="ruleForm" :model="form" v-bind="formItemLayout" :rules="validatorRules">
|
||||||
|
<a-form-model-item label="行数" prop="rows">
|
||||||
|
<a-input v-model="form.rows" placeholder="请输入行数" />
|
||||||
|
</a-form-model-item>
|
||||||
|
<a-form-model-item label="列数" prop="column">
|
||||||
|
<a-input v-model="form.column" placeholder="请输入列数" />
|
||||||
|
</a-form-model-item>
|
||||||
|
</a-form-model>
|
||||||
|
</a-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'SaicTable',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
formItemLayout: {
|
||||||
|
labelCol: { span: 6 },
|
||||||
|
wrapperCol: { span: 14 }
|
||||||
|
},
|
||||||
|
loading: false,
|
||||||
|
imageUrl: '',
|
||||||
|
form: {
|
||||||
|
title: '',
|
||||||
|
size: '中'
|
||||||
|
},
|
||||||
|
numData: {
|
||||||
|
1: 'A',
|
||||||
|
2: 'B',
|
||||||
|
3: 'C',
|
||||||
|
4: 'D',
|
||||||
|
5: 'E',
|
||||||
|
6: 'F',
|
||||||
|
7: 'G',
|
||||||
|
8: 'H',
|
||||||
|
9: 'I',
|
||||||
|
10: 'J',
|
||||||
|
11: 'K',
|
||||||
|
12: 'L',
|
||||||
|
13: 'M',
|
||||||
|
14: 'N',
|
||||||
|
15: 'O',
|
||||||
|
16: 'P',
|
||||||
|
17: 'Q',
|
||||||
|
18: 'R',
|
||||||
|
19: 'S',
|
||||||
|
20: 'T',
|
||||||
|
21: 'U',
|
||||||
|
22: 'V',
|
||||||
|
23: 'W',
|
||||||
|
24: 'X',
|
||||||
|
25: 'Y',
|
||||||
|
26: 'Z'
|
||||||
|
},
|
||||||
|
validatorRules: {
|
||||||
|
// 标签项名称
|
||||||
|
rows: [
|
||||||
|
{ required: true, message: '请输入行数', trigger: 'blur' },
|
||||||
|
{ pattern: /^[1-9]\d*$/, message: '请输入零以上的正整数' }
|
||||||
|
],
|
||||||
|
// 标签类型
|
||||||
|
column: [
|
||||||
|
{ required: true, message: '请输入列数', trigger: 'blur' },
|
||||||
|
{ pattern: /^[1-9]\d*$/, message: '请输入零以上的正整数' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSubmit () {
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
handleOk () {
|
||||||
|
this.$refs.ruleForm.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.handleInsertTable(this.form)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleInsertTableClick () {
|
||||||
|
this.visible = true
|
||||||
|
this.form = {
|
||||||
|
rows: 7,
|
||||||
|
column: 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 插入表格含题注
|
||||||
|
handleInsertTable (data) {
|
||||||
|
Asc.scope.rows = data.rows
|
||||||
|
Asc.scope.column = data.column
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oTable = Api.CreateTable(Asc.scope.column, Asc.scope.rows)
|
||||||
|
oTable.SetWidth('percent', 100)
|
||||||
|
oTable.SetTableLayout('fixed')
|
||||||
|
oTable.SetTableCellMarginRight(0.2 * (1440 / 2.54))
|
||||||
|
oTable.SetTableCellMarginTop(0.2 * (1440 / 2.54))
|
||||||
|
oTable.SetTableCellMarginLeft(0.2 * (1440 / 2.54))
|
||||||
|
oTable.SetTableCellMarginBottom(0.2 * (1440 / 2.54))
|
||||||
|
oTable.SetTableBorderTop('single', 12, 0, 0, 0, 0)
|
||||||
|
oTable.SetTableBorderBottom('single', 12, 0, 0, 0, 0)
|
||||||
|
oTable.SetTableBorderLeft('single', 12, 0, 0, 0, 0)
|
||||||
|
oTable.SetTableBorderRight('single', 12, 0, 0, 0, 0)
|
||||||
|
oTable.SetTableBorderInsideV('single', 4, 0, 0, 0, 0)
|
||||||
|
oTable.SetTableBorderInsideH('single', 4, 0, 0, 0, 0)
|
||||||
|
const oRowsCount = oTable.GetRowsCount()
|
||||||
|
oTable.SetTableDescription('tableOp')
|
||||||
|
oDocument.InsertContent([oTable])
|
||||||
|
for (let i = 0; i < oRowsCount; i++) {
|
||||||
|
const oCellsCount = oTable.GetRow(i).GetCellsCount()
|
||||||
|
for (let j = 0; j < oCellsCount; j++) {
|
||||||
|
const cellEle = oTable
|
||||||
|
.GetRow(i)
|
||||||
|
.GetCell(j)
|
||||||
|
.GetContent()
|
||||||
|
.GetElement(0)
|
||||||
|
cellEle.SetSpacingAfter(10)
|
||||||
|
cellEle.SetFontSize(18)
|
||||||
|
cellEle.SetColor(0, 0, 0)
|
||||||
|
cellEle.SetFontSize(18)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表格注
|
||||||
|
const oLastRow = oTable.GetRow(oTable.GetRowsCount() - 1)
|
||||||
|
oLastRow.MergeCells()
|
||||||
|
oLastRow.SetHeight('atLeast', 540)
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
|
||||||
|
// 插入表格注
|
||||||
|
handleInsertNote () {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const newParagraph = Api.CreateParagraph()
|
||||||
|
const oTableCell = newParagraph.GetParentTableCell()
|
||||||
|
console.log(oTableCell)
|
||||||
|
const elementsCount = oTableCell.GetContent().GetElementsCount()
|
||||||
|
let noteNumLevel = null
|
||||||
|
for (let i = 0; i < elementsCount; i++) {
|
||||||
|
const ele = oTableCell.GetContent().GetElement(i)
|
||||||
|
if (
|
||||||
|
ele &&
|
||||||
|
ele.GetClassType() === 'paragraph' &&
|
||||||
|
ele.GetNumbering()
|
||||||
|
) {
|
||||||
|
noteNumLevel = ele.GetNumbering()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!noteNumLevel) {
|
||||||
|
const noteNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
noteNumLevel = noteNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '注%1:'
|
||||||
|
noteNumLevel.SetCustomType('decimal', sFormatString, 'center')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表格中文注
|
||||||
|
var textPr = noteNumLevel.GetTextPr()
|
||||||
|
textPr.SetFontFamily('黑体')
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
const noteParagraph = Api.CreateParagraph()
|
||||||
|
noteParagraph.SetNumbering(noteNumLevel)
|
||||||
|
noteParagraph.AddText('XXX')
|
||||||
|
noteParagraph.SetFontSize(18)
|
||||||
|
noteParagraph.SetFontFamily('SimSun')
|
||||||
|
|
||||||
|
if (elementsCount > 0) {
|
||||||
|
oTableCell.AddElement(elementsCount - 1, noteParagraph)
|
||||||
|
} else {
|
||||||
|
oTableCell.AddElement(0, noteParagraph)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elementsCount > 0) {
|
||||||
|
// oTableCell.AddElement(elementsCount, noteParagraphEN);
|
||||||
|
} else {
|
||||||
|
oTableCell.AddElement(1, noteParagraph)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInsertNoteThe () {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetCustomType('decimalZero', '注:', 'right')
|
||||||
|
oNumLvl.SetSuff('space')
|
||||||
|
const oParaPr = oNumLvl.GetParaPr()
|
||||||
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
// oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(-86)
|
||||||
|
const textPr = oNumLvl.GetTextPr()
|
||||||
|
textPr.SetFontFamily('黑体')
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetFontSize(18)
|
||||||
|
oParagraph.SetIndLeft(766)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInsertNoteOne () {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
let currentNumbering = null
|
||||||
|
for (let index = 0; index < allElement; index++) {
|
||||||
|
const element = oDocument.GetElement(index)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
for (let i = 0; i < element.GetRowsCount(); i++) {
|
||||||
|
if (element.GetCell(i, 0).GetContent().GetElement(0)) {
|
||||||
|
const Count = element.GetCell(i, 0).GetContent().GetElementsCount()
|
||||||
|
if (Count > 1) {
|
||||||
|
for (let j = 0; j < Count; j++) {
|
||||||
|
const getNumbering = element.GetCell(i, 0).GetContent().GetElement(j).GetNumbering()
|
||||||
|
const text = element.GetCell(i, 0).GetContent().GetElement(j).GetSpacingBefore()
|
||||||
|
if (text == 50) {
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!numbering) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '注%1:'
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'right')
|
||||||
|
numbering.SetSuff('space')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
// oParagraph.SetSpacingLine(400, "auto");
|
||||||
|
const oParaPr = numbering.GetParaPr()
|
||||||
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
// oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(-86)
|
||||||
|
const textPr = numbering.GetTextPr()
|
||||||
|
textPr.SetFontFamily('黑体')
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetSpacingBefore(50)
|
||||||
|
oParagraph.SetSpacingAfter(50)
|
||||||
|
oParagraph.SetIndLeft(856)
|
||||||
|
oParagraph.SetFontSize(18)
|
||||||
|
oParagraph.SetBold(false)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
// oNumbering = oParagraph.GetNumbering().GetNumbering()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInsertNoteTwo () {
|
||||||
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
|
window.Asc.scope.suffType = ''
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
oNumLvl.SetCustomType('decimal', '注%1:', 'right')
|
||||||
|
oNumLvl.SetSuff('space')
|
||||||
|
var oParaPr = oNumLvl.GetParaPr()
|
||||||
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
|
// oParaPr.SetJc("both");
|
||||||
|
oParaPr.SetIndFirstLine(-86)
|
||||||
|
var textPr = oNumLvl.GetTextPr()
|
||||||
|
textPr.SetFontFamily('黑体')
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetSpacingBefore(50)
|
||||||
|
oParagraph.SetSpacingAfter(50)
|
||||||
|
oParagraph.SetIndLeft(856)
|
||||||
|
oParagraph.SetBold(false)
|
||||||
|
oParagraph.SetFontSize(18)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleInsertName () {
|
||||||
|
Asc.scope.numData = this.numData
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let num = oParagraph.GetPosInParent()
|
||||||
|
let oNumLvl
|
||||||
|
let currentNumbering
|
||||||
|
let table
|
||||||
|
let SpacingBefore
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 75) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
if (table) {
|
||||||
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
|
}
|
||||||
|
if (SpacingBefore) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 75) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '表' + Asc.scope.numData[SpacingBefore] + '.%1'
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'center')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 75) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '表%1'
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'center')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
oNumLvl.SetSuff('tab')
|
||||||
|
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
const textPr = oNumLvl.GetTextPr()
|
||||||
|
textPr.SetFontFamily('黑体')
|
||||||
|
textPr.SetFontSize(21)
|
||||||
|
oParagraph.SetJc('center')
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetStyle(oNewDocumentStyle)
|
||||||
|
oParagraph.SetFontFamily('黑体')
|
||||||
|
oParagraph.SetSpacingAfter(75, false)
|
||||||
|
oParagraph.SetSpacingBefore(73.5, false)
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.AddText('XXX')
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let GetNext = oParagraph.GetNext()
|
||||||
|
GetNext.SetSpacingAfter(0)
|
||||||
|
GetNext.SetSpacingBefore(0)
|
||||||
|
// GetNext.Delete()
|
||||||
|
// oParagraph.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
},
|
||||||
|
handleInsertNoteFou () {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
const parentTable = oParagraph.GetParentTable()
|
||||||
|
if (!parentTable) {
|
||||||
|
let num = oParagraph.GetPosInParent()
|
||||||
|
let table
|
||||||
|
let oNumLvl
|
||||||
|
let currentNumbering
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'tableOp') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 30) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (table) {
|
||||||
|
const oRowsCount = table.GetRowsCount()
|
||||||
|
for (let i = 0; i < oRowsCount; i++) {
|
||||||
|
const oCellsCount = table.GetRow(i).GetCellsCount()
|
||||||
|
if (i == 0) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for (let j = 0; j < oCellsCount; j++) {
|
||||||
|
const cellEle = table
|
||||||
|
.GetRow(i)
|
||||||
|
.GetCell(j)
|
||||||
|
.GetContent()
|
||||||
|
.GetElementsCount()
|
||||||
|
for (let k = 0; k < cellEle; k++) {
|
||||||
|
const cellEle1 = table
|
||||||
|
.GetRow(i)
|
||||||
|
.GetCell(j)
|
||||||
|
.GetContent()
|
||||||
|
.GetElement(k)
|
||||||
|
cellEle1.SetFontSize(18)
|
||||||
|
let GetNumbering = cellEle1.GetNumbering()
|
||||||
|
if (GetNumbering) {
|
||||||
|
let spacingAfter = cellEle1.GetSpacingAfter()
|
||||||
|
if (spacingAfter == 30) {
|
||||||
|
currentNumbering = GetNumbering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
}
|
||||||
|
const sFormatString = '%1'
|
||||||
|
oNumLvl.SetCustomType('lowerLetter', sFormatString, 'left')
|
||||||
|
oNumLvl.SetSuff('space')
|
||||||
|
const textPr = oNumLvl.GetTextPr()
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
textPr.SetFontFamily('黑体')
|
||||||
|
textPr.SetSmallCaps(true)
|
||||||
|
textPr.SetVertAlign('superscript')
|
||||||
|
const paraPr = oNumLvl.GetParaPr()
|
||||||
|
paraPr.SetSpacingBefore(0)
|
||||||
|
paraPr.SetJc('left')
|
||||||
|
paraPr.SetIndFirstLine(-150)
|
||||||
|
const oParagraph1 = Api.CreateParagraph()
|
||||||
|
oParagraph1.AddText(oParagraph.GetText())
|
||||||
|
oParagraph1.SetIndLeft(574)
|
||||||
|
oParagraph1.SetNumbering(oNumLvl)
|
||||||
|
oParagraph1.SetSpacingAfter(30)
|
||||||
|
oParagraph1.SetFontSize(18)
|
||||||
|
oDocument.InsertContent([oParagraph1])
|
||||||
|
} else {
|
||||||
|
const oRowsCount = parentTable.GetRowsCount()
|
||||||
|
let oNumLvl
|
||||||
|
let currentNumbering
|
||||||
|
for (let i = 0; i < oRowsCount; i++) {
|
||||||
|
const oCellsCount = parentTable.GetRow(i).GetCellsCount()
|
||||||
|
if (i == 0) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for (let j = 0; j < oCellsCount; j++) {
|
||||||
|
const cellEle = parentTable
|
||||||
|
.GetRow(i)
|
||||||
|
.GetCell(j)
|
||||||
|
.GetContent()
|
||||||
|
.GetElementsCount()
|
||||||
|
for (let k = 0; k < cellEle; k++) {
|
||||||
|
const cellEle1 = parentTable
|
||||||
|
.GetRow(i)
|
||||||
|
.GetCell(j)
|
||||||
|
.GetContent()
|
||||||
|
.GetElement(k)
|
||||||
|
cellEle1.SetFontSize(18)
|
||||||
|
let GetNumbering = cellEle1.GetNumbering()
|
||||||
|
if (GetNumbering) {
|
||||||
|
let spacingAfter = cellEle1.GetSpacingAfter()
|
||||||
|
if (spacingAfter == 30) {
|
||||||
|
currentNumbering = GetNumbering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!currentNumbering) {
|
||||||
|
let numIndex = parentTable.GetPosInParent()
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
for (let i = numIndex + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'tableOp') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 30) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
|
||||||
|
}
|
||||||
|
const sFormatString = '%1'
|
||||||
|
oNumLvl.SetCustomType('lowerLetter', sFormatString, 'left')
|
||||||
|
oNumLvl.SetSuff('space')
|
||||||
|
const textPr = oNumLvl.GetTextPr()
|
||||||
|
textPr.SetFontSize(18)
|
||||||
|
textPr.SetFontFamily('黑体')
|
||||||
|
textPr.SetSmallCaps(true)
|
||||||
|
textPr.SetVertAlign('superscript')
|
||||||
|
const paraPr = oNumLvl.GetParaPr()
|
||||||
|
paraPr.SetSpacingBefore(0)
|
||||||
|
paraPr.SetJc('left')
|
||||||
|
paraPr.SetIndFirstLine(-150)
|
||||||
|
const oParagraph1 = Api.CreateParagraph()
|
||||||
|
oParagraph1.SetIndLeft(586)
|
||||||
|
oParagraph1.SetNumbering(oNumLvl)
|
||||||
|
oParagraph1.SetSpacingAfter(30)
|
||||||
|
oParagraph1.SetFontSize(18)
|
||||||
|
oDocument.InsertContent([oParagraph1])
|
||||||
|
let GetNext = oParagraph1.GetNext()
|
||||||
|
GetNext.Delete()
|
||||||
|
}
|
||||||
|
oParagraph.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-button-group style="margin-bottom: 10px">
|
||||||
|
<a-button @click="terminology">术语</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "Terminology",
|
||||||
|
methods: {
|
||||||
|
terminology () {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
// DE.controllers.Toolbar.api.put_ListType(2, 2)
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let num = oParagraph.GetPosInParent()
|
||||||
|
let oNumLvl
|
||||||
|
let currentNumbering
|
||||||
|
let table
|
||||||
|
let SpacingBefore
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
if (table) {
|
||||||
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
|
}
|
||||||
|
if (SpacingBefore) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1 '
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '%1 '
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// oParagraphOne.Delete()
|
||||||
|
// const oParagraph = Api.CreateParagraph()
|
||||||
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
|
oParagraphNew.AddText(oParagraph.GetText())
|
||||||
|
oParagraph.Delete()
|
||||||
|
let oTextPr = oNumLvl.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
let oParaPr = oNumLvl.GetParaPr()
|
||||||
|
oNumLvl.SetSuff('none')
|
||||||
|
// oParagraphNew.SetNumbering(oNumLvl)
|
||||||
|
if (SpacingBefore) {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
oParaPr.SetIndFirstLine(20)
|
||||||
|
} else {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
}
|
||||||
|
oParagraphNew.SetSpacingAfter(267)
|
||||||
|
oParagraphNew.SetSpacingBefore(267)
|
||||||
|
oParagraphNew.SetBold(false)
|
||||||
|
const oNewDocumentStyle = oDocument.GetStyle('Heading 1')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetStyle(oNewDocumentStyle)
|
||||||
|
oParagraphNew.SetFontSize(21)
|
||||||
|
oParagraphNew.SetColor(0, 0, 0)
|
||||||
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
|
oDocument.InsertContent([oParagraphNew])
|
||||||
|
let GetNext = oParagraphNew.GetNext()
|
||||||
|
GetNext.SetSpacingAfter(0)
|
||||||
|
GetNext.SetSpacingBefore(0)
|
||||||
|
// GetNext.Delete()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,763 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-button-group style="margin-bottom: 10px">
|
||||||
|
<a-button @click="insertChapter(0)">章</a-button>
|
||||||
|
<a-button @click="insertBar(1,true)">条一</a-button>
|
||||||
|
<a-button @click="insertBar(2,true)">条二</a-button>
|
||||||
|
<a-button @click="insertBar(3,true)">条三</a-button>
|
||||||
|
<a-button @click="insertBar(4,true)">条四</a-button>
|
||||||
|
<a-button @click="insertBar(5,true)">条五</a-button>
|
||||||
|
<!-- <a-dropdown>-->
|
||||||
|
<!-- <a-menu slot="overlay" @click="insertBar">-->
|
||||||
|
<!-- <a-menu-item key="1">插入一级条</a-menu-item>-->
|
||||||
|
<!-- <a-menu-item key="2">插入二级条</a-menu-item>-->
|
||||||
|
<!-- <a-menu-item key="3">插入三级条</a-menu-item>-->
|
||||||
|
<!-- <a-menu-item key="4">插入四级条</a-menu-item>-->
|
||||||
|
<!-- <a-menu-item key="5">插入五级条</a-menu-item>-->
|
||||||
|
<!-- </a-menu>-->
|
||||||
|
<!-- <a-button class="section-btn"-->
|
||||||
|
<!-- >插入条-->
|
||||||
|
<!-- <a-icon type="down"/>-->
|
||||||
|
<!-- </a-button>-->
|
||||||
|
<!-- </a-dropdown>-->
|
||||||
|
<!-- <a-dropdown>-->
|
||||||
|
<!-- <a-menu slot="overlay" @click="adjustTo">-->
|
||||||
|
<!-- <a-menu-item key="0">章标题</a-menu-item>-->
|
||||||
|
<!-- <a-menu-item key="1">一级条标题</a-menu-item>-->
|
||||||
|
<!-- <a-menu-item key="2">二级条标题</a-menu-item>-->
|
||||||
|
<!-- <a-menu-item key="3">三级条标题</a-menu-item>-->
|
||||||
|
<!-- </a-menu>-->
|
||||||
|
<!-- <a-button class="section-btn"-->
|
||||||
|
<!-- >调整为-->
|
||||||
|
<!-- <a-icon type="down"/>-->
|
||||||
|
<!-- </a-button>-->
|
||||||
|
<!-- </a-dropdown>-->
|
||||||
|
</a-button-group>
|
||||||
|
<a-button-group style="margin-bottom: 10px">
|
||||||
|
<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>
|
||||||
|
<a-button @click="insertBarOne(5,false)">无题五</a-button>
|
||||||
|
|
||||||
|
</a-button-group>
|
||||||
|
<!-- <div>-->
|
||||||
|
<!-- <a-button-group>-->
|
||||||
|
<!-- <a-button @click="demoteClick">降级</a-button>-->
|
||||||
|
<!-- <a-button @click="upgradeClick">升级</a-button>-->
|
||||||
|
<!-- </a-button-group>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'chapterData',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
num: 0,
|
||||||
|
numData: {
|
||||||
|
1: 'A',
|
||||||
|
2: 'B',
|
||||||
|
3: 'C',
|
||||||
|
4: 'D',
|
||||||
|
5: 'E',
|
||||||
|
6: 'F',
|
||||||
|
7: 'G',
|
||||||
|
8: 'H',
|
||||||
|
9: 'I',
|
||||||
|
10: 'J',
|
||||||
|
11: 'K',
|
||||||
|
12: 'L',
|
||||||
|
13: 'M',
|
||||||
|
14: 'N',
|
||||||
|
15: 'O',
|
||||||
|
16: 'P',
|
||||||
|
17: 'Q',
|
||||||
|
18: 'R',
|
||||||
|
19: 'S',
|
||||||
|
20: 'T',
|
||||||
|
21: 'U',
|
||||||
|
22: 'V',
|
||||||
|
23: 'W',
|
||||||
|
24: 'X',
|
||||||
|
25: 'Y',
|
||||||
|
26: 'Z'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
insertChapter (val) {
|
||||||
|
Asc.scope.alias = val
|
||||||
|
Asc.scope.numData = this.numData
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
// DE.controllers.Toolbar.api.put_ListType(2, 2)
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let num = oParagraph.GetPosInParent()
|
||||||
|
let oNumLvl
|
||||||
|
let currentNumbering
|
||||||
|
let table
|
||||||
|
let SpacingBefore
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
if (table) {
|
||||||
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
|
}
|
||||||
|
if (SpacingBefore) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1 '
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '%1 '
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// oParagraphOne.Delete()
|
||||||
|
// const oParagraph = Api.CreateParagraph()
|
||||||
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
|
oParagraphNew.AddText(oParagraph.GetText())
|
||||||
|
oParagraph.Delete()
|
||||||
|
let oTextPr = oNumLvl.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
let oParaPr = oNumLvl.GetParaPr()
|
||||||
|
oNumLvl.SetSuff('none')
|
||||||
|
oParagraphNew.SetNumbering(oNumLvl)
|
||||||
|
if (SpacingBefore) {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
oParaPr.SetIndFirstLine(20)
|
||||||
|
} else {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
}
|
||||||
|
oParagraphNew.SetSpacingAfter(267)
|
||||||
|
oParagraphNew.SetSpacingBefore(267)
|
||||||
|
oParagraphNew.SetBold(false)
|
||||||
|
const oNewDocumentStyle = oDocument.GetStyle('Heading 1')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetStyle(oNewDocumentStyle)
|
||||||
|
oParagraphNew.SetFontSize(21)
|
||||||
|
oParagraphNew.SetColor(0, 0, 0)
|
||||||
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
|
oDocument.InsertContent([oParagraphNew])
|
||||||
|
let GetNext = oParagraphNew.GetNext()
|
||||||
|
GetNext.SetSpacingAfter(0)
|
||||||
|
GetNext.SetSpacingBefore(0)
|
||||||
|
// GetNext.Delete()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
insertBar (val, isTrue) {
|
||||||
|
Asc.scope.alias = val
|
||||||
|
Asc.scope.isTrue = isTrue
|
||||||
|
Asc.scope.numData = this.numData
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let num = oParagraph.GetPosInParent()
|
||||||
|
let numbering
|
||||||
|
let currentNumbering
|
||||||
|
let table
|
||||||
|
let SpacingBefore
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267 || text == 127) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
if (table) {
|
||||||
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
|
}
|
||||||
|
if (SpacingBefore) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267 || text == 127) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(Asc.scope.alias)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267 || text == 127) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(Asc.scope.alias)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
|
oParagraphNew.AddText(oParagraph.GetText())
|
||||||
|
oParagraph.Delete()
|
||||||
|
let oNewDocumentStyle = null
|
||||||
|
if (SpacingBefore) {
|
||||||
|
if (Asc.scope.alias == '1') {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 2')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
} else if (Asc.scope.alias == '2') {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 3')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
} else if (Asc.scope.alias == '3') {
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 4')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
} else if (Asc.scope.alias == '4') {
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 5')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
} else if (Asc.scope.alias == '5') {
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 6')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Asc.scope.alias == '1') {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
const sFormatString = '%1.%2 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 2')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
} else if (Asc.scope.alias == '2') {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
const sFormatString = '%1.%2.%3 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 3')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
} else if (Asc.scope.alias == '3') {
|
||||||
|
const sFormatString = '%1.%2.%3.%4 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 4')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
} else if (Asc.scope.alias == '4') {
|
||||||
|
const sFormatString = '%1.%2.%3.%4.%5 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 5')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
} else if (Asc.scope.alias == '5') {
|
||||||
|
const sFormatString = '%1.%2.%3.%4.%5.%6 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Heading 6')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const ParaPr = numbering.GetParaPr()
|
||||||
|
ParaPr.SetStyle(oNewDocumentStyle)
|
||||||
|
ParaPr.SetSpacingAfter(140)
|
||||||
|
oParagraphNew.SetStyle(oNewDocumentStyle)
|
||||||
|
oParagraphNew.SetNumbering(numbering)
|
||||||
|
oParagraphNew.SetSpacingAfter(127)
|
||||||
|
oParagraphNew.SetSpacingBefore(127)
|
||||||
|
oParagraphNew.SetBold(false)
|
||||||
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetFontSize(21)
|
||||||
|
oParagraphNew.SetJc('both')
|
||||||
|
oParagraphNew.SetColor(0, 0, 0)
|
||||||
|
oDocument.InsertContent([oParagraphNew])
|
||||||
|
let GetNext = oParagraphNew.GetNext()
|
||||||
|
GetNext.SetSpacingAfter(0)
|
||||||
|
GetNext.SetSpacingBefore(0)
|
||||||
|
// GetNext.Delete()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
insertBarOne (val, isTrue) {
|
||||||
|
Asc.scope.alias = val
|
||||||
|
Asc.scope.isTrue = isTrue
|
||||||
|
Asc.scope.numData = this.numData
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let num = oParagraph.GetPosInParent()
|
||||||
|
let numbering
|
||||||
|
let currentNumbering
|
||||||
|
let table
|
||||||
|
let SpacingBefore
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267 || text == 127) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
if (table) {
|
||||||
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
|
}
|
||||||
|
if (SpacingBefore) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267 || text == 127) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(Asc.scope.alias)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267 || text == 127) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = oNumbering.GetLevel(Asc.scope.alias)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
|
oParagraphNew.AddText(oParagraph.GetText())
|
||||||
|
oParagraph.Delete()
|
||||||
|
let oNewDocumentStyle = null
|
||||||
|
if (SpacingBefore) {
|
||||||
|
if (Asc.scope.alias == '1') {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
} else if (Asc.scope.alias == '2') {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
} else if (Asc.scope.alias == '3') {
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
} else if (Asc.scope.alias == '4') {
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
} else if (Asc.scope.alias == '5') {
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(25)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Asc.scope.alias == '1') {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
const sFormatString = '%1.%2 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
} else if (Asc.scope.alias == '2') {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
const sFormatString = '%1.%2.%3 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
} else if (Asc.scope.alias == '3') {
|
||||||
|
const sFormatString = '%1.%2.%3.%4 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
} else if (Asc.scope.alias == '4') {
|
||||||
|
const sFormatString = '%1.%2.%3.%4.%5 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
} else if (Asc.scope.alias == '5') {
|
||||||
|
const sFormatString = '%1.%2.%3.%4.%5.%6 '
|
||||||
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
numbering.SetSuff('none')
|
||||||
|
let oParaPr = numbering.GetParaPr()
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// oParagraphOne.Delete()
|
||||||
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
const ParaPr = numbering.GetParaPr()
|
||||||
|
ParaPr.SetStyle(oNewDocumentStyle)
|
||||||
|
ParaPr.SetSpacingAfter(140)
|
||||||
|
oParagraphNew.SetStyle(oNewDocumentStyle)
|
||||||
|
oParagraphNew.SetNumbering(numbering)
|
||||||
|
oParagraphNew.SetSpacingAfter(0)
|
||||||
|
oParagraphNew.SetSpacingBefore(0)
|
||||||
|
oParagraphNew.SetFontFamily('宋体')
|
||||||
|
oParagraphNew.SetBold(false)
|
||||||
|
oParagraphNew.SetFontSize(21)
|
||||||
|
oParagraphNew.SetJc('left')
|
||||||
|
oParagraphNew.SetColor(0, 0, 0)
|
||||||
|
oDocument.InsertContent([oParagraphNew])
|
||||||
|
let GetNext = oParagraphNew.GetNext()
|
||||||
|
GetNext.SetSpacingAfter(0)
|
||||||
|
GetNext.SetSpacingBefore(0)
|
||||||
|
// GetNext.Delete()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
adjustTo (val) {
|
||||||
|
Asc.scope.alias = val.key
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
let numbering = null
|
||||||
|
let currentNumbering = null
|
||||||
|
for (let index = 0; index < allElement; index++) {
|
||||||
|
const element = oDocument.GetElement(index)
|
||||||
|
if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
} else {
|
||||||
|
currentNumbering = element.CreateNumbering('numbered')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!numbering) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
|
} else {
|
||||||
|
const numberingIndex = oDocument.CreateNumbering('numbered')
|
||||||
|
numbering = numberingIndex.GetLevel(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.SetIndLeft(360)
|
||||||
|
oParagraph.SetBold(false)
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetFontFamily('黑体')
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
demoteClick () {
|
||||||
|
|
||||||
|
},
|
||||||
|
upgradeClick () {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<template></template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
test() {
|
||||||
|
try {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
|
||||||
|
})
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<template>
|
||||||
|
<div id="app">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
window.Asc.plugin.init = function () {
|
||||||
|
// Vue.prototype.ctx = this
|
||||||
|
this.callCommand(() => {
|
||||||
|
// console.log(window, document)
|
||||||
|
// const node = document.getElementById('header-logo').lastChild.cloneNode(true)
|
||||||
|
// document.getElementById('header-logo').innerHTML = ''
|
||||||
|
// document.getElementById('header-logo').appendChild(node)
|
||||||
|
// const permissions = new window.AscCommon.xHd()
|
||||||
|
// permissions.$Vd = 3
|
||||||
|
// window.localStorage.setItem('de-license-warning', 0)
|
||||||
|
// window.editor.sendEvent('asc_onLicenseChanged', permissions)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
window.Asc.plugin.button = (id) => {
|
||||||
|
console.log('wx2', id)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
#app {
|
||||||
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
text-align: center;
|
||||||
|
color: #2c3e50;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav {
|
||||||
|
padding: 30px;
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #2c3e50;
|
||||||
|
|
||||||
|
&.router-link-exact-active {
|
||||||
|
color: #42b983;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name" : "RemoveLogoClickEvent",
|
||||||
|
"guid" : "asc.{7CC733B1-9B26-4977-926E-D212B13F2B70}",
|
||||||
|
"baseUrl" : "",
|
||||||
|
"variations" : [
|
||||||
|
{
|
||||||
|
"description" : "RemoveLogoClickEvent By WangXu",
|
||||||
|
"url" : "index.html",
|
||||||
|
"icons" : ["icon.png", "icon@2x.png", "icon2.png", "icon2@2x.png"],
|
||||||
|
"isViewer" : false,
|
||||||
|
"EditorsSupport" : ["word"],
|
||||||
|
"isVisual" : false,
|
||||||
|
"isSystem" : true,
|
||||||
|
"isModal" : false,
|
||||||
|
"isInsideMode" : false,
|
||||||
|
"initDataType" : "none",
|
||||||
|
"initData" : "",
|
||||||
|
"isUpdateOleOnResize" : true,
|
||||||
|
"buttons" : []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<script type="text/javascript" src="./plugins.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
(function (window, undefined) {
|
||||||
|
window.Asc.plugin.init = function()
|
||||||
|
{
|
||||||
|
this.callCommand(() => {
|
||||||
|
this.callCommand(() => {
|
||||||
|
// console.log(window, document)
|
||||||
|
const node = document.getElementById('header-logo').lastChild.cloneNode(true)
|
||||||
|
document.getElementById('header-logo').innerHTML = ''
|
||||||
|
document.getElementById('header-logo').appendChild(node)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
};
|
||||||
|
})(window, undefined);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Binary file not shown.
@@ -0,0 +1,10 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import App from './App.vue'
|
||||||
|
// import router from './router';
|
||||||
|
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
// router,
|
||||||
|
render: (h) => h(App),
|
||||||
|
}).$mount('#app')
|
||||||
Binary file not shown.
@@ -0,0 +1,57 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
// Full config: https://github.com/axios/axios#request-config
|
||||||
|
// axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
|
||||||
|
// axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
||||||
|
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
// baseURL: process.env.baseURL || process.env.apiUrl || ""
|
||||||
|
// timeout: 60 * 1000, // Timeout
|
||||||
|
// withCredentials: true, // Check cross-site Access-Control
|
||||||
|
}
|
||||||
|
|
||||||
|
const _axios = axios.create(config)
|
||||||
|
|
||||||
|
_axios.interceptors.request.use(
|
||||||
|
(config) =>
|
||||||
|
// Do something before request is sent
|
||||||
|
config,
|
||||||
|
(error) =>
|
||||||
|
// Do something with request error
|
||||||
|
Promise.reject(error)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
// Add a response interceptor
|
||||||
|
_axios.interceptors.response.use(
|
||||||
|
(response) =>
|
||||||
|
// Do something with response data
|
||||||
|
response,
|
||||||
|
(error) =>
|
||||||
|
// Do something with response error
|
||||||
|
Promise.reject(error)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
Plugin.install = function (Vue, options) {
|
||||||
|
Vue.axios = _axios
|
||||||
|
window.axios = _axios
|
||||||
|
Object.defineProperties(Vue.prototype, {
|
||||||
|
axios: {
|
||||||
|
get() {
|
||||||
|
return _axios
|
||||||
|
}
|
||||||
|
},
|
||||||
|
$axios: {
|
||||||
|
get() {
|
||||||
|
return _axios
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Vue.use(Plugin)
|
||||||
|
|
||||||
|
export default Plugin
|
||||||
Binary file not shown.
@@ -0,0 +1,38 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
// Full config: https://github.com/axios/axios#request-config
|
||||||
|
// axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
|
||||||
|
// axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
||||||
|
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
// baseURL: '/'
|
||||||
|
baseURL: window._CONFIG.interfaceUrl//本地
|
||||||
|
// baseURL: 'https://srms.foton.com.cn',//线上
|
||||||
|
// timeout: 60 * 1000, // Timeout
|
||||||
|
// withCredentials: true, // Check cross-site Access-Control
|
||||||
|
}
|
||||||
|
|
||||||
|
const _axios = axios.create(config)
|
||||||
|
|
||||||
|
_axios.interceptors.request.use(
|
||||||
|
(config) =>
|
||||||
|
// Do something before request is sent
|
||||||
|
config,
|
||||||
|
(error) =>
|
||||||
|
// Do something with request error
|
||||||
|
Promise.reject(error)
|
||||||
|
)
|
||||||
|
|
||||||
|
// Add a response interceptor
|
||||||
|
_axios.interceptors.response.use(
|
||||||
|
(response) =>
|
||||||
|
// Do something with response data
|
||||||
|
response.data,
|
||||||
|
(error) =>
|
||||||
|
// Do something with response error
|
||||||
|
Promise.reject(error)
|
||||||
|
)
|
||||||
|
|
||||||
|
export default _axios
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import VueRouter from 'vue-router'
|
||||||
|
|
||||||
|
Vue.use(VueRouter)
|
||||||
|
|
||||||
|
const routes = []
|
||||||
|
|
||||||
|
const router = new VueRouter({
|
||||||
|
mode: 'history',
|
||||||
|
base: process.env.BASE_URL,
|
||||||
|
routes
|
||||||
|
})
|
||||||
|
|
||||||
|
export default router
|
||||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
|
Vue.use(Vuex)
|
||||||
|
|
||||||
|
export default new Vuex.Store({
|
||||||
|
state: {
|
||||||
|
chapterNumbering: sessionStorage.getItem('chapterNumbering') || null
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
chapterNumbering: state => {
|
||||||
|
return state.chapterNumbering
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
updateChapterNumbering(state, chapterNumbering) {
|
||||||
|
state.chapterNumbering = chapterNumbering
|
||||||
|
sessionStorage.setItem('chapterNumbering', chapterNumbering)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
const glob = require('glob')
|
||||||
|
|
||||||
|
const pages = {};
|
||||||
|
module.exports.pages = function getPages() {
|
||||||
|
glob.sync('./src/pages/*/*.js').forEach((filepath) => {
|
||||||
|
const fileList = filepath.split('/')
|
||||||
|
const fileName = fileList[fileList.length - 2]
|
||||||
|
pages[fileName] = {
|
||||||
|
// entry: `src/pages/${fileName}/${fileName}.js`,
|
||||||
|
entry: `src/pages/${fileName}/index.js`,
|
||||||
|
// 模板来源
|
||||||
|
// template: `src/pages/${fileName}/${fileName}.html`,
|
||||||
|
template: 'public/index.html',
|
||||||
|
// 在 dist/index.html 的输出
|
||||||
|
filename: process.env.NODE_ENV === 'development' ? `${fileName}/index.html` : `${fileName}/index.html`,
|
||||||
|
// 提取出来的通用 chunk 和 vendor chunk。
|
||||||
|
chunks: ['chunk-vendors', 'chunk-common', fileName],
|
||||||
|
// favicon: '../favicon.ico'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return pages;
|
||||||
|
};
|
||||||
|
|
||||||
|
const configs = [];
|
||||||
|
module.exports.configs = function getConfigs() {
|
||||||
|
glob.sync('./src/pages/*/config.json').forEach((filepath) => {
|
||||||
|
const fileList = filepath.split('/')
|
||||||
|
const fileName = fileList[fileList.length - 2]
|
||||||
|
configs.push({
|
||||||
|
from: `src/pages/${fileName}/config.json`,
|
||||||
|
to: process.env.NODE_ENV === 'development' ? `${fileName}/config.json` : `${fileName}/config.json`
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return configs;
|
||||||
|
};
|
||||||
Binary file not shown.
@@ -0,0 +1,55 @@
|
|||||||
|
/* eslint-disable import/extensions */
|
||||||
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
|
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
const pageMethod = require('./utils/getPages.js')
|
||||||
|
|
||||||
|
const pages = pageMethod.pages()
|
||||||
|
const configs = pageMethod.configs()
|
||||||
|
|
||||||
|
// const { interfaceUrl } = require('./src/config')
|
||||||
|
function resolve (dir) {
|
||||||
|
return path.join(__dirname, dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
pages,
|
||||||
|
// publicPath: '/onlyofficeplugins/',
|
||||||
|
outputDir: 'onlyofficeplugins', //设置打包后的项目目录名称
|
||||||
|
configureWebpack: {
|
||||||
|
plugins: [
|
||||||
|
new CopyWebpackPlugin(configs)
|
||||||
|
]
|
||||||
|
},
|
||||||
|
css: {
|
||||||
|
loaderOptions: {
|
||||||
|
less: {
|
||||||
|
javascriptEnabled: true, // old solution
|
||||||
|
// HERE is the difference!
|
||||||
|
lessOptions: {
|
||||||
|
javascriptEnabled: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
chainWebpack: (config) => {
|
||||||
|
config.resolve.alias
|
||||||
|
.set('@', resolve('./src'))
|
||||||
|
.set('@/common', resolve('@/common'))
|
||||||
|
},
|
||||||
|
devServer: {
|
||||||
|
port: 8092,
|
||||||
|
headers: { 'Access-Control-Allow-Origin': '*' },
|
||||||
|
proxy: {
|
||||||
|
'/laws-chery': {
|
||||||
|
target: 'http://10.0.10.87:8188',
|
||||||
|
ws: false,
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: {
|
||||||
|
// '/laws-chery': '' // 默认所有请求都加了jero-boot前缀,需要去掉
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "..\\onlyoffice-front"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "..\\sdkjs-dev"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "..\\web-apps-dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user