TIJIAO
This commit is contained in:
parent
b2d1383d85
commit
a7efe58a78
|
|
@ -0,0 +1,30 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function getWarehouseList(query) {
|
||||
return request({
|
||||
url: '/inm/warehouse/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function createWarehouse(data) {
|
||||
return request({
|
||||
url: '/inm/warehouse/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function updateWarehouse(id, data) {
|
||||
return request({
|
||||
url: `/inm/warehouse/${id}/`,
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function deleteWarehouse(id, data) {
|
||||
return request({
|
||||
url: `/inm/warehouse/${id}/`,
|
||||
method: 'delete',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
|
@ -87,6 +87,12 @@ export const asyncRoutes = [
|
|||
name: 'equipment',
|
||||
meta: { title: '设备管理', icon: 'example', perms: ['equipment_set'] },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'index',
|
||||
component: () => import('@/views/equipment/index'),
|
||||
meta: { title: '设备台账', icon: 'example', perms: ['index_manage'] }
|
||||
},
|
||||
{
|
||||
path: 'index',
|
||||
name: 'index',
|
||||
|
|
@ -95,14 +101,34 @@ export const asyncRoutes = [
|
|||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/inm',
|
||||
component: Layout,
|
||||
redirect: '/inm/warehouse',
|
||||
name: 'inm',
|
||||
meta: { title: '库存管理', icon: 'example', perms: ['equipment_set'] },
|
||||
children: [
|
||||
{
|
||||
path: 'warehouse',
|
||||
name: 'warehouse',
|
||||
component: () => import('@/views/inm/warehouse'),
|
||||
meta: { title: '仓库', icon: 'example', perms: ['index_manage'] }
|
||||
},
|
||||
{
|
||||
path: 'warehouse',
|
||||
name: 'warehouse',
|
||||
component: () => import('@/views/inm/warehouse'),
|
||||
meta: { title: '仓库', icon: 'example', perms: ['index_manage'] }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/mtm',
|
||||
component: Layout,
|
||||
redirect: '/mtm/material/',
|
||||
name: 'mtm',
|
||||
meta: { title: '制造技术管理', icon: 'example', perms: ['procurement_set'] },
|
||||
meta: { title: '制造管理', icon: 'example', perms: ['procurement_set'] },
|
||||
children: [
|
||||
{
|
||||
path: 'material',
|
||||
|
|
@ -147,6 +173,12 @@ export const asyncRoutes = [
|
|||
name: 'procurement',
|
||||
meta: { title: '采购管理', icon: 'example', perms: ['procurement_set'] },
|
||||
children: [
|
||||
{
|
||||
path: 'vendor',
|
||||
name: 'vendor',
|
||||
component: () => import('@/views/procurement/vendor'),
|
||||
meta: { title: '供应商', icon: 'example', perms: ['vendor_manage'] }
|
||||
},
|
||||
{
|
||||
path: 'vendor',
|
||||
name: 'vendor',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,248 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<div>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="仓库名称/仓库编号"
|
||||
style="width: 300px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleFilter"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter"
|
||||
>重置</el-button
|
||||
>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||
>新增设备</el-button
|
||||
>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 10px">
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="warehouseList.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="仓库名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="仓库编号">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="具体地点">
|
||||
<template slot-scope="scope">{{ scope.row.place }}</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="操作"
|
||||
width="220px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-link
|
||||
v-if="checkPermission(['warehouse_update'])"
|
||||
@click="handleEdit(scope)"
|
||||
>编辑</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="checkPermission(['warehouse_delete'])"
|
||||
type="danger"
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="warehouseList.count > 0"
|
||||
:total="warehouseList.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisible"
|
||||
:title="dialogType === 'edit' ? '编辑仓库' : '新增仓库'"
|
||||
>
|
||||
<el-form
|
||||
ref="Form"
|
||||
:model="warehouse"
|
||||
label-width="80px"
|
||||
label-position="right"
|
||||
:rules="rule1"
|
||||
>
|
||||
<el-form-item label="仓库名称" prop="name">
|
||||
<el-input v-model="warehouse.name" placeholder="仓库名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库编号" prop="number">
|
||||
<el-input v-model="warehouse.number" placeholder="仓库编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="具体地点" prop="place">
|
||||
<el-input v-model="warehouse.place" placeholder="具体地点" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div style="text-align: right">
|
||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getWarehouseList, createWarehouse,updateWarehouse,deleteWarehouse } from "@/api/inm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaultewarehouse = {
|
||||
};
|
||||
export default {
|
||||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
warehouse: defaultewarehouse,
|
||||
warehouseList: {
|
||||
count: 0,
|
||||
},
|
||||
options: [{
|
||||
value: 0,
|
||||
label: '运转正常'
|
||||
}, {
|
||||
value: 1,
|
||||
label: '停用'
|
||||
}, {
|
||||
value: 2,
|
||||
label: '报废'
|
||||
}],
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
keeperOptions:[],
|
||||
depOptions:[],
|
||||
listLoading: true,
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
rule1: {
|
||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
number: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
place: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//设备列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getWarehouseList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.warehouseList = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
handleCreate() {
|
||||
this.warehouse = Object.assign({}, defaultewarehouse);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
|
||||
handleEdit(scope) {
|
||||
this.warehouse = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteWarehouse(scope.row.id);
|
||||
this.getList();
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
if (isEdit) {
|
||||
updateWarehouse(this.warehouse.id, this.warehouse).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createWarehouse(this.warehouse).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Loading…
Reference in New Issue