瀏覽代碼

产品选择节点新增两个接口

GouGengquan 1 年之前
父節點
當前提交
9f203903ba
共有 2 個文件被更改,包括 83 次插入10 次删除
  1. 8 0
      src/api/modules/assets.js
  2. 75 10
      src/views/assets/orderDetail.vue

+ 8 - 0
src/api/modules/assets.js

@@ -67,8 +67,16 @@ export default {
     assetsProductionSave(params) {
         return request.post(`assetsProduction/save`, params)
     },
+    // 选择产品,更新产品信息
+    assetsProductionUpdate(params) {
+        return request.put(`assetsProduction/update`, params)
+    },
     // 根据业务id获取产品信息类型集合
     getProductionTypes(params) {
         return request.get(`assetsProduction/getProductionTypes/${params}`)
+    },
+    // 根据业务id获取是否已选择产品
+    getProductionByBusinessId(params) {
+        return request.get(`assetsProduction/getProductionByBusinessId/${params}`)
     }
 }

+ 75 - 10
src/views/assets/orderDetail.vue

@@ -414,6 +414,21 @@
           </div>
         </div>
       </el-tab-pane>
+      <el-tab-pane name="production" class="pane-class" :lazy=true>
+        <span slot="label"><i class="el-icon-document"></i>产品信息</span>
+        <div class="createMajor-main-container">
+          <div class="postInfo-container">
+            <div style="margin-top: 35px;">
+              <el-divider content-position="left">
+                <h3 class="title">
+                  <div class="avatar-wrapper icon-title">产品</div>
+                  <div class="icon-info">资产产品信息</div>
+                </h3>
+              </el-divider>
+            </div>
+          </div>
+        </div>
+      </el-tab-pane>
       <el-tab-pane name="finance" class="pane-class" :lazy=true>
         <span slot="label" @click="getOrderFundInvoiceById()"><i class="el-icon-document"></i>款项信息</span>
         <div class="createMajor-main-container">
@@ -660,10 +675,10 @@
             <el-row class="row-style">
               <el-col :xs="24" :sm="12" :lg="12" :span="6" style="width: 800px;">
                 <el-form-item label="产品类型:" prop="productionType" label-width="120px" class="postInfo-container-item">
-                  <el-radio v-model="assetsProductionFrom.productionType" :label="1" border size="medium">价值意见书</el-radio>
-                  <el-radio v-model="assetsProductionFrom.productionType" :label="2" border size="medium">咨询报告</el-radio>
-                  <el-radio v-model="assetsProductionFrom.productionType" :label="3" border size="medium">评估报告</el-radio>
-                  <el-radio v-model="assetsProductionFrom.productionType" :label="4" border size="medium">意见函</el-radio>
+                  <el-radio v-model="assetsProductionFrom.productionType" :label="STATEMENT" border size="medium">价值意见书</el-radio>
+                  <el-radio v-model="assetsProductionFrom.productionType" :label="CONSULT" border size="medium">咨询报告</el-radio>
+                  <el-radio v-model="assetsProductionFrom.productionType" :label="REPORT" border size="medium">评估报告</el-radio>
+                  <el-radio v-model="assetsProductionFrom.productionType" :label="LETTER" border size="medium">意见函</el-radio>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -675,7 +690,8 @@
               </el-col>
             </el-row>
             <el-row class="row-style">
-              <el-button @click="assetsProductionSave" style="width:100%;">提交</el-button>
+              <el-button v-if="productionChoiceStatus == 0" @click="assetsProductionSave" style="width:100%;">提交</el-button>
+              <el-button v-if="productionChoiceStatus == 1" @click="assetsProductionUpdate" style="width:100%;">提交</el-button>
             </el-row>
           </div>
         </div>
@@ -1041,6 +1057,8 @@ export default {
       pNode: null,
       // 产品选择表单可视状态
       productionChoiceDialogVisible: false,
+      // 0:新增,1:更新
+      productionChoiceStatus: 0,
       // 产品表单
       assetsProductionFrom: {
         businessId: null,
@@ -1702,7 +1720,6 @@ export default {
       this.$api.assets.getProductionTypes(id).then(res => {
         if (res.code === 200) {
           this.nodeBusinessInfo.production = res.data;
-          console.log('1:', this.nodeBusinessInfo.production);
         }
       })
     },
@@ -1716,12 +1733,62 @@ export default {
     // 打开产品选择表单弹窗
     openProductionDialog() {
       this.productionChoiceDialogVisible = true;
+      this.getProductionByBusinessId(this.pageParams.row.id);
+    },
+    // 根据业务id获取是否已选择产品
+    getProductionByBusinessId(id){
+      this.$api.assets.getProductionByBusinessId(id).then(res => {
+        if (res.code === 200) {
+          this.assetsProductionFrom = res.data;
+          // 产品信息不为null,则证明已经选择过产品,将按钮改为修改
+          if(this.assetsProductionFrom !== null){
+            this.productionChoiceStatus = 1;
+          }
+        }
+      })
     },
     // 选择产品,新增产品信息
     assetsProductionSave() {
       this.$refs.assetsProductionFrom.validate(valid => {
         if (valid) {
           this.assetsProductionFrom.businessId = this.assetsForm.id;
+          // if (this.assetsProductionFrom.productionType == 1) {
+          //   // 价值意见书
+          //   this.assetsProductionFrom.productionType = 'STATEMENT';
+          // } else if (this.assetsProductionFrom.productionType == 4) {
+          //   // 意见函
+          //   this.assetsProductionFrom.productionType = 'LETTER';
+          // }else if (this.assetsProductionFrom.productionType == 2) {
+          //   // 咨询报告
+          //   this.assetsProductionFrom.productionType = 'CONSULT';
+          // } else {
+          //   // 评估报告
+          //   this.assetsProductionFrom.productionType = 'REPORT';
+          // }
+          this.assetsProductionFrom.filePath = JSON.stringify(this.assetsProductionFrom.filePath);
+          this.taskRecordDTO.recordId = this.currentNode.tasks[0].recordId;
+          this.taskRecordDTO.taskData = this.assetsProductionFrom;
+          this.$api.assets.assetsProductionSave(this.taskRecordDTO).then(res => {
+            if (res.code === 200) {
+              this.$notify({
+                title: '成功',
+                message: '选择产品成功!',
+                type: 'success',
+                duration: 2000
+              });
+              this.getProductionTypes(this.assetsForm.id);
+              this.productionChoiceDialogVisible = false;
+              this.$refs.assetsProductionFrom.resetFields();
+            }
+          })
+        }
+      })
+    },
+    // 选择产品,更新已选择产品信息
+    assetsProductionUpdate(){
+      this.$refs.assetsProductionFrom.validate(valid => {
+        if (valid) {
+          this.assetsProductionFrom.businessId = this.assetsForm.id;
           if (this.assetsProductionFrom.productionType == 1) {
             // 价值意见书
             this.assetsProductionFrom.productionType = 'STATEMENT';
@@ -1733,13 +1800,11 @@ export default {
             this.assetsProductionFrom.productionType = 'REPORT';
           }
           this.assetsProductionFrom.filePath = JSON.stringify(this.assetsProductionFrom.filePath);
-          this.taskRecordDTO.recordId = this.currentNode.tasks[0].recordId;
-          this.taskRecordDTO.taskData = this.assetsProductionFrom;
-          this.$api.assets.assetsProductionSave(this.taskRecordDTO).then(res => {
+          this.$api.assets.assetsProductionUpdate(this.assetsProductionFrom).then(res => {
             if (res.code === 200) {
               this.$notify({
                 title: '成功',
-                message: '添加资产业务评估对象成功!',
+                message: '选择产品成功!',
                 type: 'success',
                 duration: 2000
               });