提交 4fb061b4 authored 作者: zs's avatar zs

edit

上级 4a00e686
......@@ -24,12 +24,21 @@ export default {
try {
let inspectionTimeCondition = '';
if (Array.isArray(data.inspectionTime) && data.inspectionTime.length === 2) {
const startTime = new Date(data.inspectionTime[0]).getTime();
const endTime = new Date(data.inspectionTime[1]+'T23:59:59').getTime();
inspectionTimeCondition = `AND inspectionTime >= '${startTime}' AND inspectionTime <= '${endTime}'`;
const startTime = new Date(data.inspectionTime[0]).getTime();
const endTime = new Date(data.inspectionTime[1] + 'T23:59:59').getTime();
inspectionTimeCondition = `AND inspectionTime >= '${startTime}' AND inspectionTime <= '${endTime}'`;
}
let rs = await sqllitedb.selectSQL(
`SELECT id,inspectionType,inspectionCode
let isAdmin = '';
if (data.userId) {
const userResult = await sqllitedb.selectSQL(
`SELECT isAdmin FROM ${table.userName} WHERE userId = '${data.userId}'`
);
isAdmin = userResult?.[0]?.isAdmin || '';
}
const userCondition = isAdmin ?
'' :
`AND userId = '${data.userId}'`;
let sql = `SELECT id,inspectionType,inspectionCode
,recordName
,userName
,userId
......@@ -43,9 +52,13 @@ export default {
${data.synFlag ? `AND synFlag = '${data.synFlag}'` : ''}
${data.isException ? `AND isException = '${data.isException}'` : ''}
${inspectionTimeCondition}
${userCondition}
and delFlag = 0
order by createTime desc`
order by createTime desc`
let rs = await sqllitedb.selectSQL(
sql
);
console.log('sql', sql)
return rs;
} catch (e) {
console.log(e.message);
......@@ -82,7 +95,7 @@ export default {
}
},
//更新同步
async updateSyncData(data){
async updateSyncData(data) {
let ids = '(' + data.join(',') + ')'
let sql = `update ${table.inspectionRecordName} set synFlag=1 where id in ${ids}`;
try {
......@@ -108,7 +121,7 @@ export default {
}
},
async remove(arr) {
async remove(arr) {
if (!id) {
return;
}
......@@ -121,7 +134,8 @@ async remove(arr) {
} finally {
// await sqllitedb.closeDB();
}
}, async saveBatch(list) {
},
async saveBatch(list) {
if (list.length === 0) {
return;
}
......
......@@ -40,7 +40,7 @@ module.exports = {
},
{
field: "isAdmin",
format: "TEXT",
format: "INTEGER DEFAULT 0 ",
},
{
field: "LastSynchronizationTime",
......
......@@ -53,7 +53,7 @@ export default {
} catch (e) {
console.log(e.message)
} finally {
await sqllitedb.closeDB();
// await sqllitedb.closeDB();
}
},
async info(id) {
......
[
{
"userId": "1",
"user": "姜安平",
"avatar": "",
"passWord": "Jap@123",
"roleName": "运维",
"unitName": "运维",
"LastSynchronizationTime": ""
},
{
"userId": "2",
"user": "段树梁",
"avatar": "",
"passWord": "Dsl@123",
"roleName": "运维",
"unitName": "运维",
"LastSynchronizationTime": ""
},
{
"userId": "3",
"user": "孔佳真",
"avatar": "",
"passWord": "Kjz@123",
"roleName": "运维",
"unitName": "运维",
"LastSynchronizationTime": ""
},
{
"userId": "4",
"user": "钟校明",
"avatar": "",
"passWord": "Zxm@123",
"roleName": "运维",
"unitName": "运维",
"LastSynchronizationTime": ""
}
[{
"userId": "1",
"user": "姜安平",
"avatar": "",
"passWord": "Jap@123",
"roleName": "运维",
"unitName": "运维",
"isAdmin": "",
"LastSynchronizationTime": ""
},
{
"userId": "2",
"user": "段树梁",
"avatar": "",
"passWord": "Dsl@123",
"roleName": "运维",
"unitName": "运维",
"isAdmin": "",
"LastSynchronizationTime": ""
},
{
"userId": "3",
"user": "孔佳真",
"avatar": "",
"passWord": "Kjz@123",
"roleName": "运维",
"unitName": "运维",
"isAdmin": "",
"LastSynchronizationTime": ""
},
{
"userId": "4",
"user": "钟校明",
"avatar": "",
"passWord": "Zxm@123",
"roleName": "运维",
"unitName": "运维",
"isAdmin": "",
"LastSynchronizationTime": ""
},
{
"userId": "5",
"user": "admin",
"avatar": "",
"passWord": "123456",
"roleName": "超级管理员",
"isAdmin": 1,
"unitName": "运维",
"LastSynchronizationTime": ""
}
]
\ No newline at end of file
......@@ -6,11 +6,11 @@
v-model="searchFrom.inspectionType" :localdata="inspectArr" @change="(e) => change(e, 'inspectionType')"
placeholder="类型"></uni-data-select>
<uni-data-select v-if="!hiddenSearch.includes('synFlag')" class="uni-search-item" v-model="searchFrom.synFlag" :localdata="synchronization" placeholder="状态"
<uni-data-select v-if="!hiddenSearch.includes('synFlag')" class="uni-search-item" v-model="searchFrom.synFlag" :localdata="synchronization" placeholder="是否同步"
@change="(e) => change(e, 'synFlag')"></uni-data-select>
<uni-data-select v-if="!hiddenSearch.includes('isException')" class="uni-search-item"
v-model="searchFrom.isException" :localdata="exceptionArr" placeholder="异常"
v-model="searchFrom.isException" :localdata="exceptionArr" placeholder="有无异常"
@change="(e) => change(e, 'isException')" :key="new Date().getTime()"></uni-data-select>
</view>
......@@ -54,7 +54,7 @@
},
],
synchronization: [{
value: "",
value: "-1",
text: "全部"
},
{
......@@ -71,7 +71,7 @@
},
],
exceptionArr: [{
value: "",
value: "-1",
text: "全部"
},
{
......@@ -87,6 +87,7 @@
},
methods: {
change(e, key) {
if(e == -1) e = ""
this.searchFrom[key] = e;
this.$emit("change", this.searchFrom);
},
......
......@@ -5,7 +5,7 @@
<view class="header">
<view class="title">杭州内网监管在线-运维在线</view>
<view class="header-buttons">
<view class="log-button" @click="lookLog">操作日志</view>
<view class="log-button" @click="lookLog" v-if="isAdmin">操作日志</view>
<div class="exit-button" @click="logOut">
<image
class="logout"
......
......@@ -104,10 +104,11 @@
uni.navigateTo({
url: "/pages/shaftInspection/shaftInspectionList",
});
}
}
},
async init() {
let res = await inspectApi.selectDataForTime(this.searchForm)
console.log(this.userInfo,'==================')
let res = await inspectApi.selectDataForTime({...this.searchForm,userId:this.userInfo.userId})
this.propList = res.filter(e => e.synFlag == 0)
this.countNum = res.length
const resultMap = {};
......@@ -142,7 +143,7 @@
delete this.searchForm.inspectionTime
}
console.log('搜索', this.searchForm)
this.init(this.searchForm);
this.init();
},
async onLongPress(item) {
let rs = await inspectApi.batchRemove(item.id)
......
......@@ -105,6 +105,7 @@ export const getDarft = () => {
export const getAllDeviceData = () => {
return new Promise((resolve, reject) => {
console.log(store.state.deviceData.length)
debugger
if(store.state.deviceData.length){
const tempRes = lodash.orderBy(store.state.deviceData, "creatTime", ['desc']);
......
......@@ -214,7 +214,6 @@ export const readDeviceData = () => {
// ? `${SYNCHRONIZE_DATA_PAD}/设备上架`
// : `${SYNCHRONIZE_DATA_PAD}/设备上架/${now_user.user}`;
const directoryPath = `${SYNCHRONIZE_DATA_PAD}/设备上架/${now_user.user}`;
console.log("directoryPath", directoryPath);
return new Promise((resolve, reject) => {
......
......@@ -39,7 +39,6 @@ async function importBaseFile() {
await ioUtil.decompressZip(zipFileEntry.fullPath, unzipPath)
unzipEntry = await ioUtil.getFileEntry(unzipPath);
}
debugger
// 导入
let fileEntries = []
if (unzipEntry) {
......
......@@ -240,7 +240,7 @@ export async function checkFileExists(directoryPath, fileName) {
);
});
}
createFileWithPlusIO
export const readFilesInDirectory = async (directoryPath) => {
const promiseArr = [];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论