index.vue 8.97 KB
<template>
    <div class="main">
        <div class="button">
            <el-button type="primary" @click="oneExit">编辑</el-button>
            <el-button type="primary" @click="save">保存</el-button>
            <el-button type="primary" @click="batchExit">批量修改</el-button>
        </div>
        <div class="table">
            <table border="1">
                <tr>
                    <td><input type="checkbox" @click="allcheck" v-model="isCheckAll"/></td>
                    <td>界址点号</td>
                    <td>顺序号</td>
                    <td>X坐标值</td>
                    <td>Y坐标值</td>
                    <td>界标类型</td>
                    <td>界址点类型</td>
                </tr>
                <tr v-for="(item,index) in jzdlist" :key="index">
                    <td><input type="checkbox" v-model="item.isCheck" @change="changeAll"/></td>
                    <td><input type="text" class="formInput" v-model="item.jzdh" readonly="readonly"/></td>
                    <td><input type="text" class="formInput" v-model="item.sxh" readonly="readonly"/></td>
                    <td><input type="text" class="formInput" v-model="item.xzbz" :readonly="item.iszb"
                               @keydown="oninput"/></td>
                    <td><input tepe="text" class="formInput" v-model="item.yzbz" :readonly="item.iszb"
                               @keydown="oninput"/></td>
                    <td>
                        <el-select v-model="item.jblx" :disabled="item.jzdisdisabled">
                            <el-option
                                    v-for="i in jblx"
                                    :key="i.key"
                                    :label="i.label"
                                    :value="i.value"
                            ></el-option>
                        </el-select>
                    </td>
                    <td>
                        <el-select v-model="item.jzdlx" :disabled="item.jzdisdisabled">
                            <el-option
                                    v-for="i in jzdlx"
                                    :key="i.key"
                                    :label="i.label"
                                    :value="i.value"
                            ></el-option>
                        </el-select>
                    </td>
                </tr>
            </table>
        </div>
        <div>
            <el-dialog
                    title="批量修改"
                    :visible.sync="centerDialogVisible"
                    width="30%"
                    center>
                <div class="plxg">
                    <div>
                        <span class=""> 界标类型:</span>
                        <el-select>
                            <el-option
                                    v-for="i in jblx"
                                    :key="i.key"
                                    :label="i.label"
                                    :value="i.value"
                            ></el-option>
                        </el-select>
                    </div>
                    <div>
                        <span>界址点类型:</span>
                        <el-select>
                            <el-option
                                    v-for="i in jzdlx"
                                    :key="i.key"
                                    :label="i.label"
                                    :value="i.value"
                            ></el-option>
                        </el-select>
                    </div>

                </div>
                <span slot="footer" class="dialog-footer">
                <el-button @click="centerDialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
              </span>
            </el-dialog>
        </div>
    </div>
</template>

<script>
    import {queryjzx} from '../../../api/zd'

    export default {
        name: "界址点",
        components: {},
        props: {},
        data() {
            return {
                isCheckAll: false,
                centerDialogVisible: false,
                jblx: [
                    {
                        key: '1',
                        label: '钢钉',
                        value: '1'
                    }, {
                        key: '2',
                        label: '水泥桩',
                        value: '2'
                    }, {
                        key: '3',
                        label: '石灰桩',
                        value: '3'
                    }, {
                        key: '4',
                        label: '喷绘',
                        value: '4'
                    }, {
                        key: '5',
                        label: '瓷标志',
                        value: '5'
                    }, {
                        key: '6',
                        label: '无标志',
                        value: '6'
                    }, {
                        key: '7',
                        label: '其他',
                        value: '7'
                    },
                ],
                jzdlx: [
                    {
                        key: '1',
                        label: '解析界址点',
                        value: '1'
                    }, {
                        key: '2',
                        label: '图解界址点',
                        value: '2'
                    }, {
                        key: '3',
                        label: '航测界址点',
                        value: '3'
                    }, {
                        key: '4',
                        label: '其他',
                        value: '4'
                    }
                ],
                jzdlist: [
                /*    {
                        isCheck: false,
                        jzdh: 'JZDH001',
                        sxh: '1',
                        xzbz: '10.0',
                        yzbz: '11.0',
                        jblx: '1',
                        jzdlx: '1',
                        iszb: 'readonly',
                        jbisdisabled: true,
                        jzdisdisabled: true
                    }*/

                ]
            }
        },
        created() {

        },
        mounted() {
            // 该标识码继承过来
            let bsm = '044dc12648a1f41374679281da63e93b';
            queryjzx(bsm).then(res => {
                for (let i = 0; i < res.result.length; i++) {
                    res.result[i]['isCheck'] = false;
                    res.result[i]['iszb'] = 'readonly';
                    res.result[i]['jzdisdisabled'] = true;
                }
                this.jzdlist = res.result;
            })
        },
        methods: {
            save() {
                console.log("保存....");
                for (let item of this.jzdlist) {
                    if (item.isCheck) {
                        item.iszb = 'readonly';
                        item.jbisdisabled = true;
                        item.jzdisdisabled = true;
                    }
                }
            },
            oninput(e) {
                e.target.value = (e.target.value.match(/^\d*(\.?\d{0,4})/g)[0]) || null
            },
            changeAll(e) {
                if (!e.target.checked) {
                    console.log("11111")
                    this.isCheckAll = false;
                    return
                }
                for (let item of this.jzdlist) {
                    if (!item.isCheck) {
                        this.isCheckAll = false;
                        return
                    }
                }
                this.isCheckAll = true;
            },
            allcheck(value) {
                for (let item of this.jzdlist) {
                    item.isCheck = value.target.checked;
                }
            },
            oneExit() {
                for (let item of this.jzdlist) {
                    if (item.isCheck) {
                        item.iszb = false;
                        item.jzdisdisabled = false;
                    }
                }

            },
            batchExit() {
                console.log("批量修改")
                this.centerDialogVisible = true;
            }
        },
        computed: {},
        watch: {},
    }
</script>
<style scoped lang="less">
    /deep/.el-input.is-disabled .el-input__inner{
        color: #606764;
    }
    .main {
        box-sizing: border-box;
        padding: 18px;
        height: auto;
        width: 80%;
    }

    table {
        margin-top: 10px;
        background-color: #fff;
        font-size: 14px;
        width: 100%;
    }

    td {
        text-align: center;
        height: 36px;
    }

    table .formInput {
        margin: 0;
        height: 36px;
        outline: none;
        border: none;
        color: #606764;
        overflow: visible;
        text-align: center;
        cursor: text;
    }

    .plxg span {
        width: 300px;
    }
</style>