BrandComponent.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <div class="component-list container">
  3. <div :class="activeTab == 0 ? 'type-list active' : 'type-list'" @click="activeTab = 0">型号列表</div>
  4. <div :class="activeTab == 1 ? 'type-list active' : 'type-list'" @click="activeTab = 1">代理商</div>
  5. <div class="input-group" v-if="activeTab == 0">
  6. <input type="search" class="input-sm form-control" placeholder="请输入型号" title="code"
  7. v-model="searchCode" @search="goodsSearch(searchCode)"/>
  8. <span class="input-group-btn">
  9. <button class="search btn btn-default" type="button" @click="goodsSearch(searchCode)">搜索器件</button>
  10. </span>
  11. </div>
  12. <table class="table" v-if="activeTab == 0">
  13. <thead>
  14. <tr class="bgf7">
  15. <th width="300">类目(产品名称)</th>
  16. <th width="300">型号</th>
  17. <th width="300">规格</th>
  18. <th width="200">数据手册</th>
  19. <th width="200">操作</th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. <tr class="text-center" v-for="item in list.content">
  24. <td><nuxt-link :to="'/product/kind/' + item.kindid"><span>{{item.kind.nameCn || '-'}}</span></nuxt-link></td>
  25. <td><nuxt-link :to="'/product/component/' + item.uuid"><span>{{item.code}}</span></nuxt-link></td>
  26. <td><span>{{item.spec || '-'}}</span></td>
  27. <td><a @click="toAttach(item.attach)"><button class="btn btn-default" :disabled="!item.attach" :class="{'disabledbtn':!item.attach}">Datasheet手册</button></a></td>
  28. <td>
  29. <button class="btn btn-default disabledbtn" :disabled="true">申请样片</button>
  30. </td>
  31. </tr>
  32. <tr v-if="!list.content || list.content.length === 0">
  33. <td colspan="10" class="text-center">
  34. <div class="empty">
  35. <div class="empty-img">
  36. <img src="/images/brandList/empty-cart.png">
  37. </div>
  38. <div class="empty-info">
  39. <p class="grey f16"> 暂无器件信息 </p>
  40. <i class="fa fa-mail-reply fa-xs"></i>&nbsp;<a href="javascript:history.go(-1)">返回上一页</a>
  41. </div>
  42. </div>
  43. </td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. <div style="float: right;" v-if="activeTab == 0">
  48. <page :total="list.totalElements" :page-size="pageParams.count"
  49. :current="pageParams.page" @childEvent="handleCurrentChange"></page>
  50. </div>
  51. <table class="table supper-table" v-if="activeTab == 1">
  52. <thead>
  53. <tr class="bgf7">
  54. <th width="100"></th>
  55. <th width="200">代理商</th>
  56. <th width="200">地址</th>
  57. <th width="110">电话</th>
  58. <th width="110">传真</th>
  59. <th width="110">邮箱</th>
  60. <th width="120">网址</th>
  61. </tr>
  62. </thead>
  63. <tbody>
  64. <tr class="text-center" v-for="item in supplier.content">
  65. <td v-if="item.storeuuid">
  66. <a class='add-link' :href="'/store/' + item.storeuuid">
  67. <img :src="item.img || '/images/store/common/default.png'" alt="" class="showImg">
  68. <img src="/images/store/common/goIn.png" alt="" class="goIn">
  69. </a>
  70. </td>
  71. <td v-if="!item.storeuuid"><img :src="item.img || '/images/store/common/default.png'" alt="" class="showImg"></td>
  72. <td :title='item.vendorName' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.vendorName || '-'}}</a></td>
  73. <td :title='item.vendorName' v-if="!item.storeuuid">{{item.vendorName || '-'}}</td>
  74. <td :title='item.detailAddress' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.detailAddress || '-'}}</a></td>
  75. <td :title='item.detailAddress' v-if="!item.storeuuid">{{item.detailAddress || '-'}}</td>
  76. <td :title='item.tel' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.tel || '-'}}</a></td>
  77. <td :title='item.tel' v-if="!item.storeuuid">{{item.tel || '-'}}</td>
  78. <td :title='item.fax' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.fax || '-'}}</a></td>
  79. <td :title='item.fax' v-if="!item.storeuuid">{{item.fax || '-'}}</td>
  80. <td :title='item.email' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.email || '-'}}</a></td>
  81. <td :title='item.email' v-if="!item.storeuuid">{{item.email || '-'}}</td>
  82. <td :title='item.website' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.website || '-'}}</a></td>
  83. <td :title='item.website' v-if="!item.storeuuid">{{item.website || '-'}}</td>
  84. </tr>
  85. <tr v-if="!supplier.content || supplier.content.length === 0">
  86. <td colspan="10" class="text-center">
  87. <div class="empty">
  88. <div class="empty-img">
  89. <img src="/images/brandList/empty-cart.png">
  90. </div>
  91. <div class="empty-info">
  92. <p class="grey f16"> 暂无供应商信息 </p>
  93. <i class="fa fa-mail-reply fa-xs"></i>&nbsp;<a href="javascript:history.go(-1)">返回上一页</a>
  94. </div>
  95. </div>
  96. </td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. <div style="float: right;" v-if="activeTab == 1">
  101. <page :total="supplier.totalElements" :page-size="supplierPageParams.size"
  102. :current="supplierPageParams.page" @childEvent="handleChange"></page>
  103. </div>
  104. </div>
  105. </template>
  106. <script>
  107. import Page from '~components/common/page/pageComponent.vue'
  108. export default {
  109. name: 'BrandComponent',
  110. data () {
  111. return {
  112. pageParams: {
  113. page: 1,
  114. count: 10,
  115. filter: {}
  116. },
  117. supplierPageParams: {
  118. page: 1,
  119. size: 5,
  120. sort: {'updatetime': 'DESC'}
  121. },
  122. searchCode: '',
  123. activeTab: 0
  124. }
  125. },
  126. components: {
  127. Page
  128. },
  129. computed: {
  130. lists () {
  131. return this.$store.state.brandComponent.component
  132. },
  133. list () {
  134. return this.lists.data
  135. },
  136. brand () {
  137. return this.$store.state.brandDetail.detail.data
  138. },
  139. supplier () {
  140. return this.$store.state.product.supplierInformation.information.data
  141. }
  142. },
  143. methods: {
  144. goodsSearch (keyword) {
  145. this.pageParams.page = 1
  146. this.pageParams.filter.code = keyword
  147. this.pageCmpGoods(this.pageParams)
  148. },
  149. handlerCurrentNode () {
  150. this.searchCode = ''
  151. this.pageParams.page = 1
  152. this.pageCmpGoods(this.pageParams)
  153. },
  154. async pageCmpGoods (params) {
  155. // pageCmpGoods (params) {
  156. params.filter.brandid = this.brand.id
  157. let { data } = await this.$http.get('/api/product/component/list', { params })
  158. this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', data)
  159. // this.$http.get('/api/product/component/list', { params }).then(response => {
  160. // this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', response)
  161. // })
  162. },
  163. handleCurrentChange (page) {
  164. this.pageParams.page = page
  165. this.pageParams.filter.brandid = this.brand.id
  166. this.pageCmpGoods(this.pageParams)
  167. },
  168. // 获取供应商分页
  169. async pageSupplier (params) {
  170. let uuid = this.$route.params.code
  171. let { data } = await this.$http.get(`/api/produce/vendorlist/${uuid}`, { params })
  172. this.$store.commit('product/supplierInformation/GET_INFORMATION_SUCCESS', data)
  173. },
  174. handleChange (page) {
  175. this.supplierPageParams.page = page
  176. this.pageSupplier(this.supplierPageParams)
  177. },
  178. listenChild: function (brand) {
  179. this.$store.dispatch('loadBrandPages', {count: 10, filter: { brandid: brand.id }, page: brand.page})
  180. },
  181. toAttach: function (url) {
  182. if (url === '1') {
  183. this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
  184. if (response.data) {
  185. window.location.href = response.data.content + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
  186. }
  187. })
  188. } else {
  189. window.open(url)
  190. }
  191. }
  192. }
  193. }
  194. </script>
  195. <style scoped>
  196. .component-list {
  197. float: left;
  198. margin-left: 20px;
  199. width: 970px;
  200. }
  201. .bgf7 th{
  202. color: #333;
  203. vertical-align: middle;
  204. }
  205. .component-list .type-list{
  206. height: 34px;
  207. width: 150px;
  208. border: 1px solid #5078cb;
  209. /*background-color: #5078CB;*/
  210. float: left;
  211. color: #5078cb;
  212. line-height: 34px;
  213. text-align: center;
  214. font-size: 14px;
  215. cursor: pointer ;
  216. }
  217. .component-list .type-list.active{
  218. background-color: #5078CB;
  219. color: #fff;
  220. }
  221. .component-list .input-group {
  222. width: 300px;
  223. float: right;
  224. border-radius: 3px;
  225. }
  226. .input-group .form-control{
  227. border-radius: 3px;
  228. }
  229. .component-list .input-group-btn .search{
  230. background: #5078cb;
  231. color: #fff;
  232. height: 34px;
  233. border-radius: 3px;
  234. }
  235. .component-list table {
  236. margin-top: 10px;
  237. width: 970px;
  238. border: 1px solid #e8e8e8;
  239. }
  240. .component-list table>thead {
  241. height: 40px;
  242. }
  243. .component-list table>thead>th {
  244. text-align: center;
  245. }
  246. .component-list table tbody tr{
  247. text-align: center;
  248. }
  249. .component-list .table>tbody>tr>td{
  250. vertical-align: middle;
  251. border-top: #e8e8e8 1px solid;
  252. }
  253. .component-list table tbody tr td a{
  254. color: #337ab7;
  255. font-size: 12px;
  256. }
  257. .component-list table tbody tr td a.add-link {
  258. width: 100%;
  259. color: #474443;
  260. font-size: 14px;
  261. cursor: pointer;
  262. }
  263. .component-list .btn-default {
  264. color: #214797;
  265. font-size: 12px;
  266. line-height: 12px;
  267. height: 30px;
  268. }
  269. .component-list .disabledbtn {
  270. color: #A0A0A0;
  271. }
  272. .component-list td.text-center{
  273. padding: 30px 0;
  274. font-size: 20px;
  275. line-height: 40px;
  276. }
  277. .bgf7{
  278. height: 40px;
  279. }
  280. .bgf7 th{
  281. background: #f7f7f7;
  282. border-bottom: none !important;
  283. font-size: 14px;
  284. text-align: center;
  285. }
  286. .component-list .empty{
  287. overflow: hidden;
  288. text-align: center;
  289. margin: 0 auto;
  290. }
  291. .component-list .empty-img{
  292. float: left;
  293. margin-left: 335px;
  294. }
  295. .component-list .empty-info{
  296. float: left;
  297. line-height: 10px;
  298. width: 143px;
  299. margin-top: 30px;
  300. }
  301. .empty-info .grey{
  302. color: #999;
  303. font-size: 14px;
  304. }
  305. .component-list .empty-info a{
  306. font-size: 14px;
  307. color: #5078cb;
  308. }
  309. .component-list .empty-info i{
  310. font-size: 14px;
  311. color: #5078cb;
  312. }
  313. .component-list .supper-table thead th.text-left{
  314. text-align: left;
  315. }
  316. .component-list .supper-table tbody tr{
  317. height: 74px;
  318. vertical-align:middle ;
  319. }
  320. .component-list .supper-table tbody tr:hover{
  321. background: #eee;
  322. }
  323. .component-list .supper-table tbody tr td{
  324. position: relative;
  325. overflow: hidden;
  326. text-overflow: ellipsis;
  327. white-space: nowrap;
  328. max-width: 100px;
  329. }
  330. .component-list .supper-table tbody tr img.showImg{
  331. width: 90px;
  332. height: 49px;
  333. border: 1px solid #dcdcdc;
  334. }
  335. .component-list .supper-table tbody tr img.goIn {
  336. position: absolute;
  337. top: 13px;
  338. right: 3px;
  339. width: 35px;
  340. height: 35px;
  341. }
  342. </style>