master
xy 3 years ago
parent 367f240ac3
commit add09862de

@ -0,0 +1,59 @@
import request from "@/utils/request";
import qs from 'qs';
export function index(params,isLoading = true){
return request({
url:"/api/admin/year_socre_detail/index",
method:"get",
isLoading,
params
})
}
export function show(params,isLoading = true){
return request({
url:"/api/admin/year_socre_detail/show",
method:"get",
isLoading,
params
})
}
export function save(data,isLoading = true){
return request({
url:"/api/admin/year_socre_detail/save",
method:"post",
data,
isLoading
})
}
export function destroy(params,isLoading = true){
return request({
url:"/api/admin/year_socre_detail/destroy",
method:"get",
params,
isLoading
})
}
export function excelAnalyse(data,isLoading = true){
return request({
url:"/api/admin/year_socre_detail/excel_analyse",
method:"post",
data,
isLoading
})
}
export function imports(data,isLoading = true){
return request({
url:"/api/admin/year_socre_detail/import",
method:"post",
data:qs.stringify(data),
isLoading,
headers:{
'Content-Type':'application/x-www-form-urlencoded'
}
})
}

@ -618,7 +618,7 @@ export default {
} }
}, },
created() { created() {
this.getTableData(); if(this.action) this.getTableData();
}, },
mounted() { mounted() {
this.initLoad(); this.initLoad();
@ -692,7 +692,7 @@ export default {
["expand-change"]: this.expandChange, ["expand-change"]: this.expandChange,
}} }}
> >
{this.tableItem.map((item, index) => { {this.tableFormat.map((item, index) => {
if ($scopedSlots[item.prop]) { if ($scopedSlots[item.prop]) {
return $scopedSlots[item.prop](item, index); return $scopedSlots[item.prop](item, index);
} }

@ -60,17 +60,27 @@ const state = {
* 后台查询的菜单数据拼装成路由格式的数据 * 后台查询的菜单数据拼装成路由格式的数据
* @param routes * @param routes
*/ */
const pathHandler = (path,id) => { const pathHandler = (item) => {
if(path.includes('$')){ if(!item.path || item.path?.includes('#') || item.path == ''){
return path.replace(/^\$+/g,"") return item.id + '_key'
} }
if(path.includes('^')){ if(/^\^/.test(item.path)){
return path.replace(/^\^+/g,"") return item.path.replace(/^\^+/g,"")
} }
if(path.includes('#') || path == ''){ if(/^\$/.test(item.path)){
return id + '_key' return item.path.replace(/^\$+/g,"")
} }
return path return item.path
// if(path.includes('$')){
// return path.replace(/^\$+/g,"")
// }
// if(path.includes('^')){
// return path.replace(/^\^+/g,"")
// }
// if(path.includes('#') || path == ''){
// return id + '_key'
// }
// return path
} }
const componentHandler = (path) => { const componentHandler = (path) => {
//return path === '#'|| path == '' ? Layout : loadView(path) //return path === '#'|| path == '' ? Layout : loadView(path)
@ -80,34 +90,34 @@ const componentHandler = (path) => {
if(path.includes('#') && path !== '#'){ if(path.includes('#') && path !== '#'){
return ()=>import('@/layout/noLayout') return ()=>import('@/layout/noLayout')
} }
if(path.includes('$')){
return loadView(path.replace(/^\$+/g,""))
}
if(path.includes('^')){
return loadView(path.replace(/^\^+/g,""))
}
return loadView(path) return loadView(path)
} }
// 为#,左边栏根目录无视图,##下级根目录无视图,$不显示在左边栏视图,^左边栏根目录有视图 // path为#,左边栏根目录无视图,##下级根目录无视图,$不显示在左边栏视图,^左边栏根目录有视图
export function generaMenu(routes, data) { export function generaMenu(routes, data) {
data.forEach(item => { data.forEach(item => {
let params;
if(item.path?.includes('?')){
let flag = item.path.split('?')
item.path = flag[0]
params = flag[1]
}
if (item.url === "/") { if (item.url === "/") {
} else if(/^\^/.test(item.url)){ } else if(/^\^/.test(item.path)){
const menu = { const menu = {
path: pathHandler(item.url,item.id), path: pathHandler(item),
component: Layout, component: Layout,
children: [{ children: [{
path: "", path: "",
name: 'menu_' + item.id, name: 'menu_' + item.id,
component: componentHandler(item.url), component: (item.url.includes('#')||item.path == '') ? Layout : loadView(item.url),
meta: { meta: {
title: item.name, title: item.name,
id: item.id, id: item.id,
roles: ['admin'], roles: ['admin'],
auths:item.has_auth_node_tags, auths:item.has_auth_node_tags,
params,
icon: item.icon icon: item.icon
} }
@ -119,7 +129,7 @@ export function generaMenu(routes, data) {
routes.push(menu) routes.push(menu)
} else { } else {
const menu = { const menu = {
path: pathHandler(item.url,item.id), path: pathHandler(item),
//(item.path === '#'||item.path == '' ? item.id + '_key' : item.path), //(item.path === '#'||item.path == '' ? item.id + '_key' : item.path),
component: componentHandler(item.url), component: componentHandler(item.url),
//(item.path === '#'||item.path == '' ? Layout : loadView(item.path)), //(item.path === '#'||item.path == '' ? Layout : loadView(item.path)),
@ -135,7 +145,7 @@ export function generaMenu(routes, data) {
icon: item.icon icon: item.icon
} }
} }
if(item.url.includes("$")){ if(item.path?.includes("$")){
menu.hidden = true menu.hidden = true
} }
if (item.children) { if (item.children) {
@ -143,12 +153,13 @@ export function generaMenu(routes, data) {
} }
routes.push(menu) routes.push(menu)
} }
}) })
routes.push({ // routes.push({
path: '*', // path: '*',
redirect: '/404', // redirect: '/404',
hidden: true // hidden: true
}) // })
} }
const mutations = { const mutations = {

@ -3,7 +3,7 @@
<Modal <Modal
title="数据导入" title="数据导入"
width="80" width="80"
:value="isShow" :value.sync="isShow"
@on-visible-change="(e) => $emit('update:isShow', e)" @on-visible-change="(e) => $emit('update:isShow', e)"
> >
<div class="select"> <div class="select">

@ -2,8 +2,8 @@
<div> <div>
<Modal <Modal
title="初始化" title="初始化"
width="52" width="60"
:value="isShow" :value.sync="isShow"
:loading="true" :loading="true"
@on-ok="submit" @on-ok="submit"
@on-visible-change="(e) => $emit('update:isShow', e)" @on-visible-change="(e) => $emit('update:isShow', e)"
@ -17,13 +17,7 @@
placeholder="年份选择" placeholder="年份选择"
style="width: 160px" style="width: 160px"
value-format="yyyy" value-format="yyyy"
v-model="select.year" v-model="form.year"
@change="
(e) => {
$refs['xyTable'].getTableData();
form.year = e;
}
"
></el-date-picker> ></el-date-picker>
</div> </div>
@ -31,8 +25,7 @@
<div class="label_title">录取省份</div> <div class="label_title">录取省份</div>
<xy-table <xy-table
ref="xyTable" ref="xyTable"
:action="index" :list="provincesList"
:req-opt="select"
:is-page="false" :is-page="false"
:table-item="table" :table-item="table"
@selection-change="selectChange" @selection-change="selectChange"
@ -45,7 +38,7 @@
</template> </template>
<script> <script>
import { index,init } from "@/api/unifiedRecruitment/progress"; import { init } from "@/api/unifiedRecruitment/progress";
export default { export default {
props: { props: {
@ -60,11 +53,7 @@ export default {
}, },
data() { data() {
return { return {
select: { provincesList:[],
year: String(new Date().getFullYear()),
page_size: 9999,
page: 1,
},
table: [ table: [
{ {
width: 60, width: 60,
@ -73,16 +62,9 @@ export default {
type: "selection", type: "selection",
}, },
{ {
prop: "province_id", prop: "name",
label: "省份", label: "省份",
width: 140, width: 140,
formatter: (cell, data, val) => {
return (
this.provinces.filter((item) => {
return val === item.id;
})[0]?.name || val
);
},
}, },
{ {
prop: "start_date", prop: "start_date",
@ -127,8 +109,8 @@ export default {
}; };
}, },
methods: { methods: {
index,
selectChange(selection) { selectChange(selection) {
console.log(selection)
this.form.detail = selection.map((item) => { this.form.detail = selection.map((item) => {
return { return {
id: item.id, id: item.id,
@ -138,6 +120,8 @@ export default {
}); });
}, },
submit(){ submit(){
console.log(this.form)
return
if(this.form.detail.length <= 0){ if(this.form.detail.length <= 0){
this.$message({ this.$message({
type:'warning', type:'warning',
@ -161,6 +145,16 @@ export default {
this.$refs["xyTable"].getTableData(); this.$refs["xyTable"].getTableData();
} }
}, },
provinces(newVal){
this.provincesList = newVal.map(item => {
return {
id:item.id,
name:item.name,
start_date:"",
end_date:""
}
})
}
}, },
}; };
</script> </script>

@ -3,24 +3,29 @@
<Modal <Modal
title="模板设置" title="模板设置"
width="80" width="80"
:value="isShow" :value.sync="isShow"
@on-ok="submit" @on-ok="submit"
@on-visible-change="(e) => $emit('update:isShow', e)" @on-visible-change="(e) => $emit('update:isShow', e)"
> >
<el-tabs v-model="activeName"> <div style="display: flex;align-items: center;justify-content: space-between;">
<el-tab-pane label="录取考生" name="first"> <el-tabs style="flex:1;" v-model="activeName">
<el-button type="primary" size="small" @click="add"></el-button> <el-tab-pane label="录取考生" name="first">
<xy-table </el-tab-pane>
ref="xyTable" </el-tabs>
:list="list"
:table-item="table" <el-button size="small" type="primary" style="margin-left: 40px;">添加<i class="el-icon-plus el-icon--right"></i></el-button>
style="margin-top: 10px" </div>
:is-page="false"
> <el-button type="primary" size="small" @click="add"></el-button>
<template v-slot:btns></template> <xy-table
</xy-table> ref="xyTable"
</el-tab-pane> :list="list"
</el-tabs> :table-item="table"
style="margin-top: 10px"
:is-page="false"
>
<template v-slot:btns></template>
</xy-table>
</Modal> </Modal>
</div> </div>
</template> </template>

@ -38,7 +38,18 @@
> >
</template> </template>
<template v-slot:export> <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 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-menu>
</el-dropdown>
</template> </template>
<template v-slot:import> <template v-slot:import>
<Button type="primary" @click="isShowImportRecruitInfo = true" <Button type="primary" @click="isShowImportRecruitInfo = true"
@ -200,7 +211,7 @@ export default {
await this.getList(); await this.getList();
}, },
downTemplate() { downTemplate(command) {
exports({ exports({
year: this.select.year, year: this.select.year,
}); });

@ -12,15 +12,15 @@
</div> </div>
</div> </div>
</template> </template>
<template v-slot:province_list> <template v-slot:province_ids>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <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>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-select multiple value-key="province_id" v-model="form.province_list" clearable placeholder="请选择省份" style="width: 300px;"> <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="{province_id:item.id}"></el-option> <el-option v-for="item in province_lists" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
@ -84,7 +84,7 @@
form: { form: {
year: "", year: "",
province_list: "", province_ids: "",
remark: "", remark: "",
file_ids: "", file_ids: "",
}, },
@ -93,7 +93,7 @@
required: true, required: true,
message: "请填写年份" message: "请填写年份"
}], }],
province_list: [{ province_ids: [{
required: true, required: true,
message: "请填写录取查询省份说明" message: "请填写录取查询省份说明"
}], }],
@ -123,9 +123,7 @@
submit() { submit() {
this.form.file_ids = this.fileList.map(item => { this.form.file_ids = this.fileList.map(item => {
return { return item?.response?.id
ids:item?.response?.id
}
}) })
if(this.type === 'add'){ if(this.type === 'add'){

@ -0,0 +1,124 @@
<template>
<div>
<Modal
: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="select.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="">下载导入模板</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() }`
}"
: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>
<xy-table
ref="xyTable"
:action="index"
:req-opt="select"
:table-item="table"
>
<template v-slot:btns></template>
</xy-table>
</Modal>
</div>
</template>
<script>
import { index } from "@/api/yearScore/yearScoreDetail"
import { getToken } from "@/utils/auth"
export default {
props: {
isShow: {
type: Boolean,
default: false,
},
provinces: {
type: Array,
default: () => [],
},
},
data() {
return {
action:`${process.env.VUE_APP_BASE_API}/api/admin/year_socre_detail/excel_analyse`,
fileList:[],
select:{
year:String(new Date().getFullYear()),
province_id:''
},
table: [
],
form: {
year: String(new Date().getFullYear()),
detail: [],
},
};
},
methods: {
index,
getToken,
submit(){
if(this.form.detail.length <= 0){
this.$message({
type:'warning',
message:"请选择需要初始化数据"
})
return
}
init(this.form).then(res => {
this.$message({
type:'success',
message:"初始化成功"
})
this.$emit("update:isShow",false)
})
}
},
computed: {},
watch: {
isShow(newVal) {
if (newVal) {
this.$refs["xyTable"].getTableData();
}
},
},
};
</script>
<style scoped lang="scss">
.label {
display: flex;
align-items: center;
&_title {
font-weight: 600;
padding: 10px 0;
margin-right: 10px;
}
}
</style>

@ -40,55 +40,135 @@
ref="xyTable" ref="xyTable"
:req-opt="select" :req-opt="select"
:action="index" :action="index"
:destroy-action="destroy"
:table-item="table" :table-item="table"
:auths="auths_auth_mixin" :auths="auths_auth_mixin"
@editor="" @editor="
></xy-table> (row) => {
$refs['addYearScore'].id = row.id;
$refs['addYearScore'].type = 'editor';
$refs['addYearScore'].isShow = true;
}
"
>
<template v-slot:import="scope">
<Button size="small" type="primary" ghost @click="showImport(scope.row)"
>导入</Button
>
</template>
</xy-table>
<addYearScore <addYearScore
ref="addYearScore" ref="addYearScore"
:province_lists="provinces" :province_lists="provinces"
@refresh="$refs['xyTable'].getTableData()" @refresh="$refs['xyTable'].getTableData()"
></addYearScore> ></addYearScore>
<imports ref="imports" :provinces="provinces" :is-show.sync="isShowImport"></imports>
</div> </div>
</template> </template>
<script> <script>
import { index } from "@/api/yearScore/yearScore"; import { index, destroy } from "@/api/yearScore/yearScore";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { index as provinceIndex } from "@/api/manage/province"; import { index as provinceIndex } from "@/api/manage/province";
import addYearScore from "./component/addYearScore.vue"; import addYearScore from "./component/addYearScore.vue";
import imports from "./component/imports.vue";
export default { export default {
mixins: [authMixin], mixins: [authMixin],
components: { components: {
addYearScore, addYearScore,
imports,
}, },
data() { data() {
return { return {
provinces:[], isShowImport: false,
provinces: [],
select: { select: {
year: "", year: "",
}, },
table: [], table: [
{
prop: "year",
label: "年份",
width: 120,
sortable: "custom",
},
{
label: "省份数",
width: 100,
customFn: (row) => {
return <span>{row.province_ids.length ?? 0}</span>;
},
},
{
prop: "remark",
label: "备注",
minWidth: 240,
align: "left",
},
{
label: "具体省份",
minWidth: 180,
align: "left",
customFn: (row) => {
return (
<div>
{row.province_ids.map((val) => {
return (
<el-button
type="primary"
size="mini"
plain={true}
on={{
["click"]: (e) => {
this.showImport(row, val);
},
}}
>
{(() => {
return (
this.provinces.filter((item) => {
return item.id == val;
})[0]?.name ?? val
);
})()}
</el-button>
);
})}
</div>
);
},
},
],
}; };
}, },
methods: { methods: {
index, index,
destroy,
async getProvinces(){ async getProvinces() {
const res = await provinceIndex({ const res = await provinceIndex(
page:1, {
page_size:9999 page: 1,
},false) page_size: 9999,
this.provinces = res.data },
} false
);
this.provinces = res.data;
},
showImport(row, province_id = "") {
this.$refs["imports"].select.year = String(row.year);
this.$refs["imports"].select.province_id = province_id;
this.isShowImport = true;
},
}, },
computed: {}, computed: {},
created() { created() {
this.getProvinces() this.getProvinces();
} },
}; };
</script> </script>

Loading…
Cancel
Save