BrandComponent.vue 12 KB

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