firm.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <!--
  2. firm 厂商
  3. -->
  4. <template>
  5. <el-dialog title="选择型号" :visible.sync="dialog.firm" width="900px">
  6. <div>
  7. <div id="firm">
  8. <div class="title-search query-form" style="padding: 10px;margin-bottom: 10px;">
  9. <el-input
  10. placeholder="输入厂家名称、品牌名、型号进行查找"
  11. v-model="search"
  12. size="small"
  13. style="width:300px;margin-right: 10px;"
  14. clearable
  15. ></el-input>
  16. <el-button @click="searchKey" size="small">查找</el-button>
  17. <el-select v-model="value" style="margin-left:10px;" @change="handleChangeType" placeholder="请选择">
  18. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
  19. </el-select>
  20. </div>
  21. <el-radio-group v-model="radio" style="width:100%;">
  22. <el-table class="data-table" border :data="tableData" style="width: 100%" height="300px">
  23. <el-table-column header-align='center' label="生产厂家">
  24. <template slot-scope="scope">
  25. <el-radio v-model="radio" :label="scope.row">{{scope.row.venderName || "--"}}</el-radio>
  26. </template>
  27. </el-table-column>
  28. <el-table-column header-align='center' prop="brandName" label="品牌"></el-table-column>
  29. <el-table-column header-align='center' prop="name" label="型号"></el-table-column>
  30. <el-table-column header-align='center' label="技术参数">
  31. <template slot-scope="scope">
  32. <el-button type="text" @click="lookParam(scope.row)">技术参数</el-button>
  33. <el-button :disabled="scope.row.specificationId?false:true" type="text" @click="lookParam(scope.row)">技术参数</el-button>
  34. </template>
  35. </el-table-column>
  36. </el-table>
  37. </el-radio-group>
  38. <div class="right" style="background: #fff;">
  39. <p style="height:40px;line-height:40px;text-align:center;color:#9E9E9E; float: left;">
  40. 找不到想要的型号? 赶快去
  41. <i style="color:#46B0FF;cursor: pointer;">厂家库</i>维护吧
  42. </p>
  43. <my-pagination :page="page" @change="changed" style="margin-top:10px;"></my-pagination>
  44. </div>
  45. </div>
  46. </div>
  47. <param-details :isLoad="isLoad" :data="data"></param-details>
  48. <div slot="footer">
  49. <el-button
  50. type="primary"
  51. @click="getChange"
  52. >确 定</el-button>
  53. </div>
  54. </el-dialog>
  55. </template>
  56. <script>
  57. import myPagination from "@/components/common/myPagination";
  58. import paramDetails from "@/components/business_space/dialogs/list/paramDetails"
  59. import { getSpecList, getBrandList, getManufacturerList } from "@/api/scan/request"
  60. export default {
  61. components: {
  62. myPagination,
  63. paramDetails
  64. },
  65. props: {
  66. dialog: {
  67. type: Object,
  68. default: function () {
  69. return {
  70. firm: false
  71. };
  72. }
  73. },
  74. mess: {
  75. type: [Object, String]
  76. }
  77. },
  78. data() {
  79. return {
  80. search: "", //搜索文案
  81. radio: "",
  82. value: "specification",//当前选择的查看类型
  83. options: [{
  84. value: 'specification',
  85. label: '选型号'
  86. }, {
  87. value: 'brand',
  88. label: '选生产厂家-品牌'
  89. }, {
  90. value: 'manufacturer',
  91. label: '选生产厂家'
  92. }],
  93. tableData: [],
  94. data: {},
  95. isLoad: {
  96. paramShow: false
  97. },
  98. page: {
  99. size: 50,
  100. sizes: [10, 30, 50, 100, 150, 200],
  101. total: 0,
  102. currentPage: 1
  103. },
  104. };
  105. },
  106. created() { },
  107. mounted() { },
  108. methods: {
  109. changed() {
  110. this.getData()
  111. },
  112. //查询技术参数
  113. lookParam(data) {
  114. this.data = data
  115. this.isLoad.paramShow = true
  116. },
  117. getChange() {
  118. if (!!this.radio) {
  119. this.$emit("changeFirm", this.radio)
  120. this.dialog.firm = false
  121. } else {
  122. this.$message("请选择型号")
  123. }
  124. },
  125. searchKey() {
  126. this.changePage()
  127. },
  128. changePage() {
  129. this.page = {
  130. size: 50,
  131. sizes: [10, 30, 50, 100, 150, 200],
  132. total: 0,
  133. currentPage: 1
  134. }
  135. this.getData()
  136. },
  137. handleChangeType(item) {
  138. this.page.total = 0
  139. this.tableData = []
  140. this.getData()
  141. },
  142. getData() {
  143. if(this.value == 'specification') {//型号
  144. getSpecList({
  145. limit: {
  146. skip: this.page.size * (this.page.currentPage - 1),
  147. count: this.page.size
  148. },
  149. eqFamily: this.mess.deviceId,
  150. name: this.search
  151. }, res => {
  152. this.page.total = res.totalCount
  153. this.tableData = res.content
  154. })
  155. } else if(this.value == 'brand') {//生产厂家-品牌
  156. getBrandList({
  157. limit: {
  158. skip: this.page.size * (this.page.currentPage - 1),
  159. count: this.page.size
  160. },
  161. name: this.search
  162. }, res => {
  163. this.page.total = res.totalCount
  164. this.tableData = res.content
  165. })
  166. } else if(this.value == 'manufacturer') {//生产厂家
  167. getManufacturerList({
  168. limit: {
  169. skip: this.page.size * (this.page.currentPage - 1),
  170. count: this.page.size
  171. },
  172. name: this.search
  173. }, res => {
  174. this.page.total = res.totalCount
  175. this.tableData = res.content
  176. })
  177. }
  178. console.log(this.tableData)
  179. }
  180. },
  181. watch: {
  182. dialog: {
  183. deep: true,
  184. handler: function () {
  185. if (this.dialog.firm) {
  186. this.value = 'specification'
  187. this.changePage()
  188. }
  189. }
  190. }
  191. }
  192. };
  193. </script>
  194. <style lang="less">
  195. #firm {
  196. height: 455px;
  197. overflow-y: auto;
  198. .el-table thead {
  199. tr {
  200. th {
  201. background-color: #f5f7fa;
  202. }
  203. }
  204. }
  205. }
  206. </style>