项目初始化
This commit is contained in:
472
ruoyi-ui/src/views/bas/warehouse/index.vue
Normal file
472
ruoyi-ui/src/views/bas/warehouse/index.vue
Normal file
@@ -0,0 +1,472 @@
|
||||
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" :label-width="labelWidthForSearch">
|
||||
<!-- 仓库编号 -->
|
||||
<el-form-item label="仓库编号" prop="warehouseNo">
|
||||
<el-input
|
||||
v-model="queryParams.warehouseNo"
|
||||
placeholder="请输入仓库编号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 项目编号 -->
|
||||
<el-form-item label="项目编号" prop="projectNo">
|
||||
<el-input
|
||||
v-model="queryParams.projectNo"
|
||||
placeholder="请输入项目编号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 仓库名称 -->
|
||||
<el-form-item label="仓库名称" prop="warehouseName">
|
||||
<el-input
|
||||
v-model="queryParams.warehouseName"
|
||||
placeholder="请输入仓库名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 仓库地址 -->
|
||||
<!-- <el-form-item :label="$t('warehouse.address')" prop="address">
|
||||
<el-input
|
||||
v-model="queryParams.address"
|
||||
:placeholder="$t('warehouse.placeholderAddress')"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<!-- 备注 -->
|
||||
<!-- <el-form-item :label="$t('warehouse.cDesc')" prop="cDesc">
|
||||
<el-input
|
||||
v-model="queryParams.cDesc"
|
||||
:placeholder="$t('warehouse.placeholderCDesc')"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<!-- 仓库级别 -->
|
||||
<!-- <el-form-item :label="$t('warehouse.warehouseKind')" prop="warehouseKind">
|
||||
<el-input
|
||||
v-model="queryParams.warehouseKind"
|
||||
:placeholder="$t('warehouse.placeholderWarehouseKind')"
|
||||
clearable
|
||||
maxlength="2"
|
||||
show-word-limit
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<!-- 仓库是否可用 -->
|
||||
<el-form-item label="是否可用" prop="isCurrent">
|
||||
<el-select v-model="queryParams.isCurrent" placeholder="请选择是否可用" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="仓库类型" prop="warehouseType">
|
||||
<el-select v-model="queryParams.warehouseType" placeholder="请选择仓库类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.warehouse_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<!-- 【查询】按钮 -->
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<!-- 【重置】(清空)按钮 -->
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<!-- 【新增】按钮 -->
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['bas:warehouse:add']"
|
||||
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- 【修改】按钮 -->
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['bas:warehouse:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- 【删除】按钮 -->
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['bas:warehouse:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- 【导出】按钮 -->
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['bas:warehouse:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="warehouseList" @selection-change="handleSelectionChange" max-height="700">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- 仓库ID(序号) -->
|
||||
<el-table-column label="仓库ID" align="left" prop="warehouseId" width="120"/>
|
||||
<!-- 仓库编号 -->
|
||||
<el-table-column label="仓库编号" align="left" prop="warehouseNo" />
|
||||
<!-- 项目编号 -->
|
||||
<el-table-column label="项目编号" align="left" prop="projectNo" />
|
||||
<!-- 仓库名称 -->
|
||||
<el-table-column label="仓库名称" align="left" prop="warehouseName" />
|
||||
<!-- 仓库地址 -->
|
||||
<el-table-column label="仓库地址" align="left" prop="address" />
|
||||
<!-- 备注 -->
|
||||
<el-table-column label="备注" align="left" prop="cdesc" />
|
||||
<!-- 仓库级别 -->
|
||||
<el-table-column label="仓库级别" align="left" prop="warehouseKind" />
|
||||
<!-- 仓库类型 -->
|
||||
<el-table-column label="仓库类型" align="left" prop="warehouseType" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.warehouse_type" :value="scope.row.warehouseType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 仓库是否可用 -->
|
||||
<el-table-column label="是否可用" align="left" prop="isCurrent">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isCurrent"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 操作 -->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<!-- 操作---【修改】按钮 -->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['bas:warehouse:edit']"
|
||||
>修改</el-button>
|
||||
<!-- 操作---【删除】按钮 -->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['bas:warehouse:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改仓库管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" :label-width="labelWidthForFunction">
|
||||
<!-- 仓库ID(序号) -->
|
||||
<el-form-item label="仓库ID" prop="warehouseId">
|
||||
<el-input v-model="form.warehouseId" placeholder="请输入仓库ID" :disabled="isDisabledForId"/>
|
||||
</el-form-item>
|
||||
<!-- 仓库编号 -->
|
||||
<el-form-item label="仓库编号" prop="warehouseNo">
|
||||
<el-input v-model="form.warehouseNo" placeholder="请输入仓库编号" />
|
||||
</el-form-item>
|
||||
<!-- 项目编号 -->
|
||||
<el-form-item label="项目编号" prop="projectNo">
|
||||
<el-input v-model="form.projectNo" placeholder="请输入项目编号" />
|
||||
</el-form-item>
|
||||
<!-- 仓库名称 -->
|
||||
<el-form-item label="仓库名称" prop="warehouseName">
|
||||
<el-input v-model="form.warehouseName" placeholder="请输入仓库名称" />
|
||||
</el-form-item>
|
||||
<!-- 仓库地址 -->
|
||||
<el-form-item label="仓库地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入仓库地址" />
|
||||
</el-form-item>
|
||||
<!-- 备注 -->
|
||||
<el-form-item label="备注" prop="cDesc">
|
||||
<el-input v-model="form.cdesc" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<!-- 仓库级别 -->
|
||||
<el-form-item label="仓库级别" prop="warehouseKind">
|
||||
<el-input
|
||||
v-model="form.warehouseKind"
|
||||
placeholder="请输入仓库级别"
|
||||
maxlength="2"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 仓库类型 -->
|
||||
<el-form-item label="仓库类型" prop="warehouseType">
|
||||
<el-select v-model="form.warehouseType" placeholder="请选择仓库类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.warehouse_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- 仓库是否可用 -->
|
||||
<el-form-item label="是否可用" prop="isCurrent">
|
||||
<el-select v-model="form.isCurrent" placeholder="请选择是否可用">
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<!-- 二级画面---【确定】按钮 -->
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
<!-- 二级画面---【取消】按钮 -->
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listWarehouse, getWarehouse, delWarehouse, addWarehouse, updateWarehouse } from "@/api/bas/warehouse"
|
||||
|
||||
export default {
|
||||
name: "Warehouse",
|
||||
dicts: ['sys_yes_no','warehouse_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 仓库管理表格数据
|
||||
warehouseList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
warehouseId: null,
|
||||
warehouseNo: null,
|
||||
projectNo: null,
|
||||
warehouseName: null,
|
||||
address: null,
|
||||
cDesc: null,
|
||||
warehouseKind: null,
|
||||
warehouseType: null,
|
||||
isCurrent: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
warehouseId: [
|
||||
// 校验---序号是否为空
|
||||
{ required: true, message: "仓库ID不能为空", trigger: "blur" }
|
||||
],
|
||||
warehouseNo: [
|
||||
// 校验---仓库编号是否为空
|
||||
{ required: true, message: "仓库编号不能为空", trigger: "blur" }
|
||||
],
|
||||
warehouseName: [
|
||||
// 校验---仓库名称是否为空
|
||||
{ required: true, message: "仓库名称不能为空", trigger: "blur" }
|
||||
],
|
||||
isCurrent: [
|
||||
// 校验---仓库是否可用选项是否为空
|
||||
{ required: true, message: "是否可用不能为空", trigger: "change" }
|
||||
],
|
||||
warehouseKind: [
|
||||
// 校验---仓库级别长度限制
|
||||
{ max: 2, message: "仓库级别不能超过2个字符", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
|
||||
//修改【仓库管理】界面id文本框是否可交互
|
||||
isDisabledForId: false,
|
||||
// 打开窗口标题
|
||||
// boxAddTitle: $t('warehouse.addWarehouseItem'),
|
||||
// // 功能框标签尺寸
|
||||
// labelWidthForFunction: "120px"
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询仓库管理列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listWarehouse(this.queryParams).then(response => {
|
||||
this.warehouseList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
warehouseId: null,
|
||||
warehouseNo: null,
|
||||
projectNo: null,
|
||||
warehouseName: null,
|
||||
address: null,
|
||||
cdesc: null,
|
||||
warehouseKind: null,
|
||||
warehouseType: null,
|
||||
isCurrent: null
|
||||
}
|
||||
this.resetForm("form")
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm")
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.warehouseId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
//---------------------------------
|
||||
this.isDisabledForId = false
|
||||
this.open = true
|
||||
this.title = "添加仓库"
|
||||
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
//---------------------------------
|
||||
this.isDisabledForId = true
|
||||
|
||||
this.reset()
|
||||
const warehouseId = row.warehouseId || this.ids
|
||||
getWarehouse(warehouseId).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = "修改仓库"
|
||||
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.title === "修改仓库") {
|
||||
updateWarehouse(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
if (this.title === "添加仓库") {
|
||||
addWarehouse(this.form).then(response => {
|
||||
this.$modal.msgSuccess("添加成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const warehouseIds = row.warehouseId || this.ids
|
||||
this.$modal.confirm('是否确认删除仓库编号为"' + warehouseIds + '"的数据项?').then(function() {
|
||||
return delWarehouse(warehouseIds)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('bas/warehouse/export', {
|
||||
...this.queryParams
|
||||
}, `warehouse_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
...this.$data,
|
||||
labelWidthForSearch: '68px',
|
||||
labelWidthForFunction: '120px'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
/* 统一表单控件宽度 */
|
||||
.el-select,
|
||||
.el-input {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user