selfDisk.vue 28 KB

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