123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <template>
- <div>
- <!-- 下载链接 -->
- <el-form ref="form" :model="form" :rules="rules" inline>
- <el-form-item label="任务名称" prop="type">
- <TaskSelect v-model="form.type" />
- </el-form-item>
- <el-button @click="searchForm">查询</el-button>
- </el-form>
- <el-table :data="tableData" stripe style="width: 100%;">
- <el-table-column type="selection" width="42" />
- <el-table-column width="100" label="ID">
- <span slot-scope="scope">{{ scope.row.id }}</span>
- </el-table-column>
- <el-table-column width="150" label="任务名称">
- <span slot-scope="scope">{{ scope.row.entityName }}</span>
- </el-table-column>
- <el-table-column width="150" label="上传文件名">
- <span slot-scope="scope">{{ scope.row.importFileName }}</span>
- </el-table-column>
- <el-table-column width="120" label="状态">
- <span slot-scope="scope">{{ scope.row.status }}</span>
- </el-table-column>
- <el-table-column label="异常">
- <span slot-scope="scope">{{ scope.row.summary }}</span>
- </el-table-column>
- <el-table-column width="100" label="上传时间">
- <span slot-scope="scope">{{
- scope.row.createTime | datetimeFilter
- }}</span>
- </el-table-column>
- <el-table-column :context="_self" label="操作" width="210">
- <div slot-scope="scope">
- <el-button
- size="mini"
- type="primary"
- plain
- v-if="scope.row.status === 'FINISH'"
- @click="
- download({
- id: scope.row.id,
- type: scope.row.hasResultFile === '1' ? 'RESULT' : 'IMPORTFILE',
- })
- "
- >
- 下载文件
- </el-button>
- <el-button
- size="mini"
- type="primary"
- plain
- v-if="scope.row.hasReportFile === '1'"
- @click="download({ id: scope.row.id, type: 'REPORT' })"
- >
- 导出报告
- </el-button>
- </div>
- </el-table-column>
- </el-table>
- <div class="page float-right">
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-size="pageSize"
- :page-sizes="[10, 20, 50, 100, 200, 300]"
- @size-change="handleSizeChange"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- />
- </div>
- </div>
- </template>
- <script>
- import { searchTasks } from "@/api/examwork-task";
- import { downloadFileURL } from "@/utils/utils";
- import { downloadFile } from "@/api/system-info";
- export default {
- name: "ImportExportTask",
- data() {
- return {
- form: {
- type: "",
- },
- rules: {},
- tableData: [],
- currentPage: 1,
- pageSize: 10,
- total: 10,
- };
- },
- methods: {
- async searchForm() {
- // try {
- // const valid = await this.$refs.form.validate();
- // if (!valid) return;
- // } catch (error) {
- // console.log(error);
- // return;
- // }
- const res = await searchTasks({
- type: this.form.type,
- pageNumber: this.currentPage,
- pageSize: this.pageSize,
- });
- this.tableData = res.data.data.records.records;
- this.total = res.data.data.records.total;
- },
- handleCurrentChange(val) {
- this.currentPage = val;
- this.searchForm();
- },
- handleSizeChange(val) {
- this.pageSize = val;
- this.currentPage = 1;
- this.searchForm();
- },
- async download({ id, type }) {
- const res = await downloadFile({ id, type });
- const url = res.data.data.url;
- downloadFileURL(url);
- },
- },
- };
- </script>
- <style></style>
|