luobo 3 лет назад
Родитель
Сommit
d75dd836fd

+ 7 - 0
smart-admin/src/main/java/com/huijy/web/controller/management/LabelController.java

@@ -44,6 +44,13 @@ public class LabelController extends BaseController
         List<Label> list = labelService.selectLabelList(label);
         return getDataTable(list);
     }
+    @GetMapping("/list/{type}")
+    public AjaxResult select(@PathVariable String type){
+        Label label = new Label();
+        label.setMarkerType(type);
+        List<Label> list = labelService.selectLabelList(label);
+        return AjaxResult.success(list);
+    }
 
     /**
      * 导出标签管理列表

+ 1 - 1
smart-admin/src/main/java/com/huijy/web/controller/management/MarkerController.java

@@ -24,7 +24,7 @@ import com.huijy.common.core.page.TableDataInfo;
  * 标记物管理Controller
  *
  * @author luobo
- * @date 2021-09-01
+ * @date 2021-09-08
  */
 @RestController
 @RequestMapping("/management/marker")

+ 15 - 1
smart-system/src/main/java/com/huijy/management/domain/Marker.java

@@ -10,7 +10,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
  * 标记物管理对象 t_marker
  *
  * @author luobo
- * @date 2021-09-01
+ * @date 2021-09-08
  */
 public class Marker extends BaseEntity
 {
@@ -23,6 +23,10 @@ public class Marker extends BaseEntity
     @Excel(name = "标记物名称")
     private String markerName;
 
+    /** 标记物类型 */
+    @Excel(name = "标记物类型")
+    private String markerType;
+
     /** 标记物地址 */
     @Excel(name = "标记物地址")
     private String address;
@@ -89,6 +93,15 @@ public class Marker extends BaseEntity
     {
         return markerName;
     }
+    public void setMarkerType(String markerType)
+    {
+        this.markerType = markerType;
+    }
+
+    public String getMarkerType()
+    {
+        return markerType;
+    }
     public void setAddress(String address)
     {
         this.address = address;
@@ -203,6 +216,7 @@ public class Marker extends BaseEntity
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
             .append("markerId", getMarkerId())
             .append("markerName", getMarkerName())
+            .append("markerType", getMarkerType())
             .append("address", getAddress())
             .append("showPictures", getShowPictures())
             .append("iconPictures", getIconPictures())

+ 1 - 1
smart-system/src/main/java/com/huijy/management/mapper/MarkerMapper.java

@@ -7,7 +7,7 @@ import com.huijy.management.domain.Marker;
  * 标记物管理Mapper接口
  * 
  * @author luobo
- * @date 2021-09-01
+ * @date 2021-09-08
  */
 public interface MarkerMapper 
 {

+ 1 - 1
smart-system/src/main/java/com/huijy/management/service/IMarkerService.java

@@ -7,7 +7,7 @@ import com.huijy.management.domain.Marker;
  * 标记物管理Service接口
  * 
  * @author luobo
- * @date 2021-09-01
+ * @date 2021-09-08
  */
 public interface IMarkerService 
 {

+ 1 - 1
smart-system/src/main/java/com/huijy/management/service/impl/MarkerServiceImpl.java

@@ -11,7 +11,7 @@ import com.huijy.management.service.IMarkerService;
  * 标记物管理Service业务层处理
  *
  * @author luobo
- * @date 2021-09-01
+ * @date 2021-09-08
  */
 @Service
 public class MarkerServiceImpl implements IMarkerService

+ 6 - 1
smart-system/src/main/resources/mapper/management/MarkerMapper.xml

@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="Marker" id="MarkerResult">
         <result property="markerId"    column="marker_id"    />
         <result property="markerName"    column="marker_name"    />
+        <result property="markerType"    column="marker_type"    />
         <result property="address"    column="address"    />
         <result property="showPictures"    column="show_pictures"    />
         <result property="iconPictures"    column="icon_pictures"    />
@@ -22,13 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectMarkerVo">
-        select marker_id, marker_name, address, show_pictures, icon_pictures, lat, lng, label_text, business_hours, shape_type, location_set, radius, brief_content, content from t_marker
+        select marker_id, marker_name, marker_type, address, show_pictures, icon_pictures, lat, lng, label_text, business_hours, shape_type, location_set, radius, brief_content, content from t_marker
     </sql>
 
     <select id="selectMarkerList" parameterType="Marker" resultMap="MarkerResult">
         <include refid="selectMarkerVo"/>
         <where>  
             <if test="markerName != null  and markerName != ''"> and marker_name like concat('%', #{markerName}, '%')</if>
+            <if test="markerType != null  and markerType != ''"> and marker_type = #{markerType}</if>
         </where>
     </select>
     
@@ -42,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="markerId != null">marker_id,</if>
             <if test="markerName != null">marker_name,</if>
+            <if test="markerType != null">marker_type,</if>
             <if test="address != null">address,</if>
             <if test="showPictures != null">show_pictures,</if>
             <if test="iconPictures != null">icon_pictures,</if>
@@ -58,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="markerId != null">#{markerId},</if>
             <if test="markerName != null">#{markerName},</if>
+            <if test="markerType != null">#{markerType},</if>
             <if test="address != null">#{address},</if>
             <if test="showPictures != null">#{showPictures},</if>
             <if test="iconPictures != null">#{iconPictures},</if>
@@ -77,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update t_marker
         <trim prefix="SET" suffixOverrides=",">
             <if test="markerName != null">marker_name = #{markerName},</if>
+            <if test="markerType != null">marker_type = #{markerType},</if>
             <if test="address != null">address = #{address},</if>
             <if test="showPictures != null">show_pictures = #{showPictures},</if>
             <if test="iconPictures != null">icon_pictures = #{iconPictures},</if>

+ 8 - 0
smart-ui/src/api/management/label.js

@@ -9,6 +9,14 @@ export function listLabel(query) {
   })
 }
 
+// 查询标签管理列表
+export function selectLabel(type) {
+    return request({
+      url: '/management/label/list/'+type,
+      method: 'get'
+    })
+  }
+
 // 查询标签管理详细
 export function getLabel(labelId) {
   return request({

+ 71 - 2
smart-ui/src/views/management/marker/index.vue

@@ -7,6 +7,21 @@
       v-show="showSearch"
       label-width="68px"
     >
+      <el-form-item label="标记物类型" prop="markerType">
+        <el-select
+          v-model="queryParams.markerType"
+          placeholder="请选择标记物类型"
+          clearable
+          size="small"
+        >
+          <el-option
+            v-for="dict in markerTypeOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
       <el-form-item label="标记物名称" prop="markerName">
         <el-input
           v-model="queryParams.markerName"
@@ -91,6 +106,12 @@
     >
       <el-table-column type="selection" width="55" align="center" />
       <!-- <el-table-column label="标记物id" align="center" prop="markerId" /> -->
+      <el-table-column
+        label="类型"
+        align="center"
+        prop="markerType"
+        :formatter="markerTypeFormat"
+      />
       <el-table-column label="名称" align="center" prop="markerName" />
       <el-table-column label="地址" align="center" prop="address" />
       <!-- <el-table-column label="展示图片" align="center" prop="showPictures" /> -->
@@ -190,8 +211,31 @@
                 placeholder="请输入营业时间"
               />
             </el-form-item>
+            <el-form-item label="标记物类型" prop="markerType">
+              <el-select
+                v-model="form.markerType"
+                placeholder="请选择标记物类型"
+                @change="markerTypeChange"
+              >
+                <el-option
+                  v-for="dict in markerTypeOptions"
+                  :key="dict.dictValue"
+                  :label="dict.dictLabel"
+                  :value="dict.dictValue"
+                ></el-option>
+              </el-select>
+            </el-form-item>
             <el-form-item label="标签" prop="labelText">
-              <el-input v-model="form.labelText" placeholder="请输入标签" />
+              <!-- <el-input v-model="form.labelText" placeholder="请输入标签" /> -->
+              <el-select v-model="form.labelText" multiple placeholder="请选择">
+                <el-option
+                  v-for="item in labelList"
+                  :key="item.name"
+                  :label="item.name"
+                  :value="item.name"
+                >
+                </el-option>
+              </el-select>
             </el-form-item>
           </el-tab-pane>
           <el-tab-pane label="地图" name="second">
@@ -284,7 +328,7 @@
 
 <script>
 import { listMarker, getMarker, delMarker, addMarker, updateMarker, exportMarker } from "@/api/management/marker";
-
+import { selectLabel } from "@/api/management/label";
 export default {
   name: "Marker",
   data () {
@@ -311,6 +355,8 @@ export default {
       open: false,
       // 画图形状字典
       shapeTypeOptions: [],
+      // 标记物类型字典
+      markerTypeOptions: [],
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -328,6 +374,7 @@ export default {
       tmap: undefined,
       map: undefined,
       baseUrl: process.env.VUE_APP_BASE_API,
+      labelList: undefined
 
     };
   },
@@ -336,6 +383,9 @@ export default {
     this.getDicts("shape_type").then(response => {
       this.shapeTypeOptions = response.data;
     });
+    this.getDicts("marker_type").then(response => {
+      this.markerTypeOptions = response.data;
+    });
   },
   methods: {
     /** 查询标记物管理列表 */
@@ -347,6 +397,10 @@ export default {
         this.loading = false;
       });
     },
+    // 标记物类型字典翻译
+    markerTypeFormat (row, column) {
+      return this.selectDictLabel(this.markerTypeOptions, row.markerType);
+    },
     // 画图形状字典翻译
     shapeTypeFormat (row, column) {
       return this.selectDictLabel(this.shapeTypeOptions, row.shapeType);
@@ -364,6 +418,7 @@ export default {
     reset () {
       this.form = {
         markerId: null,
+        markerType: null,
         markerName: null,
         address: null,
         showPictures: null,
@@ -414,6 +469,7 @@ export default {
         this.form = response.data;
         this.open = true;
         this.title = "修改标记物管理";
+        this.form.labelText = response.data.labelText.split(",")
 
       });
     },
@@ -421,6 +477,10 @@ export default {
     submitForm () {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          if (this.form.labelText) {
+            this.form.labelText = this.form.labelText.join(",")
+          }
+
           if (this.form.markerId != null) {
             updateMarker(this.form).then(response => {
               this.msgSuccess("修改成功");
@@ -655,6 +715,15 @@ export default {
 
         this.editor.setActiveOverlay(this.form.shapeType)
       }
+    },
+    markerTypeChange (val) {
+      selectLabel(val).then(res => {
+        console.log(res)
+        this.labelList = res.data;
+      })
+      // selectLabel(this.form.markerType).then(res=>{
+      //     console.log(res);
+      // })
     }
   }
 };