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

fix(pad): 巡检功能回归完成,功能走查优化待完成

上级 b27cc90d
{ {
"name": "computedRoomPad",
"lockfileVersion": 3,
"requires": true, "requires": true,
"lockfileVersion": 1, "packages": {
"dependencies": { "": {
"js-base64": { "dependencies": {
"js-base64": "^3.7.5",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"sm-crypto": "^0.3.12"
},
"devDependencies": {
"js-md5": "^0.7.3"
}
},
"node_modules/js-base64": {
"version": "3.7.5", "version": "3.7.5",
"resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.5.tgz", "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.5.tgz",
"integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==" "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA=="
}, },
"js-md5": { "node_modules/js-md5": {
"version": "0.7.3", "version": "0.7.3",
"resolved": "https://registry.npmmirror.com/js-md5/-/js-md5-0.7.3.tgz", "resolved": "https://registry.npmmirror.com/js-md5/-/js-md5-0.7.3.tgz",
"integrity": "sha512-ZC41vPSTLKGwIRjqDh8DfXoCrdQIyBgspJVPXHBGu4nZlAEvG3nf+jO9avM9RmLiGakg7vz974ms99nEV0tmTQ==", "integrity": "sha512-ZC41vPSTLKGwIRjqDh8DfXoCrdQIyBgspJVPXHBGu4nZlAEvG3nf+jO9avM9RmLiGakg7vz974ms99nEV0tmTQ==",
"dev": true "dev": true
}, },
"jsbn": { "node_modules/jsbn": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/jsbn/-/jsbn-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/jsbn/-/jsbn-1.1.0.tgz",
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==" "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A=="
}, },
"lodash": { "node_modules/lodash": {
"version": "4.17.21", "version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
}, },
"moment": { "node_modules/moment": {
"version": "2.30.1", "version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==" "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
"engines": {
"node": "*"
}
}, },
"sm-crypto": { "node_modules/sm-crypto": {
"version": "0.3.12", "version": "0.3.12",
"resolved": "https://registry.npmmirror.com/sm-crypto/-/sm-crypto-0.3.12.tgz", "resolved": "https://registry.npmmirror.com/sm-crypto/-/sm-crypto-0.3.12.tgz",
"integrity": "sha512-272PBzB4PYaBdeGa41TH9ZlMGLPVRmS36Gs4FjmHwXIdihQypAbhhFWZTaa/3de69q2KfMme1M5O2W5+spAdrg==", "integrity": "sha512-272PBzB4PYaBdeGa41TH9ZlMGLPVRmS36Gs4FjmHwXIdihQypAbhhFWZTaa/3de69q2KfMme1M5O2W5+spAdrg==",
"requires": { "dependencies": {
"jsbn": "^1.1.0" "jsbn": "^1.1.0"
} }
} }
......
...@@ -54,35 +54,39 @@ ...@@ -54,35 +54,39 @@
<!-- tabls --> <!-- tabls -->
<Tabs class="tabs" ref="tabs" :options="tabList" @change="changeTab" /> <Tabs class="tabs" ref="tabs" :options="tabList" @change="changeTab" />
<GatherDataCenter v-show="activeTabIndex == 0" <GatherDataCenter
:isDisable="isDisable" v-show="activeTabIndex == 0"
ref="GatherDataCenter" /> :isDisable="isDisable"
ref="GatherDataCenter"
/>
<ShieldedComputerRoom <ShieldedComputerRoom
ref="ShieldedComputerRoom" ref="ShieldedComputerRoom"
v-show="activeTabIndex == 1" v-show="activeTabIndex == 1"
/> />
<BatteryRoom ref="BatteryRoom" <BatteryRoom
:isDisable="isDisable" ref="BatteryRoom"
v-show="activeTabIndex == 2" /> :isDisable="isDisable"
v-show="activeTabIndex == 2"
/>
<ComputerRoomDuty <ComputerRoomDuty
ref="ComputerRoomDuty" ref="ComputerRoomDuty"
:isDisable="isDisable" :isDisable="isDisable"
v-show="activeTabIndex == 3" v-show="activeTabIndex == 3"
></ComputerRoomDuty> ></ComputerRoomDuty>
<DutyHandover <DutyHandover
ref="DutyHandover" ref="DutyHandover"
:isDisable="isDisable" :isDisable="isDisable"
v-show="activeTabIndex == 4" v-show="activeTabIndex == 4"
></DutyHandover> ></DutyHandover>
</view> </view>
<view v-if="!isDisable" class="fixed-btns"> <view v-if="!isDisable" class="fixed-btns">
<view class="button-group"> <view class="button-group">
<!-- isSubmit 标识: 0 是草稿态; 1 是正式提交 -->
<view <view
v-if="!detailsInfo.isSubmit || detailsInfo.isSubmit == 0"
class="btn-draft btn-class" class="btn-draft btn-class"
@tap="draft(activeTabIndex)" @tap="draft(activeTabIndex)"
> >
...@@ -193,7 +197,6 @@ export default { ...@@ -193,7 +197,6 @@ export default {
this.tempForm = darf_data.originData.tempForm; this.tempForm = darf_data.originData.tempForm;
console.log("获取草稿数据---", darf_data); console.log("获取草稿数据---", darf_data);
this.detailsInfo = darf_data; this.detailsInfo = darf_data;
} }
}, },
mounted() { mounted() {
...@@ -205,13 +208,9 @@ export default { ...@@ -205,13 +208,9 @@ export default {
this.tempForm[index] && this.tempForm[index] &&
this.setComponentData(index, 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;
} }
}, },
methods: { methods: {
...@@ -229,7 +228,7 @@ export default { ...@@ -229,7 +228,7 @@ export default {
this.tempForm = detailsInfo.originData.tempForm; this.tempForm = detailsInfo.originData.tempForm;
this.detailsInfo = detailsInfo; this.detailsInfo = detailsInfo;
this.isDisable = (detailsInfo.synchronization == 1) this.isDisable = detailsInfo.synchronization == 1;
}, },
// 回显组件数据 // 回显组件数据
setComponentData(activeTabIndex, componentData) { setComponentData(activeTabIndex, componentData) {
...@@ -269,6 +268,12 @@ export default { ...@@ -269,6 +268,12 @@ export default {
this.$store.commit("SET_ALL_DATA", tempAllData); this.$store.commit("SET_ALL_DATA", tempAllData);
writeInspectionData(tempAllData); writeInspectionData(tempAllData);
// 清空草稿数据
this.$store.commit("SET_DARF_DATA", {}); // 缓存[巡检信息]
writeDarf("").then((res) => {
console.log("写入草稿文件成功");
});
// 更新日志 // 更新日志
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
const logContent = getLogContent( const logContent = getLogContent(
...@@ -328,7 +333,7 @@ export default { ...@@ -328,7 +333,7 @@ export default {
.join(","); .join(",");
let temp = { let temp = {
...baseInfo, ...baseInfo,
isSubmit: 1, isSubmit: 0,
fillCheck, fillCheck,
isException: "", isException: "",
roomWatch: "", roomWatch: "",
...@@ -340,7 +345,6 @@ export default { ...@@ -340,7 +345,6 @@ export default {
tabList.forEach((element, index) => { tabList.forEach((element, index) => {
if (Array.isArray(tempForm[index])) { if (Array.isArray(tempForm[index])) {
console.log("---ARRAY", tempForm[index]);
tempItems.push(...tempForm[index]); tempItems.push(...tempForm[index]);
} else { } else {
temp = { temp = {
...@@ -383,6 +387,7 @@ export default { ...@@ -383,6 +387,7 @@ export default {
submit() { submit() {
this.draft(this.activeTabIndex, false, false).then(() => { this.draft(this.activeTabIndex, false, false).then(() => {
const vaild = this.$refs.tabs.isAllVails(); const vaild = this.$refs.tabs.isAllVails();
const uid = this.detailsInfo.uid;
if (vaild) { if (vaild) {
/** /**
...@@ -394,13 +399,14 @@ export default { ...@@ -394,13 +399,14 @@ 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;
params.isSubmit = 1;
let logContent = ""; let logContent = "";
// 新增 or 编辑 // 新增 or 编辑
if (params.uid) { if (uid) {
const index = all_data.findIndex( const index = all_data.findIndex((element) => element.uid == uid);
(element) => element.uid == params.uid params.uid = uid;
);
all_data[index] = params; all_data[index] = params;
logContent = getLogContent( logContent = getLogContent(
LOG_TYPE_ENUM.edit, LOG_TYPE_ENUM.edit,
...@@ -417,9 +423,6 @@ export default { ...@@ -417,9 +423,6 @@ export default {
); );
} }
// console.log("--params--",all_data, params)
// return
// 更新巡检list // 更新巡检list
this.$store.commit("SET_ALL_DATA", all_data); this.$store.commit("SET_ALL_DATA", all_data);
writeInspectionData(all_data); writeInspectionData(all_data);
...@@ -498,6 +501,7 @@ export default { ...@@ -498,6 +501,7 @@ export default {
// 写入草稿文件 更新 store 草稿内容 // 写入草稿文件 更新 store 草稿内容
const params = this.getParams(); const params = this.getParams();
params.isSubmit = 0;
this.$store.commit("SET_DARF_DATA", params); this.$store.commit("SET_DARF_DATA", params);
console.log("--写入草稿文件-", params); console.log("--写入草稿文件-", params);
// 缓存草稿 // 缓存草稿
...@@ -592,7 +596,7 @@ export default { ...@@ -592,7 +596,7 @@ export default {
margin-bottom: 16px; margin-bottom: 16px;
padding-top: 80px; padding-top: 80px;
position: relative; position: relative;
.bg-img{ .bg-img {
right: 0; right: 0;
bottom: 0; bottom: 0;
position: absolute; position: absolute;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<view <view
v-for="(ele, eleIndex) in item.resultArr" v-for="(ele, eleIndex) in item.resultArr"
class="tag" class="tag"
:key="eleIndex"
@click="tagClick(parentIndex, eleIndex, ele.isActive)" @click="tagClick(parentIndex, eleIndex, ele.isActive)"
:class="ele.isActive ? 'active-tag' : ''" :class="ele.isActive ? 'active-tag' : ''"
>{{ ele.label }} >{{ ele.label }}
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<view <view
v-for="(ele, eleIndex) in item.resultArr" v-for="(ele, eleIndex) in item.resultArr"
class="tag" class="tag"
:key="eleIndex"
@click="tagClick(parentIndex, eleIndex, ele.isActive)" @click="tagClick(parentIndex, eleIndex, ele.isActive)"
:class="ele.isActive ? 'active-tag' : ''" :class="ele.isActive ? 'active-tag' : ''"
>{{ ele.label }} >{{ ele.label }}
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
<view <view
v-for="(ele, eleIndex) in item.postionList" v-for="(ele, eleIndex) in item.postionList"
class="tag" class="tag"
:key="eleIndex"
@click="postionChange(parentIndex, eleIndex, ele.isActive)" @click="postionChange(parentIndex, eleIndex, ele.isActive)"
:class=" :class="
item.measuredDataArr.includes(ele.dictValue) ? 'active-tag' : '' item.measuredDataArr.includes(ele.dictValue) ? 'active-tag' : ''
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<view <view
v-for="(ele, eleIndex) in item.resultArr" v-for="(ele, eleIndex) in item.resultArr"
class="tag" class="tag"
:key="eleIndex"
@click="tagClick(parentIndex, eleIndex, ele.isActive)" @click="tagClick(parentIndex, eleIndex, ele.isActive)"
:class="ele.isActive ? 'active-tag' : ''" :class="ele.isActive ? 'active-tag' : ''"
>{{ ele.label }} >{{ ele.label }}
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<view <view
v-for="(ele, eleIndex) in item.resultArr" v-for="(ele, eleIndex) in item.resultArr"
class="tag" class="tag"
:key="eleIndex"
@click="tagClick(parentIndex, eleIndex, ele.isActive)" @click="tagClick(parentIndex, eleIndex, ele.isActive)"
:class="ele.isActive ? 'active-tag' : ''" :class="ele.isActive ? 'active-tag' : ''"
>{{ ele.label }} >{{ ele.label }}
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
<view <view
v-for="(ele, eleIndex) in item.postionList" v-for="(ele, eleIndex) in item.postionList"
class="tag" class="tag"
:key="eleIndex"
@click="postionChange(parentIndex, eleIndex, ele.isActive)" @click="postionChange(parentIndex, eleIndex, ele.isActive)"
:class=" :class="
item.measuredDataArr.includes(ele.dictValue) ? 'active-tag' : '' item.measuredDataArr.includes(ele.dictValue) ? 'active-tag' : ''
...@@ -62,6 +64,7 @@ ...@@ -62,6 +64,7 @@
<textarea <textarea
class="textarea" class="textarea"
v-model="form.conclusion" v-model="form.conclusion"
:disabled="isDisable"
placeholder-style="color:#C7C7C7" placeholder-style="color:#C7C7C7"
placeholder="请输入" placeholder="请输入"
/> />
...@@ -80,7 +83,11 @@ import { ...@@ -80,7 +83,11 @@ import {
* 汇集机房 * 汇集机房
*/ */
export default { export default {
props: {}, props: {
isDisable: {
type: Boolean,
},
},
data() { data() {
return { return {
list: [], list: [],
...@@ -113,7 +120,7 @@ export default { ...@@ -113,7 +120,7 @@ export default {
}, },
}, },
roomTypeLabel: "汇聚机房巡检", // 用于获取类型值 // roomTypeLabel: "汇聚机房巡检", // 用于获取类型值
}; };
}, },
mounted() { mounted() {
...@@ -122,7 +129,7 @@ export default { ...@@ -122,7 +129,7 @@ export default {
methods: { methods: {
// tag 点击事件 // tag 点击事件
tagClick(parentIndex, eleIndex, isActive) { tagClick(parentIndex, eleIndex, isActive) {
if (isActive) { if (isActive || this.isDisable) {
return; return;
} }
this.list[parentIndex].resultArr.forEach((element) => { this.list[parentIndex].resultArr.forEach((element) => {
...@@ -143,6 +150,9 @@ export default { ...@@ -143,6 +150,9 @@ export default {
}, },
// tag 点击事件 // tag 点击事件
postionChange(parentIndex, eleIndex, isActive) { postionChange(parentIndex, eleIndex, isActive) {
if (this.isDisable) {
return;
}
const postionList = this.list[parentIndex].postionList; const postionList = this.list[parentIndex].postionList;
const item = postionList[eleIndex]; const item = postionList[eleIndex];
item.isActive = !isActive; item.isActive = !isActive;
...@@ -156,10 +166,10 @@ export default { ...@@ -156,10 +166,10 @@ export default {
// 数据结构重组 // 数据结构重组
coverlist() { coverlist() {
const roomTypeLabel = this.roomTypeLabel; // const roomTypeLabel = this.roomTypeLabel;
const roomType = pad_room_type.rows.filter( // const roomType = pad_room_type.rows.filter(
(item) => item.dictLabel == roomTypeLabel // (item) => item.dictLabel == roomTypeLabel
)[0].dictValue; // )[0].dictValue;
const temp = pad_2_1_inspection_items.rows.map((item) => { const temp = pad_2_1_inspection_items.rows.map((item) => {
return { return {
...@@ -167,9 +177,9 @@ export default { ...@@ -167,9 +177,9 @@ export default {
dictLabel: item.dictLabel, dictLabel: item.dictLabel,
dictValue: item.dictValue, dictValue: item.dictValue,
notes: "", // 情况摘要 notes: "", // 情况摘要
// roomType,
inspectionResult: 0, // 异常结论 inspectionResult: 0, // 异常结论
itemCode: item.dictValue, // 检查项 如:门禁 itemCode: item.dictValue, // 检查项 如:门禁
roomType, // 机房类型
resultArr: [ resultArr: [
{ {
value: 0, value: 0,
...@@ -224,7 +234,6 @@ export default { ...@@ -224,7 +234,6 @@ 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) => {
...@@ -254,13 +263,6 @@ export default { ...@@ -254,13 +263,6 @@ export default {
Promise.all(temp).then((res) => { 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 {
// vaild: this.list.length == allVaildList.length,
// 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,
formData, formData,
......
...@@ -59,12 +59,18 @@ ...@@ -59,12 +59,18 @@
:key="index" :key="index"
:ref="item.refName" :ref="item.refName"
v-show="activeTabIndex == index" v-show="activeTabIndex == index"
:isDisable="isDisable"
></TabContentItem> ></TabContentItem>
</view> </view>
<view class="fixed-btns"> <view v-if="!isDisable" class="fixed-btns">
<view class="button-group"> <view class="button-group">
<view class="btn-draft btn-class" @tap="draft(activeTabIndex)"> <!-- 保存草稿 0:草稿 1:提交 -->
<view
v-if="!detailsInfo.isSubmit || detailsInfo.isSubmit == 0"
class="btn-draft btn-class"
@tap="draft(activeTabIndex)"
>
保存草稿 保存草稿
</view> </view>
<view class="btn-class" @tap="submit"> 提交 </view> <view class="btn-class" @tap="submit"> 提交 </view>
...@@ -114,6 +120,7 @@ export default { ...@@ -114,6 +120,7 @@ export default {
// 对应每个tab下的数据 [示例 0: 数据] // 对应每个tab下的数据 [示例 0: 数据]
}, },
detailsInfo: {}, // 详情 detailsInfo: {}, // 详情
isDisable: false, // 禁用
}; };
}, },
onLoad(options) { onLoad(options) {
...@@ -143,7 +150,6 @@ export default { ...@@ -143,7 +150,6 @@ export default {
} else { } else {
this.baseInfo = this.$store.state.temp_data; this.baseInfo = this.$store.state.temp_data;
} }
}); });
}, },
...@@ -171,6 +177,8 @@ export default { ...@@ -171,6 +177,8 @@ export default {
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;
this.isDisable = detailsInfo.synchronization == 1;
}, },
// 回显组件数据 // 回显组件数据
setComponentData(refName, componentData) { setComponentData(refName, componentData) {
...@@ -217,18 +225,22 @@ export default { ...@@ -217,18 +225,22 @@ export default {
getParams() { getParams() {
const baseInfo = this.baseInfo; const baseInfo = this.baseInfo;
const tempForm = this.tempForm; const tempForm = this.tempForm;
const fillCheck = this.tabList.filter(item => item.isVaild).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) => {
return { return {
itemCode: ele.itemCode, itemCode: ele.itemCode,
measuredData: ele.measuredData, measuredData: ele.measuredData,
inspectionResult: ele.inspectionResult, inspectionResult: ele.inspectionResult,
}; };
}); });
// 一个tab栏下的数据,是否有异常 // 一个tab栏下的数据,是否有异常
const isException = tempForm[index].temp.filter( const isException = ((tempForm[index] || {}).temp || []).filter(
(item) => item.inspectionResult > 0 (item) => item.inspectionResult > 0
).length ).length
? 1 ? 1
...@@ -237,7 +249,7 @@ export default { ...@@ -237,7 +249,7 @@ export default {
return { return {
...baseInfo, ...baseInfo,
isSubmit: 1, isSubmit: 1,
conclusion: tempForm[index].conclusion, conclusion: (tempForm[index] || {}).conclusion || "",
fillCheck, fillCheck,
position: item.value, position: item.value,
isException, isException,
...@@ -247,6 +259,8 @@ export default { ...@@ -247,6 +259,8 @@ export default {
const item = { const item = {
...temp[0], ...temp[0],
isSubmit: 0,
isException: temp.filter((item) => item.isException > 0).length ? 1 : 0, // 总的数据 isException: temp.filter((item) => item.isException > 0).length ? 1 : 0, // 总的数据
items: [], items: [],
synchronization: 0, // 是否导出过 synchronization: 0, // 是否导出过
...@@ -257,7 +271,6 @@ export default { ...@@ -257,7 +271,6 @@ export default {
}, },
}; };
item[baseInfo.inspectionCode] = temp; item[baseInfo.inspectionCode] = temp;
console.log("----item--", item);
return item; return item;
}, },
...@@ -276,42 +289,29 @@ export default { ...@@ -276,42 +289,29 @@ 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 uid = this.detailsInfo.uid;
// const temp = { params.isSubmit = 1;
// ...params[0],
// items: [],
// synchronization: 0, // 是否导出过
// submitTime: moment().format("yyyy-MM-DD"), // 记录提交时间
// originData: {
// baseInfo: this.baseInfo,
// tempForm: this.tempForm,
// },
// };
// temp[this.baseInfo.inspectionCode] = params;
// const tempItem = all_data[time] || [];
// tempItem.push(temp);
// all_data[time] = tempItem;
// params.uid = new Date().getTime(); // 唯一标识 pad 端使用
// all_data.push(temp);
let logContent = ""; let logContent = "";
// 新增 or 编辑 // 新增 or 编辑
if (params.uid) { if (uid) {
const index = all_data.findIndex( const index = all_data.findIndex((element) => element.uid == uid);
(element) => element.uid == params.uid params.uid = uid;
);
all_data[index] = params; all_data[index] = params;
logContent = getLogContent(LOG_TYPE_ENUM.edit); logContent = getLogContent(
LOG_TYPE_ENUM.edit,
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
} else { } else {
params.uid = new Date().getTime(); // 唯一标识 pad 端使用 params.uid = new Date().getTime(); // 唯一标识 pad 端使用
all_data.push(params); all_data.push(params);
logContent = getLogContent(LOG_TYPE_ENUM.add); logContent = getLogContent(
LOG_TYPE_ENUM.add,
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
} }
// 更新巡检list // 更新巡检list
...@@ -319,7 +319,6 @@ export default { ...@@ -319,7 +319,6 @@ 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);
...@@ -362,31 +361,15 @@ export default { ...@@ -362,31 +361,15 @@ 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("---isSave---", isSave);
const params = this.getParams();
console.log("--保存草稿--", params);
if (isSave) { if (isSave) {
// 更新store 和 [草稿文件] 日志数据
// // 新增日志信息
const logContent = getLogContent(LOG_TYPE_ENUM.darf);
const log_list = this.$store.state.log_list;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
console.log("日志文件写入成功");
});
// 写入草稿文件 更新 store 草稿内容 // 写入草稿文件 更新 store 草稿内容
const params = this.getParams(); const params = this.getParams();
console.log("--保存草稿--", params); params.isSubmit = 0;
this.$store.commit("SET_DARF_DATA", params); // 缓存[巡检信息] this.$store.commit("SET_DARF_DATA", params); // 缓存[巡检信息]
writeDarf(params).then((res) => { writeDarf(params).then((res) => {
...@@ -396,6 +379,20 @@ export default { ...@@ -396,6 +379,20 @@ export default {
title: "保存草稿成功", title: "保存草稿成功",
}); });
}); });
// 新增日志信息
const logContent = getLogContent(
LOG_TYPE_ENUM.darf,
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
const log_list = this.$store.state.log_list;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
console.log("日志文件写入成功");
});
} }
resolve(); resolve();
}); });
...@@ -467,7 +464,7 @@ export default { ...@@ -467,7 +464,7 @@ export default {
margin-bottom: 16px; margin-bottom: 16px;
padding-top: 80px; padding-top: 80px;
position: relative; position: relative;
.bg-img{ .bg-img {
right: 0; right: 0;
bottom: 0; bottom: 0;
position: absolute; position: absolute;
......
...@@ -133,27 +133,31 @@ export default { ...@@ -133,27 +133,31 @@ export default {
this.packedData(JDXJ_DATA, JDXJ_DATA_FILE_NAME), this.packedData(JDXJ_DATA, JDXJ_DATA_FILE_NAME),
]) ])
.then(() => { .then(() => {
// 更新巡检数据状态
const newAllData = all_data.map((item) => {
item.synchronization = 1;
return item;
});
writeInspectionData(all_data) writeInspectionData(all_data)
.then(() => { .then(() => {
this.$store.commit("SET_ALL_DATA", newAllData);
setTimeout(() => { setTimeout(() => {
uni.showToast({ uni.showToast({
title: "打包成功", title: "打包成功",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
this.close(); this.close();
this.loading = false; this.loading = false;
// 更新巡检数据状态
const newAllData = all_data.map((item) => {
item.synchronization = 1;
return item;
});
this.$store.commit("SET_ALL_DATA", newAllData);
// 生成日志 // 生成日志
const logContent = getLogContent(LOG_TYPE_ENUM.sys, "", "同步模块"); const logContent = getLogContent(
LOG_TYPE_ENUM.sys,
"",
"同步模块"
);
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);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论