Merge pull request 'dj' (#212) from dj into master
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/212
This commit is contained in:
@@ -13,21 +13,34 @@
|
||||
<AttachmentUpload ref="attachment" label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList"
|
||||
@getAttachment="getAttachment"
|
||||
@getOtherFile="getOtherFile" :showFileList="true"/>
|
||||
<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" @click="handleResubmit">重新提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import {useTagsView} from '@/stores/tagsview.js'
|
||||
import {ElMessage, ElNotification} from "element-plus";
|
||||
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
|
||||
import {getProcessInfo, projectApply} from "@/api/project-manage";
|
||||
import {useProcessStore} from '@/stores/processStore.js';
|
||||
|
||||
const tagsViewStore = useTagsView()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const formData = ref({})
|
||||
const rules = reactive({
|
||||
attachment: [{required: true, message: '请上传项目立项附件', trigger: 'blur'}],
|
||||
})
|
||||
const fileList = ref([])
|
||||
const processStore = useProcessStore()
|
||||
const deploymentId = ref()
|
||||
const file = ref({})
|
||||
const applyForm = ref()
|
||||
const showTable = ref(true)
|
||||
const otherFileList = ref([])
|
||||
@@ -71,7 +84,8 @@ const tableConfig = reactive({
|
||||
// }
|
||||
]
|
||||
})
|
||||
|
||||
const processInstanceData = ref()
|
||||
const processDiagramViewer = ref(true)
|
||||
const compositeParam = (item, type) => {
|
||||
let tag = ''
|
||||
if (router.currentRoute.value.name === 'Initiation/apply') {
|
||||
@@ -90,13 +104,12 @@ const compositeParam = (item, type) => {
|
||||
}
|
||||
const getAttachment = (val) => {
|
||||
console.log('上传文件getAttachment', val)
|
||||
let fileObj = compositeParam(val, 1)
|
||||
fileList.value.push(fileObj)
|
||||
file.value=compositeParam(val)
|
||||
}
|
||||
const getOtherFile = (val) => {
|
||||
console.log('上传文件getOtherFile', val)
|
||||
showTable.value = false
|
||||
let fileObj = compositeParam(val, 2)
|
||||
let fileObj = compositeParam(val)
|
||||
otherFileList.value.push(fileObj)
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
@@ -111,38 +124,77 @@ const getFileParam = (item) => {
|
||||
const handleSubmit = (instance) => {
|
||||
if (!instance) return
|
||||
instance.validate(async (valid) => {
|
||||
if(fileList.value.length===0){
|
||||
applyForm.value.validate()
|
||||
}else {
|
||||
applyForm.value.clearValidate()
|
||||
}
|
||||
// if(JSON.stringify(file.value) == "{}"){
|
||||
// applyForm.value.validate()
|
||||
// }else {
|
||||
// applyForm.value.clearValidate()
|
||||
// }
|
||||
if (!valid) return
|
||||
let files = []
|
||||
fileList.value.forEach(item => {
|
||||
files.push(getFileParam(item))
|
||||
})
|
||||
let singleFile={}
|
||||
if(file.value.fileId!==undefined){
|
||||
singleFile = {
|
||||
fileId: file.value.fileId
|
||||
}
|
||||
}
|
||||
otherFileList.value.forEach(item => {
|
||||
files.push(getFileParam(item))
|
||||
})
|
||||
let params = {
|
||||
// deploymentId: deploymentId.value,
|
||||
files: files
|
||||
deploymentId: deploymentId.value,
|
||||
requirementId: route.query.id,
|
||||
files: files,
|
||||
singleFile: singleFile,
|
||||
projectId:route.query.projectId,
|
||||
}
|
||||
console.log('params',params)
|
||||
// let res = await requirementReported(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: 'Summary'
|
||||
// })
|
||||
// }
|
||||
let res = await projectApply(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: 'Initiation'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleResubmit = () => {
|
||||
resubmit(submitParam(formData.value)).then(res => {
|
||||
if (res.code === 1000) {
|
||||
ElMessage.success(res.msg)
|
||||
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
|
||||
router.push({
|
||||
name: 'Collection'
|
||||
})
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
const init = () => {
|
||||
getProcessInfo().then(res => {
|
||||
processDiagramViewer.value = false
|
||||
if (res.code === 1000) {
|
||||
let data = res.data
|
||||
deploymentId.value=data.deploymentId
|
||||
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(() => {
|
||||
processDiagramViewer.value = true
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
init()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -117,6 +117,11 @@ const tableConfig = reactive({
|
||||
label: '项目影响',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'economicEstimate',
|
||||
label: '经济概况',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'startTime',
|
||||
label: '起止时间',
|
||||
@@ -144,7 +149,7 @@ const tableConfig = reactive({
|
||||
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'}]
|
||||
if (row.state === '3') {
|
||||
btn.push({label: '编辑', func: () => handleEdit(row), type: 'primary'})
|
||||
} else if (row.state === '20') {
|
||||
} else if (row.state === '0') {
|
||||
btn.push({label: '申请', func: () => handleApply(row), type: 'primary'})
|
||||
}
|
||||
return (
|
||||
@@ -196,7 +201,9 @@ const handleApply = (row) => {
|
||||
router.push({
|
||||
name:'Initiation/apply',
|
||||
query: {
|
||||
id: row.requirementId
|
||||
isAdd: 1,
|
||||
id: row.requirementId,
|
||||
projectId: row.projectId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user