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

fix: 我的算法接口联调

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