<template>
    <div>
        <el-dialog :title="title" :visible="operateVisable" v-if="operateVisable" @close="cancel" width="600px" center
            :distroy-on-close="true">

            <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="demo-ruleForm">
                <el-form-item label="机构名称" prop="identifyName">
                    <el-input v-model="ruleForm.identifyName"></el-input>
                </el-form-item>
                <el-form-item label="机构邮箱" prop="identifyEmail">
                    <el-input v-model="ruleForm.identifyEmail"></el-input>
                </el-form-item>
                <!-- <el-form-item label="经办人姓名" prop="operName">
                    <el-input v-model="ruleForm.operName"></el-input>
                </el-form-item>
                <el-form-item label="经办人用户名" prop="operUserName">
                    <el-input v-model="ruleForm.operUserName"></el-input>
                </el-form-item>
                <el-form-item label="经办人手机号" prop="operPhone">
                    <el-input v-model="ruleForm.operPhone"></el-input>
                </el-form-item> -->
                <el-form-item label="机构信用代码" prop="creditCode">
                    <el-input v-model="ruleForm.creditCode"></el-input>
                </el-form-item>
                <el-form-item label="法人姓名" prop="legalPerName">
                    <el-input v-model="ruleForm.legalPerName"></el-input>
                </el-form-item>
                <el-form-item label="法人手机号" prop="legalPerPhone">
                    <el-input v-model="ruleForm.legalPerPhone"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="cancel" class="endbutton"><span>取 消</span></el-button>
                <el-button type="primary" @click="submitForm" class="endbutton"><span>确认</span></el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import {
    insert,
} from "@/api/officialSeal/officialSeal.js";
import { listUser } from '@/api/system/user.js'
export default {
    props: ["operateVisable", "queryParams"],
    data() {
        return {
            title: "新增机构",
            ruleForm: {},
            rules: {
                identifyName: [
                    { required: true, message: '请输入机构名称', trigger: 'blur' },
                ],
                // operName: [
                //     { required: true, message: '请输入经办人姓名', trigger: 'blur' },
                // ],
                // operPhone: [
                //     { required: true, message: '请输入经办人手机号', trigger: 'blur' },
                //     { pattern: /^[1][3,4,5,6,7,8,9][0-9]{9}$/, message: '请输入正确的手机号码', trigger: 'blur', },
                // ],
                creditCode: [
                    { required: true, message: '请输入机构信用代码', trigger: 'blur' },
                ],
                legalPerName: [
                    { required: true, message: '请输入法人姓名', trigger: 'blur' },
                ],
                legalPerPhone: [
                    { required: true, message: '请输入法人手机号', trigger: 'blur' },
                    { pattern: /^[1][3,4,5,6,7,8,9][0-9]{9}$/, message: '请输入正确的手机号码', trigger: 'blur', },
                ],
                // operUserName: [
                //     { required: true, message: '请输入经办人用户名', trigger: 'blur' },
                // ],
                identifyEmail: [
                    { required: true, message: '请输入邮箱', trigger: 'blur' },
                    { type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur' }
                ]
            }
        };
    },
    watch: {
        operateVisable(val) {
            if (val) {
            }
        },
    },
    created() {

    },
    methods: {
        // 新增部门
        insertFn(data) {
            insert(data).then(res => {
                this.$modal.msgSuccess("新增成功！");
                this.$emit("cancelFilingreview");
                this.$emit('getList', this.queryParams);
            })
        },
        // 提交form表单
        submitForm() {
            this.$refs['ruleForm'].validate((valid) => {
                if (valid) {
                    this.insertFn(this.ruleForm)
                }
            });

        },
        cancel() {
            this.$emit("cancelFilingreview");
        },
    },
};
</script>
  
<style lang="scss" scoped>
.steps {
    display: flex;
    flex-wrap: wrap;
}

.radiobox {
    margin-top: 30px;
}
</style>