feat: 新增移动端适配详情

This commit is contained in:
wenhua
2024-06-27 23:35:05 +08:00
parent 8684132fc7
commit a943687afe
13 changed files with 1106 additions and 79 deletions

View File

@@ -0,0 +1,192 @@
<template>
<div v-loading="loading">
<el-form :model="formData" label-width="auto">
<el-row>
<el-col :span="24" v-if="type==='singleDetail'">
<el-form-item label="征集名称">
<span>{{ formData.requirementName }}</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="征集类型">
<span>{{ formData.collectType }}</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="截止时间">
<span>{{ formData.deadline }}</span>
</el-form-item>
</el-col>
<el-col :span="24" v-if="type==='singleDetail'">
<el-form-item label="所属公司">
<span :class="showExpendClass(showMoreCompany,formData.companyIds)">{{
getCompanyName(formData.companyIds)
}}</span>
<div style="color: #2a99ff;text-align: center;width: 100%;font-size: 15px;cursor: pointer"
@click="handleExpend">{{ showExpendText }}
</div>
</el-form-item>
</el-col>
<el-col :span="24" v-if="formData.isSpecialFund">
<el-form-item label="专项资金">
<span>{{ formData.specialFund }}</span>
</el-form-item>
</el-col>
<el-col :span="24">
<baseTitle title="征集说明"></baseTitle>
<el-form-item>
<el-card style="width: 100%">
<div v-html="formData.collectExplain">
</div>
</el-card>
</el-form-item>
</el-col>
<baseTitle v-if="fileListShow === 'READ' || fileListShow === 'EDIT'" title="附件列表"></baseTitle>
<el-col :span="24">
<file-component title="" tag="需求征集"
v-model:value="formData.fileList" :processViewer="processViewer"
:file-list-show="fileListShow"/>
</el-col>
<el-col :span="24">
<div v-if="data.taskId">
<baseTitle title="审核意见"></baseTitle>
<el-form-item prop="_value">
<el-input
v-model="_value"
:rows="3"
type="textarea"
placeholder="请输入审核意见"
/>
</el-form-item>
</div>
</el-col>
</el-row>
<div class="approval-record">
<div class="approval-title">
<baseTitle title="审批记录"></baseTitle>
<div class="diagram">
<div class="base-title">流程图</div>
<el-switch
v-model="changeDiagram"
style="--el-switch-on-color: #13ce66; --el-switch-off-color:#BEA266"
/>
</div>
</div>
<div class="process">
<operation-render v-if="processViewer && data.operationList && data.operationList.length > 0&&!changeDiagram"
:operation-list="data.operationList"
:state="data.state"/>
<process-diagram-viewer v-if="processViewer&&changeDiagram" id-name="collectionProcess"/>
</div>
</div>
</el-form>
</div>
</template>
<script setup lang="jsx">
import OperationRender from '@/views/workflow/common/OperationRender.vue'
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'
import {downloadFile} from "@/api/project-demand";
const emit = defineEmits(['update:value'])
const showExpendText = ref('')
const showMoreCompany = ref(false)
const props = defineProps({
formData: {
type: Array,
default: []
},
data: {
type: Array,
default: []
},
processViewer: {
type: Boolean,
default: false
},
companyOption: {
type: Array,
default: []
},
loading: {
type: Boolean,
default: false
},
fileListShow: {
type: String,
default: ''
},
type: {
type: String,
default: ''
},
value: {
type: String,
default: ''
}
})
const changeDiagram = ref(false)
const _value = computed({
get() {
return props.value;
},
set(val) {
emit("update:value", val);
}
})
const getCompanyName = (data) => {
if (data) {
return data.join('')
}
}
const handleExpend = () => {
showMoreCompany.value = !showMoreCompany.value;
showExpendClass(showMoreCompany.value, props.formData.companyIds)
}
const showExpendClass = (showMoreCompany, data) => {
if (!showMoreCompany) {
if (data && data.length > 14) {
showExpendText.value = '展开'
return 'company-style'
}
} else {
showExpendText.value = '收缩'
return ''
}
}
const handleDownload = (row) => {
downloadFile(row.fileId).then(res => {
const blob = new Blob([res])
let a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = row.originalFileName
a.click()
})
}
watch(() => props.loading, (newVal) => {
props.loading = newVal
}, {deep: true})
watch(() => props.processViewer, (newVal) => {
props.processViewer = newVal
}, {deep: true})
</script>
<style scoped lang="scss">
:deep(.el-empty__description) {
margin-top: 0;
}
.company-style {
//width: 98%;
min-height: 30px;
max-height: 60px;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
</style>

View File

@@ -0,0 +1,168 @@
<template>
<!-- <baseTitle title="审核意见"></baseTitle>-->
<!-- <fvForm :schema="schema" @getInstance="(e)=>form = e"></fvForm>-->
<div class="oper-page-btn">
<el-button type="danger" @click="handleReject">驳回</el-button>
<el-button color="#DED0B2" @click="handleAgree">同意</el-button>
</div>
</template>
<script setup lang="jsx">
import {ElNotification} from 'element-plus';
import {agreeTask, rejectTask} from "@/api/project-demand/index.js";
import {useTagsView} from '@/stores/tagsview.js'
const tagsViewStore = useTagsView()
const route = useRoute()
const router = useRouter()
const props = defineProps({
taskId: {
type: String,
default: ''
},
formData: {
type: Object,
default: {}
},
value: {
type: String,
default: ''
}
})
const form = ref()
const schema = computed(() => {
return [
{
label: '',
prop: 'auditOpinion',
component: 'el-input',
colProps: {
span: 24
},
props: {
placeholder: '请输入审核意见',
type: 'textarea',
rows: 3
}
}
]
})
const _value = computed({
get() {
return props.value;
},
set(val) {
emit("update:value", val);
}
})
const back = () => {
switch (route.name) {
case 'Initiation/detail':
router.push({name: 'Initiation'})
break;
case 'Filing/detail':
router.push({name: 'Filing'})
break;
case 'Implementation/detail':
if (route.query.source === 'home') {
router.push('/home')
} else {
if (route.query.step === '10') {
router.push({name: 'Summary'})
} else if (route.query.step === '20') {
router.push({name: 'Initiation'})
} else if (route.query.step === '40') {
router.push({name: 'Implementation'})
} else if (route.query.step === '50') {
router.push({name: 'Filing'})
} else if (route.query.step === '00') {
router.push({name: 'Requirement'})
}
}
break;
case 'Summary/detail':
if (route.query.source === 'home') {
router.push('/home')
} else {
router.push({name: 'Summary'})
}
break;
case 'Requirement/detail':
if (route.query.source === 'home') {
router.push('/home')
} else {
router.push({name: 'Requirement'})
}
break;
case 'Fund/detail':
if (route.query.source === 'home') {
router.push('/home')
} else {
router.push({name: 'Fund'})
}
break;
case 'Share/detail':
if (route.query.source === 'home') {
router.push('/home')
} else {
router.push({name: 'Expense/share'})
}
break;
case 'Phase/detail':
if (route.query.source === 'home') {
router.push('/home')
} else {
router.push({name: 'Implementation'})
}
break;
}
}
// 驳回
const handleReject = async () => {
// const values = form.value.getValues()
if (!_value.value) {
ElNotification({
title: '提示',
message: '请填写审核意见',
type: 'warning'
})
return
}
const params = {
taskId: props.taskId,
// ...values
auditOpinion: _value.value
}
// console.log('params', params)
const res = await rejectTask(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
back()
}
const handleAgree = async () => {
// const values = form.value.getValues()
const params = {
taskId: props.taskId,
formData: props.formData,
auditOpinion: _value.value
}
const res = await agreeTask(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
back()
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,141 @@
<template>
<div style="padding: 0 10px;">
<baseTitle title="需求征集详情"></baseTitle>
<CollectionDetailMoblie :formData="collectData.formData" :data="collectData" type="singleDetail"
:fileListShow="fileListShow"
:processViewer="processViewer" :loading="loading" v-model:value="auditOpinion"/>
<OpinionMoblie v-if="collectData.taskId" :formData="formData" :taskId="collectData.taskId" v-model:value="auditOpinion"></OpinionMoblie>
</div>
</template>
<script setup lang="jsx">
import {useProcessStore} from '@/stores/processStore.js'
import {getInfo} from "@/api/project-demand/index.js";
import {ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js'
import {getFundOption} from "@/api/special-fund";
import {getSubCompOpt} from "@/api/user/user";
import {matterTree} from "@/utils/matterTree";
import CollectionDetailMoblie from './CollectionDetailMoblie.vue'
import OpinionMoblie from './OpinionMoblie.vue'
const tagsViewStore = useTagsView()
const router = useRouter()
const route = useRoute()
const form = ref();
const loading = ref(false)
const processStore = useProcessStore()
const specialFundOption = ref([])
const processInstanceData = ref({})
const fileListShow = ref("READ")
const showTable = ref(false)
const auditOpinion = ref('')
const processViewer = ref(false)
const processTree = ref()
const collectData = ref([])
const formData = ref({})
const companyOption = ref([])
const companyNameArray = ref([])
const getFundOptions = async () => {
const res = await getFundOption()
specialFundOption.value = res.data
}
const getCompanyOption = async () => {
const res = await getSubCompOpt()
companyOption.value = res.data
}
const getCompanyOptionItem = (val) => {
if (val !== undefined) {
val.forEach(item => {
matterTree(companyNameArray.value, companyOption.value, item)
})
}
return companyNameArray.value
}
const init = async () => {
if (!route.query.id) return;
await getFundOptions()
await getCompanyOption()
getInfo(route.query.id).then(res => {
if (res.code !== 1000) {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
loading.value = false
let data = res.data
data.formData.companyIds = getCompanyOptionItem(data.formData.companyIds)
collectData.value = data
formData.value = data.formData;
if (data.formData.specialFund) {
specialFundOption.value.forEach(item => {
if (data.formData.specialFund == item.value) {
data.formData.specialFund = item.label
}
})
}
processInstanceData.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(() => {
processViewer.value = true
showTable.value = true
if (data.formPermMap["fileList"]) {
fileListShow.value = data.formPermMap["fileList"].perm
}
})
})
}
onMounted(async () => {
loading.value = true
await init()
})
</script>
<style lang="scss" scoped>
:deep(.el-empty__description) {
margin-top: 0;
}
:deep(.el-table--fit ) {
height: 300px !important;
}
.detail-block {
overflow: hidden;
padding-right: 10px;
//.info {
// display: flex;
// flex-wrap: wrap;
//
// > div {
// width: 350px;
// margin-bottom: 15px;
// margin-right: 10px;
//
// > span:first-child {
// color: black;
// font-size: 16px;
// font-weight: bold;
// }
// }
//}
//.approval-record {
// padding-bottom: 30px;
//
// .process {
// position: relative;
// }
//}
}
</style>