提交 8cbbc796 authored 作者: zs's avatar zs

edit

上级 17a330bd
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 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
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
await sqllitedb.createTable(table.inspectionRecordName, table.inspectionRecord) // 巡检记录表 await sqllitedb.createTable(table.inspectionRecordName, table.inspectionRecord) // 巡检记录表
await sqllitedb.createTable(table.assRoomName, table.assRoom) // 机房、井道信息表 await sqllitedb.createTable(table.assRoomName, table.assRoom) // 机房、井道信息表
await sqllitedb.createTable(table.assBuildingName, table.assBuilding) // 楼宇信息 await sqllitedb.createTable(table.assBuildingName, table.assBuilding) // 楼宇信息
await sqllitedb.createTable(table.logListName, table.logList) // 日志信息
// await sqllitedb.createTable(table.listDevicesName, table.listDevices) // 设备上架信息 // await sqllitedb.createTable(table.listDevicesName, table.listDevices) // 设备上架信息
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)
......
...@@ -272,5 +272,68 @@ module.exports = { ...@@ -272,5 +272,68 @@ module.exports = {
field: "delFlag", field: "delFlag",
format: "INTEGER DEFAULT 0 ", format: "INTEGER DEFAULT 0 ",
} }
] ],
logListName: 'SYS_LOG',
/**
LastSynchronizationTime: (...)
avatar: (...)
detail: (...)
isAdmin: (...)
level: (...)
module: (...)
passWord: (...)
roleName: (...)
time: (...)
type: "登录"
unitName: (...)
user: (...)
userId: (...)
userType: (...)
*/
logList: [{
field: "id",
format: "INTEGER PRIMARY KEY AUTOINCREMENT",
}, {
field: "LastSynchronizationTime",
format: "TEXT",
}, {
field: "avatar",
format: "TEXT",
}, {
field: "detail",
format: "TEXT",
}, {
field: "isAdmin",
format: "TEXT",
}, {
field: "level",
format: "TEXT",
}, {
field: "module",
format: "TEXT",
}, {
field: "passWord",
format: "TEXT",
}, {
field: "roleName",
format: "TEXT",
}, {
field: "time",
format: "TEXT",
}, {
field: "unitName",
format: "TEXT",
}, {
field: "user",
format: "TEXT",
}, {
field: "userId",
format: "TEXT",
}, {
field: "userType",
format: "TEXT",
}, {
field: "type",
format: "TEXT",
}],
}; };
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"user": "姜安平", "user": "姜安平",
"avatar": "", "avatar": "",
"passWord": "Jap@123", "passWord": "Jap@123",
"roleName": "运维", "roleName": "巡检员",
"unitName": "运维", "unitName": "运维",
"isAdmin": "", "isAdmin": "",
"LastSynchronizationTime": "" "LastSynchronizationTime": ""
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"user": "段树梁", "user": "段树梁",
"avatar": "", "avatar": "",
"passWord": "Dsl@123", "passWord": "Dsl@123",
"roleName": "运维", "roleName": "巡检员",
"unitName": "运维", "unitName": "运维",
"isAdmin": "", "isAdmin": "",
"LastSynchronizationTime": "" "LastSynchronizationTime": ""
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
"user": "孔佳真", "user": "孔佳真",
"avatar": "", "avatar": "",
"passWord": "Kjz@123", "passWord": "Kjz@123",
"roleName": "运维", "roleName": "巡检员",
"unitName": "运维", "unitName": "运维",
"isAdmin": "", "isAdmin": "",
"LastSynchronizationTime": "" "LastSynchronizationTime": ""
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"user": "钟校明", "user": "钟校明",
"avatar": "", "avatar": "",
"passWord": "Zxm@123", "passWord": "Zxm@123",
"roleName": "运维", "roleName": "巡检员",
"unitName": "运维", "unitName": "运维",
"isAdmin": "", "isAdmin": "",
"LastSynchronizationTime": "" "LastSynchronizationTime": ""
......
...@@ -58,4 +58,7 @@ Vue.prototype.$md5 = Md5 ...@@ -58,4 +58,7 @@ Vue.prototype.$md5 = Md5
import {Base64} from 'js-base64' import {Base64} from 'js-base64'
Vue.prototype.$Base64 = Base64; Vue.prototype.$Base64 = Base64;
\ No newline at end of file
import logApi from "@/api/log.js"
Vue.prototype.$logApi = logApi;
\ No newline at end of file
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
"", "",
"其他" "其他"
); );
this.$logApi.addlog(logContent)
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
......
...@@ -345,6 +345,7 @@ export default { ...@@ -345,6 +345,7 @@ export default {
"巡检模块" "巡检模块"
); );
logContent.inspectionType = baseInfo.inspectionType; logContent.inspectionType = baseInfo.inspectionType;
this.$logApi.addlog(logContent)
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
...@@ -502,7 +503,7 @@ export default { ...@@ -502,7 +503,7 @@ export default {
// 更新日志 // 更新日志
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType; logContent.inspectionType = params.inspectionType;
this.$logApi.addlog(logContent)
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
...@@ -598,7 +599,7 @@ export default { ...@@ -598,7 +599,7 @@ export default {
"巡检模块" "巡检模块"
); );
logContent.inspectionType = params.inspectionType; logContent.inspectionType = params.inspectionType;
this.$logApi.addlog(logContent)
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
......
...@@ -651,6 +651,7 @@ export default { ...@@ -651,6 +651,7 @@ export default {
all_data[index] = params; all_data[index] = params;
const logContent = getLogContent(LOG_TYPE_ENUM.sys, "数据同步", "同步"); const logContent = getLogContent(LOG_TYPE_ENUM.sys, "数据同步", "同步");
this.$logApi.addlog(logContent)
// 更新巡检list // 更新巡检list
this.$store.commit("SET_ALL_DATA", all_data); this.$store.commit("SET_ALL_DATA", all_data);
const userInfo = this.userInfo; const userInfo = this.userInfo;
......
...@@ -625,6 +625,7 @@ export default { ...@@ -625,6 +625,7 @@ export default {
// 更新日志 // 更新日志
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType; logContent.inspectionType = params.inspectionType;
this.$logApi.addlog(logContent)
console.log("logContent", logContent); console.log("logContent", logContent);
log_list.push(logContent); log_list.push(logContent);
......
...@@ -255,6 +255,7 @@ export default { ...@@ -255,6 +255,7 @@ export default {
"", "",
"同步模块" "同步模块"
); );
this.$logApi.addlog(logContent)
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
......
...@@ -161,6 +161,7 @@ ...@@ -161,6 +161,7 @@
`${item.userName}(${item.inspectionCode})`, `${item.userName}(${item.inspectionCode})`,
"巡检模块" "巡检模块"
); );
this.$logApi.addlog(logContent)
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
......
...@@ -170,6 +170,7 @@ export default { ...@@ -170,6 +170,7 @@ export default {
`${length}张照同步`, `${length}张照同步`,
"同步" "同步"
); );
this.$logApi.addlog(logContent)
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
mode="aspectFill" mode="aspectFill"
class="photo" class="photo"
></image> ></image>
<view class="photot-info">123</view>
<view <view
class="check-icon" class="check-icon"
:class="{ active: photo.selected }" :class="{ active: photo.selected }"
...@@ -333,6 +334,7 @@ export default { ...@@ -333,6 +334,7 @@ export default {
writeDeviceData(photos, this.userInfo.user); writeDeviceData(photos, this.userInfo.user);
const logContent = getLogContent(LOG_TYPE_ENUM.edit, title, type); const logContent = getLogContent(LOG_TYPE_ENUM.edit, title, type);
this.$logApi.addlog(logContent)
const log_list = [ const log_list = [
...this.$store.state.log_list, ...this.$store.state.log_list,
{ {
...@@ -481,8 +483,11 @@ export default { ...@@ -481,8 +483,11 @@ export default {
.photo { .photo {
width: 168px; width: 168px;
height: 168px; height: 168px;
} }
.photo-mask{
position: absolute;
}
.check-icon { .check-icon {
position: absolute; position: absolute;
top: 6.4px; top: 6.4px;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<script> <script>
import userApi from "@/api/user.js"; import userApi from "@/api/user.js";
import logApi from "@/api/log.js";
import SqlliteDbUtil from "@/utils/sqllitedb"; import SqlliteDbUtil from "@/utils/sqllitedb";
import table from "@/api/sqllite/table.js"; import table from "@/api/sqllite/table.js";
import { import {
...@@ -103,6 +104,7 @@ ...@@ -103,6 +104,7 @@
"", "",
"其他" "其他"
); );
this.$logApi.addlog(logContent)
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
......
...@@ -286,6 +286,7 @@ export default { ...@@ -286,6 +286,7 @@ export default {
"巡检模块" "巡检模块"
); );
logContent.inspectionType = baseInfo.inspectionType; logContent.inspectionType = baseInfo.inspectionType;
this.$logApi.addlog(logContent)
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
...@@ -439,6 +440,7 @@ export default { ...@@ -439,6 +440,7 @@ export default {
// 更新日志 // 更新日志
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType; logContent.inspectionType = params.inspectionType;
this.$logApi.addlog(logContent)
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => { addLog(log_list).then((res) => {
...@@ -503,7 +505,7 @@ export default { ...@@ -503,7 +505,7 @@ export default {
`${params.recordName}(${params.inspectionCode})`, `${params.recordName}(${params.inspectionCode})`,
"巡检模块" "巡检模块"
); );
this.$logApi.addlog(logContent)
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType; logContent.inspectionType = params.inspectionType;
......
...@@ -531,6 +531,7 @@ export default { ...@@ -531,6 +531,7 @@ export default {
console.log("签字获取数据", params); console.log("签字获取数据", params);
all_data[index] = params; all_data[index] = params;
const logContent = getLogContent(LOG_TYPE_ENUM.sign, "签字", "机房巡检"); const logContent = getLogContent(LOG_TYPE_ENUM.sign, "签字", "机房巡检");
this.$logApi.addlog(logContent)
// 更新巡检list // 更新巡检list
console.log("all_data存储", all_data); console.log("all_data存储", all_data);
console.log("all_data一个", all_data[index]); console.log("all_data一个", all_data[index]);
......
...@@ -422,7 +422,7 @@ ...@@ -422,7 +422,7 @@
`${params.recordName}(${params.inspectionCode})`, `${params.recordName}(${params.inspectionCode})`,
"巡检模块" "巡检模块"
); );
this.$logApi.addlog(logContent)
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType; logContent.inspectionType = params.inspectionType;
...@@ -498,6 +498,7 @@ ...@@ -498,6 +498,7 @@
// 更新日志 // 更新日志
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType; logContent.inspectionType = params.inspectionType;
this.$logApi.addlog(logContent)
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => { addLog(log_list).then((res) => {
......
...@@ -574,6 +574,7 @@ export default { ...@@ -574,6 +574,7 @@ export default {
// 更新日志 // 更新日志
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType; logContent.inspectionType = params.inspectionType;
this.$logApi.addlog(logContent)
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => { addLog(log_list).then((res) => {
......
...@@ -215,6 +215,7 @@ export default { ...@@ -215,6 +215,7 @@ export default {
"", "",
"同步模块" "同步模块"
); );
this.$logApi.addlog(logContent)
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论