fix : 修复阶段变更/详情/编辑功能

This commit is contained in:
2024-06-04 18:23:42 +08:00
parent 8f1cc442ac
commit b9d33bd6e4
9 changed files with 228 additions and 42 deletions

View File

@@ -77,6 +77,39 @@ export const getTags = (projectId) => {
method: "get"
});
};
export const getPhaseProcess = () => {
return request({
url: '/workflow/phase/change/process',
method: "get"
});
};
export const submitPhaseChange = (data) => {
return request({
url: '/workflow/phase/change',
method: "post",
data: data
});
};
export const getPhaseDetail = (projectId) => {
return request({
url: `/workflow/phase/change/info/${projectId}`,
method: "get"
});
};
export const getPhaseForm = (projectId) => {
return request({
url: `/workflow/phase/change/from/${projectId}`,
method: "get"
});
};
export const resubmitPhaseForm = (data) => {
return request({
url: '/workflow/phase/change/resubmit',
method: "post",
data: data
});
};
//项目归档
export const getConclusionDetail = (ProjectId) => {
return request({

View File

@@ -10,7 +10,6 @@
<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()
@@ -94,6 +93,9 @@ const back = () => {
case 'Share/detail':
router.push({name: 'Expense/share'})
break;
case 'Phase/detail':
router.push({name: 'Implementation'})
break;
}
}
// 驳回

View File

@@ -103,13 +103,14 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
newFile: false,
tag: tag
}
}
const getAttachment = (val) => {
console.log('上传文件getAttachment', val)
file.value = compositeParam(val)
formData.value.singleFile = compositeParam(val)
}
const getOtherFile = (val) => {
console.log('上传文件getOtherFile', val)

View File

@@ -56,13 +56,14 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
newFile: false,
tag: tag
}
}
const getAttachment = (val) => {
console.log('上传文件getAttachment', val)
file.value=compositeParam(val)
formData.value.singleFile = compositeParam(val)
}
const getOtherFile = (val) => {
console.log('上传文件getOtherFile', val)

View File

@@ -107,7 +107,7 @@ const searchConfig = reactive([
props: {
placeholder: '请选择状态',
clearable: true,
cacheKey: 'project_initiation'
cacheKey: 'project_implementation'
}
},
// {
@@ -232,7 +232,7 @@ const tableConfig = reactive({
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if (row.state !== null) {
return (<Tag dictType={'project_initiation'} value={row.state}/>)
return (<Tag dictType={'project_implementation'} value={row.state}/>)
} else {
return '--'
}
@@ -265,7 +265,13 @@ const tableConfig = reactive({
btn.push({label: '查看分摊', prem: ['mosr:requirement:info'], func: () => handleShare(row), type: 'primary'})
}
if (buttons.has("phaseChange")) {
btn.push({label: '阶段变更', prem: ['mosr:requirement:info'], func: () => handlePhaseChange(row), type: 'primary'})
btn.push({label: '阶段变更', prem: ['mosr:phase:change'], func: () => handlePhaseChange(row), type: 'primary'})
}
if (buttons.has("phaseChangeInfo")) {
btn.push({label: '阶段变更详情', prem: ['mosr:phase:info'], func: () => handlePhaseChangeDetail(row), type: 'primary'})
}
if (buttons.has("phaseChangeEdit")) {
btn.push({label: '阶段变更编辑', prem: ['mosr:phase:resubmit'], func: () => handlePhaseChangeEdit(row), type: 'primary'})
}
return (
<div style={{width: '100%'}}>
@@ -362,8 +368,27 @@ const handlePhaseChange = (row) => {
router.push({
name: 'Phase/change',
query: {
id: row.requirementId
id: row.requirementId,
projectId:row.projectId
}
})
}
const handlePhaseChangeDetail = (row) => {
router.push({
name: 'Phase/detail',
query: {
projectId:row.projectId
}
})
}
const handlePhaseChangeEdit = (row) => {
router.push({
name: 'Phase/edit',
query: {
projectId:row.projectId
}
})
}
</script>

View File

@@ -2,21 +2,21 @@
<div class="apply-block">
<AttachmentUpload ref="attachment" label="阶段变更附件" :showTable="showTable" :otherFileList="otherFileList"
@getAttachment="getAttachment"
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData"
:preview="name === 'Implementation/edit'"/>
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData" :preview="name === 'Phase/edit'"/>
<div class="approval-record">
<baseTitle title="流程"></baseTitle>
<process-diagram-viewer mode="view" v-if="processDiagramViewer"/>
</div>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(applyForm)">提交</el-button>
<el-button color="#DED0B2" v-if="name==='Phase/change'" @click="handleSubmit">提交</el-button>
<el-button color="#DED0B2" v-else @click="handleResubmit">重新提交</el-button>
</div>
</div>
</template>
<script setup lang="jsx">
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
import {getProjectCheckProcess, projectCheck, getCheckDetail, resubmitCheck} from "@/api/project-manage";
import {getPhaseProcess,submitPhaseChange,getPhaseForm,resubmitPhaseForm} from "@/api/project-manage";
import {ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js';
import {useTagsView} from '@/stores/tagsview.js'
@@ -29,7 +29,6 @@ const name = ref(router.currentRoute.value.name)
const loading = ref(false)
const formData = ref({})
const file = ref({})
const applyForm = ref()
const deploymentId = ref()
const showTable = ref(true)
const otherFileList = ref([])
@@ -47,7 +46,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
newFile: false,
tag: tag
}
}
@@ -71,27 +70,16 @@ const getFileParam = (item) => {
tag: item.tag
}
}
const handleSubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
if (JSON.stringify(file.value) === "{}") {
attachment.value.validate()
} else {
attachment.value.clearValidate()
}
if (!valid) return
const handleSubmit =async () => {
let files = []
let singleFile = {}
let fileArray
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
}
fileArray = otherFileList.value
fileArray.forEach(item => {
files.push(getFileParam(item))
})
@@ -102,24 +90,87 @@ const handleSubmit = (instance) => {
singleFile: singleFile,
projectId: route.query.projectId,
}
if (JSON.stringify(singleFile) === "{}") {
attachment.value.validate()
ElNotification({
title: '提示',
message: '请上传附件',
type: 'error'
})
return;
}else {
attachment.value.clearValidate()
}
console.log('params-提交', params)
// let res = await projectCheck(params)
// ElNotification({
// title: '提示',
// message: res.msg,
// type: res.code === 1000 ? 'success' : 'error'
// })
// if (res.code === 1000) {
// tagsViewStore.delVisitedViews(router.currentRoute.value.path)
// await router.push({
// name: 'Implementation'
// })
// }
})
let res = await submitPhaseChange(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({
name: 'Implementation'
})
}
}
const handleResubmit = (instance) => {
let singleFile = {}
let otherFiles = []
let fileArray
if (attachment.value.singleFile!==null&&name.value === 'Phase/edit') {
singleFile = {
fileId: attachment.value.singleFile.fileId
}
fileArray = attachment.value.allFileList
} else {
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
}
fileArray = otherFileList.value
}
fileArray.forEach(item => {
otherFiles.push(getFileParam(item))
})
//todo requirementId
let params = {
deploymentId: deploymentId.value,
requirementId: route.query.id,
fileList: otherFiles,
singleFile: singleFile,
projectId: route.query.projectId,
}
if (JSON.stringify(singleFile) === "{}") {
attachment.value.validate()
ElNotification({
title: '提示',
message: '请上传附件',
type: 'error'
})
return;
}else {
attachment.value.clearValidate()
}
console.log('重新提交params', params)
resubmitPhaseForm(params).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Implementation'
})
}
})
}
const init = async () => {
const {msg, code,data} = await getProjectCheckProcess(route.query.projectId)
const {msg, code,data} = await getPhaseProcess()
processDiagramViewer.value = false
if (code === 1000) {
deploymentId.value = data.deploymentId
@@ -141,8 +192,25 @@ const init = async () => {
})
}
}
const getDetailInfo = async () => {
getPhaseForm(route.query.projectId).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
formData.value = res.data
loading.value=false
}
})
}
onMounted(async () => {
// await init()
await init()
if (name.value === 'Phase/edit'){
loading.value=true
await getDetailInfo()
}
})
</script>

View File

@@ -0,0 +1,55 @@
<template>
<ApprovalDetail :formData="summaryData.formData" :data="summaryData"
:processViewer="summaryProcessViewer" :loading="loading" :fileListShow="fileListShow"/>
<opinion v-if="summaryData.taskId" :formData="summaryData.formData" :taskId="summaryData.taskId"></opinion>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js';
import {getPhaseDetail} from "@/api/project-manage";
const route = useRoute()
const summaryData = ref({})
const summaryProcessViewer = ref(true)
const processStore = useProcessStore()
const loading = ref(false)
const fileListShow = ref('READ')
const getInfo = async () => {
fileListShow.value='READ'
const projectId = route.query.projectId
summaryProcessViewer.value = false
loading.value = true
const {code, data,msg} = await getPhaseDetail(projectId)
if(code===1000){
summaryData.value = data;
loading.value = false
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
if (data.formPermMap["fileList"]) {
fileListShow.value = data.formPermMap["fileList"].perm
}
})
}else {
ElNotification({
title: '提示',
message: msg,
type: 'error'
})
if(msg==='查询结果为空'){
summaryData.value=[]
}
loading.value = false
}
}
getInfo()
</script>
<style scoped>
</style>

View File

@@ -108,7 +108,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
newFile: false,
tag: tag
}
}

View File

@@ -36,6 +36,7 @@
<el-table-column prop="orderNum" label="排序" width="60px"/>
<el-table-column prop="perms" label="权限标识"/>
<el-table-column prop="component" label="组件路径"/>
<el-table-column prop="path" label="路由地址"/>
<el-table-column prop="state" label="状态" width="80px">
<template #default="scope">
<tag dict-type="normal_disable" :value="scope.row.state"/>