edit.vue 25 KB

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