Skip to content

Commit 8a870b3

Browse files
committed
feat: 添加示例模板按钮,上传图片按钮,修复层级关系BUG
1 parent a164081 commit 8a870b3

File tree

10 files changed

+360
-93
lines changed

10 files changed

+360
-93
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ export default {
116116
以下是待办列表,写一些接下来该项目要干的事:
117117

118118
[] 基本功能
119+
119120
[·] BUG修复
121+
120122
[·] 剔除ElementUI
123+
121124
[·] 调整RoyText渲染逻辑

package-lock.json

Lines changed: 46 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "print-template-designer",
3-
"version": "0.1.13",
3+
"version": "0.1.14",
44
"private": false,
55
"author": {
66
"email": "admin@royians.cn",
@@ -23,6 +23,7 @@
2323
],
2424
"dependencies": {
2525
"@wangeditor/editor": "^5.1.22",
26+
"axios": "^1.2.2",
2627
"big.js": "^6.2.1",
2728
"core-js": "^3.8.3",
2829
"element-ui": "^2.15.9",

public/templates/comp-purchase-template.rptd

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

src/App.vue

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,25 @@
4141
:data-set="dataSet"
4242
:data-source="dataSource"
4343
/>
44+
<TemplateViews
45+
v-if="templateVisible"
46+
:visible.sync="templateVisible"
47+
@load="loadTemp"
48+
/>
49+
<div class="fork-me">
50+
<a
51+
href="https://github.com/ROYIANS/print-template-designer"
52+
target="_blank"
53+
>Give me a Star!
54+
</a>
55+
</div>
4456
</div>
4557
</template>
4658

4759
<script>
4860
import toast from '@/utils/toast'
4961
import PtdViewer from '@/components/Viewer/PtdViewer'
62+
import TemplateViews from '@/views/templates/TemplateViews'
5063
import { mapState } from 'vuex'
5164
5265
export default {
@@ -56,7 +69,8 @@ export default {
5669
console.log('contributed by ROYIANS@Little-Dreamland﹢')
5770
},
5871
components: {
59-
PtdViewer
72+
PtdViewer,
73+
TemplateViews
6074
},
6175
computed: {
6276
...mapState({
@@ -74,21 +88,17 @@ export default {
7488
name: '从报表配置拉取表格',
7589
icon: 'ri-table-line',
7690
event: () => {
77-
toast('从报表配置拉取表格(开发者自定义事件)')
91+
toast('(开发者自定义按钮)')
7892
}
7993
}
8094
],
8195
headIconConfig: [
8296
{
8397
name: 'Github',
84-
icon: 'ri-github-fill',
85-
title: '跳转到Github',
98+
icon: 'ri-file-word-2-line',
99+
title: '预设模板',
86100
event: () => {
87-
toast('跳转到Github', 'info', 1000)
88-
window.open(
89-
'https://github.com/ROYIANS/print-template-designer',
90-
'_blank'
91-
)
101+
this.templateVisible = true
92102
}
93103
},
94104
{
@@ -130,39 +140,20 @@ export default {
130140
curDateTime: 'YYYY.MM.DD hh:mm',
131141
curDateChn: '',
132142
curDateNum: 'YYYY年MM月DD日',
133-
tableData: [
134-
{
135-
name: '张三',
136-
age: 13,
137-
money: 10000,
138-
gender: '1',
139-
address:
140-
'小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号'
141-
},
142-
{
143-
name: '李四',
144-
age: 23,
145-
money: 20000,
146-
gender: '2',
147-
address:
148-
'小梦小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号小梦岛街道001号岛街道002号'
149-
},
150-
{
151-
name: '王五',
152-
age: 24,
153-
money: 123456789.12,
154-
gender: '1',
155-
address: '小梦岛街道003号'
156-
}
157-
],
158-
author: 'ROYIANS'
143+
currentTime: 'YYYY年MM月DD日',
144+
tableData: [{}, {}, {}, {}]
159145
},
160-
viewerVisible: false
146+
viewerVisible: false,
147+
templateVisible: false
161148
}
162149
},
163150
methods: {
164151
showViewer() {
165152
this.viewerVisible = true
153+
},
154+
loadTemp(data) {
155+
this.$refs.designer.loadTemplateData(data)
156+
this.templateVisible = false
166157
}
167158
}
168159
}
@@ -243,4 +234,22 @@ body,
243234
font-size: 14px;
244235
}
245236
}
237+
238+
.fork-me {
239+
a {
240+
text-decoration: none;
241+
color: #fff;
242+
}
243+
width: 250px;
244+
height: 32px;
245+
line-height: 32px;
246+
background: black;
247+
text-align: center;
248+
font-family: fantasy;
249+
transform: rotate(-45deg);
250+
position: fixed;
251+
right: -69px;
252+
bottom: 39px;
253+
cursor: pointer;
254+
}
246255
</style>

src/components/Main/Home.vue

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,18 +355,7 @@ export default {
355355
toast('文件格式错误,转换内容失败', 'warning')
356356
return
357357
}
358-
this.$store.commit(
359-
'printTemplateModule/setComponentData',
360-
resultParsed.componentData
361-
)
362-
this.$store.commit(
363-
'printTemplateModule/setPageConfig',
364-
resultParsed.pageConfig
365-
)
366-
this.$store.commit(
367-
'printTemplateModule/setDataSource',
368-
resultParsed.dataSource
369-
)
358+
this.loadTemplateData(resultParsed)
370359
} catch (e) {
371360
toast('文件损坏,转换内容失败', 'warning')
372361
}
@@ -398,6 +387,20 @@ export default {
398387
document.body.removeChild(eleA)
399388
toast('导出成功!', 'success')
400389
},
390+
loadTemplateData(resultParsed) {
391+
this.$store.commit(
392+
'printTemplateModule/setComponentData',
393+
resultParsed.componentData
394+
)
395+
this.$store.commit(
396+
'printTemplateModule/setPageConfig',
397+
resultParsed.pageConfig
398+
)
399+
this.$store.commit(
400+
'printTemplateModule/setDataSource',
401+
resultParsed.dataSource
402+
)
403+
},
401404
getTemplateData() {
402405
return {
403406
type: 'rptd',

0 commit comments

Comments
 (0)