addProduct.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div>
  3. <el-button size="small" type="text" @click="onShow(drawer = true)">添加产品</el-button>
  4. <el-drawer
  5. title="添加产品"
  6. :visible.sync="drawer"
  7. append-to-body
  8. direction="rtl"
  9. size="80%">
  10. <div class="drawer__panel">
  11. <el-table
  12. ref="multipleTable"
  13. :data="list"
  14. style="width: 100%"
  15. :header-cell-style="{height:'50px',color:'#606266',fontWeight:'400'}"
  16. :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}">
  17. <el-table-column
  18. align="center"
  19. label="产品图"
  20. width="80">
  21. <template slot-scope="scope">
  22. <div v-if="scope.row.attinfos[0]">
  23. <previewImage style="height:38px;width:38px" :image="scope.row.attinfos[0]" :list="scope.row.attinfos" :deletebtn="false"></previewImage>
  24. </div>
  25. </template>
  26. </el-table-column>
  27. <el-table-column
  28. prop="itemno"
  29. label="产品编号"
  30. width="180">
  31. </el-table-column>
  32. <el-table-column
  33. prop="itemname"
  34. label="产品名称"
  35. width="180">
  36. </el-table-column>
  37. <el-table-column
  38. label="型号/规格">
  39. <template slot-scope="scope">
  40. <p><span>{{scope.row.model}}</span>&nbsp;/&nbsp;<span>{{scope.row.spec}}</span></p>
  41. </template>
  42. </el-table-column>
  43. <el-table-column
  44. prop="caliber"
  45. label="口径"
  46. width="180">
  47. </el-table-column>
  48. <el-table-column
  49. prop="pressure"
  50. label="压力"
  51. width="180">
  52. </el-table-column>
  53. <el-table-column
  54. prop="material"
  55. label="材质"
  56. width="180">
  57. </el-table-column>
  58. <el-table-column
  59. prop="brand"
  60. label="品牌"
  61. width="180">
  62. <template slot-scope="scope">
  63. <p v-for="(item,index) in scope.row.brand" :key="index">
  64. <span style="float: left" v-if="index === scope.row.brand.length -1">{{item?item.brandname+'':'--'}}</span>
  65. <span style="float: left" v-else>{{item?item.brandname+',':'--'}}</span>
  66. </p>
  67. </template>
  68. </el-table-column>
  69. <el-table-column
  70. prop="itemclass"
  71. label="类别"
  72. width="180">
  73. <template slot-scope="scope">
  74. <p v-for="(item,index) in scope.row.itemclass" :key="index">
  75. <span style="float: left" v-if="index === scope.row.itemclass.length -1">{{item?item.itemclassname+'':'--'}}</span>
  76. <span style="float: left" v-else>{{item?item.itemclassname+',':'--'}}</span>
  77. </p>
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. prop="unitid"
  82. label="计量单位"
  83. width="100">
  84. <template slot-scope="scope">
  85. <el-tag size="mini" type="info" effect="plain">{{scope.row.unitname}}/{{scope.row.axunitname}}</el-tag>
  86. </template>
  87. </el-table-column>
  88. <el-table-column
  89. prop="marketprice"
  90. label="牌价"
  91. width="100">
  92. </el-table-column>
  93. <el-table-column
  94. label="操作"
  95. width="90"
  96. fixed="right">
  97. <template slot-scope="scope">
  98. <el-button type="text" size="small" @click="addProduct(scope.row)">添加</el-button>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <div class="container normal-panel" style="text-align:right">
  103. <el-pagination
  104. background
  105. @size-change="handleSizeChange"
  106. @current-change="handleCurrentChange"
  107. :current-page="currentPage"
  108. :page-sizes="[20, 50, 100, 200]"
  109. layout="total,sizes, prev, pager, next, jumper"
  110. :total="total">
  111. </el-pagination>
  112. </div>
  113. </div>
  114. </el-drawer>
  115. </div>
  116. </template>
  117. <script>
  118. import previewImage from '@/components/previewImage/index.vue'
  119. export default {
  120. props:['id','mainData'],
  121. components:{
  122. previewImage
  123. },
  124. data () {
  125. return {
  126. drawer:false,
  127. param:{
  128. "id": 20221208105403,
  129. "version":1,
  130. "content": {
  131. "sa_projectid":this.id
  132. }
  133. },
  134. list:[],
  135. currentPage:0,
  136. total:0
  137. }
  138. },
  139. methods:{
  140. async listData () {
  141. this.param.content.sa_salesforecastbillid = this.$route.query.id
  142. const res = await this.$api.requested(this.param)
  143. this.list = res.data
  144. this.total = res.total
  145. this.currentPage = res.pageNumber
  146. },
  147. handleSizeChange(val) {
  148. // console.log(`每页 ${val} 条`);
  149. this.param.content.pageSize = val
  150. this.listData()
  151. },
  152. handleCurrentChange(val) {
  153. // console.log(`当前页: ${val}`);
  154. this.param.content.pageNumber = val
  155. this.listData()
  156. },
  157. onShow () {
  158. console.log(this.mainData)
  159. this.listData()
  160. },
  161. async addProduct (row) {
  162. console.log(row,"添加商品")
  163. row.sa_salesforecastid = 0
  164. const res = await this.$api.requested({
  165. "id": 20220906155003,
  166. "version":1,
  167. "content": {
  168. "sa_salesforecastmodelid":this.mainData.sa_salesforecastmodelid,
  169. "sa_salesforecastbillid":this.$route.query.id,
  170. "sa_projectid":this.id,
  171. "itemclassinfos": [{
  172. "sa_salesforecastid":0,
  173. "itemid":row.itemid,
  174. "itemclassnum":'',
  175. "orderqty": 1,
  176. "orderamount": row.marketprice,
  177. "invoiceqty": 1,
  178. "invoiceamount": row.marketprice,
  179. "outqty": 1,
  180. "outamount": row.marketprice
  181. }]
  182. }
  183. })
  184. this.tool.showMessage(res,()=>{
  185. this.$emit('onSuccess')
  186. this.listData()
  187. })
  188. }
  189. },
  190. mounted () {
  191. }
  192. }
  193. </script>
  194. <style>
  195. </style>