UploadLinks.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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. <div class="date_pick">
  27. <Datepicker
  28. :language="zh"
  29. format="yyyy/MM/dd"
  30. placeholder=" 年 / 月 / 日"
  31. v-model="startTimeValue"
  32. ></Datepicker>
  33. </div>
  34. <span>至</span>
  35. <div class="date_pick">
  36. <Datepicker
  37. :language="zh"
  38. format="yyyy/MM/dd"
  39. placeholder=" 年 / 月 / 日"
  40. v-model="endTimeValue"
  41. ></Datepicker>
  42. </div>
  43. </div>
  44. <div class="current_button" @click="search">搜索</div>
  45. </div>
  46. </div>
  47. <div class="count">
  48. <p>针对论坛及其它平台链接上传</p>
  49. <div style="display: flex">
  50. <div><Count :sum="sum" /></div>
  51. <div class="current_button" @click="exportData">导出</div>
  52. </div>
  53. </div>
  54. <div class="tableBox">
  55. <Table :tableData="tableData" @go_detail="ulrJump"></Table>
  56. </div>
  57. <TablePage
  58. :currentPage="currentPage"
  59. :totalPage="totalPage"
  60. @change_page="changePage"
  61. @jump_page="jumpPage"
  62. ></TablePage>
  63. </div>
  64. </template>
  65. <script>
  66. import TablePage from "../../components/TablePage";
  67. import Count from "../../components/Count";
  68. import Table from "./components/UploadLinksTable";
  69. import { env_url, php_url } from "../../config/env";
  70. import Datepicker from "vuejs-datepicker";
  71. import { zh } from "vuejs-datepicker/dist/locale";
  72. import axiosTest from "axios";
  73. export default {
  74. components: {
  75. TablePage,
  76. Count,
  77. Table,
  78. Datepicker,
  79. },
  80. data() {
  81. return {
  82. zh: zh,
  83. startTimeValue: "",
  84. endTimeValue: "",
  85. inputValue: "",
  86. sum: 0,
  87. currentPage: 1,
  88. pageSize: 20,
  89. tableData: [],
  90. areaList: [],
  91. areaValue: "",
  92. startTime: "",
  93. endTime: "",
  94. onlineUrl: env_url, //'http://8.140.188.129:8080'线上 //http://8.136.230.133:8080 //测试,
  95. otherUrl: php_url,
  96. };
  97. },
  98. computed: {
  99. // 表格总页数
  100. totalPage() {
  101. return Math.ceil(this.sum / this.pageSize);
  102. },
  103. },
  104. methods: {
  105. // 当焦点在选择框时,清空选择框
  106. focusInput: function () {
  107. this.inputValue = "";
  108. },
  109. formatDateToDate: function (val) {
  110. if (val) {
  111. let date = new Date(val)
  112. let y = date.getFullYear()
  113. let m = date.getMonth() + 1
  114. m = m < 10 ? ('0' + m) : m
  115. let d = date.getDate()
  116. d = d < 10 ? ('0' + d) : d
  117. const time = y + '-' + m + '-' + d;
  118. return time
  119. } else {
  120. return ""
  121. }
  122. },
  123. search: function () {
  124. this.startTime = this.formatDateToDate(this.startTimeValue);
  125. this.endTime = this.formatDateToDate(this.endTimeValue);
  126. let data = {
  127. queryParams: this.inputValue,
  128. localArea: this.areaValue,
  129. startTime: this.startTime,
  130. endTime: this.endTime,
  131. Page: this.currentPage,
  132. Rows: this.pageSize,
  133. };
  134. // this.firmsLinkUpload(data);
  135. this.getPageTableDate(data);
  136. },
  137. changePage: function (page) {
  138. this.currentPage = page;
  139. let req = {
  140. queryParams: this.inputValue,
  141. localArea: this.areaValue,
  142. startTime: this.startTime,
  143. endTime: this.endTime,
  144. Page: this.currentPage,
  145. Rows: this.pageSize,
  146. };
  147. // this.firmsLinkUpload(req);
  148. this.getPageTableDate(req);
  149. },
  150. // 点击上一页,下一页,首页,尾页
  151. jumpPage: function (item) {
  152. switch (item) {
  153. case 1:
  154. this.currentPage = 1;
  155. break;
  156. case 2:
  157. this.currentPage = this.currentPage - 1;
  158. break;
  159. case 3:
  160. this.currentPage = this.currentPage + 1;
  161. break;
  162. case 4:
  163. this.currentPage = this.totalPage;
  164. break;
  165. }
  166. let req = {
  167. queryParams: this.inputValue,
  168. localArea: this.areaValue,
  169. startTime: this.startTime,
  170. endTime: this.endTime,
  171. Page: this.currentPage,
  172. Rows: this.pageSize,
  173. };
  174. // this.firmsLinkUpload(req);
  175. this.getPageTableDate(req);
  176. },
  177. ulrJump: function (url) {
  178. window.open(url);
  179. },
  180. exportData: function () {
  181. this.exportTem();
  182. },
  183. // 获取表格数据
  184. firmsLinkUpload: function (data = {}) {
  185. this.$http({
  186. method: "post",
  187. url: "/firmsLinkUpload",
  188. data: data,
  189. })
  190. .then((res) => {
  191. this.tableData = res.data.data;
  192. this.sum = res.data.count;
  193. })
  194. .catch((err) => {
  195. console.log(err);
  196. });
  197. },
  198. //php获取表格数据
  199. // 获取表格数据
  200. getPageTableDate: function (data = {}) {
  201. axiosTest({
  202. method: "post",
  203. url: this.otherUrl + "/lexus_php/api/report_list.php",
  204. data: data,
  205. })
  206. .then((res) => {
  207. this.tableData = res.data.data;
  208. this.sum = +res.data.count;
  209. })
  210. .catch((err) => {
  211. console.log(err);
  212. });
  213. },
  214. // 获取 所有区域 接口
  215. getAreaList: function () {
  216. this.$http({
  217. method: "post",
  218. url: "/sys/agent/selectAgentAreaInfoList",
  219. })
  220. .then((res) => {
  221. if (res.data && res.data.code === 200) {
  222. this.areaList = res.data.data;
  223. }
  224. })
  225. .catch((err) => {
  226. console.log(err);
  227. });
  228. },
  229. // 导出 接口
  230. exportTem: function () {
  231. let url =
  232. this.otherUrl +
  233. "/lexus_php/web/report_export.php?queryParams=" +
  234. this.inputValue +
  235. "&localArea=" +
  236. this.areaValue +
  237. "&startTime=" +
  238. this.startTime +
  239. "&endTime=" +
  240. this.endTime;
  241. window.open(url);
  242. },
  243. },
  244. created() {
  245. let req = {
  246. Page: this.currentPage,
  247. Rows: this.pageSize,
  248. };
  249. //this.firmsLinkUpload(req);
  250. this.getPageTableDate(req);
  251. this.getAreaList();
  252. },
  253. };
  254. </script>
  255. <style scoped lang="less">
  256. .upload_links {
  257. .header {
  258. padding: 10px;
  259. border: 1px solid #ccc;
  260. .search {
  261. display: flex;
  262. align-items: center;
  263. .input {
  264. background-color: #fff;
  265. border: 1px solid #ccc;
  266. padding: 2px;
  267. display: flex;
  268. img {
  269. width: 22px;
  270. height: 22px;
  271. border: 1px solid #ccc;
  272. }
  273. input {
  274. background-color: #fff;
  275. border: 1px solid #ccc;
  276. margin-left: 3px;
  277. color: #555;
  278. font-size: 12px;
  279. height: 18px;
  280. margin-top: 2px;
  281. }
  282. }
  283. }
  284. .area {
  285. margin-left: 20px;
  286. display: flex;
  287. height: 28px;
  288. line-height: 28px;
  289. select {
  290. margin-left: 10px;
  291. height: 28px;
  292. width: 120px;
  293. font-size: 12px;
  294. color: #555;
  295. border: 1px solid #ccc;
  296. option {
  297. font-size: 12px;
  298. border: 1px solid #ccc;
  299. }
  300. }
  301. }
  302. .time {
  303. display: flex;
  304. margin-left: 20px;
  305. p {
  306. height: 28px;
  307. line-height: 28px;
  308. margin-right: 10px;
  309. }
  310. input {
  311. height: 26px;
  312. padding: 0;
  313. outline: none;
  314. border: 1px solid #ccc;
  315. margin-right: 10px;
  316. }
  317. span {
  318. height: 28px;
  319. line-height: 28px;
  320. margin-right: 10px;
  321. }
  322. .date_pick{
  323. margin-top: 5px;
  324. }
  325. }
  326. }
  327. .count {
  328. display: flex;
  329. justify-content: space-between;
  330. margin-top: 5px;
  331. p {
  332. margin-top: 10px;
  333. font-weight: 600;
  334. }
  335. }
  336. .tableBox {
  337. width: 1030px;
  338. overflow: auto;
  339. text-align: center;
  340. }
  341. }
  342. .inputFocus {
  343. outline: none;
  344. border: 1px solid #ccc;
  345. }
  346. .inputFocus:focus {
  347. animation: shadowAni 200ms linear forwards;
  348. }
  349. @keyframes shadowAni {
  350. 0% {
  351. border-color: #cccccc;
  352. box-shadow: inset 0px 0px 0 #ccc;
  353. }
  354. 100% {
  355. border-color: #75b9f0;
  356. box-shadow: 0px 0px 5px #75b9f0;
  357. }
  358. }
  359. </style>