You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

372 lines
10 KiB

<template>
<div>
<div ref="lxHeader">
<lx-header
icon="md-apps"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
:text="getTitleName + '管理'"
>
<div slot="content"></div>
<slot>
<header-content :auths="auths_auth_mixin">
<template v-slot:search>
<div style="display: flex; align-items: center">
<el-select v-model="select.template_id" size="small" placeholder="请选择年份" style="width: 160px; margin-right: 6px" @change="getTemplateItems">
<el-option v-for="item in templates" :label="item.year" :value="item.id" :key="item.id"></el-option>
</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
v-model="select.keyword"
style="width: 160px; margin-right: 6px"
size="small"
placeholder="关键词搜索"
></el-input>
<Button type="primary" @click="search">搜索</Button>
</div>
</template>
<template v-slot:create>
<Button
type="primary"
@click="
($refs['addRecruit'].originalForm.template_id = select.template_id),
($refs['addRecruit'].type = 'add'),
(isShowAdd = true)
"
>新建</Button
>
</template>
<template v-slot:export>
<!-- <Button-->
<!-- type="primary"-->
<!-- @click="downTemplate"-->
<!-- >下载模板</Button-->
<!-- >-->
<el-dropdown @command="downTemplate">
<el-button size="small" type="primary">
下载模板<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-for="item in templateItems"
:key="item.id"
:command="item.name"
>{{ item.name }}</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</template>
<template v-slot:import>
<Button
type="primary"
@click="
isShowTip = true,
($refs['importRecruitInfo'].select.template_id = select.template_id),
($refs['importRecruitInfo'].select.year = select.year),
(isShowImportRecruitInfo = true)
"
>导入信息</Button
>
</template>
</header-content>
</slot>
</lx-header>
</div>
<xy-table
ref="xyTable"
:total="total"
:list="list"
:table-item="table"
:auths="auths_auth_mixin"
:destroy-action="destroy"
@editor="
(row) => {
$refs['addRecruit'].form.template_id = select.template_id;
$refs['addRecruit'].form.template_item_id = select.template_item_id;
$refs['addRecruit'].id = row.id;
$refs['addRecruit'].type = 'editor';
isShowAdd = true;
}
"
@destroyed="getList"
@pageSizeChange="e => {
select.page = 1;
select.page_size = e;
getList();
}"
@pageIndexChange="e => {
select.page = e;
getList()
}"
@sort-change="sortChange"
></xy-table>
<addRecruit
:is-show.sync="isShowAdd"
:province_ids="provinces"
:template-items="templateItems"
ref="addRecruit"
@refresh="$refs['xyTable'].getTableData()"
></addRecruit>
<importRecruitInfo
ref="importRecruitInfo"
:province_ids="provinces"
:templates="templates"
:is-show.sync="isShowImportRecruitInfo"
@refresh="getList"
></importRecruitInfo>
<!-- <el-dialog-->
<!-- title="提示"-->
<!-- :visible.sync="isShowTip"-->
<!-- width="30%"-->
<!-- center>-->
<!-- <span>当前选择导入的模板为:{{ getTemplateItemName() }}</span>-->
<!-- <span slot="footer" class="dialog-footer">-->
<!-- <el-button type="primary" @click="isShowTip = false">确 定</el-button>-->
<!-- </span>-->
<!-- </el-dialog>-->
</div>
</template>
<script>
import { index, destroy, exports } from "@/api/unifiedRecruitment/recruit";
import { authMixin } from "@/mixin/authMixin";
import { index as provinceIndex } from "@/api/manage/province";
import { index as filedIndex } from "@/api/unifiedRecruitment/templateFiled"
import {
show as templateShow,
index as templateIndex,
} from "@/api/unifiedRecruitment/template";
import { getConst } from "@/const";
import {
index as templateItemIndex,
show as templateItemShow,
} from "@/api/unifiedRecruitment/templateItem";
import addRecruit from "./component/addRecruit.vue";
import importRecruitInfo from "./component/importRecruitInfo.vue";
export default {
mixins: [authMixin],
components: {
addRecruit,
importRecruitInfo,
},
data() {
return {
sortFlag:0,
isShowTip:false,
tipTemplate:"",
isShowImportRecruitInfo: false,
isShowAdd: false,
provinces: [],
select: {
keyword: "",
page: 1,
page_size: 10,
template_id: "",
sort_name:"",
sort_type:""
},
templateItems: [],
templates: [],
total: 0,
list: [],
table: [],
originalTable: [
{
prop: "year",
label: "年份",
width: 100,
},
{
prop: "name",
label: "姓名",
width: 120,
},
{
prop: "province.name",
label: "省份",
width: 120,
},
{
prop: "idcard",
label: "身份证号",
width: 180
},
{
prop: "candidate_no",
label: "考生号",
width: 180,
sortable: "custom",
},
{
prop: "allow_no",
label: "准考证号",
width: 180,
sortable: "custom",
},
],
};
},
methods: {
index,
destroy,
sortChange({ column, prop, order }){
if(prop === this.select.sort_name){
this.sortFlag ++
}else{
this.sortFlag = 0
}
this.select.sort_name = prop;
this.select.sort_type = ['ASC','DESC',null][this.sortFlag % 3]
this.select.page = 1
this.getList()
},
async getTemplateItems(){
const res = await templateItemIndex({
template_id:this.select.template_id,
page_size:999,
page:1
})
this.templateItems = res.data
},
async getTemplateItemDetail() {
const res = await templateShow({
id:this.select.template_id
})
let temp =
res?.fileds?.map((item) => {
return {
prop: item.en,
label: item.name,
width: 140,
};
}) ?? [];
this.table = [...this.originalTable, ...temp];
},
async getList() {
this.$refs["xyTable"].loading = true;
try{
let res = await index(this.select, false);
this.total = res.total ?? 0;
this.list = res.data.map((item) => {
return item.fileds ? { ...item, ...item.fileds } : item;
});
setTimeout(() => {
this.$refs["xyTable"].loading = false;
}, 500);
}catch (e){
setTimeout(() => {
this.$refs["xyTable"].loading = false;
}, 500);
}
},
async getProvinces() {
const res = await provinceIndex(
{
page: 1,
page_size: 999,
},
false
);
this.provinces = res.data;
},
async getTemplate() {
const res = await templateIndex({
type: Number(this.$route.meta.params.type),
page: 1,
page_size: 999,
});
this.templates = res.data;
this.select.template_id = this.templates[0]?.id;
// const res = await templateShow(
// {
// year: this.select.year,
// type: this.$route.meta.params?.type,
// },
// false
// );
// this.select.template_id = res.id;
// let temp =
// res?.fileds?.map((item) => {
// return {
// prop: item.en,
// label: item.name,
// width: 140,
// };
// }) ?? [];
// this.table = [...this.originalTable, ...temp];
},
async search() {
//await this.getTemplate();
await this.getTemplateItemDetail();
await this.getList();
},
downTemplate(command) {
exports({
year: this.select.year,
template_item_id: this.select.template_item_id,
},`${command}模板.xlsx`);
},
},
computed: {
getTitleName() {
let map = getConst("type", "map");
return map.get(Number(this.$route.meta.params.type));
},
},
async created() {
await this.getTemplate();
await this.getTemplateItemDetail();
await this.getTemplateItems();
await this.getProvinces();
await this.getList();
}
};
</script>
<style scoped lang="scss"></style>