123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <template>
- <a-card size="small" :bordered="false" class="warehouseAllocationList-wrap">
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" ref="searchForm" :model="queryParam" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <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">
- <a-form-item label="调出仓库">
- <a-select id="warehouseAllocation-basicInfo-outWarehouseSn" allowClear placeholder="请选择调出仓库" v-model="queryParam.outWarehouseSn">
- <a-select-option v-for="(item, index) in warehouseList" :key="index" :value="item.warehouseSn">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="调入仓库">
- <a-select id="warehouseAllocation-basicInfo-putWarehouseSn" allowClear placeholder="请选择调入仓库" v-model="queryParam.putWarehouseSn">
- <a-select-option v-for="(item, index) in warehouseList" :key="index" :value="item.warehouseSn">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="业务状态">
- <v-select
- v-model="queryParam.state"
- ref="state"
- id="warehouseAllocationList-state"
- code="ALLOCATION_WAREHOUSE_STATE"
- placeholder="请选择业务状态"
- allowClear
- ></v-select>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="warehouseAllocationList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="warehouseAllocationList-reset">重置</a-button>
- <a @click="advanced = !advanced" style="margin-left: 8px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'" />
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮 -->
- <div class="table-operator"><a-button id="warehouseAllocationList-add" type="primary" class="button-error" @click="openModal = true">新增</a-button></div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="default"
- :rowKey="record => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ x: 1500, y: tableHeight }"
- bordered>
- <!-- 单号 -->
- <template slot="allocationWarehouseNo" slot-scope="text, record">
- <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.allocationWarehouseNo }}</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- v-if="record.state == 'WAIT_AUDIT'"
- size="small"
- type="link"
- class="button-warning"
- @click="handleExamine(record)"
- id="warehouseAllocationList-examine-btn">
- 审核
- </a-button>
- <a-button
- v-if="(record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT')"
- size="small"
- type="link"
- class="button-info"
- @click="handleEdit(record)"
- id="warehouseAllocationList-edit-btn">
- 编辑
- </a-button>
- <a-button
- v-if="(record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT')"
- size="small"
- type="link"
- class="button-error"
- @click="handleDel(record)"
- id="warehouseAllocationList-del-btn">
- 删除
- </a-button>
- <span v-if="(record.state != 'WAIT_SUBMIT') && (record.state != 'WAIT_AUDIT')">--</span>
- </template>
- </s-table>
- <!-- 新增/编辑 -->
- <basic-info-modal :openModal="openModal" @ok="handleEdit" @close="openModal=false" />
- </a-card>
- </template>
- <script>
- import { allocWarehouseList, allocWarehouseAudit, allocWarehouseDel } from '@/api/allocWarehouse'
- import { warehouseAllList } from '@/api/warehouse.js'
- import { STable, VSelect } from '@/components'
- import basicInfoModal from './basicInfoModal.vue'
- import rangeDate from '@/views/common/rangeDate.vue'
- export default {
- components: { STable, VSelect, basicInfoModal, rangeDate },
- data () {
- return {
- advanced: false, // 高级搜索 展开/关闭
- tableHeight: 0,
- warehouseList: [], // 仓库列表
- queryParam: { // 查询条件
- beginDate: '',
- endDate: '',
- outWarehouseSn: undefined, // 调出仓库
- putWarehouseSn: undefined, // 调入仓库
- state: undefined // 审核状态
- },
- disabled: false, // 查询、重置按钮是否可操作
- columns: [
- { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
- { title: '单号', scopedSlots: { customRender: 'allocationWarehouseNo' }, align: 'center' },
- { title: '调出仓库', dataIndex: 'outWarehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '调入仓库', dataIndex: 'putWarehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '业务状态', dataIndex: 'stateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- if (this.tableHeight == 0) {
- this.tableHeight = window.innerHeight - 380
- }
- return allocWarehouseList(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
- }
- this.disabled = false
- return data
- })
- },
- openModal: false // 新增编辑 弹框
- }
- },
- methods: {
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- // 获取仓库列表
- getWarehouseList () {
- warehouseAllList({}).then(res => {
- if (res.status == 200) {
- this.warehouseList = res.data || []
- } else {
- this.warehouseList = []
- }
- })
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate()
- this.queryParam.beginDate = ''
- this.queryParam.endDate = ''
- this.queryParam.outWarehouseSn = undefined
- this.queryParam.putWarehouseSn = undefined
- this.queryParam.state = undefined
- this.$refs.table.refresh(true)
- },
- // 删除
- handleDel (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '删除后不可恢复,确定要进行删除吗?',
- centered: true,
- onOk () {
- allocWarehouseDel({ id: row.id }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- }
- })
- }
- })
- },
- // 审核
- handleExamine (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确认要审核通过吗?',
- centered: true,
- onOk () {
- allocWarehouseAudit({ allocationWarehouseSn: row.allocationWarehouseSn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- }
- })
- }
- })
- },
- // 详情
- handleDetail (row) {
- this.$router.push({ path: `/allocationManagement/warehouseAllocation/detail/${row.allocationWarehouseSn}` })
- },
- // 新增/编辑
- handleEdit (row) {
- this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${row.id}/${row.allocationWarehouseSn}` })
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {
- vm.queryParam.outWarehouseSn = undefined
- vm.queryParam.putWarehouseSn = undefined
- vm.queryParam.state = undefined
- vm.queryParam.beginDate = ''
- vm.queryParam.endDate = ''
- vm.getWarehouseList()
- })
- }
- }
- </script>
|