From 1060c73c194b47b4c197089298724a7bd7daa407 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 21 四月 2026 15:57:37 +0800
Subject: [PATCH] 调接口加页面

---
 admin/src/views/business/area.vue |   52 +++++++++++++++++++++++++++-------------------------
 1 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/admin/src/views/business/area.vue b/admin/src/views/business/area.vue
index 725bf56..0ac68ac 100644
--- a/admin/src/views/business/area.vue
+++ b/admin/src/views/business/area.vue
@@ -1,15 +1,5 @@
 <template>
   <TableLayout :permissions="['business:areas:query']">
-    <!-- 鎼滅储琛ㄥ崟 -->
-    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
-      <el-form-item label="鍚嶇О" prop="name">
-        <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ュ悕绉�" @keypress.enter.native="search"></el-input>
-      </el-form-item>
-      <section>
-        <el-button type="primary" @click="search">鎼滅储</el-button>
-        <el-button @click="reset">閲嶇疆</el-button>
-      </section>
-    </el-form>
     <!-- 琛ㄦ牸鍜屽垎椤� -->
     <template v-slot:table-wrap>
       <el-table
@@ -22,7 +12,7 @@
         row-key="id"
         stripe
         border
-        :height="tableHeightNew - 40"
+        :height="tableHeightNew - 50"
         :header-row-class-name="'table-header'"
         class="doumee-element-table"
         @selection-change="handleSelectionChange"
@@ -34,11 +24,11 @@
         </el-table-column>
         <el-table-column prop="createDate" label="鍒涘缓鏃堕棿" align="center" min-width="140px"></el-table-column>
         <el-table-column prop="sortnum" label="鎺掑簭" align="center" min-width="140px"></el-table-column>
-        <el-table-column label="鐘舵��" align="center" min-width="140px">
+        <el-table-column label="寮�閫氱姸鎬�" align="center" min-width="140px">
           <template slot-scope="{ row }">
-            <el-switch
+            <el-switch v-if="row.type==1"
               v-model="row.status"
-              active-color="#13ce66"
+              active-color="green"
               inactive-color="#ff4949"
               active-value="1"
               inactive-value="0">
@@ -49,15 +39,19 @@
           v-if="containPermissions(['business:areas:update'])"
           label="鎿嶄綔"
           align="center"
-          min-width="80"
+          min-width="180"
         >
           <template slot-scope="{ row }">
-            <el-button type="text" @click="openPriceRule(row)">璁′环瑙勫垯</el-button>
+            <el-button type="text" @click="openPriceRule(row)" v-if="row.type === 1">璁′环瑙勫垯</el-button>
+            <el-button type="text" @click="edit(row)" v-permissions="['business:areas:update']">缂栬緫</el-button>
+            <el-button v-if="row.type!=2" type="text" @click="createChild(row)" v-permissions="['business:areas:create']">鏂板缓{{ row.type==0 ? '甯�' : '鍖哄幙' }}</el-button>
+            <el-button type="text" style="color: red;" @click="deleteById(row)" v-permissions="['business:areas:delete']">鍒犻櫎</el-button>
           </template>
         </el-table-column>
       </el-table>
     </template>
     <OperaCityPriceRuleWindow ref="operaCityPriceRuleWindow" @success="handlePriceRuleSuccess"/>
+    <OperaAreasWindow ref="operaAreasWindow" @success="update"/>
   </TableLayout>
 </template>
 
@@ -67,10 +61,11 @@
 import Pagination from '@/components/common/Pagination'
 import { listByParentId } from '@/api/business/areas'
 import OperaCityPriceRuleWindow from '@/components/business/OperaCityPriceRuleWindow'
+import OperaAreasWindow from '@/components/business/OperaAreasWindow'
 export default {
   name: 'Areas',
   extends: BaseTable,
-  components: { TableLayout, Pagination, OperaCityPriceRuleWindow },
+  components: { TableLayout, Pagination, OperaAreasWindow, OperaCityPriceRuleWindow },
   data () {
     return {
       // 鎼滅储
@@ -106,18 +101,18 @@
           this.isWorking.search = false
         })
     },
-    dataAddBool(array) {
+    dataAddBool (array) {
       array.forEach(item => {
         item.hasChildren = item.type != 2
         // item.childList = item.childList && this.dataAddBool(item.childList)
       })
       return array
     },
-    load(tree, treeNode, resolve) {
+    load (tree, treeNode, resolve) {
       this.treeMaps.set(tree.id, { tree, treeNode, resolve })
       listByParentId({ parentId: tree.id, type: tree.type + 1 })
         .then(data => {
-          resolve(this.dataAddBool(data||[]))
+          resolve(this.dataAddBool(data || []))
         })
         .catch(e => {
           this.$tip.apiFailed(e)
@@ -126,7 +121,7 @@
           this.isWorking.search = false
         })
     },
-    refreshLoadTree(parentId) {
+    refreshLoadTree (parentId) {
       if (this.treeMaps.get(parentId)) {
         const { tree, treeNode, resolve } = this.treeMaps.get(parentId)
         this.$set(this.$refs.table.store.states.lazyTreeNodeMap, parentId, [])
@@ -141,14 +136,21 @@
         this.handlePageChange()
       }
     },
-    update(parentId) {
+    update (parentId) {
       this.refreshLoadTree(parentId)
     },
-    openPriceRule(row) {
-      this.$refs.operaCityPriceRuleWindow.open('璁′环瑙勫垯', row)
+    openPriceRule (row) {
+      this.$refs.operaCityPriceRuleWindow.open('璁′环瑙勫垯(' + (row.name || '') + ')', row.id)
     },
-    handlePriceRuleSuccess() {
+    handlePriceRuleSuccess () {
       this.$message.success('淇濆瓨鎴愬姛')
+    },
+    edit (row) {
+      // this.parentId = row.type==0 ? null : row.type==1 ? '缂栬緫甯�' : '缂栬緫鍖哄幙'
+      this.$refs.operaAreasWindow.open(row.type == 0 ? '缂栬緫鐪�' : row.type == 1 ? '缂栬緫甯�' : '缂栬緫鍖哄幙', row)
+    },
+    createChild (row) {
+      this.$refs.operaAreasWindow.open(row.type == 0 ? '鏂板缓甯�' : '鏂板缓鍘垮尯', { parentId: row.id, name: '', type: row.type === 1 ? 2 : 1 })
     }
   }
 }

--
Gitblit v1.9.3