|
|
|
@ -0,0 +1,282 @@
|
|
|
|
|
<!--
|
|
|
|
|
* @Description: 检测任务
|
|
|
|
|
* @Autor: 飘泊客
|
|
|
|
|
* @Date: 2022-01-13 15:43:13
|
|
|
|
|
* @LastEditors: 飘泊客
|
|
|
|
|
* @LastEditTime: 2023-05-31 14:32:03
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<!--工具栏-->
|
|
|
|
|
<div class="head-container">
|
|
|
|
|
<div>
|
|
|
|
|
<!-- 搜索 -->
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="query.uploadName"
|
|
|
|
|
clearable
|
|
|
|
|
size="small"
|
|
|
|
|
placeholder="输入活动名称"
|
|
|
|
|
style="width: 200px"
|
|
|
|
|
class="filter-item"
|
|
|
|
|
@keyup.enter.native="crud.toQuery"
|
|
|
|
|
/>
|
|
|
|
|
<rrOperation />
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" @click="resourcesDialog = true">
|
|
|
|
|
上传文件
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!--表格渲染-->
|
|
|
|
|
<el-table
|
|
|
|
|
ref="table"
|
|
|
|
|
v-loading="crud.loading"
|
|
|
|
|
:data="crud.data"
|
|
|
|
|
:header-cell-style="{'text-align':'left'}"
|
|
|
|
|
style="width: 100%;"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column :show-overflow-tooltip="true" type="index" label="序号" />
|
|
|
|
|
<!-- <el-table-column :show-overflow-tooltip="true" prop="activityName" label="文件名称" /> -->
|
|
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="createTime" label="上传时间">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="uploadNum" label="总数" />
|
|
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="uploadName" label="活动名" />
|
|
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="activityId" label="对应活动ID" />
|
|
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="status" label="发送状态">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span :class="scope.row.status == 0 ? 'info' : 'scuuess'">{{ scope.row.status == 0 ? '发送中' : '发送成功' }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="createTime" label="发送日期">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
label="操作"
|
|
|
|
|
fixed="right"
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button type="primary" @click="downloadUrl(scope.row)">下载</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<!--分页组件-->
|
|
|
|
|
<pagination />
|
|
|
|
|
</el-row>
|
|
|
|
|
<!--追加资源-->
|
|
|
|
|
<el-dialog
|
|
|
|
|
append-to-body
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
:visible.sync="resourcesDialog"
|
|
|
|
|
:before-close="colseFileDialog"
|
|
|
|
|
title="上传文件"
|
|
|
|
|
width="520px"
|
|
|
|
|
class="import-dialog"
|
|
|
|
|
>
|
|
|
|
|
<div div class="u-flex mt-5">
|
|
|
|
|
<div class="label">任务名</div>
|
|
|
|
|
<el-input v-model="activityName" placeholder="请设置任务名" style="width: 360px" />
|
|
|
|
|
</div>
|
|
|
|
|
<div div class="u-flex mt-5">
|
|
|
|
|
<div class="label">活动ID</div>
|
|
|
|
|
<el-input v-model="actId" placeholder="请输入活动ID" style="width: 360px" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="margin-auto">
|
|
|
|
|
<el-upload
|
|
|
|
|
ref="updaatefiles"
|
|
|
|
|
action=""
|
|
|
|
|
accept=".xlsx,.xls"
|
|
|
|
|
drag
|
|
|
|
|
multiple
|
|
|
|
|
:limit="5"
|
|
|
|
|
class="mt-10 text-center"
|
|
|
|
|
:file-list="fileList"
|
|
|
|
|
:auto-upload="false"
|
|
|
|
|
:on-remove="handleRemove"
|
|
|
|
|
:on-exceed="handleExceed"
|
|
|
|
|
:http-request="updtaFils"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-upload" />
|
|
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
|
<div slot="tip" class="el-upload__tip">只能上传.xls,.xlsx,.csv文件,且不超过100M</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<div class="line-text margin-auto">
|
|
|
|
|
1、请导入 xls,xlsx,.csv 格式的文件<br>
|
|
|
|
|
2、必须填写表头方便后续匹配,也可点击下载 模板,帮助您快速完成导入<br>
|
|
|
|
|
3、多文件导入请统一提交<br>
|
|
|
|
|
4、一次最多支持导入 5 份文件<br>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="text" @click="colseFileDialog">取消</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
:loading="uploading"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="submitUpload"
|
|
|
|
|
>上传资源
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
|
|
|
|
import rrOperation from '@crud/RR.operation'
|
|
|
|
|
import pagination from '@crud/Pagination'
|
|
|
|
|
// import DateRangePicker from '@/components/DateRangePicker'
|
|
|
|
|
import { uploadActivityFiles, uploadCallFileExport } from '@/api/index'
|
|
|
|
|
import { downloadFile } from '@/utils/index'
|
|
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
|
|
|
|
|
|
|
const defaultForm = {}
|
|
|
|
|
export default {
|
|
|
|
|
name: 'DetectionTask',
|
|
|
|
|
components: { rrOperation, pagination },
|
|
|
|
|
cruds() {
|
|
|
|
|
return CRUD({ title: '检测任务', url: '/api/uploadCallFile' })
|
|
|
|
|
},
|
|
|
|
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
height: document.documentElement.clientHeight - 180 + 'px;',
|
|
|
|
|
uploading: false,
|
|
|
|
|
resourcesDialog: false,
|
|
|
|
|
activityName: '', // 任务名
|
|
|
|
|
actId: '', // 活动id
|
|
|
|
|
fileList: [], // files集合
|
|
|
|
|
permission: {
|
|
|
|
|
add: ['admin', 'user:add'],
|
|
|
|
|
edit: ['admin', 'user:edit'],
|
|
|
|
|
del: ['admin', 'user:del'],
|
|
|
|
|
download: ['admin', 'user:download']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters([
|
|
|
|
|
'user'
|
|
|
|
|
])
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
},
|
|
|
|
|
mounted: function() {
|
|
|
|
|
const that = this
|
|
|
|
|
window.onresize = function temp() {
|
|
|
|
|
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
downloadUrl(data) {
|
|
|
|
|
uploadCallFileExport({ fileId: data.id }).then(res => {
|
|
|
|
|
downloadFile(res, data.uploadName, 'xlsx')
|
|
|
|
|
})
|
|
|
|
|
// const a = document.createElement('a')
|
|
|
|
|
// a.style.display = 'none'
|
|
|
|
|
// a.href = data.filePath
|
|
|
|
|
// document.body.appendChild(a)
|
|
|
|
|
// a.click()
|
|
|
|
|
// document.body.removeChild(a)
|
|
|
|
|
},
|
|
|
|
|
// toDelete(data) {
|
|
|
|
|
// this.$confirm(`确认删除选中的数据?`, '提示', {
|
|
|
|
|
// confirmButtonText: '确定',
|
|
|
|
|
// cancelButtonText: '取消',
|
|
|
|
|
// type: 'warning'
|
|
|
|
|
// }).then(() => {
|
|
|
|
|
// this.crud.delAllLoading = true
|
|
|
|
|
// const arrayIds = Array.of(data.id)
|
|
|
|
|
// delRecord(arrayIds).then((res) => {
|
|
|
|
|
// this.crud.toQuery()
|
|
|
|
|
// })
|
|
|
|
|
// }).catch(() => {
|
|
|
|
|
// })
|
|
|
|
|
// },
|
|
|
|
|
colseFileDialog() {
|
|
|
|
|
this.fileList = []
|
|
|
|
|
this.activityName = ''
|
|
|
|
|
this.actId = ''
|
|
|
|
|
this.resourcesDialog = false
|
|
|
|
|
},
|
|
|
|
|
// 上传
|
|
|
|
|
updtaFils(file) {
|
|
|
|
|
this.fileData.append('file', file.file)
|
|
|
|
|
},
|
|
|
|
|
// 移除
|
|
|
|
|
handleRemove(file, fileList) {
|
|
|
|
|
this.fileList = fileList
|
|
|
|
|
},
|
|
|
|
|
// 选取文件超过数量提示
|
|
|
|
|
handleExceed(files, fileList) {
|
|
|
|
|
this.$message.warning(`当前限制选择 5 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
|
|
|
|
|
},
|
|
|
|
|
submitUpload() {
|
|
|
|
|
// 模板导入
|
|
|
|
|
const isLt100M = this.fileList.every(file => file.size / 1024 / 1024 < 100)
|
|
|
|
|
if (!isLt100M) {
|
|
|
|
|
this.$message.warning('请检查,上传文件大小不能超过100MB!')
|
|
|
|
|
} else {
|
|
|
|
|
this.fileData = new FormData() // new formData对象
|
|
|
|
|
this.$refs['updaatefiles'].submit()
|
|
|
|
|
if (!this.fileData.get('file')) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请先选择文件',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
this.fileData.append('uploadName', this.activityName)
|
|
|
|
|
this.fileData.append('actId', this.actId)
|
|
|
|
|
this.uploading = true
|
|
|
|
|
uploadActivityFiles(this.fileData).then((res) => {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '操作成功,文件上传中',
|
|
|
|
|
type: 'success'
|
|
|
|
|
})
|
|
|
|
|
this.fileList = []
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.colseFileDialog()
|
|
|
|
|
this.crud.toQuery()
|
|
|
|
|
this.uploading = false
|
|
|
|
|
}, 800)
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.uploading = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
|
::v-deep .vue-treeselect__control, ::v-deep .vue-treeselect__placeholder, ::v-deep .vue-treeselect__single-value {
|
|
|
|
|
height: 30px;
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.label {
|
|
|
|
|
min-width: 60px;
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
float: none;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #606266;
|
|
|
|
|
text-align: left;
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
// padding: 0 20px 0 0;
|
|
|
|
|
}
|
|
|
|
|
.scuuess {
|
|
|
|
|
color: #67c23a;
|
|
|
|
|
}
|
|
|
|
|
.info {
|
|
|
|
|
color: #909399;
|
|
|
|
|
}
|
|
|
|
|
</style>
|