123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- <template>
- <a-card size="small" :bordered="false" class="inventoryConfirmationList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 标签页 -->
- <a-tabs type="card" :default-active-key="queryParam.state" @change="handleTabChange" class="inventoryConfirmationList-tabs">
- <a-tab-pane v-for="item in tabPaneData" :key="item.type">
- <span slot="tab">{{ item.name }}</span>
- </a-tab-pane>
- </a-tabs>
- <!-- 搜索条件 -->
- <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="inventoryConfirmationList-checkWarehouseNo" v-model.trim="queryParam.checkWarehouseNo" allowClear placeholder="请输入盘点单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="仓库">
- <chooseWarehouse ref="warehouse" isPermission v-model="queryParam.warehouseSn"></chooseWarehouse>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryConfirmationList-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryConfirmationList-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- bordered>
- <!-- 单号 -->
- <template slot="checkWarehouseNo" slot-scope="text, record">
- <span v-if="$hasPermissions('B_inventoryConfirmationDetail')" class="link-bule" @click="handleDetail(record)">{{ record.checkWarehouseNo }}</span>
- <span v-else>{{ record.checkWarehouseNo }}</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- class="button-info"
- v-if="$hasPermissions('B_inventoryConfirmationConfirm')"
- @click="handleConfirm(record)"
- id="inventoryConfirmationList-audit-btn">盘点确认</a-button>
- <a-button
- size="small"
- type="link"
- class="button-success"
- v-if="$hasPermissions('B_inventoryConfirmationCheck')"
- @click="handleCheck(record)"
- id="inventoryConfirmationList-audit-btn">重新盘点</a-button>
- <span v-if="!($hasPermissions('B_inventoryConfirmationConfirm') && $hasPermissions('B_inventoryConfirmationCheck'))">--</span>
- </template>
- </s-table>
- </a-spin>
- </a-card>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import chooseWarehouse from '@/views/common/chooseWarehouse'
- import { verifyQueryPage, checkWarehouseReCheck, checkWarehouseFinanceAudit } from '@/api/checkWarehouse'
- export default {
- name: 'InventoryConfirmationList',
- mixins: [commonMixin],
- components: { STable, VSelect, chooseWarehouse },
- data () {
- return {
- spinning: false,
- tableHeight: 0,
- queryParam: { // 查询条件
- deleteFlag: '0',
- state: 'WAIT_FINANCE_AUDIT',
- checkWarehouseNo: '',
- warehouseSn: undefined
- },
- disabled: false, // 查询、重置按钮是否可操作
- tabPaneData: [
- { name: '未完结', type: 'WAIT_FINANCE_AUDIT' },
- { name: '已完结', type: 'FINISH' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return verifyQueryPage(Object.assign(parameter, this.queryParam)).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- }
- }
- },
- computed: {
- columns () {
- let arr = []
- if (this.queryParam.state == 'WAIT_FINANCE_AUDIT') { // 未完结
- arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '盘点单号', dataIndex: 'checkWarehouseNo', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '15%', align: 'center' },
- { title: '盘点状态', dataIndex: 'checkStateDictValue', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '监盘状态', dataIndex: 'checkSuperviseStateDictValue', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '盘点人', dataIndex: 'checkPersonName', align: 'center', width: '14%', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '仓库', dataIndex: 'warehouseName', align: 'center', width: '14%', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '盘点时间', dataIndex: 'checkTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '监盘人', dataIndex: 'checkSupervisePersonName', align: 'center', width: '14%', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '监盘时间', dataIndex: 'checkSuperviseTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
- ]
- } else if (this.queryParam.state == 'FINISH') { // 已完结
- arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '盘点单号', dataIndex: 'checkWarehouseNo', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '14%', align: 'center' },
- { title: '盘点状态', dataIndex: 'checkStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '监盘状态', dataIndex: 'checkSuperviseStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '盘点人', dataIndex: 'checkPersonName', align: 'center', width: '16%', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '仓库', dataIndex: 'warehouseName', align: 'center', width: '16%', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '盘点时间', dataIndex: 'checkTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '监盘人', dataIndex: 'checkSupervisePersonName', align: 'center', width: '16%', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '监盘时间', dataIndex: 'checkSuperviseTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '财务确认时间', dataIndex: 'financeAuditTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
- ]
- }
- return arr
- }
- },
- methods: {
- // 选择类型
- handleTabChange (key) {
- this.queryParam.state = key
- this.$refs.table.refresh(true)
- },
- // 详情
- handleDetail (row) {
- if (this.$hasPermissions('B_inventoryConfirmationDetail')) {
- this.$router.push({ name:"inventoryConfirmationDetail",params:{sn:row.checkWarehouseSn} })
- }
- },
- // 盘点确认
- handleConfirm (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确认盘点结果正确无误吗?',
- centered: true,
- closable: true,
- onOk () {
- _this.spinning = true
- checkWarehouseFinanceAudit({ checkWarehouseSn: row.checkWarehouseSn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh(true)
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 重新盘点
- handleCheck (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确认要重新盘点吗?',
- centered: true,
- closable: true,
- onOk () {
- _this.spinning = true
- checkWarehouseReCheck({ checkWarehouseSn: row.checkWarehouseSn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh(true)
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- resetSearchForm () {
- this.queryParam.checkWarehouseNo = ''
- this.queryParam.warehouseSn = undefined
- this.$refs.table.refresh(true)
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- setTableH () {
- this.tableHeight = window.innerHeight - 295
- }
- },
- watch: {
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.$refs.table.refresh(true)
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.$refs.table.refresh(true)
- }
- // 仅刷新列表,不重置页面
- if (this.$store.state.app.updateList) {
- this.pageInit()
- this.$refs.table.refresh()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .inventoryConfirmationList-wrap{
- .active{
- color: #ed1c24;
- cursor: pointer;
- }
- .common{
- color: rgba(0, 0, 0);
- }
- // tab样式
- .inventoryConfirmationList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
- height: 30px!important;
- }
- .inventoryConfirmationList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
- height: 30px!important;
- }
- .inventoryConfirmationList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
- line-height: 26px!important;
- height: 30px!important;
- }
- }
- </style>
|