1
lzhe
2024-05-21 ae4077644fc36dee9b66c85b23321b8e170361d0
1
已添加1个文件
已修改2个文件
368 ■■■■ 文件已修改
src/views/console/basic-data/addProduct.vue 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/basic-data/product.vue 180 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/bom-list/index.vue 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/basic-data/addProduct.vue
@@ -5,42 +5,59 @@
            <el-row>
                <el-col :span="8">
                    <el-form-item label="上级产品">
                        <el-input v-model="addDictForm.code" placeholder="上级产品" clearable></el-input>
                        <el-tree-select
                            @change = "parentIdChange"
                            default-expand-all
                            v-model="addDictForm.parentId"
                            clearable
                            node-key="id"
                            placeholder="上级产品"
                            ref="parentTree"
                            :data="parentData"
                            check-strictly
                            :props="{ label: 'name' }"
                            style="width:100%;"
                            :render-after-expand="false" />
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="产品编号">
                        <el-input v-model="addDictForm.dictValue" placeholder="产品编号" clearable></el-input>
                        <el-input v-model="addDictForm.code" placeholder="保存时系统自动生成" disabled clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="产品名称" prop="sort">
                        <el-input v-model="addDictForm.sort" placeholder="产品名称" clearable></el-input>
                    <el-form-item label="产品名称" prop="name">
                        <el-input v-model="addDictForm.name" placeholder="产品名称" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="产品类型" prop="sort">
                        <el-input v-model="addDictForm.sort" placeholder="产品类型" clearable></el-input>
                    <el-form-item label="产品类型" prop="typeId">
                        <el-select v-model="addDictForm.typeId" placeholder="请选择" style="width: 100%;">
                            <el-option v-for="item in typeIdList" :key="item.id" :label="item.name" :value="item.id" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="计量单位">
                        <el-input v-model="addDictForm.sort" placeholder="计量单位" clearable></el-input>
                        <el-input v-model="addDictForm.unit" placeholder="计量单位" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="规格型号">
                        <el-input v-model="addDictForm.sort" placeholder="规格型号" clearable></el-input>
                        <el-input v-model="addDictForm.standardModel" placeholder="规格型号" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="产品描述">
                        <el-input v-model="addDictForm.remark" placeholder="字典备注" clearable></el-input>
                        <el-input v-model="addDictForm.description" placeholder="字典备注" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="启用状态">
                        <el-input v-model="addDictForm.sort" placeholder="启用状态" clearable></el-input>
                        <el-select v-model="addDictForm.status" :prefix-icon="Search" placeholder="请选择" style="width: 100%;padding-right: 20px;">
                                <el-option key="0" label="停用" value="0" />
                                <el-option key="1" label="启用" value="1" />
                            </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
@@ -48,7 +65,7 @@
        <div class="plan-content-title">扩展字段</div>
        <template #footer>
            <el-button @click="visible=false" >取 æ¶ˆ</el-button>
            <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="dictSubmit()">保 å­˜</el-button>
            <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="productSubmit">保 å­˜</el-button>
        </template>
    </el-dialog>
</template>
@@ -58,6 +75,8 @@
        emits: ['success', 'closed'],
        data() {
            return {
                parentData: {},
                typeIdList: [],
                value1: true,
                mode: "add",
                titleMap: {
@@ -69,19 +88,19 @@
                isSaveing: false,
                //表单数据
                addDictForm: {
                    parentId: "",
                    code: "",
                    dictValue: "",
                    sort: "",
                    isSealed: false,
                    remark: "",
                    dictKey: "-1",
                    $isSealed: "否"
                    name: "",
                    typeId: "",
                    unit: "",
                    standardModel: "",
                    description: "",
                    status: "1"
                },
                //验证规则
                addDictRules: {
                    code:[{required: true, message: '请输入字典编号'}],
                    dictValue:[{required: true, message: '请输入字典名称'}],
                    sort:[{required: true, message: '请输入字典排序'}]
                    name:[{required: true, message: '请输入产品名称'}],
                    typeId:[{required: true, message: '请选择产品类型',trigger: 'change'}]
                },
                //所需数据选项
                groups: [],
@@ -102,9 +121,21 @@
            // this.getDept()
        },
        methods: {
            showParentData() {
                this.$HTTP.get("/api/blade-cps/product/tree?status=1").then(res=> {
                    if(res.code == 200) {
                        this.parentData = res.data;
                    }
                })
            },
            parentIdChange(val) {
            },
            //显示
            open(mode='add'){
            open(typeIdList,mode='add'){
                this.showParentData();  //tree-select
                this.mode = mode;
                this.typeIdList = typeIdList;
                this.visible = true;
                return this
            },
@@ -118,20 +149,11 @@
                this.depts = res.data;
            },
            //表单提交方法
            dictSubmit(){
            productSubmit(){
                var obj = Object.assign({},this.addDictForm);
                if(obj.isSealed === true) {
                    obj.$isSealed = "是";
                    obj.isSealed = "1";
                }else {
                    obj.$isSealed = "否";
                    obj.isSealed = "0";
                }
                this.$refs.dialogForm.validate(async (valid) => {
                    if (valid) {
                        this.isSaveing = true;
                        this.$HTTP.post("/api/blade-system/dict/submit",obj).then(res=> {
                            this.isSaveing = false;
                        this.$HTTP.post("/api/blade-cps/product/insert",obj).then(res=> {
                            if(res.code == 200) {
                                this.$emit('success', this.addDictForm, this.mode);
                                this.visible = false;
@@ -149,12 +171,10 @@
            setData(data){
                console.log(data)
                //可以和上面一样单个注入,也可以像下面一样直接合并进去
                if(data.isSealed == "1") {
                    data.isSealed = true;
                }else {
                    data.isSealed = false;
                }
                Object.assign(this.addDictForm, data);
                if(data.parentId == 0) {
                    this.addDictForm.parentId = "";
                }
            }
        }
    }
src/views/console/basic-data/product.vue
@@ -47,6 +47,44 @@
                            <el-icon @click="addDrawer" class="searchi-icon"><Setting /></el-icon>
                        </el-col>
                    </el-row>
                    <div class="product-type-table">
                        <el-table ref="multipleTableRef0" :data="productTableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange0" row-key="id" lazy :load="tableLoad" :tree-props="{ hasChildren: 'hasChild' }">
                            <el-table-column type="selection" width="55" />
                            <el-table-column prop="name" label="产品名称"></el-table-column>
                            <el-table-column prop="code" label="产品编号"></el-table-column>
                            <el-table-column prop="typeName" label="产品类型"></el-table-column>
                            <el-table-column prop="unit" label="计量单位"></el-table-column>
                            <el-table-column prop="standardModel" label="规格型号"></el-table-column>
                            <el-table-column prop="description" label="产品描述"></el-table-column>
                            <el-table-column prop="remark" label="工艺路线">
                                <template #default="scope">
                                     <span class="viewDetial">查看详情</span>
                                 </template>
                            </el-table-column>
                            <el-table-column prop="remark" label="BOM清单">
                                <template #default="scope">
                                     <span class="viewDetial">查看详情</span>
                                 </template>
                            </el-table-column>
                            <el-table-column fixed="right" label="操作" width="200px">
                                <template #default="scope">
                                    <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button>
                                    <el-button text type="primary" size="small" @click="refresh_product_type(scope.row, scope.$index)">刷新</el-button>
                                    <el-button text type="primary" size="small" @click="del_product_type(scope.row, scope.$index,0)">删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                        <el-pagination
                            style="margin-top: 12px;"
                            @size-change="handleSizeChange0"
                            @current-change="handleCurrentChange0"
                            :current-page="currentPage4"
                            :page-sizes="[15, 50, 100]"
                            :page-size="15"
                            layout="total, sizes, prev, pager, next, jumper"
                            :total="total0">
                        </el-pagination>
                    </div>
                    <el-drawer title="查询设置" v-model="drawer" :direction="direction" :before-close="handleClose" size="780" class="drawerClass">
                        <div class="drawer-form">
                            <div class="drawer-left">
@@ -92,7 +130,7 @@
                        </el-col>
                    </el-row>
                    <div class="product-type-table">
                        <el-table ref="multipleTableRef" :data="productTypeTableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange">
                        <el-table ref="multipleTableRef1" :data="productTypeTableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange1">
                            <el-table-column type="selection" width="55" />
                            <el-table-column prop="name" label="产品类型名称"></el-table-column>
                            <el-table-column prop="remark" label="描述"></el-table-column>
@@ -103,14 +141,14 @@
                            </el-table-column>
                            <el-table-column fixed="right" label="操作">
                                <template #default="scope">
                                    <el-button text type="primary" size="small" @click="del_product_type(scope.row, scope.$index)">删除</el-button>
                                    <el-button text type="primary" size="small" @click="del_product_type(scope.row, scope.$index,1)">删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                        <el-pagination
                            style="margin-top: 12px;"
                            @size-change="handleSizeChange"
                            @current-change="handleCurrentChange"
                            @size-change="handleSizeChange1"
                            @current-change="handleCurrentChange1"
                            :current-page="currentPage4"
                            :page-sizes="[15, 50, 100]"
                            :page-size="15"
@@ -150,6 +188,8 @@
        name: "allocation",
        data(){
            return {
                total0: 0,
                productTableData: [],
                checkData: [],
                checkList: [],
                id: "",
@@ -167,7 +207,8 @@
                uploadUrl: "/api/blade-cps/employee/import-employee",
                exportUrl: "/api/blade-cps/employee/export-template",
                activeName: 'first',
                selection: [],
                selection0: [],
                selection1: [],
                total: 0,
                searchData: {
                    keyWord: "",
@@ -180,14 +221,15 @@
                dialog: {
                    save: false
                },
                tableData: []
                tableData: [],
                delTypeNum: ""
            }
        },
        created(){
            
        },
        mounted(){
            //this.searchBtn();
            this.searchBtn0();
            this.getProductType();
            this.getProductTypeSelect();
            this.getFields();  //查询设置
@@ -196,6 +238,14 @@
            ...ElementPlusIconsVue,saveDialog,importTable
        },
        methods: {
            tableLoad(row,treeNode,resolve) {
                this.searchData.parentId= row.id;
                this.$HTTP.post(`/api/blade-cps/product/lazy/tree?current=1&size=-1&id=${row.id}`).then(res=> {
                    if(res.code == 200) {
                        resolve(res.data.records);
                    }
                })
            },
            delIcon(index) {
                this.checkData.splice(index,1);
            },
@@ -210,8 +260,15 @@
                })
            },
            delTypeDataSingle(type) {
                if(this.delTypeNum == 0) {  //删除产品
                    var url = "/api/blade-cps/product/remove";
                    var stopUrl = "/api/blade-cps/product/change-status";
                }else if(this.delTypeNum == 1) {  //删除产品类型
                    var url = "/api/blade-cps/product-type/remove";
                    var stopUrl = "/api/blade-cps/product-type/change-status";
                }
                if(type == 0) {  //删除
                    this.$HTTP.delete(`/api/blade-cps/product-type/remove`,[this.id]).then(res=> {
                    this.$HTTP.delete(url,[this.id]).then(res=> {
                        if(res.code == 200) {
                            this.$message.success("操作成功");
                            this.delTypeModel = false;
@@ -224,7 +281,7 @@
                        ids: [this.id],
                        status: 0
                    }
                    this.$HTTP.put(`/api/blade-cps/product-type/change-status`,obj).then(res=> {
                    this.$HTTP.put(stopUrl ,obj).then(res=> {
                        if(res.code == 200) {
                            this.$message.success("操作成功");
                            this.delTypeModel = false;
@@ -261,7 +318,8 @@
                    }
                })
            },
            del_product_type(row) {
            del_product_type(row,index,type) {
                this.delTypeNum = tyype;
                this.id = row.id;
                this.delTypeModel = true;
            },
@@ -302,7 +360,7 @@
                done();
            },
            getExport() {
                this.$HTTP.get(`/api/blade-cps/employee/export-employee?` + this.$TOOL.qsStringify(this.searchData)).then(res => {
                this.$HTTP.post(`/api/blade-cps/product/export-product`,this.searchData).then(res => {
                    if (res.code == 200) {
                        window.open(res.data.link);
                    }
@@ -322,23 +380,28 @@
            },
            searchClearBtn() {
                this.searchData = {
                    code: "",
                    ProductValue: "",
                    keyWord: "",
                    standardModel: "",
                    status: "1",
                    typeId: [],
                    current: "1",
                    size: "15"
                }
                this.searchBtn();
                this.searchBtn0();
            },
            refresh_product_type() {
                this.searchClearBtn();
            },
            searchclick() {
                this.searchData.current = "1";
                this.searchData.size = "15";
                this.searchBtn();
                this.searchBtn0();
            },
            searchBtn() {
                this.$HTTP.get("/api/blade-system/Product/parent-list",this.searchData).then(res=> {
            searchBtn0() {
                this.$HTTP.post("/api/blade-cps/product/lazy/tree?current=1&size=15&id=0",this.searchData).then(res=> {
                    if(res.code == 200) {
                        this.tableData = res.data.records;
                        this.total = res.data.total;
                        this.productTableData = res.data.records;
                        this.total0 = res.data.total;
                    }
                })
            },
@@ -358,7 +421,7 @@
                    this.$HTTP.post("/api/blade-system/Product/remove?ids="+row.id).then(res=> {
                        if(res.code == 200) {
                            that.$message.success("操作成功");
                            that.searchBtn();
                            that.searchBtn1();
                        }
                    })
                }).catch(() => {
@@ -369,16 +432,16 @@
            addData(){
                this.dialog.save = true
                this.$nextTick(() => {
                    this.$refs.saveDialog.open()
                    this.$refs.saveDialog.open(this.typeIdList)
                })
            },
            table_edit(row){
                this.dialog.save = true
                this.$HTTP.get("/api/blade-system/Product/detail?id="+row.id).then(res=> {
                this.$HTTP.get(`/api/blade-cps/product/get/${row.id}`).then(res=> {
                    if(res.code == 200) {
                        this.dialog.save = true;
                        this.$nextTick(() => {
                            this.$refs.saveDialog.open('edit').setData(res.data);
                            this.$refs.saveDialog.open(this.typeIdList,'edit').setData(res.data);
                        })
                    }
                })
@@ -390,46 +453,66 @@
                    this.$refs.saveDialog.open('show').setData(row)
                })
            },
            handleSelectionChange(selection) {
                this.selection = selection;
            handleSelectionChange0(selection) {
                this.selection0 = selection;
            },
            handleSelectionChange1(selection) {
                this.selection1 = selection;
            },
            addTypeData() {
                this.isAddType = true;
            },
            delTypeData() {
            },
            delData() {
                if(this.selection.length == 0) {
                if(this.selection1.length == 0) {
                    this.$message({
                      message: '请选择至少一条数据',
                      type: 'warning'
                    });
                    return;
                }
                var selStr = "";
                this.selection.map(item=> {
                    selStr += item.id + ","
                })
                selStr = selStr.replace(/,$/, '');
                var that = this;
                this.$HTTP.post("/api/blade-system/Product/remove?ids="+selStr).then(res=> {
                    if(res.code == 200) {
                        that.$message.success("操作成功");
                        that.searchclick();
                    }
                })
            },
            handleSizeChange(val) {
            delData() {
                if(this.selection0.length == 0) {
                    this.$message({
                      message: '请选择至少一条数据',
                      type: 'warning'
                    });
                    return;
                }
                // var selStr = "";
                // this.selection1.map(item=> {
                //     selStr += item.id + ","
                // })
                // selStr = selStr.replace(/,$/, '');
                // var that = this;
                // this.$HTTP.post("/api/blade-system/Product/remove?ids="+selStr).then(res=> {
                //     if(res.code == 200) {
                //         that.$message.success("操作成功");
                //         that.searchclick();
                //     }
                // })
            },
            handleSizeChange0(val) {
                console.log(`每页 ${val} æ¡`);
                this.searchData.current = "1";
                this.searchData.size = val;
                this.searchBtn();
                this.searchBtn0();
            },
            handleCurrentChange(val) {
            handleCurrentChange0(val) {
                console.log(`当前页: ${val}`);
                this.searchData.current = val;
                this.searchBtn();
                this.searchBtn0();
            },
            handleSizeChange1(val) {
                console.log(`每页 ${val} æ¡`);
                this.searchData.current = "1";
                this.searchData.size = val;
                this.searchBtn1();
            },
            handleCurrentChange1(val) {
                console.log(`当前页: ${val}`);
                this.searchData.current = val;
                this.searchBtn1();
            }
        }
    }
@@ -446,7 +529,7 @@
        padding-right: 8px;
        margin-bottom: 8px;
    }
    .multipleTableRef {
    .multipleTableRef1,.multipleTableRef0 {
        margin-bottom: 8px;
    }
    .search-condition {
@@ -498,7 +581,6 @@
    .delBtn:nth-child(1) {
        margin-right: 4px;
    }
    .delBtn:hover {
        background-color: #f34d5b;
        border-color: #f34d5b;
@@ -546,4 +628,8 @@
        display: inline-block;
        min-width: 80px;
    }
    .viewDetial {
        color: #337ecc;
        cursor: pointer;
    }
</style>
src/views/console/bom-list/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,94 @@
<template>
    <div class="rolePage">
        <div class="roleContainer">
            <div class="roleContainer-title">产品列表</div>
            <el-input v-model="keyword" prefix-icon="el-icon-search" placeholder="输入搜索内容" clearable @keyup.enter="searchBtn"></el-input>
            <ul>
                <li v-for="(item,index) in leftData" @click="changeTabaleLi(item,index)">
                    <span :class="{active: item.active}">{{item.roleName}}</span>
                </li>
            </ul>
        </div>
        <div class="role-main-tabs">
            <div class="role-main-header">
                <div class="roleContainer-title">BOM清单</div>
                <div>
                    <div>BOM版本</div>
                    <div>
                        <span>产品名称</span>
                        <span>产品编号</span>
                    </div>
                    <div>
                        <span>未定版</span>
                        <span>已定版</span>
                    </div>
                    <div>
                        æ·»åŠ æ–°ç‰ˆæœ¬
                    </div>
                </div>
            </div>
            <el-tabs tab-position="top">
                <div>
                    <div>BOM清单列表</div>
                </div>
                <div>
                    <ul>
                        <li>物料编号</li>
                        <li>物料名称</li>
                        <li>规格</li>
                        <li>计量单位</li>
                        <li>物料类型</li>
                        <li>物料属性</li>
                        <li>是否必检</li>
                        <li>额定库存</li>
                        <li>安全库存</li>
                    </ul>
                    <el-table ref="multipleTableRef0" :data="tableData" border style="width: 100%" class="multipleTableRef">
                        <el-table-column prop="name" label="工序编号"></el-table-column>
                        <el-table-column prop="code" label="工序名称"></el-table-column>
                        <el-table-column prop="typeName" label="用量分子"></el-table-column>
                        <el-table-column prop="unit" label="用量分母"></el-table-column>
                        <el-table-column prop="standardModel" label="固定耗损"></el-table-column>
                        <el-table-column fixed="right" label="操作" width="200px">
                            <template #default="scope">
                                <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button>
                                <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)">刷新</el-button>
                                <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </div>
            </el-tabs>
        </div>
    </div>
</template>
<script>
    export default {
        name: 'BOM',
        components: {
        },
        data() {
            return {
                leftData: [],
                dialog: {
                    save: false,
                    permission: false
                },
                tableData: []
            }
        },
        mounted(){
        },
        methods: {
            searchBtn() {},
        }
    }
</script>
<style scoped>
</style>