提交 691cf0cd authored 作者: JaxBBLL's avatar JaxBBLL

FIX

上级 fad51e78
...@@ -90,6 +90,7 @@ export default { ...@@ -90,6 +90,7 @@ export default {
createBy, createBy,
createTime, createTime,
updateTime, updateTime,
signImg,
inspectionData inspectionData
) values( ) values(
'${data.inspectionType}', '${data.inspectionType}',
...@@ -103,12 +104,9 @@ export default { ...@@ -103,12 +104,9 @@ export default {
'${data.createBy}', '${data.createBy}',
'${data.createTime}', '${data.createTime}',
'${data.updateTime}', '${data.updateTime}',
'${data.signImg}',
'${JSON.stringify(data.inspectionData)}' '${JSON.stringify(data.inspectionData)}'
)`; )`;
// let has = await this.info(data.id);
// if (has && has.id) {
// await this.remove(data.id);
// }
await sqllitedb.executeSQL(sql); await sqllitedb.executeSQL(sql);
} catch (e) { } catch (e) {
console.log(e.message); console.log(e.message);
...@@ -130,7 +128,6 @@ export default { ...@@ -130,7 +128,6 @@ export default {
recordName = '${data.recordName}', recordName = '${data.recordName}',
inspectionTime = '${data.inspectionTime}', inspectionTime = '${data.inspectionTime}',
isException = ${data.isException}, isException = ${data.isException},
inspectionNumber = ${data.inspectionNumber},
userId = '${data.userId}', userId = '${data.userId}',
userName = '${data.userName}', userName = '${data.userName}',
synFlag = ${data.synFlag}, synFlag = ${data.synFlag},
...@@ -138,7 +135,7 @@ export default { ...@@ -138,7 +135,7 @@ export default {
createBy = '${data.createBy}', createBy = '${data.createBy}',
createTime = '${data.createTime}', createTime = '${data.createTime}',
updateTime = '${data.updateTime}', updateTime = '${data.updateTime}',
inspectionData = '${data.inspectionData}' inspectionData = '${JSON.stringify(data.inspectionData)}'
WHERE id = ${data.id}`; WHERE id = ${data.id}`;
await sqllitedb.executeSQL(sql); await sqllitedb.executeSQL(sql);
} catch (e) { } catch (e) {
......
<template> <template>
<!-- 首页 --> <!-- 首页 -->
<view class="container"> <view class="container">
<navigator url="/pages/test/index" hover-class="navigator-hover"> <view class="flex">
<button type="default">跳转到新页面</button> <navigator url="/pages/test/index" hover-class="navigator-hover">
</navigator> <button type="default" class="uni-btn">跳转TEST</button>
</navigator>
<navigator
url="/pages/inspectionContent/inspectionContentList?uid=1"
hover-class="navigator-hover"
>
<button type="default" class="uni-btn">测试巡检</button>
</navigator>
</view>
<!-- 第一个模块 --> <!-- 第一个模块 -->
<view class="header"> <view class="header">
<view class="title">杭州内网监管在线-运维在线</view> <view class="title">杭州内网监管在线-运维在线</view>
...@@ -74,92 +82,91 @@ ...@@ -74,92 +82,91 @@
<script> <script>
export default { export default {
data() { data() {
return { return {
cards: [{ cards: [
image: '../../static/img/jf.png', {
text: '机房巡检', image: "../../static/img/jf.png",
url:"/pages/inspectionContent/inspectionContentList?backValue=home" text: "机房巡检",
}, url: "/pages/inspectionContent/inspectionContentList?backValue=home",
{ },
image: '../../static/img/jd.png', {
text: '井道巡检', image: "../../static/img/jd.png",
url:"/pages/shaftInspection/shaftInspectionList?backValue=home" text: "井道巡检",
}, url: "/pages/shaftInspection/shaftInspectionList?backValue=home",
{ },
image: '../../static/img/sj.png', {
text: '设备上架', image: "../../static/img/sj.png",
url: "/pages/listingManagement/index?backValue=home" text: "设备上架",
} url: "/pages/listingManagement/index?backValue=home",
], },
userName: this.$store.state.now_user.user, ],
}; userName: this.$store.state.now_user.user,
}, };
computed: { },
isAdmin() { computed: {
return this.$store.state.now_user.isAdmin; isAdmin() {
}, return this.$store.state.now_user.isAdmin;
}, },
created() { },
console.log(this.$store.state) created() {
}, console.log(this.$store.state);
methods: { },
// 修改密码 methods: {
updatePassword() { // 修改密码
uni.navigateTo({ updatePassword() {
url: "/pages/index/editPd", uni.navigateTo({
}); url: "/pages/index/editPd",
}, });
//退出 },
logOut() { //退出
this.$refs.inputDialog2.open(); logOut() {
}, this.$refs.inputDialog2.open();
// 查看操作日志 },
lookLog() { // 查看操作日志
uni.navigateTo({ lookLog() {
url: "/pages/index/operLog", uni.navigateTo({
}); url: "/pages/index/operLog",
}, });
// 三模块卡片跳转页面 },
toList(url){ // 三模块卡片跳转页面
uni.navigateTo({ toList(url) {
url: url, uni.navigateTo({
}); url: url,
});
}, },
// 巡检管理 // 巡检管理
toInspectionManagement() { toInspectionManagement() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/inspectionManagement/index?backValue=home", url: "/pages/inspectionManagement/index?backValue=home",
}); });
}, },
toListingManagement() { toListingManagement() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/listingManagement/index?backValue=home", url: "/pages/listingManagement/index?backValue=home",
}); });
}, },
// 井道巡检 // 井道巡检
toShaftInspection() { toShaftInspection() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/shaftInspection/shaftInspectionNew?backValue=home", url: "/pages/shaftInspection/shaftInspectionNew?backValue=home",
}); });
}, },
//退出--弹出对话框 //退出--弹出对话框
dialogInputConfirm2() { dialogInputConfirm2() {
uni.redirectTo({ uni.redirectTo({
url: "/pages/login/login", url: "/pages/login/login",
success: () => { success: () => {
// uni.clearStorage(); //测试将所有缓存清除 // uni.clearStorage(); //测试将所有缓存清除
uni.setStorageSync("now_user", this.$store.state.now_user); uni.setStorageSync("now_user", this.$store.state.now_user);
uni.setStorageSync( uni.setStorageSync(
"last_time", "last_time",
this.$store.state.now_user.LastSynchronizationTime || "" this.$store.state.now_user.LastSynchronizationTime || ""
); );
}, },
}); });
}, },
},
}
}; };
</script> </script>
......
...@@ -279,32 +279,36 @@ export default { ...@@ -279,32 +279,36 @@ export default {
return res; return res;
}); });
}, },
listFormat(baseList) {
const roomFeatureMap = {
1: "1",
2: "0",
3: "2",
};
let list = baseList.map((item, index) => {
const jfType = roomFeatureMap[item.roomFeature];
return {
id: item.id,
name: item.roomName,
value: item.dictValue,
/** 只是为了映射jfType,为了兼容之前的逻辑
* 前端用的:jfType 机房类型 0屏蔽  1汇聚  2电池间(1) 3电池间(2)
* roomFeature 机房类型枚举:1.汇聚机房,2.屏蔽机房,3.UPS机房,4.数据机房
*/
jfType: item.dictValue == "11" ? "3" : jfType,
isVaild: item.isVaild || false, // 校验通过
status: item.status || 0,
statusLable: item.statusLable || "未巡检",
};
});
return list;
},
init(baseList) { init(baseList) {
this.value = baseList[0].dictValue; this.value = baseList[0].dictValue;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const roomFeatureMap = { let list = this.listFormat(baseList);
1: "1",
2: "0",
3: "2",
};
let list = baseList.map((item, index) => {
const jfType = roomFeatureMap[item.roomFeature];
return {
id: item.id,
name: item.roomName,
value: item.dictValue,
/** 只是为了映射jfType,为了兼容之前的逻辑
* 前端用的:jfType 机房类型 0屏蔽  1汇聚  2电池间(1) 3电池间(2)
* roomFeature 机房类型枚举:1.汇聚机房,2.屏蔽机房,3.UPS机房,4.数据机房
*/
jfType: item.dictValue == "11" ? "3" : jfType,
isVaild: item.isVaild || false, // 校验通过
status: item.status || 0,
statusLable: item.statusLable || "未巡检",
};
});
this.listData = this.deepClone(list); this.listData = this.deepClone(list);
console.log("this.listData", this.listData); console.log("this.listData", this.listData);
const group1 = list.slice(0, 5); const group1 = list.slice(0, 5);
...@@ -364,10 +368,12 @@ export default { ...@@ -364,10 +368,12 @@ export default {
return inspectApi return inspectApi
.info(uid) .info(uid)
.then((res) => { .then((res) => {
console.log("before sqlToData", res);
const detailsInfo = sqlToData(res); const detailsInfo = sqlToData(res);
console.log("getDetails", detailsInfo); console.log("getDetails", detailsInfo);
this.listData = this.deepClone(detailsInfo.originData); // this.listData = this.deepClone(detailsInfo.originData);
this.listData = this.listFormat(detailsInfo.originData);
this.detailsInfo = detailsInfo; this.detailsInfo = detailsInfo;
this.inspectionNumber = detailsInfo.inspectionNumber; this.inspectionNumber = detailsInfo.inspectionNumber;
......
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
<script> <script>
import assRoomApi from "@/api/assRoom.js"; import assRoomApi from "@/api/assRoom.js";
import inspectApi from "@/api/inspect.js"; import inspectApi from "@/api/inspect.js";
import { dataToSql } from "./shared"; import { dataToSql, sqlToData } from "./shared";
import { import {
pad_all_inspection_position, pad_all_inspection_position,
...@@ -243,6 +243,7 @@ export default { ...@@ -243,6 +243,7 @@ export default {
this.inspectionCode = options.inspectionCode; this.inspectionCode = options.inspectionCode;
this.backValue = options.backValue || ""; this.backValue = options.backValue || "";
this.imgSrc = `../../static/img/jf/jf${this.value}.png`; this.imgSrc = `../../static/img/jf/jf${this.value}.png`;
this.tabs = this.tabs =
this.jfType === "2" || this.jfType === "3" this.jfType === "2" || this.jfType === "3"
? this.deepClone(tabsInfo2) ? this.deepClone(tabsInfo2)
...@@ -299,12 +300,12 @@ export default { ...@@ -299,12 +300,12 @@ export default {
// 回显数据 // 回显数据
getDetails(uid) { getDetails(uid) {
uni.showLoading(); uni.showLoading();
getInspectionDetails(uid) inspectApi
.info(uid)
.then((res) => { .then((res) => {
const detailsInfo = res; const detailsInfo = sqlToData(res);
console.log("查看tabs", this.tabs);
this.list = detailsInfo.originData[this.value - 1].details; this.list = detailsInfo.originData[this.value - 1].details;
console.log("查看list", this.list);
this.tabs.forEach((item) => { this.tabs.forEach((item) => {
if ( if (
this.list[item.value] && this.list[item.value] &&
...@@ -314,8 +315,6 @@ export default { ...@@ -314,8 +315,6 @@ export default {
} }
}); });
console.log("查看tabs2", this.tabs); console.log("查看tabs2", this.tabs);
// this.inspectionResult = list[0].inspectionResult;
this.detailsInfo = detailsInfo; this.detailsInfo = detailsInfo;
console.log("detailsInfo", detailsInfo); console.log("detailsInfo", detailsInfo);
...@@ -343,6 +342,7 @@ export default { ...@@ -343,6 +342,7 @@ export default {
// 处理提交数据 // 处理提交数据
getParams(isSubmit) { getParams(isSubmit) {
console.log("this.getParams", this.uid, this.value); console.log("this.getParams", this.uid, this.value);
console.log("originData", this.detailsInfo.originData);
if (this.uid) { if (this.uid) {
let posItem = this.detailsInfo.originData[this.value - 1]; let posItem = this.detailsInfo.originData[this.value - 1];
let paramsObj = this.getAllChildFormData(); //获取所有数据 let paramsObj = this.getAllChildFormData(); //获取所有数据
...@@ -493,8 +493,9 @@ export default { ...@@ -493,8 +493,9 @@ export default {
}, },
realSave(data) { realSave(data) {
const send = dataToSql(data); const send = dataToSql(data);
inspectApi.save(send).then((res) => { const api = this.uid ? inspectApi.update : inspectApi.save;
console.log(res); api(this.uid ? { id: this.uid, ...send } : send).then((res) => {
console.log("保存成功");
}); });
}, },
// 提交 // 提交
......
...@@ -10,16 +10,15 @@ export function dataToSql(data) { ...@@ -10,16 +10,15 @@ export function dataToSql(data) {
synFlag = data.synchronization; synFlag = data.synchronization;
} }
const send = { const send = {
id: Math.random().toString(36).substring(2, 15),
inspectionType: data.inspectionType, inspectionType: data.inspectionType,
inspectionCode: data.inspectionCode, inspectionCode: data.inspectionCode,
recordName: `${moment().format("yyyyMMDD")}-机房巡检`, recordName: `${moment().format("yyyyMMDD")}-机房巡检`,
inspectionTime: moment().format("yyyy-MM-DD HH:mm"), inspectionTime: moment().format("yyyy-MM-DD HH:mm"),
isException: data.isException, isException: data.isException, // 是否异常:0 否 1 是 2 巡检中
userId: store.state.now_user.userId, userId: store.state.now_user.userId,
userName: store.state.now_user.user, userName: store.state.now_user.user,
synFlag: synFlag, // 0.未同步,1.已同步,2.编辑 synFlag: synFlag, // 0.未同步,1.已同步,2.编辑
signImg: data.signImg, signImg: data.signImg || "",
createBy: store.state.now_user.userId, createBy: store.state.now_user.userId,
createTime: data.id ? data.createTime : `${new Date().getTime()}`, createTime: data.id ? data.createTime : `${new Date().getTime()}`,
updateTime: `${new Date().getTime()}`, updateTime: `${new Date().getTime()}`,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论