UploadLink.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. <template>
  2. <div class="upload_Link">
  3. <!-- <span><b>经销商</b></span> -->
  4. <span>针对论坛及其他平台链接上传</span>
  5. <div class="contentHead">
  6. <span>上传平台</span>
  7. <select name="" id="">
  8. <option value="">汽车之家</option>
  9. <option value="">请选择</option>
  10. </select>
  11. </div>
  12. <div class="tableBox">
  13. <table class="feedbackTable">
  14. <thead class="theadStyle">
  15. <tr class="tableHeadStyle1">
  16. <td>论坛传播情况汇总</td>
  17. </tr>
  18. <tr class="tableHeadStyle2">
  19. <td v-for="(item, index) in tableHeader" :key="index">
  20. {{ item }}
  21. </td>
  22. </tr>
  23. </thead>
  24. <tbody class="bodyStyle">
  25. <tr
  26. class="bodyContent tableHeadStyle2"
  27. v-for="(obj, index) in tableData"
  28. :key="index"
  29. :class="{ table_gray: index % 2 === 0 }"
  30. >
  31. <td v-if="flag">{{ index + 1 }}</td>
  32. <td>{{ obj.informationId }}</td>
  33. <!-- 资料名称 待定-->
  34. <td>{{ obj.publishDate }}</td>
  35. <!-- 发布日期 -->
  36. <td>{{ obj.carTypeName }}</td>
  37. <!-- 车系 -->
  38. <td>{{ obj.carPlatformName }}</td>
  39. <!-- 车型 -->
  40. <td>{{ obj.publishSourceName }}</td>
  41. <!-- 发布版块 -->
  42. <td>{{ obj.projectTypeName }}</td>
  43. <!-- 项目分类 -->
  44. <td>{{ obj.contentTypeName }}</td>
  45. <!-- 内容分类 -->
  46. <td>{{ obj.contentTypeName }}</td>
  47. <!-- 内容分类 -->
  48. <td>{{ obj.mediaTitle }}</td>
  49. <!-- 稿件标题 -->
  50. <td>{{ obj.mediaUrl }}</td>
  51. <!-- 链接 -->
  52. <td class="operationStyle">
  53. <span @click="toggleModal(index)">编辑</span>
  54. <span @click="toggleModal2(index)">删除</span>
  55. <!-- 弹窗: 确定删除? -->
  56. <deleteModal
  57. @dataDel="toDel"
  58. @hide_modal="closeme2"
  59. :showModalFlag="showModal2"
  60. :chooseItemIndex="nowIndex"
  61. ></deleteModal>
  62. </td>
  63. </tr>
  64. </tbody>
  65. </table>
  66. </div>
  67. <!-- 弹窗: 编辑表格内容 -->
  68. <Modal
  69. v-show="showModal"
  70. v-on:closeme="closeme"
  71. :Linkdata="tableData"
  72. @update="editTitle"
  73. ></Modal>
  74. <div class="timeLimitStyle">
  75. <span>仅可对上传时间为{{ feedbackTimeLimit }}个月内的资料进行反馈</span>
  76. </div>
  77. <div class="pageBottom">
  78. <div class="fileOperation">
  79. <span class="operationStyle xiahuaxian">导入模板</span>
  80. <button @click="toggleModal3()">导入</button>
  81. <button @click="toggleModal4()">导出</button>
  82. </div>
  83. <TablePage
  84. :currentPage="currentPage"
  85. :totalPage="totalPage"
  86. @change_page="changePage"
  87. @jump_page="jumpPage"
  88. class="tablePageStyle"
  89. ></TablePage>
  90. </div>
  91. <!-- 弹窗: 上传链接超过剩余限制数量,请修改后重新导入 -->
  92. <div class="modal-backdrop" v-show="showModal3">
  93. <div class="modal">
  94. <div class="modal-body">
  95. <div class="bodyRow">上传链接超过剩余限制数量,请修改后重新导入</div>
  96. </div>
  97. <div class="modal-footer">
  98. <button type="button" class="btn-confirm" @click="closeme3()">
  99. 确定
  100. </button>
  101. <button type="button" class="btn-close" @click="closeme3">
  102. 取消
  103. </button>
  104. </div>
  105. </div>
  106. </div>
  107. <!-- 弹窗: 资料名称无法匹配,请修改后重新导入 -->
  108. <div class="modal-backdrop" v-show="showModal4">
  109. <div class="modal">
  110. <div class="modal-body">
  111. <div class="bodyRow">资料名称无法匹配,请修改后重新导入</div>
  112. <div class="bodyRow">成功{{ 1 }}条,失败{{ 1 }}条</div>
  113. </div>
  114. <div class="modal-footer" style="position: relative; top: 95px">
  115. <button type="button" class="btn-confirm" @click="closeme4()">
  116. 确定
  117. </button>
  118. <button type="button" class="btn-close" @click="closeme4">
  119. 取消
  120. </button>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </template>
  126. <script>
  127. import Modal from "../../components/Modal";
  128. import TablePage from "../../components/TablePage";
  129. import deleteModal from "../data/components/UploadLinkModalDelete";
  130. export default {
  131. props: {
  132. isManufacturer: {
  133. type: String,
  134. default: "distributor",
  135. },
  136. },
  137. components: {
  138. Modal,
  139. TablePage,
  140. deleteModal,
  141. },
  142. data() {
  143. return {
  144. nowIndex: 0,
  145. /* modal */
  146. feedbackTimeLimit: 6,
  147. showModal: false,
  148. showModal2: false,
  149. showModal3: false,
  150. showModal4: false,
  151. // 表格配置
  152. sum: 240, // 一共有多少条数据
  153. pageSize: 20, // 每页展示的数据
  154. discolor: false, // false是隔行变色
  155. currentPage: 1,
  156. tableHeader: [
  157. "NO.",
  158. "发布日期",
  159. "资料名称",
  160. "车系",
  161. "车型",
  162. "发布版块",
  163. "项目分类",
  164. "内容分类1",
  165. "内容分类2",
  166. "标题",
  167. "链接",
  168. "操作",
  169. ],
  170. tableData: [
  171. {
  172. /* <!-- 资料名称 待定-->
  173. <!-- 发布日期 -->
  174. <!-- 车系 -->
  175. <!-- 车型 -->
  176. <!-- 发布版块 -->
  177. <!-- 项目分类 -->
  178. <!-- 内容分类 -->
  179. <!-- 内容分类 -->
  180. <!-- 稿件标题 -->
  181. <!-- 链接 --> */
  182. informationId: "2021/03/04",
  183. publishDate: "雷克萨斯ES上市",
  184. carTypeName: "雷克萨斯ES",
  185. carPlatformName: "ES雷克萨斯",
  186. publishSourceName: "S雷克萨斯",
  187. projectTypeName: "东区1",
  188. contentTypeName: "雷克萨斯ES",
  189. mediaTitle: "ES雷克萨斯",
  190. mediaUrl: "S雷克萨斯",
  191. },
  192. {
  193. informationId: "2021/03/04",
  194. publishDate: "雷克萨斯ES上市",
  195. carTypeName: "雷克萨斯ES",
  196. carPlatformName: "ES雷克萨斯",
  197. publishSourceName: "S雷克萨斯",
  198. projectTypeName: "东区2",
  199. contentTypeName: "雷克萨斯ES",
  200. mediaTitle: "ES雷克萨斯",
  201. mediaUrl: "S雷克萨斯",
  202. },
  203. {
  204. informationId: "",
  205. publishDate: "",
  206. carTypeName: "",
  207. carPlatformName: "",
  208. publishSourceName: "",
  209. projectTypeName: "",
  210. contentTypeName: "",
  211. mediaTitle: "",
  212. mediaUrl: "",
  213. },
  214. ],
  215. flag: true,
  216. operation: [
  217. {
  218. name: "编辑",
  219. function: () => {
  220. this.EditForm();
  221. },
  222. },
  223. {
  224. name: "删除",
  225. function: () => {
  226. this.showDetail();
  227. },
  228. },
  229. ],
  230. modalData: {}, //17:44
  231. };
  232. },
  233. computed: {
  234. // 表格总页数
  235. totalPage() {
  236. return Math.ceil(this.sum / this.pageSize);
  237. },
  238. },
  239. methods: {
  240. EditForm: () => {
  241. alert("编辑");
  242. },
  243. showDetail: () => {
  244. alert("展示详情");
  245. },
  246. /*toggleModal:点击编辑后弹窗; toggleModal2:点击删除后弹窗; toggleModal3:点击导入后弹窗; */
  247. toggleModal: function (i) {
  248. this.showModal = !this.showModal;
  249. this.modalData = this.tableData[i];
  250. console.log("INtoggleModal", this.modalData);
  251. },
  252. closeme: function () {
  253. this.showModal = !this.showModal;
  254. },
  255. toggleModal2: function (i) {
  256. this.showModal2 = !this.showModal2;
  257. this.nowIndex = i;
  258. this.modalData = this.tableData[i];
  259. console.log("INtoggleModal2", this.modalData, this.nowIndex);
  260. },
  261. closeme2: function () {
  262. this.showModal2 = !this.showModal2;
  263. },
  264. toggleModal3: function () {
  265. this.showModal3 = !this.showModal3;
  266. },
  267. closeme3: function () {
  268. this.showModal3 = !this.showModal3;
  269. },
  270. toggleModal4: function () {
  271. this.showModal4 = !this.showModal4;
  272. },
  273. closeme4: function () {
  274. this.showModal4 = !this.showModal4;
  275. },
  276. /* 编辑内容,,传参 */
  277. editTitle: function (val) {
  278. console.log("editTitle文件:", val);
  279. //this.Linkdata = new Array(val);
  280. this.$http({
  281. url: "/firmsLinkUpload",
  282. method: "post",
  283. data: val.data,
  284. })
  285. .then((res) => {
  286. console.log(res);
  287. })
  288. .catch((err) => {
  289. console.log(err);
  290. });
  291. //console.log("inEditTitle:", this.Linkdata);
  292. this.getDataList();
  293. },
  294. toDel: function (n) {
  295. // console.log("inToDel:", n);
  296. //清空数据
  297. if (n == -2) {
  298. this.tableData = "";
  299. }
  300. //清空某一项数据
  301. {
  302. let obj = this.tableData[n];
  303. // console.log(obj);
  304. Object.keys(obj).forEach((key) => {
  305. obj[key] = "";
  306. });
  307. }
  308. this.showModal2 = !this.showModal2;
  309. },
  310. /* 表格翻页 */
  311. changePage: function (page) {
  312. this.currentPage = page;
  313. console.log(page);
  314. },
  315. // 点击上一页,下一页,首页,尾页
  316. jumpPage: function (item) {
  317. switch (item) {
  318. case 1:
  319. this.currentPage = 1;
  320. break;
  321. case 2:
  322. this.currentPage = this.currentPage - 1;
  323. break;
  324. case 3:
  325. this.currentPage = this.currentPage + 1;
  326. break;
  327. case 4:
  328. this.currentPage = this.totalPage;
  329. break;
  330. }
  331. console.log(this.currentPage);
  332. },
  333. //获取资料列表
  334. getDataList: function () {
  335. this.$http({
  336. //url: "/dealerFeedback",selectMediaAccountPage
  337. url: "/firmsLinkUpload",
  338. method: "post",
  339. data: {},
  340. })
  341. .then((res) => {
  342. console.log("uploadLink res:", res);
  343. if (res.data.code === 200) {
  344. this.tableData = res.data.data;
  345. console.log("uploadLink tableData:", this.tableData);
  346. }
  347. })
  348. .catch((err) => {
  349. console.log(err);
  350. });
  351. },
  352. },
  353. mounted() {
  354. this.getDataList();
  355. },
  356. };
  357. </script>
  358. <style scoped lang="less">
  359. .contentHead {
  360. height: 55px;
  361. display: flex;
  362. align-items: center;
  363. }
  364. .contentHead span {
  365. margin-right: 15px;
  366. }
  367. .tableBox {
  368. width: 1030px;
  369. overflow-y: hidden;
  370. }
  371. .tableBox {
  372. text-align: center;
  373. .table {
  374. table-layout: fixed;
  375. background-color: #fff;
  376. border-collapse: collapse;
  377. border: none;
  378. td {
  379. border: 1px solid #ccc;
  380. }
  381. span {
  382. &:hover {
  383. cursor: pointer;
  384. }
  385. }
  386. }
  387. }
  388. .table_gray {
  389. background-color: #00549f;
  390. }
  391. .tableBox table {
  392. border-collapse: collapse;
  393. border: 0px;
  394. }
  395. .tableBox table td {
  396. border: 1px solid #ccc;
  397. border-right: 0px;
  398. border-bottom: 0px;
  399. text-overflow: ellipsis;
  400. overflow: hidden;
  401. white-space: nowrap;
  402. }
  403. // 表头样式
  404. .theadStyle tr td {
  405. color: white;
  406. }
  407. .tableHeadStyle1 {
  408. background: #848484;
  409. height: 30px;
  410. color: #fff;
  411. display: flex;
  412. align-items: center;
  413. }
  414. .tableHeadStyle1 td {
  415. width: 100%;
  416. padding: 7px 5px;
  417. }
  418. .tableHeadStyle2 {
  419. background: #848484;
  420. height: 30px;
  421. color: #fff;
  422. display: flex;
  423. align-items: center;
  424. }
  425. .tableHeadStyle2 td {
  426. width: 100px;
  427. padding: 7px 5px;
  428. }
  429. .tableHeadStyle2 td:nth-child(1) {
  430. width: 60px;
  431. }
  432. .tableHeadStyle2 td:nth-child(10) {
  433. width: 100px;
  434. padding: 7px 5px;
  435. }
  436. .tableHeadStyle2 td:nth-child(11) {
  437. width: 100px;
  438. padding: 7px 5px;
  439. }
  440. .tableHeadStyle2 td:nth-child(12) {
  441. width: 100px;
  442. padding: 7px 5px;
  443. }
  444. .tableHeadStyle2 td:nth-child(2) {
  445. width: 100px;
  446. padding: 7px 5px;
  447. }
  448. .tableHeadStyle2 td:nth-child(3) {
  449. width: 100px;
  450. padding: 7px 5px;
  451. }
  452. .bodyStyle {
  453. display: block;
  454. background-color: #fff;
  455. }
  456. .bodyStyle tr > td:nth-last-child(2) {
  457. color: #0000ff;
  458. }
  459. .bodyContent td {
  460. background-color: #fff;
  461. height: 20px;
  462. }
  463. .operationStyle {
  464. color: #0000ff;
  465. display: flex;
  466. justify-content: space-around;
  467. }
  468. .xiahuaxian {
  469. text-decoration: underline;
  470. }
  471. .operationStyle span {
  472. color: #0000ff;
  473. }
  474. .fileOperation {
  475. display: flex;
  476. justify-content: flex-start;
  477. margin: 10px;
  478. align-items: center;
  479. }
  480. .fileOperation button {
  481. border-radius: 4px;
  482. }
  483. .timeLimitStyle {
  484. padding: 10px;
  485. }
  486. .modal-backdrop {
  487. position: fixed;
  488. top: 0;
  489. right: 0;
  490. bottom: 0;
  491. left: 0;
  492. background-color: rgba(0, 0, 0, 0.3);
  493. display: flex;
  494. justify-content: center;
  495. align-items: center;
  496. }
  497. .modal {
  498. background-color: #ffffff;
  499. box-shadow: 2px 2px 20px 1px;
  500. overflow-x: auto;
  501. display: flex;
  502. flex-direction: column;
  503. width: 500px;
  504. border-radius: 0px;
  505. height: 230px;
  506. }
  507. .modal-footer {
  508. border-top: 1px solid #eee;
  509. position: relative;
  510. top: 124px;
  511. left: 232px;
  512. width: 208px;
  513. display: flex;
  514. justify-content: space-between;
  515. padding: 0px;
  516. }
  517. .modal-footer button {
  518. border-radius: 4px;
  519. margin-left: 0px;
  520. width: 80px;
  521. font-size: 14px;
  522. }
  523. .modal-footer button:nth-child(1) {
  524. background-color: #0056a0;
  525. }
  526. .modal-footer button:nth-child(2) {
  527. background-color: #eeeeee;
  528. }
  529. .modal-body {
  530. position: relative;
  531. top: 64px;
  532. margin-left: 50px;
  533. padding: 0px;
  534. }
  535. .btn-close,
  536. .btn-confirm {
  537. margin-left: 16px;
  538. width: 56px;
  539. height: 36px;
  540. border: none;
  541. cursor: pointer;
  542. }
  543. .btn-close {
  544. color: #313131;
  545. background-color: gray;
  546. }
  547. .btn-confirm {
  548. color: #fff;
  549. background-color: #2d8cf0;
  550. }
  551. .bodyRow {
  552. font-size: 16px;
  553. font-family: Arial;
  554. }
  555. /* .tablePageStyle{
  556. position: relative;
  557. left: 266px;
  558. } */
  559. .pageBottom {
  560. display: flex;
  561. justify-content: space-between;
  562. align-items: center;
  563. }
  564. </style>