Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
海康威视
web-project
Commits
a89502af
Commit
a89502af
authored
Aug 07, 2024
by
xuke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
能源消耗接口-第一次提交
parent
c84a2ccb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
47 deletions
+84
-47
http.js
src/api/http.js
+2
-2
scheduling.js
src/api/scheduling.js
+9
-1
EnergyManagePage.vue
src/views/SchedulingPage/EnergyManagePage.vue
+73
-44
No files found.
src/api/http.js
View file @
a89502af
import
axios
from
'axios'
import
store
from
'../store/index'
import
qs
from
"qs"
;
//
import qs from "qs";
//import { useRouter, useRoute } from 'vue-router'
import
{
useRouter
}
from
"vue-router"
;
//import { ref } from 'vue'
...
...
@@ -24,7 +24,7 @@ let ipAddress = axios.defaults.baseURL;
axios
.
interceptors
.
request
.
use
((
config
)
=>
{
config
.
baseURL
=
store
.
getters
.
getSERVEICE
();
console
.
log
(
config
.
baseURL
);
config
.
data
=
qs
.
stringify
(
config
.
data
);
//
config.data = qs.stringify(config.data);
return
config
;
},
(
error
)
=>
{
return
Promise
.
reject
(
error
);
...
...
src/api/scheduling.js
View file @
a89502af
import
http
from
'./http'
//能源消耗
//能源消耗
-获取
export
const
postEnergyManage
=
params
=>
{
return
http
.
post
(
`/api/energy/getData`
,
params
).
then
(
res
=>
res
).
catch
(
function
(
error
)
{
console
.
log
(
error
);
})
}
// 能源消耗-删除
export
const
postEnergyDel
=
params
=>
{
return
http
.
post
(
'/api/energy/getData'
,
{
params
:{
params
}
}).
then
(
res
=>
res
).
catch
(
function
(
error
)
{
console
.
log
(
error
);
})
}
// 瞬时热量-获取列表
...
...
src/views/SchedulingPage/EnergyManagePage.vue
View file @
a89502af
...
...
@@ -3,23 +3,30 @@ import { ref, onMounted, getCurrentInstance, reactive, nextTick } from 'vue'
import
{
ElMessageBox
,
ElMessage
}
from
'element-plus'
import
axios
from
'axios'
import
{
Search
,
Document
}
from
"@element-plus/icons-vue"
import
{
postEnergyManage
,
postSecAbsTUc
,
postEnergyManageSave
}
from
"@/api/scheduling"
const
{
proxy
}
=
getCurrentInstance
()
const
tableData
=
ref
([])
import
{
postEnergyManage
,
postSecAbsTUc
,
postEnergyManageSave
,
postEnergyDel
}
from
"@/api/scheduling"
import
http
from
'../../api/http'
// const { proxy } = getCurrentInstance()
const
tableData
=
ref
([{}])
const
formEnergy
=
reactive
({})
const
energyForm
=
ref
()
const
dialogVisible
=
ref
(
false
)
const
getEnergyData
=
async
()
=>
{
// const data = await proxy.$api.getEnergyData(config)
// const data = await postSecAbsTUc(config)
// const data = await postEnergyManage(config)
// console.log(data);
// const data = postEnergyManage(tableData.energyType=["0","1","2","3","4"])
// console.log(data);
// const data = await postEnergyManageSave(formEnergy.value)
console
.
log
(
data
);
tableData
.
value
=
data
.
list
// .map(item => ({
// ...item,
// }))
config
.
total
=
data
.
count
await
http
.
post
(
"/api/energy/getData"
,
tableData
.
energyType
=
[
"0"
,
"1"
,
"2"
,
"3"
,
"4"
]).
then
(
res
=>
{
console
.
log
(
"res:"
,
res
);
tableData
.
value
=
res
.
data
}).
catch
(
err
=>
{
console
.
log
(
error
)
})
ElMessage
.
success
(
'查询成功'
)
console
.
log
(
"tableData:"
,
tableData
.
value
);
// config.total = data.count
}
...
...
@@ -65,8 +72,8 @@ const config = reactive({
const
handleSearch
=
()
=>
{
config
.
supplyName
,
getEnergyData
(),
config
.
supplyName
=
''
getEnergyData
(),
config
.
supplyName
=
''
}
const
timeFormat
=
(
time
)
=>
{
...
...
@@ -92,6 +99,9 @@ const rules = reactive({
recordDate
:
[{
required
:
true
,
message
:
"日期是必选项"
}]
})
//
const
handleChange
=
(
page
)
=>
{
...
...
@@ -100,59 +110,75 @@ const handleChange = (page) => {
}
// 删除
const
handleDelete
=
(
row
)
=>
{
// console.log(row.id);
ElMessageBox
.
confirm
(
"你确定要删除吗?"
,{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
confirmButtonClass
:
'ExitConfirmButton'
}).
then
(
async
()
=>
{
await
proxy
.
$api
.
deleteEnergy
({
id
:
row
.
id
})
// const handleDelete = async (row) => {
// // console.log(row.energyId);
// // const energyId = row.energyId
// await ElMessageBox.confirm("你确定要删除吗?", {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// confirmButtonClass: 'ExitConfirmButton'
// })
// await postEnergyDel(row.energyId)
// ElMessage({
// type:'success',message:'删除成功'
// })
// getEnergyData()
// }
// 删除
const
handleDelete
=
async
(
row
)
=>
{
await
ElMessageBox
.
confirm
(
"你确定要删除吗?"
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
confirmButtonClass
:
'ExitConfirmButton'
})
await
http
.
post
(
"api/energy/Delete"
,
params
:{
EnergyId
:
row
.
energyId
},
false
).
then
(
res
=>
{
console
.
log
(
res
);
}).
then
(
res
=>
{
ElMessage
({
showClose
:
true
,
message
:
'删除成功'
,
type
:
'success'
type
:
'success'
,
message
:
'删除成功'
})
getEnergyData
()
})
}
// 新增
const
action
=
ref
(
'add'
)
const
handleClose
=
()
=>
{
dialogVisible
.
value
=
false
proxy
.
$ref
[
'energyForm'
].
resetFields
()
//
proxy.$ref['energyForm'].resetFields()
}
const
handleCancel
=
()
=>
{
dialogVisible
.
value
=
false
proxy
.
$ref
[
'energyForm'
].
resetFields
()
//
proxy.$ref['energyForm'].resetFields()
}
const
handleAdd
=
()
=>
{
action
.
value
=
"add"
,
dialogVisible
.
value
=
true
;
proxy
.
$refs
[
'energyForm'
].
resetFields
()
formEnergy
.
supplyName
=
''
,
formEnergy
.
energyType
=
''
//
proxy.$refs['energyForm'].resetFields()
formEnergy
.
supplyName
=
''
,
formEnergy
.
energyType
=
''
}
const
handleEdit
=
(
val
)
=>
{
action
.
value
=
"edit"
dialogVisible
.
value
=
true
nextTick
(()
=>
{
Object
.
assign
(
formEnergy
,
{
...
val
})
Object
.
assign
(
formEnergy
,
{
...
val
})
})
}
const
onSubmit
=
()
=>
{
proxy
.
$refs
[
'energyForm'
]
.
validate
(
async
(
valid
)
=>
{
energyForm
.
value
.
validate
(
async
(
valid
)
=>
{
if
(
valid
)
{
let
res
=
null
;
formEnergy
.
recordDate
=
/^
\d{4}
-
\d{2}
-
\d{2}
$/
.
test
(
formEnergy
.
recordDate
)
?
formEnergy
.
recordDate
:
timeFormat
(
formEnergy
.
recordDate
)
...
...
@@ -164,14 +190,14 @@ const onSubmit = () => {
if
(
res
)
{
dialogVisible
.
value
=
false
proxy
.
$refs
[
'energyForm'
].
resetFields
()
//
proxy.$refs['energyForm'].resetFields()
getEnergyData
()
}
}
else
{
res
=
await
proxy
.
$api
.
editEnergy
(
formEnergy
)
proxy
.
$refs
[
'energyForm'
].
resetFields
()
//
res = await proxy.$api.editEnergy(formEnergy)
//
proxy.$refs['energyForm'].resetFields()
dialogVisible
.
value
=
false
getEnergyData
()
}
}
else
{
...
...
@@ -215,13 +241,11 @@ onMounted(() => {
</th>
<th
width=
"100%"
style=
"background-color: #ffffff;text-align: left;"
>
<el-button
type=
"primary"
@
click=
"handleSearch"
>
<el-button
type=
"primary"
@
click=
"handleSearch"
>
<Search
style=
"width: 1em; height: 1em; margin-right: 8px"
/>
查询
</el-button>
<el-button
type=
"primary"
@
click=
"handleAdd"
>
<el-button
type=
"primary"
@
click=
"handleAdd"
>
<Document
style=
"width: 1em; height: 1em; margin-right: 8px"
/>
新增
</el-button>
...
...
@@ -237,6 +261,11 @@ onMounted(() => {
stripe>
<el-table-column
v-for=
"item in tableLabel"
:key=
"item.prop"
:width=
"item.width ? item.width : 150"
:prop=
"item.prop"
:label=
"item.label"
/>
<!--
<el-table-column
prop=
"allowPagingId"
label=
"Date"
width=
"180"
/>
<el-table-column
prop=
"supplyName"
label=
"Name"
width=
"180"
/>
<el-table-column
prop=
"energyType"
label=
"Address"
/>
<el-table-column
prop=
"record"
label=
"Address"
/>
<el-table-column
prop=
"recordDate"
label=
"Address"
/>
-->
<el-table-column
fixed=
"right"
label=
"操作"
min-width=
"140"
>
<template
#="
scope
"
>
<el-button
link
type=
"primary"
size=
"small"
@
click=
"handleEdit(scope.row)"
>
...
...
@@ -290,7 +319,6 @@ onMounted(() => {
<el-option
label=
"机械"
value=
"机械"
/>
</el-select>
</td>
</tr>
</table>
</td>
...
...
@@ -320,7 +348,8 @@ onMounted(() => {
<tr>
<td>
<el-form-item
prop=
"recordDate"
style=
"margin: 0;padding: 0;width: 100%;"
>
<el-date-picker
value-format=
"YYYY-MM-DD HH:mm:ss"
v-model=
"formEnergy.recordDate"
type=
"datetime"
placeholder=
"请输入日期"
style=
"width: 100%"
/>
<el-date-picker
value-format=
"YYYY-MM-DD HH:mm:ss"
v-model=
"formEnergy.recordDate"
type=
"datetime"
placeholder=
"请输入日期"
style=
"width: 100%"
/>
</el-form-item>
</td>
</tr>
...
...
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