From 3e091224ab26252d8624b42b461ba773ee8bee0f Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期日, 03 十一月 2024 19:16:31 +0800
Subject: [PATCH] update

---
 src/views/console/tooling/Tray.vue |  135 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 117 insertions(+), 18 deletions(-)

diff --git a/src/views/console/tooling/Tray.vue b/src/views/console/tooling/Tray.vue
index 0771200..7fcb504 100644
--- a/src/views/console/tooling/Tray.vue
+++ b/src/views/console/tooling/Tray.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2024-05-12 20:02:31
  * @LastEditors: Sneed
- * @LastEditTime: 2024-05-13 23:27:37
+ * @LastEditTime: 2024-06-16 16:18:18
  * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/tooling/Tray.vue
 -->
 <template>
@@ -9,10 +9,11 @@
         <el-aside width="200px">
             <el-container>
                 <el-main>
-                    <el-tree default-expand-all ref="group" node-key="id" :data="treeData" :props="{
-                        label: 'name',
-                        disabled: 'isGroup'
-                    }" @node-click="nodeClick">
+                    <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 }">
                             <div :class="data.isGroup ? 'active' : ''" class="custom-tree-node">
                                 <span>{{ node.label || data.code }}</span>
@@ -41,7 +42,8 @@
         <el-container v-if="selectNode.id">
             <el-header>
                 <el-button @click="table_add" type="primary" icon="el-icon-plus"></el-button>
-                <import-table style="margin:0 8px" :exportUrl="exportUrl" :uploadUrl="uploadUrl"></import-table>
+                <import-table style="margin:0 8px" exportUrl="/api/smis/tray/excel/template"
+                    uploadUrl="/api/smis/tray/import-tray"></import-table>
                 <el-button type="danger" plain icon="el-icon-delete" @click="batchDel"></el-button>
                 <el-input v-model="params.keyword" style="width: 240px;margin-left: auto;" placeholder="璇疯緭鍏ユ绱㈠唴瀹�"
                     clearable></el-input>
@@ -173,6 +175,61 @@
                 </div>
             </template>
         </el-dialog>
+        <el-drawer v-model="dialog" title="鎵樼洏淇℃伅" class="demo-drawer">
+            <el-container>
+                <el-main>
+                    <el-form :model="trayForm" :rules="rulesTray" ref="trayForm" label-width="120px">
+                        <el-form-item label="鎵樼洏缁�" prop="groupId">
+                            <el-tree-select v-model="trayForm.groupId" @node-click="groupIdClick" node-key="id"
+                                :data="treeData" filterable style="width: 240px" :props="{
+                                    label: 'name',
+                                }" />
+                        </el-form-item>
+                        <el-form-item v-if="trayForm.code" label="鎵樼洏缂栧彿" prop="code">
+                            <el-input style="width: 240px" v-model="trayForm.code" />
+                        </el-form-item>
+                        <el-form-item label="鎵樼洏鍚嶇О" prop="name">
+                            <el-input style="width: 240px" v-model="trayForm.name" />
+                        </el-form-item>
+                        <el-form-item label="鍙敤鐘舵��" prop="availability">
+                            <el-select style="width: 240px" v-model="trayForm.availability" placeholder="">
+                                <el-option label="婵�娲�" :value="1" />
+                                <el-option label="鍐荤粨" :value="0" />
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="鎵樼洏鎻忚堪" prop="description">
+                            <el-input style="width: 240px" type="textarea" v-model="trayForm.description" />
+                        </el-form-item>
+                        <el-form-item label="鎵樼洏绫诲埆" prop="category">
+                            <el-select style="width: 240px" v-model="trayForm.category" placeholder="">
+                                <el-option v-for="item in tray_category" :key="item.value" :label="item.label"
+                                    :value="item.value" />
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="鎵樼洏瑙勬牸" prop="standardModel">
+                            <el-input style="width: 240px" v-model="trayForm.standardModel" />
+                        </el-form-item>
+                        <el-form-item label="鎵樼洏鐘舵��" prop="trayStatus">
+                            <el-select style="width: 240px" v-model="trayForm.trayStatus" placeholder="">
+                                <el-option label="绌鸿浇" :value="1" />
+                                <el-option label="璐熻浇" :value="0" />
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="澶囨敞" prop="remark">
+                            <el-input style="width: 240px" type="textarea" v-model="trayForm.remark" />
+                        </el-form-item>
+                        <el-form-item label="鍥剧墖" prop="picture">
+                            <scUpload v-model="form.picture" title=""></scUpload>
+                        </el-form-item>
+                    </el-form>
+                </el-main>
+                <el-footer style="text-align: right">
+                    <el-button type="primary" @click="confirm">
+                        纭畾
+                    </el-button>
+                </el-footer>
+            </el-container>
+        </el-drawer>
     </el-container>
 </template>
 
@@ -204,7 +261,7 @@
                         ...data,
                         ...this.params
                     }
-                    return await this.$HTTP.get(`/api/blade-cps/tray/page/${this.selectNode.id}`, {}, { params }).then(res => {
+                    return await this.$HTTP.get(`/api/smis/tray/page/${this.selectNode.id}`, {}, { params }).then(res => {
                         return res
                     })
                 }
@@ -223,6 +280,17 @@
                     { required: true, message: '蹇呭~' }
                 ],
             },
+            dialog: false,
+            trayForm: {},
+            rulesTray: {
+                groupId: [
+                    { required: true, message: '蹇呭~' }
+                ],
+                availability: [
+                    { required: true, message: '蹇呭~' }
+                ],
+            },
+            tray_category: []
         }
     },
     watch: {
@@ -238,6 +306,12 @@
     },
     created() {
         this.init()
+        this.$HTTP.get(`/api/blade-system/dict/dictionary?code=tray_category`).then(res => {
+            this.tray_category = res.data.map(v => ({
+                label: v.dictValue,
+                value: v.dictKey
+            }))
+        })
     },
     methods: {
         addTrayGroup() {
@@ -252,13 +326,13 @@
             this.visibleGroup = true
         },
         delArea(data) {
-            this.$HTTP.delete(`/api/blade-cps/tray/remove-tree?id=${data.id}`).then(res => {
+            this.$HTTP.delete(`/api/smis/tray/remove-tree?id=${data.id}`).then(res => {
                 this.init()
             })
         },
         saveGroup() {
             if (!this.formGroup.id) {
-                this.$HTTP.post(`/api/blade-cps/group`, {
+                this.$HTTP.post(`/api/smis/group`, {
                     groupCategory: 1,
                     groupType: "group_tray",
                     parentId: this.selectNode.id,
@@ -268,7 +342,7 @@
                     this.init()
                 })
             } else {
-                this.$HTTP.put(`/api/blade-cps/group`, {
+                this.$HTTP.put(`/api/smis/group`, {
                     groupCategory: 1,
                     groupType: "group_tray",
                     parentId: this.selectNode.id,
@@ -283,8 +357,33 @@
         search() {
             this.$refs.table.reload(this.params)
         },
+        table_add() {
+            this.trayForm = {
+                groupId: this.selectNode.id,
+                availability: 1,
+                trayStatus: 1,
+            }
+            this.dialog = true
+        },
+        table_edit(row) {
+            this.trayForm = {
+                ...row
+            }
+            this.dialog = true
+        },
+        groupIdClick(node) {
+            this.trayForm.groupId = node.id
+        },
+        confirm() {
+            this.$HTTP.post(`/api/smis/tray/save`, {
+                ...this.trayForm
+            }).then(res => {
+                this.dialog = false
+                this.queryInfo()
+            })
+        },
         init() {
-            this.$HTTP.post(`/api/blade-cps/tray/tooling-tree`, {
+            this.$HTTP.post(`/api/smis/tray/tooling-tree`, {
                 groupCategory: 1,
                 groupType: "group_tray"
             }).then(res => {
@@ -295,10 +394,10 @@
         queryInfo() {
             if (!this.selectNode.id) return
             this.$refs?.table?.reload()
-            // this.$HTTP.get(`/api/blade-cps/tray/${this.selectNode.id}`).then(res => {
+            // this.$HTTP.get(`/api/smis/tray/${this.selectNode.id}`).then(res => {
             //     this.info = res.data
             // })
-            // this.$HTTP.get(`/api/blade-cps/tray-surface/list/${this.selectNode.id}`).then(res => {
+            // this.$HTTP.get(`/api/smis/tray-surface/list/${this.selectNode.id}`).then(res => {
             //     this.info = res.data
             // })
         },
@@ -312,10 +411,10 @@
         async queryChildInfo(id) {
             if (!id) return
             this.showLoading = true
-            await this.$HTTP.get(`/api/blade-cps/tray/${id}`).then(res => {
+            await this.$HTTP.get(`/api/smis/tray/${id}`).then(res => {
                 this.info = res.data
             })
-            await this.$HTTP.get(`/api/blade-cps/tray-surface/list/${id}`).then(res => {
+            await this.$HTTP.get(`/api/smis/tray-surface/list/${id}`).then(res => {
                 this.infoList = res.data
             })
             this.showLoading = false
@@ -336,19 +435,19 @@
             this.visible = true
         },
         table_del1(row) {
-            this.$HTTP.delete(`/api/blade-cps/tray-surface/remove-face/${this.info.id}?faceId=${row.id}`).then(res => {
+            this.$HTTP.delete(`/api/smis/tray-surface/remove-face/${this.info.id}?faceId=${row.id}`).then(res => {
                 this.$message.success('鎿嶄綔鎴愬姛')
                 this.queryChildInfo(this.info.id)
             })
         },
         saveTray() {
             if (this.form.id) {
-                return this.$HTTP.put(`/api/blade-cps/tray-surface/update`, this.form).then(res => {
+                return this.$HTTP.put(`/api/smis/tray-surface/update`, this.form).then(res => {
                     this.visible = false
                     this.queryChildInfo(this.info.id)
                 })
             }
-            this.$HTTP.post(`/api/blade-cps/tray-surface/save`, this.form).then(res => {
+            this.$HTTP.post(`/api/smis/tray-surface/save`, this.form).then(res => {
                 this.visible = false
                 this.queryChildInfo(this.info.id)
             })

--
Gitblit v1.9.3