edit.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  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="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="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="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="{ x: 1330, 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="primary" 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="17">
  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="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="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="7">
  163. <div style="margin-top: 4px;">
  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="{ x: 1130, 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="primary" 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 { STable, VSelect } from '@/components'
  233. import { allocWarehouseDetailList, allocWarehouseDetail, productQuery, allocWarehouseDetailCount, allocWarehouseDetailSave, allocWarehouseDetailDel, allocWarehouseSubmit } from '@/api/allocWarehouse'
  234. import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
  235. import { dealerProductTypeList } from '@/api/dealerProductType'
  236. import { warehouseLocAllList } from '@/api/warehouse'
  237. export default {
  238. components: { STable, VSelect },
  239. data () {
  240. return {
  241. spinning: false,
  242. chooseLoading: false,
  243. queryParam: {
  244. productCode: '',
  245. productName: '',
  246. productOrigCode: '', // 原厂编码
  247. brandSn: undefined,
  248. productTypeSn1: undefined,
  249. productTypeSn2: undefined,
  250. productTypeSn3: undefined,
  251. warehouseLocationSn: undefined // 调出仓位
  252. },
  253. chooseQueryParam: {
  254. productCode: '',
  255. productName: ''
  256. },
  257. disabled: false, // 查询、重置按钮是否可操作
  258. chooseDisabled: false, // 查询、重置按钮是否可操作
  259. advanced: false, // 高级搜索 展开/关闭
  260. productBrandList: [], // 产品品牌 下拉数据
  261. productTypeList: [], // 产品分类 下拉数据
  262. productType: [],
  263. warehousePutLocData: [], // 调入仓位 下拉数据
  264. warehouseOutLocData: [], // 调出仓位 下拉数据
  265. // 表头
  266. columns: [
  267. { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
  268. { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  269. { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  270. { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  271. { title: '品牌', dataIndex: 'brandName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  272. { title: '分类', scopedSlots: { customRender: 'productType' }, width: 100, align: 'center', ellipsis: true },
  273. { title: '调出仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  274. { title: '调入仓位', scopedSlots: { customRender: 'putWarehouseLocationSn' }, width: 100, align: 'center' },
  275. { title: '调出数量', scopedSlots: { customRender: 'outQty' }, width: 100, align: 'center' },
  276. { title: '可用库存数', dataIndex: 'currentQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  277. { title: '冻结库存数', dataIndex: 'freezeQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  278. { title: '单位', dataIndex: 'unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
  279. { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
  280. ],
  281. // 加载数据方法 必须为 Promise 对象
  282. loadData: parameter => {
  283. this.disabled = true
  284. const params = Object.assign(parameter, this.queryParam)
  285. params.enabledFlag = 1
  286. params.warehouseSn = this.basicInfoData ? this.basicInfoData.outWarehouseSn : ''
  287. return productQuery(params).then(res => {
  288. const data = res.data
  289. const no = (data.pageNo - 1) * data.pageSize
  290. for (var i = 0; i < data.list.length; i++) {
  291. data.list[i].no = no + i + 1
  292. }
  293. this.disabled = false
  294. return data
  295. })
  296. },
  297. // 表头
  298. chooseColumns: [
  299. { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
  300. { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  301. { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
  302. { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  303. { title: '品牌', dataIndex: 'brandName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  304. { title: '分类', scopedSlots: { customRender: 'productType' }, width: 100, align: 'center' },
  305. { title: '调出仓位', dataIndex: 'outWarehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  306. { title: '调入仓位', scopedSlots: { customRender: 'putWarehouseLocationSn' }, width: 100, align: 'center' },
  307. { title: '调出数量', scopedSlots: { customRender: 'outQty' }, width: 100, align: 'center' },
  308. { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
  309. { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
  310. ],
  311. // 加载数据方法 必须为 Promise 对象
  312. chooseLoadData: parameter => {
  313. this.chooseDisabled = true
  314. const params = Object.assign(parameter, this.chooseQueryParam, { allocationWarehouseSn: this.$route.params.sn })
  315. return allocWarehouseDetailList(params).then(res => {
  316. this.getDetailCount(Object.assign(params, this.chooseQueryParam))
  317. const data = res.data
  318. const no = (data.pageNo - 1) * data.pageSize
  319. for (var i = 0; i < data.list.length; i++) {
  320. data.list[i].no = no + i + 1
  321. data.list[i].outQty = data.list[i].allocationQty
  322. data.list[i].outQtyBackups = data.list[i].allocationQty
  323. }
  324. this.chooseDisabled = false
  325. return data
  326. })
  327. },
  328. basicInfoData: null, // 基本信息
  329. productTotal: null // 合计
  330. }
  331. },
  332. methods: {
  333. // 重置
  334. resetSearchForm () {
  335. this.queryParam.productCode = ''
  336. this.queryParam.productName = ''
  337. this.queryParam.productOrigCode = ''
  338. this.queryParam.brandSn = undefined
  339. this.queryParam.productTypeSn1 = undefined
  340. this.queryParam.productTypeSn2 = undefined
  341. this.queryParam.productTypeSn3 = undefined
  342. this.queryParam.warehouseLocationSn = undefined
  343. this.productType = []
  344. this.$refs.table.refresh(true)
  345. },
  346. // 双击快速添加
  347. handleClickRow (record) {
  348. return {
  349. on: {
  350. dblclick: (event) => {
  351. this.handleAdd(record)
  352. }
  353. }
  354. }
  355. },
  356. // 已选产品 重置
  357. chooseResetSearchForm () {
  358. this.chooseQueryParam.productCode = ''
  359. this.chooseQueryParam.productName = ''
  360. this.$refs.chooseTable.refresh(true)
  361. },
  362. // 基本信息
  363. getDetail () {
  364. this.disabled = true
  365. allocWarehouseDetail({ id: this.$route.params.id }).then(res => {
  366. if (res.status == 200) {
  367. this.basicInfoData = res.data
  368. this.resetSearchForm()
  369. this.getWarehouseLoc(res.data.putWarehouseSn, 'put')
  370. this.getWarehouseLoc(res.data.outWarehouseSn, 'out')
  371. } else {
  372. this.basicInfoData = null
  373. }
  374. this.disabled = false
  375. })
  376. },
  377. // 添加/编辑
  378. handleAdd (row, isEdit) {
  379. if (!isEdit && !row.putWarehouseLocationSn) {
  380. this.$message.warning('请选择调入仓位后再添加!')
  381. return
  382. }
  383. if (!isEdit && !row.outQty) {
  384. this.$message.warning('请输入调出数量后再添加!')
  385. return
  386. }
  387. const params = {
  388. id: isEdit ? row.id : undefined,
  389. allocationWarehouseSn: this.$route.params.sn,
  390. allocationCost: isEdit ? row.allocationCost : row.putCost,
  391. allocationQty: row.outQty,
  392. brandSn: row.brandSn,
  393. outWarehouseLocationSn: isEdit ? row.outWarehouseLocationSn : row.warehouseLocationSn,
  394. productCode: row.productCode,
  395. productOrigCode: row.productOrigCode || undefined,
  396. productSn: row.productSn,
  397. productTypeSn1: row.productTypeSn1,
  398. productTypeSn2: row.productTypeSn2,
  399. productTypeSn3: row.productTypeSn3,
  400. putWarehouseLocationSn: row.putWarehouseLocationSn
  401. }
  402. if (isEdit) { // 编辑
  403. // 清空数量时,值应保持未清空前的值,因数量不可为空
  404. if (!row.outQty || row.outQty == row.outQtyBackups) {
  405. row.outQty = row.outQtyBackups
  406. return
  407. }
  408. }
  409. this.spinning = true
  410. allocWarehouseDetailSave(params).then(res => {
  411. if (res.status == 200) {
  412. this.$message.success(res.message)
  413. this.$refs.table.refresh()
  414. this.$refs.chooseTable.refresh()
  415. this.spinning = false
  416. } else {
  417. this.spinning = false
  418. }
  419. })
  420. },
  421. // 删除
  422. handleDel (row, isAll) {
  423. const _this = this
  424. const content = isAll ? '删除后不可恢复,确定要进行整单删除吗?' : '删除后不可恢复,确定要进行删除吗?'
  425. this.$confirm({
  426. title: '提示',
  427. content: content,
  428. centered: true,
  429. onOk () {
  430. let params
  431. if (isAll) { // 整单删除
  432. params = { allocationWarehouseSn: _this.$route.params.sn }
  433. } else { // 单个删除
  434. params = { id: row.id }
  435. }
  436. _this.spinning = true
  437. allocWarehouseDetailDel(params).then(res => {
  438. if (res.status == 200) {
  439. _this.$message.success(res.message)
  440. _this.$refs.table.refresh()
  441. _this.$refs.chooseTable.refresh()
  442. _this.spinning = false
  443. } else {
  444. _this.spinning = false
  445. }
  446. })
  447. }
  448. })
  449. },
  450. // 提交
  451. handleSubmit () {
  452. const _this = this
  453. _this.spinning = true
  454. allocWarehouseSubmit({ id: this.$route.params.id }).then(res => {
  455. if (res.status == 200) {
  456. this.$message.success(res.message)
  457. setTimeout(() => {
  458. _this.handleBack()
  459. _this.spinning = false
  460. }, 1000)
  461. } else {
  462. _this.spinning = false
  463. }
  464. })
  465. },
  466. // 合计
  467. getDetailCount (params) {
  468. allocWarehouseDetailCount(params).then(res => {
  469. if (res.status == 200) {
  470. this.productTotal = res.data
  471. } else {
  472. this.productTotal = null
  473. }
  474. })
  475. },
  476. // 返回列表
  477. handleBack () {
  478. this.$router.push({ path: '/allocationManagement/warehouseAllocation/list', query: { closeLastOldTab: true } })
  479. },
  480. // 已选产品 调出数量 blur
  481. outQtyBlur (val, record) {
  482. // 光标移出,值发生改变再调用编辑接口
  483. if (val != record.outQtyBackups) {
  484. this.handleAdd(record, 'edit')
  485. }
  486. },
  487. // 已选产品 仓位 change
  488. chooseWarehouseLocChange (record) {
  489. this.handleAdd(record, 'edit')
  490. },
  491. // 产品分类 change
  492. changeProductType (val, opt) {
  493. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  494. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  495. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  496. },
  497. // 产品品牌 列表
  498. getProductBrand () {
  499. // sysFlag不传,此处应查询所有产品
  500. dealerProductBrandQuery({}).then(res => {
  501. if (res.status == 200) {
  502. this.productBrandList = res.data
  503. } else {
  504. this.productBrandList = []
  505. }
  506. })
  507. },
  508. // 产品分类 列表
  509. getProductType () {
  510. dealerProductTypeList({}).then(res => {
  511. if (res.status == 200) {
  512. this.productTypeList = res.data
  513. } else {
  514. this.productTypeList = []
  515. }
  516. })
  517. },
  518. // 获取仓库仓位
  519. getWarehouseLoc (sn, type) {
  520. warehouseLocAllList({ warehouseSn: sn }).then(res => {
  521. if (type == 'put') {
  522. this.warehousePutLocData = res.data || []
  523. } else if (type == 'out') {
  524. this.warehouseOutLocData = res.data || []
  525. }
  526. })
  527. },
  528. filterOption (input, option) {
  529. return (
  530. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  531. )
  532. },
  533. pageInit () {
  534. this.resetSearchForm()
  535. this.chooseResetSearchForm()
  536. this.getProductBrand()
  537. this.getProductType()
  538. this.getDetail()
  539. }
  540. },
  541. mounted () {
  542. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  543. this.pageInit()
  544. }
  545. },
  546. activated () {
  547. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  548. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  549. this.pageInit()
  550. }
  551. },
  552. beforeRouteEnter (to, from, next) {
  553. next(vm => {})
  554. }
  555. }
  556. </script>
  557. <style lang="less">
  558. .warehouseAllocationEdit-wrap{
  559. position: relative;
  560. height: 100%;
  561. padding-bottom: 51px;
  562. box-sizing: border-box;
  563. .warehouseAllocationEdit-back, .warehouseAllocationEdit-cont{
  564. margin-bottom: 10px;
  565. }
  566. >.ant-spin-nested-loading{
  567. overflow-y: scroll;
  568. height: 100%;
  569. }
  570. }
  571. </style>