index.vue 13.9 KB
<template>
  <div class="app-container">
    <div class="from-Card">
      <el-form
        v-show="showSearch" ref="queryRef" size="small" :model="queryParams" :inline="true"
        label-position="top"
      >
        <el-row style="width: 100%;">
          <el-col :span="4">
            <el-form-item label="缴费编号" prop="examCode">
              <el-input
                v-model="queryParams.examCode"
                placeholder="请输入缴费编号"
                clearable
                style="width: 214px;"
                @keyup.enter="handleQuery"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="考级名称" prop="name">
              <el-input
                v-model="queryParams.name"
                placeholder="请输入考级名称"
                clearable
                style="width: 214px;"
                @keyup.enter="handleQuery"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="状态" prop="status">
              <el-select v-model="queryParams.status" style="width: 214px;" clearable @change="handleQuery">
                <el-option label="未提交" value="0" />
                <el-option label="审核中" value="1" />
                <el-option label="审核通过" value="2" />
                <el-option label="审批拒绝" value="3" />
                <el-option label="撤回" value="4" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="申请单位" prop="applyName">
              <el-input
                v-model="queryParams.applyName"
                style="width: 214px;"
                placeholder="请输入申请单位"
                clearable
                @keyup.enter="handleQuery"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="考级考官" prop="examiner">
              <el-input
                v-model="queryParams.examiner"
                placeholder="请输入考级考官"
                clearable
                style="width: 214px;"
                @keyup.enter="handleQuery"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8" :hidden="showCollect">
            <el-form-item label="申请日期" prop="applyTimeRange">
              <el-date-picker
                v-model="queryParams.applyTimeRange"
                clearable
                type="daterange"
                range-separator="至"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
                value-format="YYYY-MM-DD"
                style="width: 460px;"
                @change="handleQuery"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8" :hidden="showCollect">
            <el-form-item label="考级日期" prop="examTimeRange">
              <el-date-picker
                v-model="queryParams.examTimeRange"
                clearable
                type="daterange"
                range-separator="至"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
                value-format="YYYY-MM-DD"
                style="width: 460px;"
                @change="handleQuery"
              />
            </el-form-item>
          </el-col>
          <div class="po-r-btns">
            <el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
            <el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
            <el-button
              v-if="showCollect" size="small" type="primary" link icon="ArrowDown"
              @click="showCollect=!showCollect"
            >展开</el-button>
            <el-button
              v-else size="small" type="primary" link icon="ArrowUp"
              @click="showCollect=!showCollect"
            >收起</el-button>
          </div>
        </el-row>
      </el-form>
      <el-row justify="space-between">
        <div>
          <el-button
            v-if="isExam=='0'"
            v-hasPermi="['exam:*']"
            type="primary" :icon="Plus"
            @click="handleAdd"
          >添加级位考试</el-button>
          <el-button
            v-hasPermi="['exam:*']"
            :icon="Download"
            type="warning"
            @click="handleExport"
          >导出</el-button>
        </div>
      </el-row>
    </div>

    <div class="table">
      <el-table v-loading="loading" :row-class-name="tableRowClassName" border :data="infoList">
        <el-table-column type="index" width="55" align="center" label="序号" />
        <el-table-column label="缴费编号" align="center" prop="examCode" min-width="140" :show-overflow-tooltip="true" />
        <el-table-column label="考级名称" align="center" prop="name" min-width="140" :show-overflow-tooltip="true" />
        <el-table-column label="申请单位" align="center" prop="memberName" min-width="100" :show-overflow-tooltip="true" />
        <el-table-column label="申请日期" align="center" prop="applyTime" min-width="100">
          <template #default="scope">
            <span>{{ parseTime(scope.row.applyTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="考级开始日期" align="center" prop="startTime" min-width="170" :show-overflow-tooltip="true">
          <template #default="scope">
            <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}:{i}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="考级结束日期" align="center" prop="endTime" :show-overflow-tooltip="true" min-width="170">
          <template #default="scope">
            <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{i}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="考级地点" align="center" prop="address" min-width="100" :show-overflow-tooltip="true" />
        <el-table-column label="考级考官" align="center" prop="examinerNames" min-width="120px" :show-overflow-tooltip="true" />
        <el-table-column label="考级考生" align="center" prop="pass" width="280">
          <template #default="scope">
            <el-button
              style="width:auto" link type="primary" :disabled="!(scope.row.status=='0'||scope.row.status=='3'||scope.row.status=='4')"
              @click="handleUpdatePerson(scope.row)"
            >编辑</el-button>|
            <span>共计{{ scope.row.totalNum?scope.row.totalNum:(scope.row.pass+scope.row.noPass) }}</span>|
            <span class="text-success">通过{{ scope.row.pass }}</span>|
            <span class="text-danger">不通过{{ scope.row.noPass }}</span>
          </template>
        </el-table-column>
        <el-table-column label="提交时间" align="center" prop="submitTime" min-width="100">
          <template #default="scope">
            <span v-if="scope.row.status=='0'" />
            <span v-else>{{ parseTime(scope.row.submitTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="审核状态" align="center" prop="statusStr" min-width="100">
          <template #default="scope">
            <span
              :class="{
                'text-success':scope.row.status=='2',
                'text-danger':scope.row.status=='3',
                'text-warning':scope.row.status=='4'
              }"
            >{{ scope.row.statusStr }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="审核进度"
          align="center"
          prop=""
          min-width="120"
        >
          <template #default="props">
            <schedule v-if="props.row.status == 1||props.row.status == 2" :audit-process="props.row.processInfo" />
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width="300" align="center" fixed="right" class-name="small-padding fixed-width">
          <template #default="scope">
            <el-button :disabled="!(scope.row.status!='0')" type="primary" @click="handleView(scope.row)">查看</el-button>
            <el-button
              v-hasPermi="['exam:*']" :disabled="!(scope.row.status=='0'||scope.row.status=='3'||scope.row.status=='4')" color="#13B5B1" style="--el-color-black:#fff;"
              @click="handleSubmit(scope.row)"
            >提交审核</el-button>

            <el-dropdown class="poptdmore">
              <el-button type="primary" plain>更多
                <el-icon class="el-icon--right">
                  <arrow-down />
                </el-icon>
              </el-button>
              <template #dropdown>
                <el-dropdown-menu>
                  <!--                  <el-dropdown-item>-->
                  <!--                    <el-button :disabled="!(scope.row.status!='0'&& scope.row.transcript)" type="warning" @click="viewTranscript(scope.row)">成绩单</el-button>-->
                  <!-- <el-button
                      v-hasPermi="['exam:*']" :disabled="!(scope.row.status=='0'||scope.row.status=='3'||scope.row.status=='4')" color="#13B5B1" style="--el-color-black:#fff;"
                      @click="handleSubmit(scope.row)"
                    >提交审核</el-button> -->
                  <!--                  </el-dropdown-item>-->
                  <el-dropdown-item>
                    <el-button
                      v-hasPermi="['exam:*']" :disabled="!(scope.row.status=='0'||scope.row.status=='3'||scope.row.status=='4')" type="warning" style="--el-color-black:#fff;"
                      @click="handleUpdate(scope.row)"
                    >&nbsp;&nbsp;&nbsp;</el-button>
                  </el-dropdown-item>
                  <el-dropdown-item>
                    <el-button
                      v-hasPermi="['exam:*']" :disabled="!(scope.row.status=='0'||scope.row.status=='3'||scope.row.status=='4')" type="danger"
                      @click="handleDelete(scope.row)"
                    >&nbsp;&nbsp;&nbsp;</el-button>
                  </el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total>0"
        v-model:page="queryParams.pageNum"
        v-model:limit="queryParams.pageSize"
        :total="total"
        @pagination="getList"
      />
    </div>

    <exam-view ref="examViewRef" />
    <view-files ref="viewFilesRef" />
  </div>
</template>

<script setup name="Level_Apply">
import { listInfo, delInfo, submitVerity } from '@/api/exam/info'
import { getCurrentInstance, reactive } from '@vue/runtime-core'
import { computed, ref, toRefs, watch } from 'vue'
import { parseTime } from '@/utils/ruoyi'
import ExamView from './components/examView'
import useTagsViewStore from '@/store/modules/tagsView'
import { useRouter } from 'vue-router'
import ViewFiles from '@/views/exam/components/viewFiles'
import useUserStore from '@/store/modules/user'
import { Plus, Download } from '@element-plus/icons-vue'
import Schedule from '@/views/member/components/schedule.vue'

watch(() => useTagsViewStore().reSearch, (val) => {
  if (val) {
    getList()
  }
})

const { proxy } = getCurrentInstance()
const router = useRouter()
const isExam = computed(() => useUserStore().memberInfo.isPoints)

const showCollect = ref(true)
const infoList = ref([])
const loading = ref(true)
const showSearch = ref(true)
const total = ref(0)
const data = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    name: undefined,
    applyTimeRange: undefined,
    examTimeRange: undefined,
    applyName: undefined,
    examiner: undefined,
    status: undefined,
    examCode: undefined,
    type: '1',
    rankStatus: '0'
  }
})

const { queryParams } = toRefs(data)

// // 背景色
const tableRowClassName = ({
  row,
  rowIndex
}) => {
  if (row.status == 2) {
    return 'success-row'
  }
}


/** 查询考级信息列表 */
function getList() {
  loading.value = true
  listInfo(queryParams.value).then(response => {
    infoList.value = response.rows
    total.value = response.total
    loading.value = false
  })
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1
  getList()
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm('queryRef')
  handleQuery()
}

/** 新增按钮操作 */
function handleAdd() {
  router.push('/level/apply/modify/0')
}

/** 修改按钮操作 */
function handleUpdate(row) {
  router.push(`/level/apply/modify/${row.examId}`)
}

function handleUpdatePerson(row) {
  router.push({
    path: `/level/apply/modify/${row.examId}`,
    query: { step: 2 }
  })
}

function handleSubmit(row) {
  proxy.$modal.confirm(`确定提交 "${row.name}" 进行审核?`)
    .then(() => {
      loading.value = true
      return submitVerity(row.examId)
    }).then(() => {
      loading.value = true
      getList()
      proxy.$modal.msgSuccess('提交成功')
    }).catch(() => {
    }).finally(() => {
      loading.value = false
    })
}

function handleView(row) {
  proxy.$refs['examViewRef'].open(row.examId)
}

/** 删除按钮操作 */
function handleDelete(row) {
  proxy.$modal.confirm('是否确认删除考级名称为"' + row.name + '"的数据项?').then(function() {
    loading.value = true
    return delInfo(row.examId)
  }).then(() => {
    loading.value = true
    getList()
    proxy.$modal.msgSuccess('删除成功')
  }).catch(() => {
  }).finally(() => {
    loading.value = false
  })
}

/** 导出按钮操作 */
function handleExport() {
  proxy.download('exam/info/export', {
    ...queryParams.value
  }, `级位考试信息_${new Date().getTime()}.xlsx`)
}

function viewTranscript(row) {
  proxy.$refs['viewFilesRef'].open(row.transcript)
}
getList()
</script>
<style lang="scss" scope>

</style>