From 2986ca254168879cd79325d4f98aa9ad841054e6 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 02 Jan 2024 18:03:40 +0800
Subject: [PATCH] 场所管理修改

---
 src/views/place/index.vue |   91 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 84 insertions(+), 7 deletions(-)

diff --git a/src/views/place/index.vue b/src/views/place/index.vue
index 2ed3403..831136c 100644
--- a/src/views/place/index.vue
+++ b/src/views/place/index.vue
@@ -5,6 +5,18 @@
             :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
             @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
             @refresh-change="refreshChange" @on-load="onLoad">
+            <template slot-scope="{row}" slot="location">
+                <span v-text="showLocation(row.location)"></span>
+            </template>
+
+            <template slot-scope="{row}" slot="lng">
+                <span v-text="decimalProcessing(row.lng)"></span>
+            </template>
+
+            <template slot-scope="{row}" slot="lat">
+                <span v-text="decimalProcessing(row.lat)"></span>
+            </template>
+
             <template slot-scope="{row}" slot="confirmFlag">
                 <el-tag size="small" :type="showConfirmFlag(row.confirmFlag).type">{{ showConfirmFlag(row.confirmFlag).text
                 }}</el-tag>
@@ -44,7 +56,6 @@
     update,
     add,
     getPlace,
-    getPlaceExt,
 } from "@/api/place/place"
 
 import {
@@ -83,13 +94,15 @@
                 menuWidth: 280,
                 border: true,
                 //stripe:true,
-                index: true,
+                index: false,
                 viewBtn: true,
                 editBtn: false,
                 selection: true,
                 dialogClickModal: false,
+                menuFixed: 'right',
                 column: [
                     {
+                        width: 160,
                         span: 12,
                         label: "场所名称",
                         prop: "placeName",
@@ -261,14 +274,42 @@
                     },
 
                     {
+                        width: 160,
+                        overHidden: true,
+                        slot: true,
                         label: "位置",
                         prop: "location",
-                        submitBtn: "提交",
-                        hide: true,
                         type: 'map',
                         dataType: "string",
                         span: 24,
-                        value: [117.966460, 28.431002, ""]
+                        value: [117.966460, 28.431002, ""],
+                        rules: [
+                            {
+                                required: true,
+                                message: "请选择位置",
+                                trigger: "blur",
+                            },
+                        ],
+                    },
+
+                    {
+                        width: 96,
+                        slot: true,
+                        addDisplay: false,
+                        editDisplay: false,
+                        viewDisplay: false,
+                        label: "经度",
+                        prop: "lng",
+                    },
+
+                    {
+                        width: 96,
+                        slot: true,
+                        addDisplay: false,
+                        editDisplay: false,
+                        viewDisplay: false,
+                        label: "纬度",
+                        prop: "lat",
                     },
 
                     {
@@ -291,6 +332,7 @@
                         }]
                     },
                     {
+                        width: 120,
                         display: false,
                         label: '是否有二维码',
                         searchLabelWidth: 110,
@@ -372,9 +414,41 @@
 
                 return tags
             }
+        },
+
+        showLocation () {
+            return (data) => {
+                if (data != null && data.indexOf(',') != -1) {
+                    data = data.split(',')
+
+                    return data[2]
+                } else {
+                    return data || ''
+                }
+            }
+        },
+
+        decimalProcessing () {
+            return (data) => {
+                if (data != null) {
+                    return Number(data).toFixed(6)
+                } else {
+                    return ''
+                }
+            }
         }
     },
     methods: {
+        locationDispose (data) {
+            data = data.split(',')
+
+            return {
+                longitude: data[0],
+                latitude: data[1],
+                location: data[2]
+            }
+        },
+
         auditCur (row) {
             this.curAuditRow = row
             this.auditBasePopup = true
@@ -410,7 +484,8 @@
 
             add({
                 ...row,
-                label
+                label,
+                ...this.locationDispose(row.location)
             }).then(
                 () => {
                     this.onLoad(this.page)
@@ -448,7 +523,8 @@
 
             update({
                 ...row,
-                label
+                label,
+                ...this.locationDispose(row.location)
             }).then(
                 () => {
                     this.onLoad(this.page)
@@ -483,6 +559,7 @@
                     })
                 })
         },
+
         searchReset () {
             this.query = {}
             this.onLoad(this.page)

--
Gitblit v1.9.3