warehousing.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <div class="purchaseOrderWarehousing-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="purchaseOrderWarehousing-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. <span class="billno">单号:{{ detail&&detail.purchaseBillNo }}</span>
  8. </template>
  9. </a-page-header>
  10. <!-- 内容 -->
  11. <a-card size="small" :bordered="false" class="purchaseOrderWarehousing-cont">
  12. <!-- 搜索条件 -->
  13. <div class="table-page-search-wrapper">
  14. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  15. <a-row :gutter="15">
  16. <a-col :md="6" :sm="24">
  17. <a-form-item label="关键词">
  18. <a-input id="purchaseOrderWarehousing-bundleName" v-model.trim="queryParam.queryWord" allowClear placeholder="产品名称/产品编码/原厂编码"/>
  19. </a-form-item>
  20. </a-col>
  21. <a-col :md="6" :sm="24">
  22. <a-form-item label="产品品牌">
  23. <ProductBrand id="purchaseOrderWarehousing-productBrand" v-model="queryParam.productBrandSn"></ProductBrand>
  24. </a-form-item>
  25. </a-col>
  26. <a-col :md="6" :sm="24">
  27. <a-form-item label="产品类别">
  28. <ProductType id="purchaseOrderWarehousing-productType" @change="changeProductType" v-model="productType"></ProductType>
  29. </a-form-item>
  30. </a-col>
  31. <a-col :md="6" :sm="24">
  32. <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseOrderWarehousing-refresh">查询</a-button>
  33. <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="purchaseOrderWarehousing-reset">重置</a-button>
  34. </a-col>
  35. </a-row>
  36. </a-form>
  37. </div>
  38. <!-- 总计 -->
  39. <a-alert type="info" showIcon style="margin-bottom:15px">
  40. <div slot="message">产品款数 <strong>6</strong> ,采购数量合计 <strong>6</strong> ,采购金额合计¥<strong>6.33</strong></div>
  41. </a-alert>
  42. <!-- 列表 -->
  43. <s-table
  44. class="sTable"
  45. ref="table"
  46. size="default"
  47. :rowKey="(record) => record.id"
  48. :columns="columns"
  49. :data="loadData"
  50. :scroll="{ x: 1360 }"
  51. bordered>
  52. <!-- 仓库仓位 -->
  53. <template slot="warehousePosition" slot-scope="text, record, index">
  54. <a-cascader
  55. @change="e => changeWarehouseCascade(e, record, index)"
  56. v-model="record.warehouseCascade"
  57. expand-trigger="hover"
  58. :options="warehouseCascadeData"
  59. :fieldNames="{ label: 'name', value: 'id', children: 'warehouseLocationList' }"
  60. id="bulkWarehousingOrderEdit-warehouseCascade"
  61. placeholder="请选择仓库仓位"
  62. style="width: 100%;" />
  63. </template>
  64. </s-table>
  65. </a-card>
  66. <a-affix :offset-bottom="0">
  67. <div style="text-align: center;width: 100%;background-color: #fff;padding: 12px 0;box-shadow: 0 0 20px #dcdee2;">
  68. <a-button type="primary" id="purchaseOrderWarehousing-warehousing" size="large" @click="handleWarehousing" style="padding: 0 60px;">确认入库</a-button>
  69. </div>
  70. </a-affix>
  71. </div>
  72. </template>
  73. <script>
  74. import { STable, VSelect } from '@/components'
  75. import { purchaseDetailBySn } from '@/api/purchase'
  76. import { purchaseDetailList, updateWarehouse } from '@/api/purchaseDetail'
  77. import ProductType from '../../common/productType.js'
  78. import ProductBrand from '../../common/productBrand.js'
  79. import { warehouseCascadeList } from '@/api/warehouse'
  80. export default {
  81. components: { STable, VSelect, ProductType, ProductBrand },
  82. data () {
  83. return {
  84. detail: null, // 详情数据
  85. productType: [],
  86. queryParam: {
  87. productBrandSn: undefined,
  88. queryWord: '',
  89. brand: '',
  90. productTypeSn1: '', // 产品一级分类
  91. productTypeSn2: '', // 产品二级分类
  92. productTypeSn3: '' // 产品三级分类
  93. },
  94. disabled: false, // 查询、重置按钮是否可操作
  95. warehouseCascadeData: [], // 仓库仓位
  96. // 表头
  97. columns: [
  98. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  99. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  100. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
  101. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  102. { title: '采购单价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  103. { title: '采购数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
  104. { title: '缺货数量', dataIndex: 'oosQty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
  105. { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  106. { title: '采购金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
  107. { title: '入库数量', dataIndex: 'putQty', width: 100, align: 'center' },
  108. { title: '仓库仓位', scopedSlots: { customRender: 'warehousePosition' }, width: 300, align: 'center' }
  109. ],
  110. chooseLoadData: [],
  111. // 加载数据方法 必须为 Promise 对象
  112. loadData: parameter => {
  113. this.disabled = true
  114. return purchaseDetailList(Object.assign(parameter, { purchaseBillSn: this.$route.params.sn })).then(res => {
  115. const data = res.data
  116. const no = (data.pageNo - 1) * data.pageSize
  117. for (var i = 0; i < data.list.length; i++) {
  118. data.list[i].no = no + i + 1
  119. const warehouseSn = data.list[i].warehouseSn || undefined
  120. const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
  121. if (warehouseSn || warehouseLocationSn) {
  122. data.list[i].warehouseSnBackups = warehouseSn
  123. data.list[i].warehouseLocationSnBackups = warehouseLocationSn
  124. data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
  125. } else {
  126. data.list[i].warehouseCascade = undefined
  127. }
  128. }
  129. this.disabled = false
  130. this.chooseLoadData = data.list
  131. return data
  132. })
  133. }
  134. }
  135. },
  136. methods: {
  137. // 产品分类 change
  138. changeProductType (val, opt) {
  139. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  140. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  141. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  142. },
  143. // 重置产品库
  144. resetSearchForm () {
  145. this.queryParam = {
  146. productBrandSn: undefined,
  147. productTypeSn1: '', // 产品一级分类
  148. productTypeSn2: '', // 产品二级分类
  149. productTypeSn3: '', // 产品三级分类
  150. queryWord: '',
  151. brand: ''
  152. }
  153. this.productType = []
  154. this.$refs.table.refresh(true)
  155. },
  156. // 确认入库
  157. handleWarehousing () {
  158. },
  159. // 返回列表
  160. handleBack () {
  161. this.$router.push({ path: '/purchasingManagement/purchaseOrder/list' })
  162. },
  163. filterOption (input, option) {
  164. return (
  165. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  166. )
  167. },
  168. // 详情
  169. getDetail () {
  170. purchaseDetailBySn({ sn: this.$route.params.sn }).then(res => {
  171. if (res.status == 200) {
  172. this.detail = res.data
  173. } else {
  174. this.detail = null
  175. }
  176. })
  177. },
  178. // 仓库仓位 级联 列表
  179. getWarehouseCascade () {
  180. warehouseCascadeList({}).then(res => {
  181. if (res.status == 200) {
  182. this.warehouseCascadeData = res.data
  183. } else {
  184. this.warehouseCascadeData = []
  185. }
  186. })
  187. },
  188. // 修改仓库仓位
  189. changeWarehouseCascade (val, opt, ind) {
  190. console.log(val, opt, ind)
  191. let loadData = this.chooseLoadData[ind]
  192. if (val.length < 2) {
  193. this.$message.warning('当前仓库无仓位,请选择其他仓库')
  194. const warehouseSnBackups = loadData.warehouseSnBackups || undefined
  195. const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
  196. loadData.warehouseSn = warehouseSnBackups
  197. loadData.warehouseLocationSn = warehouseLocationSnBackups
  198. if (warehouseSnBackups || warehouseLocationSnBackups) {
  199. loadData.warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
  200. } else {
  201. loadData.warehouseCascade = undefined
  202. }
  203. } else {
  204. loadData.warehouseSn = val[0] ? val[0] : ''
  205. loadData.warehouseLocationSn = val[1] ? val[1] : ''
  206. loadData.warehouseSnBackups = val[0] ? val[0] : ''
  207. loadData.warehouseLocationSnBackups = val[1] ? val[1] : ''
  208. loadData = this.chooseLoadData[ind]
  209. this.updateWarehouse(loadData)
  210. }
  211. },
  212. // 修改库存
  213. updateWarehouse (row) {
  214. updateWarehouse({ warehouseSn: row.warehouseSn, warehouseLocationSn: row.warehouseLocationSn }).then(res => {
  215. })
  216. }
  217. },
  218. mounted () {
  219. this.getDetail()
  220. this.getWarehouseCascade()
  221. }
  222. }
  223. </script>
  224. <style lang="less">
  225. .purchaseOrderWarehousing-wrap{
  226. .btn-cont {
  227. text-align: center;
  228. margin: 35px 0 10px;
  229. }
  230. .billno{
  231. font-size: 14px;
  232. font-weight: bold;
  233. margin: 0 15px;
  234. }
  235. }
  236. </style>