InforList.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div class="upload_record">
  3. <h1>资料列表</h1>
  4. <div class="record">
  5. <div>上传记录</div>
  6. <div class="searchBox">
  7. <div class="search_inside">
  8. <span><img src="" alt="" /></span>
  9. <input type="text" name="" id="" placeholder="请输入要搜索的资料名" />
  10. <button>搜索</button>
  11. </div>
  12. </div>
  13. <div class="sortBox">
  14. <div class="sort_inside">
  15. <span>是否下载</span>
  16. <select name="" id="isDownload">
  17. <option value="">不限</option>
  18. <option value="">是</option>
  19. <option value="">否</option>
  20. </select>
  21. <span>是否反馈</span>
  22. <select name="" id="isReturn">
  23. <option value="">不限</option>
  24. <option value="">是</option>
  25. <option value="">否</option>
  26. </select>
  27. <span>排序</span>
  28. <select name="" id="timeSort">
  29. <option value="">时间降序</option>
  30. <option value="">时间升序</option>
  31. </select>
  32. </div>
  33. <button>确定</button>
  34. </div>
  35. <div class="tableD">
  36. <UpLoadTable
  37. :trStyle="trStyle"
  38. :tableHeader="tableHeaderD"
  39. :tableData="tableData"
  40. :tableHeadStyle="tableHeadStyle"
  41. :operation="operation"
  42. :discolor="discolor"
  43. :flag="false"
  44. />
  45. </div>
  46. <div class="pageD">
  47. <TablePage
  48. :totalPage="totalPage"
  49. :currentPage="currentPage"
  50. @change_page="changePage"
  51. @jump_page="jumpPage"
  52. />
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import TablePage from "../../components/TablePage";
  59. import UpLoadTable from "../../components/Table";
  60. export default {
  61. props: {
  62. isManufacturer: {
  63. type: String,
  64. default: "distributor",
  65. },
  66. },
  67. components: {
  68. TablePage,
  69. UpLoadTable,
  70. },
  71. data() {
  72. return {
  73. tableHeaderD: [
  74. "资料名称",
  75. "时间类型",
  76. "传播类型",
  77. "上传时间",
  78. "下载状态",
  79. "反馈状态",
  80. "操作",
  81. ],
  82. operation: [
  83. {
  84. name: "下载",
  85. function: () => {
  86. //this.download();
  87. this.downloadPost();
  88. },
  89. },
  90. /* {
  91. name: "反馈",
  92. function: () => {
  93. this.feedback();
  94. },
  95. }, */
  96. {
  97. name: "查看详情>",
  98. function: () => {
  99. this.showDetail();
  100. },
  101. },
  102. ],
  103. // 表格配置
  104. sum: 240, // 一共有多少条数据
  105. pageSize: 20, // 每页展示的数据
  106. discolor: false, // 是否隔行变色
  107. currentPage: 1,
  108. tableData: [
  109. {
  110. name: "北京博瑞",
  111. time: "2021/04",
  112. spread: "传播类型1",
  113. uploadTime: "",
  114. down: "已下载",
  115. feedback: "未反馈",
  116. },
  117. {
  118. name: "雷克萨斯纯电动SUV",
  119. time: "2021/04",
  120. spread: "传播类型1",
  121. uploadTime: "",
  122. down: "已下载",
  123. feedback: "未反馈",
  124. },
  125. {
  126. name: "a,续航可达400公里",
  127. time: "2021/04",
  128. spread: "传播类型1",
  129. uploadTime: "",
  130. down: "已下载",
  131. feedback: "未反馈",
  132. },
  133. ],
  134. tableHeadStyle: {
  135. background: "#848484",
  136. height: "30px",
  137. color: "white",
  138. },
  139. trStyle: {
  140. width: "150px",
  141. height: "30px",
  142. overflow: "hidden",
  143. },
  144. };
  145. },
  146. computed: {
  147. // 表格总页数
  148. totalPage() {
  149. return Math.ceil(this.sum / this.pageSize);
  150. },
  151. },
  152. methods: {
  153. showDetail: () => {
  154. alert("展示详情");
  155. },
  156. feedback: () => {
  157. alert("反馈");
  158. },
  159. download: () => {
  160. alert("下载");
  161. },
  162. // 获取某一页面的数据,展示在表格
  163. changePage: function (page) {
  164. this.currentPage = page;
  165. console.log(page);
  166. },
  167. // 点击上一页,下一页,首页,尾页
  168. jumpPage: function (item) {
  169. switch (item) {
  170. case 1:
  171. this.currentPage = 1;
  172. break;
  173. case 2:
  174. this.currentPage = this.currentPage - 1;
  175. break;
  176. case 3:
  177. this.currentPage = this.currentPage + 1;
  178. break;
  179. case 4:
  180. this.currentPage = this.totalPage;
  181. break;
  182. }
  183. console.log(this.currentPage);
  184. },
  185. submit: function () {
  186. console.log(this.totalPage);
  187. this.sum = this.sum + 1;
  188. console.log(
  189. this.inforName,
  190. this.inforDes,
  191. this.materialTime,
  192. this.range,
  193. this.addByCustomize
  194. );
  195. },
  196. downloadPost: function (config) {
  197. console.log(config);
  198. return new Promise((resolve, reject) => {
  199. this.$http({
  200. url: config.url,
  201. method: "post",
  202. data: config.data,
  203. responseType: "blob",
  204. })
  205. .then((res) => {
  206. // resolve(res);
  207. let link = document.createElement("a");
  208. link.href = window.URL.createObjectURL(new Blob([res.data]));
  209. link.target = "_blank";
  210. //文件名和格式
  211. link.download = "文件模板.xlsx";
  212. document.body.appendChild(link);
  213. link.click();
  214. document.body.removeChild(link);
  215. })
  216. .catch((err) => {
  217. reject(err);
  218. });
  219. });
  220. },
  221. },
  222. mounted() {
  223. }
  224. };
  225. </script>
  226. <style scoped lang="less">
  227. .searchBox {
  228. width: 100%;
  229. height: 40px;
  230. display: flex;
  231. align-items: center;
  232. margin-left: 40px;
  233. }
  234. .sortBox {
  235. display: flex;
  236. justify-content: flex-end;
  237. height: 40px;
  238. align-items: center;
  239. }
  240. .sort_inside {
  241. display: flex;
  242. width: 400px;
  243. justify-content: space-between;
  244. }
  245. </style>