gaoshp
2024-04-27 8b76298e3077e1823e2ab52e9ab3fafb4451c3a5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!--
 * @Date: 2024-04-27 20:04:34
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-27 21:51:12
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/tpm/MachineTab.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() {
            this.$router.push(`/tpm/machine/create`);
        },
        batchDel() { },
    }
}
</script>
 
<style lang="scss" scoped></style>