1.添加货位字典路由和页面文件
							parent
							
								
									0d20d94865
								
							
						
					
					
						commit
						bf433baf6e
					
				@ -0,0 +1,3 @@
 | 
				
			||||
import axios from "../../utils/axios";
 | 
				
			||||
 | 
				
			||||
 | 
				
			||||
@ -0,0 +1,240 @@
 | 
				
			||||
<template>
 | 
				
			||||
    <div>
 | 
				
			||||
        <el-card>
 | 
				
			||||
            <el-form :inline="true" :model="filterQuery" size="mini">
 | 
				
			||||
                <el-row style="width: 100%">
 | 
				
			||||
                    <el-form-item class="query-form-item">
 | 
				
			||||
                        <el-input v-model="filterQuery.key" placeholder="请输入查询内容" clearable></el-input>
 | 
				
			||||
                    </el-form-item>
 | 
				
			||||
                    <el-form-item class="query-form-item">
 | 
				
			||||
                        <el-select v-model="filterQuery.invStorageCode" placeholder="请选择当前仓库" clearable="true"
 | 
				
			||||
                                   @change="invChange"
 | 
				
			||||
                                   size="mini">
 | 
				
			||||
                            <el-option
 | 
				
			||||
                                v-for="item in storageList"
 | 
				
			||||
                                :key="item.name"
 | 
				
			||||
                                :label="item.name"
 | 
				
			||||
                                :value="item.code">
 | 
				
			||||
                                <span style="float: left">{{ item.name }}</span>
 | 
				
			||||
                            </el-option>
 | 
				
			||||
                        </el-select>
 | 
				
			||||
                    </el-form-item>
 | 
				
			||||
                    <el-form-item class="query-form-item">
 | 
				
			||||
                        <el-select v-model="filterQuery.invWarehouseCode" placeholder="请选择当前分库" clearable="true"
 | 
				
			||||
                                   :disabled="invWarehouseDisabled"
 | 
				
			||||
                                   size="mini">
 | 
				
			||||
                            <el-option
 | 
				
			||||
                                v-for="item in subInvList"
 | 
				
			||||
                                :key="item.name"
 | 
				
			||||
                                :label="item.name"
 | 
				
			||||
                                :value="item.code">
 | 
				
			||||
                                <span style="float: left">{{ item.name }}</span>
 | 
				
			||||
                            </el-option>
 | 
				
			||||
                        </el-select>
 | 
				
			||||
                    </el-form-item>
 | 
				
			||||
                    <el-form-item>
 | 
				
			||||
                        <el-button-group>
 | 
				
			||||
                            <el-button
 | 
				
			||||
                                type="primary"
 | 
				
			||||
                                icon="el-icon-refresh"
 | 
				
			||||
                                @click="onReset"
 | 
				
			||||
                            ></el-button>
 | 
				
			||||
                            <el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
 | 
				
			||||
                            <el-button type="primary" icon="search" @click="addSpace">新增货位</el-button>
 | 
				
			||||
                        </el-button-group>
 | 
				
			||||
                    </el-form-item>
 | 
				
			||||
                </el-row>
 | 
				
			||||
            </el-form>
 | 
				
			||||
            <el-table v-loading="loading" :data="list" style="width: 100%">
 | 
				
			||||
                <el-table-column label="序号" type="index"></el-table-column>
 | 
				
			||||
                <el-table-column label="货位号" prop="nameCode" width="120"></el-table-column>
 | 
				
			||||
                <el-table-column label="货位名称" prop="cpmctymc" width="180">
 | 
				
			||||
                </el-table-column>
 | 
				
			||||
                <el-table-column label="所属仓库" prop="invStorageName" v-if="showSup"
 | 
				
			||||
                                 show-overflow-tooltip width="120"></el-table-column>
 | 
				
			||||
                <el-table-column label="所属分库" prop="invSubStorageName" v-if="showSup"
 | 
				
			||||
                                 show-overflow-tooltip width="120"></el-table-column>
 | 
				
			||||
                <el-table-column label="操作" width="120" fixed="right">
 | 
				
			||||
                    <template slot-scope="scope">
 | 
				
			||||
                        <el-button
 | 
				
			||||
                            type="text"
 | 
				
			||||
                            size="small"
 | 
				
			||||
                            @click.native.stop="editSpace(scope.row)"
 | 
				
			||||
                        >编辑
 | 
				
			||||
                        </el-button>
 | 
				
			||||
                        <el-button
 | 
				
			||||
                            type="text"
 | 
				
			||||
                            size="small"
 | 
				
			||||
                            @click.native.stop="deleteDialog(scope.row.id)"
 | 
				
			||||
                        >删除
 | 
				
			||||
                        </el-button>
 | 
				
			||||
                    </template>
 | 
				
			||||
                </el-table-column>
 | 
				
			||||
            </el-table>
 | 
				
			||||
        </el-card>
 | 
				
			||||
        <el-pagination
 | 
				
			||||
            :page-size="filterQuery.limit"
 | 
				
			||||
            @current-change="handleCurrentChange"
 | 
				
			||||
            layout="prev, pager, next"
 | 
				
			||||
            :total="total"
 | 
				
			||||
        ></el-pagination>
 | 
				
			||||
    </div>
 | 
				
			||||
</template>
 | 
				
			||||
 | 
				
			||||
<script>
 | 
				
			||||
import store from "../../store";
 | 
				
			||||
import {filterUplLocInv} from "@/api/basic/invWarehouse";
 | 
				
			||||
import {filterSubByInv} from "@/api/basic/invSubWarehouse";
 | 
				
			||||
import {userInfo} from "@/api/auth/login";
 | 
				
			||||
import {isBlank} from "@/utils/strUtil";
 | 
				
			||||
 | 
				
			||||
 | 
				
			||||
export default {
 | 
				
			||||
    data() {
 | 
				
			||||
        return {
 | 
				
			||||
            filterQuery: {
 | 
				
			||||
                invWarehouseCode: null,
 | 
				
			||||
                invStorageCode: null,
 | 
				
			||||
                key: null,
 | 
				
			||||
                page: 1,
 | 
				
			||||
                limit: 20,
 | 
				
			||||
                customerId: null,
 | 
				
			||||
            },
 | 
				
			||||
            list: [],
 | 
				
			||||
            storageList: [],
 | 
				
			||||
            subInvList: [],
 | 
				
			||||
            codeDetailVisible: false,
 | 
				
			||||
            total: 0,
 | 
				
			||||
            loading: true,
 | 
				
			||||
            index: null,
 | 
				
			||||
            dialogTableVisible: false,
 | 
				
			||||
            invWarehouseDisabled: true,
 | 
				
			||||
            formLoading: false,
 | 
				
			||||
            dialogVisible: false,
 | 
				
			||||
            deleteLoading: false,
 | 
				
			||||
            busTypes: [],
 | 
				
			||||
            idQuery: null,
 | 
				
			||||
            showSup: false,
 | 
				
			||||
            fromOptions: [],
 | 
				
			||||
        };
 | 
				
			||||
    },
 | 
				
			||||
    methods: {
 | 
				
			||||
        onReset() {
 | 
				
			||||
            this.$router.push({
 | 
				
			||||
                path: "",
 | 
				
			||||
            });
 | 
				
			||||
            this.filterQuery = {
 | 
				
			||||
                customerId: null,
 | 
				
			||||
                invWarehouseCode: null,
 | 
				
			||||
                invStorageCode: null,
 | 
				
			||||
                page: 1,
 | 
				
			||||
                limit: 20,
 | 
				
			||||
            };
 | 
				
			||||
            this.invChange();
 | 
				
			||||
            this.getList();
 | 
				
			||||
        },
 | 
				
			||||
        onSubmit() {
 | 
				
			||||
            this.loading = true;
 | 
				
			||||
            this.filterQuery.page = 1;
 | 
				
			||||
            this.getList();
 | 
				
			||||
        },
 | 
				
			||||
        handleSizeChange(val) {
 | 
				
			||||
            this.filterQuery.limit = val;
 | 
				
			||||
            this.getList();
 | 
				
			||||
        },
 | 
				
			||||
        handleCurrentChange(val) {
 | 
				
			||||
            this.filterQuery.page = val;
 | 
				
			||||
            this.getList();
 | 
				
			||||
        },
 | 
				
			||||
        handleUnitClick(row) {
 | 
				
			||||
            this.curIndex = row.id;
 | 
				
			||||
            this.dialogTableVisible = true;
 | 
				
			||||
        },
 | 
				
			||||
        closeDetailDialog(val) {
 | 
				
			||||
            this.codeDetailVisible = false;
 | 
				
			||||
        },
 | 
				
			||||
 | 
				
			||||
        closeDialog() {
 | 
				
			||||
            this.getList();
 | 
				
			||||
        },
 | 
				
			||||
        getList() {
 | 
				
			||||
            this.loading = true;
 | 
				
			||||
            this.filterQuery.customerId = store.getters.customerId;
 | 
				
			||||
        },
 | 
				
			||||
 | 
				
			||||
        deleteDialog(rowId) {
 | 
				
			||||
            this.$confirm("此操作将永久删除该货位, 是否继续?", "提示", {
 | 
				
			||||
                confirmButtonText: "确定",
 | 
				
			||||
                cancelButtonText: "取消",
 | 
				
			||||
                type: "warning",
 | 
				
			||||
            })
 | 
				
			||||
                .then(() => {
 | 
				
			||||
 | 
				
			||||
                })
 | 
				
			||||
                .catch(() => {
 | 
				
			||||
                });
 | 
				
			||||
        },
 | 
				
			||||
        getStorage() {
 | 
				
			||||
            this.storageList = [];
 | 
				
			||||
            filterUplLocInv()
 | 
				
			||||
                .then((response) => {
 | 
				
			||||
                    this.storageList = response.data || [];
 | 
				
			||||
                })
 | 
				
			||||
                .catch(() => {
 | 
				
			||||
                });
 | 
				
			||||
        },
 | 
				
			||||
        invChange() {
 | 
				
			||||
            this.filterQuery.invWarehouseCode = "";
 | 
				
			||||
            this.subInvList = [];
 | 
				
			||||
            if (this.filterQuery.invStorageCode != null && this.filterQuery.invStorageCode != "") {
 | 
				
			||||
                this.invWarehouseDisabled = false;
 | 
				
			||||
                let query = {
 | 
				
			||||
                    pcode: this.filterQuery.invStorageCode
 | 
				
			||||
                };
 | 
				
			||||
                filterSubByInv(query)
 | 
				
			||||
                    .then((response) => {
 | 
				
			||||
                        this.subInvList = response.data || [];
 | 
				
			||||
                    })
 | 
				
			||||
                    .catch(() => {
 | 
				
			||||
                    });
 | 
				
			||||
            } else {
 | 
				
			||||
                this.invWarehouseDisabled = true;
 | 
				
			||||
            }
 | 
				
			||||
        },
 | 
				
			||||
        editSpace(row) {
 | 
				
			||||
 | 
				
			||||
        },
 | 
				
			||||
        addSpace() {
 | 
				
			||||
 | 
				
			||||
        },
 | 
				
			||||
    },
 | 
				
			||||
    mounted() {
 | 
				
			||||
        document.body.ondrop = function (event) {
 | 
				
			||||
            event.preventDefault();
 | 
				
			||||
            event.stopPropagation();
 | 
				
			||||
        };
 | 
				
			||||
    },
 | 
				
			||||
    created() {
 | 
				
			||||
        this.getStorage();
 | 
				
			||||
        let query = this.$route.query;
 | 
				
			||||
        this.filterQuery = Object.assign(this.filterQuery, query);
 | 
				
			||||
        this.filterQuery.limit = parseInt(this.filterQuery.limit);
 | 
				
			||||
        // 加载表格数据
 | 
				
			||||
        //获取用户默认仓库信息
 | 
				
			||||
        userInfo().then((res) => {
 | 
				
			||||
            if (res.code === 20000) {
 | 
				
			||||
                if (!isBlank(res.data.locInvCode)) {
 | 
				
			||||
                    this.filterQuery.invStorageCode = res.data.locInvCode;
 | 
				
			||||
                    this.invChange();
 | 
				
			||||
                    this.filterQuery.invWarehouseCode = res.data.locSubInvCode;
 | 
				
			||||
                }
 | 
				
			||||
                this.getList();
 | 
				
			||||
            }
 | 
				
			||||
        }).catch((error) => {
 | 
				
			||||
        });
 | 
				
			||||
    },
 | 
				
			||||
};
 | 
				
			||||
</script>
 | 
				
			||||
 | 
				
			||||
<style type="text/scss" lang="scss">
 | 
				
			||||
</style>
 | 
				
			||||
					Loading…
					
					
				
		Reference in New Issue