real-time-export-new.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="pre-export">
  3. <el-row style="padding: 0 0 14px 0">
  4. <el-col :span="12" style="width: 355px">
  5. <el-alert
  6. :closable="false"
  7. title="申请下载后,文件会在几分钟后生成!"
  8. type="warning"
  9. >
  10. </el-alert>
  11. </el-col>
  12. <el-col
  13. :span="3"
  14. style="width: 66px; float: right"
  15. >
  16. <el-button
  17. :size="searchSize"
  18. type="primary"
  19. style="float: right; margin-left: 5px"
  20. @click="searchList"
  21. >
  22. 刷新
  23. </el-button>
  24. </el-col>
  25. </el-row>
  26. <el-table
  27. :data="tableData"
  28. border
  29. v-loading="loading"
  30. :size="size"
  31. style="width: 100%"
  32. >
  33. <el-table-column prop="name" label="业务表名称" min-width="140"/>
  34. <el-table-column prop="start" label="数据开始时间" min-width="140"/>
  35. <el-table-column prop="end" label="数据结束时间" min-width="140"/>
  36. <el-table-column prop="apply_name" label="申请人" min-width="70"/>
  37. <el-table-column prop="status" label="状态" min-width="70">
  38. <template slot-scope="scope">
  39. <el-tag
  40. :size="tablebtnSize"
  41. :type="scope.row.status == '2' ? 'success' : scope.row.status == '1'?'warning':'info'"
  42. v-text="
  43. (statusOptions.find((item) => item.id == scope.row.status) || {})
  44. .label || '--'
  45. "
  46. ></el-tag>
  47. </template>
  48. </el-table-column>
  49. <el-table-column prop="updatetime" label="状态更新时间" min-width="140"/>
  50. <el-table-column prop="addtime" label="创建时间" min-width="140"/>
  51. <el-table-column fixed="right" label="操作" width="82">
  52. <template slot-scope="scope">
  53. <el-tooltip
  54. effect="dark"
  55. content="编辑"
  56. placement="top"
  57. >
  58. <i class="el-icon-edit tb-icon" @click="openModal(scope.row)"></i>
  59. </el-tooltip>
  60. <el-tooltip
  61. effect="dark"
  62. content="下载"
  63. placement="top"
  64. v-if="
  65. scope.row.status == '2'
  66. "
  67. >
  68. <i
  69. class="el-icon-download tb-icon"
  70. @click="batchExport(scope.row.down_url)"
  71. ></i>
  72. </el-tooltip>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <add-edit
  77. :sitem="sitem"
  78. :show-model="showModel"
  79. :type="'2'"
  80. @refresh="searchList"
  81. @cancel="showModel = false"
  82. />
  83. </div>
  84. </template>
  85. <script>
  86. import asyncRequest from "@/apis/service/reportQuery/saleReportOrder/index.js";
  87. import addEdit from "./addEdit";
  88. import { mapGetters } from "vuex";
  89. import urlConfig from "@/apis/url-config";
  90. import resToken from "@/mixins/resToken";
  91. export default {
  92. name: "Account",
  93. components: {
  94. addEdit,
  95. },
  96. mixins: [ resToken],
  97. computed: {
  98. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  99. powers() {
  100. let tran =
  101. this.$store.getters.btnList.find(
  102. (item) => item.menu_route == "financeReport"
  103. ) || {};
  104. if (tran && tran.action && tran.action.length > 0) {
  105. return tran.action;
  106. } else {
  107. return [];
  108. }
  109. },
  110. },
  111. data() {
  112. return {
  113. fileUrl: urlConfig.baseURL,
  114. // 状态
  115. statusOptions: [
  116. { id: "0", label: "待创建" },
  117. { id: "1", label: "执行中" },
  118. { id: "2", label: "已完成" },
  119. ],
  120. loading: true,
  121. showModel: false,
  122. sitem: null,
  123. //接口用的是财务报表导出的接口
  124. parmValue: {
  125. page: 1, // 页码
  126. size: 15, // 每页显示条数
  127. type:2 //报表类型,1财务,2销售
  128. },
  129. // 表格 - 数据
  130. tableData: [],
  131. };
  132. },
  133. mounted() {
  134. this.searchList();
  135. },
  136. methods: {
  137. restSearch() {
  138. this.parmValue = {
  139. page: 1, // 页码
  140. size: 15, // 每页显示条数
  141. };
  142. this.searchList();
  143. },
  144. openModal(sitem) {
  145. this.showModel = true;
  146. this.sitem = sitem;
  147. },
  148. batchExport(content) {
  149. if (!this.loading) {
  150. this.loading = true;
  151. let aEle = document.createElement("a"); // 创建a标签
  152. aEle.href = this.fileUrl + content; // content为后台返回的下载地址
  153. aEle.click(); // 设置点击事件
  154. this.$message.success(`下载成功!`);
  155. setTimeout(() => {
  156. this.loading = false;
  157. }, 500);
  158. }
  159. },
  160. async searchList() {
  161. this.loading = true;
  162. const res = await asyncRequest.realNewList(this.parmValue);
  163. if (res && res.code === 0 && res.data) {
  164. this.tableData = res.data.list;
  165. } else if (res && res.code >= 100 && res.code <= 104) {
  166. await this.logout();
  167. } else {
  168. this.tableData = [];
  169. }
  170. this.loading = false;
  171. },
  172. },
  173. };
  174. </script>
  175. <style lang="scss" scoped>
  176. .account {
  177. }
  178. </style>