|
@@ -1,22 +1,43 @@
|
|
|
<template>
|
|
|
<div id="aiLib w-full" style="width:100%">
|
|
|
<div class="page-header">
|
|
|
- <div class="page-title">
|
|
|
+ <div class="page-title flex align-center">
|
|
|
<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="请选择ai类型">
|
|
|
- <el-option
|
|
|
- v-for="item in aiTypeArr"
|
|
|
- :key="item.val"
|
|
|
- :label="item.text"
|
|
|
- :value="item.val"
|
|
|
- :disabled="item.disabled">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- <el-button icon="el-icon-search" type="primary" :loading="isLoading">搜索</el-button>
|
|
|
+
|
|
|
+ <div class="">
|
|
|
+ <el-input class="ml-5 input-with-select" placeholder="输入算法名片段" v-model="key" >
|
|
|
+ <el-select v-model="aiTypeVal"
|
|
|
+ style="width: 120px;"
|
|
|
+ slot="prepend"
|
|
|
+ @change="getNowAiLib" placeholder="请选择ai类型">
|
|
|
+ <el-option
|
|
|
+ :key="0"
|
|
|
+ label="全部算法"
|
|
|
+ :value="0">
|
|
|
+ </el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="item in aiTypeArr"
|
|
|
+ :key="item.val"
|
|
|
+ :label="item.text"
|
|
|
+ :value="item.val"
|
|
|
+ :disabled="item.disabled">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button slot="append"
|
|
|
+ style="width: 80px;"
|
|
|
+ icon="el-icon-search"
|
|
|
+ type="primary"
|
|
|
+ :loading="isLoading"
|
|
|
+ @click="searchLibList">搜索</el-button>
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="page-header-btn">
|
|
|
+ <el-tooltip class="item" effect="dark" content="创建新算法库" placement="left-start">
|
|
|
+ <el-button icon="el-icon-plus" circle size="mini" @click="showCreateLib" ></el-button>
|
|
|
+ </el-tooltip>
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-table :data="libList" style="width: 100%;font-size: 12px;" :height="winHeight" header-row-class-name="table-header">
|
|
@@ -47,6 +68,7 @@
|
|
|
<script>
|
|
|
import {toNumber} from "@/until/typeTool";
|
|
|
import aiMap from "@/map/ai";
|
|
|
+import handle from "@/until/handle";
|
|
|
|
|
|
export default {
|
|
|
name: "AiLib",
|
|
@@ -62,8 +84,14 @@ export default {
|
|
|
currentPage: 1,
|
|
|
count: 15,
|
|
|
total: 1,
|
|
|
-
|
|
|
+ key: '',
|
|
|
+ searchKey: '',
|
|
|
+ searchArithmetic: '',
|
|
|
+ lastPage: 1,
|
|
|
}},
|
|
|
+ mounted(){
|
|
|
+ this.searchLibList();
|
|
|
+ },
|
|
|
methods:{
|
|
|
toBack(){
|
|
|
this.$router.back();
|
|
@@ -76,8 +104,48 @@ export default {
|
|
|
this.libraryId = 0;
|
|
|
this.triggerType = this.triggerTypes.unlimited;
|
|
|
},
|
|
|
+ async searchData(searchParam){
|
|
|
+ this.isLoading = true;
|
|
|
+ this.searchKey = searchParam.key;
|
|
|
+ this.searchArithmetic = searchParam.arithmetic;
|
|
|
+ let [err,res] = await handle(this.$axios({
|
|
|
+ method: 'get',
|
|
|
+ url: `/api/device/query/libs`,
|
|
|
+ params: searchParam
|
|
|
+ }))
|
|
|
+ this.isLoading = false;
|
|
|
+ if(err){
|
|
|
+ console.error(err);
|
|
|
+ this.$message.error(err.message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log('------------');
|
|
|
+ console.log(res)
|
|
|
+ let result = res.data;
|
|
|
+ if(res.data.code === 0){
|
|
|
+ this.total = result.data.total;
|
|
|
+ this.libList = result.data.list;
|
|
|
+ }
|
|
|
+ },
|
|
|
searchLibList(){
|
|
|
-
|
|
|
+ // 按搜索按钮进行搜索.
|
|
|
+ let searchParam = {
|
|
|
+ page: 1,
|
|
|
+ count: this.count,
|
|
|
+ key: this.key
|
|
|
+ }
|
|
|
+ if(this.aiTypeVal){searchParam.arithmetic = this.aiTypeVal}
|
|
|
+ this.searchData(searchParam);
|
|
|
+ },
|
|
|
+ changePage(){
|
|
|
+ // 使用当前配置进行搜索
|
|
|
+ let searchParam = {
|
|
|
+ page: this.currentPage,
|
|
|
+ count: this.count,
|
|
|
+ key: this.searchKey,
|
|
|
+ arithmetic: this.searchArithmetic
|
|
|
+ }
|
|
|
+ this.searchData(searchParam);
|
|
|
},
|
|
|
/**
|
|
|
* 编辑lib数据
|
|
@@ -86,18 +154,23 @@ export default {
|
|
|
editLibHandle(row){
|
|
|
this.$router.push(`/libEdit/${row.libraryId}`);
|
|
|
},
|
|
|
+ showCreateLib(){
|
|
|
+ this.$router.push(`/createLib`);
|
|
|
+ },
|
|
|
currentChange: function (val) {
|
|
|
this.currentPage = val;
|
|
|
- this.searchLibList();
|
|
|
+ this.changePage();
|
|
|
},
|
|
|
handleSizeChange: function (val) {
|
|
|
this.count = val;
|
|
|
- this.searchLibList();
|
|
|
+ this.changePage();
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-
|
|
|
+.ml-5{
|
|
|
+ margin-left: 5px;
|
|
|
+}
|
|
|
</style>
|