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

fix(巡检检查): 存草稿数据

上级 9081532d
......@@ -92,6 +92,13 @@
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/shaftInspection/shaftInspection",
"style" :
{
"navigationBarTitleText" : ""
}
}
],
......
......@@ -4,7 +4,7 @@
<view class="user-info">
<image class="user-img" src="@/static/img/add-img/home1.png"></image>
<text class="text" @click="toIndex">巡检员</text>
<text class="text" @click="toIndex">{{ userName }}</text>
</view>
<view class="tab-list">
......@@ -43,8 +43,6 @@
<SynchronousManagement v-if="activeTabIndex == 2" />
<!-- 日志 -->
<!-- <OperLog v-if="activeTabIndex == 4" /> -->
<RouterView />
......@@ -102,6 +100,8 @@ export default {
text: "同步管理",
},
],
userName: this.$store.state.now_user.user
};
},
methods: {
......
......@@ -15,7 +15,7 @@
<view class="content">
<view class="main box-shaow-box">
<view class="content_header">例行巡检</view>
<view class="content_header">机房巡检</view>
<uni-forms
class="formClass"
......@@ -87,7 +87,7 @@ export default {
init() {
this.formData = {
inspectionType: "1",
inspectionCode: moment().format("yyyyMMDDhhmm"),
inspectionCode: `JFXJ${moment().format("yyyyMMDDhhmm")}`,
recordName: `${moment().format("yyyyMMDD")}-机房巡检记录`,
inspectionTime: moment().format("yyyy-MM-DD HH:MM:ss"),
inspectionBy: this.$store.state.now_user.name,
......@@ -99,6 +99,11 @@ export default {
val.detail.data.text
}`;
this.formData.inspectionType = val.detail.value;
const inspectionCode = `${
val.detail.value == 1 ? "JFXJ" : "JDXJ"
}${moment().format("yyyyMMDDhhmm")}`;
this.formData.inspectionCode = inspectionCode;
},
back() {
......@@ -132,13 +137,28 @@ export default {
clickNext() {
this.$store.commit("SET_TEMP_DATA", this.formData); // 缓存[巡检信息]
uni.redirectTo({
url: "/pages/inspectionContent/inspectionContent",
success() {
uni.hideLoading();
},
});
if (this.formData.inspectionType == 2) {
// 井道巡检
uni.redirectTo({
url: "/pages/shaftInspection/shaftInspection",
success() {
uni.hideLoading();
},
});
} else {
// 机房巡检
uni.redirectTo({
url: "/pages/inspectionContent/inspectionContent",
success() {
uni.hideLoading();
},
});
}
return;
this.$refs.forms
.validate()
.then((res) => {
......
......@@ -28,15 +28,30 @@
<view class="content_header">巡检项目(pm)</view>
<!-- tabls -->
<Tabs class="tabs" @change="changeTab" />
<Tabs class="tabs" ref="tabs" @change="changeTab" />
<GatherDataCenter v-show="activeTabIndex == 0" />
<ShieldedComputerRoom v-show="activeTabIndex == 1" />
<BatteryRoom v-show="activeTabIndex == 2" />
<GatherDataCenter v-show="activeTabIndex == 0" ref="GatherDataCenter" />
<ShieldedComputerRoom
ref="ShieldedComputerRoom"
v-show="activeTabIndex == 1"
/>
<BatteryRoom ref="BatteryRoom" v-show="activeTabIndex == 2" />
<ComputerRoomDuty
ref="ComputerRoomDuty"
v-show="activeTabIndex == 3"
></ComputerRoomDuty>
<DutyHandover
ref="DutyHandover"
v-show="activeTabIndex == 4"
></DutyHandover>
<view class="button-group">
<view class="btn-draft btn-class" @tap="draft"> 保存草稿 </view>
<view class="btn-class" @tap="clickNext"> 提交 </view>
<view class="btn-draft btn-class" @tap="draft(activeTabIndex)">
保存草稿
</view>
<view class="btn-class" @tap="submit"> 提交 </view>
</view>
</view>
</view>
......@@ -49,6 +64,14 @@ import Tabs from "./model/tabs.vue";
import BatteryRoom from "./model/batteryRoom.vue";
import GatherDataCenter from "./model/gatherDataCenter.vue";
import ShieldedComputerRoom from "./model/shieldedComputerRoom.vue";
import ComputerRoomDuty from "./model/computerRoomDuty.vue";
import DutyHandover from "./model/dutyHandover.vue";
import {
addLog,
getLogContent,
LOG_TYPE_ENUM,
writeDarf
} from "@/utils/IoReadingAndWriting.js";
export default {
components: {
......@@ -56,28 +79,146 @@ export default {
BatteryRoom,
GatherDataCenter,
ShieldedComputerRoom,
ComputerRoomDuty,
DutyHandover,
},
data() {
return {
activeTabIndex: 0,
baseInfo: {}, // 基础信息
tempForm: {
// 对应每个tab下的数据 [示例 0: 数据]
},
};
},
onLoad() {},
mounted() {
this.baseInfo = this.$store.state.temp_data;
},
methods: {
// tab选中change 时间
changeTab(index, item) {
this.activeTabIndex = index;
this.draft(this.activeTabIndex, false, false).then(() => {
this.activeTabIndex = index;
});
},
back() {
uni.navigateBack();
},
clickNext() {},
// clickNext() {
// 提交按钮
submit() {
this.draft(this.activeTabIndex, false, false).then(() => {
const vaild = this.$refs.tabs.isAllVails();
uni.showToast({
icon: `${vaild ? "success" : "error"}`,
title: `${vaild ? "校验通过" : "请完善填写内容"}`,
});
if (vaild) {
/**
* 校验通过,
* 1.更新 store数据,
* 2. 巡检list文件
* 3.清空草稿文件数据、store草稿数据
*/
}
console.log("基础信息", this.baseInfo);
console.log("巡检信息", this.baseInfo);
});
},
// // 表单填写结果
// isAllVails(vaild, formData) {
// console.log("--this.activeTabIndex---", this.$refs.tabs.setTabVaild);
// switch (this.activeTabIndex) {
// case 0:
// this.$refs.tabs.setTabVaild(this.activeTabIndex, vaild); // 给tab栏设置状态,全部填写会高亮icon图标
// console.log("--formData", formData);
// break;
// case 1:
// this.$refs.tabs.setTabVaild(this.activeTabIndex, vaild);
// break;
// case 2:
// this.$refs.tabs.setTabVaild(this.activeTabIndex, vaild);
// break;
// case 3:
// this.$refs.tabs.setTabVaild(this.activeTabIndex, vaild);
// break;
// case 4:
// this.$refs.tabs.setTabVaild(this.activeTabIndex, vaild);
// break;
// }
// },
// 保存草稿按钮
draft(activeTabIndex, isSave = true, iSwtich = true) {
let refName = "";
return new Promise((resolve, reject) => {
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].vaildForm().then(({ vaild, formData }) => {
this.$refs.tabs
.setTabVaild(activeTabIndex, vaild, iSwtich)
.then(() => {
this.tempForm[activeTabIndex] = formData;
console.log("--this.tempForm--", formData);
if (isSave) {
// 更新store 和 [草稿文件] 日志数据
console.log("--保存草稿--");
this.$store.commit("SET_DARF_DATA", this.tempForm); // 缓存[巡检信息]
// // 新增日志信息
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("日志文件写入成功");
});
// 写入草稿文件
// ...BatteryRoom..
writeDarf(this.tempForm).then((res) => {
console.log("写入草稿文件成功");
uni.showToast({
icon: "success",
title: "保存草稿成功",
});
});
}
resolve();
});
});
});
},
// submit() {
// this.$refs.forms
// .validate()
// .then((res) => {
......
<template>
<view>电池间</view>
</template>
<script>
/**
* 电池间
*/
export default {
props:{
form:{
type: Object,
}
},
data(){
return{
}
<view class="gather-dataCenter">
<uni-forms
v-for="(item, parentIndex) in list"
:key="item.dictLabel"
:modelValue="item"
label-width="82px"
class="inspection-item"
:ref="`forms_${parentIndex}`"
:rules="rules"
>
<uni-forms-item class="row-item" label="巡检项" >
<view class="text">{{ item.dictLabel }}</view>
</uni-forms-item>
<uni-forms-item required class="row-item" label="巡检结论" >
<view class="tags">
<view
v-for="(ele, eleIndex) in item.resultArr"
class="tag"
@click="tagClick(parentIndex, eleIndex, ele.isActive)"
:class="ele.isActive ? 'active-tag' : ''"
>{{ ele.label }}
</view>
</view>
</uni-forms-item>
<!-- 异常状态时显示 -->
<uni-forms-item
required
class="row-item"
label="异常定位"
name="measuredDataArr"
v-if="item.inspectionResult == 1"
>
<view class="tags">
<view
v-for="(ele, eleIndex) in item.postionList"
class="tag"
@click="postionChange(parentIndex, eleIndex, ele.isActive)"
:class="
item.measuredDataArr.includes(ele.dictValue) ? 'active-tag' : ''
"
>{{ ele.dictLabel }}
</view>
</view>
</uni-forms-item>
<!-- 异常状态时显示 -->
<uni-forms-item
v-if="item.inspectionResult == 1"
required
class="row-item"
label="情况摘要"
name="notes"
>
<input type="text" v-model="item.notes" placeholder="请输入内容" />
</uni-forms-item>
</uni-forms>
</view>
</template>
<script>
import {
pad_1_1_inspection_items,
pad_1_1_inspection_position,
pad_room_type,
} from "@/utils/dict.js";
/**
* 电池间
*/
export default {
props: {
form: {
type: Object,
},
},
methods: {
// 回显数据
setForm(){
data() {
return {
list: [],
rules: {
// 对notes字段进行必填验证
notes: {
rules: [
{
required: true,
errorMessage: "请输入情况摘要",
},
],
},
measuredDataArr: {
rules: [
{
required: true,
errorMessage: "请选择",
},
],
},
},
// 获取数据
getForm(){
},
// 校验数据
vaildForm(){
roomTypeLabel: "电池间巡检", // 用于获取类型值
};
},
mounted() {
this.coverlist();
},
methods: {
// tag 点击事件
tagClick(parentIndex, eleIndex, isActive) {
if (isActive) {
return;
}
this.list[parentIndex].resultArr.forEach((element) => {
element.isActive = false;
});
const item = this.list[parentIndex].resultArr[eleIndex];
item.isActive = !isActive;
this.list[parentIndex].resultArr[eleIndex] = item;
// 赋值数据
this.list[parentIndex].inspectionResult = item.value; // 记录结论
this.list[parentIndex].postionList.forEach(
(item) => (item.isActive = false)
);
this.list[parentIndex].measuredDataArr = []; // 重置异常位置
this.list[parentIndex].notes = ""; // 重置摘要信息
},
// tag 点击事件
postionChange(parentIndex, eleIndex, isActive) {
const postionList = this.list[parentIndex].postionList;
const item = postionList[eleIndex];
item.isActive = !isActive;
postionList[eleIndex] = item;
this.list[parentIndex].postionList = postionList;
this.list[parentIndex].measuredDataArr = postionList
.filter((item) => item.isActive)
.map((item) => item.dictValue);
},
// 数据结构重组
coverlist() {
const roomTypeLabel = this.roomTypeLabel;
const roomType = pad_room_type.rows.filter(
(item) => item.dictLabel == roomTypeLabel
)[0].dictValue;
const temp = pad_1_1_inspection_items.rows.map((item) => {
return {
// ...item,
dictLabel: item.dictLabel,
dictValue: item.dictValue,
notes: "", // 情况摘要
inspectionResult: 0, // 异常
itemCode: item.dictValue, // 检查项 如:门禁
roomType, // 机房类型
resultArr: [
{
value: 0,
label: "正常",
isActive: true,
},
{
value: 1,
label: "异常",
isActive: false,
},
],
measuredData: "", // 逗号分隔字符串
measuredDataArr: [], // 前端本地使用
postionList: pad_1_1_inspection_position.rows.map((item) => {
return {
...item,
isActive: false,
};
}),
};
});
this.list = temp;
console.log("---temp", temp);
},
// 回显数据
setForm() {},
// 获取数据
getForm() {
const temp = this.list.map((item) => {
return {
...item,
measuredData: item.measuredDataArr.join(","),
};
});
return temp;
},
// 校验数据 所有表单
async vaildForm() {
const temp = this.list.map((item, index) => {
return this.$refs[`forms_${index}`][0]
.validate()
.then(() => {
return {
result: true,
index,
};
})
.catch(() => {
return {
result: false,
item,
};
});
});
return Promise.all(temp).then((res) => {
const allVaildList = res.filter((item) => item.result);
const formData= this.getForm();
return {
vaild: this.list.length == allVaildList.length,
formData
};
});
},
},
}
</script>
\ No newline at end of file
};
</script>
<style lang="less" scoped>
.gather-dataCenter {
.inspection-item {
border: 1px solid;
margin-bottom: 12px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 12px;
padding: 24px 24px 8px 24px;
.text {
font-size: 16px;
color: #000000;
line-height: 24px;
font-weight: bold;
}
.row-item {
border-bottom: 1px solid #eee;
// border: 1px solid;
padding-bottom: 18px;
margin-bottom: 12px;
&:last-of-type {
border-bottom: none;
margin-bottom: 0;
}
.tags {
display: flex;
align-items: center;
.tag {
background: #f2f3f5;
width: 80px;
height: 36px;
border-radius: 10px;
text-align: center;
line-height: 36px;
margin-right: 12px;
font-size: 16px;
color: #4a4a4a;
text-align: center;
font-weight: 400;
}
.active-tag {
background: #3774f6;
color: #fff;
}
}
}
}
/deep/ .uni-forms-item__content {
display: flex;
align-items: center;
}
}
</style>
\ No newline at end of file
<template>
<view class="gather-dataCenter">
<uni-forms
:modelValue="form"
label-width="82px"
class="inspection-item"
ref="forms"
:rules="rules"
label-position="top"
>
<uni-forms-item
class="row-item"
required
label="机房值班"
name="roomWatch"
>
<textarea
class="textarea"
v-model="form.roomWatch"
placeholder-style="color:#C7C7C7"
placeholder="请输入需求文字"
/>
<view class="quick-input"> 快捷输入 </view>
<view>
<text
class="qucik-text"
v-for="item in quickTextList"
:key="item.text"
@click="clickQuick(item)"
>{{ item.text }}</text
>
</view>
</uni-forms-item>
</uni-forms>
</view>
</template>
<script>
import {
pad_room_type,
} from "@/utils/dict.js";
/**
* 机房值班
*/
export default {
props: {},
data() {
return {
list: [],
rules: {
// 对notes字段进行必填验证
roomWatch: {
rules: [
{
required: true,
errorMessage: "请输入内容",
},
],
},
},
form: {
roomWatch: "", // 机房值班
},
quickTextList: [
{
text: "门禁异常",
isActive: false,
},
{
text: "已处理",
isActive: false,
},
{
text: "需派单维修",
isActive: false,
},
{
text: "进出总人数:",
isActive: false,
},
{
text: "访客记录:",
isActive: false,
},
{
text: "有",
isActive: false,
},
{
text: "无",
isActive: false,
},
],
roomTypeLabel: "机房值班", // 用于获取类型值
};
},
mounted() {
const roomTypeLabel = this.roomTypeLabel;
const roomType = pad_room_type.rows.filter(
(item) => item.dictLabel == roomTypeLabel
)[0].dictValue;
this.form.roomType = roomType;
},
methods: {
// 回显数据
setForm() {},
clickQuick(item) {
this.form.roomWatch = `${this.form.roomWatch}${item.text}`;
},
// 校验数据 所有表单
async vaildForm() {
return new Promise((resolve, reject) => {
this.$refs.forms
.validate()
.then((res) => {
resolve({
vaild: true,
formData: this.form,
});
})
.catch((error) => {
resolve({
vaild: false,
formData: this.form,
});
});
});
},
},
};
</script>
<style lang="less" scoped>
.gather-dataCenter {
.inspection-item {
border: 1px solid;
margin-bottom: 12px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 12px;
padding: 24px 24px 8px 24px;
.text {
font-size: 16px;
color: #000000;
line-height: 24px;
font-weight: bold;
}
.textarea {
width: 100%;
height: 96px;
background: #f7f7f7;
border-radius: 12px;
font-size: 14px;
color: #4a4a4a;
padding: 16px;
font-weight: 400;
}
.quick-input {
margin: 16px 18px;
font-size: 14px;
color: #7c7c7c;
font-weight: 400;
}
.qucik-text {
display: inline-block;
border: 1px solid rgba(242, 242, 242, 1);
border-radius: 8px;
width: 72px;
height: 32px;
font-size: 12px;
color: #4a4a4a;
line-height: 20px;
font-weight: 400;
margin-right: 12px;
line-height: 32px;
text-align: center;
}
}
// /deep/ .uni-forms-item__content {
// display: flex;
// align-items: center;
// }
}
</style>
<template>
<view class="gather-dataCenter">
<uni-forms
:modelValue="form"
label-width="82px"
class="inspection-item"
ref="forms"
:rules="rules"
label-position="top"
>
<uni-forms-item
class="row-item"
required
label="值班交接"
name="dutyHandover"
>
<textarea
class="textarea"
v-model="form.dutyHandover"
placeholder-style="color:#C7C7C7"
placeholder="请输入"
/>
<view class="quick-input"> 快捷输入 </view>
<view>
<text
class="qucik-text"
v-for="item in quickTextList"
:key="item.text"
@click="clickQuick(item)"
>{{ item.text }}</text
>
</view>
</uni-forms-item>
<view class="user-info">
<uni-forms-item class="row-item" label="交班人" >
<text class="text">{{ form.handoverPerson }}</text>
</uni-forms-item>
<uni-forms-item class="row-item" required label="接班人" name="successor">
<uni-easyinput
type="text"
v-model="form.successor"
placeholder="请输入"
/>
</uni-forms-item>
</view>
</uni-forms>
</view>
</template>
<script>
import { pad_room_type } from "@/utils/dict.js";
/**
* 值班交接
*/
export default {
props: {},
data() {
return {
rules: {
// 对notes字段进行必填验证
dutyHandover: {
rules: [
{
required: true,
errorMessage: "请输入内容",
},
],
},
successor: {
rules: [
{
required: true,
errorMessage: "请输入内容",
},
],
},
},
form: {
dutyHandover: "", // 机房值班
handoverPerson: "", //交班人
successor: "", // 接班人
},
quickTextList: [
{
text: "有异常",
isActive: false,
},
{
text: "已处理",
isActive: false,
},
{
text: "需派单维修",
isActive: false,
},
{
text: "进出总人数:",
isActive: false,
},
{
text: "访客记录:",
isActive: false,
},
{
text: "未完成事项:",
isActive: false,
},
{
text: "有",
isActive: false,
},
{
text: "无",
isActive: false,
},
],
roomTypeLabel: "值班交接", // 用于获取类型值
};
},
mounted() {
this.init();
},
methods: {
init() {
const roomTypeLabel = this.roomTypeLabel;
const roomType = pad_room_type.rows.filter(
(item) => item.dictLabel == roomTypeLabel
)[0].dictValue;
this.form.roomType = roomType;
this.form.handoverPerson = this.$store.state.now_user.user;
},
// 回显数据
setForm() {},
clickQuick(item) {
this.form.dutyHandover = `${this.form.dutyHandover}${item.text}`;
// this.quickTextList[index].isActive = item.isActive;
},
// 校验数据 所有表单
async vaildForm() {
return new Promise((resolve, reject) => {
this.$refs.forms
.validate()
.then((res) => {
resolve({
vaild: true,
formData: this.form,
});
})
.catch((error) => {
resolve({
vaild: false,
formData: this.form,
});
});
});
},
},
};
</script>
<style lang="less" scoped>
.gather-dataCenter {
.inspection-item {
border: 1px solid;
margin-bottom: 12px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 12px;
padding: 24px 24px 8px 24px;
.text {
font-size: 16px;
color: #000000;
line-height: 24px;
font-weight: bold;
}
.textarea {
width: 100%;
height: 96px;
background: #f7f7f7;
border-radius: 12px;
font-size: 14px;
color: #4a4a4a;
padding: 16px;
font-weight: 400;
}
.quick-input {
margin: 16px 18px;
font-size: 14px;
color: #7c7c7c;
font-weight: 400;
}
.qucik-text {
display: inline-block;
border: 1px solid rgba(242, 242, 242, 1);
border-radius: 8px;
width: 72px;
height: 32px;
font-size: 12px;
color: #4a4a4a;
line-height: 20px;
font-weight: 400;
margin-right: 12px;
line-height: 32px;
text-align: center;
}
}
.user-info{
display: flex;
.uni-forms-item{
flex: 1;;
display: flex;
flex-direction: row;
}
}
// /deep/ .uni-forms-item__content {
// display: flex;
// align-items: center;
// }
}
</style>
<template>
<view class="gather-dataCenter">
<view @click="vaildForm()">提交按钮</view>
<uni-forms
v-for="(item, parentIndex) in list"
:key="item.dictLabel"
......@@ -78,8 +76,7 @@ export default {
},
data() {
return {
list: pad_1_1_inspection_items.rows,
formData: {},
list: [],
rules: {
// 对notes字段进行必填验证
notes: {
......@@ -150,7 +147,9 @@ export default {
const temp = pad_1_1_inspection_items.rows.map((item) => {
return {
...item,
// ...item,
dictLabel: item.dictLabel,
dictValue: item.dictValue,
notes: "", // 情况摘要
inspectionResult: 0, // 异常
itemCode: item.dictValue, // 检查项 如:门禁
......@@ -185,28 +184,17 @@ export default {
setForm() {},
// 获取数据
getForm() {
console.log("_--");
const temp = this.list.map((item) => {
return {
...item,
measuredData: item.measuredDataArr.join(","),
};
});
return temp;
},
// 校验单个表单
vaildSingleForm(ref) {
console.log("--ddddd--", this.$refs);
return this.$refs[ref][0]
.validate()
.then((res) => {
console.log("success", res);
uni.showToast({
title: `校验通过`,
});
})
.catch((err) => {
console.log("err", err);
});
},
// 校验数据 所有表单
vaildForm() {
console.log(" this.$refs[`forms_${index}`", this.$refs);
async vaildForm() {
const temp = this.list.map((item, index) => {
return this.$refs[`forms_${index}`][0]
.validate()
......@@ -219,22 +207,18 @@ export default {
.catch(() => {
return {
result: false,
index,
item,
};
});
});
console.log("-temp---", temp);
Promise.all(temp).then((res) => {
return Promise.all(temp).then((res) => {
const allVaildList = res.filter((item) => item.result);
if (this.list.length == allVaildList.length) {
uni.showToast({
title: `校验通过`,
});
}
console.log("-res---", res);
const formData= this.getForm();
return {
vaild: this.list.length == allVaildList.length,
formData
};
});
},
},
......
<template>
<view>屏蔽机房</view>
</template>
<script>
/**
* 屏蔽机房
*/
export default {
props:{
form:{
type: Object,
}
},
data(){
return{
}
<view class="gather-dataCenter">
<uni-forms
v-for="(item, parentIndex) in list"
:key="item.dictLabel"
:modelValue="item"
label-width="82px"
class="inspection-item"
:ref="`forms_${parentIndex}`"
:rules="rules"
>
<uni-forms-item class="row-item" label="巡检项" name="name">
<view class="text">{{ item.dictLabel }}</view>
</uni-forms-item>
<uni-forms-item required class="row-item" label="巡检结论" name="name">
<view class="tags">
<view
v-for="(ele, eleIndex) in item.resultArr"
class="tag"
@click="tagClick(parentIndex, eleIndex, ele.isActive)"
:class="ele.isActive ? 'active-tag' : ''"
>{{ ele.label }}
</view>
</view>
</uni-forms-item>
<!-- 异常状态时显示 -->
<uni-forms-item
required
class="row-item"
label="异常定位"
name="measuredDataArr"
v-if="item.inspectionResult == 1"
>
<view class="tags">
<view
v-for="(ele, eleIndex) in item.postionList"
class="tag"
@click="postionChange(parentIndex, eleIndex, ele.isActive)"
:class="
item.measuredDataArr.includes(ele.dictValue) ? 'active-tag' : ''
"
>{{ ele.dictLabel }}
</view>
</view>
</uni-forms-item>
<!-- 异常状态时显示 -->
<uni-forms-item
v-if="item.inspectionResult == 1"
required
class="row-item"
label="情况摘要"
name="notes"
>
<input type="text" v-model="item.notes" placeholder="请输入内容" />
</uni-forms-item>
</uni-forms>
</view>
</template>
<script>
import {
pad_1_2_inspection_items,
pad_1_2_inspection_position,
pad_room_type,
} from "@/utils/dict.js";
/**
* 屏蔽机房巡检
*/
export default {
props: {
form: {
type: Object,
},
},
methods: {
// 回显数据
setForm(){
data() {
return {
list: [],
rules: {
// 对notes字段进行必填验证
notes: {
rules: [
{
required: true,
errorMessage: "请输入情况摘要",
},
],
},
measuredDataArr: {
rules: [
{
required: true,
errorMessage: "请选择",
},
],
},
},
// 获取数据
getForm(){
},
// 校验数据
vaildForm(){
roomTypeLabel: "屏蔽机房巡检", // 用于获取类型值
};
},
mounted() {
this.coverlist();
},
methods: {
// tag 点击事件
tagClick(parentIndex, eleIndex, isActive) {
if (isActive) {
return;
}
this.list[parentIndex].resultArr.forEach((element) => {
element.isActive = false;
});
const item = this.list[parentIndex].resultArr[eleIndex];
item.isActive = !isActive;
this.list[parentIndex].resultArr[eleIndex] = item;
// 赋值数据
this.list[parentIndex].inspectionResult = item.value; // 记录结论
this.list[parentIndex].postionList.forEach(
(item) => (item.isActive = false)
);
this.list[parentIndex].measuredDataArr = []; // 重置异常位置
this.list[parentIndex].notes = ""; // 重置摘要信息
},
// tag 点击事件
postionChange(parentIndex, eleIndex, isActive) {
const postionList = this.list[parentIndex].postionList;
const item = postionList[eleIndex];
item.isActive = !isActive;
postionList[eleIndex] = item;
this.list[parentIndex].postionList = postionList;
this.list[parentIndex].measuredDataArr = postionList
.filter((item) => item.isActive)
.map((item) => item.dictValue);
},
// 数据结构重组
coverlist() {
const roomTypeLabel = this.roomTypeLabel;
const roomType = pad_room_type.rows.filter(
(item) => item.dictLabel == roomTypeLabel
)[0].dictValue;
const temp = pad_1_2_inspection_items.rows.map((item) => {
return {
// ...item,
dictLabel: item.dictLabel,
dictValue: item.dictValue,
notes: "", // 情况摘要
inspectionResult: 0, // 异常
itemCode: item.dictValue, // 检查项 如:门禁
roomType, // 机房类型
resultArr: [
{
value: 0,
label: "正常",
isActive: true,
},
{
value: 1,
label: "异常",
isActive: false,
},
],
measuredData: "", // 逗号分隔字符串
measuredDataArr: [], // 前端本地使用
postionList: pad_1_2_inspection_position.rows.map((item) => {
return {
...item,
isActive: false,
};
}),
};
});
this.list = temp;
console.log("---temp", temp);
},
// 回显数据
setForm() {},
// 获取数据
getForm() {
const temp = this.list.map((item) => {
return {
...item,
measuredData: item.measuredDataArr.join(","),
};
});
return temp;
},
// 校验数据 所有表单
async vaildForm() {
const temp = this.list.map((item, index) => {
return this.$refs[`forms_${index}`][0]
.validate()
.then(() => {
return {
result: true,
index,
};
})
.catch(() => {
return {
result: false,
item,
};
});
});
return Promise.all(temp).then((res) => {
const allVaildList = res.filter((item) => item.result);
const formData= this.getForm();
return {
vaild: this.list.length == allVaildList.length,
formData
};
});
},
},
}
</script>
\ No newline at end of file
};
</script>
<style lang="less" scoped>
.gather-dataCenter {
.inspection-item {
border: 1px solid;
margin-bottom: 12px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 12px;
padding: 24px 24px 8px 24px;
.text {
font-size: 16px;
color: #000000;
line-height: 24px;
font-weight: bold;
}
.row-item {
border-bottom: 1px solid #eee;
// border: 1px solid;
padding-bottom: 18px;
margin-bottom: 12px;
&:last-of-type {
border-bottom: none;
margin-bottom: 0;
}
.tags {
display: flex;
align-items: center;
.tag {
background: #f2f3f5;
width: 80px;
height: 36px;
border-radius: 10px;
text-align: center;
line-height: 36px;
margin-right: 12px;
font-size: 16px;
color: #4a4a4a;
text-align: center;
font-weight: 400;
}
.active-tag {
background: #3774f6;
color: #fff;
}
}
}
}
/deep/ .uni-forms-item__content {
display: flex;
align-items: center;
}
}
</style>
\ No newline at end of file
......@@ -5,7 +5,7 @@
v-for="(item, index) in list"
:key="item.name"
class="tab-item"
@click="tabClick(item, index)"
@click="tabClick(index, item)"
:class="index == activeIndex ? 'active-tab-item' : ''"
>
<text
......@@ -50,7 +50,7 @@ export default {
list: [
{
name: "汇聚机房",
isVaild: true, // 校验通过
isVaild: false, // 校验通过
type: 1, // 枚举值
position: pad_1_1_inspection_position.rows,
descript:
......@@ -86,13 +86,36 @@ export default {
};
},
methods: {
tabClick(item, index) {
tabClick(index, item) {
this.activeIndex = index;
this.$emit("change", index, item);
this.$emit("change", index, item);
},
/**
* 设置单个校验状态
* @param index
* @param vaild
* @param iSwtich 是否自动切换到下一个tab
*/
setTabVaild(index, vaild = false, iSwtich=true) {
return new Promise((resolve, reject) => {
this.list[index].isVaild = vaild;
if (iSwtich && index < this.list.length - 1) {
this.tabClick(index + 1, {});
}
resolve()
});
},
// 设置校验状态
setTabVaild(index, vaild = false) {
this.list[index] = vaild;
// 校验所有内容是否填写完成
isAllVails() {
return this.list.every((item) => {
return item.isVaild;
});
},
},
};
......
......@@ -33,6 +33,12 @@ import {
TEST,
} from "@/utils/systemCofig";
import {
LOG_TYPE_ENUM,
getLogContent,
addLog,
} from "@/utils/IoReadingAndWriting.js";
export default {
components: {
hintInput,
......@@ -139,21 +145,31 @@ export default {
});
// this.$store.state.now_user = this.personList[key]
this.$store.commit("SET_USER", this.personList[key]);
let timeStr = getDateTime.dateTimeStr("y-m-d h:i");
let operData = {
name: this.$store.state.now_user.name,
level: "秘密",
user: this.$store.state.now_user.user,
module: "其他",
detail: "无",
type: "登录",
time: timeStr,
};
this.$store.state.oper_record.unshift(operData);
// let timeStr = getDateTime.dateTimeStr("y-m-d h:i");
// let operData = {
// name: this.$store.state.now_user.name,
// level: "秘密",
// user: this.$store.state.now_user.user,
// module: "其他",
// detail: "无",
// type: "登录",
// time: timeStr,
// };
// this.$store.state.oper_record.unshift(operData);
console.log("--this.personList[key]-", this.personList[key]);
// 检查文件夹是否创建
checkAndCreateDirectory(
`${SYNCHRONIZE_DATA_PAD}/${this.$store.state.now_user.user}`
);
// 更新日志信息
const logContent = getLogContent(
LOG_TYPE_ENUM.login
);
addLog(logContent);
uni.navigateTo({
url: "/pages/home/home",
});
......
<template>
<view class="gather-dataCenter">
<uni-forms
label-position="top"
:modelValue="form"
:ref="`forms`"
:rules="rules"
class="inspection-item"
>
<uni-forms
v-for="(item, parentIndex) in list"
:key="item.dictLabel"
:modelValue="item"
label-width="82px"
:ref="`forms_${parentIndex}`"
:rules="rules"
>
<uni-forms-item class="row-item" label="巡检项" name="name">
<view class="text">{{ item.dictLabel }}</view>
</uni-forms-item>
<uni-forms-item required class="row-item" label="巡检结论" name="name">
<view class="tags">
<view
v-for="(ele, eleIndex) in item.resultArr"
class="tag"
@click="tagClick(parentIndex, eleIndex, ele.isActive)"
:class="ele.isActive ? 'active-tag' : ''"
>{{ ele.label }}
</view>
</view>
</uni-forms-item>
<!-- 异常状态时显示 -->
<uni-forms-item
required
class="row-item"
label="异常定位"
name="measuredDataArr"
v-if="item.inspectionResult == 1"
>
<view class="tags">
<view
v-for="(ele, eleIndex) in item.postionList"
class="tag"
@click="postionChange(parentIndex, eleIndex, ele.isActive)"
:class="
item.measuredDataArr.includes(ele.dictValue) ? 'active-tag' : ''
"
>{{ ele.dictLabel }}
</view>
</view>
</uni-forms-item>
</uni-forms>
<!-- 结论 -->
<uni-forms-item
required
class="row-item textarea-form"
label="结论"
name="conclusion"
>
<textarea
class="textarea"
v-model="form.conclusion"
placeholder-style="color:#C7C7C7"
placeholder="请输入"
/>
</uni-forms-item>
</uni-forms>
</view>
</template>
<script>
import {
pad_2_1_inspection_items,
pad_2_1_floor,
pad_room_type,
} from "@/utils/dict.js";
/**
* 汇集机房
*/
export default {
props: {},
data() {
return {
list: [],
form: {},
rules: {
// 对notes字段进行必填验证
notes: {
rules: [
{
required: true,
errorMessage: "请输入情况摘要",
},
],
},
conclusion: {
rules: [
{
required: true,
errorMessage: "请选择",
},
],
},
measuredDataArr: {
rules: [
{
required: true,
errorMessage: "请选择",
},
],
},
},
roomTypeLabel: "汇聚机房巡检", // 用于获取类型值
};
},
mounted() {
this.coverlist();
},
methods: {
// tag 点击事件
tagClick(parentIndex, eleIndex, isActive) {
if (isActive) {
return;
}
this.list[parentIndex].resultArr.forEach((element) => {
element.isActive = false;
});
const item = this.list[parentIndex].resultArr[eleIndex];
item.isActive = !isActive;
this.list[parentIndex].resultArr[eleIndex] = item;
// 赋值数据
this.list[parentIndex].inspectionResult = item.value; // 记录结论
this.list[parentIndex].postionList.forEach(
(item) => (item.isActive = false)
);
this.list[parentIndex].measuredDataArr = []; // 重置异常位置
this.list[parentIndex].notes = ""; // 重置摘要信息
},
// tag 点击事件
postionChange(parentIndex, eleIndex, isActive) {
const postionList = this.list[parentIndex].postionList;
const item = postionList[eleIndex];
item.isActive = !isActive;
postionList[eleIndex] = item;
this.list[parentIndex].postionList = postionList;
this.list[parentIndex].measuredDataArr = postionList
.filter((item) => item.isActive)
.map((item) => item.dictValue);
},
// 数据结构重组
coverlist() {
const roomTypeLabel = this.roomTypeLabel;
const roomType = pad_room_type.rows.filter(
(item) => item.dictLabel == roomTypeLabel
)[0].dictValue;
const temp = pad_2_1_inspection_items.rows.map((item) => {
return {
// ...item,
dictLabel: item.dictLabel,
dictValue: item.dictValue,
notes: "", // 情况摘要
inspectionResult: 0, // 异常
itemCode: item.dictValue, // 检查项 如:门禁
roomType, // 机房类型
resultArr: [
{
value: 0,
label: "正常",
isActive: true,
},
{
value: 1,
label: "异常",
isActive: false,
},
],
measuredData: "", // 逗号分隔字符串
measuredDataArr: [], // 前端本地使用
postionList: pad_2_1_floor.rows.map((item) => {
return {
...item,
isActive: false,
};
}),
};
});
this.list = temp;
console.log("---temp", temp);
},
// 回显数据
setForm() {},
// 获取数据
getForm() {
const temp = this.list.map((item) => {
return {
...item,
measuredData: item.measuredDataArr.join(","),
};
});
return {
...this.form,
temp,
};
},
// 校验数据 所有表单
async vaildForm() {
return new Promise(async (resolve, reject) => {
let result = "";
this.$refs.forms
.validate()
.then((res) => {
result = true;
})
.catch((error) => {
result = false;
});
const temp = this.list.map((item, index) => {
return this.$refs[`forms_${index}`][0]
.validate()
.then(() => {
return {
result: true,
index,
};
})
.catch(() => {
return {
result: false,
item,
};
});
});
Promise.all(temp).then((res) => {
const allVaildList = res.filter((item) => item.result);
const formData = this.getForm();
// return {
// vaild: this.list.length == allVaildList.length,
// formData,
// };
resolve({
vaild: result && this.list.length == allVaildList.length,
formData,
});
});
return;
});
},
},
};
</script>
<style lang="less" scoped>
.gather-dataCenter {
.inspection-item {
border: 1px solid;
margin-bottom: 12px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 12px;
padding: 24px 24px 8px 24px;
.text {
font-size: 16px;
color: #000000;
line-height: 24px;
font-weight: bold;
}
}
.row-item {
border-bottom: 1px solid #eee;
padding-bottom: 18px;
margin-bottom: 12px;
&:last-of-type {
// border-bottom: none;
// margin-bottom: 0;
}
.tags {
display: flex;
align-items: center;
.tag {
background: #f2f3f5;
width: 80px;
height: 36px;
border-radius: 10px;
text-align: center;
line-height: 36px;
margin-right: 12px;
font-size: 16px;
color: #4a4a4a;
text-align: center;
font-weight: 400;
}
.active-tag {
background: #3774f6;
color: #fff;
}
}
}
/deep/ .uni-forms-item__content {
display: flex;
align-items: center;
}
.textarea-form {
border-bottom: none;
margin-bottom: 0;
.textarea {
width: 100%;
height: 96px;
background: #f7f7f7;
border-radius: 12px;
font-size: 14px;
color: #4a4a4a;
padding: 16px;
font-weight: 400;
}
}
}
</style>
<template>
<view class="tabs-component">
<view class="tabs-list">
<view
v-for="(item, index) in list"
:key="item.name"
class="tab-item"
@click="tabClick(index, item)"
:class="index == activeIndex ? 'active-tab-item' : ''"
>
<text
class="iconfont icon-yiwancheng1"
:class="item.isVaild ? 'vaild-icon' : ''"
></text>
{{ item.name }}</view
>
</view>
<!-- 描述 -->
<!-- <view class="descript">
<view v-if="list[activeIndex].position" class="descript-item">
<text class="name">巡检位置</text>
<text class="text">{{
list[activeIndex].position.map((item) => item.dictLabel).join("、")
}}</text>
</view>
<view class="descript-item">
<text class="name">巡检说明</text>
<text class="text"> {{ list[activeIndex].descript }}</text>
</view>
</view> -->
</view>
</template>
<script>
export default {
props: {
options: {
tyep: Array,
},
},
data() {
return {
activeIndex: 0,
list: [],
};
},
created() {
},
mounted() {
this.list = this.options
},
watch: {
options(newData) {
this.list = newData
}
},
methods: {
tabClick(index, item) {
this.activeIndex = index;
this.$emit("change", index, item);
},
/**
* 设置单个校验状态
* @param index
* @param vaild
* @param iSwtich 是否自动切换到下一个tab
*/
setTabVaild(index, vaild = false, iSwtich = true) {
return new Promise((resolve, reject) => {
this.list[index].isVaild = vaild;
if (iSwtich && index < this.list.length - 1) {
this.tabClick(index + 1, {});
}
resolve();
});
},
// 校验所有内容是否填写完成
isAllVails() {
return this.list.every((item) => {
return item.isVaild;
});
},
},
};
</script>
<style lang="less" scoped>
.tabs-component {
.tabs-list {
display: flex;
align-items: center;
margin-bottom: 16px;
.iconfont {
margin-right: 5px;
color: #999;
font-size: 14px;
}
.tab-item {
margin-right: 24px;
font-size: 14px;
color: #000000;
line-height: 22px;
font-weight: 400;
position: relative;
padding-bottom: 5px;
&::after {
content: " ";
position: absolute;
bottom: 0px;
width: 100%;
height: 3px;
border-radius: 10px;
left: 0;
}
}
.vaild-icon {
color: #3774f6;
}
.active-tab-item {
color: #3774f6;
&::after {
background: #3774f6;
}
}
}
.descript {
padding: 8px 16px;
background: #e0f1ff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 8px;
.descript-item {
font-size: 12px;
color: #959595;
line-height: 28px;
font-weight: 400;
.name {
margin-right: 8px;
}
.text {
color: #000000;
}
}
}
}
</style>
<template>
<view class="container">
<!-- 导航栏 -->
<uni-nav-bar
dark
:fixed="true"
background-color="#5474e8"
status-bar
left-text="返回"
title="杭州内网监管在线"
left-icon="left"
@clickLeft="back"
>
</uni-nav-bar>
<view class="content">
<view class="base-info">
<view class="title">井道巡检</view>
<view class=""
><text class="name">巡检编号</text><text class="text">巡检编号</text>
</view>
<view class=""
><text class="name">巡检编号</text><text class="text">巡检编号</text>
</view>
</view>
<view class="main box-shaow-box">
<view class="content_header">巡检项目</view>
<!-- tabls -->
<Tabs class="tabs" ref="tabs" :options="tabList" @change="changeTab" />
<TabContentItem
v-for="(item, index) in tabList.length"
:key="index"
v-show="activeTabIndex == index"
:ref="`TabContentItem_${index}`"
/>
<view class="button-group">
<view class="btn-draft btn-class" @tap="draft(activeTabIndex)">
保存草稿
</view>
<view class="btn-class" @tap="submit"> 提交 </view>
</view>
</view>
</view>
</view>
</template>
<script>
import moment from "moment";
import Tabs from "./model/tabs.vue";
import TabContentItem from "./model/tabContentItem.vue";
import {
addLog,
getLogContent,
LOG_TYPE_ENUM,
} from "@/utils/IoReadingAndWriting.js";
import { pad_2_1_inspection_position } from "@/utils/dict.js";
export default {
components: {
Tabs,
TabContentItem,
},
data() {
return {
tabList: [],
activeTabIndex: 0,
baseInfo: {}, // 基础信息
tempForm: {
// 对应每个tab下的数据 [示例 0: 数据]
},
};
},
onLoad() {},
mounted() {
this.baseInfo = this.$store.state.temp_data;
this.init();
},
methods: {
init() {
this.tabList = pad_2_1_inspection_position.rows.map((item, index) => {
return {
name: item.dictLabel,
isVaild: false, // 校验通过
// type: 1, // 枚举值
position: pad_2_1_inspection_position.rows,
refName: `TabContentItem_${index}`,
};
});
},
// tab选中change 时间
changeTab(index, item) {
console.log("-index--", index);
this.draft(this.activeTabIndex, false, false).then(() => {
this.activeTabIndex = index;
});
},
back() {
uni.navigateBack();
},
// 提交按钮
submit() {
this.draft(this.activeTabIndex, false, false).then(() => {
const vaild = this.$refs.tabs.isAllVails();
uni.showToast({
icon: `${vaild ? "success" : "error"}`,
title: `${vaild ? "校验通过" : "请完善填写内容"}`,
});
if (vaild) {
/**
* 校验通过,
* 1.更新 store数据,
* 2. 巡检list文件
* 3.清空草稿文件数据、store草稿数据
*/
}
console.log("基础信息", this.baseInfo);
console.log("巡检信息", this.baseInfo);
});
},
// 保存草稿按钮
draft(activeTabIndex, isSave = true, iSwtich = true) {
let refName = this.tabList[activeTabIndex].refName;
return new Promise((resolve, reject) => {
this.$refs[refName][0].vaildForm().then(({ vaild, formData }) => {
this.$refs.tabs
.setTabVaild(activeTabIndex, vaild, iSwtich)
.then(() => {
this.tempForm[activeTabIndex] = formData;
console.log("--this.tempForm--", formData);
if (isSave) {
// 更新store 和 [草稿文件] 日志数据
console.log("--保存草稿--");
this.$store.commit("SET_DARF_DATA", this.tempForm); // 缓存[巡检信息]
// // 新增日志信息
// const logContent = getLogContent(LOG_TYPE_ENUM.darf);
// const log_list = this.$store.state.log_list
// console.log("-SET_LOG_LIST--", log_list , logContent);
// const temp = [...log_list]
// console.log("-xxxxx--", temp);
// // this.$store.commit("SET_LOG_LIST", []);
// addLog(temp).then((res) => {
// console.log("日志文件写入成功");
// });
// 写入草稿文件
// ...BatteryRoom..
}
resolve();
});
});
});
},
// submit() {
// this.$refs.forms
// .validate()
// .then((res) => {
// uni.showLoading({
// title: "加载中",
// });
// // console.log('校验通过');
// // let timeStr = getDateTime.dateTimeStr("y-m-d h:i");
// // let timeStr2 = getDateTime.dateTimeStr("y-m-d h:i:s");
// // this.formData.type = "1"; //巡检为1
// // this.formData.oid = this.$store.state.now_user.areaName; //区域名
// // this.formData.status = "编辑中"; //pad端添加状态
// // this.formData.isDel = "0";
// // this.formData.id = "";
// // this.formData.errorData = {};
// // this.formData.createBy = this.$store.state.now_user.name;
// // this.formData.creatTime = timeStr2;
// // this.formData.uid =
// // this.$store.state.now_user.oid +
// // Number(
// // Math.random().toString().substr(3, 10) + Date.now()
// // ).toString(36);
// // this.$store.state.all_data.push(this.formData);
// // 记录操作日志
// let operData = {
// name: this.$store.state.now_user.name,
// level: "秘密",
// user: this.$store.state.now_user.user,
// module: "巡检",
// detail:
// this.showRoomName(this.formData.room) +
// "巡检记录" +
// "(" +
// this.formData.number +
// ")",
// type: this.$store.state.oper_type,
// time: timeStr,
// ...this.formData,
// level: "秘密",
// };
// this.$store.state.oper_record.unshift(operData); //保存该操作记录
// this.$store.commit("SET_TEMP_DATA", this.formData); // 缓存[巡检信息]
// uni.redirectTo({
// url: "/pages/inspectionContent/inspectionContent",
// success() {
// uni.hideLoading();
// },
// });
// })
// .catch((err) => {
// console.log(err);
// });
// },
},
};
</script>
<style scoped lang="less">
.container {
width: 100%;
height: 100%;
.content {
width: 100%;
background-image: linear-gradient(
0deg,
#f3f6fa 0%,
rgba(130, 153, 238, 0.73) 49%,
#5474e8 100%
);
height: calc(100vh - 44px - var(--status-bar-height));
background-size: 100% 40rpx;
background-repeat: no-repeat;
padding: 0 20px 20px 20px;
.main {
width: 100%;
height: 100%;
padding: 20px 24px;
position: relative;
.tabs {
margin: 16px 0;
}
}
}
// 基础信息
.base-info {
padding: 20px 24px;
background: #fff;
border-radius: 10px;
margin-bottom: 16px;
display: flex;
align-items: center;
.title {
font-size: 26px;
color: #000000;
line-height: 34px;
font-weight: 600;
margin-bottom: 16px;
}
.name {
font-size: 14px;
color: #7c7c7c;
font-weight: 400;
}
.text {
font-size: 14px;
color: #000000;
font-weight: 400;
}
}
.button-group {
position: fixed;
bottom: 32px;
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: center;
.btn-class {
width: 180px;
height: 48px;
background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%);
box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24);
border-radius: 27px;
font-size: 20px;
color: #ffffff;
text-align: center;
font-weight: 400;
text-align: center;
line-height: 48px;
margin-right: 24px;
}
.btn-draft {
background: #fff;
border: 1px solid #3773f6;
color: #3773f6;
box-shadow: none;
}
}
}
</style>
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
const store = new Vuex.Store({
state: {
oper_record: [], //保存操作记录数据,
all_data: [], //保存页面数据
now_user: {}, //保存当前登录用户
temp_data: {}, //当前编辑或者查看的数据,
oper_type: '', // 当前操作类型
last_time: '', //上次上报时间,
user_data: {}, //所有用户信息
scroll_top: 510, //
flgObj: false,
roomNum:null,
startTime:''
},
mutations: {
SET_STARTTIME(state, payload) {
state.startTime = payload
},
SET_TOP(state, payload) {
state.scroll_top = payload
},
SET_ROOM(state, payload){
state.roomNum = payload
},
set_FLAG(state, payload) {
state.flgObj = payload
},
SET_TYPE(state, payload) { //设置操作类型
state.oper_type = payload
},
SET_USER(state, payload) { //保存当前登录用户
state.now_user = payload
},
SET_TIME(state, payload) { //保存上次上报时间
state.last_time = payload
},
DEL_DATA(state, index) { //删除数据
state.all_data.splice(index, 1)
},
SET_TEMP_DATA(state, payload) { //设置当前编辑或查看的数据
state.temp_data = payload
},
SET_USER_DATA(state, payload) { //设置当前编辑或查看的数据
state.user_data = payload
}
}
})
state: {
oper_record: [], // 保存操作记录数据--日志数据 --弃用
all_data: [], // 保存页面数据 -- 所有的巡检数据,list列表
all_user_data: [], // 所有用户信息 -- list列表
export default store
\ No newline at end of file
log_list: [], // 保存操作记录数据--日志数据
now_user: {
id: 1,
user: "hzsgjy",
passWord: "JFXJ85250920",
areaName: "市本级",
permission: 1,
name: "超管",
oid: "scq",
}, //保存当前登录用户
darf_data: {}, // 保存草稿内容
temp_data: {}, // 当前编辑或者查看的数据,
oper_type: "", // 当前操作类型
// last_time: '', //上次上报时间,
user_data: {}, //所有用户信息
scroll_top: 510, //
flgObj: false,
roomNum: null,
startTime: "",
},
mutations: {
SET_STARTTIME(state, payload) {
state.startTime = payload;
},
SET_TOP(state, payload) {
state.scroll_top = payload;
},
SET_ROOM(state, payload) {
state.roomNum = payload;
},
set_FLAG(state, payload) {
state.flgObj = payload;
},
SET_TYPE(state, payload) {
//设置操作类型
state.oper_type = payload;
},
SET_USER(state, payload) {
//保存当前登录用户
state.now_user = payload;
},
// SET_TIME(state, payload) { //保存上次上报时间
// state.last_time = payload
// },
DEL_DATA(state, index) {
//删除数据
state.all_data.splice(index, 1);
},
SET_TEMP_DATA(state, payload) {
//设置当前编辑或查看的数据
state.temp_data = payload;
},
SET_USER_DATA(state, payload) {
//设置当前编辑或查看的数据
state.user_data = payload;
},
SET_DARF_DATA(state, payload) {
// 保存巡检内容的草稿状态
state.darf_data = payload;
},
SET_ALL_USER_DATA(state, payload) {
// 保存 所有用户列表
state.all_user_data = payload;
},
SET_LOG_LIST(state, payload) {
console.log("payload", payload)
// 保存 日志文件
state.log_list = payload;
},
},
});
export default store;
var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/home/home","pages/index/index","pages/index/operLog","pages/synchronization/synchronization","pages/inspection/inspection","pages/inspection/inspFirst","pages/inspection/inspDetail","pages/inspection/sampleTable","pages/inspection/lookInsp","pages/inspection/inspProcess","pages/repair/repair","pages/repair/repairDetail","pages/repair/showRapair","pages/report/report","pages/report/lookReport","pages/report/reportInfo","pages/report/sampleTable","pages/repair/sampleTable","pages/login/login","pages/report/report-detail/deatil_first","pages/index/editPd","pages/home/home","pages/inspectionPage/inspectionPage","pages/inspectionContent/inspectionContent"],"window":{"pageOrientation":"landscape","navigationStyle":"custom","rpxCalcMaxDeviceWidth":2000,"rpxCalcIncludeWidth":750},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"巡检管理","compilerVersion":"4.24","entryPagePath":"pages/home/home","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/home/home","meta":{"isQuit":true},"window":{"navigationBarTitleText":""}},{"path":"/pages/index/index","meta":{},"window":{}},{"path":"/pages/index/operLog","meta":{},"window":{}},{"path":"/pages/synchronization/synchronization","meta":{},"window":{}},{"path":"/pages/inspection/inspection","meta":{},"window":{}},{"path":"/pages/inspection/inspFirst","meta":{},"window":{}},{"path":"/pages/inspection/inspDetail","meta":{},"window":{}},{"path":"/pages/inspection/sampleTable","meta":{},"window":{}},{"path":"/pages/inspection/lookInsp","meta":{},"window":{}},{"path":"/pages/inspection/inspProcess","meta":{},"window":{}},{"path":"/pages/repair/repair","meta":{},"window":{}},{"path":"/pages/repair/repairDetail","meta":{},"window":{}},{"path":"/pages/repair/showRapair","meta":{},"window":{}},{"path":"/pages/report/report","meta":{},"window":{}},{"path":"/pages/report/lookReport","meta":{},"window":{}},{"path":"/pages/report/reportInfo","meta":{},"window":{}},{"path":"/pages/report/sampleTable","meta":{},"window":{}},{"path":"/pages/repair/sampleTable","meta":{},"window":{}},{"path":"/pages/login/login","meta":{},"window":{}},{"path":"/pages/report/report-detail/deatil_first","meta":{},"window":{}},{"path":"/pages/index/editPd","meta":{},"window":{}},{"path":"/pages/inspectionPage/inspectionPage","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/inspectionContent/inspectionContent","meta":{},"window":{"navigationBarTitleText":""}}];
var __uniConfig = {"pages":["pages/home/home","pages/index/index","pages/index/operLog","pages/synchronization/synchronization","pages/inspection/inspection","pages/inspection/inspFirst","pages/inspection/inspDetail","pages/inspection/sampleTable","pages/inspection/lookInsp","pages/inspection/inspProcess","pages/repair/repair","pages/repair/repairDetail","pages/repair/showRapair","pages/report/report","pages/report/lookReport","pages/report/reportInfo","pages/report/sampleTable","pages/repair/sampleTable","pages/login/login","pages/report/report-detail/deatil_first","pages/index/editPd","pages/home/home","pages/inspectionPage/inspectionPage","pages/inspectionContent/inspectionContent","pages/shaftInspection/shaftInspection"],"window":{"pageOrientation":"landscape","navigationStyle":"custom","rpxCalcMaxDeviceWidth":2000,"rpxCalcIncludeWidth":750},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"巡检管理","compilerVersion":"4.24","entryPagePath":"pages/home/home","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/home/home","meta":{"isQuit":true},"window":{"navigationBarTitleText":""}},{"path":"/pages/index/index","meta":{},"window":{}},{"path":"/pages/index/operLog","meta":{},"window":{}},{"path":"/pages/synchronization/synchronization","meta":{},"window":{}},{"path":"/pages/inspection/inspection","meta":{},"window":{}},{"path":"/pages/inspection/inspFirst","meta":{},"window":{}},{"path":"/pages/inspection/inspDetail","meta":{},"window":{}},{"path":"/pages/inspection/sampleTable","meta":{},"window":{}},{"path":"/pages/inspection/lookInsp","meta":{},"window":{}},{"path":"/pages/inspection/inspProcess","meta":{},"window":{}},{"path":"/pages/repair/repair","meta":{},"window":{}},{"path":"/pages/repair/repairDetail","meta":{},"window":{}},{"path":"/pages/repair/showRapair","meta":{},"window":{}},{"path":"/pages/report/report","meta":{},"window":{}},{"path":"/pages/report/lookReport","meta":{},"window":{}},{"path":"/pages/report/reportInfo","meta":{},"window":{}},{"path":"/pages/report/sampleTable","meta":{},"window":{}},{"path":"/pages/repair/sampleTable","meta":{},"window":{}},{"path":"/pages/login/login","meta":{},"window":{}},{"path":"/pages/report/report-detail/deatil_first","meta":{},"window":{}},{"path":"/pages/index/editPd","meta":{},"window":{}},{"path":"/pages/inspectionPage/inspectionPage","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/inspectionContent/inspectionContent","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/shaftInspection/shaftInspection","meta":{},"window":{"navigationBarTitleText":""}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* io读写方法
*
*/
import {
createFileWithPlusIO,
SYNCHRONIZE_DATA_PAD,
setSm2,
} from "./systemCofig";
import moment from "moment";
import store from "../store/index";
//日志类型
export const LOG_TYPE_ENUM = {
login: "登录",
add: "新增成功",
edit: "编辑成功",
darf: "草稿",
delete: "删除",
sys: "同步",
updatePassword: "修改密码",
};
// 生成日志
export const getLogContent = (type, detail = "无") => {
const now_user = store.state.now_user;
let timeStr = moment().format("yyyy-MM-DD HH:MM:ss");
return {
name: now_user.user,
level: "秘密",
user: now_user.user,
module: "其他",
detail,
type,
time: timeStr,
};
};
/**
* 新增日志
* @param {*} content 字符串格式 写入文件
* @returns
*/
export const addLog = (content) => {
return new Promise((resolve, reject) => {
const now_user = store.state.now_user;
let timeStr = moment().format("yyyy-MM-DD");
let fileName = `${now_user.user}${timeStr}.txt`;
const fileContent = JSON.stringify(content); // 方便验证
// const fileContent = setSm2(content) // 正式使用
console.log('-fileContent-', fileContent)
createFileWithPlusIO(
`${SYNCHRONIZE_DATA_PAD}/日志文件`,
fileName,
fileContent
).then((res) => {
// console.log("---写入成功", res);
resolve();
});
});
};
// 读取日志
export const getLog = () => {};
// 写入草稿文件
export const writeDarf = (content) => {
return new Promise((resolve, reject) => {
const now_user = store.state.now_user;
let fileName = `${now_user.user}.txt`;
const fileContent = JSON.stringify(content);
createFileWithPlusIO(
`${SYNCHRONIZE_DATA_PAD}/草稿文件/`,
fileName,
fileContent
).then((res) => {
// console.log("---写入成功", res);
resolve();
});
})
}
\ No newline at end of file
......@@ -220,6 +220,23 @@ export const pad_1_1_inspection_items = {
"isDefault": "N",
"status": "0",
"default": false
},
{
"createBy": "admin",
"createTime": "2024-09-05 15:50:28",
"updateBy": null,
"updateTime": null,
"remark": null,
"dictCode": 1275,
"dictSort": 11,
"dictLabel": "清洁",
"dictValue": "11",
"dictType": "pad_1_1_inspection_items",
"cssClass": null,
"listClass": "default",
"isDefault": "N",
"status": "0",
"default": false
}
],
"code": 200,
......@@ -514,6 +531,23 @@ export const pad_1_2_inspection_items = {
"isDefault": "N",
"status": "0",
"default": false
},
{
"createBy": "admin",
"createTime": "2024-09-05 15:50:28",
"updateBy": null,
"updateTime": null,
"remark": null,
"dictCode": 1275,
"dictSort": 11,
"dictLabel": "清洁",
"dictValue": "11",
"dictType": "pad_1_1_inspection_items",
"cssClass": null,
"listClass": "default",
"isDefault": "N",
"status": "0",
"default": false
}
],
"code": 200,
......@@ -757,6 +791,23 @@ export const pad_1_3_inspection_items = {
"isDefault": "N",
"status": "0",
"default": false
},
{
"createBy": "admin",
"createTime": "2024-09-05 15:50:28",
"updateBy": null,
"updateTime": null,
"remark": null,
"dictCode": 1275,
"dictSort": 11,
"dictLabel": "清洁",
"dictValue": "11",
"dictType": "pad_1_1_inspection_items",
"cssClass": null,
"listClass": "default",
"isDefault": "N",
"status": "0",
"default": false
}
],
"code": 200,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论