From 40377a90d7e7627e3fbdee9054f1cfa17f7d069f Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期四, 11 四月 2024 22:09:53 +0800
Subject: [PATCH] 组件维护页面

---
 src/views/console/system/vision-component-modify.vue |  192 +++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 183 insertions(+), 9 deletions(-)

diff --git a/src/views/console/system/vision-component-modify.vue b/src/views/console/system/vision-component-modify.vue
index 891d207..ecd406b 100644
--- a/src/views/console/system/vision-component-modify.vue
+++ b/src/views/console/system/vision-component-modify.vue
@@ -1,21 +1,195 @@
 <!--
  * @Date: 2024-04-09 22:18:47
  * @LastEditors: Sneed
- * @LastEditTime: 2024-04-09 22:19:02
+ * @LastEditTime: 2024-04-11 22:07:46
  * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/system/vision-component-modify.vue
 -->
 <template>
-    <div>
-        缁勪欢缁存姢
-    </div>
+    <el-container>
+        <el-aside width="220px">
+            <el-tree default-expand-all style="max-width: 600px" :data="treeData" :props="defaultProps"
+                @node-click="handleNodeClick" />
+        </el-aside>
+        <el-container>
+            <el-header style="justify-content: flex-start;">
+                <el-button type="primary" plain @click="add">鏂板</el-button>
+                <el-button @click="del" plain type="danger" :disabled="selection.length == 0">鍒犻櫎</el-button>
+            </el-header>
+            <el-main>
+                <scTable ref="table" @selection-change="handleSelectionChange" row-key="id" border :params="params"
+                    :apiObj="apiObj" stripe>
+                    <el-table-column type="selection" width="55" />
+                    <el-table-column prop="name" label="缁勪欢鍚嶇О" />
+                    <el-table-column prop="typeName" label="鍒嗙被鍚嶇О" />
+                    <el-table-column prop="url" label="鍥剧墖">
+                        <template #default="scope">
+                            <img style="width: 20px;height: 20px;" :src="`${host}${scope.row.url}`" alt="鍥剧墖" srcset="">
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="orderNum" label="鎺掑垪椤哄簭" />
+                    <el-table-column label="鎿嶄綔" fixed="right" align="left" 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-dialog v-model="dialogVisible" :title="dialogTitle" width="1000" >
+            <el-form :model="row" :rules="rules" ref="dialogForm" label-width="120px" label-position="center">
+                <el-row>
+                    <el-col :span="24">
+                        <el-form-item label="鎺ュ彛鍦板潃" prop="url">
+                            <el-input style="width: 100%" v-model="row.url" placeholder="璇疯緭鍏�" clearable></el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="鎺ュ彛涓枃鍚�" prop="urlName">
+                            <el-input style="width: 240px" v-model="row.urlName" placeholder="璇疯緭鍏�" clearable></el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="鎺ュ彛绫诲瀷" prop="urlType">
+                            <el-select v-model="row.urlType" placeholder="璇烽�夋嫨" style="width: 240px">
+                                <el-option v-for="item in interface_url_type" :key="item.value" :label="item.dictValue"
+                                    :value="item.dictKey - 0" />
+                            </el-select>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="鍥捐〃绫诲瀷" prop="owningChart">
+                            <el-select v-model="row.owningChart" placeholder="璇烽�夋嫨" style="width: 240px">
+                                <el-option v-for="item in interface_owning_chart" :key="item.value"
+                                    :label="item.dictValue" :value="item.dictKey" />
+                            </el-select>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+            </el-form>
+            <!-- <el-container>
+                <el-header>
+                    <el-button plain type="primary">鏂板缓</el-button>
+                </el-header>
+                <el-main>
+                    <el-table :data="tableData"
+                        row-key="id" border
+                        >
+                    </el-table>
+                </el-main>
+            </el-container> -->
+            <template #footer>
+                <div class="dialog-footer">
+                    <el-button @click="dialogVisible = false">鍙栨秷</el-button>
+                    <el-button type="primary" @click="save">
+                        淇濆瓨
+                    </el-button>
+                </div>
+            </template>
+        </el-dialog>
+    </el-container>
 </template>
 
 <script>
-    export default {
-        
+export default {
+    data() {
+        return {
+            defaultProps: {
+                children: 'children',
+                label: 'name',
+            },
+            treeData: [],
+            params: {
+                type: null
+            },
+            apiObj: this.$API.setting.component.getList,
+            host: '',
+            selection: [],
+            dialogVisible: false,
+            dialogTitle: '鏂板',
+            row: {
+
+            },
+            rules: {
+                url: [
+                    { required: true, message: '璇疯緭鍏�' }
+                ],
+                urlName: [
+                    { required: true, message: '璇疯緭鍏�' }
+                ],
+                urlType: [
+                    { required: true, message: '璇疯緭鍏�' }
+                ],
+                owningChart: [
+                    { required: true, message: '璇疯緭鍏�' }
+                ],
+            },
+        }
+    },
+    created() {
+        this.getList()
+    },
+    methods: {
+        query() {
+            this.$refs.table.reload(this.params)
+        },
+        getList() {
+            this.$API.setting.component.getImgHost.get().then(res => {
+                this.host = res.data + '/visual'
+                this.$API.setting.getList.get().then(res => {
+                    this.treeData = res.data
+                })
+            })
+        },
+        handleNodeClick(TreeNode) {
+            this.params.type = TreeNode.type
+            this.query()
+        },
+        handleSelectionChange(selection) {
+            this.selection = selection;
+        },
+        add() {
+            this?.$refs?.dialogForm?.resetFields()
+            Object.keys(this.row).forEach(v => {
+                this.row[v] = ''
+            })
+            this.dialogTitle = '鏂板'
+            this.dialogVisible = true
+        },
+        del() {
+            this.$API.setting.component.del({}, { data: this.selection.map(v => v.id) }).then(res => {
+                this.query()
+            })
+        },
+        save() {
+            this.$refs.dialogForm.validate(async (valid) => {
+                if (valid) {
+                    let request = this.$API.setting.interfaceConfig.add
+                    if (this?.row?.id) {
+                        request = this.$API.setting.interfaceConfig.update
+                    }
+                    request.post(this.row).then(res => {
+                        this.dialogVisible = false
+                        this.query()
+                    })
+                }
+            })
+        },
+        table_del(row) {
+            this.$API.setting.component.del({}, { data: [row.id] }).then(res => {
+                this.query()
+            })
+        }
+
     }
+}
 </script>
 
-<style lang="scss" scoped>
-
-</style>
\ No newline at end of file
+<style lang="scss" scoped></style>
\ No newline at end of file

--
Gitblit v1.9.3