Commit 63137df2 authored by wangxl's avatar wangxl

777

parent e2514da3
......@@ -223,7 +223,7 @@ export const routes = [
{ path: '/expert/expertBRegister', name: '专家导入', component: () => import('@/views/expert/components/expertImport.vue'), meta: { title: '专家导入', icon: '', noCache: true } },
{ path: '/expert/group', name: '专家组管理', component: () => import('@/views/expertGroup/expertBatch.vue'), meta: { title: '专家组管理', icon: '', noCache: true } },
{ path: '/expert/group/members', name: '专家组成员管理', component: () => import('@/views/expertGroup/expertGroupMembers.vue'), meta: { title: '专家组成员管理', icon: '', noCache: true } },
{ path: '/expert/report', name: '专家推荐', component: () => import('@/views/expert/index.vue'), meta: { title: '专家推荐', icon: '', noCache: true } },
{ path: '/expert/report', name: '专家推荐', component: () => import('@/views/report/expert/index.vue'), meta: { title: '专家推荐', icon: '', noCache: true } },
]
},
{
......
<template>
<div style="height:420px;overflow:auto;">
<a-spin :spinning="loading" style="width: 100%;height: 100%;">
<a-form-model ref="form" :model="formData" :rules="rules" class="from-table">
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">证件号</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="certId" prop="certId" v-if="!!!formData.id">
<a-input v-model="formData.certId" @blur="() => {$refs.certId.onFieldBlur(); }" style="width: 250px" />
</a-form-model-item>
<a-input disabled="disabled" style="margin-left:6px;width: 250px" v-model="formData.certId" v-if="!!formData.id" />
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">姓名</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="personName" prop="personName">
<a-input v-model="formData.personName" @blur="() => {$refs.personName.onFieldBlur(); }" style="width: 250px" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">性别</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="sex" prop="sex">
<a-select v-model="formData.sex" style="width: 130px" :disabled="!!formData.id">
<a-select-option value="">--请选择性别--</a-select-option>
<a-select-option value="男"></a-select-option>
<a-select-option value="女"></a-select-option>
</a-select>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">手机号</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="mobile" prop="mobile" v-if="!!!formData.id">
<a-input v-model="formData.mobile" @blur="() => {$refs.mobile.onFieldBlur();}" style="width: 250px" />
</a-form-model-item>
<a-input disabled="disabled" style="margin-left:6px;width:250px" v-model="formData.mobile" v-if="!!formData.id" />
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">职称</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="title" prop="title" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
<para-multi-select v-model="formData.title" :typeId="7" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">评审专业</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="auditSpecList" prop="auditSpecList" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
<spec-select v-model="formData.auditSpecList" />
</a-form-model-item>
</a-col>
</a-row>
<a-row v-if="isShow">
<a-col :span="4" class="bg-gray">
<div class="required">工作单位</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="treeCode" prop="treeCode">
<unit-tree-select v-model="formData.treeCode" :disable="false" :unitType="2" :width="300" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray" style="padding-left:16px">
<div> 邮箱</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="email" prop="email">
<a-input v-model="formData.email" @blur="() => {$refs.email.onFieldBlur();}" style="width: 250px" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray" style="padding-left:16px">
<div>备注</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="email" prop="remark">
<a-input v-model="formData.remark" @blur="() => {$refs.remark.onFieldBlur();}" style="width: 250px" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24" style="text-align:center;">
<a-button type="primary" style="margin-right: 50px" @click="submit">提交</a-button>
</a-col>
</a-row>
</a-form-model>
</a-spin>
</div>
</template>
<script>
import { isEmptyParams, checkEmail, checkPhone, checkIdentitytionId, personBirthday, personGender } from "@/views/utils/common"
import { isIdentityId } from '@/views/utils/validate'
import moment from 'moment'
import specSelect from '@/views/expert/components/specSelect'
import paraMultiSelect from '@/views/components/common/paraMultiSelect'
import paraSelect from '@/views/components/common/paraSelect'
import baseSelect from '@/views/components/common/baseSelect'
import unitSelect from '@/views/components/common/unitSelect'
import unitTreeSelect from '@/views/components/common/unitTreeSelect'
export default {
name: 'expertEdit',
components: {
paraMultiSelect, paraSelect, baseSelect, unitSelect, specSelect, unitTreeSelect
},
data () {
return {
loading: true,
isShow: false,
formData: { id: null, personName: null, sex: '', birthday: null, certId: null, mobile: null, remark: null, email: null, title: null, auditSpecList: [], treeCode: null },
rules: {
certId: [
{ required: true, message: '请输入证件号', trigger: 'blur' },
{
validator: (rule, value, callback) => {
if (value == '' || value == undefined) {
callback()
}
var errorMsg = isIdentityId(value);
if (errorMsg != "") {
callback(new Error(errorMsg));
} else {
let pars = { certId: this.formData.certId, id: this.formData.id }
this.$api.expert.expertIsExist(pars).then(({ data = {} }) => {
if (data) {
callback(new Error("专家已存在"));
} else {
this.formData.sex = personGender(this.formData.certId)
this.formData.birthday = personBirthday(this.formData.certId) + ' 00:00:00'
callback()
}
})
}
}
}
],
mobile: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{ required: true, validator: checkPhone, trigger: 'blur' }
],
email: [
{ required: false, message: '请输入邮箱', trigger: 'blur' },
{ required: false, validator: checkEmail, trigger: 'blur' }
],
personName: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
sex: [{ required: true, message: '请选择性别', trigger: 'change' }],
auditSpecList: [{ required: true, message: '请选择评审专业', trigger: 'change' }],
title: [{ required: true, message: '请选择职称', trigger: 'change' }],
treeCode: [{ required: false, message: '请选择单位', trigger: 'change' }],
remark: [{ required: false, message: '请输入备注', trigger: 'blur' }],
},
}
},
props: {
value: {
type: String,
default: () => {
return null
}
},
},
created () {
let user = JSON.parse(window.sessionStorage.getItem('user'))
if (user && user.roles) {
if (user.roles.indexOf("0") != -1) {
this.isShow = true
}
}
if (this.value)
this.getExpertById()
else
this.loading = false
},
methods: {
moment,
getExpertById () {
this.$api.expert.getExpertById({ id: this.value }).then(({ data = {} }) => {
if (data) {
this.formData = data
}
this.loading = false
}).catch(() => { this.loading = false })
},
submit () {
this.$refs.form.validate(valid => {
if (valid) {
this.loading = true
let pars = isEmptyParams(this.formData)
let par = { ...pars }
if (!!!this.formData.id) {
this.$api.expert.insert(par).then(({ data = {} }) => {
if (data) {
this.$message.success('成功!')
this.$emit('close', 'edit')
}
this.loading = false
}).catch(() => { this.loading = false })
} else {
this.$api.expert.update(par).then(({ data = {} }) => {
if (data) {
this.$message.success('成功!')
this.$emit('close', 'edit')
}
this.loading = false
}).catch(() => { this.loading = false })
}
} else {
return false
}
})
},
}
}
</script>
\ No newline at end of file
<template>
<div class="app-content" style="height:75vh;overflow: auto;">
<div class="submit-btn upload-header">
<a :href="url.downloadUrl" download="ExpertInfo.xlsx">
<a-icon type="download"></a-icon>&nbsp;<span style="color:green;text-decoration:underline;">模板下载</span>
</a>
<FileUpload @beforeUpload="beforeUpload" />
<a-divider style="height: 1px; background-color: #e8e8e8;" />
</div>
<a-divider style="height: 1px; background-color: #e8e8e8;" />
<div class="upload-table">
<a-table :dataSource="tableData" :columns="columns" rowKey="index" :pagination="false" :loading="loading">
<template slot="stateSwitch" slot-scope="record">
<a-switch checked-children="正常" un-checked-children="注销" :checked="checkedState(record)" @change="switchChange($event, record)" />
</template>
<template slot="option" slot-scope="record">
<a-button type="primary" size="small" @click="recordClick(record, 'view')">查看</a-button>
<a-button type="primary" size="small" @click="recordClick(record, 'edit')">修改</a-button>
<a-button type="primary" size="small" @click="recordClick(record, 'reset')">重置密码</a-button>
</template>
</a-table>
</div>
<div class="upload-bottom" style="text-align:center;padding:6px 0">
<a-button type="primary" @click="dataImport" :disabled="disabled">导入</a-button>
</div>
</div>
</template>
<script>
import { isEmptyParams, readExcelFile, personGender, personBirthday, checkIdentitytionId, checkEmail, checkPhone } from "@/views/utils/common"
import moment from "moment"
export default {
name: "expertImport",
data () {
return {
columns: [
{ title: "姓名", dataIndex: "personName", align: 'center' },
{ title: "证件号", dataIndex: "certId", align: 'center' },
// { title: "性别", dataIndex: "sex" },
// { title: "出生日期", dataIndex: 'birthday' },
{ title: "手机号", dataIndex: "mobile", align: 'center' },
{ title: "邮箱", dataIndex: "email", align: 'center' },
{ title: "职称", dataIndex: "titleName", align: 'center' },
{ title: "专业", dataIndex: "specName", align: 'center' },
{ title: '单位', dataIndex: 'unitName', align: 'center' },
],
tableData: [],
disabled: true,
loading: false,
url: {
downloadUrl: '/downloadFile/ExpertInfo.xlsx',
}
};
},
created () {
},
methods: {
beforeUpload (file) {
this.tableData = []
let list = readExcelFile(file, 0)
let certList = []
let mobileList = []
let exportList = []
list.then((d) => {
//读取文件数据
d.forEach(e => {
let gender = personGender(e.证件号)
let birthday = personBirthday(e.证件号) + ' 00:00:00'
let expert = { personName: e.姓名, certId: e.证件号, sex: gender, birthday: moment(birthday).format('YYYY-MM-DD HH:mm:ss'), mobile: e.手机号, email: e.邮箱, specName: e.专业, titleName: e.职称, unitName: e.单位 }
exportList.push(expert)
certList.push(e.证件号)
mobileList.push(e.手机号)
})
let uniqueMobileList = [...new Set(mobileList)]
if (uniqueMobileList.length != exportList.length) {
this.$message.error('手机号出现重复!')
return false
}
let uniqueCertList = [...new Set(certList)]
if (uniqueCertList.length != exportList.length) {
this.$message.error('证件号出现重复!')
return false
}
if (exportList.length > 0) {
this.tableData = exportList
this.disabled = false
}
})
return false
},
dataImport () {
if (this.tableData.length == 0) {
this.$message.error('请选择Excel!')
return
}
let pars = isEmptyParams(this.tableData)
let par = { ...pars }
this.$api.expert.expertImport(this.tableData).then(({ data = {} }) => {
if (data) {
this.$message.info(data)
this.tableData = []
}
})
}
},
};
</script>
<style scoped lang="less">
.upload-header {
height: 30px;
}
.upload-table {
min-height: 150px;
max-height: calc(100% - 75px);
overflow-y: auto;
}
.upload-bottom {
height: 42px;
}
</style>
<template>
<div class="from-table" style="height:280px;overflow:auto;">
<a-spin :spinning="loading" style="width: 100%;height: 100%;">
<a-row>
<a-col :span="4" class="bg-gray">
姓名:
</a-col>
<a-col :span="8">
{{expertInfo.personName}}
</a-col>
<a-col :span="4" class="bg-gray">
证件号:
</a-col>
<a-col :span="8">
{{expertInfo.certId}}
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
性别:
</a-col>
<a-col :span="8">
{{expertInfo.sex}}
</a-col>
<a-col :span="4" class="bg-gray">
职称:
</a-col>
<a-col :span="8">
{{expertInfo.titleName}}
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
联系电话:
</a-col>
<a-col :span="8">
{{expertInfo.mobile}}
</a-col>
<a-col :span="4" class="bg-gray">
邮箱:
</a-col>
<a-col :span="8">
{{expertInfo.email}}
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
专业:
</a-col>
<a-col :span="20">
<a-tag v-for="data in expertInfo.specList" :key="data.id" :color="'green'">{{data.specName}}</a-tag>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
工作单位:
</a-col>
<a-col :span="20">
{{expertInfo.workUnit}}
</a-col>
</a-row>
</a-spin>
</div>
</template>
<script>
import moment from 'moment'
export default {
name: "expertView",
data () {
return {
expertInfo: { id: '', certId: '', sex: '', birthday: null, mobile: '', email: '', title: '', unitId: null, degree: null, spec: null, address: '' },
loading: true
}
},
props: {
value: {
type: String,
default: () => {
return null
}
},
obj: {
type: Object
}
},
created () {
this.getExpertById()
},
methods: {
moment,
getExpertById () {
let pars = { id: this.value }
this.$api.expert.getExpertById(pars).then(({ data = {} }) => {
if (data) {
this.expertInfo = data
}
this.loading = false
}).catch(() => {
this.loading = false
})
}
}
}
</script>
\ No newline at end of file
<template>
<div style="width:auto;display:inline-block !important; display:inline;">
<a-select mode="tags" v-model="selected" style="width: 400px" @change="onChange" showArrow allowClear>
<a-select-opt-group v-for="item in selectArray" :key="item.key">
<span slot="label">
<a-icon type="bars" />{{ item.title }}
</span>
<a-select-option v-for="arr in item.children" :key="arr.key" :value="arr.key">
{{ arr.title }}
</a-select-option>
</a-select-opt-group>
</a-select>
</div>
</template>
<script>
// 用法 <spec-select v-model="formData.projClass" />
export default {
name: "SpecSelect",
data () {
return {
selectArray: [],
selected: [],
loadState: false,
};
},
props: {
value: null,
width: {
type: Number,
default () {
return 180
}
}
},
created () {
this.load(this.value)
},
methods: {
load (value) {
if (this.selectArray.length > 0) {
this.selected = value
} else {
this.$api.parameter.getArrayListByType({ typeId: 56 }).then(({ data = {} }) => {
if (data) {
this.selectArray = data
this.selected = value
}
}).catch(() => { })
}
},
onChange () {
if (this.selected.length > 3) {
this.$message.error('最多只能选三个专业')
this.selected = this.selected.splice(0, 3)
}
this.$emit("input", this.selected);
this.$emit("change");
},
},
watch: {
value: {
handler (value) {
if (!this.loadState) {
this.load(value)
this.loadState = true
}
}
},
},
};
</script>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment