master
lion 1 year ago
parent 12a7e2186f
commit b37caa4abf

@ -14,7 +14,7 @@ let loading ;
const service = axios.create({ const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests // withCredentials: true, // send cookies when cross-domain requests
timeout: 5000, // request timeout timeout: 10000, // request timeout
isLoading:true isLoading:true
}) })

@ -101,6 +101,29 @@
:edit-render="{ name: 'input', attrs: { type: 'text' } }" :edit-render="{ name: 'input', attrs: { type: 'text' } }"
/> />
<vxe-column
header-align="center"
field="is_show"
width="160"
title="自主招生显示"
:edit-render="{}"
>
<template #default="{ row }">
<div v-for="item in showList">
<div v-if="item.id==row.is_show">{{item.value}}</div>
</div>
</template>
<template #edit="{ row }">
<el-select size="small" v-model="row['is_show']">
<el-option
v-for="item in showList"
:key="item.id"
:value="item.id"
:label="item.value"></el-option>
</el-select>
</template>
</vxe-column>
<vxe-column <vxe-column
field="operate" field="operate"
header-align="center" header-align="center"
@ -206,6 +229,13 @@ export default {
loading: false, loading: false,
tableHeight: 400, tableHeight: 400,
showList: [{
id: 1,
value: '是'
}, {
id: 0,
value: '否'
}],
select: { select: {
page: 1, page: 1,
page_size: 20, page_size: 20,
@ -221,6 +251,7 @@ export default {
name: "", name: "",
group: "", group: "",
is_show:''
}, },
validRules: {}, validRules: {},
}; };

@ -1,41 +1,23 @@
<template> <template>
<div> <div>
<el-drawer <el-drawer :title="$route.meta.title" direction="rtl" size="68%" :visible.sync="visible" append-to-body
:title="$route.meta.title" :before-close="handleClose" @close="$emit('update:isShow', false)">
direction="rtl"
size="68%"
:visible.sync="visible"
append-to-body
:before-close="handleClose"
@close="$emit('update:isShow', false)"
>
<section class="drawer-container"> <section class="drawer-container">
<el-form <el-form class="drawer-container__form" ref="elForm" :model="form" :rules="rules" label-position="top"
class="drawer-container__form" label-width="120px" size="small">
ref="elForm"
:model="form"
:rules="rules"
label-position="top"
label-width="120px"
size="small"
>
<div class="form-layout"> <div class="form-layout">
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-input <el-input v-model="form['name']" clearable placeholder="请填写名称" style="width: 100%"></el-input>
v-model="form['name']"
clearable
placeholder="请填写名称"
style="width: 100%"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="分组" prop="group"> <el-form-item label="分组" prop="group">
<el-input <el-input v-model="form['group']" clearable placeholder="请填写分组" style="width: 100%"></el-input>
v-model="form['group']" </el-form-item>
clearable <el-form-item label="自主招生显示" prop="is_show">
placeholder="请填写分组" <el-select v-model="form['is_show']">
style="width: 100%" <el-option v-for="item in showList" :key="item.id" :label="item.value"
></el-input> :value="item.id"></el-option>
</el-select>
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
@ -52,143 +34,164 @@
</template> </template>
<script> <script>
import { save, show } from "@/api/area/area"; import {
import axios from "axios"; save,
import { getToken } from "@/utils/auth"; show
import { uploadSize } from "@/settings"; } from "@/api/area/area";
import { formatFileSize } from "@/utils"; import axios from "axios";
import {
getToken
} from "@/utils/auth";
import {
uploadSize
} from "@/settings";
import {
formatFileSize
} from "@/utils";
export default { export default {
name: "AreaDrawer", name: "AreaDrawer",
props: { props: {
isShow: { isShow: {
type: Boolean, type: Boolean,
default: false, default: false,
required: true, required: true,
},
}, },
}, data() {
data() { return {
return { uploadSize,
uploadSize, action: process.env.VUE_APP_UPLOAD_API,
action: process.env.VUE_APP_UPLOAD_API, loading: false,
loading: false, visible: false,
visible: false, showList: [{
form: { id: 1,
name: "", value: '是'
}, {
id: 0,
value: '否'
}],
form: {
name: "",
group: "", group: "",
}, is_show: 1
rules: {}, },
}; rules: {},
}, };
watch: {
isShow(newVal) {
this.visible = newVal;
}, },
visible(newVal) { watch: {
this.$emit("update:isShow", newVal); isShow(newVal) {
this.visible = newVal;
},
visible(newVal) {
this.$emit("update:isShow", newVal);
},
}, },
}, methods: {
methods: { uploadBefore(file) {
uploadBefore(file) { if (file.size > uploadSize) {
if (file.size > uploadSize) { this.$message({
type: "warning",
message: `上传图片大小超过${formatFileSize(uploadSize)}`,
});
return false;
}
window.$_uploading = true;
},
uploadSuccess(response, file, fileList, fieldName) {
window.$_uploading = false;
fileList.forEach((file) => {
if (file.response?.data && !file.response?.code) {
file.response = file.response.data;
}
});
this.form[fieldName] = fileList;
},
uploadRemove(file, fileList, fieldName) {
this.form[fieldName] = fileList;
},
uploadError(err, file, fileList, fieldName) {
window.$_uploading = false;
this.form[fieldName] = fileList;
this.$message({ this.$message({
type: "warning", type: "warning",
message: `上传图片大小超过${formatFileSize(uploadSize)}`, message: err,
}); });
return false; },
} formatFileSize,
window.$_uploading = true; getToken,
}, handleClose(done) {
uploadSuccess(response, file, fileList, fieldName) { this.$confirm("确定关闭窗口?")
window.$_uploading = false; .then((_) => {
fileList.forEach((file) => { done();
if (file.response?.data && !file.response?.code) { })
file.response = file.response.data; .catch((_) => {});
} },
});
this.form[fieldName] = fileList;
},
uploadRemove(file, fileList, fieldName) {
this.form[fieldName] = fileList;
},
uploadError(err, file, fileList, fieldName) {
window.$_uploading = false;
this.form[fieldName] = fileList;
this.$message({
type: "warning",
message: err,
});
},
formatFileSize,
getToken,
handleClose(done) {
this.$confirm("确定关闭窗口?")
.then((_) => {
done();
})
.catch((_) => {});
},
reset() { reset() {
this.form = { this.form = {
name: "", name: "",
group: "", group: "",
}; };
this.$refs["elForm"].resetFields(); this.$refs["elForm"].resetFields();
}, },
submit() { submit() {
if (window.$_uploading) { if (window.$_uploading) {
this.$message.warning("文件正在上传中"); this.$message.warning("文件正在上传中");
return; return;
} }
this.$refs["elForm"].validate(async (valid) => { this.$refs["elForm"].validate(async (valid) => {
if (valid) { if (valid) {
this.loading = true; this.loading = true;
try { try {
await save(this.form); await save(this.form);
this.$message.success("新增成功"); this.$message.success("新增成功");
this.$emit("refresh"); this.$emit("refresh");
this.$emit("update:isShow", false); this.$emit("update:isShow", false);
this.loading = false; this.loading = false;
this.reset(); this.reset();
} catch (err) { } catch (err) {
this.loading = false; this.loading = false;
}
} }
} });
}); },
}, },
}, };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.span2 { .span2 {
grid-column: span 2; grid-column: span 2;
} }
::v-deep .el-form-item > * {
max-width: 100%; ::v-deep .el-form-item>* {
} max-width: 100%;
.form-layout { }
display: grid;
grid-gap: 2%;
grid-template-columns: repeat(2, 1fr);
}
.drawer-container {
height: 100%;
padding: 20px;
display: flex;
flex-direction: column;
&__form { .form-layout {
flex: 1; display: grid;
overflow-y: scroll; grid-gap: 2%;
grid-template-columns: repeat(2, 1fr);
} }
&__footer {
margin-top: 20px; .drawer-container {
height: 100%;
padding: 20px;
display: flex; display: flex;
flex-direction: column;
&__form {
flex: 1;
overflow-y: scroll;
}
&__footer {
margin-top: 20px;
display: flex;
}
} }
}
</style> </style>

@ -357,6 +357,8 @@ export default {
page: 1, page: 1,
page_size: 20, page_size: 20,
keyword: "", keyword: "",
sort_type:'ASC',
sort_name:'sort',
show_relation: ["aspiration", "batchSubs"], show_relation: ["aspiration", "batchSubs"],
"filter[0][key]": 'aspiration_id', "filter[0][key]": 'aspiration_id',
"filter[0][op]": 'eq', "filter[0][op]": 'eq',

@ -25,7 +25,7 @@ module.exports = {
* Detail: https://cli.vuejs.org/config/#publicpath * Detail: https://cli.vuejs.org/config/#publicpath
*/ */
publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin', publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin',
outputDir: `../git-store/zhiyuan/public/${process.env.ENV === 'staging' ? '/admin_test' : '/admin'}`, outputDir: `/Users/mac/Documents/朗业/2025/x-新飞跃/zhiyuan/public/${process.env.ENV === 'staging' ? '/admin_test' : '/admin'}`,
assetsDir: 'static', assetsDir: 'static',
css: { css: {
loaderOptions: { // 向 CSS 相关的 loader 传递选项 loaderOptions: { // 向 CSS 相关的 loader 传递选项

Loading…
Cancel
Save