selfDisk.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. <template>
  2. <div class="inventoryCheckSelfDiskList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="inventoryCheckSelfDiskList-back" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="inventoryCheckSelfDiskList-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span class="billno">单号:{{ basicInfoData&&basicInfoData.checkWarehouseNo }}</span>
  9. <a-tag color="blue">{{ basicInfoData&&basicInfoData.stateDictValue }}</a-tag>
  10. </template>
  11. </a-page-header>
  12. <!-- 基础信息 -->
  13. <a-card size="small" :bordered="false" class="inventoryCheckSelfDiskList-cont">
  14. <a-collapse defaultActiveKey="1">
  15. <a-collapse-panel key="1" header="基础信息">
  16. <a-descriptions :column="3">
  17. <a-descriptions-item label="盘点类型">{{ (basicInfoData&&basicInfoData.checkTypeDictValue) || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="是否区分仓库">{{ (basicInfoData&&basicInfoData.warehouseFlagDictValue) || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="盘点仓库" :span="3" v-if="basicInfoData&&basicInfoData.warehouseFlag=='1'">{{ (basicInfoData&&basicInfoData.warehouseNameList) || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="创建人">{{ (basicInfoData&&basicInfoData.creatorName) || '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="创建时间">{{ (basicInfoData&&basicInfoData.createDate) || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="审核时间">{{ (basicInfoData&&basicInfoData.checkSuperviseTime) || '--' }}</a-descriptions-item>
  23. </a-descriptions>
  24. </a-collapse-panel>
  25. </a-collapse>
  26. </a-card>
  27. <a-card size="small" :bordered="false" class="inventoryCheckSelfDiskList-cont">
  28. <!-- 筛选条件 -->
  29. <div class="table-page-search-wrapper">
  30. <a-row>
  31. <a-col :md="2" :sm="24" style="text-align: left;">
  32. <a-button size="small" type="primary" class="button-info" @click.stop="handleBatchAdd('batch')" id="chainTransferOutEdit-del-all-btn">批量添加</a-button>
  33. </a-col>
  34. <a-col :md="20" :sm="24">
  35. <a-form layout="inline" @keyup.enter.native="searchForm">
  36. <a-row :gutter="15">
  37. <a-col :md="6" :sm="24">
  38. <a-form-item label="产品编码" prop="productCode">
  39. <a-input id="inventoryCheckSelfDiskList-productCode" v-model.trim="queryParam.productCode" placeholder="请输入" allowClear />
  40. </a-form-item>
  41. </a-col>
  42. <a-col :md="6" :sm="24">
  43. <a-form-item label="产品名称" prop="productName">
  44. <a-input id="inventoryCheckSelfDiskList-productName" v-model.trim="queryParam.productName" placeholder="请输入" allowClear />
  45. </a-form-item>
  46. </a-col>
  47. <a-col :md="6" :sm="24">
  48. <a-form-item label="产品品牌">
  49. <ProductBrand id="inventoryCheckSelfDiskList-productBrand" sysFlag="" v-model="queryParam.brandSn"></ProductBrand>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :md="2" :sm="8">
  53. <a-form-item label="">
  54. <a-checkbox @change="onlySeeStock">只查看有库存</a-checkbox>
  55. </a-form-item>
  56. </a-col>
  57. <template v-if="advanced">
  58. <a-col :md="6" :sm="24">
  59. <a-form-item label="产品分类">
  60. <ProductType id="inventoryCheckSelfDiskList-productType" @change="changeProductType" v-model="productType"></ProductType>
  61. </a-form-item>
  62. </a-col>
  63. <a-col :md="6" :sm="24" v-if="basicInfoData&&basicInfoData.warehouseFlag=='1'">
  64. <a-form-item label="仓库">
  65. <a-select id="inventoryCheckSelfDiskList-warehouseSn" allowClear placeholder="请选择仓库" v-model="queryParam.warehouseSn" >
  66. <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
  67. </a-select>
  68. </a-form-item>
  69. </a-col>
  70. </template>
  71. <a-col :md="4" :sm="16" style="margin-bottom: 10px;">
  72. <a-button type="primary" @click="searchForm" :disabled="disabled" id="inventoryCheckSelfDiskList-refresh">查询</a-button>
  73. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryCheckSelfDiskList-reset">重置</a-button>
  74. <a @click="advanced=!advanced" style="margin-left: 5px">
  75. {{ advanced ? '收起' : '展开' }}
  76. <a-icon :type="advanced ? 'up' : 'down'"/>
  77. </a>
  78. </a-col>
  79. </a-row>
  80. </a-form>
  81. </a-col>
  82. <a-col :md="2" :sm="24" style="text-align: right;">
  83. <a-button
  84. size="small"
  85. type="primary"
  86. class="button-info"
  87. style="margin-left: 5px"
  88. @click.stop="handleBatchAdd('all')"
  89. id="chainTransferOutEdit-del-all-btn">全部添加</a-button>
  90. </a-col>
  91. </a-row>
  92. </div>
  93. <!-- 列表 -->
  94. <s-table
  95. class="sTable"
  96. ref="table"
  97. size="small"
  98. :rowKey="(record,index) => record.productSn +'-'+ index"
  99. rowKeyName="productSn"
  100. :row-selection="{ columnWidth: 40 }"
  101. @rowSelection="rowSelectionFun"
  102. :columns="columns"
  103. :customRow="handleClickRow"
  104. :data="loadData"
  105. :scroll="{ y: 150 }"
  106. :defaultLoadData="false"
  107. bordered>
  108. <!-- 产品分类 -->
  109. <template slot="productType" slot-scope="text, record">
  110. <span v-if="record.dealerProduct.productTypeName2 || record.dealerProduct.productTypeName3">{{ record.dealerProduct.productTypeName2 }} {{ record.dealerProduct.productTypeName3 ? '>' : '' }} {{ record.dealerProduct.productTypeName3 }}</span>
  111. <span v-else>--</span>
  112. </template>
  113. <!-- 操作 -->
  114. <template slot="action" slot-scope="text, record">
  115. <a-button
  116. size="small"
  117. type="link"
  118. class="button-primary"
  119. :disabled="spinning"
  120. @click.stop="handleAdd(record)"
  121. id="inventoryCheckSelfDiskList-add-btn">添加</a-button>
  122. </template>
  123. </s-table>
  124. </a-card>
  125. <a-card size="small" :bordered="false" class="inventoryCheckSelfDiskList-cont">
  126. <!-- 筛选条件 -->
  127. <div class="table-page-search-wrapper">
  128. <a-row>
  129. <a-col :md="24" :sm="24">
  130. <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
  131. <a-row :gutter="15">
  132. <a-col :md="6" :sm="24">
  133. <a-form-item label="产品编码" prop="productCode">
  134. <a-input id="inventoryCheckSelfDiskList-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入" allowClear />
  135. </a-form-item>
  136. </a-col>
  137. <a-col :md="6" :sm="24">
  138. <a-form-item label="产品名称" prop="productName">
  139. <a-input id="inventoryCheckSelfDiskList-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入" allowClear />
  140. </a-form-item>
  141. </a-col>
  142. <a-col :md="6" :sm="24">
  143. <a-form-item label="产品品牌">
  144. <ProductBrand id="inventoryCheckSelfDiskList-productBrand" sysFlag="" v-model="chooseQueryParam.brandSn"></ProductBrand>
  145. </a-form-item>
  146. </a-col>
  147. <template v-if="chooseAdvanced">
  148. <a-col :md="6" :sm="24">
  149. <a-form-item label="产品分类">
  150. <ProductType id="inventoryCheckSelfDiskList-productType" @change="changeChooseProductType" v-model="chooseProductType"></ProductType>
  151. </a-form-item>
  152. </a-col>
  153. <a-col :md="6" :sm="24" v-if="basicInfoData&&basicInfoData.warehouseFlag=='1'">
  154. <a-form-item label="仓库">
  155. <a-select id="inventoryCheckSelfDiskList-warehouseSn" allowClear placeholder="请选择仓库" v-model="chooseQueryParam.warehouseSn" >
  156. <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
  157. </a-select>
  158. </a-form-item>
  159. </a-col>
  160. </template>
  161. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  162. <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="inventoryCheckSelfDiskList-refresh">查询</a-button>
  163. <a-button style="margin-left: 5px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="inventoryCheckSelfDiskList-reset">重置</a-button>
  164. <a @click="chooseAdvanced=!chooseAdvanced" style="margin-left: 5px">
  165. {{ chooseAdvanced ? '收起' : '展开' }}
  166. <a-icon :type="chooseAdvanced ? 'up' : 'down'"/>
  167. </a>
  168. </a-col>
  169. </a-row>
  170. </a-form>
  171. </a-col>
  172. </a-row>
  173. </div>
  174. <a-row>
  175. <a-col :md="20" :sm="16">
  176. <a-button size="small" type="primary" class="button-error" @click.stop="handleDel('', 'batch')" id="chainTransferOutEdit-del-all-btn">批量删除</a-button>
  177. <!-- 总计 -->
  178. <a-alert type="info" style="margin-bottom:10px;display: inline-block;">
  179. <div slot="message">
  180. 总款数: <strong>{{ productTotal&&(productTotal.totalCategory || productTotal.totalCategory==0) ? productTotal.totalCategory : '--' }}</strong> ,
  181. 总数量: <strong>{{ productTotal&&(productTotal.stockQty || productTotal.stockQty==0) ? productTotal.stockQty : '--' }}</strong> ,
  182. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  183. 总成本: <strong>{{ productTotal&&(productTotal.checkCost || productTotal.checkCost==0) ? '¥'+productTotal.checkCost : '--' }}</strong>。
  184. </div>
  185. </div>
  186. </a-alert>
  187. </a-col>
  188. <a-col :md="4" :sm="8" style="text-align: right;">
  189. <a-button
  190. size="small"
  191. type="primary"
  192. class="button-error"
  193. style="margin-left: 5px"
  194. @click.stop="handleDel('', 'all')"
  195. id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
  196. </a-col>
  197. </a-row>
  198. <!-- 列表 -->
  199. <s-table
  200. class="sTable"
  201. ref="chooseTable"
  202. size="small"
  203. :rowKey="(record) => record.id"
  204. :row-selection="{ columnWidth: 40 }"
  205. @rowSelection="rowChooseSelectionFun"
  206. :columns="chooseColumns"
  207. :data="chooseLoadData"
  208. :scroll="{ y: 300 }"
  209. :defaultLoadData="false"
  210. bordered>
  211. <!-- 产品分类 -->
  212. <template slot="productType" slot-scope="text, record">
  213. <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
  214. <span v-else>--</span>
  215. </template>
  216. <!-- 操作 -->
  217. <template slot="action" slot-scope="text, record">
  218. <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="inventoryCheckSelfDiskList-del-btn">删除</a-button>
  219. </template>
  220. </s-table>
  221. </a-card>
  222. </a-spin>
  223. <div class="affix-cont">
  224. <a-button
  225. type="primary"
  226. id="inventoryCheckSelfDiskList-submit"
  227. size="large"
  228. :disabled="spinning"
  229. class="button-primary"
  230. @click="handleSubmit"
  231. style="padding: 0 60px;">提交</a-button>
  232. </div>
  233. </div>
  234. </template>
  235. <script>
  236. import { commonMixin } from '@/utils/mixin'
  237. import { STable, VSelect } from '@/components'
  238. import ProductType from '@/views/common/productType.js'
  239. import ProductBrand from '@/views/common/productBrand.js'
  240. import { checkWarehouseDetail, checkWarehouseDetailStockList, checkWarehouseDetailList, checkWarehouseDetailCount, checkWarehouseDetailSave, checkWarehouseDetailSaveBatch, checkWarehouseDetailDel, checkWarehouseSubmit } from '@/api/checkWarehouse'
  241. export default {
  242. name: 'CheckWarehouseSelfDisk',
  243. components: { STable, VSelect, ProductType, ProductBrand },
  244. mixins: [commonMixin],
  245. props: {},
  246. data () {
  247. return {
  248. spinning: false,
  249. advanced: false, // 高级搜索 展开/关闭
  250. chooseAdvanced: false, // 高级搜索 展开/关闭
  251. disabled: false,
  252. chooseDisabled: false,
  253. queryParam: {
  254. productCode: '',
  255. productName: '',
  256. warehouseSn: undefined,
  257. brandSn: undefined,
  258. productTypeSn1: undefined,
  259. productTypeSn2: undefined,
  260. productTypeSn3: undefined
  261. },
  262. basicInfoData: null, // 基础信息
  263. productTotal: null,
  264. // 加载数据方法 必须为 Promise 对象
  265. loadData: parameter => {
  266. this.disabled = true
  267. this.spinning = true
  268. return checkWarehouseDetailStockList(Object.assign(parameter, this.queryParam, { checkWarehouseId: this.$route.params.id })).then(res => {
  269. const data = res.data
  270. const no = (data.pageNo - 1) * data.pageSize
  271. for (var i = 0; i < data.list.length; i++) {
  272. data.list[i].no = no + i + 1
  273. }
  274. this.listData = data.list || []
  275. this.disabled = false
  276. this.spinning = false
  277. return data
  278. })
  279. },
  280. chooseQueryParam: {
  281. productCode: '',
  282. productName: '',
  283. warehouseSn: undefined,
  284. brandSn: undefined,
  285. productTypeSn1: undefined,
  286. productTypeSn2: undefined,
  287. productTypeSn3: undefined
  288. },
  289. // 加载数据方法 必须为 Promise 对象
  290. chooseLoadData: parameter => {
  291. this.chooseDisabled = true
  292. return checkWarehouseDetailList(Object.assign(parameter, this.chooseQueryParam, { checkWarehouseSn: this.$route.params.sn })).then(res => {
  293. const data = res.data
  294. const no = (data.pageNo - 1) * data.pageSize
  295. for (var i = 0; i < data.list.length; i++) {
  296. data.list[i].no = no + i + 1
  297. }
  298. this.getDetailCount()
  299. this.chooseDisabled = false
  300. return data
  301. })
  302. },
  303. productType: [],
  304. chooseProductType: [],
  305. warehouseList: [], // 仓库 下拉数据
  306. listData: [],
  307. rowSelectionInfo: null,
  308. rowChooseSelectionInfo: null
  309. }
  310. },
  311. computed: {
  312. columns () {
  313. const arr = [
  314. { title: '产品编码', dataIndex: 'productCode', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '12%' : '22%', align: 'center', customRender: function (text) { return text || '--' } },
  315. { title: '产品名称', dataIndex: 'productName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '15%' : '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  316. { title: '产品品牌', dataIndex: 'brandName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '9%' : '11%', align: 'center', customRender: function (text) { return text || '--' } },
  317. { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '14%' },
  318. { title: '单位', dataIndex: 'unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  319. { title: '库存数量', dataIndex: 'currentQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  320. { title: '最后入库时间', dataIndex: 'lastStockTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  321. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  322. ]
  323. if (this.basicInfoData && this.basicInfoData.warehouseFlag == '1') {
  324. arr.splice(4, 0, { title: '仓库', dataIndex: 'warehouseName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  325. arr.splice(5, 0, { title: '仓位', dataIndex: 'warehouseLocationName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  326. }
  327. return arr
  328. },
  329. chooseColumns () {
  330. const arr = [
  331. { title: '产品编码', dataIndex: 'productCode', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '12%' : '22%', align: 'center', customRender: function (text) { return text || '--' } },
  332. { title: '产品名称', dataIndex: 'productName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '15%' : '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  333. { title: '产品品牌', dataIndex: 'brandName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '9%' : '11%', align: 'center', customRender: function (text) { return text || '--' } },
  334. { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '14%', align: 'center' },
  335. { title: '单位', dataIndex: 'productUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  336. { title: '库存数量', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  337. { title: '最后入库时间', dataIndex: 'lastStockTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  338. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  339. ]
  340. if (this.basicInfoData && this.basicInfoData.warehouseFlag == '1') {
  341. arr.splice(4, 0, { title: '仓库', dataIndex: 'warehouseName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  342. arr.splice(5, 0, { title: '仓位', dataIndex: 'warehouseLocationName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  343. }
  344. return arr
  345. }
  346. },
  347. methods: {
  348. // 表格选中项
  349. rowSelectionFun (obj) {
  350. this.rowSelectionInfo = obj || null
  351. },
  352. rowChooseSelectionFun (obj) {
  353. this.rowChooseSelectionInfo = obj || null
  354. },
  355. // 查询
  356. searchForm () {
  357. this.$refs.table.clearSelected() // 清空表格选中项
  358. this.$refs.table.refresh(true)
  359. },
  360. // 重置
  361. resetSearchForm () {
  362. this.$refs.table.clearSelected() // 清空表格选中项
  363. this.queryParam.productCode = ''
  364. this.queryParam.productName = ''
  365. this.queryParam.warehouseSn = undefined
  366. this.queryParam.brandSn = undefined
  367. this.queryParam.productTypeSn1 = undefined
  368. this.queryParam.productTypeSn2 = undefined
  369. this.queryParam.productTypeSn3 = undefined
  370. this.productType = []
  371. this.$refs.table.refresh(true)
  372. },
  373. // 添加
  374. handleAdd (row) {
  375. const params = {
  376. checkWarehouseSn: this.$route.params.sn,
  377. checkCost: row.putCost,
  378. productSn: row.productSn,
  379. productCode: row.productCode,
  380. productOrigCode: row.productOrigCode || undefined,
  381. productTypeSn1: row.productTypeSn1,
  382. productTypeSn2: row.productTypeSn2,
  383. productTypeSn3: row.productTypeSn3,
  384. brandSn: row.brandSn,
  385. stockQty: row.currentQty,
  386. lastStockTime: row.lastStockTime,
  387. checkProfitLossCost: row.lastStockCost,
  388. stockBatchNo: row.stockBatchNo || undefined,
  389. productProduceDate: row.productProduceDate || undefined,
  390. productExpiryDate: row.productExpiryDate || undefined,
  391. warehouseSn: row.warehouseSn || undefined,
  392. warehouseLocationSn: row.warehouseLocationSn || undefined
  393. }
  394. this.spinning = true
  395. checkWarehouseDetailSave(params).then(res => {
  396. if (res.status == 200) {
  397. this.$message.success(res.message)
  398. this.$refs.table.refresh()
  399. this.$refs.chooseTable.refresh()
  400. this.spinning = false
  401. } else {
  402. this.spinning = false
  403. }
  404. })
  405. },
  406. // 批量添加/全部添加
  407. handleBatchAdd (type) {
  408. const _this = this
  409. let params = {}
  410. if (type == 'batch') { // 批量添加
  411. if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.length == 0)) {
  412. this.$message.warning('请选择需要批量添加的选项值后再操作!')
  413. return
  414. }
  415. params.checkWarehouseSn = _this.$route.params.sn
  416. params.checkWarehouseDetailEntityList = []
  417. this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.map(item => {
  418. params.checkWarehouseDetailEntityList.push({
  419. checkWarehouseSn: _this.$route.params.sn,
  420. checkCost: item.putCost,
  421. productSn: item.productSn,
  422. productCode: item.productCode,
  423. productOrigCode: item.productOrigCode || undefined,
  424. productTypeSn1: item.productTypeSn1,
  425. productTypeSn2: item.productTypeSn2,
  426. productTypeSn3: item.productTypeSn3,
  427. brandSn: item.brandSn,
  428. stockQty: item.currentQty,
  429. lastStockTime: item.lastStockTime,
  430. checkProfitLossCost: item.lastStockCost,
  431. stockBatchNo: item.stockBatchNo || undefined,
  432. productProduceDate: item.productProduceDate || undefined,
  433. productExpiryDate: item.productExpiryDate || undefined,
  434. warehouseSn: item.warehouseSn || undefined,
  435. warehouseLocationSn: item.warehouseLocationSn || undefined
  436. })
  437. })
  438. } else if (type == 'all') { // 全部添加
  439. if (this.listData.length == 0) {
  440. this.$message.warning('暂时没有可添加的产品')
  441. return
  442. }
  443. params = {
  444. checkWarehouseSn: _this.$route.params.sn,
  445. allFlag: true,
  446. stockDetailDTO: this.queryParam
  447. }
  448. }
  449. this.spinning = true
  450. checkWarehouseDetailSaveBatch(params).then(res => {
  451. if (res.status == 200) {
  452. this.$refs.table.clearSelected() // 清空表格选中项
  453. this.$message.success(res.message)
  454. this.$refs.table.refresh()
  455. this.$refs.chooseTable.refresh()
  456. this.spinning = false
  457. } else {
  458. this.spinning = false
  459. }
  460. })
  461. },
  462. // 删除
  463. handleDel (row, isAll) {
  464. const _this = this
  465. let content
  466. if (isAll == 'batch') { // 批量
  467. if (this.rowChooseSelectionInfo && this.rowChooseSelectionInfo.selectedRowKeys.length == 0) {
  468. this.$message.warning('请选择需要批量删除的选项值后再操作!')
  469. return
  470. }
  471. content = '删除后不可恢复,确定要进行批量删除吗?'
  472. } else if (isAll == 'all') { // 全部
  473. content = '删除后不可恢复,确定要进行整单删除吗?'
  474. } else { // 单个
  475. content = '删除后不可恢复,确定要进行删除吗?'
  476. }
  477. this.$confirm({
  478. title: '提示',
  479. content: content,
  480. centered: true,
  481. onOk () {
  482. _this.spinning = true
  483. const params = { checkWarehouseSn: _this.$route.params.sn }
  484. if (isAll == 'batch') { // 批量
  485. params.idList = _this.rowChooseSelectionInfo && _this.rowChooseSelectionInfo.selectedRowKeys
  486. } else if (isAll == 'all') { // 全部
  487. params.allFlag = true
  488. } else { // 单个
  489. params.id = row.id
  490. }
  491. checkWarehouseDetailDel(params).then(res => {
  492. if (res.status == 200) {
  493. _this.$message.success(res.message)
  494. _this.$refs.table.refresh()
  495. _this.$refs.chooseTable.refresh()
  496. if (isAll == 'batch') { // 批量
  497. _this.$refs.chooseTable.clearSelected() // 清空表格选中项
  498. }
  499. _this.spinning = false
  500. } else {
  501. _this.spinning = false
  502. }
  503. })
  504. }
  505. })
  506. },
  507. // 返回列表
  508. handleBack () {
  509. this.$router.push({ path: '/inventoryManagement/inventoryChecking/list' })
  510. },
  511. // 查询基础信息
  512. getDetail () {
  513. checkWarehouseDetail({ sn: this.$route.params.sn }).then(res => {
  514. if (res.status == 200) {
  515. this.basicInfoData = res.data || null
  516. this.warehouseList = res.data.warehouseList || []
  517. } else {
  518. this.basicInfoData = null
  519. this.warehouseList = []
  520. }
  521. })
  522. },
  523. // 已选产品 重置
  524. chooseResetSearchForm () {
  525. this.chooseQueryParam.productCode = ''
  526. this.chooseQueryParam.productName = ''
  527. this.chooseQueryParam.warehouseSn = undefined
  528. this.chooseQueryParam.brandSn = undefined
  529. this.chooseQueryParam.productTypeSn1 = undefined
  530. this.chooseQueryParam.productTypeSn2 = undefined
  531. this.chooseQueryParam.productTypeSn3 = undefined
  532. this.chooseProductType = []
  533. this.$refs.chooseTable.refresh(true)
  534. },
  535. // 合计
  536. getDetailCount (params) {
  537. checkWarehouseDetailCount(Object.assign(this.chooseQueryParam, { checkWarehouseSn: this.$route.params.sn })).then(res => {
  538. if (res.status == 200) {
  539. this.productTotal = res.data
  540. } else {
  541. this.productTotal = null
  542. }
  543. })
  544. },
  545. // 提交
  546. handleSubmit () {
  547. const _this = this
  548. _this.spinning = true
  549. checkWarehouseSubmit({ id: this.$route.params.id }).then(res => {
  550. if (res.status == 200) {
  551. this.$message.success(res.message)
  552. setTimeout(() => {
  553. _this.handleBack()
  554. _this.spinning = false
  555. }, 1000)
  556. } else {
  557. _this.spinning = false
  558. }
  559. })
  560. },
  561. // 产品分类 change
  562. changeProductType (val, opt) {
  563. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  564. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  565. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  566. },
  567. changeChooseProductType (val, opt) {
  568. this.chooseQueryParam.productTypeSn1 = val[0] ? val[0] : ''
  569. this.chooseQueryParam.productTypeSn2 = val[1] ? val[1] : ''
  570. this.chooseQueryParam.productTypeSn3 = val[2] ? val[2] : ''
  571. },
  572. // 双击快速添加
  573. handleClickRow (record) {
  574. return {
  575. on: {
  576. dblclick: (event) => {
  577. event.stopPropagation()
  578. this.handleAdd(record)
  579. }
  580. }
  581. }
  582. },
  583. // 只查看有库存
  584. onlySeeStock (e) {
  585. console.log('1111111111:')
  586. }
  587. },
  588. mounted () {
  589. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  590. this.getDetail()
  591. this.resetSearchForm()
  592. this.chooseResetSearchForm()
  593. }
  594. },
  595. activated () {
  596. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  597. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  598. this.getDetail()
  599. this.resetSearchForm()
  600. this.chooseResetSearchForm()
  601. }
  602. },
  603. beforeRouteEnter (to, from, next) {
  604. next(vm => {})
  605. }
  606. }
  607. </script>
  608. <style lang="less">
  609. .inventoryCheckSelfDiskList-wrap{
  610. position: relative;
  611. height: 100%;
  612. padding-bottom: 51px;
  613. box-sizing: border-box;
  614. .inventoryCheckSelfDiskList-cont, .inventoryCheckSelfDiskList-back{
  615. margin-bottom: 10px;
  616. }
  617. .billno{
  618. font-size: 16px;
  619. font-weight: bold;
  620. margin: 0 15px;
  621. }
  622. >.ant-spin-nested-loading{
  623. overflow-y: auto;
  624. height: 100%;
  625. }
  626. }
  627. </style>