Browse Source

新增主办单位

xjc 4 years ago
parent
commit
d9db0b2064
2 changed files with 340 additions and 1 deletions
  1. 5 1
      src/api.js
  2. 335 0
      src/views/journalQun/Organizer.vue

+ 5 - 1
src/api.js

@@ -325,5 +325,9 @@ export default {
 	},
 	searchOrganizerList: params => {
 		return axios.get(`${baseURL}/api/admin/organizer/search`, { params: params });
-	}
+	},
+	// 主办单位
+	getOrganizerList: params => {
+		return axios.get(`${baseURL}/api/admin/organizer/list`, { params: params });
+	},
 }

+ 335 - 0
src/views/journalQun/Organizer.vue

@@ -0,0 +1,335 @@
+<style lang="scss" scoped>
+.preview {
+  .el-form-item {
+    margin-bottom: 15px;
+  }
+  label,
+  p {
+    line-height: 25px !important;
+  }
+}
+.el-cascader {
+  width: 100%;
+}
+a {
+  text-decoration: none;
+  color: #409eff;
+  cursor: pointer;
+}
+// 右边
+.item-main {
+  // margin:34px;
+  // height:600px;
+  // background: #FFFFFF;
+  border: 1px solid #dddddd;
+  box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.13);
+  border-radius: 20px;
+  .el-form.over_y {
+    max-height: calc(100vh - 340px);
+  }
+  /deep/.el-form-item__label {
+    float: none;
+  }
+}
+// label样式
+.edit_label {
+  /deep/.el-input__inner {
+    background: #f5faff;
+    border: 0px;
+    padding: 0px;
+  }
+}
+/deep/.opicon {
+  font-weight: bold;
+  padding: 5px;
+  color: #3895fe;
+}
+.tpl_title {
+  font-size: 18px;
+  margin: 20px 0;
+}
+.tpl_form {
+  margin: 20px;
+  border: 1px solid #ccc;
+  border-radius: 20px;
+  /deep/.el-form-item {
+    background: none;
+  }
+  /deep/.el-form-item__content {
+    width: 100%;
+  }
+}
+.survey_logo {
+  position: relative;
+  top: 15px;
+  left: 20px;
+}
+.result_dialog .el-dialog{
+    width: 40%;
+    margin-top:20vh!important;
+}
+.result-item{
+    height: 35px;
+    .label{
+        font-weight: 600;
+    }
+}
+// 上传
+
+/deep/.avatar-uploader .el-upload {
+  width: 148px;
+  height: 148px;
+  line-height: 148px;
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+  .avatar {
+    width: 100%;
+    height: auto;
+  }
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409eff;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 68px;
+  height: 68px;
+  line-height: 68px;
+  text-align: center;
+}
+.avatar {
+  width: 68px;
+  height: 68px;
+  display: block;
+}
+/deep/.speaker_avatar .el-upload {
+  width: 80px;
+  height: 80px;
+  line-height: 80px;
+}
+.hotel_imgs {
+  /deep/.el-upload--picture-card {
+    width: 79px;
+    height: 79px;
+    line-height: 79px;
+  }
+}
+</style>
+<template>
+  <section>
+    <p><span>刊群导览></span>主办单位</p>
+    <div class="content">
+      <div class="filter">
+        <el-form
+          size="small"
+          label-width="70px"
+          :inline="true"
+          label-position="left"
+        >
+          <el-form-item label="">
+            <el-input
+              clearable
+              placeholder="请输入标题"
+              v-model="form.name"
+            ></el-input>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="search">搜索</el-button>
+          </el-form-item>
+          <el-form-item style="float: right">
+            <el-button @click="add" type="primary">添加主办单位</el-button>
+          </el-form-item>
+        </el-form>
+      </div>
+      <el-table
+        class="table"
+        :data="list"
+        height="50vh"
+        border
+        v-loading="loading"
+        default-expand-all
+        row-key="id"
+        style="width: 100%"
+      >
+        <el-table-column prop="name" label="单位名称"> </el-table-column>
+        <el-table-column prop="desc" label="主办单位简介" width="1200px"></el-table-column>
+        <el-table-column prop="journal_name" label="期刊数量"></el-table-column>
+        <el-table-column prop="zip" width="150" label="操作">
+          <template slot-scope="scope">
+            <el-button class="edit" type="text" @click="edit(scope.row)"
+              >编辑</el-button
+            >
+            <el-button class="del" @click="del(scope.row.id)" type="text"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <Page
+        ref="pageButton"
+        :current="form.page"
+        :page_size="form.page_size"
+        :total="total"
+        @pageChange="gopage"
+      />
+    </div>
+    <!--新增编辑-->
+    <el-dialog
+      class='fu-dialog'
+      :title="dialogTitle"
+      :close-on-click-modal="true"
+      :visible.sync="dialogVisible"
+    >
+      <el-form
+        size="small"
+        class="preview"
+        :inline="false"
+        label-width="80px"
+        :model="form1"
+        ref="form1"
+        :rules="rules"
+      >
+        <el-form-item label="单位名称" prop="name">
+          <el-input v-model="form1.name" placeholder="请输入单位名称" maxlength="50" show-word-limit></el-input>
+        </el-form-item>
+        <el-form-item label="单位简介" prop="receiver_id">
+          <el-input type="textarea" v-model="form1.desc" placeholder="请输入单位简介"></el-input>
+        </el-form-item>
+        <el-form-item label="单位封面" prop="img">
+          <el-upload
+            class="avatar-uploader"
+            action="/api/admin/uploadfile"
+            :show-file-list="false"
+            :on-success="handleAvatarSuccess"
+          >
+            <img v-if="form1.img" :src="form1.img" class="avatar" />
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+          </el-upload>
+          <span style="font-size: 12px; color: #999999"
+            >建议图片尺寸为:210*160</span
+          >
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="small" type="primary" @click="save">确 定</el-button>
+      </span>
+    </el-dialog>
+  </section>
+</template>
+<script>
+import Page from "../../components/Page";
+import fuEditor from '../../components/fuEditor'
+export default {
+  components: {
+    Page,
+    fuEditor
+  },
+  data() {
+    return {
+      form: { name: "", page: 1, page_size: 20 },
+      total: 1,
+      list: [{ name: "2333" }],
+      loading: false,
+      dialogTitle:false,
+      rules: {
+        name: [{ required: true, message: "请输入标题", trigger: "blur" }],
+      },
+      form1:{}
+    };
+  },
+  methods: {
+    //封面
+    handleAvatarSuccess(res, file) {
+      this.form1.img = file.response.data;
+      console.log(this.form1.img);
+    },
+    search() {
+      let parm = this.form;
+      this.getData();
+    },
+    add() {
+      this.form1 = {};
+      this.dialogVisible = true;
+      this.dialogTitle = "添加主办单位";
+    },
+    addArticle(){
+          this.$router.push({path:'/article/article/add'})
+    },
+    gopage(size) {
+      if (size) {
+        this.form.page_size = size;
+      }
+      this.form.page = this.$refs.pageButton.page;
+      this.getData();
+    },
+    getData() {
+      var parm = this.form;
+      this.loading = true;
+      this.$api.getOrganizerList().then((res) => {
+        console.log(res)
+        this.list = res.data.data.list;
+        this.loading = false;
+      });
+    },
+    del(id) {
+      this.$confirm("确定删除吗", "提示", {
+        type: "warning",
+      }).then(() => {
+        this.$api.delArticle({ id: id }).then((res) => {
+          this.$message({
+            message: "删除成功",
+            type: "success",
+          });
+          this.getData();
+        });
+      });
+    },
+    edit(row) {
+      this.$router.push({path:'/article/article/add',query:{id:row.id}})
+    },
+    save() {
+      this.$refs["form1"].validate((valid) => {
+        if (valid) {
+          let parm = this.form1;
+          let id = this.form1.id;
+          parm.receiver_id = JSON.stringify(parm.receiver_id);
+          if (id) {
+            this.$api.editMessage(parm).then((res) => {
+              if (res.data.code == 0) {
+                this.$message({
+                  type: "success",
+                  message: "保存成功!",
+                });
+              } else {
+                this.$message.error("保存失败!");
+              }
+              this.getData();
+              this.dialogVisible = false;
+            });
+          } else {
+            this.$api.addMessage(parm).then((res) => {
+              if (res.data.code == 0) {
+                this.$message({
+                  type: "success",
+                  message: "保存成功!",
+                });
+              } else {
+                this.$message.error("保存失败!");
+              }
+              this.getData();
+              this.dialogVisible = false;
+            });
+          }
+        }
+      });
+    },
+  },
+  created() {
+    this.getData();
+  },
+};
+</script>