|
@@ -1,28 +1,11 @@
|
|
|
<template>
|
|
|
- <div id="verify">
|
|
|
+ <div id="detail">
|
|
|
<detail-frame :title="mainTitle" returns="./index">
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="120px" class="form" size="small" @submit.native.prevent>
|
|
|
- <el-form-item label="活动区域">
|
|
|
- <el-select v-model="form.state" placeholder="请选择状态">
|
|
|
- <el-option label="注册" value="0"></el-option>
|
|
|
- <el-option label="确认身份" value="1"></el-option>
|
|
|
- <el-option label="资料评分" value="2"></el-option>
|
|
|
- <el-option label="面试评分" value="3"></el-option>
|
|
|
- <el-option label="确认入库" value="4"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item :label="this.$route.query.state == 2 ? '资料评分' : '面试评分'" prop="title" required :isNew="isNew">
|
|
|
- <el-input v-model="form.title"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-row type="flex" align="middle" justify="space-around">
|
|
|
- <el-col :span="6">
|
|
|
- <el-button type="primary" @click="toSave">保存</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
+ <data-form :fields="fields" :rules="rules" @save="handleSave" :isNew="isNew" :data="info">
|
|
|
+ <template #custom="{ item, form, fieldChange }">
|
|
|
+ {{ status }}
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
</detail-frame>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -31,33 +14,32 @@
|
|
|
import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
import dataForm from '@frame/components/form';
|
|
|
import upload from '@frame/components/upload';
|
|
|
+import { createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions } = createNamespacedHelpers('teacher');
|
|
|
+
|
|
|
export default {
|
|
|
- metaInfo: { title: '审核详情页' },
|
|
|
- name: 'verify',
|
|
|
+ metaInfo: { title: '题库详情页' },
|
|
|
+ name: 'detail',
|
|
|
props: {},
|
|
|
components: {
|
|
|
detailFrame,
|
|
|
+ dataForm,
|
|
|
},
|
|
|
data: () => ({
|
|
|
- state: '',
|
|
|
- title: '',
|
|
|
- form: {
|
|
|
- state: '',
|
|
|
- },
|
|
|
-
|
|
|
- rules: {
|
|
|
- state: [{ required: true, message: '请选择状态' }],
|
|
|
- },
|
|
|
+ info: {},
|
|
|
+ fields: [{ label: '状态', required: true, model: 'status', custom: true }],
|
|
|
+ rules: {},
|
|
|
}),
|
|
|
created() {},
|
|
|
computed: {
|
|
|
+ status() {
|
|
|
+ return this.info.status == '2' ? '资料评分' : this.info.status == '3' ? '面试评分' : '其他';
|
|
|
+ },
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
isNew() {
|
|
|
- console.log(this.$route.query.state);
|
|
|
- if (this.$route.query.state == 2) {
|
|
|
- return '资料评分';
|
|
|
- } else {
|
|
|
- return '面试评分';
|
|
|
- }
|
|
|
+ return this.$route.query.id ? false : true;
|
|
|
},
|
|
|
mainTitle() {
|
|
|
let meta = this.$route.meta;
|
|
@@ -71,11 +53,37 @@ export default {
|
|
|
return main;
|
|
|
},
|
|
|
},
|
|
|
+
|
|
|
+ watch: {
|
|
|
+ isNew: {
|
|
|
+ immediate: true,
|
|
|
+ handler(val) {
|
|
|
+ if (val) this.loading = false;
|
|
|
+ else this.search();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
- uploadSuccess() {},
|
|
|
+ ...mapActions(['fetch', 'create', 'update']),
|
|
|
+ async search() {
|
|
|
+ const res = await this.fetch(this.id);
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `info`, res.data);
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
async handleSave({ isNew, data }) {
|
|
|
- console.log(isNew);
|
|
|
- console.log(data);
|
|
|
+ let res = +this.info.status + 1;
|
|
|
+
|
|
|
+ let msg;
|
|
|
+ if (isNew) {
|
|
|
+ res = await this.create(data);
|
|
|
+ msg = `${this.keyWord}添加成功`;
|
|
|
+ } else {
|
|
|
+ console.log({ status: res, id: this.$route.query.id });
|
|
|
+ res = await this.update({ status: res, id: this.$route.query.id });
|
|
|
+ console.log(res);
|
|
|
+ msg = `${this.keyWord}审核成功`;
|
|
|
+ }
|
|
|
+ if (this.$checkRes(res, msg)) this.$router.push({ path: '/teacher/index' });
|
|
|
},
|
|
|
},
|
|
|
};
|