UploadRecordDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <template>
  2. <div class="record_detail">
  3. <div class="title">
  4. <p class="data_detail">数据详情</p>
  5. </div>
  6. <div class="content">
  7. <div class="content_datail">
  8. <div class="detail">
  9. <p style="width: 65px">资料名称:</p>
  10. <p>{{ detailData.informationName }}</p>
  11. </div>
  12. <div class="detail">
  13. <p style="width: 65px">上传时间:</p>
  14. <p>{{ (detailData.filePulishTime || '').replace(RegExp("-", "g"), '/') }}</p>
  15. </div>
  16. <div class="multiDetail">
  17. <div class="time">
  18. <p style="width: 65px">素材时间:</p>
  19. <p>{{ (((detailData.fileUploadDate || '').replace('T', ' ')).slice(0, -4)).replace(RegExp("-", "g"), '/') }}</p>
  20. </div>
  21. <div class="range">
  22. <p style="width: 75px">经销商范围:</p>
  23. <p style="margin-right: 10px">
  24. {{ detailData.accountScope === 1 ? "共通" : "部分" }}
  25. </p>
  26. <p>
  27. 可查看经销商<span @click="showTable">{{
  28. detailData.totalCount
  29. }}</span
  30. >家
  31. </p>
  32. </div>
  33. </div>
  34. <div class="detail">
  35. <div style="width: 15%">资料描述:</div>
  36. <p style="width: 85%">{{ detailData.fileDiscription }}</p>
  37. </div>
  38. <div class="files">
  39. <p style="width: 65px">附件:</p>
  40. <div class="filesName">
  41. <p
  42. v-for="(item, index) in filesList"
  43. :key="index"
  44. @click="downloadFile(index)"
  45. >
  46. {{ item.fileName }}
  47. </p>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="table" v-show="isShowTable">
  52. <div class="table_option">
  53. <select @change="seletByArea" v-model="optionValue">
  54. <option value="">全区</option>
  55. <option v-for="(item, index) in areaList" :key="index">
  56. {{ item }}
  57. </option>
  58. </select>
  59. <div class="hidTable" @click="hidTable">
  60. <img src="../../../img/crossMark.png" />
  61. </div>
  62. </div>
  63. <div class="count">
  64. <Count :sum="sum"></Count>
  65. </div>
  66. <Table
  67. :tableData="tableData"
  68. :pageSize='pageSize'
  69. :currentPage='currentPage'
  70. ></Table>
  71. <div v-if="sum">
  72. <TablePage
  73. :totalPage="totalPage"
  74. :currentPage="currentPage"
  75. @change_page="changePage"
  76. @jump_page="jumpPage"
  77. ></TablePage>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="download">
  82. <p class="download_record">下载记录</p>
  83. <div class="btn">
  84. <div class="current_button" @click="downloadExcel">导出</div>
  85. </div>
  86. <p class="tip">点击导出,查看该资料下载记录</p>
  87. </div>
  88. </div>
  89. </template>
  90. <script>
  91. import Table from "./RecordDetailTable";
  92. import Count from "../../../components/Count";
  93. import TablePage from "../../../components/TablePage";
  94. import { env_url } from "../../../config/env"
  95. export default {
  96. components: {
  97. Table,
  98. Count,
  99. TablePage,
  100. },
  101. mounted() {
  102. let req = {
  103. page: this.page,
  104. rows: this.rows,
  105. asc: this.asc
  106. };
  107. console.log(req);
  108. this.getFirmsUploadList(req);
  109. this.getAreaList();
  110. },
  111. data() {
  112. return {
  113. isShowTable: false,
  114. sum: 0, // 表格总数据
  115. currentPage: 1,
  116. pageSize: 20,
  117. tableData: [],
  118. optionValue: "",
  119. filesList: [],
  120. index: (this.$route.query && this.$route.query.id) || "",
  121. asc: (this.$route.query && this.$route.query.asc) || true,
  122. rows: (this.$route.query && this.$route.query.rows) || 20,
  123. page: (this.$route.query && this.$route.query.page) || 20,
  124. detailData: {},
  125. areaList: [],
  126. onlineUrl: env_url, //'http://8.140.188.129:8080'线上 //http://8.136.230.133:8080 //测试
  127. };
  128. },
  129. computed: {
  130. // 表格总页数
  131. totalPage() {
  132. return Math.ceil(this.sum / this.pageSize);
  133. },
  134. },
  135. methods: {
  136. showTable: function () {
  137. this.isShowTable = !this.isShowTable;
  138. let id = this.detailData["id"];
  139. let req = {
  140. informationId: id,
  141. page: this.currentPage,
  142. rows: this.pageSize,
  143. };
  144. this.getDlrData(req);
  145. },
  146. hidTable: function () {
  147. this.isShowTable = false;
  148. },
  149. seletByArea: function () {
  150. let id = this.detailData["id"];
  151. let req = {
  152. informationId: id,
  153. localArea: this.optionValue,
  154. page: this.currentPage,
  155. rows: this.pageSize,
  156. };
  157. this.getDlrData(req);
  158. },
  159. // 获取某一页面的数据,展示在表格
  160. changePage: function (page) {
  161. this.currentPage = page;
  162. let id = this.detailData["id"];
  163. let req = {
  164. informationId: id,
  165. localArea: this.optionValue,
  166. page: this.currentPage,
  167. rows: this.pageSize,
  168. };
  169. this.getDlrData(req);
  170. },
  171. // 点击上一页,下一页,首页,尾页
  172. jumpPage: function (item) {
  173. switch (item) {
  174. case 1:
  175. this.currentPage = 1;
  176. break;
  177. case 2:
  178. this.currentPage = this.currentPage - 1;
  179. break;
  180. case 3:
  181. this.currentPage = this.currentPage + 1;
  182. break;
  183. case 4:
  184. this.currentPage = this.totalPage;
  185. break;
  186. }
  187. let id = this.detailData["id"];
  188. let req = {
  189. informationId: id,
  190. localArea: this.optionValue,
  191. page: this.currentPage,
  192. rows: this.pageSize,
  193. };
  194. this.getDlrData(req);
  195. },
  196. // 下载附件
  197. downloadFile: function (i) {
  198. // let dataObj = {
  199. // fileId: this.filesList[i]["id"],
  200. // informationId: this.filesList[i]["informationId"],
  201. // //agentId: this.filesList[i]['agentId'] 如果是厂商下载不传agentId
  202. // };
  203. let reqStr = "informationId=" + this.filesList[i]["informationId"] +"&" + "fileId=" + this.filesList[i]["id"];
  204. this.dealerDownload(reqStr);
  205. },
  206. // 导出 下载记录文件
  207. downloadExcel: function () {
  208. console.log(this.detailData);
  209. let reqStr = "=" + this.detailData["id"];
  210. this.exportTem(reqStr);
  211. },
  212. // 上传记录列表接口 获取对应详情
  213. getFirmsUploadList: function (data = {}) {
  214. this.$http({
  215. method: "post",
  216. url: "/firmsUploadList",
  217. data: data,
  218. })
  219. .then((res) => {
  220. if (res.data && res.data.code === 200) {
  221. this.detailData = res.data.data[this.index];
  222. let id = this.detailData["id"];
  223. let req = { informationId: id };
  224. this.selectInformationFileList(req);
  225. } else {
  226. console.log(res);
  227. }
  228. })
  229. .catch((err) => {
  230. console.log(err);
  231. });
  232. },
  233. // 获取 所有区域 接口
  234. getAreaList: function () {
  235. this.$http({
  236. method: "post",
  237. url: "/sys/agent/selectAgentAreaInfoList",
  238. })
  239. .then((res) => {
  240. if (res.data && res.data.code === 200) {
  241. this.areaList = res.data.data;
  242. console.log(this.areaList);
  243. } else {
  244. console.log(res);
  245. }
  246. })
  247. .catch((err) => {
  248. console.log(err);
  249. });
  250. },
  251. // 导出 接口
  252. exportTem: function (reqStr) {
  253. let url = this.onlineUrl + "/export?informationId" + reqStr;
  254. window.open(url);
  255. },
  256. // 分页获取所有经销商信息接口
  257. getDlrData: function (data = {}) {
  258. this.$http({
  259. method: "post",
  260. url: "/sys/agent/selectAgentInfoPage",
  261. data,
  262. })
  263. .then((res) => {
  264. if (res.data && res.data.code === 200) {
  265. this.tableData = res.data.data;
  266. this.sum = res.data.count;
  267. } else {
  268. console.log(res);
  269. }
  270. })
  271. .catch((err) => {
  272. console.log(err);
  273. });
  274. },
  275. // 文件详情 接口
  276. selectInformationFileList(data) {
  277. this.$http({
  278. method: "post",
  279. url: "/selectInformationFileList",
  280. data: data,
  281. })
  282. .then((res) => {
  283. if (res.data && res.data.code === 200) {
  284. this.filesList = res.data.data;
  285. console.log(res.data.data, "文件");
  286. } else {
  287. console.log(res);
  288. }
  289. })
  290. .catch((err) => {
  291. console.log(err);
  292. });
  293. },
  294. // 文件下载接口
  295. dealerDownload: function (reqStr) {
  296. let url = this.onlineUrl + "/dealerDownload?" + reqStr;
  297. window.open(url);
  298. },
  299. }
  300. };
  301. </script>
  302. <style scoped lang="less">
  303. .record_detail {
  304. .title {
  305. border-top: 1px solid #ccc;
  306. border-left: 1px solid #ccc;
  307. border-right: 1px solid #ccc;
  308. .data_detail {
  309. padding-left: 10px;
  310. font-size: 14px;
  311. font-weight: bolder;
  312. height: 30.8px;
  313. line-height: 30.8px;
  314. // vertical-align: bottom;
  315. // display: table-cell;
  316. }
  317. }
  318. .content {
  319. display: flex;
  320. // justify-content: ;
  321. border: 1px solid #ccc;
  322. padding: 20px;
  323. .content_datail {
  324. width: 420px;
  325. height: 390px;
  326. padding: 20px 30px 0;
  327. .detail {
  328. width: 100%;
  329. display: flex;
  330. div{
  331. font-size: 12px;
  332. }
  333. p{
  334. min-height: 50px;
  335. }
  336. }
  337. .multiDetail {
  338. // display: flex;
  339. min-height: 50px;
  340. .time {
  341. // width: 126px;
  342. min-height: 50px;
  343. display: flex;
  344. }
  345. .range {
  346. display: flex;
  347. // width: 268px;
  348. min-height: 50px;
  349. span {
  350. color: #0056a0;
  351. margin: 0 10px;
  352. &:hover {
  353. cursor: pointer;
  354. }
  355. }
  356. }
  357. }
  358. .files {
  359. display: flex;
  360. margin-top: 20px;
  361. .filesName {
  362. p {
  363. color: #0056a0;
  364. &:hover{
  365. cursor: pointer;
  366. }
  367. }
  368. }
  369. }
  370. }
  371. .table {
  372. width: 568px;
  373. height: 390px;
  374. background-color: #fff;
  375. padding: 10px;
  376. .table_option {
  377. height: 28px;
  378. width: 100%;
  379. display: flex;
  380. justify-content: space-between;
  381. select {
  382. width: 144px;
  383. height: 28px;
  384. border: 1px solid #ccc;
  385. color: #555;
  386. }
  387. }
  388. .count {
  389. display: flex;
  390. justify-content: flex-end;
  391. }
  392. .hidTable {
  393. width: 41px;
  394. height: 26px;
  395. padding-left: 15px;
  396. img {
  397. width: 26px;
  398. height: 26px;
  399. }
  400. }
  401. }
  402. }
  403. .download {
  404. padding: 10px;
  405. .download_record {
  406. font-size: 14px;
  407. }
  408. .btn {
  409. margin: 20px 50px 10px;
  410. }
  411. .tip {
  412. margin-left: 68px;
  413. }
  414. }
  415. }
  416. </style>