selfDisk.vue 29 KB

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