!18 能源设备

Merge pull request !18 from guopeiyu/guopeiyu
main
guopeiyu 2 years ago committed by Gitee
commit 1792a29b2f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 查询能源设备列表
export function getEnergyDevice(params) {
return request({
url: '/admin-api/mes/energy-device/page',
method: 'get',
params: params
})
}
// 修改能源设备
export function updateEnergyDeviceCheckRecord(data) {
return request({
url: '/admin-api/mes/energy-device/update',
method: 'put',
data: data
})
}
// 删除能源设备
export function deleteEnergyDevice(id) {
return request({
url: '/admin-api/mes/energy-device/delete?id='+id,
method: 'delete'
})
}
// 查询抄表记录
export function getEnergyDeviceCheckRecord(params) {
return request({
url: '/admin-api/mes/energy-device/energy-device-check-record/page',
method: 'get',
params
})
}
// 新增抄表记录
export function createEnergyDeviceCheckRecord(data) {
return request({
url: '/admin-api/mes/energy-device/energy-device-check-record/create',
method: 'post',
data: data
})
}
// 删除抄表记录
export function deleteEnergyDeviceCheckRecordById(id) {
return request({
url: '/admin-api/mes/energy-device/energy-device-check-record/delete?id='+id,
method: 'delete'
})
}

@ -1,4 +1,3 @@
import request from '@/utils/request' import request from '@/utils/request'

@ -331,7 +331,6 @@ export default {
} }
.u-button { .u-button {
height: 35px; height: 35px;
width: auto;
} }
.uni-group-title{ .uni-group-title{
height: 55px; height: 55px;

@ -13,16 +13,23 @@
}, },
"pages": [ "pages": [
{ {
"path": "pages/index", "path": "pages/login",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/application/index",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }
}, },
{ {
"path": "pages/login", "path": "pages/plan",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true
} }
}, },
{ {
@ -32,7 +39,13 @@
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }
}, },
{
"path": "pages/report",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": true
}
},
{ {
"path": "pages/mine", "path": "pages/mine",
"style": { "style": {
@ -52,10 +65,34 @@
} }
}, },
{ {
"path": "pages/report", "path": "pages/application/components/deskArrangement",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/application/components/energyEquipment",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/application/components/energyEquipmentDetail",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": true "onReachBottomDistance": 50
}
},
{
"path": "pages/application/components/energyEquipmentForm",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/application/components/energyEquipmentFormReset",
"style": {
"navigationStyle": "custom"
} }
} }
], ],
@ -292,7 +329,13 @@
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"list": [ "list": [
{ {
"pagePath": "pages/index", "pagePath": "pages/application/index",
"iconPath": "static/images/tabbar/app.png",
"selectedIconPath": "static/images/tabbar/app_.png",
"text": "我的应用"
},
{
"pagePath": "pages/plan",
"iconPath": "static/images/tabbar/home.png", "iconPath": "static/images/tabbar/home.png",
"selectedIconPath": "static/images/tabbar/home_.png", "selectedIconPath": "static/images/tabbar/home_.png",
"text": "计划" "text": "计划"

@ -0,0 +1,25 @@
<template>
<view>
<u-sticky
class="sticky"
:custom-nav-height="0"
>
<u-navbar
title="工位安排"
bg-color="transparent"
:auto-back="true"
:title-style="{ fontWeight: 'bold' }"
safe-area-inset-top
placeholder
/>
</u-sticky>
</view>
</template>
<script lang="ts" setup>
</script>
<style lang="sass" scoped>
.sticky
background: linear-gradient(180deg, #d4e9ff 0%, #f3f9ff 100%)
backdrop-filter: blur(27.18px)
box-shadow: 0 1px 1px 0 rgba(0, 72, 145, 0.1), 0 0.5px 0 0 rgba(0, 0, 0, 0.1)
</style>

@ -0,0 +1,188 @@
<template>
<view>
<u-sticky
class="sticky"
:custom-nav-height="0"
>
<u-navbar
title="能源设备"
bg-color="transparent"
:auto-back="true"
:title-style="{ fontWeight: 'bold' }"
safe-area-inset-top
placeholder
/>
<view class="search">
<u-input
v-model="queryParams.name"
placeholder="搜索:设备名称"
border="surround"
:clear-icon="true"
suffixIcon="search"
class="u-m-r-30"
font-size="12"
@click="getEnergyDeviceList"
/>
<uni-data-select v-model="queryParams.deviceType" placeholder="请选择设备类型" @change="getEnergyDeviceList" >
</uni-data-select>
</view>
</u-sticky>
<view v-if="total" class="wrap">
<u-list>
<u-list-item
v-for="(item, index) in energy_device_list"
:key="index"
>
<view class="content" @click="navTo({name: item.name, id: item.id})">
<view class="header">
<view class="title">
<u-image
src="@/static/images/icon/product.png"
width="40rpx"
height="40rpx"
/>
<u-text type="primary" class="u-m-l-10" :text="item.name"></u-text>
</view>
<view><u-text type="info" :text="item.code"></u-text></view>
</view>
<view class="u-flex u-m-t-30 u-m-b-30">
<view class="u-flex flex_1">设备类型
<u-text type="success" :text="item.deviceType" class="u-m-l-10"></u-text>
</view>
<view class="flex_1">抄表周期
<u-text :text="item.checkCron" class="u-flex"> </u-text>
</view>
</view>
<view class="u-m-b-30">
<view class="u-flex flex_1">最后抄表时间
<u-text type="warning" :text="item.lastCheckTime ? timestampToTime(item.lastCheckTime) : ''" class="u-m-l-10"></u-text>
</view>
</view>
<view class="u-flex u-m-b-30">
<view class="u-flex flex_1">最后抄表值
<u-text type="success" :text="item.lastCheckValue" class="u-m-l-10"></u-text>
</view>
<view class="u-flex flex_1">单位
<u-text :text="item.unitName" class="u-m-l-10"></u-text>
</view>
</view>
<view class="u-flex u-m-b-30">
<view class="u-flex flex_1">设备资料
<u-text type="success" :text="item.info" class="u-m-l-10"></u-text>
</view>
<view class="u-flex flex_1">是否启用
<u-text :text="item.isEnable ? '是':'否'" class="u-m-l-10"></u-text>
</view>
</view>
<view class="u-m-t-30 u-m-b-30"><u-line/></view>
<view class="u-flex justify-end">
<view class="u-m-r-20" @click.stop="tab.navigateTo('/pages/application/components/energyEquipmentForm', { name: item.name, id: item.id, time: item.lastCheckTime, value: item.lastCheckValue })"> <u-button type="success" plain>抄表</u-button></view>
<view class="u-m-r-20" @click.stop="tab.navigateTo('/pages/application/components/energyEquipmentFormReset', { name: item.name, id: item.id, time: item.lastCheckTime, value: item.lastCheckValue, code: item.code, isEnable: item.isEnable })"> <u-button type="error" plain>重置</u-button></view>
<view class="u-m-r-20" @click.stop> <u-button type="primary" plain >编辑</u-button></view>
<view class="u-m-r-20" @click.stop="deleteEnergyDeviceById(item.id)"> <u-button type="error" plain>删除</u-button></view>
</view>
</view>
</u-list-item>
</u-list>
</view>
<u-empty v-else icon="http://cdn.uviewui.com/uview/empty/data.png" />
</view>
</template>
<script setup>
import { ref } from 'vue'
import { deleteEnergyDevice, getEnergyDevice} from "@/api/mes/application";
import {onLoad, onReachBottom} from "@dcloudio/uni-app";
import { timestampToTime } from "@/utils/dateUtil";
import tab from "@/plugins/tab";
import { showConfirm } from "@/utils/common";
import { modal } from "@/plugins";
const queryParams = ref({
name: '',
deviceType: '',
pageNo: 1,
pageSize: 10
})
const total = ref()
const energy_device_list = ref([])
const getEnergyDeviceList = ()=> {
getEnergyDevice(queryParams.value).then(response => {
energy_device_list.value = response.data.list
total.value = response.data.total
})
}
const deleteEnergyDeviceById = (id)=>{
showConfirm("确认删除能源设备吗?").then(res => {
if (res.confirm) {
deleteEnergyDevice(id).then(() => {
queryParams.value.pageNo = 1
energy_device_list.value = [];
getEnergyDeviceList()
modal.msgSuccess("操作成功")
})
}
})
}
const navTo = (params) => {
tab.navigateTo('/pages/application/components/energyEquipmentDetail',params)
}
onReachBottom(()=>{
if (queryParams.value.pageNo * queryParams.value.pageSize >= total.value) {
return
}
queryParams.value.pageNo++
getEnergyDeviceList()
})
onLoad(() => {
getEnergyDeviceList()
uni.$on('success', data => {
if (data) {
getEnergyDeviceList();
}
});
});
</script>
<style lang="sass" scoped>
.sticky
background: linear-gradient(180deg, #d4e9ff 0%, #f3f9ff 100%)
backdrop-filter: blur(27.18px)
box-shadow: 0 1px 1px 0 rgba(0, 72, 145, 0.1), 0 0.5px 0 0 rgba(0, 0, 0, 0.1)
.search
margin: 20rpx
padding: 20rpx
display: flex
align-items: center
.wrap
background-color: #f1f1f1
padding: 0 20rpx 20rpx 20rpx
.content
margin: 0 0 20rpx 0
padding: 20rpx
background-color: #ffffff
border-radius: 10rpx
.header
display: flex
align-items: center
justify-content: space-between
.title
display: flex
align-items: center
.u-button
height: 60rpx
.flex_1
flex: 1
.u-empty
background: #ffffff
margin: 20rpx
padding-bottom: 20rpx
border-radius: 10rpx
.u-input
height: 35px
</style>

@ -0,0 +1,132 @@
<template>
<view>
<u-sticky
class="sticky"
:custom-nav-height="0"
>
<u-navbar
:title="'抄表记录:' + name"
bg-color="transparent"
:auto-back="true"
:title-style="{ fontWeight: 'bold' }"
safe-area-inset-top
placeholder
/>
</u-sticky>
<view class="container">
<u-list>
<u-list-item
v-for="(item, index) in energy_device_detail_list"
:key="index"
>
<view class="content">
<view class="u-flex u-m-t-30 u-m-b-30">
<view class="u-flex flex_1">抄表时间
<u-text type="success" :text="timestampToTime(item.checkTime)" class="u-m-l-10" size="12"></u-text>
</view>
<view class="u-flex flex_1">抄表值
<u-text :text="item.checkValue" class="u-flex" size="12"> </u-text>
</view>
</view>
<view class="u-flex u-m-t-30 u-m-b-30">
<view class="u-flex flex_1">上次抄表时间
<u-text type="success" :text="timestampToTime(item.lastCheckTime)" class="u-m-l-10" size="12"></u-text>
</view>
<view class="u-flex flex_1">上次抄表值
<u-text :text="item.lastCheckValue" class="u-flex" size="12"> </u-text>
</view>
</view>
<view class="u-flex u-m-b-30">
<view class="u-flex flex_1">差值
<u-text type="success" :text="item.diffValue" class="u-m-l-10" size="12"></u-text>
</view>
<view class="u-flex flex_1">单价
<u-text type="success" :text="item.unitPrice" class="u-m-l-10" size="12"></u-text>
</view>
</view>
<view class="u-flex flex_1">备注
<u-text type="info" :text="item.remark" class="u-m-l-10" size="12"></u-text>
</view>
<view class="u-m-t-30 u-m-b-30"><u-line/></view>
<view class="u-flex justify-end">
<view> <u-button type="error" plain @click="deleteEnergyDeviceCheckRecord(item.id)"></u-button></view>
</view>
</view>
</u-list-item>
</u-list>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { deleteEnergyDeviceCheckRecordById, getEnergyDeviceCheckRecord } from "@/api/mes/application";
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
import { timestampToTime } from "@/utils/dateUtil";
import tab from "@/plugins/tab";
import { showConfirm } from "@/utils/common";
import { modal } from "@/plugins";
const queryParams = ref({
pageNo: 1,
pageSize: 10,
deviceId: undefined
})
const name = ref('')
const total = ref()
const energy_device_detail_list = ref([])
const getEnergyDeviceCheckRecordList = ()=> {
getEnergyDeviceCheckRecord(queryParams.value).then(response => {
energy_device_detail_list.value = [...energy_device_detail_list.value, ...response.data.list]
total.value = response.data.total
})
}
/** 删除 */
function deleteEnergyDeviceCheckRecord(id){
showConfirm("确认删除抄表记录吗?").then(res => {
if (res.confirm) {
deleteEnergyDeviceCheckRecordById(id).then(response => {
queryParams.value.pageNo = 1
energy_device_detail_list.value = [];
getEnergyDeviceCheckRecordList()
modal.msgSuccess("操作成功")
})
}
})
}
onReachBottom(()=>{
if ((queryParams.value.pageNo - 1) * queryParams.value.pageSize >= total.value) {
return
}
queryParams.value.pageNo++
getEnergyDeviceCheckRecordList()
})
onLoad(() => {
name.value = tab.getParams().name
queryParams.value.deviceId = tab.getParams().id
getEnergyDeviceCheckRecordList()
});
</script>
<style lang="sass" scoped>
.sticky
background: linear-gradient(180deg, #d4e9ff 0%, #f3f9ff 100%)
backdrop-filter: blur(27.18px)
box-shadow: 0 1px 1px 0 rgba(0, 72, 145, 0.1), 0 0.5px 0 0 rgba(0, 0, 0, 0.1)
.container
background-color: #f1f1f1
padding: 20rpx
.content
margin: 0 0 20rpx 0
padding: 20rpx
background-color: #ffffff
border-radius: 10rpx
.u-button
height: 60rpx
.flex_1
flex: 1
</style>

@ -0,0 +1,114 @@
<template>
<view>
<u-sticky
class="sticky"
:custom-nav-height="0"
>
<u-navbar
:title="'新增:'+name+'抄表'"
bg-color="transparent"
:auto-back="true"
:title-style="{ fontWeight: 'bold' }"
safe-area-inset-top
placeholder
/>
</u-sticky>
<view class="container">
<!-- 自定义表单校验 -->
<uni-forms ref="customForm" :rules="customRules" labelWidth="105px" :modelValue="formData">
<uni-forms-item label="抄表时间" name="checkTime">
<uni-datetime-picker v-model="formData.checkTime" type="date" :clear-icon="true" placeholder="选择抄表时间"/>
</uni-forms-item>
<uni-forms-item label="抄表值" required name="checkValue">
<u-number-box v-model="formData.checkValue" min="0" inputWidth="100%"></u-number-box>
</uni-forms-item>
<uni-forms-item label="上次抄表时间" name="lastCheckTime">
<uni-datetime-picker v-model="formData.lastCheckTime" type="date" :clear-icon="true" placeholder="上次抄表时间" disabled/>
</uni-forms-item>
<uni-forms-item label="上次抄表值" name="lastCheckValue">
<u-number-box v-model="formData.lastCheckValue" min="0" disabled inputWidth="100%"></u-number-box>
</uni-forms-item>
<uni-forms-item label="单价" name="unitPrice">
<u-number-box v-model="formData.unitPrice" min="0" inputWidth="100%"></u-number-box>
</uni-forms-item>
<uni-forms-item label="差值" name="diffValue">
<u-number-box v-model="formData.diffValue" min="0" disabled inputWidth="100%"></u-number-box>
</uni-forms-item>
<uni-forms-item label="备注" name="remark">
<u-input type="text" placeholder="请输入备注" />
</uni-forms-item>
</uni-forms>
<view class="u-flex justify-end">
<view @click="submit()">
<u-button type="success">
<uni-icons type="checkbox" class="u-m-r-10"/>
保存
</u-button></view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from "vue";
import { onLoad, onReady } from "@dcloudio/uni-app";
import tab from "@/plugins/tab";
import { createEnergyDeviceCheckRecord } from "@/api/mes/application";
import modal from "@/plugins/modal";
const formData = ref({
checkTime: undefined,
checkValue: undefined,
deviceId: undefined,
lastCheckTime: undefined,
lastCheckValue: undefined,
diffValue: undefined,
unitPrice: undefined,
remark: undefined
})
const name = ref('')
const customForm = ref()
//
const customRules = ref({
checkValue: { rules: [{ required: true, errorMessage: '抄表值不能为空'}]},
})
const submit = ()=>{
customForm.value.validate(async(valid)=>{
if(!valid) {
formData.value.checkTime = new Date(formData.value.checkTime).getTime()
await createEnergyDeviceCheckRecord(formData.value)
modal.msgSuccess("保存成功")
await tab.navigateBack()
uni.$emit('success', true)
}
})
}
onReady(()=>{
//
customForm.value.setRules(customRules.value)
})
onLoad(() => {
name.value = tab.getParams().name
formData.value.deviceId = tab.getParams().id
formData.value.lastCheckTime = tab.getParams().time
formData.value.lastCheckValue = tab.getParams().value
});
</script>
<style lang="sass" scoped>
.sticky
background: linear-gradient(180deg, #d4e9ff 0%, #f3f9ff 100%)
backdrop-filter: blur(27.18px)
box-shadow: 0 1px 1px 0 rgba(0, 72, 145, 0.1), 0 0.5px 0 0 rgba(0, 0, 0, 0.1)
.container
padding: 20rpx
margin: 20rpx
background-color: #ffffff
.uniui-checkbox:before
color: #ffffff
.u-button
height: 35px
</style>

@ -0,0 +1,89 @@
<template>
<view>
<u-sticky
class="sticky"
:custom-nav-height="0"
>
<u-navbar
title="重置最后抄表值"
bg-color="transparent"
:auto-back="true"
:title-style="{ fontWeight: 'bold' }"
safe-area-inset-top
placeholder
/>
</u-sticky>
<view class="container">
<!-- 自定义表单校验 -->
<uni-forms labelWidth="105px" :modelValue="formData">
<uni-forms-item label="名称">
<u-input v-model="formData.name" disabled/>
</uni-forms-item>
<uni-forms-item label="编码">
<u-input v-model="formData.code" disabled/>
</uni-forms-item>
<uni-forms-item label="上次抄表时间" name="lastCheckTime">
<uni-datetime-picker v-model="formData.lastCheckTime" type="date" :clear-icon="true" placeholder="选择上次抄表时间"/>
</uni-forms-item>
<uni-forms-item label="最后抄表值" name="lastCheckValue">
<u-input v-model="formData.lastCheckValue"></u-input>
</uni-forms-item>
</uni-forms>
<view class="u-flex justify-end">
<view @click="submit()">
<u-button type="success">
<uni-icons type="checkbox" class="u-m-r-10"/>
确定
</u-button></view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import tab from "@/plugins/tab";
import { updateEnergyDeviceCheckRecord } from "@/api/mes/application";
import modal from "@/plugins/modal";
const formData = ref({
name: undefined,
code: undefined,
id: undefined,
lastCheckTime: undefined,
lastCheckValue: undefined,
})
const submit = async ()=>{
await updateEnergyDeviceCheckRecord(formData.value)
modal.msgSuccess("修改成功")
await tab.navigateBack()
//
uni.$emit('success', true)
}
onLoad(() => {
formData.value.name = tab.getParams().name
formData.value.id = tab.getParams().id
formData.value.lastCheckTime = tab.getParams().time
formData.value.lastCheckValue = tab.getParams().value
formData.value.code = tab.getParams().code
formData.value.isEnable = tab.getParams().isEnable
});
</script>
<style lang="sass" scoped>
.sticky
background: linear-gradient(180deg, #d4e9ff 0%, #f3f9ff 100%)
backdrop-filter: blur(27.18px)
box-shadow: 0 1px 1px 0 rgba(0, 72, 145, 0.1), 0 0.5px 0 0 rgba(0, 0, 0, 0.1)
.container
padding: 20rpx
margin: 20rpx
background-color: #ffffff
.uniui-checkbox:before
color: #ffffff
.u-button
height: 35px
</style>

@ -0,0 +1,119 @@
<template>
<view>
<u-sticky
class="sticky"
:custom-nav-height="0"
>
<u-navbar
title="我的应用"
bg-color="transparent"
:auto-back="false"
:title-style="{ fontWeight: 'bold' }"
left-icon=""
safe-area-inset-top
placeholder
/>
</u-sticky>
<view class="container-wrap">
<view
v-for="(item,index) in appList"
:key="item.title"
class="app-list"
>
<view
class="u-flex u-flex-between"
>
<view class="app-title">
{{ item.title }}
</view>
<u-icon
name="arrow-right"
color="#333333"
size="14"
/>
</view>
<u-row class="model-container">
<u-col v-for="(app, index) in item.list" :key="app.id" span="3">
<view class="u-flex u-flex-center" @click="navTo(path[index])">
<view class="item u-flex u-flex-column">
<u-image
:show-loading="true"
:src="app.img"
width="96rpx"
height="96rpx"
/>
<text class="text">
{{ app.text }}
</text>
</view>
</view>
</u-col>
</u-row>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import tab from "@/plugins/tab";
const appList = ref([
{
title: '基础数据',
list: [
{
id: 1,
img: '/static/images/icon/arrangement.png',
text: '工位安排'
},
{
id: 2,
img: '/static/images/icon/energy.png',
text: '能源设备'
}
]
}
])
const path = ['/pages/application/components/deskArrangement','/pages/application/components/energyEquipment']
const navTo = (url) => {
tab.navigateTo(url)
}
</script>
<style lang="sass" scoped>
.page
width: 100%
.sticky
background: linear-gradient(180deg, #d4e9ff 0%, #f3f9ff 100%)
backdrop-filter: blur(27.18px)
box-shadow: 0 1px 1px 0 rgba(0, 72, 145, 0.1), 0 0.5px 0 0 rgba(0, 0, 0, 0.1)
.container-wrap
padding: 20rpx
.app-list
background-color: #ffffff
padding: 20rpx 10rpx
border-radius: 20rpx
.app-title
color: #343434
font-size: 28rpx
font-weight: bold
.model-container
flex-wrap: wrap
.item
box-sizing: border-box
padding: 24rpx
&:active
background-color: #f1f1f1
border-radius: 20rpx
.text
margin-top: 8rpx
color: #595959
font-size: 24rpx
+ .app-list
margin-top: 20rpx
</style>

@ -95,7 +95,7 @@ function loginSuccess(result) {
// //
userStore.getInfo().then(res => { userStore.getInfo().then(res => {
uni.switchTab({ uni.switchTab({
url: '/pages/index' url: '/pages/application/index'
}); });
}) })
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Loading…
Cancel
Save