1.18整合

This commit is contained in:
2026-01-18 16:06:37 +08:00
parent 10c3fbb0d7
commit a11d3cc2f8
138 changed files with 7241 additions and 856 deletions

View File

@@ -1,25 +1,26 @@
<template>
<view class="padding page">
<view class="padding bg-white radius">
<view class="padding bg-white radius margin-bottom" v-for="(item,index) in hazardList" :key="index">
<view class="flex justify-between margin-bottom">
<view class="text-bold text-black">发现火苗</view>
<view>已审核</view>
<view class="text-bold text-black">{{item.hazardTitle}}</view>
<view>{{item.statusName}}</view>
</view>
<view class="flex margin-bottom">
<view class="text-gray">隐患日期</view>
<view class="text-black">2025-11-11</view>
<view class="text-black">{{item.hazardCreatedAt}}</view>
</view>
<view class="flex margin-bottom">
<view class="text-gray">责任单位</view>
<view class="text-black">吉首网络有限公司</view>
<view class="text-black">{{item.responsibleDeptName}}</view>
</view>
<view class="flex margin-bottom">
<view class="text-gray">判定人员</view>
<view class="text-black">张起</view>
<view class="text-black">{{item.responsiblePerson}}</view>
</view>
<view class="flex margin-bottom">
<view class="text-gray">创建时间</view>
<view class="text-black">2025-11-14 06:33:49</view>
<view class="text-black">{{item.createdAt}}</view>
</view>
<view class="flex justify-between">
<view></view>
@@ -39,24 +40,41 @@
<view>隐患</view>
<view class="text-red">*</view>
</view>
<up-input placeholder="请选择隐患"></up-input>
<view class="flex margin-bottom margin-top">
<view class="picker-input" @click="showHazardPicker = true">
<text :class="selectedHazard ? '' : 'text-gray'">{{ selectedHazard || '请选择隐患' }}</text>
</view>
<up-picker
:show="showHazardPicker"
:columns="hazardColumns"
@confirm="onHazardConfirm"
@cancel="showHazardPicker = false"
@close="showHazardPicker = false"
></up-picker>
<view class="flex margin-bottom margin-top">
<view>整改时限</view>
<view class="text-red">*</view>
</view>
<view>
<up-datetime-picker hasInput :show="show" v-model="value1" mode="date"></up-datetime-picker>
<view class="picker-input" @click="showDatePicker = true">
<text :class="formData.rectifyDeadline ? '' : 'text-gray'">{{ formData.rectifyDeadline || '请选择整改时限' }}</text>
</view>
<up-datetime-picker
:show="showDatePicker"
v-model="dateValue"
mode="datetime"
@confirm="onDateConfirm"
@cancel="showDatePicker = false"
@close="showDatePicker = false"
></up-datetime-picker>
<view class="margin-bottom margin-top">隐患治理责任单位</view>
<up-input placeholder="请输入隐患治理责任单位"></up-input>
<up-input v-model="formData.responsibleDeptName" placeholder="请输入隐患治理责任单位"></up-input>
<view class="margin-bottom margin-top">主要负责人</view>
<up-input placeholder="请输入主要负责人"></up-input>
<up-input v-model="formData.responsiblePerson" placeholder="请输入主要负责人"></up-input>
<view class="margin-bottom margin-top">主要治理内容</view>
<up-textarea v-model="value" placeholder="请输入主要治理内容" ></up-textarea>
<up-textarea v-model="formData.mainTreatmentContent" placeholder="请输入主要治理内容"></up-textarea>
<view class="margin-bottom margin-top">隐患治理完成内容</view>
<up-textarea v-model="value" placeholder="请输入隐患治理完成情况" ></up-textarea>
<up-textarea v-model="formData.treatmentResult" placeholder="请输入隐患治理完成情况"></up-textarea>
<view class="margin-bottom margin-top">隐患治理责任单位自行验收的情况</view>
<up-textarea v-model="value" placeholder="请输入隐患治理责任单位自行验收的情况" ></up-textarea>
<up-textarea v-model="formData.selfVerifyContent" placeholder="请输入隐患治理责任单位自行验收的情况"></up-textarea>
</view>
<view class="popup-footer">
<button class="btn-cancel" @click="showAddPopup = false">取消</button>
@@ -68,29 +86,135 @@
</template>
<script setup>
import {
ref
} from 'vue'
import { ref, reactive, onMounted } from 'vue'
import {getMyWriteOffList, applyDelete } from '@/request/api.js';
// 弹窗控制
const showAddPopup = ref(false);
// 确定新增
const handleAdd = () => {
// 在这里处理新增逻辑
showAddPopup.value = false;
uni.showToast({
title: '新增成功',
icon: 'success'
});
const showHazardPicker = ref(false);
const showDatePicker = ref(false);
// 隐患选择
const selectedHazard = ref('');
const selectedHazardId = ref('');
const hazardColumns = ref([['暂无数据']]);
const hazardList = ref([]); // 存储完整隐患数据
// 日期选择
const dateValue = ref(Date.now());
// 表单数据
const formData = reactive({
rectifyDeadline: '', // 整改时限
responsibleDeptName: '', // 隐患治理责任单位
responsiblePerson: '', // 主要负责人
mainTreatmentContent: '', // 主要治理内容
treatmentResult: '', // 隐患治理完成内容
selfVerifyContent: '' // 责任单位自行验收情况
});
// 获取验收完成的隐患列表
const fetchHazardList = async () => {
try {
const res = await getMyWriteOffList();
if (res.code === 0 && res.data) {
const list = res.data;
hazardList.value = list;
// 转换为 picker 需要的格式
if (list.length > 0) {
hazardColumns.value = [list.map(item => item.hazardTitle || `隐患${item.hazardId}`)];
}
console.log('隐患列表:', list);
}
} catch (error) {
console.error('获取隐患列表失败:', error);
}
};
// 整改时限
const value1 = ref(Date.now());
// 隐患选择确认
const onHazardConfirm = (e) => {
console.log('选择的隐患:', e);
if (e.value && e.value.length > 0) {
selectedHazard.value = e.value[0];
// 找到对应的隐患ID
const index = e.indexs[0];
if (hazardList.value[index]) {
selectedHazardId.value = hazardList.value[index].hazardId;
}
}
showHazardPicker.value = false;
};
// 日期时间选择确认
const onDateConfirm = (e) => {
console.log('选择的日期时间:', e);
const date = new Date(e.value);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
formData.rectifyDeadline = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
showDatePicker.value = false;
};
// 重置表单
const resetForm = () => {
selectedHazard.value = '';
selectedHazardId.value = '';
formData.rectifyDeadline = '';
formData.responsibleDeptName = '';
formData.responsiblePerson = '';
formData.mainTreatmentContent = '';
formData.treatmentResult = '';
formData.selfVerifyContent = '';
};
// 确定新增
const handleAdd = async () => {
if (!selectedHazardId.value) {
uni.showToast({ title: '请选择隐患', icon: 'none' });
return;
}
// 构建请求参数
const params = {
hazardId: Number(selectedHazardId.value), // 隐患ID必需
rectifyDeadline: formData.rectifyDeadline || '', // 整改时限
responsiblePerson: formData.responsiblePerson || '', // 主要负责人
mainTreatmentContent: formData.mainTreatmentContent || '', // 主要治理内容
treatmentResult: formData.treatmentResult || '', // 隐患治理完成内容
selfVerifyContent: formData.selfVerifyContent || '' // 责任单位自行验收情况
};
console.log('提交数据:', params);
try {
const res = await applyDelete(params);
if (res.code === 0) {
uni.showToast({ title: '申请成功', icon: 'success' });
showAddPopup.value = false;
resetForm();
} else {
uni.showToast({ title: res.msg || '申请失败', icon: 'none' });
}
} catch (error) {
console.error('申请失败:', error);
uni.showToast({ title: '请求失败', icon: 'none' });
}
};
const editor = () => {
uni.navigateTo({
url: '/pages/closeout/editor'
})
}
url: '/pages/closeout/editor'
})
};
// 页面加载时获取数据
onMounted(() => {
fetchHazardList();
});
</script>
<style lang="scss" scoped>
@@ -156,4 +280,17 @@
color: #fff;
}
}
.picker-input {
background: #fff;
border-radius: 8rpx;
padding: 24rpx 20rpx;
margin-bottom: 20rpx;
// border: 1rpx solid #F6F6F6;
border: 1rpx solid #eee;
text {
font-size: 28rpx;
// color: #333;
}
}
</style>