selfDisk.vue 28 KB

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