谐波普测-普测计划新增&终端退运-历史记录
This commit is contained in:
@@ -1,47 +1,62 @@
|
||||
<template>
|
||||
<el-dialog draggable :title="title" v-model="planAddition" width="65%" :before-close="cancelFn">
|
||||
<el-form
|
||||
:model="formdata"
|
||||
ref="formRef"
|
||||
:rules="rules"
|
||||
label-width="auto"
|
||||
class="form-two"
|
||||
>
|
||||
<el-form-item for="-" label="普测负责单位:">
|
||||
<Area v-model="formdata.orgNo" />
|
||||
<el-dialog draggable :title="title" v-model="planAddition" width="500px" :before-close="cancelFn">
|
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="auto" scroll-to-error :validate-on-rule-change="false" class="form-one">
|
||||
<el-form-item for="-" label="普测负责单位:">
|
||||
<Area v-model="form.deptId" />
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="计划名称:" prop="planName">
|
||||
<el-input v-model="formdata.planName" placeholder="请输入计划名称"></el-input>
|
||||
<el-form-item for="-" label="计划名称:" prop="planName">
|
||||
<el-input v-model="form.planName" placeholder="请输入计划名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="计划开始时间:" prop="planStartTime">
|
||||
<el-form-item for="-" label="计划开始时间:" prop="planStartTime">
|
||||
<el-date-picker
|
||||
v-model="formdata.planStartTime"
|
||||
v-model="form.planStartTime"
|
||||
type="date"
|
||||
placeholder="选择计划开始时间"
|
||||
value-format="YYYY-MM-DD"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="计划结束时间:" prop="planEndTime">
|
||||
<el-form-item for="-" label="计划结束时间:" prop="planEndTime">
|
||||
<el-date-picker
|
||||
v-model="formdata.planEndTime"
|
||||
v-model="form.planEndTime"
|
||||
type="date"
|
||||
placeholder="选择计划结束时间"
|
||||
value-format="YYYY-MM-DD"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="实际完成时间:" prop="planComplateTime">
|
||||
<!-- <el-form-item for="-" label="实际完成时间:" prop="planComplateTime">
|
||||
<el-date-picker
|
||||
v-model="formdata.planComplateTime"
|
||||
v-model="form.planComplateTime"
|
||||
type="date"
|
||||
placeholder="选择实际完成时间"
|
||||
value-format="YYYY-MM-DD"
|
||||
></el-date-picker>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item for="-" label="测试负责人:" prop="leader">
|
||||
<el-input v-model="form.leader" placeholder="请输入测试负责人"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item for="-" label="系统电站:" prop="customSubstationFlag">
|
||||
<!-- 默认值 开启 -->
|
||||
<el-radio-group v-model="form.customSubstationFlag" @change="changeSubstationFlag">
|
||||
<el-radio value="0">是</el-radio>
|
||||
<el-radio value="1">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="测试负责人:" prop="leader">
|
||||
<el-input v-model="formdata.leader" placeholder="请输入测试负责人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="关联电站:" prop="subIds" style="display: flex;align-items: center;">
|
||||
<el-cascader v-model="formdata.subIds" :options="treeList" :props="defaultProps" clearable filterable />
|
||||
<el-form-item
|
||||
for="-"
|
||||
label="关联电站:"
|
||||
v-if="form.customSubstationFlag == '0'"
|
||||
prop="substation"
|
||||
style="display: flex; align-items: center"
|
||||
>
|
||||
<el-cascader
|
||||
v-model="form.substation"
|
||||
:options="treeList"
|
||||
:props="defaultProps"
|
||||
clearable
|
||||
filterable
|
||||
collapse-tags
|
||||
placeholder="请选择关联电站"
|
||||
/>
|
||||
<!-- <el-tree-select
|
||||
accordion
|
||||
ref="treeRef"
|
||||
@@ -52,15 +67,18 @@
|
||||
readonly
|
||||
node-key="id"
|
||||
:props="defaultProps"
|
||||
v-model="formdata.subIds"
|
||||
v-model="form.substation"
|
||||
:data="treeList"
|
||||
:render-after-expand="false"
|
||||
/> -->
|
||||
</el-form-item>
|
||||
<!-- <el-form :model="formdata" label-width="auto"> -->
|
||||
<el-form-item for="-" class="uploadFile" label="普测报告:" prop="fileList">
|
||||
<el-form-item for="-" label="关联电站:" v-if="form.customSubstationFlag == '1'" prop="substation">
|
||||
<el-input v-model="form.substation" placeholder="请输入关联电站"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form :model="form" label-width="auto"> -->
|
||||
<!-- <el-form-item for="-" class="uploadFile" label="普测报告:" prop="fileList">
|
||||
<el-upload
|
||||
v-model:file-list="formdata.fileList"
|
||||
v-model:file-list="form.fileList"
|
||||
ref="upload"
|
||||
action=""
|
||||
:limit="5"
|
||||
@@ -72,7 +90,7 @@
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<!-- </el-form> -->
|
||||
</el-form>
|
||||
<!-- <el-divider content-position="left" style="font-size: 18px; font-weight: bolder">添加电站</el-divider> -->
|
||||
@@ -80,7 +98,7 @@
|
||||
<!-- <div
|
||||
v-if="
|
||||
(title == '查看计划' || title == '计划审核') &&
|
||||
(title == '计划审核' || formdata.status == 1 || formdata.status == 3 || formdata.status == 4)
|
||||
(title == '计划审核' || form.status == 1 || form.status == 3 || form.status == 4)
|
||||
"
|
||||
>
|
||||
<el-divider content-position="left" style="font-size: 18px; font-weight: bolder">审核意见</el-divider>
|
||||
@@ -88,7 +106,7 @@
|
||||
:disabled="title != '计划审核'"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||
v-model="formdata.checkComment"
|
||||
v-model="form.checkComment"
|
||||
></el-input>
|
||||
</div> -->
|
||||
<template #footer v-if="title != '查看计划'">
|
||||
@@ -102,7 +120,7 @@
|
||||
<script setup lang="ts">
|
||||
import generalTestTree from '@/components/tree/pqs/generalTestTree.vue'
|
||||
import { ref, reactive, nextTick } from 'vue'
|
||||
import { addSurvey, auditSurvey } from '@/api/process-boot/generalTest'
|
||||
import { addSurvey, auditSurvey, addSurveyPlan } from '@/api/process-boot/generalTest'
|
||||
import Area from '@/components/form/area/index.vue'
|
||||
import { ElMessage, UploadProps } from 'element-plus'
|
||||
import { uploadFile, getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
@@ -118,34 +136,52 @@ const defaultProps = ref({
|
||||
checkStrictly: true,
|
||||
emitPath: false,
|
||||
expandTrigger: 'hover' as const,
|
||||
multiple: true
|
||||
})
|
||||
const formdata: any = ref({
|
||||
orgName: '',
|
||||
orgNo: dictData.state.area[0].id,
|
||||
const obj = {
|
||||
customSubstationFlag: '0',
|
||||
deptId: '0d52f9f6e43ec0ee83013cd32da93f66',
|
||||
planEndTime: '2024-05-31',
|
||||
planName: '5.31计划',
|
||||
planStartTime: '2024-05-01',
|
||||
substation: '3c175083dbc1e870365dd12d79c837ec,5487bd33c24007aad7af4882b455203b'
|
||||
}
|
||||
const form: any = ref({
|
||||
// orgName: '',
|
||||
deptId: dictData.state.area[0].id,
|
||||
planStartTime: '',
|
||||
planEndTime: '',
|
||||
planName: '',
|
||||
rgeneralSurveyPlanDetailAddParm: [],
|
||||
subCount: '',
|
||||
busCount: '',
|
||||
subIds: '',
|
||||
fileList: [],
|
||||
checkComment: '',
|
||||
filePath: ''
|
||||
// fileList: [],
|
||||
// checkComment: '',
|
||||
// filePath: '',
|
||||
substation: '', //关联电站
|
||||
customSubstationFlag: '0' //电站类型
|
||||
})
|
||||
const props = {
|
||||
expandTrigger: 'hover' as const
|
||||
}
|
||||
const formRef = ref()
|
||||
const treeRef = ref()
|
||||
const rules = {
|
||||
const rules = ref({
|
||||
planStartTime: [{ required: true, message: '选择计划开始时间', trigger: 'change' }],
|
||||
planEndTime: [{ required: true, message: '选择计划结束时间', trigger: 'change' }],
|
||||
planComplateTime: [{ required: true, message: '选择实际完成时间 ', trigger: 'change' }],
|
||||
planName: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
|
||||
leader: [{ required: true, message: '请输入测试负责人', trigger: 'blur' }],
|
||||
subIds: [{ required: true, message: '请选择关联电站', trigger: 'change' }],
|
||||
fileList: [{ required: true, message: '请上传文件', trigger: 'change' }]
|
||||
substation: [{ required: true, message: '请选择关联电站', trigger: 'change' }]
|
||||
// fileList: [{ required: true, message: '请上传文件', trigger: 'change' }],
|
||||
})
|
||||
const changeSubstationFlag = () => {
|
||||
console.log(form.value.customSubstationFlag)
|
||||
//处理所属变电站手都输入1/下拉数据0
|
||||
if (form.value.customSubstationFlag == '0') {
|
||||
rules.value.substation[0].message = '请选择关联电站'
|
||||
form.value.substation = ''
|
||||
} else {
|
||||
rules.value.substation[0].message = '请输入关联电站'
|
||||
form.value.substation = []
|
||||
}
|
||||
}
|
||||
const cancelFn = () => {
|
||||
formRef.value.resetFields()
|
||||
@@ -159,42 +195,54 @@ const loadData = () => {
|
||||
console.log(treeList.value)
|
||||
})
|
||||
}
|
||||
loadData()
|
||||
// 提交
|
||||
const submitFn = () => {
|
||||
formRef.value.validate(async (valid: any) => {
|
||||
if (valid) {
|
||||
let filePath = ''
|
||||
// formdata.value.subIds = treeRef.value.treeRef.getCheckedKeys(false)
|
||||
formdata.value.subIds= typeof(formdata.value.subIds)=='string'?[formdata.value.subIds]:formdata.value.subIds
|
||||
if (formdata.value.fileList.length == 0) {
|
||||
audit(filePath)
|
||||
} else {
|
||||
for (let i = 0; i < formdata.value.fileList.length; i++) {
|
||||
if (formdata.value.fileList[i].raw) {
|
||||
await uploadFile(formdata.value.fileList[i].raw, 'supervision/').then(res => {
|
||||
filePath = filePath + res.data.name + ','
|
||||
})
|
||||
} else {
|
||||
filePath = filePath + formdata.value.fileList[i].supervision + ','
|
||||
}
|
||||
if (i == formdata.value.fileList.length - 1) {
|
||||
audit(filePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
audit(filePath)
|
||||
// form.value.substation = treeRef.value.treeRef.getCheckedKeys(false)
|
||||
// form.value.substation = typeof form.value.substation == 'string' ? [form.value.substation] : form.value.substation
|
||||
// if (form.value.fileList.length == 0) {
|
||||
// audit(filePath)
|
||||
// } else {
|
||||
// for (let i = 0; i < form.value.fileList.length; i++) {
|
||||
// if (form.value.fileList[i].raw) {
|
||||
// await uploadFile(form.value.fileList[i].raw, 'supervision/').then(res => {
|
||||
// filePath = filePath + res.data.name + ','
|
||||
// })
|
||||
// } else {
|
||||
// filePath = filePath + form.value.fileList[i].supervision + ','
|
||||
// }
|
||||
// if (i == form.value.fileList.length - 1) {
|
||||
// audit(filePath)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
const audit = (filePath: any) => {
|
||||
//选择系统变电站
|
||||
const addForm = JSON.parse(JSON.stringify(form.value))
|
||||
if (form.value.customSubstationFlag == '0') {
|
||||
addForm.substation = addForm.substation.join(',')
|
||||
}
|
||||
console.log(addForm, '提交')
|
||||
addSurveyPlan(addForm).then(res => {
|
||||
cancelFn()
|
||||
emit('onsubmit')
|
||||
console.log(res, '新增普测计划')
|
||||
})
|
||||
return
|
||||
if (title.value == '普测计划新增') {
|
||||
addSurvey({ ...formdata.value, filePath: filePath }).then((res: any) => {
|
||||
addSurvey({ ...form.value, filePath: filePath }).then((res: any) => {
|
||||
ElMessage.success('新增成功!')
|
||||
cancelFn()
|
||||
emit('onsubmit')
|
||||
})
|
||||
} else if (title.value == '重新发起计划') {
|
||||
auditSurvey({ ...formdata.value, filePath: filePath }).then((res: any) => {
|
||||
auditSurvey({ ...form.value, filePath: filePath }).then((res: any) => {
|
||||
ElMessage.success('重新发起计划成功!')
|
||||
cancelFn()
|
||||
emit('onsubmit')
|
||||
@@ -207,37 +255,36 @@ const handleExceed: UploadProps['onExceed'] = (): void => {
|
||||
ElMessage.error(`上传文件数量不能超过5个!`)
|
||||
}
|
||||
//移除文件上传
|
||||
const removeFile = (file: any,uploadFiles:any) => {
|
||||
const removeFile = (file: any, uploadFiles: any) => {
|
||||
console.log(file, uploadFiles)
|
||||
}
|
||||
const open = (text: string, row?: any) => {
|
||||
formdata.value = Object.assign({
|
||||
orgName: '',
|
||||
orgNo: dictData.state.area[0].id,
|
||||
loadData()
|
||||
form.value = Object.assign({
|
||||
// orgName: '',
|
||||
deptId: dictData.state.area[0].id,
|
||||
planStartTime: '',
|
||||
planEndTime: '',
|
||||
planName: '',
|
||||
rgeneralSurveyPlanDetailAddParm: [],
|
||||
subCount: '',
|
||||
busCount: '',
|
||||
subIds: [],
|
||||
checkComment: '',
|
||||
fileList: [],
|
||||
filePath: []
|
||||
substation: '', //关联电站
|
||||
// fileList: [],
|
||||
// checkComment: '',
|
||||
// filePath: '',
|
||||
customSubstationFlag: '0' //电站类型
|
||||
})
|
||||
title.value = text
|
||||
planAddition.value = true
|
||||
formRef.value?.resetFields()
|
||||
// if (row) {
|
||||
// formdata.value = JSON.parse(JSON.stringify(row))
|
||||
// form.value = JSON.parse(JSON.stringify(row))
|
||||
// nextTick(() => {
|
||||
// formdata.value.fileList = []
|
||||
// form.value.fileList = []
|
||||
// treeRef.value.loadData()
|
||||
// treeRef.value.setKey(row.subIds || [], text)
|
||||
// treeRef.value.setKey(row.substation || [], text)
|
||||
// let arr = row.filePath.split(',')
|
||||
// arr.slice(0, -1).forEach((item: any) => {
|
||||
// getFileNameAndFilePath({ filePath: item }).then((res: any) => {
|
||||
// formdata.value.fileList.push({
|
||||
// form.value.fileList.push({
|
||||
// name: res.data.fileName,
|
||||
// supervision: res.data.name,
|
||||
// url: res.data.url
|
||||
|
||||
Reference in New Issue
Block a user