|
@@ -32,6 +32,7 @@
|
|
|
@click="getDeviceFileList()"
|
|
|
>获取目录文件</el-button>
|
|
|
<el-button class="light-button" icon="el-icon-refresh" size="big" @click="refreshFileList()">刷新</el-button>
|
|
|
+ <el-button style="float: right;" class="light-button" icon="el-icon-add" size="big" @click="addFileRecord()">添加文件信息</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row type="flex" style="float:left;width: 100%;margin-top: 10px;">
|
|
@@ -70,10 +71,10 @@
|
|
|
size="small"
|
|
|
>上传文件</el-button>
|
|
|
</el-upload>
|
|
|
- <a v-if="scope.row.download==true" target="new" :href="`/test/file/${scope.row.id}/bytes`"><el-button class="table-act" type="text" icon="el-icon-download" size="small">下载文件</el-button></a>
|
|
|
- <el-button v-if="scope.row.writeable==true" class="table-act" type="text" icon="el-icon-download" size="small" @click="sendFile(scope.row)">写文件</el-button>
|
|
|
- <el-button v-if="scope.row.readable==true" class="table-act" type="text" icon="el-icon-download" size="small" @click="readFile(scope.row)">读文件</el-button>
|
|
|
- <el-button v-if="scope.row.deletable==true" class="table-act" type="text" icon="el-icon-delete" size="small" @click="deleteFile(scope.row)">删除</el-button>
|
|
|
+ <a v-if="scope.row.download==true" style="float: left;margin-right: 20px;" target="new" :href="`/test/file/${scope.row.id}/bytes`"><el-button class="table-act" type="text" icon="el-icon-download" size="small">下载文件</el-button></a>
|
|
|
+ <el-button v-if="scope.row.writeable==true" style="float: left;margin-right: 20px;" class="table-act" type="text" icon="el-icon-download" size="small" @click="sendFile(scope.row)">写文件</el-button>
|
|
|
+ <el-button v-if="scope.row.readable==true" style="float: left;margin-right: 20px;" class="table-act" type="text" icon="el-icon-download" size="small" @click="readFile(scope.row)">读文件</el-button>
|
|
|
+ <el-button v-if="scope.row.deletable==true" style="float: left;" class="table-act" type="text" icon="el-icon-delete" size="small" @click="deleteFile(scope.row)">删除</el-button>
|
|
|
<!--<el-button v-if="scope.row.pos==null || scope.row.size==null || scope.row.pos==scope.row.size" class="table-act" type="text" icon="el-icon-delete" size="small" @click="deleteFile(scope.row)">删除</el-button>-->
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -84,7 +85,7 @@
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
<el-tabs v-model="fileSendTabname" type="border-card" style="margin-top: 20px;">
|
|
|
- <el-tab-pane label="新文件下发" name="tab3" style="text-align: center;">
|
|
|
+ <el-tab-pane label="文件直接下发" name="tab3" style="text-align: center;">
|
|
|
<el-row>
|
|
|
<el-col>
|
|
|
<el-upload
|
|
@@ -206,7 +207,7 @@ export default {
|
|
|
// 初始化
|
|
|
async initFunctions() {
|
|
|
this.comonentVar.modelTitle = '文件传输'
|
|
|
- this.fileUrl = window.STATIC_CONFIG.proxyUrl
|
|
|
+ // this.fileUrl = window.STATIC_CONFIG.proxyUrl
|
|
|
this.getList()
|
|
|
},
|
|
|
// 关闭model时执行
|
|
@@ -251,8 +252,12 @@ export default {
|
|
|
}
|
|
|
this.dbFileList = resLst
|
|
|
}).catch(res => {
|
|
|
- this.dbFileList = []
|
|
|
this.isLoading2 = false
|
|
|
+ this.$message({
|
|
|
+ message: res.message,
|
|
|
+ type: 'error',
|
|
|
+ offset: window.screen.height / 3
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
refreshFileList() {
|
|
@@ -266,12 +271,43 @@ export default {
|
|
|
this.sendFileProcessNumber = '0 %'
|
|
|
this.$refs.sendFileProcess2.style.width = 0 * (300 / 100) + 'px'
|
|
|
},
|
|
|
+ addFileRecord() {
|
|
|
+ this.$prompt('文件名称', '文件信息', {
|
|
|
+ inputAttrs: {
|
|
|
+ maxlength: 50,
|
|
|
+ placeholder: '请输入50个字符以内的文件名'
|
|
|
+ }
|
|
|
+ }).then((obj) => {
|
|
|
+ // 确认
|
|
|
+ const v = obj.value == null ? '' : obj.value.replace(/ /gi, '')
|
|
|
+ if (v === '') {
|
|
|
+ this.$message('文件名称不能为空')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (v.length > 50) {
|
|
|
+ this.$message('文件名称不能超过50字符')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 先创建文件记录
|
|
|
+ putData('/test/file', { 'runnerId': this.modelParames.curPlanId, 'name': v, 'size': 0 }).then(res => {
|
|
|
+ this.$message('文件信息创添加成功')
|
|
|
+ this.getList()
|
|
|
+ }).catch(res => {
|
|
|
+ this.$message({
|
|
|
+ message: '文件信息添加失败:' + res.message,
|
|
|
+ type: 'error',
|
|
|
+ offset: window.screen.height / 3
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }).catch({
|
|
|
+ // 取消
|
|
|
+ })
|
|
|
+ },
|
|
|
submitUpload() {
|
|
|
// 上传文件
|
|
|
this.isUploadFileIng = true
|
|
|
// 先创建文件记录
|
|
|
putData('/test/file', { 'runnerId': this.modelParames.curPlanId, 'name': this.selectFileName, 'size': this.uploadSize }).then(res => {
|
|
|
- console.log(res)
|
|
|
this.fid = res.id
|
|
|
// /test/file/{id}/bytes
|
|
|
// this.uploadFileUrl = window.STATIC_CONFIG.proxyUrl + '/test/file/' + fid + '/bytes' // 文件上传地址
|
|
@@ -316,6 +352,11 @@ export default {
|
|
|
})
|
|
|
this.getList()
|
|
|
}).catch(res => {
|
|
|
+ this.$message({
|
|
|
+ message: res.message,
|
|
|
+ type: 'error',
|
|
|
+ offset: window.screen.height / 3
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
downloadFile(row) {
|
|
@@ -341,6 +382,11 @@ export default {
|
|
|
}, 3000)
|
|
|
}).catch(res => {
|
|
|
this.isReadFileId = 0
|
|
|
+ this.$message({
|
|
|
+ message: res.message,
|
|
|
+ type: 'error',
|
|
|
+ offset: window.screen.height / 3
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
sendFile(row) {
|
|
@@ -359,6 +405,11 @@ export default {
|
|
|
}, 3000)
|
|
|
}).catch(res => {
|
|
|
this.isSendFileId = 0
|
|
|
+ this.$message({
|
|
|
+ message: res.message,
|
|
|
+ type: 'error',
|
|
|
+ offset: window.screen.height / 3
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
// 表单取消按钮
|