selfDisk.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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: 'productCode', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '12%' : '22%', align: 'center', customRender: function (text) { return text || '--' } },
  303. { title: '产品名称', dataIndex: 'productName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '15%' : '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  304. { title: '产品品牌', dataIndex: 'brandName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '9%' : '11%', align: 'center', customRender: function (text) { return text || '--' } },
  305. { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '14%' },
  306. { title: '单位', dataIndex: 'unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  307. { title: '库存数量', dataIndex: 'currentQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  308. { title: '最后入库时间', dataIndex: 'lastStockTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  309. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  310. ]
  311. if (this.basicInfoData && this.basicInfoData.warehouseFlag == '1') {
  312. arr.splice(4, 0, { title: '仓库', dataIndex: 'warehouseName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  313. arr.splice(5, 0, { title: '仓位', dataIndex: 'warehouseLocationName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  314. }
  315. return arr
  316. },
  317. chooseColumns () {
  318. const arr = [
  319. { title: '产品编码', dataIndex: 'productCode', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '12%' : '22%', align: 'center', customRender: function (text) { return text || '--' } },
  320. { title: '产品名称', dataIndex: 'productName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '15%' : '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  321. { title: '产品品牌', dataIndex: 'brandName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '9%' : '11%', align: 'center', customRender: function (text) { return text || '--' } },
  322. { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '14%', align: 'center' },
  323. { title: '单位', dataIndex: 'productUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  324. { title: '库存数量', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  325. { title: '最后入库时间', dataIndex: 'lastStockTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  326. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  327. ]
  328. if (this.basicInfoData && this.basicInfoData.warehouseFlag == '1') {
  329. arr.splice(4, 0, { title: '仓库', dataIndex: 'warehouseName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  330. arr.splice(5, 0, { title: '仓位', dataIndex: 'warehouseLocationName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  331. }
  332. return arr
  333. }
  334. },
  335. methods: {
  336. // 表格选中项
  337. rowSelectionFun (obj) {
  338. this.rowSelectionInfo = obj || null
  339. },
  340. rowChooseSelectionFun (obj) {
  341. this.rowChooseSelectionInfo = obj || null
  342. },
  343. // 查询
  344. searchForm () {
  345. this.$refs.table.clearSelected() // 清空表格选中项
  346. this.$refs.table.refresh(true)
  347. },
  348. // 重置
  349. resetSearchForm () {
  350. this.$refs.table.clearSelected() // 清空表格选中项
  351. this.queryParam.productCode = ''
  352. this.queryParam.productName = ''
  353. this.queryParam.warehouseSn = undefined
  354. this.queryParam.brandSn = undefined
  355. this.queryParam.productTypeSn1 = undefined
  356. this.queryParam.productTypeSn2 = undefined
  357. this.queryParam.productTypeSn3 = undefined
  358. this.productType = []
  359. this.queryParam.existStockFlag = null
  360. this.showChecked = false
  361. this.$refs.table.refresh(true)
  362. },
  363. // 添加
  364. handleAdd (row) {
  365. const params = {
  366. checkWarehouseSn: this.$route.params.sn,
  367. checkCost: row.putCost,
  368. productSn: row.productSn,
  369. productCode: row.productCode,
  370. productOrigCode: row.productOrigCode || undefined,
  371. productTypeSn1: row.productTypeSn1,
  372. productTypeSn2: row.productTypeSn2,
  373. productTypeSn3: row.productTypeSn3,
  374. brandSn: row.brandSn,
  375. stockQty: row.currentQty,
  376. lastStockTime: row.lastStockTime,
  377. checkProfitLossCost: row.lastStockCost,
  378. stockBatchNo: row.stockBatchNo || undefined,
  379. productProduceDate: row.productProduceDate || undefined,
  380. productExpiryDate: row.productExpiryDate || undefined,
  381. warehouseSn: row.warehouseSn || undefined,
  382. warehouseLocationSn: row.warehouseLocationSn || undefined
  383. }
  384. this.spinning = true
  385. checkWarehouseDetailSave(params).then(res => {
  386. if (res.status == 200) {
  387. this.$message.success(res.message)
  388. this.$refs.table.refresh()
  389. this.$refs.chooseTable.refresh()
  390. this.spinning = false
  391. } else {
  392. this.spinning = false
  393. }
  394. })
  395. },
  396. // 批量添加/全部添加
  397. handleBatchAdd (type) {
  398. const _this = this
  399. let params = {}
  400. if (type == 'batch') { // 批量添加
  401. if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.length == 0)) {
  402. this.$message.warning('请选择需要批量添加的选项值后再操作!')
  403. return
  404. }
  405. params.checkWarehouseSn = _this.$route.params.sn
  406. params.checkWarehouseDetailEntityList = []
  407. this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.map(item => {
  408. params.checkWarehouseDetailEntityList.push({
  409. checkWarehouseSn: _this.$route.params.sn,
  410. checkCost: item.putCost,
  411. productSn: item.productSn,
  412. productCode: item.productCode,
  413. productOrigCode: item.productOrigCode || undefined,
  414. productTypeSn1: item.productTypeSn1,
  415. productTypeSn2: item.productTypeSn2,
  416. productTypeSn3: item.productTypeSn3,
  417. brandSn: item.brandSn,
  418. stockQty: item.currentQty,
  419. lastStockTime: item.lastStockTime,
  420. checkProfitLossCost: item.lastStockCost,
  421. stockBatchNo: item.stockBatchNo || undefined,
  422. productProduceDate: item.productProduceDate || undefined,
  423. productExpiryDate: item.productExpiryDate || undefined,
  424. warehouseSn: item.warehouseSn || undefined,
  425. warehouseLocationSn: item.warehouseLocationSn || undefined
  426. })
  427. })
  428. } else if (type == 'all') { // 全部添加
  429. if (this.listData.length == 0) {
  430. this.$message.warning('暂时没有可添加的产品')
  431. return
  432. }
  433. params = {
  434. checkWarehouseSn: _this.$route.params.sn,
  435. allFlag: true,
  436. stockDetailDTO: this.queryParam
  437. }
  438. }
  439. this.spinning = true
  440. checkWarehouseDetailSaveBatch(params).then(res => {
  441. if (res.status == 200) {
  442. this.$refs.table.clearSelected() // 清空表格选中项
  443. this.$message.success(res.message)
  444. this.$refs.table.refresh()
  445. this.$refs.chooseTable.refresh()
  446. this.spinning = false
  447. } else {
  448. this.spinning = false
  449. }
  450. })
  451. },
  452. // 删除
  453. handleDel (row, isAll) {
  454. const _this = this
  455. let content
  456. if (isAll == 'batch') { // 批量
  457. if (this.rowChooseSelectionInfo && this.rowChooseSelectionInfo.selectedRowKeys.length == 0) {
  458. this.$message.warning('请选择需要批量删除的选项值后再操作!')
  459. return
  460. }
  461. content = '删除后不可恢复,确定要进行批量删除吗?'
  462. } else if (isAll == 'all') { // 全部
  463. content = '删除后不可恢复,确定要清空列表吗?'
  464. } else { // 单个
  465. content = '删除后不可恢复,确定要进行删除吗?'
  466. }
  467. this.$confirm({
  468. title: '提示',
  469. content: content,
  470. centered: true,
  471. onOk () {
  472. _this.spinning = true
  473. const params = { checkWarehouseSn: _this.$route.params.sn }
  474. if (isAll == 'batch') { // 批量
  475. params.idList = _this.rowChooseSelectionInfo && _this.rowChooseSelectionInfo.selectedRowKeys
  476. } else if (isAll == 'all') { // 全部
  477. params.allFlag = true
  478. } else { // 单个
  479. params.id = row.id
  480. }
  481. checkWarehouseDetailDel(params).then(res => {
  482. if (res.status == 200) {
  483. _this.$message.success(res.message)
  484. _this.$refs.table.refresh()
  485. _this.$refs.chooseTable.refresh()
  486. if (isAll == 'batch') { // 批量
  487. _this.$refs.chooseTable.clearSelected() // 清空表格选中项
  488. }
  489. _this.spinning = false
  490. } else {
  491. _this.spinning = false
  492. }
  493. })
  494. }
  495. })
  496. },
  497. // 返回列表
  498. handleBack () {
  499. this.$router.push({ path: '/inventoryManagement/inventoryChecking/list' })
  500. },
  501. // 查询基础信息
  502. getDetail () {
  503. checkWarehouseDetail({ sn: this.$route.params.sn }).then(res => {
  504. if (res.status == 200) {
  505. this.basicInfoData = res.data || null
  506. this.warehouseList = res.data.warehouseList || []
  507. } else {
  508. this.basicInfoData = null
  509. this.warehouseList = []
  510. }
  511. })
  512. },
  513. // 已选产品 重置
  514. chooseResetSearchForm () {
  515. this.chooseQueryParam.productCode = ''
  516. this.chooseQueryParam.productName = ''
  517. this.chooseQueryParam.warehouseSn = undefined
  518. this.chooseQueryParam.brandSn = undefined
  519. this.chooseQueryParam.productTypeSn1 = undefined
  520. this.chooseQueryParam.productTypeSn2 = undefined
  521. this.chooseQueryParam.productTypeSn3 = undefined
  522. this.chooseProductType = []
  523. this.$refs.chooseTable.refresh(true)
  524. },
  525. // 合计
  526. getDetailCount (params) {
  527. checkWarehouseDetailCount(Object.assign(this.chooseQueryParam, { checkWarehouseSn: this.$route.params.sn })).then(res => {
  528. if (res.status == 200) {
  529. this.productTotal = res.data
  530. } else {
  531. this.productTotal = null
  532. }
  533. })
  534. },
  535. // 提交
  536. handleSubmit () {
  537. const _this = this
  538. _this.spinning = true
  539. checkWarehouseSubmit({ id: this.$route.params.id }).then(res => {
  540. if (res.status == 200) {
  541. this.$message.success(res.message)
  542. setTimeout(() => {
  543. _this.handleBack()
  544. _this.spinning = false
  545. }, 1000)
  546. } else {
  547. _this.spinning = false
  548. }
  549. })
  550. },
  551. // 产品分类 change
  552. changeProductType (val, opt) {
  553. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  554. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  555. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  556. },
  557. changeChooseProductType (val, opt) {
  558. this.chooseQueryParam.productTypeSn1 = val[0] ? val[0] : ''
  559. this.chooseQueryParam.productTypeSn2 = val[1] ? val[1] : ''
  560. this.chooseQueryParam.productTypeSn3 = val[2] ? val[2] : ''
  561. },
  562. // 双击快速添加
  563. handleClickRow (record) {
  564. this.handleAdd(record)
  565. },
  566. // 只查看有库存
  567. onlySeeStock (e) {
  568. this.showChecked = e.target.checked
  569. this.queryParam.existStockFlag = e.target.checked ? 1 : null
  570. }
  571. },
  572. mounted () {
  573. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  574. this.getDetail()
  575. this.resetSearchForm()
  576. this.chooseResetSearchForm()
  577. }
  578. },
  579. activated () {
  580. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  581. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  582. this.getDetail()
  583. this.resetSearchForm()
  584. this.chooseResetSearchForm()
  585. }
  586. },
  587. beforeRouteEnter (to, from, next) {
  588. next(vm => {})
  589. }
  590. }
  591. </script>
  592. <style lang="less">
  593. .inventoryCheckSelfDiskList-wrap{
  594. position: relative;
  595. height: 100%;
  596. padding-bottom: 51px;
  597. box-sizing: border-box;
  598. .inventoryCheckSelfDiskList-cont, .inventoryCheckSelfDiskList-back{
  599. margin-bottom: 10px;
  600. }
  601. .billno{
  602. font-size: 16px;
  603. font-weight: bold;
  604. margin: 0 15px;
  605. }
  606. >.ant-spin-nested-loading{
  607. overflow-y: auto;
  608. height: 100%;
  609. }
  610. }
  611. </style>