7 changed files with 1175 additions and 1 deletions
@ -0,0 +1,53 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// 查询隐患记录登记信息列表
|
|||
export function listRecord(query) { |
|||
return request({ |
|||
url: '/build/hazardRecord/list', |
|||
method: 'post', |
|||
data: query |
|||
}) |
|||
} |
|||
|
|||
// 查询隐患记录登记信息详细
|
|||
export function getRecord(id) { |
|||
return request({ |
|||
url: '/build/hazardRecord/' + id, |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
// 新增隐患记录登记信息
|
|||
export function addRecord(data) { |
|||
return request({ |
|||
url: '/build/hazardRecord', |
|||
method: 'post', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 修改隐患记录登记信息
|
|||
export function updateRecord(data) { |
|||
return request({ |
|||
url: '/build/hazardRecord', |
|||
method: 'put', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 删除隐患记录登记信息
|
|||
export function delRecord(id) { |
|||
return request({ |
|||
url: '/build/hazardRecord/' + id, |
|||
method: 'delete' |
|||
}) |
|||
} |
|||
|
|||
// 导出隐患记录登记信息
|
|||
export function exportRecord(query) { |
|||
return request({ |
|||
url: '/build/hazardRecord/export', |
|||
method: 'get', |
|||
params: query |
|||
}) |
|||
} |
@ -0,0 +1,490 @@ |
|||
<template> |
|||
<view class="project-add"> |
|||
<!-- 项目新增表单卡片 --> |
|||
<view class="cc-card form-card"> |
|||
<view class="form-title">{{ pageTitle }}</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">隐患名称</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.hazardName" class="form-input" placeholder="请输入隐患名称" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">项目名称</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.entryName" class="form-input" placeholder="请输入项目名称" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">排查计划</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.investigationPlan" class="form-input" placeholder="请输入排查计划" type="number" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">检查单位</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.inspectionUnit" class="form-input" placeholder="请输入检查单位" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">检查责任人</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.personCgeInspection" class="form-input" placeholder="请输入检查责任人" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">检查周期</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.inspectionCycle" class="form-input" placeholder="请输入检查周期" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">检查人列表信息</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.checkerListInfo" class="form-input" placeholder="请输入检查人列表信息" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">隐患描述</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.hazardDescription" class="form-input" placeholder="请输入隐患描述" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">隐患所在区域</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.hazardLocationArea" class="form-input" placeholder="请输入隐患所在区域" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">隐患类型</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.hazardType" class="form-input" placeholder="请输入隐患类型" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">隐患等级</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.hazardLevel" class="form-input" placeholder="请输入隐患等级" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">整改期限</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.rectificationDeadline" class="form-input" placeholder="请输入整改期限" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="form-item"> |
|||
<text class="form-label">整改责任单位</text> |
|||
<view class="form-content"> |
|||
<input v-model="form.rectificationResponsibleUnit" class="form-input" placeholder="请输入整改责任单位" /> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="cc-form-card" style="margin-top: 16px;margin-bottom: 16px;"> |
|||
<view class="form-title"> |
|||
<view>图片</view> |
|||
<view class="form-tips">支持png、jpg等格式,不大于5M</view> |
|||
</view> |
|||
|
|||
<view class="form-item" style="margin-bottom: 0;"> |
|||
<div class="img-box"> |
|||
<div class="img-list"> |
|||
<div |
|||
v-for="(item, index) in imgPreviewList" |
|||
:key="index" |
|||
class="img-item" |
|||
> |
|||
<image :src="item" @click="previewImage(index)" /> |
|||
<button class="delete-btn" @click="deleteImage(index)">删除</button> |
|||
</div> |
|||
<div class="file-select" @click="chooseAttachment"></div> |
|||
</div> |
|||
</div> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="cc-operation-row operation-row"> |
|||
<view class="buttons-group"> |
|||
<view class="button primary-button" @click="handleConfirm">确定</view> |
|||
<view class="button default-button" @click="handleCancle">取消</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
listRecord, |
|||
getRecord, |
|||
addRecord, |
|||
updateRecord, |
|||
delRecord, |
|||
exportRecord, |
|||
} from "@/api/system/hazardRecord"; |
|||
import {baseUrl} from "@/config"; |
|||
import {getToken} from "@/utils/auth"; |
|||
export default { |
|||
data() { |
|||
return { |
|||
form: { |
|||
id: this.$route.query.monitorId, |
|||
hazardName: '', |
|||
entryName: '', |
|||
investigationPlan: '', |
|||
inspectionUnit: '', |
|||
personCgeInspection: '', |
|||
inspectionCycle: '', |
|||
checkerListInfo: '', |
|||
hazardDescription: '', |
|||
hazardType: '', |
|||
hazardLevel: '', |
|||
rectificationDeadline: '', |
|||
rectificationResponsibleUnit: '', |
|||
hazardAttachment: '', |
|||
proNo: this.$route.query.proNo |
|||
}, |
|||
pageTitle: '添加隐患登记信息', |
|||
imagePath: '', // 用于存储选中的图片路径 |
|||
proNo: this.$route.query.proNo, |
|||
proCode: this.$route.query.proCode, |
|||
projectName: this.$route.query.projectName, |
|||
headers: { |
|||
jianwei: "jwtech " + getToken(), |
|||
}, |
|||
imgList: [], |
|||
imgPreviewList: [], |
|||
// imgPreviewList: ["http://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960", "http://gips1.baidu.com/it/u=3874647369,3220417986&fm=3028&app=3028&f=JPEG&fmt=auto?w=720&h=1280"] |
|||
}; |
|||
}, |
|||
created () { |
|||
this.handleJudgeTitle() |
|||
this.getDetailInfo() |
|||
}, |
|||
methods: { |
|||
// 处理标题名称 |
|||
handleJudgeTitle() { |
|||
let operateType = this.$route.query.operateType |
|||
if (operateType === 'add') { |
|||
this.pageTitle = '添加隐患登记信息' |
|||
} else { |
|||
this.pageTitle = '编辑隐患登记信息' |
|||
} |
|||
}, |
|||
|
|||
getDetailInfo() { |
|||
if (this.form.id) { |
|||
getRecord(this.form.id).then(res => { |
|||
if (res.data.hazardAttachment) { |
|||
this.imgList = JSON.parse(res.data.hazardAttachment) |
|||
this.imgPreviewList = this.imgList.map(item => { |
|||
item.url |
|||
}) |
|||
} |
|||
this.form = res.data |
|||
}) |
|||
} |
|||
}, |
|||
|
|||
handleConfirm() { |
|||
if (!this.judgeAttrWrite()) { |
|||
return |
|||
} |
|||
uni.showLoading({ |
|||
title: '提交中...', |
|||
mask: true |
|||
}) |
|||
if (this.imgList && this.imgList.length>0) { |
|||
this.form.hazardAttachment = JSON.stringify(this.imgList) |
|||
} |
|||
if (this.form.id) { |
|||
updateRecord(this.form).then(res => { |
|||
uni.showToast({ |
|||
title: '提交成功', |
|||
icon: 'none' |
|||
}) |
|||
this.$tab.redirectTo(`/pages/danger/list?operateType=add&proNo=${this.proNo}&proCode=${this.proCode}&menuType=${0}&projectName=${this.projectName}`) |
|||
// uni.navigateTo({ |
|||
// url: '/pages/danger/list?tabNum=1&id=' + this.$route.query.id + '&proNo=' |
|||
// }) |
|||
uni.hideLoading() |
|||
}) |
|||
} else { |
|||
addRecord(this.form).then(res => { |
|||
uni.showToast({ |
|||
title: '提交成功', |
|||
icon: 'none' |
|||
}) |
|||
uni.hideLoading() |
|||
// uni.navigateTo({ |
|||
// url: '/pages/danger/list?tabNum=1&id=' + this.$route.query.id |
|||
// }) |
|||
this.$tab.redirectTo(`/pages/danger/list?operateType=add&proNo=${this.proNo}&proCode=${this.proCode}&menuType=${0}&projectName=${this.projectName}`) |
|||
}) |
|||
} |
|||
}, |
|||
|
|||
handleCancle() { |
|||
uni.navigateBack() |
|||
}, |
|||
|
|||
// 判断必填项是否填写 |
|||
judgeAttrWrite() { |
|||
const form = this.form |
|||
if (!form.hazardName) { |
|||
uni.showToast({ |
|||
title: `隐患名称不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.entryName) { |
|||
uni.showToast({ |
|||
title: `项目名称不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.investigationPlan) { |
|||
uni.showToast({ |
|||
title: `排查计划不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.inspectionUnit) { |
|||
uni.showToast({ |
|||
title: `检查单位不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.personCgeInspection) { |
|||
uni.showToast({ |
|||
title: `检查责任人不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.inspectionCycle) { |
|||
uni.showToast({ |
|||
title: `检查周期不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.checkerListInfo) { |
|||
uni.showToast({ |
|||
title: `检查人列表信息不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.hazardDescription) { |
|||
uni.showToast({ |
|||
title: `隐患描述不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.hazardLocationArea) { |
|||
uni.showToast({ |
|||
title: `隐患所在区域不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.hazardType) { |
|||
uni.showToast({ |
|||
title: `隐患类型不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.hazardLevel) { |
|||
uni.showToast({ |
|||
title: `隐患等级不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.rectificationDeadline) { |
|||
uni.showToast({ |
|||
title: `整改期限不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
if (!form.rectificationResponsibleUnit) { |
|||
uni.showToast({ |
|||
title: `整改责任单位不能为空!`, |
|||
icon: 'none' |
|||
}) |
|||
return false |
|||
} |
|||
return true |
|||
}, |
|||
|
|||
// 选择上传附件 |
|||
chooseAttachment() { |
|||
uni.showActionSheet({ |
|||
itemList: ['照相机', '图册'], |
|||
success: (res) => { |
|||
if (res.tapIndex === 0) { |
|||
// 选择拍照 |
|||
this.takePhoto(); |
|||
} else if (res.tapIndex === 1) { |
|||
// 选择从相册选择 |
|||
this.chooseFromGallery(); |
|||
} |
|||
}, |
|||
fail: (err) => { |
|||
console.log('选择附件失败', err); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// 拍照 |
|||
takePhoto() { |
|||
uni.chooseImage({ |
|||
count: 1, // 选择1张图片 |
|||
sourceType: ['camera'], // 仅允许拍照 |
|||
success: (res) => { |
|||
const tempFilePath = res.tempFilePaths[0]; |
|||
const fileName = res.tempFiles[0].name |
|||
this.uploadFile(tempFilePath, fileName); // 上传文件 |
|||
}, |
|||
fail: (err) => { |
|||
console.log('拍照失败', err); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// 从相册选择 |
|||
chooseFromGallery() { |
|||
uni.chooseImage({ |
|||
count: 1, // 选择1张图片 |
|||
sourceType: ['album'], // 仅允许从相册选择 |
|||
success: (res) => { |
|||
const tempFilePath = res.tempFilePaths[0]; |
|||
const fileName = res.tempFiles[0].name |
|||
this.uploadFile(tempFilePath, fileName); // 上传文件 |
|||
}, |
|||
fail: (err) => { |
|||
console.log('从相册选择失败', err); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// 上传文件 |
|||
uploadFile(filePath, fileName) { |
|||
console.log('上传成功', fileName) |
|||
let token="jwtech " + getToken() |
|||
// 替换为你的后端接口地址 |
|||
const uploadUrl = baseUrl+'/common/upload'; |
|||
uni.uploadFile({ |
|||
header: { |
|||
'jianwei':token, |
|||
}, |
|||
url: uploadUrl, // 你的服务器上传接口 |
|||
filePath: filePath, |
|||
name: 'file', |
|||
success: (uploadFileRes) => { |
|||
let imageItem = JSON.parse(uploadFileRes.data) |
|||
// 将选择的图片添加到 imageList |
|||
imageItem.name = fileName |
|||
this.imgList.push(imageItem) |
|||
this.imgPreviewList.push(imageItem.url) |
|||
console.log('上传成功', this.imgPreviewList) |
|||
// 你可以在这里处理返回的数据 |
|||
}, |
|||
fail: (uploadFileErr) => { |
|||
console.log('上传失败', uploadFileErr); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// 图片放大查看 |
|||
previewImage(index) { |
|||
uni.previewImage({ |
|||
current: index, // 当前显示的图片索引 |
|||
urls: this.imgPreviewList // 图片列表 |
|||
}); |
|||
}, |
|||
|
|||
// 删除图片 |
|||
deleteImage(index) { |
|||
this.imgPreviewList.splice(index, 1); |
|||
this.imgList.splice(index, 1); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.project-add { |
|||
padding: 16px 20px 80px; |
|||
.file-select { |
|||
width: 72px; |
|||
height: 72px; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
border: 1px solid #e7e7e7; |
|||
border-radius: 4px; |
|||
font-size: 0; |
|||
uni-button { |
|||
display: none; |
|||
} |
|||
&::after { |
|||
content: '+'; |
|||
font-size: 38px; |
|||
color: #00B39D; |
|||
} |
|||
} |
|||
.img-box { |
|||
.img-list { |
|||
width: 100%; |
|||
display: flex; |
|||
align-items: center; |
|||
flex-wrap: wrap; |
|||
.img-item { |
|||
position: relative; |
|||
image { |
|||
width: 72px; |
|||
// width: calc(calc(100% - 30px) / 4); |
|||
height: 72px; |
|||
border: 1px solid #e7e7e7; |
|||
} |
|||
.delete-btn { |
|||
position: absolute; |
|||
top: 5px; |
|||
right: 5px; |
|||
background-color: #3b3838; |
|||
font-size: 12px; |
|||
color: white; |
|||
border: none; |
|||
padding: 0 2px; |
|||
border-radius: 50%; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,231 @@ |
|||
<template> |
|||
<view class="project"> |
|||
<view class="cc-header"> |
|||
<!-- 搜索框 --> |
|||
<view class="cc-search search-bar"> |
|||
<view class="search-box"> |
|||
<image src="/static/images/icon/search.png" /> |
|||
<input type="text" v-model="queryParams.data.projectName" @confirm="handleSearchProjectList" placeholder="请输入项目名称" /> |
|||
</view> |
|||
</view> |
|||
<!-- 行政区划和项目类型下拉框 --> |
|||
<view class="cc-query-dropdowns dropdowns"> |
|||
<region-picker @trigge-method="handleRegionParams" /> |
|||
<project-type-picker @trigge-method="handleProjectTypeParams" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 项目列表 --> |
|||
<view class="cc-project-list project-list"> |
|||
<view v-for="(project, index) in projects" :key="index" class="cc-card project-card"> |
|||
<view class="attr-item project-title">{{ project.projectName }}</view> |
|||
<view class="attr-item"> |
|||
<view class="attr-title">项目编号</view> |
|||
<view class="attr-value">{{ project.proCode }}</view> |
|||
</view> |
|||
<view class="attr-item"> |
|||
<view class="attr-title">行政区划</view> |
|||
<view class="attr-value">{{ project.adcdName }}</view> |
|||
</view> |
|||
<view class="attr-item"> |
|||
<view class="attr-title">项目类型</view> |
|||
<view class="attr-value">{{ project.projectTypeName }}</view> |
|||
</view> |
|||
<view class="operate-buttons"> |
|||
<view class="buttons-group"> |
|||
<view class="primary-button__text button" @click="handleToDanger(project)">隐患等级</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<no-data-view v-if="projects.length === 0" /> |
|||
<uni-load-more v-if="queryParams.pageNum == pages" status="no-more"></uni-load-more> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { getProjectListApi } from '@/api/system/project' |
|||
import { addressList } from '@/uni_modules/piaoyi-cityPicker/components/piaoyi-cityPicker/cityData.js' |
|||
import NoDataView from '@/components/no-data-view/no-data-view.vue' |
|||
import RegionPicker from '@/components/region-picker/region-picker.vue' |
|||
import ProjectTypePicker from '@/components/project-type-picker/project-type-picker.vue' |
|||
|
|||
export default { |
|||
components: { |
|||
NoDataView, |
|||
RegionPicker, |
|||
ProjectTypePicker |
|||
}, |
|||
data() { |
|||
return { |
|||
selectedDistrict: 0, // 行政区划选择的索引 |
|||
selectedProjectType: 0, // 项目类型选择的索引 |
|||
districts: ['请选择', '北京市', '上海市', '广州市'], // 行政区划数据 |
|||
projectTypes: ['请选择', '建筑', 'IT', '教育'], // 项目类型数据 |
|||
testArray: [['重大项目', '面上项目', '其他'], ['引调水改成', '枢纽工程'], ['新建水库', '病险']], |
|||
projects: [], |
|||
queryParams: { |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
params: {orderBy: "create_time", sortBy: "desc"}, |
|||
data: { |
|||
projectName: '', |
|||
adcd: '' |
|||
} |
|||
}, |
|||
pages: 0, |
|||
// 省市区数据 |
|||
addressTreeList: addressList, |
|||
addressList: [], |
|||
// 重大项目字典 |
|||
zd_projectTypeOptions: [], |
|||
// 面上项目字典 |
|||
ms_projectTypeOptions: [], |
|||
}; |
|||
}, |
|||
created () { |
|||
this.handleAddressTreeData() |
|||
this.getProjectList() |
|||
this.getDicts("major_project").then((response) => { |
|||
this.zd_projectTypeOptions = response.data |
|||
}) |
|||
this.getDicts("general_project").then((response) => { |
|||
this.ms_projectTypeOptions = response.data |
|||
}) |
|||
}, |
|||
onReachBottom() { |
|||
if (this.queryParams.pageNum < this.pages) { |
|||
this.queryParams.pageNum++ // 页码加1 |
|||
this.getProjectList() |
|||
} |
|||
}, |
|||
methods: { |
|||
// 检索项目 |
|||
handleSearchProjectList() { |
|||
this.queryParams.pageNum = 1 |
|||
this.getProjectList('again') |
|||
}, |
|||
|
|||
// 获取项目列表 |
|||
getProjectList(mode) { |
|||
uni.showLoading({ |
|||
title: '加载中...', |
|||
mask: true |
|||
}) |
|||
getProjectListApi(this.queryParams).then(res => { |
|||
if (mode === 'again') { |
|||
this.projects = [] |
|||
uni.pageScrollTo({ |
|||
scrollTop: 0, // 设置滚动到顶部 |
|||
duration: 300 // 滚动动画持续时间,单位为毫秒 |
|||
}) |
|||
} |
|||
this.projects = [...this.projects, ...res.records] |
|||
this.pages = res.pages |
|||
this.projects.forEach(projectItem => { |
|||
projectItem.adcdName = this.formatAdcd(projectItem) |
|||
projectItem.projectTypeName = this.projectTypeFormat(projectItem) |
|||
}) |
|||
uni.hideLoading() |
|||
}) |
|||
}, |
|||
|
|||
// 处理区划请求 |
|||
handleRegionParams(adcd) { |
|||
this.queryParams.pageNum = 1 |
|||
this.queryParams.data.adcd = adcd |
|||
this.getProjectList('again') |
|||
}, |
|||
|
|||
// 处理项目类型 |
|||
handleProjectTypeParams(params) { |
|||
this.queryParams.pageNum = 1 |
|||
this.queryParams.data.projectType = params.projectType |
|||
this.queryParams.data.isMajor = params.isMajor |
|||
this.getProjectList('again') |
|||
}, |
|||
|
|||
// 将省市区的树状数据分解成列表,并在后面补零 |
|||
handleAddressTreeData() { |
|||
let result = [] |
|||
function traverse(node) { |
|||
result.push({ code: node.code, name: node.name, dictLabel: node.name, dictValue: node.code}) // 将当前节点添加到结果中 |
|||
if (node.children) { |
|||
node.children.forEach(child => traverse(child)) // 递归遍历子节点 |
|||
} |
|||
} |
|||
this.addressTreeList.forEach(node => traverse(node)) // 遍历树的每个根节点 |
|||
this.addressList = result |
|||
this.addressList.forEach(item => { |
|||
if (item.code.length===2) { |
|||
item.code = item.dictValue = item.code + '0000' |
|||
} |
|||
if (item.code.length===4) { |
|||
item.code = item.dictValue = item.code + '00' |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
// 处理省市区显示 |
|||
formatAdcd(row) { |
|||
if (row.adcd) { |
|||
let provinceCode = row.adcd.slice(0, 2)+"0000"; |
|||
let cityCode = row.adcd.slice(0, 4)+"00"; |
|||
let areaCode = row.adcd; |
|||
let s=""; |
|||
if (areaCode.length > 2) { |
|||
s=this.areaCodeFormat(provinceCode) |
|||
if (cityCode!=provinceCode){ |
|||
s+="-"+this.areaCodeFormat(cityCode) |
|||
} |
|||
if (areaCode!=cityCode){ |
|||
s+="-" + this.areaCodeFormat(areaCode) |
|||
} |
|||
} |
|||
return s |
|||
} |
|||
}, |
|||
|
|||
//行政区划字典 |
|||
areaCodeFormat(adcd, column) { |
|||
return this.selectDictLabel( |
|||
this.addressList, |
|||
adcd |
|||
); |
|||
}, |
|||
|
|||
// 项目类型字典翻译 |
|||
projectTypeFormat(row, column) { |
|||
if (row.isMajor == "zd") { |
|||
return this.selectDictLabel( |
|||
this.zd_projectTypeOptions, |
|||
row.projectType |
|||
); |
|||
} else if (row.isMajor == "ms") { |
|||
return this.selectDictLabel( |
|||
this.ms_projectTypeOptions, |
|||
row.projectType |
|||
); |
|||
}else if (row.isMajor !=null){ |
|||
return '其他' |
|||
} |
|||
}, |
|||
|
|||
// 跳转到隐患排查列表页面 |
|||
handleToDanger(projectItem) { |
|||
// uni.navigateTo({ |
|||
// url: '/pages/danger/list?id=' + projectItem.id |
|||
// }) |
|||
this.$tab.navigateTo(`/pages/danger/list?operateType=add&proNo=${projectItem.proNo}&proCode=${projectItem.proCode}&menuType=${0}&projectName=${projectItem.projectName}`) |
|||
}, |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.project { |
|||
.project-list { |
|||
padding: 114px 20px 16px; |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,376 @@ |
|||
<template> |
|||
<view class="project"> |
|||
<view class="cc-header"> |
|||
<!-- 搜索框 --> |
|||
<view class="cc-search search-bar"> |
|||
<view class="search-box"> |
|||
<image src="/static/images/icon/search.png" /> |
|||
<input v-model="queryParams.cv.value" type="text" placeholder="请输入隐患名称" @confirm="handleSearchProjectList" /> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 项目列表 --> |
|||
<view class="cc-project-list"> |
|||
<view v-for="(project, index) in problemList" :key="index" class="project-card"> |
|||
<view class="attr-item project-title">{{ project.hazardName }}</view> |
|||
<view class="attr-item"> |
|||
<view class="attr-title">项目名称</view> |
|||
<view class="attr-value">{{ project.entryName }}</view> |
|||
</view> |
|||
<view class="attr-item"> |
|||
<view class="attr-title">检查计划</view> |
|||
<view class="attr-value">{{ project.investigationPlan }}</view> |
|||
</view> |
|||
<view class="attr-item"> |
|||
<view class="attr-title">检查单位</view> |
|||
<view class="attr-value">{{ project.inspectionUnit }}</view> |
|||
</view> |
|||
<view class="attr-item"> |
|||
<view class="attr-title">检查责任人</view> |
|||
<view class="attr-value">{{ project.personCgeInspection }}</view> |
|||
</view> |
|||
<view class="attr-item"> |
|||
<view class="attr-title">检查周期</view> |
|||
<view class="attr-value">{{ project.inspectionCycle }}</view> |
|||
</view> |
|||
<view class="attr-item"> |
|||
<view class="attr-title">隐患描述</view> |
|||
<view class="attr-value">{{ project.hazardDescription }}</view> |
|||
</view> |
|||
<view class="operate-buttons"> |
|||
<view class="buttons-group"> |
|||
<view class="primary-button__text button" @click="handleDangerInfo(project)">修改</view> |
|||
<view class="error-button__text button" @click="handleDeleteCheck(project)">删除</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<no-data-view v-if="problemList.length === 0" /> |
|||
<uni-load-more v-if="queryParams.pageNum == pages" status="no-more"></uni-load-more> |
|||
</view> |
|||
|
|||
<!-- 操作按钮 --> |
|||
<view class="operation-buttons"> |
|||
<view class="buttons-group"> |
|||
<view class="primary-button button" @click="handleAddCheck()">新增隐患</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 提示窗示例 --> |
|||
<uni-popup ref="delectDialog" type="dialog"> |
|||
<uni-popup-dialog type="error" cancelText="取消" confirmText="确认" title="警告" content="是否确认删除该数据" @confirm="handleDeleteDialogConfirm"></uni-popup-dialog> |
|||
</uni-popup> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
// import { projectCheckListApi } from '@/api/system/project' |
|||
import { |
|||
listRecord, |
|||
getRecord, |
|||
addRecord, |
|||
updateRecord, |
|||
delRecord, |
|||
exportRecord, |
|||
} from "@/api/system/hazardRecord"; |
|||
import NoDataView from '@/components/no-data-view/no-data-view.vue' |
|||
export default { |
|||
components: { |
|||
NoDataView |
|||
}, |
|||
data() { |
|||
return { |
|||
searchQuery: '', // 搜索框的内容 |
|||
selectedDistrict: 0, // 行政区划选择的索引 |
|||
selectedProjectType: 0, // 项目类型选择的索引 |
|||
districts: ['请选择', '北京市', '上海市', '广州市'], // 行政区划数据 |
|||
projectTypes: ['请选择', '建筑', 'IT', '教育'], // 项目类型数据 |
|||
queryParams: { |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
params: {orderBy: "create_time", sortBy: "desc"}, |
|||
data: { |
|||
proNo: this.$route.query.proNo, |
|||
// projectName: this.$route.query.projectName, |
|||
menuType: '0', |
|||
checkType: '', |
|||
checkTime: '' |
|||
}, |
|||
cv: { |
|||
name: "hazardName", |
|||
type: "like", |
|||
value: null, |
|||
}, |
|||
}, |
|||
proNo: this.$route.query.proNo, |
|||
proCode: this.$route.query.proCode, |
|||
projectName: this.$route.query.projectName, |
|||
projects: [], |
|||
problemList: [], |
|||
pages: 0, |
|||
checkTypes: [], |
|||
checkTypeNames: [], |
|||
deleteCheckDraftId: '' |
|||
}; |
|||
}, |
|||
created() { |
|||
this.getDicts("check_type").then((response) =>{ |
|||
this.checkTypes = response.data |
|||
this.checkTypeNames = this.checkTypes.map(item => item.dictLabel) |
|||
}) |
|||
this.getList() |
|||
}, |
|||
// onReachBottom() { |
|||
// if (this.queryParams.pageNum < this.pages) { |
|||
// this.queryParams.pageNum++; // 页码加1 |
|||
// this.getList() |
|||
// } |
|||
// }, |
|||
methods: { |
|||
changeTab(index) { |
|||
this.activeTab = index |
|||
this.queryParams.pageNum = 1 |
|||
this.getList('again') |
|||
}, |
|||
// 获取项目列表 |
|||
getList(mode) { |
|||
uni.showLoading({ |
|||
title: '加载中...', |
|||
mask: true |
|||
}) |
|||
listRecord(this.queryParams).then(res => { |
|||
if (mode === 'again') { |
|||
this.projectCheckList = [] |
|||
uni.pageScrollTo({ |
|||
scrollTop: 0, // 设置滚动到顶部 |
|||
duration: 300 // 滚动动画持续时间,单位为毫秒 |
|||
}) |
|||
} |
|||
this.problemList = res.records |
|||
// this.problemList = res.records[0].bsSgcJsjdBuiRegulatoryInspections |
|||
// this.problemList.forEach(item => { |
|||
// this.menuTypeName = this.formatMenuType(item) |
|||
// }) |
|||
// this.projectCheckList = [...this.projectCheckList, ...res.records] |
|||
// this.pages = res.pages |
|||
// this.projectCheckList.forEach(projectItem => { |
|||
// projectItem.adcdName = this.formatAdcd(projectItem) |
|||
// }) |
|||
uni.hideLoading() |
|||
}) |
|||
}, |
|||
|
|||
// 监督检查类型字典翻译 |
|||
checkTypesFormat(row, column) { |
|||
return this.selectDictLabel( |
|||
this.checkTypes, |
|||
row.checkType |
|||
); |
|||
}, |
|||
|
|||
formatMenuType(row) { |
|||
let res; |
|||
switch (row?.menuType) { |
|||
case "0": |
|||
res = "项目法人履职检查"; |
|||
break; |
|||
case "1": |
|||
res = "质量检查"; |
|||
break; |
|||
case "2": |
|||
res = "市场监督专项检查"; |
|||
break; |
|||
case "3": |
|||
res = "防洪度汛检查"; |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
return res; |
|||
}, |
|||
|
|||
handleSearchProjectList() { |
|||
this.searchQuery = '' |
|||
this.queryParams.pageNum = 1 |
|||
this.getList('again') |
|||
}, |
|||
|
|||
handleDateChange(e) { |
|||
this.queryParams.inspectionDate = e.detail.value |
|||
}, |
|||
handleCheckTypeChange(e) { |
|||
this.queryParams.checkType = this.checkTypes[e.detail.value] |
|||
}, |
|||
handleAddCheck() { |
|||
this.$tab.navigateTo(`/pages/danger/edit?operateType=add&proNo=${this.proNo}&proCode=${this.proCode}&menuType=${0}&projectName=${this.projectName}`) |
|||
}, |
|||
handleDangerInfo(item) { |
|||
// 跳转到编辑问题页面 |
|||
this.$tab.navigateTo(`/pages/danger/edit?operateType=edit&proNo=${this.proNo}&proCode=${this.proCode}&monitorId=${item.id}`) |
|||
}, |
|||
handleDeleteCheck(item) { |
|||
this.deleteCheckDraftId = item.id |
|||
this.$refs.delectDialog.open() |
|||
}, |
|||
// 处理删除 |
|||
handleDeleteDialogConfirm() { |
|||
delRecord(this.deleteCheckDraftId).then(res => { |
|||
uni.showToast({ |
|||
title: `删除项目成功`, |
|||
icon: 'none' |
|||
}) |
|||
this.getList('again') |
|||
}) |
|||
}, |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.project { |
|||
// padding: 20px; |
|||
.tabs { |
|||
height: 48px; |
|||
display: flex; |
|||
justify-content: space-around; |
|||
background-color: #fff; |
|||
.tab { |
|||
flex: 1; |
|||
display: flex; |
|||
align-items: center; |
|||
text-align: center; |
|||
justify-content: center; |
|||
color: #595959; |
|||
cursor: pointer; |
|||
&.active { |
|||
color: #00B39D; |
|||
.tab-text { |
|||
position: relative; |
|||
height: 100%; |
|||
display: flex; |
|||
align-items: center; |
|||
&::after { |
|||
content: ''; |
|||
position: absolute; |
|||
bottom: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 3px; |
|||
background: #00B39D; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
// .search-bar { |
|||
// padding: 12px 25px; |
|||
// background: #fff; |
|||
// border-top: 1px solid #f0f0f0; |
|||
// border-bottom: 1px solid #f0f0f0; |
|||
// .search-box { |
|||
// padding: 8px 20px; |
|||
// background: #f7f8fa; |
|||
// border-radius: 8px; |
|||
// } |
|||
// input { |
|||
// width: 100%; |
|||
// border: none; |
|||
// border-radius: 5px; |
|||
// } |
|||
// } |
|||
.cc-project-list { |
|||
padding: 66px 20px 96px; |
|||
} |
|||
.project-list { |
|||
padding: 0 20px 95px; |
|||
.project-card { |
|||
background-color: #fff; |
|||
padding: 20px 0 0 0; |
|||
margin-top: 10px; |
|||
border-radius: 8px; |
|||
box-shadow: 0 2px 5px rgba(0,0,0,0.1); |
|||
margin-top: 15px; |
|||
.attr-item { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
color: #262626; |
|||
padding: 0 20px 20px 20px; |
|||
padding-bottom: 15px; |
|||
.attr-title { |
|||
font-size: 16px; |
|||
color: #595959; |
|||
} |
|||
.attr-value { |
|||
&.no-done { |
|||
color: #FF0000; |
|||
} |
|||
} |
|||
} |
|||
.operate-buttons { |
|||
border-top: 1px solid #f0f0f0; |
|||
display: flex; |
|||
height: 48px; |
|||
box-sizing: border-box; |
|||
.buttons-group { |
|||
width: 100%; |
|||
height: 100%; |
|||
display: flex; |
|||
&:nth-child(1) { |
|||
.button { |
|||
border-right: 1px solid #f0f0f0; |
|||
&:nth-last-child(1) { |
|||
border-right: 0; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
.button { |
|||
flex: 1; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
cursor: pointer; |
|||
&.primary-button__text { |
|||
color: #00B39D; |
|||
} |
|||
&.error-button__text { |
|||
color: #E04040; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
.project-title { |
|||
font-size: 18px; |
|||
} |
|||
} |
|||
.operation-buttons { |
|||
position: fixed; |
|||
bottom: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 80px; |
|||
padding: 16px 20px; |
|||
background: #fff; |
|||
border-top: 1px solid #f0f0f0; |
|||
.buttons-group { |
|||
height: 100%; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-around; |
|||
.button { |
|||
cursor: pointer; |
|||
} |
|||
.primary-button { |
|||
flex: 1; |
|||
height: 100%; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
color: #fff; |
|||
background-color: #00B39D; |
|||
border-radius: 8px; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
Loading…
Reference in new issue