|
@@ -2,6 +2,14 @@
|
|
<div id="detail">
|
|
<div id="detail">
|
|
<detail-frame :title="mainTitle" returns="/student/index">
|
|
<detail-frame :title="mainTitle" returns="/student/index">
|
|
<data-form :data="info" :fields="fields" :rules="rules" @save="handleSave" :isNew="isNew">
|
|
<data-form :data="info" :fields="fields" :rules="rules" @save="handleSave" :isNew="isNew">
|
|
|
|
+ <template #options="{item}">
|
|
|
|
+ <template v-if="item.model === 'school_name'">
|
|
|
|
+ <el-option v-for="(item, index) in schcoolList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="item.model === 'nation'">
|
|
|
|
+ <el-option v-for="(item, index) in nationList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
<template #radios="{item}">
|
|
<template #radios="{item}">
|
|
<template v-if="item.model === 'gender'">
|
|
<template v-if="item.model === 'gender'">
|
|
<el-radio label="男">男</el-radio>
|
|
<el-radio label="男">男</el-radio>
|
|
@@ -25,6 +33,8 @@ import detailFrame from '@frame/layout/admin/detail-frame';
|
|
import dataForm from '@frame/components/form';
|
|
import dataForm from '@frame/components/form';
|
|
import { createNamespacedHelpers } from 'vuex';
|
|
import { createNamespacedHelpers } from 'vuex';
|
|
const { mapActions } = createNamespacedHelpers('student');
|
|
const { mapActions } = createNamespacedHelpers('student');
|
|
|
|
+const { mapActions: mapNation } = createNamespacedHelpers('nation');
|
|
|
|
+const { mapActions: mapschool } = createNamespacedHelpers('school');
|
|
//缺少字典表:学校表,民族表,院系表,专业表
|
|
//缺少字典表:学校表,民族表,院系表,专业表
|
|
export default {
|
|
export default {
|
|
metaInfo: { title: '学生信息' },
|
|
metaInfo: { title: '学生信息' },
|
|
@@ -35,13 +45,15 @@ export default {
|
|
dataForm,
|
|
dataForm,
|
|
},
|
|
},
|
|
data: () => ({
|
|
data: () => ({
|
|
|
|
+ schcoolList: [],
|
|
|
|
+ nationList: [],
|
|
info: {},
|
|
info: {},
|
|
fields: [
|
|
fields: [
|
|
{ label: '姓名', required: true, model: 'name' },
|
|
{ label: '姓名', required: true, model: 'name' },
|
|
{ label: '性别', required: true, model: 'gender', type: 'radio' },
|
|
{ label: '性别', required: true, model: 'gender', type: 'radio' },
|
|
- // { label: '民族', required: true, model: 'nation', type: 'select' },
|
|
|
|
|
|
+ { label: '民族', required: true, model: 'nation', type: 'select' },
|
|
{ label: '身份证号', required: true, model: 'id_number', options: { maxlength: 18 } },
|
|
{ label: '身份证号', required: true, model: 'id_number', options: { maxlength: 18 } },
|
|
- // { label: '学校', required: true, model: 'school_name', type: 'select' },
|
|
|
|
|
|
+ { label: '学校', required: true, model: 'school_name', type: 'select' },
|
|
// { label: '院系', required: true, model: 'yard', type: 'select' },
|
|
// { label: '院系', required: true, model: 'yard', type: 'select' },
|
|
// { label: '专业', required: true, model: 'major', type: 'select' },
|
|
// { label: '专业', required: true, model: 'major', type: 'select' },
|
|
{ label: '入学年份', required: true, model: 'entry_year', type: 'year' },
|
|
{ label: '入学年份', required: true, model: 'entry_year', type: 'year' },
|
|
@@ -87,7 +99,10 @@ export default {
|
|
is_fine: [{ required: true, message: '请选择是否优秀' }],
|
|
is_fine: [{ required: true, message: '请选择是否优秀' }],
|
|
},
|
|
},
|
|
}),
|
|
}),
|
|
- created() {},
|
|
|
|
|
|
+ created() {
|
|
|
|
+ this.otherList();
|
|
|
|
+ this.schoolname();
|
|
|
|
+ },
|
|
computed: {
|
|
computed: {
|
|
id() {
|
|
id() {
|
|
return this.$route.query.id;
|
|
return this.$route.query.id;
|
|
@@ -118,6 +133,19 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapActions(['fetch', 'create', 'update']),
|
|
...mapActions(['fetch', 'create', 'update']),
|
|
|
|
+ ...mapNation({ nation: 'query' }),
|
|
|
|
+ ...mapschool({ zschool: 'query' }),
|
|
|
|
+ async otherList() {
|
|
|
|
+ const res = await this.nation();
|
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `nationList`, res.data);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ async schoolname() {
|
|
|
|
+ const res = await this.zschool();
|
|
|
|
+ console.log(res);
|
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `schcoolList`, res.data);
|
|
|
|
+ },
|
|
|
|
+
|
|
async search() {
|
|
async search() {
|
|
const res = await this.fetch(this.id);
|
|
const res = await this.fetch(this.id);
|
|
if (this.$checkRes(res)) this.$set(this, `info`, res.data);
|
|
if (this.$checkRes(res)) this.$set(this, `info`, res.data);
|
|
@@ -128,10 +156,10 @@ export default {
|
|
let msg;
|
|
let msg;
|
|
if (isNew) {
|
|
if (isNew) {
|
|
data.openid = new Date().getTime();
|
|
data.openid = new Date().getTime();
|
|
- data.nation = `汉族`;
|
|
|
|
- data.yard = `测试学院`;
|
|
|
|
- data.major = `测试专业`;
|
|
|
|
- data.school_name = `测试学校`;
|
|
|
|
|
|
+ // data.nation = `汉族`;
|
|
|
|
+ // data.yard = `测试学院`;
|
|
|
|
+ // data.major = `测试专业`;
|
|
|
|
+ // data.school_name = `测试学校`;
|
|
res = await this.create(data);
|
|
res = await this.create(data);
|
|
msg = `${this.keyWord}添加成功`;
|
|
msg = `${this.keyWord}添加成功`;
|
|
} else {
|
|
} else {
|