提交 80022c88 authored 作者: zs's avatar zs

edit

上级 0b91117e
...@@ -19,6 +19,25 @@ export default { ...@@ -19,6 +19,25 @@ export default {
} }
}, },
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) { async addlog(data) {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB() let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
try { try {
......
<template> <template>
<view class="operLog"> <view class="operLog">
<uni-nav-bar <uni-nav-bar :fixed="true" background-color="rgba(214, 240, 255, 0.0)" status-bar rightWidth="300">
:fixed="true" <block slot="left">
background-color="rgba(214, 240, 255, 0.0)" <view class="uni-nav-bar-text" @click="back">
status-bar <text class="iconfont icon-fanhui"></text>
rightWidth="300" </view>
> </block>
<block slot="left"> </uni-nav-bar>
<view class="uni-nav-bar-text" @click="back">
<text class="iconfont icon-fanhui"></text <view class="main">
></view> <!-- 占位---不可删除 -->
</block> <view class="seize-seat"> </view>
</uni-nav-bar>
<view class="container">
<view class="main"> <!-- 搜索区域 -->
<!-- 占位---不可删除 --> <view class="search-com">
<view class="seize-seat"> </view> <view class="search-com-left">
<uni-data-select class="uni-search-item" v-model="searchFrom.type" :localdata="typeList"
<view class="container"> @change="change" placeholder="操作类型:全部" :key="new Date().getTime()"></uni-data-select>
<!-- 搜索区域 -->
<view class="search-com"> <view class="search-com-right">
<view class="search-com-left"> <uni-datetime-picker class="uni-datetime-picker" type="daterange"
<uni-data-select v-model="searchFrom.inspectionTime" :border="false" @change="timeChange" />
class="uni-search-item" </view>
v-model="searchFrom.type" </view>
:localdata="typeList" </view>
@change="change"
placeholder="操作类型:全部" <view class="count-tatal">
:key="new Date().getTime()" <text class="num">{{ tableData.length || 0 }}</text>
></uni-data-select> <text>查询结果</text>
</view>
<view class="search-com-right"> <!-- 展示区域 -->
<uni-datetime-picker <view class="table-main box-shaow-box">
class="uni-datetime-picker" <view class="log-item" v-for="(item, index) in tableData" :key="index">
type="daterange" <text class="time bold">{{ item.time }}</text>
v-model="searchFrom.inspectionTime"
:border="false" <view class="desc">
@change="timeChange" <!-- 不可删除 -->
/> <text class="xuxian">......</text>
</view>
</view> <text class="bold"> {{ item.roleName }} {{ item.user }} </text>
</view> <text class="text">操作模块</text>
<text class="bold">{{ item.module }}</text>
<view class="count-tatal"> <text v-if="item.detail" class="text">操作详情</text>
<text class="num">{{ tableData.length || 0 }}</text> <text v-if="item.detail" class="bold">{{ item.detail }}</text>
<text>查询结果</text> <text v-if="item.type" class="text">操作类型</text>
</view> <text v-if="item.type" class="bold">{{ item.type }}</text>
<!-- 展示区域 --> </view>
<view class="table-main box-shaow-box"> </view>
<view </view>
class="log-item" <uni-pagination class="pagination" :total="total" :show-icon="true" :current="pageCurrent"
v-for="(item, index) in tableData" @change="pageChange"></uni-pagination>
:key="index" </view>
>
<text class="time bold">{{ item.time }}</text> </view>
<view class="desc"> </view>
<!-- 不可删除 -->
<text class="xuxian">......</text>
<text class="bold"> {{ item.roleName }} {{ item.user }} </text>
<text class="text">操作</text>
<text class="bold">{{ item.module }}{{ item.type }}</text>
<text v-if="item.detail" class="text">内容</text>
<text v-if="item.detail" class="bold">{{ item.detail }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template> </template>
<script> <script>
import { getLogList } from "@/request/index.js"; import {
import { LOG_TYPE_ENUM } from "@/utils/IoReadingAndWriting.js"; getLogList
export default { } from "@/request/index.js";
components: { import {
}, LOG_TYPE_ENUM
data() { } from "@/utils/IoReadingAndWriting.js";
return { export default {
searchFrom: { components: {},
type: -1, data() {
}, return {
searchVal: "", searchFrom: {
allData: [], type: -1,
tableData: [], },
// 每页数据量 searchVal: "",
pageSize: 10, allData: [],
// 当前页 tableData: [],
pageCurrent: 1, // 每页数据量
// 数据总量 pageSize: 10,
total: 0, // 当前页
loading: false, pageCurrent: 1,
typeList: [ // 数据总量
{ value: "all", text: "全部" }, total: 0,
loading: false,
{ value: "1", text: "巡检" }, typeList: [{
{ value: "2", text: "同步" }, value: "all",
text: "全部"
{ },
text: "其他",
value: "-1", {
}, value: "1",
], text: "巡检"
searchForm: { },
type: "", {
startTime: "", value: "2",
endTime: "", text: "同步"
}, },
recordData: [],
}; {
}, text: "其他",
created() {}, value: "-1",
onNavigationBarButtonTap(val) { },
uni.navigateBack(); ],
}, searchForm: {
onLoad() { type: "",
uni.showLoading(); startTime: "",
endTime: "",
getLogList() },
.then((res) => { recordData: [],
this.recordData = res; };
this.getData(); },
uni.hideLoading(); created() {},
}) onNavigationBarButtonTap(val) {
.catch((error) => { uni.navigateBack();
if (0 == error.code) { },
uni.showToast({ onLoad() {
title: error.msg, uni.showLoading();
icon: "none",
duration: 1000, getLogList()
}); .then((res) => {
} this.recordData = res;
uni.hideLoading(); this.getData();
}); uni.hideLoading();
}, })
methods: { .catch((error) => {
change(e) { if (0 == error.code) {
this.searchForm.type = e; uni.showToast({
this.getData(); title: error.msg,
}, icon: "none",
duration: 1000,
timeChange(val) { });
let temp = [...val]; }
if (val.length && val[0] == val[1]) { uni.hideLoading();
temp[1] = `${temp[1]} 23:59:59`; });
} },
methods: {
this.searchForm.startTime = temp[0] || ""; pageChange(e) {
this.searchForm.endTime = temp[1] || ""; const {
type,
this.getData(); current
}, } = e
this.pageCurrent = e.current
back() { this.getData()
uni.navigateBack(); },
}, change(e) {
this.searchForm.type = e;
// 获取数据 this.getData();
getData() { },
this.loading = true;
const { type, startTime, endTime } = this.searchForm; timeChange(val) {
let temp = [...val];
this.tableData = this.recordData.filter((item) => { if (val.length && val[0] == val[1]) {
let matchType = true; // 类型筛选 temp[1] = `${temp[1]} 23:59:59`;
let matchTime = true; // 时间筛选 }
if (type && type != "all") {
if (type == -1) { this.searchForm.startTime = temp[0] || "";
// [其他]搜索项 this.searchForm.endTime = temp[1] || "";
matchType =
Object.values(LOG_TYPE_ENUM).indexOf(item.type) > -1 && this.getData();
!item.inspectionType && },
item.module.indexOf("同步") < 0;
} else if (type == 1) { back() {
// [巡检]搜索项 uni.navigateBack();
matchType = (item.inspectionType || 0) > 0; },
} else if (type == 2) {
// [同步]搜索项 // 获取数据
matchType = item.module.indexOf("同步") > -1; async getData() {
} this.loading = true;
} const {
type,
if (startTime && endTime) { startTime,
matchTime = endTime
Date.parse(item.time) <= Date.parse(endTime) && } = this.searchForm;
Date.parse(item.time) >= Date.parse(startTime); let data = {
} page: 2,
return matchType && matchTime; size: 10
}); }
let res = await this.$logApi.pageSelect({
this.loading = false; page: this.pageCurrent,
}, size: this.pageSize
}, })
}; if (res) {
this.total = res.total
this.tableData = res.data
}
this.loading = false;
return
this.tableData = this.recordData.filter((item) => {
let matchType = true; // 类型筛选
let matchTime = true; // 时间筛选
if (type && type != "all") {
if (type == -1) {
// [其他]搜索项
matchType =
Object.values(LOG_TYPE_ENUM).indexOf(item.type) > -1 &&
!item.inspectionType &&
item.module.indexOf("同步") < 0;
} else if (type == 1) {
// [巡检]搜索项
matchType = (item.inspectionType || 0) > 0;
} else if (type == 2) {
// [同步]搜索项
matchType = item.module.indexOf("同步") > -1;
}
}
if (startTime && endTime) {
matchTime =
Date.parse(item.time) <= Date.parse(endTime) &&
Date.parse(item.time) >= Date.parse(startTime);
}
return matchType && matchTime;
});
},
},
};
</script> </script>
<style scoped lang="less" scoped> <style scoped lang="less" scoped>
.operLog { .operLog {
background-image: linear-gradient( background-image: linear-gradient(90deg,
90deg, #e9f7fe 0%,
#e9f7fe 0%, #dceffe 40%,
#dceffe 40%, #d5ebfd 66%,
#d5ebfd 66%, #c9e8fe 100%);
#c9e8fe 100%
); .main {
.main { margin-top: -44px;
margin-top: -44px; }
}
.container {
.container { height: 100%;
height: 100%; padding: 16px 24px;
padding: 16px 24px; height: calc(100vh - 44px );
height: calc(100vh - 50px - 24px - 8px);
.search-com {
.search-com { display: flex;
display: flex; align-items: center;
align-items: center;
.search-com-left { .search-com-left {
display: flex; display: flex;
align-items: center; align-items: center;
.uni-search-item {
margin-right: 12px; .uni-search-item {
width: 200px; margin-right: 12px;
background: #fff; width: 200px;
border-radius: 4px; background: #fff;
border: none !important; border-radius: 4px;
} border: none !important;
} }
.search-com-right { }
width: 300px;
.uni-datetime-picker { .search-com-right {
background: #fff; width: 300px;
}
} .uni-datetime-picker {
} background: #fff;
}
.count-tatal { }
margin: 16px 0 8px 0; }
font-size: 14px;
color: #4a4a4a; .count-tatal {
font-weight: 400; margin: 16px 0 8px 0;
.num { font-size: 14px;
font-size: 18px; color: #4a4a4a;
color: #3774f6; font-weight: 400;
line-height: 26px;
font-weight: 600; .num {
margin-right: 5px; font-size: 18px;
} color: #3774f6;
} line-height: 26px;
.table-main { font-weight: 600;
padding: 28px 24px; margin-right: 5px;
background: #fff; }
overflow: auto; }
height: calc(100vh - 26px - 16px - 8px - 36px - 62px - 18px - 50px);
.log-item { .table-main {
display: flex; padding: 28px 24px;
align-items: flex-start; background: #fff;
padding-bottom: 20px; overflow: auto;
&:last-of-type { height: calc(100vh - 26px - 16px - 8px - 36px - 62px - 18px - 50px);
.xuxian {
display: none; .log-item {
} display: flex;
} align-items: flex-start;
.time { padding-bottom: 20px;
font-size: 16px;
color: #000000; &:last-of-type {
text-align: right; .xuxian {
line-height: 24px; display: none;
font-weight: 500; }
position: relative; }
margin-right: 40px;
&::after { .time {
position: absolute; font-size: 16px;
content: " "; color: #000000;
right: -22px; text-align: right;
top: 50%; line-height: 24px;
transform: translateY(-50%); font-weight: 500;
width: 8px; position: relative;
height: 8px; margin-right: 40px;
border-radius: 50%;
background: #3774f6; &::after {
} position: absolute;
} content: " ";
.bold { right: -22px;
font-weight: bold !important; top: 50%;
color: #000000 !important; transform: translateY(-50%);
} width: 8px;
.desc { height: 8px;
position: relative; border-radius: 50%;
.xuxian { background: #3774f6;
position: absolute; }
transform: rotate(90deg); }
font-size: 10px;
color: #3774f6; .bold {
left: -29px; font-weight: bold !important;
top: 24px; color: #000000 !important;
} }
text {
font-size: 14px; .desc {
color: #4a4a4a; position: relative;
line-height: 22px;
font-weight: 400; .xuxian {
} position: absolute;
.text { transform: rotate(90deg);
margin: 0 8px; font-size: 10px;
} color: #3774f6;
} left: -29px;
} top: 24px;
} }
}
text {
.seize-seat { font-size: 14px;
height: 50px; color: #4a4a4a;
width: 100%; line-height: 22px;
background-image: linear-gradient( font-weight: 400;
90deg, }
#e9f7fe 0%,
#dceffe 40%, .text {
#d5ebfd 66%, margin: 0 8px;
#c9e8fe 100% }
); }
} }
// 导航栏样式 }
.uni-nav-bar-text { }
height: 36px; .pagination{
width: 36px; margin-top: 10px;
background: #ffffff; ::v-deep .page--active{
border: 0.4px solid rgba(224, 224, 224, 1); padding: 0 10px;
border-radius: 18px; }
border-radius: 50%; }
color: #333; .seize-seat {
text-align: center; height: 50px;
.iconfont { width: 100%;
font-size: 20px; background-image: linear-gradient(90deg,
line-height: 36px; #e9f7fe 0%,
} #dceffe 40%,
} #d5ebfd 66%,
} #c9e8fe 100%);
</style> }
// 导航栏样式
.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
...@@ -77,7 +77,11 @@ ...@@ -77,7 +77,11 @@
mode="aspectFill" mode="aspectFill"
class="photo" class="photo"
></image> ></image>
<view class="photo-mask">拍摄时间:{{photo.time}}</view> <view class="photo-mask">
<view>照片编号:{{photo.id}}</view>
<view>拍摄时间:{{photo.time}}</view>
<view>数据同步:{{ photo.synchronization ? "已同步" : "待同步"}}</view>
</view>
<view <view
class="check-icon" class="check-icon"
:class="{ active: photo.selected }" :class="{ active: photo.selected }"
...@@ -96,7 +100,7 @@ ...@@ -96,7 +100,7 @@
photo.synchronization ? "已同步" : "待同步" photo.synchronization ? "已同步" : "待同步"
}}</view> }}</view>
<view class="photo-info"> <view class="photo-info">
<text class="no">照片编号:{{ photo.id }}</text> 照片编号:{{ photo.id }}
</view> </view>
</view> </view>
</view> </view>
...@@ -485,9 +489,7 @@ export default { ...@@ -485,9 +489,7 @@ export default {
height: 168px; height: 168px;
} }
.photo-mask{
position: absolute;
}
.check-icon { .check-icon {
position: absolute; position: absolute;
top: 6.4px; top: 6.4px;
...@@ -540,7 +542,6 @@ export default { ...@@ -540,7 +542,6 @@ export default {
.photo-mask{ .photo-mask{
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
color: #ffffff; color: #ffffff;
text-align: center;
position: absolute; position: absolute;
bottom: 26.4px; bottom: 26.4px;
width: 148px; width: 148px;
...@@ -548,25 +549,20 @@ export default { ...@@ -548,25 +549,20 @@ export default {
right: 0; right: 0;
border-radius: 4.8px; border-radius: 4.8px;
margin:0 auto; margin:0 auto;
padding: 3.6px; padding:4.8px;
font-size: 9.6px; font-size: 9.6px;
color: #ffffff; color: #ffffff;
line-height: 16px; line-height: 16px;
font-weight: 400;
text-shadow: 0 0 2px rgba(0,0,0,0.30); text-shadow: 0 0 2px rgba(0,0,0,0.30);
font-weight: 400;
} }
.photo-info { .photo-info {
text-align: center; text-align: center;
font-family: PingFangSC-Regular;
text { font-size: 11.2px;
font-family: PingFangSC-Regular; color: #000000;
font-size: 11.2px; line-height: 17.6px;
color: #000000; font-weight: 400;
line-height: 17.6px; }
font-weight: 400;
}
}
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论