fix : 修改详情页数据回显问题及简化代码

This commit is contained in:
2024-06-01 00:45:13 +08:00
parent 14abf64e5d
commit f4ad871831
10 changed files with 108 additions and 294 deletions

View File

@@ -5,7 +5,6 @@
:formData="commonForm.formData"
:data="commonForm"
:processViewer="commonProvessViewer"
:companyOption="companyOption"
v-show="showActive == '00'"
:loading="loading"
/>
@@ -24,52 +23,35 @@
</template>
<script setup lang="jsx">
import {getInfo} from "@/api/project-demand/index.js";
import {getSubCompOpt} from '@/api/user/user.js'
import {useProcessStore} from '@/stores/processStore.js';
import CollectionDetail from "@/components/DetailComponent/CollectionDetail.vue";
import SummaryDetail from "@/components/DetailComponent/SummaryDetail.vue";
import ApprovalDetail from "@/components/DetailComponent/ApprovalDetail.vue";
import {getMapProjectStateInfo} from '@/components/steps/api';
import {ElLoading} from "element-plus";
import {ElLoading, ElNotification} from "element-plus";
const route = useRoute()
const companyOption = ref([])
const showActive = ref()
const loading = ref(false)
const processStore = useProcessStore()
const activeName = ref('first')
const handleClick = (tab, event) => {
console.log(tab, event)
if (tab.index.value === 0) {
}
}
const getCompanyOption = async () => {
const res = await getSubCompOpt()
companyOption.value = res.data
}
const commonForm = ref({})
const commonProvessViewer = ref(true)
const getAllInfo = async (state) => {
const loading = ElLoading.service({fullscreen: true})
try {
state == '00' && (await getCompanyOption())
commonProvessViewer.value = false
loading.value = true
const {data, code} = await getMapProjectStateInfo(route.query.projectId, state)
// if(state == '00') {
// collectionData.value = data;
// } else if(state == '10') {
// summaryData.value = data;
// }
const {data, code,msg} = await getMapProjectStateInfo(route.query.projectId, state)
if(code===1000){
loading.value = false
}else {
ElNotification({
title: '提示',
message: msg,
type: 'error'
})
}
if(data===undefined)return;
commonForm.value = data
@@ -80,18 +62,14 @@ const getAllInfo = async (state) => {
processStore.refuseList.value = data.refuseList;
processStore.passList.value = data.passList;
nextTick(() => {
// summaryProcessViewer.value = true
commonProvessViewer.value = true
})
loading.close()
} catch {
loading.close()
}
}
const showActive = ref()
const setDetail = (active) => {
showActive.value = active
getAllInfo(active)

View File

@@ -208,12 +208,7 @@ const tableConfig = reactive({
btn.push({label: '详情', prem: ['mosr:requirement:info'], func: () => handleDetail(row), type: 'primary'})
}
if (buttons.has("attachments")) {
btn.push({
label: '附件',
prem: ['mosr:requirement:resubmit'],
func: () => handleAttachment(row),
type: 'primary'
})
btn.push({label: '附件', prem: ['mosr:requirement:resubmit'], func: () => handleAttachment(row), type: 'primary'})
}
if (buttons.has("entry")) {
btn.push({label: '结项', prem: ['mosr:requirement:del'], func: () => handleConclusion(row), type: 'primary'})

View File

@@ -5,7 +5,6 @@
:formData="commonForm.formData"
:data="commonForm"
:processViewer="commonProvessViewer"
:companyOption="companyOption"
v-show="showActive == '00'"
:loading="loading"
/>
@@ -21,65 +20,41 @@
</template>
<script setup lang="jsx">
import {getInfo} from "@/api/project-demand/index.js";
import {getSubCompOpt} from '@/api/user/user.js'
import {useProcessStore} from '@/stores/processStore.js';
import CollectionDetail from "@/components/DetailComponent/CollectionDetail.vue";
import SummaryDetail from "@/components/DetailComponent/SummaryDetail.vue";
import ApprovalDetail from "@/components/DetailComponent/ApprovalDetail.vue";
import { getMapProjectStateInfo } from '@/components/steps/api';
import { ElLoading } from "element-plus";
import {ElLoading, ElNotification} from "element-plus";
import Opinion from "@/components/DetailComponent/Opinion.vue";
// const activeName = ref('first')
const handleClick = (tab, event) => {
console.log(tab, event)
if(tab.index.value === 0){
}
}
const route = useRoute()
const activeName = ref('first')
const collectionData = ref({})
const summaryData = ref({})
const loading = ref(false)
const collectionProcessViewer = ref(true)
const summaryProcessViewer = ref(true)
const processStore = useProcessStore()
const companyOption = ref([])
const cuurentStep = ref()
route.query.step == '10' && (cuurentStep.value = 1)
route.query.step == '20' && (cuurentStep.value = 2)
route.query.step == '40' && (cuurentStep.value = 3)
route.query.step == '50' && (cuurentStep.value = 4)
const rules = reactive({
auditOpinion: [{required: true, message: '请输入审核意见', trigger: 'blur'}],
})
const getCompanyOption = async () => {
const res = await getSubCompOpt()
companyOption.value = res.data
}
const showActive = ref()
const commonForm = ref({})
const commonProvessViewer = ref(true)
const getAllInfo = async (state) => {
const loading = ElLoading.service({fullscreen: true})
try {
state == '00' && ( await getCompanyOption() )
commonProvessViewer.value = false
loading.value = true
const { data, code } = await getMapProjectStateInfo(route.query.projectId, state)
if(state == '00') {
collectionData.value = data;
} else if(state == '10') {
summaryData.value = data;
}
const { data, code ,msg} = await getMapProjectStateInfo(route.query.projectId, state)
if(code===1000){
loading.value = false
}else {
ElNotification({
title: '提示',
message: msg,
type: 'error'
})
}
if(data===undefined)return;
commonForm.value = data
@@ -90,17 +65,14 @@ const getAllInfo = async (state) => {
processStore.refuseList.value = data.refuseList;
processStore.passList.value = data.passList;
nextTick(() => {
// summaryProcessViewer.value = true
commonProvessViewer.value = true
})
loading.close()
} catch {
loading.close()
}
}
const showActive = ref()
const setDetail = (active) => {
showActive.value = active

View File

@@ -218,9 +218,9 @@ const tableConfig = reactive({
if (buttons.has("edit")) {
btn.push({label: '编辑', prem: ['mosr:requirement:info'], func: () => handleEdit(row), type: 'primary'})
}
// if (buttons.has("standing")) {
if (buttons.has("standing")) {
btn.push({label: '台账', prem: ['mosr:requirement:info'], func: () => handleStandingBook(row), type: 'primary'})
// }
}
// if (buttons.has("attachments")) {
btn.push({label: '附件', prem: ['mosr:requirement:info'], func: () => handleAttachment(row), type: 'primary'})
// }

View File

@@ -5,7 +5,6 @@
:formData="commonForm.formData"
:data="commonForm"
:processViewer="commonProvessViewer"
:companyOption="companyOption"
v-show="showActive == '00'"
:loading="loading"
/>
@@ -22,101 +21,38 @@
</template>
<script setup lang="jsx">
import {getInfo} from "@/api/project-demand/index.js";
import {getSubCompOpt} from '@/api/user/user.js'
import {useProcessStore} from '@/stores/processStore.js';
import CollectionDetail from "@/components/DetailComponent/CollectionDetail.vue";
import {downloadFile} from "@/api/project-demand";
import SummaryDetail from "@/components/DetailComponent/SummaryDetail.vue";
import ApprovalDetail from "@/components/DetailComponent/ApprovalDetail.vue";
import { getMapProjectStateInfo } from '@/components/steps/api';
import { ElLoading } from "element-plus";
import {ElLoading, ElNotification} from "element-plus";
import Opinion from "@/components/DetailComponent/Opinion.vue";
const route = useRoute()
const activeName = ref('first')
const collectionData = ref({})
const summaryData = ref({})
const collectionProcessViewer = ref(true)
const loading = ref(false)
const active = ref(route.query.state)
const summaryProcessViewer = ref(true)
const processStore = useProcessStore()
const companyOption = ref([])
const rules = reactive({
auditOpinion: [{required: true, message: '请输入审核意见', trigger: 'blur'}],
})
const getCompanyOption = async () => {
const res = await getSubCompOpt()
companyOption.value = res.data
}
const getDemandCollectionInfo = async () => {
if (!route.query.id) return
await getCompanyOption()
collectionProcessViewer.value = false
getInfo(route.query.id).then(res => {
let data = res.data
collectionData.value = data;
processStore.setDesign(data)
processStore.runningList.value = data.runningList;
processStore.endList.value = data.endList;
processStore.noTakeList.value = data.noTakeList;
processStore.refuseList.value = data.refuseList;
processStore.passList.value = data.passList;
nextTick(() => {
collectionProcessViewer.value = true
})
})
}
const getDemandSummaryInfo = async () => {
if (!route.query.id) return
// await getCompanyOption()
summaryProcessViewer.value = false
getInfo(route.query.id).then(res => {
let data = res.data
summaryData.value = data;
processStore.setDesign(data)
processStore.runningList.value = data.runningList;
processStore.endList.value = data.endList;
processStore.noTakeList.value = data.noTakeList;
processStore.refuseList.value = data.refuseList;
processStore.passList.value = data.passList;
nextTick(() => {
summaryProcessViewer.value = true
})
})
}
const handleClick = (tab, event) => {
console.log(tab, event)
if (tab.props.name === 'first') {
getDemandCollectionInfo()
} else if (tab.props.name === 'second') {
getDemandSummaryInfo()
}
}
// getDemandCollectionInfo()
const showActive = ref()
const commonForm = ref({})
const commonProvessViewer = ref(true)
const getAllInfo = async (state) => {
const loading = ElLoading.service({fullscreen: true})
try {
state == '00' && ( await getCompanyOption() )
commonProvessViewer.value = false
loading.value = true
const { data, code } = await getMapProjectStateInfo(route.query.projectId, state)
if(state == '00') {
collectionData.value = data;
} else if(state == '10') {
summaryData.value = data;
}
const { data, code,msg } = await getMapProjectStateInfo(route.query.projectId, state)
if(code===1000){
loading.value = false
}else {
ElNotification({
title: '提示',
message: msg,
type: 'error'
})
}
console.log(data, 'data--22');
if(data===undefined)return;
commonForm.value = data
processStore.setDesign(data)
@@ -126,17 +62,14 @@ const getAllInfo = async (state) => {
processStore.refuseList.value = data.refuseList;
processStore.passList.value = data.passList;
nextTick(() => {
// summaryProcessViewer.value = true
commonProvessViewer.value = true
})
loading.close()
} catch {
loading.close()
}
}
const showActive = ref()
const setDetail = (active) => {
showActive.value = active

View File

@@ -212,9 +212,9 @@ const tableConfig = reactive({
// if (buttons.has("delete")) {
// btn.push({label: '删除',prem: ['mosr:requirement:del'], func: () => handleDelete(row), type: 'primary'})
// }
// if (buttons.has("apply")) {
if (buttons.has("apply")) {
btn.push({label: '申请',prem: ['mosr:requirement:info'], func: () => handleApply(row), type: 'primary'})
// }
}
return (
<div style={{width: '100%'}}>
{