coding280
This commit is contained in:
parent
886cba24dc
commit
5af6787e30
|
@ -107,7 +107,6 @@ export const asyncRoutes = [
|
||||||
name: 'material',
|
name: 'material',
|
||||||
component: () => import('@/views/mtm/material'),
|
component: () => import('@/views/mtm/material'),
|
||||||
meta: { title: '物料清单', icon: 'material', perms: ['mtm_material'] }
|
meta: { title: '物料清单', icon: 'material', perms: ['mtm_material'] }
|
||||||
|
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
|
@ -151,7 +150,19 @@ export const asyncRoutes = [
|
||||||
name: 'productprocess',
|
name: 'productprocess',
|
||||||
component: () => import('@/views/mtm/productprocess'),
|
component: () => import('@/views/mtm/productprocess'),
|
||||||
meta: { title: '产品管理', icon: 'product', perms: ['mtm_productprocess'] }
|
meta: { title: '产品管理', icon: 'product', perms: ['mtm_productprocess'] }
|
||||||
},
|
}
|
||||||
|
,{
|
||||||
|
path: 'productList',
|
||||||
|
name: 'productList',
|
||||||
|
component: () => import('@/views/mtm/productList'),
|
||||||
|
meta: { title: '成品列表', icon: 'material', perms: ['mtm_material'] }
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
path: 'wproductList',
|
||||||
|
name: 'wproductList',
|
||||||
|
component: () => import('@/views/mtm/wproductList'),
|
||||||
|
meta: { title: '半成品列表', icon: 'material', perms: ['mtm_material'] }
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card style="margin-top: 2px">
|
<el-card style="margin-top: 2px">
|
||||||
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
||||||
<el-tab-pane label="成品" name="1"></el-tab-pane>
|
<!--<el-tab-pane label="成品" name="1"></el-tab-pane>
|
||||||
<el-tab-pane label="半成品" name="2"></el-tab-pane>
|
<el-tab-pane label="半成品" name="2"></el-tab-pane>-->
|
||||||
<el-tab-pane label="主要原料" name="3"></el-tab-pane>
|
<el-tab-pane label="主要原料" name="3"></el-tab-pane>
|
||||||
<el-tab-pane label="辅助材料" name="4"></el-tab-pane>
|
<el-tab-pane label="辅助材料" name="4"></el-tab-pane>
|
||||||
<el-tab-pane label="加工工具" name="5"></el-tab-pane>
|
<el-tab-pane label="加工工具" name="5"></el-tab-pane>
|
||||||
|
@ -210,22 +210,23 @@
|
||||||
},
|
},
|
||||||
processOptions: [],
|
processOptions: [],
|
||||||
options_: {
|
options_: {
|
||||||
|
// "1": '成品',
|
||||||
"1": '成品',
|
// "2": '半成品',
|
||||||
"2": '半成品',
|
|
||||||
"3": '主要原料',
|
"3": '主要原料',
|
||||||
"4": '辅助材料',
|
"4": '辅助材料',
|
||||||
"5": '加工工具',
|
"5": '加工工具',
|
||||||
"6": '辅助工装',
|
"6": '辅助工装',
|
||||||
|
|
||||||
},
|
},
|
||||||
options: [{
|
options: [
|
||||||
|
/*{
|
||||||
value: 1,
|
value: 1,
|
||||||
label: '成品'
|
label: '成品'
|
||||||
}, {
|
}, {
|
||||||
value: 2,
|
value: 2,
|
||||||
label: '半成品'
|
label: '半成品'
|
||||||
}, {
|
}, */
|
||||||
|
{
|
||||||
value: 3,
|
value: 3,
|
||||||
label: '主要原料'
|
label: '主要原料'
|
||||||
}, {
|
}, {
|
||||||
|
@ -258,10 +259,11 @@
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
listQuery: {
|
listQuery: {
|
||||||
|
type:3,
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
},
|
},
|
||||||
activeName: "",
|
activeName: "3",
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogType: "new",
|
dialogType: "new",
|
||||||
|
|
|
@ -0,0 +1,351 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-card>
|
||||||
|
<div>
|
||||||
|
<el-button
|
||||||
|
v-if="checkPermission(['material_create'])"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="handleCreate"
|
||||||
|
>
|
||||||
|
新增成品
|
||||||
|
</el-button>
|
||||||
|
<el-input
|
||||||
|
v-model="listQuery.search"
|
||||||
|
placeholder="成品名称/成品编号"
|
||||||
|
style="width: 300px"
|
||||||
|
class="filter-item"
|
||||||
|
clearable
|
||||||
|
@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>
|
||||||
|
</el-card>
|
||||||
|
<el-card style="margin-top: 2px">
|
||||||
|
<el-table
|
||||||
|
v-loading="listLoading"
|
||||||
|
:data="materialList.results"
|
||||||
|
border
|
||||||
|
fit
|
||||||
|
stripe
|
||||||
|
highlight-current-row
|
||||||
|
height="100"
|
||||||
|
v-el-height-adaptive-table="{bottomOffset: 42}"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="50"/>
|
||||||
|
<el-table-column label="成品编号">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.number }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="物料类别">
|
||||||
|
<template> 成品</template>
|
||||||
|
</el-table-column>
|
||||||
|
<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.specification }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="单片玻璃数量">
|
||||||
|
<template slot-scope="scope">{{ scope.row.piece_count }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计量单位">
|
||||||
|
<template slot-scope="scope">{{ scope.row.unit }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间">
|
||||||
|
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
label="操作"
|
||||||
|
width="220px"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['material_update'])&&scope.row.type!=5&&scope.row.type!=6"
|
||||||
|
type="primary"
|
||||||
|
@click="handlebind(scope)"
|
||||||
|
>
|
||||||
|
检查表
|
||||||
|
</el-link>
|
||||||
|
<el-link
|
||||||
|
subproduction_delete
|
||||||
|
type="primary"
|
||||||
|
@click="handleEdit(scope)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-link>
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['material_update'])"
|
||||||
|
type="primary"
|
||||||
|
@click="handledetail(scope)"
|
||||||
|
>
|
||||||
|
详情
|
||||||
|
</el-link>
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['material_delete'])"
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="materialList.count > 0"
|
||||||
|
:total="materialList.count"
|
||||||
|
:page.sync="listQuery.page"
|
||||||
|
:limit.sync="listQuery.page_size"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:title="dialogType === 'edit' ? '编辑成品' : '新增成品'"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
:model="material"
|
||||||
|
label-width="100px"
|
||||||
|
label-position="right"
|
||||||
|
:rules="rule1"
|
||||||
|
>
|
||||||
|
<el-form-item label="成品名称" prop="name">
|
||||||
|
<el-input v-model="material.name" placeholder="成品名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="成品编号" prop="number">
|
||||||
|
<el-input v-model="material.number" placeholder="成品编号"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格型号">
|
||||||
|
<el-input v-model="material.specification" placeholder="规格型号"/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="计量单位">
|
||||||
|
<el-select style="width: 100%" v-model="material.unit" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in unitoptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单片玻璃数量" v-if="material.type==1">
|
||||||
|
<el-input v-model="material.piece_count" placeholder="单片玻璃数量"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="安全库存数">
|
||||||
|
<el-input-number style="width: 100%;" v-model="material.count_safe" :step="1" :min="0" step-strictly
|
||||||
|
placeholder="安全库存数"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序">
|
||||||
|
<el-input-number style="width: 100%;" v-model="material.sort_str" :step="1" :min="0" step-strictly
|
||||||
|
placeholder="排序"></el-input-number>
|
||||||
|
</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 {
|
||||||
|
getMaterialList,
|
||||||
|
createMaterial,
|
||||||
|
updateMaterial,
|
||||||
|
deleteMaterial
|
||||||
|
} from "@/api/mtm";
|
||||||
|
import checkPermission from "@/utils/permission";
|
||||||
|
import Pagination from "@/components/Pagination";
|
||||||
|
|
||||||
|
const defaultmaterial = {
|
||||||
|
name: null,
|
||||||
|
number: null,
|
||||||
|
specification: null,
|
||||||
|
unit: null,
|
||||||
|
type: 1,
|
||||||
|
piece_count: null,
|
||||||
|
sort_str: null,
|
||||||
|
count_safe: 0,
|
||||||
|
processes: [],
|
||||||
|
};
|
||||||
|
export default {
|
||||||
|
name: "productList",
|
||||||
|
components: {Pagination},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
material: defaultmaterial,
|
||||||
|
materialList: {
|
||||||
|
count: 0,
|
||||||
|
},
|
||||||
|
options_: {
|
||||||
|
|
||||||
|
"1": '成品',
|
||||||
|
"2": '半成品',
|
||||||
|
"3": '主要原料',
|
||||||
|
"4": '辅助材料',
|
||||||
|
"5": '加工工具',
|
||||||
|
"6": '辅助工装',
|
||||||
|
|
||||||
|
},
|
||||||
|
unitoptions: [
|
||||||
|
{
|
||||||
|
value: '块',
|
||||||
|
label: '块'
|
||||||
|
}, {
|
||||||
|
value: '套',
|
||||||
|
label: '套'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '个',
|
||||||
|
label: '个'
|
||||||
|
}, {
|
||||||
|
value: 'm2',
|
||||||
|
label: 'm2'
|
||||||
|
}, {
|
||||||
|
value: '瓶',
|
||||||
|
label: '瓶'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
listQuery: {
|
||||||
|
type: 1,
|
||||||
|
page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
},
|
||||||
|
activeName: "",
|
||||||
|
listLoading: true,
|
||||||
|
dialogVisible: false,
|
||||||
|
dialogType: "new",
|
||||||
|
rule1: {
|
||||||
|
name: [{required: true, message: "请输入", trigger: "blur"}],
|
||||||
|
number: [{required: true, message: "请输入", trigger: "blur"}],
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
// this.getProcessList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkPermission,
|
||||||
|
//成品详情
|
||||||
|
handledetail(scope) {
|
||||||
|
this.$router.push({name: "MaterialDetail", params: {id: scope.row.id, type: scope.row.type},})
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
let that = this;
|
||||||
|
that.listLoading = true;
|
||||||
|
getMaterialList(this.listQuery).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
that.materialList = response.data;
|
||||||
|
}
|
||||||
|
that.listLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//检查表
|
||||||
|
handlebind(scope) {
|
||||||
|
this.$router.push({name: "MaterialDO", params: {id: scope.row.id},})
|
||||||
|
},
|
||||||
|
handleFilter() {
|
||||||
|
this.listQuery.page = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
resetFilter() {
|
||||||
|
this.activeName = "";
|
||||||
|
this.listQuery = {
|
||||||
|
type: 1,
|
||||||
|
page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
};
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleCreate() {
|
||||||
|
this.material = Object.assign({}, defaultmaterial);
|
||||||
|
this.dialogType = "new";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleEdit(scope) {
|
||||||
|
this.material = Object.assign({}, scope.row); // copy obj
|
||||||
|
this.dialogType = "edit";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(scope) {
|
||||||
|
let that = this;
|
||||||
|
this.$confirm("确认删除?", "警告", {
|
||||||
|
confirmButtonText: "确认",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "error",
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
await deleteMaterial(scope.row.id);
|
||||||
|
that.getList();
|
||||||
|
that.$message.success("成功");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
that.$message.error(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async confirm(form) {
|
||||||
|
let that = this;
|
||||||
|
that.$refs[form].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const isEdit = this.dialogType === "edit";
|
||||||
|
if (isEdit) {
|
||||||
|
updateMaterial(this.material.id, this.material).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
that.getList();
|
||||||
|
that.dialogVisible = false;
|
||||||
|
that.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
createMaterial(this.material).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
that.getList();
|
||||||
|
that.dialogVisible = false;
|
||||||
|
that.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -0,0 +1,322 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-card>
|
||||||
|
<div>
|
||||||
|
<el-button
|
||||||
|
v-if="checkPermission(['material_create'])"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="handleCreate"
|
||||||
|
>
|
||||||
|
新增半成品
|
||||||
|
</el-button>
|
||||||
|
<el-input
|
||||||
|
v-model="listQuery.search"
|
||||||
|
placeholder="半成品名称/半成品编号"
|
||||||
|
style="width: 300px"
|
||||||
|
class="filter-item"
|
||||||
|
clearable
|
||||||
|
@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>
|
||||||
|
</el-card>
|
||||||
|
<el-card style="margin-top: 2px">
|
||||||
|
<el-table
|
||||||
|
v-loading="listLoading"
|
||||||
|
:data="materialList.results"
|
||||||
|
border
|
||||||
|
fit
|
||||||
|
stripe
|
||||||
|
highlight-current-row
|
||||||
|
height="100"
|
||||||
|
v-el-height-adaptive-table="{bottomOffset: 42}"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="50"/>
|
||||||
|
<el-table-column label="半成品编号">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.number }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="物料类别">
|
||||||
|
<template> 半成品</template>
|
||||||
|
</el-table-column>
|
||||||
|
<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.specification }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计量单位">
|
||||||
|
<template slot-scope="scope">{{ scope.row.unit }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间">
|
||||||
|
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
label="操作"
|
||||||
|
width="220px"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['material_update'])&&scope.row.type!=5&&scope.row.type!=6"
|
||||||
|
type="primary"
|
||||||
|
@click="handlebind(scope)"
|
||||||
|
>检查表
|
||||||
|
</el-link>
|
||||||
|
<el-link
|
||||||
|
subproduction_delete
|
||||||
|
type="primary"
|
||||||
|
@click="handleEdit(scope)"
|
||||||
|
>编辑
|
||||||
|
</el-link>
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['material_update'])"
|
||||||
|
type="primary"
|
||||||
|
@click="handledetail(scope)"
|
||||||
|
>详情
|
||||||
|
</el-link>
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['material_delete'])"
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope)"
|
||||||
|
>删除
|
||||||
|
</el-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="materialList.count > 0"
|
||||||
|
:total="materialList.count"
|
||||||
|
:page.sync="listQuery.page"
|
||||||
|
:limit.sync="listQuery.page_size"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:title="dialogType === 'edit' ? '编辑半成品' : '新增半成品'"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
:model="material"
|
||||||
|
label-width="100px"
|
||||||
|
label-position="right"
|
||||||
|
:rules="rule1"
|
||||||
|
>
|
||||||
|
<el-form-item label="半成品名称" prop="name">
|
||||||
|
<el-input v-model="material.name" placeholder="半成品名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="半成品编号" prop="number">
|
||||||
|
<el-input v-model="material.number" placeholder="半成品编号"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格型号">
|
||||||
|
<el-input v-model="material.specification" placeholder="规格型号"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="计量单位">
|
||||||
|
<el-select style="width: 100%" v-model="material.unit" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in unitoptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="安全库存数">
|
||||||
|
<el-input-number style="width: 100%;" v-model="material.count_safe" :step="1" :min="0" step-strictly placeholder="安全库存数"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序">
|
||||||
|
<el-input-number style="width: 100%;" v-model="material.sort_str" :step="1" :min="0" step-strictly placeholder="排序"></el-input-number>
|
||||||
|
</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 {
|
||||||
|
getMaterialList,
|
||||||
|
createMaterial,
|
||||||
|
updateMaterial,
|
||||||
|
deleteMaterial
|
||||||
|
} from "@/api/mtm";
|
||||||
|
import checkPermission from "@/utils/permission";
|
||||||
|
import Pagination from "@/components/Pagination";
|
||||||
|
const defaultmaterial = {
|
||||||
|
name: null,
|
||||||
|
number: null,
|
||||||
|
specification: null,
|
||||||
|
unit: null,
|
||||||
|
type: 2,
|
||||||
|
piece_count: null,
|
||||||
|
sort_str: null,
|
||||||
|
count_safe: 0,
|
||||||
|
processes: [],
|
||||||
|
};
|
||||||
|
export default {
|
||||||
|
name: "wproductList",
|
||||||
|
components: {Pagination},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
material: defaultmaterial,
|
||||||
|
materialList: {
|
||||||
|
count: 0,
|
||||||
|
},
|
||||||
|
unitoptions: [
|
||||||
|
{
|
||||||
|
value: '块',
|
||||||
|
label: '块'
|
||||||
|
}, {
|
||||||
|
value: '套',
|
||||||
|
label: '套'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '个',
|
||||||
|
label: '个'
|
||||||
|
}, {
|
||||||
|
value: 'm2',
|
||||||
|
label: 'm2'
|
||||||
|
}, {
|
||||||
|
value: '瓶',
|
||||||
|
label: '瓶'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
listQuery: {
|
||||||
|
type:2,
|
||||||
|
page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
},
|
||||||
|
activeName: "",
|
||||||
|
listLoading: true,
|
||||||
|
dialogVisible: false,
|
||||||
|
dialogType: "new",
|
||||||
|
rule1: {
|
||||||
|
name: [{required: true, message: "请输入", trigger: "blur"}],
|
||||||
|
number: [{required: true, message: "请输入", trigger: "blur"}],
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
// this.getProcessList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkPermission,
|
||||||
|
//半成品详情
|
||||||
|
handledetail(scope){
|
||||||
|
this.$router.push({name: "MaterialDetail", params: { id: scope.row.id,type: scope.row.type }, })
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true;
|
||||||
|
getMaterialList(this.listQuery).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
this.materialList = response.data;
|
||||||
|
}
|
||||||
|
this.listLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//检查表
|
||||||
|
handlebind(scope) {
|
||||||
|
this.$router.push({name: "MaterialDO", params: {id: scope.row.id},})
|
||||||
|
},
|
||||||
|
handleFilter() {
|
||||||
|
this.listQuery.page = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
resetFilter() {
|
||||||
|
this.activeName = "";
|
||||||
|
this.listQuery = {
|
||||||
|
type: 2,
|
||||||
|
page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
};
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleCreate() {
|
||||||
|
this.material = Object.assign({}, defaultmaterial);
|
||||||
|
this.dialogType = "new";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleEdit(scope) {
|
||||||
|
this.material = 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 deleteMaterial(scope.row.id);
|
||||||
|
this.getList();
|
||||||
|
this.$message.success("成功");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.$message.error(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async confirm(form) {
|
||||||
|
this.$refs[form].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const isEdit = this.dialogType === "edit";
|
||||||
|
if (isEdit) {
|
||||||
|
updateMaterial(this.material.id, this.material).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
createMaterial(this.material).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
Loading…
Reference in New Issue