Explorar o código

修改报价配置复选框问题

wuguojie hai 1 ano
pai
achega
60e8c2a6ba
Modificáronse 1 ficheiros con 26 adicións e 12 borrados
  1. 26 12
      src/views/PeopleManage/Agent/QuoteCountManagement.vue

+ 26 - 12
src/views/PeopleManage/Agent/QuoteCountManagement.vue

@@ -54,7 +54,7 @@
             </el-table>
           </el-form-item>
           <el-form-item prop="quoteLimit" label="报价限制">
-            <el-checkbox-group v-model="quoteForm.quoteLimit">
+            <el-checkbox-group v-model="quoteForm.quoteLimit" @change="checkChange">
               <div>
                 <el-checkbox label="1" :disabled="!isEdit">
                   <div style="display: flex; align-items: center">
@@ -188,11 +188,11 @@ export default {
         quoteLimit: []
       }, // 报价form
       quoteRules: {
-        // isEnabled: [
-        //   {
-        //     required: true, message: '', trigger: 'change'
-        //   }
-        // ],
+        isEnabled: [
+          {
+            required: true, message: '', trigger: 'change'
+          }
+        ],
         authorize: [
           {
             required: true, message: '请选择代理人限制', trigger: 'change'
@@ -220,6 +220,17 @@ export default {
     }
   },
   methods: {
+    checkChange() {
+      if(!this.quoteForm.quoteLimit.includes('1')) {
+        this.$set(this.quoteForm, 'orderRadio', '')
+      }
+      if(!this.quoteForm.quoteLimit.includes('2')) {
+        this.$set(this.quoteForm, 'dayMaxQuoteNum', '')
+      }
+      if(!this.quoteForm.quoteLimit.includes('3')) {
+        this.$set(this.quoteForm, 'carMaxQuoteNum', '')
+      }
+    },
     // 获取保险公司
     initCompany() {
       this.$api.quote.getCompany().then(res => {
@@ -360,16 +371,17 @@ export default {
         if(res.code === 200) {
           this.quoteForm = {...res.data}
           this.quoteForm.isEnabled = res.data.isEnabled?true:false
-          this.quoteForm.quoteLimit = []
+          let list = []
           if(res.data.orderRatio){
-            this.quoteForm.quoteLimit.push('1')
+            list.push('1')
           }
           if(res.data.dayMaxQuoteNum){
-            this.quoteForm.quoteLimit.push('2')
+            list.push('2')
           }
           if(res.data.carMaxQuoteNum){
-            this.quoteForm.quoteLimit.push('3')
+            list.push('3')
           }
+          this.$set(this.quoteForm, 'quoteLimit', list)
           this.selectedList = res.data.proxyList
           this.selectList = [...res.data.proxyList]
           this.myList = [...res.data.proxyList]
@@ -461,8 +473,10 @@ export default {
     },
     // 监听浏览器刷新
     handleBeforeUnload(event) {
-      event.preventDefault();
-      event.returnValue = '';
+      if(this.isEdit) {
+        event.preventDefault();
+        event.returnValue = '';
+      }
     },
     // 删除选择的代理人
     handleDelete(row) {