From f2e4a9d500d2ae2a0ca0fe9ff8cb050c90ccaa2e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 05 Jan 2024 18:02:00 +0800
Subject: [PATCH] 所有图片字段需要调整

---
 src/views/place/components/baseAllInfo.vue |  138 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 106 insertions(+), 32 deletions(-)

diff --git a/src/views/place/components/baseAllInfo.vue b/src/views/place/components/baseAllInfo.vue
index eb75677..1faa0fb 100644
--- a/src/views/place/components/baseAllInfo.vue
+++ b/src/views/place/components/baseAllInfo.vue
@@ -43,6 +43,19 @@
 
 export default {
     data () {
+
+        //手机号格式校验
+        let validatorPhone = function (rule, value, callback) {
+            if (value) {
+                if (!/^1[3456789]\d{9}$/.test(value)) {
+                    callback(new Error('手机号格式有误!'))
+                } else {
+                    callback()
+                }
+            }
+            callback()
+        }
+
         return {
             placeExt: [],
 
@@ -108,12 +121,19 @@
                     },
 
                     {
-                        width: 110,
-                        label: "电话",
+                        width: 96,
+                        label: "手机号码",
                         prop: "principalPhone",
                         search: true,
                         searchSpan: 4,
                         slot: true,
+                        overHidden: true,
+                        rules: [
+                            {
+                                validator: validatorPhone,
+                                trigger: 'blur'
+                            }
+                        ],
                     },
 
                     {
@@ -122,7 +142,6 @@
                         label: "所属社区",
                         prop: "neiCode",
                         search: false,
-                        width: 150,
                         type: "tree",
                         dicUrl: "/api/blade-system/region/tree",
                         props: {
@@ -175,18 +194,25 @@
                         },
                         span: 24,
                     },
+
                     {
-                        label: "场所位置",
-                        prop: "localtion",
-                        span: 24,
-                        minWidth: 220,
+                        width: 160,
                         overHidden: true,
-                        // rules: [{
-                        //     required: true,
-                        //     message: "请输入区域",
-                        //     trigger: "blur",
-                        // },],
-                    }
+                        slot: true,
+                        label: "位置",
+                        prop: "location",
+                        type: 'map',
+                        dataType: "string",
+                        span: 24,
+                        value: [117.966460, 28.431002, ""],
+                        rules: [
+                            {
+                                required: true,
+                                message: "请选择位置",
+                                trigger: "blur",
+                            },
+                        ],
+                    },
                 ]
             },
 
@@ -199,9 +225,21 @@
                         label: '法人信息',
                         prop: 'legalPerson'
                     },
+
                     {
-                        label: '法人电话',
-                        prop: 'legalTel'
+                        width: 96,
+                        label: "法人电话",
+                        prop: "legalTel",
+                        search: true,
+                        searchSpan: 4,
+                        slot: true,
+                        overHidden: true,
+                        rules: [
+                            {
+                                validator: validatorPhone,
+                                trigger: 'blur'
+                            }
+                        ],
                     },
 
                     {
@@ -255,22 +293,36 @@
                 border: true,
                 index: true,
                 dialogClickModal: false,
-                column: [{
-                    label: "名称",
-                    prop: "name",
-                    searchSpan: 4,
-                    search: true,
-                }, {
-                    label: "电话",
-                    prop: "telephone",
-                    searchSpan: 4,
-                    search: true,
-                }, {
-                    label: "暂住地",
-                    prop: "tempAddress",
-                    searchSpan: 4,
-                    search: true,
-                },]
+                column: [
+                    {
+                        label: "名称",
+                        prop: "name",
+                        searchSpan: 4,
+                        search: true,
+                    },
+
+                    {
+                        width: 96,
+                        label: "手机号码",
+                        prop: "telephone",
+                        search: true,
+                        searchSpan: 4,
+                        slot: true,
+                        overHidden: true,
+                        rules: [
+                            {
+                                validator: validatorPhone,
+                                trigger: 'blur'
+                            }
+                        ],
+                    },
+
+                    {
+                        label: "暂住地",
+                        prop: "tempAddress",
+                        searchSpan: 4,
+                        search: true,
+                    },]
             },
             holdPage: {
                 pageSize: 20,
@@ -296,6 +348,8 @@
                         getPlaceExt({ placeId: newData['id'] }),
                     ]).then(that.$axios.spread(function (baseInfo, restInfo) {
                         that.form = baseInfo.data.data
+
+                        that.form.location = [that.form.lng, that.form.lat, that.form.location].join(',')
 
                         if (that.form.imageUrls && that.form.imageUrls.length) {
                             that.form.imageUrls = that.form.imageUrls.split(",").filter(item => item != '').map(item => website.minioUrl + item).join(',')
@@ -346,6 +400,16 @@
     },
 
     methods: {
+        locationDispose (data) {
+            data = data.split(',')
+
+            return {
+                longitude: data[0],
+                latitude: data[1],
+                location: data[2]
+            }
+        },
+
         selectionClear () {
             this.$nextTick(() => {
                 this.$refs.crud && this.$refs.crud.toggleSelection()
@@ -455,13 +519,23 @@
                 imageUrls = urls.join(",")
             }
 
+            let label = this.form.label
+
+            if (this.form.smallLabel != '') {
+                label = label + ',' + this.form.smallLabel
+            }
+
+            delete this.form.smallLabel
+
             this.$refs.baseForm.validate((valid, done, msg) => {
                 if (valid) {
                     that.$axios.all([
                         update({
                             // ...this.placeElement.curRow,
                             ...this.form,
-                            imageUrls
+                            imageUrls,
+                            label,
+                            ...this.locationDispose(this.form.location)
                         }),
                         updatePlaceExt(this.placeForm)
                     ]).then(that.$axios.spread(function () {

--
Gitblit v1.9.3