From b734a2c20d48014ad238940bdeb41137273ef25e Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期四, 11 四月 2024 21:35:05 +0800
Subject: [PATCH] 新增看板接口

---
 src/views/console/system/interfaceConfig.vue |  156 ++++++++++++++++++++++++++-------------------------
 1 files changed, 79 insertions(+), 77 deletions(-)

diff --git a/src/views/console/system/interfaceConfig.vue b/src/views/console/system/interfaceConfig.vue
index e74c70b..df37305 100644
--- a/src/views/console/system/interfaceConfig.vue
+++ b/src/views/console/system/interfaceConfig.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2024-04-09 22:18:47
  * @LastEditors: Sneed
- * @LastEditTime: 2024-04-10 21:11:42
+ * @LastEditTime: 2024-04-11 21:34:08
  * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/system/interfaceConfig.vue
  * 鐪嬫澘鎺ュ彛
 -->
@@ -10,20 +10,27 @@
         <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-input clearable v-model="urlName_like" style="max-width: 200px;margin-left: auto;">
+                <template #append>
+                    <el-button @click="query" icon="el-icon-search" />
+                </template>
+            </el-input>
         </el-header>
         <el-main>
-            <scTable ref="table" @selection-change="handleSelectionChange" row-key="id" border :params="params" :apiObj="apiObj" stripe>
+            <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="url" label="鎺ュ彛鍦板潃" />
                 <el-table-column prop="urlName" label="鎺ュ彛涓枃鍚�" />
                 <el-table-column prop="urlType" label="鎺ュ彛绫诲瀷">
                     <template #default="scope">
-                        <span>{{ ['POST',"PUT","GET"][scope.row.urlType] }}</span>
+                        <span>{{ interface_url_type?.find(v => v.dictKey == scope.row.urlType)?.dictValue }}</span>
                     </template>
                 </el-table-column>
                 <el-table-column prop="owningChart" label="鍥捐〃绫诲瀷">
                     <template #default="scope">
-                        <span>{{ ['鏌辩姸鎶樼嚎鍥�',"楗煎浘","鐢樼壒鍥�","琛ㄦ牸","浠〃鐩�"][scope.row.owningChart -1] }}</span>
+                        <span>{{ interface_owning_chart?.find(v => v.dictKey == scope.row.owningChart)?.dictValue
+                            }}</span>
                     </template>
                 </el-table-column>
                 <el-table-column label="鎿嶄綔" fixed="right" align="left" width="160">
@@ -41,51 +48,48 @@
                 </el-table-column>
             </scTable>
         </el-main>
-        <el-dialog v-model="dialogVisible" :title="dialogTitle" width="750" :before-close="handleClose">
+        <el-dialog v-model="dialogVisible" :title="dialogTitle" width="1000" :before-close="handleClose">
             <el-form :model="row" :rules="rules" ref="dialogForm" label-width="120px" label-position="center">
                 <el-row>
-                    <el-col :span="12">
-                        <el-form-item label="鍒嗙被鍚嶇О" prop="name">
-                            <el-input style="width: 240px" v-model="row.name" placeholder="璇疯緭鍏ュ垎绫诲悕绉�"
-                                clearable></el-input>
+                    <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="parentId">
-                            <el-select v-model="row.parentId" filterable placeholder="璇烽�夋嫨涓婄骇鍒嗙被" style="width: 240px">
-                                <el-option v-for="item in options" :key="item.value" :label="item.label"
-                                    :value="item.value" />
+                        <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="icon">
-                            <el-input @click="showIconDialog = true" style="width: 240px" v-model="row.icon"
-                                placeholder="璇烽�夋嫨鍒嗙被鍥炬爣" clearable></el-input>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="12">
-                        <el-form-item label="鍒嗙被缂栧彿" prop="type">
-                            <el-input style="width: 240px" v-model="row.type" placeholder="璇疯緭鍏ュ垎绫荤紪鍙�"
-                                clearable></el-input>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="12">
-                        <el-form-item label="鎺掑垪椤哄簭" prop="orderNum">
-                            <el-input-number style="width: 240px" default v-model="row.orderNum" :min="0"
-                                placeholder="璇疯緭鍏ユ帓鍒楅『搴�" />
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="12">
-                        <el-form-item label="鐘舵��" prop="status">
-                            <el-radio-group style="width: 240px" v-model="row.status">
-                                <el-radio v-for="item in statusList" :label="item.value" :key="item.value">{{ item.label
-                                    }}</el-radio>
-                            </el-radio-group>
+                        <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>
@@ -95,12 +99,6 @@
                 </div>
             </template>
         </el-dialog>
-        <el-dialog v-model="showIconDialog" title="鍒嗙被鍥炬爣" width="750">
-            <div class="icons">
-                <component @click="setIcon(item)" class="icon" v-for="item in icons" :is='item' :key="item"></component>
-            </div>
-
-        </el-dialog>
     </el-container>
 </template>
 
@@ -108,32 +106,51 @@
 export default {
     data() {
         return {
-            apiObj: this.$API.setting.getConList,
+            apiObj: this.$API.setting.interfaceConfig.getConList,
             selection: [],
             dialogVisible: false,
+            urlName_like: '',
             row: {
                 id: '',
-                name: '',
-                parentId: '',
-                icon: '',
-                type: '',
-                orderNum: 0,
-                status: 1,
+                url: '',
+                urlName: '',
+                urlType: '',
+                owningChart: '',
             },
             rules: {
-                name: [
-                    { required: true, message: '璇疯緭鍏ュ垎绫诲悕绉�' }
+                url: [
+                    { required: true, message: '璇疯緭鍏�' }
                 ],
-                type: [
-                    { required: true, message: '璇疯緭鍏ュ垎绫荤紪鍙�' }
-                ]
+                urlName: [
+                    { required: true, message: '璇疯緭鍏�' }
+                ],
+                urlType: [
+                    { required: true, message: '璇疯緭鍏�' }
+                ],
+                owningChart: [
+                    { required: true, message: '璇疯緭鍏�' }
+                ],
             },
+            interface_url_type: [],
+            interface_owning_chart: [],
+            flow: [],
         }
     },
     created() {
-        this.queryList()
+        this.$API.system.dic.getDic.get({ code: 'interface_url_type' }).then(res => {
+            this.interface_url_type = res.data
+        })
+        this.$API.system.dic.getDic.get({ code: 'interface_owning_chart' }).then(res => {
+            this.interface_owning_chart = res.data
+        })
+        this.$API.system.dic.getDic.get({ code: 'flow' }).then(res => {
+            this.flow = res.data
+        })
     },
     methods: {
+        query() {
+            this.$refs.table.reload({ urlName_like: this.urlName_like })
+        },
         add() {
             this?.$refs?.dialogForm?.resetFields()
             Object.keys(this.row).forEach(v => {
@@ -146,29 +163,20 @@
         save() {
             this.$refs.dialogForm.validate(async (valid) => {
                 if (valid) {
-                    let request = this.$API.setting.insert
+                    let request = this.$API.setting.interfaceConfig.add
                     if (this?.row?.id) {
-                        request = this.$API.setting.update
+                        request = this.$API.setting.interfaceConfig.update
                     }
                     request.post(this.row).then(res => {
                         this.dialogVisible = false
-                        this.queryList()
+                        this.query()
                     })
                 }
             })
         },
         del() {
-            this.$API.setting.del.delete({}, { data: this.selection.map(v => v.id) }).then(res => {
-                this.queryList()
-            })
-        },
-        queryList() {
-            this.$API.setting.getList.get().then(res => {
-                this.tableData = res.data;
-                this.options = res.data.map(item => ({
-                    value: item.id,
-                    label: item.name
-                }))
+            this.$API.setting.interfaceConfig.del.delete({}, { data: this.selection.map(v => v.id) }).then(res => {
+                this.query()
             })
         },
         table_edit(row) {
@@ -178,19 +186,13 @@
             this.dialogVisible = true
         },
         table_del(row) {
-            this.$API.setting.del.delete({}, { data: [row.id] }).then(res => {
-                this.queryList()
+            this.$API.setting.interfaceConfig.del.delete({}, { data: [row.id] }).then(res => {
+                this.query()
             })
         },
         handleSelectionChange(selection) {
-            console.log('>>>>>>')
             this.selection = selection;
         },
-        setIcon(icon) {
-            console.log('>>>>>>', icon)
-            this.row.icon = icon
-            this.showIconDialog = false
-        }
     },
 }
 </script>

--
Gitblit v1.9.3