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

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

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

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

@ -3,24 +3,29 @@
<Modal
title="模板设置"
width="80"
:value="isShow"
:value.sync="isShow"
@on-ok="submit"
@on-visible-change="(e) => $emit('update:isShow', e)"
>
<el-tabs v-model="activeName">
<el-tab-pane label="录取考生" name="first">
<el-button type="primary" size="small" @click="add"></el-button>
<xy-table
ref="xyTable"
:list="list"
:table-item="table"
style="margin-top: 10px"
:is-page="false"
>
<template v-slot:btns></template>
</xy-table>
</el-tab-pane>
</el-tabs>
<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">
</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>
</div>
<el-button type="primary" size="small" @click="add"></el-button>
<xy-table
ref="xyTable"
:list="list"
:table-item="table"
style="margin-top: 10px"
:is-page="false"
>
<template v-slot:btns></template>
</xy-table>
</Modal>
</div>
</template>

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

@ -12,15 +12,15 @@
</div>
</div>
</template>
<template v-slot:province_list>
<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>
省份
</div>
<div class="xy-table-item-content">
<el-select multiple value-key="province_id" v-model="form.province_list" 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-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>
@ -84,7 +84,7 @@
form: {
year: "",
province_list: "",
province_ids: "",
remark: "",
file_ids: "",
},
@ -93,7 +93,7 @@
required: true,
message: "请填写年份"
}],
province_list: [{
province_ids: [{
required: true,
message: "请填写录取查询省份说明"
}],
@ -123,9 +123,7 @@
submit() {
this.form.file_ids = this.fileList.map(item => {
return {
ids:item?.response?.id
}
return item?.response?.id
})
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"
:req-opt="select"
:action="index"
:destroy-action="destroy"
:table-item="table"
:auths="auths_auth_mixin"
@editor=""
></xy-table>
@editor="
(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
ref="addYearScore"
:province_lists="provinces"
@refresh="$refs['xyTable'].getTableData()"
></addYearScore>
<imports ref="imports" :provinces="provinces" :is-show.sync="isShowImport"></imports>
</div>
</template>
<script>
import { index } from "@/api/yearScore/yearScore";
import { index, destroy } from "@/api/yearScore/yearScore";
import { authMixin } from "@/mixin/authMixin";
import { index as provinceIndex } from "@/api/manage/province";
import addYearScore from "./component/addYearScore.vue";
import imports from "./component/imports.vue";
export default {
mixins: [authMixin],
components: {
addYearScore,
imports,
},
data() {
return {
provinces:[],
isShowImport: false,
provinces: [],
select: {
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: {
index,
destroy,
async getProvinces(){
const res = await provinceIndex({
page:1,
page_size:9999
},false)
this.provinces = res.data
}
async getProvinces() {
const res = await provinceIndex(
{
page: 1,
page_size: 9999,
},
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: {},
created() {
this.getProvinces()
}
this.getProvinces();
},
};
</script>

Loading…
Cancel
Save