Explorar o código

# fix 修改不产鱼原因

jc-wangyt hai 1 mes
pai
achega
9fad21b82f

+ 3 - 3
src/api/newApi/bizoppmanage.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 // 项目商机列表
 export function getOpportunityList(data) {
   return request({
-    url: '/stage-api/opportunity/list',
+    url: '/opportunity/list',
     method: 'get',
     params: data
   })
@@ -11,7 +11,7 @@ export function getOpportunityList(data) {
 // 项目商机详情
 export function getOpportunityDetail(noticeId) {
   return request({
-    url: `/stage-api/opportunity/${noticeId}`,
+    url: `/opportunity/${noticeId}`,
     method: 'get'
   })
 }
@@ -19,7 +19,7 @@ export function getOpportunityDetail(noticeId) {
 // 更新项目商机
 export function updateOpportunity(data) {
   return request({
-    url: '/stage-api/opportunity/update',
+    url: '/freemarket/update',
     method: 'post',
     data
   })

+ 3 - 3
src/api/newApi/openMarketBid.js

@@ -1,9 +1,9 @@
 import request from '@/utils/request'
 
-// 自由市场商机列表
+// 自由市场商机列表  /stage-api
 export function getFreeMarketList(data) {
   return request({
-    url: '/stage-api/freemarket/list',
+    url: '/freemarket/list',
     method: 'get',
     params: data
   })
@@ -12,7 +12,7 @@ export function getFreeMarketList(data) {
  // 自由市场商机详情
  export function getFreeMarketDetail(noticeId) {
    return request({
-     url: `/stage-api/freemarket/${noticeId}`,
+     url: `/freemarket/${noticeId}`,
      method: 'get'
    })
  }

+ 27 - 15
src/views/openMarketBid/edit.vue

@@ -4,7 +4,8 @@
             <!-- 公告信息 -->
             <div class="detail-section">
                 <h3 class="section-title">公告信息</h3>
-                <el-form :model="formData" label-width="130px" size="small" class="detail-form">
+                <el-form :model="formData" :rules="rules" ref="formRef" label-width="130px" size="small"
+                    class="detail-form">
                     <el-row :gutter="20">
                         <el-col :span="12">
                             <el-form-item label="公告标题">
@@ -237,7 +238,7 @@
                     </el-row>
                     <el-row :gutter="20">
                         <el-col :span="12">
-                            <el-form-item label="是否参与">
+                            <el-form-item label="是否参与" prop="isParticipate">
                                 <el-select v-model="formData.isParticipate" placeholder="请选择是否参与" style="width: 100%">
                                     <el-option v-for="option in isParticipateOptions" :key="option.value"
                                         :label="option.label" :value="option.value"></el-option>
@@ -246,7 +247,7 @@
                         </el-col>
 
                         <el-col :span="12" v-if="formData.isParticipate == 0">
-                            <el-form-item label="不参与原因">
+                            <el-form-item label="不参与原因" prop="notParticipateReason">
                                 <el-cascader v-model="formData.notParticipateReason"
                                     :options="notParticipateReasonOptions" placeholder="请选择不参与原因"
                                     style="width: 100%"></el-cascader>
@@ -317,6 +318,8 @@ export default {
     data() {
         return {
             selected: {},
+            // 表单验证规则
+            rules: {},
             // 是否参与下拉选项
             isParticipateOptions: [
                 { value: 1, label: '是' },
@@ -403,18 +406,27 @@ export default {
             console.log(row)
         },
         handleSave() {
-            updateOpportunity({
-                opportunityId: this.selected.id,
-                id: this.formData.fmId,
-                isParticipate: this.formData.isParticipate,
-                notParticipateReason: this.formData.notParticipateReason.join(','),
-
-            }).then(response => {
-                this.$message.success('更新成功');
-                this.$emit('update:dialogVisible', false);
-            }).catch(error => {
-                console.error('更新商机失败:', error);
-                this.$message.error('更新失败');
+            this.$refs.formRef.validate((valid) => {
+                if (valid) {
+                    if (this.formData.isParticipate === 1) {
+                        this.formData.notParticipateReason = [];
+                    }
+                    updateOpportunity({
+                        opportunityId: this.selected.id,
+                        id: this.formData.fmId,
+                        isParticipate: this.formData.isParticipate,
+                        notParticipateReason: Array.isArray(this.formData?.notParticipateReason) ? this.formData.notParticipateReason.join(',') : ''
+                    }).then(response => {
+                        this.$message.success('更新成功');
+                        this.$emit('update:dialogVisible', false);
+                    }).catch(error => {
+                        console.error('更新商机失败:', error);
+                        this.$message.error('更新失败');
+                    });
+                } else {
+                    // 验证失败,保留错误提示
+                    return false;
+                }
             });
         },
         // 选择商机确定