|
|
@ -102,10 +102,6 @@ const projectId = computed(() => store.getters['projects/projectId']); // 项目 |
|
|
|
const options = ref([]); |
|
|
|
const detailId = computed(() => store.state.task.detailId); // 子课题ID |
|
|
|
|
|
|
|
watch(detailId, async () => { |
|
|
|
await getSubProject(detailId.value); |
|
|
|
}); |
|
|
|
|
|
|
|
const topicSubFormData = ref({ |
|
|
|
projectId: projectId.value, |
|
|
|
id: detailId.value, |
|
|
@ -133,6 +129,22 @@ const stageList = ref([ |
|
|
|
}, |
|
|
|
]); |
|
|
|
|
|
|
|
if (detailId.value) { |
|
|
|
getSubProject(detailId.value); |
|
|
|
} else { |
|
|
|
renderData(); |
|
|
|
} |
|
|
|
|
|
|
|
watch(detailId, async () => { |
|
|
|
if (detailId.value) { |
|
|
|
await getSubProject(detailId.value); |
|
|
|
} else { |
|
|
|
renderData(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
getList(); // 获取成员列表 |
|
|
|
|
|
|
|
// 添加实施内容与目标 |
|
|
|
function addMilestones() { |
|
|
|
stageList.value.push({ |
|
|
@ -150,8 +162,6 @@ function addMilestones() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
getList(); // 获取成员列表 |
|
|
|
|
|
|
|
const handleSearch = async value => { |
|
|
|
console.log('handleSearch', options.value, value); |
|
|
|
// await getList(value); // 获取成员列表 |
|
|
@ -178,55 +188,47 @@ async function getList(name) { |
|
|
|
options.value.push(obj); |
|
|
|
}); |
|
|
|
} catch (error) { |
|
|
|
console.log('error', error); |
|
|
|
message.info(error); |
|
|
|
throw new Error(error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const onSubmit = () => { |
|
|
|
stageList.value.forEach(item => { |
|
|
|
item.date.forEach((val, key) => { |
|
|
|
if (key === 0) { |
|
|
|
item.startTime = dayjs(val).format('x'); |
|
|
|
} else { |
|
|
|
item.endTime = dayjs(val).format('x'); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
const onSubmit = async () => { |
|
|
|
let msgText = ''; |
|
|
|
|
|
|
|
stageList.value.forEach(item => { |
|
|
|
console.log(item); |
|
|
|
if (item.date.length > 0) { |
|
|
|
item.date.forEach((val, key) => { |
|
|
|
if (key === 0) { |
|
|
|
item.startTime = dayjs(val).format('x'); |
|
|
|
} else { |
|
|
|
item.endTime = dayjs(val).format('x'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
if (item.checkContent.indexOf('1') > -1) { |
|
|
|
if (!item.thesis) msgText = '请填写论文数量'; |
|
|
|
} |
|
|
|
|
|
|
|
if (item.checkContent.indexOf('2') > -1) { |
|
|
|
if (!item.patent) msgText = '请填写专利数量'; |
|
|
|
} |
|
|
|
|
|
|
|
if (item.checkContent.indexOf('3') > -1) { |
|
|
|
if (!item.theSoft) msgText = '请填写软著数量'; |
|
|
|
} |
|
|
|
|
|
|
|
if (item.checkContent.indexOf('4') > -1) { |
|
|
|
if (!item.sciThesis) msgText = '请填写SCI论文数量'; |
|
|
|
} |
|
|
|
|
|
|
|
if (item.checkContent.indexOf('5') > -1) { |
|
|
|
if (!item.inventPatent) msgText = '请填写发明专利数量'; |
|
|
|
} |
|
|
|
|
|
|
|
if (item.checkContent.indexOf('6') > -1) { |
|
|
|
if (!item.practicalPatent) msgText = '请填写实用新型专利数量'; |
|
|
|
} |
|
|
|
|
|
|
|
if (item.checkContent.indexOf('7') > -1) { |
|
|
|
if (!item.facadePatent) msgText = '请填写外观专利数量'; |
|
|
|
} |
|
|
|
|
|
|
|
if (item.thesis < item.sciThesis) msgText = 'SCI论文数量不能比总论文数量大'; |
|
|
|
|
|
|
|
const totalPatent = Number(item.inventPatent) + Number(item.practicalPatent) + Number(item.facadePatent); |
|
|
|
if (item.patent < totalPatent) msgText = '发明专利数量、实用新型专利数量、外观专利数量总和不能比总专利数量大'; |
|
|
|
}); |
|
|
@ -247,15 +249,20 @@ const onSubmit = () => { |
|
|
|
}); |
|
|
|
|
|
|
|
const params = { param: topicSubFormData.value }; |
|
|
|
saveSubExperiment(params); |
|
|
|
getSubProject(detailId.value); |
|
|
|
await saveSubExperiment(params); |
|
|
|
store.commit('layout/setRefreshProjects'); |
|
|
|
|
|
|
|
if (detailId.value) { |
|
|
|
getSubProject(detailId.value); |
|
|
|
} else { |
|
|
|
renderData(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
async function getSubProject(id) { |
|
|
|
try { |
|
|
|
const params = { param: { taskDetailId: id } }; |
|
|
|
const data = await getSubExperiment(params); |
|
|
|
store.commit('layout/setRefreshProjects'); |
|
|
|
|
|
|
|
if (data) { |
|
|
|
const start = dayjs(Number(data.startTime)); |
|
|
@ -266,7 +273,11 @@ async function getSubProject(id) { |
|
|
|
data.subExperimentStageDtoList.forEach(item => { |
|
|
|
item.startTime = item.stageStartTime; |
|
|
|
item.endTime = item.stageEndTime; |
|
|
|
item.date = [dayjs(Number(item.startTime)), dayjs(Number(item.endTime))]; |
|
|
|
console.log(item.startTime !== '0'); |
|
|
|
if (item.startTime !== '0') { |
|
|
|
item.date = [dayjs(Number(item.startTime)), dayjs(Number(item.endTime))]; |
|
|
|
} |
|
|
|
|
|
|
|
item.checkContent = []; |
|
|
|
if (item.thesis) item.checkContent.push('1'); |
|
|
|
if (item.patent) item.checkContent.push('2'); |
|
|
@ -278,36 +289,43 @@ async function getSubProject(id) { |
|
|
|
}); |
|
|
|
stageList.value = data.subExperimentStageDtoList; |
|
|
|
} else { |
|
|
|
topicSubFormData.value = { |
|
|
|
projectId: projectId.value, |
|
|
|
id: detailId.value, |
|
|
|
name: '', |
|
|
|
memberId: '', |
|
|
|
date: [], |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
stageDtoList: [], |
|
|
|
}; |
|
|
|
stageList.value = [ |
|
|
|
{ |
|
|
|
date: [], |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
checkContent: [], |
|
|
|
thesis: '', |
|
|
|
sciThesis: '', |
|
|
|
patent: '', |
|
|
|
inventPatent: '', |
|
|
|
practicalPatent: '', |
|
|
|
facadePatent: '', |
|
|
|
theSoft: '', |
|
|
|
}, |
|
|
|
]; |
|
|
|
// 如果返回值为空渲染空数据 |
|
|
|
renderData(); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
message.info(error); |
|
|
|
throw new Error(error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 如果是添加渲染数据 |
|
|
|
function renderData() { |
|
|
|
topicSubFormData.value = { |
|
|
|
projectId: projectId.value, |
|
|
|
id: detailId.value, |
|
|
|
name: '', |
|
|
|
memberId: '', |
|
|
|
date: [], |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
stageDtoList: [], |
|
|
|
}; |
|
|
|
stageList.value = [ |
|
|
|
{ |
|
|
|
date: [], |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
checkContent: [], |
|
|
|
thesis: '', |
|
|
|
sciThesis: '', |
|
|
|
patent: '', |
|
|
|
inventPatent: '', |
|
|
|
practicalPatent: '', |
|
|
|
facadePatent: '', |
|
|
|
theSoft: '', |
|
|
|
}, |
|
|
|
]; |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped> |
|
|
|