Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop
This commit is contained in:
commit
df8c6723d8
|
@ -9,6 +9,7 @@ const personApi = {
|
|||
quit: 'person/quit',
|
||||
resetPwd: 'person/resetPwd',
|
||||
setAdmin: 'person/setAdmin',
|
||||
changeLogPage: '/person/changeLog/pageList'
|
||||
}
|
||||
|
||||
export function personAddOrUpdate (params) {
|
||||
|
@ -67,3 +68,10 @@ export function personSetAdmin (params) {
|
|||
params: params
|
||||
})
|
||||
}
|
||||
export function personChangeLogPage (params) {
|
||||
return request({
|
||||
url: personApi.changeLogPage,
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
<!-- 课程名称 -->
|
||||
<a-col :span="18" :offset="3">
|
||||
<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-col>
|
||||
|
||||
|
@ -16,8 +19,7 @@
|
|||
<a-col :span="9" :offset="3">
|
||||
<a-form-model-item label="课程类别" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
|
||||
<a-select v-model="form.courseType" placeholder="--请选择--">
|
||||
<a-select-option value="1"> 商业 </a-select-option>
|
||||
<a-select-option value="2"> 政务 </a-select-option>
|
||||
<a-select-option v-for="(item,index) in dictCourseType" :key="index" :value="item.value"> {{item.name}} </a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
|
@ -25,7 +27,14 @@
|
|||
<!-- 课件大小 -->
|
||||
<a-col :span="9">
|
||||
<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 }}分钟
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -41,8 +50,7 @@
|
|||
<a-col :span="9" :offset="3">
|
||||
<a-form-model-item label="所属行业" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
|
||||
<a-select v-model="form.industryInvolved" placeholder="--请选择--">
|
||||
<a-select-option value="1"> 医疗 </a-select-option>
|
||||
<a-select-option value="0"> 建筑 </a-select-option>
|
||||
<a-select-option v-for="(item,index) in industry" :key="index" :value="item.value"> {{item.name}} </a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
|
@ -61,7 +69,7 @@
|
|||
<a-col :span="9" :offset="3">
|
||||
<a-form-model-item label="选择岗位" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
|
||||
<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-form-model-item>
|
||||
</a-col>
|
||||
|
@ -76,7 +84,14 @@
|
|||
<!-- 上传封面图片 -->
|
||||
<a-col :span="18" :offset="3">
|
||||
<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">
|
||||
<a-icon type="plus" />
|
||||
<div class="ant-upload-text">上传</div>
|
||||
|
@ -109,6 +124,7 @@
|
|||
import { courseAdd, getCourseDetails } from '@/api/course/course'
|
||||
import storage from 'store'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
|
||||
|
||||
export default {
|
||||
name: 'step1',
|
||||
|
@ -118,36 +134,35 @@ export default {
|
|||
form: {
|
||||
coverPath: '',
|
||||
},
|
||||
personType: [
|
||||
{ id: '1', name: '人员类别1' },
|
||||
{ id: '2', name: '人员类别2' },
|
||||
{ id: '3', name: '人员类别3' },
|
||||
],
|
||||
url: '',
|
||||
previewVisible: false,
|
||||
fileList: [],
|
||||
previewImage :[
|
||||
|
||||
]
|
||||
|
||||
previewImage: [],
|
||||
dictPerson:[],
|
||||
dictCourseType:[],
|
||||
industry:[]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
courseAdd,
|
||||
getCourseDetails
|
||||
getCourseDetails,
|
||||
},
|
||||
created() {
|
||||
if (this.$route.query.id) {
|
||||
getCourseDetails({ id: this.$route.query.id }).then(res => {
|
||||
this.form = res.data;
|
||||
getCourseDetails({ id: this.$route.query.id }).then((res) => {
|
||||
this.form = res.data
|
||||
|
||||
this.form.courseType = this.form.courseType + '';
|
||||
this.form.industryInvolved = this.form.industryInvolved + '';
|
||||
this.form.isRequired = this.form.isRequired + '';
|
||||
|
||||
});
|
||||
// this.form.courseType = this.form.courseType + ''
|
||||
// this.form.industryInvolved = this.form.industryInvolved + ''
|
||||
this.form.isRequired = this.form.isRequired + ''
|
||||
// this.form.is
|
||||
this.dictEcho();
|
||||
})
|
||||
}
|
||||
|
||||
this.dictionaryDropDown()
|
||||
},
|
||||
|
||||
methods: {
|
||||
// getPersonType() {
|
||||
// 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() {
|
||||
this.$router.push({path:"/course/CourseList",query:{
|
||||
courseName:this.$route.query.courseName
|
||||
} })
|
||||
this.$router.push({
|
||||
path: '/course/CourseList',
|
||||
query: {
|
||||
courseName: this.$route.query.courseName,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
getToken() {
|
||||
let hreader = {};
|
||||
hreader[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN);
|
||||
return hreader;
|
||||
let hreader = {}
|
||||
hreader[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN)
|
||||
return hreader
|
||||
},
|
||||
onSuccess(file) {
|
||||
console.log('1---', file);
|
||||
|
||||
console.log('1---', file)
|
||||
},
|
||||
handleCancel() {
|
||||
this.previewVisible = false;
|
||||
this.previewVisible = false
|
||||
},
|
||||
async handlePreview(file) {
|
||||
if (!file.url && !file.preview) {
|
||||
file.preview = await getBase64(file.originFileObj);
|
||||
file.preview = await getBase64(file.originFileObj)
|
||||
}
|
||||
this.previewImage = file.url || file.preview;
|
||||
this.previewVisible = true;
|
||||
this.previewImage = file.url || file.preview
|
||||
this.previewVisible = true
|
||||
},
|
||||
handleChange({ fileList }) {
|
||||
this.fileList = fileList;
|
||||
console.log("fileList-------",fileList);
|
||||
this.fileList.file=fileList[0];
|
||||
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)
|
||||
|
||||
|
||||
this.fileList = fileList
|
||||
this.fileList.file = fileList[0]
|
||||
this.form.coverPath = this.fileList.file.response.url
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
// 图片预览Base64
|
||||
function getBase64(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = () => resolve(reader.result);
|
||||
reader.onerror = error => reject(error);
|
||||
});
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
reader.onload = () => resolve(reader.result)
|
||||
reader.onerror = (error) => reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -3,11 +3,19 @@
|
|||
<a-descriptions layout="horizontal" bordered size="small" :column="1">
|
||||
<a-descriptions-item label="课程编号"> {{ detailData.courseCode }} </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.questionCount }} </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="课程封面图">
|
||||
<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>
|
||||
<div class="buttonGroup">
|
||||
<a-button type="primary" @click="close"> 返回 </a-button>
|
||||
|
@ -17,29 +25,45 @@
|
|||
</template>
|
||||
<script>
|
||||
import { getCourseDetails } from '@/api/course/course'
|
||||
|
||||
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
|
||||
export default {
|
||||
name: 'details',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
queryParam: { id: this.$route.query.id },
|
||||
detailData: {}
|
||||
detailData: {
|
||||
coverPath: [],
|
||||
},
|
||||
dictCourseType:[]
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
let parameter = {};
|
||||
getCourseDetails(Object.assign(parameter, this.queryParam)).then(res => { this.detailData = res.data });
|
||||
let parameter = {}
|
||||
getCourseDetails(Object.assign(parameter, this.queryParam)).then((res) => {
|
||||
this.detailData = res.data
|
||||
})
|
||||
|
||||
//调用词典
|
||||
this.dictionaryDropDown();
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.$router.push({ path: '/course/CourseList', query: { } });
|
||||
this.$router.push({ path: '/course/CourseList', query: {} })
|
||||
},
|
||||
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>
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<template>
|
||||
<!-- <page-header-wrapper> -->
|
||||
<a-card :bordered="false" title="题库管理">
|
||||
<template slot="extra">
|
||||
<a-button size="small" @click="questionColse">返回</a-button>
|
||||
|
@ -20,6 +19,7 @@
|
|||
|
||||
<div class="questionDetail">
|
||||
<br />
|
||||
<div>
|
||||
<a-button
|
||||
type="primary"
|
||||
class="create-button"
|
||||
|
@ -39,10 +39,15 @@
|
|||
type="primary"
|
||||
class="create-button"
|
||||
style="font-size: 15px; margin: 0px 10px 10px 0px"
|
||||
@click="questionBatchDownload"
|
||||
@click="showModal"
|
||||
>
|
||||
模板下载
|
||||
</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>
|
||||
<a-divider :style="{ backgroundColor: '#000' }" />
|
||||
<div class="question">
|
||||
|
@ -86,7 +91,6 @@
|
|||
|
||||
<input ref="inputFile" type="file" style="display: none" @change="questionBatchImport" />
|
||||
</a-card>
|
||||
<!-- </page-header-wrapper> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -104,6 +108,7 @@ export default {
|
|||
quesitonList: [],
|
||||
questionDetail: {},
|
||||
isactive: 1,
|
||||
visible: false,
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -123,8 +128,9 @@ export default {
|
|||
|
||||
//题目ID查看题目
|
||||
quesionId: function (i, index) {
|
||||
if (this.quesitonList != null && this.quesitonList.length != 0) {//ID不为空则执行下面
|
||||
console.log("题目!!!!",this.quesitonList.length)
|
||||
if (this.quesitonList != null && this.quesitonList.length != 0) {
|
||||
//ID不为空则执行下面
|
||||
console.log('题目!!!!', this.quesitonList.length)
|
||||
this.isactive = index
|
||||
this.questionId = i
|
||||
|
||||
|
@ -146,7 +152,7 @@ export default {
|
|||
path: '/course/CourseList',
|
||||
query: {
|
||||
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() {
|
||||
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'
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,8 +1,368 @@
|
|||
<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>
|
||||
|
||||
<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>
|
||||
</style>
|
||||
this.queryParam.userId = record.userId
|
||||
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>
|
|
@ -72,7 +72,7 @@
|
|||
</template>
|
||||
|
||||
<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-dropdown v-if="hasPerm('person:edit') || hasPerm('person:resetPwd') || hasPerm('person:del')">
|
||||
<a class="ant-dropdown-link">
|
||||
|
|
Loading…
Reference in New Issue