addExaminer.vue 2.46 KB
<template>
  <div>
    <el-dialog v-model="showDialog" width="800" title="添加考官" destroy-on-close>
      <el-form :model="form" :rules="rules" label-width="">
        <el-form-item label="证件号" prop="idcCode">
          <el-input v-model.trim="form.idcCode" style="width: 300px;" placeholder="请输入证件号" />
          <el-button style="width: 100px;margin-left: 20px;" type="primary" round @click="handelSearch">查询</el-button>
        </el-form-item>
      </el-form>
      
      <div>
        <el-table v-loading="loading" :data="list" border>
          <el-table-column label="序号" type="index" width="55" align="center" />
          <el-table-column label="姓名" prop="name" align="center" />
          <el-table-column label="证件号" prop="idcCode" align="center" />
          <el-table-column label="注册单位" prop="memName" align="center" />
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
            <template #default="{ row }">
              <el-button type="primary" @click="handelAdd(row)">添加</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--      <div style="text-align: center;">-->
      <!--        <el-button round class="btn" type="" @click="showDialog=false">取消</el-button>-->
      <!--        <el-button round class="btn" type="primary" @click="handelSubmit">添加</el-button>-->
      <!--      </div>-->
    </el-dialog>
  </div>
</template>

<script setup>
import { getCurrentInstance, ref } from 'vue'
import { coachList, ztxAdd } from '@/api/exam/info'
import { getOtherInfoList } from '@/api/person/info'
const { proxy } = getCurrentInstance()

const emit = defineEmits(['handelSuccess'])
const form = ref({
  idCode: '4',
  perType: '3'
})
const rules = ref({

})
const loading = ref(false)
const showDialog = ref(false)
const list = ref([])

function open() {
  form.value = {
    idcCode: '',
    perType: '3'
  }
  showDialog.value = true
}


async function handelSearch() {
  if (!form.value.idcCode) {
    proxy.$mdoal.msgError('请输入证件号')
    return
  }
  loading.value = true
  const res = await getOtherInfoList(form.value)
  loading.value = false
  list.value = res.rows ?? []
}

async function handelAdd(row) {
  await ztxAdd(row.perId)
  proxy.$modal.msgSuccess('添加成功')
  emit('handelSuccess')
}

defineExpose({
  open
})
</script>

<style lang="scss" scoped>

.btn{
  width: 200px;
  height:38px
}
</style>