123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <template>
- <div class="sync-manage">
- <div class="part-box part-box-filter part-box-flex">
- <el-form ref="FilterForm" label-position="left" inline>
- <template v-if="checkPrivilege('condition', 'condition')">
- <el-form-item label="同步类型:">
- <el-select v-model="filter.type" placeholder="同步类型" clearable>
- <el-option
- v-for="(val, key) in STMMS_SYNC_TYPE"
- :key="key"
- :value="key"
- :label="val"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="同步结果:">
- <el-select
- v-model="filter.result"
- placeholder="同步结果"
- clearable
- style="width: 120px;"
- >
- <el-option
- v-for="(val, key) in DATA_TASK_RESULT"
- :key="key"
- :value="key"
- :label="val"
- ></el-option>
- </el-select>
- </el-form-item>
- </template>
- <el-form-item label-width="0px">
- <el-button
- v-if="checkPrivilege('button', 'select')"
- type="primary"
- @click="toPage(1)"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- </div>
- <div class="part-box part-box-pad">
- <el-table ref="TableList" :data="dataList">
- <el-table-column
- type="index"
- label="序号"
- width="70"
- :index="indexMethod"
- ></el-table-column>
- <el-table-column prop="type" label="类别"></el-table-column>
- <el-table-column prop="status" label="状态"> </el-table-column>
- <el-table-column prop="result" label="结果" width="100">
- </el-table-column>
- <el-table-column prop="createTime" label="创建时间" width="180">
- <span slot-scope="scope">{{
- scope.row.createTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="createName" label="创建人"></el-table-column>
- <el-table-column class-name="action-column" label="操作" width="100">
- <template slot-scope="scope">
- <el-button
- v-if="scope.row.hasReportFile && checkPrivilege('link', 'export')"
- type="text"
- class="btn-primary"
- :disabled="loading"
- @click="toDonwloadLog(scope.row)"
- >导出日志</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <div class="part-page">
- <el-pagination
- background
- layout="total,prev, pager, next"
- :current-page="current"
- :total="total"
- :page-size="size"
- @current-change="toPage"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { STMMS_SYNC_TYPE, DATA_TASK_RESULT } from "@/constants/enumerate";
- import { syncResultListPage } from "../api";
- import { attachmentDownload } from "../../login/api";
- import { downloadByUrl } from "@/plugins/download";
- export default {
- name: "sync-manage",
- data() {
- return {
- STMMS_SYNC_TYPE,
- DATA_TASK_RESULT,
- filter: {
- result: "",
- type: ""
- },
- current: 1,
- size: this.GLOBAL.pageSize,
- total: 0,
- dataList: [],
- loading: false
- };
- },
- created() {
- this.getList();
- },
- methods: {
- async getList() {
- if (!this.checkPrivilege("list", "list")) return;
- const datas = {
- ...this.filter,
- pageNumber: this.current,
- pageSize: this.size
- };
- const data = await syncResultListPage(datas);
- this.dataList = data.records;
- this.total = data.total;
- },
- toPage(page) {
- this.current = page;
- this.getList();
- },
- async toDonwloadLog(row) {
- if (this.loading) return;
- this.loading = true;
- const res = await attachmentDownload({
- id: row.id,
- type: "SYNC_REPORT"
- }).catch(() => {});
- this.loading = false;
- if (!res) {
- this.$message.error("文件下载失败,请重新尝试!");
- return;
- }
- const url = res.url;
- if (url.endsWith(".txt")) {
- this.loading = false;
- window.open(url);
- return;
- }
- downloadByUrl(url);
- this.$message.success("文件下载成功!");
- }
- }
- };
- </script>
|