BrandComponent.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div class="component-list container">
  3. <div class="type-list">型号列表</div>
  4. <div class="input-group">
  5. <input type="search" class="input-sm form-control" placeholder="请输入型号" title="code"
  6. v-model="searchCode" @search="goodsSearch(searchCode)"/>
  7. <span class="input-group-btn">
  8. <button class="search btn btn-default" type="button" @click="goodsSearch(searchCode)">搜索器件</button>
  9. </span>
  10. </div>
  11. <table class="table">
  12. <thead>
  13. <tr class="bgf7">
  14. <th width="500">型号</th>
  15. <th width="300">数据手册</th>
  16. <th width="200">操作</th>
  17. </tr>
  18. </thead>
  19. <tbody>
  20. <tr class="text-center" v-for="item in list.content">
  21. <td><a :href="'/product/component/' + item.uuid"><span>{{item.code}}</span></a></td>
  22. <td><a :href="item.attach" target="_blank"><button class="btn btn-default" :disabled="!item.attach" :class="{'disabledbtn':!item.attach}">Datasheet手册</button></a></td>
  23. <td>
  24. <button class="btn btn-default disabledbtn" :disabled="true">申请样片</button>
  25. </td>
  26. </tr>
  27. <tr v-if="!list.content || list.content.length === 0">
  28. <td colspan="10" class="text-center">
  29. <div class="empty">
  30. <div class="empty-img">
  31. <img src="/images/brandList/empty-cart.png">
  32. </div>
  33. <div class="empty-info">
  34. <p class="grey f16"> 暂无器件信息 </p>
  35. <i class="fa fa-mail-reply fa-xs"></i>&nbsp;<a href="javascript:history.go(-1)">返回上一页</a>
  36. </div>
  37. </div>
  38. </td>
  39. </tr>
  40. </tbody>
  41. </table>
  42. <div style="float: right;">
  43. <page :total="list.totalElements" :page-size="pageParams.count"
  44. :current="pageParams.page" @childEvent="handleCurrentChange"></page>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import Page from '~components/common/page/pageComponent.vue'
  50. export default {
  51. name: 'BrandComponent',
  52. data () {
  53. return {
  54. pageParams: {
  55. page: 1,
  56. count: 10,
  57. filter: {}
  58. },
  59. searchCode: ''
  60. }
  61. },
  62. components: {
  63. Page
  64. },
  65. computed: {
  66. lists () {
  67. return this.$store.state.brandComponent.component
  68. },
  69. list () {
  70. return this.lists.data
  71. },
  72. brand () {
  73. return this.$store.state.brandDetail.detail.data
  74. }
  75. },
  76. methods: {
  77. goodsSearch (keyword) {
  78. this.pageParams.page = 1
  79. this.pageParams.filter.code = keyword
  80. this.pageCmpGoods(this.pageParams)
  81. },
  82. handlerCurrentNode () {
  83. this.searchCode = ''
  84. this.pageParams.page = 1
  85. this.pageCmpGoods(this.pageParams)
  86. },
  87. async pageCmpGoods (params) {
  88. // pageCmpGoods (params) {
  89. params.filter.brandid = this.brand.id
  90. let { data } = await this.$http.get('/api/product/component/list', { params })
  91. this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', data)
  92. // this.$http.get('/api/product/component/list', { params }).then(response => {
  93. // this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', response)
  94. // })
  95. },
  96. handleCurrentChange (page) {
  97. this.pageParams.page = page
  98. this.pageParams.filter.brandid = this.brand.id
  99. this.pageCmpGoods(this.pageParams)
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped>
  105. .component-list {
  106. float: left;
  107. margin-left: 20px;
  108. width: 970px;
  109. }
  110. .bgf7 th{
  111. color: #333;
  112. vertical-align: middle;
  113. }
  114. .component-list .type-list{
  115. height: 34px;
  116. width: 150px;
  117. border: 1px solid #5078cb;
  118. background-color: #5078CB;
  119. float: left;
  120. color: #fff;
  121. line-height: 34px;
  122. text-align: center;
  123. font-size: 14px;
  124. }
  125. .component-list .input-group {
  126. width: 300px;
  127. float: right;
  128. border-radius: 3px;
  129. }
  130. .input-group .form-control{
  131. border-radius: 3px;
  132. }
  133. .component-list .input-group-btn .search{
  134. background: #5078cb;
  135. color: #fff;
  136. height: 34px;
  137. border-radius: 3px;
  138. }
  139. .component-list table {
  140. margin-top: 10px;
  141. width: 970px;
  142. border: 1px solid #e8e8e8;
  143. }
  144. .component-list table>thead {
  145. height: 40px;
  146. }
  147. .component-list table>thead>th {
  148. text-align: center;
  149. }
  150. .component-list table tbody tr{
  151. text-align: center;
  152. }
  153. .component-list .table>tbody>tr>td{
  154. vertical-align: middle;
  155. border-top: #e8e8e8 1px solid;
  156. }
  157. .component-list table tbody tr td a{
  158. color: #337ab7;
  159. font-size: 12px;
  160. }
  161. .component-list .btn-default {
  162. color: #214797;
  163. font-size: 12px;
  164. line-height: 12px;
  165. height: 30px;
  166. }
  167. .component-list .disabledbtn {
  168. color: #A0A0A0;
  169. }
  170. .component-list td.text-center{
  171. padding: 30px 0;
  172. font-size: 20px;
  173. line-height: 40px;
  174. }
  175. .bgf7{
  176. height: 40px;
  177. }
  178. .bgf7 th{
  179. background: #f7f7f7;
  180. border-bottom: none !important;
  181. font-size: 14px;
  182. text-align: center;
  183. }
  184. .component-list .empty{
  185. overflow: hidden;
  186. text-align: center;
  187. margin: 0 auto;
  188. }
  189. .component-list .empty-img{
  190. float: left;
  191. margin-left: 335px;
  192. }
  193. .component-list .empty-info{
  194. float: left;
  195. line-height: 10px;
  196. width: 143px;
  197. margin-top: 30px;
  198. }
  199. .empty-info .grey{
  200. color: #999;
  201. font-size: 14px;
  202. }
  203. .component-list .empty-info a{
  204. font-size: 14px;
  205. color: #5078cb;
  206. }
  207. .component-list .empty-info i{
  208. font-size: 14px;
  209. color: #5078cb;
  210. }
  211. </style>