[new] 完成 人发系统 - 人才库 - 新增、修改、列表

This commit is contained in:
tian.guangyuan
2020-03-16 17:31:10 +08:00
parent 8705245e40
commit 148e4381d9
8 changed files with 429 additions and 51 deletions

View File

@@ -2,13 +2,37 @@ import request from '@/assets/js/utils/request'
import getUrl from '@/assets/js/utils/get-url'
// 人才库列表查询接口
export function getAgentPersonnelList(data) {
export function getAgentPersonnelList(data = {}) {
return request({
url: getUrl('/agent/personnel/queryList', 1),
method: 'post',
data
})
}
// 人才库 - 新增人才
export function saveAgentPersonnel(data) {
return request({
url: getUrl('/agent/personnel/saveOrUpdate', 1),
method: 'post',
data
})
}
// 人才库 - 查询详情
export function getAgentPersonnelDetail(data) {
return request({
url: getUrl('/agent/personnel/queryDetail', 1),
method: 'post',
data
})
}
// 人才库 - 查询人才库列表 - 导航页
export function getAgentPersonnelListFirst(data = {}) {
return request({
url: getUrl('/agent/personnel/queryListFirst', 1),
method: 'post',
data
})
}
// 活动量统计周报
export function queryWeekly(data) {

View File

@@ -2025,6 +2025,20 @@ export default {
{ id: 2, text: '确认加盟' },
{ id: 3, text: '三次接触以上' },
{ id: 4, text: '二次接触' },
{ id: 5, text: '首次接触 '}
{ id: 5, text: '首次接触 ' }
],
// 活动量管理 - 人才库 - 过往职业
talentPoolPastOccu: [
{ id: '01', text: '一般内勤职员' },
{ id: '02', text: '其他金融行业' },
{ id: '03', text: '家庭主妇' },
{ id: '04', text: '自由职业' },
{ id: '05', text: '离退休人员' },
{ id: '06', text: '个体经营者' },
{ id: '07', text: '销售' },
{ id: '08', text: '公务员' },
{ id: '09', text: '保险外勤' },
{ id: '10', text: '保险内勤' },
{ id: '11', text: '其他' }
]
}

View File

@@ -145,4 +145,26 @@ Validator.extend('avoirdupois', {
validate: value => {
return /^[0-9]+([.]{1}[0-9]{1})?$/.test(value) && value > 0.1
}
})
})
//同业公司
Validator.extend('sameCompany', {
getMessage: () => '同业公司长度不超过120个字符不支持特殊字符',
validate: value => {
return /^[0-9a-zA-Z\.\s\u4e00-\u9fa5]{1,120}$/.test(value)
}
})
//从业年限
Validator.extend('workYears', {
getMessage: () => '从业年限仅支持阿拉伯数字,最多精确到一位小数',
validate: value => {
return /^[0-9]+([.]{1}[0-9]{1})?$/.test(value) && value > 0
}
})
//最大长度120字符
Validator.extend('max120', {
getMessage: () => '输入内容不得超过120哥字符',
validate: value => {
return value.length < 121
}
})

View File

@@ -3,7 +3,7 @@
<van-cell :title="talentPoolInfo.name" title-class="ml10" is-link value-class="text-left">
<van-icon slot="icon" :name="talentPoolInfo.avatarUrl || defaultAcatarUrl" style="line-height: inherit;" size="24" />
<span>{{ talentPoolInfo.sameCompany }}</span>
<van-icon slot="right-icon" name="edit" style="line-height: inherit;" color="#1989fa" size="24" />
<van-icon slot="right-icon" name="edit" style="line-height: inherit;" color="#1989fa" size="24" @click="edit(talentPoolInfo.personnelCode)" />
</van-cell>
</div>
</template>
@@ -32,6 +32,22 @@ export default {
return {
defaultAcatarUrl: 'https://b.yzcdn.cn/vant/icon-demo-1126.png'
}
},
methods: {
edit(personnelCode) {
if (personnelCode) {
localStorage.setItem('personnelCode', personnelCode)
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/manpower/talentPool/Edit'
},
routerInfo: {
path: '/manpower/talentPool/Edit'
}
})
}
}
}
}
</script>

View File

@@ -18,31 +18,42 @@
<!-- 人才库 -->
<div class="bg-white">
<div class="p15" v-if="personnelsList.length == 0">
<p class="fs16 fwb">人才库</p>
<div class="text-center van-hairline--top">
<van-icon name="add-square" size="50" color="#1989fa" />
</div>
</div>
<van-collapse v-model="personnelNames" v-else>
<van-collapse v-model="talentPoolCollapse" v-if="talentPoolList.length > 0">
<van-collapse-item name="1" title-class="fs16 fwb">
<div slot="title" class="flex justify-content-s align-items-c">人才库 <van-icon name="plus" /></div>
<TalentPoolItem :talentPoolInfo="talentPoolInfo"> </TalentPoolItem>
<div slot="title" class="flex justify-content-s align-items-c">
人才库
<van-icon class="mr10" name="plus" @click.stop="addTalentPool" />
</div>
<TalentPoolItem v-for="talentPoolInfo in talentPoolList" :key="talentPoolInfo.personnelCode" :talentPoolInfo="talentPoolInfo"></TalentPoolItem>
<p v-if="showMoreTalentPool" class="p15 text-right blue" @click="toListTalentPool">查看全部>>></p>
</van-collapse-item>
</van-collapse>
<template v-else>
<van-cell class="fs16 fwb">
<div slot="title" class="flex justify-content-s align-items-c">
人才库
</div>
</van-cell>
<van-cell>
<template slot="title">
<div class="text-center"><van-icon name="add-square" size="50" color="#1989fa" @click="addTalentPool" /></div>
</template>
</van-cell>
</template>
</div>
<!-- 当日增员活动日志 -->
<div class="bg-white">
<div class="p15">
<p class="fs16 fwb">当日增员活动日志</p>
<div class="text-center van-hairline--top">
<van-icon name="add-square" size="50" color="#1989fa" @click="toEdit" />
</div>
<div class="text-center van-hairline--top"><van-icon name="add-square" size="50" color="#1989fa" @click="toEdit" /></div>
</div>
<van-collapse v-model="personnelNames">
<van-collapse-item name="1" title-class="fs16 fwb">
<div slot="title" class="flex justify-content-s align-items-c">当日增员活动日志 <van-icon name="plus" /></div>
<div slot="title" class="flex justify-content-s align-items-c">
当日增员活动日志
<van-icon name="plus" />
</div>
<ActivityLogItem :ActivityLogInfo="ActivityLogInfo"></ActivityLogItem>
<ActivityLogItem :ActivityLogInfo="ActivityLogInfo"></ActivityLogItem>
</van-collapse-item>
@@ -53,10 +64,10 @@
</template>
<script>
import formatDate from '@/assets/js/utils/date-utils'
import { Collapse, CollapseItem, Grid, GridItem } from 'vant'
import { Collapse, CollapseItem, Grid, GridItem, Cell } from 'vant'
import TalentPoolItem from '@/components/ebiz/manpower/TalentPoolItem'
import ActivityLogItem from '@/components/ebiz/manpower/ActivityLogItem'
import { queryWeekly, queryListFirst } from '@/api/ebiz/manpower/manpower'
import { getAgentPersonnelListFirst, queryWeekly, queryListFirst } from '@/api/ebiz/manpower/manpower'
export default {
components: {
@@ -64,6 +75,7 @@ export default {
[CollapseItem.name]: CollapseItem,
[Grid.name]: Grid,
[GridItem.name]: GridItem,
[Cell.name]: Cell,
TalentPoolItem,
ActivityLogItem
},
@@ -87,13 +99,18 @@ export default {
whiteboard: '', // 白板
sameTrade: '' // 同业
},
// 人才列表
// 人才列表
showMoreTalentPool: false,
talentPoolCollapse: ['1'],
talentPoolList: [],
// 日志列表
personnelsList: []
}
},
mounted() {
this.queryWeekly()
this.queryListFirst()
this.getAgentPersonnelListFirst()
},
methods: {
// 获取日志统计周报
@@ -141,6 +158,46 @@ export default {
},
routerInfo: { path: '/manpower/ActivityLog/Edit' }
})
},
addTalentPool() {
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/manpower/talentPool/Add'
},
routerInfo: {
path: '/manpower/talentPool/Add'
}
})
},
toListTalentPool() {
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/manpower/talentPool/'
},
routerInfo: {
path: '/manpower/talentPool/'
}
})
},
getAgentPersonnelListFirst() {
getAgentPersonnelListFirst()
.then(res => {
if (res.result == 0) {
let data = res.content.personnels
if (data.length > 5) {
this.showMoreTalentPool = true
data = data.slice(0, 5)
} else {
this.showMoreTalentPool = false
}
this.talentPoolList = data
} else {
this.$toast(res.resultMessage)
}
})
.catch(() => {})
}
}
}

View File

@@ -3,10 +3,36 @@
<div class="container">
<van-field v-model="formData.name" required clearable label="姓名" name="姓名" placeholder="请输入" v-validate="'required|name'" />
<van-field v-model="formData.mobile" clearable label="手机号码" name="手机号码" placeholder="请输入" maxlength="11" type="tel" v-validate="'mobile'" />
<van-field v-model="formData.sameCompany" required clearable label="同业公司" name="同业公司" placeholder="请输入" v-validate="'required'" />
<select-radio :radios="gradeType" label="岗位类型" name="岗位类型" :value.sync="formData.gradeType" :required="true"></select-radio>
<van-field v-model="formData.grade" required clearable label="职级/岗位" name="职级/岗位" placeholder="请输入" v-validate="'required'" />
<van-field v-model="formData.workYears" required clearable label="从业年限" name="从业年限" placeholder="请输入" v-validate="'required'" />
<select-radio :radios="isSame" label="是否同业" name="是否同业" :value.sync="formData.isSame" :required="true"></select-radio>
<!-- 异业公司 要求填写 -->
<template v-if="formData.isSame == '1'">
<van-field
:value="formData.pastOccu | idToText('talentPoolPastOccu')"
readonly
required
label="过往职业"
name="过往职业"
right-icon="arrow"
placeholder="请选择"
@click="toSelect('pastOccu')"
/>
</template>
<!-- 异业公司 要求填写 end-->
<!-- 同业公司 要求填写 -->
<template v-if="formData.isSame == '0'">
<van-field v-model="formData.sameCompany" required clearable label="同业公司" name="同业公司" placeholder="请输入" v-validate="'required|sameCompany'" />
<select-radio
:radios="gradeType"
label="岗位类型"
name="岗位类型"
:value.sync="formData.gradeType"
:required="true"
v-validate="'required'"
></select-radio>
<van-field v-model="formData.grade" required clearable label="职级/岗位" name="职级/岗位" placeholder="请输入" v-validate="'required|max120'" />
<van-field v-model="formData.workYears" required clearable label="从业年限" name="从业年限" placeholder="请输入" v-validate="'required|workYears'" />
</template>
<!-- 同业公司 要求填写 end -->
<van-field
:value="formData.status | idToText('talentPoolStatus')"
readonly
@@ -15,11 +41,10 @@
name="状态"
right-icon="arrow"
placeholder="请选择"
@click="toSelect"
@click="toSelect('status')"
/>
<van-popup v-model="popupShow" position="bottom">
<van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="popupShow = false" />
</van-popup>
<van-button color="#1989fa" type="primary" class="bottom-btn" size="large" @click="save">保存</van-button>
<van-popup v-model="popupShow" position="bottom"><van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="popupShow = false"/></van-popup>
</div>
</template>
@@ -28,6 +53,9 @@ import { Field, CellGroup, Cell, Popup, Picker } from 'vant'
import filter from '@/filters/index'
import DataDictionary from '@/assets/js/utils/data-dictionary'
import SelectRadio from '@/components/ebiz/SelectRadio'
import { saveAgentPersonnel } from '@/api/ebiz/manpower/manpower'
export default {
name: 'TalentPoolAdd',
components: {
@@ -43,10 +71,13 @@ export default {
},
data() {
return {
selected: '',
popupShow: false,
formData: {
name: '',
mobile: '',
isSame: '0',
pastOccu: '01',
sameCompany: '',
gradeType: '0',
grade: '',
@@ -63,25 +94,64 @@ export default {
value: '1'
}
],
columns: DataDictionary.talentPoolStatus
isSame: [
{
label: '是',
value: '0'
},
{
label: '否',
value: '1'
}
],
columns: null
}
},
watch: {},
created() {},
mounted() {},
methods: {
toSelect() {
toSelect(name) {
this.selected = name
this.popupShow = true
switch (name) {
case 'pastOccu':
this.columns = DataDictionary.talentPoolPastOccu
break
case 'status':
this.columns = DataDictionary.talentPoolStatus
break
default:
break
}
},
onConfirm(value) {
this.popupShow = false
this.formData.status = value.id
this.formData[this.selected] = value.id
},
save() {
this.$validator.validateAll().then(result => {
if (result) {
saveAgentPersonnel(this.formData)
.then(res => {
if (res.result == 0) {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('goBack', {
refresh: '1',
index: '-1'
})
} else {
this.$toast(res.resultMessage)
}
})
.catch(() => {})
} else {
this.$toast(this.errors.all()[0])
}
})
}
}
}
</script>
<style scoped="scoped" lang="scss">
.container {
}
</style>
<style scoped="scoped" lang="scss"></style>

View File

@@ -1,19 +1,168 @@
<!-- 人才库-修改人才 -->
<template>
<div>TalentPoolEdit 人才库-修改人才</div>
<div class="container">
<van-field v-model="formData.name" required clearable label="姓名" name="姓名" placeholder="请输入" v-validate="'required|name'" />
<van-field v-model="formData.mobile" clearable label="手机号码" name="手机号码" placeholder="请输入" maxlength="11" type="tel" v-validate="'mobile'" />
<select-radio :radios="isSame" label="是否同业" name="是否同业" :value.sync="formData.isSame" :required="true"></select-radio>
<!-- 异业公司 要求填写 -->
<template v-if="formData.isSame == '1'">
<van-field
:value="formData.pastOccu | idToText('talentPoolPastOccu')"
readonly
required
label="过往职业"
name="过往职业"
right-icon="arrow"
placeholder="请选择"
@click="toSelect('pastOccu')"
/>
</template>
<!-- 异业公司 要求填写 end-->
<!-- 同业公司 要求填写 -->
<template v-if="formData.isSame == '0'">
<van-field v-model="formData.sameCompany" required clearable label="同业公司" name="同业公司" placeholder="请输入" v-validate="'required|sameCompany'" />
<select-radio
:radios="gradeType"
label="岗位类型"
name="岗位类型"
:value.sync="formData.gradeType"
:required="true"
v-validate="'required'"
></select-radio>
<van-field v-model="formData.grade" required clearable label="职级/岗位" name="职级/岗位" placeholder="请输入" v-validate="'required|max120'" />
<van-field v-model="formData.workYears" required clearable label="从业年限" name="从业年限" placeholder="请输入" v-validate="'required|workYears'" />
</template>
<!-- 同业公司 要求填写 end -->
<van-field
:value="formData.status | idToText('talentPoolStatus')"
readonly
required
label="状态"
name="状态"
right-icon="arrow"
placeholder="请选择"
@click="toSelect('status')"
/>
<van-button color="#1989fa" type="primary" class="bottom-btn" size="large" @click="save">保存</van-button>
<van-popup v-model="popupShow" position="bottom"><van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="popupShow = false"/></van-popup>
</div>
</template>
<script>
import { Field, CellGroup, Cell, Popup, Picker } from 'vant'
import filter from '@/filters/index'
import DataDictionary from '@/assets/js/utils/data-dictionary'
import SelectRadio from '@/components/ebiz/SelectRadio'
import { getAgentPersonnelDetail, saveAgentPersonnel } from '@/api/ebiz/manpower/manpower'
export default {
name: 'TalentPoolEdit',
components: {},
name: 'TalentPoolAdd',
components: {
[Field.name]: Field,
[CellGroup.name]: CellGroup,
[Cell.name]: Cell,
[Popup.name]: Popup,
[Picker.name]: Picker,
[SelectRadio.name]: SelectRadio
},
filters: {
idToText: filter.idToText
},
data() {
return {}
return {
selected: '',
popupShow: false,
formData: {
name: '',
mobile: '',
isSame: '0',
pastOccu: '01',
sameCompany: '',
gradeType: '0',
grade: '',
workYears: '',
status: 0
},
gradeType: [
{
label: '内勤',
value: '0'
},
{
label: '外勤',
value: '1'
}
],
isSame: [
{
label: '是',
value: '0'
},
{
label: '否',
value: '1'
}
],
columns: null
}
},
watch: {},
created() {},
created() {
const personnelCode = localStorage.getItem('personnelCode')
getAgentPersonnelDetail({ personnelCode: personnelCode })
.then(res => {
console.log(res)
if (res.result == 0) {
this.formData = res.content.personnel
} else {
this.$toast(res.resultMessage)
}
})
.catch(() => {})
},
mounted() {},
methods: {}
methods: {
toSelect(name) {
this.selected = name
this.popupShow = true
switch (name) {
case 'pastOccu':
this.columns = DataDictionary.talentPoolPastOccu
break
case 'status':
this.columns = DataDictionary.talentPoolStatus
break
default:
break
}
},
onConfirm(value) {
this.popupShow = false
this.formData[this.selected] = value.id
},
save() {
this.$validator.validateAll().then(result => {
if (result) {
saveAgentPersonnel(this.formData)
.then(res => {
if (res.result == 0) {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('goBack', {
refresh: '1',
index: '-1'
})
} else {
this.$toast(res.resultMessage)
}
})
.catch(() => {})
} else {
this.$toast(this.errors.all()[0])
}
})
}
}
}
</script>

View File

@@ -1,8 +1,8 @@
<!-- 人才库-人才列表 -->
<template>
<div class="container">
<van-search placeholder="请输入要查询人的姓名" v-model="searchName" @input="searchList" />
<div v-if="talentPoolList">
<van-search placeholder="请输入要查询人的姓名" v-model="searchName" @change="searchList" />
<div v-if="hasTalentPoolList" class="mb60">
<van-index-bar :index-list="indexList">
<div v-for="(item, key) in talentPoolList" :key="key" class="bg-white mb10 mr20">
<van-index-anchor :index="key" class="border-gb" />
@@ -10,13 +10,20 @@
</div>
</van-index-bar>
</div>
<van-button type="info" class="bottom-btn" @click="add" v-no-more-click="1000">新增</van-button>
<div v-else class="text-center">
<img class="mt40" src="@/assets/images/pic_page-non.png" />
<div class="fs17 mt40">暂无数据</div>
</div>
<van-button type="info" class="bottom-btn" size="large" @click="add" v-no-more-click="1000">新增</van-button>
</div>
</template>
<script>
import { Search, Cell, IndexBar, IndexAnchor, Popup, Button, Tag } from 'vant'
import TalentPoolItem from '@/components/ebiz/manpower/TalentPoolItem'
import { getAgentPersonnelList } from '@/api/ebiz/manpower/manpower'
export default {
name: 'TalentPoolList',
components: {
@@ -31,19 +38,38 @@ export default {
},
data() {
return {
hasTalentPoolList: false,
searchName: '',
indexList: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '#'],
talentPoolList: {
A: [{ name: '王辉', sameCompany: '中国人寿', personnelCode: 123 }, { name: '辉大概', sameCompany: '中国的分工', personnelCode: 85 }],
B: [{ name: '好的', sameCompany: '中的人寿', personnelCode: 852 }]
}
talentPoolList: {}
}
},
watch: {},
created() {},
created() {
this.searchList()
},
mounted() {},
methods: {
searchList() {},
searchList() {
this.hasTalentPoolList = false
getAgentPersonnelList({ name: this.searchName })
.then(res => {
if (res.result == 0) {
if (Object.keys(res.content.personnels).length == 0) {
return false
}
const data = res.content.personnels
this.talentPoolList = {}
for (let item of this.indexList) {
if (data[item]) {
this.talentPoolList[item] = data[item]
}
}
this.hasTalentPoolList = true
}
})
.catch(() => {})
},
add() {
this.$jump({
flag: 'h5',
@@ -54,7 +80,7 @@ export default {
path: '/manpower/talentPool/Add'
}
})
}
},
}
}
</script>