edit.vue 26 KB

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