real-time-export-new.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. v-if="powers.some((item) => item == '002')"
  16. >
  17. <el-button
  18. :size="searchSize"
  19. type="primary"
  20. style="float: right; margin-left: 5px"
  21. @click="searchList"
  22. >
  23. 刷新
  24. </el-button>
  25. </el-col>
  26. </el-row>
  27. <el-table
  28. :data="tableData"
  29. border
  30. v-loading="loading"
  31. :size="size"
  32. style="width: 100%"
  33. >
  34. <el-table-column prop="name" label="业务表名称" min-width="140"/>
  35. <el-table-column prop="start" label="数据开始时间" min-width="140"/>
  36. <el-table-column prop="end" label="数据结束时间" min-width="140"/>
  37. <el-table-column prop="apply_name" label="申请人" min-width="70"/>
  38. <el-table-column prop="status" label="状态" min-width="70">
  39. <template slot-scope="scope">
  40. <el-tag
  41. :size="tablebtnSize"
  42. :type="scope.row.status == '2' ? 'success' : scope.row.status == '1'?'warning':'info'"
  43. v-text="
  44. (statusOptions.find((item) => item.id == scope.row.status) || {})
  45. .label || '--'
  46. "
  47. ></el-tag>
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="updatetime" label="状态更新时间" min-width="140"/>
  51. <el-table-column prop="addtime" label="创建时间" min-width="140"/>
  52. <el-table-column fixed="right" label="操作" width="82">
  53. <template slot-scope="scope">
  54. <el-tooltip
  55. effect="dark"
  56. content="编辑"
  57. placement="top"
  58. v-if="powers.some((item) => item == '005')"
  59. >
  60. <i class="el-icon-edit tb-icon" @click="openModal(scope.row)"></i>
  61. </el-tooltip>
  62. <el-tooltip
  63. effect="dark"
  64. content="导出"
  65. placement="top"
  66. v-if="
  67. powers.some((item) => item == '049') && scope.row.status == '2'
  68. "
  69. >
  70. <i
  71. class="el-icon-download tb-icon"
  72. @click="batchExport(scope.row.down_url)"
  73. ></i>
  74. </el-tooltip>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. <add-edit
  79. :sitem="sitem"
  80. :show-model="showModel"
  81. :type="'3'"
  82. @refresh="searchList"
  83. @cancel="showModel = false"
  84. />
  85. </div>
  86. </template>
  87. <script>
  88. import asyncRequest from "@/apis/service/search/standBook";
  89. import addEdit from "./addEdit";
  90. import { mapGetters } from "vuex";
  91. import urlConfig from "@/apis/url-config";
  92. import resToken from "@/mixins/resToken";
  93. export default {
  94. name: "Account",
  95. components: {
  96. addEdit,
  97. },
  98. mixins: [ resToken],
  99. computed: {
  100. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  101. powers() {
  102. let tran =
  103. this.$store.getters.btnList.find(
  104. (item) => item.menu_route == "standBook"
  105. ) || {};
  106. if (tran && tran.action && tran.action.length > 0) {
  107. return tran.action;
  108. } else {
  109. return [];
  110. }
  111. },
  112. },
  113. data() {
  114. return {
  115. fileUrl: urlConfig.baseURL,
  116. // 状态
  117. statusOptions: [
  118. { id: "0", label: "待创建" },
  119. { id: "1", label: "执行中" },
  120. { id: "2", label: "已完成" },
  121. ],
  122. loading: true,
  123. showModel: false,
  124. sitem: null,
  125. parmValue: {
  126. page: 1, // 页码
  127. size: 15, // 每页显示条数
  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. // if (this.checkAuditTime('9:00','18:00')) return this.$message.warning('9:00至18:00不可编辑')
  146. this.showModel = true;
  147. this.sitem = sitem;
  148. },
  149. batchExport(content) {
  150. if (!this.loading) {
  151. this.loading = true;
  152. let aEle = document.createElement("a"); // 创建a标签
  153. aEle.href = this.fileUrl + content; // content为后台返回的下载地址
  154. aEle.click(); // 设置点击事件
  155. this.$message.success(`导出成功!`);
  156. setTimeout(() => {
  157. this.loading = false;
  158. }, 500);
  159. }
  160. },
  161. async searchList() {
  162. this.loading = true;
  163. const res = await asyncRequest.realNewList(this.parmValue);
  164. if (res && res.code === 0 && res.data) {
  165. this.tableData = res.data.list;
  166. } else if (res && res.code >= 100 && res.code <= 104) {
  167. await this.logout();
  168. } else {
  169. this.tableData = [];
  170. }
  171. this.loading = false;
  172. },
  173. checkAuditTime(beginTime, endTime) {
  174. var nowDate = new Date();
  175. var beginDate = new Date(nowDate);
  176. var endDate = new Date(nowDate);
  177. var beginIndex = beginTime.lastIndexOf("\:");
  178. var beginHour = beginTime.substring(0, beginIndex);
  179. var beginMinue = beginTime.substring(beginIndex + 1, beginTime.length);
  180. beginDate.setHours(beginHour, beginMinue, 0, 0);
  181. var endIndex = endTime.lastIndexOf("\:");
  182. var endHour = endTime.substring(0, endIndex);
  183. var endMinue = endTime.substring(endIndex + 1, endTime.length);
  184. endDate.setHours(endHour, endMinue, 0, 0);
  185. return nowDate.getTime() - beginDate.getTime() >= 0 && nowDate.getTime() <= endDate.getTime();
  186. },
  187. },
  188. };
  189. </script>
  190. <style lang="scss" scoped>
  191. .account {
  192. }
  193. </style>