UploadRecordDetail.vue 11 KB

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