Commit 6d04e774 authored by xinzhedeai's avatar xinzhedeai

feature: css代码记过优化

parent d0667754
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, viewprot-fit:cover">
<title>消防安全检查清单</title>
<script type="text/javascript" src="../sdk/includeHead.js"></script>
</head>
<head>
<style>
html,
body {
background-color: #fff;
}
.pd-01rem {
padding-bottom: 0.1rem;
}
/* 表单相关 */
.formValue {
float: right;
}
.formSubmitBtnWrapper {
display: flex;
justify-content: center;
margin-top: 0.2rem;
margin-bottom: 0.2rem;
}
.formSubmitBtnWrapper .van-button {
width: 4rem;
}
/**
* 框架样式覆盖修改
*/
.van-cell__value {
overflow: unset;
}
.van-cell:after {
border-bottom: none;
}
.van-radio-group--horizontal {
float: right;
}
.checklist-container {
padding: 12px;
background: #fff;
overflow: hidden;
padding-bottom: 1rem;
}
.check-item {
width: 88vw;
padding: 12px;
background: white;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.item-header {
display: flex;
align-items: center;
margin-bottom: 8px;
}
.item-number {
/* width: 28px;
height: 28px;
line-height: 28px;
text-align: center;
background: #1989fa;
color: white;
border-radius: 50%;
margin-right: 12px; */
}
.expand-section {
width: 77.5vw;
margin-top: 12px;
/* border: 2px solid #000; */
float: left;
background: #f5f6fa;
padding: 0.4rem;
}
.sub-checkbox-group {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
margin: 8px 0;
}
.uploader-wrapper {
--van-uploader-size: 80px;
}
.deadline-picker {
display: flex;
gap: 12px;
margin: 12px 0;
}
.check-item {
float: left;
}
.van-radio-group--horizontal {
float: left;
}
/* 样式优化 */
.checklist-container.item_title {}
.checklist-header p {
background-color: rgb(25, 137, 250);
color: rgb(255, 255, 255);
font-size: 0.26rem;
padding: 0.2rem .3rem .2rem;
line-height: .39999rem;
margin: 0;
}
.checklist-header h5 {
font-size: .32rem;
text-align: center;
}
.item_title {
font-size: .3rem;
color: #1081E3;
font-weight: bold;
position: relative;
padding-left: .2rem;
}
.item_title::before {
content: '';
display: block;
width: 0.05rem;
height: 0.32rem;
background-color: #1081E3;
margin-right: 0.2rem;
position: absolute;
left: 0;
top: 0;
}
.van-checkbox {
width: auto;
}
.van-cell {
background: #f5f6fa;
margin-top: 0.2rem;
}
.sub-checkbox-group {
display: flex;
flex-wrap: wrap;
gap: .2rem;
}
.van-cell-group {
background-color: #f5f6fa;
}
.van-radio {
margin-right: 0.8rem;
margin-top: .2rem;
}
.van-radio__label {
font-size: 0.28rem;
}
textarea {
/* background: #f5f6fa !important; */
background-color: #fff !important;
}
.van-cell__value {
background-color: #f5f6fa;
}
.van-uploader__upload {
background-color: #fff;
}
.title_require {
position: relative;
padding: 0;
margin: 0;
margin-top: 0.1rem;
/* padding-top: 0.1rem; */
padding-left: 0.2rem;
}
.title_require::before {
position: absolute;
content: '*';
color: #ee0a24;
font-size: 0.3rem;
left: 0rem;
top: 50%;
transform: translateY(-50%);
}
.van-cell {
padding: 0;
}
.van-checkbox__label {
font-size: 0.28rem;
}
.van-checkbox__icon,
.van-radio__icon {
font-size: 0.34rem;
background-color: #fff;
}
.limit_date_wrapper .van-field__label {
width: 1.3rem;
}
.item-title {
font-size: 0.28rem;
}
.bottom_bar {
position: fixed;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 78vw;
border: 1px solid;
}
.bottom_bar button {
float: right;
}
.van-icon-apps-o:before,
.van-icon-fire-o:before {
font-size: .32rem;
}
</style>
</head>
<body>
<div id="app">
<div class="checklist-header">
<p>
1.不合格或不满足等选择“否”的检查项,需将问题进行拍照上传,并描述问题详情。<br>
2.检查人员对管辖范围内企业安全情况负责,需如实上报。
</p>
<h5>九小场所安全检查清单</h5>
</div>
<div class="checklist-container">
<div class="item_title">
{{ checkData[checkPageIndex].title }}
</div>
<div v-for="(item, index) in checkData[checkPageIndex]['checkList']" :key="item.id" class="check-item">
<div class="item-header">
<!-- <div class="item-number">{{ index + 1 }}</div> -->
<div class="item-title">{{ index + 1 }}.{{ item.title }}</div>
</div>
<!-- 单选按钮组 -->
<van-radio-group v-model="item.selected" @change="handleSelectionChange(item)"
direction="horizontal">
<van-radio name="yes"></van-radio>
<van-radio name="no"></van-radio>
<van-radio name="na">不涉及</van-radio>
</van-radio-group>
<!-- 否选项扩展内容 -->
<div v-show="item.selected !== 'no'" class="expand-section">
<div>
<!-- 子检查项 -->
<div class="sub-checkbox-group">
<van-checkbox v-for="(subItem, subIndex) in item.subChecks" :key="subIndex"
v-model="subItem.checked" shape="square">
隐患点{{ subIndex + 1 }}
</van-checkbox>
</div>
<!-- 隐患描述 -->
<!-- <van-field
v-model="item.description"
type="textarea"
rows="2"
placeholder="请填写具体隐患情况"
label="隐患描述"
/> -->
<van-cell-group>
<p style="font-size:0.2rem" class="title_require">请输入隐患描述</p>
<van-field v-model="item.description" type="textarea" rows="1"></van-field>
</van-cell-group>
<!-- 照片上传 -->
<van-cell-group>
<van-cell>*请上传隐患图片:<span style="color: red;">(格式png/jpg/jpeg)</span>
<div>
<van-uploader style="width: 80px; height:80px;" v-model="item.photos"
:max-count="3" :after-read="handleFileUpload" class="uploader-wrapper" />
</div>
</van-cell>
</van-cell-group>
<!-- <van-uploader
style="width: 80px; height:80px;"
v-model="item.photos"
:max-count="3"
:after-read="handleFileUpload"
class="uploader-wrapper"
/> -->
<van-cell-group>
<van-cell>
<div class="limit_date_wrapper">
<van-field label-align="left" readonly clickable label="整改期限"
:value="`${item.deadlineDays}天 截至整改日期:${item.deadlineDate}`"
@click="showDeadlinePicker = true; currentItem=item" />
</div>
</van-cell>
</van-cell-group>
</div>
</div>
</div>
<!-- <div>
<div><span class="title">检查人员</span><span class="content">xxxxxx</span></div>
<div><span class="title">检查人员</span><span class="content">xxxxxx</span></div>
</div> -->
<div class="bottom_bar">
<div style="display: inline-block;">
<van-icon name="apps-o" color="blue" />
<span
style="color: #545454;font-size: 0.28rem;margin-right: 1rem;margin-left: 0.2rem;">{{ notNullCount }}/{{totalItems}}</span>
<van-icon name="fire-o" color="#ee0a24" />
<span style="color: #545454;font-size: 0.28rem;margin-left: 0.2rem;">{{noCount}} 隐患</span>
</div>
<van-button type="info" size="small" @click="navTo1" v-show="checkPageIndex===3">完成检查</van-button>
<van-button v-show="checkPageIndex<3" type="info" size="small"
@click="checkPageIndex++">下一项</van-button>
</div>
<!-- 整改天数选择器 -->
<van-popup v-model="showDeadlinePicker" position="bottom">
<van-picker :columns="deadlineOptions" @confirm="handleDeadlineConfirm" show-toolbar
title="选择整改天数" />
</van-popup>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script src="https://cdn.jsdelivr.net/npm/vant@2/lib/vant.min.js"></script>
<script>
const checkData = [{
id: 1,
title: '消防安全检查',
checkList: [{
id: 1,
title: '检查项目 1',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}, {
id: 1,
title: '检查项目 2',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}],
},
{
id: 2,
title: '用电安全检查',
checkList: [{
id: 1,
title: '检查项目 1',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}],
},
{
id: 3,
title: '用电安全检查2',
checkList: [{
id: 1,
title: '检查项目 1',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}],
},
{
id: 4,
title: '用电安全检查4',
checkList: [{
id: 1,
title: '检查项目 1',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}],
},
]
function countSelectedNo(result) { // 获取 checkList 中 selected 为 'no' 的对象个数
return result.reduce((total, category) => {
return total + category.checkList.filter(item => item.selected === 'no').length;
}, 0);
}
function getTotalCheckListItems(result) { // 获取所有 checkList 子元素的总数
return result.reduce((total, category) => {
console.log(category, 'category')
return total + category.checkList.length;
}, 0);
}
function countSelectedNotNull(result) { // 获取 checkList 中 selected 不为 null 的个数
return result.reduce((total, category) => {
return total + category.checkList.filter(item => item.selected !== null).length;
}, 0);
}
// 统计各个状态数量
// 调用方法
const noCount = countSelectedNo(checkData); // selected=no 的个数
const totalItems = getTotalCheckListItems(checkData); // checkList 子元素总数
const notNullCount = countSelectedNotNull(checkData); // selected 不为 null 的个数
// 初始化检查项数据结构
function createCheckItem(id) {
return {
id: id,
title: `检查项目 ${id}`,
selected: null,
subChecks: Array.from({
length: 10
}, (_, i) => ({
id: i + 1,
checked: false
})),
description: '',
photos: [],
deadlineDays: '',
deadlineDate: '',
}
}
new Vue({
el: '#app',
data: {
showDeadlinePicker: false,
deadlineOptions: ['1', '3', '5', '7'],
currentEditingItem: null,
checkList: Array.from({
length: 40
}, (_, i) => createCheckItem(i + 1)),
checkData, // 提交给后端,图片使用vant结构,base64,后端处理,不走爱山东中台。(数据量大!)
checkPageIndex: 0,
currentItem: null,
noCount,
totalItems,
notNullCount,
},
watch: {
checkData: {
handler(newVal) {
const snapshot = JSON.parse(JSON.stringify(newVal));
// const snapshot = JSON.stringify(newVal);
console.log('全量变化:', snapshot);
this.noCount = countSelectedNo(newVal); // selected=no 的个数
this.totalItems = getTotalCheckListItems(newVal); // checkList 子元素总数
this.notNullCount = countSelectedNotNull(newVal); // selected 不为 null 的个数
},
deep: true
},
},
methods: {
navTo1() {
lightAppJssdk.navigation.show({
url: '_shanghu_detail.html',
title: '高区应急扫描',
isgoback: '0',
success: function(data) {
//成功回调
},
fail: function(data) {
//错误返回
}
});
},
// 处理单选变化
handleSelectionChange(item) {
if (item.selected !== 'no') {
this.$set(item, 'description', '')
this.$set(item, 'photos', [])
this.$set(item, 'deadlineDays', '')
this.$set(item, 'deadlineDate', '')
}
},
// 文件上传处理
handleFileUpload(file) {
console.log('上传文件:', file)
// 此处可添加实际文件上传逻辑
},
// 整改天数确认
handleDeadlineConfirm(value) {
const days = parseInt(value)
// const currentItem = this.checkList.find(
// item => item.selected === 'no' && !item.deadlineDays
// )
const currentItem = this.currentItem
if (currentItem) {
currentItem.deadlineDays = days
const deadlineDate = new Date()
deadlineDate.setDate(deadlineDate.getDate() + days)
currentItem.deadlineDate = this.formatDate(deadlineDate)
}
this.showDeadlinePicker = false
},
// 日期格式化
formatDate(date) {
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`
}
}
})
</script>
</body>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, viewprot-fit:cover">
<title>消防安全检查清单</title>
<script type="text/javascript" src="../sdk/includeHead.js"></script>
<style>
/* 基础样式 */
html,
body {
background-color: #fff;
}
/* 通用工具类 */
.pd-01rem {
padding-bottom: 0.1rem;
}
/* 表单相关 */
.formValue {
float: right;
}
.formSubmitBtnWrapper {
display: flex;
justify-content: center;
margin-top: 0.2rem;
margin-bottom: 0.2rem;
}
.formSubmitBtnWrapper .van-button {
width: 4rem;
}
/* 框架样式覆盖修改 */
.checklist-container .van-cell__value {
overflow: unset;
background-color: #f5f6fa;
}
.checklist-container .van-cell:after {
border-bottom: none;
}
.checklist-container .van-radio-group--horizontal {
float: left;
}
.checklist-container .van-checkbox {
width: auto;
}
.checklist-container .van-checkbox__label,
.checklist-container .van-radio__label {
font-size: 0.28rem;
}
.checklist-container .van-checkbox__icon,
.checklist-container .van-radio__icon {
font-size: 0.34rem;
background-color: #fff;
}
.checklist-container .van-radio {
margin-right: 0.8rem;
margin-top: 0.2rem;
}
.checklist-container .van-cell {
background: #f5f6fa;
margin-top: 0.2rem;
padding: 0;
}
.checklist-container .van-cell-group {
background-color: #f5f6fa;
}
.checklist-container textarea {
background-color: #fff !important;
}
.checklist-container .van-uploader__upload {
background-color: #fff;
}
.limit_date_wrapper .van-field__label {
width: 1.3rem;
}
.checklist-container .van-icon-apps-o:before,
.checklist-container .van-icon-fire-o:before {
font-size: 0.32rem;
}
/* 检查清单容器 */
.checklist-container {
padding: 12px;
background: #fff;
overflow: hidden;
padding-bottom: 1rem;
}
/* 检查项 */
.check-item {
width: 88vw;
padding: 12px;
background: white;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
float: left;
}
.item-header {
display: flex;
align-items: center;
margin-bottom: 8px;
}
.item-number {}
.item-title {
font-size: 0.28rem;
}
.item_title {
font-size: 0.3rem;
color: #1081E3;
font-weight: bold;
position: relative;
padding-left: 0.2rem;
}
.item_title::before {
content: '';
display: block;
width: 0.05rem;
height: 0.32rem;
background-color: #1081E3;
position: absolute;
left: 0;
top: 0;
}
/* 展开部分 */
.expand-section {
width: 77.5vw;
margin-top: 12px;
float: left;
background: #f5f6fa;
padding: 0.4rem;
}
/* 子复选框组 */
.sub-checkbox-group {
display: flex;
flex-wrap: wrap;
gap: 0.2rem;
margin: 8px 0;
}
/* 上传器 */
.uploader-wrapper {
--van-uploader-size: 80px;
}
/* 截止日期选择器 */
.deadline-picker {
display: flex;
gap: 12px;
margin: 12px 0;
}
/* 检查清单头部 */
.checklist-header p {
background-color: rgb(25, 137, 250);
color: rgb(255, 255, 255);
font-size: 0.26rem;
padding: 0.2rem 0.3rem 0.2rem;
line-height: 0.39999rem;
margin: 0;
}
.checklist-header h5 {
font-size: 0.32rem;
text-align: center;
}
/* 必填标题 */
.title_require {
position: relative;
padding: 0;
margin: 0;
margin-top: 0.1rem;
padding-left: 0.2rem;
}
.title_require::before {
position: absolute;
content: '*';
color: #ee0a24;
font-size: 0.3rem;
left: 0;
top: 50%;
transform: translateY(-50%);
}
/* 底部栏 */
.bottom_bar {
position: fixed;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 78vw;
border: 1px solid;
}
.bottom_bar button {
float: right;
}
</style>
</head>
<body>
<!-- 原 HTML 主体内容保持不变 -->
<div id="app">
<div class="checklist-header">
<p>
1.不合格或不满足等选择“否”的检查项,需将问题进行拍照上传,并描述问题详情。<br>
2.检查人员对管辖范围内企业安全情况负责,需如实上报。
</p>
<h5>九小场所安全检查清单</h5>
</div>
<div class="checklist-container">
<div class="item_title">
{{ checkData[checkPageIndex].title }}
</div>
<div v-for="(item, index) in checkData[checkPageIndex]['checkList']" :key="item.id" class="check-item">
<div class="item-header">
<!-- <div class="item-number">{{ index + 1 }}</div> -->
<div class="item-title">{{ index + 1 }}.{{ item.title }}</div>
</div>
<!-- 单选按钮组 -->
<van-radio-group v-model="item.selected" @change="handleSelectionChange(item)" direction="horizontal">
<van-radio name="yes"></van-radio>
<van-radio name="no"></van-radio>
<van-radio name="na">不涉及</van-radio>
</van-radio-group>
<!-- 否选项扩展内容 -->
<div v-show="item.selected !== 'no'" class="expand-section">
<div>
<!-- 子检查项 -->
<div class="sub-checkbox-group">
<van-checkbox v-for="(subItem, subIndex) in item.subChecks" :key="subIndex"
v-model="subItem.checked" shape="square">
隐患点{{ subIndex + 1 }}
</van-checkbox>
</div>
<!-- 隐患描述 -->
<van-cell-group>
<p style="font-size:0.2rem" class="title_require">请输入隐患描述</p>
<van-field v-model="item.description" type="textarea" rows="1"></van-field>
</van-cell-group>
<!-- 照片上传 -->
<van-cell-group>
<van-cell>*请上传隐患图片:<span style="color: red;">(格式png/jpg/jpeg)</span>
<div>
<van-uploader style="width: 80px; height:80px;" v-model="item.photos"
:max-count="3" :after-read="handleFileUpload" class="uploader-wrapper" />
</div>
</van-cell>
</van-cell-group>
<!-- 整改期限 -->
<van-cell-group>
<van-cell>
<div class="limit_date_wrapper">
<van-field label-align="left" readonly clickable label="整改期限"
:value="`${item.deadlineDays}天 截至整改日期:${item.deadlineDate}`"
@click="showDeadlinePicker = true; currentItem=item" />
</div>
</van-cell>
</van-cell-group>
</div>
</div>
</div>
<!-- 底部栏 -->
<div class="bottom_bar">
<div style="display: inline-block;">
<van-icon name="apps-o" color="blue" />
<span
style="color: #545454;font-size: 0.28rem;margin-right: 1rem;margin-left: 0.2rem;">{{ notNullCount }}/{{totalItems}}</span>
<van-icon name="fire-o" color="#ee0a24" />
<span style="color: #545454;font-size: 0.28rem;margin-left: 0.2rem;">{{noCount}} 隐患</span>
</div>
<van-button type="info" size="small" @click="navTo1" v-show="checkPageIndex===3">完成检查</van-button>
<van-button v-show="checkPageIndex<3" type="info" size="small"
@click="checkPageIndex++">下一项</van-button>
</div>
<!-- 整改天数选择器 -->
<van-popup v-model="showDeadlinePicker" position="bottom">
<van-picker :columns="deadlineOptions" @confirm="handleDeadlineConfirm" show-toolbar
title="选择整改天数" />
</van-popup>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script src="https://cdn.jsdelivr.net/npm/vant@2/lib/vant.min.js"></script>
<script>
// 原 JavaScript 代码保持不变
const checkData = [{
id: 1,
title: '消防安全检查',
checkList: [{
id: 1,
title: '检查项目 1',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}, {
id: 1,
title: '检查项目 2',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}],
},
{
id: 2,
title: '用电安全检查',
checkList: [{
id: 1,
title: '检查项目 1',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}],
},
{
id: 3,
title: '用电安全检查2',
checkList: [{
id: 1,
title: '检查项目 1',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}],
},
{
id: 4,
title: '用电安全检查4',
checkList: [{
id: 1,
title: '检查项目 1',
selected: null,
subChecks: [{
id: 1,
checked: false
},
{
id: 2,
checked: false
},
{
id: 3,
checked: false
},
{
id: 4,
checked: false
}
],
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
}],
},
];
function countSelectedNo(result) {
// 获取 checkList 中 selected 为 'no' 的对象个数
return result.reduce((total, category) => {
return total + category.checkList.filter(item => item.selected === 'no').length;
}, 0);
}
function getTotalCheckListItems(result) {
// 获取所有 checkList 子元素的总数
return result.reduce((total, category) => {
console.log(category, 'category');
return total + category.checkList.length;
}, 0);
}
function countSelectedNotNull(result) {
// 获取 checkList 中 selected 不为 null 的个数
return result.reduce((total, category) => {
return total + category.checkList.filter(item => item.selected !== null).length;
}, 0);
}
// 统计各个状态数量
const noCount = countSelectedNo(checkData); // selected=no 的个数
const totalItems = getTotalCheckListItems(checkData); // checkList 子元素总数
const notNullCount = countSelectedNotNull(checkData); // selected 不为 null 的个数
// 初始化检查项数据结构
function createCheckItem(id) {
return {
id: id,
title: `检查项目 ${id}`,
selected: null,
subChecks: Array.from({ length: 10 }, (_, i) => ({
id: i + 1,
checked: false
})),
description: '',
photos: [],
deadlineDays: '',
deadlineDate: ''
};
}
new Vue({
el: '#app',
data: {
showDeadlinePicker: false,
deadlineOptions: ['1', '3', '5', '7'],
currentEditingItem: null,
checkList: Array.from({ length: 40 }, (_, i) => createCheckItem(i + 1)),
checkData, // 提交给后端,图片使用vant结构,base64,后端处理,不走爱山东中台。(数据量大!)
checkPageIndex: 0,
currentItem: null,
noCount,
totalItems,
notNullCount
},
watch: {
checkData: {
handler(newVal) {
const snapshot = JSON.parse(JSON.stringify(newVal));
console.log('全量变化:', snapshot);
this.noCount = countSelectedNo(newVal); // selected=no 的个数
this.totalItems = getTotalCheckListItems(newVal); // checkList 子元素总数
this.notNullCount = countSelectedNotNull(newVal); // selected 不为 null 的个数
},
deep: true
}
},
methods: {
navTo1() {
lightAppJssdk.navigation.show({
url: '_shanghu_detail.html',
title: '高区应急扫描',
isgoback: '0',
success: function (data) {
// 成功回调
},
fail: function (data) {
// 错误返回
}
});
},
// 处理单选变化
handleSelectionChange(item) {
if (item.selected !== 'no') {
this.$set(item, 'description', '');
this.$set(item, 'photos', []);
this.$set(item, 'deadlineDays', '');
this.$set(item, 'deadlineDate', '');
}
},
// 文件上传处理
handleFileUpload(file) {
console.log('上传文件:', file);
// 此处可添加实际文件上传逻辑
},
// 整改天数确认
handleDeadlineConfirm(value) {
const days = parseInt(value);
const currentItem = this.currentItem;
if (currentItem) {
currentItem.deadlineDays = days;
const deadlineDate = new Date();
deadlineDate.setDate(deadlineDate.getDate() + days);
currentItem.deadlineDate = this.formatDate(deadlineDate);
}
this.showDeadlinePicker = false;
},
// 日期格式化
formatDate(date) {
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
}
}
});
</script>
</div>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment