提交 af224f81 authored 作者: 邓文彬's avatar 邓文彬

fix(Pad): 机房巡检数据回显完成,井道数据待完善

上级 983c0c25
<template> <template>
<view class="inspect-item"> <view class="inspect-item" @click="toPage">
<view class="content"> <view
<view class="name">机房</view> class="content"
:class="details.synchronization == 1 ? 'synchronization' : ''"
>
<view class="name">{{ getLabel(details.inspectionType) }}</view>
<view class="info"> <view class="info">
<view class="info-row"> <view class="info-row">
<text class="title">2024-08-24-F301机房巡检记录</text> <text class="title">{{ details.recordName }}</text>
<text class="status">待同步</text> <text class="status">{{
<view class="status alarm"> details.synchronization == 0 ? "待同步" : "已同步"
}}</text>
<view v-if="details.isException == 1" class="status alarm">
<text class="iconfont icon-yichang1"></text> <text class="iconfont icon-yichang1"></text>
<text>有异常</text></view <text>有异常</text></view
> >
</view> </view>
<view class="info-row info-row-code"> <view class="info-row info-row-code">
<text>编号:</text> <text>编号:</text>
<text class="code-num">JF202408241002</text> <text class="code-num">{{ details.inspectionCode }}</text>
</view> </view>
</view> </view>
<view class="img"> <view class="img">
<!-- <image class="bg-img" src="../../static/img/add-img/default.png"></image> --> <image
<image class="bg-img" src="../../static/img/add-img/active.png"></image> v-if="details.synchronization == 1"
class="bg-img"
src="../../static/img/add-img/default.png"
></image>
<image
v-else
class="bg-img"
src="../../static/img/add-img/active.png"
></image>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { pad_inspection_type } from "@/utils/dict.js";
export default { export default {
props: {}, props: {
details: {
type: Object,
},
},
methods: {
getLabel(val) {
const temp =
(
pad_inspection_type.rows.filter((item) => item.dictValue == val)[0] ||
{}
).dictLabel || "";
return temp.length ? temp.slice(0, 2) : "";
},
toPage() {
const url =
this.details.inspectionType == 1
? "/pages/inspectionContent/inspectionContent"
: "/pages/shaftInspection/shaftInspection";
console.log(" this.details", this.details.uid);
uni.navigateTo({
url: `${url}?uid=${this.details.uid}`,
});
},
},
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
...@@ -43,6 +85,7 @@ export default { ...@@ -43,6 +85,7 @@ export default {
height: 84px; height: 84px;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
background-image: linear-gradient(-67deg, #ffab2487, #ffab2425 50%);
.name { .name {
background: #ffab2471; background: #ffab2471;
border-radius: 12px; border-radius: 12px;
...@@ -111,5 +154,18 @@ export default { ...@@ -111,5 +154,18 @@ export default {
} }
} }
} }
.synchronization {
background-image: linear-gradient(-67deg, #9c9c9c, #9c9c9c 50%);
.name {
background: #7c7c7ca0;
border-radius: 12px;
color: #4a4a4a;
}
.status {
background: #e0e0e0 !important;
color: #4a4a4a !important;
}
}
} }
</style> </style>
...@@ -97,6 +97,12 @@ export default { ...@@ -97,6 +97,12 @@ export default {
userName: this.$store.state.now_user.user, userName: this.$store.state.now_user.user,
}; };
}, },
onLoad(options={}) {
// options就是路由参数,它是一个对象
// this.tabIndex = ;
this.tabClick({}, options.tabIndex || 0)
console.log("---------------------", options); // 假设路由参数中有一个名为id的参数
},
methods: { methods: {
// 修改密码 // 修改密码
updatePassword() { updatePassword() {
......
...@@ -104,8 +104,8 @@ export default { ...@@ -104,8 +104,8 @@ export default {
this.formData = { this.formData = {
inspectionType: "1", inspectionType: "1",
inspectionCode: `JFXJ${moment().format("yyyyMMDDhhmm")}`, inspectionCode: `JFXJ${moment().format("yyyyMMDDhhmm")}`,
recordName: `${moment().format("yyyyMMDD")}-机房巡检记录`, recordName: `${moment().format("yyyyMMDDhhmm")}-机房巡检记录`,
inspectionTime: moment().format("yyyy-MM-DD HH:MM:ss"), inspectionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
inspectionBy: this.$store.state.now_user.name, inspectionBy: this.$store.state.now_user.name,
inspectionById: this.$store.state.now_user.id, inspectionById: this.$store.state.now_user.id,
isException: "", // 是否有异常 isException: "", // 是否有异常
...@@ -113,6 +113,7 @@ export default { ...@@ -113,6 +113,7 @@ export default {
isSubmit: "", // 0 是草稿态; 1 是正式提交 isSubmit: "", // 0 是草稿态; 1 是正式提交
conclusion: "", //结论 conclusion: "", //结论
fillCheck: "", // tab字典的value值, 校验通过的 fillCheck: "", // tab字典的value值, 校验通过的
items: [ items: [
// { // {
// "itemCode": "1", // 检查项 // "itemCode": "1", // 检查项
...@@ -124,7 +125,7 @@ export default { ...@@ -124,7 +125,7 @@ export default {
}, },
change(val) { change(val) {
this.formData.recordName = `${moment().format("yyyyMMDD")}-${ this.formData.recordName = `${moment().format("yyyyMMDDhhmm")}-${
val.detail.data.text val.detail.data.text
}`; }`;
this.formData.inspectionType = val.detail.value; this.formData.inspectionType = val.detail.value;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<view class="base-row"> <view class="base-row">
<view class="base-row-item" <view class="base-row-item"
><text class="name">巡检编号</text ><text class="name">巡检编号</text
><text class="text">{{ baseInfo.inspectionCode }}</text> ><text class="text">{{ baseInfo.inspectionCode }}</text>
</view> </view>
<view class="base-row-item" <view class="base-row-item"
><text class="name">巡检日期</text ><text class="name">巡检日期</text
...@@ -68,13 +68,28 @@ ...@@ -68,13 +68,28 @@
<view class="fixed-btns"> <view class="fixed-btns">
<view class="button-group"> <view class="button-group">
<view class="btn-draft btn-class" @tap="draft(activeTabIndex)"> <view
v-if="!detailsInfo.uid"
class="btn-draft btn-class"
@tap="draft(activeTabIndex)"
>
保存草稿 保存草稿
</view> </view>
<view class="btn-class" @tap="submit"> 提交 </view> <view class="btn-class" @tap="submit"> 提交 </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 退出账号弹出 -->
<uni-popup ref="inputDialog2" type="dialog">
<uni-popup-dialog
ref="inputClose2"
mode="base"
title="确定删除巡检内容?"
@confirm="dialogInputConfirm2"
>
</uni-popup-dialog>
</uni-popup>
</view> </view>
</template> </template>
...@@ -149,13 +164,23 @@ export default { ...@@ -149,13 +164,23 @@ export default {
tempForm: { tempForm: {
// 对应每个tab下的数据 [示例 0: 数据] // 对应每个tab下的数据 [示例 0: 数据]
}, },
detailsInfo: {}, // 详情
}; };
}, },
onLoad() { onLoad(options) {
this.init(); this.init();
if (options.uid) {
this.getDetails(options.uid);
}
}, },
mounted() { mounted() {
this.baseInfo = this.$store.state.temp_data; if (this.detailsInfo.inspectionType) {
this.tabList.forEach((item, index) => {
this.setComponentData(index, this.tempForm[index]);
});
} else {
this.baseInfo = this.$store.state.temp_data;
}
}, },
methods: { methods: {
...@@ -164,18 +189,84 @@ export default { ...@@ -164,18 +189,84 @@ export default {
this.tabList[index].value = item.dictValue; this.tabList[index].value = item.dictValue;
}); });
}, },
// 删除 // 回显数据
deleteClick() { getDetails(uid) {
const all_data = this.$store.state.all_data || [];
const detailsInfo = all_data.filter((item) => item.uid == uid)[0] || {};
console.log("--detailsInfo--", detailsInfo);
this.baseInfo = detailsInfo.originData.baseInfo;
this.tempForm = detailsInfo.originData.tempForm;
this.detailsInfo = detailsInfo;
},
// 回显组件数据
setComponentData(activeTabIndex, componentData) {
let refName = "";
switch (activeTabIndex) {
case 0:
refName = "GatherDataCenter";
break;
case 1:
refName = "ShieldedComputerRoom";
break;
case 2:
refName = "BatteryRoom";
break;
case 3:
refName = "ComputerRoomDuty";
break;
case 4:
refName = "DutyHandover";
break;
}
this.$refs[refName].setForm(componentData);
},
//--弹出对话框
dialogInputConfirm2() {
const all_data = this.$store.state.all_data;
const detailsInfo = this.detailsInfo;
const tempAllData = all_data.filter(
(element) => element.uid != detailsInfo.uid
);
// 更新巡检list
this.$store.commit("SET_ALL_DATA", tempAllData);
writeInspectionData(tempAllData);
// 更新日志
const log_list = this.$store.state.log_list;
const logContent = getLogContent(LOG_TYPE_ENUM.delete);
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
console.log("日志文件写入成功");
});
uni.showToast({ uni.showToast({
title: "删除", icon: `success`,
title: `删除成功`,
}); });
uni.redirectTo({
url: "/pages/home/home?tabIndex=1",
success() {
uni.hideLoading();
},
});
},
// 删除
deleteClick() {
this.$refs.inputDialog2.open();
}, },
lookTable() { lookTable() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/report/sampleTable" url: "/pages/report/sampleTable",
}) });
}, },
// tab选中change 时间 // tab选中change 时间
changeTab(index, item) { changeTab(index, item) {
...@@ -219,7 +310,7 @@ export default { ...@@ -219,7 +310,7 @@ export default {
} }
}); });
console.log("---getParams", tempItems); // console.log("---getParams", tempItems);
const items = tempItems.map((item) => { const items = tempItems.map((item) => {
return { return {
...@@ -263,9 +354,20 @@ export default { ...@@ -263,9 +354,20 @@ export default {
const params = this.getParams(); const params = this.getParams();
const all_data = this.$store.state.all_data; const all_data = this.$store.state.all_data;
let logContent = "";
all_data.push(params); // 新增 or 编辑
if (params.uid) {
const index = all_data.findIndex(
(element) => element.uid == params.uid
);
all_data[index] = params;
logContent = getLogContent(LOG_TYPE_ENUM.edit);
} else {
params.uid = new Date().getTime(); // 唯一标识 pad 端使用
all_data.push(params);
logContent = getLogContent(LOG_TYPE_ENUM.add);
}
// console.log("--params--",all_data, params) // console.log("--params--",all_data, params)
// return // return
...@@ -275,11 +377,10 @@ export default { ...@@ -275,11 +377,10 @@ export default {
writeInspectionData(all_data); writeInspectionData(all_data);
// 更新日志 // 更新日志
const logContent = getLogContent(LOG_TYPE_ENUM.add);
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);
addLog(log_list).then((res) => { addLog(log_list).then((res) => {
console.log("日志文件写入成功"); console.log("日志文件写入成功");
}); });
...@@ -300,13 +401,16 @@ export default { ...@@ -300,13 +401,16 @@ export default {
icon: `${vaild ? "success" : "error"}`, icon: `${vaild ? "success" : "error"}`,
title: `${vaild ? "校验通过" : "请完善填写内容"}`, title: `${vaild ? "校验通过" : "请完善填写内容"}`,
}); });
if (!vaild) {
return;
}
uni.redirectTo({ uni.redirectTo({
url: "/pages/home/home?tabIndex=1", url: "/pages/home/home?tabIndex=1",
success() { success() {
uni.hideLoading(); uni.hideLoading();
}, },
}); });
}); });
}, },
...@@ -484,7 +588,7 @@ export default { ...@@ -484,7 +588,7 @@ export default {
background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%); background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%);
box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24); box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24);
border-radius: 27px; border-radius: 27px;
font-size:18px; font-size: 18px;
color: #ffffff; color: #ffffff;
text-align: center; text-align: center;
font-weight: 400; font-weight: 400;
......
...@@ -106,7 +106,9 @@ export default { ...@@ -106,7 +106,9 @@ export default {
}, },
methods: { methods: {
// 回显数据 // 回显数据
setForm() {}, setForm(componentData) {
this.form = componentData;
},
clickQuick(item) { clickQuick(item) {
this.form.roomWatch = `${this.form.roomWatch}${item.text}`; this.form.roomWatch = `${this.form.roomWatch}${item.text}`;
......
...@@ -34,20 +34,24 @@ ...@@ -34,20 +34,24 @@
</view> </view>
</uni-forms-item> </uni-forms-item>
<view class="user-info"> <view class="user-info">
<uni-forms-item class="row-item" label="交班人">
<uni-forms-item class="row-item" label="交班人" > <text class="text">{{ form.handoverPerson }}</text>
<text class="text">{{ form.handoverPerson }}</text> </uni-forms-item>
</uni-forms-item>
<uni-forms-item
<uni-forms-item class="row-item" required label="接班人" name="successor"> class="row-item"
<uni-easyinput required
type="text" label="接班人"
v-model="form.successor" name="successor"
placeholder="请输入" >
/> <uni-easyinput
</uni-forms-item> type="text"
</view> v-model="form.successor"
placeholder="请输入"
/>
</uni-forms-item>
</view>
</uni-forms> </uni-forms>
</view> </view>
</template> </template>
...@@ -137,8 +141,9 @@ export default { ...@@ -137,8 +141,9 @@ export default {
this.form.handoverPerson = this.$store.state.now_user.user; this.form.handoverPerson = this.$store.state.now_user.user;
}, },
// 回显数据 // 回显数据
setForm() {}, setForm(componentData) {
this.form = componentData;
},
clickQuick(item) { clickQuick(item) {
this.form.dutyHandover = `${this.form.dutyHandover}${item.text}`; this.form.dutyHandover = `${this.form.dutyHandover}${item.text}`;
// this.quickTextList[index].isActive = item.isActive; // this.quickTextList[index].isActive = item.isActive;
...@@ -215,10 +220,10 @@ export default { ...@@ -215,10 +220,10 @@ export default {
} }
} }
.user-info{ .user-info {
display: flex; display: flex;
.uni-forms-item{ .uni-forms-item {
flex: 1;; flex: 1;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
<!-- 异常状态时显示 --> <!-- 异常状态时显示 -->
<uni-forms-item <uni-forms-item
v-if="item.inspectionResult == 1"
required required
class="row-item" class="row-item"
label="情况摘要" label="情况摘要"
...@@ -69,11 +68,7 @@ import { ...@@ -69,11 +68,7 @@ import {
* 汇集机房 * 汇集机房
*/ */
export default { export default {
props: { props: {},
form: {
type: Object,
},
},
data() { data() {
return { return {
list: [], list: [],
...@@ -181,7 +176,10 @@ export default { ...@@ -181,7 +176,10 @@ export default {
console.log("---temp", temp); console.log("---temp", temp);
}, },
// 回显数据 // 回显数据
setForm() {}, setForm(componentData) {
console.log("-componentData---", componentData);
this.list = componentData;
},
// 获取数据 // 获取数据
getForm() { getForm() {
const temp = this.list.map((item) => { const temp = this.list.map((item) => {
...@@ -214,10 +212,10 @@ export default { ...@@ -214,10 +212,10 @@ export default {
return Promise.all(temp).then((res) => { return Promise.all(temp).then((res) => {
const allVaildList = res.filter((item) => item.result); const allVaildList = res.filter((item) => item.result);
const formData= this.getForm(); const formData = this.getForm();
return { return {
vaild: this.list.length == allVaildList.length, vaild: this.list.length == allVaildList.length,
formData formData,
}; };
}); });
}, },
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
<!-- 异常状态时显示 --> <!-- 异常状态时显示 -->
<uni-forms-item <uni-forms-item
v-if="item.inspectionResult == 1"
required required
class="row-item" class="row-item"
label="情况摘要" label="情况摘要"
...@@ -69,11 +68,7 @@ ...@@ -69,11 +68,7 @@
* 屏蔽机房巡检 * 屏蔽机房巡检
*/ */
export default { export default {
props: {
form: {
type: Object,
},
},
data() { data() {
return { return {
list: [], list: [],
...@@ -181,7 +176,9 @@ ...@@ -181,7 +176,9 @@
console.log("---temp", temp); console.log("---temp", temp);
}, },
// 回显数据 // 回显数据
setForm() {}, setForm(componentData) {
this.list = componentData
},
// 获取数据 // 获取数据
getForm() { getForm() {
const temp = this.list.map((item) => { const temp = this.list.map((item) => {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<!-- 描述 --> <!-- 描述 -->
<view v-if="(list[activeIndex]|| {}).value" class="descript"> <view v-if="(list[activeIndex]|| {}).value" class="descript">
<view v-if="list[activeIndex].position || []" class="descript-item"> <view v-if="(list[activeIndex].position || []).length" class="descript-item">
<text class="name">巡检位置</text> <text class="name">巡检位置</text>
<text class="text">{{ <text class="text">{{
list[activeIndex].position.map((item) => item.dictLabel).join("、") list[activeIndex].position.map((item) => item.dictLabel).join("、")
......
...@@ -31,6 +31,7 @@ import { ...@@ -31,6 +31,7 @@ import {
checkAndCreateDirectory, checkAndCreateDirectory,
createFileWithPlusIO, createFileWithPlusIO,
TEST, TEST,
TEST_2X
} from "@/utils/systemCofig"; } from "@/utils/systemCofig";
import { import {
...@@ -62,8 +63,7 @@ export default { ...@@ -62,8 +63,7 @@ export default {
mounted() { mounted() {
// let timeStr = getDateTime.dateTimeStr('y-m-d h-i-s') // let timeStr = getDateTime.dateTimeStr('y-m-d h-i-s')
// let fileName = "用户名" + timeStr + '.txt' // let fileName = "用户名" + timeStr + '.txt'
// console.log("---xxxxx", TEST) // const fileContent = this.setSm2(TEST_2X)
// const fileContent = this.setSm2(TEST)
// console.log("---加密内容", fileContent) // console.log("---加密内容", fileContent)
// createFileWithPlusIO(`${SYNCHRONIZE_DATA_PAD}/同步数据`, fileName,fileContent ).then(res => { // createFileWithPlusIO(`${SYNCHRONIZE_DATA_PAD}/同步数据`, fileName,fileContent ).then(res => {
// console.log("---写入成功", res) // console.log("---写入成功", res)
......
...@@ -196,8 +196,12 @@ export default { ...@@ -196,8 +196,12 @@ export default {
this.list = temp; this.list = temp;
console.log("---temp", temp); console.log("---temp", temp);
}, },
// 回显数据 // 回显数据
setForm() {}, setForm(componentData) {
console.log("-componentData---", componentData);
this.list = componentData.temp;
this.form.conclusion = componentData.conclusion
},
// 获取数据 // 获取数据
getForm() { getForm() {
const temp = this.list.map((item) => { const temp = this.list.map((item) => {
......
...@@ -107,28 +107,64 @@ export default { ...@@ -107,28 +107,64 @@ export default {
tempForm: { tempForm: {
// 对应每个tab下的数据 [示例 0: 数据] // 对应每个tab下的数据 [示例 0: 数据]
}, },
detailsInfo: {}, // 详情
}; };
}, },
onLoad() {}, onLoad(options) {
if (options.uid) {
this.getDetails(options.uid);
}
},
mounted() { mounted() {
this.baseInfo = this.$store.state.temp_data; // this.baseInfo = this.$store.state.temp_data;
this.init(); // console.log("---baseInfo-", this.baseInfo);
console.log("---baseInfo-", this.baseInfo); this.init().then(() => {
if (this.detailsInfo.inspectionType) {
this.tabList.forEach((item, index) => {
this.setComponentData(item.refName, this.tempForm[index]);
});
} else {
this.baseInfo = this.$store.state.temp_data;
}
this.tabList.forEach((item, index) => {
this.setComponentData(item.refName, this.tempForm[index]);
});
});
}, },
methods: { methods: {
init() { init() {
this.tabList = pad_2_1_inspection_position.rows.map((item, index) => { return new Promise((resolve, reject) => {
return { this.tabList = pad_2_1_inspection_position.rows.map((item, index) => {
name: item.dictLabel, return {
value: item.dictValue, name: item.dictLabel,
isVaild: false, // 校验通过 value: item.dictValue,
// type: 1, // 枚举值 isVaild: false, // 校验通过
position: pad_2_1_inspection_position.rows, // type: 1, // 枚举值
refName: `TabContentItem_${index}`, position: pad_2_1_inspection_position.rows,
}; refName: `TabContentItem_${index}`,
};
});
resolve();
}); });
}, },
// 回显数据
getDetails(uid) {
const all_data = this.$store.state.all_data || [];
const detailsInfo = all_data.filter((item) => item.uid == uid)[0] || {};
this.baseInfo = detailsInfo.originData.baseInfo;
this.tempForm = detailsInfo.originData.tempForm;
this.detailsInfo = detailsInfo;
},
// 回显组件数据
setComponentData(refName, componentData) {
console.log("--refs--");
console.log("--refName--", refName);
// this.$refs[refName][0].setForm(componentData);
},
//--弹出对话框 //--弹出对话框
dialogInputConfirm2() { dialogInputConfirm2() {
uni.redirectTo({ uni.redirectTo({
...@@ -222,6 +258,7 @@ export default { ...@@ -222,6 +258,7 @@ export default {
items: [], items: [],
synchronization: 0, // 是否导出过 synchronization: 0, // 是否导出过
submitTime: moment().format("yyyy-MM-DD"), // 记录提交时间 submitTime: moment().format("yyyy-MM-DD"), // 记录提交时间
originData: { originData: {
baseInfo: this.baseInfo, baseInfo: this.baseInfo,
tempForm: this.tempForm, tempForm: this.tempForm,
...@@ -235,14 +272,30 @@ export default { ...@@ -235,14 +272,30 @@ export default {
// tempItem.push(temp); // tempItem.push(temp);
// all_data[time] = tempItem; // all_data[time] = tempItem;
all_data.push(temp); // params.uid = new Date().getTime(); // 唯一标识 pad 端使用
// all_data.push(temp);
let logContent = "";
// 新增 or 编辑
if (params.uid) {
const index = all_data.findIndex(
(element) => element.uid == params.uid
);
all_data[index] = temp;
logContent = getLogContent(LOG_TYPE_ENUM.edit);
} else {
temp.uid = new Date().getTime(); // 唯一标识 pad 端使用
all_data.push(temp);
logContent = getLogContent(LOG_TYPE_ENUM.add);
}
// 更新巡检list // 更新巡检list
this.$store.commit("SET_ALL_DATA", all_data); this.$store.commit("SET_ALL_DATA", all_data);
writeInspectionData(all_data); writeInspectionData(all_data);
// 更新日志 // 更新日志
const logContent = getLogContent(LOG_TYPE_ENUM.add); // const logContent = getLogContent(LOG_TYPE_ENUM.add);
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);
...@@ -258,6 +311,7 @@ export default { ...@@ -258,6 +311,7 @@ export default {
// 清空基础缓存信息 // 清空基础缓存信息
this.$store.commit("SET_TEMP_DATA", {}); // 缓存[巡检信息] this.$store.commit("SET_TEMP_DATA", {}); // 缓存[巡检信息]
console.log("--提交--", params); console.log("--提交--", params);
} }
...@@ -266,6 +320,10 @@ export default { ...@@ -266,6 +320,10 @@ export default {
title: `${vaild ? "提交成功" : "请完善填写内容"}`, title: `${vaild ? "提交成功" : "请完善填写内容"}`,
}); });
if (!vaild) {
return;
}
uni.redirectTo({ uni.redirectTo({
url: "/pages/home/home?tabIndex=1", url: "/pages/home/home?tabIndex=1",
success() { success() {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</view> </view>
<view class="row-item bottom-row"> <view class="row-item bottom-row">
<button class="button" :loading="loading" @click="packedData"> <button class="button" :loading="loading" @click="clickHandle">
数据打包 数据打包
</button> </button>
</view> </view>
...@@ -46,44 +46,59 @@ import { ...@@ -46,44 +46,59 @@ import {
} from "@/utils/systemCofig"; } from "@/utils/systemCofig";
import getDateTime from "@/common/getdateTime.js"; import getDateTime from "@/common/getdateTime.js";
import { Base64 } from "js-base64"; import { Base64 } from "js-base64";
import { writeInspectionData } from "@/utils/IoReadingAndWriting.js";
export default { export default {
components: {}, components: {},
data() { data() {
return { return {
loading: false, loading: false,
all_data: [] all_data: [],
}; };
}, },
mounted() { mounted() {
// const all_data = this.$store.state.all_data; // const all_data = this.$store.state.all_data;
this.all_data = this.$store.state.all_data || []; this.all_data = this.$store.state.all_data || [];
}, },
methods: { methods: {
change(e) { change(e) {},
console.log("----", e);
},
close() { close() {
this.$emit("close"); this.$emit("close");
}, },
packedData() { clickHandle() {
this.loading = true;
const userName = this.$store.state.now_user.name; const userName = this.$store.state.now_user.name;
const all_data = this.$store.state.all_data; const all_data = this.all_data;
console.log("-同步数据--", all_data);
let timeStr = getDateTime.dateTimeStr("y-m-d h-i-s"); let timeStr = getDateTime.dateTimeStr("y-m-d h-i-s");
let fileName = `${userName}${timeStr}.txt`; let JFXJ_DATA_FILE_NAME = `${userName}_JFXJ_${timeStr}.txt`;
const fileContent = setSm2( Base64.encode(JSON.stringify(all_data))); let JDXJ_DATA_FILE_NAME = `${userName}_JDXJ_${timeStr}.txt`;
createFileWithPlusIO(
`${SYNCHRONIZE_DATA_PAD}/同步数据`,
fileName,
fileContent
)
.then((res) => {
console.log("---写入成功", res);
const JFXJ_DATA = all_data
.filter((item) => item.inspectionType == 1)
.map((item) => {
return {
...item,
originData: [],
};
}); // 机房数据类型是 1
const JDXJ_DATA = all_data.filter((item) => item.inspectionType == 2); // 井道数据类型是 2
this.loading = true;
Promise.all([
this.packedData(JFXJ_DATA, JFXJ_DATA_FILE_NAME),
this.packedData(JDXJ_DATA, JDXJ_DATA_FILE_NAME),
])
.then(() => {
const newAllData = all_data.map((item) => {
item.synchronization = 1;
return item;
});
this.$store.commit("SET_ALL_DATA", newAllData);
writeInspectionData(all_data);
setTimeout(() => { setTimeout(() => {
uni.showToast({ uni.showToast({
title: "打包成功", title: "打包成功",
...@@ -105,6 +120,15 @@ export default { ...@@ -105,6 +120,15 @@ export default {
}, 2 * 1000); }, 2 * 1000);
}); });
}, },
packedData(content, fileName) {
const fileContent = setSm2(content);
return createFileWithPlusIO(
`${SYNCHRONIZE_DATA_PAD}/发送数据`,
fileName,
fileContent
);
},
}, },
}; };
</script> </script>
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<InspectionItem <InspectionItem
v-for="ele in item.list" v-for="ele in item.list"
:key="ele.inspectionCode" :key="ele.inspectionCode"
:details="ele"
/> />
</view> </view>
</view> </view>
...@@ -66,6 +67,7 @@ export default { ...@@ -66,6 +67,7 @@ export default {
methods: { methods: {
init() { init() {
const all_data = this.$store.state.all_data || []; const all_data = this.$store.state.all_data || [];
console.log("---all_data-", all_data)
const tempAllData = {}; const tempAllData = {};
all_data.forEach((item) => { all_data.forEach((item) => {
const val = tempAllData[item.submitTime] || []; const val = tempAllData[item.submitTime] || [];
...@@ -81,8 +83,6 @@ export default { ...@@ -81,8 +83,6 @@ export default {
const { inspectionTime = [] } = this.searchForm; const { inspectionTime = [] } = this.searchForm;
const startTime = inspectionTime[0]; const startTime = inspectionTime[0];
const endTime = inspectionTime[1]; const endTime = inspectionTime[1];
console.log("--startTime-", startTime);
console.log("--endTime-", startTime);
// 第一步: 筛选有效的时间范围 // 第一步: 筛选有效的时间范围
const timeFrame = keys.filter((key) => { const timeFrame = keys.filter((key) => {
...@@ -96,7 +96,6 @@ export default { ...@@ -96,7 +96,6 @@ export default {
} }
}); });
console.log("--timeFrame-", timeFrame);
// 第二步: 根据搜索条件过滤 // 第二步: 根据搜索条件过滤
const list = timeFrame.map((key) => { const list = timeFrame.map((key) => {
...@@ -110,7 +109,8 @@ export default { ...@@ -110,7 +109,8 @@ export default {
// console.log("timeFramea", timeFrame); // console.log("timeFramea", timeFrame);
// console.log("this.all_data", all_data); // console.log("this.all_data", all_data);
// console.log("this.list", list); console.log("list 数据----", list);
this.countNum = 0;
list.forEach((item) => { list.forEach((item) => {
this.countNum += item.list.length; this.countNum += item.list.length;
}); });
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论