<template>
|
<div class="right-main">
|
<div class="top-title">
|
<p>应用算法列表</p>
|
</div>
|
<div class="control-bar">
|
<div class="line-one">
|
<div class="screening">
|
<label>基础算法</label>
|
<el-select v-model="sdk_type" size="small" placeholder="请选择">
|
<el-option
|
v-for="item in baseSdkList"
|
:key="item.id"
|
:label="item.sdk_type"
|
:value="item.sdk_type"
|
:title="item.sdk_type"
|
></el-option>
|
</el-select>
|
</div>
|
<div class="screening">
|
<label>SO</label>
|
<el-select v-model="rule_so" size="small" placeholder="请选择">
|
<el-option
|
v-for="(item, index) in soList"
|
:key="index"
|
:label="item"
|
:value="item"
|
:title="item"
|
></el-option>
|
</el-select>
|
</div>
|
<div class="screening">
|
<label>算法名称</label>
|
<el-input placeholder="请输入" prefix-icon="el-icon-search" v-model="inputText" size="small"></el-input>
|
</div>
|
<div class="screening">
|
<el-button type="primary" class="btn-search" plain @click="renderTableList(1)" size="small">搜索</el-button>
|
<el-button class="btn-reset" @click="clearSearch" size="small">重置</el-button>
|
</div>
|
<div class="right-fixed">
|
<el-button class="cursor-pointer" type="primary" size="small" @click="createPageAlg">添加</el-button>
|
</div>
|
</div>
|
</div>
|
<div class="table-area">
|
<el-table
|
v-loading="tableLoading"
|
:data="pageAlgsData"
|
tooltip-effect="dark"
|
:fit="true"
|
:default-sort="{ prop: 'createTime', order: 'descending' }"
|
>
|
<!-- <el-table-column type="selection" width="30"></el-table-column> -->
|
<el-table-column label="序号" width="68">
|
<template slot-scope="scope">{{ scope.$index + 1 + (page - 1) * size }}</template>
|
</el-table-column>
|
<el-table-column prop="id" label="算法编号" min-width="160" sortable></el-table-column>
|
<el-table-column
|
prop="sdk_name"
|
label="应用算法名称"
|
min-width="200"
|
show-overflow-tooltip
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="sdk_type"
|
label="基础算法名称"
|
min-width="150"
|
show-overflow-tooltip
|
sortable
|
></el-table-column>
|
<el-table-column prop="rule_so" label="SO名称" min-width="130" show-overflow-tooltip sortable></el-table-column>
|
<el-table-column
|
prop="version"
|
label="最新版本号"
|
min-width="140"
|
show-overflow-tooltip
|
sortable
|
></el-table-column>
|
<el-table-column label="最后更新时间" min-width="180" sortable>
|
<template slot-scope="scope">
|
<div>{{ scope.row.update_time || scope.row.create_time }}</div>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="更新人"
|
width="140"
|
prop="updateUserName"
|
show-overflow-tooltip
|
sortable
|
></el-table-column>
|
<el-table-column label="操作" min-width="120">
|
<template slot-scope="scope">
|
<span class="cursor-pointer" @click="edit(scope.row)">编辑</span>
|
<span class="cursor-pointer" @click="deletePageAlg(scope.row)">删除</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
<div>
|
<el-pagination
|
@current-change="refresh"
|
@size-change="handleSizeChange"
|
:current-page="page"
|
:page-sizes="[5, 10, 15, 20, 25]"
|
:page-size="size"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total"
|
></el-pagination>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
// import { findAllBaseAlg, getAllSO, getAllPageAlg, delPageAlg } from "@/api/algorithm"
|
import request from "@/api/index"
|
export default {
|
data() {
|
return {
|
baseSdkList: [],
|
soList: [],
|
tableHeight: window.innerHeight - 350,
|
sdk_type: "",
|
page: 1,
|
size: 10,
|
total: 0,
|
rule_so: "",
|
inputText: "",
|
pageAlgsData: [],
|
tableLoading: false
|
}
|
},
|
methods: {
|
renderTableList(v) {
|
this.tableLoading = true
|
getAllPageAlg({
|
inputText: this.inputText,
|
page: v === 1 ? 1 : this.page,
|
rule_so: this.rule_so,
|
sdk_type: this.sdk_type,
|
size: this.size
|
})
|
.then((res) => {
|
if (res.code == 200) {
|
this.pageAlgsData = res.data.list
|
this.total = res.data.total
|
this.tableLoading = false
|
if (res.data.total <= this.size) {
|
this.page = 1
|
}
|
}
|
})
|
.catch((e) => {
|
this.tableLoading = false
|
if (e && e.status == 401) {
|
return
|
}
|
this.$notify({
|
type: "error",
|
message: "数据获取失败,请稍后重试!",
|
duration: 2500,
|
offset: 57
|
})
|
})
|
},
|
getAllBaseSDK() {
|
findAllBaseAlg().then((res) => {
|
if (res.code == 200) {
|
this.baseSdkList = res.data.list
|
}
|
})
|
},
|
getSOList() {
|
getAllSO().then((res) => {
|
if (res.success) {
|
this.soList = res.data.list
|
}
|
})
|
},
|
|
refresh(page) {
|
this.page = page
|
this.renderTableList()
|
},
|
handleSizeChange(size) {
|
this.size = size
|
this.renderTableList()
|
},
|
edit(row) {
|
this.$router.push({ path: `/Layout/PageAlgorithmEdit/edit/${row.id}` })
|
},
|
|
deletePageAlg(row) {
|
this.$confirm("确定删除该项吗?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
center: true
|
})
|
.then(() => {
|
delPageAlg(row.id).then((res) => {
|
if (res.code == 200) {
|
this.$message({
|
type: "success",
|
message: "删除成功!"
|
})
|
this.renderTableList()
|
}
|
})
|
})
|
.catch((e) => {
|
console.log(e)
|
})
|
},
|
createPageAlg() {
|
this.$router.push({ path: "/Layout/PageAlgorithmEdit/create/alg" })
|
},
|
clearSearch() {
|
this.sdk_type = ""
|
this.inputText = ""
|
this.rule_so = ""
|
this.renderTableList()
|
}
|
},
|
mounted() {
|
this.getAllBaseSDK()
|
this.getSOList()
|
this.renderTableList()
|
}
|
}
|
</script>
|
<style lang="scss">
|
.manageOrder {
|
width: 100%;
|
height: 100%;
|
.orderTop {
|
width: calc(100% - 60px);
|
height: 30px;
|
background: #fff;
|
padding: 15px 30px;
|
p {
|
font-family: "PingFangSC-Regular";
|
text-align: left;
|
font-size: 18px;
|
line-height: 30px;
|
font-weight: 600;
|
}
|
}
|
.orderBody {
|
width: calc(100% - 40px);
|
height: calc(100% - 100px);
|
padding: 20px;
|
background: #f0f2f5;
|
.top {
|
background-image: linear-gradient(-180deg, #ffffff 13%, #e9ebf2 100%);
|
height: 76px;
|
width: 100%;
|
padding: 5px 22px;
|
box-sizing: border-box;
|
text-align: left;
|
// line-height: 55px;
|
white-space: nowrap;
|
overflow-x: auto;
|
overflow-y: hidden;
|
.p-label,
|
.p-task,
|
.p-level,
|
.p-date,
|
.p-input,
|
.p-clear {
|
display: inline-block;
|
padding-right: 10px;
|
box-sizing: border-box;
|
margin-top: 20px;
|
b:hover {
|
min-width: 100px;
|
color: #2249b4;
|
}
|
.el-input__inner {
|
border-radius: 3px;
|
}
|
}
|
.clear-searching {
|
cursor: pointer;
|
text-decoration: underline;
|
width: 40px;
|
font-size: 13px;
|
color: #3d68e1;
|
}
|
}
|
.orderList {
|
width: calc(100% - 30px);
|
height: calc(100% - 106px);
|
background: #fff;
|
padding: 15px;
|
border-radius: 5px;
|
// overflow-y: scroll
|
}
|
}
|
}
|
</style>
|