2024-04-02 16:43:18 +08:00
|
|
|
<template>
|
2024-04-03 16:24:14 +08:00
|
|
|
<el-form :model="causeAnalysisData" :rules="rules" ref="form1Ref" label-width="auto">
|
2024-04-09 16:52:11 +08:00
|
|
|
<el-form-item label="电网侧原因:" prop="reportProcessContentYyfx">
|
|
|
|
|
<el-checkbox-group :disabled="prop.disabled" v-model="causeAnalysisData.reportProcessContentYyfx">
|
2024-04-02 16:43:18 +08:00
|
|
|
<el-checkbox v-for="(item, ind) in CauseList" :key="ind" :label="item.code">
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-divider></el-divider>
|
|
|
|
|
|
2024-04-09 16:52:11 +08:00
|
|
|
<el-form-item label="用户侧原因:" prop="userReportProcessContentYyfx">
|
|
|
|
|
<el-checkbox-group :disabled="prop.disabled" v-model="causeAnalysisData.userReportProcessContentYyfx">
|
2024-04-02 16:43:18 +08:00
|
|
|
<el-checkbox v-for="(item, ind) in userCauseList" :key="ind" :label="item.code">
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</el-form-item>
|
2024-06-13 13:32:50 +08:00
|
|
|
<el-row v-if="prop.addData.problemSources == '用户投诉' || prop.addData.problemSources == '终端异常'">
|
2024-04-02 16:43:18 +08:00
|
|
|
<el-divider></el-divider>
|
|
|
|
|
|
2024-06-13 13:32:50 +08:00
|
|
|
<el-form-item label="电网侧受影响终端:" prop="powerGridAffectDev">
|
2024-04-09 16:52:11 +08:00
|
|
|
<el-checkbox-group :disabled="prop.disabled" v-model="causeAnalysisData.powerGridAffectDev">
|
2024-04-02 16:43:18 +08:00
|
|
|
<el-checkbox v-for="(item, ind) in powerGridAffectDevList" :key="ind" :label="item.code">
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-divider></el-divider>
|
|
|
|
|
|
2024-06-13 13:32:50 +08:00
|
|
|
<el-form-item label="用户侧受影响终端:" prop="userAffectDev">
|
2024-04-09 16:52:11 +08:00
|
|
|
<el-checkbox-group :disabled="prop.disabled" v-model="causeAnalysisData.userAffectDev">
|
2024-04-02 16:43:18 +08:00
|
|
|
<el-checkbox v-for="(item, ind) in userAffectDevList" :key="ind" :label="item.code">
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-divider></el-divider>
|
|
|
|
|
|
2024-04-09 16:52:11 +08:00
|
|
|
<el-form-item label="事件描述:" prop="eventDescriptionYyfx">
|
2024-04-02 16:43:18 +08:00
|
|
|
<el-input
|
|
|
|
|
style="width: 400px"
|
|
|
|
|
:autosize="{ minRows: 2, maxRows: 4 }"
|
|
|
|
|
type="textarea"
|
|
|
|
|
placeholder="请输入内容"
|
2024-04-09 16:52:11 +08:00
|
|
|
:disabled="prop.disabled"
|
2024-04-02 16:43:18 +08:00
|
|
|
v-model="causeAnalysisData.eventDescriptionYyfx"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
2024-04-07 16:40:16 +08:00
|
|
|
|
2024-04-02 16:43:18 +08:00
|
|
|
<el-form-item class="item" label="原因分析报告:" style="margin-top: 10px" prop="fileList">
|
|
|
|
|
<el-upload
|
|
|
|
|
v-model:file-list="causeAnalysisData.fileList"
|
|
|
|
|
ref="upload"
|
2024-04-07 16:40:16 +08:00
|
|
|
v-if="!prop.disabled"
|
2024-04-02 16:43:18 +08:00
|
|
|
action=""
|
|
|
|
|
:limit="1"
|
|
|
|
|
:on-exceed="handleExceed"
|
|
|
|
|
:auto-upload="false"
|
|
|
|
|
>
|
|
|
|
|
<template #trigger>
|
|
|
|
|
<el-button type="primary">上传文件</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-upload>
|
2024-04-07 16:40:16 +08:00
|
|
|
|
|
|
|
|
<el-button type="primary" link @click="download" v-else>
|
|
|
|
|
{{ prop.List.fileNameYyfx }}
|
|
|
|
|
</el-button>
|
2024-04-02 16:43:18 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { useDictData } from '@/stores/dictData'
|
2024-04-09 16:52:11 +08:00
|
|
|
import {
|
|
|
|
|
uploadFile,
|
|
|
|
|
reasonAnalysis,
|
|
|
|
|
takeAction,
|
|
|
|
|
effectAnalysis,
|
|
|
|
|
correctiveAction
|
|
|
|
|
} from '@/api/process-boot/electricitymanagement'
|
2024-04-02 16:43:18 +08:00
|
|
|
import { UploadInstance, UploadProps, UploadRawFile, ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
import { genFileId } from 'element-plus'
|
2024-04-07 16:40:16 +08:00
|
|
|
import { ref, reactive, onMounted } from 'vue'
|
2024-04-02 16:43:18 +08:00
|
|
|
const prop = defineProps({
|
|
|
|
|
addData: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => {}
|
2024-04-07 16:40:16 +08:00
|
|
|
},
|
|
|
|
|
List: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => {}
|
|
|
|
|
},
|
|
|
|
|
disabled: {
|
|
|
|
|
type: Boolean
|
2024-04-02 16:43:18 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const emit = defineEmits(['handleClose'])
|
|
|
|
|
|
|
|
|
|
const dictData = useDictData()
|
|
|
|
|
const upload = ref()
|
2024-04-03 16:24:14 +08:00
|
|
|
const form1Ref = ref()
|
2024-04-07 16:40:16 +08:00
|
|
|
|
2024-04-02 16:43:18 +08:00
|
|
|
const causeAnalysisData: any = ref({
|
|
|
|
|
reportProcessContentYyfx: [],
|
|
|
|
|
userReportProcessContentYyfx: [],
|
|
|
|
|
eventDescriptionYyfx: '',
|
|
|
|
|
fileNameYyfx: '', //原因分析报告文件名称
|
|
|
|
|
filePathYyfx: '', //原因分析报告文件路径
|
|
|
|
|
powerGridAffectDev: [],
|
|
|
|
|
userAffectDev: [],
|
|
|
|
|
fileList: []
|
|
|
|
|
})
|
|
|
|
|
const rules = {
|
|
|
|
|
reportProcessContentYyfx: [{ required: true, message: '请选择电网侧原因', trigger: 'change' }],
|
|
|
|
|
userReportProcessContentYyfx: [{ required: true, message: '请选择用户侧原因', trigger: 'change' }],
|
|
|
|
|
eventDescriptionYyfx: [{ required: true, message: '请填写事件描述', trigger: 'blur' }],
|
2024-06-13 13:32:50 +08:00
|
|
|
powerGridAffectDev: [{ required: true, message: '请选择电网侧受影响终端', trigger: 'change' }],
|
|
|
|
|
userAffectDev: [{ required: true, message: '请选择用户侧受影响终端', trigger: 'change' }],
|
2024-04-02 16:43:18 +08:00
|
|
|
fileList: [{ required: true, message: '请上传文件', trigger: 'change' }]
|
|
|
|
|
}
|
|
|
|
|
// 电网侧原因
|
|
|
|
|
const CauseList = dictData.getBasicData('Grid-side_Reasons')
|
|
|
|
|
// 用户侧原因
|
|
|
|
|
const userCauseList = dictData.getBasicData('User_Reasons')
|
2024-06-13 13:32:50 +08:00
|
|
|
// 电网侧受影响终端
|
2024-04-02 16:43:18 +08:00
|
|
|
const powerGridAffectDevList = dictData.getBasicData('Grid_Unit')
|
2024-06-13 13:32:50 +08:00
|
|
|
// 用户侧受影响终端
|
2024-04-02 16:43:18 +08:00
|
|
|
const userAffectDevList = dictData.getBasicData('Customer_Unit')
|
|
|
|
|
const OnlineList = dictData.getBasicData('Problem_Sources')
|
|
|
|
|
|
|
|
|
|
// 上传
|
|
|
|
|
const handleExceed: UploadProps['onExceed'] = files => {
|
|
|
|
|
upload.value!.clearFiles()
|
|
|
|
|
const file = files[0] as UploadRawFile
|
|
|
|
|
file.uid = genFileId()
|
|
|
|
|
upload.value!.handleStart(file)
|
|
|
|
|
}
|
2024-04-07 16:40:16 +08:00
|
|
|
// 下载
|
|
|
|
|
const download = async () => {
|
|
|
|
|
// window.open(addForm.value.ifile)
|
|
|
|
|
let response = await fetch(prop.List.filePathYyfx)
|
|
|
|
|
let blob = await response.blob()
|
|
|
|
|
let a = document.createElement('a')
|
|
|
|
|
a.href = window.URL.createObjectURL(blob)
|
|
|
|
|
a.download = prop.List.fileNameYyfx
|
|
|
|
|
a.click()
|
|
|
|
|
a.remove()
|
|
|
|
|
}
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
if (prop.List.filePathYyfx != null) {
|
|
|
|
|
causeAnalysisData.value = prop.List
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-04-09 16:52:11 +08:00
|
|
|
const submit = (num: number) => {
|
|
|
|
|
console.log(prop.addData.problemSources)
|
|
|
|
|
|
2024-04-03 16:24:14 +08:00
|
|
|
form1Ref.value.validate(async (valid: any) => {
|
2024-04-02 16:43:18 +08:00
|
|
|
if (valid) {
|
|
|
|
|
let form = new FormData()
|
|
|
|
|
form.append('file', causeAnalysisData.value.fileList[0].raw)
|
|
|
|
|
causeAnalysisData.value.powerQualityProblemNo = prop.addData.powerQualityProblemNo
|
|
|
|
|
await uploadFile(form).then((res: any) => {
|
2024-04-09 16:52:11 +08:00
|
|
|
causeAnalysisData.value.filePathYyfx = res.data.minFileUrl
|
|
|
|
|
causeAnalysisData.value.fileNameYyfx = res.data.minFileName
|
2024-04-02 16:43:18 +08:00
|
|
|
})
|
2024-04-09 16:52:11 +08:00
|
|
|
|
|
|
|
|
if (num == 0) {
|
|
|
|
|
reasonAnalysis(causeAnalysisData.value).then((res: any) => {
|
|
|
|
|
ElMessage.success('提交成功')
|
|
|
|
|
emit('handleClose')
|
|
|
|
|
})
|
|
|
|
|
} else if (num == 1) {
|
|
|
|
|
correctiveAction(causeAnalysisData.value).then((res: any) => {
|
|
|
|
|
ElMessage.success('提交成功')
|
|
|
|
|
emit('handleClose')
|
|
|
|
|
})
|
|
|
|
|
} else if (num == 2) {
|
|
|
|
|
takeAction(causeAnalysisData.value).then((res: any) => {
|
|
|
|
|
ElMessage.success('提交成功')
|
|
|
|
|
emit('handleClose')
|
|
|
|
|
})
|
|
|
|
|
} else if (num == 3) {
|
|
|
|
|
effectAnalysis(causeAnalysisData.value).then((res: any) => {
|
|
|
|
|
ElMessage.success('提交成功')
|
|
|
|
|
emit('handleClose')
|
|
|
|
|
})
|
|
|
|
|
}
|
2024-04-02 16:43:18 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
defineExpose({
|
|
|
|
|
submit
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped></style>
|