From a59ff44b2eaa7020f0529632d9ec064c4dc38e27 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期二, 28 四月 2026 22:08:46 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/gtzxinglijicun

---
 admin/src/views/business/area.vue |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/admin/src/views/business/area.vue b/admin/src/views/business/area.vue
index 0ac68ac..911682a 100644
--- a/admin/src/views/business/area.vue
+++ b/admin/src/views/business/area.vue
@@ -28,10 +28,11 @@
           <template slot-scope="{ row }">
             <el-switch v-if="row.type==1"
               v-model="row.status"
+              @change="handleStatusChange($event, row)"
               active-color="green"
               inactive-color="#ff4949"
-              active-value="1"
-              inactive-value="0">
+              :active-value="1"
+              :inactive-value="0">
             </el-switch>
           </template>
         </el-table-column>
@@ -59,7 +60,7 @@
 import BaseTable from '@/components/base/BaseTable'
 import TableLayout from '@/layouts/TableLayout'
 import Pagination from '@/components/common/Pagination'
-import { listByParentId } from '@/api/business/areas'
+import { listByParentId, updateStatus } from '@/api/business/areas'
 import OperaCityPriceRuleWindow from '@/components/business/OperaCityPriceRuleWindow'
 import OperaAreasWindow from '@/components/business/OperaAreasWindow'
 export default {
@@ -79,7 +80,7 @@
   },
   created () {
     this.config({
-      module: '鐪佸競鍖轰俊鎭〃',
+      module: '鐪佸競鍖轰俊鎭�',
       api: '/business/areas',
       'field.id': 'id',
       'field.main': 'id'
@@ -87,6 +88,25 @@
     this.search()
   },
   methods: {
+    deleteById (row) {
+      var that = this
+      const message = '纭鍒犻櫎閫夋嫨鐨勬暟鎹褰曞強鍏朵笅绾у瓙鏁版嵁鍚�?'
+      this.$dialog.deleteConfirm(message)
+        .then(() => {
+          this.isWorking.delete = true
+          this.api.deleteById(row.id)
+            .then(() => {
+              this.refreshLoadTree(row.parentId)
+            })
+            .catch(e => {
+              this.$tip.apiFailed(e)
+            })
+            .finally(() => {
+              this.isWorking.delete = false
+            })
+        })
+        .catch(() => {})
+    },
     // 椤电爜鍙樻洿澶勭悊
     handlePageChange (pageIndex) {
       this.isWorking.search = true
@@ -108,6 +128,14 @@
       })
       return array
     },
+    handleStatusChange (val, row) {
+      updateStatus({ id: row.id, status: val }).then(res => {
+        this.$tip.apiSuccess(res || '淇敼鎴愬姛')
+      }).catch(e => {
+        row.status = val === 1 ? 0 : 1
+        this.$tip.apiFailed(e)
+      })
+    },
     load (tree, treeNode, resolve) {
       this.treeMaps.set(tree.id, { tree, treeNode, resolve })
       listByParentId({ parentId: tree.id, type: tree.type + 1 })

--
Gitblit v1.9.3