Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ai-yunshou-vue
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AI云守
ai-yunshou-vue
Commits
e1496a9c
Commit
e1496a9c
authored
Sep 06, 2024
by
胡占生
🇨🇳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复我的算法编辑功能
parent
4dcefc1b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
51 deletions
+95
-51
src/api/algorithmList/index.js
src/api/algorithmList/index.js
+7
-0
src/views/algorithmControl/components/form.vue
src/views/algorithmControl/components/form.vue
+12
-2
src/views/algorithmList/components/form.vue
src/views/algorithmList/components/form.vue
+53
-40
src/views/algorithmList/index.vue
src/views/algorithmList/index.vue
+23
-9
No files found.
src/api/algorithmList/index.js
View file @
e1496a9c
...
...
@@ -57,6 +57,13 @@ export function detailAlg(id) {
})
}
// 查询我的算法列表详情
export
function
detailMyAlg
(
id
)
{
return
request
({
url
:
`/yunshou/userAlgorithm/
${
id
}
`
,
method
:
'
get
'
,
})
}
// 新增算法列表
export
function
addAlg
(
data
)
{
...
...
src/views/algorithmControl/components/form.vue
View file @
e1496a9c
...
...
@@ -61,7 +61,12 @@
:key=
"disc.id"
:label=
"disc.alarmName"
:value=
"disc.id"
/>
>
<span>
<el-tag
type=
"success"
:style=
"{backgroundColor: disc.alarmColor,width:'40px'}"
>
{{ }}
</el-tag>
</span>
{{ disc.alarmName }}
</el-option>
</el-select>
</el-form-item>
</el-col>
...
...
@@ -174,7 +179,12 @@
:key=
"disc.id"
:label=
"disc.alarmName"
:value=
"disc.id"
/>
>
<span>
<el-tag
type=
"success"
:style=
"{backgroundColor: disc.alarmColor,width:'40px'}"
>
{{ }}
</el-tag>
</span>
{{ disc.alarmName }}
</el-option>
</el-select>
</el-form-item>
</el-col>
...
...
src/views/algorithmList/components/form.vue
View file @
e1496a9c
...
...
@@ -7,38 +7,33 @@
>
<el-form
ref=
"algRef"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-row>
<el-col
:span=
"
12
"
>
<el-col
:span=
"
24
"
>
<el-form-item
label=
"算法名称"
prop=
"algorithmName"
>
<el-input
v-model=
"form.algorithmName"
placeholder=
"请输入岗位名称"
/>
<el-input
v-model=
"form.algorithmName"
placeholder=
"请输入岗位名称"
disabled
/>
</el-form-item>
</el-col>
<el-col
:span=
"
12
"
>
<el-col
:span=
"
24
"
>
<el-form-item
label=
"算法英文"
prop=
"algorithmEnglish"
>
<el-input
v-model=
"form.algorithmEnglish"
placeholder=
"请输入编码名称"
/>
<el-input
v-model=
"form.algorithmEnglish"
placeholder=
"请输入编码名称"
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"12"
>
<el-form-item
label=
"硬件平台"
prop=
"algorithmPlat"
>
<el-input
v-model=
"form.algorithmPlat"
placeholder=
"请输入编码名称"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"告警等级"
prop=
"alarmLevel"
>
<el-input
v-model=
"form.alarmLevel"
placeholder=
"请输入告警等级"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"12"
>
<el-form-item
label=
"卡片文案"
prop=
"cardCopywriting"
>
<el-input
v-model=
"form.cardCopywriting"
type=
"textarea"
:rows=
"8"
placeholder=
"请输入内容"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"卡片图片"
prop=
"status"
>
<ImageUpload
:modelValue=
"form.cardImg"
:limit=
'1'
:fileSize=
"5"
@
update:modelValue=
"getImageUrl"
/>
<el-col
:span=
"24"
>
<el-form-item
label=
"预警等级"
prop=
"alarmLevel"
>
<el-select
v-model=
"form.alarmLevel"
placeholder=
"请选择预警等级"
clearable
>
<el-option
v-for=
"disc in levelList"
:key=
"disc.id"
:label=
"disc.alarmName"
:value=
"disc.id"
>
<span>
<el-tag
type=
"success"
:style=
"
{backgroundColor: disc.alarmColor,width:'40px'}">
{{
}}
</el-tag>
</span>
{{
disc
.
alarmName
}}
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
...
...
@@ -53,20 +48,29 @@
</template>
<
script
setup
>
import
{
addAlg
,
updateAlg
,
detailAlg
}
from
"
@/api/algorithmList/index.js
"
;
import
{
addAlg
,
updateMyAlg
,
detailAlg
,
detailMyAlg
}
from
"
@/api/algorithmList/index.js
"
;
import
{
listAlgLevel
}
from
"
@/api/algorithmList/algorithmDown.js
"
;
const
{
proxy
}
=
getCurrentInstance
();
const
emit
=
defineEmits
();
const
open
=
ref
(
false
);
const
title
=
ref
(
""
);
const
levelList
=
ref
([]);
const
ids
=
ref
([]);
const
data
=
reactive
({
form
:
{},
form
:
{
id
:
''
,
algorithmEnglish
:
''
,
algorithmName
:
''
,
algorithmPlat
:
0
,
status
:
"
0
"
,
remark
:
''
},
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
algorithmEnglish
:
undefined
,
algorithmName
:
undefined
,
status
:
undefined
algorithmEnglish
:
''
,
algorithmName
:
''
,
status
:
''
},
rules
:
{
algorithmName
:
[{
required
:
true
,
message
:
"
算法名称不能为空
"
,
trigger
:
"
blur
"
}],
...
...
@@ -78,23 +82,30 @@ const data = reactive({
const
{
queryParams
,
form
,
rules
}
=
toRefs
(
data
);
function
getImageUrl
(
url
){
form
.
value
.
cardImg
=
url
console
.
log
(
"
🚀 ~ getImageUrl ~ orm.cardImg:
"
,
form
)
form
.
value
.
cardImg
=
url
console
.
log
(
"
🚀 ~ getImageUrl ~ orm.cardImg:
"
,
form
)
}
/** 表单重置 */
function
reset
()
{
form
.
value
=
{
id
:
undefined
,
algorithmEnglish
:
undefined
,
algorithmName
:
undefined
,
id
:
''
,
algorithmEnglish
:
''
,
algorithmName
:
''
,
algorithmPlat
:
0
,
status
:
"
0
"
,
remark
:
undefined
remark
:
''
};
proxy
.
resetForm
(
"
algRef
"
);
}
/** 查询预警等级列表 */
function
getLevelList
()
{
listAlgLevel
().
then
(
response
=>
{
levelList
.
value
=
response
.
rows
;
});
}
getLevelList
()
/** 新增按钮操作 */
function
handleAdd
()
{
...
...
@@ -105,12 +116,14 @@ function handleAdd() {
/** 修改按钮操作 */
function
handleUpdate
(
row
)
{
reset
();
const
id
=
row
.
i
d
||
ids
.
value
;
detailAlg
(
id
).
then
(
response
=>
{
console
.
log
(
"
🚀 ~ handleUpdate ~ row:
"
,
row
)
const
id
=
row
.
userAlgorithmI
d
||
ids
.
value
;
detail
My
Alg
(
id
).
then
(
response
=>
{
form
.
value
=
response
.
data
;
form
.
value
.
algorithmName
=
row
.
algorithmName
;
form
.
value
.
algorithmEnglish
=
row
.
algorithmEnglish
;
open
.
value
=
true
;
title
.
value
=
"
修改算法
"
;
title
.
value
=
"
修改
我的
算法
"
;
});
}
...
...
@@ -119,7 +132,7 @@ function submitForm() {
proxy
.
$refs
[
"
algRef
"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
form
.
value
.
id
!=
undefined
)
{
updateAlg
(
form
.
value
).
then
(
response
=>
{
update
My
Alg
(
form
.
value
).
then
(
response
=>
{
proxy
.
$modal
.
msgSuccess
(
"
修改成功
"
);
open
.
value
=
false
;
emit
(
"
getList
"
);
...
...
src/views/algorithmList/index.vue
View file @
e1496a9c
...
...
@@ -27,12 +27,12 @@
default-active=
"2"
class=
"el-menu-vertical-demo"
>
<el-menu-item
:index=
"'我的算法'"
@
click=
"
getMyList
"
>
<el-menu-item
:index=
"'我的算法'"
@
click=
"
handMyMenuClick
"
>
<span><el-icon
style=
"color: #7F8184;"
><component
:is=
"'HomeFilled'"
/></el-icon>
我的算法
</span>
</el-menu-item>
<el-divider
style=
"margin: 5px 0;"
/>
<el-menu-item
:index=
"''"
@
click=
"handMenuClick"
>
<span>
<el-icon
style=
"color: #7F8184;"
><component
:is=
"'
DeleteFilled'"
/></el-icon>
全部
</span>
<span>
<el-icon
style=
"color: #7F8184;"
><component
:is=
"'
Menu'"
/></el-icon>
全部算法
</span>
</el-menu-item>
<el-menu-item
v-for=
"item in algorithm_scen"
:key=
"item.value"
:index=
"item.value"
@
click=
"handMenuClick"
>
<span
style=
"display: flex;align-items: center;"
>
...
...
@@ -116,9 +116,10 @@
>
{{
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)"
v-if=
"!listState"
>
添加
</el-button>
<el-button
link
type=
"primary"
icon=
"Edit"
@
click.stop=
"handleEnable(item)"
v-if=
"listState"
>
{{
item
.
algorithmStatus
==
'
0
'
?
'
停用
'
:
'
启用
'
}}
</el-button>
<div
style=
"display: flex;justify-content: flex-end;position: absolute;right: 15px;bottom: 5px;"
>
<el-button
link
type=
"primary"
:icon=
"item.status=='0'?'Bottom':'Check'"
@
click.stop=
"handleUpdate(item)"
v-if=
"!listState"
>
{{
item
.
status
==
'
0
'
?
'
添加
'
:
'
已添加
'
}}
</el-button>
<el-button
link
type=
"primary"
icon=
"Open"
@
click.stop=
"handleEnable(item)"
v-if=
"listState"
>
{{
item
.
algorithmStatus
==
'
0
'
?
'
停用
'
:
'
启用
'
}}
</el-button>
<el-button
link
type=
"primary"
icon=
"Edit"
@
click.stop=
"handlUpdateMyAlg(item)"
v-if=
"listState"
>
{{
'
编辑
'
}}
</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"
>
...
...
@@ -148,13 +149,14 @@
</el-col>
</el-row>
<algorithmDown
ref=
"algorithmDownRef"
/>
<algForm
ref=
"algFormRef"
/>
</div>
</template>
<
script
setup
name=
"Index"
>
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'
import
algForm
from
'
./components/form
.vue
'
const
{
proxy
}
=
getCurrentInstance
();
const
{
algorithm_scen
,
sys_job_status
}
=
proxy
.
useDict
(
"
algorithm_scen
"
,
"
sys_job_status
"
);
import
{
ArrowDown
}
from
'
@element-plus/icons-vue
'
...
...
@@ -162,6 +164,7 @@
const
globalScreenHeight
=
inject
(
'
globalScreenHeight
'
);
const
router
=
useRouter
();
const
algorithmDownRef
=
ref
(
null
)
const
algFormRef
=
ref
(
null
)
const
nowText
=
ref
(
'
算法管理
'
)
const
nowTopTitle
=
ref
(
'
算法管理
'
)
const
listState
=
ref
(
false
)
...
...
@@ -217,8 +220,9 @@
getList
()
}
function
handleUpdate
(
row
)
{
addMyAlg
({
algorithmId
:
row
.
id
}).
then
((
res
)
=>
{
if
(
row
.
status
==
'
0
'
)
addMyAlg
({
algorithmId
:
row
.
id
}).
then
((
res
)
=>
{
proxy
.
$modal
.
msgSuccess
(
"
添加成功
"
);
getList
()
console
.
log
(
"
🚀 ~ addMyAlg ~ res:
"
,
res
)
})
// algorithmDownRef.value.handleUpdate(row)
...
...
@@ -230,13 +234,19 @@
getList
()
}
function
handMyMenuClick
(
row
)
{
queryParams
.
value
.
applicationScenarios
=
''
nowTopTitle
.
value
=
row
.
index
getMyList
()
}
function
iconComponent
(
row
){
if
(
row
){
return
row
}
else
{
return
'
CirclePlusFilled
'
}
}
function
handleEnable
(
row
){
...
...
@@ -251,6 +261,10 @@
}
function
handlUpdateMyAlg
(
row
){
algFormRef
.
value
.
handleUpdate
(
row
)
}
/** 删除按钮操作 */
function
handleDelete
(
row
)
{
const
id
=
row
.
userAlgorithmId
||
ids
.
value
;
...
...
@@ -282,7 +296,7 @@
-webkit-line-clamp
:
3
;
-webkit-box-orient
:
vertical
;
overflow
:
hidden
;
margin
:
5
px
0
;
margin
:
10
px
0
;
}
.ellipsis
{
overflow
:
hidden
;
/* 隐藏超出的内容 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment