Explorar o código

党建管理修改

lidongze %!s(int64=3) %!d(string=hai) anos
pai
achega
97f171a219

+ 7 - 0
src/main/java/com/izouma/nineth/domain/MetaResources.java

@@ -1,6 +1,7 @@
 package com.izouma.nineth.domain;
 
 import com.izouma.nineth.annotations.Searchable;
+import com.izouma.nineth.enums.MetaResourcesType;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -9,6 +10,8 @@ import lombok.NoArgsConstructor;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
 
 @Data
 @AllArgsConstructor
@@ -21,6 +24,10 @@ public class MetaResources extends BaseEntity {
     @Searchable
     private String name;
 
+    @Enumerated(EnumType.STRING)
+    @ApiModelProperty("类型")
+    private MetaResourcesType type;
+
     @ApiModelProperty("文件")
     @Column(columnDefinition = "TEXT")
     private String value;

+ 16 - 0
src/main/java/com/izouma/nineth/enums/MetaResourcesType.java

@@ -0,0 +1,16 @@
+package com.izouma.nineth.enums;
+
+public enum MetaResourcesType {
+    PARTY("党建"),
+    ;
+
+    private final String description;
+
+    MetaResourcesType(String description) {
+        this.description = description;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+}

+ 123 - 107
src/main/vue/src/views/MetaResourcesEdit.vue

@@ -1,118 +1,134 @@
 <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="82px" label-position="right" size="small"
-					style="max-width: 500px;">
-					<el-form-item prop="name" label="文件名称">
-						<el-input v-model="formData.name"></el-input>
-					</el-form-item>
-					<el-form-item prop="value" label="文件">
+    <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="82px" label-position="right" size="small"
+                    style="max-width: 500px;">
+                    <el-form-item prop="name" label="文件名称">
+                        <el-input v-model="formData.name"></el-input>
+                    </el-form-item>
+                    <el-form-item prop="type" label="类型">
+                        <el-select v-model="formData.type" clearable filterable placeholder="请选择">
+                            <el-option v-for="item in typeOptions" :key="item.value" :label="item.label"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
+                    </el-form-item>
+                    <el-form-item prop="value" label="文件">
                         <file-upload v-model="formData.value" :limit="1"></file-upload>
-					</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>
+                    </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: 'MetaResourcesEdit',
-    created() {
-        if (this.$route.query.id) {
-            this.$http
-                .get('metaResources/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: {
-                name: [
-                    {
-                        required: true,
-                        message: '请输入名称',
+	name: 'MetaResourcesEdit',
+	created() {
+		if (this.$route.query.id) {
+			this.$http
+				.get('metaResources/get/' + this.$route.query.id)
+				.then(res => {
+					this.formData = res;
+				})
+				.catch(e => {
+					console.log(e);
+					this.$message.error(e.error);
+				});
+		}
+	},
+	data() {
+		return {
+			saving: false,
+            type: '',
+			typeOptions: [{ label: '党建', value: 'PARTY' }],
+			formData: {},
+			rules: {
+				name: [
+					{
+						required: true,
+						message: '请输入名称',
+						trigger: 'blur'
+					}
+				],
+				type: [
+                    { 
+                        required: true, 
+                        message: '请选择类型',
                         trigger: 'blur'
-                    }
+                     }
                 ],
-                value: [
-                    {
-                        required: true,
-                        message: '请上传文件',
-                        trigger: 'blur'
-                    }
-                ]
-            }
-        };
-    },
-    methods: {
-        onSave() {
-            this.$refs.form.validate(valid => {
-                if (valid) {
-                    this.submit();
-                } else {
-                    return false;
-                }
-            });
-        },
-        submit() {
-            let data = { ...this.formData };
+				value: [
+					{
+						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('/metaResources/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(`/metaResources/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('/metaResources/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(`/metaResources/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>

+ 8 - 1
src/main/vue/src/views/MetaResourcesList.vue

@@ -11,6 +11,9 @@
 			</el-button>
 		</page-title>
 		<div class="filters-container">
+            <el-select v-model="type" clearable placeholder="请选择类型" @change="getData">
+                <el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
+            </el-select>
 			<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>
@@ -23,6 +26,7 @@
 			</el-table-column>
 			<el-table-column prop="name" label="文件名称" width="300" align="center">
 			</el-table-column>
+            <el-table-column prop="type" align="center" label="类型" :formatter="typeFormatter"> </el-table-column>
             <el-table-column prop="value" label="文件地址" align="center">
 			</el-table-column>
 			<el-table-column label="操作" align="center" fixed="right" width="150">
@@ -52,6 +56,9 @@ export default {
         return {
             multipleMode: false,
             search: '',
+            typeOptions: [
+                { label: '党建', value: 'PARTY' }
+            ],
             url: '/metaResources/all',
             downloading: false
         };
@@ -70,7 +77,7 @@ export default {
             return '';
         },
         beforeGetData() {
-            return { search: this.search, query: { del: false } };
+            return { search: this.search, query: { del: false ,type: this.type} };
         },
         toggleMultipleMode(multipleMode) {
             this.multipleMode = multipleMode;