提交 4781a716 authored 作者: 刘守彩's avatar 刘守彩

fix: bugs

上级 a4ebaaec
import SqlliteDbUtil from '@/utils/sqllitedb'
import table from './sqllite/table.js'
import {
fixNullVal
} from "@/utils/common";
// 用户
export default {
async selectList() {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
try {
let rs = await sqllitedb.selectSQL(`select * from ${table.logListName}`)
return rs
} catch (e) {
console.log(e.message)
} finally {
await sqllitedb.closeDB();
}
},
async pageSelect(data){
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
let pre = (data.page -1) * data.size
let nxt = data.size
try {
let count = await sqllitedb.selectSQL(`select count(*) as total from ${table.logListName} limit 1 `)
let sql = `select * from ${table.logListName} ORDER BY time desc limit ${nxt} offset ${pre} `
let rs = await sqllitedb.selectSQL(sql)
console.log('sql',sql)
return {
data:rs || [],
total:count[0].total || 0
}
} catch (e) {
console.log(e.message)
} finally {
await sqllitedb.closeDB();
}
},
async addlog(data) {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
try {
const values = `(
'${data.LastSynchronizationTime || ""}',
'${data.avatar || ""}',
'${data.detail || ""}',
'${data.isAdmin}',
'${data.level}',
'${data.module}',
'${data.passWord}',
'${data.roleName}',
'${data.time}',
'${data.type}',
'${data.unitName}',
'${data.user}',
'${data.userId}',
${data.userType === null ? 'NULL' : `'${data.userType}'` }
)`
const sql = `INSERT INTO ${table.logListName} (
LastSynchronizationTime,
avatar,
detail,
isAdmin,
level,
module,
passWord,
roleName,
time,
type,
unitName,
user,
userId,
userType
) VALUES ${values}`;
let rs = await sqllitedb.selectSQL(sql)
return rs
} catch (e) {
console.log(e.message)
} finally {
await sqllitedb.closeDB();
}
},
async remove(id) {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
try {
if (!id) {
return
}
let sql = `delete from ${table.logListName} where id = '${id}'`;
await sqllitedb.executeSQL(sql);
} catch (e) {
console.log(e.message)
} finally {
// await sqllitedb.closeDB();
}
},
async info(id) {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
let sql = `select * from ${table.logListName} where id = '${id}'`;
let res = await sqllitedb.selectSQL(sql);
if (res && res.length > 0) {
return res[0]
}
},
async saveBatch(list) {
if (list.length === 0) {
return;
}
console.log('开始保存用户信息....' + list.length)
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
try {
for (let data of list) {
let column = ''
let values = ''
let idx = 0
for (let attr in data) {
let dataField = table['user'].find(v => {
if (v.field === attr) {
return v
}
})
if (!dataField) {
continue
}
column += dataField.field + ','
values += "'" + fixNullVal(data[attr]) + "',"
idx++
}
column = column.endsWith(',') ? column.substring(0, column.length - 1) : column
values = values.endsWith(',') ? values.substring(0, values.length - 1) : values
let sql = `insert into ${table.logListName}(${column}) values(${values})`
let has = await this.info(data.id)
if (has && has.id) {
await this.remove(data.id)
}
await sqllitedb.executeSQL(sql)
}
} catch (e) {
console.log(e.message)
} finally {
await sqllitedb.closeDB();
}
console.log('导入完成...')
}
import SqlliteDbUtil from '@/utils/sqllitedb'
import table from './sqllite/table.js'
import {
fixNullVal
} from "@/utils/common";
// 用户
export default {
async selectList() {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
try {
let rs = await sqllitedb.selectSQL(`select * from ${table.logListName}`)
return rs
} catch (e) {
console.log(e.message)
} finally {
await sqllitedb.closeDB();
}
},
// async pageSelect(data){
// let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
// let pre = (data.page -1) * data.size
// let nxt = data.size
// try {
// let count = await sqllitedb.selectSQL(`select count(*) as total from ${table.logListName} limit 1 `)
// let sql = `select * from ${table.logListName} ORDER BY time desc limit ${nxt} offset ${pre} `
// let rs = await sqllitedb.selectSQL(sql)
// console.log('sql',sql, rs)
// return {
// data:rs || [],
// total:count[0].total || 0
// }
// } catch (e) {
// console.log(e.message)
// } finally {
// await sqllitedb.closeDB();
// }
// },
async pageSelect(data) {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
let pre = (data.page - 1) * data.size
let nxt = data.size
// 拼接时间范围条件
let whereClause = "1=1"
if (data.startTime && data.endTime) {
whereClause += ` AND time BETWEEN '${data.startTime} 00:00:00' AND '${data.endTime} 23:59:59'`
}
try {
// 获取总数
let countSql = `SELECT count(*) as total FROM ${table.logListName} WHERE ${whereClause} LIMIT 1`
let count = await sqllitedb.selectSQL(countSql)
// 获取分页数据
let sql =
`SELECT * FROM ${table.logListName} WHERE ${whereClause} ORDER BY time DESC LIMIT ${nxt} OFFSET ${pre}`
let rs = await sqllitedb.selectSQL(sql)
console.log('sql', sql, rs)
return {
data: rs || [],
total: count[0]?.total || 0
}
} catch (e) {
console.log(e.message)
} finally {
await sqllitedb.closeDB()
}
},
async addlog(data) {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
try {
const values = `(
'${data.LastSynchronizationTime || ""}',
'${data.avatar || ""}',
'${data.detail || ""}',
'${data.isAdmin}',
'${data.level}',
'${data.module}',
'${data.passWord}',
'${data.roleName}',
'${data.time}',
'${data.type}',
'${data.unitName}',
'${data.user}',
'${data.userId}',
${data.userType === null ? 'NULL' : `'${data.userType}'` }
)`
const sql = `INSERT INTO ${table.logListName} (
LastSynchronizationTime,
avatar,
detail,
isAdmin,
level,
module,
passWord,
roleName,
time,
type,
unitName,
user,
userId,
userType
) VALUES ${values}`;
let rs = await sqllitedb.selectSQL(sql)
return rs
} catch (e) {
console.log(e.message)
} finally {
await sqllitedb.closeDB();
}
},
async remove(id) {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
try {
if (!id) {
return
}
let sql = `delete from ${table.logListName} where id = '${id}'`;
await sqllitedb.executeSQL(sql);
} catch (e) {
console.log(e.message)
} finally {
// await sqllitedb.closeDB();
}
},
async info(id) {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
let sql = `select * from ${table.logListName} where id = '${id}'`;
let res = await sqllitedb.selectSQL(sql);
if (res && res.length > 0) {
return res[0]
}
},
async saveBatch(list) {
if (list.length === 0) {
return;
}
console.log('开始保存用户信息....' + list.length)
let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
try {
for (let data of list) {
let column = ''
let values = ''
let idx = 0
for (let attr in data) {
let dataField = table['user'].find(v => {
if (v.field === attr) {
return v
}
})
if (!dataField) {
continue
}
column += dataField.field + ','
values += "'" + fixNullVal(data[attr]) + "',"
idx++
}
column = column.endsWith(',') ? column.substring(0, column.length - 1) : column
values = values.endsWith(',') ? values.substring(0, values.length - 1) : values
let sql = `insert into ${table.logListName}(${column}) values(${values})`
let has = await this.info(data.id)
if (has && has.id) {
await this.remove(data.id)
}
await sqllitedb.executeSQL(sql)
}
} catch (e) {
console.log(e.message)
} finally {
await sqllitedb.closeDB();
}
console.log('导入完成...')
}
}
\ No newline at end of file
......@@ -113,7 +113,11 @@ module.exports = {
{
field: "signImg",
format: "TEXT",
},
},
{
field: "dataSource",
format: "INTEGER DEFAULT 1"
}
],
// 机房、井道信息表
......
......@@ -3,7 +3,7 @@
<view class="container">
<!-- 第一个模块 -->
<view class="header">
<view class="title">杭州内网监管在线-运维在线</view>
<view class="title">杭州内网监管在线-山南数据中心运维在线</view>
<view class="header-buttons">
<view class="log-button" @click="lookLog" v-if="isAdmin">操作日志</view>
<div class="exit-button" @click="logOut">
......@@ -188,12 +188,13 @@ export default {
left: 50%;
transform: translateX(-50%);
ont-family: PingFangSC-Medium;
font-size: 32px;
font-size: 30px;
color: #000000;
text-align: center;
line-height: 40px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
font-weight: 500;
font-weight: 500;
white-space: nowrap;
}
.header-buttons {
......
......@@ -16,8 +16,8 @@
<!-- 搜索区域 -->
<view class="search-com">
<view class="search-com-left">
<uni-data-select class="uni-search-item" v-model="searchFrom.type" :localdata="typeList"
@change="change" placeholder="操作类型:全部" :key="new Date().getTime()"></uni-data-select>
<!-- <uni-data-select class="uni-search-item" v-model="searchFrom.type" :localdata="typeList"
@change="change" placeholder="操作类型:全部" :key="new Date().getTime()"></uni-data-select> -->
<view class="search-com-right">
<uni-datetime-picker class="uni-datetime-picker" type="daterange"
......@@ -148,13 +148,8 @@
},
timeChange(val) {
let temp = [...val];
if (val.length && val[0] == val[1]) {
temp[1] = `${temp[1]} 23:59:59`;
}
this.searchForm.startTime = temp[0] || "";
this.searchForm.endTime = temp[1] || "";
this.searchForm.startTime = val[0] || "";
this.searchForm.endTime = val[1] || "";
this.getData();
},
......@@ -173,11 +168,13 @@
} = this.searchForm;
let data = {
page: 2,
size: 10
size: 10,
}
let res = await this.$logApi.pageSelect({
page: this.pageCurrent,
size: this.pageSize
size: this.pageSize,
startTime,
endTime
})
if (res) {
this.total = res.total
......
......@@ -140,7 +140,7 @@ export default {
conclusion: "",
settingLabel: "设定电池电压",
settingLabelShow: "设定电压",
setting: this.jfType === "3" ? "2V-2.35V" : "2V-2.35V", //设定温度值
setting: "10V-15V", //设定温度值
// value: "", //输入温度
unit: "V", //单位
photos: [],
......@@ -155,7 +155,7 @@ export default {
conclusion: "",
settingLabel: "设定电池温度",
settingLabelShow: "设定温度",
setting: "10℃-40℃", //设定湿度值
setting: "10℃-35℃", //设定湿度值
// value: "", //输入湿度
unit: "℃", //单位
photos: [],
......@@ -170,7 +170,7 @@ export default {
conclusion: "",
settingLabel: "设定电池内阻",
settingLabelShow: "设定内阻",
setting: this.jfType === "3" ? "<50mΩ" : "<50mΩ", //设定湿度值
setting: this.jfType === "3" ? "<10mΩ" : "<10mΩ", //设定湿度值
// value: "", //输入湿度
unit: "mΩ", //单位
photos: [],
......
......@@ -282,7 +282,7 @@ export default {
options: {}, //存储数据
backValue: "",
all_data: [], //所有数据
jfType: "0", //机房类型
jfType: "2", //机房类型
allIsSubmitOne: false,
startDialogData: {
text: [],
......@@ -547,7 +547,7 @@ export default {
}
console.log("this.detailsItem", this.detailsItem);
},
startDialogBtn(name = "山南UPS间", jfType = "0", value = "1") {
startDialogBtn(name = "山南UPS间", jfType = "2", value = "1") {
let item = this.findTargetObject(this.listData);
console.log("即将操作的机房", item);
......@@ -563,7 +563,7 @@ export default {
this.value = value;
this.$refs.startDialog.open();
},
startDialog(name = "山南UPS间", jfType = "0", value = "1") {
startDialog(name = "山南UPS间", jfType = "2", value = "1") {
this.name = name;
this.jfType = jfType;
this.value = value;
......
......@@ -210,7 +210,7 @@ export default {
}, //弹窗文案
listData: [],
name: "",
jfType: "0",
jfType: "2",
value: "1",
paramsObjFirst: {},
all_data: [],
......
......@@ -34,6 +34,7 @@ export function dataToSql(data) {
createTime: data.id ? data.createTime : `${new Date().getTime()}`,
updateTime: `${new Date().getTime()}`,
inspectionData: data.originData,
dataSource: data.dataSource
};
console.log("dataToSql", send);
return send;
......@@ -85,6 +86,7 @@ export function sqlToData(sqlData) {
inspectionNumber, // 已巡检数量
allIsSubmitOne, // 是否全部填写完成
isSign: !!sqlData.signImg, // 是否有签名
dataSource: sqlData.dataSource
};
return ret;
......
差异被折叠。
<template>
<view class="sampleTable">
<uni-nav-bar
:fixed="true"
background-color="rgba(214, 240, 255, 0.0)"
status-bar
rightWidth="300"
>
<block slot="left">
<view class="" @click="back">
<text class="iconfont icon-fanhui"></text
></view>
</block>
</uni-nav-bar>
<view class="main">
<!-- 占位---不可删除 -->
<view class="seize-seat"> </view>
<view class="container box-shaow-box">
<view v-if="isJF" class="image-item top-image">
<image
src="@/static/img/add-img/jf_table.png"
mode="widthFix"
></image>
</view>
<view v-else class="image-item top-image">
<image
src="@/static/img/add-img/jd_table.png"
mode="widthFix"
></image>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isJF: false,
};
},
onNavigationBarButtonTap(val) {
uni.navigateBack();
},
onLoad(options) {
this.isJF = options.isJF == 1;
},
methods: {
checkImage(val) {
let res = "";
res = `/static/img/report-table/report${val + 1}.png`;
return res;
},
back() {
uni.navigateBack();
},
},
};
</script>
<style lang="less" scoped>
.sampleTable {
width: 100%;
height: 100%;
background-image: linear-gradient(
90deg,
#e9f7fe 0%,
#dceffe 40%,
#d5ebfd 66%,
#c9e8fe 100%
);
.main {
margin-top: -44px;
width: 100%;
background-size: 100% 40rpx;
background-repeat: no-repeat;
.container {
margin: 0 auto;
width: 730rpx;
height: calc(100vh - 44px - var(--status-bar-height) - 20px);
padding: 23.53rpx 17.65rpx;
padding-bottom: 0;
// width: 341.18rpx;
overflow: auto;
display: flex;
flex-wrap: wrap;
justify-sampletable: space-between;
.image-item {
text-align: center;
width: 60%;
height: 100%;
background-color: #ffffff;
border-radius: 4px;
margin: 0 auto;
}
.top-image {
height: 288.24rpx;
}
image {
width: 100%;
box-shadow: 0px 0px 9.41rpx 0px rgba(84, 116, 232, 0.2);
// object-fit: contain;
}
}
}
.seize-seat {
height: 50px;
width: 100%;
background-image: linear-gradient(
90deg,
#e9f7fe 0%,
#dceffe 40%,
#d5ebfd 66%,
#c9e8fe 100%
);
}
// 导航栏样式
.uni-nav-bar-text {
height: 36px;
width: 36px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 18px;
border-radius: 50%;
color: #333;
text-align: center;
.iconfont {
font-size: 20px;
line-height: 36px;
}
}
}
</style>
<template>
<view class="sampleTable">
<uni-nav-bar :fixed="true" background-color="rgba(214, 240, 255, 0.0)" status-bar rightWidth="300">
<block slot="left">
<view class="" @click="back">
<text class="iconfont icon-fanhui"></text>
</view>
</block>
</uni-nav-bar>
<view class="main">
<!-- 占位---不可删除 -->
<view class="seize-seat"> </view>
<view class="container box-shaow-box">
<view v-if="isJF" class="image-item top-image">
<image src="@/static/img/add-img/jf_table_new.png" mode="widthFix"></image>
</view>
<view v-else class="image-item top-image">
<image src="@/static/img/add-img/jd_table.png" mode="widthFix"></image>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isJF: false,
};
},
onNavigationBarButtonTap(val) {
uni.navigateBack();
},
onLoad(options) {
this.isJF = options.isJF == 1;
},
methods: {
checkImage(val) {
let res = "";
res = `/static/img/report-table/report${val + 1}.png`;
return res;
},
back() {
uni.navigateBack();
},
},
};
</script>
<style lang="less" scoped>
.sampleTable {
width: 100%;
height: 100%;
background-image: linear-gradient(90deg,
#e9f7fe 0%,
#dceffe 40%,
#d5ebfd 66%,
#c9e8fe 100%);
.main {
margin-top: -44px;
width: 100%;
background-size: 100% 40rpx;
background-repeat: no-repeat;
.container {
margin: 0 auto;
height: calc(100vh - 44px - var(--status-bar-height) - 20px);
padding: 23.53rpx 17.65rpx;
padding-bottom: 0;
overflow: auto;
display: flex;
flex-wrap: wrap;
justify-sampletable: space-between;
.image-item {
text-align: center;
width: 80%;
height: 100%;
background-color: #ffffff;
border-radius: 4px;
margin: 0 auto;
}
.top-image {
height: 288.24rpx;
}
image {
width: 100%;
box-shadow: 0px 0px 9.41rpx 0px rgba(84, 116, 232, 0.2);
}
}
}
.seize-seat {
height: 50px;
width: 100%;
background-image: linear-gradient(90deg,
#e9f7fe 0%,
#dceffe 40%,
#d5ebfd 66%,
#c9e8fe 100%);
}
// 导航栏样式
.uni-nav-bar-text {
height: 36px;
width: 36px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 18px;
border-radius: 50%;
color: #333;
text-align: center;
.iconfont {
font-size: 20px;
line-height: 36px;
}
}
}
</style>
\ No newline at end of file
zI7Z5z3b
\ No newline at end of file
别名:__uni__a11bfd5
密码:zI7Z5z3b
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论