edit.vue 25 KB

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