<!--
 * @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/monitorsite.js";
export default {
    data() {
        return {
            form: {},
            query: {},
            loading: true,
            debugForm: {
                wiuNm: '',
                wiuCd: '',
            },
            debugOption: {
                labelWidth: 150,
                submitBtn: true,
                emptyBtn: true,
                column: [
                    {
                        label: "取用水测站代码",
                        prop: "wiustCd",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请录入取用水测站代码",
                                trigger: "click",
                            },
                        ],
                    },
                    {
                        label: "取用水测站名称",
                        prop: "wiustNm",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请录入取用水测站名称",
                                trigger: "click",
                            },
                        ],

                    },
                    {
                        label: "行政机构",
                        prop: "orgName",
                        span: 24,
                        disabled: true,
                    },
                    {
                        label: "所属用水户",
                        prop: "wiuNm",
                        span: 24,
                        disabled: true,
                    },
                    {
                        label: '所属用水户',
                        prop: 'wiuCd',
                        span: 24,
                        display: false,
                    },
                    {
                        label: '取用水测站类别',
                        prop: 'wiustTp',
                        type: 'select',
                        props: {
                            label: 'name',
                            value: 'code'
                        },
                        span: 24,
                        dicData: [{
                            name: '地表水取水站',
                            code: '1'
                        }, {
                            name: '地下水取水站',
                            code: '2'
                        }, {
                            name: '退（排）水站',
                            code: '3'
                        }],
                        rules: [
                            {
                                required: true,
                                message: "请选择取用水测站类别",
                                trigger: "click",
                            },
                        ],
                    },
                    {
                        label: "所在地",
                        prop: "loc",
                        span: 24,
                    },
                    {
                        label: '基面类型',
                        prop: 'datTp',
                        type: 'select',
                        props: {
                            label: 'name',
                            value: 'code'
                        },
                        span: 24,
                        dicData: [{
                            name: '地表水取水站',
                            code: '01'
                        }, {
                            name: '1954年黄海高程系',
                            code: '02'
                        }
                            , {
                            name: '其他',
                            code: '99'
                        }],
                    },
                    {
                        label: "基面高程",
                        prop: "datElev",
                        span: 24,
                    },
                    {
                        label: "修正基值",
                        prop: "modBasVal",
                        span: 24,
                    },
                    {
                        label: "修正参数",
                        prop: "modPara",
                        span: 24,
                    },
                    {
                        label: '测井类型',
                        prop: 'wellTp',
                        type: 'select',
                        props: {
                            label: 'name',
                            value: 'code'
                        },
                        span: 24,
                        dicData: [{
                            name: '专用井',
                            code: '1'
                        }, {
                            name: '结合井',
                            code: '2'
                        }],
                    },
                    {
                        label: "测井地面高程",
                        prop: "wellLandElev",
                        span: 24,
                    },
                    {
                        label: "设站年月",
                        prop: "estStYm",
                        type: "date",
                        span: 24,
                        format: 'yyyy年MM月',
                        valueFormat: 'yyyy-MM-dd HH:mm:ss',
                    }
                ]
            }
        };
    },

    props: {
        visible: {
            type: [Boolean],
            default: false,
        },
        wiuNm: {
            type: [String],
            required: true
        },
        wiuCd: {
            type: [String],
            required: true
        },
        orgName: {
            type: [String],
            required: true
        },
    },
    name: 'addMonitorSiteView',
    created() {
        this.init();
    },
    methods: {
        init() {
            this.debugForm['wiuNm'] = this.wiuNm;
            this.debugForm['wiuCd'] = this.wiuCd;
            this.debugForm['orgName'] = this.orgName;
        },
        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>
