edit.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <template>
  2. <div class="warehouseAllocationEdit-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="warehouseAllocationEdit-back" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="warehouseAllocationEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span style="margin: 0 15px;color: #666;">调出仓库:{{ (basicInfoData&&basicInfoData.outWarehouseName) || '--' }}</span>
  9. <span style="margin: 0 15px;color: #666;">调入仓库:{{ (basicInfoData&&basicInfoData.putWarehouseName) || '--' }}</span>
  10. </template>
  11. </a-page-header>
  12. <!-- 选择产品 -->
  13. <a-card size="small" :bordered="false" class="warehouseAllocationEdit-cont">
  14. <a-collapse :activeKey="['1']">
  15. <a-collapse-panel key="1" header="选择产品">
  16. <!-- 筛选条件 -->
  17. <div class="table-page-search-wrapper">
  18. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  19. <a-row :gutter="15">
  20. <a-col :md="6" :sm="24">
  21. <a-form-item label="产品编码" prop="productCode">
  22. <a-input id="warehouseAllocationEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-item label="产品名称" prop="productName">
  27. <a-input id="warehouseAllocationEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
  28. </a-form-item>
  29. </a-col>
  30. <a-col :md="6" :sm="24">
  31. <a-form-item label="原厂编码" prop="productOrigCode">
  32. <a-input id="warehouseAllocationEdit-productOrigCode" v-model.trim="queryParam.productOrigCode" placeholder="请输入原厂编码" allowClear />
  33. </a-form-item>
  34. </a-col>
  35. <template v-if="advanced">
  36. <a-col :md="6" :sm="24">
  37. <a-form-item label="产品品牌">
  38. <a-select
  39. placeholder="请选择产品品牌"
  40. id="warehouseAllocationEdit-brandSn"
  41. allowClear
  42. v-model="queryParam.brandSn"
  43. :showSearch="true"
  44. option-filter-prop="children"
  45. :filter-option="filterOption">
  46. <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
  47. </a-select>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="6" :sm="24">
  51. <a-form-item label="产品分类">
  52. <a-cascader
  53. @change="changeProductType"
  54. change-on-select
  55. v-model="productType"
  56. expand-trigger="hover"
  57. :options="productTypeList"
  58. :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
  59. id="warehouseAllocationEdit-productType"
  60. placeholder="请选择产品分类"
  61. allowClear />
  62. </a-form-item>
  63. </a-col>
  64. <a-col :md="6" :sm="24">
  65. <a-form-item label="调出仓位" prop="warehouseLocationSn">
  66. <a-select id="warehouseAllocationEdit-warehouseLocationSn" placeholder="请选择" allowClear v-model="queryParam.warehouseLocationSn" style="width: 100%;">
  67. <a-select-option v-for="item in warehouseOutLocData" :key="item.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
  68. </a-select>
  69. </a-form-item>
  70. </a-col>
  71. </template>
  72. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  73. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="warehouseAllocationList-refresh">查询</a-button>
  74. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="warehouseAllocationList-reset">重置</a-button>
  75. <a @click="advanced=!advanced" style="margin-left: 5px">
  76. {{ advanced ? '收起' : '展开' }}
  77. <a-icon :type="advanced ? 'up' : 'down'"/>
  78. </a>
  79. </a-col>
  80. </a-row>
  81. </a-form>
  82. </div>
  83. <!-- 列表 -->
  84. <s-table
  85. class="sTable"
  86. ref="table"
  87. size="small"
  88. :rowKey="(record) => record.stockSn+record.productSn+record.warehouseSn+record.warehouseLocationSn"
  89. :columns="columns"
  90. :customRow="handleClickRow"
  91. :data="loadData"
  92. :defaultLoadData="false"
  93. :scroll="{ y: 300 }"
  94. bordered>
  95. <!-- 产品分类 -->
  96. <template slot="productType" slot-scope="text, record">
  97. <span v-if="record.dealerProduct.productTypeName2 || record.dealerProduct.productTypeName3">{{ record.dealerProduct.productTypeName2 }} {{ record.dealerProduct.productTypeName3 ? '>' : '' }} {{ record.dealerProduct.productTypeName3 }}</span>
  98. <span v-else>--</span>
  99. </template>
  100. <!-- 调入仓位 -->
  101. <template slot="putWarehouseLocationSn" slot-scope="text, record">
  102. <a-select size="small" id="warehouseAllocationEdit-putWarehouseLocationSn" placeholder="请选择" v-model="record.putWarehouseLocationSn" style="width: 100%;">
  103. <a-select-option v-for="item in warehousePutLocData" :key="item.warehouseLocationSn" :disabled="item.warehouseLocationSn==record.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
  104. </a-select>
  105. </template>
  106. <!-- 调出数量 -->
  107. <template slot="outQty" slot-scope="text, record">
  108. <a-input-number
  109. size="small"
  110. id="warehouseAllocationEdit-outQty"
  111. v-model="record.outQty"
  112. :precision="0"
  113. :min="1"
  114. :max="record.currentQty"
  115. placeholder="请输入"
  116. style="width: 100%;" />
  117. </template>
  118. <!-- 操作 -->
  119. <template slot="action" slot-scope="text, record">
  120. <a-button size="small" type="link" class="button-primary" @click="handleAdd(record)" id="warehouseAllocationEdit-add-btn">添加</a-button>
  121. </template>
  122. </s-table>
  123. </a-collapse-panel>
  124. </a-collapse>
  125. </a-card>
  126. <!-- 已选产品 -->
  127. <a-card size="small" :bordered="false" class="warehouseAllocationEdit-cont">
  128. <a-collapse :activeKey="['1']">
  129. <a-collapse-panel key="1" header="已选产品">
  130. <!-- 总计 -->
  131. <a-alert type="info" style="margin-bottom:10px">
  132. <div slot="message">
  133. 总款数 <strong>{{ (productTotal&&(productTotal.productTotalCategory || productTotal.productTotalCategory==0)) ? productTotal.productTotalCategory : '--' }}</strong> ,
  134. 总数量 <strong>{{ (productTotal&&(productTotal.productTotalQty || productTotal.productTotalQty==0)) ? productTotal.productTotalQty : '--' }}</strong> ,
  135. 总成本 <strong>{{ (productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0)) ? '¥'+productTotal.productTotalCost : '--' }}</strong>
  136. </div>
  137. </a-alert>
  138. <!-- 筛选条件 -->
  139. <a-row :gutter="15" justify="space-between">
  140. <a-col :span="18">
  141. <div class="table-page-search-wrapper">
  142. <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
  143. <a-row :gutter="15">
  144. <a-col :md="9" :sm="24">
  145. <a-form-item label="产品编码" prop="productCode">
  146. <a-input id="warehouseAllocationEdit-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
  147. </a-form-item>
  148. </a-col>
  149. <a-col :md="9" :sm="24">
  150. <a-form-item label="产品名称" prop="productName">
  151. <a-input id="warehouseAllocationEdit-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
  152. </a-form-item>
  153. </a-col>
  154. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  155. <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="warehouseAllocationList-refresh">查询</a-button>
  156. <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="warehouseAllocationList-reset">重置</a-button>
  157. </a-col>
  158. </a-row>
  159. </a-form>
  160. </div>
  161. </a-col>
  162. <a-col :span="6">
  163. <div style="margin-top: 4px;text-align: right;">
  164. <!-- <a-button size="small" style="margin-left: 8px" id="chainTransferOutEdit-import-btn">导入明细</a-button> -->
  165. <a-button size="small" type="danger" style="margin-left: 8px" @click.stop="handleDel('', 'all')" id="warehouseAllocationEdit-del-all-btn">整单删除</a-button>
  166. </div>
  167. </a-col>
  168. </a-row>
  169. <!-- 列表 -->
  170. <s-table
  171. class="sTable"
  172. ref="chooseTable"
  173. size="small"
  174. :rowKey="(record) => record.id"
  175. :columns="chooseColumns"
  176. :data="chooseLoadData"
  177. :defaultLoadData="false"
  178. :scroll="{ y: 300 }"
  179. bordered>
  180. <!-- 产品分类 -->
  181. <template slot="productType" slot-scope="text, record">
  182. <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
  183. <span v-else>--</span>
  184. </template>
  185. <!-- 调入仓位 -->
  186. <template slot="putWarehouseLocationSn" slot-scope="text, record">
  187. <a-select
  188. size="small"
  189. id="warehouseAllocationEdit-putWarehouseLocationSn"
  190. @change="chooseWarehouseLocChange(record)"
  191. placeholder="请选择"
  192. v-model="record.putWarehouseLocationSn"
  193. style="width: 100%;">
  194. <a-select-option v-for="item in warehousePutLocData" :key="item.warehouseLocationSn" :disabled="item.warehouseLocationSn==record.outWarehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
  195. </a-select>
  196. </template>
  197. <!-- 调出数量 -->
  198. <template slot="outQty" slot-scope="text, record">
  199. <a-input-number
  200. size="small"
  201. id="warehouseAllocationEdit-outQty"
  202. v-model="record.outQty"
  203. :precision="0"
  204. :min="1"
  205. :max="999999"
  206. placeholder="请输入"
  207. @blur="e => outQtyBlur(e.target.value, record)"
  208. style="width: 100%;" />
  209. </template>
  210. <!-- 操作 -->
  211. <template slot="action" slot-scope="text, record">
  212. <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="warehouseAllocationEdit-del-btn">删除</a-button>
  213. </template>
  214. </s-table>
  215. </a-collapse-panel>
  216. </a-collapse>
  217. </a-card>
  218. </a-spin>
  219. <div class="affix-cont">
  220. <a-button
  221. type="primary"
  222. id="warehouseAllocationEdit-submit"
  223. size="large"
  224. :disabled="spinning"
  225. class="button-primary"
  226. @click="handleSubmit"
  227. style="padding: 0 60px;">提交</a-button>
  228. </div>
  229. </div>
  230. </template>
  231. <script>
  232. import { commonMixin } from '@/utils/mixin'
  233. import { STable, VSelect } from '@/components'
  234. import { allocWarehouseDetailList, allocWarehouseDetail, updatePutWhLocation, productQuery, allocWarehouseDetailCount, allocWarehouseDetailSave, allocWarehouseDetailDel, allocWarehouseSubmit } from '@/api/allocWarehouse'
  235. import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
  236. import { dealerProductTypeList } from '@/api/dealerProductType'
  237. import { warehouseLocAllList } from '@/api/warehouse'
  238. export default {
  239. name: 'AllocWarehouseEdit',
  240. components: { STable, VSelect },
  241. mixins: [commonMixin],
  242. data () {
  243. return {
  244. spinning: false,
  245. chooseLoading: false,
  246. queryParam: {
  247. productCode: '',
  248. productName: '',
  249. productOrigCode: '', // 原厂编码
  250. brandSn: undefined,
  251. productTypeSn1: undefined,
  252. productTypeSn2: undefined,
  253. productTypeSn3: undefined,
  254. warehouseLocationSn: undefined // 调出仓位
  255. },
  256. chooseQueryParam: {
  257. productCode: '',
  258. productName: ''
  259. },
  260. disabled: false, // 查询、重置按钮是否可操作
  261. chooseDisabled: false, // 查询、重置按钮是否可操作
  262. advanced: false, // 高级搜索 展开/关闭
  263. productBrandList: [], // 产品品牌 下拉数据
  264. productTypeList: [], // 产品分类 下拉数据
  265. productType: [],
  266. warehousePutLocData: [], // 调入仓位 下拉数据
  267. warehouseOutLocData: [], // 调出仓位 下拉数据
  268. // 表头
  269. columns: [
  270. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  271. { title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  272. { title: '产品名称', dataIndex: 'productName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  273. { title: '原厂编码', dataIndex: 'productOrigCode', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  274. { title: '品牌', dataIndex: 'brandName', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  275. { title: '分类', scopedSlots: { customRender: 'productType' }, width: '9%', align: 'center' },
  276. { title: '调出仓位', dataIndex: 'warehouseLocationName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  277. { title: '调入仓位', scopedSlots: { customRender: 'putWarehouseLocationSn' }, width: '8%', align: 'center' },
  278. { title: '调出数量', scopedSlots: { customRender: 'outQty' }, width: '7%', align: 'center' },
  279. { title: '可用库存数', dataIndex: 'currentQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  280. { title: '冻结库存数', dataIndex: 'freezeQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  281. { title: '单位', dataIndex: 'unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  282. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  283. ],
  284. // 加载数据方法 必须为 Promise 对象
  285. loadData: parameter => {
  286. this.disabled = true
  287. const params = Object.assign(parameter, this.queryParam)
  288. params.enabledFlag = 1
  289. params.warehouseSn = this.basicInfoData ? this.basicInfoData.outWarehouseSn : ''
  290. return productQuery(params).then(res => {
  291. const data = res.data
  292. const no = (data.pageNo - 1) * data.pageSize
  293. for (var i = 0; i < data.list.length; i++) {
  294. data.list[i].no = no + i + 1
  295. }
  296. this.disabled = false
  297. return data
  298. })
  299. },
  300. // 表头
  301. chooseColumns: [
  302. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  303. { title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  304. { title: '产品名称', dataIndex: 'productName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  305. { title: '原厂编码', dataIndex: 'productOrigCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  306. { title: '品牌', dataIndex: 'brandName', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  307. { title: '分类', scopedSlots: { customRender: 'productType' }, width: '9%', align: 'center' },
  308. { title: '调出仓位', dataIndex: 'outWarehouseLocationName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  309. { title: '调入仓位', scopedSlots: { customRender: 'putWarehouseLocationSn' }, width: '8%', align: 'center' },
  310. { title: '调出数量', scopedSlots: { customRender: 'outQty' }, width: '8%', align: 'center' },
  311. { title: '单位', dataIndex: 'productUnit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  312. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  313. ],
  314. // 加载数据方法 必须为 Promise 对象
  315. chooseLoadData: parameter => {
  316. this.chooseDisabled = true
  317. const params = Object.assign(parameter, this.chooseQueryParam, { allocationWarehouseSn: this.$route.params.sn })
  318. return allocWarehouseDetailList(params).then(res => {
  319. this.getDetailCount(Object.assign(params, this.chooseQueryParam))
  320. const data = res.data
  321. const no = (data.pageNo - 1) * data.pageSize
  322. for (var i = 0; i < data.list.length; i++) {
  323. data.list[i].no = no + i + 1
  324. data.list[i].outQty = data.list[i].allocationQty
  325. data.list[i].outQtyBackups = data.list[i].allocationQty
  326. }
  327. this.chooseDisabled = false
  328. return data
  329. })
  330. },
  331. basicInfoData: null, // 基本信息
  332. productTotal: null // 合计
  333. }
  334. },
  335. methods: {
  336. // 重置
  337. resetSearchForm () {
  338. this.queryParam.productCode = ''
  339. this.queryParam.productName = ''
  340. this.queryParam.productOrigCode = ''
  341. this.queryParam.brandSn = undefined
  342. this.queryParam.productTypeSn1 = undefined
  343. this.queryParam.productTypeSn2 = undefined
  344. this.queryParam.productTypeSn3 = undefined
  345. this.queryParam.warehouseLocationSn = undefined
  346. this.productType = []
  347. this.$refs.table.refresh(true)
  348. },
  349. // 双击快速添加
  350. handleClickRow (record) {
  351. return {
  352. on: {
  353. dblclick: (event) => {
  354. this.handleAdd(record)
  355. }
  356. }
  357. }
  358. },
  359. // 已选产品 重置
  360. chooseResetSearchForm () {
  361. this.chooseQueryParam.productCode = ''
  362. this.chooseQueryParam.productName = ''
  363. this.$refs.chooseTable.refresh(true)
  364. },
  365. // 基本信息
  366. getDetail () {
  367. this.disabled = true
  368. allocWarehouseDetail({ id: this.$route.params.id }).then(res => {
  369. if (res.status == 200) {
  370. this.basicInfoData = res.data
  371. this.resetSearchForm()
  372. this.getWarehouseLoc(res.data.putWarehouseSn, 'put')
  373. this.getWarehouseLoc(res.data.outWarehouseSn, 'out')
  374. } else {
  375. this.basicInfoData = null
  376. }
  377. this.disabled = false
  378. })
  379. },
  380. // 添加/编辑
  381. handleAdd (row, isEdit) {
  382. if (!isEdit && !row.putWarehouseLocationSn) {
  383. this.$message.warning('请选择调入仓位后再添加!')
  384. return
  385. }
  386. if (!isEdit && !row.outQty) {
  387. this.$message.warning('请输入调出数量后再添加!')
  388. return
  389. }
  390. const params = {
  391. id: isEdit ? row.id : undefined,
  392. allocationWarehouseSn: this.$route.params.sn,
  393. allocationCost: isEdit ? row.allocationCost : row.putCost,
  394. allocationQty: row.outQty,
  395. brandSn: row.brandSn,
  396. outWarehouseLocationSn: isEdit ? row.outWarehouseLocationSn : row.warehouseLocationSn,
  397. productCode: row.productCode,
  398. productOrigCode: row.productOrigCode || undefined,
  399. productSn: row.productSn,
  400. productTypeSn1: row.productTypeSn1,
  401. productTypeSn2: row.productTypeSn2,
  402. productTypeSn3: row.productTypeSn3,
  403. putWarehouseLocationSn: row.putWarehouseLocationSn
  404. }
  405. if (isEdit) { // 编辑
  406. // 清空数量时,值应保持未清空前的值,因数量不可为空
  407. if (!row.outQty) {
  408. row.outQty = row.outQtyBackups
  409. return
  410. }
  411. }
  412. this.spinning = true
  413. allocWarehouseDetailSave(params).then(res => {
  414. if (res.status == 200) {
  415. this.$message.success(res.message)
  416. this.$refs.table.refresh()
  417. this.$refs.chooseTable.refresh()
  418. this.spinning = false
  419. } else {
  420. this.spinning = false
  421. row.outQty = row.outQtyBackups
  422. }
  423. })
  424. },
  425. // 删除
  426. handleDel (row, isAll) {
  427. const _this = this
  428. const content = isAll ? '删除后不可恢复,确定要进行整单删除吗?' : '删除后不可恢复,确定要进行删除吗?'
  429. this.$confirm({
  430. title: '提示',
  431. content: content,
  432. centered: true,
  433. onOk () {
  434. let params
  435. if (isAll) { // 整单删除
  436. params = { allocationWarehouseSn: _this.$route.params.sn }
  437. } else { // 单个删除
  438. params = {
  439. allocationWarehouseSn: _this.$route.params.sn,
  440. productSn: row.productSn,
  441. outWarehouseLocationSn: row.outWarehouseLocationSn,
  442. putWarehouseLocationSn: row.putWarehouseLocationSn
  443. }
  444. }
  445. _this.spinning = true
  446. allocWarehouseDetailDel(params).then(res => {
  447. if (res.status == 200) {
  448. _this.$message.success(res.message)
  449. _this.$refs.table.refresh()
  450. _this.$refs.chooseTable.refresh()
  451. _this.spinning = false
  452. } else {
  453. _this.spinning = false
  454. }
  455. })
  456. }
  457. })
  458. },
  459. // 提交
  460. handleSubmit () {
  461. const _this = this
  462. _this.spinning = true
  463. allocWarehouseSubmit({ id: this.$route.params.id }).then(res => {
  464. if (res.status == 200) {
  465. this.$message.success(res.message)
  466. setTimeout(() => {
  467. _this.handleBack()
  468. _this.spinning = false
  469. }, 1000)
  470. } else {
  471. _this.spinning = false
  472. }
  473. })
  474. },
  475. // 合计
  476. getDetailCount (params) {
  477. allocWarehouseDetailCount(params).then(res => {
  478. if (res.status == 200) {
  479. this.productTotal = res.data
  480. } else {
  481. this.productTotal = null
  482. }
  483. })
  484. },
  485. // 返回列表
  486. handleBack () {
  487. this.$router.push({ path: '/allocationManagement/warehouseAllocation/list' })
  488. },
  489. // 已选产品 调出数量 blur
  490. outQtyBlur (val, record) {
  491. // 光标移出,值发生改变再调用编辑接口
  492. if (val != record.outQtyBackups) {
  493. this.handleAdd(record, 'edit')
  494. }
  495. },
  496. // 已选产品 仓位 change
  497. chooseWarehouseLocChange (row) {
  498. const params = {
  499. allocationWarehouseSn: this.$route.params.sn,
  500. productSn: row.productSn,
  501. outWarehouseLocationSn: row.outWarehouseLocationSn,
  502. putWarehouseLocationSn: row.putWarehouseLocationSn
  503. }
  504. this.spinning = true
  505. updatePutWhLocation(params).then(res => {
  506. if (res.status == 200) {
  507. this.$message.success(res.message)
  508. this.$refs.table.refresh()
  509. this.$refs.chooseTable.refresh()
  510. this.spinning = false
  511. } else {
  512. this.spinning = false
  513. }
  514. })
  515. },
  516. // 产品分类 change
  517. changeProductType (val, opt) {
  518. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  519. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  520. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  521. },
  522. // 产品品牌 列表
  523. getProductBrand () {
  524. // sysFlag不传,此处应查询所有产品
  525. dealerProductBrandQuery({}).then(res => {
  526. if (res.status == 200) {
  527. this.productBrandList = res.data
  528. } else {
  529. this.productBrandList = []
  530. }
  531. })
  532. },
  533. // 产品分类 列表
  534. getProductType () {
  535. dealerProductTypeList({}).then(res => {
  536. if (res.status == 200) {
  537. this.productTypeList = res.data
  538. } else {
  539. this.productTypeList = []
  540. }
  541. })
  542. },
  543. // 获取仓库仓位
  544. getWarehouseLoc (sn, type) {
  545. warehouseLocAllList({ warehouseSn: sn }).then(res => {
  546. if (type == 'put') {
  547. this.warehousePutLocData = res.data || []
  548. } else if (type == 'out') {
  549. this.warehouseOutLocData = res.data || []
  550. }
  551. })
  552. },
  553. filterOption (input, option) {
  554. return (
  555. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  556. )
  557. },
  558. pageInit () {
  559. this.chooseResetSearchForm()
  560. this.getProductBrand()
  561. this.getProductType()
  562. this.getDetail()
  563. }
  564. },
  565. mounted () {
  566. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  567. this.pageInit()
  568. }
  569. },
  570. activated () {
  571. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  572. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  573. this.pageInit()
  574. }
  575. },
  576. beforeRouteEnter (to, from, next) {
  577. next(vm => {})
  578. }
  579. }
  580. </script>
  581. <style lang="less">
  582. .warehouseAllocationEdit-wrap{
  583. position: relative;
  584. height: 100%;
  585. padding-bottom: 51px;
  586. box-sizing: border-box;
  587. .warehouseAllocationEdit-back, .warehouseAllocationEdit-cont{
  588. margin-bottom: 10px;
  589. }
  590. >.ant-spin-nested-loading{
  591. overflow-y: scroll;
  592. height: 100%;
  593. }
  594. }
  595. </style>