list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="入库单号">
  10. <a-input id="warehousingConfirmationList-stockPutNo" v-model.trim="queryParam.stockPutNo" allowClear placeholder="请输入入库单号"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="单据状态">
  15. <v-select
  16. v-model="queryParam.auditState"
  17. ref="auditState"
  18. id="warehousingConfirmationList-auditState"
  19. code="PUT_CONFIRM_STATE"
  20. placeholder="请选择单据状态"
  21. allowClear></v-select>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="业务单号">
  26. <a-input id="warehousingConfirmationList-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入业务单号"/>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="入库类型">
  31. <v-select
  32. v-model="queryParam.incomingType"
  33. id="warehousingConfirmationList-incomingType"
  34. code="PUT_CONFIRM_STATE"
  35. placeholder="请选择入库类型"
  36. allowClear></v-select>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :md="6" :sm="24" v-show="isShowWarehouse">
  40. <a-form-model-item label="仓库">
  41. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  42. </a-form-model-item>
  43. </a-col>
  44. <a-col :md="isShowWarehouse?6:24" :sm="24" style="margin-bottom: 10px;" :style="{textAlign:isShowWarehouse?'left':'center'}">
  45. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="warehousingConfirmationList-refresh">查询</a-button>
  46. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="warehousingConfirmationList-reset">重置</a-button>
  47. </a-col>
  48. </a-row>
  49. </a-form>
  50. </div>
  51. </a-card>
  52. <a-card size="small" :bordered="false" class="warehousingConfirmationList-wrap">
  53. <a-spin :spinning="spinning" tip="Loading...">
  54. <!-- 列表 -->
  55. <div v-if="$hasPermissions('B_warehousingConfirmationpl')" style="margin-bottom: 10px">
  56. <a-button type="primary" id="warehousingConfirmationList-export" :loading="loading" @click="handleBatchAudit">批量确认</a-button>
  57. <span style="margin-left: 10px">
  58. <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0"> {{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }} </template>
  59. </span>
  60. </div>
  61. <s-table
  62. class="sTable fixPagination"
  63. ref="table"
  64. :style="{ height: tableHeight+70+'px' }"
  65. size="small"
  66. :rowKey="(record) => record.stockPutSn"
  67. rowKeyName="stockPutSn"
  68. :row-selection="$hasPermissions('B_warehousingConfirmationpl') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.auditState != 'WAIT' } }) } : null"
  69. @rowSelection="rowSelectionFun"
  70. :columns="columns"
  71. :data="loadData"
  72. :pageSize="30"
  73. :scroll="{ y: tableHeight }"
  74. :defaultLoadData="false"
  75. bordered>
  76. <!-- 入库单号 -->
  77. <template slot="stockPutNo" slot-scope="text, record">
  78. <span :id="'warehousingConfirmationList-detail-'+record.stockPutNo" v-if="$hasPermissions('B_warehousingConfirmationDetail')" class="link-bule" @click="handleDetail(record)">{{ record.stockPutNo }}</span>
  79. <span v-else>{{ record.stockPutNo }}</span>
  80. </template>
  81. <!-- 操作 -->
  82. <template slot="action" slot-scope="text, record">
  83. <a-button
  84. size="small"
  85. type="link"
  86. v-if="record.auditState=='WAIT' && $hasPermissions('B_warehousingConfirmationAlone')"
  87. class="button-info"
  88. @click="handleAudit(record)"
  89. :id="'warehousingConfirmationList-audit-btn-'+record.stockPutNo">入库确认</a-button>
  90. <span v-else>--</span>
  91. </template>
  92. </s-table>
  93. </a-spin>
  94. <!-- 查看 -->
  95. <confirmation-detail-modal v-drag :openModal="openModal" :itemSn="itemSn" :nowData="nowData" @close="closeModal" />
  96. <!-- 入库确认 -->
  97. <a-modal
  98. centered
  99. v-drag
  100. class="confirmation-modal"
  101. :footer="null"
  102. :maskClosable="false"
  103. v-model="confirmationModal"
  104. @cancel="confirmationModal=false"
  105. :width="416">
  106. <div class="confirmation-main">
  107. <a-icon type="question-circle" style="color: #faad14;font-size: 22px;margin-right: 16px;" />
  108. <div class="confirmation-cont">
  109. <p class="confirmation-tit">提示</p>
  110. <p class="confirmation-txt">请点击下方按钮确认操作?</p>
  111. </div>
  112. </div>
  113. <div class="btn-box">
  114. <a-button id="confir-ruku-cancel" type="primary" :loading="spinning" class="button-error" @click="handleConfirmationFail">不通过</a-button>
  115. <a-button id="confir-ruku-ok" type="primary" :loading="spinning" class="button-info" @click="handleConfirmationOk">通过</a-button>
  116. </div>
  117. </a-modal>
  118. </a-card>
  119. </div>
  120. </template>
  121. <script>
  122. import { commonMixin } from '@/utils/mixin'
  123. import { STable, VSelect } from '@/components'
  124. import confirmationDetailModal from './detailModal.vue'
  125. import chooseWarehouse from '@/views/common/chooseWarehouse'
  126. import { stockPutList, stockPutConfirm } from '@/api/stockPut'
  127. export default {
  128. name: 'WarehousingConfirmationList',
  129. mixins: [commonMixin],
  130. components: { STable, VSelect, confirmationDetailModal, chooseWarehouse },
  131. data () {
  132. return {
  133. spinning: false,
  134. loading: false,
  135. queryParam: { // 查询条件
  136. stockPutNo: '', // 入库单号
  137. auditState: undefined, // 状态
  138. warehouseSn: undefined // 仓库
  139. },
  140. tableHeight: 0, // 表格高度
  141. disabled: false, // 查询、重置按钮是否可操作
  142. // 加载数据方法 必须为 Promise 对象
  143. loadData: parameter => {
  144. this.disabled = true
  145. this.spinning = true
  146. return stockPutList(Object.assign(parameter, this.queryParam, { confirm: true })).then(res => {
  147. let data
  148. if (res.status == 200) {
  149. data = res.data
  150. this.disabled = false
  151. }
  152. this.spinning = false
  153. return data
  154. })
  155. },
  156. openModal: false, // 详情弹框
  157. itemSn: '', // 详情弹框单据sn
  158. nowData: null, // 详情弹框当前操作数据
  159. confirmationModal: false, // 入库确认弹框
  160. confirmationInfo: null, // 确认入库得单据数据
  161. isBatch: false, // 是否批量确认入库
  162. rowSelectionInfo: null // 批量操作已选数据
  163. }
  164. },
  165. computed: {
  166. // 列表表头
  167. columns () {
  168. const arr = [
  169. { title: '入库时间', dataIndex: 'putTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  170. { title: '入库单号', scopedSlots: { customRender: 'stockPutNo' }, width: '12%', align: 'center' },
  171. { title: '业务单号', dataIndex: 'stockPutNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  172. { title: '商户名称', dataIndex: 'providerName', align: 'left', width: '18%', customRender: function (text) { return text || '--' }, ellipsis: true },
  173. { title: '入库数量', dataIndex: 'productTotalQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  174. { title: '入库类型', dataIndex: 'putBizTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  175. { title: '单据状态', dataIndex: 'auditStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  176. { title: '财务审核时间', dataIndex: 'auditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  177. { title: '备注', dataIndex: 'remark', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  178. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  179. ]
  180. // 是否显示仓库
  181. if (this.isShowWarehouse) {
  182. arr.splice(3, 0, { title: '仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
  183. }
  184. if (this.$hasPermissions('M_warehousingConfirmationList_costPrice')) { // 成本价权限
  185. arr.splice(this.isShowWarehouse ? 5 : 4, 0, { title: '入库成本', dataIndex: 'productTotalCost', width: '7%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  186. }
  187. return arr
  188. }
  189. },
  190. methods: {
  191. // 表格选中项
  192. rowSelectionFun (obj) {
  193. this.rowSelectionInfo = obj || null
  194. },
  195. // 重置
  196. resetSearchForm () {
  197. this.queryParam.stockPutNo = ''
  198. this.queryParam.auditState = undefined
  199. this.queryParam.warehouseSn = undefined
  200. this.$refs.table.refresh(true)
  201. },
  202. // 详情
  203. handleDetail (row) {
  204. if (this.$hasPermissions('B_warehousingConfirmationDetail')) {
  205. this.itemSn = row.stockPutSn
  206. this.nowData = row
  207. this.openModal = true
  208. }
  209. },
  210. // 关闭详情弹框
  211. closeModal () {
  212. this.itemSn = ''
  213. this.nowData = null
  214. this.openModal = false
  215. },
  216. // 入库确认通过
  217. handleConfirmationOk () {
  218. if (this.isBatch) { // 批量
  219. this.auditOrder(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, true)
  220. } else {
  221. this.auditOrder([this.confirmationInfo.stockPutSn], true)
  222. }
  223. },
  224. // 入库确认不通过
  225. handleConfirmationFail () {
  226. if (this.isBatch) { // 批量
  227. this.auditOrder(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, false)
  228. } else {
  229. this.auditOrder([this.confirmationInfo.stockPutSn], false)
  230. }
  231. },
  232. // 打开入库确认
  233. handleAudit (row) {
  234. this.confirmationInfo = row
  235. this.isBatch = false
  236. this.confirmationModal = true
  237. },
  238. // 入库确认接口调用
  239. auditOrder (snList, flag) {
  240. const _this = this
  241. if (this.isBatch) {
  242. _this.loading = true
  243. }
  244. _this.spinning = true
  245. stockPutConfirm({ stockPutSnList: snList, confirm: flag }).then(res => {
  246. if (this.isBatch) {
  247. _this.loading = false
  248. }
  249. if (res.status == 200) {
  250. if (this.isBatch) {
  251. _this.$refs.table.clearSelected() // 清空表格选中项
  252. }
  253. _this.$message.success(res.message)
  254. _this.$refs.table.refresh()
  255. _this.confirmationModal = false
  256. _this.spinning = false
  257. } else {
  258. _this.confirmationModal = false
  259. _this.spinning = false
  260. }
  261. })
  262. },
  263. // 批量入库确认
  264. handleBatchAudit () {
  265. const _this = this
  266. if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  267. _this.$message.warning('请在列表勾选后再进行批量操作!')
  268. return
  269. }
  270. this.isBatch = true
  271. this.confirmationModal = true
  272. },
  273. // 页面初始
  274. pageInit () {
  275. const _this = this
  276. this.$nextTick(() => { // 页面渲染完成后的回调
  277. _this.setTableH()
  278. })
  279. this.rowSelectionInfo = null
  280. this.$refs.table.clearTable()
  281. },
  282. // 表格高度
  283. setTableH () {
  284. const tableSearchH = this.$refs.tableSearch.offsetHeight
  285. this.tableHeight = window.innerHeight - tableSearchH - 240
  286. }
  287. },
  288. watch: {
  289. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  290. this.setTableH()
  291. }
  292. },
  293. mounted () {
  294. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  295. this.pageInit()
  296. this.resetSearchForm()
  297. }
  298. },
  299. activated () {
  300. // 如果是新页签打开,则重置当前页面
  301. if (this.$store.state.app.isNewTab) {
  302. this.pageInit()
  303. this.resetSearchForm()
  304. }
  305. // 仅刷新列表,不重置页面
  306. if (this.$store.state.app.updateList) {
  307. this.pageInit()
  308. this.$refs.table.refresh()
  309. }
  310. },
  311. beforeRouteEnter (to, from, next) {
  312. next(vm => {})
  313. }
  314. }
  315. </script>
  316. <style lang="less">
  317. .active{
  318. color: #ed1c24;
  319. cursor: pointer;
  320. }
  321. .common{
  322. color: rgba(0, 0, 0);
  323. }
  324. .confirmation-modal{
  325. .ant-modal-body{
  326. padding: 32px 32px 24px;
  327. }
  328. .confirmation-main{
  329. display: flex;
  330. .confirmation-cont{
  331. .confirmation-tit{
  332. color: rgba(0, 0, 0);
  333. font-weight: 500;
  334. font-size: 16px;
  335. line-height: 1.4;
  336. margin: 0;
  337. }
  338. .confirmation-txt{
  339. margin: 8px 0 0;
  340. color: rgba(0, 0, 0);
  341. font-size: 14px;
  342. line-height: 1.5;
  343. }
  344. }
  345. }
  346. .btn-box{
  347. text-align: right;
  348. margin-top: 24px;
  349. }
  350. }
  351. </style>