Commit 6ca4886f authored by wangxl's avatar wangxl

222222

parent 6e842e19
...@@ -417,6 +417,9 @@ export default { ...@@ -417,6 +417,9 @@ export default {
save (params) { save (params) {
return fetch(`/v1/science-admin/com-project/save`, params, 'post', 'json') return fetch(`/v1/science-admin/com-project/save`, params, 'post', 'json')
}, },
saveByStep (params) {
return fetch(`/v1/science-admin/com-project/saveByStep`, params, 'post', 'json')
},
updateUnit (params) { updateUnit (params) {
return fetch(`/v1/science-admin/com-project/updateUnit`, params, 'post', 'json') return fetch(`/v1/science-admin/com-project/updateUnit`, params, 'post', 'json')
}, },
......
...@@ -4,18 +4,17 @@ ...@@ -4,18 +4,17 @@
<a-spin :spinning="loading" style="width: 100%;height: 100%;"> <a-spin :spinning="loading" style="width: 100%;height: 100%;">
<div class="page-steps"> <div class="page-steps">
<a-steps size="small" :current="current"> <a-steps size="small" :current="current">
<a-step :status="item.status" v-for="(item,index) in completeStatus" :key="index+'completeStatus'" :title="item.title" /> <a-step :status="item.status" v-for="(item,index) in stepsArray" :key="index+'stepsArray'" :title="item.title" />
</a-steps> </a-steps>
</div> </div>
<div class="page-content"> <div class="page-content">
<project-edit v-model="value" @close="closeWindow" @load="onLoad" :showStatus.sync="showStatus" ref="projCreate" v-if="projType"></project-edit> <project-edit v-model="value" @close="closeWindow" @load="onLoad" @next="changeSteps" :stepsArray.sync="stepsArray" ref="projCreate"></project-edit>
<project-edit-key v-model="value" @close="closeWindow" @load="onLoad" :showStatus.sync="showStatus" ref="projCreate" v-else></project-edit-key>
</div> </div>
<div class="page-footer"> <div class="page-footer">
<a-button v-if="currSteps > 0" style="margin-left: 40px" type="primary" @click="prev">上一步</a-button> <a-button v-if="currSteps > 0" style="margin-left: 40px" type="primary" @click="prev">上一步</a-button>
<a-button style="margin-left: 40px" type="primary" @click="save">保 存</a-button> <a-button style="margin-left: 40px" type="primary" @click="save">保 存</a-button>
<a-button v-if="currSteps < completeStatus.length - 1" style="margin-left: 40px" type="primary" @click="next">下一步</a-button> <a-button v-if="currSteps < stepsArray.length - 1" style="margin-left: 40px" type="primary" @click="next">下一步</a-button>
<a-button v-if="currSteps == completeStatus.length - 1" style="margin-left: 40px" type="primary" @click="submit">完成填写</a-button> <a-button v-if="currSteps == stepsArray.length - 1" style="margin-left: 40px" type="primary" @click="submit">完成填写</a-button>
</div> </div>
</a-spin> </a-spin>
</div> </div>
...@@ -36,15 +35,14 @@ export default { ...@@ -36,15 +35,14 @@ export default {
projType: getType() == "1", projType: getType() == "1",
current: 10, current: 10,
currSteps: 0, currSteps: 0,
completeStatus: [ stepsArray: [
{ status: "", title: '基本信息' }, { status: "process", title: '基本信息', showStatus: true },
{ status: "", title: '项目组成员及单位' }, { status: "wait", title: '项目组成员及单位', showStatus: false },
{ status: "", title: '经费预算及设备明细' }, { status: "wait", title: '经费预算及设备明细', showStatus: false },
{ status: "", title: '阶段目标及课题设置' }, { status: "wait", title: '阶段目标及课题设置', showStatus: false },
{ status: "", title: '绩效指标' }, { status: "wait", title: '绩效指标', showStatus: false },
{ status: "", title: '附件' } { status: "wait", title: '附件', showStatus: false }
], ],
showStatus: [true, false, false, false, false, false],
stepStyle: { stepStyle: {
marginBottom: '60px', marginBottom: '60px',
boxShadow: '0px -1px 0 0 #e8e8e8 inset', boxShadow: '0px -1px 0 0 #e8e8e8 inset',
...@@ -66,35 +64,28 @@ export default { ...@@ -66,35 +64,28 @@ export default {
debugger debugger
this.currSteps = e this.currSteps = e
this.changeSteps(this.currSteps) this.changeSteps(this.currSteps)
console.log(this.currSteps, 'stepsChange')
}, },
next () { next () {
this.currSteps++; this.$refs.projCreate.submit(this.currSteps, true)
this.changeSteps(this.currSteps)
console.log(this.currSteps, 'next')
}, },
prev () { prev () {
this.currSteps--; this.currSteps--;
this.changeSteps(this.currSteps) this.changeSteps(this.currSteps)
console.log(this.currSteps, 'prev')
}, },
changeSteps (e) { changeSteps (e) {
var clone = [].concat(this.completeStatus) this.currSteps = e
clone[e].status = "process" var clone = [].concat(this.stepsArray)
this.completeStatus = clone clone.forEach(e => {
this.changeShowStatus(e) e.showStatus = false
}, })
changeShowStatus (e) { clone[e].showStatus = true;
var clone = [false, false, false, false, false, false] this.stepsArray = clone
clone[e] = true;
this.showStatus = clone
console.log(this.showStatus)
}, },
save () { save () {
this.$refs.projCreate.save() this.$refs.projCreate.save(this.currSteps)
}, },
submit () { submit () {
this.$refs.projCreate.submit() this.$refs.projCreate.submit(this.currSteps, false)
}, },
closeWindow (value) { closeWindow (value) {
this.$emit('close', value) this.$emit('close', value)
......
<template> <template>
<div> <div>
<a-form-model ref="form" :model="formData" :rules="rules" style="border-top: 0px" class="from-table font-line-space"> <a-form-model ref="form" :model="formData" :rules="rules" style="border-top: 0px" class="from-table font-line-space">
<div v-if="showStatus[0]"> <div v-if="stepsArray[0].showStatus">
<a-row> <a-row>
<a-col :span="24" style="border-top: 0px;text-align: center;"> <a-col :span="24" style="border-top: 0px;text-align: center;">
<div class="main-title"> <div class="main-title">
...@@ -350,20 +350,6 @@ ...@@ -350,20 +350,6 @@
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row type="flex">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div class="required">申请经费(万元)</div>
</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="govFunding">
<!-- <a-input-number v-model="formData.govFunding" @change="govFundingChange" :min="0" :step="0.01" style="width: 100px" /> -->
{{ formData.govFunding }}
<span> 万元</span>
</a-form-model-item>
</a-col>
</a-row>
<a-row type="flex"> <a-row type="flex">
<a-col :span="4" class="bg-gray"> <a-col :span="4" class="bg-gray">
<div class="special-middle"> <div class="special-middle">
...@@ -512,7 +498,7 @@ ...@@ -512,7 +498,7 @@
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
<div v-if="showStatus[1]"> <div v-if="stepsArray[1].showStatus">
<a-row> <a-row>
<a-col :span="24" style="border-top: 0px"> <a-col :span="24" style="border-top: 0px">
<div class="main-title"> <div class="main-title">
...@@ -532,7 +518,7 @@ ...@@ -532,7 +518,7 @@
<!-- 项目主要参与单位及分工 --> <!-- 项目主要参与单位及分工 -->
<participate-units-edit :participateUnits.sync="formData.participateUnits" /> <participate-units-edit :participateUnits.sync="formData.participateUnits" />
</div> </div>
<div v-if="showStatus[2]"> <div v-if="stepsArray[2].showStatus">
<!-- 经费预算 --> <!-- 经费预算 -->
<budget-edit :budget.sync="formData.budget" @save="budgetSave" /> <budget-edit :budget.sync="formData.budget" @save="budgetSave" />
<a-row type="flex"> <a-row type="flex">
...@@ -572,13 +558,13 @@ ...@@ -572,13 +558,13 @@
<!-- 项目承担单位研究资金支出预算明细表 --> <!-- 项目承担单位研究资金支出预算明细表 -->
<unit-payment-edit :unitPayment.sync="formData.unitPayment" /> <unit-payment-edit :unitPayment.sync="formData.unitPayment" />
</div> </div>
<div v-if="showStatus[3]"> <div v-if="stepsArray[3].showStatus">
<!-- 项目安排及阶段目标 --> <!-- 项目安排及阶段目标 -->
<proj-stage-goals-edit :stageGoals.sync="formData.stageGoals" /> <proj-stage-goals-edit :stageGoals.sync="formData.stageGoals" />
<!-- 项目课题设置 --> <!-- 项目课题设置 -->
<project-sub-edit :projectSubList.sync="formData.projectSubList" /> <project-sub-edit :projectSubList.sync="formData.projectSubList" />
</div> </div>
<div v-if="showStatus[4]"> <div v-if="stepsArray[4].showStatus">
<a-row type="flex"> <a-row type="flex">
<a-col :span="24" style="text-align: center;"> <a-col :span="24" style="text-align: center;">
<div class="special-middle"> <div class="special-middle">
...@@ -589,7 +575,7 @@ ...@@ -589,7 +575,7 @@
<!-- 项目绩效指标 --> <!-- 项目绩效指标 -->
<project-kpi-edit :projectKPI.sync="formData.projectKPI" /> <project-kpi-edit :projectKPI.sync="formData.projectKPI" />
</div> </div>
<div v-if="showStatus[5]"> <div v-if="stepsArray[5].showStatus">
<!-- 附件 --> <!-- 附件 -->
<file-edit :fileList.sync="formData.fileList" /> <file-edit :fileList.sync="formData.fileList" />
</div> </div>
...@@ -677,19 +663,19 @@ export default { ...@@ -677,19 +663,19 @@ export default {
return null return null
} }
}, },
showStatus: { stepsArray: {
type: Array, type: Array,
default () { default () {
return [true, false, false, false, false, false] return []
} }
}, },
}, },
created () { created () {
console.log(this.showStatus)
this.getProject() this.getProject()
}, },
data () { data () {
return { return {
completeStatus: "0,0,0,0,0,0",
overseasShow: false, overseasShow: false,
formData: { formData: {
id: null, id: null,
...@@ -761,8 +747,8 @@ export default { ...@@ -761,8 +747,8 @@ export default {
remark: [{ required: true, message: '请填写附注说明', trigger: 'blur' },], remark: [{ required: true, message: '请填写附注说明', trigger: 'blur' },],
startDate: { required: true, message: '请选择项日开始时间', trigger: 'change' }, startDate: { required: true, message: '请选择项日开始时间', trigger: 'change' },
endDate: { required: true, message: '请选择项目结束时间', trigger: 'change' }, endDate: { required: true, message: '请选择项目结束时间', trigger: 'change' },
totalFunding: [{ required: true, message: '请填写项目总经费', trigger: 'blur' },], // totalFunding: [{ required: true, message: '请填写项目总经费', trigger: 'blur' },],
govFunding: [{ required: true, message: '请填写申请科技经费', trigger: 'blur' },], // govFunding: [{ required: true, message: '请填写申请科技经费', trigger: 'blur' },],
projAbstract: [{ required: true, message: '请填写项目摘要', trigger: 'blur' },], projAbstract: [{ required: true, message: '请填写项目摘要', trigger: 'blur' },],
projKeywords: [{ required: true, message: '请填写关键词', trigger: 'blur' },], projKeywords: [{ required: true, message: '请填写关键词', trigger: 'blur' },],
researchContent: { required: true, message: '请填写项目实施目标', trigger: 'blur' }, researchContent: { required: true, message: '请填写项目实施目标', trigger: 'blur' },
...@@ -782,12 +768,72 @@ export default { ...@@ -782,12 +768,72 @@ export default {
}, },
methods: { methods: {
moment, moment,
save (step) {
var obj = this.getObj(step)
obj.step = step
if (this.checkInfo(step)) {
this.$emit('load', true)
let pars = isEmptyParams(obj)
let par = { ...pars }
this.$api.project.saveByStep(par).then(({ data = {} }) => {
if (data) {
this.formData.id = data
this.$message.success('保存成功!')
this.$emit('close', 'save')
}
this.$emit('load', false)
}).catch(() => {
this.$emit('load', false)
})
}
},
submit (step, next) {
if (this.checkInfo(step)) {
this.$refs.form.validate(valid => {
if (valid) {
this.$emit('load', true)
var obj = this.getObj(step)
obj.step = step
let state = obj.projState
if (state != 30)
obj.projState = 10
let pars = isEmptyParams(obj)
let par = { ...pars }
this.$api.project.saveByStep(par).then(({ data = {} }) => {
if (data) {
this.formData.id = data
if (next) {
this.$emit('close', 'save')
this.$emit('next', step + 1)
var arr = this.completeStatus.split(',');
arr[step] = "1";
this.completeStatus = arr.toString()
this.formData.completeStatus = this.completeStatus
this.getCompleteStatus(step + 1, this.completeStatus)
} else {
this.$message.success('成功!')
this.$emit('close', 'submit')
}
}
this.$emit('load', false)
}).catch(() => {
this.$emit('load', false)
})
} else {
this.$message.error('信息未填写完全!')
return false
}
})
}
},
getProject () { getProject () {
this.$emit('load', true) this.$emit('load', true)
if (!!this.value) { if (!!this.value) {
this.$api.project.getProjectInfoById({ id: this.value }).then(({ data = {} }) => { this.$api.project.getProjectInfoById({ id: this.value }).then(({ data = {} }) => {
if (data) { if (data) {
this.formData = data this.formData = data
console.log(data)
this.getCompleteStatus(0, data.completeStatus)
this.loadList() this.loadList()
} else } else
this.$emit('close', 'error') this.$emit('close', 'error')
...@@ -800,6 +846,7 @@ export default { ...@@ -800,6 +846,7 @@ export default {
this.$api.project.getNewProject({ projType: getType() }).then(({ data = {} }) => { this.$api.project.getNewProject({ projType: getType() }).then(({ data = {} }) => {
if (data) { if (data) {
this.formData = data this.formData = data
this.getCompleteStatus(0, data.completeStatus)
this.loadList() this.loadList()
} else } else
this.$emit('close', 'error') this.$emit('close', 'error')
...@@ -810,12 +857,24 @@ export default { ...@@ -810,12 +857,24 @@ export default {
}) })
} }
}, },
getCompleteStatus (step, completeStatus) {
var arr = completeStatus.split(',')
if (!!arr && arr.length > 0) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == "1") {
this.stepsArray[i].status = "finish"
}
}
this.stepsArray[step].status = "process"
}
},
loadList () { loadList () {
if (!!!this.formData.cooperativeUnits || this.formData.cooperativeUnits.length == 0) if (!!!this.formData.cooperativeUnits || this.formData.cooperativeUnits.length == 0)
this.formData.cooperativeUnits = [{ ...Cooperative }, { ...Cooperative }] this.formData.cooperativeUnits = []
if (!!!this.formData.participateUnits || this.formData.participateUnits.length == 0) if (!!!this.formData.participateUnits || this.formData.participateUnits.length == 0)
this.formData.participateUnits = [{ ...ParticipateUnit }, { ...ParticipateUnit }] this.formData.participateUnits = [] //{ ...Cooperative }, { ...Cooperative }
if (!!!this.formData.members || this.formData.members.length == 0) if (!!!this.formData.members || this.formData.members.length == 0)
this.formData.members = [] this.formData.members = []
...@@ -848,60 +907,61 @@ export default { ...@@ -848,60 +907,61 @@ export default {
this.formData.managerDept = this.formData.projectKPI.managerDept this.formData.managerDept = this.formData.projectKPI.managerDept
this.formData.projAttribute = this.formData.projectKPI.projAttribute this.formData.projAttribute = this.formData.projectKPI.projAttribute
}, },
save () { getObj (step) {
this.processProjectYearTarget() var obj = null
if (this.checkProjName()) { switch (step) {
this.$emit('load', true) case 0: {
let pars = isEmptyParams(this.formData) obj = {
let par = { ...pars } id: null, reportYear: null, batch: null, projState: null, appPersonId: null, appUnitId: null, projType: null,
this.$api.project.save(par).then(({ data = {} }) => { jobTime: null, address: null, mainResearchAreas: null,
if (data) { unitLinkName: null, unitLinkMobile: null, unitLinkEmail: null, unitLinkFax: null,
this.formData.id = data projName: null, knowledgeId: null, startDate: null, endDate: null,
this.$message.success('保存成功!') remark: null, projClass: null, subjectScope: null, projAbstract: null, projKeywords: null,
this.$emit('close', 'save') totalFunding: null, govFunding: null, unitFunding: null, selfFunding: null,
} researchContent: null, technologyTarget: null, economyTarget: null, achievementTarget: null, technologyReportsTarget: null, otherTarget: null,
this.$emit('load', false) fileId: null, downloadId: null, completeStatus: null, step: null
}).catch(() => {
this.$emit('load', false)
})
}
},
submit () {
this.processProjectYearTarget()
this.$refs.form.validate(valid => {
if (valid) {
if (this.formData.members.length == 0) {
this.$message.error('至少添加一位项目组成员!')
return false
} else {
this.$emit('load', true)
let state = this.formData.projState
if (state != 30)
this.formData.projState = 10
let pars = isEmptyParams(this.formData)
let par = { ...pars }
this.$api.project.save(par).then(({ data = {} }) => {
if (data) {
this.formData.id = data
this.$message.success('成功!')
this.$emit('close', 'submit')
}
this.$emit('load', false)
}).catch(() => {
this.$emit('load', false)
})
} }
} else { break;
this.$message.error('项目信息未填写完全!')
return false
} }
case 1:
obj = { id: null, members: [], participateUnits: [], completeStatus: null, step: null }
break;
case 2:
obj = { id: null, budget: [], fundPlan: [], deviceList: [], manufactureList: [], unitPayment: [], completeStatus: null, step: null }
break;
case 3:
obj = { id: null, stageGoals: [], projectSubList: [], completeStatus: null, step: null }
break;
case 4:
obj = { id: null, projectKPI: null, completeStatus: null, step: null }
break;
case 5:
obj = { id: null, fileList: [], projState: null, completeStatus: null, step: null }
break;
}
Object.keys(obj).forEach(key => {
obj[key] = this.formData[key];
}) })
return obj
}, },
checkProjName () { checkInfo (step) {
if (this.formData.projName == "" || this.formData.projName == null) { if (step == 0) {
alert('项目名称不能为空') if (this.formData.projName == "" || this.formData.projName == null) {
return false alert('项目名称不能为空')
} else { return false
} else return true
} else if (step == 1) {
if (!!!this.formData.members || this.formData.members.length == 0) {
this.$message.error('至少添加一位项目组成员!')
return false
} else return true
} else if (step == 2) {
return true
} else if (step == 3) {
return true
} else if (step == 4) {
return true
} else if (step == 5) {
return true return true
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment