From dcf9c9e0410fe1186239e3f8d6f7bdc789c08010 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期三, 05 六月 2024 18:00:39 +0800
Subject: [PATCH] 1

---
 src/views/master/frock/tray-deposit/index.vue |  206 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 200 insertions(+), 6 deletions(-)

diff --git a/src/views/master/frock/tray-deposit/index.vue b/src/views/master/frock/tray-deposit/index.vue
index fd50fe5..8c2bd2f 100644
--- a/src/views/master/frock/tray-deposit/index.vue
+++ b/src/views/master/frock/tray-deposit/index.vue
@@ -1,19 +1,213 @@
 <!--
- * @Date: 2024-05-07 22:49:32
+ * @Date: 2024-05-07 22:46:30
  * @LastEditors: Sneed
- * @LastEditTime: 2024-05-07 22:49:45
+ * @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>
-    <div>
-        鎵樼洏瀛樻斁
-    </div>
+    <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></style>
\ No newline at end of file
+<style lang="scss" scoped>
+.treedisabled {
+    color: #ccc;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3