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

fix:井道完成

上级 38f620e9
......@@ -15,11 +15,24 @@ uni-page-head .uni-btn-icon {
}
.uni-nav-bar-right-text{
.uni-nav-bar-right-text {
font-size: 14px !important;
}
.uni-navbar-btn-text>text{
.uni-nav-bar-text {
height: 28.8px;
width: 28.8px;
background: #ffffff;
border: 0.32px solid rgba(224, 224, 224, 1);
border-radius: 14.4px;
color: #333;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.uni-navbar-btn-text>text {
font-size: 14px !important;
}
......@@ -45,7 +58,7 @@ uni-page-head .uni-btn-icon {
}
.uni-navbar__header {
padding: 0 32px !important;
padding: 0 25.6px !important;
/* padding-right: 18px !important; */
}
......
<template>
<view>
<view class="canvas-container">
<canvas canvas-id="canvas" id="canvas" :disable-scroll="true" style="width: 100%; height: 200px;background-color: #FFFFFF;"
@touchstart="handleTouchStart($event)" @touchmove="handleTouchMove($event)" @touchend="handleTouchEnd($event)"
@touchcancel="handleEnd($event)"></canvas>
</view>
<view class="btn-container">
<button class="cu-btn lg bg-blue" @click="handleConfirm()">确定</button>
<button class="cu-btn lg line-gray" @click="reset()">重置</button>
</view>
</view>
</template>
<script>
var context = null
export default {
props: {
dialogVisiable: {
type: Boolean,
default: false
}
},
data() {
return {
canvasData: []
};
},
watch: {
dialogVisiable() {
if (this.dialogVisiable === true) {
context = uni.createCanvasContext('canvas')
context.setLineWidth(3)
context.setStrokeStyle("#000000")
this.reset()
}
},
canvasData() {
context.moveTo(this.canvasData[0].x, this.canvasData[0].y)
for (let i = 0; i < this.canvasData.length; i++) {
context.lineTo(this.canvasData[i].x, this.canvasData[i].y)
}
context.stroke()
context.draw(true)
}
},
methods: {
reset() {
context.draw()
},
hideModal() {
this.$emit('update:dialogVisiable', false)
},
handleTouchStart(e) {
this.canvasData = []
const a = e.changedTouches[0]
this.canvasData.push({
x: a.x,
y: a.y
})
},
handleTouchMove(e) {
const a = e.changedTouches[0]
this.canvasData.push({
x: a.x,
y: a.y
})
},
handleTouchEnd(e) {
const a = e.changedTouches[0]
this.canvasData.push({
x: a.x,
y: a.y
})
},
handleEnd() {
context.stroke()
context.draw(true)
},
handleConfirm() {
uni.canvasToTempFilePath({
canvasId: 'canvas',
success: res => {
this.$emit('success', res.tempFilePath)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.canvas-container {
width: 400px;
}
.btn-container {
padding-bottom: 20rpx;
display: flex;
justify-content: space-around;
}
</style>
import Signature from './components/jackyq-signature.vue'
export default Signature
\ No newline at end of file
<template>
<!-- 巡检管理 -->
<view class="inspection-management">
<uni-nav-bar :fixed="true" background-color="rgba(214, 240, 255, 0.0)" status-bar rightWidth="300">
<uni-nav-bar
:fixed="true"
background-color="rgba(214, 240, 255, 0.0)"
status-bar
rightWidth="300"
>
<block slot="left">
<view class="uni-nav-bar-text" @click="back">
<text class="iconfont icon-Arrow-Left"></text>
......@@ -26,13 +31,21 @@
<view class="month-list">
<!-- 每月记录 -->
<view class="month-record-item" v-for="(item, index) in list" :key="index">
<view
class="month-record-item"
v-for="(item, index) in list"
:key="index"
>
<view v-if="(item.list || []).length" class="seconed-title">
{{ item.submitTime || item.time}}
{{ item.submitTime || item.time }}
</view>
<view class="inspect-list">
<InspectionItem v-for="ele in item.list" :key="ele.uid" :details="ele" />
<InspectionItem
v-for="ele in item.list"
:key="ele.uid"
:details="ele"
/>
</view>
</view>
......@@ -46,17 +59,13 @@
</template>
<script>
import SearchCom from "@/components/searchCom/index.vue";
import InspectionItem from "@/components/inspectionItem/index.vue";
import {
getDarft
} from "@/request/index.js";
import {
getAllInspections
} from "@/request/index.js";
import Empty from "@/components/empty/index.vue";
import SearchCom from "@/components/searchCom/index.vue";
import InspectionItem from "@/components/inspectionItem/index.vue";
import { getDarft } from "@/request/index.js";
import { getAllInspections } from "@/request/index.js";
import Empty from "@/components/empty/index.vue";
export default {
export default {
components: {
SearchCom,
InspectionItem,
......@@ -98,7 +107,6 @@
userInfo() {
return this.$store.state.now_user || {};
},
},
methods: {
// 返回
......@@ -114,15 +122,12 @@
uni.navigateTo({
url: "/pages/shaftInspection/shaftInspectionNew",
});
}
},
init() {
const all_data = this.all_data || [];
const {
inspectionTime = []
} = this.searchForm;
const { inspectionTime = [] } = this.searchForm;
const startTime = inspectionTime[0];
const endTime = inspectionTime[1];
......@@ -132,13 +137,13 @@
return true;
} else {
return (
new Date(startTime).getTime() <= new Date(item.submitTime).getTime() &&
new Date(startTime).getTime() <=
new Date(item.submitTime).getTime() &&
new Date(item.submitTime).getTime() <= new Date(endTime).getTime()
);
}
});
// 属于同一个月的数据 聚合
const tempAllData = {};
timeFrame.forEach((item) => {
......@@ -165,23 +170,28 @@
});
this.list = list;
console.log("this.list",this.list)
console.log("this.list", this.list);
},
coverData(arr = []) {
console.log("arr",arr)
const {
isException = "",
inspectionType = "",
synchronization = "",
} = this.searchForm;
return arr.filter((item) => {
return (
(!isException || isException == "all" || item.isException == isException) &&
(!inspectionType || inspectionType == "all" || item.inspectionType == inspectionType) &&
(!synchronization || synchronization == "all" || item.synchronization == synchronization)
(!isException ||
isException == "all" ||
item.isException == isException) &&
(!inspectionType ||
inspectionType == "all" ||
item.inspectionType == inspectionType) &&
(!synchronization ||
synchronization == "all" ||
item.synchronization == synchronization)
);
});
},
......@@ -230,93 +240,83 @@
});
},
},
};
};
</script>
<style scoped lang="less">
/* 导航栏样式 */
.uni-nav-bar-text {
height: 36px;
width: 36px;
.uni-nav-bar-text {
height: 28.8px;
width: 28.8px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 18px;
border-radius: 50%;
border: 0.32px solid rgba(224, 224, 224, 1);
border-radius: 14.4px;
color: #333;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
.iconfont {
font-size: 20px;
line-height: 36px;
}
}
.nav-right {
width: 240px;
font-size: 16px;
line-height: 28.8px;
}
.header-buttons {
}
.nav-right {
width: 192px;
}
.header-buttons {
display: flex;
align-items: center;
margin-left: auto; // 将按钮组推到最右侧
margin-left: auto;
.button {
width: 112px;
height: 36px;
background: #FFFFFF;
border-radius: 18px;
margin-left: 16px;
width: 89.6px;
height: 28.8px;
background: #ffffff;
border-radius: 14.4px;
margin-left: 12.8px;
font-family: PingFangSC-Regular;
font-size: 16px;
font-size: 12.8px;
color: #000000;
line-height: 36px;
line-height: 28.8px;
font-weight: 400;
border: 0;
}
}
.inspection-management {
background-image: linear-gradient(115deg, #E8F0FB 0%, #E1EBFA 100%);
padding: 0 32px;
}
.inspection-management {
background-image: linear-gradient(115deg, #e8f0fb 0%, #e1ebfa 100%);
padding: 0 25.6px;
.inspection-management-content {
.count-tatal {
font-family: PingFangSC-Medium;
margin: 16px 0px 24px;
font-size: 14px;
margin: 12.8px 0px 19.2px;
font-size: 11.2px;
color: #4a4a4a;
font-weight: 400;
height: 28px;
line-height: 28px;
height: 22.4px;
line-height: 22.4px;
.num {
font-size: 20px;
font-size: 16px;
color: #3774f6;
line-height: 28px;
line-height: 22.4px;
font-weight: 500;
margin-right: 2px;
margin-right: 1.6px;
}
}
.month-list {
height: calc(100vh - 26px - 16px - 8px - 36px - 62px);
height: calc(100vh - 20.8px - 12.8px - 6.4px - 28.8px - 49.6px - 25px);
overflow: auto;
padding-bottom: 140px;
// padding-bottom: 112px;
.seconed-title {
font-size: 20px;
font-size: 16px;
color: #000000;
line-height: 28px;
line-height: 22.4px;
font-weight: 500;
margin-bottom: 12px;
margin-bottom: 9.6px;
}
.month-record-item {
margin-bottom: 24px;
margin-bottom: 19.2px;
&:last-of-type {
margin: 0;
}
.inspect-list {
display: flex;
flex-wrap: wrap;
......@@ -325,21 +325,20 @@
}
}
}
.inspection-button {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 60px;
width: 240px;
height: 48px;
bottom: 48px;
width: 192px;
height: 38.4px;
left: 50%;
color: #fff;
transform: translateX(-50%);
background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%);
box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24);
border-radius: 27px;
}
box-shadow: 0px 8px 19.2px 0px rgba(51, 104, 246, 0.24);
border-radius: 21.6px;
}
}
</style>
......@@ -330,8 +330,10 @@ export default {
background: #ffffff;
border: 0.32px solid rgba(224, 224, 224, 1);
border-radius: 14.4px;
border-radius: 50%;
color: #333;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
.iconfont {
......
......@@ -280,21 +280,6 @@ export default {
<style lang="less" scoped>
/* 导航栏样式 */
.uni-nav-bar-text {
height: 28.8px;
width: 28.8px;
background: #ffffff;
border: 0.32px solid rgba(224, 224, 224, 1);
border-radius: 14.4px;
border-radius: 50%;
color: #333;
text-align: center;
.iconfont {
font-size: 16px;
line-height: 28.8px;
}
}
.nav-right {
width: 192px;
......
<template>
<!-- 井道巡检操作 -->
<view class="container">
<uni-nav-bar :fixed="true" background-color="rgba(214, 240, 255, 0.0)" status-bar rightWidth="300">
<uni-nav-bar
:fixed="true"
background-color="rgba(214, 240, 255, 0.0)"
status-bar
rightWidth="300"
>
<block slot="left">
<view class="uni-nav-bar-text" @click="back">
<text class="iconfont icon-Arrow-Left"></text>
......@@ -12,85 +17,98 @@
<view class="profile-box">
<view class="profile-left">
<view class="avatar">
<image src="@/static/img/add-img/home1.png" mode="aspectFit"></image>
<image
src="@/static/img/add-img/home1.png"
mode="aspectFit"
></image>
</view>
<view class="info">
<view class="username">井道巡检</view>
<view class="number">位置:<text class="value">{{ location }}</text></view>
<view class="number"
>位置:<text class="value">{{ location }}</text></view
>
</view>
</view>
</view>
</view>
<!-- 模块1:巡检井道 -->
<!-- <view class="module">
<view class="title-bar">
<view class="blue-line"></view>
<text class="title">巡检井道</text>
<text class="location">{{ location }}{{floor}}</text>
<button class="submit-btn" :class="{ active: isSubmitEnabled }" :disabled="!isSubmitEnabled" @click="submit">
完成当前机房全部巡检
</button>
</view>
</view> -->
<!-- 模块2:巡检说明 -->
<!-- <view class="module">
<view class="title-bar">
<view class="blue-line"></view>
<text class="title">巡检说明</text>
</view>
<text class="description">{{ randomDescription }}</text>
</view> -->
<!-- 模块3:Tab 操作区域 -->
<view class="module">
<view class="tab-buttons">
<view v-for="(tab, index) in tabs" :key="index" :class="['tab-item', { active: activeTab === index }]"
@click="switchTab(index)">
<view
v-for="(tab, index) in tabs"
:key="index"
:class="['tab-item', { active: activeTab === index }]"
@click="switchTab(index)"
>
<image :src="tab.icon" class="tab-icon"></image>
<text class="tab-text">{{ tab.label }}</text>
<view v-if="activeTab === index" class="underline"></view>
</view>
</view>
<view class="tip">
<image class="tip-icon" src="@/static/img/add-img/home1.png" mode="aspectFit"></image>请点击“需巡检井道”执行巡检
<image
class="tip-icon"
src="@/static/img/add-img/home1.png"
mode="aspectFit"
></image
>请点击“需巡检井道”执行巡检
</view>
<view class="tab-content">
<!-- 操作区域 -->
<view class="form-item"><text class="form-label">巡检项</text>
<view class="form-item"
><text class="form-label">巡检项</text>
<view class="label">
<text>{{ tabs[activeTab].label }}</text>
</view>
</view>
<view class="form-item">
<text class="form-label"><text class="required">*</text>巡检结论</text>
<text class="form-label"
><text class="required">*</text>巡检结论</text
>
<view class="switch-container">
<view :class="['status-btn', { active: inspectionResult === 0 }]" @click="setInspectionResult(0)">
<view
:class="['status-btn', { active: inspectionResult === 0 }]"
@click="setInspectionResult(0)"
>
正常
</view>
<view :class="['status-btn', { active: inspectionResult === 1 }]" @click="setInspectionResult(1)">
<view
:class="['status-btn', { active: inspectionResult === 1 }]"
@click="setInspectionResult(1)"
>
异常
</view>
</view>
</view>
<view class="form-item">
<text class="form-label"><text class="required">*</text>情况摘要</text>
<input class="input-box" v-model="list[activeTab] && list[activeTab].conclusion" placeholder="请输入情况摘要" />
<text class="form-label"
><text class="required">*</text>情况摘要</text
>
<input
class="input-box"
v-model="list[activeTab] && list[activeTab].conclusion"
placeholder="请输入情况摘要"
/>
</view>
<view class="form-item">
<text class="form-label">现场照片</text>
<view class="photo-box">
<view class="photo-container">
<view @click="takePhoto" class="photo-btn"> + </view>
<view v-for="(photo, index) in list[activeTab] &&
list[activeTab].photos" :key="index" class="photo-item">
<view
v-for="(photo, index) in list[activeTab] &&
list[activeTab].photos"
:key="index"
class="photo-item"
>
<image :src="photo" class="photo"></image>
<text class="delete-photo" @click="deletePhoto(index)">×</text>
</view>
</view>
<view class="photo-limit">请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view>
<view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
>
</view>
</view>
</view>
......@@ -103,15 +121,18 @@
完成
</button>
</view> -->
<view class="module submit-module">
<view class="submit-module">
<button class="action-btn" @click="submit(0)">暂存</button>
<button v-if="isSubmitEnabled" class="action-btn complete-btn" @click="submit">
<button
v-if="isSubmitEnabled"
class="action-btn complete-btn"
@click="submit(1)"
>
完成巡检
</button>
<button v-else class="action-btn complete-btn" @click="closePopup">
<button v-else class="action-btn complete-btn" @click="nextTab">
下一项
</button>
<button class="action-btn complete-btn" @click="submit(1)">完成</button>
</view>
<!-- 使用 uni-popup 组件 完成弹窗 -->
<uni-popup ref="popup" type="center">
......@@ -133,27 +154,24 @@
</template>
<script>
import {
import {
pad_2_1_inspection_items,
pad_2_1_inspection_position,
pad_2_1_floor,
} from "@/utils/dict.js"; //巡检位置,A座到F座 楼层2楼4楼到26楼
import {
} from "@/utils/dict.js"; //巡检位置,A座到F座 楼层2楼4楼到26楼
import {
addLog,
getLogContent,
LOG_TYPE_ENUM,
writeDarf,
writeInspectionData,
} from "@/utils/IoReadingAndWriting.js";
} from "@/utils/IoReadingAndWriting.js";
import {
getInspectionDetails,
getDarft
} from "@/request/index.js";
import moment from "moment";
import _ from 'lodash';
import { getInspectionDetails, getDarft } from "@/request/index.js";
import moment from "moment";
import _ from "lodash";
export default {
export default {
data() {
return {
location: "",
......@@ -163,7 +181,8 @@
isSubmitEnabled: false, // 提交按钮是否可点击
uid: "",
randomDescription: "这是一段随机说明文字。", // 随机说明文字
tabs: [{
tabs: [
{
label: "门禁",
icon: "../../static/img/add-img/home1.png",
},
......@@ -252,12 +271,15 @@
.then((res) => {
const detailsInfo = res;
console.log("getDetails", res);
let list = detailsInfo.originData[this.value - 1].position[this.dictValue - 1].details;
let list =
detailsInfo.originData[this.value - 1].position[this.dictValue - 1]
.details;
// 未巡检需要处理默认数据结构
if (list && list.length) {
this.list = list
this.list = list;
}
console.log("let list", list)
this.inspectionResult = list[0].inspectionResult
console.log("let list", list);
this.detailsInfo = detailsInfo;
console.log("获取list", this.list);
......@@ -340,22 +362,22 @@
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
filePath,
function(entry) {
function (entry) {
entry.file(
function(file) {
function (file) {
const reader = new plus.io.FileReader();
reader.onloadend = function(evt) {
reader.onloadend = function (evt) {
const base64 = evt.target.result; // 获取 Base64 数据
resolve(base64); // 返回 Base64 数据
};
reader.readAsDataURL(file); // 读取文件并转换为 Base64
},
function(error) {
function (error) {
reject("获取文件对象失败:" + error.message);
}
);
},
function(error) {
function (error) {
reject("解析文件路径失败:" + error.message);
}
);
......@@ -369,25 +391,36 @@
// 处理提交数据
getParams(isSubmit) {
if (this.uid) {
let posItem = this.detailsInfo.originData[this.value - 1].position[this.dictValue - 1]
posItem.details = this.list
posItem.isSubmit = isSubmit
let posItem =
this.detailsInfo.originData[this.value - 1].position[
this.dictValue - 1
];
posItem.details = this.list;
posItem.isSubmit = isSubmit;
// 提交才会有巡检状态,暂存没有
if (isSubmit) {
if (!this.checkInspectionResult(this.list)) {
posItem.status = 2; //1表示已经巡检过有异常
posItem.statusLable = "巡检异常"
posItem.statusLable = "巡检异常";
} else {
posItem.status = 1; //1表示已经巡检过没有异常
posItem.statusLable = "已巡检"
}
let {
notZeroCount,
equalTwoCount
} = this.count(this.detailsInfo.originData)
this.detailsInfo.inspectionNumber = notZeroCount //巡检总数
this.detailsInfo.isException = equalTwoCount //异常数量
this.detailsInfo.isSubmit = this.typeSubmit(this.detailsInfo.originData) > 0 ? 0 : 1, //是否提交
posItem.statusLable = "已巡检";
}
} else {
posItem.status = 0; //暂存就是未巡检
posItem.statusLable = "未巡检";
}
let { notZeroCount, equalTwoCount } = this.count(
this.detailsInfo.originData
);
this.detailsInfo.inspectionNumber = notZeroCount; //巡检总数
this.detailsInfo.isException = equalTwoCount; //异常数量
this.detailsInfo.isSubmit =
this.typeSubmit(this.detailsInfo.originData) > 0 ? 0 : 1; //是否提交
console.log("this.detailsInfo", this.detailsInfo);
this.detailsInfo.submitTime = moment().format("yyyy-MM-DD"); // 记录提交时间
this.detailsInfo.submitMonth = moment().format("yyyy-MM"); // 记录提交月份
this.detailsInfo.synchronization = 2 //编辑中
return this.detailsInfo;
} else {
let baseInfo = this.baseInfo;
......@@ -402,30 +435,27 @@
descript: "检查内容包括门禁、卫生、设备告警。",
};
});
let tabList = JSON.parse(JSON.stringify(dataObj))
let posItem = tabList[this.value - 1].position[this.dictValue - 1]
console.log("posItem", posItem);
let tabList = JSON.parse(JSON.stringify(dataObj));
let posItem = tabList[this.value - 1].position[this.dictValue - 1];
posItem.details = this.list;
posItem.isSubmit = isSubmit //当前项是否提交
console.log("this.list", this.list)
posItem.isSubmit = isSubmit; //当前项是否提交
if (!this.checkInspectionResult(this.list)) {
posItem.status = 2; //1表示已经巡检过有异常
posItem.statusLable = "巡检异常"
posItem.statusLable = "巡检异常";
} else {
posItem.status = 1; //1表示已经巡检过没有异常
posItem.statusLable = "已巡检"
posItem.statusLable = "已巡检";
}
console.log("this.tabList", tabList);
// 根据获取到的每个井道的isSubmit来判断是否有暂存状态
let typeSubmit = this.typeSubmit(tabList)
// 根据获取到的每个井道的isSubmit来判断是否有暂存状态,只有有一个井道是暂存,那就是编辑中、暂存状态
let typeSubmit = this.typeSubmit(tabList);
const data = {
...baseInfo,
isSubmit: typeSubmit > 0 ? 0 : 1, //0暂存 1提交
isSubmit: typeSubmit > 0 ? 0 : 1, //0暂存(编辑中) 1提交(待同步,已同步)
inspectionNumber: 1,
isException: posItem.status == 2 ? 1 : 0,
items: [],
synchronization: 0, // 是否同步过
synchronization: typeSubmit > 0 ? 2 : 0, // 是否同步过
submitTime: moment().format("yyyy-MM-DD"), // 记录提交时间
submitMonth: moment().format("yyyy-MM"), // 记录提交月份
originData: tabList, //所有大楼和楼层的数据
......@@ -446,89 +476,31 @@
}
});
return acc;
}, {
},
{
notZeroCount: 0,
equalTwoCount: 0
equalTwoCount: 0,
} // 初始化统计结果
);
},
typeSubmit(originData) {
return originData.reduce((acc, curr) => {
return acc + curr.position.reduce((innerAcc, innerCurr) => {
return (
acc +
curr.position.reduce((innerAcc, innerCurr) => {
return innerCurr.status === 0 ? innerAcc + 1 : innerAcc;
}, 0);
}, 0)
);
}, 0);
},
// 检查是否存在异常
checkInspectionResult(arr) {
return !arr.some((obj) => obj.inspectionResult === 1);
},
// 检查所有Tab 的必填项是否填写完整
isAllTabValid() {
const data = this.list;
// 校验函数
const validateData = (data) => {
return data.every(
(item) =>
item.inspectionResult !== null && item.conclusion.trim() !== ""
);
};
// 调用校验函数
const isValid = validateData(data);
console.log(141, isValid);
return isValid;
},
// 检查当前 Tab 的必填项是否填写完整
isCurrentTabValid() {
const currentTabData = this.list[this.activeTab];
console.log("currentTabData", currentTabData);
return (
currentTabData.inspectionResult !== null && // 巡检结论必填
currentTabData.conclusion.trim() !== "" // 情况摘要必填
// 现场照片为非必填项,不做校验
);
},
// 暂存
saveDraft(isSave = true) {
return new Promise((resolve, reject) => {
if (isSave) {
// 写入草稿文件 更新 store 草稿内容
const params = this.getParams();
console.log("params", params);
params.isSubmit = 0;
this.$store.commit("SET_DARF_DATA", params); // 缓存[巡检信息]
writeDarf(params).then((res) => {
console.log("写入草稿文件成功");
uni.showToast({
icon: "success",
title: "保存草稿成功",
});
});
// 新增日志信息
const logContent = getLogContent(
LOG_TYPE_ENUM.darf,
`${params.recordName}(${params.inspectionCode})`,
"巡检模块"
);
const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {
console.log("日志文件写入成功");
});
}
resolve();
});
},
// 提交
submit(isSubmit = 1) {
// 校验是否通过
if (isSubmit && !this.isCurrentTabValid()) {
if (isSubmit && !this.isAllTabValid()) {
uni.showToast({
title: "请填写完整必填项",
icon: "none",
......@@ -539,7 +511,7 @@
const all_data = this.$store.state.all_data; //获取全部数据
let logContent = "";
console.log("this.uid", this.uid);
console.log("all_data", all_data)
console.log("all_data", all_data);
if (this.uid) {
const index = all_data.findIndex((element) => element.uid == this.uid);
params.uid = this.uid;
......@@ -561,7 +533,7 @@
}
// 更新巡检list
const userInfo = this.userInfo;
console.log("all_data存储", all_data)
console.log("all_data存储", all_data);
this.$store.commit("SET_ALL_DATA", all_data);
const inspectList = all_data.filter(
(item) => item.createByName == userInfo.user
......@@ -579,29 +551,57 @@
console.log("日志文件写入成功");
});
// 清空草稿数据
// this.$store.commit("SET_DARF_DATA", {}); // 缓存[巡检信息]
// writeDarf("").then((res) => {
// console.log("写入草稿文件成功");
// });
// 清空基础缓存信息
this.$store.commit("SET_TEMP_DATA", {}); // 缓存[巡检信息]
// const historyData = {
// location: this.location,
// randomDescription: this.randomDescription,
// tabData: this.list,
// firstSubmitTime: this.firstSubmitTime,
// };
// uni.setStorageSync("inspectionHistory", historyData);
uni.showToast({
title: `${isSubmit}?'提交成功':'保存草稿成功'`,
title: isSubmit ? "提交成功" : "保存草稿成功",
icon: "success",
});
uni.navigateTo({
url: "/pages/inspectionManagement/index",
});
},
// 检查所有Tab 的必填项是否填写完整
isAllTabValid() {
const data = this.list;
// 校验函数
const validateData = (data) => {
return data.every(
(item) =>
item.inspectionResult !== null && item.conclusion.trim() !== ""
);
};
// 调用校验函数
const isValid = validateData(data);
console.log(141, isValid);
return isValid;
},
// 检查当前 Tab 的必填项是否填写完整
isCurrentTabValid() {
const currentTabData = this.list[this.activeTab];
console.log("currentTabData", currentTabData);
return (
currentTabData.inspectionResult !== null && // 巡检结论必填
currentTabData.conclusion.trim() !== "" // 情况摘要必填
// 现场照片为非必填项,不做校验
);
},
// 下一项
nextTab() {
console.log(5215415, this.isCurrentTabValid());
if (!this.isCurrentTabValid()) {
uni.showToast({
title: "请填写完整必填项",
icon: "none",
});
return false;
}
if (this.activeTab === 2) {
this.isSubmitEnabled = true;
} else {
this.switchTab(this.activeTab + 1);
}
},
// 切换 Tab
switchTab(index) {
this.activeTab = index;
......@@ -621,37 +621,40 @@
this.switchTab((this.activeTab + 1) % this.tabs.length);
},
},
};
};
</script>
<style scoped lang="less">
/* 导航栏样式 */
.uni-nav-bar-text {
height: 36px;
width: 36px;
.uni-nav-bar-text {
height: 28.8px;
width: 28.8px;
background: #ffffff;
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 18px;
border: 0.32px solid rgba(224, 224, 224, 1);
border-radius: 14.4px;
color: #333;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
.iconfont {
font-size: 20px;
line-height: 36px;
}
font-size: 16px;
line-height: 28.8px;
}
}
.container {
padding: 24px;
}
.container {
padding: 19.2px;
height: calc(100vh - 115px);
}
.profile-section {
.profile-section {
width: 100%;
margin-bottom: 12.8px;
margin-bottom: 10.24px;
.profile-box {
background-color: #fff;
border-radius: 9.6px;
padding: 12.8px 25.6px;
border-radius: 7.68px;
padding: 10.24px 20.48px;
display: flex;
justify-content: space-between;
align-items: center;
......@@ -662,11 +665,11 @@
.avatar {
position: relative;
width: 40.5px;
height: 40.5px;
width: 32.4px;
height: 32.4px;
border-radius: 50%;
overflow: hidden;
margin-right: 9px;
margin-right: 7.2px;
image {
width: 100%;
......@@ -680,28 +683,28 @@
right: 0;
background-color: rgba(0, 0, 0, 0.5);
text-align: center;
height: 17.6px;
height: 14.08px;
font-family: PingFangSC-Regular;
font-size: 9.6px;
font-size: 7.68px;
color: #ffffff;
line-height: 16px;
line-height: 12.8px;
font-weight: 400;
}
}
.info {
.username {
font-size: 16px;
font-size: 12.8px;
color: #000000;
line-height: 22.4px;
line-height: 17.92px;
font-weight: 500;
margin-bottom: 7.2px;
margin-bottom: 5.76px;
}
.number {
font-size: 12.8px;
font-size: 10.24px;
color: #4a4a4a;
line-height: 22.4px;
line-height: 17.92px;
font-weight: 400;
.value {
......@@ -711,114 +714,109 @@
}
}
}
}
}
.module {
.module {
background: #ffffff;
border-radius: 12px;
padding: 16px 25px;
}
height: 100%;
border-radius: 9.6px;
padding: 12.8px 20px;
}
.title-bar {
.title-bar {
display: flex;
align-items: center;
margin-bottom: 10px;
margin-bottom: 8px;
.blue-line {
width: 4px;
height: 16px;
width: 3.2px;
height: 12.8px;
background-color: #007aff;
margin-right: 8px;
margin-right: 6.4px;
}
.title {
font-size: 16px;
font-size: 12.8px;
font-weight: bold;
}
.location {
margin-left: 8px;
margin-left: 6.4px;
color: #666;
}
.submit-btn {
position: absolute;
right: 24px;
right: 19.2px;
width: 20%;
background-color: #ccc;
color: #fff;
border-radius: 4px;
padding: 4px 8px;
font-size: 12px;
border-radius: 3.2px;
padding: 3.2px 6.4px;
font-size: 9.6px;
&.active {
background-color: #007aff;
}
}
}
}
.description {
font-size: 14px;
.description {
font-size: 11.2px;
color: #666;
}
}
.tab-buttons {
.tab-buttons {
display: flex;
justify-content: flex-start;
/* 左对齐 */
align-items: center;
margin-bottom: 10px;
gap: 20px;
/* Tab 之间的间隔 */
/* 容器内边距 */
}
margin-bottom: 8px;
gap: 16px;
}
.tip {
.tip {
width: 100%;
height: 34px;
height: 27.2px;
background: rgba(55, 116, 246, 0.05);
border: 1px solid rgba(55, 116, 246, 0.3);
border-radius: 10px;
font-size: 14px;
border: 0.8px solid rgba(55, 116, 246, 0.3);
border-radius: 8px;
font-size: 11.2px;
color: #4a4a4a;
letter-spacing: 0;
line-height: 34px;
line-height: 27.2px;
font-weight: 400;
padding: 0 12px;
padding: 0 9.6px;
.tip-icon {
width: 14px;
height: 14px;
margin-right: 8px;
}
width: 11.2px;
height: 11.2px;
margin-right: 6.4px;
}
}
.tab-item {
.tab-item {
display: flex;
align-items: flex-start;
position: relative;
padding: 8px 0;
/* 上下内边距 */
padding: 6.4px 0;
cursor: pointer;
white-space: nowrap;
/* 防止文字换行 */
.tab-icon {
width: 10.5px;
height: 10.5px;
margin-bottom: 4px;
margin-right: 3px;
width: 8.4px;
height: 8.4px;
margin-bottom: 3.2px;
margin-right: 2.4px;
}
.tab-text {
font-size: 14px;
font-size: 11.2px;
color: #333;
}
&.active {
.tab-text {
color: #3774f6;
/* 选中时的文字颜色 */
}
.underline {
......@@ -827,133 +825,133 @@
left: 50%;
transform: translateX(-50%);
width: 100%;
/* 横线宽度与内容一致 */
height: 2px;
height: 1.6px;
background-color: #3774f6;
/* 选中时的横线颜色 */
}
}
}
}
.form-item {
.form-item {
display: flex;
align-items: center;
padding: 12px 0;
line-height: 36px;
border-bottom: 1px solid #f2f3f5;
padding: 9.6px 0;
line-height: 28.8px;
border-bottom: 0.8px solid #f2f3f5;
.form-label {
font-size: 14px;
font-size: 11.2px;
font-weight: bold;
margin-right: 32px;
width: 73px;
margin-right: 25.6px;
width: 58.4px;
text-align: right;
.required {
color: red;
margin-right: 4px;
margin-right: 3.2px;
}
}
.switch-container {
display: flex;
gap: 12px;
/* 按钮之间的间隔 */
gap: 9.6px;
.status-btn {
flex: 1;
/* 按钮宽度平分 */
padding: 7px 24px;
font-size: 16px;
padding: 5.6px 19.2px;
font-size: 12.8px;
color: #000000;
background: #f2f2f2;
text-align: center;
font-weight: 400;
line-height: 22px;
border-radius: 18px;
line-height: 17.6px;
border-radius: 14.4px;
&.active {
color: #ffffff;
background: #3774f6;
border: 0.4px solid rgba(224, 224, 224, 1);
border: 0.32px solid rgba(224, 224, 224, 1);
}
}
}
.input-box {
flex: 1;
border-radius: 4px;
font-size: 16px;
line-height: 24px;
border-radius: 3.2px;
font-size: 12.8px;
line-height: 19.2px;
}
.photo-limit {
font-size: 16px;
font-size: 12.8px;
color: #959595;
line-height: 24px;
line-height: 19.2px;
font-weight: 400;
}
.photo-container {
display: flex;
flex-wrap: wrap;
margin-bottom: 8px;
margin-bottom: 6.4px;
.photo-item {
position: relative;
margin-right: 8px;
margin-bottom: 8px;
margin-right: 6.4px;
margin-bottom: 6.4px;
.photo {
width: 72px;
height: 72px;
border-radius: 4px;
margin-left: 12px;
width: 57.6px;
height: 57.6px;
border-radius: 3.2px;
margin-left: 9.6px;
}
.delete-photo {
position: absolute;
top: -8px;
right: -8px;
top: -6.4px;
right: -6.4px;
background-color: #ff4d4f;
color: #fff;
width: 16px;
height: 16px;
width: 12.8px;
height: 12.8px;
border-radius: 50%;
text-align: center;
line-height: 16px;
font-size: 12px;
line-height: 12.8px;
font-size: 9.6px;
}
}
}
.photo-btn {
background: #ffffff;
border: 0.34px solid rgba(221, 221, 221, 1);
border-radius: 2.05px;
width: 72px;
height: 72px;
font-size: 72px;
border: 0.272px solid rgba(221, 221, 221, 1);
border-radius: 1.64px;
width: 57.6px;
height: 57.6px;
font-size: 57.6px;
color: #cccccc;
text-align: center;
line-height: 64px;
}
line-height: 51.2px;
}
}
.submit-module {
.submit-module {
display: flex;
justify-content: center;
gap: 20px;
position: fixed;
gap: 16px;
left: 50%;
transform: translateX(-50%);
bottom: 25.6px;
.action-btn {
width: 182px;
height: 48px;
line-height: 48px;
width: 145.6px;
height: 38.4px;
line-height: 38.4px;
background: #ffffff;
border: 1px solid rgba(224, 224, 224, 1);
box-shadow: 0px 10px 24px 0px rgba(185, 185, 185, 0.24);
border-radius: 27px 24px 24px 27px;
font-size: 20px;
border: 0.8px solid rgba(224, 224, 224, 1);
box-shadow: 0px 8px 19.2px 0px rgba(185, 185, 185, 0.24);
border-radius: 21.6px 19.2px 19.2px 21.6px;
font-size: 16px;
color: #000000;
text-align: center;
font-weight: 400;
......@@ -963,52 +961,46 @@
color: #ffffff;
}
}
}
}
// 弹窗内容样式
.popup-content {
.popup-content {
background-color: white;
padding: 40px;
border-radius: 10px;
padding: 32px;
border-radius: 8px;
text-align: center;
position: relative;
width: 300px;
width: 240px;
// 关闭按钮样式
.close-icon {
position: absolute;
top: 10px;
right: 10px;
font-size: 20px;
top: 8px;
right: 8px;
font-size: 16px;
cursor: pointer;
}
// 成功图标样式
.icon-success {
font-size: 40px;
font-size: 32px;
color: green;
margin-bottom: 20px;
margin-bottom: 16px;
}
// 成功文字样式
.success-text {
font-size: 18px;
margin-bottom: 20px;
font-size: 14.4px;
margin-bottom: 16px;
}
// 下一项按钮样式
.next-button {
background-color: blue;
color: white;
padding: 10px 20px;
border-radius: 5px;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
font-size: 12.8px;
// 按钮 hover 效果
&:hover {
opacity: 0.9;
}
}
}
}
</style>
<template>
<view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}">
<view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
:style="{ 'background-color': themeBgColor }" >
<view class="uni-navbar__content"
:class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
:style="{ 'background-color': themeBgColor }">
<status-bar v-if="statusBar" />
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
class="uni-navbar__header">
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}" class="uni-navbar__header">
<view @tap="onClickLeft" class="uni-navbar__header-btns uni-navbar__header-btns-left"
:style="{width:leftIconWidth}">
<slot name="left">
......@@ -20,8 +20,7 @@
<view class="uni-navbar__header-container " @tap="onClickTitle">
<slot>
<view class="uni-navbar__header-container-inner" v-if="title.length>0">
<text class="uni-nav-bar-text uni-ellipsis-1"
:style="{color: themeColor }">{{ title }}</text>
<text class="uni-nav-bar-text uni-ellipsis-1" :style="{color: themeColor }">{{ title }}</text>
</view>
</slot>
</view>
......@@ -205,11 +204,16 @@
position: sticky;
/* #endif */
}
.uni-navbar {
// box-sizing: border-box;
}
.uni-nav-bar-text {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
/* #ifdef APP-PLUS */
font-size: 34rpx;
/* #endif */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论