123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <template>
- <div id="update">
- <el-row>
- <el-col :span="24" class="main">
- <el-col :span="24" class="top">
- <el-button type="primary" size="mini" @click="back">返回</el-button>
- </el-col>
- <el-col :span="24" class="down">
- <el-col :span="24" class="setp">
- <el-steps :active="active" align-center>
- <el-step title="(一)基本信息"> </el-step>
- <el-step title="(二)内容简介"> </el-step>
- <el-step title="(三)主研人员名单"></el-step>
- <el-step title="(四)评价委托方提供资料清单"></el-step>
- </el-steps>
- </el-col>
- <el-col :span="24" class="twoInfo">
- <basic :basicForm="form.basic" @resetBtn="back" @basicBtn="basicBtn" v-if="active == '1'"></basic>
- <brief :briefForm="form.brief" @briefUp="briefUp" @briefBtn="briefBtn" v-else-if="active == '2'"></brief>
- <research :researchForm="form.research" @researchUp="researchUp" @researchBtn="researchBtn" v-else-if="active == '3'"></research>
- <datalists :datalistForm="form.datalist" @detailedUp="detailedUp" @onSubmit="onSubmit" v-else-if="active == '4'"></datalists>
- </el-col>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import basic from './updateParts/basic.vue';
- import brief from './updateParts/brief.vue';
- import research from './updateParts/research.vue';
- import datalists from './updateParts/datalists.vue';
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: achieveApply } = createNamespacedHelpers('achieveApply');
- export default {
- name: 'update',
- props: {},
- components: {
- basic,
- brief,
- research,
- datalists,
- },
- data: function() {
- return {
- // 步骤
- active: 3,
- form: {
- basic: {},
- brief: {},
- research: [],
- datalist: {},
- },
- };
- },
- async created() {
- console.log(this.user);
- await this.search();
- },
- methods: {
- ...achieveApply(['fetch', 'update', 'create']),
- async search() {
- if (this.id) {
- let res = await this.fetch(this.id);
- if (this.$checkRes(res)) {
- this.$set(this, `form`, res.data);
- }
- }
- },
- //基本信息下一步
- basicBtn() {
- this.active = 2;
- },
- // 内容简介上一步
- briefUp() {
- this.active = 1;
- },
- // 内容简介下一步
- briefBtn() {
- this.active = 3;
- },
- // 研发人员名单上一步
- researchUp() {
- this.active = 2;
- },
- // 研发人员名单下一步
- researchBtn({ data }) {
- this.$set(this.form, `research`, data);
- this.active = 4;
- },
- // 补充材料上一步
- detailedUp() {
- this.active = 3;
- },
- async onSubmit() {
- let data = this.form;
- data.status = this.status;
- if (data.id) {
- let res = await this.update(data);
- if (this.$checkRes(res)) {
- this.$message({
- message: '修改信息完成,等待审核',
- type: 'success',
- });
- this.back();
- }
- } else {
- data.user_id = this.user.id;
- let res = await this.create(data);
- if (this.$checkRes(res)) {
- this.$message({
- message: '申报完成,等待审核',
- type: 'success',
- });
- this.back();
- }
- }
- },
- // 返回
- back() {
- window.history.back();
- },
- },
- computed: {
- ...mapState(['user']),
- id() {
- return this.$route.query.id;
- },
- status() {
- return this.$route.query.status;
- },
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- watch: {
- test: {
- deep: true,
- immediate: true,
- handler(val) {},
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .main {
- .top {
- text-align: right;
- margin: 0 0 10px 0;
- }
- }
- </style>
|