centaline-data-driven 1.2.97 → 1.3.0

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.
@@ -9,7 +9,7 @@
9
9
 
10
10
  <ct-searchscreen ref="screen" :api="searchConditionApi" :key="reloadKeyScreen"
11
11
  @loaded="screenLoaded" :screenPara="screenPara"
12
- :categoryLoaded="loaded.categoryLoaded" @search="search()"
12
+ :categoryLoaded="loaded.categoryLoaded" @search="search()" @saveShortcut="saveShortcut"
13
13
  @showTitle="showTitleScreenHandler"></ct-searchscreen>
14
14
 
15
15
  <ct-searchtable ref="table" :api="searchDataApi" :searchStatsApi="searchStatsApi" :from="from" @loaded="tableLoaded"
@@ -274,6 +274,9 @@
274
274
  this.rowClickHandle();
275
275
  this.$refs.table.refreshFromSimple(field,data);
276
276
  },
277
+ saveShortcut(){
278
+ this.$refs.table.getPage(1);
279
+ },
277
280
  }
278
281
  }
279
282
  </script>
@@ -8,6 +8,9 @@
8
8
  </template>
9
9
  <component v-for="(col, index) in model.btnScreen" :key="index" :is="col.is" :vmodel="col" :api="model.optionApi" @click="clickHandler(col)"></component>
10
10
  </div>
11
+ <div class="shortcutFollow" style="padding-left: 20px;" v-if="model.shortcutForm">
12
+ <ct-form :source="model.shortcutForm.code1" @submit="saveShortcut"></ct-form>
13
+ </div>
11
14
  <el-popover class="SeachScreenPop max-seachpopper" placement="top" transition="el-zoom-in-top" v-model="highScreen" trigger="click" visible-arrow="false">
12
15
  <div style="width:100%">
13
16
  <template v-for="(col, index) in highScreenRow" v-if="col.show !== false">
@@ -93,7 +96,6 @@
93
96
  },
94
97
  loadScreen() {
95
98
  var self = this;
96
- console.log(self.model)
97
99
  var hasParent = self.model.screen.filter((v) => {
98
100
  return typeof v.parentName !== 'undefined';
99
101
  });
@@ -163,6 +165,9 @@
163
165
  }
164
166
  });
165
167
  },
168
+ saveShortcut(){
169
+ this.$emit('saveShortcut');
170
+ },
166
171
  }
167
172
  }
168
173
  </script>
@@ -0,0 +1,11 @@
1
+ import dynamicViewerFile from './src/dynamicViewerFile'
2
+
3
+ dynamicViewerFile.install = function (Vue) {
4
+ Vue.component(dynamicViewerFile.name, dynamicViewerFile);
5
+ }
6
+
7
+ if (typeof window !== 'undefined' && window.Vue) {
8
+ window.Vue.use(dynamicViewerFile);
9
+ }
10
+
11
+ export default dynamicViewerFile;
@@ -0,0 +1,418 @@
1
+ <template>
2
+ <div style="height: 100%" id="viewer-file" ref="viewerfile">
3
+ <el-container style="height: 100%; border: 1px solid #eee">
4
+ <el-aside style="background-color: rgb(238, 241, 246)"
5
+ ><div style="height: 100%">
6
+ <el-menu
7
+ :default-openeds="openeds"
8
+ :default-active="activeitem"
9
+ style="height: 100%"
10
+ >
11
+ <el-submenu
12
+ :key="groupIndex"
13
+ :index="groupIndex.toString()"
14
+ v-for="(group, groupIndex) in MediaAlbum"
15
+ >
16
+ <template slot="title"> <i></i><div style="padding: 0 10px !important">{{ group.albumName }}</div> </template>
17
+ <el-menu-item-group>
18
+ <el-menu-item
19
+ @click="handleClick(item, groupIndex, index)"
20
+ :key="index"
21
+ :index="groupIndex.toString() + '-' + index.toString()"
22
+ v-for="(item, index) in group.medias"
23
+ >{{ item.mediaLabelName || item.fileName }}</el-menu-item
24
+ >
25
+ </el-menu-item-group>
26
+ </el-submenu>
27
+ </el-menu>
28
+ </div>
29
+ </el-aside>
30
+ <el-main ref="displayArea">
31
+ <div
32
+ style="position: relative; width: 100%; height: 100%"
33
+ v-if="resultObject"
34
+ >
35
+ <!--VR-->
36
+ <template v-if="itemFile.mediaTypeID == '1'">
37
+ <div
38
+ class="viewerContent"
39
+ style="height: 100%; width: 800px; text-align: center"
40
+ >
41
+ 暂不支持VR
42
+ <!-- <ct-viewerVR :VRUrl="resultObject"> </ct-viewerVR> -->
43
+ </div>
44
+ </template>
45
+ <!--Photo-->
46
+ <template v-else-if="itemFile.mediaTypeID == '2'">
47
+ <ct-viewerImage
48
+ ref="viewerImage"
49
+ :imgUrl="resultObject"
50
+ :rotate="rotate"
51
+ ></ct-viewerImage>
52
+ </template>
53
+ <!--ThreeDimensional-->
54
+ <template v-else-if="itemFile.mediaTypeID == '3'"
55
+ >暂不支持ThreeDimensional
56
+ </template>
57
+ <!--Video-->
58
+ <template v-else-if="itemFile.mediaTypeID == '4'">
59
+ <div class="viewerContent">
60
+ <video
61
+ preload="none"
62
+ :src="resultObject"
63
+ controls="controls"
64
+ class="viewerContent"
65
+ controlslist="nodownload"
66
+ :height="500"
67
+ :width="800"
68
+ >
69
+ 您的浏览器不支持 video 标签。
70
+ </video>
71
+ </div>
72
+ </template>
73
+ <!--Audio-->
74
+ <template v-else-if="itemFile.mediaTypeID == '5'">
75
+ <div class="viewerContent">
76
+ <audio
77
+ preload="none"
78
+ :src="resultObject"
79
+ controls="controls"
80
+ class="viewerContent"
81
+ controlslist="nodownload"
82
+ style="width: 50%"
83
+ >
84
+ 您的浏览器不支持 audio 标签。
85
+ </audio>
86
+ </div>
87
+ </template>
88
+ <!--File-->
89
+ <template v-else-if="itemFile.mediaTypeID == '6'">
90
+ <template
91
+ v-if="
92
+ 'doc,docx,xlsx'.search(itemFile.fileExtension.toLowerCase()) >
93
+ -1
94
+ "
95
+ >
96
+ <div
97
+ class="viewerContent"
98
+ style="height: 100px; text-align: center"
99
+ >
100
+ <a :href="resultObject">
101
+ <img :src="itemFile.thumbnailUrl" /><br />{{
102
+ itemFile.mediaLabelName || itemFile.fileName
103
+ }}</a
104
+ >
105
+ </div>
106
+ </template>
107
+ <template
108
+ v-else-if="
109
+ 'pdf'.search(itemFile.fileExtension.toLowerCase()) > -1
110
+ "
111
+ >
112
+ <div
113
+ class="viewerContent"
114
+ style="height: 100%; width: 800px; text-align: center"
115
+ >
116
+ <ct-viewerPDF :pdfUrl="resultObject"> </ct-viewerPDF>
117
+ </div>
118
+ </template>
119
+ </template>
120
+ <template v-else> 不支持此类型:{{ itemFile.mediaTypeID }} </template>
121
+
122
+ <template v-if="resultObject != ''">
123
+ <div class="magnify-footer" :style="{width:displayAreaWidth+'px','bottom':(displayAreabtm+10)+'px'}">
124
+ <div class="magnify-toolbar">
125
+ <a
126
+ href="javascript:void(0)"
127
+ class="magnify-btn el-icon-back"
128
+ title="上一张"
129
+ @click="jump(-1)"
130
+ ></a
131
+ ><a
132
+ href="javascript:void(0)"
133
+ class="magnify-btn el-icon-right"
134
+ title="下一张"
135
+ @click="jump(1)"
136
+ ></a>
137
+ <template v-if="itemFile.mediaTypeID == '2'">
138
+ <a
139
+ href="javascript:void(0)"
140
+ class="magnify-btn el-icon-refresh-left"
141
+ title="左旋转"
142
+ @click="rotateImg('L')"
143
+ ></a
144
+ ><a
145
+ href="javascript:void(0)"
146
+ class="magnify-btn el-icon-refresh-right"
147
+ title="右旋转"
148
+ @click="rotateImg('R')"
149
+ ></a
150
+ ><a
151
+ href="javascript:void(0)"
152
+ class="magnify-btn el-icon-zoom-in"
153
+ title="放大"
154
+ @click="zoom(0.2)"
155
+ ></a
156
+ ><a
157
+ href="javascript:void(0)"
158
+ class="magnify-btn el-icon-refresh"
159
+ title="实际尺寸"
160
+ @click="actualSize()"
161
+ ></a
162
+ ><a
163
+ href="javascript:void(0)"
164
+ class="magnify-btn el-icon-zoom-out"
165
+ title="缩小"
166
+ @click="zoom(-0.2)"
167
+ >
168
+ </a> </template
169
+ ><a
170
+ href="javascript:void(0)"
171
+ class="magnify-btn el-icon-download"
172
+ title="下载"
173
+ ></a>
174
+ </div>
175
+ </div>
176
+ </template>
177
+ </div>
178
+ </el-main>
179
+ </el-container>
180
+ </div>
181
+ </template>
182
+
183
+
184
+ <script>
185
+ import dynamicElement from "../../mixins/dynamicElement";
186
+ import dynamicViewerImage from "./dynamicViewerImage.vue";
187
+ import dynamicViewerPDF from "./dynamicViewerPDF.vue";
188
+ //import dynamicViewerVR from "./dynamicViewerVR.vue";
189
+ export default {
190
+ name: "ct-viewerfile",
191
+ mixins: [dynamicElement],
192
+ components: {
193
+ "ct-viewerImage": dynamicViewerImage,
194
+ "ct-viewerPDF": dynamicViewerPDF,
195
+ // "ct-viewerVR": dynamicViewerVR,
196
+ },
197
+ props: {
198
+ MediaAlbum: Array,
199
+ groupIndex: Number,
200
+ index: Number,
201
+ },
202
+ data() {
203
+ return {
204
+ rotate: 0,
205
+ activeIndex: -1,
206
+ activeGroup: -1,
207
+ resultObject: "",
208
+ itemFile: {},
209
+ groupCountLen: 0,
210
+ activeitem: "",
211
+ openeds: [],
212
+ displayAreaWidth: 0,
213
+ displayAreabtm: 0,
214
+ };
215
+ },
216
+ created() {
217
+ var self = this;
218
+ this.groupCountLen = 0;
219
+ this.MediaAlbum.forEach((item, n) => {
220
+ self.openeds.push(n.toString());
221
+ item.medias.forEach((v) => {
222
+ this.groupCountLen++;
223
+ });
224
+ });
225
+ },
226
+
227
+ mounted() {
228
+ var self = this;
229
+ self.displayAreaWidth = this.DomWidth();
230
+ self.displayAreabtm =self.leftDomTop( self.$refs.displayArea.$el);
231
+ window.onresize = () => {
232
+ self.displayAreaWidth = self.DomWidth();
233
+ self.displayAreabtm =self.leftDomTop( self.$refs.displayArea.$el);
234
+ };
235
+
236
+ if (
237
+ this.groupIndex != undefined &&
238
+ this.index != undefined &&
239
+ this.groupIndex > -1 &&
240
+ this.index > -1
241
+ ) {
242
+ var item = this.MediaAlbum[this.groupIndex].medias[this.index];
243
+ this.handleClick(item, this.groupIndex, this.index);
244
+ }
245
+ },
246
+ methods: {
247
+ DomWidth(){
248
+ let arrLength = (window.innerWidth-this.$refs.viewerfile.offsetWidth);
249
+ arrLength=arrLength>0?arrLength:0;
250
+ var Width= window.innerWidth-arrLength-this.$refs.displayArea.$el.offsetLeft-40;
251
+
252
+ return Width;
253
+ },
254
+ leftDomTop() {
255
+ const height = window.innerHeight; //可视区窗口高度
256
+ const curDomHeight = this.$refs.viewerfile.offsetHeight;
257
+ // const curDomHeight = dom.getBoundingClientRect().height
258
+ const curDomY = this.$refs.viewerfile.getBoundingClientRect().y;
259
+ let curDomBottom = height - curDomHeight - curDomY;
260
+ curDomBottom=curDomBottom>0?curDomBottom:0;
261
+ return curDomBottom;
262
+ },
263
+ FileExtension(item) {
264
+ return item.savedFileName.replace(/.+\./, "").toLowerCase();
265
+ },
266
+ offsetLeft(elements) {
267
+ var left = elements.offsetLeft;
268
+ var parent = elements.offsetParent;
269
+ while (parent != null) {
270
+ left += parent.offsetLeft;
271
+ parent = parent.offsetParent;
272
+ }
273
+
274
+ return left;
275
+ },
276
+ handleClick(item, groupIndex, index) {
277
+ if (index == this.activeIndex && groupIndex == this.activeGroup) return;
278
+ this.activeIndex = index;
279
+ this.activeGroup = groupIndex;
280
+ this.itemFile = item;
281
+
282
+ this.activeitem = groupIndex + "-" + index;
283
+
284
+ this.resultObject = this.itemFile.mediaUrl;
285
+
286
+ this.$forceUpdate();
287
+ },
288
+ jump(n) {
289
+ var item = {};
290
+ var groupIndex = this.activeGroup;
291
+ var index = -1;
292
+ if (n > 0) {
293
+ if (
294
+ this.activeGroup * 1 + this.activeIndex + 1 + n >=
295
+ this.groupCountLen
296
+ ) {
297
+ groupIndex = 0;
298
+ index = 0;
299
+ } else {
300
+ if (this.MediaAlbum[this.activeGroup].medias[this.activeIndex + n]) {
301
+ index = this.activeIndex + n;
302
+ } else {
303
+ if (
304
+ this.MediaAlbum[this.activeGroup + n] &&
305
+ this.MediaAlbum[this.activeGroup + n].medias[0]
306
+ ) {
307
+ index = 0;
308
+ groupIndex = this.activeGroup + n;
309
+ } else {
310
+ groupIndex = 0;
311
+ index = 0;
312
+ }
313
+ }
314
+ }
315
+ } else if (n < 0) {
316
+ if (this.activeGroup * 1 + this.activeIndex + n < 0) {
317
+ groupIndex = this.MediaAlbum.length - 1;
318
+ index = this.MediaAlbum[groupIndex].medias.length - 1;
319
+ } else {
320
+ if (this.MediaAlbum[this.activeGroup].medias[this.activeIndex + n]) {
321
+ index = this.activeIndex + n;
322
+ } else {
323
+ if (
324
+ this.MediaAlbum[this.activeGroup + n].medias[
325
+ this.MediaAlbum[this.activeGroup + n].medias.length - 1
326
+ ]
327
+ ) {
328
+ index = this.MediaAlbum[this.activeGroup + n].medias.length - 1;
329
+ groupIndex = this.activeGroup + n;
330
+ } else {
331
+ groupIndex = this.MediaAlbum.length - 1;
332
+ index = this.MediaAlbum[groupIndex].medias.length - 1;
333
+ }
334
+ }
335
+ }
336
+ }
337
+ item = this.MediaAlbum[groupIndex].medias[index];
338
+ this.handleClick(item, groupIndex, index);
339
+ },
340
+
341
+ //旋转图片
342
+ rotateImg(type) {
343
+ var currentDeg = this.rotate || 0;
344
+
345
+ if (type == "L") {
346
+ currentDeg = currentDeg - 90;
347
+ } else if (type == "R") {
348
+ currentDeg = currentDeg + 90;
349
+ }
350
+ if (Math.abs(currentDeg) >= 360) {
351
+ currentDeg = currentDeg % 360;
352
+ }
353
+ this.rotate = currentDeg;
354
+ this.$forceUpdate();
355
+ },
356
+
357
+ actualSize() {
358
+ this.rotate = 0;
359
+ this.$refs.viewerImage.actualSize();
360
+ },
361
+ zoom(n) {
362
+ this.$refs.viewerImage.zoom(n);
363
+ },
364
+ },
365
+ };
366
+ // 禁止右键菜单
367
+ document.oncontextmenu = function () {
368
+ return false;
369
+ };
370
+ </script>
371
+
372
+ <style>
373
+ body,
374
+ html {
375
+ height: 100%;
376
+ }
377
+ #viewer-file .el-container {
378
+ margin-bottom: 40px;
379
+ height: 100%;
380
+ }
381
+
382
+ .viewerContent {
383
+ cursor: move;
384
+ position: absolute !important;
385
+ top: 0;
386
+ bottom: 0;
387
+ left: 0;
388
+ right: 0;
389
+ margin: auto;
390
+ }
391
+
392
+ .magnify-footer {
393
+ position: fixed;
394
+ height: 50px;
395
+ bottom: 0px;
396
+ text-align: center;
397
+ color: #fff;
398
+ z-index: 9;
399
+ }
400
+
401
+ .magnify-toolbar {
402
+ display: inline-block;
403
+ background-color: rgba(0, 0, 0, 0.5);
404
+ -webkit-border-radius: 5px 5px 0 0;
405
+ -moz-border-radius: 5px 5px 0 0;
406
+ border-radius: 5px 5px 0 0;
407
+ }
408
+ .magnify-toolbar .magnify-btn {
409
+ margin: 15px 20px;
410
+ color: #999;
411
+ font-size: 25px;
412
+ font-weight: 800;
413
+ }
414
+ .magnify-toolbar .magnify-btn:hover,
415
+ .magnify-btn-close:hover {
416
+ color: #fff;
417
+ }
418
+ </style>
@@ -0,0 +1,147 @@
1
+
2
+ <template>
3
+ <div class="Imagebox" @mousewheel="bagimg($event)">
4
+ <img
5
+ id="ViewerImage"
6
+ class="scaleimg"
7
+ border="0"
8
+ v-bind:style="{
9
+ transform:
10
+ 'scale(' +
11
+ (params.zoomVal || 1) +
12
+ ') rotate(' +
13
+ (rotate || 0) +
14
+ 'deg)',
15
+ }"
16
+ :src="imgUrl"
17
+ />
18
+ </div>
19
+ </template>
20
+ <script>
21
+ export default {
22
+ props: {
23
+ imgUrl: String,
24
+ rotate: Number,
25
+ },
26
+ data() {
27
+ return {
28
+ params: {
29
+ zoomVal: 1,
30
+ left: 0,
31
+ top: 0,
32
+ currentX: 0,
33
+ currentY: 0,
34
+ flag: false,
35
+ },
36
+ };
37
+ },
38
+ mounted() {
39
+ this.startDrag(
40
+ document.getElementById("ViewerImage"),
41
+ document.getElementById("ViewerImage")
42
+ );
43
+ },
44
+ methods: {
45
+ zoom(n) {
46
+ this.params.zoomVal += n;
47
+ },
48
+ actualSize() {
49
+ this.params = {
50
+ zoomVal: 1,
51
+ left: 0,
52
+ top: 0,
53
+ currentX: 0,
54
+ currentY: 0,
55
+ flag: false,
56
+ };
57
+ },
58
+
59
+ bagimg(e) {
60
+ var e = document.getElementById("ViewerImage");
61
+ this.params.zoomVal += event.wheelDelta / 1200;
62
+ if (this.params.zoomVal >= 0.2) {
63
+ } else {
64
+ this.params.zoomVal = 0.2;
65
+ return false;
66
+ }
67
+ },
68
+ getImgCss(e, key) {
69
+ return e.currentStyle
70
+ ? e.currentStyle[key]
71
+ : document.defaultView.getComputedStyle(e, false)[key];
72
+ },
73
+ startDrag(bar, target, callback) {
74
+ let that = this;
75
+ if (that.getImgCss(target, "left") !== "auto") {
76
+ that.params.left = that.getImgCss(target, "left");
77
+ }
78
+ if (that.getImgCss(target, "top") !== "auto") {
79
+ that.params.top = that.getImgCss(target, "top");
80
+ }
81
+ bar.onmousedown = function (event) {
82
+ that.params.flag = true;
83
+ if (!event) {
84
+ event = window.event;
85
+ bar.onselectstart = function () {
86
+ return false;
87
+ };
88
+ }
89
+ let e = event;
90
+ that.params.currentX = e.clientX;
91
+ that.params.currentY = e.clientY;
92
+ };
93
+ document.onmouseup = function () {
94
+ that.params.flag = false;
95
+ if (that.getImgCss(target, "left") !== "auto") {
96
+ that.params.left = that.getImgCss(target, "left");
97
+ }
98
+ if (that.getImgCss(target, "top") !== "auto") {
99
+ that.params.top = that.getImgCss(target, "top");
100
+ }
101
+ };
102
+ document.onmousemove = function (event) {
103
+ let e = event ? event : window.event;
104
+ if (that.params.flag) {
105
+ let nowX = e.clientX,
106
+ nowY = e.clientY;
107
+ let disX = nowX - that.params.currentX,
108
+ disY = nowY - that.params.currentY;
109
+ target.style.left = parseInt(that.params.left) + disX + "px";
110
+ target.style.top = parseInt(that.params.top) + disY + "px";
111
+ if (typeof callback == "function") {
112
+ callback(
113
+ (parseInt(that.params.left) || 0) + disX,
114
+ (parseInt(that.params.top) || 0) + disY
115
+ );
116
+ }
117
+ if (event.preventDefault) {
118
+ event.preventDefault();
119
+ }
120
+ return false;
121
+ }
122
+ };
123
+ },
124
+ },
125
+ };
126
+ </script>
127
+
128
+ <style>
129
+ .Imagebox {
130
+ position: relative;
131
+ width: 100%;
132
+ height: 100%;
133
+ overflow: hidden;
134
+ }
135
+
136
+ .scaleimg {
137
+ max-height: 100%;
138
+ max-width: 100%;
139
+ cursor: move;
140
+ position: absolute;
141
+ top: 0;
142
+ bottom: 0;
143
+ left: 0;
144
+ right: 0;
145
+ margin: auto;
146
+ }
147
+ </style>
@@ -0,0 +1,73 @@
1
+
2
+ <template>
3
+ <div>
4
+ <pdf
5
+ v-for="i in numPages"
6
+ :key="i"
7
+ :src="fileUrl"
8
+ :page="i"
9
+ style="width: 100%"
10
+ >
11
+ </pdf>
12
+ </div>
13
+ </template>
14
+ <script>
15
+ import pdf from "vue-pdf";
16
+ export default {
17
+ components: {
18
+ pdf,
19
+ },
20
+ props: {
21
+ pdfUrl: String,
22
+ },
23
+ data() {
24
+ return {
25
+ numPages: 1,
26
+ fileUrl: "",
27
+ };
28
+ },
29
+ mounted() {
30
+ this.init(this.pdfUrl);
31
+ },
32
+ methods: {
33
+ init(pdfUrl) {
34
+ var self = this;
35
+ var loadingTask = pdf.createLoadingTask(pdfUrl);
36
+ loadingTask
37
+ .then((pdf) => {
38
+ self.fileUrl = loadingTask;
39
+ self.numPages = pdf.numPages;
40
+ })
41
+ .catch((err) => {
42
+ console.error("pdf加载失败");
43
+ });
44
+ },
45
+ },
46
+ watch: {
47
+ pdfUrl(newValue, oldValue) {
48
+ this.init(newValue);
49
+ },
50
+ },
51
+ };
52
+ </script>
53
+
54
+ <style>
55
+ .Imagebox {
56
+ position: relative;
57
+ width: 100%;
58
+ height: 100%;
59
+ overflow: hidden;
60
+ }
61
+
62
+ .scaleimg {
63
+ max-height: 100%;
64
+ max-width: 100%;
65
+ cursor: move;
66
+ position: absolute;
67
+ top: 0;
68
+ bottom: 0;
69
+ left: 0;
70
+ right: 0;
71
+ margin: auto;
72
+ }
73
+ </style>