<!--
|
* @Date: 2024-05-07 22:46:30
|
* @LastEditors: Sneed
|
* @LastEditTime: 2024-05-12 17:50:26
|
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/master/frock/tray-deposit/index.vue
|
-->
|
<template>
|
<el-main style="height: 100%;">
|
<el-card shadow="never" style="height: 100%;" body-style="height: 100%">
|
<el-containter>
|
<el-header>
|
<import-table style="margin:0 8px" :exportUrl="exportUrl" :uploadUrl="uploadUrl"></import-table>
|
</el-header>
|
<el-main>
|
<el-container>
|
<el-aside width="200px" v-loading="showGrouploading">
|
<el-tree default-expand-all ref="group" node-key="id" :data="treeData" :props="props"
|
@node-click="nodeClick">
|
<template #default="{ node, data }">
|
<span class="custom-tree-node">
|
<span :class="data.isArea ? 'treedisabled' : ''">{{
|
node.label }}</span>
|
</span>
|
</template>
|
</el-tree>
|
</el-aside>
|
<el-container>
|
<el-main v-if="selectNode?.id">
|
<el-row>
|
<el-col :span="4">
|
库位编号: {{ selectNode.warehouseCode }}
|
</el-col>
|
<el-col :span="4">
|
库位名称: {{ selectNode.warehouseName }}
|
</el-col>
|
<el-col :span="4">
|
库位描述: {{ selectNode.remark }}
|
</el-col>
|
</el-row>
|
<el-row style="margin-top: 10px;">
|
<el-col>
|
<el-button @click="table_add" type="primary" icon="el-icon-plus">添加</el-button>
|
</el-col>
|
<el-col style="margin-top: 10px;">
|
<scTable :pageSize="10000" ref="table" @selection-change="handleSelectionChange"
|
row-key="id" border :params="params" :apiObj="apiObj" stripe
|
@dataChange="dataChange">
|
<!-- <el-table-column type="selection" width="55" /> -->
|
<el-table-column prop="trayCode" label="托盘编号" />
|
<el-table-column prop="trayName" label="托盘名称" />
|
<el-table-column label="操作" fixed="right" align="left" width="160">
|
<template #default="scope">
|
<el-button-group>
|
<el-popconfirm width="220" title="确定将选择的数据删除"
|
@confirm="table_del([scope.row], '0')">
|
<template #reference>
|
<el-button text type="primary"
|
size="small">删除</el-button>
|
</template>
|
</el-popconfirm>
|
</el-button-group>
|
</template>
|
</el-table-column>
|
</scTable>
|
</el-col>
|
|
</el-row>
|
</el-main>
|
<el-main v-else>
|
<el-empty description="" />
|
</el-main>
|
</el-container>
|
</el-container>
|
</el-main>
|
</el-containter>
|
</el-card>
|
<el-dialog v-model="dialogVisible" title="添加" width="500">
|
<el-tree show-checkbox default-expand-all ref="group1" node-key="id" :data="todoList" :props="{
|
label: 'name',
|
disabled: 'isGroup'
|
}">
|
<template #default="{ node, data }">
|
<span class="custom-tree-node">
|
<span>{{
|
node.label || data.code }}</span>
|
</span>
|
</template>
|
</el-tree>
|
<template #footer>
|
<div class="dialog-footer">
|
<el-button type="primary" @click="add">
|
确定
|
</el-button>
|
</div>
|
</template>
|
</el-dialog>
|
</el-main>
|
</template>
|
|
<script>
|
import importTable from '@/layout/components/importTable.vue'
|
export default {
|
components: {
|
importTable,
|
},
|
watch: {
|
selectNode(val) {
|
this.params.wareId = val?.id
|
this.$refs?.table?.reload()
|
}
|
},
|
data() {
|
return {
|
options: {
|
|
},
|
props: {
|
label: 'name',
|
disabled: 'isArea'
|
},
|
exportUrl: '/api/blade-cps/tray-storage/excel/template',
|
uploadUrl: '/api/blade-cps/tray-storage/excel/import',
|
treeData: [],
|
selectNode: {},
|
apiObj: {
|
get: async (data) => {
|
let params = {
|
warehouseStationId: this.selectNode.id
|
}
|
return await this.$HTTP.get(`/api/blade-cps/tray-storage/list`, {}, { params }).then(res => {
|
return {
|
data: {
|
records: res.data,
|
total: res.data?.length,
|
summary: res.data?.summary,
|
},
|
msg: res.msg,
|
code: res.code
|
}
|
})
|
}
|
},
|
params: {
|
warehouseStationId: ''
|
},
|
todoList: [],
|
dialogVisible: false,
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
this.$HTTP.get(`/api/blade-cps/tray-storage/tree`).then(res => {
|
this.treeData = res.data
|
})
|
this.$HTTP.get(`/api/blade-cps/material-type/list`).then(res => {
|
this.options.typeId = res.data.map(item => ({
|
label: item.name,
|
value: item.id
|
}))
|
})
|
this.$HTTP.get(`/api/blade-system/dict/dictionary?code=material_property`).then(res => {
|
this.options.property = res.data.map(item => ({
|
label: item.dictValue,
|
value: item.dictKey - 0
|
}))
|
})
|
},
|
nodeClick(node) {
|
if (node.isArea) return
|
this.queryInfo(node.id)
|
},
|
queryInfo(id) {
|
this.$HTTP.get(`/api/blade-cps/warehouse-station/get/${id}`).then(res => {
|
this.selectNode = res.data
|
})
|
},
|
table_add() {
|
this.$HTTP.post(`/api/blade-cps/tray/un-used-tray-tree`, { groupCategory: 1, groupType: 'group_tray' }).then(res => {
|
if (res.data?.length > 0) {
|
this.todoList = res.data
|
this.dialogVisible = true
|
} else {
|
this.$message.warning("暂无可添加托盘")
|
}
|
})
|
},
|
add() {
|
let ids = this.$refs.group1.getCheckedNodes()
|
console.log(ids)
|
this.$HTTP.post(`/api/blade-cps/tray-storage`, { warehouseStationId: this.selectNode.id, trayIds: ids.map(v => v.id) }).then(res => {
|
this.$message.success("操作成功")
|
this.dialogVisible = false
|
this.$refs.table.reload()
|
})
|
},
|
table_del(ids) {
|
this.$HTTP.delete(`/api/blade-cps/tray-storage`, { ids: ids.map(v => ({ id: v.id, othersId: v.trayId })) }).then(res => {
|
this.$message.success("操作成功")
|
this.$refs.table.reload()
|
})
|
}
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.treedisabled {
|
color: #ccc;
|
}
|
</style>
|