province_step1.vue 16 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
<template>
  <div class="">
    <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.trim="queryParams.examCode"
                placeholder="请输入缴费编号"
                clearable
                @keyup.enter="handleQuery"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="考级名称" prop="name">
              <el-input
                v-model.trim="queryParams.name"
                placeholder="请输入考级名称"
                clearable
                @keyup.enter="handleQuery"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="状态" prop="status">
              <el-select v-model="queryParams.status" clearable style="width: 100%" @change="handleQuery">
                <el-option label="全部" value="" />
                <el-option label="审批中" value="0" />
                <el-option label="审批通过" value="1" />
                <el-option label="审批拒绝" value="2" />
                <el-option label="审批撤回" value="3" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="上报单位" prop="applyName">
              <el-input
                v-model.trim="queryParams.applyName"
                placeholder="请输入上报单位"
                clearable
                @keyup.enter="handleQuery"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="考级考官" prop="examiner">
              <el-input
                v-model.trim="queryParams.examiner"
                placeholder="请输入考级考官"
                clearable
                @keyup.enter="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"-->
          <!--              />-->
          <!--            </el-form-item>-->
          <!--          </el-col>-->
          <el-col v-if="!showCollect" :span="8" style="display: flex">
            <el-form-item style="width: 100%;" label="考试日期" prop="examTimeRange">
              <el-date-picker
                v-model="queryParams.examTimeRange[0]" type="date" value-format="YYYY-MM-DD"
                placeholder="开始时间" style="width: 100%;"
              />
            </el-form-item>
            <el-form-item style="width: 100%;" label="考试日期" prop="examTimeRange">
              <el-date-picker
                v-model="queryParams.examTimeRange[1]" type="date" value-format="YYYY-MM-DD"
                placeholder="结束时间" style="width: 100%;"
              />
            </el-form-item>
          </el-col>
          <!--          <el-col :span="8" :hidden="showCollect">-->
          <!--            <el-form-item label="审核日期" prop="verityTimeRange">-->
          <!--              <el-date-picker-->
          <!--                v-model="queryParams.verityTimeRange"-->
          <!--                clearable-->
          <!--                type="daterange"-->
          <!--                range-separator="至"-->
          <!--                start-placeholder="开始时间"-->
          <!--                end-placeholder="结束时间"-->
          <!--                value-format="YYYY-MM-DD"-->
          <!--                style="width: 100%;"-->
          <!--                @change="handleQuery"-->
          <!--              />-->
          <!--            </el-form-item>-->
          <!--          </el-col>-->
          <!--          <el-col v-if="!showCollect" :span="8" style="display: flex">-->
          <!--            <el-form-item style="width: 100%;" label="审核日期" prop="handleDate">-->
          <!--              <el-date-picker-->
          <!--                v-model="queryParams.handleDate[0]" type="date" value-format="YYYY-MM-DD HH:mm:ss"-->
          <!--                placeholder="开始时间" style="width: 100%;"-->
          <!--              />-->
          <!--            </el-form-item>-->
          <!--            <el-form-item style="width: 100%;" label="审核日期" prop="handleDate">-->
          <!--              <el-date-picker-->
          <!--                v-model="queryParams.handleDate[1]" type="date" value-format="YYYY-MM-DD HH:mm:ss"-->
          <!--                placeholder="结束时间" style="width: 100%;"-->
          <!--              />-->
          <!--            </el-form-item>-->
          <!--          </el-col>-->
          <div class="po-r-btns">
            <el-button size="small" type="primary" @click="handleQuery">搜索</el-button>
            <el-button size="small" @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
            :icon="DocumentChecked" type="warning" color="#13B5B1" style="--el-color-black:#fff;" :disabled="multiple"
            @click="handleApprovalAll"
          >批量审核</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" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center" :selectable="selectable" />
        <el-table-column type="index" width="55" align="center" label="序号" />
        <el-table-column label="缴费编号" align="center" prop="examCode" min-width="200" :show-overflow-tooltip="true" />
        <el-table-column label="考级名称" align="center" prop="name" min-width="250" :show-overflow-tooltip="true" />
        <el-table-column label="上报单位" align="center" prop="memberName" min-width="120" :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="160" :show-overflow-tooltip="true">
          <template #default="scope">
            <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }} ~ {{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="考级地点" align="center" prop="address" min-width="120" :show-overflow-tooltip="true" />
        <el-table-column label="考级考官" align="center" prop="examinerNames" min-width="100" :show-overflow-tooltip="true" />
        <el-table-column label="考级考生数" align="center" prop="totalNum" min-width="90" />
        <el-table-column label="金额" align="center" prop="totalAmount" min-width="90">
          <template #default="scope">
            {{ (scope.row.totalAmount*1).toFixed(2) }}
          </template>
        </el-table-column>
        <el-table-column label="提交时间" align="center" prop="submitTime" min-width="100">
          <template #default="scope">
            <span>{{ 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.auditStatus=='1',
                'text-danger':scope.row.auditStatus=='2',
                'text-warning':scope.row.auditStatus=='3'
              }"
            >{{ scope.row.statusStr }}</span>
          </template>
        </el-table-column>
        <!--        <el-table-column-->
        <!--          label="审核进度"-->
        <!--          align="center"-->
        <!--          prop=""-->
        <!--          min-width="120"-->
        <!--        >-->
        <!--          <template #default="scope">-->
        <!--            <schedule v-if="scope.row.auditStatus == 1||scope.row.auditStatus == 0" :audit-process="scope.row.auditProcess" />-->
        <!--          </template>-->
        <!--        </el-table-column>-->
        <el-table-column label="审核日期" align="center" prop="handleDate" min-width="120" :show-overflow-tooltip="true">
          <template #default="scope">
            <span>{{ parseTime(scope.row.handleDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column width="260" label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
          <template #default="scope">
            <el-button type="primary" @click="handleView(scope.row)">查看</el-button>
            <el-button :disabled="!(scope.row.auditStatus=='0')" color="#13B5B1" style="--el-color-black:#fff;" @click="handleApproval(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.transcript" type="warning" @click="viewTranscript(scope.row)">成绩单</el-button>-->
                  <!--                  </el-dropdown-item>-->
                </el-dropdown-menu>
                <el-dropdown-item>
                  <el-button :disabled="!(scope.row.isView=='1' && scope.row.auditStatus=='1')" type="danger" @click="handleBack(scope.row)">&nbsp;&nbsp;&nbsp;</el-button>
                </el-dropdown-item>
              </template>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>
      <div v-show="total>0" class="totalCost">
        费用合计:<span>{{ statistical.totalCost?.toFixed(2) }} </span>
        考试人数合计:<span>{{ statistical.totalNum }} </span>
      </div>
      <pagination
        v-show="total>0"
        v-model:page="queryParams.pageNum"
        v-model:limit="queryParams.pageSize"
        :total="total"
        @pagination="getList"
      />
    </div>
  </div>
</template>

<script setup>
import { getVerityList } from '@/api/exam/info'
import { getCurrentInstance, reactive } from '@vue/runtime-core'
import { ref, toRefs } from 'vue'
import { parseTime } from '@/utils/ruoyi'
import _ from 'lodash'
import jsonlint from '@/utils/jsonlint/jsonlint'
import { Download, DocumentChecked } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'

const { proxy } = getCurrentInstance()
const emit = defineEmits(['viewExam', 'doApproval', 'viewTranscript', 'doBack'])
const router = useRouter()

const showCollect = ref(true)
const infoList = ref([])
const loading = ref(false)
const showSearch = ref(true)
const multiple = ref(true)
const total = ref(0)
let ids = []
const batchList = ref([])
const statistical = ref({})

const data = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    examCode: undefined,
    name: undefined,
    examTimeRange: [null, null],
    handleDate: [null, null],
    applyName: undefined,
    examiner: undefined,
    status: '0',
    mergeFlag: '0',
    type: '1'
  }
})
const { queryParams } = toRefs(data)

const statusArr = ['审批中', '审批通过', '审批拒绝', '审批撤回']

/** 查询考级信息列表 */
function getList() {
  // if ((queryParams.value.handleDate[0] == null && queryParams.value.handleDate[1] != null) || (queryParams.value.handleDate[1] == null && queryParams.value.handleDate[0] != null)) return proxy.$modal.msgError('请完善审核日期')
  if ((queryParams.value.examTimeRange[0] == null && queryParams.value.examTimeRange[1] != null) || (queryParams.value.examTimeRange[1] == null && queryParams.value.examTimeRange[0] != null)) return proxy.$modal.msgError('请完善考试日期')

  loading.value = true

  getVerityList(queryParams.value).then(response => {
    statistical.value = {
      totalCost: 0,
      totalNum: 0
    }
    const list = []
    _.each(response.rows, r => {
      const item = jsonlint.parse(r.content)
      item.recordId = r.recordId
      item.auditStatus = r.auditStatus
      item.isView = r.isView
      item.submitStatus = r.submitStatus
      item.distributeTime = r.distributeTime
      item.statusStr = statusArr[r.auditStatus]
      item.remark = r.remark
      item.cuLevels = r.cuLevels
      item.sourceData = r
      item.auditProcess = r.auditProcess
      item.handleDate = r.handleDate
      list.push(item)

      statistical.value.totalCost += (item.totalAmount * 1)
      statistical.value.totalNum += (item.totalNum * 1)
    })
    infoList.value = list
    total.value = response.total
    loading.value = false
  })
}

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

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

function selectable(row) {
  return row.auditStatus == '0'
}

// 多选框选中数据
function handleSelectionChange(selection) {
  ids = selection.map(item => item.recordId)
  multiple.value = !selection.length
  batchList.value = selection
}

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

/**
 * 批量审核
 */
function handleApprovalAll() {
  const rows = []
  const approveFlag = batchList.value.some(item => {
    if (item.auditStatus != '0') {
      return proxy.$message.warning(`缴费名称为”${item.examCode}“的数据项未处于待审核状态,无法审核!`)
    }
  })
  if (approveFlag) {
    return
  }
  _.each(ids, (id) => {
    const temp = _.find(infoList.value, (info) => {
      return info.recordId == id
    })
    if (temp) {
      rows.push(JSON.stringify(temp.sourceData))
    }
  })
  emit('doApproval', rows)
}

function handleView(row) {
  emit('viewExam', row, { hasApproval: true })
}

function viewTranscript(row) {
  emit('viewTranscript', row)
}

function handleApproval(row) {
  emit('doApproval', [JSON.stringify(row.sourceData)])
}

function handleBack(row) {
  emit('doBack', row)
}

function handleExport() {
  proxy.download('/exam/info/verityList/export', {
    ...queryParams.value
  }, `级位考试审核_${new Date().getTime()}.xlsx`)
}

function approvalCompleted(flag) {
  if (flag == 1) {
    // 审核通过
    proxy.$modal.confirm('审批完成,是否进行审核数据合并?')
      .then(() => {
        router.push({
          path: '/level/approvalMerge',
          query: { step: 2 }
        })
      })
  }
}

getList()
defineExpose({
  getList,
  approvalCompleted
})
</script>