shuishen
2024-01-03 7cef46a5e85fc015463ae1a0aa65efee689a8dcc
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 {
@@ -88,8 +99,10 @@
                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)
@@ -437,7 +512,20 @@
                })
                row.imageUrls = urls.join(",")
            }
            update(row).then(
            let label = row.label
            if (row.smallLabel != '') {
                label = label + ',' + row.smallLabel
            }
            delete row.smallLabel
            update({
                ...row,
                label,
                ...this.locationDispose(row.location)
            }).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
@@ -471,6 +559,7 @@
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
@@ -512,10 +601,13 @@
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getPlace(this.form.id).then((res) => {
                    this.form = res.data.data
                    this.form.location = [this.form.lng, this.form.lat, this.form.location].join(',')
                    if (this.form.imageUrls.length) {
                        this.form.imageUrls = this.form.imageUrls.split(",").filter(item => item != '').map(item => website.minioUrl + item).join(',')
@@ -536,7 +628,6 @@
                    }
                    done()
                })
            } else {
                done()