@zhijiancloud/bpm 0.0.1 → 0.0.2

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.
Files changed (128) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +49 -5
  3. package/components/.DS_Store +0 -0
  4. package/components/css/bpmMulFile.less +54 -0
  5. package/components/css/bpmSelectCheckItem.less +4 -0
  6. package/components/css/bpmSelectFromForm.less +10 -0
  7. package/components/css/bpmSelectFromId.less +33 -0
  8. package/components/css/bpmText.less +49 -0
  9. package/components/css/demo2.less +3 -0
  10. package/components/css/index.less +3 -0
  11. package/components/lib/bpmDateTime/index.js +7 -0
  12. package/components/lib/bpmDateTime/src/main.vue +82 -0
  13. package/components/lib/bpmDateTime/src/part/editor.vue +124 -0
  14. package/components/lib/bpmDateTime/src/part/reader.vue +55 -0
  15. package/components/lib/bpmField/index.js +7 -0
  16. package/components/lib/bpmField/src/main.vue +173 -0
  17. package/components/lib/bpmMulFile/index.js +7 -0
  18. package/components/lib/bpmMulFile/src/main.vue +86 -0
  19. package/components/lib/bpmMulFile/src/part/editor.vue +433 -0
  20. package/components/lib/bpmMulFile/src/part/lib/compressImageUtils.js +226 -0
  21. package/components/lib/bpmMulFile/src/part/lib/utils.js +281 -0
  22. package/components/lib/bpmMulFile/src/part/reader.vue +303 -0
  23. package/components/lib/bpmMulImage/index.js +7 -0
  24. package/components/lib/bpmMulImage/src/main.vue +87 -0
  25. package/components/lib/bpmMulImage/src/part/editor.vue +439 -0
  26. package/components/lib/bpmMulImage/src/part/lib/compressImageUtils.js +226 -0
  27. package/components/lib/bpmMulImage/src/part/lib/utils.js +281 -0
  28. package/components/lib/bpmMulImage/src/part/reader.vue +171 -0
  29. package/components/lib/bpmNumber/index.js +7 -0
  30. package/components/lib/bpmNumber/src/main.vue +83 -0
  31. package/components/lib/bpmNumber/src/part/editor.vue +48 -0
  32. package/components/lib/bpmNumber/src/part/reader.vue +7 -0
  33. package/components/lib/bpmSelect/index.js +7 -0
  34. package/components/lib/bpmSelect/src/main.vue +90 -0
  35. package/components/lib/bpmSelect/src/part/editor.vue +75 -0
  36. package/components/lib/bpmSelect/src/part/reader.vue +44 -0
  37. package/components/lib/bpmSelectCheckItem/index.js +7 -0
  38. package/components/lib/bpmSelectCheckItem/src/main.vue +101 -0
  39. package/components/lib/bpmSelectCheckItem/src/part/editor.vue +94 -0
  40. package/components/lib/bpmSelectCheckItem/src/part/reader.vue +7 -0
  41. package/components/lib/bpmSelectFromField/index.js +7 -0
  42. package/components/lib/bpmSelectFromField/src/main.vue +97 -0
  43. package/components/lib/bpmSelectFromField/src/part/editor.vue +82 -0
  44. package/components/lib/bpmSelectFromField/src/part/reader.vue +7 -0
  45. package/components/lib/bpmSelectFromForm/index.js +7 -0
  46. package/components/lib/bpmSelectFromForm/src/main.vue +103 -0
  47. package/components/lib/bpmSelectFromForm/src/part/editor.vue +181 -0
  48. package/components/lib/bpmSelectFromForm/src/part/reader.vue +7 -0
  49. package/components/lib/bpmSelectFromId/index.js +7 -0
  50. package/components/lib/bpmSelectFromId/src/main.vue +102 -0
  51. package/components/lib/bpmSelectFromId/src/part/editor.vue +260 -0
  52. package/components/lib/bpmSelectFromId/src/part/reader.vue +7 -0
  53. package/components/lib/bpmSubForm/index.js +7 -0
  54. package/components/lib/bpmSubForm/src/main.vue +181 -0
  55. package/components/lib/bpmText/index.ts +13 -0
  56. package/components/lib/bpmText/src/main.vue +87 -0
  57. package/components/lib/bpmText/src/part/editor.vue +104 -0
  58. package/components/lib/bpmText/src/part/reader.vue +7 -0
  59. package/components/lib/bpmTime/index.js +7 -0
  60. package/components/lib/bpmTime/src/main.vue +83 -0
  61. package/components/lib/bpmTime/src/part/editor.vue +54 -0
  62. package/components/lib/bpmTime/src/part/reader.vue +24 -0
  63. package/components/lib/demo/index.js +7 -0
  64. package/components/{bpm2/lib → lib}/demo/src/main.vue +1 -1
  65. package/components/lib/demo2/index.js +7 -0
  66. package/components/lib/demo2/src/main.vue +11 -0
  67. package/components/lib/field-const.js +468 -0
  68. package/components/lib/index.ts +52 -0
  69. package/components/lib/mixins/RemoteSelectReader.vue +49 -0
  70. package/components/lib/mixins/TextReader.vue +22 -0
  71. package/components/lib/net.js +21 -0
  72. package/components/lib/utils.js +89 -0
  73. package/components/sfc.d.ts +27 -0
  74. package/dist/06c52960c6d2c0312a3e.woff +1 -0
  75. package/dist/0db1520f47986b6c755a.svg +1 -0
  76. package/dist/1e59d2330b4c6deb84b340635ed36249.ttf +0 -0
  77. package/dist/20fd1704ea223900efa9fd4e869efb08.woff2 +0 -0
  78. package/dist/4a2487b5cc6987c4f1de.woff2 +1 -0
  79. package/dist/4c6f1cd9993ba8a53b8e.ttf +1 -0
  80. package/dist/8b43027f47b20503057dfbbaa9401fef.eot +0 -0
  81. package/dist/bpmDateTime.umd.js +1 -0
  82. package/dist/bpmDateTime.umd.js.LICENSE.txt +38 -0
  83. package/dist/bpmField.umd.js +2 -0
  84. package/dist/bpmField.umd.js.LICENSE.txt +9 -0
  85. package/dist/bpmMulFile.umd.js +2 -0
  86. package/dist/bpmMulFile.umd.js.LICENSE.txt +9 -0
  87. package/dist/bpmMulImage.umd.js +2 -0
  88. package/dist/bpmMulImage.umd.js.LICENSE.txt +9 -0
  89. package/dist/bpmNumber.umd.js +1 -0
  90. package/dist/bpmNumber.umd.js.LICENSE.txt +38 -0
  91. package/dist/bpmSelect.umd.js +1 -0
  92. package/dist/bpmSelect.umd.js.LICENSE.txt +38 -0
  93. package/dist/bpmSelectCheckItem.umd.js +1 -0
  94. package/dist/bpmSelectFromField.umd.js +1 -0
  95. package/dist/bpmSelectFromForm.umd.js +1 -0
  96. package/dist/bpmSelectFromId.umd.js +1 -0
  97. package/dist/bpmSelectUser.umd.js +1 -0
  98. package/dist/bpmSubForm.umd.js +1 -0
  99. package/dist/bpmText.umd.js +1 -0
  100. package/dist/bpmText.umd.js.LICENSE.txt +38 -0
  101. package/dist/bpmTime.umd.js +1 -0
  102. package/dist/bpmTime.umd.js.LICENSE.txt +38 -0
  103. package/dist/c1e38fd9e0e74ba58f7a2b77ef29fdd3.svg +2671 -0
  104. package/dist/css/bpmMulFile.css +1 -0
  105. package/dist/css/bpmSelectCheckItem.css +1 -0
  106. package/dist/css/bpmSelectFromForm.css +1 -0
  107. package/dist/css/bpmSelectFromId.css +1 -0
  108. package/dist/css/bpmText.css +1 -0
  109. package/dist/css/demo2.css +1 -0
  110. package/dist/css/index.css +1 -0
  111. package/dist/demo.umd.js +1 -0
  112. package/dist/demo2.umd.js +1 -0
  113. package/dist/e5c0c62d732823225aaa.eot +1 -0
  114. package/dist/f691f37e57f04c152e2315ab7dbad881.woff +0 -0
  115. package/dist/index.umd.js +2 -0
  116. package/dist/index.umd.js.LICENSE.txt +9 -0
  117. package/package.json +66 -16
  118. package/components/bpm2/.DS_Store +0 -0
  119. package/components/bpm2/lib/demo/index.js +0 -18
  120. package/dist/favicon.ico +0 -0
  121. package/dist/index.html +0 -1
  122. package/dist/js/chunk-vendors.fad77a0a.js +0 -2
  123. package/dist/js/chunk-vendors.fad77a0a.js.map +0 -1
  124. package/dist/js/index.655afe85.js +0 -2
  125. package/dist/js/index.655afe85.js.map +0 -1
  126. package/dist/lib.umd.js +0 -1
  127. /package/components/{bpm2/css → css}/demo.less +0 -0
  128. /package/dist/css/{index.40a99d5f.css → demo.css} +0 -0
@@ -0,0 +1,303 @@
1
+ <template>
2
+ <div
3
+ class="bpm-mul-file-reader">
4
+ <div v-show="!value || value.length == 0">
5
+ 暂无文件或图片
6
+ </div>
7
+ <viewer :images="photo" rebuild @inited="inited" ref="viewer">
8
+ <span v-for="item in value" :key="item.md5">
9
+ <div class="file-box" v-if="isImageFile(item)">
10
+ <div class="file-icon">
11
+ <img :src="fileLink(item, 600)" alt />
12
+ </div>
13
+ <div
14
+ class="relative-position tc file-link ellipsis"
15
+ :title="item.name"
16
+ >
17
+ {{ item.name }}
18
+ </div>
19
+ </div>
20
+ <span
21
+ target="_blank"
22
+ v-else
23
+ class="file-box"
24
+ @click="reviewOnMobile(item)"
25
+ >
26
+ <div class="text-center text-faded file-icon" @click="preview(item)">
27
+ <i
28
+ aria-hidden="true"
29
+ class="q-icon fa fa-file-pdf-o"
30
+ :class="getFileTypeClass(item)"
31
+ ></i>
32
+ </div>
33
+ <div
34
+ class="relative-position tc file-link ellipsis"
35
+ :title="item.name"
36
+ @click="preview(item)"
37
+ >
38
+ {{ item.name }}
39
+ </div>
40
+ <div class="operation-box">
41
+ <a href="javascript:;" v-if="!isDwg(item)" @click="preview(item)"
42
+ >预览</a
43
+ >
44
+ <span v-if="!is_mobile && !isDwg(item)">|</span>
45
+ <a
46
+ v-if="!is_mobile"
47
+ href="javascript:;"
48
+ @click="download(item)"
49
+ >下载</a
50
+ >
51
+ <span v-if="is_mobile">|</span>
52
+ <a
53
+ v-if="is_mobile"
54
+ href="javascript:;"
55
+ @click="share(item)"
56
+ >分享</a
57
+ >
58
+ </div>
59
+ </span>
60
+ </span>
61
+ </viewer>
62
+ <el-dialog
63
+ :visible.sync="opened"
64
+ class="file-modal"
65
+ :before-close="onHide"
66
+ @open="onOpen"
67
+ title="文件预览"
68
+ :fullscreen="true"
69
+ v-bind="$attrs"
70
+ v-on="$listeners"
71
+ >
72
+ <iframe :src="officeUrl" width="99%" :height="windowH"></iframe>
73
+ </el-dialog>
74
+ <img id="image" src="" style="display: none" />
75
+ </div>
76
+ </template>
77
+
78
+
79
+ <script>
80
+ import Vue from "vue";
81
+ import _ from "lodash";
82
+ import Viewer from "v-viewer";
83
+ import {Dialog} from "element-ui";
84
+ Vue.use(Dialog);
85
+
86
+ import "viewerjs/dist/viewer.css";
87
+ // import {wvAgent} from "./lib/utils"
88
+ import {urlAppendParam, isMobile} from "../../../utils"
89
+ import { showGPSInfo, getFileType, gethashcode } from "./lib/utils";
90
+
91
+ Vue.use(Viewer);
92
+ Viewer.setDefaults({
93
+ Options: {
94
+ inline: true,
95
+ button: true,
96
+ navbar: true,
97
+ title: true,
98
+ toolbar: true,
99
+ tooltip: true,
100
+ movable: true,
101
+ zoomable: true,
102
+ rotatable: true,
103
+ scalable: true,
104
+ transition: false,
105
+ fullscreen: false,
106
+ keyboard: true,
107
+ },
108
+ });
109
+ Vue.use(Dialog);
110
+
111
+ export default {
112
+ props: ["value", "fieldConf", "row"],
113
+ data() {
114
+ return {
115
+ vueLightId1: null,
116
+ photo: [],
117
+ officeUrl: "",
118
+ opened: false,
119
+ windowH: 0,
120
+ type: "small"
121
+ };
122
+ },
123
+ computed: {
124
+ is_mobile(){
125
+ return isMobile()
126
+ }
127
+ },
128
+ watch: {
129
+ value() {
130
+ this.setPhoto();
131
+ },
132
+ },
133
+ created () {
134
+ // wvAgent.register()
135
+ },
136
+ mounted() {
137
+ let time = new Date().getTime();
138
+ this.vueLightId1 = time + 1;
139
+ this.setPhoto();
140
+ this.windowH = (document.body.clientHeight / 100) * 99 - 50;
141
+ },
142
+ methods: {
143
+ isDwg(item) {
144
+ return _.endsWith(item.name, ".dwg");
145
+ },
146
+ inited(viewer) {
147
+ viewer.options.view = this.view;
148
+ this.$viewer = viewer;
149
+ },
150
+ view(e) {
151
+ let index = e.detail.index;
152
+ let value = _.filter(this.value, (item) => {
153
+ return this.isImageFile(item);
154
+ });
155
+ let item = _.get(value, index);
156
+ showGPSInfo(item);
157
+ },
158
+ setPhoto() {
159
+ let value = [];
160
+ _.each(this.value, (item) => {
161
+ if (this.isImageFile(item)) {
162
+ let link = this.fileLink(item, 600);
163
+ value.push(link);
164
+ }
165
+ });
166
+ this.photo = value;
167
+ },
168
+ getFileTypeClass(item) {
169
+ let fileSuffix = getFileType(item.type);
170
+ if (item.type == "application/pdf") fileSuffix = "fa-file-pdf-o";
171
+ let typeMap = {
172
+ document: "fa-file-word-o",
173
+ sheet: "fa-file-excel-o",
174
+ doc: "fa-file-word-o",
175
+ docx: "fa-file-word-o",
176
+ xlsx: "fa-file-excel-o",
177
+ "ms-excel": "fa-file-excel-o",
178
+ dwg: "fa-file-image-o",
179
+ png: "fa-file-image-o",
180
+ jpg: "fa-file-image-o",
181
+ };
182
+ return _.get(typeMap, fileSuffix);
183
+ },
184
+ isImageFile(item) {
185
+ return _.startsWith(item.type, "image");
186
+ },
187
+ fileLink(item) {
188
+ if (!item || !item.md5) return;
189
+ let isImg = this.isImageFile(item);
190
+ let args = {
191
+ file_md5: item.md5,
192
+ };
193
+ // let token = zj.utils.pageParam().token;
194
+ // if (token) {
195
+ // args.token = token;
196
+ // }
197
+
198
+ if (!isImg) {
199
+ args.is_file = 1;
200
+ }
201
+
202
+ let result = urlAppendParam(
203
+ "/platform/v1/papi/web_file/image_view/",
204
+ args
205
+ );
206
+ return result;
207
+ },
208
+ reviewOnMobile(item) {
209
+ if (this.is_mobile) {
210
+ this.preview(item);
211
+ }
212
+ },
213
+ async preview(item) {
214
+ let res = await zj.net.w.noapi({
215
+ url: `/platform/v1/papi/app_file/download/?file_md5=${item.md5}&webp=0`,
216
+ });
217
+ let preview_url = _.get(res, "url_list.0.path.0");
218
+ let fileSuffix = getFileType(preview_url);
219
+ if (item.type == "application/pdf") fileSuffix = "pdf";
220
+ if (item.type == "application/vnd.ms-excel") fileSuffix = "ms-excel";
221
+ let typeMap = {
222
+ document: "Word.Document",
223
+ docx: "Word.Document",
224
+ doc: "Word.Document",
225
+ sheet: "Excel.Sheet",
226
+ pdf: "pdf",
227
+ xlsx: "Excel.Sheet",
228
+ "ms-excel": "Excel.Sheet",
229
+ };
230
+ let hash = gethashcode();
231
+ let url = `https://${window.location.host}/zj_of/v1/papi/file/read_only/?md5=${item.md5}&type=${typeMap[fileSuffix]}&sign=${hash}`;
232
+ let result = await zj.net.w.noapi({
233
+ url: `/zj_of/v1/papi/file/using_engine/`,
234
+ });
235
+ if (result.engine != "wps")
236
+ url =
237
+ "https://view.officeapps.live.com/op/embed.aspx?src=" +
238
+ encodeURIComponent(preview_url);
239
+ console.log("url", url)
240
+ if (fileSuffix == "pdf") {
241
+ let index = preview_url.lastIndexOf(".com");
242
+ preview_url = preview_url.substring(index + 4, preview_url.length);
243
+ preview_url = encodeURIComponent(preview_url);
244
+ if (this.is_mobile)
245
+ url = `/public/app3/bpm/view_pdf.html?url=${preview_url}`;
246
+ else url = `/public/bpm/app/view_pdf.html?url=${preview_url}`;
247
+ }
248
+
249
+ this.officeUrl = url;
250
+ this.opened = true;
251
+ },
252
+
253
+ //分享
254
+ async share(item) {
255
+ let res = await zj.net.w.noapi({
256
+ url: `/platform/v1/papi/app_file/download/?file_md5=${item.md5}&webp=0`,
257
+ });
258
+
259
+ //如果是移动平台,调用客户端预览页面
260
+ if (this.is_mobile) {
261
+ let fileInfo = {
262
+ share_url: _.get(res, "url_list.0.path.0"),
263
+ title: item.name,
264
+ logo_url: "",
265
+ context: item.name,
266
+ };
267
+
268
+ this.toShare(fileInfo);
269
+ }
270
+ },
271
+
272
+ //打开预览页
273
+ async toShare(fileInfo) {
274
+ console.log("fileInfo",fileInfo)
275
+ // wvAgent.invoke("sharePage", {
276
+ // page_url: fileInfo.share_url,
277
+ // title: fileInfo.title || "",
278
+ // logo_url: fileInfo.logo_url || "",
279
+ // context: fileInfo.context || "",
280
+ // });
281
+ },
282
+ async download(item) {
283
+ window.open(
284
+ `/platform/v1/papi/web_file/web_download/?file_md5=${item.md5}`
285
+ );
286
+ },
287
+ getFileType(filePath) {
288
+ var startIndex = filePath.lastIndexOf(".");
289
+ if (startIndex != -1)
290
+ return filePath
291
+ .substring(startIndex + 1, filePath.length)
292
+ .toLowerCase();
293
+ else return "";
294
+ },
295
+ onHide() {
296
+ this.opened = false;
297
+ },
298
+ onOpen() {
299
+ this.opened = true;
300
+ },
301
+ },
302
+ };
303
+ </script>
@@ -0,0 +1,7 @@
1
+ import BpmMulImage from './src/main.vue'
2
+
3
+ BpmMulImage.install = function(Vue) {
4
+ Vue.component(BpmMulImage.name , BpmMulImage);
5
+ }
6
+
7
+ export default BpmMulImage
@@ -0,0 +1,87 @@
1
+ <template>
2
+ <component
3
+ class="bpm-mul-image"
4
+ v-model="curVal"
5
+ :is="curComponent"
6
+ :fieldConf="fieldConf"
7
+ :row="row"
8
+ :mode="mode"
9
+ :uiType="uiType"
10
+ v-bind="$attrs"
11
+ v-on="$listeners"
12
+ >
13
+ </component>
14
+ </template>
15
+ <script>
16
+ import editorComponent from "./part/editor.vue";
17
+ import readerComponent from "./part/reader.vue";
18
+
19
+ export default {
20
+ name: "BpmMulImage",
21
+ components: {
22
+ editorComponent,
23
+ readerComponent
24
+ },
25
+ props: {
26
+ value: {
27
+ type: String,
28
+
29
+ },
30
+ fieldConf: {
31
+ type: Object,
32
+ default() {
33
+ return {};
34
+ },
35
+ },
36
+ row: {
37
+ type: Object,
38
+ default() {
39
+ return {};
40
+ },
41
+ },
42
+ mode: {
43
+ type: String,
44
+ default() {
45
+ return "view";
46
+ },
47
+ },
48
+ uiType: {
49
+ type: String,
50
+ default() {
51
+ return "default";
52
+ },
53
+ },
54
+ },
55
+ data () {
56
+ return {
57
+ curVal: ""
58
+ }
59
+ },
60
+ computed: {
61
+ curComponent() {
62
+ if (this.mode == "view") {
63
+ return readerComponent;
64
+ } else {
65
+ return editorComponent;
66
+ }
67
+ },
68
+ },
69
+ watch: {
70
+ curVal(val){
71
+ this.$emit("input", val)
72
+ this.$emit("change", val);
73
+ },
74
+ value(){
75
+ this.curVal = this.value
76
+ },
77
+
78
+ },
79
+ mounted () {
80
+ this.curVal = this.value
81
+ }
82
+ };
83
+ </script>
84
+
85
+ <style>
86
+ @import "../../../css/bpmMulFile.less";
87
+ </style>