UploadRecordDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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. <p style="width: 65px">资料描述:</p>
  36. <p>{{ 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. export default {
  95. components: {
  96. Table,
  97. Count,
  98. TablePage,
  99. },
  100. mounted() {
  101. let req = {
  102. page: this.page,
  103. rows: this.rows,
  104. asc: this.asc
  105. };
  106. console.log(req);
  107. this.getFirmsUploadList(req);
  108. this.getAreaList();
  109. },
  110. data() {
  111. return {
  112. isShowTable: false,
  113. sum: 0, // 表格总数据
  114. currentPage: 1,
  115. pageSize: 20,
  116. tableData: [],
  117. optionValue: "",
  118. filesList: [],
  119. index: (this.$route.query && this.$route.query.id) || "",
  120. asc: (this.$route.query && this.$route.query.asc) || true,
  121. rows: (this.$route.query && this.$route.query.rows) || 20,
  122. page: (this.$route.query && this.$route.query.page) || 20,
  123. detailData: {},
  124. areaList: [],
  125. onlineUrl: "http://8.136.230.133:8080",
  126. };
  127. },
  128. computed: {
  129. // 表格总页数
  130. totalPage() {
  131. return Math.ceil(this.sum / this.pageSize);
  132. },
  133. },
  134. methods: {
  135. showTable: function () {
  136. this.isShowTable = !this.isShowTable;
  137. let id = this.detailData["id"];
  138. let req = {
  139. informationId: id,
  140. page: this.currentPage,
  141. rows: this.pageSize,
  142. };
  143. this.getDlrData(req);
  144. },
  145. hidTable: function () {
  146. this.isShowTable = false;
  147. },
  148. seletByArea: function () {
  149. let req = {
  150. localArea: this.optionValue,
  151. page: this.currentPage,
  152. rows: this.pageSize,
  153. };
  154. this.getDlrData(req);
  155. },
  156. // 获取某一页面的数据,展示在表格
  157. changePage: function (page) {
  158. this.currentPage = page;
  159. let id = this.detailData["id"];
  160. let req = {
  161. informationId: id,
  162. page: this.currentPage,
  163. rows: this.pageSize,
  164. };
  165. this.getDlrData(req);
  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. let id = this.detailData["id"];
  184. let req = {
  185. informationId: id,
  186. page: this.currentPage,
  187. rows: this.pageSize,
  188. };
  189. this.getDlrData(req);
  190. },
  191. // 下载附件
  192. downloadFile: function (i) {
  193. // let dataObj = {
  194. // fileId: this.filesList[i]["id"],
  195. // informationId: this.filesList[i]["informationId"],
  196. // //agentId: this.filesList[i]['agentId'] 如果是厂商下载不传agentId
  197. // };
  198. let reqStr = "informationId=" + this.filesList[i]["informationId"] +"&" + "id=" + this.filesList[i]["id"];
  199. this.dealerDownload(reqStr);
  200. },
  201. // 导出 下载记录文件
  202. downloadExcel: function () {
  203. console.log(this.detailData);
  204. let reqStr = "=" + this.detailData["id"];
  205. this.exportTem(reqStr);
  206. },
  207. // 上传记录列表接口 获取对应详情
  208. getFirmsUploadList: function (data = {}) {
  209. this.$http({
  210. method: "post",
  211. url: "/firmsUploadList",
  212. data: data,
  213. })
  214. .then((res) => {
  215. if (res.data && res.data.code === 200) {
  216. this.detailData = res.data.data[this.index];
  217. let id = this.detailData["id"];
  218. let req = { informationId: id };
  219. this.selectInformationFileList(req);
  220. } else {
  221. console.log(res);
  222. }
  223. })
  224. .catch((err) => {
  225. console.log(err);
  226. });
  227. },
  228. // 获取 所有区域 接口
  229. getAreaList: function () {
  230. this.$http({
  231. method: "post",
  232. url: "/sys/agent/selectAgentAreaInfoList",
  233. })
  234. .then((res) => {
  235. if (res.data && res.data.code === 200) {
  236. this.areaList = res.data.data;
  237. console.log(this.areaList);
  238. } else {
  239. console.log(res);
  240. }
  241. })
  242. .catch((err) => {
  243. console.log(err);
  244. });
  245. },
  246. // 导出 接口
  247. exportTem: function (reqStr) {
  248. let url = this.onlineUrl + "/export?informationId" + reqStr;
  249. window.open(url);
  250. },
  251. // 分页获取所有进销商信息接口
  252. getDlrData: function (data = {}) {
  253. this.$http({
  254. method: "post",
  255. url: "/sys/agent/selectAgentInfoPage",
  256. data,
  257. })
  258. .then((res) => {
  259. if (res.data && res.data.code === 200) {
  260. this.tableData = res.data.data;
  261. this.sum = res.data.count;
  262. } else {
  263. console.log(res);
  264. }
  265. })
  266. .catch((err) => {
  267. console.log(err);
  268. });
  269. },
  270. // 文件详情 接口
  271. selectInformationFileList(data) {
  272. this.$http({
  273. method: "post",
  274. url: "/selectInformationFileList",
  275. data: data,
  276. })
  277. .then((res) => {
  278. if (res.data && res.data.code === 200) {
  279. this.filesList = res.data.data;
  280. console.log(res.data.data, "文件");
  281. } else {
  282. console.log(res);
  283. }
  284. })
  285. .catch((err) => {
  286. console.log(err);
  287. });
  288. },
  289. // 文件下载接口
  290. dealerDownload: function (reqStr) {
  291. let url = this.onlineUrl + "/dealerDownload?" + reqStr;
  292. window.open(url);
  293. },
  294. },
  295. };
  296. </script>
  297. <style scoped lang="less">
  298. .record_detail {
  299. .title {
  300. border-top: 1px solid #ccc;
  301. .data_detail {
  302. padding-left: 10px;
  303. font-size: 14px;
  304. font-weight: bolder;
  305. height: 30.8px;
  306. vertical-align: bottom;
  307. display: table-cell;
  308. }
  309. }
  310. .content {
  311. display: flex;
  312. // justify-content: ;
  313. border: 1px solid #ccc;
  314. padding: 20px;
  315. .content_datail {
  316. width: 420px;
  317. height: 390px;
  318. padding: 20px 30px 0;
  319. .detail {
  320. width: 100%;
  321. min-height: 50px;
  322. display: flex;
  323. }
  324. .multiDetail {
  325. // display: flex;
  326. min-height: 50px;
  327. .time {
  328. // width: 126px;
  329. min-height: 50px;
  330. display: flex;
  331. }
  332. .range {
  333. display: flex;
  334. // width: 268px;
  335. min-height: 50px;
  336. span {
  337. color: #0056a0;
  338. margin: 0 10px;
  339. &:hover {
  340. cursor: pointer;
  341. }
  342. }
  343. }
  344. }
  345. .files {
  346. display: flex;
  347. .filesName {
  348. p {
  349. color: #0056a0;
  350. &:hover{
  351. cursor: pointer;
  352. }
  353. }
  354. }
  355. }
  356. }
  357. .table {
  358. width: 568px;
  359. height: 390px;
  360. background-color: #fff;
  361. padding: 10px;
  362. .table_option {
  363. height: 28px;
  364. width: 100%;
  365. display: flex;
  366. justify-content: space-between;
  367. select {
  368. width: 144px;
  369. height: 28px;
  370. border: 1px solid #ccc;
  371. color: #555;
  372. }
  373. }
  374. .count {
  375. display: flex;
  376. justify-content: flex-end;
  377. }
  378. .hidTable {
  379. width: 41px;
  380. height: 26px;
  381. padding-left: 15px;
  382. img {
  383. width: 26px;
  384. height: 26px;
  385. }
  386. }
  387. }
  388. }
  389. .download {
  390. padding: 10px;
  391. .download_record {
  392. font-size: 14px;
  393. }
  394. .btn {
  395. margin: 20px 50px 10px;
  396. }
  397. .tip {
  398. margin-left: 68px;
  399. }
  400. }
  401. }
  402. </style>