<!--
 * @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="color:gray;margin-top: 0px;">*视频站编码仅支持字母+数字的编码组合，长度为20个字符</div>
                </basic-container>
            </el-col>
        </el-row> -->
        <el-row>
            <el-col :span="24">
                <basic-container>
                    <avue-form :option="debugOption" v-model="debugForm" @submit="submit" />
                </basic-container>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import { add } from "@/api/baseinfo/rtu.js";
//import { getToken } from "@/util/auth";
// import { validatenull } from "@/util/validate";
import { getChildrenList } from "@/api/baseinfo/region";
export default {
    data() {
        return {
            fileName: '',
            editForm: {},
            editDialog: false,
            form: {},
            selectionList: [],
            query: {},
            loading: true,
            postData: {},
            debugForm: {
                isVideo: 1,
            },
            debugOption: {
                labelWidth: 150,
                submitBtn: true,
                emptyBtn: true,
                column: [
                    {
                        label: '视频站编码',
                        prop: 'rtuCode',
                        maxlength: 20,
                        showWordLimit: true,
                        tip: '*视频站编码仅支持字母+数字的编码组合，长度为20个字符',
                        span: 24,
                        rules: [{
                            required: true,
                            message: "必填项",
                            trigger: "blur"
                        }],
                    },
                    {
                        label: '视频站名称',
                        prop: 'rtuName',
                        span: 24,
                        rules: [{
                            required: true,
                            message: "必填项",
                            trigger: "blur"
                        }],
                    },
                    {
                        label: '旗县区',
                        prop: 'adCode',
                        type: 'select',
                        props: {
                            label: 'adnm',
                            value: 'adcd'
                        },
                        span: 24,
                        dicData: [],
                        rules: [{
                            required: true,
                            message: "必填项",
                            trigger: "blur"
                        }],
                    },
                    {
                        label: "测站类型",
                        prop: "isVideo",
                        span: 24,
                        editDisplay: false,
                        addDisplay: false,
                        display: false,
                    },
                    {
                        label: '经度',
                        prop: 'lng',
                        tip: "使用弧度格式录入，如110.2536",
                        span: 12,
                        rules: [{
                            required: true,
                            message: "必填项",
                            trigger: "blur"
                        }],
                    },
                    {
                        label: '纬度',
                        prop: 'lat',
                        tip: "使用弧度格式录入，如90.2536",
                        span: 12,
                        rules: [{
                            required: true,
                            message: "必填项",
                            trigger: "blur"
                        }],
                    },
                    {
                        label: '安装位置',
                        prop: 'locationDesc',
                        span: 24,
                        rules: [{
                            required: true,
                            message: "必填项",
                            trigger: "blur"
                        }],
                    },
                    {
                        label: '蓄电池容量',
                        prop: 'batteryModel',
                        span: 24,
                    },
                    {
                        label: '太阳能板',
                        prop: 'sunPowerModel',
                        span: 24,
                    },
                    {
                        label: 'SIM卡号',
                        prop: 'networkSimId',
                        span: 24,
                    },
                    {
                        label: 'SIM卡开卡单位',
                        prop: 'networkPayer',
                        span: 24,
                    },
                ]
            }
        };
    },

    props: {
        visible: {
            tyep: [Boolean],
            default: false,
        },
        importLoading: {
            tyep: [Boolean],
            default: false,
        }
    },
    name: 'videositeadd',
    created() {

    },
    methods: {
        init() {
            getChildrenList().then((res) => {
                const column = this.findObject(this.debugOption.column, "adCode");
                column.dicData = res.data.data;
            }, error => {
                this.$message.error(error)
            });
        },
        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>
.mb0 {
    margin-top: 10;

}
</style>
