联调 常态化干扰源用户管理 保存功能

This commit is contained in:
GGJ
2024-06-27 14:45:58 +08:00
parent 531ed72641
commit fac38dd9cc
8 changed files with 228 additions and 52 deletions

View File

@@ -523,11 +523,20 @@ import type { ComponentSize, FormInstance, FormRules } from 'element-plus'
import { useAdminInfo } from '@/stores/adminInfo'
import { queryByAllCode } from '@/api/system-boot/dictTree'
import { uploadFile } from '@/api/system-boot/file'
import { submitFormData, getById, updateFormData } from '@/api/supervision-boot/interfere/index'
defineProps({
import { submitFormData, getById, updateFormData, addEditor } from '@/api/supervision-boot/interfere/index'
import { getUserReportUpdateById } from '@/api/supervision-boot/userReport/form'
const props = defineProps({
openType: {
type: String,
default: 'create'
},
update: {
type: Boolean,
default: false
},
normalizedControl: {
type: Boolean,
default: false
}
})
const emits = defineEmits(['onSubmit'])
@@ -935,28 +944,72 @@ const open = async (row: any) => {
dialogFormVisible.value = true
if (row.row) {
resendId.value = row.row.id
await getById({ id: row.row.id }).then(res => {
// form.value.userType = res.data.userType
if (res.data.userReportProjectPO != null) {
// userType 0 1
form.value = { ...res.data, ...res.data.userReportProjectPO }
fileRaw(res.data, 'userReportProjectPO')
} else if (res.data.userReportSubstationPO != null) {
// userType 2 3 4 5
form.value = { ...res.data, ...res.data.userReportSubstationPO }
fileRaw(res.data, 'userReportSubstationPO')
} else if (res.data.userReportSensitivePO != null) {
// userType6
form.value = { ...res.data, ...res.data.userReportSensitivePO }
fileRaw(res.data, 'userReportSensitivePO')
}
form.value.orgId = adminInfo.$state.deptName
})
if (props.update) {
await getUserReportUpdateById(row.row.id).then(res => {
handleResponse(res.userReportMessageJson)
})
} else {
await getById({ id: row.row.id }).then(res => {
handleResponse(res)
})
}
// if (props.update) {
// await getUserReportUpdateById({ id: row.row.id }).then(res => {
// // form.value.userType = res.data.userType
// if (res.data.userReportProjectPO != null) {
// // userType 0 1
// form.value = { ...res.data, ...res.data.userReportProjectPO }
// fileRaw(res.data, 'userReportProjectPO')
// } else if (res.data.userReportSubstationPO != null) {
// // userType 2 3 4 5
// form.value = { ...res.data, ...res.data.userReportSubstationPO }
// fileRaw(res.data, 'userReportSubstationPO')
// } else if (res.data.userReportSensitivePO != null) {
// // userType6
// form.value = { ...res.data, ...res.data.userReportSensitivePO }
// fileRaw(res.data, 'userReportSensitivePO')
// }
// form.value.orgId = adminInfo.$state.deptName
// })
// } else {
// await getById({ id: row.row.id }).then(res => {
// // form.value.userType = res.data.userType
// if (res.data.userReportProjectPO != null) {
// // userType 0 1
// form.value = { ...res.data, ...res.data.userReportProjectPO }
// fileRaw(res.data, 'userReportProjectPO')
// } else if (res.data.userReportSubstationPO != null) {
// // userType 2 3 4 5
// form.value = { ...res.data, ...res.data.userReportSubstationPO }
// fileRaw(res.data, 'userReportSubstationPO')
// } else if (res.data.userReportSensitivePO != null) {
// // userType6
// form.value = { ...res.data, ...res.data.userReportSensitivePO }
// fileRaw(res.data, 'userReportSensitivePO')
// }
// form.value.orgId = adminInfo.$state.deptName
// })
// }
} else {
resendId.value = ''
form.value.userType = userTypeList.value[0].value
}
}
async function handleResponse(response) {
// userType logic is commented out; if needed, implement accordingly
if (response.data.userReportProjectPO) {
form.value = { ...response.data, ...response.data.userReportProjectPO }
fileRaw(response.data, 'userReportProjectPO')
} else if (response.data.userReportSubstationPO) {
form.value = { ...response.data, ...response.data.userReportSubstationPO }
fileRaw(response.data, 'userReportSubstationPO')
} else if (response.data.userReportSensitivePO) {
form.value = { ...response.data, ...response.data.userReportSensitivePO }
fileRaw(response.data, 'userReportSensitivePO')
}
form.value.orgId = adminInfo.$state.deptName
}
// 处理上传文件回显
const fileRaw = (row: any, key: string) => {
let list = [
@@ -1150,15 +1203,27 @@ const confirmForm = (flag: boolean) => {
confirmFormData.saveOrCheckflag = '1'
if (title.value != '用户档案录入') confirmFormData.id = resendId.value
if (!control.value) confirmFormData.dataType = 1
submitFormData(confirmFormData).then(res => {
ElMessage({
message: '保存成功!',
type: 'success'
if (props.normalizedControl) {
addEditor(confirmFormData).then(res => {
ElMessage({
message: '保存成功!',
type: 'success'
})
ruleFormRef.value.resetFields()
resetForm()
close()
})
ruleFormRef.value.resetFields()
resetForm()
close()
})
} else {
submitFormData(confirmFormData).then(res => {
ElMessage({
message: '保存成功!',
type: 'success'
})
ruleFormRef.value.resetFields()
resetForm()
close()
})
}
} else {
ruleFormRef.value.validate((valid: any) => {
if (valid) {

View File

@@ -213,7 +213,6 @@
<a target="_blank" :href="proviteData.feasibilityReport?.url" rel="nofollow">
{{ proviteData.feasibilityReport?.name }}
</a>
</span>
<span
v-if="
@@ -318,7 +317,7 @@ import { onMounted, ref, reactive, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { formatDate } from '@/utils/formatTime'
import { propTypes } from '@/utils/propTypes'
import { getUserReportById } from '@/api/supervision-boot/userReport/form'
import { getUserReportById, getUserReportUpdateById } from '@/api/supervision-boot/userReport/form'
import { getDictTreeById } from '@/api/system-boot/dictTree'
import { useDictData } from '@/stores/dictData'
import { getFileNameAndFilePath } from '@/api/system-boot/file'
@@ -329,7 +328,11 @@ defineOptions({ name: 'BpmUserReportDetail' })
const { query } = useRoute() // 查询参数
const props = defineProps({
id: propTypes.string.def(undefined)
id: propTypes.string.def(undefined),
update: {
type: Boolean,
default: false
}
})
const detailLoading = ref(false) // 表单的加载中
const detailData = ref<any>({}) // 详情数据
@@ -406,33 +409,41 @@ const powerSupplyInfoOptionList = dictData.getBasicData('supply_condition')
const getInfo = async () => {
detailLoading.value = true
try {
await getUserReportById(props.id || queryId).then(res => {
if(props.update){
await getUserReportUpdateById(props.id || queryId).then(res => {
detailData.value = res.data.userReportMessageJson
getProviteData()
})
}else{
await getUserReportById(props.id || queryId).then(res => {
detailData.value = res.data
getProviteData()
})
}
} finally {
detailLoading.value = false
}
}
const proviteData = ref()
//可研报告
const feasibilityReportRef:any = ref(null)
const feasibilityReportRef: any = ref(null)
//项目初步设计说明书
const preliminaryDesignDescriptionRef:any = ref(null)
const preliminaryDesignDescriptionRef: any = ref(null)
//预测评估报告
const predictionEvaluationReportRef:any = ref(null)
const predictionEvaluationReportRef: any = ref(null)
//预测评估评审意见报告
const predictionEvaluationReviewOpinionsRef:any = ref(null)
const predictionEvaluationReviewOpinionsRef: any = ref(null)
//用户接入变电站主接线示意图
const substationMainWiringDiagramRef:any= ref(null)
const substationMainWiringDiagramRef: any = ref(null)
//主要敏感终端清单
const sensitiveDevicesRef:any = ref(null)
const sensitiveDevicesRef: any = ref(null)
//抗扰度测试报告
const antiInterferenceReportRef:any = ref(null)
const antiInterferenceReportRef: any = ref(null)
//背景电能质量测试报告
const powerQualityReportRef:any = ref(null)
const powerQualityReportRef: any = ref(null)
//其他附件
const additionalAttachmentsRef:any = ref(null)
const additionalAttachmentsRef: any = ref(null)
//预览
const preview = (val: any, url: any) => {
nextTick(() => {
@@ -645,6 +656,6 @@ onMounted(() => {
// }
.elView {
cursor: pointer;
margin-right:10px;
margin-right: 10px;
}
</style>