UploadRecord.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div class="upload_record">
  3. <div v-if="!isShowDetail">
  4. <div class="search">
  5. <div class="input">
  6. <img src="../../img/search.png">
  7. <input type="text" @focus="focusInput" v-model="inputValue">
  8. </div>
  9. <div class="current_button" @click="search">
  10. 搜索
  11. </div>
  12. </div>
  13. <div class="sort">
  14. <Count :sum='sum'/>
  15. <p>排序</p>
  16. <select v-model="order" @change="sort">
  17. <option value="">按时间降序</option>
  18. <option value="DESC">按时间升序</option>
  19. </select>
  20. </div>
  21. <div class="table">
  22. <Table
  23. :tableData='data'
  24. @download='download'
  25. @delet='delet'
  26. @detail='detail'
  27. >
  28. </Table>
  29. </div>
  30. <TablePage
  31. :currentPage='currentPage'
  32. :totalPage='totalPage'
  33. @change_page='changePage'
  34. @jump_page='jumpPage'
  35. ></TablePage>
  36. </div>
  37. <div v-else>
  38. <Detail></Detail>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import Count from '../../components/Count';
  44. import Table from './components/UploadRecordTable';
  45. import TablePage from '../../components/TablePage';
  46. import Detail from './components/UploadRecordDetail';
  47. export default {
  48. components: {
  49. Count,
  50. Table,
  51. TablePage,
  52. Detail
  53. },
  54. data() {
  55. return {
  56. inputValue: '请输入要搜索的资料名',
  57. order: '', // 排序方式
  58. sum: 100, // 表格总数据
  59. currentPage: 1,
  60. pageSize: 20,
  61. data: [
  62. {informationName:'雷克萨斯ES上市', filePulishTime:'2021/04',accountScope: '共通', download1: 50, downloadCount: 25, fileUploadDate: '2021/03/10 18:19'},
  63. {informationName:'雷克萨斯ES上市', filePulishTime:'2021/04',accountScope: '共通', download1: 50, downloadCount: 25, fileUploadDate: '2021/03/10 18:19'},
  64. {informationName:'雷克萨斯ES上市', filePulishTime:'2021/04',accountScope: '共通', download1: 50, downloadCount: 25, fileUploadDate: '2021/03/10 18:19'},
  65. {informationName:'雷克萨斯ES上市', filePulishTime:'2021/04',accountScope: '共通', download1: 50, downloadCount: 25, fileUploadDate: '2021/03/10 18:19'},
  66. {informationName:'雷克萨斯ES上市', filePulishTime:'2021/04',accountScope: '共通', download1: 50, downloadCount: 25, fileUploadDate: '2021/03/10 18:19'}
  67. ],
  68. }
  69. },
  70. computed:{
  71. // 表格总页数
  72. totalPage() {
  73. return Math.ceil(this.sum/this.pageSize);
  74. },
  75. isShowDetail() {
  76. return (this.$route.query && this.$route.query.id) ? true : false
  77. }
  78. },
  79. methods: {
  80. focusInput: function() {
  81. this.inputValue = '';
  82. },
  83. search: function() {
  84. console.log(this.inputValue);
  85. let data = {
  86. name: this.inputValue,
  87. asc: true
  88. }
  89. this.getFirmsUploadList(data);
  90. this.inputValue = '请输入要搜索的资料名'
  91. },
  92. sort: function(){
  93. // ASC降序
  94. let asc = this.order === 'DESC' ? false : true;
  95. let data = {
  96. name: this.inputValue,
  97. asc: asc
  98. }
  99. this.getFirmsUploadList(data);
  100. },
  101. changePage: function(page) {
  102. this.currentPage = page;
  103. console.log(page);
  104. },
  105. // 点击上一页,下一页,首页,尾页
  106. jumpPage: function(item) {
  107. switch(item) {
  108. case 1:
  109. this.currentPage = 1;
  110. break;
  111. case 2:
  112. this.currentPage = this.currentPage - 1;
  113. break;
  114. case 3:
  115. this.currentPage = this.currentPage + 1;
  116. break;
  117. case 4:
  118. this.currentPage = this.totalPage;
  119. break;
  120. }
  121. console.log(this.currentPage);
  122. },
  123. download: function(i) {
  124. this.selectInformationAgentList(i);
  125. },
  126. delet: function(i) {
  127. this.deleteInformationInfo(i);
  128. },
  129. detail: function(i) {
  130. let id = this.data[i].id || i
  131. this.$router.push({ query: { id: id } });
  132. },
  133. // 上传记录列表接口
  134. getFirmsUploadList: function(data) {
  135. this.$http(({
  136. methods: 'post',
  137. url: '/firmsUploadList',
  138. data: data
  139. })).then((res) => {
  140. console.log(res);
  141. }).catch((err) => {
  142. console.log(err);
  143. })
  144. },
  145. // 下载资料接口
  146. selectInformationAgentList: function(dataId) {
  147. this.$http({
  148. methods: 'post',
  149. url: '/selectInformationAgentList',
  150. data: {
  151. id: dataId
  152. }
  153. }).then((res) => {
  154. console.log(res);
  155. }).catch((err) => {
  156. console.log(err);
  157. })
  158. },
  159. // 删除记录接口
  160. deleteInformationInfo: function(dataId) {
  161. this.$http({
  162. method: 'post',
  163. url: '/deleteInformationInfo',
  164. data: {
  165. dataId: dataId
  166. }
  167. }).then((res) => {
  168. console.log(res);
  169. }).catch((err) => {
  170. console.log(err);
  171. })
  172. }
  173. },
  174. created() {
  175. this.getFirmsUploadList();
  176. }
  177. }
  178. </script>
  179. <style scoped lang="less">
  180. .upload_record{
  181. .search{
  182. border: 1px solid #ccc;
  183. padding: 10px;
  184. display: flex;
  185. align-items: center;
  186. .input{
  187. background-color: #fff;
  188. border: 1px solid #ccc;
  189. padding: 2px;
  190. display: flex;
  191. img{
  192. width: 28px;
  193. height: 28px;
  194. border: 1px solid #ccc;
  195. }
  196. input{
  197. background-color: #fff;
  198. border: 1px solid #ccc;
  199. margin-left: 3px;
  200. color: #555;
  201. font-size: 12px;
  202. }
  203. }
  204. }
  205. .sort{
  206. display: flex;
  207. justify-content: flex-end;
  208. margin-top: 10px;
  209. height: 30px;
  210. p{
  211. margin: 10px 5px 0 15px;
  212. text-align: center;
  213. height: 20px;
  214. }
  215. select{
  216. border: 1px solid #ccc;
  217. font-size: 12px;
  218. height: 30px;
  219. }
  220. }
  221. }
  222. input{
  223. outline: none;
  224. border: 1px solid #ccc;
  225. }
  226. input:focus{
  227. animation: shadowAni 200ms linear forwards;
  228. }
  229. @keyframes shadowAni{
  230. 0%{
  231. border-color: #cccccc;
  232. box-shadow: inset 0px 0px 0 #ccc;
  233. };
  234. 100%{
  235. border-color: #75b9F0;
  236. box-shadow: 0px 0px 5px #75b9F0;
  237. }
  238. }
  239. </style>