gaoshp
2024-04-27 0cbc8a23790c0f33274dc06de9f42ed6372a62c7
UPDATE
已添加4个文件
已修改1个文件
396 ■■■■■ 文件已修改
src/api/model/machineManagement.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/workstation/index.vue 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tpm/Machine.vue 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tpm/MachineGroup.vue 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tpm/machine-management.vue 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/model/machineManagement.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
/*
 * @Date: 2024-03-24 11:37:47
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-27 20:26:42
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/api/model/machineManagement.js
 */
import config from "@/config"
import http from "@/utils/request"
export default {
    getList: {
        url: `${config.API_URL}/blade-cps/machine/page`,
        name: "获取工位列表",
        get: async function (params) {
            return await http.post(this.url, { ...params }, { params: { current: params.current, size: params.size } });
        },
    },
}
src/views/console/workstation/index.vue
@@ -47,14 +47,10 @@
                                        ref="table" :params="params" :apiObj="apiObj"
                                        @selection-change="selectionChange" stripe>
                                        <el-table-column type="selection" width="50"></el-table-column>
                                        <el-table-column label="工位编号" prop="code" width="120"
                                            sortable='custom'></el-table-column>
                                        <el-table-column label="工位名称" prop="name" width="120"
                                            sortable='custom'></el-table-column>
                                        <el-table-column label="工位类型" prop="type" width="120"
                                            sortable='custom'></el-table-column>
                                        <el-table-column label="工位日历" prop="calendarName" width="120"
                                            sortable='custom'></el-table-column>
                                        <el-table-column label="工位编号" prop="code" width="120"></el-table-column>
                                        <el-table-column label="工位名称" prop="name" width="120"></el-table-column>
                                        <el-table-column label="工位类型" prop="type" width="120"></el-table-column>
                                        <el-table-column label="工位日历" prop="calendarName" width="120"></el-table-column>
                                        <el-table-column label="操作" fixed="right" align="right" width="160">
                                            <template #default="scope">
                                                <el-button-group>
@@ -129,49 +125,64 @@
                                                    <el-container>
                                                        <el-header>
                                                            <span>采集信息</span>
                                                            <el-button  @click="editFlag = !editFlag" style="margin-left: auto;" text type="primary" size="small">配置工位采集</el-button>
                                                            <el-button v-show="editFlag" @click="saveInfo" text type="primary" size="small">保存</el-button>
                                                            <el-button text type="primary" size="small">修改DMP配置</el-button>
                                                            <el-button @click="editFlag = !editFlag"
                                                                style="margin-left: auto;" text type="primary"
                                                                size="small">配置工位采集</el-button>
                                                            <el-button v-show="editFlag" @click="saveInfo" text
                                                                type="primary" size="small">保存</el-button>
                                                            <el-button text type="primary"
                                                                size="small">修改DMP配置</el-button>
                                                        </el-header>
                                                        <el-main>
                                                            <el-table :data="list" height="200px">
                                                                <el-table-column label="采集变量名称" prop="name" />
                                                                <el-table-column label="工位变量名称" prop="dataItem">
                                                                    <template #default="scope">
                                                                        <el-input :disabled="!editFlag" v-model="scope.row.dataItem"></el-input>
                                                                        <el-input :disabled="!editFlag"
                                                                            v-model="scope.row.dataItem"></el-input>
                                                                    </template>
                                                                </el-table-column>
                                                                <el-table-column label="数据标签" prop="description">
                                                                    <template #default="scope">
                                                                        <el-select :disabled="!editFlag" v-model="scope.row.description">
                                                                            <el-option v-for="item in workstation_param_type" :key="item.dictKey" :label="item.dictValue"
                                                                                :value="item.dictKey-0" />
                                                                        <el-select :disabled="!editFlag"
                                                                            v-model="scope.row.description">
                                                                            <el-option
                                                                                v-for="item in workstation_param_type"
                                                                                :key="item.dictKey"
                                                                                :label="item.dictValue"
                                                                                :value="item.dictKey - 0" />
                                                                        </el-select>
                                                                        <!-- {{ dmp_data_type.find(v => v.dictKey == scope.row.wcsDataType)?.dictValue }} -->
                                                                    </template>
                                                                </el-table-column>
                                                                <el-table-column label="数据类别" prop="wcsDataType">
                                                                    <template #default="scope">
                                                                        <el-select disabled v-model="scope.row.wcsDataType">
                                                                            <el-option v-for="item in dmp_data_type" :key="item.dictKey" :label="item.dictValue"
                                                                                :value="item.dictKey-0" />
                                                                        <el-select disabled
                                                                            v-model="scope.row.wcsDataType">
                                                                            <el-option v-for="item in dmp_data_type"
                                                                                :key="item.dictKey"
                                                                                :label="item.dictValue"
                                                                                :value="item.dictKey - 0" />
                                                                        </el-select>
                                                                        <!-- {{ dmp_data_type.find(v => v.dictKey == scope.row.wcsDataType)?.dictValue }} -->
                                                                    </template>
                                                                </el-table-column>
                                                                <el-table-column label="大屏" prop="bigScreen">
                                                                    <template #default="scope">
                                                                        <el-checkbox :disabled="!editFlag" v-model="scope.row.bigScreen"  />
                                                                        <el-checkbox :disabled="!editFlag"
                                                                            v-model="scope.row.bigScreen" />
                                                                    </template>
                                                                </el-table-column>
                                                                <el-table-column label="实时数据" prop="realTimeData">
                                                                    <template #default="scope">
                                                                        <el-checkbox :disabled="!editFlag" v-model="scope.row.realTimeData"  />
                                                                        <el-checkbox :disabled="!editFlag"
                                                                            v-model="scope.row.realTimeData" />
                                                                    </template>
                                                                </el-table-column>
                                                                <el-table-column label="过程参数" prop="processParameter">
                                                                    <template #default="scope">
                                                                        <el-checkbox :disabled="!editFlag" v-model="scope.row.processParameter"  />
                                                                        <el-checkbox :disabled="!editFlag"
                                                                            v-model="scope.row.processParameter" />
                                                                    </template>
                                                                </el-table-column>
                                                            </el-table>
@@ -210,7 +221,7 @@
                                                        <el-col :span="8">
                                                            <ul class="workbench">
                                                                <li v-for="item in workbenchVOList" :key="item.sort">
                                                                    {{`【${item.sort}】`}}{{item.name}}
                                                                    {{ `【${item.sort}】` }}{{ item.name }}
                                                                </li>
                                                            </ul>
                                                        </el-col>
@@ -659,8 +670,8 @@
                this.search()
            })
        },
        saveInfo () {
            this.$HTTP.post('/api/blade-cps/workstation-wcs/save',this.workbenchVOList).then(res => {
        saveInfo() {
            this.$HTTP.post('/api/blade-cps/workstation-wcs/save', this.workbenchVOList).then(res => {
                this.editFlag = false
            })
        },
@@ -701,6 +712,7 @@
        }
    }
}
.workbench {
    list-style: none;
}
src/views/tpm/Machine.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,126 @@
<!--
 * @Date: 2024-04-27 20:04:34
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-27 20:38:52
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/tpm/Machine.vue
-->
<template>
    <el-container>
        <el-aside width="200px" v-loading="showGrouploading">
            <el-container>
                <el-main class="nopadding">
                    <el-tree ref="group" default-expand-all node-key="id" :data="group"
                        :current-node-key="params.groupId" :highlight-current="true" @node-click="nodeClick"></el-tree>
                </el-main>
            </el-container>
        </el-aside>
        <el-container>
            <el-header>
                <div class="left-panel">
                    <el-button size="small" @click="table_add" type="primary" icon="el-icon-plus"></el-button>
                    <el-button size="small" type="danger" plain icon="el-icon-delete" @click="batchDel"></el-button>
                    <!-- <el-button type="primary" plain>导入</el-button>
                                    <el-button type="primary" plain>批量操作</el-button> -->
                </div>
                <div class="right-panel">
                    <div class="right-panel-search">
                        <span>类型</span>
                        <el-select size="small" v-model="params.machineTypeId" style="width: 240px">
                            <el-option size="small" v-for="item in types" :key="item.value" :label="item.label"
                                :value="item.value" />
                        </el-select>
                        <span>状态</span>
                        <el-select size="small" v-model="params.status" style="width: 240px">
                            <el-option size="small" v-for="item in status" :key="item.value" :label="item.label"
                                :value="item.value" />
                        </el-select>
                        <el-input size="small" v-model="params.machineName" style="width: 240px" placeholder="请输入机器名称"
                            clearable></el-input>
                        <el-button size="small" @click="search" type="primary" icon="el-icon-search"></el-button>
                    </div>
                </div>
            </el-header>
            <el-main class="nopadding">
                <scTable highlight-current-row @dataChange="dataChange" @row-click="rowClick" ref="table"
                    :params="params" :apiObj="apiObj" @selection-change="selectionChange" stripe>
                    <el-table-column type="selection" width="50"></el-table-column>
                    <el-table-column label="机器编号" prop="machineCode" width="120"></el-table-column>
                    <el-table-column label="机器名称" prop="machineName" width="120"></el-table-column>
                    <el-table-column label="所属机器组" prop="groupName" width="120"></el-table-column>
                    <el-table-column label="机器类型" prop="machineTypeName" width="120"></el-table-column>
                    <el-table-column label="机器序列号" prop="serialNo" width="120"></el-table-column>
                    <el-table-column label="短编号" prop="shortCode" width="120"></el-table-column>
                    <el-table-column label="机器规格" prop="machineModel" width="120"></el-table-column>
                    <el-table-column label="使用状态" prop="machineUseStatusName" width="120"></el-table-column>
                    <el-table-column label="操作" fixed="right" align="right" width="160">
                        <template #default="scope">
                            <el-button-group>
                                <el-button text type="primary" size="small"
                                    @click="table_edit(scope.row, scope.$index)">编辑</el-button>
                                <el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index, '0')">
                                    <template #reference>
                                        <el-button text type="primary" size="small">删除</el-button>
                                    </template>
                                </el-popconfirm>
                            </el-button-group>
                        </template>
                    </el-table-column>
                </scTable>
            </el-main>
        </el-container>
    </el-container>
</template>
<script>
export default {
    data() {
        return {
            apiObj: this.$API.machineManagement.getList,
            group: [],
            treeCheckKey: '',
            params: {
                groupId: '',
                machineCode: '',
                machineName: '',
                machineTypeId: '',
                status: 1,
            },
            status: [
                {
                    label: '启用',
                    value: 1
                },
                {
                    label: '停用',
                    value: 0
                }
            ],
            types: []
        }
    },
    created() {
        this.getTreeData()
    },
    methods: {
        getTreeData() {
            this.$HTTP.get('/api/blade-cps/group/tree?groupCategory=1&groupType=group_machine').then(res => {
                if (res.code === 200) {
                    this.group = res.data
                    this.params.groupId = res.data[0].id
                }
            })
        },
        nodeClick(node) {
            this.params.groupId = node.id
        },
        search() {
            this.$refs.table.reload(this.params)
        },
        table_add() { },
        batchDel() { },
    }
}
</script>
<style lang="scss" scoped></style>
src/views/tpm/MachineGroup.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,80 @@
<!--
 * @Date: 2024-04-27 20:02:44
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-27 20:49:52
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/tpm/MachineGroup.vue
-->
<template>
    <el-container>
        <el-aside width="200px" v-loading="showGrouploading">
            <el-container>
                <el-main class="nopadding">
                    <el-tree ref="group" node-key="id" :data="group" :current-node-key="treeCheckKey"
                        :highlight-current="true" default-expand-all @node-click="groupClick"></el-tree>
                </el-main>
            </el-container>
        </el-aside>
        <el-container>
            <el-header>
                <div class="left-panel">
                    <el-button @click="addChild" type="primary" plain>新增下级</el-button>
                    <el-button @click="del" type="danger" plain>删除</el-button>
                </div>
            </el-header>
            <el-main class="">
                <el-form :model="form" :rules="rules" ref="dialogForm" label-width="200px" label-position="left">
                    <el-form-item label="上级目录" prop="parentName">
                        <el-input style="width: 240px" v-model="form.parentName"></el-input>
                    </el-form-item>
                    <el-form-item label="机器组名称" prop="name">
                        <el-input style="width: 240px" v-model="form.name" clearable></el-input>
                    </el-form-item>
                </el-form>
                <el-button @click="save" style="width: 100px" type="primary" plain>保存</el-button>
            </el-main>
        </el-container>
    </el-container>
</template>
<script>
export default {
    data() {
        return {
            group: [],
            treeCheckKey: '',
            form: {
                name: '',
                parentName: '',
                parentId: '',
                id: '',
                groupType: 'group_machine',
                groupCategory: '1',
                code: ''
            },
        }
    },
    created() {
        this.getTreeData()
    },
    methods: {
        getTreeData() {
            this.$HTTP.get('/api/blade-cps/group/tree?groupCategory=1&groupType=group_machine').then(res => {
                if (res.code === 200) {
                    this.group = res.data
                    this.treeCheckKey = res.data[0].id
                }
            })
        },
        groupClick() {
        },
        addChild() { },
        del() { },
        save() {
        }
    }
}
</script>
<style lang="scss" scoped></style>
src/views/tpm/machine-management.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,111 @@
<template>
    <el-main>
        <el-card shadow="never">
            <el-tabs tab-position="top" class="custom-tabs" v-model="activeName">
                <el-tab-pane label="机器台账" name="1">
                    <Machine></Machine>
                </el-tab-pane>
                <el-tab-pane label="机器组" name="2">
                    <MachineGroup></MachineGroup>
                </el-tab-pane>
            </el-tabs>
        </el-card>
        <!-- <Dialog ref="dialog" @success="success" :option="{ types, status, group }"></Dialog> -->
    </el-main>
</template>
<script>
import pmsPng from '@/assets/pms.png'
// import Dialog from './Dialog.vue'
import MachineGroup from './MachineGroup.vue'
import Machine from './Machine.vue'
export default {
    name: 'system',
    components: {
        // Dialog,
        MachineGroup,
        Machine
    },
    data() {
        return {
            activeName: '1',
        }
    },
    watch: {
        activeName: {
            handler(val) {
                // this.queryList().then(() => {
                //     if (val == 1) {
                //         console.log('>>>>>>>>>>>>>>', this.treeCheckedNode)
                //         this.apiObj = this.$API.workstation.getList
                //         this.params = {
                //             groupId: this.treeCheckedNode.id,
                //             keyWord: '',
                //             status: 1,
                //             type: ''
                //         }
                //         this.groupClick1(this.treeCheckedNode)
                //     }
                // })
            },
            immediate: true
        },
        treeCheckedNode: {
            handler(val) {
                this.addGroupShow = false
                Object.keys(this.form).forEach(key => {
                    this.form[key] = val?.[key]
                })
            },
            deep: true
        }
    },
    created() {
        this.init()
        this.queryList()
    },
    methods: {
    }
}
</script>
<style lang="scss" scoped>
.show-info {
    list-style: none;
    font-size: 14px;
}
.preview-title {
    padding: 12px;
    margin-bottom: 14px;
    font-size: 16px;
}
.preview-content {
    font-size: 14px;
    display: flex;
    align-items: center;
    .img {
        width: 30%;
    }
    ul {
        list-style: none;
        display: flex;
        flex-wrap: wrap;
        li {
            width: 50%;
            flex: 1 0 auto;
            margin-bottom: 10px;
        }
    }
}
.workbench {
    list-style: none;
}
</style>