<template>
  <div style="overflow-y: auto">
    <h1><el-button @click="onSubmit">校验</el-button></h1>
    <CusForm ref="ref_form">
      <h2>船籍港（link=portOfRegistry）</h2>
      <el-col :span="24">
        船籍港1级：{{form.portOfRegistry1}}，船籍港2级：{{form.portOfRegistry2}}
      </el-col>
      <CusFormColumn
          link="portOfRegistry"
          label="船籍港"
          v-model:paramOne="form.portOfRegistry1"
          v-model:paramTwo="form.portOfRegistry2"/>
      <CusFormColumn
          link="portOfRegistry"
          label="船籍港"
          required
          v-model:paramOne="form.portOfRegistry1"
          v-model:paramTwo="form.portOfRegistry2"/>
      <h2>常驻停泊点（link=residentMooringPoint）</h2>
      <el-col :span="24">
        船籍港1级：{{form.residentMooringPoint1}}，船籍港2级：{{form.residentMooringPoint2}}
      </el-col>
      <CusFormColumn
          link="residentMooringPoint"
          label="常驻停泊点"
          v-model:paramOne="form.residentMooringPoint1"
          v-model:paramTwo="form.residentMooringPoint2"/>
      <CusFormColumn
          link="residentMooringPoint"
          label="常驻停泊点"
          required
          v-model:paramOne="form.residentMooringPoint1"
          v-model:paramTwo="form.residentMooringPoint2"/>
      <h2>部门（link=dept）</h2>
      <el-col :span="24">
        部门：{{form.dept}}
        部门(多选)：{{form.dept2}}
      </el-col>
      <CusFormColumn
          link="dept"
          label="部门（当前）"
          v-model:param="form.dept"/>
      <CusFormColumn
          link="dept"
          all
          label="部门（所有）"
          v-model:param="form.dept"/>
      <CusFormColumn
          link="dept"
          all
          label="部门（多选）"
          multiple
          collapse-tags
          collapse-tags-tooltip
          v-model:param="form.dept2"/>
      <CusFormColumn
          link="dept"
          all
          label="部门（多选）"
          multiple
          show-checkbox
          :check-strictly="false"
          collapse-tags
          collapse-tags-tooltip
          v-model:param="form.dept2"/>
    </CusForm>
  </div>
</template>

<script lang="ts">
import {
  defineComponent,
  computed,
  onMounted,
  ref,
  reactive,
  watch,
  getCurrentInstance,
  ComponentInternalInstance,
  toRefs,
  nextTick
} from 'vue'
import {useStore} from 'vuex'
import {useRouter, useRoute} from 'vue-router'

export default defineComponent({
  name: '',
  components: {},
  setup() {
    const store = useStore();
    const router = useRouter();
    const route = useRoute();
    const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
    const state = reactive({
      form: {
        portOfRegistry1: null,
        portOfRegistry2: null,
        residentMooringPoint1: null,
        residentMooringPoint2: null,
        dept: null,
        dept2: [],
      }
    })
    const ref_form = ref()
    const onSubmit = () => {
      ref_form.value.submit()
    }
    return {
      ...toRefs(state),
      ref_form,
      onSubmit
    }
  },
})
</script>

<style scoped lang="scss">
</style>
