Procházet zdrojové kódy

数字农业增加可视化

hanfucheng před 11 měsíci
rodič
revize
6b7d5dce06

+ 7 - 0
data-ui/src/api/data/digitalforest/animal/animal.js

@@ -52,3 +52,10 @@ export function selectCenterMonitorlList(query) {
   })
 }
 
+export function DictOptions() {
+  return request({
+    url: `/center-data/dataDict/dictTree?type=ybdw_lv`,
+    method: 'get'
+  })
+}
+

+ 26 - 31
data-ui/src/views/data/digitalforest/animal/index.vue

@@ -3,14 +3,9 @@
     <el-form :model="queryParams" ref="queryForm" v-if="['2','1','3'].includes(routeParams.wildlifeType)" :inline="true"
              v-show="showSearch" @submit.native.prevent>
       <el-form-item label="动物种类" prop="type">
-        <el-select v-model="queryParams.type" placeholder="请选择动物种类" clearable size="small">
-          <el-option
-            v-for="dict in dict.type.forest_animal"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          />
-        </el-select>
+        <treeselect v-model="queryParams.type" :noOptionsText="'空'"
+                    :noResultsText="'空'" :options="cityOptions" placeholder="请选择动物种类" @select="hc"
+                    :disable-branch-nodes="true" style="width: 240px"/>
       </el-form-item>
       <el-form-item prop="deptId">
         <template slot="label">
@@ -98,11 +93,7 @@
 
     <el-table v-loading="loading" :data="animalList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center"/>
-      <el-table-column label="动物种类" align="center" prop="type">
-        <template slot-scope="scope">
-          <dict-tag :options="dict.type.forest_animal" :value="scope.row.type"/>
-        </template>
-      </el-table-column>
+      <el-table-column label="动物种类" align="center" prop="typeLabel"/>
       <el-table-column label="所属部门" align="center" prop="deptName"/>
 <!--      <el-table-column label="上报设备" align="center" prop="cameraName"-->
 <!--                       v-if="['2'].includes(routeParams.wildlifeType)"/>-->
@@ -163,14 +154,9 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="动物类型" prop="type">
-              <el-select v-model="form.type" placeholder="请选择类型">
-                <el-option
-                  v-for="dict in dict.type.forest_animal"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                ></el-option>
-              </el-select>
+              <treeselect v-model="form.type" :noOptionsText="'空'"
+                          :noResultsText="'空'" :options="cityOptions" placeholder="请选择动物类型" @select="hc"
+                          :disable-branch-nodes="true"/>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -239,15 +225,10 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="100px">
         <el-row>
           <el-col :span="12">
-            <el-form-item label="动物类型" prop="type" >
-              <el-select v-model="form.type" placeholder="请选择类型" :disabled="findView">
-                <el-option
-                  v-for="dict in dict.type.forest_animal"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                ></el-option>
-              </el-select>
+            <el-form-item label="动物类型" prop="type">
+              <treeselect v-model="form.type" :noOptionsText="'空'"
+                          :noResultsText="'空'" :options="cityOptions" placeholder="请选择动物类型" @select="hc"
+                          :disable-branch-nodes="true" :disabled="findView"/>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -335,7 +316,8 @@ import {
   delAnimal,
   addAnimal,
   updateAnimal,
-  selectCenterMonitorlList
+  selectCenterMonitorlList,
+  DictOptions
 } from "@/api/data/digitalforest/animal/animal";
 import supermap from '@/views/components/supermap'
 import deptselector from '@/views/components/deptselector'
@@ -360,6 +342,7 @@ export default {
       ISuperMapvisible: false,
       disabled: false,
       showLongitude: false,
+      cityOptions:[],
       // 部门树选项
       deptOptions: undefined,
       titleLongitude: '经纬度',
@@ -453,6 +436,7 @@ export default {
     // alert(this.$route.params.wildlifeType)
     this.routeParams.wildlifeType = this.$route.query.wildlifeType;
     this.getList();
+    this.getDictselect();
     this.getTreeselect();
     selectCenterMonitorlList(this.queryParams).then(response => {
       this.monitorList = response.data;
@@ -465,6 +449,17 @@ export default {
       this.form.deptName = node.label
       this.$refs.form.validateField("deptId")
     },
+    getDictselect(){
+      DictOptions().then(response => {
+        this.cityOptions =response;
+      });
+    },
+    hc(node){
+      // this.form.occurPlace = node.id
+      this.form.placeId = node.id
+      this.form.place = node.label
+      this.$refs.form.validateField("placeId")
+    },
     showMap() {
       this.ISuperMapvisible = true;
       this.$nextTick(() => {

+ 1 - 1
data-ui/src/views/data/digitalforest/lycyzcz/index.vue

@@ -119,7 +119,7 @@
         </el-form-item>
         <el-form-item label="产业类型" prop="industryType">
           <treeselect v-model="form.industryType" :noOptionsText="'空'"
-                      :noResultsText="'空'" :options="cityOptions" placeholder="请选择发生地" @select="hc"
+                      :noResultsText="'空'" :options="cityOptions" placeholder="请选择产业类型" @select="hc"
                       :disable-branch-nodes="true"/>
         </el-form-item>
         <el-form-item label="产业金额" prop="industrySum">

+ 3 - 1
src/main/java/com/sooka/sponest/data/digitalforest/domain/CenterdataTForestAnimal.java

@@ -51,10 +51,12 @@ public class CenterdataTForestAnimal extends BaseBusinessEntity {
      * 动物种类
      */
     @ApiModelProperty(value = "动物种类", required = true)
-    @Excel(name = "动物种类", dictType = "forest_animal")
     @NotBlank(message = "动物种类不能为空")
     private String type;
 
+    @Excel(name = "动物种类")
+    private String typeLabel;
+
     /**
      * 频次
      */

+ 3 - 1
src/main/java/com/sooka/sponest/data/digitalforest/domain/CenterdataTForestAnimalCount.java

@@ -52,10 +52,12 @@ public class CenterdataTForestAnimalCount extends BaseBusinessEntity {
     /**
      * 动物种类
      */
-    @Excel(name = "动物种类", dictType = "forest_animal")
     @NotBlank(message = "动物种类不能为空")
     private String type;
 
+    @Excel(name = "动物种类")
+    private String typeLabel;
+
     /**
      * 频次
      */

+ 17 - 8
src/main/resources/mapper/digitalforest/CenterdataTForestAnimalMapper.xml

@@ -44,8 +44,12 @@
 
     <select id="selectCenterdataTForestAnimalList" parameterType="CenterdataTForestAnimal"
             resultMap="CenterdataTForestAnimalResult">
-        <include refid="selectCenterdataTForestAnimalVo"/>
+        select a.id, a.create_by, a.create_time,a.create_name,a.update_name, a.update_by, a.update_time, a.data_status,
+        a.type, a.longitude, a.latitude, a.attach_id, a.dept_id, a.dept_name,
+        a.appear_time, d1.name typeLabel
+        from centerdata_t_forest_animal a
         left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+        LEFT JOIN centerdata_t_forest_dict d1 ON a.type = d1.id
         <where>
             <if test="dataStatus != null  and dataStatus != ''">and a.data_status = #{dataStatus}</if>
             <if test="type != null  and type != ''">and a.type = #{type}</if>
@@ -72,13 +76,15 @@
         a.create_name,
         a.update_time,
         a.update_name,
-        a.type,
+        d1.name typeLabel,
         a.dept_id,
         a.dept_name,
         a.longitude,
         a.latitude,
-        a.appear_time  from centerdata_t_forest_animal a
+        a.appear_time
+        from centerdata_t_forest_animal a
         left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+        LEFT JOIN centerdata_t_forest_dict d1 ON a.type = d1.id
         <where>
             <if test="dataStatus != null  and dataStatus != ''">and a.data_status = #{dataStatus}</if>
             <if test="type != null  and type != ''">and a.type = #{type}</if>
@@ -102,8 +108,9 @@
 
     <select id="exportSelectCenterdataTForestAnimalCountList" parameterType="CenterdataTForestAnimal"
             resultMap="CenterdataTForestAnimalCountResult">
-        select a.type, a.dept_id, a.dept_name ,count(a.id) frequency from centerdata_t_forest_animal a
+        select d1.name typeLabel, a.dept_id, a.dept_name ,count(a.id) frequency from centerdata_t_forest_animal a
         left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+        LEFT JOIN centerdata_t_forest_dict d1 ON a.type = d1.id
         <where>
             <if test="dataStatus != null  and dataStatus != ''">and a.data_status = #{dataStatus}</if>
             <if test="type != null  and type != ''">and a.type = #{type}</if>
@@ -111,7 +118,6 @@
             <if test="latitude != null  and latitude != ''">and a.latitude = #{latitude}</if>
             <if test="attachId != null  and attachId != ''">and a.attach_id = #{attachId}</if>
             <if test="deptId != null ">and a.dept_id = #{deptId}</if>
-            <if test="deptName != null  and deptName != ''">and a.dept_name like concat('%', #{deptName}, '%')</if>
             ${params.dataScope}
         </where>
         group by a.type, a.dept_id
@@ -122,10 +128,11 @@
     <select id="selectCenterdataTForestAnimalStandList" parameterType="CenterdataTForestAnimal"
             resultMap="CenterdataTForestAnimalResult">
         select a.id, a.create_by, c.camera_name as cameraName, a.create_time, a.update_by, a.update_time, a.data_status,
-        a.type, a.longitude, a.latitude, a.attach_id, a.dept_id, a.dept_name,
+        a.type, a.longitude, a.latitude, a.attach_id, a.dept_id, a.dept_name,d1.name typeLabel,
         a.appear_time from centerdata_t_forest_animal a
         left join ${database_monitor}.centermonitor_t_camera c on a.create_by = c.id
         left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+        LEFT JOIN centerdata_t_forest_dict d1 ON a.type = d1.id
         <where>
             <if test="dataStatus != null  and dataStatus != ''">and a.data_status like concat('%', #{dataStatus}, '%')
             </if>
@@ -134,6 +141,7 @@
             <if test="longitude != null  and longitude != ''">and a.longitude like concat('%', #{longitude}, '%')</if>
             <if test="latitude != null  and latitude != ''">and a.latitude like concat('%', #{latitude}, '%')</if>
             <if test="attachId != null  and attachId != ''">and a.attach_id = #{attachId}</if>
+            <if test="appearTime != null ">and a.appear_time = #{appearTime}</if>
             <if test="deptId != null">
                 <choose>
                     <when test="deptName != null and deptName == 0">
@@ -150,11 +158,12 @@
     <!--    统计-->
     <select id="selectCenterdataTForestAnimalCountList" parameterType="CenterdataTForestAnimal"
             resultMap="CenterdataTForestAnimalResult">
-        SELECT a.type,  a.dept_name, count(a.id) frequency from centerdata_t_forest_animal a
+        SELECT d1.name typeLabel,  a.dept_name, count(a.id) frequency from centerdata_t_forest_animal a
         left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+        LEFT JOIN centerdata_t_forest_dict d1 ON a.type = d1.id
         <where>
             <if test="dataStatus != null  and dataStatus != ''">and data_status = #{dataStatus}</if>
-            <if test="type != null  and type != ''">and type = #{type}</if>
+            <if test="type != null  and type != ''">and a.type = #{type}</if>
             <if test="longitude != null  and longitude != ''">and longitude = #{longitude}</if>
             <if test="latitude != null  and latitude != ''">and latitude = #{latitude}</if>
             <if test="attachId != null  and attachId != ''">and attach_id = #{attachId}</if>