代码提交
This commit is contained in:
parent
476b9f79cb
commit
7959a0bd7d
|
|
@ -1,3 +1,4 @@
|
|||
export * from './modules/auth'
|
||||
export * from './modules/user'
|
||||
export * from './modules/workTicket'
|
||||
export * from './modules/workTicket'
|
||||
export * from './modules/projectImplementation'
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import { get } from '../request'
|
||||
|
||||
/**
|
||||
* 查询项目实施列表
|
||||
* @param {Object} params - 查询参数
|
||||
* @param {Number} params.pageNum - 页码(可选)
|
||||
* @param {Number} params.pageSize - 每页数量(可选)
|
||||
* @param {String} params.status - 状态(可选)
|
||||
* @param {String} params.projectName - 项目名称(可选,模糊查询)
|
||||
* @param {Number} params.projectId - 项目ID(可选)
|
||||
* @returns {Promise} 返回项目实施列表 { total: number, rows: array }
|
||||
*/
|
||||
export function getProjectImplementationList(params = {}) {
|
||||
return get('/manage/contractor/projectImplementation/list', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目详情
|
||||
* @param {Number} projectId - 项目ID
|
||||
* @returns {Promise} 返回项目详情数据
|
||||
*/
|
||||
export function getProjectImplementationDetail(projectId) {
|
||||
return get(`/manage/contractor/projectImplementation/${projectId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当天合格数量和检查项总数
|
||||
* @param {Number} projectId - 项目ID
|
||||
* @returns {Promise} 返回当天检查项汇总数据 { qualifiedCount: number, totalCount: number, submissionDate: string, submitted: boolean }
|
||||
*/
|
||||
export function getTodayInspectionSummary(projectId) {
|
||||
return get('/manage/contractor/dailyInspection/todaySummary', { projectId })
|
||||
}
|
||||
|
|
@ -92,6 +92,15 @@ export function submitWorkPlan(projectId) {
|
|||
return put(`/manage/contractor/workPlan/submit/${projectId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回工作计划
|
||||
* @param {Number|String} projectId - 项目ID(必填)
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export function withdrawWorkPlan(projectId) {
|
||||
return put(`/manage/contractor/workPlan/withdraw/${projectId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param {String} filePath - 文件路径(本地临时文件路径)
|
||||
|
|
@ -196,4 +205,56 @@ export function submitImplementation(projectId) {
|
|||
return put(`/manage/contractor/projectImplementation/submitImplementation?projectId=${projectId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工作计划
|
||||
* @param {Object} data - 工作计划数据
|
||||
* @param {Number|String} data.id - 工作计划ID(必填)
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export function updateWorkPlan(data) {
|
||||
return put('/manage/contractor/workPlan', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取出入证详情(根据项目ID)
|
||||
* @param {Number|String} projectId - 项目ID(必填)
|
||||
* @returns {Promise} 返回出入证详情
|
||||
*/
|
||||
export function getAccessPermitDetail(projectId) {
|
||||
return get(`/manage/contractor/accessPermit/project/${projectId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改出入证申请
|
||||
* @param {Object} data - 出入证申请数据
|
||||
* @param {Number|String} data.id - 出入证申请ID(必填)
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export function updateAccessPermit(data) {
|
||||
return put('/manage/contractor/accessPermit', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工作票申请
|
||||
* @param {Object} data - 工作票数据
|
||||
* @param {Number|String} data.id - 工作票ID(必填)
|
||||
* @param {Number} data.projectId - 所属项目ID(必填)
|
||||
* @param {String} data.workLocation - 作业地点
|
||||
* @param {Number} data.supervisorId - 作业负责人ID
|
||||
* @param {String} data.supervisorName - 作业负责人姓名
|
||||
* @param {String} data.supervisorPosition - 作业负责人职位
|
||||
* @param {String} data.workContent - 作业内容
|
||||
* @param {String} data.riskType - 风险类型(如:高风险、中风险、低风险)
|
||||
* @param {String} data.workStartTime - 作业开始时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||
* @param {String} data.workEndTime - 作业结束时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||
* @param {Array<String>} data.safetyMeasuresList - 安全措施列表
|
||||
* @param {Array<Object>} data.qualificationList - 作业班成员资质列表
|
||||
* @param {String} data.needMonitoringCamera - 是否需申领移动监控球机("0"否,"1"是)
|
||||
* @param {Number} data.cameraApplicationId - 监控球机申请ID(如果需要监控球机时填写)
|
||||
* @param {String} data.remark - 备注
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export function updateWorkTicket(data) {
|
||||
return put('/manage/contractor/workTicket', data)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
<template>
|
||||
<view class="MainBox">
|
||||
<view class="labebBox">申请单位:</view>
|
||||
<view class="fw-600">{{ progectInfo.applyUnit }}</view>
|
||||
<view class="fw-600">{{ applyUnit }}</view>
|
||||
<view class="labebBox">施工单位:</view>
|
||||
<view class="fw-600">{{ progectInfo.constructUnit }}</view>
|
||||
<view class="fw-600">{{ constructUnit }}</view>
|
||||
<view class="labebBox">施工地点:</view>
|
||||
<view class="fw-600">{{ progectInfo.site }}</view>
|
||||
<view class="fw-600">{{ site }}</view>
|
||||
<view class="labebBox">附件资料:</view>
|
||||
<view class="ListBox">
|
||||
<u-virtual-list :list-data="dataSource" :item-height="80" height="100%">
|
||||
<u-virtual-list v-if="dataSource.length > 0" :list-data="dataSource" :item-height="80" height="100%">
|
||||
<template #default="{ item, index }">
|
||||
<view class="CardBox" :key="item.id">
|
||||
<view class="FlexBox">
|
||||
|
|
@ -22,45 +22,78 @@
|
|||
</view>
|
||||
</template>
|
||||
</u-virtual-list>
|
||||
<view v-else class="empty-tip">暂无附件资料</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
const progectInfo = ref({
|
||||
Id: 1,
|
||||
applyUnit: '北京CBD改造项目管理有限公司',
|
||||
constructUnit: '北京CBD改造项目施工有限公司',
|
||||
site: '北京市海淀区',
|
||||
})
|
||||
const dataSource = ref([
|
||||
{
|
||||
id: 1,
|
||||
name: '项目合同.pdf'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '项目进度表.xlsx'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '项目成本表.xlsx'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '项目风险卡.xlsx'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '项目整改记录.xlsx'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '项目风险管控类型.xlsx'
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
projectData: {
|
||||
type: Object,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
|
||||
// 计算属性:申请单位
|
||||
const applyUnit = computed(() => {
|
||||
return props.projectData?.constructionUnitName || '未设置'
|
||||
})
|
||||
|
||||
// 计算属性:施工单位
|
||||
const constructUnit = computed(() => {
|
||||
return props.projectData?.constructionUnitName || '未设置'
|
||||
})
|
||||
|
||||
// 计算属性:施工地点
|
||||
const site = computed(() => {
|
||||
const location = props.projectData?.workLocation || ''
|
||||
const detail = props.projectData?.workLocationDetail || ''
|
||||
if (location && detail) {
|
||||
return `${location} ${detail}`
|
||||
}
|
||||
return location || detail || '未设置'
|
||||
})
|
||||
|
||||
// 附件资料列表(如果有附件数据,可以从projectData中获取)
|
||||
const dataSource = ref([
|
||||
// 这里可以根据实际接口返回的附件数据来填充
|
||||
// 目前先保持空数组,如果有附件接口可以后续添加
|
||||
])
|
||||
|
||||
// 获取项目状态文本
|
||||
const getProjectStatusText = (status) => {
|
||||
const statusMap = {
|
||||
'0': '未开始',
|
||||
'1': '进行中',
|
||||
'2': '已完成',
|
||||
'3': '已暂停',
|
||||
'4': '已取消'
|
||||
}
|
||||
return statusMap[status] || '未知状态'
|
||||
}
|
||||
|
||||
// 获取实施状态文本
|
||||
const getImplementationStatusText = (status) => {
|
||||
const statusMap = {
|
||||
'1': '实施中',
|
||||
'2': '已完工',
|
||||
'3': '整改中',
|
||||
'4': '待完工确认'
|
||||
}
|
||||
return statusMap[status] || '未知状态'
|
||||
}
|
||||
|
||||
// 获取审批状态文本
|
||||
const getApprovalStatusText = (status) => {
|
||||
const statusMap = {
|
||||
'0': '待审批',
|
||||
'1': '已审批',
|
||||
'2': '已拒绝'
|
||||
}
|
||||
return statusMap[status] || '未知状态'
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.labebBox {
|
||||
|
|
@ -97,6 +130,13 @@ const dataSource = ref([
|
|||
margin-top: 20rpx;
|
||||
height: calc(100% - 384rpx);
|
||||
padding: 20rpx;
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
|
||||
.CardBox {
|
||||
width: 100%;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<u-row>
|
||||
<u-col :span="6">
|
||||
<view>今日检查项完成度</view>
|
||||
<view class="blcakFont">5/6</view>
|
||||
<view class="blcakFont">{{ completedCount }}/{{ totalCheckItems }}</view>
|
||||
</u-col>
|
||||
<u-col :span="6">
|
||||
<view>待整改问题数</view>
|
||||
|
|
@ -43,7 +43,34 @@
|
|||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
projectData: {
|
||||
type: Object,
|
||||
default: () => null
|
||||
},
|
||||
todaySummary: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
qualifiedCount: 0,
|
||||
totalCount: 0,
|
||||
submissionDate: '',
|
||||
submitted: false
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// 使用接口返回的今日检查项数据
|
||||
const totalCheckItems = computed(() => {
|
||||
return props.todaySummary?.totalCount || 0
|
||||
})
|
||||
|
||||
// 使用接口返回的合格数量
|
||||
const completedCount = computed(() => {
|
||||
return props.todaySummary?.qualifiedCount || 0
|
||||
})
|
||||
|
||||
const dataSource = ref([
|
||||
{ id: 1, name: 'AI返现安全帽佩戴不规范', time: '2023-08-01 10:00:00' },
|
||||
{ id: 2, name: 'AI返现安全帽佩戴不规范', time: '2023-08-02 10:00:00' },
|
||||
|
|
@ -55,8 +82,17 @@ const dataSource = ref([
|
|||
])
|
||||
// 提交今日风险检查项
|
||||
const submitCheck = () => {
|
||||
// 从项目数据中获取项目ID
|
||||
const projectId = props.projectData?.projectId
|
||||
if (!projectId) {
|
||||
uni.showToast({
|
||||
title: '项目ID不存在',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/TodayExamine/index',
|
||||
url: `/pages/TodayExamine/index?projectId=${projectId}`,
|
||||
})
|
||||
}
|
||||
// 整改反馈
|
||||
|
|
|
|||
|
|
@ -44,16 +44,16 @@
|
|||
<up-tabs :list="list1" @click="click"></up-tabs>
|
||||
</view>
|
||||
<view class="displayCase">
|
||||
<ControlView v-if="currentTab === 1"></ControlView>
|
||||
<BasicView v-if="currentTab === 2" ></BasicView>
|
||||
<RecordView v-if="currentTab === 3"></RecordView>
|
||||
<ControlView v-if="currentTab === 1" :project-data="progectInfo.detailData" :today-summary="todayInspectionSummary"></ControlView>
|
||||
<BasicView v-if="currentTab === 2" :project-data="progectInfo.detailData"></BasicView>
|
||||
<RecordView v-if="currentTab === 3" :project-data="progectInfo.detailData"></RecordView>
|
||||
</view>
|
||||
</view>
|
||||
<view class="FootBox">
|
||||
<u-button type="primary">项目完工确认</u-button>
|
||||
<u-button type="primary" :disabled="progectInfo.detailData?.implementationStatus !== '4'">项目完工确认</u-button>
|
||||
<view class="FootTxt">
|
||||
<view>复核进度:</view>
|
||||
<view class="yellow">监理复核中</view>
|
||||
<view class="yellow">{{ getReviewStatusText() }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -62,16 +62,29 @@
|
|||
import ControlView from './components/ControlView.vue'
|
||||
import BasicView from './components/BasicView.vue'
|
||||
import RecordView from './components/RecordView.vue'
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getProjectImplementationDetail, getTodayInspectionSummary } from '@/api'
|
||||
|
||||
const progectInfo = ref({
|
||||
Id: 1,
|
||||
name: '北京CBD改造项目',
|
||||
code: '20230801001',
|
||||
leader: '张三',
|
||||
period: '2023.8.1-2023.12.31',
|
||||
riskControlType: '动火作业风险卡',
|
||||
percentage: 30
|
||||
Id: null,
|
||||
name: '',
|
||||
code: '',
|
||||
leader: '',
|
||||
period: '',
|
||||
riskControlType: '',
|
||||
percentage: 0,
|
||||
// 详情数据
|
||||
detailData: null
|
||||
})
|
||||
|
||||
// 今日检查项汇总数据
|
||||
const todayInspectionSummary = ref({
|
||||
qualifiedCount: 0,
|
||||
totalCount: 0,
|
||||
submissionDate: '',
|
||||
submitted: false
|
||||
})
|
||||
|
||||
// tabs 切换
|
||||
const currentTab = ref(1)
|
||||
// tabs 列表
|
||||
|
|
@ -95,10 +108,127 @@ const click = (e) => {
|
|||
}
|
||||
// 返回列表页
|
||||
const goBack = () => {
|
||||
uni.switchTab({
|
||||
url: '/pages/ProgectList/index'
|
||||
})
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
// 格式化日期
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr) return ''
|
||||
const date = new Date(dateStr)
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}.${month}.${day}`
|
||||
}
|
||||
|
||||
// 获取项目详情
|
||||
const fetchProjectDetail = async (projectId) => {
|
||||
try {
|
||||
const data = await getProjectImplementationDetail(projectId)
|
||||
if (data) {
|
||||
// 保存完整数据
|
||||
progectInfo.value.detailData = data
|
||||
|
||||
// 映射基本信息
|
||||
progectInfo.value.Id = data.projectId
|
||||
progectInfo.value.name = data.projectName || '未命名项目'
|
||||
progectInfo.value.code = data.projectCode || ''
|
||||
|
||||
// 作业负责人(监理人)
|
||||
progectInfo.value.leader = data.supervisorName || '未设置'
|
||||
|
||||
// 作业周期
|
||||
const startTime = formatDate(data.workStartTime)
|
||||
const endTime = formatDate(data.workEndTime)
|
||||
progectInfo.value.period = startTime && endTime ? `${startTime}-${endTime}` : '未设置'
|
||||
|
||||
// 当前进度
|
||||
progectInfo.value.percentage = data.currentProgress || 0
|
||||
|
||||
// 风险管控类型(从riskControlCard.templateName获取)
|
||||
progectInfo.value.riskControlType = data.riskControlCard?.templateName || '未设置'
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取项目详情失败:', error)
|
||||
uni.showToast({
|
||||
title: '获取项目详情失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 获取今日检查项汇总
|
||||
const fetchTodayInspectionSummary = async (projectId) => {
|
||||
try {
|
||||
const data = await getTodayInspectionSummary(projectId)
|
||||
if (data) {
|
||||
todayInspectionSummary.value = {
|
||||
qualifiedCount: data.qualifiedCount || 0,
|
||||
totalCount: data.totalCount || 0,
|
||||
submissionDate: data.submissionDate || '',
|
||||
submitted: data.submitted || false
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取今日检查项汇总失败:', error)
|
||||
// 不显示错误提示,使用默认值
|
||||
todayInspectionSummary.value = {
|
||||
qualifiedCount: 0,
|
||||
totalCount: 0,
|
||||
submissionDate: '',
|
||||
submitted: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取复核状态文本
|
||||
const getReviewStatusText = () => {
|
||||
const data = progectInfo.value.detailData
|
||||
if (!data) return '未知状态'
|
||||
|
||||
// 优先显示监理复核状态
|
||||
if (data.supervisionReviewStatus) {
|
||||
const statusMap = {
|
||||
'0': '待监理复核',
|
||||
'1': '监理复核中',
|
||||
'2': '监理复核通过',
|
||||
'3': '监理复核拒绝'
|
||||
}
|
||||
return statusMap[data.supervisionReviewStatus] || '未知状态'
|
||||
}
|
||||
|
||||
// 其次显示物业复核状态
|
||||
if (data.propertyReviewStatus) {
|
||||
const statusMap = {
|
||||
'0': '待物业复核',
|
||||
'1': '物业复核中',
|
||||
'2': '物业复核通过',
|
||||
'3': '物业复核拒绝'
|
||||
}
|
||||
return statusMap[data.propertyReviewStatus] || '未知状态'
|
||||
}
|
||||
|
||||
return '未开始复核'
|
||||
}
|
||||
|
||||
// 组件挂载时获取详情
|
||||
onMounted(() => {
|
||||
// 从URL参数获取项目ID
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
const options = currentPage.options || {}
|
||||
const projectId = options.id || options.projectId
|
||||
|
||||
if (projectId) {
|
||||
fetchProjectDetail(projectId)
|
||||
fetchTodayInspectionSummary(projectId)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '缺少项目ID参数',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.FlexBox {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<view class="FlexBox TopBox">
|
||||
<view class="SelectBox">
|
||||
<u-select :current="TypeValue" :options="TypeList" placeholder="请选择工单类型" size="large" showOptionsLabel
|
||||
@update:current="TypeValue = $event"></u-select>
|
||||
@update:current="handleTypeChange($event)"></u-select>
|
||||
</view>
|
||||
|
||||
|
||||
|
|
@ -34,7 +34,10 @@
|
|||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
import { getProjectImplementationList } from '@/api'
|
||||
|
||||
const TypeValue = ref('1') // 工单类型
|
||||
// 类型列表
|
||||
const TypeList = ref([
|
||||
|
|
@ -44,15 +47,96 @@ const TypeList = ref([
|
|||
{ name: '待完工确认', id: '4' },
|
||||
])
|
||||
|
||||
const dataSource = ref([
|
||||
{ id: 1, name: '北京CBD写字楼改造项目', remainingTime: '1', site: '北京市朝阳区建国路88号', status: '实施中' },
|
||||
{ id: 2, name: '工单2', remainingTime: '2', site: '北京市朝阳区建国路88号', status: '整改中' },
|
||||
{ id: 3, name: '工单3', remainingTime: '3', site: '北京市朝阳区建国路88号', status: '待完工确认' },
|
||||
{ id: 4, name: '工单4', remainingTime: '5', site: '北京市朝阳区建国路88号', status: '实施中' },
|
||||
{ id: 5, name: '工单5', remainingTime: '3', site: '北京市朝阳区建国路88号', status: '待完工确认' },
|
||||
{ id: 6, name: '工单6', remainingTime: '2', site: '北京市朝阳区建国路88号', status: '已完工' },
|
||||
{ id: 7, name: '工单7', remainingTime: '4', site: '北京市朝阳区建国路88号', status: '已完工' },
|
||||
])
|
||||
const dataSource = ref([])
|
||||
const total = ref(0) // 总条数
|
||||
|
||||
// 查询项目实施列表
|
||||
const fetchProjectImplementationList = async () => {
|
||||
try {
|
||||
const params = {
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
}
|
||||
// 根据选择的类型添加筛选条件
|
||||
if (TypeValue.value === '2') {
|
||||
// 我负责的项目 - 可能需要根据实际接口参数调整
|
||||
params.myProject = true
|
||||
} else if (TypeValue.value === '3') {
|
||||
// 带整改
|
||||
params.status = '整改中'
|
||||
} else if (TypeValue.value === '4') {
|
||||
// 待完工确认
|
||||
params.status = '待完工确认'
|
||||
} else {
|
||||
// 全部实施中项目
|
||||
params.status = '实施中'
|
||||
}
|
||||
|
||||
const result = await getProjectImplementationList(params)
|
||||
// 根据返回的数据结构处理:{ total, rows, code, msg }
|
||||
if (result && result.rows && Array.isArray(result.rows)) {
|
||||
dataSource.value = result.rows.map(item => {
|
||||
// 计算剩余作业时长(天)
|
||||
let remainingDays = 0
|
||||
if (item.workEndTime) {
|
||||
const endTime = new Date(item.workEndTime)
|
||||
const now = new Date()
|
||||
const diffTime = endTime - now
|
||||
remainingDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))
|
||||
remainingDays = remainingDays > 0 ? remainingDays : 0
|
||||
}
|
||||
|
||||
// 映射实施状态文本
|
||||
let statusText = '未知状态'
|
||||
if (item.implementationStatus === '1') {
|
||||
statusText = '实施中'
|
||||
} else if (item.implementationStatus === '2') {
|
||||
statusText = '已完工'
|
||||
} else if (item.implementationStatus === '3') {
|
||||
statusText = '整改中'
|
||||
} else if (item.implementationStatus === '4') {
|
||||
statusText = '待完工确认'
|
||||
}
|
||||
|
||||
return {
|
||||
id: item.projectId,
|
||||
name: item.projectName || '未命名项目',
|
||||
remainingTime: remainingDays,
|
||||
site: item.workLocation || item.workLocationDetail || '未设置地址',
|
||||
status: statusText,
|
||||
// 保留原始数据,方便详情页使用
|
||||
rawData: item
|
||||
}
|
||||
})
|
||||
total.value = result.total || 0
|
||||
} else {
|
||||
dataSource.value = []
|
||||
total.value = 0
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('查询项目实施列表失败:', error)
|
||||
dataSource.value = []
|
||||
total.value = 0
|
||||
}
|
||||
}
|
||||
|
||||
// 监听类型变化,重新查询
|
||||
const handleTypeChange = (value) => {
|
||||
TypeValue.value = value
|
||||
fetchProjectImplementationList()
|
||||
}
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
fetchProjectImplementationList()
|
||||
})
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh(() => {
|
||||
fetchProjectImplementationList().finally(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
})
|
||||
|
||||
// 跳转项目详情
|
||||
const GoDetail = (id) => {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
<view class="LabelBox">{{ item.checkItemName }}</view>
|
||||
<view class="ValueBox">
|
||||
<u-radio-group v-model="item.value" @change="change(item)">
|
||||
<u-radio label="合格" :border-color="item.value === '是' ? '#ff9900' : '#c5d5d6'"></u-radio>
|
||||
<u-radio label="不合格" :border-color="item.value === '否' ? '#ff9900' : '#c5d5d6'"></u-radio>
|
||||
<u-radio label="合格" :name="'合格'" :border-color="item.value === '合格' ? '#ff9900' : '#c5d5d6'"></u-radio>
|
||||
<u-radio label="不合格" :name="'不合格'" :border-color="item.value === '不合格' ? '#ff9900' : '#c5d5d6'"></u-radio>
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -32,31 +32,75 @@
|
|||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getProjectImplementationDetail } from '@/api'
|
||||
|
||||
// 检查项列表
|
||||
const checkItemList = ref([
|
||||
{
|
||||
id: 1,
|
||||
checkItemName: '作业人员是否持证上岗',
|
||||
value: '是'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
checkItemName: '作业人员是否有安全装备',
|
||||
value: '是'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
checkItemName: '作业人员是否有安全工具',
|
||||
value: '是'
|
||||
}
|
||||
])
|
||||
const checkItemList = ref([])
|
||||
|
||||
// 返回列表页
|
||||
const goBack = () => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
|
||||
// 获取项目详情并提取检查项
|
||||
const fetchCheckItems = async (projectId) => {
|
||||
try {
|
||||
const data = await getProjectImplementationDetail(projectId)
|
||||
if (data && data.riskControlCard && data.riskControlCard.checkItems && data.riskControlCard.checkItems.length > 0) {
|
||||
// 将接口返回的checkItems转换为页面需要的格式,并按sortOrder排序
|
||||
checkItemList.value = data.riskControlCard.checkItems
|
||||
.map(item => ({
|
||||
id: item.checkItemId,
|
||||
checkItemName: item.itemDescription,
|
||||
value: item.checkResult === '合格' ? '合格' : (item.checkResult || ''),
|
||||
checkItemId: item.checkItemId,
|
||||
templateItemId: item.templateItemId,
|
||||
sortOrder: item.sortOrder || 0,
|
||||
originalData: item // 保留原始数据,方便后续提交
|
||||
}))
|
||||
.sort((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0))
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '暂无检查项数据',
|
||||
icon: 'none'
|
||||
})
|
||||
checkItemList.value = []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取检查项数据失败:', error)
|
||||
uni.showToast({
|
||||
title: '获取检查项数据失败',
|
||||
icon: 'none'
|
||||
})
|
||||
checkItemList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 单选改变事件
|
||||
const change = (item) => {
|
||||
console.log('检查项选择改变:', item)
|
||||
}
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
// 从URL参数获取项目ID
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
const options = currentPage.options || {}
|
||||
const projectId = options.projectId || options.id
|
||||
|
||||
if (projectId) {
|
||||
fetchCheckItems(projectId)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '缺少项目ID参数',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@
|
|||
<u-tag :text="item.draftStatusText" shape="circle"></u-tag>
|
||||
</view>
|
||||
<view class="BtnList">
|
||||
<u-button text="修改" plain color="#2979ff" size="small"></u-button>
|
||||
<u-button text="撤回" plain color="#ff9900" size="small"></u-button>
|
||||
<u-button text="修改" plain color="#2979ff" size="small" @click="handleEdit(item)"></u-button>
|
||||
<u-button text="撤回" plain color="#ff9900" size="small" @click="handleWithdraw(item, index)"></u-button>
|
||||
<u-button text="删除" plain color="#fa3534" size="small" @click="handleDelete(item, index)"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
</template>
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getWorkPlanList, deleteWorkPlan } from '@/api/modules/workTicket'
|
||||
import { getWorkPlanList, deleteWorkPlan, withdrawWorkPlan } from '@/api/modules/workTicket'
|
||||
|
||||
const TypeValue = ref('1') // 工单类型
|
||||
// 类型列表
|
||||
|
|
@ -142,6 +142,30 @@ const HandleNewAdd = () => {
|
|||
})
|
||||
}
|
||||
|
||||
// 跳转修改工单
|
||||
const handleEdit = (item) => {
|
||||
const projectId = item.projectId || item.id
|
||||
if (!projectId) {
|
||||
uni.showToast({
|
||||
title: '项目ID不存在',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
// 获取工作票ID,支持 ticketIds 或 ticketId 字段
|
||||
const ticketId = item.ticketIds || item.ticketId
|
||||
// 构建跳转URL,添加 edit=1 标识为修改模式
|
||||
let url = `/pages/WorkOrderEdit/index?projectId=${projectId}&edit=1`
|
||||
if (ticketId) {
|
||||
// 如果 ticketIds 是数组,取第一个;如果是单个值,直接使用
|
||||
const ticketIdValue = Array.isArray(ticketId) ? ticketId[0] : ticketId
|
||||
url += `&workTicketId=${ticketIdValue}`
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
})
|
||||
}
|
||||
|
||||
// 跳转到详情页
|
||||
const handleDetail = (item) => {
|
||||
const projectId = item.projectId || item.id
|
||||
|
|
@ -166,6 +190,55 @@ const handleDetail = (item) => {
|
|||
})
|
||||
}
|
||||
|
||||
// 撤回工作计划
|
||||
const handleWithdraw = async (item, index) => {
|
||||
try {
|
||||
// 确认撤回
|
||||
const res = await new Promise((resolve) => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `确定要撤回项目"${item.projectName || '未命名项目'}"吗?`,
|
||||
confirmText: '撤回',
|
||||
confirmColor: '#ff9900',
|
||||
success: (result) => {
|
||||
resolve(result.confirm)
|
||||
},
|
||||
fail: () => {
|
||||
resolve(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
|
||||
// 获取项目ID,优先使用 projectId,如果没有则使用 id
|
||||
const projectId = item.projectId || item.id
|
||||
if (!projectId) {
|
||||
uni.showToast({
|
||||
title: '项目ID不存在',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 调用撤回接口
|
||||
await withdrawWorkPlan(projectId)
|
||||
|
||||
uni.showToast({
|
||||
title: '撤回成功',
|
||||
icon: 'success'
|
||||
})
|
||||
|
||||
// 撤回成功后,刷新列表
|
||||
await fetchWorkPlanList()
|
||||
} catch (error) {
|
||||
console.error('撤回失败:', error)
|
||||
// 错误提示已在 request.js 的拦截器中处理
|
||||
}
|
||||
}
|
||||
|
||||
// 删除工作计划
|
||||
const handleDelete = async (item, index) => {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -137,13 +137,19 @@ const restoreFormData = (data) => {
|
|||
}
|
||||
if (data.period && Array.isArray(data.period) && data.period.length >= 2) {
|
||||
if (data.period[0]) {
|
||||
startDateText.value = data.period[0];
|
||||
startDate.value = dayjs(data.period[0]).valueOf();
|
||||
// 处理日期字符串,提取日期部分(处理 "2020-01-01 00:00:00" 格式)
|
||||
const startDateStr = String(data.period[0]).split(' ')[0];
|
||||
startDateText.value = startDateStr;
|
||||
startDate.value = dayjs(startDateStr).isValid() ? dayjs(startDateStr).valueOf() : null;
|
||||
}
|
||||
if (data.period[1]) {
|
||||
endDateText.value = data.period[1];
|
||||
endDate.value = dayjs(data.period[1]).valueOf();
|
||||
// 处理日期字符串,提取日期部分(处理 "2020-01-01 00:00:00" 格式)
|
||||
const endDateStr = String(data.period[1]).split(' ')[0];
|
||||
endDateText.value = endDateStr;
|
||||
endDate.value = dayjs(endDateStr).isValid() ? dayjs(endDateStr).valueOf() : null;
|
||||
}
|
||||
// 更新 formData.period,确保数据同步
|
||||
UpdatePeriod();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -296,10 +296,10 @@ const restoreFormData = (data) => {
|
|||
formData.value.CarList = [...data.CarList];
|
||||
}
|
||||
if (data.remark) formData.value.remark = data.remark;
|
||||
// 恢复文件列表(如果需要的话,可以从 data 中恢复)
|
||||
// if (data.fileList && Array.isArray(data.fileList)) {
|
||||
// fileList1.value = [...data.fileList];
|
||||
// }
|
||||
// 恢复文件列表
|
||||
if (data.fileList && Array.isArray(data.fileList)) {
|
||||
fileList1.value = [...data.fileList];
|
||||
}
|
||||
};
|
||||
|
||||
// 监听 allData.GatePassInfo 的变化,恢复表单数据
|
||||
|
|
@ -358,7 +358,11 @@ defineExpose({
|
|||
return typeof id === 'string' ? parseInt(id) || id : id;
|
||||
});
|
||||
|
||||
// 获取出入证ID(修改模式下需要)
|
||||
const accessPermitId = props.allData?.GatePassInfo?.id || null;
|
||||
|
||||
return {
|
||||
permitId: accessPermitId, // 修改模式下需要传入ID(使用permitId字段)
|
||||
projectId,
|
||||
workLocation,
|
||||
sysUserIds,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -75,8 +75,6 @@ async function handleLogin() {
|
|||
password: formData.password,
|
||||
role: formData.role
|
||||
})
|
||||
console.log(response);
|
||||
|
||||
// 保存用户信息和token
|
||||
if (response) {
|
||||
userStore.setUserInfo(response)
|
||||
|
|
|
|||
Loading…
Reference in New Issue