fix : 修复所属公司及详情loading

This commit is contained in:
2024-05-20 11:45:53 +08:00
parent 1d772e1414
commit f83ae8df51
4 changed files with 268 additions and 248 deletions

View File

@@ -1,4 +1,5 @@
<template>
<div v-loading="loading">
<el-form :model="formData" ref="form" label-width="auto">
<el-row>
<el-col :span="12">
@@ -64,6 +65,7 @@
</div>
</div>
</el-form>
</div>
</template>
<script setup lang="jsx">
@@ -72,10 +74,8 @@ import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.v
import {matterTree} from '@/utils/matterTree.js';
import {downloadFile} from "@/api/project-demand";
const emit = defineEmits(['getInfo'])
const emit = defineEmits(['getInfo',"update:formData"])
const form = ref()
const showForm = ref(true)
const loading = ref(false)
const showTable = ref(false)
const companyNameArray = ref([])
@@ -95,7 +95,10 @@ const props = defineProps({
companyOption: {
type: Array,
default: []
},
}, loading: {
type: Boolean,
default: false
}
})
const tableConfig = reactive({
columns: [
@@ -134,7 +137,6 @@ const tableConfig = reactive({
}
]
})
const handleDownload = (row) => {
downloadFile(row.fileId).then(res => {
const blob = new Blob([res])
@@ -150,16 +152,19 @@ const getDataSourceOptionItem = (val) => {
matterTree(companyNameArray.value, props.companyOption, item)
})
}
return companyNameArray.value.join('');
let uniqueArr = Array.from(new Set(companyNameArray.value));
return uniqueArr.join('');
}
watch(() => props.loading, (newVal) => {
props.loading = newVal
}, {deep: true})
watch(() => props.companyOption, (newVal) => {
props.companyOption = newVal
}, {deep: true})
watch(() => props.formData, (newVal) => {
if (newVal) {
newVal.companyIds = getDataSourceOptionItem(newVal.companyIds)
props.formData = newVal
}
watch(() => props.formData.companyIds, (newVal) => {
props.formData.companyIds = getDataSourceOptionItem(newVal)
}, {deep: true})
watch(() => props.processViewer, (newVal) => {
props.processViewer = newVal

View File

@@ -1,5 +1,5 @@
<template>
<div class="detail-block">
<div class="detail-block" v-loading="loading">
<el-form :model="localFormData" ref="summaryForm" :rules="rules">
<el-row gutter="50">
<el-col :span="12">
@@ -124,7 +124,9 @@
</el-col>
<el-col :span="24">
<el-form-item label="需求上报申请书">
<el-button type="primary" link @click="handleDownload(localFormData.singleFile)">{{localFormData.singleFile?.originalFileName}}</el-button>
<el-button type="primary" link @click="handleDownload(localFormData.singleFile)">
{{ localFormData.singleFile?.originalFileName }}
</el-button>
</el-form-item>
</el-col>
<el-col :span="24">
@@ -160,7 +162,7 @@
</div>
<div class="oper-page-btn" v-if="data.state === '1' && data.taskId">
<el-button @click="handleReject(summaryForm)" >驳回</el-button>
<el-button @click="handleReject(summaryForm)">驳回</el-button>
<el-button color="#DED0B2" @click="handleAgree">同意</el-button>
</div>
</el-form>
@@ -174,6 +176,7 @@ import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.v
import {ElMessage, ElNotification} from "element-plus";
import {agreeTask, rejectTask} from "@/api/project-demand";
import {useTagsView} from '@/stores/tagsview.js'
const tagsViewStore = useTagsView()
const props = defineProps({
formData: {
@@ -187,7 +190,10 @@ const props = defineProps({
processViewer: {
type: Boolean,
default: false
},
}, loading: {
type: Boolean,
default: false
}
})
const localFormData = ref({})
const tableConfig = reactive({
@@ -228,7 +234,7 @@ const tableConfig = reactive({
]
})
const router = useRouter()
const summaryForm=ref()
const summaryForm = ref()
const rules = reactive({
auditOpinion: [{required: true, message: '请输入审核意见', trigger: 'blur'}],
})
@@ -279,23 +285,26 @@ const handleDownload = (row) => {
downloadFile(row.fileId).then(res => {
const blob = new Blob([res])
let a = document.createElement('a')
a.href=URL.createObjectURL(blob)
a.href = URL.createObjectURL(blob)
a.download = row.originalFileName
a.click()
})
}
watch(
()=>props.formData,
(val)=>{
() => props.formData,
(val) => {
console.log(val, 'ssss');
}
)
watch(() => props.processViewer, (newVal) => {
props.processViewer = newVal
}, {deep: true})
watch(() => props.loading, (newVal) => {
props.loading = newVal
}, {deep: true})
watchEffect(()=>{
watchEffect(() => {
Object.keys(props.formData).length && (localFormData.value = props.formData)
})
</script>
@@ -304,7 +313,8 @@ watchEffect(()=>{
:deep(.el-table--fit) {
height: auto !important;
}
.detail-block{
.detail-block {
overflow-x: hidden;
overflow-y: auto;
padding-bottom: 20px;

View File

@@ -1,5 +1,5 @@
<template>
<div class="detail-block">
<div class="detail-block" v-loading="loading">
<baseTitle title="需求上报"></baseTitle>
<el-form :model="formData" ref="summaryForm" :rules="rules">
<el-row gutter="50">
@@ -251,6 +251,7 @@ const processStore = useProcessStore()
const router = useRouter()
const route = useRoute()
const name=ref(router.currentRoute.value.name)
const loading = ref(false)
const processDiagramViewer = ref(false)
const tagsViewStore = useTagsView()
const companyOption = ref([])
@@ -440,6 +441,7 @@ const getDetailInfo = async () => {
})
if (res.code === 1000) {
formData.value = res.data.formData
loading.value=false
}
})
}
@@ -468,16 +470,17 @@ const init = async () => {
})
}
onMounted(async () => {
loading.value=true
await init()
if (route.query.projectId) {
await getDetailInfo()
}
})
const staging = async () => {
}
</script>
<style lang="scss" scoped>
.detail-block {
overflow: hidden;
padding-bottom: 30px;

View File

@@ -2,9 +2,9 @@
<steps :active="active" @setDetail="setDetail" @stepChange="stepChange">
<template #content>
<collection-detail v-show="showActive == '00'" :formData="summaryData.formData" :data="summaryData"
:processViewer="summaryProcessViewer" :companyOption="companyOption" />
:processViewer="summaryProcessViewer" :companyOption="companyOption" :loading="loading"/>
<summary-detail v-show="showActive == '10'" :formData="summaryData.formData" :data="summaryData"
:processViewer="summaryProcessViewer"/>
:processViewer="summaryProcessViewer" :loading="loading"/>
</template>
</steps>
</template>
@@ -20,6 +20,7 @@ const route = useRoute()
const companyOption = ref([])
const summaryData = ref({})
const summaryProcessViewer = ref(true)
const loading = ref(false)
const processStore = useProcessStore()
const active = ref(route.query.state)
const showActive = ref()
@@ -31,9 +32,10 @@ const getInfo = async (state) => {
const projectId = route.query.projectId
await getCompanyOption()
summaryProcessViewer.value = false
loading.value = true
const {code, data} = await getMapProjectStateInfo(projectId, state)
summaryData.value = data;
console.log('data',data)
loading.value = false
processStore.setDesign(data)
processStore.runningList.value = data.runningList;
processStore.endList.value = data.endList;