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

View File

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

View File

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

View File

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