index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <div>
  3. <div class="flex-align-center flex-between mt-10">
  4. <el-input style="width:200px" size="small" suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>
  5. <el-button type="primary" size="small" :disabled="tableSelectData.length === 0" @click="onConfirm">添加选中商品</el-button>
  6. </div>
  7. <div>
  8. <el-table
  9. ref="multipleTable"
  10. :data="tableData"
  11. style="width: 100%"
  12. :header-cell-style="{height:'50px',color:'#768093',fontWeight:'400'}"
  13. :cell-style="{height:'50px',color:'#768093',fontWeight:'400'}"
  14. size="mini"
  15. border
  16. @selection-change="selectionChange">
  17. <el-table-column
  18. type="selection"
  19. width="55">
  20. </el-table-column>
  21. <el-table-column
  22. prop="itemname"
  23. label="产品名称"
  24. width="180">
  25. </el-table-column>
  26. <el-table-column
  27. prop="itemno"
  28. label="产品编号"
  29. width="180">
  30. </el-table-column>
  31. <el-table-column
  32. label="型号">
  33. <template slot-scope="scope">
  34. <p><span>{{scope.row.model}}</span></p>
  35. </template>
  36. </el-table-column>
  37. <el-table-column
  38. prop="unit"
  39. label="计量单位"
  40. width="90">
  41. <template slot-scope="scope">
  42. <el-tag size="mini" type="info" effect="plain">{{scope.row.unit}}/{{scope.row.auxunit}}</el-tag>
  43. </template>
  44. </el-table-column>
  45. </el-table>
  46. <div style="margin-top:16px;text-align:right">
  47. <el-pagination
  48. background
  49. small
  50. @size-change="handleSizeChange"
  51. @current-change="handleCurrentChange"
  52. :current-page="currentPage"
  53. :page-size="params.content.pageSize"
  54. layout="total, prev, pager, next, jumper"
  55. :total="total">
  56. </el-pagination>
  57. </div>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import uploadFile from '@/components/upload/hw_obs_upload'
  63. import previewImage from '@/components/previewImage/index'
  64. export default {
  65. props:['data'],
  66. data () {
  67. return {
  68. params:{
  69. "id": 20230116111602,
  70. "content": {
  71. "sa_orderid": 0,
  72. "pageNumber": 1,
  73. "pageSize": 10,
  74. "where": {
  75. "condition": ""
  76. }
  77. },
  78. },
  79. tableSelectData:[],
  80. tableData: [],
  81. total:0,
  82. currentPage:0
  83. }
  84. },
  85. components:{
  86. uploadFile,
  87. previewImage
  88. },
  89. methods:{
  90. async listData () {
  91. this.params.content.sa_orderid = this.$route.query.id
  92. const res = await this.$api.requested(this.params)
  93. this.tableData = res.data
  94. this.total = res.total
  95. this.currentPage = res.pageNumber
  96. },
  97. handleSizeChange(val) {
  98. // console.log(`每页 ${val} 条`);
  99. this.params.content.pageSize = val
  100. this.listData()
  101. },
  102. handleCurrentChange(val) {
  103. // console.log(`当前页: ${val}`);
  104. this.params.content.pageNumber = val
  105. this.listData()
  106. },
  107. selectionChange (val) {
  108. this.tableSelectData = val
  109. },
  110. onConfirm () {
  111. this.$emit('onConfirm',this.tableSelectData)
  112. },
  113. clearSelection () {
  114. this.$refs.multipleTable.clearSelection();
  115. }
  116. },
  117. mounted () {
  118. this.listData()
  119. }
  120. }
  121. </script>
  122. <style>
  123. </style>
  124. <style scoped>
  125. .produtMag-panel{
  126. /* margin: 30px; */
  127. padding:0 10px 10px 10px;
  128. background: #fff;
  129. border-radius:5px;
  130. overflow: hidden;
  131. border:1px solid rgb(0 0 0 / 5%)
  132. /* box-shadow: 0 5px 5px rgb(0 0 0 / 10%);
  133. transform: translate3d(0,-2px,0); */
  134. }
  135. .image {
  136. width:40px;height:40px;margin:0px auto;
  137. }
  138. </style>