edit.vue 26 KB

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