BrandComponent.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. <el-pagination
  44. :current-page.sync="pageParams.page"
  45. :page-size="pageParams.count"
  46. layout="prev, pager, next, jumper"
  47. :total="list.totalElements"
  48. @current-change="handleCurrentChange">
  49. </el-pagination>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. export default {
  55. name: 'BrandComponent',
  56. data () {
  57. return {
  58. pageParams: {
  59. page: 1,
  60. count: 10,
  61. filter: {}
  62. },
  63. searchCode: ''
  64. }
  65. },
  66. computed: {
  67. lists () {
  68. return this.$store.state.brandComponent.component
  69. },
  70. list () {
  71. return this.lists.data
  72. },
  73. brand () {
  74. return this.$store.state.brandDetail.detail.data
  75. }
  76. },
  77. methods: {
  78. goodsSearch (keyword) {
  79. this.pageParams.page = 1
  80. this.pageParams.filter.code = keyword
  81. this.pageCmpGoods(this.pageParams)
  82. },
  83. handlerCurrentNode () {
  84. this.searchCode = ''
  85. this.pageParams.page = 1
  86. this.pageCmpGoods(this.pageParams)
  87. },
  88. async pageCmpGoods (params) {
  89. let { data } = await this.$http.get('/api/product/component/list', { params })
  90. this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', data)
  91. },
  92. handleCurrentChange (page) {
  93. this.pageParams.page = page
  94. this.pageParams.filter.brandid = this.brand.id
  95. this.pageCmpGoods(this.pageParams)
  96. }
  97. }
  98. }
  99. </script>
  100. <style scoped>
  101. .component-list {
  102. float: left;
  103. margin-left: 20px;
  104. width: 970px;
  105. }
  106. .bgf7 th{
  107. color: #333;
  108. vertical-align: middle;
  109. }
  110. .component-list .type-list{
  111. height: 34px;
  112. width: 150px;
  113. border: 1px solid #5078cb;
  114. background-color: #5078CB;
  115. float: left;
  116. color: #fff;
  117. line-height: 34px;
  118. text-align: center;
  119. font-size: 14px;
  120. }
  121. .component-list .input-group {
  122. width: 300px;
  123. float: right;
  124. border-radius: 3px;
  125. }
  126. .input-group .form-control{
  127. border-radius: 3px;
  128. }
  129. .component-list .input-group-btn .search{
  130. background: #5078cb;
  131. color: #fff;
  132. height: 34px;
  133. border-radius: 3px;
  134. }
  135. .component-list table {
  136. margin-top: 10px;
  137. width: 970px;
  138. border: 1px solid #e8e8e8;
  139. }
  140. .component-list table>thead {
  141. height: 40px;
  142. }
  143. .component-list table>thead>th {
  144. text-align: center;
  145. }
  146. .component-list table tbody tr{
  147. text-align: center;
  148. }
  149. .component-list .table>tbody>tr>td{
  150. vertical-align: middle;
  151. border-top: #e8e8e8 1px solid;
  152. }
  153. .component-list table tbody tr td a{
  154. color: #337ab7;
  155. font-size: 12px;
  156. }
  157. .component-list .btn-default {
  158. color: #214797;
  159. font-size: 12px;
  160. line-height: 12px;
  161. height: 30px;
  162. }
  163. .component-list .disabledbtn {
  164. color: #A0A0A0;
  165. }
  166. .component-list td.text-center{
  167. padding: 30px 0;
  168. font-size: 20px;
  169. line-height: 40px;
  170. }
  171. .bgf7{
  172. height: 40px;
  173. }
  174. .bgf7 th{
  175. background: #f7f7f7;
  176. border-bottom: none !important;
  177. font-size: 14px;
  178. text-align: center;
  179. }
  180. .component-list .empty{
  181. overflow: hidden;
  182. text-align: center;
  183. margin: 0 auto;
  184. }
  185. .component-list .empty-img{
  186. float: left;
  187. margin-left: 335px;
  188. }
  189. .component-list .empty-info{
  190. float: left;
  191. line-height: 10px;
  192. width: 143px;
  193. margin-top: 30px;
  194. }
  195. .empty-info .grey{
  196. color: #999;
  197. font-size: 14px;
  198. }
  199. .component-list .empty-info a{
  200. font-size: 14px;
  201. color: #5078cb;
  202. }
  203. .component-list .empty-info i{
  204. font-size: 14px;
  205. color: #5078cb;
  206. }
  207. </style>