index.vue 12 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>界址点距(m)</td>
                    <td>界址线类型</td>
                    <td>界址线位置</td>
                    <td>界限性质</td>
                    <td>说明</td>
                </tr>
                <tr v-for="(item,index) in jzxlist" :key="index">
                    <td><input type="checkbox" v-model="item.isCheck" @change="changeAll"/></td>
                    <td><input type="text" class="formInput" v-model="item.qsd" readonly="readonly"/></td>
                    <td><input type="text" class="formInput" v-model="item.zzd" readonly="readonly"/></td>
                    <td><input type="text" class="formInput" v-model="item.jzdj" :readonly="item.jjisdisabled"/></td>
                    <td>
                        <el-select v-model="item.jzxlx" :disabled="item.jzxisdisabled" >
                            <el-option
                                    v-for="i in jzxlx"
                                    :key="i.key"
                                    :label="i.label"
                                    :value="i.value"
                            ></el-option>
                        </el-select>
                    </td>
                    <td>
                        <el-select v-model="item.jzxwz" :disabled="item.jzxisdisabled" >
                            <el-option
                                    v-for="i in jzxwz"
                                    :key="i.key"
                                    :label="i.label"
                                    :value="i.value"
                            ></el-option>
                        </el-select>
                    </td>
                    <td>
                        <el-select v-model="item.jxxz" :disabled="item.jzxisdisabled">
                            <el-option
                                    v-for="i in jxxz"
                                    :key="i.key"
                                    :label="i.label"
                                    :value="i.value"
                            ></el-option>
                        </el-select>
                    </td>
                    <td>
                        <input type="text" class="formInput" v-model="item.sm"/>
                    </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 {queryjzd} from '../../../api/zd'

    export default {
        name: "",
        components: {},
        props: {},
        data() {
            return {
                isCheckAll: false,
                centerDialogVisible: false,
                jzxwz: [
                    {
                        key: '1',
                        label: '内',
                        value: '1'
                    }, {
                        key: '2',
                        label: '中',
                        value: '2'
                    }, {
                        key: '3',
                        label: '外',
                        value: '3'
                    },
                ],
                jxxz: [
                    {
                        key: '600001',
                        label: '已定界',
                        value: '600001'
                    }, {
                        key: '600002',
                        label: '未定界',
                        value: '600002'
                    }, {
                        key: '600003',
                        label: '争议界',
                        value: '600003'
                    }, {
                        key: '600004',
                        label: '工作界',
                        value: '600004'
                    }, {
                        key: '600009',
                        label: '其他',
                        value: '600009'
                    },
                ],
                jzxlx: [
                    {
                        key: '250200',
                        label: '海岸线',
                        value: '250200'
                    }, {
                        key: '250201',
                        label: '大潮平均高潮线',
                        value: '250201'
                    }, {
                        key: '250202',
                        label: '零米等深线',
                        value: '250202'
                    }, {
                        key: '250203',
                        label: '江河入海口陆海分界线',
                        value: '250203'
                    }, {
                        key: '620200',
                        label: '国界',
                        value: '620200'
                    }, {
                        key: '630200',
                        label: '省、自治区、直辖市界',
                        value: '630200'
                    }, {
                        key: '640200',
                        label: '地区、自治州、地级市界',
                        value: '640200'
                    }, {
                        key: '650200',
                        label: '县、区、旗、县级市界',
                        value: '650200'
                    }, {
                        key: '660200',
                        label: '街道、乡、(镇)界',
                        value: '660200'
                    }, {
                        key: '670402',
                        label: '开发区、保税区界',
                        value: '670402'
                    }, {
                        key: '670500',
                        label: '街坊、村界',
                        value: '670500'
                    }, {
                        key: '670600',
                        label: '省、自治区、直辖市间海域行政界线',
                        value: '670600'
                    }, {
                        key: '670700',
                        label: '县际间海域行政界线',
                        value: '670700'
                    },
                ],
                jzxlist: [
                    {
                        isCheck: false,
                        qsd: '11',
                        zzd: '1',
                        jzdj: '10.0',
                        jzxlx: '670600',
                        jzxwz: '1',
                        jxxz: '600002',
                        sm: '32131',
                        iszb: 'readonly',
                        jjisdisabled: true,
                        jzxisdisabled: true
                    }, {
                        isCheck: false,
                        qsd: '12',
                        zzd: '1',
                        jzdj: '10.0',
                        jzxlx: '670500',
                        jzxwz: '1',
                        jxxz: '600002',
                        sm: '3123',
                        iszb: 'readonly',
                        jjisdisabled: true,
                        jzxisdisabled: true
                    }, {
                        isCheck: false,
                        qsd: '14',
                        zzd: '1',
                        jzdj: '10.0',
                        jzxlx: '670700',
                        jzxwz: '1',
                        jxxz: '600004',
                        sm: '212',
                        iszb: 'readonly',
                        jjisdisabled: true,
                        jzxisdisabled: true
                    },

                ]
            }
        },
        created() {

        },
        mounted() {
            // 该标识码继承过来
            let bsm = '401044005bad0557d5e3787239d8e18e';
            /*  queryjzd(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]['jbisdisabled'] = true;
                      res.result[i]['jzdisdisabled'] = true;
                  }
                  this.jzdlist = res.result;
              })*/
        },
        methods: {
            save() {
                console.log("保存....");
                for (let item of this.jzxlist) {
                    if (item.isCheck) {
                        item.jjisdisabled = 'readonly';
                        item.jzxisdisabled = 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.jzxlist) {
                    if (!item.isCheck) {
                        this.isCheckAll = false;
                        return
                    }
                }
                this.isCheckAll = true;
            },
            allcheck(value) {
                for (let item of this.jzxlist) {
                    item.isCheck = value.target.checked;
                }
            },
            oneExit() {
                for (let item of this.jzxlist) {
                    if (item.isCheck) {
                        item.jjisdisabled = false;
                        item.jzxisdisabled = false;
                    }
                }

            },
            batchExit() {
                console.log("批量修改")
                this.centerDialogVisible = true;
            }
        },
        computed: {},
        watch: {},
    }
</script>
<style scoped lang="less">
    .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>