提交 7e671fff authored 作者: caodi\cd's avatar caodi\cd

fix:数据同步

上级 9b24d271
......@@ -56,7 +56,7 @@
toPage() {
const url =
this.details.inspectionType == 1 ?
`/pages/inspectionContent/inspectionContent?isDisable=${
`/pages/inspectionContent/inspectionContentList?isDisable=${
this.isDisable ? 1 : 0
}` :
`/pages/shaftInspection/shaftInspectionList?isDisable=${
......
......@@ -13,7 +13,7 @@
</block>
<block slot="right" class="nav-right">
<view class="header-buttons">
<button class="button" @click="lookLog">查看样表</button>
<!-- <button class="button" @click="lookLog">查看样表</button> -->
</view>
</block>
</uni-nav-bar>
......@@ -34,17 +34,23 @@
</view>
</view>
<view class="profile-right">
<button class="record-button" @click="toListingManagement">
<!-- <button class="record-button" @click="toListingManagement">
巡检人签字
</button>
</button> -->
</view>
</view>
</view>
<view class="box">
<view class="bar">
<view class="title"> 巡检进度 </view>
<view class="dai"> 待巡检 <text class="num">11</text>个机房</view>
<view class="yi"> 已完成 <text class="num">0</text>个机房</view>
<view class="dai">
待巡检 <text class="num">{{ 11 - inspectionNumber }}</text
>个机房</view
>
<view class="yi">
已完成 <text class="num">{{ inspectionNumber }}</text
>个机房</view
>
</view>
</view>
<view class="card-box">
......@@ -59,11 +65,7 @@
v-for="(card, cardIndex) in row"
:key="cardIndex"
@click="
toShaftInspection(
card.dictLabel,
card.jfType,
card.value
)
toShaftInspection(card.name, card.jfType, card.value)
"
>
<view class="card">
......@@ -76,7 +78,7 @@
<text class="status">{{ card.statusLable }}</text>
</view>
<view class="second-row">
<text class="location">{{ card.dictLabel }}</text>
<text class="location">{{ card.name }}</text>
</view>
</view>
<view class="spacer-image right" v-if="cardIndex < row.length - 1">
......@@ -128,7 +130,14 @@ export default {
init() {
return new Promise((resolve, reject) => {
let list = pad_all_inspection_position.rows.map((item, index) => {
return item;
return {
name: item.dictLabel,
value: item.dictValue,
jfType: item.jfType,
isVaild: false, // 校验通过
status:item.status,
statusLable:item.statusLable
};
});
const group1 = list.slice(0, 5);
const group2 = list.slice(5, 10);
......@@ -153,8 +162,39 @@ export default {
resolve();
});
},
// 回显数据
getDetails(uid) {
uni.showLoading();
getInspectionDetails(uid)
.then((res) => {
const detailsInfo = res;
console.log("detailsInfo", detailsInfo);
this.detailsInfo = detailsInfo;
this.inspectionNumber = detailsInfo.inspectionNumber;
this.inspectionCode = detailsInfo.inspectionCode;
this.cardsInfo = detailsInfo.originData;
const group1 = this.cardsInfo.slice(0, 5);
const group2 = this.cardsInfo.slice(5, 10);
const group3 = this.cardsInfo.slice(10);
this.rows = [group1, group2, group3];
console.log("this.cardsInfo", this.cardsInfo);
this.isDisable = this.isDisable || detailsInfo.synchronization == 1; // 是否禁用 1:已同步数据 0: 未同步数据
uni.hideLoading();
})
.catch((error) => {
uni.showToast({
title: error.msg,
icon: "none",
duration: 1000,
});
uni.hideLoading();
});
},
// 跳转到具体的机房
toShaftInspection(location,jfType,value) {
toShaftInspection(location, jfType, value) {
uni.navigateTo({
url: `/pages/inspectionContent/inspectionContentNew?value=${value}&inspectionCode=${this.inspectionCode}&jfType=${jfType}&location=${location}&uid=${this.uid}`,
});
......
......@@ -51,6 +51,7 @@
mode="aspectFit"
></image
></view>
<view class="kong"></view>
<!-- 操作区域 -->
<!-- 物理环境 -->
<wlhj
......@@ -194,6 +195,7 @@ export default {
detailsInfo: {}, // 详情
baseInfo: {}, // 基础信息
list: [], //巡检信息
itemDetail: {},
};
},
computed: {
......@@ -228,7 +230,9 @@ export default {
}
},
watch: {},
mounted() {},
mounted() {
this.itemDetail = this.getAllChildFormData();
},
methods: {
// 初始化
init() {
......@@ -332,17 +336,21 @@ export default {
return this.detailsInfo;
} else {
let baseInfo = this.baseInfo;
let paramsObj = this.getAllChildFormData();
let paramsObj = this.getAllChildFormData(); //获取所有数据
let dataObj = pad_all_inspection_position.rows.map((item, index) => {
return {
name: item.dictLabel,
value: item.dictValue,
jfType:item.jfType,
jfType: item.jfType,
isVaild: false, // 校验通过
details: this.itemDetail,
status:item.status,
statusLable:item.statusLable
};
});
let tabList = JSON.parse(JSON.stringify(dataObj));
let posItem = tabList[this.value - 1];
let posItem = tabList[this.value];
console.log("posItem", posItem);
posItem.details = paramsObj;
console.log("posItem", posItem);
if (!this.checkInspectionResult(paramsObj)) {
......@@ -358,7 +366,7 @@ export default {
inspectionNumber: 1,
isException: posItem.status == 2 ? 1 : 0,
items: [],
synchronization: typeSubmit > 0 ? 2 : 0, // 是否同步过
synchronization: 0, // 是否同步过
submitTime: moment().format("yyyy-MM-DD"), // 记录提交时间
submitMonth: moment().format("yyyy-MM"), // 记录提交月份
originData: tabList, //所有大楼和楼层的数据
......@@ -415,7 +423,7 @@ export default {
},
// 提交
submit(isSubmit = 1) {
let allValid = this.allValid(paramsObj);
let allValid = this.allValid(this.getAllChildFormData());
// 校验是否通过
if (isSubmit && !allValid) {
uni.showToast({
......@@ -497,9 +505,19 @@ export default {
console.log("所有子组件的数据:", allData);
return allData;
},
// 判断所有tab下的数据是否通过校验
allValid(arr) {
return arr.every((item) => item.isValid === true);
// 判断所有的数据是否通过校验
allValid(parentObj) {
// 遍历对象的所有属性
for (let key in parentObj) {
// 确保属性是对象自身的(而非继承的)
if (parentObj.hasOwnProperty(key)) {
// 检查 isValid 属性是否为 false
if (parentObj[key].isValid === false) {
return false; // 如果有一个为 false,直接返回 false
}
}
}
return true; // 如果全部为 true,返回 true
},
// 检查所有Tab 的必填项是否填写完整
isAllTabValid() {
......@@ -673,11 +691,16 @@ export default {
}
.jfImg {
width: 100%;
margin-bottom: 15px;
.weitu {
width: 100%;
height: 280px;
}
}
.kong {
width: 100%;
height: 10px;
}
.tab-item {
display: flex;
align-items: flex-start;
......
差异被折叠。
......@@ -54,7 +54,14 @@
</view>
<!-- 开始巡检 -->
<view class="inspection-button" @click="toPage">同步数据</view>
<!-- <view class="inspection-button" @click="toPage">开始巡检</view> -->
<view class="inspection-button" @click="openDialog(true)">同步数据</view
><!-- 打包弹窗 -->
<Dialog
v-show="isDialog && list.length"
:list="list"
@close="openDialog(false)"
></Dialog>
</view>
</template>
......@@ -62,6 +69,7 @@
import SearchCom from "@/components/searchCom/index.vue";
import InspectionItem from "@/components/inspectionItem/index.vue";
import { getDarft } from "@/request/index.js";
import Dialog from "./dialog.vue";
import { getAllInspections } from "@/request/index.js";
import Empty from "@/components/empty/index.vue";
......@@ -69,6 +77,7 @@ export default {
components: {
SearchCom,
InspectionItem,
Dialog,
Empty,
},
data() {
......@@ -116,16 +125,18 @@ export default {
clickInspection(type) {
if (type == 1) {
uni.navigateTo({
url: "/pages/shaftInspection/shaftInspectionNew",
url: "/pages/inspectionContent/inspectionContentList",
});
} else {
uni.navigateTo({
url: "/pages/shaftInspection/shaftInspectionNew",
url: "/pages/shaftInspection/shaftInspectionList",
});
}
},
init() {
const all_data = this.all_data || [];
// this.isPackedDataBtn =
// all_data.filter((item) => item.synchronization == 0).length > 0;
const { inspectionTime = [] } = this.searchForm;
const startTime = inspectionTime[0];
......@@ -174,7 +185,7 @@ export default {
},
coverData(arr = []) {
console.log("arr",arr)
console.log("arr", arr);
const {
isException = "",
inspectionType = "",
......@@ -195,6 +206,12 @@ export default {
);
});
},
openDialog(show) {
this.isDialog = show;
if (!show) {
this.init();
}
},
change(e) {
this.searchForm = e;
......@@ -244,21 +261,21 @@ export default {
</script>
<style scoped lang="less">
.uni-nav-bar-text {
height: 28.8px;
width: 28.8px;
background: #ffffff;
border: 0.32px solid rgba(224, 224, 224, 1);
border-radius: 14.4px;
color: #333;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
height: 28.8px;
width: 28.8px;
background: #ffffff;
border: 0.32px solid rgba(224, 224, 224, 1);
border-radius: 14.4px;
color: #333;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
.iconfont {
font-size: 16px;
line-height: 28.8px;
}
.iconfont {
font-size: 16px;
line-height: 28.8px;
}
}
.nav-right {
width: 192px;
......@@ -278,7 +295,7 @@ export default {
color: #000000;
line-height: 28.8px;
font-weight: 400;
border: 0;
border: 0;
}
}
.inspection-management {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论