selfDisk.vue 28 KB

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