<!--
|
* @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>
|