@zscreate/zhxy-app-component 1.0.114 → 1.0.116
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.
|
@@ -787,11 +787,17 @@ export default {
|
|
|
787
787
|
return findComponent(data.list)
|
|
788
788
|
},
|
|
789
789
|
getUploadFileUrl(widget) {
|
|
790
|
-
let action =
|
|
790
|
+
let action = action = this.widget.options.action;
|
|
791
|
+
|
|
791
792
|
if (String(widget.options.action).startsWith('http')) {
|
|
792
793
|
action = this.widget.options.action;
|
|
793
794
|
} else {
|
|
794
|
-
|
|
795
|
+
if (action !== '/sys/common/upload') {
|
|
796
|
+
const apiUrl = process.uniEnv.BASE_API || process.uniEnv.apiUrl
|
|
797
|
+
action = apiUrl + action
|
|
798
|
+
} else {
|
|
799
|
+
action = this.actionUrl.includes('sys/common/upload') ? this.actionUrl : (this.actionUrl + '/sys/common/upload')
|
|
800
|
+
}
|
|
795
801
|
}
|
|
796
802
|
return action
|
|
797
803
|
},
|
|
@@ -817,10 +823,7 @@ export default {
|
|
|
817
823
|
}
|
|
818
824
|
})
|
|
819
825
|
},
|
|
820
|
-
|
|
821
|
-
fileDelete(idx) {
|
|
822
|
-
this.dataModel.splice(idx, 1)
|
|
823
|
-
},
|
|
826
|
+
|
|
824
827
|
//切换时间
|
|
825
828
|
dateChange(val) {
|
|
826
829
|
if (this.tableKey) {
|
|
@@ -864,7 +867,7 @@ export default {
|
|
|
864
867
|
let params = {
|
|
865
868
|
formId: this.formId,
|
|
866
869
|
model: this.widget.model,
|
|
867
|
-
value: this.models,
|
|
870
|
+
value: Object.assign({} , this.getFormData() , this.models),
|
|
868
871
|
};
|
|
869
872
|
// if (typeof(this.formDataId) == 'object' && this.formDataId.id) {
|
|
870
873
|
// params.formDataId = this.formDataId.id
|
|
@@ -20,10 +20,10 @@ export default {
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
httpApiActions(args) {
|
|
23
|
-
const { method = 'get', api, data, showError } = args
|
|
23
|
+
const { method = 'get', api, data, showError, handleData } = args
|
|
24
24
|
let func = method === 'get' ? this.$u.get : this.$u.post
|
|
25
25
|
func(api, data).then(res => {
|
|
26
|
-
res.success && this.updateModelByPulish(res.result)
|
|
26
|
+
res.success && this.updateModelByPulish(handleData ? handleData(res) : res.result)
|
|
27
27
|
|
|
28
28
|
if (!res.success && showError) {
|
|
29
29
|
uni.showToast({ title: res.message, icon: 'none' })
|
|
@@ -3,6 +3,25 @@ export const valueChangeMixin = {
|
|
|
3
3
|
/**文件dataModal**/
|
|
4
4
|
filePost(val) {
|
|
5
5
|
this.dataModel.push(val)
|
|
6
|
+
this.updateEncryptFileIds()
|
|
7
|
+
},
|
|
8
|
+
//文件删除
|
|
9
|
+
fileDelete(idx) {
|
|
10
|
+
this.dataModel.splice(idx, 1)
|
|
11
|
+
this.updateEncryptFileIds()
|
|
12
|
+
},
|
|
13
|
+
updateEncryptFileIds() {
|
|
14
|
+
if (this.widget.options.uploadEncrypt) {
|
|
15
|
+
if (Array.isArray(this.dataModel)) {
|
|
16
|
+
this.models['formFileIds'] = this.dataModel.map(item => {
|
|
17
|
+
return item['fileId']
|
|
18
|
+
}).join(',')
|
|
19
|
+
this.$emit('update:models', this.models)
|
|
20
|
+
} else {
|
|
21
|
+
this.models['formFileIds'] = ''
|
|
22
|
+
this.$emit('update:models', this.models)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
6
25
|
},
|
|
7
26
|
/**imgdataModal**/
|
|
8
27
|
imgUrlPost(val) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</view>
|
|
8
8
|
<view>
|
|
9
9
|
<view class="file_item" v-for="(item,idx) in defaultFile" :key="idx">
|
|
10
|
-
<view @click="downLoadFile(item.url,item.name)" style="max-width: 640rpx;color: rgb(0, 122, 255); overflow: hidden" :style="{maxWidth: disabled ? '100%': '640rpx'}">{{item.name}}</view>
|
|
10
|
+
<view @click="downLoadFile(item.url,item.name, item)" style="max-width: 640rpx;color: rgb(0, 122, 255); overflow: hidden" :style="{maxWidth: disabled ? '100%': '640rpx'}">{{item.name}}</view>
|
|
11
11
|
<icon type="clear" size="16" @click="handleDelete(idx)" v-if="!disabled" />
|
|
12
12
|
</view>
|
|
13
13
|
</view>
|
|
@@ -81,8 +81,13 @@
|
|
|
81
81
|
handleDelete(idx) {
|
|
82
82
|
this.$emit('fileDelete', idx)
|
|
83
83
|
},
|
|
84
|
-
downLoadFile(path, name) {
|
|
85
|
-
|
|
84
|
+
downLoadFile(path, name, item) {
|
|
85
|
+
let baseUrl = this.downLoadUrl
|
|
86
|
+
if (this.widget.options.uploadEncrypt) {
|
|
87
|
+
path = '/sys/common/downloadZip?fileId=' + item.fileId
|
|
88
|
+
baseUrl = process.uniEnv.BASE_API || process.uniEnv.apiUrl
|
|
89
|
+
}
|
|
90
|
+
downloadFile(baseUrl, { path, name })
|
|
86
91
|
},
|
|
87
92
|
chooseMessageFile: function(e) {
|
|
88
93
|
console.log(this.widget, )
|
|
@@ -140,13 +145,27 @@
|
|
|
140
145
|
filePath: path[0].path,
|
|
141
146
|
name: 'file',
|
|
142
147
|
formData: {},
|
|
148
|
+
// header['X-Access-Token'] = uni.getStorageSync('token') || vm.$store.state.token
|
|
149
|
+
header: {
|
|
150
|
+
'X-Access-Token': uni.getStorageSync('token') || this.$store.state.token || this.$store.getters.token
|
|
151
|
+
},
|
|
143
152
|
success: function(res) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
153
|
+
res = JSON.parse(res.data)
|
|
154
|
+
if (!res.success) return uni.showToast({
|
|
155
|
+
title: res.message || '文件上传失败',
|
|
156
|
+
icon: 'none'
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
let imgObj = {
|
|
160
|
+
key: String(Math.random()).substr(2) - 0,
|
|
161
|
+
name: that.name,
|
|
162
|
+
status: "success",
|
|
163
|
+
url: res.message
|
|
164
|
+
}
|
|
165
|
+
if (that.widget.options.uploadEncrypt) {
|
|
166
|
+
imgObj['fileId'] = res.result.fileId
|
|
167
|
+
imgObj['name'] = res.result.fileName || imgObj['name']
|
|
168
|
+
}
|
|
150
169
|
that.$emit('filePost', imgObj)
|
|
151
170
|
},
|
|
152
171
|
complete() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zscreate/zhxy-app-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.116",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "zhxy-app-component",
|
|
6
6
|
"main": "index.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"zhxy-app-component"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
+
"postversion": "git push && git push --tags",
|
|
11
12
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|
package/utils/util.js
CHANGED
|
@@ -110,8 +110,9 @@ function downloadFile(downLoadUrl, { path, name }) {
|
|
|
110
110
|
let type = '';
|
|
111
111
|
const fileTypes = ['doc', 'docx', 'pdf', 'xls', 'xlsx', 'ppt', 'pptx'];
|
|
112
112
|
const imageTypes = ['png', 'jpeg', 'jpg', 'gif']
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
let tempPath = name || path
|
|
114
|
+
if (tempPath) {
|
|
115
|
+
let str = tempPath.split('.');
|
|
115
116
|
type = str[str.length - 1]
|
|
116
117
|
type = type.toString().toLowerCase()
|
|
117
118
|
}
|