This commit is contained in:
2026-02-10 09:51:18 +08:00
commit 634e0b9456
150 changed files with 18730 additions and 0 deletions
+184
View File
@@ -0,0 +1,184 @@
<template>
<view class="ant-layout page">
<page-header></page-header>
<head-title title="基础设置"></head-title>
<view class="ant-layout-content content">
<view class="form">
<uni-row :gutter="gutter">
<uni-col :span="labelSpan">
<label class="ant-form-item-label">序列号</label>
</uni-col>
<uni-col :span="wrapSpan">
<view class="form-text">
{{ deviceSn }}
</view>
</uni-col>
</uni-row>
<uni-row :gutter="gutter">
<uni-col :span="labelSpan">
<label class="ant-form-item-label">设备名称</label>
</uni-col>
<uni-col :span="wrapSpan">
<input class="ant-input" v-model="name" />
</uni-col>
</uni-row>
<uni-row :gutter="gutter">
<uni-col :span="labelSpan">
<label class="ant-form-item-label">锁屏密码</label>
</uni-col>
<uni-col :span="wrapSpan">
<input type="number" class="ant-input" v-model="screenPw" placeholder="密码为4个数字"/>
</uni-col>
</uni-row>
<uni-row :gutter="gutter">
<uni-col :span="labelSpan">
<label class="ant-form-item-label">设置密码</label>
</uni-col>
<uni-col :span="wrapSpan">
<input type="number" class="ant-input" v-model="settingPw" placeholder="密码为4个数字"/>
</uni-col>
</uni-row>
<uni-row :gutter="gutter">
<uni-col :span="labelSpan">
<label class="ant-form-item-label">接口密钥</label>
</uni-col>
<uni-col :span="wrapSpan">
<input class="ant-input" v-model="apiKey" />
</uni-col>
</uni-row>
<uni-row :gutter="gutter">
<uni-col :span="wrapSpan" :offset="6" style="text-align: left;">
<view class="form-btn">
<view class="ant-btn" @click="submit">保存</view>
<view class="ant-btn" style="margin-left: 20px;" @click="asyncSet">同步</view>
</view>
</uni-col>
</uni-row>
</view>
</view>
<notice ref="notice"/>
</view>
</template>
<script>
import PageHeader from '@/components/PageHeader.vue'
import HeadTitle from '@/components/HeadTitle.vue'
import Notice from '@/components/Notice.vue';
import { getMacAddress } from '@/js_sdk/zw-devicemac/devicemac.js'
import storage from '@/utils/storage.js'
import * as Api from '@/api/index.js'
export default {
components: {
PageHeader,Notice,HeadTitle
},
data() {
return {
gutter: 12,
labelSpan: 6,
wrapSpan: 16,
deviceSn: '',
name: '',
settingPw: '',
screenPw: '',
apiKey: '',
}
},
onLoad() {
this.deviceSn = getMacAddress()
let base = this.$store.getters.base
this.name = base.name
this.settingPw = base.settingPw
this.screenPw = base.screenPw
this.apiKey = base.apiKey
},
methods: {
submit() {
if (this.settingPw != '' && this.settingPw.length != 4 ) {
this.$refs.notice.open({
title: '密码长度4个数字',
type: 'error'
})
return
}
let form = {
name: this.name,
settingPw: this.settingPw,
screenPw: this.screenPw,
apiKey: this.apiKey
}
storage.set('base', form)
this.$store.commit('SET_BASE', { ...form })
this.$refs.notice.open({
title: '保存成功',
type: 'success'
})
},
asyncSet() {
this.$refs.notice.open({
title: '正在同步数据...',
content: '请稍候'
})
Api.deviceinfo({
// mac: this.deviceSn,
// name: this.name,
// setting_password: this.settingPw,
// screen_pw: this.screenPw,
// api_key: this.apiKey
}).then(res => {
console.log(res)
})
}
},
}
</script>
<style scoped>
.page{
background: transparent;
}
.form{
font-size: 18px;
margin-top: 20px;
padding: 40px;
}
.form .uni-row{
margin-bottom: 20px;
}
.ant-form-item-label{
color: #747A8D;
line-height: 40px;
}
.ant-input{
height: 40px;
font-size: 18px;
}
.form-text{
color: #747A8D;
line-height: 40px;
text-align: left;
font-size: 18px;
}
.ant-btn{
line-height: 38px;
background: #2F3242;
border-color: #2F3242;
height: 46px;
width: 128px;
border-radius: 50px;
color: #fff;
font-size: 16px;
}
.form-btn{
margin-top: 60px;
}
</style>
+101
View File
@@ -0,0 +1,101 @@
<template>
<view class="ant-layout page">
<page-header></page-header>
<head-title title="设备信息"></head-title>
<view class="ant-layout-content content">
<view>[基本信息]</view>
<view>设备名称{{ deviceName }}</view>
<view>设备序列号{{ deviceSn }}</view>
<view>设备IP{{ deviceIp }}</view>
<view>&nbsp;</view>
<view>[存储信息]</view>
<view>内镜{{ endo }}</view>
<view>人员{{ person }}</view>
<view>日志{{ log }}</view>
<view>&nbsp;</view>
<view>[运行信息]</view>
<view>紫外线灯累计工作时长{{ UIlamp }}</view>
<view>HEPA累计工作时长{{ HEPA }}</view>
</view>
<notice ref="notice"/>
</view>
</template>
<script>
import PageHeader from '@/components/PageHeader.vue'
import Notice from '@/components/Notice.vue';
import HeadTitle from '@/components/HeadTitle.vue'
import storage from '@/utils/storage.js'
import { getMacAddress } from '@/js_sdk/zw-devicemac/devicemac.js'
import * as db from '@/db/sqlite.js'
export default {
components: {
PageHeader,Notice, HeadTitle
},
data() {
return {
deviceName: '储镜柜',
deviceSn: '',
deviceIp: '192.168.1.1',
endo: 0,
person: 0,
log: 0,
UIlamp: 0, //紫外线灯累计工作时长
HEPA: 0
}
},
async onLoad() {
let info = uni.getDeviceInfo()
console.log(info)
uni.getNetworkType({
success(res) {
console.log(res)
// 网络状态
let net = res.networkType
}
})
this.deviceSn = getMacAddress()
let config = storage.get('config', '')
this.deviceIp = config ? config.ip +':'+config.port : '未设置'
this.UIlamp = storage.get('disinfectRun', '0')
this.HEPA = storage.get('windRun', '0')
let user = await db.getCount('user')
this.person = user[0].num
let log = await db.getCount('log')
this.log = log[0].num
let endo = await db.getCount('endo')
this.endo = endo[0].num
},
methods: {
back() {
uni.navigateBack({
delta: 1
})
}
},
}
</script>
<style scoped>
.page{
background: transparent;
height: 100%;
}
.content{
margin: 20px;
height: 100%;
background: #2F3242;
border-radius: 10px;
padding: 20px 40px;
color: #747A8D;
font-size: 18px;
text-align: left;
line-height: 2em;
}
</style>
+311
View File
@@ -0,0 +1,311 @@
<template>
<view class="ant-layout page">
<page-header></page-header>
<head-title title="内镜信息">
<template #rightBtn>
<view class="ant-btn" @click="add">新增</view>
</template>
</head-title>
<view class="ant-layout-content content">
<table class="ant-table">
<thead class="ant-table-thead">
<tr>
<th>序号</th>
<th>钢印号</th>
<th>品牌</th>
<th>型号</th>
<th>类型</th>
<th>卡号</th>
<th>卡号2</th>
</tr>
</thead>
<tbody class="ant-table-tbody">
<tr v-for="(item, index) in list" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.rfid }}</td>
<td>{{ item.brand }}</td>
<td>{{ item.model }}</td>
<td>{{ item.type }}</td>
<td>{{ item.ic }}</td>
<td>{{ item.ic2 }}</td>
</tr>
</tbody>
</table>
</view>
<view class="ant-layout-footer footer">
<view class="pagenation">
<uni-row style="margin: 0;">
<uni-col :span="8" style="text-align: left;">
<view class="ant-btn" @click="pre">上一页</view>
</uni-col>
<uni-col :span="8" style="line-height: 48px;">
{{ page }}/ {{ totalPage }}
</uni-col>
<uni-col :span="8" style="text-align: right;">
<view class="ant-btn" @click="next">下一页</view>
</uni-col>
</uni-row>
</view>
</view>
<notice ref="notice"/>
<uni-popup ref="popup" :mask-click="false">
<view class="pop-content">
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">*钢印号</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.rfid"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">*卡号</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.ic"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">卡号2</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.ic2"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">品牌</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.brand"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">型号</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.model"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">类型</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.type"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col>
<view class="form-btn">
<view class="ant-btn" @click="submit">保存</view>
<view class="ant-btn" style="margin-left: 20px;" @click="close">取消</view>
</view>
</uni-col>
</uni-row>
</view>
</uni-popup>
</view>
</template>
<script>
import PageHeader from '@/components/PageHeader.vue'
import HeadTitle from '@/components/HeadTitle.vue'
import Notice from '@/components/Notice.vue';
import * as db from '@/db/sqlite.js'
export default {
components: {
PageHeader,Notice,HeadTitle
},
data() {
return {
list: [
{
ic: '11111111111111',
brand: '奥林巴斯',
model: 'GIF290',
type: '胃',
rfid: '1111111111',
}
],
page: 1,
totalPage: 0,
form: {
rfid: '',
ic: '',
ic2: '',
model: '',
brand: '',
type: ''
}
}
},
onLoad() {
this.getList()
},
methods: {
add() {
this.$refs.popup.open()
this.form = {
rfid: '',
ic: '',
ic2: '',
model: '',
brand: '',
type: ''
}
uni.$on('ic', (val) => {
if (!this.form.ic) {
this.form.ic = val
} else if (!this.form.ic2) {
this.form.ic2 = val
}
})
},
close() {
this.$refs.popup.close()
uni.$off('ic')
},
async submit() {
if (this.form.rfid == '' || this.form.ic == '') {
return false
}
let tableName = 'endo'
let isTable = await db.isTable(tableName)
if (!isTable) {
await db.addEndoTable()
}
try {
await db.addTabItem(tableName, { ...this.form })
this.$refs.popup.close()
uni.showToast({
title: '保存成功',
icon: 'none'
})
this.getList()
} catch (error) {
uni.showToast({
title: '保存失败',
icon: 'none'
})
}
},
getList() {
db.getDataList('endo', this.page, 15, '', '').then(res => {
this.list = res.list
this.totalPage = res.totalPage
})
},
// 上一页
pre() {
if (this.page > 1) {
this.page--
this.getList()
}
},
// 下一页
next() {
if (this.page < this.totalPage) {
this.page++
this.getList()
}
},
},
}
</script>
<style scoped>
.page{
background: transparent;
height: 100%;
}
.content{
color: #747A8D;
flex: 1;
height: 100%;
padding: 20px;
}
.footer{
background: transparent;
padding: 20px;
}
.pagenation{
height: 50px;
color: #747A8D;
font-size: 16px;
letter-spacing: 2px;
}
.pagenation .ant-btn{
width: 143px;
height: 50px;
border-radius: 50px;
box-shadow: none;
font-size: 24px;
font-weight: 500;
background: #2F3242;
color: #fff;
border-color: #2F3242;
line-height: 40px;
}
.pop-content{
padding: 30px;
padding-top: 50px;
width: 500px;
min-height: 400px;
border-radius: 15px;
background: #777D90;
}
.pop-content .uni-row{
margin-bottom: 16px;
}
.ant-form-item-label{
color: #fff;
font-size: 18px;
line-height: 40px;
}
.ant-input{
height: 40px;
font-size: 18px;
}
.form-text{
color: #747A8D;
line-height: 40px;
text-align: left;
font-size: 18px;
}
.ant-btn{
line-height: 38px;
background: #2F3242;
border-color: #2F3242;
height: 46px;
width: 128px;
border-radius: 50px;
color: #fff;
font-size: 16px;
}
.form-btn{
margin-top: 30px;
}
</style>
+159
View File
@@ -0,0 +1,159 @@
<template>
<view class="ant-layout page">
<page-header></page-header>
<view class="ant-layout-header header">
<uni-row>
<uni-col :span="6" style="text-align: left;">
<view class="ant-btn" @click="back">返回</view>
</uni-col>
<uni-col :span="12">
<view class="title">
网络设置
</view>
</uni-col>
<uni-col :span="6"></uni-col>
</uni-row>
</view>
<view class="ant-layout-content content">
<uni-row style="margin-top: 20%;">
<uni-col :span="16" :offset="4">
<uni-row class="form" :gutter="8">
<uni-col :span="16">
<view @click="onFocus('ip')" class="ant-input">
<text v-if="ip != ''">{{ ip }}</text>
<text style="color: #ccc;" v-else>ip地址</text>
</view>
</uni-col>
<uni-col :span="8">
<view @click="onFocus('port')" class="ant-input">
<text v-if="port != ''">{{ port }}</text>
<text style="color: #ccc;" v-else>端口号</text>
</view>
</uni-col>
</uni-row>
<view class="extra">输入云端IP地址如192.168.0.1:8000</view>
</uni-col>
</uni-row>
<uni-row justify="center" type="flex" style="margin-top: 40px;">
<uni-col>
<input-num ref="inputNum" @backspace="backspace" @input="input"></input-num>
</uni-col>
</uni-row>
<uni-row justify="center" type="flex" style="margin-top: 40px;">
<view class="ant-btn" @click="submit">确定</view>
</uni-row>
</view>
<notice ref="notice"/>
</view>
</template>
<script>
import InputNum from '@/components/InputNum.vue';
import PageHeader from '@/components/PageHeader.vue'
import Notice from '@/components/Notice.vue';
import storage from '@/utils/storage'
export default {
components: {
InputNum,PageHeader,Notice
},
data() {
return {
ip: '',
port: '',
focus: 'ip'
}
},
mounted() {
this.getData();
},
methods: {
getData() {
let server = storage.get('server', '')
if (server) {
this.ip = server.ip;
this.port = server.port;
}
},
back() {
uni.navigateBack()
},
onFocus(val) {
this.focus = val;
},
backspace() {
if (this.focus == 'ip') {
this.ip = this.ip.slice(0, -1)
}
if (this.focus == 'port') {
this.port = this.port.slice(0, -1)
}
},
input(val) {
if (this.focus == 'ip') {
this.ip += val
}
if (this.focus == 'port') {
this.port += val
}
},
submit() {
if (!this.isValidIP(this.ip)) {
// this.$message.error('请输入正确的IP地址');
return;
}
let data = {
ip: this.ip,
port: this.port ? this.port : '80'
}
storage.set('config', data)
this.$store.state.apiUrl = 'http://' + data.ip + ':' + data.port
this.$refs.notice.open({
title: data.ip + ':' + data.port,
content: '设置成功'
})
},
isValidIP(ip) {
const ipRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
return ipRegex.test(ip);
},
}
}
</script>
<style scoped>
.page{
background: transparent;
}
.ant-btn{
line-height: 38px;
}
.ant-btn{
background: #2F3242;
border-color: #2F3242;
height: 46px;
width: 128px;
border-radius: 50px;
color: #fff;
font-size: 16px;
}
.form{
justify-content: center;
}
.ant-input{
font-size: 18px;
}
.extra{
font-size: 18px;
font-weight: 500;
color: #fff;
margin-top: 20px;
}
.title{
font-size: 24px;
color: #747A8D;
}
</style>
+297
View File
@@ -0,0 +1,297 @@
<template>
<view class="ant-layout page">
<page-header></page-header>
<head-title title="人员维护">
<template #rightBtn>
<view class="ant-btn" @click="add">新增</view>
</template>
</head-title>
<view class="ant-layout-content content">
<table class="ant-table">
<thead class="ant-table-thead">
<tr>
<th>序号</th>
<th>姓名</th>
<th>科室</th>
<th>工号</th>
<th>卡号</th>
<th>卡号2</th>
</tr>
</thead>
<tbody class="ant-table-tbody">
<tr v-for="(item, index) in list" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.name }}</td>
<td>{{ item.type }}</td>
<td>{{ item.number }}</td>
<td>{{ item.ic }}</td>
<td>{{ item.ic2 }}</td>
</tr>
</tbody>
</table>
</view>
<view class="ant-layout-footer footer">
<view class="pagenation">
<uni-row style="margin: 0;">
<uni-col :span="8" style="text-align: left;">
<view class="ant-btn" @click="pre">上一页</view>
</uni-col>
<uni-col :span="8" style="line-height: 48px;">
{{ page }}/ {{ totalPage }}
</uni-col>
<uni-col :span="8" style="text-align: right;">
<view class="ant-btn" @click="next">下一页</view>
</uni-col>
</uni-row>
</view>
</view>
<notice ref="notice"/>
<uni-popup ref="popup" :mask-click="false">
<view class="pop-content">
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">*姓名</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.name"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">*卡号</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.ic"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">卡号2</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.ic2"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">工号</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.number"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8">
<view class="ant-input-group">
<view class="ant-form-item-label">科室</view>
</view>
</uni-col>
<uni-col :span="16">
<input class="ant-input" v-model="form.type"/>
</uni-col>
</uni-row>
<uni-row>
<uni-col>
<view class="form-btn">
<view class="ant-btn" @click="submit">保存</view>
<view class="ant-btn" style="margin-left: 20px;" @click="close">取消</view>
</view>
</uni-col>
</uni-row>
</view>
</uni-popup>
</view>
</template>
<script>
import PageHeader from '@/components/PageHeader.vue'
import HeadTitle from '@/components/HeadTitle.vue'
import Notice from '@/components/Notice.vue';
import * as db from '@/db/sqlite.js'
export default {
components: {
PageHeader,Notice,HeadTitle
},
data() {
return {
list: [
{
ic: '11111111111111',
name: '张三',
type: '清洗科',
number: '1111111111',
}
],
page: 1,
totalPage: 0,
form: {
name: '',
ic: '',
ic2: '',
number: '',
type: ''
}
}
},
onLoad() {
this.getList()
},
methods: {
add() {
this.$refs.popup.open()
this.form = {
name: '',
ic: '',
ic2: '',
number: '',
type: ''
}
uni.$on('ic', (val) => {
if (!this.form.ic) {
this.form.ic = val
} else if (!this.form.ic2) {
this.form.ic2 = val
}
})
},
close() {
this.$refs.popup.close()
uni.$off('ic')
},
async submit() {
if (this.form.name == '' || this.form.ic == '') {
return false
}
let tableName = 'user'
let isTable = await db.isTable(tableName)
if (!isTable) {
await db.addUserTable()
}
try {
await db.addTabItem(tableName, { ...this.form })
this.$refs.popup.close()
uni.showToast({
title: '保存成功',
icon: 'none'
})
this.getList()
} catch (error) {
uni.showToast({
title: '保存失败',
icon: 'none'
})
}
},
getList() {
db.getDataList('user', this.page, 15, '', '').then(res => {
this.list = res.list
this.totalPage = res.totalPage
})
},
// 上一页
pre() {
if (this.page > 1) {
this.page--
this.getList()
}
},
// 下一页
next() {
if (this.page < this.totalPage) {
this.page++
this.getList()
}
},
},
}
</script>
<style scoped>
.page{
background: transparent;
height: 100%;
}
.content{
color: #747A8D;
flex: 1;
height: 100%;
padding: 20px;
}
.footer{
background: transparent;
padding: 20px;
}
.pagenation{
height: 50px;
color: #747A8D;
font-size: 16px;
letter-spacing: 2px;
}
.pagenation .ant-btn{
width: 143px;
height: 50px;
border-radius: 50px;
box-shadow: none;
font-size: 24px;
font-weight: 500;
background: #2F3242;
color: #fff;
border-color: #2F3242;
line-height: 40px;
}
.pop-content{
padding: 30px;
padding-top: 50px;
width: 500px;
min-height: 400px;
border-radius: 15px;
background: #777D90;
}
.pop-content .uni-row{
margin-bottom: 16px;
}
.ant-form-item-label{
color: #fff;
font-size: 18px;
line-height: 40px;
}
.ant-input{
height: 40px;
font-size: 18px;
}
.form-text{
color: #747A8D;
line-height: 40px;
text-align: left;
font-size: 18px;
}
.ant-btn{
line-height: 38px;
background: #2F3242;
border-color: #2F3242;
height: 46px;
width: 128px;
border-radius: 50px;
color: #fff;
font-size: 16px;
}
.form-btn{
margin-top: 30px;
}
</style>
+318
View File
@@ -0,0 +1,318 @@
<template>
<view class="ant-layout page">
<page-header></page-header>
<head-title title="运行参数"></head-title>
<view class="ant-layout-content content">
<uni-section title="存储超时设置" titleColor="#fff" titleFontSize="18px"></uni-section>
<uni-row>
<uni-col :span="12">
<view class="ant-flex">
<view class="ant-form-item-label before">临期</view>
<view class="value">
<input type="number" class="ant-input" v-model="endoNear"/>
</view>
<view class="ant-form-item-label after">小时</view>
</view>
</uni-col>
<uni-col :span="12">
<view class="ant-flex">
<view class="ant-form-item-label before">超期</view>
<view class="value">
<input type="number" class="ant-input" v-model="endoOver"/>
</view>
<view class="ant-form-item-label after">小时</view>
</view>
</uni-col>
</uni-row>
<uni-section title="传感器设置" titleColor="#fff" titleFontSize="18px"></uni-section>
<uni-row>
<uni-col :span="12">
<view class="ant-flex">
<view class="ant-form-item-label before">温度</view>
<view class="value">
<input type="number" class="ant-input" v-model="temp"/>
</view>
<view class="ant-form-item-label after"></view>
</view>
</uni-col>
<uni-col :span="12">
<view class="ant-flex">
<view class="ant-form-item-label before">湿度</view>
<view class="value">
<input type="number" class="ant-input" v-model="humi"/>
</view>
<view class="ant-form-item-label after">%RH</view>
</view>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12">
<view class="ant-flex">
<view class="ant-form-item-label before">压差</view>
<view class="value">
<input type="number" class="ant-input" v-model="pressure"/>
</view>
<view class="ant-form-item-label after">Pa</view>
</view>
</uni-col>
<uni-col :span="12">
<view class="ant-flex">
<view class="ant-form-item-label before">压差补偿</view>
<view class="value">
<input class="ant-input" v-model="pressureCom"/>
</view>
<view class="ant-form-item-label after">Pa</view>
</view>
</uni-col>
</uni-row>
<uni-section title="自动消毒设置" titleColor="#fff" titleFontSize="18px"></uni-section>
<view class="ant-flex group-set" v-for="(i, k) in group" :key="k">
<view class="ant-form-item-label">{{k+1}}</view>
<view class="input">
<input type="number" class="ant-input" v-model="group[k].start.h" />
<text class="form-text"> : </text>
<input type="number" class="ant-input" v-model="group[k].start.m" />
</view>
<view class="form-text">~</view>
<view class="input">
<input type="number" class="ant-input" v-model="group[k].end.h" />
<text class="form-text"> : </text>
<input type="number" class="ant-input" v-model="group[k].end.m" />
</view>
<view class="form-text" style="width: 120px;margin-left: 10px;">
<select-switch :defaultSwitch="group[k].status" @change="groupStatusChange(k)" checked_bj_color="#777D90" :switchList="['ON', 'OFF']"></select-switch>
</view>
</view>
<uni-section title="手动消毒时长设置" titleColor="#fff" titleFontSize="18px"></uni-section>
<uni-row class="ant-flex" style="justify-content: left;">
<view class="ant-form-item-label">时长</view>
<view class="input" style="width: 100px;">
<input type="number" class="ant-input" v-model="disinfectTime"/>
</view>
<view class="ant-form-item-label">
<text class="form-text">分钟</text>
<text style="font-size: 16px;margin-left:10px;">(单次开启持续时长1-59分钟)</text>
</view>
</uni-row>
<uni-section title="真空泵运行参数设置" titleColor="#fff" titleFontSize="18px"></uni-section>
<uni-row>
<uni-col :span="12">
<view class="ant-flex">
<view class="ant-form-item-label">每隔</view>
<view class="input" style="width: 100px;">
<input type="number" class="ant-input" v-model="vacuumPerHour"/>
</view>
<view class="ant-form-item-label">小时</view>
</view>
</uni-col>
<uni-col :span="12">
<view class="ant-flex">
<view class="ant-form-item-label">启动</view>
<view class="input" style="width: 100px;">
<input type="number" min="1" max="59" class="ant-input" v-model="vacuumRunTime"/>
</view>
<view class="ant-form-item-label">分钟</view>
</view>
</uni-col>
</uni-row>
<uni-row style="margin-top: 40px;">
<uni-col :span="24">
<view class="ant-btn" @click="submit">保存</view>
<view class="ant-btn" style="margin-left: 20px;" @click="asyncSet">同步</view>
</uni-col>
</uni-row>
</view>
<notice ref="notice"/>
</view>
</template>
<script>
import PageHeader from '@/components/PageHeader.vue'
import HeadTitle from '@/components/HeadTitle.vue'
import Notice from '@/components/Notice.vue';
import selectSwitch from "@/components/xuan-switch/xuan-switch.vue";
import storage from '@/utils/storage.js';
import { compareTimes } from '@/utils/common.js';
export default {
components: {
PageHeader,Notice,HeadTitle, selectSwitch
},
data() {
return {
endoNear: '72',
endoOver: '96',
temp: '16',
humi: '30',
pressure: '5',
pressureCom: '+5',
group: [],
disinfectTime: '10',
vacuumPerHour: '1',
vacuumRunTime: '10',
}
},
onLoad() {
let runStorage = this.$store.getters.run
if (runStorage) {
// 本地存储
for (let k in runStorage) {
this[k] = runStorage[k]
}
}
},
methods: {
groupStatusChange(key) {
this.group[key].status = !this.group[key].status
},
submit() {
if (this.checkeForm()) {
storage.set('run', { ...this.$data })
this.$store.commit('SET_RUN', { ...this.$data })
this.$refs.notice.open({
title: '保存成功'
})
}
},
checkeForm() {
if (this.endoNear < 1 || this.endoNear > this.endoOver) {
uni.showToast({
title: '请检查超时设置填写是否正确',
icon: 'none'
})
return false
}
for (let i of this.group) {
if (i.start.h > 23 || i.start.m > 59 || i.end.h > 23 || i.end.m > 59) {
uni.showToast({
title: '时间格式超限',
icon: 'none'
})
return false
}
i.start.h = i.start.h.toString().padStart(2, '0');
i.start.m = i.start.m.toString().padStart(2, '0');
i.end.h = i.end.h.toString().padStart(2, '0');
i.end.m = i.end.m.toString().padStart(2, '0');
let start = i.start.h + ':' + i.start.m
let end = i.end.h + ':' + i.end.m
if (i.status == false) {
continue;
}
if (compareTimes(start, end) != 1) {
uni.showToast({
title: '请检查消毒设置填写是否正确',
icon: 'none'
})
return false
}
}
for (let i in this.$data) {
if (this.$data[i] == 'group') {
continue;
}
if (this.$data[i] == '' || this.$data[i] == null || this.$data[i] == 0) {
uni.showToast({
title: '请检查信息填写是否完整',
icon: 'none'
})
return false
}
}
return true
},
asyncSet() {
// const res = await this.$api.asyncSet()
// if (res.code === 200) {
// this.$refs.notice.show({
// title: '同步成功',
// type: 'success'
// })
// } else {
// this.$refs.notice.show({
// title: '同步失败',
// type: 'error'
// })
// }
}
},
}
</script>
<style scoped>
.page{
background: transparent;
height: 100%;
}
.content{
height: 100%;
padding: 20px;
}
.uni-section{
background-color: transparent;
text-align: left;
}
.uni-row{
margin-bottom: 10px;
}
.ant-form-item-label{
color: #747A8D;
line-height: 40px;
padding: 0 10px;
font-size: 18px;
}
.ant-form-item-label.before{
width: 160px;
text-align: right;
}
.value{
width: 140px;
}
.ant-form-item-label.after{
width: 80px;
text-align: left;
}
.ant-input{
height: 40px;
font-size: 18px;
}
.form-text{
color: #747A8D;
line-height: 40px;
text-align: left;
font-size: 18px;
}
.ant-btn{
line-height: 38px;
background: #2F3242;
border-color: #2F3242;
height: 46px;
width: 128px;
border-radius: 50px;
color: #fff;
font-size: 16px;
}
.group-set{
margin-bottom: 10px;
}
.group-set .ant-input{
width: 65px;
}
.form-text :deep(.switch-container){
width: 100%;
height: 40px;
border-radius: 0;
}
</style>