冀北普测计划修改

This commit is contained in:
cdf
2024-06-04 14:45:35 +08:00
parent 15ee7efa6e
commit f0dfa0ceca
3 changed files with 79 additions and 82 deletions

View File

@@ -135,14 +135,10 @@ export function addPlanCycle(data: any) {
params: data params: data
}) })
} }
// 批量提交审核
export function submitAuditUser(data: any) {
return createAxios({
url: '/process-boot/rGeneralSurveyPlan/submitAuditUser',
method: 'post',
data
})
}
// 新增普测计划 // 新增普测计划
export function addSurvey(data: any) { export function addSurvey(data: any) {
return createAxios({ return createAxios({
@@ -159,10 +155,15 @@ export function querySurveyDetail(data: any) {
params: data params: data
}) })
} }
// 修改普测计划 // 修改普测计划
export function auditSurvey(data: any) { export function auditSurvey(data: any) {
return createAxios({ return createAxios({
url: '/supervision-boot/generalSurvey/auditSurvey', url: '/supervision-boot/surveyPlan/update',
method: 'POST', method: 'POST',
data data
}) })
@@ -170,7 +171,7 @@ export function auditSurvey(data: any) {
// 取消普测计划 // 取消普测计划
export function cancel(data: any) { export function cancel(data: any) {
return createAxios({ return createAxios({
url: '/supervision-boot/generalSurvey/cancel', url: '/supervision-boot/surveyPlan/cancel',
method: 'POST', method: 'POST',
data data
}) })
@@ -187,3 +188,20 @@ export function addSurveyPlan(data: any) {
data 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}
})
}

View File

@@ -37,14 +37,14 @@
<el-form-item for="-" label="系统电站:" prop="customSubstationFlag"> <el-form-item for="-" label="系统电站:" prop="customSubstationFlag">
<!-- 默认值 开启 --> <!-- 默认值 开启 -->
<el-radio-group v-model="form.customSubstationFlag" @change="changeSubstationFlag"> <el-radio-group v-model="form.customSubstationFlag" @change="changeSubstationFlag">
<el-radio value="0"></el-radio> <el-radio :value="0"></el-radio>
<el-radio value="1"></el-radio> <el-radio :value="1"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
for="-" for="-"
label="关联电站:" label="关联电站:"
v-if="form.customSubstationFlag == '0'" v-if="form.customSubstationFlag == 0"
prop="substation" prop="substation"
style="display: flex; align-items: center" style="display: flex; align-items: center"
> >
@@ -72,7 +72,7 @@
:render-after-expand="false" :render-after-expand="false"
/> --> /> -->
</el-form-item> </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-input v-model="form.substation" placeholder="请输入关联电站"></el-input>
</el-form-item> </el-form-item>
<!-- <el-form :model="form" label-width="auto"> --> <!-- <el-form :model="form" label-width="auto"> -->
@@ -118,15 +118,16 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import generalTestTree from '@/components/tree/pqs/generalTestTree.vue'
import { ref, reactive, nextTick } from '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 Area from '@/components/form/area/index.vue'
import { ElMessage, UploadProps } from 'element-plus' import { ElMessage, UploadProps } from 'element-plus'
import { uploadFile, getFileNameAndFilePath } from '@/api/system-boot/file'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
import { initDetpStataionTree } from '@/api/process-boot/generalTest'
const emit = defineEmits(['onsubmit']) const emit = defineEmits(['onsubmit'])
const dictData = useDictData() const dictData = useDictData()
const title = ref('') const title = ref('')
const planAddition = ref(false) const planAddition = ref(false)
@@ -138,14 +139,7 @@ const defaultProps = ref({
expandTrigger: 'hover' as const, expandTrigger: 'hover' as const,
multiple: true 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({ const form: any = ref({
// orgName: '', // orgName: '',
deptId: dictData.state.area[0].id, deptId: dictData.state.area[0].id,
@@ -156,10 +150,11 @@ const form: any = ref({
// checkComment: '', // checkComment: '',
// filePath: '', // filePath: '',
substation: '', //关联电站 substation: '', //关联电站
customSubstationFlag: '0' //电站类型 customSubstationFlag: 0 //电站类型
}) })
const props = { const props = {
expandTrigger: 'hover' as const expandTrigger: 'hover' as const,
} }
const formRef = ref() const formRef = ref()
const treeRef = ref() const treeRef = ref()
@@ -175,7 +170,7 @@ const rules = ref({
const changeSubstationFlag = () => { const changeSubstationFlag = () => {
console.log(form.value.customSubstationFlag) console.log(form.value.customSubstationFlag)
//处理所属变电站手都输入1/下拉数据0 //处理所属变电站手都输入1/下拉数据0
if (form.value.customSubstationFlag == '0') { if (form.value.customSubstationFlag == 0) {
rules.value.substation[0].message = '请选择关联电站' rules.value.substation[0].message = '请选择关联电站'
form.value.substation = '' form.value.substation = ''
} else { } else {
@@ -184,7 +179,7 @@ const changeSubstationFlag = () => {
} }
} }
const cancelFn = () => { const cancelFn = () => {
formRef.value.resetFields() formRef.value?.resetFields()
// treeRef.value.setKey([]) // treeRef.value.setKey([])
planAddition.value = false planAddition.value = false
} }
@@ -195,43 +190,42 @@ const loadData = () => {
console.log(treeList.value) 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 = () => { const submitFn = () => {
formRef.value.validate(async (valid: any) => { formRef.value.validate(async (valid: any) => {
if (valid) { if (valid) {
let filePath = '' let filePath = ''
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 audit = (filePath: any) => {
//选择系统变电站 //选择系统变电站
const addForm = JSON.parse(JSON.stringify(form.value)) const addForm = JSON.parse(JSON.stringify(form.value))
if (form.value.customSubstationFlag == '0') { if (form.value.customSubstationFlag == 0) {
addForm.substation = addForm.substation.join(',') addForm.substation = addForm.substation.join(',')
} }
addSurveyPlan(addForm).then(res => { if(title.value == '普测计划新增'){
cancelFn() addSurveyPlan(addForm).then(res => {
emit('onsubmit') cancelFn()
}) emit('onsubmit')
})
}else {
updateSurveyPlan(addForm).then(res => {
cancelFn()
emit('onsubmit')
})
}
return return
} }
// 上传文件 // 上传文件
@@ -243,7 +237,7 @@ const handleExceed: UploadProps['onExceed'] = (): void => {
const removeFile = (file: any, uploadFiles: any) => { const removeFile = (file: any, uploadFiles: any) => {
console.log(file, uploadFiles) console.log(file, uploadFiles)
} }
const open = (text: string, row?: any) => { const open = (text: string, id: any) => {
loadData() loadData()
form.value = Object.assign({ form.value = Object.assign({
// orgName: '', // orgName: '',
@@ -255,33 +249,14 @@ const open = (text: string, row?: any) => {
// fileList: [], // fileList: [],
// checkComment: '', // checkComment: '',
// filePath: '', // filePath: '',
customSubstationFlag: '0' //电站类型 customSubstationFlag: 0 //电站类型
}) })
title.value = text title.value = text
planAddition.value = true planAddition.value = true
formRef.value?.resetFields()
// if (row) { if(id){
// form.value = JSON.parse(JSON.stringify(row)) detailById(id)
// 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()
// })
// }
} }
defineExpose({ open }) defineExpose({ open })
</script> </script>

View File

@@ -7,9 +7,12 @@
</TableHeader> </TableHeader>
<Table ref="tableRef" /> <Table ref="tableRef" />
<!-- 新增 --> <!-- 新增 -->
<planAdd ref="planAddRef" @onsubmit="tableStore.index()" /> <planAdd ref="planAddRef" @onsubmit="tableStore.index()" :openType="openType" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useAdminInfo } from '@/stores/adminInfo'
//获取登陆用户姓名和部门
const adminInfo = useAdminInfo()
import { ref, onMounted, provide, nextTick } from 'vue' import { ref, onMounted, provide, nextTick } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
@@ -27,6 +30,7 @@ const planAddRef = ref()
const TableHeaderRef = ref() const TableHeaderRef = ref()
const auditList: any = ref([]) const auditList: any = ref([])
const auditUser = ref('') const auditUser = ref('')
const openType = ref('create')
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/supervision-boot/surveyPlan/surveyPlanPage', url: '/supervision-boot/surveyPlan/surveyPlanPage',
publicHeight: 65, publicHeight: 65,
@@ -95,11 +99,11 @@ const tableStore = new TableStore({
icon: 'el-icon-Open', icon: 'el-icon-Open',
render: 'basicButton', render: 'basicButton',
disabled: row => { disabled: row => {
return row.status == 1 || row.status == 2 return row.createBy != adminInfo.$state.id || row.status == 1 || row.status == 2
}, },
click: row => { click: row => {
// deviceQuitPopup.value.open('重新发起退运', 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', icon: 'el-icon-Open',
render: 'basicButton', render: 'basicButton',
disabled: row => { 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 => { click: row => {
cancelLeave(row) cancelLeave(row)