BrandComponent.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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"><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. let { data } = await this.$http.get('/api/product/component/list', { params })
  90. this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', data)
  91. // this.$http.get('/api/product/component/list', { params }).then(response => {
  92. // this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', response)
  93. // })
  94. },
  95. handleCurrentChange (page) {
  96. this.pageParams.page = page
  97. this.pageParams.filter.brandid = this.brand.id
  98. this.pageCmpGoods(this.pageParams)
  99. }
  100. }
  101. }
  102. </script>
  103. <style scoped>
  104. .component-list {
  105. float: left;
  106. margin-left: 20px;
  107. width: 970px;
  108. }
  109. .bgf7 th{
  110. color: #333;
  111. vertical-align: middle;
  112. }
  113. .component-list .type-list{
  114. height: 34px;
  115. width: 150px;
  116. border: 1px solid #5078cb;
  117. background-color: #5078CB;
  118. float: left;
  119. color: #fff;
  120. line-height: 34px;
  121. text-align: center;
  122. font-size: 14px;
  123. }
  124. .component-list .input-group {
  125. width: 300px;
  126. float: right;
  127. border-radius: 3px;
  128. }
  129. .input-group .form-control{
  130. border-radius: 3px;
  131. }
  132. .component-list .input-group-btn .search{
  133. background: #5078cb;
  134. color: #fff;
  135. height: 34px;
  136. border-radius: 3px;
  137. }
  138. .component-list table {
  139. margin-top: 10px;
  140. width: 970px;
  141. border: 1px solid #e8e8e8;
  142. }
  143. .component-list table>thead {
  144. height: 40px;
  145. }
  146. .component-list table>thead>th {
  147. text-align: center;
  148. }
  149. .component-list table tbody tr{
  150. text-align: center;
  151. }
  152. .component-list .table>tbody>tr>td{
  153. vertical-align: middle;
  154. border-top: #e8e8e8 1px solid;
  155. }
  156. .component-list table tbody tr td a{
  157. color: #337ab7;
  158. font-size: 12px;
  159. }
  160. .component-list .btn-default {
  161. color: #214797;
  162. font-size: 12px;
  163. line-height: 12px;
  164. height: 30px;
  165. }
  166. .component-list .disabledbtn {
  167. color: #A0A0A0;
  168. }
  169. .component-list td.text-center{
  170. padding: 30px 0;
  171. font-size: 20px;
  172. line-height: 40px;
  173. }
  174. .bgf7{
  175. height: 40px;
  176. }
  177. .bgf7 th{
  178. background: #f7f7f7;
  179. border-bottom: none !important;
  180. font-size: 14px;
  181. text-align: center;
  182. }
  183. .component-list .empty{
  184. overflow: hidden;
  185. text-align: center;
  186. margin: 0 auto;
  187. }
  188. .component-list .empty-img{
  189. float: left;
  190. margin-left: 335px;
  191. }
  192. .component-list .empty-info{
  193. float: left;
  194. line-height: 10px;
  195. width: 143px;
  196. margin-top: 30px;
  197. }
  198. .empty-info .grey{
  199. color: #999;
  200. font-size: 14px;
  201. }
  202. .component-list .empty-info a{
  203. font-size: 14px;
  204. color: #5078cb;
  205. }
  206. .component-list .empty-info i{
  207. font-size: 14px;
  208. color: #5078cb;
  209. }
  210. </style>