<!--
 * @Title: 
 * @Description: 
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
    <div>
        <el-row>
            <el-col :span="24">
                <basic-container>
                    <!-- <div style="height: calc(100vh - 400px);overflow-y: auto;"> -->
                    <avue-form :option="debugOption" v-model="debugForm" @submit="submit" />
                    <!-- </div> -->
                </basic-container>
            </el-col>
        </el-row>
    </div>
</template>
<script>
import { add } from "@/api/baseinfo/monitorpoint.js";
export default {
    data() {
        return {
            form: {},
            query: {},
            loading: true,
            debugForm: {
                wiuNm: '',
                wiuCd: '',
            },
            debugOption: {
                labelWidth: 150,
                submitBtn: true,
                emptyBtn: true,
                column: [
                    {
                        label: "监测点代码",
                        prop: "mpCd",
                        span: 24,
                        width: 120,
                        rules: [
                            {
                                required: true,
                                message: "请录入监测点代码",
                                trigger: "click",
                            },
                        ],
                    },
                    {
                        label: "监测点名称",
                        prop: "mpNm",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请录入监测点名称",
                                trigger: "click",
                            },
                        ],

                    },
                    {
                        label: "所属监测站",
                        prop: "wiustNm",
                        span: 24,
                        disabled: true,
                    },
                    {
                        label: "监测站代码",
                        prop: "wiustCd",
                        span: 24,
                        display: false,
                    },
                    {
                        label: "监测点地址",
                        prop: "mpAddr",
                        span: 24,
                    },
                    {
                        label: '监测项目',
                        prop: 'mpItem',
                        type: 'select',
                        props: {
                            label: 'name',
                            value: 'code'
                        },
                        span: 24,
                        dicData: [{
                            name: '水位',
                            code: '1'
                        }, {
                            name: '流量',
                            code: '2'
                        }]
                    },
                    {
                        label: "经度",
                        prop: "lng",
                        span: 24,
                    },
                    {
                        label: "纬度",
                        prop: "lat",
                        span: 24,
                    },
                    {
                        label: '监测类型',
                        prop: 'isAuto',
                        type: 'select',
                        props: {
                            label: 'name',
                            value: 'code'
                        },
                        span: 24,
                        dicData: [{
                            name: '间接推算',
                            code: '0'
                        }, {
                            name: '直接监测',
                            code: '1'
                        }]
                    },
                    {
                        label: '水源类型',
                        prop: 'sourTp',
                        type: 'select',
                        props: {
                            label: 'name',
                            value: 'code'
                        },
                        span: 24,
                        dicData: [{
                            name: '江河',
                            code: "11"
                        }, {
                            name: '湖泊',
                            code: "12"
                        }, {
                            name: '水库',
                            code: "13"
                        }, {
                            name: '其他地表水',
                            code: "19"
                        }, {
                            name: '浅层水',
                            code: "21"
                        }, {
                            name: '承压水',
                            code: "22"
                        }, {
                            name: '地热水',
                            code: "23"
                        }, {
                            name: '矿泉水',
                            code: "24"
                        }, {
                            name: '岩溶水',
                            code: "25"
                        }, {
                            name: '其他地下水',
                            code: "29"
                        }, {
                            name: '外调水',
                            code: "31"
                        }, {
                            name: '矿坑水',
                            code: "32"
                        }, {
                            name: '海水',
                            code: "33"
                        }, {
                            name: '雨水',
                            code: "34"
                        }, {
                            name: '其他非常规水源',
                            code: "39"
                        }],
                    },
                    {
                        label: "备注",
                        prop: "nt",
                        span: 24,
                    },
                ]
            }
        };
    },

    props: {
        visible: {
            type: [Boolean],
            default: false,
        },
        wiustNm: {
            type: [String],
            required: true
        },
        wiustCd: {
            type: [String],
            required: true
        },
    },
    name: 'addMonitorPointView',
    created() {
        this.init();
    },
    methods: {
        init() {
            this.debugForm['wiustNm'] = this.wiustNm;
            this.debugForm['wiustCd'] = this.wiustCd;
        },
        submit(from, done) {
            console.log(JSON.stringify(from));
            add(from).then(() => {
                this.$message({
                    type: "success",
                    message: "提交成功!"
                });

                this.$emit("update:visible", false);
                this.$emit("fevent");
                done();
            }, error => {
                console.log(error);
                done();
            });
        },
    },
};
</script>
<style lang="scss" scoped></style>
