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

fix:数据同步

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