| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388 |
- <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"
- @clear="getData"
- ></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="dialogVisible1=true" plain icon="el-icon-upload" type="primary">导入</el-button>
- </el-form-item>
- <el-form-item style="float:right" >
- <el-button @click="download" plain icon="el-icon-download" type="primary">导出</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="57vh"
- border
- v-loading="loading"
- default-expand-all
- row-key="id"
- style="width: 100%"
- >
- <el-table-column prop="name" label="学科名称" width="200"> </el-table-column>
- <el-table-column prop="desc" label="学科简介" width="500"></el-table-column>
- <el-table-column prop="journal_count" label="期刊数量"></el-table-column>
- <el-table-column prop="zip" fixed="right" align="center" width="150" label="操作">
- <template slot-scope="scope">
- <el-button type="text" @click="$router.push({path:'/journal/subject/detail',query:{id:scope.row.id}})"
- >查看</el-button>
- <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="false"
- :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="desc">
- <el-input type="textarea" v-model="form1.desc" placeholder="请输入学科简介"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button size="small" type="primary" @click="save">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog
- class="fu-dialog"
- title="导入" width="400px"
- :close-on-click-modal="false"
- :visible.sync="dialogVisible1"
- >
- <el-upload
- class="upload-demo"
- action="/api/admin/uploadfile"
- :show-file-list="false"
- :on-success="handleAvatarSuccess1">
- <el-button size="small" type="primary">点击上传</el-button>
- <div slot="tip" class="el-upload__tip">只能上传.xls/.xlsx文件,且不超过500M</div>
-
- </el-upload>
- <div>{{file}}</div>
- <span slot="footer" class="dialog-footer">
- <el-button size="small" type="normal" @click="dialogVisible1=false">取消</el-button>
- <el-button size="small" type="primary" @click="upload">确 定</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:"",
- dialogVisible:false,
- dialogVisible1:false,
- rules: {
- name: [{ required: true, message: "请输入学科名称", trigger: "blur" }],
- desc: [{ required: true, message: "请输入学科简介", trigger: "blur" }]
- },
- form1:{},
- file:''
- };
- },
- methods: {
- upload(){
- this.$api.upSubjectData({file:this.file}).then(res=>{
- this.dialogVisible1=false;
- this.getData();
- this.$message({
- message: "上传成功",
- type: "success",
- });
- })
- },
- download(){
- this.$api.getSubjectData().then(res=>{
- var elink = document.createElement("a");
- let blob = new Blob([res.data], {
- type: "application/vnd.ms-excel,charset=UTF-8",
- });
- let objUrl = URL.createObjectURL(blob);
- let file_name = decodeURIComponent(
- res.headers["content-disposition"].split("=")[1]
- );
- console.log(file_name);
- elink.download = file_name;
- elink.style.display = "none";
- elink.href = objUrl;
- document.body.appendChild(elink);
- elink.click();
- document.body.removeChild(elink);
- })
- },
- handleAvatarSuccess1(res, file) {
- this.file=file.response.data;
- },
- //封面
- handleAvatarSuccess(res, file) {
- this.form1.img = file.response.data;
- console.log(this.form1.img);
- },
- search() {
- 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.getSubjectList(parm).then((res) => {
- console.log(res)
- this.list = res.data.data.list;
- this.loading = false;
- });
- },
- del(id) {
- this.$confirm("确定删除吗", "提示", {
- type: "warning",
- }).then(() => {
- this.$api.delSubject({ id: id }).then((res) => {
- this.$message({
- message: "删除成功",
- type: "success",
- });
- this.getData();
- });
- });
- },
- edit(row) {
- this.form1 = row
- this.dialogVisible = true
- },
- 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.updateSubject(parm).then((res) => {
- if (res.data.code == 0) {
- this.$message({
- type: "success",
- message: "保存成功!",
- });
- this.getData();
- this.dialogVisible = false;
- } else {
- this.$message.error(res.data.message);
- }
-
- });
- } else {
- this.$api.addSubject(parm).then((res) => {
- if (res.data.code == 0) {
- this.$message({
- type: "success",
- message: "保存成功!",
- });
- this.getData();
- this.dialogVisible = false;
- } else {
- this.$message.error(res.data.message);
- }
-
- });
- }
- }
- });
- },
- },
- created() {
- this.getData();
- },
- };
- </script>
|