|
|
|
|
@ -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>
|
|
|
|
|
|