master
xy 3 years ago
parent 427ff00a7c
commit c307a8a74c

@ -52,8 +52,8 @@ export function imports(data,isLoading = true){
})
}
export async function exports(params){
await download('/api/admin/recruit/export','get',params,`统招生管理-${params.year}.xlsx`)
export async function exports(params,filename = `模板-${params.year}.xlsx`){
await download('/api/admin/recruit/export','get',params,filename)
}

@ -225,6 +225,7 @@ export default {
candidate_no: "",
allow_no: "",
template_id: "",
template_item_id:""
},
originalRules: {
year: [{ required: true, message: "请选择年份", trigger: "blur" }],

@ -35,6 +35,20 @@
</div>
</div>
</template>
<template v-slot:footerContent>
<template>
<Poptip
:transfer="true"
confirm
title="确认要删除吗"
@on-ok="destroy">
<Button type="error" ghost>删除</Button>
</Poptip>
</template>
<Button @click="$refs['dialog'].reset()" style="margin-left: 8px">重置</Button>
<Button type="primary" @click="submit"></Button>
</template>
</xy-dialog>
</div>
</template>
@ -42,7 +56,8 @@
<script>
import {
show,
save
save,
destroy
} from '@/api/unifiedRecruitment/templateItem';
export default {
props:{
@ -80,23 +95,40 @@
},
submit() {
if(this.type === 'add'){
if(this.form.hasOwnProperty('id')){
delete this.form.id
this.$refs['dialog'].validate().then(val => {
if(val){
if(this.type === 'add'){
if(this.form.hasOwnProperty('id')){
delete this.form.id
}
}
if (this.type === 'editor') {
Object.defineProperty(this.form, 'id', {
value: this.id,
enumerable: true,
configurable: true,
writable: true
})
}
save(this.form).then(res => {
this.$successMessage(this.type, '')
this.isShow = false
this.$emit('refresh')
})
}
}
if (this.type === 'editor') {
Object.defineProperty(this.form, 'id', {
value: this.id,
enumerable: true,
configurable: true,
writable: true
})
},
destroy(){
destroy({
id:this.id
}).then(res => {
this.$message({
type:'success',
message:"删除成功"
})
}
save(this.form).then(res => {
this.$successMessage(this.type, '')
this.isShow = false
this.$emit('refresh')
this.isShow = false
})
}
},

@ -82,6 +82,7 @@ export default {
year:'',
province_id:'',
template_id:'',
template_item_id:'',
isEnd:0
},
@ -165,6 +166,7 @@ export default {
let promiseAll = this.list.map(item => {
let form = {
template_item_id:this.select.template_item_id,
template_id:this.select.template_id,
year:this.select.year,
province_id:this.select.province_id,

@ -12,6 +12,7 @@
<template v-slot:search>
<div style="display: flex; align-items: center">
<el-date-picker
:clearable="false"
size="small"
type="year"
placement="bottom"
@ -19,10 +20,28 @@
style="width: 160px; margin-right: 6px"
value-format="yyyy"
v-model="select.year"
@change="getTemplate"
></el-date-picker>
<el-select v-model="select.template_item_id" size="small" placeholder="模板类型" style="width: 160px; margin-right: 6px">
<el-option v-for="item in templateItems" :key="item.id" :label="item.name" :value="item.id"></el-option>
<el-select
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
@ -37,29 +56,41 @@
<template v-slot:create>
<Button
type="primary"
@click="($refs['addRecruit'].type = 'add'), (isShowAdd = true)"
@click="
($refs['addRecruit'].form.template_id = select.template_id),
($refs['addRecruit'].form.template_item_id =
select.template_item_id),
($refs['addRecruit'].type = 'add'),
(isShowAdd = true)
"
>新建</Button
>
</template>
<template v-slot:export>
<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.id"
>{{ item.name }}</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
<Button
type="primary"
@click="downTemplate"
>下载模板</Button
>
<!-- <el-dropdown @command="downTemplate">-->
<!-- <el-button size="small" type="primary">-->
<!-- 下载模板<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
<!-- </el-button>-->
<!-- <el-dropdown-menu slot="dropdown">-->
<!-- <el-dropdown-item-->
<!-- v-for="item in templateItems"-->
<!-- :key="item.id"-->
<!-- :command="item.id"-->
<!-- >{{ item.name }}</el-dropdown-item-->
<!-- >-->
<!-- </el-dropdown-menu>-->
<!-- </el-dropdown>-->
</template>
<template v-slot:import>
<Button
type="primary"
@click="
($refs['importRecruitInfo'].select.template_item_id = select.template_item_id),
($refs['importRecruitInfo'].select.year = select.year),
(isShowImportRecruitInfo = true)
"
@ -81,6 +112,7 @@
@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;
@ -100,7 +132,7 @@
ref="importRecruitInfo"
:province_ids="provinces"
:is-show.sync="isShowImportRecruitInfo"
@refresh="$refs['xyTable'].getTableData()"
@refresh="getList"
></importRecruitInfo>
</div>
</template>
@ -109,9 +141,15 @@
import { index, destroy, exports } from "@/api/unifiedRecruitment/recruit";
import { authMixin } from "@/mixin/authMixin";
import { index as provinceIndex } from "@/api/manage/province";
import { show as templateShow } from "@/api/unifiedRecruitment/template";
import {
show as templateShow,
index as templateIndex,
} from "@/api/unifiedRecruitment/template";
import { getConst } from "@/const";
import { index as templateItemIndex } from "@/api/unifiedRecruitment/templateItem";
import {
index as templateItemIndex,
show as templateItemShow,
} from "@/api/unifiedRecruitment/templateItem";
import addRecruit from "./component/addRecruit.vue";
import importRecruitInfo from "./component/importRecruitInfo.vue";
@ -132,9 +170,10 @@ export default {
page: 1,
page_size: 10,
template_id: "",
template_item_id:"",
template_item_id: "",
},
templateItems: [],
templates: [],
total: 0,
list: [],
@ -151,14 +190,9 @@ export default {
width: 120,
},
{
prop: "province_id",
prop: "province.name",
label: "省份",
width: 120,
formatter: (cell, data, val) => {
return (
this.provinces.filter((item) => item.id === val)[0]?.name ?? ""
);
},
},
{
prop: "idcard",
@ -185,38 +219,18 @@ export default {
index,
destroy,
async getTemplateItem() {
const res = await templateItemIndex({
page: 1,
page_size: 999,
template_id: this.select.template_id,
},false);
this.templateItems = res.data;
this.select.template_item_id = this.templateItems[0]?.id
},
async getList() {
this.$refs['xyTable'].loading = true
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)
},
async getProvinces() {
const res = await provinceIndex(
{
page: 1,
page_size: 9999,
},
false
);
this.provinces = res.data;
},
async getTemplateItemDetail() {
if (!this.select.template_item_id) {
this.$message({
type: "warning",
message: "当前年份无模板内容",
});
return;
}
// const res = await templateItemShow({
// id: this.select.template_item_id,
// });
async getTemplate() {
const res = await templateShow(
{
year: this.select.year,
@ -235,17 +249,73 @@ export default {
}) ?? [];
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),
year: this.select.year,
page: 1,
page_size: 999,
});
this.templates = res.data;
this.select.template_id = this.templates[0]?.id;
this.select.template_item_id = this.templates[0]?.items[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.getTemplateItem();
//await this.getTemplate();
//await this.getTemplateItemDetail();
await this.getList();
},
downTemplate(command) {
downTemplate() {
exports({
year: this.select.year,
template_item_id: command,
template_item_id: this.select.template_item_id,
});
},
},
@ -257,12 +327,10 @@ export default {
},
async created() {
await this.getTemplate();
await this.getTemplateItem();
await this.getTemplateItemDetail();
await this.getProvinces();
await this.getList();
},
mounted() {
this.getList();
}
};
</script>

@ -107,13 +107,13 @@ export default {
},
{
prop: "remark",
label: "录取查询说明",
label: "备注",
align: "left",
minWidth: 300,
},
{
label: "是否开放查询",
minWidth: 300,
minWidth: 340,
showOverflowTooltip:false,
customFn: (row) => {
return (
@ -179,6 +179,10 @@ export default {
<style scoped lang="scss">
.template-item{
display: flex;
flex-wrap: wrap;
align-content: center;
align-items: center;
justify-content: space-between;
&>div + div{
margin-left: 14px;

@ -146,7 +146,7 @@ export default {
width: 140,
},
{
label: "选",
label: "选",
align:'left',
customFn: (row) => {
return (

@ -9,33 +9,50 @@
:rules="rules"
@submit="submit"
>
<template v-slot:province_id> </template>
<template v-slot:year> </template>
<template v-slot:type>
<template v-slot:province_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>
招生类型
省份
</div>
<div class="xy-table-item-content">
<el-select
v-model="form.type"
v-model="form.province_id"
clearable
placeholder="请选择招生类型 "
placeholder="请选择省份 "
style="width: 300px"
>
<el-option
v-for="item in getConst('type', 'array')"
v-for="item in province_ids"
:key="item.id"
:label="item.value"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:year>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>
年份
</div>
<div class="xy-table-item-content">
<el-date-picker
type="year"
v-model="form.year"
placeholder="请选择年份"
style="width: 300px"
value-format="yyyy"
></el-date-picker>
</div>
</div>
</template>
<template v-slot:specialize_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
@ -103,33 +120,16 @@
</template>
<template v-slot:subject>
<div class="xy-table-item">
<div class="xy-table-item-label"> </div>
<div class="xy-table-item-label"> </div>
<div class="xy-table-item-content" style="width: 300px">
<el-tag
:key="tag"
v-for="tag in form.subject"
closable
@close="handleClose(tag)"
>
{{ tag }}
</el-tag>
<el-input
class="input-new-tag"
v-if="inputVisible"
v-model="inputValue"
ref="saveTagInput"
size="small"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"
>
</el-input>
<el-button
v-else
class="button-new-tag"
size="small"
@click="showInput"
>+ 新增</el-button
>
<el-select v-model="form.subject" style="width: 300px">
<el-option
v-for="item in store.state.subject.split(',')"
:key="item"
:label="item"
:value="item"
></el-option>
</el-select>
</div>
</div>
</template>
@ -154,14 +154,18 @@
<script>
import { show, save } from "@/api/yearScore/yearScoreDetail";
import { getConst } from "@/const";
export default {
props: {
specialize_ids: {
type: Array,
default: () => [],
},
province_ids: {
type: Array,
default: () => [],
},
},
inject: ["store"],
data() {
return {
inputVisible: false,
@ -173,7 +177,6 @@ export default {
form: {
province_id: "",
year: "",
type: "",
specialize_id: "",
max_socre: "",
min_socre: "",
@ -209,8 +212,6 @@ export default {
};
},
methods: {
getConst,
handleClose(tag) {
this.form.subject.splice(this.form.subject.indexOf(tag), 1);
},
@ -231,7 +232,7 @@ export default {
this.inputValue = "";
},
async getDetail() {
const res = await show(this.id);
const res = await show({ id: this.id });
this.$integrateData(this.form, res);
},
@ -251,7 +252,7 @@ export default {
}
save({
...this.form,
subject:this.form.subject.toString()
subject: this.form.subject.toString(),
}).then((res) => {
this.$successMessage(this.type, "");
this.isShow = false;
@ -273,6 +274,9 @@ export default {
}
},
},
"form.year"(val){
this.form.year = val + ''
}
};
</script>

@ -1,75 +1,93 @@
<template>
<div>
<Modal
:title="`${form.year}分数导入`"
:title="`${form.year}分数`"
width="64"
:value.sync="isShow"
:loading="true"
@on-ok="submit"
@on-visible-change="(e) => $emit('update:isShow', e)"
>
<div class="label">
<div class="label_title">省份选择</div>
<el-select
size="small"
v-model="form.province_id"
placeholder="请选择省份"
>
<el-option
v-for="item in provinces"
:key="item.id"
:value="item.id"
:label="item.name"
></el-option>
</el-select>
</div>
<div style="margin-top: 6px; display: flex; align-items: flex-start">
<el-button size="small" type="primary" @click="downLoad"
>下载导入模板</el-button
>
<el-button
size="small"
type="primary"
@click="
($refs['addYearScoreDetail'].type = 'add'),
($refs['addYearScoreDetail'].form.province_id = form.province_id),
($refs['addYearScoreDetail'].form.year = form.year),
($refs['addYearScoreDetail'].isShow = true)
"
>新增</el-button
>
<el-upload
style="margin-left: 10px"
ref="upload"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
:headers="{
Authorization: `Bearer ${getToken()}`,
}"
:action="action"
:file-list="fileList"
:on-success="successHandle"
:on-error="errorHandle"
:auto-upload="false"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件</el-button
<el-tabs tab-position="left">
<el-tab-pane label="明细">
<xy-table
ref="xyTable2"
:auths="['edit', 'delete']"
:table-item="table2"
:action="index"
:destroy-action="destroy"
:req-opt="{ year: form.year, province_id: form.province_id }"
@editor="
row => {
($refs['addYearScoreDetail'].type = 'editor'),
($refs['addYearScoreDetail'].form.province_id =
form.province_id),
($refs['addYearScoreDetail'].id = row.id),
($refs['addYearScoreDetail'].form.year = form.year),
($refs['addYearScoreDetail'].isShow = true)
}
"
>
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="$refs['upload'].submit()"
>开始上传</el-button
>
<div slot="tip" class="el-upload__tip">
支持文件格式EXCEL扩展名为 XLSXXLS
</xy-table>
</el-tab-pane>
<el-tab-pane label="导入">
<div class="label"></div>
<div style="margin-top: 6px; display: flex; align-items: flex-start">
<!-- <el-button size="small" type="primary" @click="downLoad"-->
<!-- >下载导入模板</el-button-->
<!-- >-->
<el-button
size="small"
type="primary"
@click="
($refs['addYearScoreDetail'].type = 'add'),
($refs['addYearScoreDetail'].form.province_id =
form.province_id),
($refs['addYearScoreDetail'].form.year = form.year),
($refs['addYearScoreDetail'].isShow = true)
"
>新增</el-button
>
<el-upload
style="margin-left: 10px"
ref="upload"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
:headers="{
Authorization: `Bearer ${getToken()}`,
}"
:action="action"
:file-list="fileList"
:on-success="successHandle"
:on-error="errorHandle"
:auto-upload="false"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件</el-button
>
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="$refs['upload'].submit()"
>开始上传</el-button
>
<div slot="tip" class="el-upload__tip">
支持文件格式EXCEL扩展名为 XLSXXLS
</div>
</el-upload>
</div>
</el-upload>
</div>
<xy-table ref="xyTable" :is-page="false" :list="list" :table-item="table">
<template v-slot:btns></template>
</xy-table>
<xy-table
style="margin-top: 10px"
ref="xyTable"
:is-page="false"
:list="list"
:table-item="table"
>
<template v-slot:btns></template>
</xy-table>
</el-tab-pane>
</el-tabs>
<template v-slot:footer>
<Button @click="$emit('update:isShow', false)">取消</Button>
@ -79,13 +97,15 @@
<addYearScoreDetail
ref="addYearScoreDetail"
:province_ids="provinces"
:specialize_ids="specializes"
@refresh="$refs['xyTable2'].getTableData()"
></addYearScoreDetail>
</div>
</template>
<script>
import { index, imports } from "@/api/yearScore/yearScoreDetail";
import { index, imports, destroy } from "@/api/yearScore/yearScoreDetail";
import { getToken } from "@/utils/auth";
import { index as specializeIndex } from "@/api/manage/specialize";
@ -109,7 +129,41 @@ export default {
action: `${process.env.VUE_APP_BASE_API}/api/admin/year_socre_detail/excel_analyse`,
fileList: [],
list: [],
table: [],
table: [
{
prop: "year",
label: "年份",
width: 140,
},
{
prop: "province_name",
label: "省份",
width: 180,
},
{
prop: "subject",
label: "选科",
width: 180,
},
{
prop: "max_socre",
label: "最高分",
width: 160,
sortable: true,
},
{
prop: "min_socre",
label: "最低分",
width: 160,
sortable: true,
},
{
prop: "remark",
label: "备注",
minWidth: 200,
align: "left",
},
],
total: 0,
specializes: [],
@ -118,10 +172,54 @@ export default {
year: String(new Date().getFullYear()),
detail: [],
},
table2: [
{
prop: "year",
label: "年份",
width: 140,
sortable: "custom",
},
{
prop: "provinces.name",
label: "省份",
width: 180,
},
{
prop: "subject",
label: "选科",
width: 180,
},
{
prop: "specialize.name",
label: "专业",
width: 180,
},
{
prop: "max_socre",
label: "最高分",
width: 160,
sortable: "custom",
},
{
prop: "min_socre",
label: "最低分",
width: 160,
sortable: "custom",
},
{
prop: "remark",
label: "备注",
minWidht: 200,
align: "left",
},
],
};
},
methods: {
getToken,
index,
destroy,
downLoad() {},
async getSpecializes() {
@ -158,35 +256,54 @@ export default {
});
},
submit() {
if (this.form.detail.length <= 0) {
if (this.list.length <= 0) {
this.$message({
type: "warning",
message: "请选择需要初始化数据",
});
return;
}
let promiseAll = this.list.map((item) => {
return imports(item);
});
Promise.all(promiseAll)
imports(
{
detail:this.list
}
)
.then((res) => {
this.$message({
type: "success",
message: `成功导入${res.length}`,
message: `成功导入${this.list.length}`,
});
this.$emit("refresh");
this.$emit("update:isShow", false);
this.$refs["xyTable2"].getTableData();
})
.catch((err) => {
console.log(err);
});
// let promiseAll = this.list.map((item) => {
// return imports({
// detail: item,
// });
// });
// Promise.all(promiseAll)
// .then((res) => {
// this.$message({
// type: "success",
// message: `${res.length}`,
// });
// this.$emit("refresh");
// this.$refs['xyTable2'].getTableData()
// })
// .catch((err) => {
// console.log(err);
// });
},
},
computed: {},
watch: {
isShow(newVal) {
if (newVal) {
this.getList();
//this.getList();
this.$refs["xyTable2"].getTableData(true);
}
},
},

@ -51,11 +51,11 @@
}
"
>
<template v-slot:import="scope">
<Button size="small" type="primary" ghost @click="showImport(scope.row)"
>导入</Button
>
</template>
<!-- <template v-slot:import="scope">-->
<!-- <Button size="small" type="primary" ghost @click="showImport(scope.row)"-->
<!-- >导入</Button-->
<!-- >-->
<!-- </template>-->
</xy-table>
<addYearScore
@ -81,8 +81,21 @@ export default {
addYearScore,
imports,
},
provide(){
return {
store:this.store
}
},
data() {
return {
store:{
state:{
subject:""
},
commit(subject,val){
this.state[subject] = val
}
},
isShowImport: false,
provinces: [],
select: {
@ -154,6 +167,7 @@ export default {
this.provinces = res.data;
},
showImport(row, province_id = "") {
this.store.state.subject = row.province_ids?.filter(item => item.province_id == province_id)[0]?.subject ?? ""
this.$refs["imports"].form.year = String(row.year);
this.$refs["imports"].form.province_id = province_id;
this.isShowImport = true;

Loading…
Cancel
Save