<template>
    <div>



      <el-card >

        <div class="container" style="margin:100px">
          <div style="font-style: italic; margin-left: 500px; color: red; font-size: 50px;">
            欢迎来到承运商系统
          </div>
        </div>

      </el-card>








    </div>
</template>

<script setup>
    import ButtonBar from '@/components/ButtonBar.vue'

    import {
        ref,
        reactive,
        onMounted,
        getCurrentInstance
    } from 'vue'

    const {
        proxy
    } = getCurrentInstance()

    import tools from '@/tools'
    import Selector from "@/components/Selector.vue";
    const cardBodyStyle = ref(tools.style.card)
    const inputStyle = ref(tools.style.input)

    onMounted(() => {
        handleSearch()
    })



    /**
     *   查询
     */

    const query = ref({
           ftranscode: '',
           ftransname: '',
           ftransdirector: '',
           ftransdirectorphone: '',
           ftransdescribe: '',
           ftransroute: '',
           frecommendperson: '',
           fother: '',
          administrator:'',
          logonpassword:'',
          confirmPassword:'',
          fundRegist:'',
      capaDescription:'',
      fundCurrency:'',
      mailAddress:'',
      postalCode:'',
      tax:'',
      bank:'',
      bankAccount:'',
      corporation:'',
      corporationPhone:'',
      corporationNumber:'',
      corporationFax:'',
      corporationMailbax:'',
      businessWebsite:'',
      authorizer:'',
      authorizerPhone:'',
      authorizerNumber:'',
      authorizerFax:'',
      authorizerMailbax:'',

   })
   const tableData = ref([])

   const handleSearch = () => {

   }



    /**
     *   查询
     */


    /**
     * 分页
     */
    /**
     * 新增
     */
    const dialogVisible = ref(false)
    const form = ref({
      ftranscode: '',
      ftransname: '',
      ftransdirector: '',
      ftransdirectorphone: '',
      ftransdescribe: '',
      ftransroute: '',
      frecommendperson: '',
      fother: '',
      administrator:'',
      logonpassword:'',
      confirmPassword:'',
      fundRegist:'',
      capaDescription:'',
      fundCurrency:'',
      mailAddress:'',
      postalCode:'',
      tax:'',
      bank:'',
      bankAccount:'',
      corporation:'',
      corporationPhone:'',
      corporationNumber:'',
      corporationFax:'',
      corporationMailbax:'',
      businessWebsite:'',
      authorizer:'',
      authorizerPhone:'',
      authorizerNumber:'',
      authorizerFax:'',
      authorizerMailbax:'',


    })
    const ruleFormRef = ref()
    const rules = reactive({
      ftransname: [{
        required: true,
        message: '请输入承运商名称',
        trigger:  'blur'
        }],
      administrator: [{
            required: true,
            message: '请输入用户名',
            trigger: 'change' | 'blur'
        }, {
          min: 6,
          pattern: /^[a-zA-Z0-9]{6,}$/,
          message: '用户名至少包含6位字母或数字',
          trigger:  'blur' // 失去焦点时触发验证
        }],
        logonpassword: [{
            required: true,
            message: '请输入密码',
            trigger:  'blur'
        }, {
          min: 8,
          pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/,
          message: '密码至少包含8位大小写字母或数字',
          trigger:  'blur' // 失去焦点时触发验证
        }],
      confirmPassword: [{
        required: true,
        message: '请确认密码',
        trigger:  'blur'
      },  /*{
        validator: (rule, value, callback) => {
          if (value === '') {
            callback(new Error('请再次输入登录密码'));
          } else if (value !== query.value.logonpassword) {
            callback(new Error('两次输入的密码不一致'));
          } else {
            callback();
          }
        },
        trigger: 'blur'
      }*/],
      fundRegist: [{
        required: true,
        message: '注册资金不能为空',
        trigger: 'change'| 'blur'
      }],
      corporation: [{
        required: true,
        message: '法人代表不能为空',
        trigger: 'change'| 'blur'
      }],
      authorizer: [{
        required: true,
        message: '授权人不能为空',
        trigger: 'change'| 'blur'
      }],
      authorizerPhone: [{
        required: true,
        message: '授权人手机号不能为空',
        trigger: 'change'| 'blur'
      }],

    })

    const handleAdd = () => {
        form.value = {
          ftranscode: '',
          ftransname: '',
          ftransdirector: '',
          ftransdirectorphone: '',
          ftransdescribe: '',
          ftransroute: '',
          frecommendperson: '',
          fother: '',
          administrator:'',
          logonpassword:'',
          confirmPassword:'',
          fundRegist:'',
          capaDescription:'',
          fundCurrency:'',
          mailAddress:'',
          postalCode:'',
          tax:'',
          bank:'',
          bankAccount:'',
          corporation:'',
          corporationPhone:'',
          corporationNumber:'',
          corporationFax:'',
          corporationMailbax:'',
          businessWebsite:'',
          authorizer:'',
          authorizerPhone:'',
          authorizerNumber:'',
          authorizerFax:'',
          authorizerMailbax:'',
        }
        dialogVisible.value = true
    }
    /**
     * 新增
     */
    /**
     * 保存、修改、删除
     */

    const openDialog=()=>{
    }


    const Login = (ruleFormRef) => {
        ruleFormRef.validate((valid, fields) => {
            if (valid) {
                var url = 'tms/Login/LoginCarrier'
                var param = {
                    json: JSON.stringify(form.value),
                }
                proxy.$axios.post(url, param).then(response => {
                    if (response.data.code == 0) {
                    //添加缓存 todo
                      query.value = response.data.data

                        ElMessage({
                            message: '登录成功',
                            type: 'success',
                        })
                      proxy.$router.push({
                        path: '/login'
                      })
                    } else {
                        // ElMessage.error('操作失败！' + response.data.msg)
                        ElMessage({
                            message: '操作失败' + response.data.msg,
                            type: 'error'
                        })
                    }
                })

            } else {
                console.log('error submit!', fields)
            }
        })
    }


</script>

<style>
</style>