history-data.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <div class="pre-export">
  3. <ex-table
  4. style="margin-top: -10px"
  5. v-loading="loading"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. parmValue.page = 1;
  16. searchList();
  17. "
  18. @screen-submit="
  19. pageInfo.curr = 1;
  20. parmValue.page = 1;
  21. searchList();
  22. "
  23. >
  24. <template #table-header="{}">
  25. <div style="width: 100%">
  26. <el-row style="padding: 0 0 0 80px">
  27. <el-col :span="24">
  28. <el-col :span="12" style="width: 355px">
  29. <el-alert
  30. :closable="false"
  31. title="申请导出后,文件会在几分钟后生成!"
  32. type="warning"
  33. >
  34. </el-alert>
  35. </el-col>
  36. <el-col
  37. :span="3"
  38. style="width: 66px; float: right"
  39. v-if="powers.some((item) => item == '002')"
  40. >
  41. <el-button
  42. :size="searchSize"
  43. type="primary"
  44. style="float: right; margin-left: 5px"
  45. @click="searchList"
  46. >
  47. 刷新
  48. </el-button>
  49. </el-col>
  50. </el-col>
  51. </el-row>
  52. </div>
  53. </template>
  54. <template #status="{ scope }">
  55. <el-tag
  56. :size="tablebtnSize"
  57. :type="
  58. (statusOptions.find((item) => item.id == scope.row.status) || {})
  59. .type || ''
  60. "
  61. v-text="
  62. (statusOptions.find((item) => item.id == scope.row.status) || {})
  63. .label || '--'
  64. "
  65. ></el-tag>
  66. </template>
  67. <template #operation="{ scope }">
  68. <el-tooltip
  69. effect="dark"
  70. content="申请导出"
  71. placement="top"
  72. v-if="
  73. powers.some((item) => item == '049') && scope.row.status !== '1'
  74. "
  75. >
  76. <i class="el-icon-thumb tb-icon" @click="setStatus(scope.row.id)"></i>
  77. </el-tooltip>
  78. <el-tooltip
  79. v-if="powers.some((item) => item == '049') && scope.row.status == '2'"
  80. effect="dark"
  81. content="导出"
  82. placement="top"
  83. >
  84. <i
  85. class="el-icon-download tb-icon"
  86. @click="batchExport(scope.row.down_url)"
  87. ></i>
  88. </el-tooltip>
  89. </template>
  90. </ex-table>
  91. </div>
  92. </template>
  93. <script>
  94. import mixinPage from "@/mixins/elPaginationHandle";
  95. import asyncRequest from "@/apis/service/search/standBook";
  96. import ExTable from "@/components/ExTableNew.vue";
  97. import { mapGetters } from "vuex";
  98. import urlConfig from "@/apis/url-config";
  99. import resToken from "@/mixins/resToken";
  100. export default {
  101. name: "Account",
  102. components: {
  103. ExTable,
  104. },
  105. mixins: [mixinPage, resToken],
  106. computed: {
  107. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  108. powers() {
  109. let tran =
  110. this.$store.getters.btnList.find(
  111. (item) => item.menu_route == "standBook"
  112. ) || {};
  113. if (tran && tran.action && tran.action.length > 0) {
  114. return tran.action;
  115. } else {
  116. return [];
  117. }
  118. },
  119. },
  120. data() {
  121. return {
  122. fileUrl: urlConfig.testURL,
  123. // 状态
  124. statusOptions: [
  125. { id: "0", label: "待申请", type: "info" },
  126. { id: "1", label: "系统处理中", type: "warning" },
  127. { id: "2", label: "已完成", type: "success" },
  128. { id: "3", label: "导出失败", type: "danger" },
  129. ],
  130. loading: true,
  131. showModel: false,
  132. sitem: null,
  133. parmValue: {
  134. page: 1, // 页码
  135. size: 15, // 每页显示条数
  136. },
  137. // 表格 - 数据
  138. tableData: [],
  139. // 表格 - 参数
  140. table: {
  141. stripe: true,
  142. border: true,
  143. _defaultHeader_: ["setcol"],
  144. },
  145. // 表格 - 分页
  146. pageInfo: {
  147. size: 15,
  148. curr: 1,
  149. total: 0,
  150. },
  151. // 表格 - 列参数
  152. columns: [
  153. {
  154. prop: "name",
  155. label: "业务表名称",
  156. "min-width":"145px"
  157. },
  158. // {
  159. // prop: "apply_name",
  160. // label: "申请人",
  161. // width:"80px"
  162. // },
  163. {
  164. prop: "status",
  165. label: "状态",
  166. _slot_: "status",
  167. "min-width":"100px"
  168. },
  169. {
  170. prop: "remark",
  171. label: "下载反馈备注",
  172. "min-width":"145px"
  173. },
  174. {
  175. prop: "expiretime",
  176. label: "文件过期时间",
  177. "width":"145px"
  178. },
  179. {
  180. prop: "updatetime",
  181. label: "更新时间",
  182. "width":"145px"
  183. },
  184. {
  185. prop: "addtime",
  186. label: "创建时间",
  187. "width":"145px"
  188. },
  189. {
  190. prop: "",
  191. label: "操作",
  192. fixed: "right",
  193. width: "80px",
  194. _slot_: "operation",
  195. },
  196. ],
  197. };
  198. },
  199. mounted() {
  200. this.searchList();
  201. },
  202. methods: {
  203. restSearch() {
  204. this.parmValue = {
  205. page: 1, // 页码
  206. size: 15, // 每页显示条数
  207. };
  208. this.searchList();
  209. },
  210. openModal(sitem) {
  211. this.showModel = true;
  212. this.sitem = sitem;
  213. },
  214. batchExport(content) {
  215. if (!this.loading) {
  216. this.loading = true;
  217. let aEle = document.createElement("a"); // 创建a标签
  218. // aEle.download = fileName; // 设置下载文件的文件名
  219. aEle.href = this.fileUrl + content; // content为后台返回的下载地址
  220. aEle.click(); // 设置点击事件
  221. // document.body.removeChild(aEle); //下载完成移除元素
  222. this.$message.success(`导出成功!`);
  223. setTimeout(() => {
  224. this.loading = false;
  225. }, 500);
  226. }
  227. },
  228. async setStatus(id) {
  229. if (!this.loading) {
  230. this.loading = true;
  231. const model = {
  232. id: id,
  233. };
  234. const res = await asyncRequest.download(model);
  235. if (res && res.code === 0) {
  236. this.$notify.success({
  237. title: "申请成功,请等待系统执行完成!",
  238. message: "",
  239. });
  240. await this.searchList();
  241. } else if (res && res.code >= 100 && res.code <= 104) {
  242. await this.logout();
  243. } else {
  244. this.$message.warning(res.message);
  245. }
  246. this.loading = false;
  247. }
  248. },
  249. async searchList() {
  250. this.loading = true;
  251. const res = await asyncRequest.hlist(this.parmValue);
  252. if (res && res.code === 0 && res.data) {
  253. this.tableData = res.data.list;
  254. this.tableData.forEach((v) => {
  255. if (v.status !== "3") {
  256. v.remark = "";
  257. }
  258. });
  259. this.pageInfo.total = Number(res.data.count);
  260. } else if (res && res.code >= 100 && res.code <= 104) {
  261. await this.logout();
  262. } else {
  263. this.tableData = [];
  264. this.pageInfo.total = 0;
  265. }
  266. this.loading = false;
  267. },
  268. },
  269. };
  270. </script>
  271. <style lang="scss" scoped>
  272. .account {
  273. }
  274. </style>