master
xy 1 year ago
parent 462d7cfb40
commit a713428e23

@ -22,6 +22,22 @@
>
<template v-if="isHasAuth('search')">
<el-input style="width: 120px;" v-model="select['filter[1][value]']" placeholder="学校名称.." size="small"></el-input>
<el-select
style="width: 120px;"
v-model="select['type']"
clearable
placeholder="请选择学校类型"
multiple
collapse-tags
size="small"
>
<el-option
v-for="(option, optionIndex) in schoolType"
:key="optionIndex"
:label="option['label']"
:value="option['value']"
></el-option>
</el-select>
<el-select style="width: 100px;" clearable v-model="select['filter[0][value]']" placeholder="区域.." size="small">
<el-option v-for="item in area" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
@ -425,6 +441,7 @@ export default {
'filter[3][key]': 'from',
'filter[3][op]': 'eq',
'filter[3][value]': '',
'type': [],
},
total: 0,
allAlign: null,

@ -46,6 +46,31 @@
>搜索</el-button
>
</template>
<el-popover
v-if="isHasAuth('import')"
placement="bottom-start"
title="导入"
width="400"
trigger="click">
<template #reference>
<el-button style="margin-left: 10px;" type="primary" size="small" icon="el-icon-upload">导入</el-button>
</template>
<template #default>
<el-upload
ref="upload"
:action="action"
:on-success="uploadSuccess"
accept=".xls,.xlsx"
:headers="{
'Authorization': 'Bearer ' + getToken()
}"
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="uploadData"></el-button>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件</div>
</el-upload>
</template>
</el-popover>
</template>
</vxe-toolbar>
</slot>
@ -286,6 +311,7 @@ export default {
},
data() {
return {
action: `${process.env.VUE_APP_BASE_API}/api/admin/score/import`,
uploadSize,
examineKey: 0,
isShowAdd: false,
@ -346,8 +372,9 @@ export default {
},
},
created() {
this.getArea();
this.getSchool();
this.getArea().then(_ => {
this.getSchool();
})
this.getList();
},
@ -356,6 +383,19 @@ export default {
this.calcTableHeight();
},
methods: {
getToken,
uploadData() {
this.$refs.upload.submit();
},
uploadSuccess(response) {
console.log(response)
if (response.hasOwnProperty('errcode')) {
this.$message.error(response.errmsg)
} else {
this.$message.success(`已导入${response.total}`)
this.getList(true)
}
},
exportMethod() {
this.$confirm("请选择导出方式", "提示", {
confirmButtonText: "全量导出",

@ -24,9 +24,7 @@
<el-descriptions-item label="所属学校">
{{
school.find((i) => i["id"] === form["school_id"])
? school.find((i) => i["id"] === form["school_id"])["name"]
: ""
form['school'] ? form['school'].name : ''
}}
</el-descriptions-item>
@ -96,7 +94,7 @@ export default {
code: "",
school_id: "",
school: "",
year: "",
total_score: "",
@ -122,6 +120,7 @@ export default {
try {
const detail = await show({
id,
show_relation: ['school']
});
for (let key in this.form) {
if (detail.hasOwnProperty(key)) {

@ -22,15 +22,27 @@
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
<template v-if="isHasAuth('search')">
<el-cascader
size="small"
v-model="select['filter[0][value]']"
:options="school"
style="margin-left: 10px;"
:props="{
emitPath: false,
value: 'id',
label: 'name',
}"></el-cascader>
<el-button
style="margin-left: 10px;"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
>
</template>
<el-popover
v-if="isHasAuth('import')"
placement="bottom-start"
@ -120,16 +132,23 @@
<vxe-column
align="center"
field="school_id"
field="school.name"
width="180"
title="学校"
:edit-render="{
name: 'VxeSelect',
options: school,
props: { multiple: false },
optionProps: { value: 'id', label: 'name' },
}"
/>
:edit-render="{}"
>
<template #edit="{ row }">
<el-cascader
size="small"
v-model="row['school_id']"
:options="school"
:props="{
emitPath: false,
value: 'id',
label: 'name',
}"></el-cascader>
</template>
</vxe-column>
<vxe-column
header-align="center"
@ -246,6 +265,7 @@ import axios from "axios";
import { getToken } from "@/utils/auth";
import { index as schoolIndex } from "@/api/school/school";
import {index as areaIndex} from "@/api/area/area";
export default {
name: "Specialty",
@ -268,7 +288,10 @@ export default {
page: 1,
page_size: 20,
keyword: "",
show_relation: [],
show_relation: ['school'],
"filter[0][key]": 'school_id',
"filter[0][op]": 'eq',
"filter[0][value]": '',
},
total: 0,
allAlign: null,
@ -304,7 +327,9 @@ export default {
},
},
created() {
this.getSchool();
this.getArea().then(_ => {
this.getSchool();
})
this.getList();
},
@ -391,7 +416,20 @@ export default {
await this.$refs["ShowSpecialty"].getDetail(row.id);
this.isShowDetail = true;
},
async getArea() {
try {
const res = await areaIndex(
{
page: 1,
page_size: 999,
},
false
);
this.area = res.data;
} catch (err) {
console.error(err);
}
},
async getSchool() {
try {
const res = await schoolIndex(
@ -401,7 +439,11 @@ export default {
},
false
);
this.school = res.data;
this.school = this.area.map(area => ({
...area,
children: res.data.filter(school => school.area_id === area.id)
}))
} catch (err) {
console.error(err);
}

@ -30,20 +30,17 @@
</el-form-item>
<el-form-item label="学校" prop="school_id" clearable>
<el-select
<el-cascader
size="small"
v-model="form['school_id']"
clearable
filterable
placeholder="请填写学校"
placeholder="请填写所属学校"
:options="school"
style="width: 100%"
>
<el-option
v-for="(option, optionIndex) in school"
:key="optionIndex"
:label="option['name']"
:value="option['id']"
></el-option>
</el-select>
:props="{
emitPath: false,
value: 'id',
label: 'name',
}"></el-cascader>
</el-form-item>
<el-form-item label="名称" prop="name">

@ -10,23 +10,23 @@
@close="$emit('update:isShow',false)">
<section class="drawer-container">
<el-descriptions class="drawer-container__desc" size="small" border ref="elDesc" :column="2" direction="vertical" :labelStyle="{ 'font-weight': '500', 'font-size': '15px' }">
<el-descriptions-item label="专业代码">
{{ form['code'] }}
</el-descriptions-item>
<el-descriptions-item label="学校">
{{ school.find(i => i['id'] === form['school_id']) ? school.find(i => i['id'] === form['school_id'])['name'] : '' }}
{{ form['school'] ? form['school'].name : '' }}
</el-descriptions-item>
<el-descriptions-item label="名称">
{{ form['name'] }}
</el-descriptions-item>
<el-descriptions-item label="内容" span="2">
<div v-html="form['content']"></div>
</el-descriptions-item>
</el-descriptions>
</section>
</el-drawer>
@ -44,27 +44,27 @@
default: false,
required: true
},
school : {
type: Array,
default: () => []
},
},
data() {
return {
loading: false,
visible: false,
form: {
code: '',
school_id: '',
name: '',
content: '',
},
}
},

Loading…
Cancel
Save