hd-idevvue3 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -191
- package/dist/index.html +17 -0
- package/package.json +13 -9
- package/pnpm-lock.yaml +5593 -0
- package/src/App.vue +15 -0
- package/src/assets/sound/notify.wav +0 -0
- package/src/demo/demo.vue +43 -0
- package/src/demo/dropdemo.vue +43 -0
- package/src/demo/extsets.vue +107 -0
- package/src/demo/formedit.vue +145 -0
- package/src/demo/hightquery.vue +169 -0
- package/src/demo/inlineedit.vue +88 -0
- package/src/demo/selfdrop.vue +41 -0
- package/src/demo//350/241/214/345/206/205/347/272/247/350/201/224.txt +2 -0
- package/src/directive/el-dragDialog/drag.js +124 -0
- package/src/directive/el-dragDialog/index.js +13 -0
- package/src/errorLog.js +14 -0
- package/src/hdcom/BigGrid.js +173 -0
- package/src/hdcom/BillShow.vue +90 -0
- package/src/hdcom/BillUpload.vue +253 -0
- package/src/hdcom/BtnRight.vue +98 -0
- package/src/hdcom/ErrHint.vue +30 -0
- package/src/hdcom/ExtendColumn.vue +108 -0
- package/src/hdcom/ExtendCommon.js +29 -0
- package/src/hdcom/ExtendForm.vue +114 -0
- package/src/hdcom/FacePicUpload.vue +71 -0
- package/src/hdcom/FaceRecTest.vue +104 -0
- package/src/hdcom/GridChart.vue +194 -0
- package/src/hdcom/GridExField.vue +281 -0
- package/src/hdcom/GridShow.vue +238 -0
- package/src/hdcom/HdAside.vue +178 -0
- package/src/hdcom/HdBtn.vue +113 -0
- package/src/hdcom/HdButton.vue +137 -0
- package/src/hdcom/HdComFaceRec.vue +58 -0
- package/src/hdcom/HdComGrid.vue +776 -0
- package/src/hdcom/HdComQuery.vue +273 -0
- package/src/hdcom/HdComQueryDetail.vue +161 -0
- package/src/hdcom/HdComSortDetail.vue +155 -0
- package/src/hdcom/HdDatePicker.vue +78 -0
- package/src/hdcom/HdDialog.vue +63 -0
- package/src/hdcom/HdDrop.vue +163 -0
- package/src/hdcom/HdFileUpload.vue +148 -0
- package/src/hdcom/HdFilterBox.vue +90 -0
- package/src/hdcom/HdFooter.vue +149 -0
- package/src/hdcom/HdForm.vue +278 -0
- package/src/hdcom/HdFormBtn.vue +89 -0
- package/src/hdcom/HdFormItem.vue +35 -0
- package/src/hdcom/HdGctosGrid +0 -0
- package/src/hdcom/HdGrid.vue +825 -0
- package/src/hdcom/HdGridEditBtn.vue +44 -0
- package/src/hdcom/HdGridExt.js +219 -0
- package/src/hdcom/HdGridSel.vue +223 -0
- package/src/hdcom/HdHeader.vue +148 -0
- package/src/hdcom/HdHotKey.vue +81 -0
- package/src/hdcom/HdInputHint.vue +49 -0
- package/src/hdcom/HdMain.vue +43 -0
- package/src/hdcom/HdMessage.vue +192 -0
- package/src/hdcom/HdNum.vue +69 -0
- package/src/hdcom/HdPopSel.vue +58 -0
- package/src/hdcom/HdRightMenu.vue +61 -0
- package/src/hdcom/HdSel/SelGridFieldcod.vue +36 -0
- package/src/hdcom/HdTableColumn.vue +334 -0
- package/src/hdcom/HdTempSave.vue +140 -0
- package/src/hdcom/HdTree.vue +86 -0
- package/src/hdcom/HdTreeTable/eval.js +32 -0
- package/src/hdcom/HdTreeTable/index.vue +174 -0
- package/src/hdcom/ImportExcel.vue +143 -0
- package/src/hdcom/PdfShow.vue +266 -0
- package/src/hdcom/index.js +80 -0
- package/src/idev.common.js +72 -0
- package/src/index.js +13 -0
- package/src/utils/HdQuery.js +54 -0
- package/src/utils/comutils.js +98 -0
- package/src/utils/utils.js +105 -0
- package/src/vendor/Blob.js +179 -0
- package/src/vendor/Export2Excel.js +220 -0
- package/src/vendor/Export2Zip.js +22 -0
- package/src/views/layout/AppMain.vue +32 -0
- package/src/views/layout/HdLayout.vue +78 -0
- package/src/views/layout/header/ElasticSearch.vue +225 -0
- package/src/views/layout/header/HZRecorder.js +231 -0
- package/src/views/layout/header/HeaderSearch.vue +198 -0
- package/src/views/layout/header/Levelbar.vue +49 -0
- package/src/views/layout/header/MainHeader.vue +271 -0
- package/src/views/layout/header/Navbar.vue +105 -0
- package/src/views/layout/header/ScrollPane.vue +81 -0
- package/src/views/layout/header/TagsView.vue +210 -0
- package/src/views/layout/header/VocRec.vue +97 -0
- package/src/views/layout/header/changepswform.vue +96 -0
- package/src/views/layout/index.js +12 -0
- package/src/views/layout/menu/Hamburger.vue +45 -0
- package/src/views/layout/menu/HdMenu.vue +167 -0
- package/src/views/layout/menu/css/menu.css +288 -0
- package/src/views/layout/menu/index.vue +25 -0
- package/src/views/privilege/commsg/commsg.vue +78 -0
- package/src/views/privilege/commsg/commsgOrgn.vue +42 -0
- package/src/views/privilege/commsg/commsgRole.vue +149 -0
- package/src/views/privilege/commsg/commsgform.vue +160 -0
- package/src/views/privilege/commsg/commsgiframe.vue +33 -0
- package/src/views/privilege/commsg/commsgto.vue +120 -0
- package/src/views/privilege/commsg/commsgtoform.vue +108 -0
- package/src/views/privilege/commsg/commsgtrans.vue +155 -0
- package/src/views/privilege/exfield/comexcolumn.vue +71 -0
- package/src/views/privilege/exfield/comexcolumnform.vue +101 -0
- package/src/views/privilege/exfield/comexfield.vue +31 -0
- package/src/views/privilege/exfield/comexfieldform.vue +94 -0
- package/src/views/privilege/exfield/comexfieldsub.vue +72 -0
- package/src/views/privilege/index.js +42 -0
- package/src/views/privilege/menu/comMenu.vue +41 -0
- package/src/views/privilege/menu/menu.vue +133 -0
- package/src/views/privilege/menu/menuinfo.vue +56 -0
- package/src/views/privilege/menu/rolelist.vue +47 -0
- package/src/views/privilege/menu/userlist.vue +49 -0
- package/src/views/privilege/mobile/authmobileupdate.vue +69 -0
- package/src/views/privilege/mobile/authmobileupdateform.vue +90 -0
- package/src/views/privilege/orgDept/authOrgn.vue +96 -0
- package/src/views/privilege/orgDept/authorgnform.vue +145 -0
- package/src/views/privilege/orgDept/orgDept.vue +37 -0
- package/src/views/privilege/orgDept/orgTree.vue +88 -0
- package/src/views/privilege/orgDept/orgnselect.vue +134 -0
- package/src/views/privilege/personDept/authuser.vue +123 -0
- package/src/views/privilege/personDept/authuserform.vue +154 -0
- package/src/views/privilege/personDept/facerec.vue +117 -0
- package/src/views/privilege/personDept/orgncascader.vue +125 -0
- package/src/views/privilege/personDept/personDept.vue +31 -0
- package/src/views/privilege/quartz/comquartzjob.vue +65 -0
- package/src/views/privilege/quartz/comquartzjobform.vue +99 -0
- package/src/views/privilege/quartz/comquartzlog.vue +59 -0
- package/src/views/privilege/role/btnRole.vue +117 -0
- package/src/views/privilege/role/menuRole.vue +64 -0
- package/src/views/privilege/role/orgnRole.vue +56 -0
- package/src/views/privilege/role/role.vue +67 -0
- package/src/views/privilege/role/rolelist.vue +67 -0
- package/src/views/privilege/role/roleselect.vue +57 -0
- package/src/views/privilege/search/comsearch.vue +105 -0
- package/src/views/privilege/search/menu.vue +52 -0
- package/src/views/privilege/syscode/syscode.vue +103 -0
- package/src/views/privilege/syscode/sysfield.vue +66 -0
- package/src/views/privilege/syscode/sysfieldframe.vue +30 -0
- package/src/views/privilege/syslog/menulog.vue +52 -0
- package/src/views/privilege/syslog/syslog.vue +115 -0
- package/src/views/privilege/syslog/syslogconfig.vue +61 -0
- package/src/views/privilege/syslog/syslogform.vue +83 -0
- package/src/views/privilege/syslog/syslogframe.vue +26 -0
- package/src/views/privilege/userRole/userRole.vue +122 -0
- package/src/views/privilege.zip +0 -0
- package/vite.config.js +118 -0
- package/.babelrc +0 -17
- package/.editorconfig +0 -14
- package/.eslintignore +0 -3
- package/.npminstall.done +0 -1
- package/.postcssrc.js +0 -8
- package/LICENSE +0 -21
- package/Listening +0 -28
- package/build/build.js +0 -70
- package/build/check-versions.js +0 -45
- package/build/config.js +0 -81
- package/build/dev-client.js +0 -9
- package/build/dev-server.js +0 -93
- package/build/utils.js +0 -78
- package/build/vue-loader.conf.js +0 -12
- package/build/webpack.common.js +0 -37
- package/build/webpack.component.js +0 -36
- package/build/webpack.prod.conf.js +0 -38
- package/components.json +0 -8
- package/conf.js +0 -42
- package/config/dev.env.js +0 -6
- package/config/index.js +0 -43
- package/config/prod.env.js +0 -6
- package/config/sit.env.js +0 -6
- package/favicon.ico +0 -0
- package/jsdoc-vue.js +0 -12
- package/lib/0.index.js +0 -12573
- package/lib/1.index.js +0 -6
- package/lib/2.index.js +0 -2
- package/lib/idev.common.js +0 -1
- package/lib/idv8.common.js +0 -1
- package/lib/index.js +0 -49170
- package/lib/js/ErrHint.js +0 -1
- package/lib/js/HdAside.js +0 -1
- package/lib/js/HdBtn.js +0 -1
- package/lib/js/HdButton.js +0 -1
- package/lib/js/HdComFaceRec.js +0 -1
- package/lib/js/HdComGrid.js +0 -1
- package/lib/js/HdDatePicker.js +0 -1
- package/lib/js/HdDialog.js +0 -1
- package/lib/js/HdDrop.js +0 -1
- package/lib/js/HdFileUpload.js +0 -1
- package/lib/js/HdFooter.js +0 -1
- package/lib/js/HdForm.js +0 -1
- package/lib/js/HdFormBtn.js +0 -1
- package/lib/js/HdFormItem.js +0 -1
- package/lib/js/HdGrid.js +0 -1
- package/lib/js/HdGridEditBtn.js +0 -1
- package/lib/js/HdGridSel.js +0 -1
- package/lib/js/HdHeader.js +0 -1
- package/lib/js/HdHotkey.js +0 -1
- package/lib/js/HdLayout.js +0 -1
- package/lib/js/HdMain.js +0 -1
- package/lib/js/HdMessage.js +0 -1
- package/lib/js/HdNum.js +0 -1
- package/lib/js/HdPopSel.js +0 -1
- package/lib/js/HdSearch.js +0 -1
- package/lib/js/HdTableColumn.js +0 -1
- package/lib/js/HdTempSave.js +0 -1
- package/lib/js/HdTree.js +0 -1
- package/lib/js/HdTreeTable.js +0 -1
- package/lib/js/authmobileupdate.js +0 -1
- package/lib/js/comexfield.js +0 -1
- package/lib/js/commsg.js +0 -1
- package/lib/js/commsgto.js +0 -1
- package/lib/js/comquartzjob.js +0 -1
- package/lib/js/comquartzlog.js +0 -1
- package/lib/js/comsearch.js +0 -1
- package/lib/js/menu.js +0 -1
- package/lib/js/menuinfo.js +0 -1
- package/lib/js/orgDept.js +0 -1
- package/lib/js/orgTree.js +0 -1
- package/lib/js/personDept.js +0 -1
- package/lib/js/role.js +0 -1
- package/lib/js/sysfieldframe.js +0 -1
- package/lib/js/syslog.js +0 -1
- package/lib/js/syslogframe.js +0 -1
- package/lib/js/userRole.js +0 -1
- package/npminstall-debug.log +0 -200
- package/ytgvue.rar +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-table :data="formatData" :row-style="showRow" v-bind="$attrs">
|
|
3
|
+
<el-table-column v-if="columns.length===0" width="150">
|
|
4
|
+
<template slot-scope="scope">
|
|
5
|
+
<span v-for="space in scope.row._level" class="ms-tree-space" :key="space"></span>
|
|
6
|
+
<span class="tree-ctrl" v-if="iconShow(0,scope.row)" @click="toggleExpanded(scope.$index)">
|
|
7
|
+
<i v-if="!scope.row._expanded" class="el-icon-plus"></i>
|
|
8
|
+
<i v-else class="el-icon-minus"></i>
|
|
9
|
+
</span>
|
|
10
|
+
{{scope.$index}}
|
|
11
|
+
</template>
|
|
12
|
+
</el-table-column>
|
|
13
|
+
<el-table-column v-else v-for="(column, index) in columns" :key="column.value" :label="column.text" :width="column.width">
|
|
14
|
+
<template slot-scope="scope">
|
|
15
|
+
<span v-if="index === 0" v-for="space in scope.row._level" class="ms-tree-space" :key="space"></span>
|
|
16
|
+
<span class="tree-ctrl" v-if="iconShow(index,scope.row)" @click="toggleExpanded(scope.$index)">
|
|
17
|
+
<i v-if="!scope.row._expanded" class="el-icon-plus"></i>
|
|
18
|
+
<i v-else class="el-icon-minus"></i>
|
|
19
|
+
</span>
|
|
20
|
+
{{scope.row[column.value]}}
|
|
21
|
+
</template>
|
|
22
|
+
</el-table-column>
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</el-table>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
/**
|
|
29
|
+
Auth: Lei.j1ang
|
|
30
|
+
Created: 2018/1/19-13:59
|
|
31
|
+
*/
|
|
32
|
+
import treeToArray from './eval'
|
|
33
|
+
export default {
|
|
34
|
+
name: 'treeTable',
|
|
35
|
+
props: {
|
|
36
|
+
data: {
|
|
37
|
+
type: [Array, Object],
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
columns: {
|
|
41
|
+
type: Array,
|
|
42
|
+
default: () => []
|
|
43
|
+
},
|
|
44
|
+
evalFunc: Function,
|
|
45
|
+
evalArgs: Array,
|
|
46
|
+
expandAll: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
computed: {
|
|
52
|
+
// 格式化数据源
|
|
53
|
+
formatData: function() {
|
|
54
|
+
let tmp
|
|
55
|
+
if (!Array.isArray(this.data)) {
|
|
56
|
+
tmp = [this.data]
|
|
57
|
+
} else {
|
|
58
|
+
tmp = this.data
|
|
59
|
+
}
|
|
60
|
+
const func = this.evalFunc || treeToArray
|
|
61
|
+
const args = this.evalArgs ? Array.concat([tmp, this.expandAll], this.evalArgs) : [tmp, this.expandAll]
|
|
62
|
+
return func.apply(null, args)
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
showRow: function(row) {
|
|
67
|
+
const show = (row.row.parent ? (row.row.parent._expanded && row.row.parent._show) : true)
|
|
68
|
+
row.row._show = show
|
|
69
|
+
return show ? 'animation:treeTableShow 1s;-webkit-animation:treeTableShow 1s;' : 'display:none;'
|
|
70
|
+
},
|
|
71
|
+
// 切换下级是否展开
|
|
72
|
+
toggleExpanded: function(trIndex) {
|
|
73
|
+
const record = this.formatData[trIndex]
|
|
74
|
+
record._expanded = !record._expanded
|
|
75
|
+
},
|
|
76
|
+
// 图标显示
|
|
77
|
+
iconShow(index, record) {
|
|
78
|
+
return (index === 0 && record.children && record.children.length > 0)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
<style rel="stylesheet/css">
|
|
84
|
+
@keyframes treeTableShow {
|
|
85
|
+
from {opacity: 0;}
|
|
86
|
+
to {opacity: 1;}
|
|
87
|
+
}
|
|
88
|
+
@-webkit-keyframes treeTableShow {
|
|
89
|
+
from {opacity: 0;}
|
|
90
|
+
to {opacity: 1;}
|
|
91
|
+
}
|
|
92
|
+
</style>
|
|
93
|
+
|
|
94
|
+
<style lang="scss" rel="stylesheet/scss" scoped>
|
|
95
|
+
$color-blue: #2196F3;
|
|
96
|
+
$space-width: 8px;
|
|
97
|
+
.ms-tree-space {
|
|
98
|
+
position: relative;
|
|
99
|
+
top: 1px;
|
|
100
|
+
display: inline-block;
|
|
101
|
+
font-style: normal;
|
|
102
|
+
font-weight: 400;
|
|
103
|
+
line-height: 1;
|
|
104
|
+
width: $space-width;
|
|
105
|
+
height: 14px;
|
|
106
|
+
&::before {
|
|
107
|
+
content: ""
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
.processContainer{
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: 100%;
|
|
113
|
+
}
|
|
114
|
+
table td {
|
|
115
|
+
line-height: 26px;
|
|
116
|
+
}
|
|
117
|
+
.tree-ctrl{
|
|
118
|
+
position: relative;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
color: $color-blue;
|
|
121
|
+
margin-left: -$space-width;
|
|
122
|
+
}
|
|
123
|
+
.el-table {
|
|
124
|
+
height: 100%;
|
|
125
|
+
width: 100%;
|
|
126
|
+
flex: 1;
|
|
127
|
+
.el-table__body-wrapper {
|
|
128
|
+
width: 100%;
|
|
129
|
+
}
|
|
130
|
+
.el-table__header-wrapper th { //列表标题
|
|
131
|
+
background-color: #f6f6f6;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.el-table__fixed-header-wrapper th { //固定的列表标题
|
|
135
|
+
background-color: #f6f6f6;
|
|
136
|
+
}
|
|
137
|
+
td, th { //列表标题及内容
|
|
138
|
+
padding: 1px 0;
|
|
139
|
+
}
|
|
140
|
+
.cell, .el-table th div, .el-table--border th:first-child .cell, .el-table--border td:first-child .cell { //列表的margin
|
|
141
|
+
padding-left: 5px !important;
|
|
142
|
+
padding-right: 1px !important;
|
|
143
|
+
padding-top:1.5px !important;
|
|
144
|
+
padding-bottom: 1.5px !important;
|
|
145
|
+
}
|
|
146
|
+
.el-table__empty-block {
|
|
147
|
+
position: static;
|
|
148
|
+
text-align: center;
|
|
149
|
+
width: 100%;
|
|
150
|
+
height: 80%
|
|
151
|
+
}
|
|
152
|
+
.el-table__body { //列表下面加了空白
|
|
153
|
+
margin-bottom: 10px;
|
|
154
|
+
}
|
|
155
|
+
.el-table__body-wrapper {
|
|
156
|
+
height: 100%;
|
|
157
|
+
overflow-y: auto;
|
|
158
|
+
}
|
|
159
|
+
.el-input__inner {
|
|
160
|
+
height: 27px;
|
|
161
|
+
margin-bottom: 0px;
|
|
162
|
+
}
|
|
163
|
+
.el-input, .el-form-item__content, .el-form-item__label, .el-input__icon {
|
|
164
|
+
line-height: 30px;
|
|
165
|
+
}
|
|
166
|
+
.el-input__inner {
|
|
167
|
+
padding: 5px;
|
|
168
|
+
}
|
|
169
|
+
.el-input--prefix .el-input__inner { //日期的有logo不一样
|
|
170
|
+
padding-left: 30px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
</style>
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog title="Excel上传" :visible.sync="visible" width='65%' top="10vh">
|
|
3
|
+
<input id="excel-upload-input" ref="excel-upload-input" type="file" accept=".xlsx, .xls" class="c-hide"
|
|
4
|
+
@change="handkeFileChange">
|
|
5
|
+
<div class="excelSel" @drop="handleDrop" @dragover="handleDragover" @dragenter="handleDragover">
|
|
6
|
+
{{$t('Excel导入,需要以导出的Excel为模板')}}<br/>
|
|
7
|
+
{{$t('Excel文件拖动到或点击按钮上传')}}
|
|
8
|
+
<el-button style="margin-left:16px;" type="primary" @click="handleUpload">{{$t('浏览')}}</el-button>
|
|
9
|
+
</div>
|
|
10
|
+
<el-dialog title="sheet选择" :visible.sync="sheetVisible" width='55%' top="15vh">
|
|
11
|
+
<div style="margin: 10px">{{$t('发现excel中存在多个sheet,请选择一个')}}</div>
|
|
12
|
+
<el-radio-group v-model="selSheet">
|
|
13
|
+
<el-radio v-for="(name,index) in allSheet" :label="name" :key="index">{{name}}</el-radio>
|
|
14
|
+
</el-radio-group>
|
|
15
|
+
<el-button style="margin-left:16px;" type="primary" @click="sheetSure">{{$t('确定')}}</el-button>
|
|
16
|
+
</el-dialog>
|
|
17
|
+
</el-dialog>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import XLSX from 'xlsx'
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
loading: false,
|
|
27
|
+
excelData: {
|
|
28
|
+
header: null,
|
|
29
|
+
results: null
|
|
30
|
+
},
|
|
31
|
+
visible: false,
|
|
32
|
+
allSheet: [],
|
|
33
|
+
selSheet: '',
|
|
34
|
+
workbook: null,
|
|
35
|
+
sheetVisible: false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
show() {
|
|
40
|
+
this.visible = true
|
|
41
|
+
},
|
|
42
|
+
generateDate({ header, results }) {
|
|
43
|
+
this.excelData.header = header
|
|
44
|
+
this.excelData.results = results
|
|
45
|
+
this.$emit('on-selected-file', this.excelData)
|
|
46
|
+
},
|
|
47
|
+
handleDrop(e) {
|
|
48
|
+
e.stopPropagation()
|
|
49
|
+
e.preventDefault()
|
|
50
|
+
const files = e.dataTransfer.files
|
|
51
|
+
if (files.length !== 1) {
|
|
52
|
+
this.$message.error(this.$t('只支持单文件!'))
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
const itemFile = files[0] // only use files[0]
|
|
56
|
+
this.readerData(itemFile)
|
|
57
|
+
e.stopPropagation()
|
|
58
|
+
e.preventDefault()
|
|
59
|
+
},
|
|
60
|
+
handleDragover(e) {
|
|
61
|
+
e.stopPropagation()
|
|
62
|
+
e.preventDefault()
|
|
63
|
+
e.dataTransfer.dropEffect = 'copy'
|
|
64
|
+
},
|
|
65
|
+
handleUpload() {
|
|
66
|
+
document.getElementById('excel-upload-input').click()
|
|
67
|
+
},
|
|
68
|
+
handkeFileChange(e) {
|
|
69
|
+
const files = e.target.files
|
|
70
|
+
const itemFile = files[0] // only use files[0]
|
|
71
|
+
if (!itemFile) return
|
|
72
|
+
this.readerData(itemFile)
|
|
73
|
+
this.$refs['excel-upload-input'].value = null // fix can't select the same excel
|
|
74
|
+
},
|
|
75
|
+
readerData(itemFile) {
|
|
76
|
+
const reader = new FileReader()
|
|
77
|
+
reader.onload = e => {
|
|
78
|
+
const data = e.target.result
|
|
79
|
+
const fixedData = this.fixdata(data)
|
|
80
|
+
this.workbook = XLSX.read(btoa(fixedData), { type: 'base64' })
|
|
81
|
+
this.allSheet = this.workbook.SheetNames
|
|
82
|
+
this.selSheet = this.workbook.SheetNames[0]
|
|
83
|
+
if (this.allSheet.length == 1) {
|
|
84
|
+
this.sheetSure()
|
|
85
|
+
} else {
|
|
86
|
+
this.sheetVisible = true
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
reader.readAsArrayBuffer(itemFile)
|
|
90
|
+
},
|
|
91
|
+
sheetSure() {
|
|
92
|
+
// this.sheetVisible = false
|
|
93
|
+
const worksheet = this.workbook.Sheets[this.selSheet]
|
|
94
|
+
const header = this.get_header_row(worksheet)
|
|
95
|
+
const results = XLSX.utils.sheet_to_json(worksheet)
|
|
96
|
+
this.generateDate({ header, results })
|
|
97
|
+
},
|
|
98
|
+
fixdata(data) {
|
|
99
|
+
let o = ''
|
|
100
|
+
let l = 0
|
|
101
|
+
const w = 10240
|
|
102
|
+
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)))
|
|
103
|
+
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)))
|
|
104
|
+
return o
|
|
105
|
+
},
|
|
106
|
+
get_header_row(sheet) {
|
|
107
|
+
const headers = []
|
|
108
|
+
const range = XLSX.utils.decode_range(sheet['!ref'])
|
|
109
|
+
let C
|
|
110
|
+
const R = range.s.r
|
|
111
|
+
/* start in the first row */
|
|
112
|
+
for (C = range.s.c; C <= range.e.c; ++C) { /* walk every column in the range */
|
|
113
|
+
var cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
|
|
114
|
+
/* find the cell in the first row */
|
|
115
|
+
var hdr = 'UNKNOWN ' + C // <-- replace with your desired default
|
|
116
|
+
if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
|
|
117
|
+
headers.push(hdr)
|
|
118
|
+
}
|
|
119
|
+
return headers
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<style scoped>
|
|
126
|
+
#excel-upload-input {
|
|
127
|
+
display: none;
|
|
128
|
+
z-index: -9999;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.excelSel {
|
|
132
|
+
border: 2px dashed #bbb;
|
|
133
|
+
width: 600px;
|
|
134
|
+
height: 160px;
|
|
135
|
+
line-height: 80px;
|
|
136
|
+
margin: 0 auto;
|
|
137
|
+
font-size: 24px;
|
|
138
|
+
border-radius: 5px;
|
|
139
|
+
text-align: center;
|
|
140
|
+
color: #bbb;
|
|
141
|
+
position: relative;
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog :fullscreen="true" :title="gening?'正在生成pdf':'PDF预览'" :visible.sync="visible" @close="$emit('close')"
|
|
3
|
+
class="pdfshow">
|
|
4
|
+
<el-row>
|
|
5
|
+
<el-col :span="4">
|
|
6
|
+
<el-switch @change="initPdf()" :active-text="$t('横向显示')" :inactive-text="$t('竖向显示')" v-model="isLandscape">
|
|
7
|
+
</el-switch>
|
|
8
|
+
</el-col>
|
|
9
|
+
<el-col :span="4">
|
|
10
|
+
{{$t('字号')}}
|
|
11
|
+
<el-input :clearable="false" :placeholder="$t('请输入字号')" size="mini" style="width:100px"
|
|
12
|
+
v-model.number="fontSize"></el-input>
|
|
13
|
+
</el-col>
|
|
14
|
+
<el-col :span="6">
|
|
15
|
+
<el-pagination :current-page.sync="currentPage" :page-size.sync="pageSize" :page-sizes="[100, 200, 400]"
|
|
16
|
+
:total="totalSize" @current-change="initPdf()" @size-change="initPdf()"
|
|
17
|
+
layout="sizes, prev, pager, next">
|
|
18
|
+
</el-pagination>
|
|
19
|
+
</el-col>
|
|
20
|
+
<el-col :span="4">
|
|
21
|
+
<el-button @click="refreshGridData()">{{$t('刷新')}}</el-button>
|
|
22
|
+
</el-col>
|
|
23
|
+
</el-row>
|
|
24
|
+
<el-row>
|
|
25
|
+
<el-checkbox-group v-model="pdfExport" v-if="columnStyles.length>0">
|
|
26
|
+
<el-checkbox v-for="(item, index) in resultData[0]" :label="index" :key="index">{{item}}
|
|
27
|
+
<el-input :clearable="false" :placeholder="$t('最小宽')" size="mini" style="width:50px"
|
|
28
|
+
v-model="columnStyles[index].cellWidth"></el-input>
|
|
29
|
+
</el-checkbox>
|
|
30
|
+
</el-checkbox-group>
|
|
31
|
+
</el-row>
|
|
32
|
+
<object id="output" style="width: 100%;height: calc(100% - 40px)" type="application/pdf">
|
|
33
|
+
<p>It appears you don't have PDF support in this web browser</p>
|
|
34
|
+
</object>
|
|
35
|
+
</el-dialog>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
import jsPDF from 'jspdf';
|
|
40
|
+
import 'jspdf-autotable';
|
|
41
|
+
|
|
42
|
+
window.jsPDF = jsPDF
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
name: 'pdfshow',
|
|
47
|
+
components: {},
|
|
48
|
+
props: {
|
|
49
|
+
gening: {//pdf生成中
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: function () {
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultSort: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default: function () { // updTimFirst是因为会触发HdQuery的排序及查询,默认不让查询
|
|
58
|
+
return { prop: 'updTim', order: 'descending' }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
pageHide: Boolean,
|
|
62
|
+
ckHide: Boolean, // 是否显示checkbox默认显示
|
|
63
|
+
indexHide: Boolean, // 是否显示index 默认显示
|
|
64
|
+
recHide: Boolean, // 是否显示创建人 默认显示
|
|
65
|
+
rowClassName: Function,
|
|
66
|
+
// : [Array],
|
|
67
|
+
excelPropHeader: Boolean// 导出excel是否包含属性头,默认false,导入excel如果需要模板,可以开启,并且会导出所有属性
|
|
68
|
+
},
|
|
69
|
+
data() {
|
|
70
|
+
return {
|
|
71
|
+
visible: true, //因为外层是v-if
|
|
72
|
+
totalSize: 0,//数据总数
|
|
73
|
+
isLandscape: false,//默认竖向
|
|
74
|
+
pdfExport: [],// 导出pdf时不处理的字段
|
|
75
|
+
currentPage: 1,
|
|
76
|
+
pageSize: 400,
|
|
77
|
+
resultData: [], //所有数据
|
|
78
|
+
columnStyles: [],
|
|
79
|
+
gridData: [], //展示数据
|
|
80
|
+
gridStyles: [],
|
|
81
|
+
title: '',
|
|
82
|
+
fontSize: 10,
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
mounted() {
|
|
86
|
+
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
handleSizeChange() {
|
|
90
|
+
this.initPdf()
|
|
91
|
+
},
|
|
92
|
+
handleCurrentChange() {
|
|
93
|
+
this.initPdf()
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* 过滤不显示字段
|
|
97
|
+
*/
|
|
98
|
+
initShowData() {
|
|
99
|
+
this.gridData = this.resultData.map(v1 => {
|
|
100
|
+
return v1.filter((v2, i2) =>
|
|
101
|
+
this.pdfExport.indexOf(i2) > -1
|
|
102
|
+
)
|
|
103
|
+
});
|
|
104
|
+
let flag = 0;
|
|
105
|
+
this.gridStyles = this.resultData[0].reduce((total, v, i) => {
|
|
106
|
+
if (this.pdfExport.indexOf(i) > -1) {
|
|
107
|
+
let cellWidth = parseInt(this.columnStyles[i].cellWidth);
|
|
108
|
+
// console.log('xxx'.cellWidth, this.columnStyles[i].cellWidth)
|
|
109
|
+
total[flag++] = { cellWidth: isNaN(cellWidth) ? 'auto' : cellWidth }
|
|
110
|
+
}
|
|
111
|
+
return total
|
|
112
|
+
}, {});
|
|
113
|
+
|
|
114
|
+
},
|
|
115
|
+
refreshGridData() {
|
|
116
|
+
// console.log('refreshGridData', this.pdfExport)
|
|
117
|
+
let obj = { isLandscape: this.isLandscape, fontSize: this.fontSize, cols: this.pdfExport, columnStyles: this.columnStyles }
|
|
118
|
+
localStorage.setItem("HdPdfSel" + this.$parent.gridId, JSON.stringify(obj));
|
|
119
|
+
this.initShowData();
|
|
120
|
+
this.initPdf();
|
|
121
|
+
},
|
|
122
|
+
addScript() {//字体库太大,使用pdf时才会加载字体
|
|
123
|
+
this.$message({
|
|
124
|
+
type: 'success',
|
|
125
|
+
showClose: true,
|
|
126
|
+
duration: 99999,
|
|
127
|
+
message: this.$t('正在初始化pdf脚本,请等待...')
|
|
128
|
+
})
|
|
129
|
+
var head = document.getElementsByTagName('head')[0];
|
|
130
|
+
var script = document.createElement('script');
|
|
131
|
+
const that = this;
|
|
132
|
+
script.onload = script.onreadystatechange = () => {
|
|
133
|
+
console.log('readyState', that.readyState)
|
|
134
|
+
if (!that.readyState || that.readyState === "loaded" || that.readyState === "complete") {
|
|
135
|
+
that.$message.closeAll()
|
|
136
|
+
that.initPdf()//脚本渲染好后,再显示
|
|
137
|
+
script.onload = script.onreadystatechange = null;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
script.type = 'text/javascript';
|
|
141
|
+
script.src = 'static/js/simsun.js';
|
|
142
|
+
head.appendChild(script);
|
|
143
|
+
},
|
|
144
|
+
genPdf(header, merdata, title) {
|
|
145
|
+
// console.log('parent', this.$parent)
|
|
146
|
+
// console.log('grid', this.$parent.gridId)
|
|
147
|
+
this.totalSize = merdata.length - 1
|
|
148
|
+
this.resultData.push(["#", ...merdata[0]]);
|
|
149
|
+
for (let i = 1; i < merdata.length; i++) {
|
|
150
|
+
this.resultData.push([i, ...merdata[i]]);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// console.log('localStorage', localStorage.getItem('HdPdfSel' + this.$parent.gridId));
|
|
154
|
+
// let obj = {isLandscape: this.isLandscape, fontSize: this.fontSize, cols: this.pdfExport}
|
|
155
|
+
// localStorage.setItem("HdPdfSel" + this.$parent.gridId, JSON.stringify(obj));
|
|
156
|
+
let storeStr = localStorage.getItem('HdPdfSel' + this.$parent.gridId)
|
|
157
|
+
if (storeStr) {
|
|
158
|
+
let storeObj = JSON.parse(storeStr)
|
|
159
|
+
this.pdfExport = storeObj.cols;
|
|
160
|
+
this.fontSize = storeObj.fontSize
|
|
161
|
+
this.isLandscape = storeObj.isLandscape
|
|
162
|
+
if (!storeObj.columnStyles || storeObj.columnStyles.length < 1) {
|
|
163
|
+
this.columnStyles = this.resultData[0].map(v => {
|
|
164
|
+
return { cellWidth: 'auto' };
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
this.columnStyles = storeObj.columnStyles
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//默认全选
|
|
171
|
+
if (!this.pdfExport || !Array.isArray(this.pdfExport) || this.pdfExport.length < 1) {
|
|
172
|
+
this.pdfExport = [];
|
|
173
|
+
for (let i = 0; i <= this.totalSize; i++) {
|
|
174
|
+
this.pdfExport.push(i);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
this.initShowData();
|
|
179
|
+
this.title = title;
|
|
180
|
+
this.addScript()
|
|
181
|
+
},
|
|
182
|
+
initPdf() {
|
|
183
|
+
let startDataNum = (this.currentPage - 1) * this.pageSize + 1 //merdata第一位是header 要+1
|
|
184
|
+
let endDataNum = (this.currentPage) * this.pageSize + 1
|
|
185
|
+
let nowData = this.gridData.slice(startDataNum, endDataNum)
|
|
186
|
+
this.$nextTick(() => {
|
|
187
|
+
this.showPdf([this.gridData[0]], nowData, this.title)
|
|
188
|
+
})
|
|
189
|
+
},
|
|
190
|
+
showPdf(header, merdata, title) {
|
|
191
|
+
var head = header
|
|
192
|
+
var body = merdata
|
|
193
|
+
var doc = null
|
|
194
|
+
if (this.isLandscape) {
|
|
195
|
+
var doc = new jsPDF('l', 'pt');
|
|
196
|
+
doc.setFont('simsun');
|
|
197
|
+
// doc.setFontStyle('normal');
|
|
198
|
+
doc.text(title, 450, 30, { align: 'center' });
|
|
199
|
+
} else {
|
|
200
|
+
var doc = new jsPDF('h', 'pt');
|
|
201
|
+
doc.setFont('simsun');
|
|
202
|
+
// doc.setFontStyle('normal');
|
|
203
|
+
doc.text(title, 300, 30, { align: 'center' });
|
|
204
|
+
}
|
|
205
|
+
// doc.
|
|
206
|
+
doc.autoTable({
|
|
207
|
+
head: head,
|
|
208
|
+
body: body,
|
|
209
|
+
margin: { right: 12, left: 12 },
|
|
210
|
+
styles: {
|
|
211
|
+
font: "simsun",
|
|
212
|
+
fontStyle: 'normal',
|
|
213
|
+
lineColor: '#000',
|
|
214
|
+
lineWidth: 1,
|
|
215
|
+
fontSize: this.fontSize,
|
|
216
|
+
cellPadding: 0.5,
|
|
217
|
+
halign: 'center',
|
|
218
|
+
overflow: "linebreak",
|
|
219
|
+
cellWidth: '10',
|
|
220
|
+
minCellWidth: '2',
|
|
221
|
+
},
|
|
222
|
+
headStyles: { font: "simsun", fontStyle: 'normal' }, // Red
|
|
223
|
+
columnStyles: this.gridStyles,
|
|
224
|
+
// columnStyles: {//列的样式
|
|
225
|
+
// columnWidth: 20,
|
|
226
|
+
// },
|
|
227
|
+
// didParseCell: (HookData) => {//num居右
|
|
228
|
+
// console.log('HookData', HookData, HookData.cell.text, HookData.cell, HookData.cell.text[0].length);
|
|
229
|
+
// HookData.column.width = this.gridStyles[HookData.column.index].cellWidth
|
|
230
|
+
// HookData.cell.width = this.gridStyles[HookData.column.index].cellWidth
|
|
231
|
+
// HookData.cell.styles.cellWidth = this.gridStyles[HookData.column.index].cellWidth + 'px'
|
|
232
|
+
// // if (!isNaN(HookData.cell.text)) {
|
|
233
|
+
// // HookData.cell.styles.halign = 'right'
|
|
234
|
+
// // }
|
|
235
|
+
// }
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
document.getElementById("output").data = doc.output('datauristring');
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
watch: {
|
|
242
|
+
fontSize(newVal) {
|
|
243
|
+
if (!newVal) {
|
|
244
|
+
this.fontSize = 10
|
|
245
|
+
} else if (newVal > 50) {
|
|
246
|
+
this.fontSize = 50
|
|
247
|
+
} else if (newVal < 2) {
|
|
248
|
+
this.fontSize = 1
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
</script>
|
|
254
|
+
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
255
|
+
.pdfshow {
|
|
256
|
+
/deep/ .el-dialog {
|
|
257
|
+
// overflow: hidden;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/deep/ .el-dialog__body {
|
|
261
|
+
//deep内的不会加随机数
|
|
262
|
+
width: 100%;
|
|
263
|
+
height: calc(100% - 55px);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import HdDrop from './HdDrop'
|
|
2
|
+
import HdGrid from './HdGrid'
|
|
3
|
+
import HdBtn from './HdBtn'
|
|
4
|
+
import HdButton from './HdButton'
|
|
5
|
+
import HdNum from './HdNum'
|
|
6
|
+
import HdDatePicker from './HdDatePicker'
|
|
7
|
+
import HdTreeTable from './HdTreeTable/index.vue'
|
|
8
|
+
import HdDialog from './HdDialog'
|
|
9
|
+
import HdAside from './HdAside.vue'
|
|
10
|
+
import HdFooter from './HdFooter'
|
|
11
|
+
import HdHeader from './HdHeader'
|
|
12
|
+
import HdMain from './HdMain'
|
|
13
|
+
import HdTree from './HdTree'
|
|
14
|
+
import HdPopSel from './HdPopSel'
|
|
15
|
+
import '../utils/utils.js'
|
|
16
|
+
import HdHotkey from './HdHotkey' // 实际为shortkey组件
|
|
17
|
+
import HdComGrid from './HdComGrid'
|
|
18
|
+
import HdForm from './HdForm'
|
|
19
|
+
import HdFormBtn from './HdFormBtn'
|
|
20
|
+
import HdFormItem from './HdFormItem.vue'
|
|
21
|
+
import HdTableColumn from './HdTableColumn.vue'
|
|
22
|
+
import ErrHint from './ErrHint.vue'
|
|
23
|
+
import HdMessage from './HdMessage.vue'
|
|
24
|
+
import HdFileUpload from './HdFileUpload.vue'
|
|
25
|
+
import HdGridSel from './HdGridSel.vue'
|
|
26
|
+
import HdGridEditBtn from './HdGridEditBtn'
|
|
27
|
+
import HdTempSave from './HdTempSave'
|
|
28
|
+
import HdComFaceRec from './HdComFaceRec.vue'
|
|
29
|
+
import HdInputHint from './HdInputHint'
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
install(Vue) {
|
|
35
|
+
Vue.use(require('vue-shortkey'))
|
|
36
|
+
Vue._window = window
|
|
37
|
+
Vue.component('HdDrop', HdDrop)
|
|
38
|
+
Vue.component('HdGrid', HdGrid)
|
|
39
|
+
Vue.component('HdBtn', HdBtn)
|
|
40
|
+
Vue.component('HdNum', HdNum)
|
|
41
|
+
Vue.component('elTreeTable', HdTreeTable)
|
|
42
|
+
Vue.component('elButton', HdButton) // 替换element ui
|
|
43
|
+
Vue.component('elDialog', HdDialog)
|
|
44
|
+
Vue.component('elAside', HdAside)
|
|
45
|
+
Vue.component('elFooter', HdFooter)
|
|
46
|
+
Vue.component('elHeader', HdHeader)
|
|
47
|
+
Vue.component('elMain', HdMain)
|
|
48
|
+
Vue.component('HdTreeTable', HdTreeTable)
|
|
49
|
+
Vue.component('HdButton', HdButton) // 替换element ui
|
|
50
|
+
Vue.component('HdDialog', HdDialog)
|
|
51
|
+
Vue.component('HdAside', HdAside)
|
|
52
|
+
Vue.component('HdFooter', HdFooter)
|
|
53
|
+
Vue.component('HdHeader', HdHeader)
|
|
54
|
+
Vue.component('HdMain', HdMain)
|
|
55
|
+
Vue.component('HdInputHint', HdInputHint)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// Vue.component('el-popover', HdPopover)
|
|
59
|
+
Vue.component('elFormItem', HdFormItem)
|
|
60
|
+
Vue.component('HdFormItem', HdFormItem)
|
|
61
|
+
Vue.component('HdTree', HdTree)
|
|
62
|
+
Vue.component('HdDatePicker', HdDatePicker)
|
|
63
|
+
Vue.component('HdHotKey', HdHotkey)
|
|
64
|
+
Vue.component('HdComGrid', HdComGrid)
|
|
65
|
+
Vue.component('HdForm', HdForm)
|
|
66
|
+
Vue.component('HdFormBtn', HdFormBtn)
|
|
67
|
+
Vue.component('HdPopSel', HdPopSel)
|
|
68
|
+
Vue.component('elTableColumn', HdTableColumn)
|
|
69
|
+
Vue.component('HdTableColumn', HdTableColumn)
|
|
70
|
+
Vue.component('ErrHint', ErrHint)
|
|
71
|
+
Vue.component('HdMessage', HdMessage)
|
|
72
|
+
Vue.component('HdFileUpload', HdFileUpload)
|
|
73
|
+
Vue.component('HdGridSel', HdGridSel)
|
|
74
|
+
Vue.component('HdGridEditBtn', HdGridEditBtn)
|
|
75
|
+
Vue.component('HdTempSave', HdTempSave)
|
|
76
|
+
Vue.component('HdComFaceRec', HdComFaceRec)
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|