Przeglądaj źródła

Merge branch 'dev-meta-dz' of xiongzhu/raex_back into master

lidongze 3 lat temu
rodzic
commit
cf113f65e3

+ 4 - 4
src/main/java/com/izouma/nineth/domain/MetaEmail.java

@@ -22,14 +22,14 @@ public class MetaEmail extends BaseEntity{
 
     @ApiModelProperty("邮件作者")
     @ExcelProperty("邮件作者")
-    private String auther;
+    private String author;
 
     @ApiModelProperty("邮件内容")
     @ExcelProperty("邮件内容")
     private String description;
 
-    @ApiModelProperty("是否已读")
-    @ExcelProperty("是否已读")
-    private boolean readed;
+    @ApiModelProperty("是否发布")
+    @ExcelProperty("是否发布")
+    private boolean publish;
 }
 

+ 0 - 30
src/main/java/com/izouma/nineth/domain/MetaQuestionNote.java

@@ -1,30 +0,0 @@
-package com.izouma.nineth.domain;
-
-import com.alibaba.excel.annotation.ExcelProperty;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import javax.persistence.Entity;
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-@Entity
-@ApiModel("元宇宙题库记录")
-public class MetaQuestionNote extends BaseEntity {
-
-    @ApiModelProperty("用户ID")
-    @ExcelProperty("用户ID")
-    private Long userId;
-
-    @ApiModelProperty("题目ID")
-    @ExcelProperty("题目ID")
-    private Long questionId;
-
-    @ApiModelProperty("是否完成")
-    @ExcelProperty("是否完成")
-    private boolean finsh;
-}

+ 1 - 1
src/main/java/com/izouma/nineth/domain/MetaZoumaLight.java → src/main/java/com/izouma/nineth/domain/MetaZouMaLight.java

@@ -14,7 +14,7 @@ import javax.persistence.Entity;
 @NoArgsConstructor
 @Entity
 @ApiModel("元宇宙走马灯配置")
-public class MetaZoumaLight extends BaseEntity {
+public class MetaZouMaLight extends BaseEntity {
 
     @ApiModelProperty("是否发布")
     @ExcelProperty("是否发布")

+ 0 - 13
src/main/java/com/izouma/nineth/repo/MetaQuestionNoteRepo.java

@@ -1,13 +0,0 @@
-package com.izouma.nineth.repo;
-
-import com.izouma.nineth.domain.MetaQuestionNote;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-
-import javax.transaction.Transactional;
-
-public interface MetaQuestionNoteRepo extends JpaRepository<MetaQuestionNote, Long>, JpaSpecificationExecutor<MetaQuestionNote> {
-
-}

+ 4 - 4
src/main/java/com/izouma/nineth/repo/MetaZoumaLightRepo.java

@@ -1,6 +1,6 @@
 package com.izouma.nineth.repo;
 
-import com.izouma.nineth.domain.MetaZoumaLight;
+import com.izouma.nineth.domain.MetaZouMaLight;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
@@ -8,11 +8,11 @@ import org.springframework.data.jpa.repository.Query;
 
 import javax.transaction.Transactional;
 
-public interface MetaZoumaLightRepo extends JpaRepository<MetaZoumaLight, Long>, JpaSpecificationExecutor<MetaZoumaLight> {
-    @Query("update MetaZoumaLight t set t.del = true where t.id = ?1")
+public interface MetaZoumaLightRepo extends JpaRepository<MetaZouMaLight, Long>, JpaSpecificationExecutor<MetaZouMaLight> {
+    @Query("update MetaZouMaLight t set t.del = true where t.id = ?1")
     @Modifying
     @Transactional
     void softDelete(Long id);
 
-    MetaZoumaLight findByPublishAndDel (boolean publish,boolean del);
+    MetaZouMaLight findByPublishAndDel (boolean publish, boolean del);
 }

+ 0 - 20
src/main/java/com/izouma/nineth/service/MetaQuestionNoteService.java

@@ -1,20 +0,0 @@
-package com.izouma.nineth.service;
-
-import com.izouma.nineth.domain.MetaQuestionNote;
-import com.izouma.nineth.dto.PageQuery;
-import com.izouma.nineth.repo.MetaQuestionNoteRepo;
-import com.izouma.nineth.utils.JpaUtils;
-import lombok.AllArgsConstructor;
-import org.springframework.data.domain.Page;
-import org.springframework.stereotype.Service;
-
-@Service
-@AllArgsConstructor
-public class MetaQuestionNoteService {
-
-    private MetaQuestionNoteRepo metaQuestionNoteRepo;
-
-    public Page<MetaQuestionNote> all(PageQuery pageQuery) {
-        return metaQuestionNoteRepo.findAll(JpaUtils.toSpecification(pageQuery, MetaQuestionNote.class), JpaUtils.toPageRequest(pageQuery));
-    }
-}

+ 3 - 3
src/main/java/com/izouma/nineth/service/MetaZoumaLightService.java

@@ -1,6 +1,6 @@
 package com.izouma.nineth.service;
 
-import com.izouma.nineth.domain.MetaZoumaLight;
+import com.izouma.nineth.domain.MetaZouMaLight;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.repo.MetaZoumaLightRepo;
 import com.izouma.nineth.utils.JpaUtils;
@@ -14,7 +14,7 @@ public class MetaZoumaLightService {
 
     private MetaZoumaLightRepo metaZoumaLightRepo;
 
-    public Page<MetaZoumaLight> all(PageQuery pageQuery) {
-        return metaZoumaLightRepo.findAll(JpaUtils.toSpecification(pageQuery, MetaZoumaLight.class), JpaUtils.toPageRequest(pageQuery));
+    public Page<MetaZouMaLight> all(PageQuery pageQuery) {
+        return metaZoumaLightRepo.findAll(JpaUtils.toSpecification(pageQuery, MetaZouMaLight.class), JpaUtils.toPageRequest(pageQuery));
     }
 }

+ 8 - 2
src/main/java/com/izouma/nineth/web/MetaEmailController.java

@@ -1,14 +1,13 @@
 package com.izouma.nineth.web;
 import com.izouma.nineth.domain.MetaEmail;
-import com.izouma.nineth.service.MetaEmailService;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.MetaEmailRepo;
+import com.izouma.nineth.service.MetaEmailService;
 import com.izouma.nineth.utils.ObjUtils;
 import com.izouma.nineth.utils.excel.ExcelUtils;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
@@ -56,5 +55,12 @@ public class MetaEmailController extends BaseController {
         List<MetaEmail> data = all(pageQuery).getContent();
         ExcelUtils.export(response, data);
     }
+
+    @PostMapping("/{id}/publish")
+    public void publish(@PathVariable Long id) {
+        MetaEmail metaEmail = metaEmailRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+        metaEmail.setPublish(true);
+        metaEmailRepo.save(metaEmail);
+    }
 }
 

+ 0 - 57
src/main/java/com/izouma/nineth/web/MetaQuestionNoteController.java

@@ -1,57 +0,0 @@
-package com.izouma.nineth.web;
-import com.alibaba.excel.util.CollectionUtils;
-import com.izouma.nineth.domain.MetaQuestionNote;
-import com.izouma.nineth.dto.MetaRestResult;
-import com.izouma.nineth.dto.PageQuery;
-import com.izouma.nineth.repo.MetaQuestionNoteRepo;
-import com.izouma.nineth.service.MetaQuestionNoteService;
-import com.izouma.nineth.utils.SecurityUtils;
-import com.izouma.nineth.utils.excel.ExcelUtils;
-import lombok.AllArgsConstructor;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-@RestController
-@RequestMapping("/metaQuestionNote")
-@AllArgsConstructor
-public class MetaQuestionNoteController extends BaseController {
-    private MetaQuestionNoteService metaQuestionNoteService;
-    private MetaQuestionNoteRepo metaQuestionNoteRepo;
-
-    //@PreAuthorize("hasRole('ADMIN')")
-    @PostMapping("/all")
-    public Page<MetaQuestionNote> all(@RequestBody PageQuery pageQuery) {
-        return metaQuestionNoteService.all(pageQuery);
-    }
-
-    @GetMapping("/excel")
-    @ResponseBody
-    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
-        List<MetaQuestionNote> data = all(pageQuery).getContent();
-        ExcelUtils.export(response, data);
-    }
-
-    @PostMapping("/save")
-    public MetaRestResult<List<MetaQuestionNote>> save(@RequestBody List<Long> metaQuestionIds) {
-        if (CollectionUtils.isEmpty(metaQuestionIds)) {
-            return MetaRestResult.returnError("Illegal parameter : metaQuestionIds can not be null");
-        }
-        List<MetaQuestionNote> metaQuestionNotes = new ArrayList<>();
-        Long userId = SecurityUtils.getAuthenticatedUser().getId();
-        metaQuestionIds.forEach(id -> {
-            MetaQuestionNote metaQuestionNote = new MetaQuestionNote();
-            metaQuestionNote.setUserId(userId);
-            metaQuestionNote.setQuestionId(id);
-            metaQuestionNotes.add(metaQuestionNote);
-        });
-        return MetaRestResult.returnSuccess(metaQuestionNoteRepo.saveAll(metaQuestionNotes));
-
-    }
-
-}
-

+ 7 - 7
src/main/java/com/izouma/nineth/web/MetaZoumaLightController.java

@@ -1,5 +1,5 @@
 package com.izouma.nineth.web;
-import com.izouma.nineth.domain.MetaZoumaLight;
+import com.izouma.nineth.domain.MetaZouMaLight;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.MetaZoumaLightRepo;
@@ -24,15 +24,15 @@ public class MetaZoumaLightController extends BaseController {
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
-    public MetaZoumaLight save(@RequestBody MetaZoumaLight record) {
+    public MetaZouMaLight save(@RequestBody MetaZouMaLight record) {
         if (record.isPublish()) {
-            MetaZoumaLight metaZoumaLight = metaZoumaLightRepo.findByPublishAndDel(true,false);
+            MetaZouMaLight metaZoumaLight = metaZoumaLightRepo.findByPublishAndDel(true,false);
             if (Objects.nonNull(metaZoumaLight) && !Objects.equals(metaZoumaLight.getId(), record.getId())){
                 throw new BusinessException("仅允许发布一条!");
             }
         }
         if (record.getId() != null) {
-            MetaZoumaLight orig = metaZoumaLightRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            MetaZouMaLight orig = metaZoumaLightRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
             ObjUtils.merge(orig, record);
             return metaZoumaLightRepo.save(orig);
         }
@@ -42,12 +42,12 @@ public class MetaZoumaLightController extends BaseController {
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/all")
-    public Page<MetaZoumaLight> all(@RequestBody PageQuery pageQuery) {
+    public Page<MetaZouMaLight> all(@RequestBody PageQuery pageQuery) {
         return metaZoumaLightService.all(pageQuery);
     }
 
     @GetMapping("/get/{id}")
-    public MetaZoumaLight get(@PathVariable Long id) {
+    public MetaZouMaLight get(@PathVariable Long id) {
         return metaZoumaLightRepo.findById(id).orElseThrow(new BusinessException("无记录"));
     }
 
@@ -59,7 +59,7 @@ public class MetaZoumaLightController extends BaseController {
     @GetMapping("/excel")
     @ResponseBody
     public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
-        List<MetaZoumaLight> data = all(pageQuery).getContent();
+        List<MetaZouMaLight> data = all(pageQuery).getContent();
         ExcelUtils.export(response, data);
     }
 }

+ 1 - 9
src/main/vue/src/router.js

@@ -1612,15 +1612,7 @@ const router = new Router({
                     meta: {
                         title: '走马灯',
                     },
-                },
-                {
-                    path: '/metaQuestionNoteList',
-                    name: 'MetaQuestionNoteList',
-                    component: () => import(/* webpackChunkName: "metaQuestionNoteList" */ '@/views/MetaQuestionNoteList.vue'),
-                    meta: {
-                       title: '题库记录',
-                    },
-               }
+                }
                 /**INSERT_LOCATION**/
             ]
         },

+ 134 - 128
src/main/vue/src/views/MetaEmailEdit.vue

@@ -1,133 +1,139 @@
 <template>
-    <div class="edit-view">
-        <page-title>
-            <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
-            <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
-                删除
-            </el-button>
-            <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
-        </page-title>
-        <div class="edit-view__content-wrapper">
-            <div class="edit-view__content-section">
-                <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right"
-                         size="small"
-                         style="max-width: 500px;">
-                        <el-form-item prop="title" label="邮件标题">
-                                    <el-input v-model="formData.title"></el-input>
-                        </el-form-item>
-                        <el-form-item prop="auther" label="邮件作者">
-                                    <el-input v-model="formData.auther"></el-input>
-                        </el-form-item>
-                        <el-form-item prop="description" label="邮件内容" style="width: calc(100vw - 450px)">
-                        <el-input
-                            v-model="formData.description"
-                            type="textarea"
-                            :autosize="{ minRows: 3, maxRows: 20 }"
-                            placeholder="请输入邮件内容"
-                        >
-                        </el-input>
-                    </el-form-item>
-                    <el-form-item class="form-submit">
-                        <el-button @click="onSave" :loading="saving" type="primary">
-                            保存
-                        </el-button>
-                        <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
-                            删除
-                        </el-button>
-                        <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
-                    </el-form-item>
-                </el-form>
-            </div>
-        </div>
-    </div>
+	<div class="edit-view">
+		<page-title>
+			<el-button @click="$router.go(-1)" :disabled="saving"> 取消 </el-button>
+			<el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id"> 删除 </el-button>
+			<el-button @click="onSave" :loading="saving" type="primary"> 保存 </el-button>
+		</page-title>
+		<div class="edit-view__content-wrapper">
+			<div class="edit-view__content-section">
+				<el-form
+					:model="formData"
+					:rules="rules"
+					ref="form"
+					label-width="80px"
+					label-position="right"
+					size="small"
+					style="max-width: 500px"
+				>
+					<el-form-item prop="title" label="邮件标题">
+						<el-input v-model="formData.title"> </el-input>
+					</el-form-item>
+					<el-form-item prop="author" label="邮件作者">
+						<el-input v-model="formData.author"> </el-input>
+					</el-form-item>
+					<el-form-item prop="description" label="邮件内容" style="width: calc(100vw - 450px)">
+						<el-input
+							v-model="formData.description"
+							type="textarea"
+							:autosize="{ minRows: 3, maxRows: 20 }"
+							placeholder="请输入邮件内容"
+						>
+						</el-input>
+					</el-form-item>
+					<el-form-item class="form-submit">
+						<el-button @click="onSave" :loading="saving" type="primary"> 保存 </el-button>
+						<el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+							删除
+						</el-button>
+						<el-button @click="$router.go(-1)" :disabled="saving"> 取消 </el-button>
+					</el-form-item>
+				</el-form>
+			</div>
+		</div>
+	</div>
 </template>
 <script>
-    export default {
-        name: 'MetaEmailEdit',
-        created() {
-            if (this.$route.query.id) {
-                this.$http
-                    .get('metaEmail/get/' + this.$route.query.id)
-                    .then(res => {
-                        this.formData = res;
-                    })
-                    .catch(e => {
-                        console.log(e);
-                        this.$message.error(e.error);
-                    });
-            }
-        },
-        data() {
-            return {
-                saving: false,
-                formData: {
-                },
-                rules: {
-                    title: [
-                    {
-                        required: true,
-                        message: '请输入邮件标题',
-                        trigger: 'blur'
-                    }
-                ],
-                    auther: [
-                    {
-                        required: true,
-                        message: '请输入邮件作者',
-                        trigger: 'blur'
-                    }
-                ],
-                    description: [
-                    {
-                        required: true,
-                        message: '请输入邮件内容',
-                        trigger: 'blur'
-                    }
-                ]
-                },
-            }
-        },
-        methods: {
-            onSave() {
-                this.$refs.form.validate((valid) => {
-                    if (valid) {
-                        this.submit();
-                    } else {
-                        return false;
-                    }
-                });
-            },
-            submit() {
-                let data = {...this.formData};
+export default {
+	name: 'MetaEmailEdit',
+	created() {
+		if (this.$route.query.id) {
+			this.$http
+				.get('metaEmail/get/' + this.$route.query.id)
+				.then(res => {
+					this.formData = res;
+				})
+				.catch(e => {
+					console.log(e);
+					this.$message.error(e.error);
+				});
+		}
+	},
+	data() {
+		return {
+			saving: false,
+			formData: {},
+			rules: {
+				title: [
+					{
+						required: true,
+						message: '请输入邮件标题',
+						trigger: 'blur'
+					}
+				],
+				author: [
+					{
+						required: true,
+						message: '请输入邮件作者',
+						trigger: 'blur'
+					}
+				],
+				description: [
+					{
+						required: true,
+						message: '请输入邮件内容',
+						trigger: 'blur'
+					}
+				]
+			}
+		};
+	},
+	methods: {
+		onSave() {
+			this.$refs.form.validate(valid => {
+				if (valid) {
+					this.submit();
+				} else {
+					return false;
+				}
+			});
+		},
+		submit() {
+			let data = { ...this.formData };
 
-                this.saving = true;
-                this.$http
-                    .post('/metaEmail/save', data, {body: 'json'})
-                    .then(res => {
-                        this.saving = false;
-                        this.$message.success('成功');
-                        this.$router.go(-1);
-                    })
-                    .catch(e => {
-                        console.log(e);
-                        this.saving = false;
-                        this.$message.error(e.error);
-                    });
-            },
-            onDelete() {
-                this.$confirm('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
-                    return this.$http.post(`/metaEmail/del/${this.formData.id}`)
-                }).then(() => {
-                    this.$message.success('删除成功');
-                    this.$router.go(-1);
-                }).catch(e => {
-                    if (e !== 'cancel') {
-                        console.log(e);
-                        this.$message.error((e || {}).error || '删除失败');
-                    }
-                })
-            },
-        }
-    }
+			this.saving = true;
+			this.$http
+				.post('/metaEmail/save', data, { body: 'json' })
+				.then(res => {
+					this.saving = false;
+					this.$message.success('成功');
+					this.$router.go(-1);
+				})
+				.catch(e => {
+					console.log(e);
+					this.saving = false;
+					this.$message.error(e.error);
+				});
+		},
+		onDelete() {
+			this.$confirm('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+				.then(() => {
+					return this.$http.post(`/metaEmail/del/${this.formData.id}`);
+				})
+				.then(() => {
+					this.$message.success('删除成功');
+					this.$router.go(-1);
+				})
+				.catch(e => {
+					if (e !== 'cancel') {
+						console.log(e);
+						this.$message.error((e || {}).error || '删除失败');
+					}
+				});
+		}
+	}
+};
 </script>
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+
+</style>

+ 178 - 160
src/main/vue/src/views/MetaEmailList.vue

@@ -1,169 +1,187 @@
 <template>
-    <div  class="list-view">
-        <page-title>
-            <el-button @click="addRow" type="primary" icon="el-icon-plus" :disabled="fetchingData || downloading" class="filter-item">
-                新增
-            </el-button>
-            <el-button @click="download" icon="el-icon-upload2" :loading="downloading" :disabled="fetchingData" class="filter-item">
-                导出
-            </el-button>
-        </page-title>
-        <div class="filters-container">
-            <el-input
-                    placeholder="搜索..."
-                    v-model="search"
-                    clearable
-                    class="filter-item search"
-                    @keyup.enter.native="getData"
-            >
-                <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
-            </el-input>
-        </div>
-        <el-table :data="tableData" row-key="id" ref="table"
-                  header-row-class-name="table-header-row"
-                  header-cell-class-name="table-header-cell"
-                  row-class-name="table-row" cell-class-name="table-cell"
-                  :height="tableHeight" v-loading="fetchingData">
-            <el-table-column v-if="multipleMode" align="center" type="selection"
-                             width="50">
-            </el-table-column>
-            <el-table-column prop="id" label="ID" width="100">
-            </el-table-column>
-                                <el-table-column prop="title" label="邮件标题"
->
-                    </el-table-column>
-                    <el-table-column prop="auther" label="邮件作者"
->
-                    </el-table-column>
-                    <el-table-column prop="description" label="邮件内容"
->
-                    </el-table-column>
-            <el-table-column
-                    label="操作"
-                    align="center"
-                    fixed="right"
-                    width="150">
-                <template slot-scope="{row}">
-                    <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
-                    <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
+	<div class="list-view">
+		<page-title>
+			<el-button
+				@click="addRow"
+				type="primary"
+				icon="el-icon-plus"
+				:disabled="fetchingData || downloading"
+				class="filter-item"
+			>
+				新增
+			</el-button>
+			<el-button
+				@click="download"
+				icon="el-icon-upload2"
+				:loading="downloading"
+				:disabled="fetchingData"
+				class="filter-item"
+			>
+				导出
+			</el-button>
+		</page-title>
+		<div class="filters-container">
+			<el-input
+				placeholder="搜索..."
+				v-model="search"
+				clearable
+				class="filter-item search"
+				@keyup.enter.native="getData"
+			>
+				<el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
+			</el-input>
+		</div>
+		<el-table
+			:data="tableData"
+			row-key="id"
+			ref="table"
+			header-row-class-name="table-header-row"
+			header-cell-class-name="table-header-cell"
+			row-class-name="table-row"
+			cell-class-name="table-cell"
+			:height="tableHeight"
+			v-loading="fetchingData"
+		>
+			<el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
+			<el-table-column prop="id" align="center" label="ID" width="100"> </el-table-column>
+			<el-table-column prop="title" align="center" label="邮件标题" width="200"> </el-table-column>
+			<el-table-column prop="author" align="center" label="邮件作者" width="100"> </el-table-column>
+			<el-table-column prop="description" align="center" label="邮件内容" width="500"> </el-table-column>
+            <el-table-column prop="publish" align="center" label="是否发布" width="80">
+                <template slot-scope="{ row }">
+                    <el-tag :type="row.publish ? '' : 'info'"> {{ row.publish }} </el-tag>
                 </template>
             </el-table-column>
-        </el-table>
-        <div class="pagination-wrapper">
-            <!-- <div class="multiple-mode-wrapper">
-                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
-                <el-button-group v-else>
-                    <el-button @click="operation1">批量操作1</el-button>
-                    <el-button @click="operation2">批量操作2</el-button>
-                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
-                </el-button-group>
-            </div> -->
-            <el-pagination background @size-change="onSizeChange"
-                           @current-change="onCurrentChange" :current-page="page"
-                           :page-sizes="[10, 20, 30, 40, 50]" :page-size="pageSize"
-                           layout="total, sizes, prev, pager, next, jumper"
-                           :total="totalElements">
-            </el-pagination>
-        </div>
-
-    </div>
+			<el-table-column label="操作" align="center" fixed="right" width="300">
+				<template slot-scope="{ row }">
+					<el-button @click="editRow(row)" type="primary" size="mini" plain v-if="row && !row.publish">
+						编辑
+					</el-button>
+					<el-button @click="publish(row)" type="primary" size="mini" plain v-if="row && !row.publish"> 发布 </el-button>
+					<el-button @click="deleteRow(row)" type="danger" size="mini" plain v-if="row && !row.publish">
+						删除
+					</el-button>
+				</template>
+			</el-table-column>
+		</el-table>
+		<div class="pagination-wrapper">
+			<el-pagination
+				background
+				@size-change="onSizeChange"
+				@current-change="onCurrentChange"
+				:current-page="page"
+				:page-sizes="[10, 20, 30, 40, 50]"
+				:page-size="pageSize"
+				layout="total, sizes, prev, pager, next, jumper"
+				:total="totalElements"
+			>
+			</el-pagination>
+		</div>
+	</div>
 </template>
 <script>
-    import { mapState } from "vuex";
-    import pageableTable from "@/mixins/pageableTable";
+import { mapState } from 'vuex';
+import pageableTable from '@/mixins/pageableTable';
 
-    export default {
-        name: 'MetaEmailList',
-        mixins: [pageableTable],
-        data() {
-            return {
-                multipleMode: false,
-                search: "",
-                url: "/metaEmail/all",
-                downloading: false,
-            }
-        },
-        computed: {
-            selection() {
-                return this.$refs.table.selection.map(i => i.id);
-            }
-        },
-        methods: {
-            beforeGetData() {
-                return { search: this.search, query: { del: false } };
-            },
-            toggleMultipleMode(multipleMode) {
-                this.multipleMode = multipleMode;
-                if (!multipleMode) {
-                    this.$refs.table.clearSelection();
-                }
-            },
-            addRow() {
-                this.$router.push({
-                    path: "/metaEmailEdit",
-                    query: {
-                        ...this.$route.query
-                    }
-                });
-            },
-            editRow(row) {
-                this.$router.push({
-                    path: "/metaEmailEdit",
-                    query: {
-                    id: row.id
-                    }
-                });
-            },
-            download() {
-                this.downloading = true;
-                this.$axios
-                    .get("/metaEmail/excel", { 
-                        responseType: "blob",
-                        params: { size: 10000 }
-                    })
-                    .then(res => {
-                        console.log(res);
-                        this.downloading = false;
-                        const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
-                        const link = document.createElement("a");
-                        link.href = downloadUrl;
-                        link.setAttribute(
-                            "download",
-                            res.headers["content-disposition"].split("filename=")[1]
-                        );
-                        document.body.appendChild(link);
-                        link.click();
-                        link.remove();
-                    })
-                    .catch(e => {
-                        console.log(e);
-                        this.downloading = false;
-                        this.$message.error(e.error);
-                    });
-            },
-            operation1() {
-                this.$notify({
-                    title: '提示',
-                    message: this.selection
-                });
-            },
-            operation2() {
-                this.$message('操作2');
-            },
-            deleteRow(row) {
-                this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
-                    return this.$http.post(`/metaEmail/del/${row.id}`)
-                }).then(() => {
-                    this.$message.success('删除成功');
-                    this.getData();
-                }).catch(e => {
-                    if (e !== 'cancel') {
-                        this.$message.error(e.error);
-                    }
-                })
-            },
-        }
-    }
+export default {
+	name: 'MetaEmailList',
+	mixins: [pageableTable],
+	data() {
+		return {
+			multipleMode: false,
+			search: '',
+			url: '/metaEmail/all',
+			downloading: false
+		};
+	},
+	computed: {
+		selection() {
+			return this.$refs.table.selection.map(i => i.id);
+		}
+	},
+	methods: {
+		beforeGetData() {
+			return { search: this.search, query: { del: false } };
+		},
+		toggleMultipleMode(multipleMode) {
+			this.multipleMode = multipleMode;
+			if (!multipleMode) {
+				this.$refs.table.clearSelection();
+			}
+		},
+		addRow() {
+			this.$router.push({
+				path: '/metaEmailEdit',
+				query: {
+					...this.$route.query
+				}
+			});
+		},
+		editRow(row) {
+			this.$router.push({
+				path: '/metaEmailEdit',
+				query: {
+					id: row.id
+				}
+			});
+		},
+		download() {
+			this.downloading = true;
+			this.$axios
+				.get('/metaEmail/excel', {
+					responseType: 'blob',
+					params: { size: 10000 }
+				})
+				.then(res => {
+					console.log(res);
+					this.downloading = false;
+					const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+					const link = document.createElement('a');
+					link.href = downloadUrl;
+					link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
+					document.body.appendChild(link);
+					link.click();
+					link.remove();
+				})
+				.catch(e => {
+					console.log(e);
+					this.downloading = false;
+					this.$message.error(e.error);
+				});
+		},
+		deleteRow(row) {
+			this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+				.then(() => {
+					return this.$http.post(`/metaEmail/del/${row.id}`);
+				})
+				.then(() => {
+					this.$message.success('删除成功');
+					this.getData();
+				})
+				.catch(e => {
+					if (e !== 'cancel') {
+						this.$message.error(e.error);
+					}
+				});
+		},
+		publish(row) {
+			this.$alert('邮件发布之后不能编辑和删除,请确定是否发布邮件!', '提示', { type: 'info' })
+				.then(() => {
+					return this.$http.post(`/metaEmail/${row.id}/publish`);
+				})
+				.then(() => {
+					this.$message.success('发布成功');
+					this.getData();
+				})
+				.catch(e => {
+					if (e !== 'cancel') {
+						this.$message.error(e.error);
+					}
+				});
+		}
+	}
+};
 </script>
 <style lang="less" scoped>
+
 </style>

+ 0 - 170
src/main/vue/src/views/MetaQuestionNoteList.vue

@@ -1,170 +0,0 @@
-<template>
-	<div class="list-view">
-		<page-title>
-			<el-button
-				@click="download"
-				icon="el-icon-upload2"
-				:loading="downloading"
-				:disabled="fetchingData"
-				class="filter-item"
-			>
-				导出
-			</el-button>
-		</page-title>
-		<div class="filters-container">
-			<el-input
-				placeholder="搜索..."
-				v-model="search"
-				clearable
-				class="filter-item search"
-				@keyup.enter.native="getData"
-			>
-				<el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
-			</el-input>
-		</div>
-		<el-table
-			:data="tableData"
-			row-key="id"
-			ref="table"
-			header-row-class-name="table-header-row"
-			header-cell-class-name="table-header-cell"
-			row-class-name="table-row"
-			cell-class-name="table-cell"
-			:height="tableHeight"
-			v-loading="fetchingData"
-		>
-			<el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
-			<el-table-column prop="id" label="ID" width="100"> </el-table-column>
-			<el-table-column prop="userId" label="用户ID"> </el-table-column>
-			<el-table-column prop="questionId" label="题目ID"> </el-table-column>
-
-			<el-table-column label="操作" align="center" fixed="right" width="150">
-				<template slot-scope="{ row }">
-					<el-button @click="editRow(row)" type="primary" size="mini" plain> 编辑 </el-button>
-					<el-button @click="deleteRow(row)" type="danger" size="mini" plain> 删除 </el-button>
-				</template>
-			</el-table-column>
-		</el-table>
-		<div class="pagination-wrapper">
-			<!-- <div class="multiple-mode-wrapper"> 
-                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)"> 批量编辑 </el-button>
-                <el-button-group v-else> 
-                    <el-button @click="operation1"> 批量操作1 </el-button>
-                    <el-button @click="operation2"> 批量操作2 </el-button>
-                    <el-button @click="toggleMultipleMode(false)"> 取消 </el-button>
-                </el-button-group>
-            </div> -->
-			<el-pagination
-				background
-				@size-change="onSizeChange"
-				@current-change="onCurrentChange"
-				:current-page="page"
-				:page-sizes="[10, 20, 30, 40, 50]"
-				:page-size="pageSize"
-				layout="total, sizes, prev, pager, next, jumper"
-				:total="totalElements"
-			>
-			</el-pagination>
-		</div>
-	</div>
-</template>
-<script>
-import { mapState } from 'vuex';
-import pageableTable from '@/mixins/pageableTable';
-
-export default {
-	name: 'MetaQuestionNoteList',
-	mixins: [pageableTable],
-	data() {
-		return {
-			multipleMode: false,
-			search: '',
-			url: '/metaQuestionNote/all',
-			downloading: false
-		};
-	},
-	computed: {
-		selection() {
-			return this.$refs.table.selection.map(i => i.id);
-		}
-	},
-	methods: {
-		beforeGetData() {
-			return { search: this.search, query: { del: false } };
-		},
-		toggleMultipleMode(multipleMode) {
-			this.multipleMode = multipleMode;
-			if (!multipleMode) {
-				this.$refs.table.clearSelection();
-			}
-		},
-		addRow() {
-			this.$router.push({
-				path: '/metaQuestionNoteEdit',
-				query: {
-					...this.$route.query
-				}
-			});
-		},
-		editRow(row) {
-			this.$router.push({
-				path: '/metaQuestionNoteEdit',
-				query: {
-					id: row.id
-				}
-			});
-		},
-		download() {
-			this.downloading = true;
-			this.$axios
-				.get('/metaQuestionNote/excel', {
-					responseType: 'blob',
-					params: { size: 10000 }
-				})
-				.then(res => {
-					console.log(res);
-					this.downloading = false;
-					const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
-					const link = document.createElement('a');
-					link.href = downloadUrl;
-					link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
-					document.body.appendChild(link);
-					link.click();
-					link.remove();
-				})
-				.catch(e => {
-					console.log(e);
-					this.downloading = false;
-					this.$message.error(e.error);
-				});
-		},
-		operation1() {
-			this.$notify({
-				title: '提示',
-				message: this.selection
-			});
-		},
-		operation2() {
-			this.$message('操作2');
-		},
-		deleteRow(row) {
-			this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
-				.then(() => {
-					return this.$http.post(`/metaQuestionNote/del/${row.id}`);
-				})
-				.then(() => {
-					this.$message.success('删除成功');
-					this.getData();
-				})
-				.catch(e => {
-					if (e !== 'cancel') {
-						this.$message.error(e.error);
-					}
-				});
-		}
-	}
-};
-</script>
-<style lang="less" scoped>
-
-</style>