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

fix(Pad): 井道数回显完成

上级 af224f81
...@@ -170,13 +170,24 @@ export default { ...@@ -170,13 +170,24 @@ export default {
onLoad(options) { onLoad(options) {
this.init(); this.init();
if (options.uid) { if (options.uid) {
// 获取详情
this.getDetails(options.uid); this.getDetails(options.uid);
} else if (options.isDarf) {
// 获取草稿数据
const darf_data = this.$store.state.darf_data;
this.baseInfo = darf_data.originData.baseInfo;
this.tempForm = darf_data.originData.tempForm;
console.log("获取草稿数据---", darf_data);
this.detailsInfo = darf_data;
} }
}, },
mounted() { mounted() {
if (this.detailsInfo.inspectionType) { if (this.detailsInfo.inspectionType) {
const fillCheck = this.detailsInfo.fillCheck.split(",")
this.tabList.forEach((item, index) => { this.tabList.forEach((item, index) => {
this.setComponentData(index, this.tempForm[index]); item.isVaild = fillCheck.includes(item.value)
this.tempForm[index] && this.setComponentData(index, this.tempForm[index]);
}); });
} else { } else {
this.baseInfo = this.$store.state.temp_data; this.baseInfo = this.$store.state.temp_data;
...@@ -285,7 +296,7 @@ export default { ...@@ -285,7 +296,7 @@ export default {
const tempForm = this.tempForm; const tempForm = this.tempForm;
const baseInfo = this.baseInfo; const baseInfo = this.baseInfo;
const fillCheck = tabList.map((item) => item.value).join(","); const fillCheck = tabList.filter(item => item.isVaild). map((item) => item.value).join(",");
let temp = { let temp = {
...baseInfo, ...baseInfo,
isSubmit: 1, isSubmit: 1,
...@@ -459,15 +470,11 @@ export default { ...@@ -459,15 +470,11 @@ export default {
}); });
// 写入草稿文件 更新 store 草稿内容 // 写入草稿文件 更新 store 草稿内容
this.$store.commit("SET_DARF_DATA", { const params = this.getParams();
...this.tempForm, this.$store.commit("SET_DARF_DATA", params);
...this.baseInfo, console.log("--写入草稿文件-", params);
}); // 缓存草稿
// 缓存[巡检信息] writeDarf(params).then((res) => {
writeDarf({
...this.tempForm,
...this.baseInfo,
}).then((res) => {
console.log("写入草稿文件成功"); console.log("写入草稿文件成功");
uni.showToast({ uni.showToast({
icon: "success", icon: "success",
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
class="row-item" class="row-item"
label="异常定位" label="异常定位"
name="measuredDataArr" name="measuredDataArr"
v-if="item.inspectionResult == 1"
> >
<view class="tags"> <view class="tags">
<view <view
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<!-- 异常状态时显示 --> <!-- 异常状态时显示 -->
<uni-forms-item <uni-forms-item
v-if="item.inspectionResult == 1"
required required
class="row-item" class="row-item"
label="情况摘要" label="情况摘要"
...@@ -251,13 +251,13 @@ export default { ...@@ -251,13 +251,13 @@ export default {
align-items: center; align-items: center;
.tag { .tag {
background: #f2f3f5; background: #f2f3f5;
width: 80px; width: 55px;
height: 36px; height: 36px;
border-radius: 10px; border-radius: 10px;
text-align: center; text-align: center;
line-height: 36px; line-height: 36px;
margin-right: 12px; margin-right: 10px;
font-size: 16px; font-size: 14px;
color: #4a4a4a; color: #4a4a4a;
text-align: center; text-align: center;
font-weight: 400; font-weight: 400;
......
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
<!-- 异常状态时显示 --> <!-- 异常状态时显示 -->
<uni-forms-item <uni-forms-item
v-if="item.inspectionResult == 1"
required required
class="row-item" class="row-item"
label="情况摘要" label="情况摘要"
...@@ -252,16 +254,16 @@ export default { ...@@ -252,16 +254,16 @@ export default {
align-items: center; align-items: center;
.tag { .tag {
background: #f2f3f5; background: #f2f3f5;
width: 80px; width: 55px;
height: 36px; height: 36px;
border-radius: 10px; border-radius: 10px;
text-align: center; text-align: center;
line-height: 36px; line-height: 36px;
margin-right: 12px; margin-right: 10px;
font-size: 16px; font-size: 14px;
color: #4a4a4a; color: #4a4a4a;
text-align: center; text-align: center;
font-weight: 400; font-weight: 400;
} }
.active-tag { .active-tag {
background: #3774f6; background: #3774f6;
......
...@@ -45,9 +45,21 @@ export default { ...@@ -45,9 +45,21 @@ export default {
}, },
toPage() { toPage() {
uni.navigateTo({ const darf_data = this.$store.state.darf_data || {};
url: "/pages/inspection/inspFirst", console.log("---读取的草稿数据", darf_data)
}); if (darf_data.inspectionType == 1) {
uni.navigateTo({
url: `/pages/inspectionContent/inspectionContent?isDarf=1`,
});
} else if (darf_data.inspectionType == 2) {
uni.navigateTo({
url: `/pages/shaftInspection/shaftInspection?isDarf=1`,
});
} else {
uni.navigateTo({
url: "/pages/inspection/inspFirst",
});
}
}, },
}, },
}; };
......
...@@ -194,13 +194,17 @@ export default { ...@@ -194,13 +194,17 @@ export default {
}); });
this.list = temp; this.list = temp;
console.log("---temp", temp); // console.log("---temp", temp);
}, },
// 回显数据 // 回显数据
setForm(componentData) { setForm(componentData) {
console.log("-componentData---", componentData); console.log("-componentData---", componentData);
this.list = componentData.temp; this.list = componentData.temp;
this.form.conclusion = componentData.conclusion if (componentData.conclusion) {
this.form = {
conclusion: componentData.conclusion,
};
}
}, },
// 获取数据 // 获取数据
getForm() { getForm() {
...@@ -220,6 +224,7 @@ export default { ...@@ -220,6 +224,7 @@ export default {
async vaildForm() { async vaildForm() {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
let result = ""; let result = "";
console.log("--vaildForm--", this.form);
this.$refs.forms this.$refs.forms
.validate() .validate()
.then((res) => { .then((res) => {
...@@ -253,6 +258,8 @@ export default { ...@@ -253,6 +258,8 @@ export default {
// vaild: this.list.length == allVaildList.length, // vaild: this.list.length == allVaildList.length,
// formData, // formData,
// }; // };
console.log("--result-", result);
console.log("--allVaildList-", allVaildList);
resolve({ resolve({
vaild: result && this.list.length == allVaildList.length, vaild: result && this.list.length == allVaildList.length,
...@@ -297,13 +304,13 @@ export default { ...@@ -297,13 +304,13 @@ export default {
align-items: center; align-items: center;
.tag { .tag {
background: #f2f3f5; background: #f2f3f5;
width: 80px; width: 55px;
height: 36px; height: 36px;
border-radius: 10px; border-radius: 10px;
text-align: center; text-align: center;
line-height: 36px; line-height: 36px;
margin-right: 12px; margin-right: 10px;
font-size: 16px; font-size: 14px;
color: #4a4a4a; color: #4a4a4a;
text-align: center; text-align: center;
font-weight: 400; font-weight: 400;
......
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
</view> </view>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
options: { options: {
...@@ -46,19 +44,16 @@ export default { ...@@ -46,19 +44,16 @@ export default {
list: [], list: [],
}; };
}, },
created() { created() {},
},
mounted() { mounted() {
this.list = this.options this.list = this.options;
}, },
watch: { watch: {
options(newData) { options(newData) {
this.list = newData this.list = newData;
},
}
}, },
methods: { methods: {
tabClick(index, item) { tabClick(index, item) {
this.activeIndex = index; this.activeIndex = index;
......
...@@ -49,11 +49,11 @@ ...@@ -49,11 +49,11 @@
<Tabs class="tabs" ref="tabs" :options="tabList" @change="changeTab" /> <Tabs class="tabs" ref="tabs" :options="tabList" @change="changeTab" />
<TabContentItem <TabContentItem
v-for="(item, index) in tabList.length" v-for="(item, index) in tabList"
:key="index" :key="index"
:ref="item.refName"
v-show="activeTabIndex == index" v-show="activeTabIndex == index"
:ref="`TabContentItem_${index}`" ></TabContentItem>
/>
</view> </view>
<view class="fixed-btns"> <view class="fixed-btns">
...@@ -113,23 +113,31 @@ export default { ...@@ -113,23 +113,31 @@ export default {
onLoad(options) { onLoad(options) {
if (options.uid) { if (options.uid) {
this.getDetails(options.uid); this.getDetails(options.uid);
} else if (options.isDarf) {
// 获取草稿数据
const darf_data = this.$store.state.darf_data;
this.baseInfo = darf_data.originData.baseInfo;
this.tempForm = darf_data.originData.tempForm;
console.log("获取草稿数据---", darf_data);
this.detailsInfo = darf_data;
} }
}, },
mounted() { mounted() {
// this.baseInfo = this.$store.state.temp_data;
// console.log("---baseInfo-", this.baseInfo);
this.init().then(() => { this.init().then(() => {
if (this.detailsInfo.inspectionType) { if (this.detailsInfo.inspectionType) {
this.tabList.forEach((item, index) => { const fillCheck = this.detailsInfo.fillCheck.split(",");
this.setComponentData(item.refName, this.tempForm[index]);
}); setTimeout(() => {
this.tabList.forEach((item, index) => {
item.isVaild = fillCheck.includes(item.value);
this.tempForm[index] &&
this.setComponentData(item.refName, this.tempForm[index]);
});
}, 500);
} else { } else {
this.baseInfo = this.$store.state.temp_data; this.baseInfo = this.$store.state.temp_data;
} }
this.tabList.forEach((item, index) => {
this.setComponentData(item.refName, this.tempForm[index]);
});
}); });
}, },
...@@ -146,7 +154,6 @@ export default { ...@@ -146,7 +154,6 @@ export default {
refName: `TabContentItem_${index}`, refName: `TabContentItem_${index}`,
}; };
}); });
resolve(); resolve();
}); });
}, },
...@@ -154,16 +161,14 @@ export default { ...@@ -154,16 +161,14 @@ export default {
getDetails(uid) { getDetails(uid) {
const all_data = this.$store.state.all_data || []; const all_data = this.$store.state.all_data || [];
const detailsInfo = all_data.filter((item) => item.uid == uid)[0] || {}; const detailsInfo = all_data.filter((item) => item.uid == uid)[0] || {};
console.log("--detailsInfo-", detailsInfo);
this.baseInfo = detailsInfo.originData.baseInfo; this.baseInfo = detailsInfo.originData.baseInfo;
this.tempForm = detailsInfo.originData.tempForm; this.tempForm = detailsInfo.originData.tempForm;
this.detailsInfo = detailsInfo; this.detailsInfo = detailsInfo;
}, },
// 回显组件数据 // 回显组件数据
setComponentData(refName, componentData) { setComponentData(refName, componentData) {
console.log("--refs--"); this.$refs[refName][0].setForm(componentData);
console.log("--refName--", refName);
// this.$refs[refName][0].setForm(componentData);
}, },
//--弹出对话框 //--弹出对话框
dialogInputConfirm2() { dialogInputConfirm2() {
...@@ -188,7 +193,6 @@ export default { ...@@ -188,7 +193,6 @@ export default {
// tab选中change 时间 // tab选中change 时间
changeTab(index, item) { changeTab(index, item) {
console.log("-index--", index);
this.draft(this.activeTabIndex, false, false).then(() => { this.draft(this.activeTabIndex, false, false).then(() => {
this.activeTabIndex = index; this.activeTabIndex = index;
}); });
...@@ -207,7 +211,7 @@ export default { ...@@ -207,7 +211,7 @@ export default {
getParams() { getParams() {
const baseInfo = this.baseInfo; const baseInfo = this.baseInfo;
const tempForm = this.tempForm; const tempForm = this.tempForm;
const fillCheck = this.tabList.map((item) => item.value).join(","); const fillCheck = this.tabList.filter(item => item.isVaild).map((item) => item.value).join(",");
const temp = this.tabList.map((item, index) => { const temp = this.tabList.map((item, index) => {
const items = tempForm[index].temp.map((ele) => { const items = tempForm[index].temp.map((ele) => {
...@@ -217,6 +221,7 @@ export default { ...@@ -217,6 +221,7 @@ export default {
inspectionResult: ele.inspectionResult, inspectionResult: ele.inspectionResult,
}; };
}); });
// 一个tab栏下的数据,是否有异常
const isException = tempForm[index].temp.filter( const isException = tempForm[index].temp.filter(
(item) => item.inspectionResult > 0 (item) => item.inspectionResult > 0
).length ).length
...@@ -234,7 +239,20 @@ export default { ...@@ -234,7 +239,20 @@ export default {
}; };
}); });
return temp; const item = {
...temp[0],
isException: temp.filter((item) => item.isException > 0).length ? 1 : 0, // 总的数据
items: [],
synchronization: 0, // 是否导出过
submitTime: moment().format("yyyy-MM-DD"), // 记录提交时间
originData: {
baseInfo,
tempForm,
},
};
item[baseInfo.inspectionCode] = temp;
console.log("----item--", item);
return item;
}, },
// 提交按钮 // 提交按钮
...@@ -253,19 +271,19 @@ export default { ...@@ -253,19 +271,19 @@ 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;
const temp = { // const temp = {
...params[0], // ...params[0],
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,
}, // },
}; // };
temp[this.baseInfo.inspectionCode] = params; // temp[this.baseInfo.inspectionCode] = params;
// const tempItem = all_data[time] || []; // const tempItem = all_data[time] || [];
...@@ -282,11 +300,11 @@ export default { ...@@ -282,11 +300,11 @@ export default {
const index = all_data.findIndex( const index = all_data.findIndex(
(element) => element.uid == params.uid (element) => element.uid == params.uid
); );
all_data[index] = temp; all_data[index] = params;
logContent = getLogContent(LOG_TYPE_ENUM.edit); logContent = getLogContent(LOG_TYPE_ENUM.edit);
} else { } else {
temp.uid = new Date().getTime(); // 唯一标识 pad 端使用 params.uid = new Date().getTime(); // 唯一标识 pad 端使用
all_data.push(temp); all_data.push(params);
logContent = getLogContent(LOG_TYPE_ENUM.add); logContent = getLogContent(LOG_TYPE_ENUM.add);
} }
...@@ -338,18 +356,18 @@ export default { ...@@ -338,18 +356,18 @@ export default {
let refName = this.tabList[activeTabIndex].refName; let refName = this.tabList[activeTabIndex].refName;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.$refs[refName][0].vaildForm().then(({ vaild, formData }) => { this.$refs[refName][0].vaildForm().then(({ vaild, formData }) => {
console.log("---校验---", vaild);
this.$refs.tabs this.$refs.tabs
.setTabVaild(activeTabIndex, vaild, iSwtich) .setTabVaild(activeTabIndex, vaild, iSwtich)
.then(() => { .then(() => {
this.tempForm[activeTabIndex] = formData; this.tempForm[activeTabIndex] = formData;
console.log("--xxxx--", {
...this.tempForm, console.log("---isSave---", isSave);
...this.baseInfo, const params = this.getParams();
}); console.log("--保存草稿--", params);
if (isSave) { if (isSave) {
// 更新store 和 [草稿文件] 日志数据 // 更新store 和 [草稿文件] 日志数据
console.log("--保存草稿--");
// // 新增日志信息 // // 新增日志信息
const logContent = getLogContent(LOG_TYPE_ENUM.darf); const logContent = getLogContent(LOG_TYPE_ENUM.darf);
...@@ -361,14 +379,11 @@ export default { ...@@ -361,14 +379,11 @@ export default {
}); });
// 写入草稿文件 更新 store 草稿内容 // 写入草稿文件 更新 store 草稿内容
this.$store.commit("SET_DARF_DATA", { const params = this.getParams();
...this.tempForm, console.log("--保存草稿--", params);
...this.baseInfo,
}); // 缓存[巡检信息] this.$store.commit("SET_DARF_DATA", params); // 缓存[巡检信息]
writeDarf({ writeDarf(params).then((res) => {
...this.tempForm,
...this.baseInfo,
}).then((res) => {
console.log("写入草稿文件成功"); console.log("写入草稿文件成功");
uni.showToast({ uni.showToast({
icon: "success", icon: "success",
......
...@@ -128,7 +128,7 @@ export const readDarfData = () => { ...@@ -128,7 +128,7 @@ export const readDarfData = () => {
resolve({}); resolve({});
} else { } else {
console.log("读取草稿文件--", JSON.parse(Base64.decode(res))); console.log("读取草稿文件--", JSON.parse(Base64.decode(res)));
resolve(JSON.parse(Base64.decode(element))); resolve(JSON.parse(Base64.decode(res)));
} }
}) })
.catch((error) => { .catch((error) => {
......
...@@ -1055,7 +1055,8 @@ export const pad_2_1_inspection_position = { ...@@ -1055,7 +1055,8 @@ export const pad_2_1_inspection_position = {
// 井道巡检_楼层 // 井道巡检_楼层
export const pad_2_1_floor = { export const pad_2_1_floor = {
"total": 13, "msg": "操作成功",
"code": 200,
"rows": [ "rows": [
{ {
"createBy": "admin", "createBy": "admin",
...@@ -1226,13 +1227,60 @@ export const pad_2_1_floor = { ...@@ -1226,13 +1227,60 @@ export const pad_2_1_floor = {
"isDefault": "N", "isDefault": "N",
"status": "0", "status": "0",
"default": false "default": false
},
{
"createBy": "admin",
"createTime": "2024-09-05 16:01:31",
"updateBy": null,
"updateTime": null,
"remark": null,
"dictCode": 1329,
"dictSort": 11,
"dictLabel": "22楼",
"dictValue": "11",
"dictType": "pad_2_1_floor",
"cssClass": null,
"listClass": "default",
"isDefault": "N",
"status": "0",
"default": false
},
{
"createBy": "admin",
"createTime": "2024-09-05 16:01:37",
"updateBy": null,
"updateTime": null,
"remark": null,
"dictCode": 1330,
"dictSort": 12,
"dictLabel": "24楼",
"dictValue": "12",
"dictType": "pad_2_1_floor",
"cssClass": null,
"listClass": "default",
"isDefault": "N",
"status": "0",
"default": false
},
{
"createBy": "admin",
"createTime": "2024-09-05 16:01:46",
"updateBy": null,
"updateTime": null,
"remark": null,
"dictCode": 1331,
"dictSort": 13,
"dictLabel": "26楼",
"dictValue": "13",
"dictType": "pad_2_1_floor",
"cssClass": null,
"listClass": "default",
"isDefault": "N",
"status": "0",
"default": false
} }
], ]
"code": 200, }
"msg": "查询成功",
"status": null,
"map": null
};
// 机房巡检类型 // 机房巡检类型
export const pad_room_type ={ export const pad_room_type ={
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论