guanqb
2024-01-17 0c8deac1e2ac7a05b1c7142a166dfbea5f735c6b
src/views/scanOrCode/index.vue
@@ -34,16 +34,15 @@
                    :header-cell-style="{ 'text-align': 'center', 'background-color': '#203c60', 'borderColor': '#324e75' }"
                    :cell-style="{ 'text-align': 'center', 'borderColor': '#324e75', 'cursor': 'default' }"
                    :row-class-name="tableRowClassName" class="police-infor-table">
                    <el-table-column prop="JJDWMC" :show-overflow-tooltip="true" label="姓名"
                        min-width="80%"></el-table-column>
                    <el-table-column prop="JJDWMC" :show-overflow-tooltip="true" label="手机号"
                        min-width="80%"></el-table-column>
                    <el-table-column prop="name" :show-overflow-tooltip="true" label="姓名" min-width="80%"></el-table-column>
                    <el-table-column prop="tel" :show-overflow-tooltip="true" label="手机号" min-width="80%"></el-table-column>
                    <el-table-column label="操作" align="center" min-width="32%">
                        <template slot-scope="scope">
                            <el-button type="text" size="small" title="定位">
                            <el-button type="text" size="small" title="定位" :disabled="positionDisabled(scope.row)"
                                @click="rowClick(scope.row)">
                                <i class="el-icon-location" :style="{ color: positionColor(scope.row) }"></i>
                            </el-button>
                            <el-button type="text" size="small" title="详情">
                            <el-button type="text" size="small" title="详情" @click="goDetail(scope.row)">
                                <i class="el-icon-document"></i>
                            </el-button>
                        </template>
@@ -57,50 +56,24 @@
                </div>
            </div>
        </div>
        <scanDetailDialog ref="scanDetailDialog"></scanDetailDialog>
    </div>
</template>
<script>
import { initMapPosition } from '@/utils/mapPositionInit'
import scanDetailDialog from './components/scanDetailDialog.vue'
let loading = null
export default {
    inject: ['userInfo'],
    components: { scanDetailDialog },
    data () {
        return {
            searchText: '',
            options: {
                columns: [
                    {
                        type: 'input',
                        props: 'xm',
                        label: '姓名',
                        width: '40%',
                    },
                    {
                        type: 'input',
                        props: 'sjh',
                        label: '手机号',
                        width: '60%',
                    },
                    {
                        type: 'input',
                        props: 'sfz',
                        label: '身份证号',
                    },
                    {
                        type: 'input',
                        props: 'zz',
                        label: '住址',
                    },
                ]
            },
            realEmptyText: "",
            currentTableHeight: 0,
            tableData: [],
@@ -145,6 +118,7 @@
        that.$nextTick(() => {
            initMapPosition()
            that.getList()
        })
    },
@@ -161,32 +135,85 @@
    },
    computed: {
        whetherPosition () {
            return (row) => {
                return !(row.ZDDWXZB && row.ZDDWXZB != 0 && row.ZDDWYZB && row.ZDDWYZB != 0 && row.ZDDWXZB > 73)
            }
        },
        positionColor () {
            return (row) => {
                if (row.ZDDWXZB && row.ZDDWXZB != 0 && row.ZDDWYZB && row.ZDDWYZB != 0 && row.ZDDWXZB > 73) {
                if (row.X && row.X != 0 || row.lng && row.lng != 0 || row.longitude && row.longitude != 0 || row.x && row.x != 0) {
                    return "#1AFA29"
                } else {
                    return "#ccc"
                }
            }
        }
        },
        positionDisabled () {
            return (row) => {
                if (row.X && row.X != 0 || row.lng && row.lng != 0 || row.longitude && row.longitude != 0 || row.x && row.x != 0) {
                    return false
                } else {
                    return true
                }
            }
        },
    },
    methods: {
        searchBtn () {
        // 点击详情
        goDetail (row) {
            this.$refs.scanDetailDialog.showScanDetail(row)
        },
        // 点击定位
        rowClick (row) {
            this.$EventBus.$emit('toPosition', {
                siteJd: row.lng,
                siteWd: row.lat,
                siteGd: 200
            })
        },
        // 获取列表
        getList () {
            let params = {
                searchText: this.searchText,
                type: this.typeValue,
                size: this.pages.pageSize,
                current: this.pages.currentPage
            }
            console.log('getList', params)
            this.tableData = [
                {
                    name: '张三',
                    tel: '13366668888',
                    lng: 112.22,
                    lat: 33.22,
                    address: '111'
                },
                {
                    name: '李四',
                    tel: '13366668877',
                    lng: 124.22,
                    lat: 30.22,
                    address: '222'
                },
                {
                    name: '王五',
                    tel: '13366668866',
                    lng: 126.22,
                    lat: 36.22,
                    address: '333'
                }
            ]
            this.pages.total = 3
        },
        searchBtn () {
            this.getList()
        },
        // 分页处理
        handleCurrentChange (currentPage) {
            this.page.currentPage = currentPage
            this.pages.currentPage = currentPage
            this.getList()
        },
@@ -200,6 +227,7 @@
        },
        typeChange () {
            this.getList()
        },
        setTableHeight () {