1
lzhe
2024-05-27 6c3ae44336f7f25e5b33330e353fc283ab04c1f4
1
已修改2个文件
320 ■■■■ 文件已修改
src/views/console/product-process/process-route/addWorkmanship.vue 268 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/product-process/process-route/workmanship.vue 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/product-process/process-route/addWorkmanship.vue
@@ -118,69 +118,102 @@
            </el-col>
            <el-col :span="24">
                <el-form-item label="夹具">
                    <el-button>关联夹具</el-button>
                    <el-button>批量关联</el-button>
                    <el-button type="primary" size="small" @click="isShowFirstFixtures = true" :disabled="isShowFirstFixtures">关联夹具</el-button>
                    <el-button size="small">批量关联</el-button>
                </el-form-item>
            </el-col>
            <!-- <el-col :span="24">
                <el-row style="margin-top: 12px;margin-bottom: 12px;" v-if="isAddData0">
            <!-- 添加夹具 -->
            <el-col :span="24" v-if="isShowFirstFixtures">
                <el-row style="margin-top: 12px;margin-bottom: 12px;">
                    <el-col :span="4">
                        <el-select v-model="addData0.type" placeholder="夹具组" size="small" style="padding-right: 20px;">
                            <el-option v-for="item in typeList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
                        <el-tree-select
                            @change = "fixturesChange"
                            default-expand-all
                            v-model="fixturesFirstData.groupId"
                            clearable
                            size="small"
                            node-key="id"
                            placeholder="夹具组"
                            ref="fixturesFirstData"
                            :data="fixturesFirstTree"
                            check-strictly
                            :props="{ label: 'name' }"
                            style="width:100%;"
                            :render-after-expand="false" />
                    </el-col>
                    <el-col :span="4">
                        <el-select v-model="fixturesFirstData.fixtureCode" size="small" style="width: 100%" placeholder="夹具编号" @change="fixtureCodeChange">
                            <el-option v-for="item in fixtureCodeList" :key="item.code" :label="item.code" :value="item.code"/>
                        </el-select>
                    </el-col>
                    <el-col :span="4">
                        <el-select v-model="addData0.type" placeholder="夹具编号" size="small" style="padding-right: 20px;">
                            <el-option v-for="item in typeList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
                        </el-select>
                        <el-input v-model="fixturesFirstData.name" disabled size="small" placeholder="夹具名称" style="padding-right: 20px;"></el-input>
                    </el-col>
                    <el-col :span="4">
                        <el-input v-model="addData0.description" disabled size="small" placeholder="夹具名称" style="padding-right: 20px;"></el-input>
                        <el-button type="primary" size="small" @click="saveFirstFixture">保存</el-button>
                        <el-button size="small" @click="cencelFirstFixture">取消</el-button>
                    </el-col>
                </el-row>
            </el-col> -->
            </el-col>
            <!-- 夹具table -->
            <el-col :span="24">
                <el-table ref="multipleTableRef" :data="fixtures" border style="width: 100%;margin-bottom:12px;" class="multipleTableRef">
                    <el-table-column prop="fixtureGroupName" label="夹具组">
                        <template #default="scope">
                            <el-tree-select
                                @change = "fixturesChange"
                                default-expand-all
                                v-model="item.fixtureCode"
                                clearable
                                node-key="id"
                                placeholder="夹具组"
                                ref="parentTree"
                                :data="fixturesData"
                                check-strictly
                                :props="{ label: 'name' }"
                                style="width:100%;"
                                :render-after-expand="false" />
                        </template>
                        <template #default="scope">{{scope.row.fixtureGroupName}}</template>
                    </el-table-column>
                    <el-table-column prop="name" label="夹具编号">
                        <template #default="scope">
                            <el-select v-model="item.fixtureCode" style="width: 100%" placeholder="刀具型号">
                                <el-option v-for="item in numJQList" :key="item.id" :label="item.name" :value="item.id"/>
                            </el-select>
                        </template>
                        <template #default="scope">{{scope.row.fixtureCode}}</template>
                    </el-table-column>
                    <el-table-column prop="fixtureName" 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="fixtures_del(scope.row, scope.$index)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-col>
            <el-col :span="24">
                <el-form-item label="刀具">
                    <el-button>关联刀具</el-button>
                    <el-button>批量关联</el-button>
                    <el-button type="primary" size="small" @click="isShowFirstTools = true" :disabled="isShowFirstTools">关联刀具</el-button>
                    <el-button size="small">批量关联</el-button>
                </el-form-item>
            </el-col>
            <!-- 添加刀具 -->
            <el-col :span="24" v-if="isShowFirstTools">
                <el-row style="margin-top: 12px;margin-bottom: 12px;">
                    <el-col :span="4">
                        <el-tree-select
                            @change = "toolsChange"
                            default-expand-all
                            v-model="toolsFirstData.groupId"
                            clearable
                            size="small"
                            node-key="id"
                            placeholder="刀具组"
                            ref="toolsFirstData"
                            :data="toolsFirstTree"
                            check-strictly
                            :props="{ label: 'name' }"
                            style="width:100%;"
                            :render-after-expand="false" />
                    </el-col>
                    <el-col :span="4">
                        <el-select v-model="toolsFirstData.test" size="small" style="width: 100%" placeholder="刀具型号">
                            <el-option v-for="item in testList" :key="item.code" :label="item.code" :value="item.code"/>
                        </el-select>
                    </el-col>
                    <el-col :span="4">
                        <el-select v-model="fixturesFirstData.test" size="small" style="padding-right: 20px;" placeholder="刀具编号">
                            <el-option v-for="item in testList" :key="item.code" :label="item.code" :value="item.code"/>
                        </el-select>
                    </el-col>
                    <el-col :span="4">
                        <el-button type="primary" size="small" @click="saveFirstTools">保存</el-button>
                        <el-button size="small" @click="cencelFirstTools">取消</el-button>
                    </el-col>
                </el-row>
            </el-col>
            <!-- 刀具table -->
            <el-col :span="24">
                <el-table ref="multipleTableRef" :data="tools" border style="width: 100%;" class="multipleTableRef">
                    <el-table-column prop="code" label="刀具类型">
@@ -214,7 +247,7 @@
        </el-row>
    </el-form>
    <div style="margin-top:12px;">
        <el-button>取消</el-button>
        <el-button @click="closeDrawer">取消</el-button>
        <el-button type="primary" @click="craftSave">保存</el-button>
    </div>
</template>
@@ -223,13 +256,25 @@
    export default {
        data() {
            return {
                toolsFirstTree: {},
                isShowFirstTools: false,
                fixtureCodeList: [],
                isShowFirstFixtures: false,
                toolsFirstData: {
                    test: ""
                },
                fixturesFirstData: {
                    fixtureId: "",
                    fixtureCode: "",
                    name: "",
                    groupId: ""
                },
                testList: [],
                fixturesFirstTree: {},
                programIdData: {},
                numDQList: [],
                modelDQList: [],
                typeDQList: [],
                numJQList: [],
                fixturesData: [],
                parentDQData: [],
                fixtures: [],
                tools: [],
                bagIdData: {},
@@ -253,17 +298,14 @@
                    programName: "",  //加工顺序
                    bagId: "",  //工具包
                    bagName: "",
                    isSelectProgramFiles: false,
                    test0: "",
                    test: "",
                    num: null,
                    box: false
                    isSelectProgramFiles: false
                },
                workmanshipRules: {
                    sort: [{ required: true, message: '请选择 工序顺序' }],
                },
            }
        },
        props: ["craftId","isClear"],
        mounted() {
            this.getToolingTree();  //夹具组tree
            this.getCategoryTree();  //刀具类型
@@ -271,19 +313,135 @@
            this.getNumberAndName();  //工序编号和名称
            this.getCatalogueTree();  //加工程序
        },
        watch: {
            isClear(val) {
                if(val) {
                    this.resetAll();
                }
            }
        },
        methods: {
            closeDrawer() {
                this.resetAll();
                this.$emit('success', {});
            },
            saveFirstTools() {
                this.$message.error("请选择刀具类型");
                return;
            },
            cencelFirstTools() {
                this.isShowFirstTools = false;
                this.toolsFirstData = {
                    // fixtureId: "",
                    // fixtureCode: "",
                    // name: ""
                }
                //this.fixtureCodeList = [];
            },
            fixtures_del(row,index) {
                this.fixtures.splice(index,1);
            },
            fixtureCodeChange(value) {
                this.fixtureCodeList.forEach(item=> {
                    if(item.code == value) {
                        this.fixturesFirstData.name = item.name;
                        this.fixturesFirstData.fixtureId = item.id;
                        this.fixturesFirstData.fixtureGroupName = item.fixtureGroupName;
                        this.fixturesFirstData.fixtureName = item.name;
                    }
                })
            },
            saveFirstFixture() {
                if(this.fixturesFirstData.fixtureCode == "") {
                    this.$message.error("请选择夹具");
                    return;
                }
                this.fixturesFirstData.code = this.fixturesFirstData.fixtureCode;
                this.fixtures.push(this.fixturesFirstData);
                this.cencelFirstFixture();
            },
            cencelFirstFixture() {
                this.isShowFirstFixtures = false;
                this.fixturesFirstData = {
                    fixtureId: "",
                    fixtureCode: "",
                    name: ""
                }
                this.fixtureCodeList = [];
            },
            fixturesChange(value) {
                var row = this.$refs.fixturesFirstData.getCurrentNode();
                this.fixturesFirstData.groupName = row.name;
                this.$HTTP.get(`/api/blade-cps/fixture/list?groupId=${value}`).then(res=> {
                    if(res.code == 200) {
                        this.fixtureCodeList = res.data;
                    }
                })
            },
            toolsChange(value) {
            },
            craftSave() {  //保存
                console.log(this.workmanshipForm)
                if(this.isShowFirstFixtures) {
                    this.$message.error("请先保存当前关联的夹具");
                    return;
                }
                if(this.isShowFirstTools) {
                    this.$message.error("请先保存当前关联的刀具");
                    return;
                }
                var obj = Object.assign({},this.workmanshipForm);
                obj.id = "";
                obj.fixtures = this.fixtures;
                obj.tools = this.tools;
                this.$HTTP.post(`/api/blade-cps/production-craft-process/insert?versionId=${this.craftId}`,[obj]).then(res=> {
                    if(res.code == 200) {
                        this.$emit('success', obj);
                        this.resetAll();
                    }
                })
            },
            resetAll() {
                this.workmanshipForm = {
                    processCode: "",
                    processId: "",
                    processName: "",
                    processTypeName: "-",
                    sort: null,
                    d: "",
                    h: "",
                    m: "",
                    s: "",
                    prepareTime: "",
                    disassemblyTime: "",
                    transportTime: "",
                    programId: "",
                    programName: "",  //加工顺序
                    bagId: "",  //工具包
                    bagName: "",
                    isSelectProgramFiles: false
                };
                this.fixtures = [];
                this.tools = [];
                this.toolsFirstData = {
                    test: ""
                };
                this.fixturesFirstData = {
                    fixtureId: "",
                    fixtureCode: "",
                    name: "",
                    groupId: ""
                };
            },
            processChange(val) {
                if(val) {
                    this.processCodeList.forEach(item=> {
                        if(val == item.id) {
                            console.log(item)
                            this.workmanshipForm.processId = item.id;
                            this.workmanshipForm.processCode = item.code;
                            this.workmanshipForm.processName = item.name;
                            this.workmanshipForm.processTypeName = item.typeName;
                            this.workmanshipForm.processType = item.type;
                        }
                    })
                }
@@ -309,7 +467,6 @@
                    if(res.code == 200) {
                        this.processCodeList = res.data.records;
                        this.processNameList = res.data.records;
                        console.log(res.data);
                    }
                })
            },
@@ -345,14 +502,11 @@
                }
                this.$HTTP.post("/api/blade-cps/tray/tooling-tree",obj).then(res=> {
                    if(res.code == 200) {
                        this.fixturesData = res.data;
                        this.fixturesFirstTree = res.data;
                    }
                })
            },
            programIdChange() {
            },
            fixturesChange() {
            },
            bagIdChange(val) {
@@ -360,6 +514,16 @@
            },
            table_edit() {
            },
            setData(data) {
                this.$HTTP.get(`/api/blade-cps/production-craft-process/get/${data.id}`).then(res=> {
                    if(res.code == 200) {
                        this.workmanshipForm = res.data;
                        this.fixtures = res.data.fixtures;
                        this.tools = res.data.tools;
                    }
                })
            }
        }
    }
src/views/console/product-process/process-route/workmanship.vue
@@ -46,7 +46,7 @@
    <el-drawer v-model="drawer" title="添加工序" direction="rtl" :before-close="handleClose" size="60%" modal-class="viewData">
        <!-- 新增路线 -->
        <div class="addworkmanship">
            <add-workmanship></add-workmanship>
            <add-workmanship ref="addworkmanship" @success="handleSuccess" :isClear="isClear" :craftId="craftId"></add-workmanship>
        </div>
    </el-drawer>
</template>
@@ -60,6 +60,7 @@
        props: ["isCustomization","craftId"],
        data() {
            return {
                isClear: false,
                drawer: false,
                tableData: [],
                selection: [],
@@ -78,6 +79,11 @@
            }
        },
        methods: {
            handleSuccess(value) {
                this.drawer = false;
                this.isClear = false;
                this.getcraftlList();
            },
            getcraftlList() {
                this.$HTTP.get(`/api/blade-cps/production-craft-version/detail/${this.craftId}`).then(res=> {
                    if(res.code == 200) {
@@ -88,8 +94,9 @@
                    }
                })
            },
            handleClose() {
            handleClose(done) {
                this.isClear = true;
                done();
            },
            determineVersion() {
                var that = this;
@@ -111,18 +118,6 @@
                // this.getWorkDetail();
                // this.getPage1();
            },
            table_edit(row,index) {
            },
            table_del(row,index) {
                this.$confirm(`确认要删除此工序吗?`, '', {
                    type: 'warning'
                }).then(() => {
                    this.tableData.splice(index,1);
                }).catch(() => {
                })
            },
            addRouteSuccess(selection) {
                selection.forEach((item,i)=> {
                    item.index = i+1;
@@ -141,6 +136,33 @@
                        this.$refs.saveDialog.open();
                    })
                }
            },
            table_edit(row,index) {
                this.drawer = true;
                this.$nextTick(()=> {
                    this.$refs.addworkmanship.setData(row);
                })
            },
            table_del(row,index) {
                var that = this;
                this.$confirm(`确认要删除此工序吗?`, '', {
                    type: 'warning'
                }).then(() => {
                    var obj = {
                        mainProcess: [],
                        normalProcess: that.tableData,
                        removeIds: [row.id],
                        versionId: that.craftId
                    }
                    this.$HTTP.post(`/api/blade-cps/production-craft-process/child-process-update`,obj).then(res=> {
                        if(res.code == 200) {
                            that.$message.success("操作成功");
                            that.getcraftlList();
                        }
                    })
                }).catch(() => {
                })
            }
        }
    }