<template>
|
<div class="class_dataImport">
|
<el-steps :active="add_Step" align-center>
|
<el-step title="研究目标" description="明确临床问题"></el-step>
|
<el-step title="方案设计" description="确立方案"></el-step>
|
<el-step title="预览" description=""></el-step>
|
</el-steps>
|
<div style="height: 55vh; padding:0px; box-sizing:boder-box; overflow: auto;">
|
<div v-if="add_Step == 0" style="width: 100%; height: 100%;" align="center">
|
<div style="padding-top: 5%; box-sizing:boder-box">
|
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
<el-form-item label="项目名称:" prop="name" style="width: 50%;">
|
<el-input v-model="ruleForm.name"></el-input>
|
</el-form-item>
|
<el-form-item label="研究目的:" prop="objective" style="width: 50%;">
|
<el-select v-model="ruleForm.objective" placeholder="请选择" style="width: 100%;">
|
<el-option
|
v-for="item in options_objectives"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
|
<el-form-item label="起止时间:" prop="items" style="width: 50%;">
|
<el-date-picker
|
v-model="ruleForm.items"
|
type="daterange"
|
range-separator="至"
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
style="width: 100%;"
|
>
|
</el-date-picker>
|
</el-form-item>
|
|
<el-form-item label="项目描述:" prop="desp" style="width: 50%;">
|
<el-input type="textarea" v-model="ruleForm.desp"></el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
</div>
|
<div v-if="add_Step == 1" style="width: 100%; height: 100%;" align="center">
|
<substep ref="substep_zj" v-bind:xmId="xmId"></substep>
|
</div>
|
<div v-if="add_Step == 2" style="width: 100%; height: 100%;" align="center">
|
<substepReadOnly v-bind:form_objs="form_objs" v-bind:showData_="showData_"></substepReadOnly>
|
</div>
|
</div>
|
|
<div style="width: 100%; text-align: center;">
|
<el-button v-if="add_Step > 0" style="margin-top: 12px;" @click="UpwardStep">上一步</el-button>
|
<el-button :loading="loading_nextStep" style="margin-top: 12px;" @click="NextStep">{{nextStepName}}</el-button>
|
<!-- <el-button :loading="loading_cancel" style="margin-top: 12px;" @click="Cancel">{{cancelName}}</el-button> -->
|
</div>
|
|
</div>
|
</template>
|
|
<script>
|
import substep from './portion/substep.vue'
|
import substepReadOnly from './portion/substepReadOnly.vue'
|
export default {
|
name: 'dataImport',
|
props:{
|
rowData:{
|
type: Object,
|
required: true
|
}
|
},
|
components: {
|
substep,
|
substepReadOnly
|
},
|
data () {
|
return {
|
userId: undefined,
|
assign: undefined,
|
add_Step: 0,
|
loading_nextStep: false,
|
nextStepName: "下一步",
|
loading_cancel: false,
|
cancelName: "关 闭",
|
|
ruleForm: {},
|
xmId: null,
|
showData_: null,
|
form_objs: null,
|
options_objectives: [
|
{
|
value: "干预性系统评价",
|
label: "干预性系统评价"
|
},
|
{
|
value: "诊断性系统评价",
|
label: "诊断性系统评价"
|
},
|
{
|
value: "预后性系统评价",
|
label: "预后性系统评价"
|
},
|
{
|
value: "相关性系统评价",
|
label: "相关性系统评价"
|
}
|
],
|
rules: {
|
name: [
|
{
|
required: true,
|
message: "不能为空",
|
trigger: ["change", "blur"]
|
}
|
],
|
objective: [
|
{
|
required: true,
|
message: "不能为空",
|
trigger: ["change", "blur"]
|
}
|
],
|
items: [
|
{
|
type: "array",
|
required: true,
|
message: "不能为空",
|
trigger: ["change", "blur"]
|
}
|
]
|
|
}
|
|
}
|
},
|
mounted() {
|
if(this.rowData.id) {
|
this.ruleForm = this.rowData;
|
this.xmId = this.rowData.id;
|
}
|
this.userId = localStorage.getItem('userId');
|
this.assign = localStorage.getItem('assign');
|
},
|
methods:{
|
Cancel() {
|
this.add_Step = 0;
|
this.nextStepName = "下一步";
|
this.$emit('closeNewProject');
|
},
|
|
UpwardStep() {
|
this.add_Step --;
|
if (this.add_Step == 0) {
|
this.nextStepName = "下一步";
|
}
|
else if (this.add_Step == 2) {
|
this.nextStepName = "保 存";
|
}
|
else {
|
this.nextStepName = "下一步";
|
}
|
},
|
|
NextStep() {
|
if (this.add_Step == 0) {
|
let is_null1 = false;
|
this.$refs['ruleForm'].validate((valid) => {
|
if (valid) {
|
is_null1 = true;
|
} else {
|
console.log('error submit!!');
|
return false;
|
}
|
});
|
if(is_null1) {
|
this.saveStep1();
|
this.loading_save = true;
|
}
|
|
// this.xmId = "c3b7f55c800e4726b53fdc18dd994603";
|
// this.add_Step = 1;
|
}
|
else if (this.add_Step == 1) {
|
this.saveStep2();
|
// this.add_Step = 2;
|
// this.nextStepName = "完 成";
|
}
|
else if (this.add_Step == 2) {
|
this.saveStep3();
|
}
|
},
|
|
saveStep1() {
|
let ruleForm_ = this.ruleForm;
|
var items1 = this.$moment(ruleForm_.items[0]).format('YYYY-MM-DD');
|
var items2 = this.$moment(ruleForm_.items[1]).format('YYYY-MM-DD');
|
//let items1 = new Date(ruleForm_.items[0]).Format("yyyy-MM-dd").toLocaleString();
|
// let items2 = new Date(ruleForm_.items[1]).Format("yyyy-MM-dd").toLocaleString();
|
|
let url = "/api/scheme/addOrUpdate";
|
this.$axios.get(url,{
|
params: {
|
reseachType: ruleForm_.objective,
|
name: ruleForm_.name,
|
startTime: items1,
|
endTime: items2,
|
id: this.xmId,
|
desp:ruleForm_.desp,
|
userId: this.userId
|
}
|
}).then(data_ => {
|
console.log(data_);
|
this.xmId = data_.data.data;
|
|
this.add_Step = 1;
|
}).catch(error =>{
|
console.log(error);
|
})
|
},
|
|
saveStep2() {
|
this.showData_ = this.$refs.substep_zj.showData;
|
this.form_objs = this.$refs.substep_zj.form_;
|
|
let form_array = [];
|
let is_null1 = true;
|
|
for (let itm_k in this.showData_) {
|
let ref_k = "ref_" + itm_k;
|
this.$refs.substep_zj.$refs[ref_k].validate((valid) => {
|
if (!valid) {
|
is_null1 = false;
|
}
|
});
|
|
let form_obj = {};
|
form_obj = this.form_objs[itm_k];
|
if (!form_obj.mustAttach) {
|
form_obj.mustAttach = false;
|
}
|
if (form_obj.startTime) {
|
form_obj.startTime = this.$moment(form_obj.startTime).format('YYYY-MM-DD');
|
// form_obj.startTime = new Date(form_obj.startTime).Format("yyyy-MM-dd").toLocaleString();
|
}
|
if (form_obj.endTime) {
|
form_obj.endTime = this.$moment(form_obj.endTime).format('YYYY-MM-DD');
|
// form_obj.endTime = new Date(form_obj.endTime).Format("yyyy-MM-dd").toLocaleString();
|
}
|
if (form_obj.userIds) {
|
let leng = form_obj.userIds.length;
|
|
form_obj.roleName = form_obj.userIds[leng-2];
|
form_obj.userId = form_obj.userIds[leng-1];
|
}
|
form_obj.type = itm_k;
|
form_obj.parentId = this.xmId;
|
|
|
form_array.push(form_obj);
|
}
|
|
if (is_null1) {
|
let datas = "?datas=" + encodeURI(JSON.stringify(form_array));
|
let url = "/api/detail/updates";
|
this.$axios.get(url + datas).then(data_ => {
|
console.log(data_);
|
|
this.add_Step = 2;
|
this.nextStepName = "完 成";
|
}).catch(error =>{
|
console.log(error);
|
})
|
}
|
},
|
saveStep3() {
|
let url = "/api/scheme/working/" + this.ruleForm.id;
|
this.$axios.get(url).then(data_ => {
|
if(data_.data.success) {
|
this.$message('项目启动成功');
|
this.Cancel();
|
}else {
|
|
this.$message({message:'项目启动失败', type: 'warning'});
|
}
|
}).catch(error =>{
|
console.log(error);
|
})
|
},
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style>
|
.class_dataImport .el-tabs__content{
|
position: inherit;
|
}
|
|
.class_dataImport .grid-content {
|
border-radius: 4px;
|
height: 60px;
|
min-height: 26px;
|
}
|
.class_dataImport .main-row .grid-content {
|
line-height: 60px;
|
}
|
|
.class_dataImport .z_grid-content2{
|
display:table-cell;
|
vertical-align:bottom;
|
color: #2c3e50;
|
height: 50px;
|
}
|
|
</style>
|