123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <a-card size="small" :bordered="false" class="inventoryCheckAuditList-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="inventoryCheckAuditList-checkWarehouseNo" v-model.trim="queryParam.checkWarehouseNo" allowClear placeholder="请输入盘点单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="盘点完成时间">
- <rangeDate ref="rangeDate" @change="dateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <span class="table-page-search-submitButtons">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryCheckAuditList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="inventoryCheckAuditList-reset">重置</a-button>
- </span>
- </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 style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_inventoryCheckingDetail')" @click="handleDetail(record)">{{ record.checkWarehouseNo }}</span>
- <span v-else>{{ record.checkWarehouseNo }}</span>
- </template>
- <!-- 盈亏数量 -->
- <template slot="totalLossQty" slot-scope="text, record">
- <span>{{ (record.totalLossQty || record.totalLossQty==0) ? Math.abs(record.totalLossQty) : '--' }}</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- v-if="record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit')"
- type="link"
- class="button-info"
- @click="handleExamine(record, true)"
- id="warehousingAudit-adopt-btn">通过</a-button>
- <a-button
- size="small"
- v-if="record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit')"
- type="link"
- class="button-warning"
- @click="handleExamine(record, false)"
- id="warehousingAudit-unadopt-btn">不通过</a-button>
- <span v-if="!(record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit'))">--</span>
- </template>
- </s-table>
- </a-spin>
- <!-- 详情 -->
- <inventoryChecking-detail-modal :openModal="openDetailModal" :itemSn="itemSn" @close="handleDetailClose" />
- </a-card>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import rangeDate from '@/views/common/rangeDate.vue'
- import inventoryCheckingDetailModal from '@/views/inventoryManagement/inventoryChecking/detailModal.vue'
- import { checkWarehouseAuditList, checkWarehouseFinanceAudit } from '@/api/checkWarehouse'
- export default {
- components: { STable, VSelect, rangeDate, inventoryCheckingDetailModal },
- data () {
- return {
- spinning: false,
- disabled: false, // 查询、重置按钮是否可操作
- tableHeight: 0,
- // 查询参数
- queryParam: {
- beginDate: undefined,
- endDate: undefined,
- checkWarehouseNo: ''
- },
- // 表头
- columns: [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '盘点单号', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '17%', align: 'center' },
- { title: '总款数', dataIndex: 'productTotalCategory', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '总数量', dataIndex: 'totalStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '总成本', dataIndex: 'totalStockCost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '盘盈数量', dataIndex: 'totalProfitQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '盘亏数量', scopedSlots: { customRender: 'totalLossQty' }, width: '7%', align: 'center' },
- { title: '盘点完成时间', dataIndex: 'checkTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '财务审核时间', dataIndex: 'financeAuditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '财务审核状态', dataIndex: 'stateDictValue', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', align: 'center' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return checkWarehouseAuditList(Object.assign(parameter, this.queryParam)).then(res => {
- const 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
- data.list[i].financeFinishTime = data.list[i].financeAuditTime
- }
- this.disabled = false
- this.spinning = false
- return data
- })
- },
- productTotal: null,
- openDetailModal: false,
- itemSn: null
- }
- },
- methods: {
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- // 详情
- handleDetail (row) {
- this.itemSn = row.checkWarehouseSn
- this.openDetailModal = true
- },
- handleDetailClose () {
- this.itemSn = null
- this.openDetailModal = false
- },
- // 审核
- handleExamine (row, type) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确定要进行' + (type ? ' 通过 ' : ' 不通过 ') + '操作吗?',
- centered: true,
- onOk () {
- _this.spinning = true
- checkWarehouseFinanceAudit({ id: row.id, auditFlag: type }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate()
- this.queryParam.beginDate = undefined
- this.queryParam.endDate = undefined
- this.queryParam.checkWarehouseNo = ''
- this.$refs.table.refresh(true)
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 195
- }
- },
- watch: {
- advanced (newValue, oldValue) {
- const _this = this
- setTimeout(() => {
- _this.setTableH()
- }, 400)
- },
- '$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()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
|