| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 |
- <template>
- <div id="schoolManagement">
- <search-box
- ref="search_box"
- :formList="formList"
- @search="search"
- @init="init"
- />
- <table-list
- :tableSets="tableSet"
- :tableData="tableData"
- :navText="navText"
- @addClick="addClick"
- :loading="loading"
- @editInfo="editInfo"
- >
- <template slot="btn" slot-scope="props">
- <el-button type="text" @click="addClick(props.scope.row, 0)"
- >修改</el-button
- >
- <el-button type="text" @click="del(props.scope.row)">删除</el-button>
- </template>
- </table-list>
- <pagination
- :total="total"
- :pageSize="pageSize"
- :currentPage="currentPage"
- @handleSizeChange="handleSizeChange"
- @handleCurrentChange="handleCurrentChange"
- />
- <el-dialog
- :visible.sync="dialogBox"
- width="560px"
- :show-close="false"
- :destroy-on-close="true"
- :before-close="closeBefore"
- :fullscreen="fullscreen"
- >
- <div slot="title" class="hearders">
- <div class="leftTitle">
- {{ statusPop === 1 ? "添加" : statusPop === 0 ? "修改" : "详情" }}
- </div>
- <div class="rightBoxs">
- <img
- src="@/assets/images/Max@2x.png"
- alt=""
- @click="fullscreen = !fullscreen"
- />
- <img src="@/assets/images/Close@2x.png" alt="" @click="closeBefore" />
- </div>
- </div>
- <el-row class="contentBox" :span="24">
- <el-form
- label-position="right"
- label-width="120px"
- :model="poppleData"
- :rules="rules"
- ref="poppleData"
- >
- <el-form-item label="学校名称" prop="schoolName">
- <el-input v-model="poppleData.schoolName"></el-input>
- </el-form-item>
- <el-form-item label="学校等级" prop="dictCode">
- <el-select
- v-model="poppleData.dictCode"
- placeholder="请选择学校等级"
- >
- <el-option
- v-for="item in optionsList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="是否启用" prop="status">
- <el-radio-group v-model="poppleData.status">
- <el-radio :label="1">启用</el-radio>
- <el-radio :label="0">停用</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="学校联系人">
- <el-input v-model="poppleData.contact"></el-input>
- </el-form-item>
- <el-form-item label="联系方式">
- <el-input v-model="poppleData.phone"></el-input>
- </el-form-item>
- <el-form-item label="优势专业">
- <el-input v-model="poppleData.advantageSpecialty"></el-input>
- </el-form-item>
- <el-form-item label="地点">
- <el-input v-model="poppleData.address"></el-input>
- </el-form-item>
- <el-form-item label="简介">
- <el-input
- type="textarea"
- :rows="2"
- placeholder="请输入简介"
- v-model="poppleData.introduction"
- ></el-input>
- </el-form-item>
- </el-form>
- </el-row>
- <div slot="footer" class="dialog-footer">
- <el-button @click="closeBefore">关闭</el-button>
- <el-button @click="submitForm('poppleData')" type="primary"
- >确定</el-button
- >
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import searchBox from "@/components/searchBox";
- import tableList from "@/components/tableList";
- import pagination from "@/components/pagination";
- export default {
- components: { searchBox, tableList, pagination },
- data() {
- return {
- loading: false, //当前表单加载是否加载动画
- navText: {
- title: "查出学校共有",
- index: 0,
- ch: "所",
- num: true,
- choice: true,
- addHide: false,
- backFatherBtn: {
- status: false,
- title: "未定义",
- },
- },
- //搜索
- formList: [
- {
- label:"学校名称",
- prop:"schoolName",
- placeholder: "请输入学校名称",
- scope:"selects",
- options:[],
- },
- {
- label: "学校联系人",
- prop: "contact",
- placeholder: "请输入学校联系人",
- },
- {
- label: "联系方式",
- prop: "phone",
- placeholder: "请输入联系方式",
- },
- {
- label: "学校等级",
- prop: "dictCode",
- placeholder: "请选择学校等级",
- scope: "select",
- options: [],
- },
- {
- label: "学校状态",
- prop: "status",
- placeholder: "请选择学校状态",
- scope: "select",
- options: [
- {
- label: "启用",
- value: 1,
- },
- {
- label: "关闭",
- value: 0,
- },
- ],
- },
- ],
- // 表单
- tableSet: [
- {
- label: "学校名称",
- prop: "schoolName",
- hidden: true,
- },
- {
- label: "学校联系人",
- prop: "contact",
- hidden: true,
- },
- {
- label: "联系方式",
- prop: "phone",
- hidden: true,
- },
- {
- label: "学校等级",
- prop: "dictLabel",
- hidden: true,
- },
- {
- label: "优势专业",
- prop: "advantageSpecialty",
- hidden: true,
- },
- {
- label: "地址",
- prop: "address",
- hidden: true,
- },
- {
- label: "用户数",
- prop: "userNum",
- hidden: true,
- scope: "isNums",
- },
- {
- label: "启用状态",
- prop: "status",
- hidden: true,
- scope: "status",
- },
- {
- label: "简介",
- prop: "introduction",
- hidden: true,
- },
- ],
- poppleData: {},
- tableData: [], //表单数据
- total: 0, //一共多少条+
- pageSize: 10, //每页多少条数据
- currentPage: 1, //当前页码
- fullscreen: false,
- dialogBox: false,
- optionsList: [],
- statusPop: 0,
- rules: {
- schoolName: [
- { required: true, message: "请输入学校名称", trigger: "blur" },
- ],
- dictCode: [
- { required: true, message: "请选择学校等级", trigger: "change" },
- ],
- status: [
- { required: true, message: "请选择是否启用", trigger: "change" },
- ],
- },
- };
- },
- mounted() {
- this.search();
- this.getSchoolType();
- },
- methods: {
- editInfo(options) {
- this.$router.push({
- name: "/personalManagement",
- params: {
- schoolName: options.schoolName,
- },
- });
- console.log(options);
- },
- getSchoolType() {
- this.$api.obtaindictdata({ dictTypeId: 11 }).then((res) => {
- var listsT = [];
- res.rows.forEach((item, index) => {
- var ac = {
- value: item.dictCode,
- label: item.dictLabel,
- };
- listsT.push(ac);
- });
- this.formList.forEach((item, index) => {
- if (item.prop === "dictCode") {
- item.options = listsT;
- this.optionsList = listsT;
- }
- });
- });
- },
- submitForm(formName) {
- var self = this;
- this.$refs[formName].validate((valid) => {
- if (valid) {
- self.rulesTableSumbit();
- } else {
- return false;
- }
- });
- },
- search(v, os) {
- this.loading = true;
- if (os) {
- this.currentPage = 1;
- }
- if(v === undefined){
- v = {}
- }
- var data = {
- schoolName: v.schoolName,
- contact: v.contact,
- phone: v.phone,
- dictCode: v.dictCode,
- status: v.status === undefined ? "0,1" : v.status,
- pageSize: this.pageSize,
- pageNum: this.currentPage,
- };
- this.$api.inquireuserschoolList(data).then((res) => {
- this.tableData = res.rows;
- this.total = res.total;
- this.navText.index = res.total;
- });
- this.loading = false;
- },
- init() {
- this.search();
- },
- rulesTableSumbit() {
- var data = {
- address: this.poppleData.address,
- advantageSpecialty: this.poppleData.advantageSpecialty,
- contact: this.poppleData.contact,
- dictCode: this.poppleData.dictCode,
- introduction: this.poppleData.introduction,
- phone: this.poppleData.phone,
- schoolCity: this.poppleData.schoolCity,
- schoolName: this.poppleData.schoolName,
- status: this.poppleData.status,
- };
- if (this.statusPop === 1) {
- this.$api.adduserschool(data).then((res) => {
- if (res.code === 200) {
- this.$message.success("新增成功");
- this.search();
- this.dialogBox = false;
- }
- });
- } else {
- data.id = this.poppleData.id;
- this.$api.edituserschool(data).then((res) => {
- if (res.code === 200) {
- this.$message.success("修改成功");
- this.search();
- this.dialogBox = false;
- }
- });
- }
- },
- del(options) {
- var self = this;
- this.$confirm("此操作将删除该学校, 是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- self.$api
- .edituserschool({
- id: options.id,
- status: -1,
- schoolName: options.schoolName,
- })
- .then((res) => {
- if (res.code === 200) {
- self.$message.success("删除成功");
- self.search();
- }
- });
- })
- .catch(() => {});
- },
- closeBefore() {
- this.dialogBox = false;
- this.fullscreen = false;
- this.poppleData = {};
- },
- addClick(v, int) {
- if (v === undefined) {
- this.statusPop = 1;
- this.poppleData = {};
- } else {
- this.statusPop = int;
- this.$api.obtainuserschool(v.id).then((res) => {
- this.poppleData = res.data;
- });
- }
- this.$nextTick(() => {
- this.$refs.poppleData.clearValidate();
- });
- this.dialogBox = true;
- },
- handleSizeChange(v) {
- this.pageSize = v;
- this.currentPage = 1;
- this.search(this.$refs.search_box.formData);
- },
- handleCurrentChange(v) {
- this.currentPage = v;
- this.search(this.$refs.search_box.formData);
- },
- },
- };
- </script>
- <style lang="less" scoped>
- /deep/.el-button {
- border-radius: 8px;
- }
- /deep/.el-dialog {
- border-radius: 8px;
- .el-dialog__header {
- padding: 0;
- .hearders {
- height: 40px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0px 18px 0px 20px;
- border-bottom: 1px solid #e2e2e2;
- .leftTitle {
- font-size: 14px;
- font-weight: bold;
- color: #2f4378;
- }
- .rightBoxs {
- display: flex;
- align-items: center;
- img {
- width: 14px;
- height: 14px;
- margin-left: 13px;
- cursor: pointer;
- }
- }
- }
- }
- .el-dialog__body {
- padding: 0;
- .contentBox {
- padding: 20px 20px 5px;
- .el-col {
- padding: 0px 20px;
- margin-bottom: 30px;
- header {
- margin-bottom: 6px;
- color: #2f4378;
- font-size: 14px;
- }
- }
- }
- }
- .el-dialog__footer {
- padding: 0;
- .dialog-footer {
- padding: 0px 40px;
- height: 70px;
- border-top: 1px solid #e2e2e2;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- }
- }
- }
- .imgBox {
- width: 100%;
- // height: 210px;
- border: 1px solid #e2e2e2;
- border-radius: 8px;
- padding: 8px 8px 3px;
- display: flex;
- flex-direction: column;
- align-items: center;
- .imgLabel {
- flex: 1;
- width: 100%;
- border: 1px dotted #e2e2e2;
- color: #999;
- font-size: 14px;
- cursor: pointer;
- border-radius: 8px;
- .msPhoto {
- display: flex;
- justify-content: center;
- align-items: center;
- max-width: 100%;
- max-height: 270px;
- img {
- max-width: 100%;
- max-height: 270px;
- }
- }
- .imgbbx {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 100%;
- i {
- font-weight: bold;
- margin: 14px 0;
- font-size: 24px;
- }
- }
- }
- p {
- margin: 5px 0px;
- }
- }
- .avatar-uploader .el-upload {
- border: 1px dashed #d9d9d9;
- border-radius: 6px;
- cursor: pointer;
- position: relative;
- overflow: hidden;
- }
- .avatar-uploader .el-upload:hover {
- border-color: #409eff;
- }
- .avatar-uploader-icon {
- font-size: 28px;
- color: #8c939d;
- width: 178px;
- height: 178px;
- line-height: 178px;
- text-align: center;
- }
- .avatar {
- width: 178px;
- height: 178px;
- display: block;
- }
- </style>
|