You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
421 lines
12 KiB
421 lines
12 KiB
<template>
|
|
<view>
|
|
<view class="cc-card cc-form-card">
|
|
<view class="form-title">监督检查</view>
|
|
<view class="form-item">
|
|
<text class="form-label">项目名称</text>
|
|
<view class="form-content">
|
|
<input v-model="form.projectName" class="form-input" placeholder="请选择项目名称" disabled/>
|
|
<picker mode="selector" :range="projectNames" @change="onProjectChange">
|
|
<view class="form-select">
|
|
选择
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="form-item">
|
|
<text class="form-label">检查类型</text>
|
|
<view class="form-content">
|
|
<input v-model="showForm.checkType" class="form-input" placeholder="请选择检查类型" disabled/>
|
|
<picker mode="selector" :range="checkNameTypes" @change="onCheckTypeChange">
|
|
<view class="form-select">
|
|
选择
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="form-item">
|
|
<text class="form-label">检查时间</text>
|
|
<view class="form-content">
|
|
<input v-model="form.inspectionTime" class="form-input" placeholder="请选择检查时间" disabled/>
|
|
<picker mode="date" @change="onCheckTimeChange">
|
|
<view class="form-select">
|
|
选择
|
|
</view>
|
|
</picker>
|
|
</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.inspectionPerson" class="form-input" placeholder="请输入被检查单位" />
|
|
</view>
|
|
</view>
|
|
|
|
<view class="form-item">
|
|
<text class="form-label">组成成员</text>
|
|
<view class="form-content">
|
|
<input v-model="form.constituentMember" class="form-input" placeholder="请输入组成成员" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="cc-form-card" style="margin-top: 16px;">
|
|
<view class="form-title">
|
|
<view>检查通知</view>
|
|
<view class="form-tips">支持png、jpg、pdf、word等格式,不大于200M</view>
|
|
</view>
|
|
|
|
<view class="form-item" style="margin-bottom: 0;">
|
|
<uni-file-picker
|
|
:autoUpload="false"
|
|
file-mediatype="all"
|
|
file-extname="png,jpg,pdf,,doc,docx,xls,xlsx"
|
|
limit="10"
|
|
@select="handleSelectCheckFile"
|
|
@success="handleCheckFileSuccess"
|
|
></uni-file-picker>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="cc-form-card" style="margin-top: 16px;">
|
|
<view class="form-title">
|
|
<view>整改通知</view>
|
|
<view class="form-tips">支持png、jpg、pdf、word等格式,不大于200M</view>
|
|
</view>
|
|
|
|
<view class="form-item" style="margin-bottom: 0;">
|
|
<uni-file-picker limit="10" file-mediatype="all" file-extname="png,jpg,pdf,,doc,docx,xls,xlsx" @success="handleModifyFileSuccess"></uni-file-picker>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="cc-form-card" style="margin-top: 16px;">
|
|
<view class="form-title">
|
|
<view>整改回复</view>
|
|
<view class="form-tips">支持png、jpg、pdf、word等格式,不大于200M</view>
|
|
</view>
|
|
|
|
<view class="form-item" style="margin-bottom: 0;">
|
|
<uni-file-picker limit="10" file-mediatype="all" file-extname="png,jpg,pdf,,doc,docx,xls,xlsx" @success="handleReplyFileSuccess"></uni-file-picker>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { getProjectListApi } from '@/api/system/project'
|
|
import { addNewInspections, getInspections, updateInspections } from '@/api/system/check/inspections'
|
|
import { addInspectionsDraft, getInspectionsDraft, updateInspectionsDraft } from '@/api/system/check/inspectionsDraft'
|
|
export default {
|
|
name: "MonitorAdd",
|
|
props: {
|
|
monitorDraftId: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
monitorId: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
form: {
|
|
"menuType": "0",
|
|
"inspectionTypes": null,
|
|
"inspectionTime": "",
|
|
"inspectionPerson": "",
|
|
"constituentMember": "",
|
|
"noticeAttachment": "",
|
|
"checklist": "",
|
|
"rectificationReport": null,
|
|
"createTime": null,
|
|
"updateTime": null,
|
|
"remark": null,
|
|
"createUid": null,
|
|
"updateUid": null,
|
|
"owerDept": null,
|
|
"proCode": "",
|
|
"proNo": "",
|
|
"projectName": "",
|
|
"checkType": "",
|
|
"inspectionUnit": "",
|
|
"rectificationDtoList": []
|
|
},
|
|
showForm: {
|
|
checkType: ''
|
|
},
|
|
projectNames: [],
|
|
checkTypes: [],
|
|
checkNameTypes: [],
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
params: {orderBy: "create_time", sortBy: "desc"},
|
|
data: {
|
|
projectName: ''
|
|
}
|
|
},
|
|
projects: [],
|
|
projectNames: []
|
|
}
|
|
},
|
|
|
|
created() {
|
|
console.log("88888888888888888888888")
|
|
console.log(this.monitorId)
|
|
|
|
this.getProjectList()
|
|
this.getDicts("check_type").then((response) =>{
|
|
this.checkTypes = response.data
|
|
this.checkNameTypes = this.checkTypes.map(item => item.dictLabel)
|
|
})
|
|
if (this.monitorDraftId) {
|
|
getInspectionsDraft(this.draftId).then(res => {
|
|
this.form = res.data
|
|
this.showForm.checkType = this.checkTypeFormat(this.form.checkType)
|
|
})
|
|
} else if (this.monitorId) {
|
|
getInspections(this.monitorId).then(res => {
|
|
this.form = res.data
|
|
this.showForm.checkType = this.checkTypeFormat(this.form.checkType)
|
|
})
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
// 获取项目列表
|
|
getProjectList() {
|
|
uni.showLoading({
|
|
title: '加载中...',
|
|
mask: true
|
|
})
|
|
getProjectListApi(this.queryParams).then(res => {
|
|
this.projects = res.records
|
|
this.projectNames = this.projects.map(item => item.projectName)
|
|
uni.hideLoading()
|
|
})
|
|
},
|
|
|
|
// 处理选择项目
|
|
onProjectChange(e) {
|
|
const index = e.detail.value
|
|
this.form.projectName = this.projects[index].projectName
|
|
this.form.proNo = this.projects[index].id
|
|
this.form.proCode = this.projects[index].proCode
|
|
this.$forceUpdate()
|
|
},
|
|
|
|
onCheckTypeChange(e) {
|
|
this.showForm.checkType = this.checkTypes[e.detail.value].dictLabel
|
|
this.form.checkType = this.checkTypes[e.detail.value].dictValue
|
|
},
|
|
|
|
onCheckTimeChange(e) {
|
|
this.form.inspectionTime = e.detail.value
|
|
},
|
|
|
|
//行政区划字典
|
|
checkTypeFormat(checkType, column) {
|
|
return this.selectDictLabel(
|
|
this.checkTypes,
|
|
checkType
|
|
);
|
|
},
|
|
|
|
handleSelectCheckFile(e) {
|
|
const tempFiles = e.tempFiles
|
|
tempFiles.forEach(item => {
|
|
const reader = new FileReader()
|
|
reader.onload = (e) => {
|
|
const fileRaw = e.target.result
|
|
console.log(e.target.result) // 这里是文件的原始内容
|
|
let formData = new FormData()
|
|
formData.append('file', fileRaw);
|
|
uploadFileData(formData).then(res => {
|
|
uni.showToast({
|
|
title: `添加成功!`,
|
|
icon: 'none'
|
|
})
|
|
})
|
|
}
|
|
reader.readAsText(item.file)
|
|
// uni.readFile({
|
|
// filePath: item, // 选择的文件路径
|
|
// encoding: 'utf8', // 文件编码
|
|
// success: (res) => {
|
|
// console.log('文件内容:', res.data); // 处理文件内容
|
|
// },
|
|
// fail: (err) => {
|
|
// console.error('读取文件失败:', err);
|
|
// }
|
|
// });
|
|
})
|
|
|
|
// const tempFiles = e.tempFiles
|
|
// tempFiles.forEach(item => {
|
|
// uploadFileData({ file: item.file }).then(res => {
|
|
// console.log(res)
|
|
// })
|
|
// })
|
|
// console.log("1111111111")
|
|
// console.log(e)
|
|
},
|
|
|
|
// 判断必填项是否填写
|
|
judgeAttrWrite() {
|
|
const form = this.form
|
|
if (!form.projectName) {
|
|
uni.showToast({
|
|
title: `项目名称不能为空!`,
|
|
icon: 'none'
|
|
})
|
|
return false
|
|
}
|
|
if (!form.checkType) {
|
|
uni.showToast({
|
|
title: `检查类型不能为空!`,
|
|
icon: 'none'
|
|
})
|
|
return false
|
|
}
|
|
if (!form.inspectionTime) {
|
|
uni.showToast({
|
|
title: `检查时间不能为空!`,
|
|
icon: 'none'
|
|
})
|
|
return false
|
|
}
|
|
if (!form.inspectionUnit) {
|
|
uni.showToast({
|
|
title: `检查单位不能为空!`,
|
|
icon: 'none'
|
|
})
|
|
return false
|
|
}
|
|
if (!form.inspectionPerson) {
|
|
uni.showToast({
|
|
title: `被检查单位不能为空!`,
|
|
icon: 'none'
|
|
})
|
|
return false
|
|
}
|
|
if (!form.constituentMember) {
|
|
uni.showToast({
|
|
title: `组成成员不能为空!`,
|
|
icon: 'none'
|
|
})
|
|
return false
|
|
}
|
|
// if (!form.noticeAttachment) {
|
|
// uni.showToast({
|
|
// title: `检查通知不能为空!`,
|
|
// icon: 'none'
|
|
// })
|
|
// return false
|
|
// }
|
|
// if (!form.checklist) {
|
|
// uni.showToast({
|
|
// title: `整改通知不能为空!`,
|
|
// icon: 'none'
|
|
// })
|
|
// return false
|
|
// }
|
|
// if (!form.rectificationReport) {
|
|
// uni.showToast({
|
|
// title: `整改回复不能为空!`,
|
|
// icon: 'none'
|
|
// })
|
|
// return false
|
|
// }
|
|
return true
|
|
},
|
|
|
|
// 保存检查
|
|
handleConfirm() {
|
|
if (!this.judgeAttrWrite()) {
|
|
return
|
|
}
|
|
uni.showLoading({
|
|
title: '加载中...',
|
|
mask: true
|
|
})
|
|
console.log("88888888", this.form)
|
|
addNewInspections(this.form).then(res => {
|
|
uni.showToast({
|
|
title: `操作成功`,
|
|
icon: 'none'
|
|
})
|
|
uni.navigateTo({
|
|
url: `/pages/monitoring/list/index`
|
|
});
|
|
})
|
|
},
|
|
|
|
// 暂存功能
|
|
handleConfirmDraft() {
|
|
if (!this.judgeAttrWrite()) {
|
|
return
|
|
}
|
|
uni.showLoading({
|
|
title: '加载中...',
|
|
mask: true
|
|
})
|
|
console.log("88888888", this.form)
|
|
if (this.draftId) {
|
|
this.form.id = this.draftId
|
|
updateInspectionsDraft(this.form).then(res => {
|
|
uni.showToast({
|
|
title: `操作成功`,
|
|
icon: 'none'
|
|
})
|
|
uni.navigateTo({
|
|
url: `/pages/monitoring/list/index`
|
|
});
|
|
})
|
|
} else {
|
|
addInspectionsDraft(this.form).then(res => {
|
|
uni.showToast({
|
|
title: `操作成功`,
|
|
icon: 'none'
|
|
})
|
|
uni.navigateTo({
|
|
url: `/pages/monitoring/list/index`
|
|
});
|
|
})
|
|
}
|
|
},
|
|
|
|
// 带问题列表的监督提交
|
|
handleConfirmMonitor() {
|
|
if (this.monitorId) {
|
|
updateInspections(this.form).then(res => {
|
|
uni.showToast({
|
|
title: `操作成功`,
|
|
icon: 'none'
|
|
})
|
|
uni.navigateTo({
|
|
url: `/pages/monitoring/list/index`
|
|
});
|
|
})
|
|
} else {
|
|
addNewInspections(this.form).then(res => {
|
|
uni.showToast({
|
|
title: `操作成功`,
|
|
icon: 'none'
|
|
})
|
|
uni.navigateTo({
|
|
url: `/pages/monitoring/list/index`
|
|
});
|
|
})
|
|
}
|
|
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
</style>
|