123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- <template>
- <div class="pre-export">
- <ex-table
- style="margin-top: -10px"
- v-loading="loading"
- :table="table"
- :data="tableData"
- :columns="columns"
- :page="pageInfo"
- :size="size"
- @page-curr-change="handlePageChange"
- @page-size-change="handleSizeChange"
- @screen-reset="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- @screen-submit="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- >
- <template #table-header="{}">
- <div style="width: 100%">
- <el-row style="padding: 0 0 0 80px">
- <el-col :span="24">
- <el-col :span="12" style="width: 355px">
- <el-alert
- :closable="false"
- title="申请导出后,文件会在几分钟后生成!"
- type="warning"
- >
- </el-alert>
- </el-col>
- <el-col
- :span="3"
- style="width: 66px; float: right"
- v-if="powers.some((item) => item == '002')"
- >
- <el-button
- :size="searchSize"
- type="primary"
- style="float: right; margin-left: 5px"
- @click="searchList"
- >
- 刷新
- </el-button>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- <template #status="{ scope }">
- <el-tag
- :size="tablebtnSize"
- :type="
- (statusOptions.find((item) => item.id == scope.row.status) || {})
- .type || ''
- "
- v-text="
- (statusOptions.find((item) => item.id == scope.row.status) || {})
- .label || '--'
- "
- ></el-tag>
- </template>
- <template #operation="{ scope }">
- <el-tooltip
- effect="dark"
- content="申请导出"
- placement="top"
- v-if="
- powers.some((item) => item == '049') && scope.row.status !== '1'
- "
- >
- <i class="el-icon-thumb tb-icon" @click="setStatus(scope.row.id)"></i>
- </el-tooltip>
- <el-tooltip
- v-if="powers.some((item) => item == '049') && scope.row.status == '2'"
- effect="dark"
- content="导出"
- placement="top"
- >
- <i
- class="el-icon-download tb-icon"
- @click="batchExport(scope.row.down_url)"
- ></i>
- </el-tooltip>
- </template>
- </ex-table>
- </div>
- </template>
- <script>
- import mixinPage from "@/mixins/elPaginationHandle";
- import asyncRequest from "@/apis/service/search/standBook";
- import ExTable from "@/components/ExTableNew.vue";
- import { mapGetters } from "vuex";
- import urlConfig from "@/apis/url-config";
- import resToken from "@/mixins/resToken";
- export default {
- name: "Account",
- components: {
- ExTable,
- },
- mixins: [mixinPage, resToken],
- computed: {
- ...mapGetters(["tablebtnSize", "searchSize", "size"]),
- powers() {
- let tran =
- this.$store.getters.btnList.find(
- (item) => item.menu_route == "standBook"
- ) || {};
- if (tran && tran.action && tran.action.length > 0) {
- return tran.action;
- } else {
- return [];
- }
- },
- },
- data() {
- return {
- fileUrl: urlConfig.testURL,
- // 状态
- statusOptions: [
- { id: "0", label: "待申请", type: "info" },
- { id: "1", label: "系统处理中", type: "warning" },
- { id: "2", label: "已完成", type: "success" },
- { id: "3", label: "导出失败", type: "danger" },
- ],
- loading: true,
- showModel: false,
- sitem: null,
- parmValue: {
- page: 1, // 页码
- size: 15, // 每页显示条数
- },
- // 表格 - 数据
- tableData: [],
- // 表格 - 参数
- table: {
- stripe: true,
- border: true,
- _defaultHeader_: ["setcol"],
- },
- // 表格 - 分页
- pageInfo: {
- size: 15,
- curr: 1,
- total: 0,
- },
- // 表格 - 列参数
- columns: [
- {
- prop: "name",
- label: "业务表名称",
- "min-width":"145px"
- },
- // {
- // prop: "apply_name",
- // label: "申请人",
- // width:"80px"
- // },
- {
- prop: "status",
- label: "状态",
- _slot_: "status",
- "min-width":"100px"
- },
-
- {
- prop: "remark",
- label: "下载反馈备注",
- "min-width":"145px"
- },
- {
- prop: "expiretime",
- label: "文件过期时间",
- "width":"145px"
- },
- {
- prop: "updatetime",
- label: "更新时间",
- "width":"145px"
- },
- {
- prop: "addtime",
- label: "创建时间",
- "width":"145px"
- },
- {
- prop: "",
- label: "操作",
- fixed: "right",
- width: "80px",
- _slot_: "operation",
- },
- ],
- };
- },
- mounted() {
- this.searchList();
- },
- methods: {
- restSearch() {
- this.parmValue = {
- page: 1, // 页码
- size: 15, // 每页显示条数
- };
- this.searchList();
- },
- openModal(sitem) {
- this.showModel = true;
- this.sitem = sitem;
- },
- batchExport(content) {
- if (!this.loading) {
- this.loading = true;
- let aEle = document.createElement("a"); // 创建a标签
- // aEle.download = fileName; // 设置下载文件的文件名
- aEle.href = this.fileUrl + content; // content为后台返回的下载地址
- aEle.click(); // 设置点击事件
- // document.body.removeChild(aEle); //下载完成移除元素
- this.$message.success(`导出成功!`);
- setTimeout(() => {
- this.loading = false;
- }, 500);
- }
- },
- async setStatus(id) {
- if (!this.loading) {
- this.loading = true;
- const model = {
- id: id,
- };
- const res = await asyncRequest.download(model);
-
- if (res && res.code === 0) {
- this.$notify.success({
- title: "申请成功,请等待系统执行完成!",
- message: "",
- });
- await this.searchList();
- } else if (res && res.code >= 100 && res.code <= 104) {
- await this.logout();
- } else {
- this.$message.warning(res.message);
- }
- this.loading = false;
- }
- },
- async searchList() {
- this.loading = true;
- const res = await asyncRequest.hlist(this.parmValue);
- if (res && res.code === 0 && res.data) {
- this.tableData = res.data.list;
- this.tableData.forEach((v) => {
- if (v.status !== "3") {
- v.remark = "";
- }
- });
- this.pageInfo.total = Number(res.data.count);
- } else if (res && res.code >= 100 && res.code <= 104) {
- await this.logout();
- } else {
- this.tableData = [];
- this.pageInfo.total = 0;
- }
- this.loading = false;
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .account {
- }
- </style>
|