|
|
@@ -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;
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
// 选择商机确定
|