Commit 4dcefc1b authored by 胡占生's avatar 胡占生 🇨🇳

fix: 我的算法接口联调

parent 961d388e
......@@ -39,6 +39,15 @@ export function listAlgFile(query) {
params: query
})
}
// 查询我的算法列表
export function listMyAlg(query) {
return request({
url: '/yunshou/userAlgorithm/list',
method: 'get',
params: query
})
}
// 查询算法列表x详情
export function detailAlg(id) {
......@@ -58,6 +67,15 @@ export function addAlg(data) {
})
}
// 新增我的算法列表
export function addMyAlg(data) {
return request({
url: '/yunshou/userAlgorithm',
method: 'post',
data: data
})
}
// 修改算法列表
export function updateAlg(data) {
return request({
......@@ -67,6 +85,24 @@ export function updateAlg(data) {
})
}
// 修改我的算法列表
export function updateMyAlg(data) {
return request({
url: '/yunshou/userAlgorithm',
method: 'put',
data: data
})
}
// 修改我的算法状态
export function updateMyAlgState(data) {
return request({
url: '/yunshou/userAlgorithm/updateRunningState',
method: 'post',
data: data
})
}
// 删除算法列表
export function deleteAlg(ids) {
......@@ -76,6 +112,14 @@ export function deleteAlg(ids) {
})
}
// 删除我的算法列表
export function deleteMyAlg(ids) {
return request({
url: `/yunshou/userAlgorithm/${ids}`,
method: 'delete'
})
}
// 启用禁用算法
export function updateAlgState(data) {
......
......@@ -27,7 +27,7 @@
default-active="2"
class="el-menu-vertical-demo"
>
<el-menu-item :index="'我的算法'" @click="handMenuClick">
<el-menu-item :index="'我的算法'" @click="getMyList">
<span><el-icon style="color: #7F8184;"><component :is="'HomeFilled'" /></el-icon>我的算法</span>
</el-menu-item>
<el-divider style="margin: 5px 0;"/>
......@@ -71,7 +71,7 @@
type="primary"
plain
@click="handState('1')"
></el-button>
></el-button>
</el-col>
<el-col :span="1.5">
<el-button
......@@ -94,10 +94,11 @@
<div class="cleartitle">
<span class="ellipsis">{{item.algorithmName}}</span>
<el-tag
v-if="listState"
:type=" item.algorithmStatus=='0'?'success':'danger'"
effect="dark"
>
{{ item.algorithmStatus=='0'?'已启用':'' }}
{{ item.algorithmStatus=='0'?'已启用':'' }}
</el-tag>
</div>
</template>
......@@ -116,9 +117,9 @@
{{ item.cardCopywriting }}
</div>
<div style="display: flex;justify-content: flex-end;position: absolute;right: 15px;bottom: 10px;" >
<el-button link type="primary" icon="Bottom" @click.stop="handleUpdate(item)" >下载</el-button>
<el-button link type="primary" icon="Edit" @click.stop="handleEnable(item)" >{{item.algorithmStatus=='0'?'':'启用' }}</el-button>
<el-button link type="primary" icon="Delete" @click.stop="handleDelete(item)">删除</el-button>
<el-button link type="primary" icon="Bottom" @click.stop="handleUpdate(item)" v-if="!listState">添加</el-button>
<el-button link type="primary" icon="Edit" @click.stop="handleEnable(item)" v-if="listState">{{item.algorithmStatus=='0'?'':'启用' }}</el-button>
<el-button link type="primary" icon="Delete" @click.stop="handleDelete(item)" v-if="listState">删除</el-button>
<!-- <el-dropdown trigger="click" @command.stop="handleSetSize">
<el-button link type="primary">
<el-icon class="el-icon--right">
......@@ -151,7 +152,7 @@
</template>
<script setup name="Index">
import { listAlg, detailAlg, addAlg, updateAlg, deleteAlg,updateAlgState } from "@/api/algorithmList/index.js";
import { listAlg, listMyAlg ,detailAlg, addMyAlg, updateMyAlgState,deleteMyAlg, deleteAlg,updateAlgState } from "@/api/algorithmList/index.js";
import algorithmDown from './components/algorithmDown.vue'
// import algForm from './components/algorithmDown.vue'
const { proxy } = getCurrentInstance();
......@@ -163,6 +164,7 @@
const algorithmDownRef = ref(null)
const nowText=ref('算法管理')
const nowTopTitle=ref('算法管理')
const listState=ref(false)
const ids = ref([]);
// const iconComponent = ref('');
// setTimeout(() => {
......@@ -189,13 +191,20 @@
/** 查询算法列表 */
function getList() {
// loading.value = true;
listAlg(queryParams.value).then(response => {
// console.log("🚀 ~ listAlg ~ response:", response)
algList.value = response.rows
// loading.value = false;
listState.value=false
});
}
/** 查询我的算法列表 */
function getMyList() {
nowTopTitle.value='我的算法'
listMyAlg(queryParams.value).then(response => {
algList.value = response.rows
listState.value=true
});
}
function handeAdd(row){
algorithmDownRef.value.handleAdd()
}
......@@ -207,8 +216,12 @@
queryParams.value.algorithmStatus=state
getList()
}
function handleUpdate(row) {
algorithmDownRef.value.handleUpdate(row)
function handleUpdate(row) {
addMyAlg({algorithmId:row.id}).then((res) => {
proxy.$modal.msgSuccess("添加成功");
console.log("🚀 ~ addMyAlg ~ res:", res)
})
// algorithmDownRef.value.handleUpdate(row)
}
function handMenuClick(row) {
......@@ -240,11 +253,11 @@
/** 删除按钮操作 */
function handleDelete(row) {
const id = row.id || ids.value;
const id = row.userAlgorithmId || ids.value;
proxy.$modal.confirm('是否确认删除算法名称为"' + row.algorithmName + '"的数据项?').then(function() {
return deleteAlg(id);
return deleteMyAlg(id);
}).then(() => {
getList();
getMyList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment