fix : 修复首页查看跳转问题及简化代码

This commit is contained in:
2024-06-02 11:54:19 +08:00
parent cd715fbf98
commit c05322a2bf
8 changed files with 59 additions and 90 deletions

View File

@@ -11,6 +11,8 @@
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({
@@ -51,23 +53,35 @@ const back = () => {
router.push({name: 'Filing'})
break;
case 'Implementation/detail':
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'})
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':
router.push({name: 'Summary'})
if (route.query.source === 'home') {
router.push('/home')
} else {
router.push({name: 'Summary'})
}
break;
case 'Requirement/detail':
router.push({name: 'Requirement'})
if (route.query.source === 'home') {
router.push('/home')
} else {
router.push({name: 'Requirement'})
}
break;
case 'Fund/detail':
router.push({name: 'Fund'})
@@ -88,7 +102,6 @@ const handleReject = async () => {
})
return
}
console.log('values', values)
const params = {
taskId: props.taskId,
...values
@@ -99,6 +112,7 @@ const handleReject = async () => {
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
back()
}
@@ -115,6 +129,7 @@ const handleAgree = async () => {
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
back()
}
</script>

View File

@@ -46,14 +46,14 @@
</el-col>
</el-row>
</div>
<div v-else style="display: flex; justify-content: center; align-items: center; height: 100%;" >
<div v-else style="display: flex; justify-content: center; align-items: center; height: 100%;">
您没有任何角色 请联系管理员
</div>
</template>
<script setup lang="jsx">
import 'element-plus/theme-chalk/display.css'
import { useAuthStore } from '@/stores/userstore.js'
import {useAuthStore} from '@/stores/userstore.js'
const AuthStore = useAuthStore()
const router = useRouter()
@@ -120,9 +120,9 @@ const tableConfig = reactive({
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if(row.targetState!==null||row.targetState!==undefined){
if (row.targetState !== null || row.targetState !== undefined) {
return (<Tag dictType={'todo_type'} value={row.targetState}/>)
}else {
} else {
return '--'
}
}
@@ -162,16 +162,27 @@ const handleView = (row) => {
router.push({
name: 'Requirement/detail',
query: {
id: row.targetId
id: row.targetId,
source: 'home'
}
})
} else{
} else if (row.targetState == '10' && row.targetId) {
router.push({
name: 'Summary/detail',
query: {
projectId: row.targetId,
state: row.state,
source: 'home'
}
})
} else {
router.push({
name: 'Implementation/detail',
query: {
projectId: row.targetId,
state: row.state,
step: row.targetState
step: row.targetState,
source: 'home'
}
})
}

View File

@@ -25,7 +25,7 @@
v-model="formData.deadline"
type="datetime"
placeholder="截止时间"
value-format="YYYY-MM-DD"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-config-provider>
</el-form-item>

View File

@@ -204,7 +204,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="其中申请公司总部科技创新专项资金(元)" prop="specialFundAmount">
<el-form-item label="其中申请公司总部科技创新专项资金(元)" prop="specialFundAmount" v-if="formData.isSpecialFund">
<el-input v-model="formData.specialFundAmount" clearable></el-input>
</el-form-item>
</el-col>
@@ -297,16 +297,16 @@ const rules = reactive({
serviceDescription: [{required: true, message: '请输入现有业务描述', trigger: 'blur'}],
contentDescription: [{required: true, message: '请输入研发项目关键内容描述', trigger: 'blur'}]
})
// const getIsFund = async () => {
// getFormInfo(route.query.id).then(res => {
// if (res.code === 1000) {
// formData.value.isSpecialFund = res.data.isSpecialFund
// if(res.data.isSpecialFund){
// formData.value.specialFund = Number(res.data.specialFund)
// }
// }
// })
// }
const getIsFund = async () => {
getFormInfo(route.query.id).then(res => {
if (res.code === 1000) {
formData.value.isSpecialFund = res.data.isSpecialFund
if(res.data.isSpecialFund){
formData.value.specialFund = Number(res.data.specialFund)
}
}
})
}
const compositeParam = (item, type) => {
let tag = ''
if (name.value === 'Summary/add' || name.value === 'Summary/edit') {
@@ -346,12 +346,6 @@ const handleSubmit = debounce(async (instance) => {
if (!instance) return
instance.validate(async (valid, fields) => {
if (!valid) return
// if (JSON.stringify(file.value) === "{}") {
// attachment.value.validate()
// } else {
// attachment.value.clearValidate()
// }
let singleFile = {}
if (file.value.fileId !== undefined) {
singleFile = {
@@ -430,12 +424,6 @@ const handleResubmit = debounce(() => {
let otherFiles = []
let fileArray
if (name.value === 'Summary/edit') {
// console.log('attachment.value', attachment.value.singleFile)
// if (attachment.value.singleFile === null) {
// attachment.value.validate()
// } else {
// attachment.value.clearValidate()
// }
singleFile = {
fileId: attachment.value.singleFile?.fileId
}
@@ -502,7 +490,7 @@ const getDetailInfo = async () => {
const init = async () => {
const resFund = await getFundOption()
specialFundOption.value = resFund.data
// await getIsFund()
await getIsFund()
const res = await getSubCompOpt()
companyOption.value = res.data
getProcessInfo().then(res => {

View File

@@ -11,8 +11,6 @@ const localData = reactive({})
const tableIns = ref()
const router = useRouter()
const searchConfig = reactive([
{
label: '需求名称',
@@ -76,7 +74,6 @@ const searchConfig = reactive([
// colProps: {}
// },
])
const tableConfig = reactive({
columns: [
{

View File

@@ -128,12 +128,6 @@ const getFileParam = (item) => {
}
}
const handleSubmit = async () => {
// if (JSON.stringify(file.value) === "{}") {
// attachment.value.validate()
// return;
// } else {
// attachment.value.clearValidate()
// }
let files = []
let singleFile = {}
if (file.value.fileId !== undefined) {
@@ -180,12 +174,6 @@ const handleResubmit = () => {
let singleFile = {}
let otherFiles = []
let fileArray
// if (JSON.stringify(file.value) === "{}" || attachment.value.singleFile === null) {
// attachment.value.validate()
// return;
// } else {
// attachment.value.clearValidate()
// }
if (attachment.value.singleFile !== null && name.value === 'Filing/edit') {
singleFile = {
fileId: attachment.value.singleFile.fileId

View File

@@ -82,13 +82,6 @@ const getFileParam = (item) => {
const handleSubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
if(JSON.stringify(file.value) === "{}"){
attachment.value.validate()
return;
}else {
attachment.value.clearValidate()
}
if (!valid) return
let files = []
let singleFile={}
@@ -149,12 +142,6 @@ const handleResubmit = (instance) => {
let singleFile = {}
let otherFiles = []
let fileArray
// if (JSON.stringify(file.value) === "{}"||attachment.value.singleFile===null) {
// attachment.value.validate()
// return;
// } else {
// attachment.value.clearValidate()
// }
if (attachment.value.singleFile!==null&&name.value === 'Implementation/edit') {
singleFile = {
fileId: attachment.value.singleFile.fileId

View File

@@ -126,17 +126,6 @@ const getFileParam = (item) => {
const handleSubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (JSON.stringify(file.value) === "{}") {
attachment.value.validate()
ElNotification({
title: '提示',
message: '请上传附件',
type: 'error'
})
return;
} else {
attachment.value.clearValidate()
}
if (!valid) return
let files = []
let singleFile = {}
@@ -186,12 +175,6 @@ const handleResubmit = async () => {
let files = []
let singleFile = {}
let fileArray
// if (JSON.stringify(file.value) === "{}" || attachment.value.singleFile === null) {
// attachment.value.validate()
// return;
// } else {
// attachment.value.clearValidate()
// }
if (attachment.value.singleFile !== null && name.value === 'Initiation/edit') {
singleFile = {
fileId: attachment.value.singleFile.fileId