基本功能都已完成

This commit is contained in:
王利强
2026-02-08 09:30:43 +08:00
parent 1ad538f351
commit 721ef0ad54
494 changed files with 6837 additions and 42302 deletions

View File

@@ -27,7 +27,7 @@
<view><button class="bg-blue round cu-btn lg" @click="editor()">查看详情</button></view>
</view>
</view>
<button class="cuIcon-add bg-blue round margin-top" @click="showAddPopup = true">新增</button>
<button class="cuIcon-add bg-blue round margin-top" @click="openAddPopup">新增</button>
<!-- 弹出框 -->
<u-popup :show="showAddPopup" mode="center" round="20" @close="showAddPopup = false">
<view class="popup-content">
@@ -35,7 +35,7 @@
<view class="popup-title text-bold">新增销号申请</view>
<view class="popup-close" @click="showAddPopup = false">×</view>
</view>
<view class="popup-body">
<scroll-view class="popup-body" scroll-y :style="{ height: '60vh' }">
<view class="flex margin-bottom">
<view>隐患</view>
<view class="text-red">*</view>
@@ -66,7 +66,16 @@
@close="showDatePicker = false"
></up-datetime-picker>
<view class="margin-bottom margin-top">隐患治理责任单位</view>
<up-input v-model="formData.responsibleDeptName" placeholder="请输入隐患治理责任单位"></up-input>
<view class="picker-input" @click="showDeptPicker = true">
<text :class="selectedDeptName ? '' : 'text-gray'">{{ selectedDeptName || '请选择隐患治理责任单位' }}</text>
</view>
<up-picker
:show="showDeptPicker"
:columns="deptColumns"
@confirm="onDeptConfirm"
@cancel="showDeptPicker = false"
@close="showDeptPicker = false"
></up-picker>
<view class="margin-bottom margin-top">主要负责人</view>
<up-input v-model="formData.responsiblePerson" placeholder="请输入主要负责人"></up-input>
<view class="margin-bottom margin-top">主要治理内容</view>
@@ -75,7 +84,7 @@
<up-textarea v-model="formData.treatmentResult" placeholder="请输入隐患治理完成情况"></up-textarea>
<view class="margin-bottom margin-top">隐患治理责任单位自行验收的情况</view>
<up-textarea v-model="formData.selfVerifyContent" placeholder="请输入隐患治理责任单位自行验收的情况"></up-textarea>
</view>
</scroll-view>
<view class="popup-footer">
<button class="btn-cancel" @click="showAddPopup = false">取消</button>
<button class="btn-confirm bg-blue" @click="handleAdd">确定</button>
@@ -87,18 +96,26 @@
<script setup>
import { ref, reactive, onMounted } from 'vue'
import {getMyWriteOffList, applyDelete } from '@/request/api.js';
import { getMyWriteOffList, applyDelete, getAcceptanceList, getDepartmentPersonUsers } from '@/request/api.js';
// 弹窗控制
const showAddPopup = ref(false);
const showHazardPicker = ref(false);
const showDatePicker = ref(false);
const showDeptPicker = ref(false);
// 隐患选择
const selectedHazard = ref('');
const selectedHazardId = ref('');
const hazardColumns = ref([['暂无数据']]);
const hazardList = ref([]); // 存储完整隐患数据
const acceptanceHazardList = ref([]); // 存储可申请销号的隐患数据
const hazardList = ref([]); // 存储销号申请列表
// 部门选择
const selectedDeptName = ref('');
const selectedDeptId = ref('');
const deptColumns = ref([['暂无数据']]);
const deptList = ref([]); // 存储部门列表
// 日期选择
const dateValue = ref(Date.now());
@@ -106,31 +123,100 @@
// 表单数据
const formData = reactive({
rectifyDeadline: '', // 整改时限
responsibleDeptName: '', // 隐患治理责任单位
responsibleDeptId: '', // 隐患治理责任单位ID
responsiblePerson: '', // 主要负责人
mainTreatmentContent: '', // 主要治理内容
treatmentResult: '', // 隐患治理完成内容
selfVerifyContent: '' // 责任单位自行验收情况
});
// 获取验收完成的隐患列表
const fetchHazardList = async () => {
// 获取销号申请列表(页面显示用)
const fetchWriteOffList = 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);
hazardList.value = res.data;
console.log('销号申请列表:', res.data);
}
} catch (error) {
console.error('获取隐患列表失败:', error);
console.error('获取销号申请列表失败:', error);
}
};
// 获取可申请销号的隐患列表(弹窗选择用)
const fetchAcceptanceList = async () => {
try {
const res = await getAcceptanceList();
if (res.code === 0 && res.data) {
const list = res.data.records || res.data || [];
acceptanceHazardList.value = list;
// 转换为 picker 需要的格式
if (list.length > 0) {
hazardColumns.value = [list.map(item => item.title || item.hazardTitle || `隐患${item.hazardId}`)];
} else {
hazardColumns.value = [['暂无可申请销号的隐患']];
}
console.log('可申请销号的隐患列表:', list);
}
} catch (error) {
console.error('获取可申请销号隐患列表失败:', error);
}
};
// 获取部门列表
const fetchDeptList = async () => {
try {
const res = await getDepartmentPersonUsers();
if (res.code === 0 && res.data) {
const users = [];
res.data.forEach(dept => {
if (dept.users && dept.users.length > 0) {
dept.users.forEach(user => {
users.push({
userId: user.userId,
deptId: dept.deptId,
name: `${user.nickName}${dept.deptName}`
});
});
}
});
deptList.value = users;
// 转换为 picker 需要的格式
if (users.length > 0) {
deptColumns.value = [users.map(item => item.name)];
} else {
deptColumns.value = [['暂无人员数据']];
}
console.log('部门人员列表:', users);
}
} catch (error) {
console.error('获取部门人员列表失败:', error);
}
};
// 部门选择确认
const onDeptConfirm = (e) => {
console.log('选择的人员:', e);
if (e.value && e.value.length > 0) {
selectedDeptName.value = e.value[0];
// 找到对应的用户ID和部门ID
const index = e.indexs[0];
if (deptList.value[index]) {
selectedDeptId.value = deptList.value[index].deptId;
formData.responsibleDeptId = deptList.value[index].deptId;
}
}
showDeptPicker.value = false;
};
// 打开新增弹窗
const openAddPopup = () => {
resetForm();
fetchAcceptanceList(); // 获取可申请销号的隐患列表
fetchDeptList(); // 获取部门列表
showAddPopup.value = true;
};
// 隐患选择确认
const onHazardConfirm = (e) => {
console.log('选择的隐患:', e);
@@ -138,8 +224,8 @@
selectedHazard.value = e.value[0];
// 找到对应的隐患ID
const index = e.indexs[0];
if (hazardList.value[index]) {
selectedHazardId.value = hazardList.value[index].hazardId;
if (acceptanceHazardList.value[index]) {
selectedHazardId.value = acceptanceHazardList.value[index].hazardId;
}
}
showHazardPicker.value = false;
@@ -163,8 +249,10 @@
const resetForm = () => {
selectedHazard.value = '';
selectedHazardId.value = '';
selectedDeptName.value = '';
selectedDeptId.value = '';
formData.rectifyDeadline = '';
formData.responsibleDeptName = '';
formData.responsibleDeptId = '';
formData.responsiblePerson = '';
formData.mainTreatmentContent = '';
formData.treatmentResult = '';
@@ -178,10 +266,11 @@
return;
}
// 构建请求参数
// 构建请求参数(与接口文档对应)
const params = {
hazardId: Number(selectedHazardId.value), // 隐患ID必需
rectifyDeadline: formData.rectifyDeadline || '', // 整改时限
responsibleDeptId: Number(formData.responsibleDeptId) || 0, // 隐患治理责任单位ID
responsiblePerson: formData.responsiblePerson || '', // 主要负责人
mainTreatmentContent: formData.mainTreatmentContent || '', // 主要治理内容
treatmentResult: formData.treatmentResult || '', // 隐患治理完成内容
@@ -196,6 +285,8 @@
uni.showToast({ title: '申请成功', icon: 'success' });
showAddPopup.value = false;
resetForm();
// 刷新销号申请列表
fetchWriteOffList();
} else {
uni.showToast({ title: res.msg || '申请失败', icon: 'none' });
}
@@ -211,9 +302,9 @@
})
};
// 页面加载时获取数据
// 页面加载时获取销号申请列表
onMounted(() => {
fetchHazardList();
fetchWriteOffList();
});
</script>
@@ -251,8 +342,6 @@
.popup-body {
padding: 30rpx;
max-height: 800rpx;
overflow-y: auto;
}
.popup-footer {

View File

@@ -17,7 +17,7 @@
<up-input v-model="formData.statusName" placeholder="" disabled></up-input>
<view class="flex justify-center margin-top-xl" style="gap: 30rpx;">
<button class="round cu-btn lg" @click="handleCancel">返回</button>
<button v-if="canEdit" class="bg-blue round cu-btn lg" @click="handleSubmit">保存</button>
<!-- <button v-if="canEdit" class="bg-blue round cu-btn lg" @click="handleSubmit">保存</button> -->
</view>
</view>
</view>