Просмотр исходного кода

增加外呼意向度填写弹窗

zyy 14 часов назад
Родитель
Сommit
c5505cda69
1 измененных файлов с 77 добавлено и 15 удалено
  1. 77 15
      src/views/aiSipCall/aiSipCallManualOutbound.vue

+ 77 - 15
src/views/aiSipCall/aiSipCallManualOutbound.vue

@@ -447,25 +447,39 @@
                         <el-input v-model="customerForm.communicationHistory" type="textarea" :rows="4" placeholder="历史沟通记录" disabled style="background-color: #f5f7fa;" />
                     </el-form-item>
 
-                    <el-row :gutter="20">
-                        <el-col :span="12">
-                            <el-form-item label="意向度">
-                                <el-select v-model="intent" placeholder="请选择用户意向" style="width: 100%;">
-                                    <el-option label="A" value="A" />
-                                    <el-option label="B" value="B" />
-                                    <el-option label="C" value="C" />
-                                </el-select>
-                            </el-form-item>
-                        </el-col>
-                    </el-row>
 
                     <el-form-item>
                         <el-button type="primary" @click="saveCustomerForm">保存</el-button>
                         <el-button @click="closeCustomerForm">关闭</el-button>
                     </el-form-item>
+
                 </el-form>
             </div>
         </div>
+
+        <el-dialog
+            title="填写客户意向度"
+            :visible.sync="intentDialogVisible"
+            width="420px"
+            append-to-body
+            :close-on-click-modal="false"
+            :close-on-press-escape="false"
+            :show-close="false"
+        >
+            <el-form :model="intentForm" label-width="80px" size="small">
+                <el-form-item label="意向度">
+                    <el-select v-model="intentForm.intent" placeholder="请选择意向度" style="width: 100%;">
+                        <el-option label="A" value="A" />
+                        <el-option label="B" value="B" />
+                        <el-option label="C" value="C" />
+                    </el-select>
+                </el-form-item>
+            </el-form>
+
+            <div slot="footer" class="dialog-footer">
+                <el-button type="primary" @click="confirmIntentAndSync">确认</el-button>
+            </div>
+        </el-dialog>
     </div>
 </template>
 
@@ -608,9 +622,14 @@ export default {
                 province: '',
                 city: '',
                 county: '',
-                communicationHistory: '',
+                communicationHistory: ''
+            },
+            // 意向度弹窗
+            intentDialogVisible: false,
+            intentForm: {
                 intent: ''
             },
+            pendingSyncInfo: null,
             currentCallUuid: '', // 当前通话的 uuid
             callFinishedAt: '', // 通话结束时间
             callExecuted: false, // 是否已执行成功(只要外呼开始/振铃就算)
@@ -904,7 +923,7 @@ export default {
                 this.updatePhoneBar(msg, EventList.CALLER_HANGUP);
 
                 if (this.callExecuted && !this.callExecuteFailed) {
-                    this.scheduleSuccessSync('CALLER_HANGUP', msg);
+                    this.openIntentDialog('CALLER_HANGUP', msg);
                 }
             });
 
@@ -927,7 +946,7 @@ export default {
                 this.updatePhoneBar(msg, EventList.CALLEE_HANGUP);
 
                 if (this.callExecuted && !this.callExecuteFailed) {
-                    this.scheduleSuccessSync('CALLEE_HANGUP', msg);
+                    this.openIntentDialog('CALLEE_HANGUP', msg);
                 }
             });
 
@@ -1366,7 +1385,7 @@ export default {
                     uuid: this.currentCallUuid,
                     callType: '03',
                     status: status,
-                    intent: this.customerForm.intent,
+                    intent: this.intentForm.intent,
                     companyId: this.companyId,
                     companyUserId: this.companyUserId,
                     workflowInstanceId: this.workflowInstanceId,
@@ -1411,6 +1430,49 @@ export default {
             }, 10000);
         },
 
+        openIntentDialog(source, msg) {
+            if (this.callResultRecorded) {
+                return;
+            }
+
+            if (this.recordTimer) {
+                clearTimeout(this.recordTimer);
+                this.recordTimer = null;
+            }
+
+            const uuid = (msg && msg.object && msg.object.uuid) ? msg.object.uuid : this.currentCallUuid;
+            if (uuid) {
+                this.currentCallUuid = uuid;
+            }
+
+            this.pendingSyncInfo = {
+                source,
+                msg
+            };
+            this.intentForm.intent = '';
+            this.intentDialogVisible = true;
+        },
+
+        confirmIntentAndSync() {
+            if (!this.intentForm.intent) {
+                this.$message.warning('请选择意向度');
+                return;
+            }
+
+            this.intentDialogVisible = false;
+
+            if (!this.pendingSyncInfo) {
+                this.$message.error('未找到待提交的通话信息');
+                return;
+            }
+
+            const { source, msg } = this.pendingSyncInfo;
+            this.pendingSyncInfo = null;
+
+            this.triggerSyncByUuid(2, source, msg, 0, '');
+            this.intentForm.intent = '';
+        },
+
         /**
          * 置闲处理
          */