selfDisk.vue 28 KB

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