list.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <div class="productInfoList-wrap">
  3. <!-- 列表 -->
  4. <s-table
  5. class="sTable"
  6. ref="table"
  7. size="small"
  8. :rowKey="(record) => record.id"
  9. :columns="columns"
  10. :data="loadData"
  11. :customRow="handleClickRow"
  12. :scroll="{ y: 149 }"
  13. :defaultLoadData="false"
  14. bordered>
  15. <template slot="footer">
  16. <a-row>
  17. <a-col span="2">合计:</a-col>
  18. <a-col span="22">
  19. <a-row>
  20. <a-col span="4">初期结存数量:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
  21. <a-col span="4">初期结存单价:{{ (totalData && (totalData.jpBsxLqqAmount || totalData.jpBsxLqqAmount==0)) ? toThousands(totalData.jpBsxLqqAmount) : '--' }}</a-col>
  22. <a-col span="4">初期结存金额:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
  23. <a-col span="4">本期收入数量:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
  24. <a-col span="4">本期收入单价:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
  25. <a-col span="4">本期收入金额:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
  26. <a-col span="4">本期发出数量:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
  27. <a-col span="4">本期发出单价:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
  28. <a-col span="4">本期发出金额:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
  29. <a-col span="4">本期结存数量:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
  30. <a-col span="4">本期结存单价:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
  31. <a-col span="4">本期结存金额:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
  32. </a-row>
  33. </a-col>
  34. </a-row>
  35. </template>
  36. </s-table>
  37. </div>
  38. </template>
  39. <script>
  40. import { commonMixin } from '@/utils/mixin'
  41. import { queryStockProductPage } from '@/api/stock'
  42. import ProductType from '@/views/common/productType.js'
  43. import ProductBrand from '@/views/common/productBrand.js'
  44. import { STable, VSelect } from '@/components'
  45. export default {
  46. name: 'QueryPart',
  47. mixins: [commonMixin],
  48. components: { STable, VSelect, ProductBrand, ProductType },
  49. props: {
  50. newLoading: Boolean
  51. },
  52. data () {
  53. return {
  54. advanced: false, // 高级搜索 展开/关闭
  55. showSetting: false, // 设置弹框
  56. productType: [],
  57. buyerSn: '',
  58. queryParam: { // 查询条件
  59. productCode: '', // 产品编码
  60. productName: '', // 产品名称
  61. productOrigCode: '', // 原厂编码
  62. productBrandSn: undefined, // 产品品牌
  63. productTypeSn1: '', // 产品一级分类
  64. productTypeSn2: '', // 产品二级分类
  65. productTypeSn3: '' // 产品三级分类
  66. },
  67. columns: [
  68. { title: '二级分类', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  69. { title: '三级分类', dataIndex: 'productName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  70. { title: '品牌', dataIndex: 'productBrandName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  71. { title: '期初结存数量', dataIndex: 'currentStockQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  72. { title: '期初结存单价', dataIndex: 'productPrice', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  73. { title: '期初结存金额', dataIndex: 'productPrice', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  74. { title: '本期收入数量', dataIndex: 'productUnit', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  75. { title: '本期收入单价', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  76. { title: '本期收入金额', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  77. { title: '本期发出数量', dataIndex: 'packQtyV', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  78. { title: '本期发出单价', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  79. { title: '本期发出金额', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  80. { title: '期末结存数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: '12%', align: 'center' },
  81. { title: '期末结存单价', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  82. { title: '期末结存金额', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') }
  83. ],
  84. disabled: false, // 查询、重置按钮是否可操作
  85. // 加载数据方法 必须为 Promise 对象
  86. loadData: parameter => {
  87. this.disabled = true
  88. this.queryParam.dealerSn = this.buyerSn
  89. return queryStockProductPage(Object.assign(parameter, this.queryParam, { onlineFalg: '1', pricingState: 'PRICED' })).then(res => {
  90. let data
  91. if (res.status == 200) {
  92. data = res.data
  93. data.list = data.list.filter(item => item != null)
  94. const no = (data.pageNo - 1) * data.pageSize
  95. for (var i = 0; i < data.list.length; i++) {
  96. data.list[i].no = no + i + 1
  97. data.list[i].salesNums = 1
  98. data.list[i].currentStockQty = data.list[i].currentStockQty || 0
  99. const productPackQty = (data.list[i].productPackQty || data.list[i].productPackQty == 0) ? data.list[i].productPackQty : '--'
  100. const productUnit = data.list[i].productUnit || '--'
  101. const productPackQtyUnit = data.list[i].productPackQtyUnit || '--'
  102. data.list[i].packQtyV = productPackQty + productUnit + '/' + productPackQtyUnit
  103. }
  104. this.disabled = false
  105. }
  106. return data
  107. })
  108. }
  109. }
  110. },
  111. methods: {
  112. // 双击列表
  113. handleClickRow (record) {
  114. const _this = this
  115. return {
  116. on: {
  117. dblclick: (event) => {
  118. if (!record.productPrice || record.productPrice <= 0) {
  119. _this.$message.info('该产品暂时不能添加')
  120. } else {
  121. event.stopPropagation()
  122. _this.$emit('add', record, 0)
  123. }
  124. }
  125. }
  126. }
  127. },
  128. // 重置
  129. resetSearchForm () {
  130. this.queryParam.productCode = ''
  131. this.queryParam.productName = ''
  132. this.queryParam.productOrigCode = ''
  133. this.queryParam.productBrandSn = undefined
  134. this.queryParam.productTypeSn1 = ''
  135. this.queryParam.productTypeSn2 = ''
  136. this.queryParam.productTypeSn3 = ''
  137. this.productType = []
  138. this.$refs.table.refresh(true)
  139. },
  140. pageInit (buyerSn) {
  141. this.buyerSn = buyerSn
  142. this.resetSearchForm()
  143. },
  144. // 刷新当前页面
  145. resetCurForm () {
  146. this.$refs.table.refresh()
  147. },
  148. // 选择配件
  149. handleAdd (row) {
  150. this.$emit('add', row, 0)
  151. },
  152. // 产品分类 change
  153. changeProductType (val, opt) {
  154. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  155. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  156. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="less" scoped>
  162. .productInfoList-wrap{
  163. .ellipsisCon{
  164. display: flex;
  165. justify-content: space-between;
  166. align-items: center;
  167. .ellipsisText{
  168. width: 100%;
  169. overflow: hidden;
  170. text-overflow: ellipsis;
  171. display: box;
  172. display: -webkit-box;
  173. -webkit-line-clamp: 1;
  174. -webkit-box-orient: vertical;
  175. }
  176. }
  177. }
  178. </style>