flat: 暂存, 推送服务
This commit is contained in:
@@ -3,35 +3,43 @@
|
||||
size="100%"
|
||||
append-to-body
|
||||
title="推送服务"
|
||||
:visible.sync="visible"
|
||||
@close="changeVisible"
|
||||
:visible.sync="viewDrawer"
|
||||
>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<el-form :inline="true" size="small" :model="formInline" label-width="70px" label-position="right" class="demo-form-inline">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="4">
|
||||
<el-form-item label="用户名">
|
||||
<el-input v-model="formInline.userName" style="width: 150px" placeholder="用户名"></el-input>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户:">
|
||||
<el-input v-model="formInline.userName" class="input-with-select" placeholder="用户名">
|
||||
<el-select v-model="formInline.groupId" slot="prepend" style="width: 160px" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in leftServeOptions"
|
||||
:key="item.id"
|
||||
:label="item.groupName"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button slot="append" @click="leftSearch">搜索</el-button>
|
||||
</el-input>
|
||||
<!-- <el-select v-model="formInline.groupId" style="width: 150px" placeholder="请选择">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="item in leftServeOptions"-->
|
||||
<!-- :key="item.id"-->
|
||||
<!-- :label="item.groupName"-->
|
||||
<!-- :value="item.id">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- <el-form-item>-->
|
||||
<!-- <el-input v-model="formInline.userName" style="width: 150px" placeholder="用户名"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item>-->
|
||||
<!-- <el-button type="primary" style="width: 80px" size="small" @click="leftSearch">搜索</el-button>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="服务类型">
|
||||
<el-select v-model="formInline.groupId" style="width: 150px" placeholder="请选择"@change="groupNameChange">
|
||||
<el-option
|
||||
v-for="item in leftServeOptions"
|
||||
:key="item.id"
|
||||
:label="item.groupName"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item>
|
||||
<el-button type="primary" style="width: 80px" size="small" @click="leftSearch">搜索</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
@@ -46,28 +54,54 @@
|
||||
:table-loading="leftLoading"
|
||||
:page.sync="leftPages"
|
||||
@current-change="leftCurrentPageChange"
|
||||
@size-change="leftSizePageChange"
|
||||
@selection-change="leftSelectionChange"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button type="primary" style="width: 80px" size="small" @click="onSubmit">推送政策</el-button>
|
||||
<el-button type="primary" style="width: 80px" size="small" :disabled="pushState" @click="onSubmit">
|
||||
{{pushState ? '推送中...' : rightTabs ? '推送岗位' : '推送政策' }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot="labelsBase" slot-scope="{row}">
|
||||
<TextTooltip :content="row.labelsBase" length="20"></TextTooltip>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</div>
|
||||
<!-- 操作 -->
|
||||
<div class="content-center">
|
||||
<div><el-button type="primary" size="small">匹配政策</el-button></div>
|
||||
<div style="margin-top: 30px"><el-button type="primary" size="small">匹配岗位</el-button></div>
|
||||
<div><el-button type="primary" size="small" @click="changeTabs(0)">匹配政策</el-button></div>
|
||||
<div style="margin-top: 30px"><el-button type="primary" @click="changeTabs(1)" size="small">匹配岗位</el-button></div>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<div class="content-right">
|
||||
<avue-crud
|
||||
:data="tableData"
|
||||
:option="leftUserOptions"
|
||||
:page.sync="leftPages"
|
||||
@current-change="leftCurrentPageChange"
|
||||
@selection-change="leftSelectionChange"
|
||||
>
|
||||
</avue-crud>
|
||||
<div>
|
||||
<avue-crud
|
||||
ref="crud2"
|
||||
:data="rightDataList"
|
||||
:option="rightTabs ? rightPostOptions : rightPolicyOptions"
|
||||
:page.sync="rightPages"
|
||||
:table-loading="rightLoading"
|
||||
@selection-change="rightSelectionChange"
|
||||
>
|
||||
<template slot="menuLeft" >
|
||||
<el-input
|
||||
style="width: 300px"
|
||||
placeholder="搜索岗位"
|
||||
v-show="rightTabs === 1"
|
||||
prefix-icon="el-icon-search"
|
||||
@input="searchInputChange"
|
||||
v-model="searchInput"
|
||||
clearable>
|
||||
</el-input>
|
||||
</template>
|
||||
<template slot="labelName" slot-scope="{row}">
|
||||
<TextTooltip :content="row.labelName" length="40"></TextTooltip>
|
||||
</template>
|
||||
<template slot="jobDescription" slot-scope="{row}">
|
||||
<TextTooltip :content="row.jobDescription" length="40"></TextTooltip>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,9 +109,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getListAllByLabels, getListGroupByLabels, getServeAllPolicyList } from "@/api/tenant/serve.js";
|
||||
const pages = { layout: 'prev, pager, next, jumper', total: 0, size: 10, current: 1 }
|
||||
let leftUserOptions = {
|
||||
import { getListAllByLabels, getListGroupByLabels, getServeAllPolicyList, getListByids, getSearchAll, pushPolicyUserServe, pushPostUserServe } from "@/api/tenant/serve.js";
|
||||
import TextTooltip from "@/components/text-tooltip/index.vue";
|
||||
import {debounce} from '@/util/util'
|
||||
import {DateTime} from "@/util/dateTime";
|
||||
const pages = { pagerCount: 3, total: 0, size: 10, current: 1 }
|
||||
const baseOptions = {
|
||||
dateBtn: false,
|
||||
addBtn: false,
|
||||
editBtn: false,
|
||||
@@ -90,22 +127,54 @@ let leftUserOptions = {
|
||||
menu:false,
|
||||
tip: false,
|
||||
selection: true,
|
||||
}
|
||||
let leftUserOptions = {
|
||||
...baseOptions,
|
||||
column: [{
|
||||
label: '企业名称',
|
||||
prop: 'companyName',
|
||||
}, {
|
||||
label: '用户名',
|
||||
label: '姓名',
|
||||
prop: 'name',
|
||||
},{
|
||||
label: '身份证',
|
||||
prop: 'idNumber',
|
||||
},{
|
||||
label: '手机号',
|
||||
prop: 'telphone',
|
||||
},{
|
||||
label: '标签',
|
||||
prop: 'labelsBase',
|
||||
slot: true,
|
||||
}]
|
||||
}
|
||||
let rightPolicyOptions = {
|
||||
...baseOptions,
|
||||
column: [{
|
||||
label: '政策名称',
|
||||
prop: 'name',
|
||||
}, {
|
||||
label: '政策标签',
|
||||
prop: 'labelName',
|
||||
slot: true,
|
||||
}]
|
||||
}
|
||||
let rightPostOptions = {
|
||||
...baseOptions,
|
||||
column: [{
|
||||
label: '岗位名称',
|
||||
prop: 'jobName',
|
||||
}, {
|
||||
label: '企业名称',
|
||||
prop: 'companyName',
|
||||
}, {
|
||||
label: '岗位描述',
|
||||
prop: 'jobDescription',
|
||||
slot: true,
|
||||
}]
|
||||
}
|
||||
export default {
|
||||
components: {TextTooltip},
|
||||
data() {
|
||||
return {
|
||||
formInline: {},
|
||||
tableData: [],
|
||||
leftServeOptions: [],
|
||||
leftUserDataList: [],
|
||||
leftUserPages: {},
|
||||
@@ -113,17 +182,34 @@ export default {
|
||||
leftPages: Object.assign({}, pages),
|
||||
leftUserOptions: Object.assign({}, leftUserOptions),
|
||||
leftLoading: false,
|
||||
rightLoading: false,
|
||||
rightDataList: [],
|
||||
rightDataSelections: [],
|
||||
rightPages: Object.assign({}, pages),
|
||||
rightPolicyOptions: Object.assign({}, rightPolicyOptions),
|
||||
rightPostOptions: Object.assign({}, rightPostOptions),
|
||||
searchInput: '',
|
||||
rightTabs: 0, // 0: 政策, 1: 岗位
|
||||
pushState: false,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
visible: { default: false, type: Boolean },
|
||||
visible: Boolean,
|
||||
rowData: { default: null, type: Function },
|
||||
changeVisible: { default: null, type: Function },
|
||||
},
|
||||
computed: {
|
||||
viewDrawer: {
|
||||
get() {
|
||||
return this.visible;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit("update:visible", val);
|
||||
},
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
visible(val) {
|
||||
val ? this.onPageLoad() : this.onPageInit()
|
||||
}
|
||||
viewDrawer(val) { val ? this.onPageLoad() : this.onPageInit()}
|
||||
},
|
||||
methods: {
|
||||
onPageLoad() {
|
||||
@@ -131,45 +217,142 @@ export default {
|
||||
if(!this.rowData) return
|
||||
this.getLeftServeList()
|
||||
this.getLeftUserList()
|
||||
this.getRightListPolicy()
|
||||
},
|
||||
onPageInit() {
|
||||
this.formInline = {}
|
||||
this.tableData = []
|
||||
this.leftServeOptions = []
|
||||
this.leftUserDataList = []
|
||||
this.leftUserSelections = []
|
||||
this.leftUserPages = Object({}, pages)
|
||||
this.leftPages = Object.assign({}, pages)
|
||||
this.leftUserOptions = Object.assign({}, leftUserOptions)
|
||||
this.leftLoading = false
|
||||
this.rightLoading = false
|
||||
this.rightDataList = []
|
||||
this.rightDataSelections = []
|
||||
this.rightPages = Object.assign({}, pages)
|
||||
this.rightPolicyOptions = Object.assign({}, rightPolicyOptions)
|
||||
this.rightPostOptions = Object.assign({}, rightPostOptions)
|
||||
this.searchInput = ''
|
||||
this.rightTabs = 0 // 0: 政策
|
||||
this.pushState = false
|
||||
this.$refs.crud1.selectClear()
|
||||
this.$refs.crud2.selectClear()
|
||||
},
|
||||
changeTabs(type) {
|
||||
this.rightDataList = []
|
||||
this.rightTabs = type
|
||||
this.rightDataSelections = []
|
||||
type === 0 && this.getRightListPolicy()
|
||||
},
|
||||
searchInputChange: debounce(function (val) {
|
||||
this.getRightSearch()
|
||||
}, 1000),
|
||||
leftSearch() {
|
||||
console.log('submit!', this.formInline);
|
||||
console.log('search', this.formInline)
|
||||
this.getLeftUserList('serve')
|
||||
},
|
||||
leftCurrentPageChange(current) {
|
||||
this.leftPages.current = current
|
||||
this.getLeftUserList()
|
||||
},
|
||||
leftSizePageChange(current) {
|
||||
this.leftPages.size = current
|
||||
this.getLeftUserList()
|
||||
},
|
||||
leftSelectionChange(val) {
|
||||
console.log(val)
|
||||
this.leftUserSelections = val
|
||||
},
|
||||
rightSelectionChange(val) {
|
||||
this.rightDataSelections = val
|
||||
},
|
||||
onSubmit() {
|
||||
if( !this.leftUserSelections.length ) return this.$message.info('请选择推送用户')
|
||||
if( !this.rightDataSelections.length ) return this.$message.info('请选择推送政策或岗位')
|
||||
if(this.rightTabs === 0) {
|
||||
this.pushPolicyAndUser()
|
||||
} else {
|
||||
this.pushPostAndUser()
|
||||
}
|
||||
},
|
||||
groupNameChange() {
|
||||
delete this.formInline.userName
|
||||
this.getLeftUserList('serve')
|
||||
},
|
||||
async pushPostAndUser() {
|
||||
this.pushState = true
|
||||
const createTime = Date.now() + 2000
|
||||
let params = {
|
||||
serveId: this.rowData.id,
|
||||
posts: this.rightDataSelections.map((item) => ({id: item.id, type: item.type1})),
|
||||
users: this.leftUserSelections.map((item) => ({idNumber: item.idNumber, talentsId: item.id}))
|
||||
}
|
||||
let resData = await pushPostUserServe(params)
|
||||
if(resData.data.code === 200) {
|
||||
const timed = createTime - Date.now() > 0 ? createTime - Date.now() : 0
|
||||
setTimeout(() => {
|
||||
this.$message.success('岗位推送成功')
|
||||
this.$refs.crud1.selectClear()
|
||||
this.$refs.crud2.selectClear()
|
||||
this.pushState = false
|
||||
}, timed)
|
||||
|
||||
}
|
||||
},
|
||||
async pushPolicyAndUser() {
|
||||
this.pushState = true
|
||||
const createTime = Date.now() + 2000
|
||||
let params = {
|
||||
serveId: this.rowData.id,
|
||||
policyIds: this.rightDataSelections.map((item) => item.id),
|
||||
users: this.leftUserSelections.map((item) => ({idNumber: item.idNumber, talentsId: item.id}))
|
||||
}
|
||||
let resData = await pushPolicyUserServe(params)
|
||||
if(resData.data.code === 200) {
|
||||
const timed = createTime - Date.now() > 0 ? createTime - Date.now() : 0
|
||||
setTimeout(() => {
|
||||
this.$message.success('政策推送成功')
|
||||
this.$refs.crud1.selectClear()
|
||||
this.$refs.crud2.selectClear()
|
||||
this.pushState = false
|
||||
}, timed)
|
||||
}
|
||||
},
|
||||
async getRightSearch() {
|
||||
let params = {keywords: this.searchInput}
|
||||
this.rightLoading = true
|
||||
let resData = await getSearchAll(params)
|
||||
this.rightLoading = false
|
||||
if(resData.data.code === 200){
|
||||
this.rightDataList = resData.data.data
|
||||
console.log(resData.data)
|
||||
}
|
||||
},
|
||||
async getRightListPolicy() {
|
||||
let params = {ids: this.rowData.policyIds}
|
||||
this.rightLoading = true
|
||||
let resData = await getListByids(params)
|
||||
this.rightLoading = false
|
||||
if(resData.data.code === 200){
|
||||
this.rightDataList = resData.data.data
|
||||
}
|
||||
},
|
||||
async getLeftUserList(type) {
|
||||
const {current, size} = this.leftPages
|
||||
let params = {
|
||||
...this.formInline,
|
||||
...this.leftPages,
|
||||
current, size,
|
||||
labels: this.rowData.serveLabels,
|
||||
}
|
||||
console.log(params)
|
||||
// params.labels = '未分组'
|
||||
this.leftLoading = true
|
||||
let resData = await getListAllByLabels(params)
|
||||
this.leftLoading = false
|
||||
if ( resData.data.code === 200 ) {
|
||||
const { records, total, size, current } = resData.data.data
|
||||
this.leftUserDataList = records
|
||||
this.leftPages = { total, size, current }
|
||||
this.leftLoading = false
|
||||
}
|
||||
},
|
||||
async getLeftServeList() {
|
||||
@@ -177,7 +360,7 @@ export default {
|
||||
// params.labels = '未分组'
|
||||
let resData = await getListGroupByLabels(params)
|
||||
if ( resData.data.code === 200 ) {
|
||||
this.leftServeOptions = resData.data.data
|
||||
this.leftServeOptions = [{groupName: '全部', value: ''}, ...resData.data.data]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +370,7 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
display: grid;
|
||||
grid-template-columns: 500px 100px 1fr;
|
||||
grid-template-columns: 1fr 60px 1fr;
|
||||
grid-gap: 20px;
|
||||
.content-left{
|
||||
|
||||
@@ -201,7 +384,9 @@ export default {
|
||||
flex-direction: column;
|
||||
}
|
||||
.content-right{
|
||||
|
||||
.right-search{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -314,9 +314,8 @@
|
||||
<mission-view :visible.sync="viewDrawer" :model="view"></mission-view>
|
||||
<work-view :visible.sync="workViewDrawer" :model="workViewModel"></work-view>
|
||||
<PushService
|
||||
:visible="PushServiceVisible"
|
||||
:visible.sync="PushServiceVisible"
|
||||
:rowData="selectPushServiceData"
|
||||
@changeVisible="() => PushServiceVisible = false"
|
||||
></PushService>
|
||||
</div>
|
||||
</template>
|
||||
@@ -913,6 +912,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
selectPushService(row) {
|
||||
console.log('点击')
|
||||
this.selectPushServiceData = deepClone(row)
|
||||
this.PushServiceVisible = true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user