master
lion 1 year ago
parent b37caa4abf
commit a7897d5d0d

@ -35,3 +35,13 @@ export function destroy(params, isLoading = true) {
isLoading isLoading
}) })
} }
export function importData(data, isLoading = true) {
return request({
method: 'post',
url: '/api/admin/middle-school-indicator/import',
data,
isLoading
})
}

@ -35,3 +35,12 @@ export function destroy(params, isLoading = true) {
isLoading isLoading
}) })
} }
export function importData(data, isLoading = true) {
return request({
method: 'post',
url: '/api/admin/score/import',
data,
isLoading
})
}

@ -308,6 +308,8 @@
:school="school" :school="school"
:is-show.sync="isShowDetail" :is-show.sync="isShowDetail"
/> />
<importShow ref="importShow" :school="school" @success="getList" :is-show.sync="isShowImport"></importShow>
</div> </div>
</template> </template>
@ -330,6 +332,7 @@ import { getToken } from "@/utils/auth";
import { index as schoolIndex } from "@/api/school/school"; import { index as schoolIndex } from "@/api/school/school";
import {getparameter} from "@/api/system/dictionary"; import {getparameter} from "@/api/system/dictionary";
import importShow from "./components/importShow.vue";
export default { export default {
name: "MiddleSchoolIndicator", name: "MiddleSchoolIndicator",
@ -337,15 +340,16 @@ export default {
components: { components: {
AddMiddleSchoolIndicator, AddMiddleSchoolIndicator,
ShowMiddleSchoolIndicator, ShowMiddleSchoolIndicator,
importShow
}, },
data() { data() {
return { return {
action: `${process.env.VUE_APP_BASE_API}/api/admin/middle-school-indicator/import`, action: `${process.env.VUE_APP_BASE_API}/api/admin/middle-school-indicator/excel-show`,
uploadSize, uploadSize,
examineKey: 0, examineKey: 0,
isShowAdd: false, isShowAdd: false,
isShowDetail: false, isShowDetail: false,
isShowImport: false,
loading: false, loading: false,
tableHeight: 400, tableHeight: 400,
select: { select: {
@ -405,8 +409,18 @@ export default {
if (response.hasOwnProperty('errcode')) { if (response.hasOwnProperty('errcode')) {
this.$message.error(response.errmsg) this.$message.error(response.errmsg)
} else { } else {
this.$message.success(`已导入${response.total}`) let arr = []
this.getList(true) response.list.map(row => {
arr.push({
...row,
year: row.year?row.year+'':''
});
});
this.isShowImport = true
this.$refs.importShow.errList = response.err
this.$refs.importShow.list = arr
// this.$message.success(`${response.total}`)
// this.getList(true)
} }
}, },
exportMethod() { exportMethod() {
@ -421,7 +435,7 @@ export default {
Object.keys(this.form).forEach(key => { Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
}) })
download("/api/admin/school/index", "get", { download("/api/admin/middle-school-indicator/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,

@ -0,0 +1,122 @@
<template>
<div>
<vxe-modal :value="isShow" show-footer title="导入预览" show-confirm-button :width="defaultModalSize.sWidth"
:height="defaultModalSize.sHeight" transfer :fullscreen="$store.getters.device === 'mobile'"
@input="(e) => $emit('update:isShow', e)">
<div v-if="errList.length>0">
学校库暂无<span style="color:red;margin-right:10px" v-for="item in errList">{{item}}</span>
</div>
<vxe-table ref="table" stripe style="margin-top: 10px" :loading="loading" :height="tableHeight" keep-source
show-overflow :row-config="{ isCurrent: true, isHover: true }" :column-config="{ resizable: true }"
:edit-config="{
trigger: 'manual',
mode: 'row',
showStatus: true,
isHover: true,
autoClear: false,
}" :data="list">
<vxe-column type="seq" width="58" align="center" />
<vxe-column align="center" field="year" width="180" title="年份">
<template #default="{ row }">
<el-date-picker style="width: 100%;" size="small" type="year" format="yyyy" value-format="yyyy" v-model="row['year']"></el-date-picker>
</template>
</vxe-column>
<vxe-column align="center" field="school.name" title="学校">
<template #default="{ row }">
<el-cascader size="small" filterable v-model="row['school_id']" :options="school" :props="{
emitPath: false,
value: 'id',
label: 'name',
}"></el-cascader>
</template>
</vxe-column>
<vxe-column header-align="center" align="right" field="total" width="160" title="学籍数">
<template #default="{ row }">
<el-input type="number" v-model="row['total']"></el-input>
</template>
</vxe-column>
<vxe-column header-align="center" align="right" field="details_name" width="160" title="分配学校">
<template #default="{ row }">
<el-input v-model="row['details_name']"></el-input>
</template>
</vxe-column>
<vxe-column header-align="center" align="right" field="details_total" width="160" title="名额">
<template #default="{ row }">
<el-input type="number" v-model="row['details_total']"></el-input>
</template>
</vxe-column>
</vxe-table>
<template #footer>
<el-button type="primary" :loading="loading" @click="submit"></el-button>
</template>
</vxe-modal>
</div>
</template>
<script>
import {
importData
} from "@/api/middle-school-indicator/middle-school-indicator";
import {
defaultModalSize
} from "@/settings";
export default {
props: {
isShow: {
type: Boolean,
default: false,
required: true
},
school: {
type: Array,
default: () => [],
},
},
data() {
return {
loading: false,
defaultModalSize,
list: [],
errList:[],
tableHeight: 400,
};
},
mounted() {
this.calcTableHeight();
},
methods: {
calcTableHeight() {
let clientHeight = document.documentElement.clientHeight;
let padding = 160;
let margin = 20;
this.tableHeight =
clientHeight -
padding -
margin;
},
async submit() {
try {
this.loading = true
console.log(this.list)
// return
await importData({
data:this.list
}, false)
this.$message.success("添加成功")
this.$emit('update:isShow', false)
this.$emit("success")
this.list = []
} catch (err) {
console.error(err)
} finally {
this.loading = false
}
}
},
computed: {},
};
</script>
<style scoped lang="scss"></style>

File diff suppressed because it is too large Load Diff

@ -19,7 +19,7 @@
:labelStyle="{ 'font-weight': '500', 'font-size': '15px' }" :labelStyle="{ 'font-weight': '500', 'font-size': '15px' }"
> >
<el-descriptions-item label="代码"> <el-descriptions-item label="代码">
{{ form["code"] }} {{ form['school'] ? form['school'].code : '' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="所属学校"> <el-descriptions-item label="所属学校">

@ -0,0 +1,130 @@
<template>
<div>
<vxe-modal :value="isShow" show-footer title="导入预览" show-confirm-button :width="defaultModalSize.sWidth"
:height="defaultModalSize.sHeight" transfer :fullscreen="$store.getters.device === 'mobile'"
@input="(e) => $emit('update:isShow', e)">
<div v-if="errList.length>0">
学校库暂无<span style="color:red;margin-right:10px" v-for="item in errList">{{item}}</span>
</div>
<vxe-table ref="table" stripe style="margin-top: 10px" :loading="loading" :height="tableHeight" keep-source
show-overflow :row-config="{ isCurrent: true, isHover: true }" :column-config="{ resizable: true }"
:edit-config="{
trigger: 'manual',
mode: 'row',
showStatus: true,
isHover: true,
autoClear: false,
}" :data="list">
<vxe-column type="seq" width="58" align="center" />
<vxe-column align="center" field="school.name" width="180" title="所属学校">
<template #default="{ row }">
<el-cascader size="small" filterable v-model="row['school_id']" :options="school" :props="{
emitPath: false,
value: 'id',
label: 'name',
}"></el-cascader>
</template>
</vxe-column>
<vxe-column align="center" field="year" width="180" title="年份">
<template #default="{ row }">
<el-date-picker style="width: 100%;" size="small" type="year" format="yyyy" value-format="yyyy" v-model="row['year']"></el-date-picker>
</template>
</vxe-column>
<vxe-column header-align="center" align="right" field="total_score" width="160" title="统招总分">
<template #default="{ row }">
<el-input type="number" v-model="row['total_score']"></el-input>
</template>
</vxe-column>
<vxe-column header-align="center" align="right" field="main_score" width="160" title="统招语数外">
<template #default="{ row }">
<el-input type="number" v-model="row['main_score']"></el-input>
</template>
</vxe-column>
<vxe-column header-align="center" align="right" field="area_total_score" width="160" title="跨区总分">
<template #default="{ row }">
<el-input type="number" v-model="row['area_total_score']"></el-input>
</template>
</vxe-column>
<vxe-column header-align="center" align="right" field="area_main_score" width="160" title="跨区语数外">
<template #default="{ row }">
<el-input type="number" v-model="row['area_main_score']"></el-input>
</template>
</vxe-column>
</vxe-table>
<template #footer>
<el-button type="primary" :loading="loading" @click="submit"></el-button>
</template>
</vxe-modal>
</div>
</template>
<script>
import {
importData
} from "@/api/score/score";
import {
defaultModalSize
} from "@/settings";
export default {
props: {
isShow: {
type: Boolean,
default: false,
required: true
},
school: {
type: Array,
default: () => [],
},
},
data() {
return {
loading: false,
defaultModalSize,
list: [],
errList:[],
tableHeight: 400,
};
},
mounted() {
this.calcTableHeight();
},
methods: {
calcTableHeight() {
let clientHeight = document.documentElement.clientHeight;
let padding = 160;
let margin = 20;
this.tableHeight =
clientHeight -
padding -
margin;
},
async submit() {
try {
this.loading = true
console.log(this.list)
// return
await importData({
data:this.list
}, false)
this.$message.success("添加成功")
this.$emit('update:isShow', false)
this.$emit("success")
this.list = []
} catch (err) {
console.error(err)
} finally {
this.loading = false
}
}
},
computed: {},
};
</script>
<style scoped lang="scss"></style>
Loading…
Cancel
Save