Browse Source

项目新增后其他步骤默认回显项目

ljb 10 months ago
parent
commit
c80dafa83b

+ 4 - 0
src/views/project-manage/components/apply-form.vue

@@ -444,6 +444,10 @@ export default {
       func(params).then(({ data }) => {
         this.loading = false;
         if (data.code == 200) {
+          if (!params.id) {
+            this.$emit('success', data.data);
+            this.formData.id = data.data.xmId;
+          }
           this.$message.success(params.id ? '修改成功!' : '保存成功!');
         }
       }).catch(err => {

+ 4 - 1
src/views/project-manage/project-list.vue

@@ -55,7 +55,7 @@
     >
       <el-tabs type="border-card">
         <el-tab-pane label="1、项目立项" lazy>
-          <apply-form :projectId="currProjectId"></apply-form>
+          <apply-form :projectId="currProjectId" @success="handleApplySuccess"></apply-form>
         </el-tab-pane>
         <el-tab-pane label="2、科研预算" lazy>
           <project-budget :projectId="currProjectId"></project-budget>
@@ -127,6 +127,9 @@ export default window.$crudCommon({
       this.currProjectId = data.id;
       this.drawerVisible = true;
     },
+    handleApplySuccess({ xmId }) {
+      this.currProjectId = xmId;
+    },
     handleExport() {
       exportBloByPost(`/api/kd-scientific/technician/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
         downloadXls(res.data, `科研项目汇总表${this.params.yearAndMonth}.xlsx`);