selfDisk.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  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 { STable, VSelect } from '@/components'
  225. import ProductType from '@/views/common/productType.js'
  226. import ProductBrand from '@/views/common/productBrand.js'
  227. import { checkWarehouseDetail, checkWarehouseDetailStockList, checkWarehouseDetailList, checkWarehouseDetailCount, checkWarehouseDetailSave, checkWarehouseDetailSaveBatch, checkWarehouseDetailDel, checkWarehouseSubmit } from '@/api/checkWarehouse'
  228. export default {
  229. components: { STable, VSelect, ProductType, ProductBrand },
  230. props: {},
  231. data () {
  232. return {
  233. spinning: false,
  234. advanced: false, // 高级搜索 展开/关闭
  235. chooseAdvanced: false, // 高级搜索 展开/关闭
  236. disabled: false,
  237. chooseDisabled: false,
  238. queryParam: {
  239. productCode: '',
  240. productName: '',
  241. warehouseSn: undefined,
  242. brandSn: undefined,
  243. productTypeSn1: undefined,
  244. productTypeSn2: undefined,
  245. productTypeSn3: undefined
  246. },
  247. basicInfoData: null, // 基础信息
  248. productTotal: null,
  249. // 加载数据方法 必须为 Promise 对象
  250. loadData: parameter => {
  251. this.disabled = true
  252. this.spinning = true
  253. return checkWarehouseDetailStockList(Object.assign(parameter, this.queryParam, { checkWarehouseId: this.$route.params.id })).then(res => {
  254. const data = res.data
  255. const no = (data.pageNo - 1) * data.pageSize
  256. for (var i = 0; i < data.list.length; i++) {
  257. data.list[i].no = no + i + 1
  258. }
  259. this.listData = data.list || []
  260. this.disabled = false
  261. this.spinning = false
  262. return data
  263. })
  264. },
  265. chooseQueryParam: {
  266. productCode: '',
  267. productName: '',
  268. warehouseSn: undefined,
  269. brandSn: undefined,
  270. productTypeSn1: undefined,
  271. productTypeSn2: undefined,
  272. productTypeSn3: undefined
  273. },
  274. // 加载数据方法 必须为 Promise 对象
  275. chooseLoadData: parameter => {
  276. this.chooseDisabled = true
  277. return checkWarehouseDetailList(Object.assign(parameter, this.chooseQueryParam, { checkWarehouseSn: this.$route.params.sn })).then(res => {
  278. const data = res.data
  279. const no = (data.pageNo - 1) * data.pageSize
  280. for (var i = 0; i < data.list.length; i++) {
  281. data.list[i].no = no + i + 1
  282. }
  283. this.getDetailCount()
  284. this.chooseDisabled = false
  285. return data
  286. })
  287. },
  288. productType: [],
  289. chooseProductType: [],
  290. warehouseList: [], // 仓库 下拉数据
  291. selectedRowKeys: [],
  292. selectedRows: [],
  293. chooseSelectedRowKeys: [],
  294. chooseSelectedRows: [],
  295. listData: []
  296. }
  297. },
  298. computed: {
  299. columns () {
  300. const arr = [
  301. { title: '产品编码', dataIndex: 'productCode', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '12%' : '22%', align: 'center', customRender: function (text) { return text || '--' } },
  302. { title: '产品名称', dataIndex: 'productName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '15%' : '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  303. { title: '产品品牌', dataIndex: 'brandName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '9%' : '11%', align: 'center', customRender: function (text) { return text || '--' } },
  304. { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '14%' },
  305. { title: '单位', dataIndex: 'unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  306. { title: '库存数量', dataIndex: 'currentQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  307. { title: '最后入库时间', dataIndex: 'lastStockTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  308. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  309. ]
  310. if (this.basicInfoData && this.basicInfoData.warehouseFlag == '1') {
  311. arr.splice(4, 0, { title: '仓库', dataIndex: 'warehouseName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  312. arr.splice(5, 0, { title: '仓位', dataIndex: 'warehouseLocationName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  313. }
  314. return arr
  315. },
  316. chooseColumns () {
  317. const arr = [
  318. { title: '产品编码', dataIndex: 'productCode', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '12%' : '22%', align: 'center', customRender: function (text) { return text || '--' } },
  319. { title: '产品名称', dataIndex: 'productName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '15%' : '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  320. { title: '产品品牌', dataIndex: 'brandName', width: this.basicInfoData && this.basicInfoData.warehouseFlag == '1' ? '9%' : '11%', align: 'center', customRender: function (text) { return text || '--' } },
  321. { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '14%', align: 'center' },
  322. { title: '单位', dataIndex: 'productUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  323. { title: '库存数量', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  324. { title: '最后入库时间', dataIndex: 'lastStockTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  325. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  326. ]
  327. if (this.basicInfoData && this.basicInfoData.warehouseFlag == '1') {
  328. arr.splice(4, 0, { title: '仓库', dataIndex: 'warehouseName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  329. arr.splice(5, 0, { title: '仓位', dataIndex: 'warehouseLocationName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } })
  330. }
  331. return arr
  332. }
  333. },
  334. methods: {
  335. // 重置
  336. resetSearchForm () {
  337. this.queryParam.productCode = ''
  338. this.queryParam.productName = ''
  339. this.queryParam.warehouseSn = undefined
  340. this.queryParam.brandSn = undefined
  341. this.queryParam.productTypeSn1 = undefined
  342. this.queryParam.productTypeSn2 = undefined
  343. this.queryParam.productTypeSn3 = undefined
  344. this.productType = []
  345. this.$refs.table.refresh(true)
  346. },
  347. // 添加
  348. handleAdd (row) {
  349. const params = {
  350. checkWarehouseSn: this.$route.params.sn,
  351. checkCost: row.putCost,
  352. productSn: row.productSn,
  353. productCode: row.productCode,
  354. productOrigCode: row.productOrigCode || undefined,
  355. productTypeSn1: row.productTypeSn1,
  356. productTypeSn2: row.productTypeSn2,
  357. productTypeSn3: row.productTypeSn3,
  358. brandSn: row.brandSn,
  359. stockQty: row.currentQty,
  360. lastStockTime: row.lastStockTime,
  361. checkProfitLossCost: row.lastStockCost,
  362. stockBatchNo: row.stockBatchNo || undefined,
  363. productProduceDate: row.productProduceDate || undefined,
  364. productExpiryDate: row.productExpiryDate || undefined,
  365. warehouseSn: row.warehouseSn || undefined,
  366. warehouseLocationSn: row.warehouseLocationSn || undefined
  367. }
  368. this.spinning = true
  369. checkWarehouseDetailSave(params).then(res => {
  370. if (res.status == 200) {
  371. this.$message.success(res.message)
  372. this.$refs.table.refresh()
  373. this.$refs.chooseTable.refresh()
  374. this.spinning = false
  375. } else {
  376. this.spinning = false
  377. }
  378. })
  379. },
  380. // 批量添加/全部添加
  381. handleBatchAdd (type) {
  382. const _this = this
  383. let params = {}
  384. if (type == 'batch') { // 批量添加
  385. if (this.selectedRows.length == 0) {
  386. this.$message.warning('请选择需要批量添加的选项值后再操作!')
  387. return
  388. }
  389. params.checkWarehouseSn = _this.$route.params.sn
  390. params.checkWarehouseDetailEntityList = []
  391. this.selectedRows.map(item => {
  392. params.checkWarehouseDetailEntityList.push({
  393. checkWarehouseSn: _this.$route.params.sn,
  394. checkCost: item.putCost,
  395. productSn: item.productSn,
  396. productCode: item.productCode,
  397. productOrigCode: item.productOrigCode || undefined,
  398. productTypeSn1: item.productTypeSn1,
  399. productTypeSn2: item.productTypeSn2,
  400. productTypeSn3: item.productTypeSn3,
  401. brandSn: item.brandSn,
  402. stockQty: item.currentQty,
  403. lastStockTime: item.lastStockTime,
  404. checkProfitLossCost: item.lastStockCost,
  405. stockBatchNo: item.stockBatchNo || undefined,
  406. productProduceDate: item.productProduceDate || undefined,
  407. productExpiryDate: item.productExpiryDate || undefined,
  408. warehouseSn: item.warehouseSn || undefined,
  409. warehouseLocationSn: item.warehouseLocationSn || undefined
  410. })
  411. })
  412. } else if (type == 'all') { // 全部添加
  413. if (this.listData.length == 0) {
  414. this.$message.warning('暂时没有可添加的产品')
  415. return
  416. }
  417. params = {
  418. checkWarehouseSn: _this.$route.params.sn,
  419. allFlag: true,
  420. stockDetailDTO: this.queryParam
  421. }
  422. }
  423. this.spinning = true
  424. checkWarehouseDetailSaveBatch(params).then(res => {
  425. if (res.status == 200) {
  426. this.selectedRowKeys = []
  427. this.selectedRows = []
  428. this.$message.success(res.message)
  429. this.$refs.table.refresh()
  430. this.$refs.chooseTable.refresh()
  431. this.spinning = false
  432. } else {
  433. this.spinning = false
  434. }
  435. })
  436. },
  437. // 删除
  438. handleDel (row, isAll) {
  439. const _this = this
  440. let content
  441. if (isAll == 'batch') { // 批量
  442. if (this.chooseSelectedRowKeys.length == 0) {
  443. this.$message.warning('请选择需要批量删除的选项值后再操作!')
  444. return
  445. }
  446. content = '删除后不可恢复,确定要进行批量删除吗?'
  447. } else if (isAll == 'all') { // 全部
  448. content = '删除后不可恢复,确定要进行整单删除吗?'
  449. } else { // 单个
  450. content = '删除后不可恢复,确定要进行删除吗?'
  451. }
  452. this.$confirm({
  453. title: '提示',
  454. content: content,
  455. centered: true,
  456. onOk () {
  457. _this.spinning = true
  458. const params = { checkWarehouseSn: _this.$route.params.sn }
  459. if (isAll == 'batch') { // 批量
  460. params.idList = _this.chooseSelectedRowKeys
  461. } else if (isAll == 'all') { // 全部
  462. params.allFlag = true
  463. } else { // 单个
  464. params.id = row.id
  465. }
  466. checkWarehouseDetailDel(params).then(res => {
  467. if (res.status == 200) {
  468. _this.$message.success(res.message)
  469. _this.$refs.table.refresh()
  470. _this.$refs.chooseTable.refresh()
  471. if (isAll == 'batch') { // 批量
  472. _this.chooseSelectedRowKeys = []
  473. _this.chooseSelectedRows = []
  474. }
  475. _this.spinning = false
  476. } else {
  477. _this.spinning = false
  478. }
  479. })
  480. }
  481. })
  482. },
  483. // 返回列表
  484. handleBack () {
  485. this.$router.push({ path: '/inventoryManagement/inventoryChecking/list' })
  486. },
  487. // 查询基础信息
  488. getDetail () {
  489. checkWarehouseDetail({ sn: this.$route.params.sn }).then(res => {
  490. if (res.status == 200) {
  491. this.basicInfoData = res.data || null
  492. this.warehouseList = res.data.warehouseList || []
  493. } else {
  494. this.basicInfoData = null
  495. this.warehouseList = []
  496. }
  497. })
  498. },
  499. // 已选产品 重置
  500. chooseResetSearchForm () {
  501. this.chooseQueryParam.productCode = ''
  502. this.chooseQueryParam.productName = ''
  503. this.chooseQueryParam.warehouseSn = undefined
  504. this.chooseQueryParam.brandSn = undefined
  505. this.chooseQueryParam.productTypeSn1 = undefined
  506. this.chooseQueryParam.productTypeSn2 = undefined
  507. this.chooseQueryParam.productTypeSn3 = undefined
  508. this.chooseProductType = []
  509. this.$refs.chooseTable.refresh(true)
  510. },
  511. // 合计
  512. getDetailCount (params) {
  513. checkWarehouseDetailCount(Object.assign(this.chooseQueryParam, { checkWarehouseSn: this.$route.params.sn })).then(res => {
  514. if (res.status == 200) {
  515. this.productTotal = res.data
  516. } else {
  517. this.productTotal = null
  518. }
  519. })
  520. },
  521. // 提交
  522. handleSubmit () {
  523. const _this = this
  524. _this.spinning = true
  525. checkWarehouseSubmit({ id: this.$route.params.id }).then(res => {
  526. if (res.status == 200) {
  527. this.$message.success(res.message)
  528. setTimeout(() => {
  529. _this.handleBack()
  530. _this.spinning = false
  531. }, 1000)
  532. } else {
  533. _this.spinning = false
  534. }
  535. })
  536. },
  537. // 产品分类 change
  538. changeProductType (val, opt) {
  539. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  540. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  541. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  542. },
  543. changeChooseProductType (val, opt) {
  544. this.chooseQueryParam.productTypeSn1 = val[0] ? val[0] : ''
  545. this.chooseQueryParam.productTypeSn2 = val[1] ? val[1] : ''
  546. this.chooseQueryParam.productTypeSn3 = val[2] ? val[2] : ''
  547. },
  548. // 双击快速添加
  549. handleClickRow (record) {
  550. return {
  551. on: {
  552. dblclick: (event) => {
  553. this.handleAdd(record)
  554. }
  555. }
  556. }
  557. },
  558. onChange (selectedRowKeys, selectedRows) {
  559. this.selectedRowKeys = selectedRowKeys
  560. },
  561. onSelectChange (record, selected, selectedRows, nativeEvent) {
  562. if (selected) { // 选择
  563. this.selectedRows.push(record)
  564. } else { // 取消
  565. this.selectedRows = selectedRows
  566. }
  567. },
  568. // 本页全选/取消全选
  569. onSelectAllChange (selected, selectedRows, changeRows) {
  570. const _this = this
  571. if (selected) { // 选择
  572. this.selectedRows = [...this.selectedRows, ...changeRows]
  573. } else { // 取消
  574. const arrId = []
  575. this.selectedRows.map((item, index) => {
  576. this.selectedRows.map((subItem, ind) => {
  577. if (item.id == subItem.id) {
  578. arrId.push(index)
  579. }
  580. })
  581. })
  582. arrId.map((item, index) => {
  583. _this.selectedRows = _this.selectedRows.slice(item, item + 1)
  584. })
  585. }
  586. },
  587. onChooseChange (selectedRowKeys, selectedRows) {
  588. this.chooseSelectedRowKeys = selectedRowKeys
  589. },
  590. onChooseSelectChange (record, selected, selectedRows, nativeEvent) {
  591. const _this = this
  592. if (selected) { // 选择
  593. this.chooseSelectedRows.push(record)
  594. } else { // 取消
  595. const arrId = []
  596. this.chooseSelectedRows.map((item, index) => {
  597. if (item.id == record.id) {
  598. arrId.push(index)
  599. }
  600. })
  601. arrId.map((item, index) => {
  602. _this.chooseSelectedRows = _this.chooseSelectedRows.slice(item, item + 1)
  603. })
  604. }
  605. },
  606. // 本页全选/取消全选
  607. onChooseSelectAllChange (selected, selectedRows, changeRows) {
  608. const _this = this
  609. if (selected) { // 选择
  610. this.chooseSelectedRows = [...this.chooseSelectedRows, ...changeRows]
  611. } else { // 取消
  612. const arrId = []
  613. this.chooseSelectedRows.map((item, index) => {
  614. this.chooseSelectedRows.map((subItem, ind) => {
  615. if (item.id == subItem.id) {
  616. arrId.push(index)
  617. }
  618. })
  619. })
  620. arrId.map((item, index) => {
  621. _this.chooseSelectedRows = _this.chooseSelectedRows.slice(item, item + 1)
  622. })
  623. }
  624. }
  625. },
  626. mounted () {
  627. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  628. this.getDetail()
  629. this.resetSearchForm()
  630. this.chooseResetSearchForm()
  631. }
  632. },
  633. activated () {
  634. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  635. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  636. this.getDetail()
  637. this.resetSearchForm()
  638. this.chooseResetSearchForm()
  639. }
  640. },
  641. beforeRouteEnter (to, from, next) {
  642. next(vm => {})
  643. }
  644. }
  645. </script>
  646. <style lang="less">
  647. .inventoryCheckSelfDiskList-wrap{
  648. position: relative;
  649. height: 100%;
  650. padding-bottom: 51px;
  651. box-sizing: border-box;
  652. .inventoryCheckSelfDiskList-cont, .inventoryCheckSelfDiskList-back{
  653. margin-bottom: 10px;
  654. }
  655. .billno{
  656. font-size: 16px;
  657. font-weight: bold;
  658. margin: 0 15px;
  659. }
  660. >.ant-spin-nested-loading{
  661. overflow-y: scroll;
  662. height: 100%;
  663. }
  664. }
  665. </style>