修改上传文件

This commit is contained in:
qq787203167
2022-03-23 22:40:40 +08:00
parent c089041fb1
commit 48a9f4c7a4
3 changed files with 9 additions and 8 deletions
@@ -112,7 +112,7 @@
</div> </div>
<a-form-model-item class="itemModel" :prop="item.db_field_name"> <a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-button type="primary" class="button-text" <a-button type="primary" class="button-text"
@click="clickButtonToUpload(item.db_field_name)"> @click="clickButtonToUpload(item)">
{{ (formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' || {{ (formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||
formInline[item.db_field_name] == null) ? $t('clickUpload') : $t('viewUploadedFiles') formInline[item.db_field_name] == null) ? $t('clickUpload') : $t('viewUploadedFiles')
}} }}
@@ -344,11 +344,12 @@
this.formInline[item] = dateOne ? [dateOne, dateTwo] : [] this.formInline[item] = dateOne ? [dateOne, dateTwo] : []
}, },
clickButtonToUpload(current) { clickButtonToUpload(item) {
this.$refs.uploadFile.perentHandleFunc() this.$refs.uploadFile.perentHandleFunc()
this.$refs.uploadFile.state = item.flag
this.$refs.uploadFile.visible = true this.$refs.uploadFile.visible = true
this.uploadName = current this.uploadName = item.db_field_name
getAction('sys/common/getFileInfos', { id: this.formInline[current] }).then((res) => { getAction('sys/common/getFileInfos', { id: this.formInline[item.db_field_name] }).then((res) => {
if (res.success) { if (res.success) {
this.$refs.uploadFile.perentHandleFunc(res.result) this.$refs.uploadFile.perentHandleFunc(res.result)
} else { } else {
@@ -136,7 +136,7 @@
initWebSocket: function() { initWebSocket: function() {
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
var userId = store.getters.userInfo.id var userId = store.getters.userInfo.id
var url = window._CONFIG['domianWebSocketURL'].replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/'+userId var url = window._CONFIG['domianWebSocketURL'].replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId
this.websock = new WebSocket(url) this.websock = new WebSocket(url)
this.websock.onopen = this.websocketOnopen this.websock.onopen = this.websocketOnopen
this.websock.onerror = this.websocketOnerror this.websock.onerror = this.websocketOnerror
@@ -149,7 +149,7 @@
this.timer = setInterval(() => { this.timer = setInterval(() => {
try { try {
self.websock.send('test') self.websock.send('test')
console.log('发送消息'); console.log('发送消息')
} catch (err) { } catch (err) {
console.log('断开了:' + err) console.log('断开了:' + err)
self.connection() self.connection()
@@ -161,7 +161,6 @@
this.reconnect() this.reconnect()
}, },
websocketOnmessage: function(e) { websocketOnmessage: function(e) {
console.log('-----接收消息-------', e)
//系统通知 //系统通知
this.loadData() this.loadData()
}, },
+2 -1
View File
@@ -8,7 +8,7 @@
name="file" name="file"
:file-list="myfileList" :file-list="myfileList"
:multiple="true" :multiple="true"
:action='uploadAction' :action="uploadAction+'?state='+state"
:headers="headers" :headers="headers"
@preview="preview" @preview="preview"
:before-upload="beforeUpload" :before-upload="beforeUpload"
@@ -37,6 +37,7 @@
visible: false, visible: false,
title: this.$t('clickUpload'), title: this.$t('clickUpload'),
uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload', uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload',
state:undefined,
myuploadAction: window._CONFIG['domianURL'] + this.thisFileUploadUrl, myuploadAction: window._CONFIG['domianURL'] + this.thisFileUploadUrl,
upDataList: [], upDataList: [],
downLoadFileUrl: window._CONFIG['domianPreviewURL'] + '/sys/common/download', downLoadFileUrl: window._CONFIG['domianPreviewURL'] + '/sys/common/download',