Bläddra i källkod

接口制作与完善,前端界面完成

kindring 2 år sedan
förälder
incheckning
dd753a443b

+ 12 - 2
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java

@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
 import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
 import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
+import com.genersoft.iot.vmp.vmanager.bean.AiLib;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
 import com.github.pagehelper.PageInfo;
 
@@ -66,8 +67,17 @@ public interface IVideoManagerStorage {
 	 * 获取数据库中所有的ai库
 	 * @return
 	 */
-	public List<AiConfig> queryLibraryList();
-
+	public List<AiLib> queryLibraryList();
+
+	public int addAiConfig(String configName,
+						   int arithmetic,
+						   int triggerType,
+						   int libraryId,
+						   int refreshTime,
+						   float score,
+						   String resourcePath,
+						   String uploadUrl,
+						   String pushUrl);
 	/**
 	 * 通过ai库的
 	 * @param libraryId

+ 8 - 5
src/main/java/com/genersoft/iot/vmp/storager/dao/HfyDevAiMapper.java

@@ -1,6 +1,7 @@
 package com.genersoft.iot.vmp.storager.dao;
 import com.genersoft.iot.vmp.gb28181.bean.AiConfig;
 import com.genersoft.iot.vmp.gb28181.bean.Device;
+import com.genersoft.iot.vmp.vmanager.bean.AiLib;
 import org.apache.ibatis.annotations.*;
 import org.springframework.stereotype.Repository;
 import java.util.List;
@@ -18,7 +19,7 @@ public interface HfyDevAiMapper {
     @Select("select * from ai_configs where arithmetic = ${arithmetic}")
     List<AiConfig> getAiConfigList(int arithmetic);
 
-    @Insert("insert into ai_config(" +
+    @Insert("insert into ai_configs(" +
             "libraryId," +
             "arithmetic," +
             "triggerType," +
@@ -48,8 +49,10 @@ public interface HfyDevAiMapper {
             ")")
     int devUseConfig(AiConfig aiConfig);
     @Select("select * from ai_library ")
-    List<AiConfig> getAiLibraryList();
+    List<AiLib> getAiLibraryList();
 
+    @Select("select * from ai_library where libraryId = #{libraryId} and arithmetic = #{arithmetic}")
+    List<AiLib> findLibByAiTypeAndLibraryId(int libraryId,int arithmetic);
 
     @Insert("insert into ai_library(" +
             "libraryName," +
@@ -60,17 +63,17 @@ public interface HfyDevAiMapper {
             "#{version}," +
             "#{arithmetic}" +
             ")")
-    int createAiLibrary(AiConfig aiConfig);
+    int createAiLibrary(AiLib aiLib);
 
     @Update(value = {"<script>" +
-            "update img_library" +
+            "update ai_library" +
             "set " +
             "<if test=\"libraryName\">, libraryName='${name}'</if>" +
             "<if test=\"version\">, version='${version}'</if>" +
             "<if test=\"arithmetic\">, libraryName='${arithmetic}'</if>" +
             "where libraryId = '${libraryId}'" +
             "</script>" })
-    int updateAiLibrary(AiConfig aiConfig);
+    int updateAiLibrary(AiLib aiLib);
 
     @Select("select * from lib_item where libraryId = #{libraryId}")
     List<AiConfig> getLibItemByLibraryId(int libraryId);

+ 54 - 1
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java

@@ -15,6 +15,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.storager.dao.*;
 import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
 import com.genersoft.iot.vmp.utils.DateUtil;
+import com.genersoft.iot.vmp.vmanager.bean.AiLib;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -61,6 +62,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
     private DeviceMapper deviceMapper;
 	@Autowired
 	private HfyDevAiMapper HfyDevAiMapper;
+
 	@Autowired
 	private DeviceChannelMapper deviceChannelMapper;
 
@@ -254,10 +256,61 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 	 * 获取数据库列表
 	 * @return
 	 */
-	public List<AiConfig> queryLibraryList(){
+	public List<AiLib> queryLibraryList(){
 		return HfyDevAiMapper.getAiLibraryList();
 	}
 
+	public int addAiConfig(String configName,
+						   int arithmetic,
+						   int triggerType,
+						   int libraryId,
+						   int refreshTime,
+						   float score,
+						   String resourcePath,
+						   String uploadUrl,
+						   String pushUrl){
+		logger.info("configName:"+configName+
+					" triggerType:"+triggerType+
+					" libraryId:"+libraryId+
+				" refreshTime:"+refreshTime+
+				" score:"+score+
+				" resourcePath:"+resourcePath+
+				" uploadUrl:"+uploadUrl+
+				" pushUrl:"+pushUrl);
+		// 火情类型,但是触发类型不是无限制
+		if(arithmetic == 2 && triggerType != 1){
+			logger.warn("火情类型,但是采用了黑白名单触发");
+			return -1;
+		}
+		// 黑白名单类型,但是没有选择libarayId
+		if(triggerType != 1 && libraryId <1){
+			logger.warn("在非限制类型下使用了ai库");
+			return -1;
+		}
+		if(libraryId > 0 ){
+			List<AiLib> aiLibList = HfyDevAiMapper.findLibByAiTypeAndLibraryId(libraryId,arithmetic);
+			if(aiLibList.isEmpty()){logger.warn("无法找到lib库"); return -1;}
+		}
+		// 查找是否能够找到lib库id
+
+		// 设置默认值
+		refreshTime = Math.max(10,refreshTime);// 最少10秒
+		refreshTime = Math.min(864000,refreshTime);// 最多10天
+		score = (float) Math.max(1.0,score);// 最少10秒
+		score = (float) Math.min(99.9,score);// 最多10天
+		// 默认资源更新地址
+		AiConfig aiConfig = new AiConfig();
+		aiConfig.setConfigName(configName);
+		aiConfig.setArithmetic(arithmetic);
+		aiConfig.setTriggerType(triggerType);
+		aiConfig.setRefreshTime(refreshTime);
+		aiConfig.setScore(score);
+		aiConfig.setResourcePath(resourcePath);
+		aiConfig.setUploadUrl(uploadUrl);
+		aiConfig.setPushUrl(pushUrl);
+		return HfyDevAiMapper.createAiConfig(aiConfig);
+	}
+
 	public List<AiConfig> queryItemByLibraryId(int libraryId){
 		return HfyDevAiMapper.getLibItemByLibraryId(libraryId);
 	}

+ 62 - 0
src/main/java/com/genersoft/iot/vmp/vmanager/bean/AiLib.java

@@ -0,0 +1,62 @@
+package com.genersoft.iot.vmp.vmanager.bean;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+
+public class AiLib {
+    @Schema(description = "图像库id")
+    private int libraryId;
+
+    @Schema(description = "图像库名称")
+    private String libraryName;
+
+    @Schema(description = "图像库版本")
+    private String version;
+
+    @Schema(description = "适用的算法")
+    private int arithmetic;
+
+    @Schema(description = "数量")
+    private int total;
+
+    public int getLibraryId() {
+        return libraryId;
+    }
+
+    public void setLibraryId(int libraryId) {
+        this.libraryId = libraryId;
+    }
+
+    public String getLibraryName() {
+        return libraryName;
+    }
+
+    public void setLibraryName(String libraryName) {
+        this.libraryName = libraryName;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public int getArithmetic() {
+        return arithmetic;
+    }
+
+    public void setArithmetic(int arithmetic) {
+        this.arithmetic = arithmetic;
+    }
+
+    public int getTotal() {
+        return total;
+    }
+
+    public void setTotal(int total) {
+        this.total = total;
+    }
+
+
+}

+ 31 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java

@@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.service.IDeviceChannelService;
 import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
+import com.genersoft.iot.vmp.vmanager.bean.AiLib;
 import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
@@ -120,7 +121,7 @@ public class DeviceQuery {
 
 	@Operation(summary = "ai数据库查询")
 	@GetMapping("/aiLibrary")
-	public List<AiConfig> aiLibrary(){
+	public List<AiLib> aiLibrary(){
 		if (logger.isDebugEnabled()) {
 			logger.debug("设备ai数据查询");
 		}
@@ -136,6 +137,35 @@ public class DeviceQuery {
 		return storager.queryItemByLibraryId(libraryId);
 	}
 
+	// allowEmptyValue
+	@Operation(summary = "添加ai库配置文件")
+	@Parameter(name = "aiConfig", description = "配置数据", required = true)
+//	@Parameter(name = "configName", description = "配置名称", required = true)
+//	@Parameter(name = "arithmetic", description = "算法id")
+//	@Parameter(name = "triggerType", description = "触发类型")
+//	@Parameter(name = "refreshTime", description = "刷新时间")
+//	@Parameter(name = "score", description = "检测阈值",allowEmptyValue = true)
+//	@Parameter(name = "resourcePath", description = "资源数据更新获取地址",allowEmptyValue = true)
+//	@Parameter(name = "uploadUrl", description = "多媒体资源上传地址",allowEmptyValue = true)
+//	@Parameter(name = "pushUrl", description = "回调地址",allowEmptyValue = true)
+	@PostMapping("/addAiConfig")
+	public int addAiConfig(@RequestBody AiConfig aiConfig){
+		if (logger.isDebugEnabled()) {
+			logger.debug("创建ai配置");
+		}
+		return storager.addAiConfig(
+				aiConfig.getConfigName(),
+				aiConfig.getArithmetic(),
+				aiConfig.getTriggerType(),
+				aiConfig.getLibraryId(),
+				aiConfig.getRefreshTime(),
+				aiConfig.getScore(),
+				aiConfig.getResourcePath(),
+				aiConfig.getUploadUrl(),
+				aiConfig.getPushUrl());
+//		return 1;
+	}
+
 	/**
 	 * 分页查询国标设备
 	 * @param page 当前页

+ 1 - 1
src/main/resources/application.yml

@@ -121,7 +121,7 @@ media:
     # [必须修改] zlm服务器唯一id,用于触发hook时区别是哪台服务器,general.mediaServerId
     id: your_server_id
     # [必须修改] zlm服务器的内网IP
-    ip: 192.168.1.203
+    ip: szgpay.ticp.net
     # [可选] 返回流地址时的ip,置空使用 media.ip
     stream-ip: szgpay.ticp.net
     #stream-ip: 192.168.1.203

+ 0 - 38
web_src/src/components/aiConfig.vue

@@ -165,44 +165,6 @@
         <el-button @click="showArithmeticDialog(aiTypes.fire)">选择{{toArithmetic(aiTypes.fire).text}}配置</el-button>
       </div>
     </el-card>
-
-
-<!--      <div class="ai-info">-->
-<!--        <div class="info-item">-->
-<!--          <div class="label">检验类型:</div>-->
-<!--          <div class="text">{{toTriggerType(item.triggerType).text}}</div>-->
-<!--        </div>-->
-
-<!--        <div class="info-item">-->
-<!--          <div class="label">触发相似度:</div>-->
-<!--          <div class="text">{{item.score}}%</div>-->
-<!--        </div>-->
-
-<!--        <div class="info-item">-->
-<!--          <div class="label">使用数据库:</div>-->
-<!--          <div class="text">{{ toAiData(item.libraryId).libraryName }}</div>-->
-<!--        </div>-->
-<!--        <div class="info-item">-->
-<!--          <div class="label">数据库版本:</div>-->
-<!--          <div class="text">{{ toAiData(item.libraryId).version }}</div>-->
-<!--        </div>-->
-<!--        <div class="info-item">-->
-<!--          <div class="label">名单数量:</div>-->
-<!--          <div class="text">{{ toAiData(item.libraryId).total }}</div>-->
-<!--        </div>-->
-<!--        <div class="info-item">-->
-<!--          <div class="label">资源路径:</div>-->
-<!--          <div class="text">{{ item.resourcePath }}</div>-->
-<!--        </div>-->
-<!--        <div class="info-item">-->
-<!--          <div class="label">多媒体资源上传地址:</div>-->
-<!--          <div class="text">{{ item.uploadUrl }}</div>-->
-<!--        </div>-->
-<!--        <div class="info-item">-->
-<!--          <div class="label">报警推送回调地址:</div>-->
-<!--          <div class="text">{{ item.pushUrl }}</div>-->
-<!--        </div>-->
-<!--      </div>-->
   </el-container>
 </div>
 </template>

+ 288 - 0
web_src/src/components/createConfig.vue

@@ -0,0 +1,288 @@
+<template>
+  <div id="aiConfig w-full" style="width:100%">
+    <div class="page-header">
+      <div class="page-title">
+        <el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="toBack" ></el-button>
+        <el-divider direction="vertical"></el-divider>
+        创建ai配置:
+        <el-select v-model="aiTypeVal" @change="getNowAiLib" placeholder="请选择">
+        <el-option
+          v-for="item in aiTypeArr"
+          :key="item.val"
+          :label="item.text"
+          :value="item.val"
+          :disabled="item.disabled">
+        </el-option>
+      </el-select>
+      </div>
+      <div class="page-header-btn">
+      </div>
+    </div>
+
+    <el-container v-loading="isLoading" style="min-height: 82vh;flex-direction: column;" >
+      <el-card  class="box-card mt-5">
+        <div slot="header" class="card-header flex space-between align-center" >
+          <span>输入配置对应参数</span>
+        </div>
+        <div class="box-center">
+          <div class="line">
+            <div class="label">检测类型</div>
+            <div class="input">
+              <el-select v-model="triggerType" placeholder="请选择" no-data-text="无法加载类型库">
+                <el-option
+                  v-for="item in triggerTypeArr"
+                  :key="item.val"
+                  :label="item.text"
+                  :value="item.val"
+                  :disabled="aiTypeVal===aiTypes.fire && (item.val !== triggerTypes.unlimited)">
+                </el-option>
+              </el-select>
+              <el-tooltip class="item" effect="dark" content="创建新数据库" placement="left-start">
+                <el-button icon="el-icon-plus" size="mini" style="font-size: 20px; color: #000;" type="text" @click="toAddLibrary" ></el-button>
+              </el-tooltip>
+            </div>
+          </div>
+          <div class="line" v-if="triggerType !== triggerTypes.unlimited ">
+            <div class="label">图形库</div>
+            <div class="input">
+              <el-select v-model="libraryId" placeholder="请选择" no-data-text="暂时没有算法库">
+                <el-option
+                  v-for="item in nowAiLib"
+                  :key="item.libraryId"
+                  :label="item.libraryName"
+                  :value="item.libraryId"
+                  :disabled="item.disabled">
+                </el-option>
+              </el-select>
+              <el-tooltip class="item" effect="dark" content="创建新数据库" placement="left-start">
+                <el-button icon="el-icon-plus" size="mini" style="font-size: 20px; color: #000;" type="text" @click="toAddLibrary" ></el-button>
+              </el-tooltip>
+            </div>
+          </div>
+          <div class="line">
+            <div class="label">数据刷新时间</div>
+            <div class="input">
+              <el-input-number v-model="refreshTime" controls-position="right" :min="10" :max="9999"></el-input-number>
+              <span class="ml-3.5">/秒</span>
+            </div>
+          </div>
+          <div class="line">
+            <div class="label">配置名称</div>
+            <div class="input">
+              <el-input placeholder="该配置展示给其他界面的名称" v-model="configName"/>
+            </div>
+          </div>
+
+          <div class="line">
+            <div class="label">检测阈值</div>
+            <div class="input">
+              <el-input-number v-model="score" controls-position="right" :min="1" :step="0.1" :max="99"></el-input-number>
+              <span class="ml-3.5">%</span>
+            </div>
+          </div>
+
+          <div class="line">
+            <div class="label">资源获取地址</div>
+            <div class="input">
+              <el-input placeholder="使用默认地址" v-model="resourcePath"/>
+            </div>
+          </div>
+
+          <div class="line">
+            <div class="label">多媒体数据上传地址</div>
+            <div class="input">
+              <el-input placeholder="使用默认地址" v-model="uploadUrl"/>
+            </div>
+          </div>
+
+          <div class="line">
+            <div class="label">回调数据地址</div>
+            <div class="input">
+              <el-input placeholder="默认不启用" v-model="pushUrl"/>
+            </div>
+          </div>
+
+        </div>
+        <el-divider></el-divider>
+        <el-button-group>
+          <el-button @click="init">重置</el-button>
+          <el-button @click="submitData" type="primary">确认添加</el-button>
+        </el-button-group>
+      </el-card>
+    </el-container>
+  </div>
+</template>
+
+<script>
+import handle from "@/until/handle";
+import {toNumber} from "@/until/typeTool";
+import aiMap from "@/map/ai";
+
+export default {
+  name: "createConfig",
+  data(){
+    return {
+      aiTypes: aiMap.aiTypes,
+      aiTypeArr: aiMap.getAITypeArr(),
+      triggerTypes: aiMap.triggerTypes,
+      triggerTypeArr: aiMap.getTriggerTypeArr(),
+      aiTypeVal: 0,
+      arithmetic: this.$route.params.arithmetic,
+      isLoading:false,
+      aiLibList: [],
+      nowAiLib: [],
+      configName: '',
+      libraryId: 0,
+      triggerType: 1,
+      refreshTime: 60,
+      score: 75.5,
+      resourcePath: "",
+      uploadUrl: "",
+      pushUrl: "",
+      errorTip: "",
+    }
+  },
+  mounted() {
+    // console.log('******************');
+    this.init();
+    this.loadAiLib();
+  },
+  methods:{
+    toArithmetic: aiMap.toArithmetic,
+    toTriggerType: aiMap.toTriggerType,
+    init(){
+      this.arithmetic = this.$route.params.arithmetic || this.aiTypeArr[0].val;
+      this.arithmetic = toNumber(this.arithmetic);
+      this.aiTypeVal = this.arithmetic;
+      this.libraryId = 0;
+      this.configName= '';
+      this.libraryId= 0;
+      this.triggerType= 1;
+      this.refreshTime= 60;
+      this.score= 75.5;
+      this.resourcePath= "";
+      this.uploadUrl= "";
+      this.pushUrl= "";
+      this.errorTip= "";
+      // console.log(this.aiTypeVal);
+    },
+    toBack(){
+      this.$router.back();
+      if (this.deviceId === "" ) {
+        this.beforeUrl = "/deviceList"
+      }
+    },
+    async loadAiLib(){
+      this.isLoading = true;
+      let that = this;
+      let [err,res] = await handle(this.$axios({
+        method: 'get',
+        url: `/api/device/query/aiLibrary`
+      }))
+      this.isLoading = false;
+      if (err){
+        console.error(err)
+        that.$message({
+          showClose: true,
+          message: err,
+          type: 'error'
+        });
+        return;
+      }
+      let data = res.data;
+      if(data.code === 0 ){
+        that.aiLibList = data.data;
+      }else{
+        console.log(res);
+        console.error("未知的返回结果!")
+      }
+    },
+    toAiData(num){
+      num=toNumber(num);
+      console.log(this.aiLibList);
+      let key = Object.keys(this.aiLibList).find(key=>toNumber(this.aiLibList[key].libraryId)===num);
+      return key?this.aiLibList[key]:false;
+    },
+    getNowAiLib(){
+      this.nowAiLib = this.aiLibList.filter(aiLib=>toNumber(aiLib.libraryId)===toNumber(this.aiTypeVal));
+      this.libraryId = 0;
+      this.triggerType = this.triggerTypes.unlimited;
+      console.log("------");
+      console.log(this.nowAiLib);
+    },
+    toAddLibrary(){
+
+    },
+    // 构建数据结构体
+    async submitData(){
+      if(!this.arithmetic){return this.$message.warning('未选择算法')}
+      if(!this.triggerType){return this.$message.warning('未选择触发类型')}
+      if(this.triggerType!==this.triggerTypes.unlimited && !this.libraryId){return this.$message.warning('未选择对应的数据库')}
+      let data = {};
+      data.configName = this.configName;
+      data.arithmetic = this.aiTypeVal;
+      data.triggerType = this.triggerType;
+      data.score = this.score;
+      data.refreshTime = this.refreshTime;
+      data.resourcePath = this.resourcePath;
+      data.uploadUrl = this.uploadUrl;
+      data.pushUrl = this.pushUrl;
+      this.isLoading = true;
+      let [err,res] = handle(this.$axios({
+        method: 'post',
+        url: '/api/device/query/addAiConfig',
+        data:data
+      }));
+      this.isLoading = false;
+      if(err){
+        console.error(err)
+        this.$message({
+          showClose: true,
+          message: err,
+          type: 'error'
+        });
+        return;
+      }
+      console.log(res);
+      this.$message.success("创建成功!!!");
+      this.init();
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+.box-center{
+  width:100%;
+  height: auto;
+}
+.box-center{
+  width: 100%;
+  height: auto;
+  padding: 10px 5px;
+  box-sizing: border-box;
+}
+.box-center .line{
+  width: 100%;
+  height: 35px;
+  display: flex;
+  margin-bottom: 10px;
+}
+.box-center .line .label{
+  width: 20%;
+  height: 100%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.box-center .line .input{
+  width: 80%;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  box-sizing: border-box;
+  padding-left: 8px;
+  border-left: 1px solid grey;
+}
+</style>

+ 8 - 1
web_src/src/components/dialog/addArithmetic.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="ptzControl " v-loading="isLoading">
-    <el-dialog :title="`选择${aiTypeInfo.text}配置`" top="0" :close-on-click-modal="false" :visible.sync="showThisDialog" @close="close()">
+    <el-dialog :title="`选择${aiTypeInfo.text}配置`" top="0" :close-on-click-modal="false" :visible.sync="showThisDialog" >
       <div id="shared" style="text-align: right; margin-top: 1rem;" v-if="aiConfigs.length">
         <div :class="`config ${selectConfigId==item.configId?'config-select':''} ${useArithmetic.configId==item.configId?'config-disable':''}`" v-for="item in aiConfigs"  :key="item.configId" @click="selectConfig(item.configId)">
           <div class="config-left">
@@ -15,6 +15,7 @@
         无法找到{{aiTypeInfo.text}}的配置文件
       </div>
       <el-button-group>
+        <el-button @click="toCreateConfig">创建配置</el-button>
         <el-button @click="saveDevAiConfig">确认</el-button>
       </el-button-group>
     </el-dialog>
@@ -94,6 +95,12 @@ export default {
       console.log(configId)
       this.selectConfigId = configId;
     },
+    toCreateConfig(){
+      this.$nextTick(()=>{
+        this.showThisDialog = false;
+      })
+      this.$router.push(`/createConfig/${this.arithmetic}`);
+    },
     saveDevAiConfig(){
       if(!this.selectConfigId){
         return this.$message.warning("请选择配置文件")

+ 25 - 4
web_src/src/map/ai.js

@@ -1,10 +1,9 @@
 import {toNumber} from "../until/typeTool";
-import {getMapVal} from "../until/mapTools"
+
 const arithmeticEnum = {
   face:{
     val: 1,
     text: '人脸识别',
-
   },
   fire:{
     val: 2,
@@ -27,7 +26,7 @@ const triggerTypeEnum = {
   },
   blackList:{
     val: 3,
-    text: 'b黑名单'
+    text: '黑名单'
   },
 }
 
@@ -67,6 +66,26 @@ function toTriggerType(num){
   return key?triggerTypeEnum[key]:false;
 }
 
+function getAITypeArr(){
+  return Object.keys(arithmeticEnum).map(key=>{
+    return {
+      ...arithmeticEnum[key],
+      disabled: false,
+    };
+  })
+}
+
+function getTriggerTypeArr(){
+  return Object.keys(triggerTypeEnum).map(key=>{
+    return {
+      ...triggerTypeEnum[key],
+      disabled: false,
+    };
+  })
+}
+
+
+
 
 export default {
   arithmeticEnum,
@@ -74,5 +93,7 @@ export default {
   aiTypes,
   triggerTypeEnum,
   toTriggerType,
-  triggerTypes
+  triggerTypes,
+  getAITypeArr,
+  getTriggerTypeArr
 }

+ 6 - 1
web_src/src/router/index.js

@@ -20,7 +20,7 @@ import deviceTree from '../components/common/DeviceTree.vue'
 import userManager from '../components/UserManager.vue'
 import aiConfig from "../components/aiConfig";
 import devAiEdit from "../components/devAiEdit";
-
+import createConfig from "@/components/createConfig";
 import wasmPlayer from '../components/common/jessibuca.vue'
 import rtcPlayer from '../components/dialog/rtcPlayer.vue'
 
@@ -71,6 +71,11 @@ export default new VueRouter({
           name: 'aiConfig',
           component: aiConfig,
         },
+        {
+          path: '/createConfig/:arithmetic?',
+          name: 'createConfig',
+          component: createConfig,
+        },
         {
           path: '/devEditAi/:aiId',
           name: 'devAiEdit',

+ 25 - 20
参考文档/数据库扩展.md

@@ -3,20 +3,20 @@
 > 以及使用的图像库
 > 
 ## 图像库 ai_library
-| 字段    | 类型 | 可选值 | 备注  |
-|-------| -- | --- |-----|
-| libraryId | int | pk | 图像库id  |
+| 字段    | 类型     | 可选值 | 备注  |
+|-------|--------| --- |-----|
+| libraryId | int    | pk | 图像库id  |
 | libraryName | string | "" | 图像库名称  |
 | version | string | "" | 图像库 版本uuid |
-| arithmetic | int | 1-3 | 适用的算法 |
-| total | int | n | 图像数量 |
+| arithmetic | int    | 1-3 | 适用的算法 |
+| total | int    | n | 图像数量 |
 
 ### 图像 lib_item
-| 字段    | 类型 | 可选值 | 备注  |
-|-------| -- | --- |-----|
-| libId | int | pk | 项目id |
-| libraryId | int | tk | 图像库id  |
-| itemType | int | 1,2 | 数据类型,图片,文本 |
+| 字段    | 类型     | 可选值 | 备注  |
+|-------|--------| --- |-----|
+| libId | int    | pk | 项目id |
+| libraryId | int    | tk | 图像库id  |
+| itemType | int    | 1,2 | 数据类型,图片,文本 |
 | imageUrl | string | url | 图片的链接 |
 | trait | string | '' | 用来匹配的图片的特征值 |
 | textValue | string | '' | 用于匹配的值 |
@@ -25,21 +25,26 @@
 | idCard | string | '' | 身份证号 |
 
 ## ai配置 aiConfigs
-| 字段    | 类型 | 可选值 | 备注  |
-|-------| -- | --- |-----|
-| configId | int | pk | 配置id |
-| libraryId | int | tk | 图形库id |
-| arithmetic | int | 1-3 | 对应的算法.人脸,火情,车牌, |
-| triggerType | int | 1-3 | 触发类型 无限制,白名单,黑名单 |
-| refreshTime | int | 0-n | 刷新时间 单位秒 |
-| score | float | 0.0-100.0 | 检测阈值 |
+| 字段    | 类型     | 可选值 | 备注  |
+|-------|--------| --- |-----|
+| configId | int    | pk | 配置id |
+| libraryId | int    | tk | 图形库id |
+| arithmetic | int    | 1-3 | 对应的算法.人脸,火情,车牌, |
+| triggerType | int    | 1-3 | 触发类型 无限制,白名单,黑名单 |
+| refreshTime | int    | 0-n | 刷新时间 单位秒 |
+| score | float  | 0.0-100.0 | 检测阈值 |
 | resourcePath | string | url | 资源数据更新获取地址 |
 | uploadUrl | string | url | 多媒体资源上传地址 |
 | pushUrl | string | url | 回调地址 | 
 
+
+资源获取地址 /api/device/lib?libId=xxxx
+
+多媒体资源上传地址 
+
 ### 国标设备配置 dev_ai_config
-| 字段    | 类型 | 可选值 | 备注  |
-|-------| -- | --- |-----|
+| 字段    | 类型  | 可选值 | 备注  |
+|-------|-----| --- |-----|
 | deviceId | int | tk | 设备id |
 | configId | int | tk | 配置id |
 | arithmetic | int | 1-3 | 对应的算法.人脸,火情,车牌, |