<!--
|
* @Date: 2024-05-12 20:02:31
|
* @LastEditors: Sneed
|
* @LastEditTime: 2024-06-16 16:18:09
|
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/tooling/tray-fixturePreview.vue
|
-->
|
<template>
|
<el-container>
|
<el-aside width="200px">
|
<el-tree :expand-on-click-node="false" default-expand-all ref="group" node-key="id" :data="treeData" :props="{
|
label: 'name',
|
disabled: 'isGroup'
|
}" @node-click="nodeClick">
|
<template #default="{ node, data }">
|
<span :class="data.isGroup ? 'active' : ''" class="custom-tree-node">
|
<span>{{
|
node.label || data.code }}</span>
|
</span>
|
</template>
|
</el-tree>
|
</el-aside>
|
<!-- <el-main> -->
|
<el-container>
|
<el-header>
|
<import-table style="margin:0 8px" exportUrl="/api/smis/tray-fixture/excel/template"
|
uploadUrl="/api/smis/tray-fixture/excel/import"></import-table>
|
</el-header>
|
<el-main v-if="selectNode.id">
|
<el-row>
|
<el-col style="margin-bottom: 8px">
|
<h2>托盘信息</h2>
|
</el-col>
|
<el-col :span="4">
|
托盘编号: {{ info?.code || '-' }}
|
</el-col>
|
<el-col :span="4">
|
托盘名称: {{ info?.name || '-' }}
|
</el-col>
|
<el-col :span="4">
|
托盘规格: {{ info?.standardModel || '-' }}
|
</el-col>
|
<el-col :span="4">
|
托盘状态: {{ info?.trayStatus ? '空载' : '负载' }}
|
</el-col>
|
<el-col :span="4">
|
可用状态: {{ info?.availability ? '激活' : '冻结' }}
|
<!-- 1-激活 0-冻结 -->
|
</el-col>
|
<el-col :span="4">
|
托盘描述: {{ info?.description || '-' }}
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col style="margin: 20px 0">
|
<h2>托盘面</h2>
|
</el-col>
|
<el-col :span="24">
|
<el-collapse v-model="activeNames" style="margin-top: 20px;">
|
<el-collapse-item v-for="item in surfaceList" :key="item.id" :title="item.name"
|
:name="item.id">
|
<el-table stripe :data="item.list">
|
<el-table-column label="夹具编号" prop="fixtureCode"></el-table-column>
|
<el-table-column label="夹具名称" prop="fixtureName"></el-table-column>
|
</el-table>
|
</el-collapse-item>
|
</el-collapse>
|
</el-col>
|
</el-row>
|
|
<el-row>
|
<el-col style="margin: 20px 0">
|
<h2>托盘工艺文件</h2>
|
|
</el-col>
|
</el-row>
|
</el-main>
|
<el-main class="empty" v-else>
|
<el-empty></el-empty>
|
</el-main>
|
</el-container>
|
<!-- </el-main> -->
|
</el-container>
|
</template>
|
|
<script>
|
import importTable from '@/layout/components/importTable.vue'
|
export default {
|
components: {
|
importTable
|
},
|
data() {
|
return {
|
treeData: [],
|
info: {},
|
surfaceList: [], //托盘面
|
fileList: [], //附件
|
selectNode: {},
|
activeNames: ''
|
}
|
},
|
watch: {
|
'selectNode.id': {
|
handler(val) {
|
if (val) {
|
this.queryInfo()
|
} else {
|
this.info = {}
|
}
|
}
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
this.$HTTP.post(`/api/smis/tray/tray-tree`, {
|
groupCategory: 1,
|
groupType: "group_tray"
|
}).then(res => {
|
this.treeData = res.data
|
})
|
},
|
async queryInfo() {
|
this.$HTTP.get(`/api/smis/tray/${this.selectNode.id}`).then(res => {
|
this.info = res.data
|
})
|
|
this.$HTTP.post(`/api/smis/tray/tool-appendix?id=${this.selectNode.id}`).then(res => {
|
this.fileList = res.data
|
})
|
await this.$HTTP.get(`/api/smis/tray-surface/list/${this.selectNode.id}`).then(res => {
|
this.surfaceList = res.data
|
this.activeNames = res.data?.[0]?.id
|
})
|
Promise.all(this.surfaceList.map(item => {
|
return this.$HTTP.get(`/api/smis/tray-fixture/list/fixture?faceId=${item.id}`)
|
})).then(data => {
|
data.forEach((v, i) => {
|
this.surfaceList[i].list = v.data
|
})
|
})
|
console.log(this.surfaceList)
|
},
|
nodeClick(node) {
|
if (!node.isGroup) this.selectNode = node
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.custom-tree-node.active {
|
color: #ccc;
|
}
|
|
.empty {
|
justify-content: center;
|
}
|
</style>
|