master
xy 3 years ago
parent add09862de
commit 6a9cacae3a

@ -44,8 +44,11 @@ export function imports(data,isLoading = true){
return request({
url:"/api/admin/recruit/import",
method:"post",
data,
isLoading
data:qs.stringify(data),
isLoading,
headers:{
'Content-Type':'application/x-www-form-urlencoded'
}
})
}

@ -0,0 +1,38 @@
import request from "@/utils/request";
export function index(params,isLoading = true){
return request({
url:"/api/admin/template_item/index",
method:"get",
isLoading,
params
})
}
export function show(params,isLoading = true){
return request({
url:"/api/admin/template_item/show",
method:"get",
isLoading,
params
})
}
export function save(data,isLoading = true){
return request({
url:"/api/admin/template_item/save",
method:"post",
data,
isLoading
})
}
export function destroy(params,isLoading = true){
return request({
url:"/api/admin/template_item/destroy",
method:"get",
params,
isLoading
})
}

@ -207,58 +207,60 @@ export default {
if (isRefresh) {
this.selectOpt.page = 1;
}
switch (typeof this.action) {
case "string":
this.loading = true;
axios({
baseURL: process.env.VUE_APP_BASE_API,
url: this.action,
headers: {
Authorization: "Bearer " + getToken(),
},
params:
this.reqOpt.method && this.reqOpt.method === "get"
? this.selectOpt
: "",
data:
this.reqOpt.method && this.reqOpt.method === "post"
? this.selectOpt
: "",
...this.reqOpt,
})
.then((res) => {
this.listData = this.getByStrkey(res.data, this.resProp);
this.totalData = res.data.total;
setTimeout(() => {
this.loading = false;
}, 300);
setTimeout(() => {
switch (typeof this.action) {
case "string":
this.loading = true;
axios({
baseURL: process.env.VUE_APP_BASE_API,
url: this.action,
headers: {
Authorization: "Bearer " + getToken(),
},
params:
this.reqOpt.method && this.reqOpt.method === "get"
? this.selectOpt
: "",
data:
this.reqOpt.method && this.reqOpt.method === "post"
? this.selectOpt
: "",
...this.reqOpt,
})
.catch((err) => {
console.error(err);
this.loading = false;
});
break;
case "function":
this.loading = true;
this.action({
...this.selectOpt,
...this.reqOpt,
},false)
.then((res) => {
this.listData = this.getByStrkey(res, this.resProp);
this.totalData = res.total;
setTimeout(() => {
.then((res) => {
this.listData = this.getByStrkey(res.data, this.resProp);
this.totalData = res.data.total;
setTimeout(() => {
this.loading = false;
}, 300);
})
.catch((err) => {
console.error(err);
this.loading = false;
}, 300);
})
.catch((err) => {
console.error(err);
this.loading = false;
});
break;
default:
return;
}
});
break;
case "function":
this.loading = true;
this.action({
...this.selectOpt,
...this.reqOpt,
},false)
.then((res) => {
this.listData = this.getByStrkey(res, this.resProp);
this.totalData = res.total;
setTimeout(() => {
this.loading = false;
}, 300);
})
.catch((err) => {
console.error(err);
this.loading = false;
});
break;
default:
return;
}
})
},
getByStrkey(obj, str) {
if (!str) return obj;
@ -362,6 +364,9 @@ export default {
sort() {
this.$refs.table.sort();
},
getSelection(){
return this.$refs.table?.store?.states?.selection ?? []
},
//table
delete(row, type) {
@ -431,7 +436,8 @@ export default {
type: "success",
message: "删除成功",
});
this.getTableData();
if(this.action)this.getTableData();
this.$emit('destroyed')
});
}
},
@ -801,7 +807,7 @@ export default {
{$scopedSlots.btns ? $scopedSlots.btns() : this.isCreateAuthBtns()}
</el-table>
) : (
<el-table ref="table" height={this.height ?? this.tableHeight} />
<el-table ref="table" v-loading={this.loading} height={this.height ?? this.tableHeight} />
)}
<el-backtop

@ -26,6 +26,16 @@ const data = {
id:2,
value:"年份"
}
],
"type":[
{
id:1,
value:"统招生"
},
{
id:2,
value:"提前招生"
}
]
}

@ -96,11 +96,22 @@ const componentHandler = (path) => {
// path为#,左边栏根目录无视图,##下级根目录无视图,$不显示在左边栏视图,^左边栏根目录有视图
export function generaMenu(routes, data) {
data.forEach(item => {
let params;
let params = {};
if(item.path?.includes('?')){
let flag = item.path.split('?')
item.path = flag[0]
params = flag[1]
if(flag[1]){
let list = flag[1].split('&')
list.forEach(item => {
let kv = item.split('=')
Object.defineProperty(params,kv[0],{
value:kv[1],
writable:true,
enumerable:true,
configurable:false
})
})
}
}
if (item.url === "/") {
@ -141,7 +152,7 @@ export function generaMenu(routes, data) {
id: item.id,
roles: ['admin'],
auths:item.has_auth_node_tags,
params,
icon: item.icon
}
}

@ -34,7 +34,7 @@
<addProvince
ref="addProvince"
@refresh="$refs['xyTable'].getTableData(true)"
@refresh="$refs['xyTable'].getTableData()"
></addProvince>
</div>
</template>

@ -39,7 +39,7 @@
<add-specialize
ref="addSpecialize"
@refresh="$refs['xyTable'].getTableData(true)"
@refresh="$refs['xyTable'].getTableData()"
></add-specialize>
</div>
</template>

@ -9,37 +9,49 @@ export default {
title={this.type === "add" ? "新增统招生" : "编辑统招生"}
width="54"
value={this.isShow}
loading={true}
on={{
["on-visible-change"]: (e) => this.$emit("update:isShow", e),
["on-ok"]: (e) => {
this.$refs['oriElForm'].validate().then(res => {
if (res){
let fileds = []
for(let key in this.form){
let temp = {}
temp[key] = this.form[key]
fileds.push(temp)
}
this.$refs['elForm'].validate().then(res => {
Object.defineProperty(this.originalForm,'fileds',{
enumerable:true,
writable:true,
configurable:false,
value:fileds
})
}}
scopedSlots={{
footer: () => {
return (
<div>
<Button
on={{
["click"]: (e) => {
this.$emit("update:isShow", false);
},
}}
>
取消
</Button>
<Button type="primary" on={{ ["click"]: (e) => {
this.$refs["oriElForm"].validate().then((res) => {
if (res) {
this.$refs["elForm"].validate().then((res) => {
Object.defineProperty(this.originalForm, "fileds", {
enumerable: true,
writable: true,
configurable: false,
value: this.form,
});
save(this.originalForm).then(res => {
this.$message({
type:'success',
message:res.msg
})
this.$emit("refresh")
this.$emit("update:isShow", false)
})
})
}
})
save(this.originalForm).then((res) => {
this.$message({
type: "success",
message: res.msg,
});
this.$emit("refresh");
this.$emit("update:isShow", false);
});
});
}
});
} }}>
确认
</Button>
</div>
);
},
}}
>
@ -212,6 +224,7 @@ export default {
idcard: "",
candidate_no: "",
allow_no: "",
template_id: "",
},
originalRules: {
year: [{ required: true, message: "请选择年份", trigger: "blur" }],

@ -60,7 +60,8 @@ export default {
form: {
year: "",
remark: "",
is_open:0
is_open:0,
type:this.$route.meta.params.type
},
rules: {
year: [
@ -75,7 +76,7 @@ export default {
methods: {
async getDetail() {
const res = await show({
id: this.id,
id: this.id
},true);
this.$integrateData(this.form, res);
},

@ -0,0 +1,127 @@
<template>
<div>
<xy-dialog ref="dialog" :is-show.sync="isShow" type="form" :title="type === 'add' ? '新增模板介绍' : '编辑模板介绍'" :form="form" :rules="rules" @submit="submit">
<template v-slot:template_id>
</template>
<template v-slot:is_open>
<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-switch style="width: 300px;" v-model="form.is_open" :active-value="1" :inactive-value="0"></el-switch>
</div>
</div>
</template>
<template v-slot:name>
<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-input v-model="form.name " clearable placeholder="请输入名称 " style="width: 300px;" />
</div>
</div>
</template>
<template v-slot:content>
<div class="xy-table-item">
<div class="xy-table-item-label">
内容
</div>
<div class="xy-table-item-content">
<el-input type="textarea" :autosize="{minRows:2}" v-model="form.content " clearable placeholder="请输入内容 " style="width: 300px;" />
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import {
show,
save
} from '@/api/unifiedRecruitment/templateItem';
export default {
props:{
},
data() {
return {
isShow: false,
id: '',
type: '',
form: {
template_id: "",
is_open: "",
name: "",
content: "",
},
rules: {
is_open: [{
required: true,
message: "请填写是否可查询"
}],
name: [{
required: true,
message: "请填写名称"
}],
}
}
},
methods: {
async getDetail() {
const res = await show({id:this.id})
this.$integrateData(this.form, res)
},
submit() {
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')
})
}
},
watch: {
isShow(val) {
if (val) {
if (this.type === 'editor') {
this.getDetail()
}
} else {
this.id = ''
this.type = ''
this.$refs['dialog'].reset()
delete this.form.id
}
}
}
}
</script>
<style scoped lang="scss">
::v-deep .el-input__inner {
text-align: left;
}
.xy-table-item-label{
width: 160px;
}
</style>

@ -0,0 +1,224 @@
<template>
<div>
<Modal
title="数据导入"
width="80"
:loading="true"
:value.sync="isShow"
@on-visible-change="(e) => $emit('update:isShow', e)"
@on-ok="submit"
>
<div class="select">
<div class="select__item">
<span style="color: red;">*</span><span>年份</span>
<el-date-picker size="small" placeholder="请选择年份" v-model="select.year" value-format="yyyy" type="year" style="width: 200px;"></el-date-picker>
</div>
<div class="select__item">
<span style="color: red;">*</span><span>省份</span>
<el-select size="small" placeholder="请选择省份" v-model="select.province_id" style="width: 200px;">
<el-option v-for="item in province_ids" :value="item.id" :key="item.id" :label="item.name"></el-option>
</el-select>
</div>
<div class="select__item">
<span></span>
<span>更新统招进度为录取结束</span>
<el-checkbox v-model="select.isEnd" :true-label="1" :false-label="0"></el-checkbox>
</div>
</div>
<div class="upload">
<el-upload
class="upload-demo"
ref="upload"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
:headers="{
'Authorization':`Bearer ${getToken()}`
}"
:data="select"
: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>
<xy-table :is-page="false" :list="list" :table-item="table" style="margin-top: 10px;">
<template v-slot:btns></template>
</xy-table>
<template v-slot:footer>
<Button @click="$emit('update:isShow', false)">取消</Button>
<Button type="primary" @click="submit"></Button>
</template>
</Modal>
</div>
</template>
<script>
import {
getToken
} from '@/utils/auth'
import {show as templateShow} from "@/api/unifiedRecruitment/template";
import { imports } from '@/api/unifiedRecruitment/recruit'
export default {
props: {
isShow: {
type: Boolean,
default: false,
},
province_ids:Array
},
data() {
return {
action: `${process.env.VUE_APP_BASE_API}/api/admin/recruit/excel_analyse`,
fileList:[],
select:{
year:'',
province_id:'',
template_id:'',
isEnd:0
},
list:[],
table:[],
newTable:[],
originalTable: [
{
prop: "name",
label: "姓名",
width: 140,
},
{
prop: "idcard",
label: "身份证号",
width: 180,
sortable: true,
},
{
prop: "candidate_no",
label: "考生号",
minWidth: 180,
sortable: true,
},
{
prop: "allow_no",
label: "准考证号",
minWidth: 180,
sortable: true,
},
],
};
},
methods: {
getToken,
successHandle(response, file, fileList){
this.list = response ?? []
},
errorHandle(err, file, fileList){
this.$message({
type:'error',
message:err
})
},
async getTemplate() {
const res = await templateShow(
{
year: this.select.year,
type: this.$route.meta.params?.type,
},
true
);
this.select.template_id = res.id;
this.newTable =
res?.fileds?.map((item) => {
return {
prop: item.en,
label: item.name,
width: 140,
};
}) ?? [];
this.table = [...this.originalTable, ...this.newTable];
},
submit(){
if(!this.select.year || !this.select.province_id){
this.$message({
type:'warning',
message:'请先选择年份或省份'
})
return
}
let load = this.$loading({
text:"正在导入中...",
lock:true,
background:"rgba(0,0,0,0.4)",
})
let promiseAll = this.list.map(item => {
let form = {
template_id:this.select.template_id,
year:this.select.year,
province_id:this.select.province_id,
is_end:this.select.isEnd,
detail:[item]
}
return imports(form)
})
Promise.all(promiseAll).then(res => {
this.$message({
type:'success',
message:`成功导入${res.length}`
})
this.$emit('refresh')
this.$emit('update:isShow',false)
load.close()
}).catch(err => {
console.log(err)
})
}
},
computed: {},
watch: {
async isShow(val){
if(val){
await this.getTemplate()
}
}
},
};
</script>
<style scoped lang="scss">
.select{
display: flex;
align-items: center;
&>div + div{
margin-left: 20px;
}
&__item{
&>span + span{
font-weight: 600;
padding: 0 16px;
}
}
}
.upload{
width: 30%;
margin-top: 10px;
}
</style>

@ -4,8 +4,6 @@
title="初始化"
width="60"
:value.sync="isShow"
:loading="true"
@on-ok="submit"
@on-visible-change="(e) => $emit('update:isShow', e)"
>
<div class="label">
@ -33,6 +31,11 @@
<template v-slot:btns></template>
</xy-table>
</div>
<template v-slot:footer>
<Button @click="$emit('update:isShow', false)">取消</Button>
<Button type="primary" @click="submit"></Button>
</template>
</Modal>
</div>
</template>
@ -79,6 +82,13 @@ export default {
type="date"
v-model={row.start_date}
value-format="yyyy-MM-dd"
on={
{
['change']:e => {
this.selectChange(this.$refs['xyTable'].getSelection())
}
}
}
></el-date-picker>
);
},
@ -96,6 +106,13 @@ export default {
type="date"
v-model={row.end_date}
value-format="yyyy-MM-dd"
on={
{
['change']:e => {
this.selectChange(this.$refs['xyTable'].getSelection())
}
}
}
></el-date-picker>
);
},
@ -110,7 +127,6 @@ export default {
},
methods: {
selectChange(selection) {
console.log(selection)
this.form.detail = selection.map((item) => {
return {
id: item.id,
@ -120,8 +136,6 @@ export default {
});
},
submit(){
console.log(this.form)
return
if(this.form.detail.length <= 0){
this.$message({
type:'warning',

@ -7,13 +7,48 @@
@on-ok="submit"
@on-visible-change="(e) => $emit('update:isShow', e)"
>
<div style="display: flex;align-items: center;justify-content: space-between;">
<el-tabs style="flex:1;" v-model="activeName">
<el-tab-pane label="录取考生" name="first">
<div
style="
display: flex;
align-items: center;
justify-content: space-between;
"
>
<el-tabs style="flex: 1" v-model="activeName">
<el-tab-pane
v-for="item in templateItems"
:key="item.index"
:name="item.name"
>
<template v-slot:label>
<span style="padding: 0 8px"
>{{ item.name
}}<i
class="el-icon-setting"
style="padding-left: 8px;cursor: alias"
@click="
($refs['addTemplateItem'].id = item.id),
($refs['addTemplateItem'].type = 'editor'),
($refs['addTemplateItem'].form.template_id = id),
($refs['addTemplateItem'].isShow = true)
"
></i
></span>
</template>
</el-tab-pane>
</el-tabs>
<el-button size="small" type="primary" style="margin-left: 40px;">添加<i class="el-icon-plus el-icon--right"></i></el-button>
<el-button
size="small"
type="primary"
style="margin-left: 40px"
@click="
($refs['addTemplateItem'].type = 'add'),
($refs['addTemplateItem'].form.template_id = id),
($refs['addTemplateItem'].isShow = true)
"
>添加<i class="el-icon-plus el-icon--right"></i
></el-button>
</div>
<el-button type="primary" size="small" @click="add"></el-button>
@ -27,14 +62,25 @@
<template v-slot:btns></template>
</xy-table>
</Modal>
<addTemplateItem
ref="addTemplateItem"
@refresh="getTemplateItem"
></addTemplateItem>
</div>
</template>
<script>
import { index as templateItemIndex } from "@/api/unifiedRecruitment/templateItem";
import { index, save, destroy } from "@/api/unifiedRecruitment/templateFiled";
import { show } from "@/api/unifiedRecruitment/template";
import { getConst } from "@/const";
import addTemplateItem from "./addTemplateItem.vue";
export default {
components: {
addTemplateItem,
},
props: {
isShow: {
type: Boolean,
@ -47,40 +93,41 @@ export default {
visiblePopover: false,
popIndex: "",
id: "",
activeName: "first",
activeName: "",
select: {},
form: {},
templateItems: [],
list: [],
originalList: [
{
name:"年份",
student_query:1,
type:2,
remark:"无"
name: "年份",
student_query: 1,
type: 2,
remark: "无",
},
{
name:"姓名",
student_query:1,
type:1,
remark:"无"
name: "姓名",
student_query: 1,
type: 1,
remark: "无",
},
{
name:"身份证号",
student_query:1,
type:1,
remark:"无"
name: "身份证号",
student_query: 1,
type: 1,
remark: "无",
},
{
name:"考生号",
student_query:1,
type:1,
remark:"无"
name: "考生号",
student_query: 1,
type: 1,
remark: "无",
},
{
name:"准考证号",
student_query:1,
type:1,
remark:"无"
name: "准考证号",
student_query: 1,
type: 1,
remark: "无",
},
],
table: [
@ -248,11 +295,21 @@ export default {
};
},
methods: {
async getTemplateItem() {
const res = await templateItemIndex({
page: 1,
page_size: 999,
template_id: this.id,
});
this.templateItems = res.data;
this.activeName = this.templateItems[0]?.name;
},
async getDetail() {
const res = await show({
id: this.id,
});
this.list = [...this.originalList,...res.fileds];
this.list = [...this.originalList, ...res.fileds];
},
add() {
@ -269,9 +326,10 @@ export default {
},
computed: {},
watch: {
isShow(newVal) {
async isShow(newVal) {
if (newVal) {
this.getDetail();
await this.getTemplateItem();
await this.getDetail();
} else {
this.id = "";
}

@ -4,7 +4,7 @@
<lx-header
icon="md-apps"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
text="统招生管理"
:text="getTitleName + '管理'"
>
<div slot="content"></div>
<slot>
@ -43,16 +43,22 @@
下载模板<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="a">黄金糕</el-dropdown-item>
<el-dropdown-item>狮子头</el-dropdown-item>
<el-dropdown-item>螺蛳粉</el-dropdown-item>
<el-dropdown-item>双皮奶</el-dropdown-item>
<el-dropdown-item>蚵仔煎</el-dropdown-item>
<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="isShowImportRecruitInfo = true"
<Button
type="primary"
@click="
($refs['importRecruitInfo'].select.year = select.year),
(isShowImportRecruitInfo = true)
"
>导入录取信息</Button
>
</template>
@ -63,17 +69,20 @@
<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'].id = row.id;
$refs['addRecruit'].type = 'editor';
isShowAdd = true;
}
"
@destroyed="getList"
></xy-table>
<addRecruit
@ -87,6 +96,7 @@
ref="importRecruitInfo"
:province_ids="provinces"
:is-show.sync="isShowImportRecruitInfo"
@refresh="$refs['xyTable'].getTableData()"
></importRecruitInfo>
</div>
</template>
@ -96,6 +106,8 @@ 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 { getConst } from "@/const";
import { index as templateItemIndex } from "@/api/unifiedRecruitment/templateItem";
import addRecruit from "./component/addRecruit.vue";
import importRecruitInfo from "./component/importRecruitInfo.vue";
@ -115,8 +127,11 @@ export default {
keyword: "",
page: 1,
page_size: 10,
template_id: "",
},
templateItems: [],
total: 0,
list: [],
table: [],
originalTable: [
@ -142,7 +157,7 @@ export default {
},
{
prop: "idcard",
label: "份证号",
label: "份证号",
width: 180,
sortable: "custom",
},
@ -165,17 +180,24 @@ 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;
},
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) => {
let obj = {};
if (item.fileds) {
item.fileds.forEach((filed) => {
obj = { ...obj, ...filed };
});
}
return { ...item, ...obj };
return item.fileds ? { ...item, ...item.fileds } : item;
});
setTimeout(() => {
this.$refs['xyTable'].loading = false
},500)
},
async getProvinces() {
const res = await provinceIndex(
@ -192,9 +214,11 @@ export default {
const res = await templateShow(
{
year: this.select.year,
type: this.$route.meta.params?.type,
},
true
false
);
this.select.template_id = res.id;
let temp =
res?.fileds?.map((item) => {
return {
@ -214,15 +238,24 @@ export default {
downTemplate(command) {
exports({
year: this.select.year,
template_id: this.select.template_id,
});
},
},
computed: {},
computed: {
getTitleName() {
let map = getConst("type", "map");
return map.get(Number(this.$route.meta.params.type));
},
},
created() {
this.getTemplateItem();
this.getProvinces();
this.getTemplate();
this.getList();
},
mounted() {
this.getList();
}
};
</script>

@ -4,7 +4,7 @@
<lx-header
icon="md-apps"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
text="统招模版"
:text="getTitleName + '模板管理'"
>
<div slot="content"></div>
<slot>
@ -79,6 +79,7 @@
<script>
import { index, destroy, save } from "@/api/unifiedRecruitment/template";
import { authMixin } from "@/mixin/authMixin";
import { getConst } from "@/const";
import addTemplate from "./component/addTemplate.vue";
import setting from "./component/setting.vue";
@ -93,6 +94,7 @@ export default {
isShowSetting: false,
select: {
year: "",
type: this.$route.meta.params.type
},
table: [
@ -136,8 +138,17 @@ export default {
methods: {
index,
destroy,
getConst,
},
computed: {},
computed: {
getTitleName(){
let map = getConst('type','map')
return map.get(Number(this.$route.meta.params?.type))
}
},
created() {
}
};
</script>

@ -1,99 +0,0 @@
<template>
<div>
<Modal
title="数据导入"
width="80"
:value.sync="isShow"
@on-visible-change="(e) => $emit('update:isShow', e)"
>
<div class="select">
<div class="select__item">
<span>年份</span>
<el-date-picker size="small" placeholder="请选择年份" v-model="select.year" value-format="yyyy" type="year" style="width: 200px;"></el-date-picker>
</div>
<div class="select__item">
<span>省份</span>
<el-select size="small" placeholder="请选择省份" v-model="select.province_id" style="width: 200px;">
<el-option v-for="item in province_ids" :value="item.id" :key="item.id" :label="item.name"></el-option>
</el-select>
</div>
<div class="select__item">
<span>更新统招进度为录取结束</span>
<el-checkbox></el-checkbox>
</div>
</div>
<div class="upload">
<el-upload
class="upload-demo"
ref="upload"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
:headers="{
'Authorization':`Bear ${getToken()}`
}"
:data="select"
:action="action"
:file-list="fileList"
: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>
</Modal>
</div>
</template>
<script>
import {
getToken
} from '@/utils/auth'
export default {
props: {
isShow: {
type: Boolean,
default: false,
},
province_ids:Array
},
data() {
return {
action: `${process.env.VUE_APP_BASE_API}/api/admin/recruit/excel_analyse`,
fileList:[],
select:{
year:'',
province_id:''
}
};
},
methods: {
getToken,
},
computed: {},
watch: {},
};
</script>
<style scoped lang="scss">
.select{
display: flex;
align-items: center;
&__item{
&>span{
font-weight: 600;
padding: 0 16px;
}
}
}
.upload{
width: 30%;
margin-top: 10px;
}
</style>

@ -1,48 +1,80 @@
<template>
<div>
<xy-dialog ref="dialog" :is-show.sync="isShow" type="form" :title="type === 'add' ? '新增历年分数' : '编辑历年分数'" :form="form" :rules="rules" @submit="submit">
<xy-dialog
ref="dialog"
:is-show.sync="isShow"
type="form"
:title="type === 'add' ? '新增历年分数' : '编辑历年分数'"
:form="form"
:rules="rules"
@submit="submit"
>
<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>
<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>
<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:province_ids>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>
省份
</div>
<div class="xy-table-item-content">
<el-select multiple v-model="form.province_ids" clearable placeholder="请选择省份" style="width: 300px;">
<el-option v-for="item in province_lists" :key="item.id" :label="item.name" :value="item.id"></el-option>
<el-select
multiple
v-model="form.province_ids"
clearable
placeholder="请选择省份"
style="width: 300px"
>
<el-option
v-for="item in province_lists"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:remark>
<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">
<el-input type="textarea" :autosize="{minRows:2}" v-model="form.remark " clearable placeholder="请输入备注 " style="width: 300px;" />
<el-input
type="textarea"
:autosize="{ minRows: 2 }"
v-model="form.remark"
clearable
placeholder="请输入备注 "
style="width: 300px"
/>
</div>
</div>
</template>
<template v-slot:file_ids>
<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">
<el-upload
style="width: 300px;"
style="width: 300px"
ref="upload"
multiple
:on-success="successHandle"
@ -50,10 +82,23 @@
accept="application/x-rar-compressed,application/zip,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf"
:action="action"
:file-list="fileList"
: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">支持文件格式.rar .zip .doc .docx .pdf <br>单个文件不能超过500kb</div>
:auto-upload="false"
:on-remove="removeHande"
>
<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">
支持文件格式.rar .zip .doc .docx .pdf
<br />单个文件不能超过500kb
</div>
</el-upload>
</div>
</div>
@ -63,158 +108,172 @@
</template>
<script>
import {
show,
save
} from '@/api/yearScore/yearScore';
export default {
props:{
province_lists: {
type:Array,
default:()=>[]
},
import { show, save } from "@/api/yearScore/yearScore";
export default {
props: {
province_lists: {
type: Array,
default: () => [],
},
data() {
return {
isShow: false,
id: '',
type: '',
action: process.env.VUE_APP_UPLOAD_API,
fileList:[],
},
data() {
return {
isShow: false,
id: "",
type: "",
action: process.env.VUE_APP_UPLOAD_API,
fileList: [],
form: {
year: "",
province_ids: "",
remark: "",
file_ids: "",
},
rules: {
year: [{
form: {
year: "",
province_ids: "",
remark: "",
file_ids: "",
},
rules: {
year: [
{
required: true,
message: "请填写年份"
}],
province_ids: [{
message: "请填写年份",
},
],
province_ids: [
{
required: true,
message: "请填写录取查询省份说明"
}],
}
message: "请填写录取查询省份说明",
},
],
},
};
},
methods: {
//
successHandle(response, file, fileList) {
this.fileList = fileList;
},
removeHande(file,fileList){
this.fileList = fileList
},
uploadBefore(file) {
console.log(file);
if (file.size / 1000 > 500) {
this.$message({
type: "warning",
message: "上传图片大小超过500kb",
});
return false;
}
},
methods: {
//
successHandle(response, file, fileList){
this.fileList = fileList
},
uploadBefore(file) {
console.log(file)
if ((file.size / 1000) > 500) {
this.$message({
type: 'warning',
message: '上传图片大小超过500kb'
})
return false
}
},
async getDetail() {
const res = await show(this.id)
this.$integrateData(this.form, res)
},
async getDetail() {
let res = await show({
id: this.id,
});
res.year = String(res?.year)
res.province_ids = res?.province_ids?.map(item => Number(item))
this.fileList = res.files.map(item => {
return {
name:item.original_name,
url:item.url,
response:item
}
})
this.$integrateData(this.form, res);
},
submit() {
this.form.file_ids = this.fileList.map(item => {
return item?.response?.id
})
submit() {
this.form.file_ids = this.fileList.map((item) => {
return item?.response?.id;
});
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
})
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
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,
});
}
save(this.form).then((res) => {
this.$successMessage(this.type, "");
this.isShow = false;
this.$emit("refresh");
});
},
watch: {
isShow(val) {
if (val) {
if (this.type === 'editor') {
this.getDetail()
}
} else {
this.id = ''
this.type = ''
this.fileList = []
this.$refs['dialog'].reset()
delete this.form.id
},
watch: {
isShow(val) {
if (val) {
if (this.type === "editor") {
this.getDetail();
}
} else {
this.id = "";
this.type = "";
this.fileList = [];
this.$refs["dialog"].reset();
delete this.form.id;
}
}
}
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-input__inner {
text-align: left;
}
.img__delete {
transform: scale(0.8, 0.8);
::v-deep .el-input__inner {
text-align: left;
}
position: absolute;
top: 4px;
right: 4px;
}
.img__delete {
transform: scale(0.8, 0.8);
::v-deep .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
position: absolute;
top: 4px;
right: 4px;
}
::v-deep .avatar-uploader .el-upload:hover {
border-color: $primaryColor;
}
::v-deep .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
::v-deep .el-upload--picture-card {
font-size: 28px;
color: #8c939d;
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
text-align: center;
}
::v-deep .avatar-uploader .el-upload:hover {
border-color: $primaryColor;
}
::v-deep .avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
text-align: center;
}
::v-deep .el-upload--picture-card {
font-size: 28px;
color: #8c939d;
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
text-align: center;
}
::v-deep .avatar {
width: 80px !important;
display: block;
border-radius: 6px;
}
::v-deep .avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
text-align: center;
}
::v-deep .el-input__inner {
text-align: left;
}
::v-deep .avatar {
width: 80px !important;
display: block;
border-radius: 6px;
}
::v-deep .el-input__inner {
text-align: left;
}
</style>

@ -15,17 +15,19 @@
</el-select>
</div>
<div style="margin-top: 6px;display: flex;align-items: flex-start;">
<el-button size="small" type="primary" @click="">下载导入模板</el-button>
<el-button size="small" type="primary" @click="downLoad"></el-button>
<el-upload
style="margin-left: 10px;"
ref="upload"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
:headers="{
'Authorization':`Bear ${ getToken() }`
'Authorization':`Bearer ${getToken()}`
}"
:data="select"
: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>
@ -36,18 +38,23 @@
<xy-table
ref="xyTable"
:action="index"
:req-opt="select"
:is-page="false"
:list="list"
:table-item="table"
>
<template v-slot:btns></template>
</xy-table>
<template v-slot:footer>
<Button @click="$emit('update:isShow',false)"></Button>
<Button type="primary" @click="submit"></Button>
</template>
</Modal>
</div>
</template>
<script>
import { index } from "@/api/yearScore/yearScoreDetail"
import { index,imports} from "@/api/yearScore/yearScoreDetail"
import { getToken } from "@/utils/auth"
export default {
props: {
@ -64,10 +71,7 @@ export default {
return {
action:`${process.env.VUE_APP_BASE_API}/api/admin/year_socre_detail/excel_analyse`,
fileList:[],
select:{
year:String(new Date().getFullYear()),
province_id:''
},
list:[],
table: [
],
@ -81,6 +85,18 @@ export default {
index,
getToken,
downLoad(){
},
successHandle(response, file, fileList){
this.list = response ?? []
},
errorHandle(err, file, fileList){
this.$message({
type:'error',
message:err
})
},
submit(){
if(this.form.detail.length <= 0){
this.$message({
@ -89,12 +105,18 @@ export default {
})
return
}
init(this.form).then(res => {
let promiseAll = this.list.map(item => {
return imports(item)
})
Promise.all(promiseAll).then(res => {
this.$message({
type:'success',
message:"初始化成功"
message:`成功导入${res.length}`
})
this.$emit("update:isShow",false)
this.$emit('refresh')
this.$emit('update:isShow',false)
}).catch(err => {
console.log(err)
})
}
},

@ -124,7 +124,7 @@ export default {
plain={true}
on={{
["click"]: (e) => {
this.showImport(row, val);
this.showImport(row, Number(val));
},
}}
>

Loading…
Cancel
Save