|
@@ -0,0 +1,171 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="main" v-loading="loading">
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <custom-search-bar :fields="fields.filter((f) => f.isSearch)" v-model="searchForm" @search="search" @reset="toReset">
|
|
|
+ <template #type>
|
|
|
+ <el-option v-for="i in signTypeList" :key="i.id" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ </custom-search-bar>
|
|
|
+ <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @view="toView" @exam="toExam">
|
|
|
+ <template #is_use="{ row }">
|
|
|
+ <el-tag v-if="row.is_use == '0'" type="success" @click="toUse(row, '1')">启用</el-tag>
|
|
|
+ <el-tag v-else type="info" @click="toUse(row, '0')">禁用</el-tag>
|
|
|
+ </template>
|
|
|
+ </custom-table>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-dialog v-model="dialog.show" :title="dialog.title" :destroy-on-close="false" @close="toClose">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" v-if="dialog.type == '1'">
|
|
|
+ <custom-form v-model="form" :fields="formFields" :useSave="false">
|
|
|
+ <template #type>
|
|
|
+ <el-option v-for="i in signTypeList" :key="i.id" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #project_file>
|
|
|
+ <custom-upload model="project_file" :list="form.project_file" :limit="4" url="/files/web/cxyy_sign/upload" @change="onUpload"></custom-upload>
|
|
|
+ </template>
|
|
|
+ </custom-form>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" v-if="dialog.type == '2'">
|
|
|
+ <custom-form v-model="examForm" :fields="examFormFields" :rules="examRules" @save="toExamSave">
|
|
|
+ <template #status>
|
|
|
+ <el-option v-for="i in statusList" :key="i.id" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ </custom-form>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { cloneDeep, get } from 'lodash-es'
|
|
|
+const $checkRes = inject('$checkRes')
|
|
|
+const { t } = useI18n()
|
|
|
+// 接口
|
|
|
+import { SignStore } from '@/store/api/platform/sign'
|
|
|
+import { DictDataStore } from '@/store/api/system/dictData'
|
|
|
+const store = SignStore()
|
|
|
+const dictDataStore = DictDataStore()
|
|
|
+
|
|
|
+const data = ref([])
|
|
|
+const searchForm = ref({})
|
|
|
+const fields = [
|
|
|
+ { label: t('pages.sign.name'), model: 'name', isSearch: true },
|
|
|
+ { label: t('pages.sign.phone'), model: 'phone', isSearch: true },
|
|
|
+ { label: t('pages.sign.company'), model: 'company', isSearch: true },
|
|
|
+ { label: t('pages.match.type'), model: 'type', isSearch: true, type: 'select', format: (i) => getDict(i, 'type') },
|
|
|
+ { label: t('pages.sign.time'), model: 'time' },
|
|
|
+ { label: t('pages.match.status'), model: 'status', format: (i) => getDict(i, 'status') }
|
|
|
+]
|
|
|
+const opera = [
|
|
|
+ { label: t('common.view'), method: 'view' },
|
|
|
+ { label: t('common.exam'), method: 'exam', type: 'warning', display: (i) => i.status === '0' }
|
|
|
+]
|
|
|
+let skip = 0
|
|
|
+let limit = inject('limit')
|
|
|
+const total = ref(0)
|
|
|
+const formFields = ref([
|
|
|
+ { label: t('pages.sign.name'), model: 'name' },
|
|
|
+ { label: t('pages.sign.phone'), model: 'phone' },
|
|
|
+ { label: t('pages.sign.type'), model: 'type', type: 'select' },
|
|
|
+ { label: t('pages.sign.company'), model: 'company' },
|
|
|
+ { label: t('pages.sign.project_name'), model: 'project_name', display: () => form.value.type == '1' },
|
|
|
+ { label: t('pages.sign.project_brief'), model: 'project_brief', type: 'textarea', display: () => form.value.type == '1' },
|
|
|
+ { label: t('pages.sign.project_file'), model: 'project_file', custom: true, display: () => form.value.type == '1' }
|
|
|
+])
|
|
|
+const dialog = ref({ type: '1', show: false, title: t('pages.sign.DialogTitle') })
|
|
|
+const form = ref({})
|
|
|
+// 审核
|
|
|
+const examFormFields = [{ label: t('pages.match.status'), model: 'status', type: 'select' }]
|
|
|
+const examRules = reactive({
|
|
|
+ status: [{ required: true, message: t('common.statusMessage'), trigger: 'blur' }]
|
|
|
+})
|
|
|
+const examForm = ref({})
|
|
|
+// 字典表
|
|
|
+const cardTypeList = ref([])
|
|
|
+const statusList = ref([])
|
|
|
+const signTypeList = ref([])
|
|
|
+// 加载中
|
|
|
+const loading = ref(false)
|
|
|
+const searchOther = async () => {
|
|
|
+ let result
|
|
|
+ // 证件类型
|
|
|
+ result = await dictDataStore.query({ code: 'cardType', is_use: '0' })
|
|
|
+ if ($checkRes(result)) cardTypeList.value = result.data
|
|
|
+ // 状态
|
|
|
+ result = await dictDataStore.query({ code: 'examStatus', is_use: '0' })
|
|
|
+ if ($checkRes(result)) statusList.value = result.data
|
|
|
+ // 报名类型
|
|
|
+ result = await dictDataStore.query({ code: 'signType', is_use: '0' })
|
|
|
+ if ($checkRes(result)) signTypeList.value = result.data
|
|
|
+}
|
|
|
+const props = defineProps({
|
|
|
+ matchInfo: { type: Object }
|
|
|
+})
|
|
|
+const match = computed({
|
|
|
+ get() {
|
|
|
+ return props.matchInfo
|
|
|
+ }
|
|
|
+})
|
|
|
+const id = ref('')
|
|
|
+const search = async (query = { skip, limit }) => {
|
|
|
+ skip = query.skip
|
|
|
+ limit = query.limit
|
|
|
+ const info = { skip: query.skip, limit: query.limit, ...searchForm.value, match: id.value }
|
|
|
+ const res = await store.query(info)
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ data.value = res.data
|
|
|
+ total.value = res.total
|
|
|
+ }
|
|
|
+}
|
|
|
+// 字典数据转换
|
|
|
+const getDict = (data, model) => {
|
|
|
+ if (data) {
|
|
|
+ let res
|
|
|
+ if (model == 'status') res = statusList.value.find((f) => f.value == data)
|
|
|
+ if (model == 'type') res = signTypeList.value.find((f) => f.value == data)
|
|
|
+ return get(res, 'label')
|
|
|
+ }
|
|
|
+}
|
|
|
+// 查看
|
|
|
+const toView = async (data) => {
|
|
|
+ form.value = data
|
|
|
+ dialog.value = { type: '1', show: true, title: t('pages.user.dialogTitle') }
|
|
|
+}
|
|
|
+// 审核
|
|
|
+const toExam = (data) => {
|
|
|
+ examForm.value = data
|
|
|
+ dialog.value = { type: '2', show: true, title: t('pages.match.examDialogTitle') }
|
|
|
+}
|
|
|
+// 审核保存
|
|
|
+const toExamSave = async () => {
|
|
|
+ const data = cloneDeep(examForm.value)
|
|
|
+ let res = await store.update({ id: data.id, status: data.status })
|
|
|
+ if ($checkRes(res, true)) {
|
|
|
+ search({ skip, limit })
|
|
|
+ toClose()
|
|
|
+ }
|
|
|
+}
|
|
|
+const toClose = () => {
|
|
|
+ examForm.value = {}
|
|
|
+ dialog.value = { show: false }
|
|
|
+}
|
|
|
+watch(
|
|
|
+ match,
|
|
|
+ async (item) => {
|
|
|
+ id.value = item.id
|
|
|
+ loading.value = true
|
|
|
+ await searchOther()
|
|
|
+ await search({ skip, limit })
|
|
|
+ loading.value = false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true //初始化立即执行
|
|
|
+ }
|
|
|
+)
|
|
|
+</script>
|
|
|
+<style scoped lang="scss"></style>
|