<script setup lang="ts">
import { ref, getCurrentInstance, reactive } from "vue";
import { useRouter, useRoute } from "vue-router";
import request, { download } from '~/utils/request';
import { pick } from 'lodash-es';
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
import type { AxiosRequestConfig } from 'axios'

// #region (constant)
const TABLE_KEY = 'kjg_id'
const URL_CUT = '/khfw/jggl'
const URL_CUT_REF = ref(URL_CUT)
const URL_SUBMIT_KEY = URL_CUT.split('/').join('_').slice(1)
const instance = getCurrentInstance()
const router = useRouter()
const route = useRoute()
// #endregion

// #region (variable)
const loading_table = ref(true)
let whichDialogSubmit: 'add' | 'edit'
// #endregion

// #region (type)
type TYPE_TABLE_FIELD = {
  [TABLE_KEY]: string;
  'kjg_name': string; // 机构名称
  'kjg_reg_address': string; // 注册地址
  'kjg_teach_address': string; // 办学地址
  'kjg_jglxdh': string; // 机构联系电话
  'kjg_tyshxydm': string; // 统一社会信用代码
  'kjg_bxxkz': string; // 办学许可证
  'kjg_yyzz': string; // 营业执照
  'kjg_frxm': string; // 法人姓名
  'kjg_frlxdh': string; // 法人联系电话
  'kjg_frsfzzm': string; // 法人身份证正面
  'kjg_frsfzfm': string; // 法人身份证反面
  'kjg_fzrxm': string; // 负责人姓名
  'kjg_fzrlxdh': string; // 负责人联系电话
  'kjg_fzrsfzzm': string; // 负责人身份证正面
  'kjg_fzrsfzfm': string; // 负责人身份证反面
  'kjg_shzt': string; // 审核状态
  'kjg_shztsm': string; // 审核状态说明
  'openid': string; // 申请人openid
  'unionid': string; // 申请人unionid
  'appid': string; // 申请人appid
  'kjg_dldz': string; // 登录地址
  'kjg_cszh': string; // 初始账号
  'kjg_csmm': string; // 初始密码
  'kjg_jgfl': string; // 机构分类
  'kjg_longitude': string; // 坐标经度
  'kjg_latitude': string; // 坐标纬度
  'kjg_szrs': string; // 师资人数
  'kjg_jgtb': string; // 机构图标
  'kjg_jgjs': string; // 机构介绍
  'kjg_ztpf': string; // 总体评分
  'kjg_jspf': string; // 讲师评分
  'kjg_kcpf': string; // 课程评分
  'kjg_hjpf': string; // 环境评分
}
// #endregion

// #region (props)
// #endregion

// #region (query row)
const queryForm_Data = ref<Partial<TYPE_TABLE_FIELD> & { keyword?: string }>({})

const handleQueryFormBtn_search = () => {
  queryApi()
}
const handleQueryFormBtn_clear = () => {
  queryForm_Data.value = {}
}
// #endregion

// #region (table selection)
const multipleSelection = ref<TYPE_TABLE_FIELD[]>([])
const handleSelectionChange = (val: TYPE_TABLE_FIELD[]) => {
  multipleSelection.value = val
}
// #endregion

// #region (table row)
const handleTableRowBtn_import = async ({ file }: { file: File }) => {
  const res = await API_MAP['import']({ file })
  if (res.code === '1') {
    queryApi()
    ElMessage.success(res.msg)
  }
}
const handleTableRowBtn_export = () => {
  exportApi()
}
const handleTableRowBtn_add = () => {
  whichDialogSubmit = 'add'
  dialogForm_Data.value = {}
  dialogVisible_addOrEdit.value = true
}
const handleTableRowBtn_delete = async () => {
  await deleteApi(multipleSelection.value.map((item: TYPE_TABLE_FIELD) => item[TABLE_KEY]))
  queryApi()
}
// #endregion

// #region (table body)
const tableData = ref<TYPE_TABLE_FIELD[]>([])
const DetailName = '-SHGL-JGSQ-DSH'
const DetailParam = 'aid'

const handleTableColBtn_edit = async (scope: { row: TYPE_TABLE_FIELD }) => {
  whichDialogSubmit = 'edit'
  const res = await detailApi(scope.row[TABLE_KEY])
  dialogForm_Data.value = (res.data.one_info)
  dialogVisible_addOrEdit.value = true
}
const handleTableColBtn_audit = (scope: { row: TYPE_TABLE_FIELD }) => {
  whichDialogSubmit = 'edit'
  dialogForm_Data.value = pick(scope.row, [`${TABLE_KEY}`, ...Object.keys(dialogForm_Rules_audit)])
  dialogVisible_audit.value = true
}
const handleTableColBtn_detail = (scope: { row: TYPE_TABLE_FIELD }) => {
  router.push({ name: DetailName, params: { [DetailParam]: scope.row[TABLE_KEY] } })
}
const handleTableColBtn_delete = async (scope: { row: TYPE_TABLE_FIELD }) => {
  await deleteApi(scope.row[TABLE_KEY])
  queryApi()
}
// #endregion

// #region (pagination)
const total = ref(0)
const limit = ref(10)

const currentPage = ref(1)
function handleCurrentChange() {
  queryApi()
}
// #endregion

// #region (dialog base)
const dialogForm_Data = ref<Partial<TYPE_TABLE_FIELD> & { keyword?: string }>({})

const handleDialogFormBtn_submit = async (formRefKey: string, extendData?: Partial<TYPE_TABLE_FIELD>) => {
  const isValid = await (instance?.refs[formRefKey] as FormInstance).validate((valid: boolean) => valid)
  if (isValid) {
    await API_MAP[whichDialogSubmit](<TYPE_TABLE_FIELD>({ ...dialogForm_Data.value, ...extendData }))
    handleDialogFormBtn_cancel()
    queryApi()
  }
}
const handleDialogFormBtn_cancel = (formRefKey?: string) => {
  dialogVisible_addOrEdit.value = false
  dialogVisible_audit.value = false
}
// #endregion

// #region (dialog add/edit)
const dialogVisible_addOrEdit = ref<boolean>(false)

const dialogForm_Ref_addOrEdit = ref<FormInstance>()
const dialogForm_Rules_addOrEdit = reactive({
  'kjg_name': { required: true, message: '机构名称不能为空', trigger: 'submit' },
  'kjg_reg_address': { required: true, message: '注册地址不能为空', trigger: 'submit' },
  'kjg_teach_address': { required: true, message: '办学地址不能为空', trigger: 'submit' },
  'kjg_jglxdh': { required: true, message: '机构联系电话不能为空', trigger: 'submit' },
  'kjg_tyshxydm': { required: true, message: '统一社会信用代码不能为空', trigger: 'submit' },
  'kjg_bxxkz': { required: true, message: '办学许可证不能为空', trigger: 'submit' },
  'kjg_yyzz': { required: true, message: '营业执照不能为空', trigger: 'submit' },
  'kjg_frxm': { required: true, message: '法人姓名不能为空', trigger: 'submit' },
  'kjg_frlxdh': { required: true, message: '法人联系电话不能为空', trigger: 'submit' },
  'kjg_frsfzzm': { required: true, message: '法人身份证正面不能为空', trigger: 'submit' },
  'kjg_frsfzfm': { required: true, message: '法人身份证反面不能为空', trigger: 'submit' },
  'kjg_fzrxm': { required: true, message: '负责人姓名不能为空', trigger: 'submit' },
  'kjg_fzrlxdh': { required: true, message: '负责人联系电话不能为空', trigger: 'submit' },
  'kjg_fzrsfzzm': { required: true, message: '负责人身份证正面不能为空', trigger: 'submit' },
  'kjg_fzrsfzfm': { required: true, message: '负责人身份证反面不能为空', trigger: 'submit' },
  'kjg_shzt': { required: true, message: '审核状态不能为空', trigger: 'submit' },
  'kjg_shztsm': { required: true, message: '审核状态说明不能为空', trigger: 'submit' },
  'openid': { required: true, message: '申请人openid不能为空', trigger: 'submit' },
  'unionid': { required: true, message: '申请人unionid不能为空', trigger: 'submit' },
  'appid': { required: true, message: '申请人appid不能为空', trigger: 'submit' },
  'kjg_dldz': { required: true, message: '登录地址不能为空', trigger: 'submit' },
  'kjg_cszh': { required: true, message: '初始账号不能为空', trigger: 'submit' },
  'kjg_csmm': { required: true, message: '初始密码不能为空', trigger: 'submit' },
  'kjg_jgfl': { required: true, message: '机构分类不能为空', trigger: 'submit' },
  'kjg_longitude': { required: true, message: '坐标经度不能为空', trigger: 'submit' },
  'kjg_latitude': { required: true, message: '坐标纬度不能为空', trigger: 'submit' },
  'kjg_szrs': { required: true, message: '师资人数不能为空', trigger: 'submit' },
  'kjg_jgtb': { required: true, message: '机构图标不能为空', trigger: 'submit' },
  'kjg_jgjs': { required: true, message: '机构介绍不能为空', trigger: 'submit' },
  'kjg_ztpf': { required: true, message: '总体评分不能为空', trigger: 'submit' },
  'kjg_jspf': { required: true, message: '讲师评分不能为空', trigger: 'submit' },
  'kjg_kcpf': { required: true, message: '课程评分不能为空', trigger: 'submit' },
  'kjg_hjpf': { required: true, message: '环境评分不能为空', trigger: 'submit' },
})
// #endregion

// #region (dialog audit)
const dialogVisible_audit = ref<boolean>(false)

const dialogForm_Field_audit = reactive<{
  FLAG: keyof TYPE_TABLE_FIELD,
  REASON?: keyof TYPE_TABLE_FIELD
}>({
  FLAG: 'kjg_shzt',
  // REASON:'kjg_id'
})

const dialogForm_Ref_audit = ref<FormInstance>()
const dialogForm_Rules_audit = reactive<FormRules>({
  'kjg_name': { required: true, message: '机构名称不能为空', trigger: 'submit' },
  'kjg_reg_address': { required: true, message: '注册地址不能为空', trigger: 'submit' },
  'kjg_teach_address': { required: true, message: '办学地址不能为空', trigger: 'submit' },
  'kjg_jglxdh': { required: true, message: '机构联系电话不能为空', trigger: 'submit' },
  'kjg_tyshxydm': { required: true, message: '统一社会信用代码不能为空', trigger: 'submit' },
  'kjg_bxxkz': { required: true, message: '办学许可证不能为空', trigger: 'submit' },
  'kjg_yyzz': { required: true, message: '营业执照不能为空', trigger: 'submit' },
  'kjg_frxm': { required: true, message: '法人姓名不能为空', trigger: 'submit' },
  'kjg_frlxdh': { required: true, message: '法人联系电话不能为空', trigger: 'submit' },
  'kjg_frsfzzm': { required: true, message: '法人身份证正面不能为空', trigger: 'submit' },
  'kjg_frsfzfm': { required: true, message: '法人身份证反面不能为空', trigger: 'submit' },
  'kjg_fzrxm': { required: true, message: '负责人姓名不能为空', trigger: 'submit' },
  'kjg_fzrlxdh': { required: true, message: '负责人联系电话不能为空', trigger: 'submit' },
  'kjg_fzrsfzzm': { required: true, message: '负责人身份证正面不能为空', trigger: 'submit' },
  'kjg_fzrsfzfm': { required: true, message: '负责人身份证反面不能为空', trigger: 'submit' },
  'kjg_shzt': { required: true, message: '审核状态不能为空', trigger: 'submit' },
  'kjg_shztsm': { required: true, message: '审核状态说明不能为空', trigger: 'submit' },
  'openid': { required: true, message: '申请人openid不能为空', trigger: 'submit' },
  'unionid': { required: true, message: '申请人unionid不能为空', trigger: 'submit' },
  'appid': { required: true, message: '申请人appid不能为空', trigger: 'submit' },
  'kjg_dldz': { required: true, message: '登录地址不能为空', trigger: 'submit' },
  'kjg_cszh': { required: true, message: '初始账号不能为空', trigger: 'submit' },
  'kjg_csmm': { required: true, message: '初始密码不能为空', trigger: 'submit' },
  'kjg_jgfl': { required: true, message: '机构分类不能为空', trigger: 'submit' },
  'kjg_longitude': { required: true, message: '坐标经度不能为空', trigger: 'submit' },
  'kjg_latitude': { required: true, message: '坐标纬度不能为空', trigger: 'submit' },
  'kjg_szrs': { required: true, message: '师资人数不能为空', trigger: 'submit' },
  'kjg_jgtb': { required: true, message: '机构图标不能为空', trigger: 'submit' },
  'kjg_jgjs': { required: true, message: '机构介绍不能为空', trigger: 'submit' },
  'kjg_ztpf': { required: true, message: '总体评分不能为空', trigger: 'submit' },
  'kjg_jspf': { required: true, message: '讲师评分不能为空', trigger: 'submit' },
  'kjg_kcpf': { required: true, message: '课程评分不能为空', trigger: 'submit' },
  'kjg_hjpf': { required: true, message: '环境评分不能为空', trigger: 'submit' },
})

// #endregion

// #region (request api):
function queryApi() {
  loading_table.value = true
  return request({
    url: URL_CUT + '/index',
    data: {
      ...queryForm_Data.value,
      limit: limit.value,
      page: currentPage.value,
      kjg_shzt: 3
    }
  }).then((response: { data: { total_rows: string, page_data: TYPE_TABLE_FIELD[] } }) => {
    const { data } = response
    total.value = parseInt(data.total_rows)
    tableData.value = data.page_data
    return response
  }).then(() => {
    loading_table.value = false
  })
}

function addApi(data: TYPE_TABLE_FIELD) {
  return request({
    url: URL_CUT + '/add',
    data: {
      [URL_SUBMIT_KEY]: data,
    }
  })
}

function editApi(data: Partial<TYPE_TABLE_FIELD>) {
  return request({
    url: URL_CUT + '/edit',
    data: {
      [TABLE_KEY]: data[TABLE_KEY],
      [URL_SUBMIT_KEY]: pick(data, ['kjg_name', 'kjg_reg_address', 'kjg_teach_address', 'kjg_jglxdh', 'kjg_tyshxydm', 'kjg_bxxkz', 'kjg_yyzz', 'kjg_frxm', 'kjg_frlxdh', 'kjg_frsfzzm', 'kjg_frsfzfm', 'kjg_fzrxm', 'kjg_fzrlxdh', 'kjg_fzrsfzzm', 'kjg_fzrsfzfm', 'kjg_shzt', 'kjg_shztsm', 'openid', 'unionid', 'appid', 'kjg_dldz', 'kjg_cszh', 'kjg_csmm', 'kjg_jgfl', 'kjg_longitude', 'kjg_latitude', 'kjg_szrs', 'kjg_jgtb', 'kjg_jgjs', 'kjg_ztpf', 'kjg_jspf', 'kjg_kcpf', 'kjg_hjpf',]),
    }
  })
}

function deleteApi(id: string | string[]) {
  return request({
    url: URL_CUT + '/delete',
    data: {
      [TABLE_KEY]: id,
    }
  })
}

function detailApi(id: string) {
  return request({
    url: URL_CUT + '/detail',
    data: {
      [TABLE_KEY]: id,
    }
  })
}

function importApi(data: { file: File }) {
  return request({
    $type: 'import',
    url: URL_CUT + '/import',
    data
  } as AxiosRequestConfig)
}

function exportApi() {
  return download(URL_CUT + '/index', queryForm_Data.value)
}

const API_MAP = {
  query: queryApi,
  add: addApi,
  edit: editApi,
  delete: deleteApi,
  detail: detailApi,
  import: importApi,
  export: exportApi,
}
// #endregion

// #region (page init)
function init() {
  queryApi()
}
init()
// #endregion

</script>

<template>
  <div class="card flex-grow flex flex-col">
    <el-form inline :model="queryForm_Data">
      <!-- <el-form-item label="关键字"><el-input v-model="queryForm_Data.keyword" ></el-input></el-form-item> -->
      <el-form-item label="机构名称">
        <el-input v-model="queryForm_Data.kjg_name" clearable />
      </el-form-item>
      <!-- <el-form-item label="注册地址"><el-input v-model="queryForm_Data.kjg_reg_address" clearable /></el-form-item>
      <el-form-item label="办学地址"><el-input v-model="queryForm_Data.kjg_teach_address" clearable /></el-form-item> -->
      <el-form-item label="机构联系电话">
        <el-input v-model="queryForm_Data.kjg_jglxdh" clearable />
      </el-form-item>
      <el-form-item label="统一社会信用代码">
        <el-input v-model="queryForm_Data.kjg_tyshxydm" clearable />
      </el-form-item>
      <!-- <el-form-item label="办学许可证"><el-input v-model="queryForm_Data.kjg_bxxkz" clearable /></el-form-item>
      <el-form-item label="营业执照"><el-input v-model="queryForm_Data.kjg_yyzz" clearable /></el-form-item> -->
      <el-form-item label="法人姓名">
        <el-input v-model="queryForm_Data.kjg_frxm" clearable />
      </el-form-item>
      <!-- <el-form-item label="法人联系电话"><el-input v-model="queryForm_Data.kjg_frlxdh" clearable /></el-form-item>
      <el-form-item label="法人身份证正面"><el-input v-model="queryForm_Data.kjg_frsfzzm" clearable /></el-form-item>
      <el-form-item label="法人身份证反面"><el-input v-model="queryForm_Data.kjg_frsfzfm" clearable /></el-form-item> -->
      <el-form-item label="负责人姓名">
        <el-input v-model="queryForm_Data.kjg_fzrxm" clearable />
      </el-form-item>
      <!-- <el-form-item label="负责人联系电话"><el-input v-model="queryForm_Data.kjg_fzrlxdh" clearable /></el-form-item>
      <el-form-item label="负责人身份证正面"><el-input v-model="queryForm_Data.kjg_fzrsfzzm" clearable /></el-form-item>
      <el-form-item label="负责人身份证反面"><el-input v-model="queryForm_Data.kjg_fzrsfzfm" clearable /></el-form-item>
      <el-form-item label="审核状态"><el-select v-model="queryForm_Data.kjg_shzt" clearable filterable ><el-option label="待审核" value="2" /><el-option label="通过" value="1" /><el-option label="不通过" value="3" /></el-select></el-form-item>
      <el-form-item label="审核状态说明"><el-input v-model="queryForm_Data.kjg_shztsm" clearable /></el-form-item>
      <el-form-item label="申请人openid"><el-input v-model="queryForm_Data.openid" clearable /></el-form-item>
      <el-form-item label="申请人unionid"><el-input v-model="queryForm_Data.unionid" clearable /></el-form-item>
      <el-form-item label="申请人appid"><el-input v-model="queryForm_Data.appid" clearable /></el-form-item>
      <el-form-item label="登录地址"><el-input v-model="queryForm_Data.kjg_dldz" clearable /></el-form-item>
      <el-form-item label="初始账号"><el-input v-model="queryForm_Data.kjg_cszh" clearable /></el-form-item>
      <el-form-item label="初始密码"><el-input v-model="queryForm_Data.kjg_csmm" clearable /></el-form-item>
      <el-form-item label="机构分类"><el-input v-model="queryForm_Data.kjg_jgfl" clearable /></el-form-item>
      <el-form-item label="坐标经度"><el-input v-model="queryForm_Data.kjg_longitude" clearable /></el-form-item>
      <el-form-item label="坐标纬度"><el-input v-model="queryForm_Data.kjg_latitude" clearable /></el-form-item>
      <el-form-item label="师资人数"><el-input v-model="queryForm_Data.kjg_szrs" clearable /></el-form-item>
      <el-form-item label="机构图标"><el-input v-model="queryForm_Data.kjg_jgtb" clearable /></el-form-item>
      <el-form-item label="机构介绍"><el-input v-model="queryForm_Data.kjg_jgjs" clearable /></el-form-item>
      <el-form-item label="总体评分"><el-input v-model="queryForm_Data.kjg_ztpf" clearable /></el-form-item>
      <el-form-item label="讲师评分"><el-input v-model="queryForm_Data.kjg_jspf" clearable /></el-form-item>
      <el-form-item label="课程评分"><el-input v-model="queryForm_Data.kjg_kcpf" clearable /></el-form-item>
      <el-form-item label="环境评分"><el-input v-model="queryForm_Data.kjg_hjpf" clearable /></el-form-item> -->
      <el-form-item>
        <el-button @click="handleQueryFormBtn_search" type="primary">搜索</el-button>
        <el-button @click="handleQueryFormBtn_clear" type="warning">清空</el-button>
      </el-form-item>
    </el-form>
    <div class="divider"></div>
    <div>
      <!-- <import-button :url="URL_CUT_REF"></import-button> -->
      <el-button @click="handleTableRowBtn_export" type="success">导出</el-button>
      <!-- <el-button @click="handleTableRowBtn_add" type="primary">新增</el-button> -->
      <!-- <el-button @click="handleTableRowBtn_delete" type="danger">删除</el-button> -->
    </div>

    <div class="divider"></div>
    <div class="flex-auto">
      <el-table :data="tableData" @selection-change="handleSelectionChange" v-loading="loading_table"
        element-loading-background="#ffffff70">
        <el-table-column type="selection"></el-table-column>
        <el-table-column prop="kjg_name" label="机构名称" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_reg_address" label="注册地址" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_teach_address" label="办学地址" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_jglxdh" label="机构联系电话" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_tyshxydm" label="统一社会信用代码" width="auto" show-overflow-tooltip></el-table-column>
        <!-- <el-table-column prop="kjg_bxxkz" label="办学许可证" width="auto" show-overflow-tooltip></el-table-column> -->
        <!-- <el-table-column prop="kjg_yyzz" label="营业执照" width="auto" show-overflow-tooltip></el-table-column> -->
        <el-table-column prop="kjg_frxm" label="法人姓名" width="auto" show-overflow-tooltip></el-table-column>
        <!-- <el-table-column prop="kjg_frlxdh" label="法人联系电话" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_frsfzzm" label="法人身份证正面" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_frsfzfm" label="法人身份证反面" width="auto" show-overflow-tooltip></el-table-column> -->
        <el-table-column prop="kjg_fzrxm" label="负责人姓名" width="auto" show-overflow-tooltip></el-table-column>
        <!-- <el-table-column prop="kjg_fzrlxdh" label="负责人联系电话" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_fzrsfzzm" label="负责人身份证正面" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_fzrsfzfm" label="负责人身份证反面" width="auto" show-overflow-tooltip></el-table-column> -->
        <el-table-column prop="kjg_shzt" label="审核状态" width="auto" show-overflow-tooltip></el-table-column>
        <!-- <el-table-column prop="kjg_shztsm" label="审核状态说明" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="openid" label="申请人openid" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="unionid" label="申请人unionid" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="appid" label="申请人appid" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_dldz" label="登录地址" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_cszh" label="初始账号" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_csmm" label="初始密码" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_jgfl" label="机构分类" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_longitude" label="坐标经度" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_latitude" label="坐标纬度" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_szrs" label="师资人数" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_jgtb" label="机构图标" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_jgjs" label="机构介绍" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_ztpf" label="总体评分" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_jspf" label="讲师评分" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_kcpf" label="课程评分" width="auto" show-overflow-tooltip></el-table-column>
        <el-table-column prop="kjg_hjpf" label="环境评分" width="auto" show-overflow-tooltip></el-table-column> -->
        <!-- <el-table-column label="操作" fixed="right">
          <template #default="scope">
            <el-button link :auto-insert-space="false" @click="handleTableColBtn_edit(scope)" type="primary" >编辑</el-button>
            <el-button link :auto-insert-space="false" @click="handleTableColBtn_audit(scope)" type="primary">审核
            </el-button>
            <el-button link :auto-insert-space="false" @click="handleTableColBtn_detail(scope)" type="primary" >详情</el-button>
            <el-button link :auto-insert-space="false" @click="handleTableColBtn_delete(scope)" type="primary" >删除</el-button>
          </template>
        </el-table-column> -->
      </el-table>
    </div>

    <div class="flex justify-end mt-10 py-4">
      <el-pagination :page-size="limit" v-model:current-page="currentPage" @current-change="handleCurrentChange"
        background layout="total, prev, pager, next" :total="total" />
    </div>
  </div>

  <el-dialog v-model="dialogVisible_addOrEdit" append-to-body destroy-on-close>
    <el-form :model="dialogForm_Data" ref="dialogForm_Ref_addOrEdit" :rules="dialogForm_Rules_addOrEdit"
      label-width="120px">
      <el-form-item label="机构名称" prop="kjg_name">
        <el-input v-model="dialogForm_Data.kjg_name" clearable />
      </el-form-item>
      <el-form-item label="注册地址" prop="kjg_reg_address">
        <el-input v-model="dialogForm_Data.kjg_reg_address" clearable />
      </el-form-item>
      <el-form-item label="办学地址" prop="kjg_teach_address">
        <el-input v-model="dialogForm_Data.kjg_teach_address" clearable />
      </el-form-item>
      <el-form-item label="机构联系电话" prop="kjg_jglxdh">
        <el-input v-model="dialogForm_Data.kjg_jglxdh" clearable />
      </el-form-item>
      <el-form-item label="统一社会信用代码" prop="kjg_tyshxydm">
        <el-input v-model="dialogForm_Data.kjg_tyshxydm" clearable />
      </el-form-item>
      <el-form-item label="办学许可证" prop="kjg_bxxkz">
        <el-input v-model="dialogForm_Data.kjg_bxxkz" clearable />
      </el-form-item>
      <el-form-item label="营业执照" prop="kjg_yyzz">
        <el-input v-model="dialogForm_Data.kjg_yyzz" clearable />
      </el-form-item>
      <el-form-item label="法人姓名" prop="kjg_frxm">
        <el-input v-model="dialogForm_Data.kjg_frxm" clearable />
      </el-form-item>
      <el-form-item label="法人联系电话" prop="kjg_frlxdh">
        <el-input v-model="dialogForm_Data.kjg_frlxdh" clearable />
      </el-form-item>
      <el-form-item label="法人身份证正面" prop="kjg_frsfzzm">
        <el-input v-model="dialogForm_Data.kjg_frsfzzm" clearable />
      </el-form-item>
      <el-form-item label="法人身份证反面" prop="kjg_frsfzfm">
        <el-input v-model="dialogForm_Data.kjg_frsfzfm" clearable />
      </el-form-item>
      <el-form-item label="负责人姓名" prop="kjg_fzrxm">
        <el-input v-model="dialogForm_Data.kjg_fzrxm" clearable />
      </el-form-item>
      <el-form-item label="负责人联系电话" prop="kjg_fzrlxdh">
        <el-input v-model="dialogForm_Data.kjg_fzrlxdh" clearable />
      </el-form-item>
      <el-form-item label="负责人身份证正面" prop="kjg_fzrsfzzm">
        <el-input v-model="dialogForm_Data.kjg_fzrsfzzm" clearable />
      </el-form-item>
      <el-form-item label="负责人身份证反面" prop="kjg_fzrsfzfm">
        <el-input v-model="dialogForm_Data.kjg_fzrsfzfm" clearable />
      </el-form-item>
      <el-form-item label="审核状态" prop="kjg_shzt">
        <el-radio-group v-model="dialogForm_Data.kjg_shzt">
          <el-radio label="0">待审核</el-radio>
          <el-radio label="1">通过</el-radio>
          <el-radio label="2">不通过</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="审核状态说明" prop="kjg_shztsm">
        <el-input v-model="dialogForm_Data.kjg_shztsm" clearable />
      </el-form-item>
      <el-form-item label="申请人openid" prop="openid">
        <el-input v-model="dialogForm_Data.openid" clearable />
      </el-form-item>
      <el-form-item label="申请人unionid" prop="unionid">
        <el-input v-model="dialogForm_Data.unionid" clearable />
      </el-form-item>
      <el-form-item label="申请人appid" prop="appid">
        <el-input v-model="dialogForm_Data.appid" clearable />
      </el-form-item>
      <el-form-item label="登录地址" prop="kjg_dldz">
        <el-input v-model="dialogForm_Data.kjg_dldz" clearable />
      </el-form-item>
      <el-form-item label="初始账号" prop="kjg_cszh">
        <el-input v-model="dialogForm_Data.kjg_cszh" clearable />
      </el-form-item>
      <el-form-item label="初始密码" prop="kjg_csmm">
        <el-input v-model="dialogForm_Data.kjg_csmm" clearable />
      </el-form-item>
      <el-form-item label="机构分类" prop="kjg_jgfl">
        <el-input v-model="dialogForm_Data.kjg_jgfl" clearable />
      </el-form-item>
      <el-form-item label="坐标经度" prop="kjg_longitude">
        <el-input v-model="dialogForm_Data.kjg_longitude" clearable />
      </el-form-item>
      <el-form-item label="坐标纬度" prop="kjg_latitude">
        <el-input v-model="dialogForm_Data.kjg_latitude" clearable />
      </el-form-item>
      <el-form-item label="师资人数" prop="kjg_szrs">
        <el-input v-model="dialogForm_Data.kjg_szrs" clearable />
      </el-form-item>
      <el-form-item label="机构图标" prop="kjg_jgtb">
        <el-input v-model="dialogForm_Data.kjg_jgtb" clearable />
      </el-form-item>
      <el-form-item label="机构介绍" prop="kjg_jgjs">
        <el-input v-model="dialogForm_Data.kjg_jgjs" clearable />
      </el-form-item>
      <el-form-item label="总体评分" prop="kjg_ztpf">
        <el-input v-model="dialogForm_Data.kjg_ztpf" clearable />
      </el-form-item>
      <el-form-item label="讲师评分" prop="kjg_jspf">
        <el-input v-model="dialogForm_Data.kjg_jspf" clearable />
      </el-form-item>
      <el-form-item label="课程评分" prop="kjg_kcpf">
        <el-input v-model="dialogForm_Data.kjg_kcpf" clearable />
      </el-form-item>
      <el-form-item label="环境评分" prop="kjg_hjpf">
        <el-input v-model="dialogForm_Data.kjg_hjpf" clearable />
      </el-form-item>
      <div class="flex justify-center">
        <el-button @click="handleDialogFormBtn_submit('dialogForm_Ref_addOrEdit')" type="primary">提交</el-button>
        <el-button @click="handleDialogFormBtn_cancel('dialogForm_Ref_addOrEdit')" type="default">取消</el-button>
      </div>
    </el-form>
  </el-dialog>

  <el-dialog v-model="dialogVisible_audit" append-to-body destroy-on-close>
    <el-form :model="dialogForm_Data" ref="dialogForm_Ref_audit" :rules="dialogForm_Rules_audit" label-width="120px">
      <el-form-item label="状态">
        <el-radio-group v-model="dialogForm_Data[dialogForm_Field_audit.FLAG]">
          <el-radio label="1">通过</el-radio>
          <el-radio label="3">未通过</el-radio>
        </el-radio-group>
      </el-form-item>
      <!-- <el-form-item label="原因" v-show="dialogForm_Data[dialogForm_Field_audit.FLAG] === '1'">
        <el-input type="textarea" v-model="dialogForm_Data[dialogForm_Field_audit.REASON]" :rows="5" />
      </el-form-item> -->
      <div class="flex justify-center">
        <el-button @click="handleDialogFormBtn_submit('dialogForm_Ref_audit')" type="primary">提交</el-button>
        <el-button @click="handleDialogFormBtn_cancel('dialogForm_Ref_audit')" type="default">取消</el-button>
      </div>
    </el-form>
  </el-dialog>
</template>
