UploadLinks.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <div class="upload_links">
  3. <div class="header">
  4. <div class="search">
  5. <div class="input">
  6. <img src="../../img/search.png" />
  7. <input
  8. type="text"
  9. @focus="focusInput"
  10. v-model="inputValue"
  11. class="inputFocus"
  12. placeholder="DLR Code / 经销商"
  13. />
  14. </div>
  15. <div class="area">
  16. <p>所属区域</p>
  17. <select v-model="areaValue">
  18. <option value="">请选择</option>
  19. <option v-for="(item, index) in areaList" :key="index">
  20. {{ item }}
  21. </option>
  22. </select>
  23. </div>
  24. <div class="time">
  25. <p>请选择时间段</p>
  26. <input type="date" v-model="startTime" />
  27. <span>至</span>
  28. <input type="date" v-model="endTime" />
  29. </div>
  30. <div class="current_button" @click="search">搜索</div>
  31. </div>
  32. </div>
  33. <div class="count">
  34. <p>针对论坛及其它平台链接上传</p>
  35. <div style="display: flex">
  36. <div><Count :sum="sum" /></div>
  37. <div class="current_button" @click="exportData">导出</div>
  38. </div>
  39. </div>
  40. <div class="tableBox">
  41. <Table :tableData="tableData" @go_detail="ulrJump"></Table>
  42. </div>
  43. <TablePage
  44. :currentPage="currentPage"
  45. :totalPage="totalPage"
  46. @change_page="changePage"
  47. @jump_page="jumpPage"
  48. ></TablePage>
  49. </div>
  50. </template>
  51. <script>
  52. import TablePage from "../../components/TablePage";
  53. import Count from "../../components/Count";
  54. import Table from "./components/UploadLinksTable";
  55. export default {
  56. components: {
  57. TablePage,
  58. Count,
  59. Table,
  60. },
  61. data() {
  62. return {
  63. inputValue: "",
  64. sum: 0,
  65. currentPage: 1,
  66. pageSize: 20,
  67. tableData: [],
  68. areaList: [],
  69. areaValue: "",
  70. startTime: "",
  71. endTime: "",
  72. onlineUrl: "http://8.140.188.129:8080", //'http://8.140.188.129:8080'线上 //http://8.136.230.133:8080 //测试
  73. };
  74. },
  75. computed: {
  76. // 表格总页数
  77. totalPage() {
  78. return Math.ceil(this.sum / this.pageSize);
  79. },
  80. },
  81. methods: {
  82. // 当焦点在选择框时,清空选择框
  83. focusInput: function () {
  84. this.inputValue = "";
  85. },
  86. search: function () {
  87. let data = {
  88. queryParams: this.inputValue,
  89. localArea: this.areaValue,
  90. startTime: this.startTime,
  91. endTime: this.endTime,
  92. page: this.currentPage,
  93. rows: this.pageSize,
  94. };
  95. this.firmsLinkUpload(data);
  96. },
  97. changePage: function (page) {
  98. this.currentPage = page;
  99. let req = {
  100. queryParams: this.inputValue,
  101. localArea: this.areaValue,
  102. startTime: this.startTime,
  103. endTime: this.endTime,
  104. page: this.currentPage,
  105. rows: this.pageSize,
  106. };
  107. this.firmsLinkUpload(req);
  108. },
  109. // 点击上一页,下一页,首页,尾页
  110. jumpPage: function (item) {
  111. switch (item) {
  112. case 1:
  113. this.currentPage = 1;
  114. break;
  115. case 2:
  116. this.currentPage = this.currentPage - 1;
  117. break;
  118. case 3:
  119. this.currentPage = this.currentPage + 1;
  120. break;
  121. case 4:
  122. this.currentPage = this.totalPage;
  123. break;
  124. }
  125. let req = {
  126. queryParams: this.inputValue,
  127. localArea: this.areaValue,
  128. startTime: this.startTime,
  129. endTime: this.endTime,
  130. page: this.currentPage,
  131. rows: this.pageSize,
  132. };
  133. this.firmsLinkUpload(req);
  134. },
  135. ulrJump: function (url) {
  136. window.open(url);
  137. },
  138. exportData: function () {
  139. this.exportTem();
  140. },
  141. // 获取表格数据
  142. firmsLinkUpload: function (data = {}) {
  143. this.$http({
  144. method: "post",
  145. url: "/firmsLinkUpload",
  146. data: data,
  147. })
  148. .then((res) => {
  149. console.log(res.data.data);
  150. this.tableData = res.data.data;
  151. this.sum = res.data.count;
  152. })
  153. .catch((err) => {
  154. console.log(err);
  155. });
  156. },
  157. // 获取 所有区域 接口
  158. getAreaList: function () {
  159. this.$http({
  160. method: "post",
  161. url: "/sys/agent/selectAgentAreaInfoList",
  162. })
  163. .then((res) => {
  164. if (res.data && res.data.code === 200) {
  165. this.areaList = res.data.data;
  166. } else {
  167. console.log(res);
  168. }
  169. })
  170. .catch((err) => {
  171. console.log(err);
  172. });
  173. },
  174. // 导出 接口
  175. exportTem: function () {
  176. let url = this.onlineUrl + "/exportFactory";
  177. window.open(url);
  178. },
  179. },
  180. created() {
  181. let req = {
  182. page: this.currentPage,
  183. rows: this.pageSize,
  184. };
  185. this.firmsLinkUpload(req);
  186. this.getAreaList();
  187. },
  188. };
  189. </script>
  190. <style scoped lang="less">
  191. .upload_links {
  192. .header {
  193. padding: 10px;
  194. border: 1px solid #ccc;
  195. .search {
  196. display: flex;
  197. align-items: center;
  198. .input {
  199. background-color: #fff;
  200. border: 1px solid #ccc;
  201. padding: 2px;
  202. display: flex;
  203. img {
  204. width: 22px;
  205. height: 22px;
  206. border: 1px solid #ccc;
  207. }
  208. input {
  209. background-color: #fff;
  210. border: 1px solid #ccc;
  211. margin-left: 3px;
  212. color: #555;
  213. font-size: 12px;
  214. height: 18px;
  215. }
  216. }
  217. }
  218. .area {
  219. margin-left: 20px;
  220. display: flex;
  221. height: 28px;
  222. line-height: 28px;
  223. select {
  224. margin-left: 10px;
  225. height: 28px;
  226. width: 120px;
  227. font-size: 12px;
  228. color: #555;
  229. border: 1px solid #ccc;
  230. option {
  231. font-size: 12px;
  232. border: 1px solid #ccc;
  233. }
  234. }
  235. }
  236. .time {
  237. display: flex;
  238. margin-left: 20px;
  239. p {
  240. height: 28px;
  241. line-height: 28px;
  242. margin-right: 10px;
  243. }
  244. input {
  245. height: 26px;
  246. padding: 0;
  247. outline: none;
  248. border: 1px solid #ccc;
  249. margin-right: 10px;
  250. }
  251. span {
  252. height: 28px;
  253. line-height: 28px;
  254. margin-right: 10px;
  255. }
  256. }
  257. }
  258. .count {
  259. display: flex;
  260. justify-content: space-between;
  261. margin-top: 5px;
  262. p {
  263. margin-top: 10px;
  264. font-weight: 600;
  265. }
  266. }
  267. .tableBox {
  268. width: 1030px;
  269. overflow: auto;
  270. text-align: center;
  271. }
  272. }
  273. .inputFocus {
  274. outline: none;
  275. border: 1px solid #ccc;
  276. }
  277. .inputFocus:focus {
  278. animation: shadowAni 200ms linear forwards;
  279. }
  280. @keyframes shadowAni {
  281. 0% {
  282. border-color: #cccccc;
  283. box-shadow: inset 0px 0px 0 #ccc;
  284. }
  285. 100% {
  286. border-color: #75b9f0;
  287. box-shadow: 0px 0px 5px #75b9f0;
  288. }
  289. }
  290. </style>