selfDisk.vue 28 KB

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