Visit-detail.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. <template>
  2. <el-dialog
  3. v-model="state.dialogVisible"
  4. draggable
  5. :title="dialogTitle"
  6. ref="dialogRef"
  7. append-to-body
  8. @mouseup="mouseup"
  9. :style="'transform: ' + state.transform + ';'"
  10. @close="close"
  11. destroy-on-close
  12. >
  13. <el-collapse v-model="state.collapseArr" class="collapse-box" v-loading="state.loading">
  14. <!-- 工单信息 -->
  15. <el-collapse-item name="1">
  16. <template #title>
  17. <p class="pl20">
  18. <b class="font14">工单信息</b>
  19. </p>
  20. </template>
  21. <div class="collapse-container">
  22. <el-form label-width="100px" class="show-info-form">
  23. <el-row :gutter="10">
  24. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  25. <el-form-item label="工单编码" class="mb5"> {{ state.orderDetail.no }} </el-form-item>
  26. </el-col>
  27. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  28. <el-form-item label="受理时间" class="mb5">
  29. <span>{{ dayjs(state.orderDetail.startTime).format('YYYY-MM-DD HH:mm:ss') }}</span></el-form-item
  30. >
  31. </el-col>
  32. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  33. <el-form-item label="受理人" class="mb5">
  34. <span>{{ state.orderDetail?.acceptorName }}</span>
  35. </el-form-item>
  36. </el-col>
  37. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  38. <el-form-item label="来源渠道" class="mb5"> {{ state.orderDetail.sourceChannel }} </el-form-item>
  39. </el-col>
  40. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  41. <el-form-item label="受理类型" class="mb5"> {{ state.orderDetail.acceptType }} </el-form-item>
  42. </el-col>
  43. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  44. <el-form-item label="热点分类" class="mb5"> {{ state.orderDetail.hotspotName }} </el-form-item>
  45. </el-col>
  46. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  47. <el-form-item label="工单标题" class="mb5"> {{ state.orderDetail.title }} </el-form-item>
  48. </el-col>
  49. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  50. <el-form-item label="工单内容" class="formatted-text mb5"> {{ state.orderDetail.content }} </el-form-item>
  51. </el-col>
  52. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  53. <el-form-item label="办理结果" class="formatted-text mb5"> {{ state.orderDetail.fileOpinion }} </el-form-item>
  54. </el-col>
  55. </el-row>
  56. </el-form>
  57. </div>
  58. </el-collapse-item>
  59. <el-collapse-item name="2">
  60. <template #title>
  61. <p class="pl20">
  62. <b class="font14">来电人信息</b>
  63. </p>
  64. </template>
  65. <div class="collapse-container">
  66. <el-form label-width="100px" class="show-info-form">
  67. <el-row :gutter="10">
  68. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  69. <el-form-item label="来电人姓名"> {{ state.orderDetail.fromName }} </el-form-item>
  70. </el-col>
  71. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" v-if="state.orderDetail.fromPhone">
  72. <el-form-item label="来电号码" class="mb5">
  73. {{ state.orderDetail.fromPhone }}
  74. <el-button plain title="人工回访录音" size="small" type="primary" class="ml8" @click="recordFile" v-if="state.recordingAbsolutePath"
  75. >人工回访录音</el-button
  76. >
  77. </el-form-item>
  78. </el-col>
  79. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  80. <el-form-item label="来电人性别" class="mb5"> {{ state.orderDetail.fromGenderText }} </el-form-item>
  81. </el-col>
  82. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  83. <el-form-item label="联系电话">
  84. {{ state.orderDetail.contact }}
  85. <el-button plain title="呼叫" size="small" type="primary" class="ml8" @click="onCall(state.orderDetail.contact)" v-if="!disabled"
  86. >外呼</el-button
  87. >
  88. </el-form-item>
  89. </el-col>
  90. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  91. <el-form-item label="联系地址"> {{ state.orderDetail.address }} </el-form-item>
  92. </el-col>
  93. </el-row>
  94. </el-form>
  95. </div>
  96. </el-collapse-item>
  97. <el-collapse-item name="3">
  98. <template #title>
  99. <p class="pl20">
  100. <b class="font14">回访信息</b>
  101. </p>
  102. </template>
  103. <div class="collapse-container">
  104. <el-form label-width="120px" ref="ruleFormRef" :model="state.ruleForm" label-position="left">
  105. <!-- 详情 -->
  106. <template v-if="disabled">
  107. <el-row :gutter="10" class="show-info-form">
  108. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  109. <el-form-item label="当前回访人">
  110. {{ state.orderVisitModel.employeeName }}
  111. <el-button plain title="智能回访录音" size="small" type="primary" class="ml8" @click="onSmartRecord" v-if="state.smartRecord"
  112. >智能回访录音
  113. </el-button>
  114. <el-button
  115. plain
  116. title="人工回访录音"
  117. size="small"
  118. type="primary"
  119. class="ml8"
  120. @click="recordFile"
  121. v-if="state.recordingAbsolutePath"
  122. >人工回访录音</el-button
  123. >
  124. </el-form-item>
  125. </el-col>
  126. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" v-if="visitCount">
  127. <el-form-item label="当前工单已回访次数" label-width="140px"> {{ visitCount }}次 </el-form-item>
  128. </el-col>
  129. <!-- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  130. <el-form-item label="回访标签">
  131. <span v-if="state.ruleForm.isPutThrough !== null">{{ state.ruleForm.isPutThrough ? '已接通' : '未接通' }}</span>
  132. </el-form-item>
  133. </el-col>-->
  134. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="['ZiGong'].includes(themeConfig.appScope)">
  135. <el-form-item label="语音评价"> </el-form-item>
  136. </el-col>
  137. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  138. <el-row v-for="item in state.ruleForm.visitDetails" :key="item.id" :gutter="10">
  139. <!-- 务员评价 -->
  140. <template v-if="item.visitTarget === 10 && isTelSource">
  141. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  142. <el-form-item label="话务员评价">
  143. {{ item.seatEvaluateText }}
  144. </el-form-item>
  145. </el-col>
  146. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  147. <el-form-item label="话务员回访内容">
  148. {{ item.visitContent }}
  149. </el-form-item>
  150. </el-col>
  151. </template>
  152. <!-- 部门评价 -->
  153. <template v-if="item.visitTarget === 20">
  154. <el-divider content-position="left">
  155. <el-text tag="b" size="large" type="primary"> {{ item.visitOrgName }} </el-text>
  156. </el-divider>
  157. <template v-if="['YiBin'].includes(themeConfig.appScope)">
  158. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  159. <el-form-item label="部门是否联系">
  160. {{ item.isContact === null ? '' : item.isContact === true ? '是' : '否' }}
  161. </el-form-item>
  162. </el-col>
  163. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  164. <el-form-item label="处理结果">
  165. {{ item.volved === null ? '' : item.volved === true ? '已得到解决' : '未得到解决' }}
  166. </el-form-item>
  167. </el-col>
  168. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="item.volveConent">
  169. <el-form-item label="备注" class="formatted-text mb5">
  170. {{ item.volveConent }}
  171. </el-form-item>
  172. </el-col>
  173. </template>
  174. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  175. <el-form-item label="部门办件结果">
  176. {{ item.orgProcessingResults?.dicDataName }}
  177. </el-form-item>
  178. </el-col>
  179. <!-- 不满意才会选择不满意原因 -->
  180. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="item.orgNoSatisfiedReason && item.orgNoSatisfiedReason.length">
  181. <el-form-item label="不满意原因">
  182. {{ item.orgNoSatisfiedReason.map((item) => item.dicDataName).join(',') }}
  183. </el-form-item>
  184. </el-col>
  185. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="['ZiGong'].includes(themeConfig.appScope)">
  186. <el-form-item label="部门办件态度">
  187. {{ item.orgHandledAttitude?.dicDataName }}
  188. </el-form-item>
  189. </el-col>
  190. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  191. <el-form-item label="部门回访内容">
  192. {{ item.visitContent }}
  193. </el-form-item>
  194. </el-col>
  195. </template>
  196. </el-row>
  197. </el-col>
  198. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="state.orderVisitModel.orgJudge || state.orderVisitModel.seatJudge">
  199. <el-form-item label="扭转满意度">
  200. <el-tag v-if="state.orderVisitModel.orgJudge" class="mr10">扭转部门满意度</el-tag>
  201. <el-tag v-if="state.orderVisitModel.seatJudge">扭转坐席满意度</el-tag>
  202. </el-form-item>
  203. </el-col>
  204. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="state.orderVisitModel.judgeStateText">
  205. <el-form-item label="评判结果">
  206. <span>{{ state.orderVisitModel.judgeStateText }}</span>
  207. </el-form-item>
  208. </el-col>
  209. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="state.orderVisitModel.judgeContent">
  210. <el-form-item label="评判内容" class="formatted-text mb5">
  211. <span>{{ state.orderVisitModel.judgeContent }}</span>
  212. </el-form-item>
  213. </el-col>
  214. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="['ZiGong'].includes(themeConfig.appScope)">
  215. <el-form-item label="历史回访记录" class="w100">
  216. <div class="w100">
  217. <ProTable
  218. ref="proTableRef"
  219. :columns="columns"
  220. :data="state.histories"
  221. @updateTable="queryList"
  222. :loading="state.loading"
  223. :pagination="false"
  224. border
  225. :toolButton="false"
  226. class="w100"
  227. >
  228. <template #empty> 暂无数据 </template>
  229. </ProTable>
  230. </div>
  231. </el-form-item>
  232. </el-col>
  233. </el-row>
  234. </template>
  235. <!-- 编辑 -->
  236. <template v-else>
  237. <el-row :gutter="10">
  238. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  239. <el-form-item label="当前回访人">
  240. {{ userInfos.name }}
  241. <el-button plain title="智能回访录音" size="small" type="primary" class="ml8" @click="onSmartRecord" v-if="state.smartRecord"
  242. >智能回访录音
  243. </el-button>
  244. <el-button
  245. plain
  246. title="人工回访录音"
  247. size="small"
  248. type="primary"
  249. class="ml8"
  250. @click="recordFile"
  251. v-if="state.recordingAbsolutePath"
  252. >人工回访录音</el-button
  253. >
  254. </el-form-item>
  255. </el-col>
  256. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  257. <el-form-item label="当前工单已回访次数" label-width="140px"> {{ visitCount }}次 </el-form-item>
  258. </el-col>
  259. <!-- <el-col :span="24">
  260. <el-form-item label="回访标签" prop="isPutThrough" :rules="[{ required: false, message: '请选择回访标签', trigger: 'change' }]">
  261. <el-checkbox v-model="state.ruleForm.isPutThrough">未接通</el-checkbox>
  262. </el-form-item>
  263. </el-col>-->
  264. <el-col :span="24">
  265. <el-row v-for="(item, index) in state.ruleForm.visitDetails" :key="item.id" :gutter="10">
  266. <!-- 务员评价 -->
  267. <template v-if="item.visitTarget === 10 && isTelSource">
  268. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="['ZiGong'].includes(themeConfig.appScope)">
  269. <el-form-item
  270. label="语音评价"
  271. :prop="`visitDetails.${index}.voiceEvaluate`"
  272. :rules="[{ required: true, message: '请选择语音评价', trigger: 'change' }]"
  273. >
  274. <el-radio-group v-model="item.voiceEvaluate" disabled>
  275. <el-radio v-for="items in viceEvaluate" :key="items.key" :label="items.value" :value="items.key">{{
  276. items.value
  277. }}</el-radio>
  278. </el-radio-group>
  279. </el-form-item>
  280. </el-col>
  281. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  282. <el-form-item
  283. label="话务员评价"
  284. :prop="`visitDetails.${index}.seatEvaluate`"
  285. :rules="[{ required: true, message: '请选择话务员评价', trigger: 'change' }]"
  286. >
  287. <el-radio-group v-model="item.seatEvaluate">
  288. <el-radio v-for="items in seatEvaluate" :key="items.key" :label="items.value" :value="items.key">{{
  289. items.value
  290. }}</el-radio>
  291. </el-radio-group>
  292. </el-form-item>
  293. </el-col>
  294. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  295. <el-form-item
  296. label="话务员回访内容"
  297. :prop="`visitDetails.${index}.visitContent`"
  298. :rules="[{ required: true, message: '请填写话务员回访内容', trigger: 'blur' }]"
  299. >
  300. <common-advice
  301. @chooseAdvice="chooseAdvice($event, index)"
  302. v-model="item.visitContent"
  303. placeholder="请填写话务员回访内容"
  304. :loading="state.loading"
  305. :commonEnum="commonEnum.ReturnVisit"
  306. :minRows="5"
  307. :maxRows="10"
  308. drawerWidth="40%"
  309. />
  310. </el-form-item>
  311. </el-col>
  312. </template>
  313. <!-- 部门评价 -->
  314. <template v-if="item.visitTarget === 20">
  315. <el-divider content-position="left">
  316. <el-text tag="b" size="large"> {{ item.visitOrgName }} </el-text>
  317. </el-divider>
  318. <template v-if="['YiBin'].includes(themeConfig.appScope)">
  319. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  320. <el-form-item
  321. label="部门是否联系"
  322. :prop="`visitDetails.${index}.isContact`"
  323. :rules="[{ required: true, message: '请选择部门是否联系', trigger: 'change' }]"
  324. >
  325. <el-radio-group v-model="item.isContact">
  326. <el-radio :value="true">是</el-radio>
  327. <el-radio :value="false">否</el-radio>
  328. </el-radio-group>
  329. </el-form-item>
  330. </el-col>
  331. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  332. <el-form-item
  333. label="处理结果"
  334. :prop="`visitDetails.${index}.volved`"
  335. :rules="[{ required: true, message: '请选择处理结果', trigger: 'change' }]"
  336. >
  337. <el-radio-group v-model="item.volved">
  338. <el-radio :value="true">已得到解决</el-radio>
  339. <el-radio :value="false">未得到解决</el-radio>
  340. </el-radio-group>
  341. </el-form-item>
  342. </el-col>
  343. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="item.volved === false">
  344. <el-form-item
  345. label=""
  346. :prop="`visitDetails.${index}.volveConent`"
  347. :rules="[{ required: false, message: '请填写备注', trigger: 'blur' }]"
  348. >
  349. <common-advice
  350. @chooseAdvice="chooseAdvice($event, index)"
  351. v-model="item.volveConent"
  352. placeholder="请填写备注"
  353. :loading="state.loading"
  354. :commonEnum="commonEnum.ReturnVisit"
  355. :minRows="5"
  356. :maxRows="10"
  357. drawerWidth="40%"
  358. />
  359. </el-form-item>
  360. </el-col>
  361. </template>
  362. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  363. <el-form-item
  364. label="部门办件结果"
  365. :prop="`visitDetails.${index}.orgProcessingResults`"
  366. :rules="[{ required: true, message: '请选择部门办件结果', trigger: 'change' }]"
  367. >
  368. <el-select
  369. v-model="item.orgProcessingResults"
  370. placeholder="请选择部门办件结果"
  371. class="w100"
  372. value-key="dicDataValue"
  373. @change="
  374. (val) => {
  375. item.orgProcessingResults.value = val?.dicDataName;
  376. item.orgProcessingResults.key = val?.dicDataValue;
  377. }
  378. "
  379. >
  380. <el-option v-for="items in visitSatisfaction" :key="items.dicDataValue" :label="items.dicDataName" :value="items" />
  381. </el-select>
  382. </el-form-item>
  383. </el-col>
  384. <!-- 不满意才会选择不满意原因 -->
  385. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="['1', '2'].includes(item.orgProcessingResults?.key)">
  386. <el-form-item
  387. label="不满意原因"
  388. :prop="`visitDetails.${index}.orgNoSatisfiedReason`"
  389. :rules="[{ required: true, message: '请选择不满意原因', trigger: 'change' }]"
  390. >
  391. <el-select
  392. v-model="item.orgNoSatisfiedReason"
  393. placeholder="请选择不满意原因"
  394. class="w100"
  395. value-key="dicDataValue"
  396. multiple
  397. collapse-tags
  398. collapse-tags-tooltip
  399. @change="selectReason($event, index)"
  400. >
  401. <el-option v-for="items in dissatisfiedReason" :key="items.dicDataValue" :label="items.dicDataName" :value="items" />
  402. </el-select>
  403. </el-form-item>
  404. </el-col>
  405. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="['ZiGong'].includes(themeConfig.appScope)">
  406. <el-form-item
  407. label="部门办件态度"
  408. :prop="`visitDetails.${index}.orgHandledAttitude`"
  409. :rules="[{ required: true, message: '请选择部门办件态度', trigger: 'change' }]"
  410. >
  411. <el-select
  412. v-model="item.orgHandledAttitude"
  413. placeholder="请选择部门办件态度"
  414. class="w100"
  415. value-key="dicDataValue"
  416. @change="
  417. (val) => {
  418. item.orgHandledAttitude.value = val.dicDataName;
  419. item.orgHandledAttitude.key = val.dicDataValue;
  420. }
  421. "
  422. >
  423. <el-option v-for="items in visitManner" :key="items.dicDataValue" :label="items.dicDataName" :value="items" />
  424. </el-select>
  425. </el-form-item>
  426. </el-col>
  427. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  428. <el-form-item
  429. label="部门回访内容"
  430. :prop="`visitDetails.${index}.visitContent`"
  431. :rules="[{ required: true, message: '请填写部门回访内容', trigger: 'blur' }]"
  432. >
  433. <common-advice
  434. @chooseAdvice="chooseAdvice($event, index)"
  435. v-model="item.visitContent"
  436. d
  437. placeholder="请填写部门回访内容"
  438. :loading="state.loading"
  439. :commonEnum="commonEnum.ReturnVisit"
  440. :minRows="5"
  441. :maxRows="10"
  442. drawerWidth="40%"
  443. />
  444. </el-form-item>
  445. </el-col>
  446. </template>
  447. </el-row>
  448. </el-col>
  449. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  450. <el-form-item label="扭转满意度" prop="orgJudge" :rules="[{ required: false, message: '请选择扭转满意度', trigger: 'change' }]">
  451. <el-checkbox v-model="state.ruleForm.orgJudge">扭转部门满意度</el-checkbox>
  452. <el-checkbox v-model="state.ruleForm.seatJudge">扭转坐席满意度</el-checkbox>
  453. </el-form-item>
  454. </el-col>
  455. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="['ZiGong'].includes(themeConfig.appScope)">
  456. <el-form-item label="历史回访记录">
  457. <div class="w100">
  458. <ProTable
  459. ref="proTableRef"
  460. :columns="columns"
  461. :data="state.histories"
  462. @updateTable="queryList"
  463. :loading="state.loading"
  464. :pagination="false"
  465. border
  466. :toolButton="false"
  467. class="w100"
  468. >
  469. <template #empty> 暂无数据 </template>
  470. </ProTable>
  471. </div>
  472. </el-form-item>
  473. </el-col>
  474. </el-row>
  475. </template>
  476. </el-form>
  477. </div>
  478. </el-collapse-item>
  479. </el-collapse>
  480. <template #footer v-if="disabled">
  481. <span class="dialog-footer">
  482. <el-button @click="closeDialog" class="default-button">关 闭</el-button>
  483. </span>
  484. </template>
  485. <template #footer v-else>
  486. <span class="dialog-footer">
  487. <el-button @click="closeDialog" class="default-button">取 消</el-button>
  488. <el-button type="primary" @click="onRedo" :loading="state.loading" v-auth="'business:visit:redo'" v-if="['ZiGong'].includes(themeConfig.appScope)">重办</el-button>
  489. <el-button type="primary" @click="onSubmit(ruleFormRef)" :loading="state.loading">保存</el-button>
  490. </span>
  491. </template>
  492. </el-dialog>
  493. <!-- 播放录音 -->
  494. <play-record ref="playRecordRef" />
  495. <!-- 回访重办 -->
  496. <visit-redo ref="visitRedoRef" @updateList="onRedoSuccess" />
  497. </template>
  498. <script setup lang="tsx" name="orderFollowUpDetail">
  499. import { computed, defineAsyncComponent, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
  500. import { ElMessage, FormInstance } from 'element-plus';
  501. import { commonEnum } from '@/utils/constants';
  502. import { storeToRefs } from 'pinia';
  503. import { useUserInfo } from '@/stores/userInfo';
  504. import dayjs from 'dayjs';
  505. import { visitDetailBaseData, visitOrder } from '@/api/business/visit';
  506. import mittBus from '@/utils/mitt';
  507. import { callCenterOutbound } from '@/utils/callCenter';
  508. import { useThemeConfig } from '@/stores/themeConfig';
  509. import { formatDate } from '@/utils/formatTime';
  510. // 引入组件
  511. const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
  512. const PlayRecord = defineAsyncComponent(() => import('@/components/PlayRecord/index.vue')); // 播放录音
  513. const VisitRedo = defineAsyncComponent(() => import('@/views/business/visit/component/Visit-redo.vue')); // 回访重办
  514. // 定义子组件向父组件传值/事件
  515. const emit = defineEmits(['updateList']);
  516. // 定义变量内容
  517. const state = reactive<any>({
  518. collapseArr: ['1', '2', '3'], // 折叠面板
  519. dialogVisible: false, // 是否显示弹窗
  520. loading: false, // 是否显示加载
  521. transform: 'translate(0px, 0px)', // 附件弹窗位置
  522. smartRecord: null,
  523. ruleForm: {
  524. isPutThrough: false, //未接通
  525. visitDetails: {},
  526. orgJudge: false, // 扭转部门满意度
  527. seatJudge: false, // 扭转坐席满意度
  528. },
  529. orderDetail: {}, // 工单详情
  530. orderVisitModel: {}, // 回访详情
  531. recordingAbsolutePath: '', // 录音文件
  532. histories: [], //回访记录列表
  533. });
  534. const ruleFormRef = ref<RefType>();
  535. const storesUserInfo = useUserInfo();
  536. const { userInfos } = storeToRefs(storesUserInfo); // 用户信息
  537. const visitCount = ref<number>(0); // 回访次数
  538. const seatEvaluate = ref<EmptyArrayType>(); // 话务员评价
  539. const viceEvaluate = ref<EmptyArrayType>(); // 语音评价
  540. const dissatisfiedReason = ref<EmptyArrayType>(); // 不满意原因
  541. const visitManner = ref<EmptyArrayType>(); // 部门办件态度
  542. const visitSatisfaction = ref<EmptyArrayType>(); // 部门办件结果
  543. const visitId = ref<string>(''); // 回访id
  544. const dialogTitle = ref<string>('回访'); // 弹窗标题
  545. const aiVisitVoiceBaseUrl = ref(''); // 智能回访录音前缀
  546. const storesThemeConfig = useThemeConfig();
  547. const { themeConfig } = storeToRefs(storesThemeConfig);
  548. const getBaseData = async (id: string) => {
  549. state.loading = true;
  550. try {
  551. const { result } = await visitDetailBaseData(id);
  552. visitCount.value = result?.visitCount ?? 0;
  553. seatEvaluate.value = result?.seatEvaluate ?? [];
  554. viceEvaluate.value = result?.viceEvaluate ?? [];
  555. dissatisfiedReason.value = result?.dissatisfiedReason ?? [];
  556. visitManner.value = result?.visitManner ?? [];
  557. visitSatisfaction.value = result?.visitSatisfaction ?? [];
  558. visitId.value = result?.orderVisitModel?.id ?? '';
  559. state.orderDetail = result?.orderVisitModel?.order ?? {};
  560. state.orderVisitModel = result?.orderVisitModel ?? {};
  561. state.recordingAbsolutePath = result?.recordingAbsolutePath ?? '';
  562. state.smartRecord = result?.orderVisitModel.recordUrl ?? '';
  563. aiVisitVoiceBaseUrl.value = result.aiVisitVoiceBaseUrl;
  564. state.histories = result?.histories ?? []; // 回访记录列表
  565. if (result?.orderVisitModel?.isPutThrough !== null) {
  566. state.ruleForm.isPutThrough = !result?.orderVisitModel?.isPutThrough ?? false;
  567. } else {
  568. state.ruleForm.isPutThrough = false;
  569. }
  570. state.ruleForm.visitDetails = result?.orderVisitModel?.orderVisitDetails ?? {};
  571. for (let i of state.ruleForm.visitDetails) {
  572. if (i.visitTarget === 20) {
  573. if (i.orgProcessingResults) {
  574. i.orgProcessingResults = {
  575. ...i.orgProcessingResults,
  576. dicDataName: i.orgProcessingResults.value,
  577. dicDataValue: i.orgProcessingResults.key,
  578. };
  579. }
  580. if (i.orgNoSatisfiedReason) {
  581. i.orgNoSatisfiedReason = i.orgNoSatisfiedReason.map((item: any) => {
  582. return {
  583. ...item,
  584. dicDataName: item.value,
  585. dicDataValue: item.key,
  586. };
  587. });
  588. } else {
  589. i.orgNoSatisfiedReason = [];
  590. }
  591. if (i.orgHandledAttitude) {
  592. i.orgHandledAttitude = {
  593. ...i.orgHandledAttitude,
  594. dicDataName: i.orgHandledAttitude.value,
  595. dicDataValue: i.orgHandledAttitude.key,
  596. };
  597. }
  598. }
  599. }
  600. state.loading = false;
  601. } catch (error) {
  602. console.log(error);
  603. state.loading = false;
  604. }
  605. };
  606. const notGetThrough = ref(false);
  607. watch(
  608. () => state.ruleForm.isPutThrough,
  609. (val) => {
  610. notGetThrough.value = !val;
  611. },
  612. { immediate: true, deep: true }
  613. );
  614. // 判断当前工单是否是电话来源
  615. const isTelSource = computed(() => {
  616. return state.orderDetail?.sourceChannelCode === 'RGDH';
  617. });
  618. // 打开弹窗
  619. const openDialog = (row: any, type: string = '回访') => {
  620. if (!row.id || !row) {
  621. ElMessage.warning('传入回访ID不正确');
  622. return;
  623. }
  624. state.dialogVisible = true;
  625. getBaseData(row.id);
  626. dialogTitle.value = type;
  627. };
  628. const disabled = computed(() => {
  629. return ['回访明细', '回访详情'].includes(dialogTitle.value);
  630. });
  631. // 设置抽屉
  632. const dialogRef = ref<RefType>(); // 弹窗ref
  633. const mouseup = () => {
  634. state.transform = dialogRef.value.dialogContentRef.$el.style.transform;
  635. };
  636. // 关闭弹窗
  637. const closeDialog = () => {
  638. state.dialogVisible = false;
  639. };
  640. // 查看人工回访录音文件
  641. const playRecordRef = ref<RefType>();
  642. const recordFile = () => {
  643. playRecordRef.value.openDialog(state.orderVisitModel.callId);
  644. };
  645. // 查看智能回访录音
  646. const onSmartRecord = () => {
  647. playRecordRef.value.playRecord(aiVisitVoiceBaseUrl.value + state.smartRecord);
  648. };
  649. // 呼叫
  650. const onCall = (phoneNumber: string) => {
  651. callCenterOutbound(phoneNumber);
  652. };
  653. // 选择不满意原因
  654. const selectReason = (val: any, index: number | string) => {
  655. state.ruleForm.visitDetails[index].orgNoSatisfiedReason = val.map((item: any) => {
  656. return {
  657. ...item,
  658. value: item.dicDataName,
  659. key: item.dicDataValue,
  660. };
  661. });
  662. console.log(state.ruleForm.visitDetails[index].orgNoSatisfiedReason,'111')
  663. };
  664. const close = () => {
  665. ruleFormRef.value?.clearValidate();
  666. ruleFormRef.value?.resetFields();
  667. };
  668. // 提交
  669. const onSubmit = (formEl: FormInstance | undefined) => {
  670. if (!formEl) return;
  671. formEl.validate((valid: boolean) => {
  672. if (!valid) return;
  673. state.loading = true;
  674. let request = {
  675. ...state.ruleForm,
  676. isPutThrough: !state.ruleForm.isPutThrough,
  677. ...state.visitDetails,
  678. id: visitId.value,
  679. };
  680. if (callId.value) {
  681. request.callId = callId.value;
  682. }
  683. visitOrder(request)
  684. .then(() => {
  685. ElMessage.success('操作成功');
  686. state.loading = false;
  687. closeDialog();
  688. emit('updateList');
  689. })
  690. .catch(() => {
  691. state.loading = false;
  692. });
  693. });
  694. };
  695. // 选中常用意见
  696. const chooseAdvice = (item: any, index: number | string) => {
  697. if (state.ruleForm.visitDetails[index].visitContent === null) {
  698. state.ruleForm.visitDetails[index].visitContent = '';
  699. }
  700. state.ruleForm.visitDetails[index].visitContent += item.content;
  701. };
  702. // 重办
  703. const visitRedoRef = ref<RefType>();
  704. const onRedo = () => {
  705. visitRedoRef.value.openDialog(state.orderDetail);
  706. };
  707. // 重办成功
  708. const onRedoSuccess = () => {
  709. closeDialog();
  710. emit('updateList');
  711. };
  712. const queryList = () => {};
  713. // 表格配置项
  714. const columns = ref<any[]>([
  715. { prop: 'voiceEvaluateTxt', label: '语音评价', minWidth: 110 },
  716. { prop: 'seatEvaluateTxt', label: '话务员评价', minWidth: 110 },
  717. { prop: 'visitOrgName', label: '部门名称', minWidth: 110 },
  718. { prop: 'orgProcessingResultsValue', label: '部门办件结果', minWidth: 110 },
  719. { prop: 'orgHandledAttitudeValue', label: '部门办件态度', minWidth: 110 },
  720. { prop: 'visitContent', label: '部门评价内容', minWidth: 110 },
  721. {
  722. prop: 'visitTime',
  723. label: '回访时间',
  724. minWidth: 160,
  725. render: (scope) => {
  726. return <span>{formatDate(scope.row.visitTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  727. },
  728. },
  729. ]);
  730. const callId = ref<string>('');
  731. onMounted(() => {
  732. mittBus.on('outboundConnect', (data) => {
  733. console.log(data, '外呼已经接通辣');
  734. if (data.callNumber === state.orderDetail.contact) callId.value = data.callId;
  735. });
  736. });
  737. onBeforeUnmount(() => {
  738. mittBus.off('outboundConnect');
  739. });
  740. defineExpose({
  741. openDialog,
  742. closeDialog,
  743. });
  744. </script>
  745. <style lang="scss" scoped>
  746. .collapse-box {
  747. .el-radio {
  748. margin-right: 10px;
  749. }
  750. :deep(.el-collapse-item__header) {
  751. background-color: var(--hotline-bg-main-color);
  752. height: 40px;
  753. border-radius: var(--el-border-radius-base);
  754. }
  755. :deep(.el-collapse-item__content) {
  756. padding-bottom: 10px !important;
  757. }
  758. .collapse-container {
  759. padding: 10px;
  760. .plug-container {
  761. border: var(--el-border);
  762. border-radius: var(--el-border-radius-base);
  763. margin-bottom: 15px;
  764. &:last-child {
  765. margin-bottom: 0;
  766. }
  767. .plug-container-title {
  768. padding: 10px 15px;
  769. font-weight: bold;
  770. border-bottom: var(--el-border);
  771. font-size: var(--el-font-size-medium);
  772. }
  773. }
  774. }
  775. }
  776. </style>
  777. <style lang="scss">
  778. .demo-tabs-form {
  779. .title {
  780. font-size: var(--el-font-size-medium);
  781. padding: 10px 15px 20px 15px;
  782. }
  783. }
  784. </style>