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

edit

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