master
xy 3 years ago
parent ef9d9e6d78
commit 58da0d8c7b

@ -62,6 +62,32 @@ export default {
props={{ model: this.originalForm }} props={{ model: this.originalForm }}
rules={this.originalRules} rules={this.originalRules}
> >
<el-col span={12}>
<el-form-item label="模板选择" prop="year">
<el-select
clearable={true}
v-model={this.originalForm.template_item_id}
placeholder="请选择模板"
on={
{
['change']:e => {
this.getTemplate()
}
}
}
>
{this.templateItems.map((item) => {
return (
<el-option
value={item.id}
label={item.name}
key={item.id}
></el-option>
);
})}
</el-select>
</el-form-item>
</el-col>
<el-col span={12}> <el-col span={12}>
<el-form-item label="年份" prop="year"> <el-form-item label="年份" prop="year">
<el-date-picker <el-date-picker
@ -197,6 +223,7 @@ export default {
default: false, default: false,
}, },
province_ids: Array, province_ids: Array,
templateItems:Array,
}, },
data() { data() {
let idcardValidate = (rule, value, callback) => { let idcardValidate = (rule, value, callback) => {
@ -294,7 +321,7 @@ export default {
watch: { watch: {
async isShow(newVal) { async isShow(newVal) {
if (newVal) { if (newVal) {
await this.getTemplate(); //await this.getTemplate();
} }
}, },
}, },

@ -9,10 +9,36 @@
@on-ok="submit" @on-ok="submit"
> >
<div class="select"> <div class="select">
<div class="select__item">
<span style="color: red">*</span><span>导入模板</span>
<el-select
size="small"
placeholder="请选择导入模板"
v-model="select.template_item_id"
style="width: 200px"
@change="getTemplate"
>
<el-option-group
v-for="group in templates"
:key="group.id"
:label="String(group.year)"
>
<el-option
v-for="item in group.items"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-option-group>
</el-select>
</div>
<div class="select__item"> <div class="select__item">
<span style="color: red">*</span><span>年份</span> <span style="color: red">*</span><span>年份</span>
<el-date-picker <el-date-picker
size="small" size="small"
:clearable="false"
placeholder="请选择年份" placeholder="请选择年份"
v-model="select.year" v-model="select.year"
value-format="yyyy" value-format="yyyy"
@ -72,6 +98,7 @@
:file-list="fileList" :file-list="fileList"
:on-success="successHandle" :on-success="successHandle"
:on-error="errorHandle" :on-error="errorHandle"
:before-upload="beforeUploadHandle"
:auto-upload="false" :auto-upload="false"
> >
<el-button slot="trigger" size="small" type="primary" <el-button slot="trigger" size="small" type="primary"
@ -109,7 +136,6 @@
<script> <script>
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { show as templateShow } from "@/api/unifiedRecruitment/template";
import { imports } from "@/api/unifiedRecruitment/recruit"; import { imports } from "@/api/unifiedRecruitment/recruit";
import { index as filedIndex } from "@/api/unifiedRecruitment/templateFiled"; import { index as filedIndex } from "@/api/unifiedRecruitment/templateFiled";
export default { export default {
@ -119,6 +145,7 @@ export default {
default: false, default: false,
}, },
province_ids: Array, province_ids: Array,
templates:Array,
}, },
data() { data() {
return { return {
@ -166,6 +193,15 @@ export default {
methods: { methods: {
getToken, getToken,
beforeUploadHandle(file){
if(!this.select.template_item_id){
this.$message({
type:'warning',
message:"请先选择导入模板"
})
return false
}
},
successHandle(response, file, fileList) { successHandle(response, file, fileList) {
this.list = response ?? []; this.list = response ?? [];
}, },

@ -11,39 +11,42 @@
<header-content :auths="auths_auth_mixin"> <header-content :auths="auths_auth_mixin">
<template v-slot:search> <template v-slot:search>
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<el-date-picker <el-select v-model="select.template_id" size="small" placeholder="请选择年份" style="width: 160px; margin-right: 6px" @change="getTemplateItems">
:clearable="false" <el-option v-for="item in templates" :label="item.year" :value="item.id" :key="item.id"></el-option>
size="small"
type="year"
placement="bottom"
placeholder="年份选择"
style="width: 160px; margin-right: 6px"
value-format="yyyy"
v-model="select.year"
@change="getTemplate"
></el-date-picker>
<el-select
ref="templateSelect"
v-model="select.template_item_id"
size="small"
placeholder="模板类型"
style="width: 160px; margin-right: 6px"
>
<el-option-group
v-for="group in templates"
:key="group.id"
:label="String(group.year)"
>
<el-option
v-for="item in group.items"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-option-group>
</el-select> </el-select>
<!-- <el-date-picker-->
<!-- :clearable="false"-->
<!-- size="small"-->
<!-- type="year"-->
<!-- placement="bottom"-->
<!-- placeholder="年份选择"-->
<!-- style="width: 160px; margin-right: 6px"-->
<!-- value-format="yyyy"-->
<!-- v-model="select.year"-->
<!-- @change="getTemplate"-->
<!-- ></el-date-picker>-->
<!-- <el-select-->
<!-- ref="templateSelect"-->
<!-- v-model="select.template_item_id"-->
<!-- size="small"-->
<!-- placeholder="模板类型"-->
<!-- style="width: 160px; margin-right: 6px"-->
<!-- >-->
<!-- <el-option-group-->
<!-- v-for="group in templates"-->
<!-- :key="group.id"-->
<!-- :label="String(group.year)"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="item in group.items"-->
<!-- :key="item.id"-->
<!-- :label="item.name"-->
<!-- :value="item.id"-->
<!-- >-->
<!-- </el-option>-->
<!-- </el-option-group>-->
<!-- </el-select>-->
<el-input <el-input
v-model="select.keyword" v-model="select.keyword"
@ -59,8 +62,6 @@
type="primary" type="primary"
@click=" @click="
($refs['addRecruit'].originalForm.template_id = select.template_id), ($refs['addRecruit'].originalForm.template_id = select.template_id),
($refs['addRecruit'].originalForm.template_item_id =
select.template_item_id),
($refs['addRecruit'].type = 'add'), ($refs['addRecruit'].type = 'add'),
(isShowAdd = true) (isShowAdd = true)
" "
@ -68,24 +69,24 @@
> >
</template> </template>
<template v-slot:export> <template v-slot:export>
<Button <!-- <Button-->
type="primary" <!-- type="primary"-->
@click="downTemplate" <!-- @click="downTemplate"-->
>下载模板</Button <!-- >下载模板</Button-->
> <!-- >-->
<!-- <el-dropdown @command="downTemplate">--> <el-dropdown @command="downTemplate">
<!-- <el-button size="small" type="primary">--> <el-button size="small" type="primary">
<!-- 下载模板<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>--> 下载模板<i class="el-icon-arrow-down el-icon--right"></i>
<!-- </el-button>--> </el-button>
<!-- <el-dropdown-menu slot="dropdown">--> <el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item--> <el-dropdown-item
<!-- v-for="item in templateItems"--> v-for="item in templateItems"
<!-- :key="item.id"--> :key="item.id"
<!-- :command="item.id"--> :command="item.name"
<!-- >{{ item.name }}</el-dropdown-item--> >{{ item.name }}</el-dropdown-item
<!-- >--> >
<!-- </el-dropdown-menu>--> </el-dropdown-menu>
<!-- </el-dropdown>--> </el-dropdown>
</template> </template>
<template v-slot:import> <template v-slot:import>
<Button <Button
@ -93,7 +94,6 @@
@click=" @click="
isShowTip = true, isShowTip = true,
($refs['importRecruitInfo'].select.template_id = select.template_id), ($refs['importRecruitInfo'].select.template_id = select.template_id),
($refs['importRecruitInfo'].select.template_item_id = select.template_item_id),
($refs['importRecruitInfo'].select.year = select.year), ($refs['importRecruitInfo'].select.year = select.year),
(isShowImportRecruitInfo = true) (isShowImportRecruitInfo = true)
" "
@ -137,6 +137,7 @@
<addRecruit <addRecruit
:is-show.sync="isShowAdd" :is-show.sync="isShowAdd"
:province_ids="provinces" :province_ids="provinces"
:template-items="templateItems"
ref="addRecruit" ref="addRecruit"
@refresh="$refs['xyTable'].getTableData()" @refresh="$refs['xyTable'].getTableData()"
></addRecruit> ></addRecruit>
@ -144,20 +145,21 @@
<importRecruitInfo <importRecruitInfo
ref="importRecruitInfo" ref="importRecruitInfo"
:province_ids="provinces" :province_ids="provinces"
:templates="templates"
:is-show.sync="isShowImportRecruitInfo" :is-show.sync="isShowImportRecruitInfo"
@refresh="getList" @refresh="getList"
></importRecruitInfo> ></importRecruitInfo>
<el-dialog <!-- <el-dialog-->
title="提示" <!-- title="提示"-->
:visible.sync="isShowTip" <!-- :visible.sync="isShowTip"-->
width="30%" <!-- width="30%"-->
center> <!-- center>-->
<span>当前选择导入的模板为{{ getTemplateItemName() }}</span> <!-- <span>当前选择导入的模板为{{ getTemplateItemName() }}</span>-->
<span slot="footer" class="dialog-footer"> <!-- <span slot="footer" class="dialog-footer">-->
<el-button type="primary" @click="isShowTip = false"> </el-button> <!-- <el-button type="primary" @click="isShowTip = false"> </el-button>-->
</span> <!-- </span>-->
</el-dialog> <!-- </el-dialog>-->
</div> </div>
</template> </template>
@ -193,12 +195,10 @@ export default {
isShowAdd: false, isShowAdd: false,
provinces: [], provinces: [],
select: { select: {
year: `${new Date().getFullYear()}`,
keyword: "", keyword: "",
page: 1, page: 1,
page_size: 10, page_size: 10,
template_id: "", template_id: "",
template_item_id: "",
sort_name:"", sort_name:"",
sort_type:"" sort_type:""
}, },
@ -260,25 +260,22 @@ export default {
this.getList() this.getList()
}, },
getTemplateItemName(){ async getTemplateItems(){
return this.$refs['templateSelect']?.selected?.label const res = await templateItemIndex({
template_id:this.select.template_id,
page_size:999,
page:1
})
this.templateItems = res.data
}, },
async getTemplateItemDetail() { async getTemplateItemDetail() {
if (!this.select.template_item_id) { const res = await templateShow({
this.$message({ id:this.select.template_id
type: "warning", })
message: "当前年份无模板内容",
});
return;
}
const res = await filedIndex({
template_item_id:this.select.template_item_id,
template_id:this.select.template_id,
page:1,
page_size:999
});
let temp = let temp =
res?.data?.map((item) => { res?.fileds?.map((item) => {
return { return {
prop: item.en, prop: item.en,
label: item.name, label: item.name,
@ -318,13 +315,11 @@ export default {
async getTemplate() { async getTemplate() {
const res = await templateIndex({ const res = await templateIndex({
type: Number(this.$route.meta.params.type), type: Number(this.$route.meta.params.type),
year: this.select.year,
page: 1, page: 1,
page_size: 999, page_size: 999,
}); });
this.templates = res.data; this.templates = res.data;
this.select.template_id = this.templates[0]?.id; this.select.template_id = this.templates[0]?.id;
this.select.template_item_id = this.templates[0]?.items[0]?.id;
// const res = await templateShow( // const res = await templateShow(
// { // {
// year: this.select.year, // year: this.select.year,
@ -350,11 +345,11 @@ export default {
await this.getList(); await this.getList();
}, },
downTemplate() { downTemplate(command) {
exports({ exports({
year: this.select.year, year: this.select.year,
template_item_id: this.select.template_item_id, template_item_id: this.select.template_item_id,
},`${ this.getTemplateItemName() }模板.xlsx`); },`${command}模板.xlsx`);
}, },
}, },
computed: { computed: {
@ -366,6 +361,7 @@ export default {
async created() { async created() {
await this.getTemplate(); await this.getTemplate();
await this.getTemplateItemDetail(); await this.getTemplateItemDetail();
await this.getTemplateItems();
await this.getProvinces(); await this.getProvinces();
await this.getList(); await this.getList();
} }

@ -130,13 +130,23 @@ export default {
align: "left", align: "left",
customFn: (row) => { customFn: (row) => {
return ( return (
<div> <div style={
{
'display':'flex',
'flex-wrap':'wrap'
}
}>
{row.province_ids.map((val) => { {row.province_ids.map((val) => {
return ( return (
<el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
plain={true} plain={true}
style={
{
'margin':'0 6px 4px 0'
}
}
on={{ on={{
["click"]: (e) => { ["click"]: (e) => {
this.showImport(row, Number(val.province_id)); this.showImport(row, Number(val.province_id));

Loading…
Cancel
Save