Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop

This commit is contained in:
Yuanjianghong 2021-11-15 00:37:58 +08:00
commit df8c6723d8
6 changed files with 567 additions and 127 deletions

View File

@ -9,6 +9,7 @@ const personApi = {
quit: 'person/quit', quit: 'person/quit',
resetPwd: 'person/resetPwd', resetPwd: 'person/resetPwd',
setAdmin: 'person/setAdmin', setAdmin: 'person/setAdmin',
changeLogPage: '/person/changeLog/pageList'
} }
export function personAddOrUpdate (params) { export function personAddOrUpdate (params) {
@ -67,3 +68,10 @@ export function personSetAdmin (params) {
params: params params: params
}) })
} }
export function personChangeLogPage (params) {
return request({
url: personApi.changeLogPage,
method: 'get',
params: params
})
}

View File

@ -8,7 +8,10 @@
<!-- 课程名称 --> <!-- 课程名称 -->
<a-col :span="18" :offset="3"> <a-col :span="18" :offset="3">
<a-form-model-item label="课程名称" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }"> <a-form-model-item label="课程名称" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
<a-input v-model="form.courseName" v-decorator="['courseName', { rules: [{ required: true, message: '请填写课程名称' }] }]" /> <a-input
v-model="form.courseName"
v-decorator="['courseName', { rules: [{ required: true, message: '请填写课程名称' }] }]"
/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
@ -16,8 +19,7 @@
<a-col :span="9" :offset="3"> <a-col :span="9" :offset="3">
<a-form-model-item label="课程类别" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }"> <a-form-model-item label="课程类别" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
<a-select v-model="form.courseType" placeholder="--请选择--"> <a-select v-model="form.courseType" placeholder="--请选择--">
<a-select-option value="1"> 商业 </a-select-option> <a-select-option v-for="(item,index) in dictCourseType" :key="index" :value="item.value"> {{item.name}} </a-select-option>
<a-select-option value="2"> 政务 </a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
@ -25,7 +27,14 @@
<!-- 课件大小 --> <!-- 课件大小 -->
<a-col :span="9"> <a-col :span="9">
<a-form-item label="课时" :label-col="{ span: 4 }" :wrapper-col="{ span: 10 }"> <a-form-item label="课时" :label-col="{ span: 4 }" :wrapper-col="{ span: 10 }">
<a-input-number id="hour" v-model="dataValue" :min="1" :max="1000" @change="onChange" :style="{ display: 'ln', width: '100%' }" /> <a-input-number
id="hour"
v-model="dataValue"
:min="1"
:max="1000"
@change="onChange"
:style="{ display: 'ln', width: '100%' }"
/>
{{ dataValue }}分钟 {{ dataValue }}分钟
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -41,8 +50,7 @@
<a-col :span="9" :offset="3"> <a-col :span="9" :offset="3">
<a-form-model-item label="所属行业" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }"> <a-form-model-item label="所属行业" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
<a-select v-model="form.industryInvolved" placeholder="--请选择--"> <a-select v-model="form.industryInvolved" placeholder="--请选择--">
<a-select-option value="1"> 医疗 </a-select-option> <a-select-option v-for="(item,index) in industry" :key="index" :value="item.value"> {{item.name}} </a-select-option>
<a-select-option value="0"> 建筑 </a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
@ -61,7 +69,7 @@
<a-col :span="9" :offset="3"> <a-col :span="9" :offset="3">
<a-form-model-item label="选择岗位" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }"> <a-form-model-item label="选择岗位" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
<a-select v-model="form.job" placeholder="--请选择--"> <a-select v-model="form.job" placeholder="--请选择--">
<a-select-option v-for="item in personType" :key="item.id"> {{ item.name }} </a-select-option> <a-select-option v-for="(item,index) in dictPerson" :key="index" :value="item.value"> {{ item.name }} </a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
@ -76,7 +84,14 @@
<!-- 上传封面图片 --> <!-- 上传封面图片 -->
<a-col :span="18" :offset="3"> <a-col :span="18" :offset="3">
<a-form-model-item label="上传封面图片" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }"> <a-form-model-item label="上传封面图片" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
<a-upload action="/dawa/sys/oss/upload?sourceId=course" list-type="picture-card" :file-list="fileList" :headers="getToken()" @change="handleChange" @preview="handlePreview"> <a-upload
action="/dawa/sys/oss/upload?sourceId=course"
list-type="picture-card"
:file-list="fileList"
:headers="getToken()"
@change="handleChange"
@preview="handlePreview"
>
<div v-if="fileList.length < 1"> <div v-if="fileList.length < 1">
<a-icon type="plus" /> <a-icon type="plus" />
<div class="ant-upload-text">上传</div> <div class="ant-upload-text">上传</div>
@ -109,6 +124,7 @@
import { courseAdd, getCourseDetails } from '@/api/course/course' import { courseAdd, getCourseDetails } from '@/api/course/course'
import storage from 'store' import storage from 'store'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
export default { export default {
name: 'step1', name: 'step1',
@ -118,36 +134,35 @@ export default {
form: { form: {
coverPath: '', coverPath: '',
}, },
personType: [
{ id: '1', name: '人员类别1' },
{ id: '2', name: '人员类别2' },
{ id: '3', name: '人员类别3' },
],
url: '', url: '',
previewVisible: false, previewVisible: false,
fileList: [], fileList: [],
previewImage :[ previewImage: [],
dictPerson:[],
] dictCourseType:[],
industry:[]
} }
}, },
components: { components: {
courseAdd, courseAdd,
getCourseDetails getCourseDetails,
}, },
created() { created() {
if (this.$route.query.id) { if (this.$route.query.id) {
getCourseDetails({ id: this.$route.query.id }).then(res => { getCourseDetails({ id: this.$route.query.id }).then((res) => {
this.form = res.data; this.form = res.data
this.form.courseType = this.form.courseType + ''; // this.form.courseType = this.form.courseType + ''
this.form.industryInvolved = this.form.industryInvolved + ''; // this.form.industryInvolved = this.form.industryInvolved + ''
this.form.isRequired = this.form.isRequired + ''; this.form.isRequired = this.form.isRequired + ''
// this.form.is
}); this.dictEcho();
})
} }
this.dictionaryDropDown()
}, },
methods: { methods: {
// getPersonType() { // getPersonType() {
// return dictGet(Object.assign(parameter)).then((res) => { // return dictGet(Object.assign(parameter)).then((res) => {
@ -170,60 +185,75 @@ export default {
}) })
}, },
dictionaryDropDown () {
this.formLoading = true
//
dictionaryDropDown({ dictionaryCode: '0007' }).then((res) => {
this.industry = res.data
this.formLoading = false
})
//
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
this.dictCourseType = res.data
this.formLoading = false
})
//
dictionaryDropDown({ dictionaryCode: '0005' }).then((res) => {
this.dictPerson = res.data
this.formLoading = false
})
},
//
dictEcho(){
console.log("form___",this.form)
},
// //
goback() { goback() {
this.$router.push({path:"/course/CourseList",query:{ this.$router.push({
courseName:this.$route.query.courseName path: '/course/CourseList',
} }) query: {
courseName: this.$route.query.courseName,
},
})
}, },
getToken() { getToken() {
let hreader = {}; let hreader = {}
hreader[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN); hreader[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN)
return hreader; return hreader
}, },
onSuccess(file) { onSuccess(file) {
console.log('1---', file); console.log('1---', file)
}, },
handleCancel() { handleCancel() {
this.previewVisible = false; this.previewVisible = false
}, },
async handlePreview(file) { async handlePreview(file) {
if (!file.url && !file.preview) { if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj); file.preview = await getBase64(file.originFileObj)
} }
this.previewImage = file.url || file.preview; this.previewImage = file.url || file.preview
this.previewVisible = true; this.previewVisible = true
}, },
handleChange({ fileList }) { handleChange({ fileList }) {
this.fileList = fileList; this.fileList = fileList
console.log("fileList-------",fileList); this.fileList.file = fileList[0]
this.fileList.file=fileList[0]; this.form.coverPath = this.fileList.file.response.url
console.log('file``````',this.fileList.file)
console.log('response``````',this.fileList.file.response.url)
this.form.coverPath = this.fileList.file.response.url;
console.log("url",this.form.coverPath)
}, },
}, },
} }
// Base64 // Base64
function getBase64(file) { function getBase64(file) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const reader = new FileReader(); const reader = new FileReader()
reader.readAsDataURL(file); reader.readAsDataURL(file)
reader.onload = () => resolve(reader.result); reader.onload = () => resolve(reader.result)
reader.onerror = error => reject(error); reader.onerror = (error) => reject(error)
}); })
} }
</script> </script>

View File

@ -3,11 +3,19 @@
<a-descriptions layout="horizontal" bordered size="small" :column="1"> <a-descriptions layout="horizontal" bordered size="small" :column="1">
<a-descriptions-item label="课程编号"> {{ detailData.courseCode }} </a-descriptions-item> <a-descriptions-item label="课程编号"> {{ detailData.courseCode }} </a-descriptions-item>
<a-descriptions-item label="课程名称"> {{ detailData.courseName }} </a-descriptions-item> <a-descriptions-item label="课程名称"> {{ detailData.courseName }} </a-descriptions-item>
<a-descriptions-item label="课程类别"> {{ detailData.courseType }} </a-descriptions-item> <a-descriptions-item label="课程类别" v-for="(item,index) in dictCourseType" :key="index" :value="item.value"> {{ item.name }} </a-descriptions-item>
<a-descriptions-item label="课时"> {{ detailData.hour }} </a-descriptions-item> <a-descriptions-item label="课时"> {{ detailData.hour }} </a-descriptions-item>
<a-descriptions-item label="试题数量"> {{ detailData.questionCount }} </a-descriptions-item>
<a-descriptions-item label="学习内容"> {{ detailData.learningContent }} </a-descriptions-item> <a-descriptions-item label="学习内容"> {{ detailData.learningContent }} </a-descriptions-item>
<a-descriptions-item label="试题数量"> {{ detailData.questionCount }} </a-descriptions-item>
<a-descriptions-item label="备注"> {{ detailData.remark }} </a-descriptions-item> <a-descriptions-item label="备注"> {{ detailData.remark }} </a-descriptions-item>
<a-descriptions-item label="课程封面图">
<viewer :images="detailData.coverPath">
<img :src="detailData.coverPath" />
</viewer>
<!-- <div>
<img :src="detailData.coverPath" v-image-preview width="100" height="100">
</div> -->
</a-descriptions-item>
</a-descriptions> </a-descriptions>
<div class="buttonGroup"> <div class="buttonGroup">
<a-button type="primary" @click="close"> 返回 </a-button> <a-button type="primary" @click="close"> 返回 </a-button>
@ -17,29 +25,45 @@
</template> </template>
<script> <script>
import { getCourseDetails } from '@/api/course/course' import { getCourseDetails } from '@/api/course/course'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
export default { export default {
name: 'details', name: 'details',
components: {}, components: {},
data() { data() {
return { return {
queryParam: { id: this.$route.query.id }, queryParam: { id: this.$route.query.id },
detailData: {} detailData: {
coverPath: [],
},
dictCourseType:[]
} }
}, },
created: function () { created: function () {
let parameter = {}; let parameter = {}
getCourseDetails(Object.assign(parameter, this.queryParam)).then(res => { this.detailData = res.data }); getCourseDetails(Object.assign(parameter, this.queryParam)).then((res) => {
this.detailData = res.data
})
//
this.dictionaryDropDown();
}, },
methods: { methods: {
close() { close() {
this.$router.push({ path: '/course/CourseList', query: { } }); this.$router.push({ path: '/course/CourseList', query: {} })
}, },
edit(record) { edit(record) {
this.$router.push({ path : '/course/CourseAdd', query:{ id: this.queryParam.id }}); this.$router.push({ path: '/course/CourseAdd', query: { id: this.queryParam.id } })
}
}, },
//
dictionaryDropDown() {
//
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
this.dictCourseType = res.data
this.formLoading = false
})
},
},
} }
</script> </script>

View File

@ -1,5 +1,4 @@
<template> <template>
<!-- <page-header-wrapper> -->
<a-card :bordered="false" title="题库管理"> <a-card :bordered="false" title="题库管理">
<template slot="extra"> <template slot="extra">
<a-button size="small" @click="questionColse">返回</a-button> <a-button size="small" @click="questionColse">返回</a-button>
@ -20,6 +19,7 @@
<div class="questionDetail"> <div class="questionDetail">
<br /> <br />
<div>
<a-button <a-button
type="primary" type="primary"
class="create-button" class="create-button"
@ -39,10 +39,15 @@
type="primary" type="primary"
class="create-button" class="create-button"
style="font-size: 15px; margin: 0px 10px 10px 0px" style="font-size: 15px; margin: 0px 10px 10px 0px"
@click="questionBatchDownload" @click="showModal"
> >
模板下载 模板下载
</a-button> </a-button>
<a-modal v-model="visible" title="模板下载" cancelText="关闭" :ok-button-props="{ style: { display: 'none' } }">
<a-button type="primary" class="create-button" style="font-size: 15px; margin:-15px 50px 3px 50px" @click="questionBatchDownloadDemo">示例模板</a-button>
<a-button type="primary" class="create-button" style="font-size: 15px; margin:-15px 30px 3px 70px" @click="questionBatchDownload">纯净模板</a-button>
</a-modal>
</div>
<b><h1 class="questionContent">课程题目库预览</h1></b> <b><h1 class="questionContent">课程题目库预览</h1></b>
<a-divider :style="{ backgroundColor: '#000' }" /> <a-divider :style="{ backgroundColor: '#000' }" />
<div class="question"> <div class="question">
@ -86,7 +91,6 @@
<input ref="inputFile" type="file" style="display: none" @change="questionBatchImport" /> <input ref="inputFile" type="file" style="display: none" @change="questionBatchImport" />
</a-card> </a-card>
<!-- </page-header-wrapper> -->
</template> </template>
<script> <script>
@ -104,6 +108,7 @@ export default {
quesitonList: [], quesitonList: [],
questionDetail: {}, questionDetail: {},
isactive: 1, isactive: 1,
visible: false,
} }
}, },
@ -123,8 +128,9 @@ export default {
//ID //ID
quesionId: function (i, index) { quesionId: function (i, index) {
if (this.quesitonList != null && this.quesitonList.length != 0) {//ID if (this.quesitonList != null && this.quesitonList.length != 0) {
console.log("题目!!!!",this.quesitonList.length) //ID
console.log('题目!!!!', this.quesitonList.length)
this.isactive = index this.isactive = index
this.questionId = i this.questionId = i
@ -146,7 +152,7 @@ export default {
path: '/course/CourseList', path: '/course/CourseList',
query: { query: {
courseName: this.$route.query.courseName, courseName: this.$route.query.courseName,
pageNum:this.$route.query.pageNum pageNum: this.$route.query.pageNum,
}, },
}) })
}, },
@ -217,9 +223,21 @@ export default {
}) })
}, },
showModal() {
this.visible = true
},
handleOk(e) {
console.log(e)
this.visible = false
},
// //
questionBatchDownload() { questionBatchDownload() {
window.location.href = '/dawa/sys/oss/show/20211108/2420f1de94174bb8a0fb1a2f1e9e1742.xlsx' window.location.href = '/dawa/sys/oss/show/20211115/d722289c97f34ab8850eabdc45782e84.xlsx'
},
//
questionBatchDownloadDemo() {
window.location.href = '/dawa/sys/oss/show/20211114/d82abc89cfba4e18b3f4bc0f9dfa6b96.xlsx'
}, },
}, },
} }

View File

@ -1,8 +1,368 @@
<template> <template>
<a-modal
:title="modalTitle"
:width="900"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleCancel"
@cancel="handleCancel"
>
<a-spin :spinning="confirmLoading">
<a-divider orientation="left">基本信息</a-divider>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item style="display: none;">
<a-input v-decorator="['id']" />
</a-form-item>
<a-form-item style="display: none;">
<a-input v-decorator="['userId']" />
</a-form-item>
<a-form-item
label="用户名"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入用户名" readOnly v-decorator="['userName', {rules: [{required: true, min: 5, message: '请输入至少五个字符的账号'}]}]" />
</a-form-item>
</a-form>
</a-col>
<a-col :md="12" :sm="24" >
<a-form :form="form">
<a-form-item
label="姓名"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入姓名" readOnly v-decorator="['name', {rules: [{required: true, message: '请输入姓名'}]}]" />
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="身份证"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入身份证" readOnly v-decorator="['idCardNo', {rules: [{required: true, message: '请输入身份证'}]}]" @blur="idCardNoBlur"/>
</a-form-item>
</a-form>
</a-col>
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="年龄"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input readOnly v-decorator="['age']" />
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="性别"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
>
<a-radio-group disabled v-decorator="['sex',{rules: [{ required: true, message: '请选择性别' }]}]" >
<a-radio :value="1"></a-radio>
<a-radio :value="2"></a-radio>
</a-radio-group>
</a-form-item>
</a-form>
</a-col>
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="手机号"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入手机号" readOnly v-decorator="['phone',{rules: [{ required: true, message: '请输入手机号' }]}]" />
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="24" :sm="24">
<a-form :form="form">
<a-form-item
label="岗位"
:labelCol="{span: 3}"
:wrapperCol="{span: 20}"
has-feedback
>
<a-select style="width: 100%" disabled placeholder="请选择岗位" v-decorator="['jobs',{rules: [{ required: true, message: '请选择岗位' }]}]" >
<a-select-option v-for="(item,index) in jobsData" :key="index" :value="item.value" >{{ item.name }}</a-select-option>
</a-select>
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="工种"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-select style="width: 100%" disabled placeholder="请选择工种" v-decorator="['workType',{rules: [{ required: true, message: '请选择工种' }]}]" >
<a-select-option v-for="(item,index) in workTypeData" :key="index" :value="item.value" >{{ item.name }}</a-select-option>
</a-select>
</a-form-item>
</a-form>
</a-col>
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="学历"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-select style="width: 100%" disabled placeholder="请选择学历" v-decorator="['degreeId',{rules: [{ required: true, message: '请选择学历' }]}]" >
<a-select-option v-for="(item,index) in degreeData" :key="index" :value="item.value" >{{ item.name }}</a-select-option>
</a-select>
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="24" :sm="24">
<a-form :form="form">
<a-form-item
label="人员类型"
:labelCol="{span: 3}"
:wrapperCol="{span: 20}"
>
<a-checkbox-group disabled v-decorator="['type',{rules: [{ required: true, message: '请选择人员类型!' }]}]">
<a-checkbox name="type" v-for="(item,index) in typeData" :key="index" :value="item.value" >
{{ item.name }}
</a-checkbox>
</a-checkbox-group>
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="部门信息"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input readOnly v-decorator="['orgName',{rules: [{ required: true, message: '请选择机构' }]}]" />
</a-form-item>
<a-form-item style="display: none;">
<a-input v-decorator="['orgId']" />
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-divider orientation="left">变动信息</a-divider>
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:pagination="{ pageSize: 5 }"
:showSizeChanger="false"
>
<template slot="createTime" slot-scope="text, record">
{{ record.createTime | moment('YYYY-MM-DD') }}
</template>
</s-table>
</a-spin>
</a-modal>
</template> </template>
<script> <script>
</script> import { STable } from '@/components'
import { personGet, personChangeLogPage } from '@/api/person/person'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
export default {
components: {
STable
},
data () {
return {
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
modalTitle: '人员详情',
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
jobsData: [],
workTypeData: [],
degreeData: [],
typeData: [],
//
queryParam: { },
//
columns: [
{
title: '日期',
dataIndex: 'createTime',
scopedSlots: { customRender: 'createTime' }
},
{
title: '人员变动信息',
dataIndex: 'changeType'
},
{
title: '部门信息',
dataIndex: 'orgName'
}
],
// Promise
loadData: parameter => {
return personChangeLogPage(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
}
}
},
mounted () {
this.dictionaryDropDown()
},
methods: {
//
detail (record) {
this.confirmLoading = true
this.visible = true
<style> this.queryParam.userId = record.userId
</style> this.queryParam.orgId = record.orgId
//
personGet({ id: record.id }).then((res) => {
if (res.code === 200) {
const data = res.data
//
const type = data.type.split(',')
const typeIntArr = []//
type.forEach(item => {
typeIntArr.push(+item)
})
this.form.getFieldDecorator('type', { valuePropName: 'checked', initialValue: typeIntArr })
console.log(data)
this.form.setFieldsValue(
{
id: data.id,
userId: data.userId,
name: data.name,
userName: data.userName,
idCardNo: data.idCardNo,
// age: data.age,
// sex: data.sex,
phone: data.phone,
jobs: parseInt(data.jobs),
workType: parseInt(data.workType),
degreeId: data.degreeId,
orgId: data.orgId,
orgName: data.orgName
}
)
//
this.analyzeIdCardNo(data.idCardNo)
} else {
this.$message.error('查询失败:' + res.msg)
}
})
this.confirmLoading = false
},
/**
* 获取字典数据
*/
dictionaryDropDown () {
this.formLoading = true
//
dictionaryDropDown({ dictionaryCode: '0002' }).then((res) => {
this.jobsData = res.data
})
//
dictionaryDropDown({ dictionaryCode: '0003' }).then((res) => {
this.workTypeData = res.data
})
//
dictionaryDropDown({ dictionaryCode: '0004' }).then((res) => {
this.degreeData = res.data
})
//
dictionaryDropDown({ dictionaryCode: '0005' }).then((res) => {
this.typeData = res.data
this.formLoading = false
})
},
idCardNoBlur (event) {
const idCardNo = event.target.value
this.analyzeIdCardNo(idCardNo)
},
analyzeIdCardNo (idCardNo) {
// undefined
if (!idCardNo) {
return
}
//
if (parseInt(idCardNo.substr(16, 1)) % 2 === 1) {
this.form.setFieldsValue({ sex: 1 })
} else {
console.log('sex 2')
this.form.setFieldsValue({ sex: 2 })
}
//
var yearBirth = idCardNo.substring(6, 10)
var monthBirth = idCardNo.substring(10, 12)
var dayBirth = idCardNo.substring(12, 14)
//
var myDate = new Date()
var monthNow = myDate.getMonth() + 1
var dayNow = myDate.getDate()
var age = myDate.getFullYear() - yearBirth
if (monthNow < monthBirth || (monthNow === monthBirth && dayNow < dayBirth)) {
age--
}
console.log(age)
//
this.form.setFieldsValue({ age })
},
handleCancel () {
this.form.resetFields()
this.visible = false
}
}
}
</script>

View File

@ -72,7 +72,7 @@
</template> </template>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a v-if="hasPerm('person:detail')" @click="$refs.personDetail.detial(record)">详情</a> <a v-if="hasPerm('person:detail')" @click="$refs.personDetail.detail(record)">详情</a>
<a-divider type="vertical" v-if="hasPerm('person:detail')" /> <a-divider type="vertical" v-if="hasPerm('person:detail')" />
<a-dropdown v-if="hasPerm('person:edit') || hasPerm('person:resetPwd') || hasPerm('person:del')"> <a-dropdown v-if="hasPerm('person:edit') || hasPerm('person:resetPwd') || hasPerm('person:del')">
<a class="ant-dropdown-link"> <a class="ant-dropdown-link">