agilebuilder-ui 1.0.70 → 1.0.71-temp8
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/lib/super-ui.css +1 -1
- package/lib/super-ui.js +44662 -42816
- package/lib/super-ui.umd.cjs +94 -86
- package/package.json +4 -2
- package/packages/department-tree/src/department-tree.vue +28 -10
- package/packages/department-tree-mobile/src/department-tree-app.vue +6 -6
- package/packages/department-user-tree/src/department-user-tree.vue +16 -2
- package/packages/department-user-tree-mobile/src/department-user-tree-app.vue +6 -6
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-app.vue +410 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +484 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-component.vue +140 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-input.vue +220 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload.vue +249 -0
- package/packages/fs-upload-new/src/fs-button-upload.vue +9 -13
- package/packages/fs-upload-new/src/fs-drag-upload.vue +4 -8
- package/packages/fs-upload-new/src/fs-preview-new.vue +103 -36
- package/packages/fs-upload-new/src/fs-upload-new.vue +88 -8
- package/packages/super-grid/src/apis.js +6 -6
- package/packages/super-grid/src/search-button.vue +18 -14
- package/packages/super-grid/src/search-form-mobile.vue +250 -0
- package/packages/super-grid/src/search-form.vue +159 -82
- package/packages/super-grid/src/super-grid.vue +21 -5
- package/src/api/sso-service.js +25 -14
- package/src/i18n/langs/cn.js +4 -1
- package/src/i18n/langs/en.js +4 -1
- package/src/permission.js +108 -122
- package/src/styles/theme/green/sidebar.scss +11 -0
- package/src/utils/common-util.js +217 -124
- package/src/utils/i18n-util.js +127 -0
- package/src/utils/jump-page-utils.js +34 -13
- package/src/utils/permissionAuth.js +47 -8
- package/src/utils/util.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agilebuilder-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.71temp8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./lib/super-ui.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"path-to-regexp": "6.2.1",
|
|
20
20
|
"sortablejs": "^1.15.0",
|
|
21
21
|
"tinymce": "5.8.2",
|
|
22
|
+
"compressorjs": "1.2.1",
|
|
22
23
|
"uuid": "^9.0.1"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
"vue": "3.3.4",
|
|
34
35
|
"vue-i18n": "^9.5.0",
|
|
35
36
|
"vue-router": "^4.2.5",
|
|
36
|
-
"vuex": "^4.1.0"
|
|
37
|
+
"vuex": "^4.1.0",
|
|
38
|
+
"axios": "^1.5.1"
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
+
|
|
4
|
+
<DepartmentMobileTree
|
|
5
|
+
v-if="isMobile"
|
|
6
|
+
ref="inlineDeparmentTree"
|
|
7
|
+
:department-info="departmentInfo"
|
|
8
|
+
:multiple="multiple"
|
|
9
|
+
:search-field="searchField"
|
|
10
|
+
:select-department-info="selectDepartmentInfo"
|
|
11
|
+
:separator="separator"
|
|
12
|
+
@close="result"
|
|
13
|
+
/>
|
|
3
14
|
<el-dialog
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
v-else
|
|
16
|
+
:close-on-click-modal="false"
|
|
17
|
+
:title="myTitle"
|
|
18
|
+
:width="multiple ? '920px' : '509px'"
|
|
19
|
+
append-to-body
|
|
20
|
+
class="user-tree"
|
|
21
|
+
model-value
|
|
22
|
+
@close="$emit('close')"
|
|
23
|
+
@closed="$emit('closed')"
|
|
24
|
+
@open="$emit('open')"
|
|
25
|
+
@opend="$emit('opend')"
|
|
14
26
|
>
|
|
15
27
|
<inline-department-tree
|
|
16
28
|
ref="inlineDeparmentTree"
|
|
@@ -40,11 +52,14 @@
|
|
|
40
52
|
<script>
|
|
41
53
|
import {$emit} from '../../utils/gogocodeTransfer'
|
|
42
54
|
import InlineDepartmentTree from '../../department-tree-inline/src/department-tree-inline.vue'
|
|
55
|
+
import DepartmentMobileTree from '../../department-tree-mobile/src/department-tree-app.vue'
|
|
56
|
+
import {isMobileBrowser} from '../../../src/utils/common-util'
|
|
43
57
|
|
|
44
58
|
export default {
|
|
45
59
|
name: 'DepartmentTree',
|
|
46
60
|
components: {
|
|
47
61
|
InlineDepartmentTree,
|
|
62
|
+
DepartmentMobileTree
|
|
48
63
|
},
|
|
49
64
|
props: {
|
|
50
65
|
// 是否是多选树,默认是true
|
|
@@ -93,12 +108,15 @@ export default {
|
|
|
93
108
|
},
|
|
94
109
|
},
|
|
95
110
|
data() {
|
|
111
|
+
const isMobile = isMobileBrowser()
|
|
112
|
+
console.log('部门树---isMobile=', isMobile)
|
|
96
113
|
let myTitle = this.$t('imatrixUIMessage.pleaseSelectDepartment')
|
|
97
114
|
if (this.title) {
|
|
98
115
|
myTitle = this.title
|
|
99
116
|
}
|
|
100
117
|
return {
|
|
101
118
|
myTitle,
|
|
119
|
+
isMobile
|
|
102
120
|
}
|
|
103
121
|
},
|
|
104
122
|
methods: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-drawer v-model="isShowForm" direction="btt" size="100%" class="organization-tree">
|
|
2
|
+
<el-drawer v-model="isShowForm" :close-on-click-modal="false" :close-on-press-escape="false" direction="btt" size="100%" class="organization-tree" @close="closeTree()">
|
|
3
3
|
<template #header>
|
|
4
4
|
<div style="text-align: center;">
|
|
5
5
|
{{$t('imatrixUIMessage.pleaseSelect')}}
|
|
@@ -48,10 +48,10 @@ const props = defineProps<{
|
|
|
48
48
|
}
|
|
49
49
|
}>()
|
|
50
50
|
const emits = defineEmits(['close'])
|
|
51
|
-
let isShowForm = ref(
|
|
52
|
-
function showTree() {
|
|
53
|
-
|
|
54
|
-
}
|
|
51
|
+
let isShowForm = ref(true)
|
|
52
|
+
// function showTree() {
|
|
53
|
+
// isShowForm.value = true
|
|
54
|
+
// }
|
|
55
55
|
function closeTree(selectNodeInfo) {
|
|
56
56
|
emits('close', selectNodeInfo)
|
|
57
57
|
isShowForm.value = false
|
|
@@ -59,7 +59,7 @@ const props = defineProps<{
|
|
|
59
59
|
function selectDepartment() {
|
|
60
60
|
// this.$refs.inlineDeparmentTree.selectDepartment()
|
|
61
61
|
}
|
|
62
|
-
defineExpose({showTree})
|
|
62
|
+
// defineExpose({showTree})
|
|
63
63
|
</script>
|
|
64
64
|
<style>
|
|
65
65
|
.organization-tree, .organization-tree .el-checkbox__label,.organization-tree .el-breadcrumb__inner,.organization-tree .el-tree {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<department-user-multi-tree
|
|
4
|
-
v-if="multiple"
|
|
4
|
+
v-if="!isMobile && multiple"
|
|
5
5
|
:department-info="departmentInfo"
|
|
6
6
|
:height="height"
|
|
7
7
|
:is-need-virtual-user="isNeedVirtualUser"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
@opendDialog="opendDialog"
|
|
17
17
|
/>
|
|
18
18
|
<department-user-single-tree
|
|
19
|
-
v-if="!multiple"
|
|
19
|
+
v-if="!isMobile && !multiple"
|
|
20
20
|
:department-info="departmentInfo"
|
|
21
21
|
:is-need-virtual-user="isNeedVirtualUser"
|
|
22
22
|
:title="title"
|
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
@openDialog="openDialog"
|
|
27
27
|
@opendDialog="opendDialog"
|
|
28
28
|
/>
|
|
29
|
+
<DepartmentUserMobileTree
|
|
30
|
+
v-if="isMobile"
|
|
31
|
+
:department-info="departmentInfo"
|
|
32
|
+
:search-field="searchField"
|
|
33
|
+
:select-user-info="selectUserInfo"
|
|
34
|
+
:separator="separator"
|
|
35
|
+
@close="closeDialog"
|
|
36
|
+
/>
|
|
29
37
|
</div>
|
|
30
38
|
</template>
|
|
31
39
|
|
|
@@ -33,12 +41,15 @@
|
|
|
33
41
|
import {$emit} from '../../utils/gogocodeTransfer'
|
|
34
42
|
import DepartmentUserSingleTree from './department-user-single-tree.vue'
|
|
35
43
|
import DepartmentUserMultiTree from './department-user-multiple-tree.vue'
|
|
44
|
+
import DepartmentUserMobileTree from '../../department-user-tree-mobile/src/department-user-tree-app.vue'
|
|
45
|
+
import {isMobileBrowser} from '../../../src/utils/common-util'
|
|
36
46
|
|
|
37
47
|
export default {
|
|
38
48
|
name: 'DepartmentUserTree',
|
|
39
49
|
components: {
|
|
40
50
|
DepartmentUserSingleTree,
|
|
41
51
|
DepartmentUserMultiTree,
|
|
52
|
+
DepartmentUserMobileTree
|
|
42
53
|
},
|
|
43
54
|
props: {
|
|
44
55
|
// 是否是多选树,默认是true
|
|
@@ -88,12 +99,15 @@ export default {
|
|
|
88
99
|
}
|
|
89
100
|
},
|
|
90
101
|
data() {
|
|
102
|
+
const isMobile = isMobileBrowser()
|
|
103
|
+
console.log('部门人员树---isMobile=', isMobile)
|
|
91
104
|
let myTitle = this.$t('imatrixUIMessage.pleaseSelectPersonnel')
|
|
92
105
|
if (this.title) {
|
|
93
106
|
myTitle = this.title
|
|
94
107
|
}
|
|
95
108
|
return {
|
|
96
109
|
myTitle,
|
|
110
|
+
isMobile
|
|
97
111
|
}
|
|
98
112
|
},
|
|
99
113
|
methods: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-drawer v-model="isShowForm" direction="btt" size="100%" class="organization-tree">
|
|
2
|
+
<el-drawer v-model="isShowForm" direction="btt" size="100%" class="organization-tree" @close="closeTree()">
|
|
3
3
|
<template #header>
|
|
4
4
|
<div style="text-align: center;">
|
|
5
5
|
{{$t('imatrixUIMessage.pleaseSelect')}}
|
|
@@ -47,10 +47,10 @@ const props = defineProps<{
|
|
|
47
47
|
}
|
|
48
48
|
}>()
|
|
49
49
|
const emits = defineEmits(['close'])
|
|
50
|
-
let isShowForm = ref(
|
|
51
|
-
function showTree() {
|
|
52
|
-
|
|
53
|
-
}
|
|
50
|
+
let isShowForm = ref(true)
|
|
51
|
+
// function showTree() {
|
|
52
|
+
// isShowForm.value = true
|
|
53
|
+
// }
|
|
54
54
|
function closeTree(selectNodeInfo) {
|
|
55
55
|
emits('close', selectNodeInfo)
|
|
56
56
|
isShowForm.value = false
|
|
@@ -58,7 +58,7 @@ const props = defineProps<{
|
|
|
58
58
|
function selectDepartment() {
|
|
59
59
|
// this.$refs.inlineDeparmentTree.selectDepartment()
|
|
60
60
|
}
|
|
61
|
-
defineExpose({showTree})
|
|
61
|
+
// defineExpose({showTree})
|
|
62
62
|
</script>
|
|
63
63
|
<style>
|
|
64
64
|
.organization-tree, .organization-tree .el-checkbox__label,.organization-tree .el-breadcrumb__inner,.organization-tree .el-tree {
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<q-uploader
|
|
4
|
+
:url="defaultAction"
|
|
5
|
+
label="Upload"
|
|
6
|
+
field-name="file"
|
|
7
|
+
:with-credentials="true"
|
|
8
|
+
:multiple="multiple"
|
|
9
|
+
>
|
|
10
|
+
<template v-slot:header>
|
|
11
|
+
<div class="row no-wrap items-center q-pa-sm q-gutter-xs">
|
|
12
|
+
<q-btn
|
|
13
|
+
v-if="newFiles.length > 0"
|
|
14
|
+
icon="clear_all"
|
|
15
|
+
round
|
|
16
|
+
dense
|
|
17
|
+
flat
|
|
18
|
+
/>
|
|
19
|
+
<q-btn
|
|
20
|
+
v-if="fileList.length > 0"
|
|
21
|
+
icon="done_all"
|
|
22
|
+
round
|
|
23
|
+
dense
|
|
24
|
+
flat
|
|
25
|
+
/>
|
|
26
|
+
<q-spinner
|
|
27
|
+
v-if="isUploading && !disable"
|
|
28
|
+
class="q-uploader__spinner"
|
|
29
|
+
/>
|
|
30
|
+
<q-btn
|
|
31
|
+
v-if="!disable"
|
|
32
|
+
type="a"
|
|
33
|
+
icon="add_box"
|
|
34
|
+
round
|
|
35
|
+
dense
|
|
36
|
+
flat
|
|
37
|
+
@click="pickFiles"
|
|
38
|
+
/>
|
|
39
|
+
<q-btn
|
|
40
|
+
v-if="!disable"
|
|
41
|
+
icon="cloud_upload"
|
|
42
|
+
round
|
|
43
|
+
dense
|
|
44
|
+
flat
|
|
45
|
+
@click="uploadFiles"
|
|
46
|
+
/>
|
|
47
|
+
<q-btn
|
|
48
|
+
v-if="showClose"
|
|
49
|
+
icon="close"
|
|
50
|
+
round
|
|
51
|
+
dense
|
|
52
|
+
flat
|
|
53
|
+
@click="$emit('close')"
|
|
54
|
+
>
|
|
55
|
+
<q-tooltip>Close</q-tooltip>
|
|
56
|
+
</q-btn>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
<template v-slot:list>
|
|
60
|
+
<q-list separator>
|
|
61
|
+
<q-item
|
|
62
|
+
v-for="(tempFile,index) in newFiles"
|
|
63
|
+
:key="index"
|
|
64
|
+
active
|
|
65
|
+
active-class="bg-teal-1 text-grey-8"
|
|
66
|
+
>
|
|
67
|
+
<q-item-section>
|
|
68
|
+
<q-item-label class="full-width ellipsis">
|
|
69
|
+
{{ tempFile.name }}
|
|
70
|
+
</q-item-label>
|
|
71
|
+
</q-item-section>
|
|
72
|
+
|
|
73
|
+
<q-item-section
|
|
74
|
+
v-if="isImg(tempFile)"
|
|
75
|
+
thumbnail
|
|
76
|
+
>
|
|
77
|
+
<img :src="tempFile.base64Path">
|
|
78
|
+
</q-item-section>
|
|
79
|
+
|
|
80
|
+
<q-item-section
|
|
81
|
+
v-if="!disable"
|
|
82
|
+
side
|
|
83
|
+
>
|
|
84
|
+
<q-btn
|
|
85
|
+
size="12px"
|
|
86
|
+
color="red"
|
|
87
|
+
flat
|
|
88
|
+
dense
|
|
89
|
+
round
|
|
90
|
+
icon="delete"
|
|
91
|
+
@click.native="removeFile(index,true,tempFile.name)"
|
|
92
|
+
/>
|
|
93
|
+
</q-item-section>
|
|
94
|
+
</q-item>
|
|
95
|
+
</q-list>
|
|
96
|
+
<q-list separator>
|
|
97
|
+
<q-item
|
|
98
|
+
v-for="(myFile,index) in fileList"
|
|
99
|
+
:key="myFile.serverPath"
|
|
100
|
+
>
|
|
101
|
+
<q-item-section>
|
|
102
|
+
<q-item-label class="full-width ellipsis">
|
|
103
|
+
{{ myFile.name }}
|
|
104
|
+
</q-item-label>
|
|
105
|
+
</q-item-section>
|
|
106
|
+
|
|
107
|
+
<q-item-section
|
|
108
|
+
v-if="isImg(myFile)"
|
|
109
|
+
thumbnail
|
|
110
|
+
>
|
|
111
|
+
<img :src="imgSrc+'&showName='+ encodeURI(myFile.name) + '&serverPath=' + myFile.serverPath">
|
|
112
|
+
</q-item-section>
|
|
113
|
+
|
|
114
|
+
<q-item-section
|
|
115
|
+
top
|
|
116
|
+
side
|
|
117
|
+
>
|
|
118
|
+
<div
|
|
119
|
+
class="q-col-gutter-xs row items-start"
|
|
120
|
+
>
|
|
121
|
+
<div class="col">
|
|
122
|
+
<q-btn
|
|
123
|
+
size="12px"
|
|
124
|
+
flat
|
|
125
|
+
dense
|
|
126
|
+
round
|
|
127
|
+
icon="download"
|
|
128
|
+
@click.native="downloadFile(myFile)"
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
<div
|
|
132
|
+
v-if="!disable"
|
|
133
|
+
class="col"
|
|
134
|
+
>
|
|
135
|
+
<q-btn
|
|
136
|
+
size="12px"
|
|
137
|
+
color="red"
|
|
138
|
+
flat
|
|
139
|
+
dense
|
|
140
|
+
round
|
|
141
|
+
icon="delete"
|
|
142
|
+
@click.native="removeFile(index,false,myFile.name)"
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</q-item-section>
|
|
147
|
+
</q-item>
|
|
148
|
+
</q-list>
|
|
149
|
+
</template>
|
|
150
|
+
</q-uploader>
|
|
151
|
+
</div>
|
|
152
|
+
</template>
|
|
153
|
+
|
|
154
|
+
<script>
|
|
155
|
+
import Vue from 'vue'
|
|
156
|
+
import {
|
|
157
|
+
getToken
|
|
158
|
+
} from '../../../src/utils/auth.js' // 获得token
|
|
159
|
+
export default {
|
|
160
|
+
name: 'FileUploadApp',
|
|
161
|
+
props: {
|
|
162
|
+
systemCode: {
|
|
163
|
+
type: String,
|
|
164
|
+
default: null
|
|
165
|
+
},
|
|
166
|
+
multiple: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
default: false
|
|
169
|
+
},
|
|
170
|
+
// 已上传文件列表
|
|
171
|
+
fileResult: {
|
|
172
|
+
type: Array,
|
|
173
|
+
default: null
|
|
174
|
+
},
|
|
175
|
+
showClose: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: true
|
|
178
|
+
},
|
|
179
|
+
// 是否禁止编辑,为true只能下载,不能删除和上传
|
|
180
|
+
disable: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
default: false
|
|
183
|
+
},
|
|
184
|
+
// 文件大小限制,单位是M
|
|
185
|
+
limitFileSize: {
|
|
186
|
+
type: Number,
|
|
187
|
+
default: null
|
|
188
|
+
},
|
|
189
|
+
beforeUpload: {
|
|
190
|
+
type: Function,
|
|
191
|
+
default: null
|
|
192
|
+
},
|
|
193
|
+
beforeRemove: {
|
|
194
|
+
type: Function,
|
|
195
|
+
default: null
|
|
196
|
+
},
|
|
197
|
+
// 组件id,在表单或列表中应该唯一,一般传字段名即可
|
|
198
|
+
componentId: {
|
|
199
|
+
type: String,
|
|
200
|
+
default: function () {
|
|
201
|
+
return 'file-upload'
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
// 组件名称,一般是字段label
|
|
205
|
+
componentName: {
|
|
206
|
+
type: String,
|
|
207
|
+
default: function () {
|
|
208
|
+
return 'file-upload'
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
options: {
|
|
212
|
+
type: Object,
|
|
213
|
+
default: null
|
|
214
|
+
},
|
|
215
|
+
// 列表编码。选择文件后,回填列表文件集合使用。
|
|
216
|
+
listCode: {
|
|
217
|
+
type: String,
|
|
218
|
+
default: null
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
data () {
|
|
222
|
+
let fileList = []
|
|
223
|
+
if (this.fileResult) {
|
|
224
|
+
fileList = JSON.parse(JSON.stringify(this.fileResult))
|
|
225
|
+
}
|
|
226
|
+
const defaultAction = Vue.prototype.baseAPI + '/component/super-form/uploads'
|
|
227
|
+
const token = getToken()
|
|
228
|
+
let baseURL
|
|
229
|
+
if (this.options) {
|
|
230
|
+
baseURL = this.options.backendUrl
|
|
231
|
+
}
|
|
232
|
+
if (!baseURL) {
|
|
233
|
+
baseURL = Vue.prototype.baseURL
|
|
234
|
+
}
|
|
235
|
+
const imgSrc = baseURL + '/common/super-form/downloads?jwt=' + token
|
|
236
|
+
return {
|
|
237
|
+
defaultAction,
|
|
238
|
+
fileList,
|
|
239
|
+
imgSrc,
|
|
240
|
+
newFiles: [],
|
|
241
|
+
isUploading: false, // 是否正在上传
|
|
242
|
+
baseURL
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
watch: {
|
|
246
|
+
fileResult (val) {
|
|
247
|
+
this.fileList = JSON.parse(JSON.stringify(val))
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
methods: {
|
|
251
|
+
addFile (files) {
|
|
252
|
+
if (this.multiple) {
|
|
253
|
+
this.newFiles = this.newFiles.concat(files)
|
|
254
|
+
} else {
|
|
255
|
+
if (files && files.length > 0) {
|
|
256
|
+
this.newFiles = files
|
|
257
|
+
} else {
|
|
258
|
+
this.newFiles = []
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
this.$emit('pickup-file', this.newFiles)
|
|
262
|
+
},
|
|
263
|
+
isImg (file) {
|
|
264
|
+
const fileName = file.name
|
|
265
|
+
if (fileName) {
|
|
266
|
+
return fileName.indexOf('jpg') !== -1 || fileName.indexOf('JPG') !== -1 || fileName.indexOf('png') !== -1 || fileName.indexOf('PNG') !== -1
|
|
267
|
+
}
|
|
268
|
+
return false
|
|
269
|
+
},
|
|
270
|
+
removeFile (index, isTemp, fileName) {
|
|
271
|
+
if (!isTemp) {
|
|
272
|
+
// 表示是已经上传了的文件
|
|
273
|
+
const rmFile = JSON.parse(JSON.stringify(this.fileList[index]))
|
|
274
|
+
this.fileList.splice(index, 1)
|
|
275
|
+
this.$emit('remove', { rmFiles: [rmFile], serverFiles: this.fileList })
|
|
276
|
+
} else {
|
|
277
|
+
// 表示是新添加,还未上传的文件
|
|
278
|
+
const rmFile = JSON.parse(JSON.stringify(this.newFiles[index]))
|
|
279
|
+
this.newFiles.splice(index, 1)
|
|
280
|
+
this.$emit('remove', { rmFiles: [rmFile], serverFiles: this.fileList, newFiles: this.newFiles })
|
|
281
|
+
// console.log('---点击了删除文件按钮,发送postmessage给手机端---')
|
|
282
|
+
const message = {
|
|
283
|
+
type: 'removeFiles',
|
|
284
|
+
files: [fileName],
|
|
285
|
+
componentId: this.componentId,
|
|
286
|
+
componentName: this.componentName
|
|
287
|
+
}
|
|
288
|
+
window.parent.postMessage(JSON.stringify(message), '*')
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
downloadFile (file) {
|
|
292
|
+
this.$emit('download', file)
|
|
293
|
+
},
|
|
294
|
+
// 表示点击了选择文件按钮
|
|
295
|
+
pickFiles () {
|
|
296
|
+
// console.log('---点击了选择文件按钮---')
|
|
297
|
+
const message = {
|
|
298
|
+
type: 'pickFiles',
|
|
299
|
+
multiple: this.multiple,
|
|
300
|
+
componentId: this.componentId,
|
|
301
|
+
componentName: this.componentName,
|
|
302
|
+
systemCode: this.systemCode,
|
|
303
|
+
token: getToken(),
|
|
304
|
+
listCode: this.listCode
|
|
305
|
+
}
|
|
306
|
+
window.parent.postMessage(JSON.stringify(message), '*')
|
|
307
|
+
},
|
|
308
|
+
// 表示点击了上传按钮
|
|
309
|
+
uploadFiles () {
|
|
310
|
+
// console.log('---点击了上传按钮---this.newFiles=', this.newFiles)
|
|
311
|
+
if (this.newFiles && this.newFiles.length > 0) {
|
|
312
|
+
this.isUploading = true
|
|
313
|
+
// const message = {
|
|
314
|
+
// type: 'uploadFiles',
|
|
315
|
+
// systemCode: this.systemCode,
|
|
316
|
+
// token: getToken(),
|
|
317
|
+
// limitFileSize: this.limitFileSize,
|
|
318
|
+
// componentId: this.componentId,
|
|
319
|
+
// componentName: this.componentName
|
|
320
|
+
// }
|
|
321
|
+
let isCanUpload = true
|
|
322
|
+
if (this.beforeUpload && typeof (this.beforeUpload) === 'function') {
|
|
323
|
+
for (let i = 0; i < this.newFiles.length; i++) {
|
|
324
|
+
const file = this.newFiles[i]
|
|
325
|
+
const isMobile = true
|
|
326
|
+
// eslint-disable-next-line no-useless-call
|
|
327
|
+
isCanUpload = this.beforeUpload.call(this, file, isMobile)
|
|
328
|
+
if (isCanUpload !== undefined && isCanUpload === false) {
|
|
329
|
+
break
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (!isCanUpload) {
|
|
334
|
+
// 不能提交文件
|
|
335
|
+
return
|
|
336
|
+
}
|
|
337
|
+
// window.parent.postMessage(JSON.stringify(message), '*')
|
|
338
|
+
this.uploadFileSuccess(this.newFiles)
|
|
339
|
+
} else {
|
|
340
|
+
this.$emit('uploadend', this.fileList)
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
cleareQueuedFiles () {
|
|
344
|
+
// console.log('---cleareQueuedFiles---')
|
|
345
|
+
this.newFiles = []
|
|
346
|
+
// console.log('---点击了清空临时文件按钮,发送postmessage给手机端---')
|
|
347
|
+
const message = {
|
|
348
|
+
type: 'clearFiles',
|
|
349
|
+
componentId: this.componentId,
|
|
350
|
+
componentName: this.componentName
|
|
351
|
+
}
|
|
352
|
+
window.parent.postMessage(JSON.stringify(message), '*')
|
|
353
|
+
},
|
|
354
|
+
clearUploadedFiles () {
|
|
355
|
+
// console.log('---clearUploadedFiles---')
|
|
356
|
+
this.fileList = []
|
|
357
|
+
},
|
|
358
|
+
pickFileDone (data) {
|
|
359
|
+
this.appFileDone(data)
|
|
360
|
+
},
|
|
361
|
+
uploadFileDone (data) {
|
|
362
|
+
// 表示文件上传到服务器成功
|
|
363
|
+
this.appFileDone(data)
|
|
364
|
+
},
|
|
365
|
+
appFileDone (data) {
|
|
366
|
+
const files = data.files
|
|
367
|
+
let myFiles = files
|
|
368
|
+
if (files && typeof files === 'string') {
|
|
369
|
+
myFiles = JSON.parse(files)
|
|
370
|
+
}
|
|
371
|
+
if (myFiles && !Array.isArray(myFiles)) {
|
|
372
|
+
myFiles = [myFiles]
|
|
373
|
+
}
|
|
374
|
+
if (data.type === 'pickFileDone') {
|
|
375
|
+
// 选择文件完成
|
|
376
|
+
console.log('appFileDone11111----myFiles=', JSON.stringify(myFiles))
|
|
377
|
+
this.addFile(myFiles)
|
|
378
|
+
} else {
|
|
379
|
+
// 表示文件上传到服务器成功
|
|
380
|
+
console.log('appFileDone22222----myFiles=', JSON.stringify(myFiles))
|
|
381
|
+
this.uploadFileSuccess(myFiles)
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
uploadFileSuccess (files) {
|
|
385
|
+
this.isUploading = false
|
|
386
|
+
// 表示文件上传到服务器成功
|
|
387
|
+
if (files) {
|
|
388
|
+
// files:[{name:'',serverPath:''},{name:'',serverPath:''}]
|
|
389
|
+
if (this.multiple) {
|
|
390
|
+
this.$set(this, 'fileList', this.fileList.concat(files))
|
|
391
|
+
} else {
|
|
392
|
+
// 单选时将已选文件移除,然后再替换为新上传的文件
|
|
393
|
+
const rmFiles = JSON.parse(JSON.stringify(this.fileList))
|
|
394
|
+
this.fileResult[0] = files
|
|
395
|
+
this.$set(this, 'fileList', files)
|
|
396
|
+
this.$emit('remove', { rmFiles, serverFiles: this.fileList })
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
console.log('uploadFileSuccess111111----this.fileList=', JSON.stringify(this.fileList))
|
|
400
|
+
this.$set(this, 'newFiles', [])
|
|
401
|
+
this.$set(this, 'isUploading', false)
|
|
402
|
+
this.$emit('uploadend', this.fileList)
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
</script>
|
|
407
|
+
|
|
408
|
+
<style lang="scss" scoped>
|
|
409
|
+
|
|
410
|
+
</style>
|