Parcourir la source

野生植物增加图片上传功能

Memory_LG il y a 11 mois
Parent
commit
84823a9b32

+ 9 - 2
data-ui/src/views/data/digitalforest/plant/index.vue

@@ -150,6 +150,11 @@
         <el-form-item label="备注" prop="remarks">
           <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" maxlength="255"/>
         </el-form-item>
+
+        <el-form-item label="图片" prop="attachId">
+          <ImageUpload ref="ImageUpload" :limit="1" :fileType="['png', 'jpg', 'jpeg']" :value="form.attachId"
+                       @input="getUrl" @removeImage="removeImage"></ImageUpload>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -221,7 +226,8 @@ export default {
         plantName: null,
         plantNumber: null,
         plantType: null,
-        remarks: null
+        remarks: null,
+        attachId: null
       },
       // 表单参数
       form: {},
@@ -316,7 +322,8 @@ export default {
         plantName: null,
         plantNumber: null,
         plantType: null,
-        remarks: null
+        remarks: null,
+        attachId:null
       };
       this.resetForm("form");
     },

+ 11 - 0
src/main/java/com/sooka/sponest/data/digitalforest/domain/CenterdataTForestPlant.java

@@ -69,6 +69,8 @@ public class CenterdataTForestPlant extends BaseBusinessEntity {
 
     private String year;
 
+    private String attachId;
+
     public String getYear() {
         return year;
     }
@@ -149,6 +151,14 @@ public class CenterdataTForestPlant extends BaseBusinessEntity {
         return remarks;
     }
 
+    public String getAttachId() {
+        return attachId;
+    }
+
+    public void setAttachId(String attachId) {
+        this.attachId = attachId;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -167,6 +177,7 @@ public class CenterdataTForestPlant extends BaseBusinessEntity {
                 .append("plantNumber", getPlantNumber())
                 .append("plantType", getPlantType())
                 .append("remarks", getRemarks())
+                .append("attachId", getAttachId())
                 .toString();
     }
 }

+ 5 - 1
src/main/resources/mapper/digitalforest/CenterdataTForestPlantMapper.xml

@@ -20,11 +20,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="plantNumber"    column="plant_number"    />
         <result property="plantType"    column="plant_type"    />
         <result property="remarks"    column="remarks"    />
+        <result property="attachId"    column="attach_id"    />
     </resultMap>
 
     <sql id="selectCenterdataTForestPlantVo">
         select a.id, a.dept_id, a.dept_name, a.create_by, a.create_name, a.create_time, a.update_by, a.update_name, a.update_time, a.longitude,
-               a.latitude, a.plant_name, a.plant_number, a.plant_type, a.remarks from centerdata_t_forest_plant a
+               a.latitude, a.plant_name, a.plant_number, a.plant_type, a.remarks, a.attach_id from centerdata_t_forest_plant a
     </sql>
 
     <select id="selectCenterdataTForestPlantList" parameterType="CenterdataTForestPlant" resultMap="CenterdataTForestPlantResult">
@@ -77,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="plantNumber != null">plant_number,</if>
             <if test="plantType != null">plant_type,</if>
             <if test="remarks != null">remarks,</if>
+            <if test="attachId != null">attach_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -94,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="plantNumber != null">#{plantNumber},</if>
             <if test="plantType != null">#{plantType},</if>
             <if test="remarks != null">#{remarks},</if>
+            <if test="attachId != null">#{attachId},</if>
          </trim>
     </insert>
 
@@ -114,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="plantNumber != null">plant_number = #{plantNumber},</if>
             <if test="plantType != null">plant_type = #{plantType},</if>
             <if test="remarks != null">remarks = #{remarks},</if>
+            <if test="attachId != null">attach_id = #{attachId},</if>
         </trim>
         where id = #{id}
     </update>