冀北普测计划修改
This commit is contained in:
@@ -135,14 +135,10 @@ export function addPlanCycle(data: any) {
|
||||
params: data
|
||||
})
|
||||
}
|
||||
// 批量提交审核
|
||||
export function submitAuditUser(data: any) {
|
||||
return createAxios({
|
||||
url: '/process-boot/rGeneralSurveyPlan/submitAuditUser',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 新增普测计划
|
||||
export function addSurvey(data: any) {
|
||||
return createAxios({
|
||||
@@ -159,10 +155,15 @@ export function querySurveyDetail(data: any) {
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 修改普测计划
|
||||
export function auditSurvey(data: any) {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/generalSurvey/auditSurvey',
|
||||
url: '/supervision-boot/surveyPlan/update',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
@@ -170,7 +171,7 @@ export function auditSurvey(data: any) {
|
||||
// 取消普测计划
|
||||
export function cancel(data: any) {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/generalSurvey/cancel',
|
||||
url: '/supervision-boot/surveyPlan/cancel',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
@@ -187,3 +188,20 @@ export function addSurveyPlan(data: any) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateSurveyPlan(data: any) {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/surveyPlan/update',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//新版普测计划管理新增
|
||||
export function getById(id: any) {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/surveyPlan/getById',
|
||||
method: 'get',
|
||||
params:{id:id}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@
|
||||
<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 :value="0">是</el-radio>
|
||||
<el-radio :value="1">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
for="-"
|
||||
label="关联电站:"
|
||||
v-if="form.customSubstationFlag == '0'"
|
||||
v-if="form.customSubstationFlag == 0"
|
||||
prop="substation"
|
||||
style="display: flex; align-items: center"
|
||||
>
|
||||
@@ -72,7 +72,7 @@
|
||||
:render-after-expand="false"
|
||||
/> -->
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="关联电站:" v-if="form.customSubstationFlag == '1'" prop="substation">
|
||||
<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"> -->
|
||||
@@ -118,15 +118,16 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import generalTestTree from '@/components/tree/pqs/generalTestTree.vue'
|
||||
|
||||
import { ref, reactive, nextTick } from 'vue'
|
||||
import { addSurvey, auditSurvey, addSurveyPlan } from '@/api/process-boot/generalTest'
|
||||
import { addSurvey, auditSurvey, addSurveyPlan, getById,initDetpStataionTree,updateSurveyPlan } 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'
|
||||
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { initDetpStataionTree } from '@/api/process-boot/generalTest'
|
||||
|
||||
const emit = defineEmits(['onsubmit'])
|
||||
|
||||
const dictData = useDictData()
|
||||
const title = ref('')
|
||||
const planAddition = ref(false)
|
||||
@@ -138,14 +139,7 @@ const defaultProps = ref({
|
||||
expandTrigger: 'hover' as const,
|
||||
multiple: true
|
||||
})
|
||||
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,
|
||||
@@ -156,10 +150,11 @@ const form: any = ref({
|
||||
// checkComment: '',
|
||||
// filePath: '',
|
||||
substation: '', //关联电站
|
||||
customSubstationFlag: '0' //电站类型
|
||||
customSubstationFlag: 0 //电站类型
|
||||
})
|
||||
const props = {
|
||||
expandTrigger: 'hover' as const
|
||||
expandTrigger: 'hover' as const,
|
||||
|
||||
}
|
||||
const formRef = ref()
|
||||
const treeRef = ref()
|
||||
@@ -175,7 +170,7 @@ const rules = ref({
|
||||
const changeSubstationFlag = () => {
|
||||
console.log(form.value.customSubstationFlag)
|
||||
//处理所属变电站手都输入1/下拉数据0
|
||||
if (form.value.customSubstationFlag == '0') {
|
||||
if (form.value.customSubstationFlag == 0) {
|
||||
rules.value.substation[0].message = '请选择关联电站'
|
||||
form.value.substation = ''
|
||||
} else {
|
||||
@@ -184,7 +179,7 @@ const changeSubstationFlag = () => {
|
||||
}
|
||||
}
|
||||
const cancelFn = () => {
|
||||
formRef.value.resetFields()
|
||||
formRef.value?.resetFields()
|
||||
// treeRef.value.setKey([])
|
||||
planAddition.value = false
|
||||
}
|
||||
@@ -195,43 +190,42 @@ const loadData = () => {
|
||||
console.log(treeList.value)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const detailById = (id:any) =>{
|
||||
getById(id).then(res => {
|
||||
form.value = res.data
|
||||
form.value.substation = res.data.substation.split(",")
|
||||
})
|
||||
}
|
||||
// 提交
|
||||
const submitFn = () => {
|
||||
formRef.value.validate(async (valid: any) => {
|
||||
if (valid) {
|
||||
let 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') {
|
||||
if (form.value.customSubstationFlag == 0) {
|
||||
addForm.substation = addForm.substation.join(',')
|
||||
}
|
||||
addSurveyPlan(addForm).then(res => {
|
||||
cancelFn()
|
||||
emit('onsubmit')
|
||||
})
|
||||
if(title.value == '普测计划新增'){
|
||||
addSurveyPlan(addForm).then(res => {
|
||||
cancelFn()
|
||||
emit('onsubmit')
|
||||
})
|
||||
}else {
|
||||
updateSurveyPlan(addForm).then(res => {
|
||||
cancelFn()
|
||||
emit('onsubmit')
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
// 上传文件
|
||||
@@ -243,7 +237,7 @@ const handleExceed: UploadProps['onExceed'] = (): void => {
|
||||
const removeFile = (file: any, uploadFiles: any) => {
|
||||
console.log(file, uploadFiles)
|
||||
}
|
||||
const open = (text: string, row?: any) => {
|
||||
const open = (text: string, id: any) => {
|
||||
loadData()
|
||||
form.value = Object.assign({
|
||||
// orgName: '',
|
||||
@@ -255,33 +249,14 @@ const open = (text: string, row?: any) => {
|
||||
// fileList: [],
|
||||
// checkComment: '',
|
||||
// filePath: '',
|
||||
customSubstationFlag: '0' //电站类型
|
||||
customSubstationFlag: 0 //电站类型
|
||||
})
|
||||
title.value = text
|
||||
planAddition.value = true
|
||||
formRef.value?.resetFields()
|
||||
// if (row) {
|
||||
// form.value = JSON.parse(JSON.stringify(row))
|
||||
// nextTick(() => {
|
||||
// form.value.fileList = []
|
||||
// treeRef.value.loadData()
|
||||
// treeRef.value.setKey(row.substation || [], text)
|
||||
// let arr = row.filePath.split(',')
|
||||
// arr.slice(0, -1).forEach((item: any) => {
|
||||
// getFileNameAndFilePath({ filePath: item }).then((res: any) => {
|
||||
// form.value.fileList.push({
|
||||
// name: res.data.fileName,
|
||||
// supervision: res.data.name,
|
||||
// url: res.data.url
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
// } else {
|
||||
// nextTick(() => {
|
||||
// treeRef.value.loadData()
|
||||
// })
|
||||
// }
|
||||
|
||||
if(id){
|
||||
detailById(id)
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
<!-- 新增 -->
|
||||
<planAdd ref="planAddRef" @onsubmit="tableStore.index()" />
|
||||
<planAdd ref="planAddRef" @onsubmit="tableStore.index()" :openType="openType" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
//获取登陆用户姓名和部门
|
||||
const adminInfo = useAdminInfo()
|
||||
import { ref, onMounted, provide, nextTick } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
@@ -27,6 +30,7 @@ const planAddRef = ref()
|
||||
const TableHeaderRef = ref()
|
||||
const auditList: any = ref([])
|
||||
const auditUser = ref('')
|
||||
const openType = ref('create')
|
||||
const tableStore = new TableStore({
|
||||
url: '/supervision-boot/surveyPlan/surveyPlanPage',
|
||||
publicHeight: 65,
|
||||
@@ -95,11 +99,11 @@ const tableStore = new TableStore({
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.status == 1 || row.status == 2
|
||||
return row.createBy != adminInfo.$state.id || row.status == 1 || row.status == 2
|
||||
},
|
||||
click: row => {
|
||||
// deviceQuitPopup.value.open('重新发起退运', row)
|
||||
planAddRef.value.open('重新发起计划', row)
|
||||
planAddRef.value.open('重新发起计划', row.id)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -109,7 +113,7 @@ const tableStore = new TableStore({
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.status == 3 || row.status == 2 || row.status == 4
|
||||
return row.createBy != adminInfo.$state.id || row.status == 3 || row.status == 2 || row.status == 4
|
||||
},
|
||||
click: row => {
|
||||
cancelLeave(row)
|
||||
|
||||
Reference in New Issue
Block a user