123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template>
- <a-card size="small" :bordered="false" class="warehousingConfirmationList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="入库单号">
- <a-input id="warehousingConfirmationList-stockPutNo" v-model.trim="queryParam.stockPutNo" allowClear placeholder="请输入入库单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="单据状态">
- <v-select
- v-model="queryParam.auditState"
- ref="auditState"
- id="warehousingConfirmationList-auditState"
- code="PUT_CONFIRM_STATE"
- placeholder="请选择单据状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="warehousingConfirmationList-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="warehousingConfirmationList-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 列表 -->
- <div v-if="$hasPermissions('B_warehousingConfirmationpl')" style="margin-bottom: 10px">
- <a-button type="primary" class="button-error" id="warehousingConfirmationList-export" :loading="loading" @click="handleBatchAudit">批量确认</a-button>
- <span style="margin-left: 5px">
- <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0"> {{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }} </template>
- </span>
- </div>
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- :rowKey="(record) => record.stockPutSn"
- rowKeyName="stockPutSn"
- :row-selection="$hasPermissions('B_warehousingConfirmationpl') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.auditState != 'WAIT' } }) } : null"
- @rowSelection="rowSelectionFun"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- bordered>
- <!-- 入库单号 -->
- <template slot="stockPutNo" slot-scope="text, record">
- <span :class="$hasPermissions('B_warehousingConfirmationDetail')?'active':'common'" @click="handleDetail(record)">{{ record.stockPutNo }}</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- v-if="record.auditState=='WAIT' && $hasPermissions('B_warehousingConfirmationAlone')"
- class="button-warning"
- @click="handleAudit(record)"
- id="warehousingConfirmationList-audit-btn">入库确认</a-button>
- <span v-else>--</span>
- </template>
- </s-table>
- </a-spin>
- <!-- 查看 -->
- <confirmation-detail-modal :openModal="openModal" :itemSn="itemSn" :nowData="nowData" @close="closeModal" />
- <!-- 入库确认 -->
- <a-modal
- centered
- class="confirmation-modal"
- :footer="null"
- :maskClosable="false"
- v-model="confirmationModal"
- @cancle="confirmationModal=false"
- :width="416">
- <div class="confirmation-main">
- <a-icon type="question-circle" style="color: #faad14;font-size: 22px;margin-right: 16px;" />
- <div class="confirmation-cont">
- <p class="confirmation-tit">提示</p>
- <p class="confirmation-txt">请点击下方按钮确认操作?</p>
- </div>
- </div>
- <div class="btn-box">
- <a-button type="primary" class="button-error" @click="handleConfirmationFail">不通过</a-button>
- <a-button type="primary" class="button-info" @click="handleConfirmationOk">通过</a-button>
- </div>
- </a-modal>
- </a-card>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import confirmationDetailModal from './detailModal.vue'
- import { stockPutList, stockPutConfirm } from '@/api/stockPut'
- export default {
- components: { STable, VSelect, confirmationDetailModal },
- data () {
- return {
- spinning: false,
- queryParam: { // 查询条件
- stockPutNo: '', // 入库单号
- auditState: undefined // 状态
- },
- tableHeight: 0,
- disabled: false, // 查询、重置按钮是否可操作
- loading: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return stockPutList(Object.assign(parameter, this.queryParam, { confirm: true })).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- },
- openModal: false,
- itemSn: '',
- nowData: null,
- confirmationModal: false,
- confirmationInfo: null,
- isBatch: false,
- rowSelectionInfo: null
- }
- },
- computed: {
- // 列表表头
- columns () {
- const arr = [
- { title: '入库时间', dataIndex: 'putTime', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '入库单号', scopedSlots: { customRender: 'stockPutNo' }, width: '16%', align: 'center' },
- { title: '商户名称', dataIndex: 'providerName', align: 'left', width: '22%', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '入库数量', dataIndex: 'productTotalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- // { title: '入库成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '入库类型', dataIndex: 'putBizTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '单据状态', dataIndex: 'auditStateDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '财务审核时间', dataIndex: 'auditTime', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '备注', dataIndex: 'remark', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
- ]
- if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
- arr.splice(4, 0, { title: '入库成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- return arr
- }
- },
- methods: {
- // 表格选中项
- rowSelectionFun (obj) {
- this.rowSelectionInfo = obj || null
- },
- // 重置
- resetSearchForm () {
- this.queryParam.stockPutNo = ''
- this.queryParam.auditState = undefined
- this.$refs.table.refresh(true)
- },
- // 详情
- handleDetail (row) {
- if (this.$hasPermissions('B_warehousingConfirmationDetail')) {
- this.itemSn = row.stockPutSn
- this.nowData = row
- this.openModal = true
- }
- },
- closeModal () {
- this.itemSn = ''
- this.nowData = null
- this.openModal = false
- },
- // 通过
- handleConfirmationOk () {
- if (this.isBatch) { // 批量
- this.auditOrder(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, true)
- } else {
- this.auditOrder([this.confirmationInfo.stockPutSn], true)
- }
- },
- // 不通过
- handleConfirmationFail () {
- if (this.isBatch) { // 批量
- this.auditOrder(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, false)
- } else {
- this.auditOrder([this.confirmationInfo.stockPutSn], false)
- }
- },
- // 单个审核
- handleAudit (row) {
- this.confirmationInfo = row
- this.isBatch = false
- this.confirmationModal = true
- },
- auditOrder (snList, flag) {
- const _this = this
- if (this.isBatch) {
- _this.loading = true
- }
- _this.spinning = true
- stockPutConfirm({ stockPutSnList: snList, confirm: flag }).then(res => {
- if (this.isBatch) {
- _this.loading = false
- }
- if (res.status == 200) {
- if (this.isBatch) {
- _this.$refs.table.clearSelected() // 清空表格选中项
- }
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.confirmationModal = false
- _this.spinning = false
- } else {
- _this.confirmationModal = false
- _this.spinning = false
- }
- })
- },
- // 批量审核
- handleBatchAudit () {
- const _this = this
- if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
- _this.$message.warning('请在列表勾选后再进行批量操作!')
- return
- }
- this.isBatch = true
- this.confirmationModal = true
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 235
- }
- },
- watch: {
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- // 仅刷新列表,不重置页面
- if (this.$store.state.app.updateList) {
- this.pageInit()
- this.$refs.table.refresh()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .active{
- color: #ed1c24;
- cursor: pointer;
- }
- .common{
- color: rgba(0, 0, 0);
- }
- .confirmation-modal{
- .ant-modal-body{
- padding: 32px 32px 24px;
- }
- .confirmation-main{
- display: flex;
- .confirmation-cont{
- .confirmation-tit{
- color: rgba(0, 0, 0);
- font-weight: 500;
- font-size: 16px;
- line-height: 1.4;
- margin: 0;
- }
- .confirmation-txt{
- margin: 8px 0 0;
- color: rgba(0, 0, 0);
- font-size: 14px;
- line-height: 1.5;
- }
- }
- }
- .btn-box{
- text-align: right;
- margin-top: 24px;
- }
- }
- </style>
|