zgAccept.vue 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  1. <template>
  2. <div class="order-add-container layout-padding">
  3. <el-row :gutter="10" class="h100">
  4. <!-- 左侧工单信息 -->
  5. <el-col :span="14" class="left-content h100">
  6. <el-scrollbar class="h100">
  7. <el-card shadow="never">
  8. <el-form :model="state.ruleForm" ref="ruleFormRef" label-width="110px" label-position="right" scroll-to-error>
  9. <p class="border-title mb10">来电信息</p>
  10. <el-row :gutter="20">
  11. <!-- 来源渠道 -->
  12. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  13. <!-- 手动创建或者来电弹单或者转写工单 -->
  14. <template v-if="['tel', 'manual', 'transfer'].includes(state.createBy)">
  15. <el-form-item label="来源渠道" prop="channel" :rules="[{ required: true, message: '请选择来源渠道', trigger: 'change' }]">
  16. <el-select
  17. v-model="state.ruleForm.channel"
  18. placeholder="请选择来源渠道"
  19. class="w100"
  20. clearable
  21. value-key="dicDataValue"
  22. @change="changeChannel"
  23. >
  24. <el-option v-for="item in state.channelOptions" :value="item" :key="item.dicDataValue" :label="item.dicDataName" />
  25. </el-select>
  26. </el-form-item>
  27. </template>
  28. <!-- 互联网来信 -->
  29. <template v-if="state.createBy === 'letter'">
  30. <el-form-item label="来源渠道" prop="channel">
  31. <span>{{ state.ruleForm.channel }}</span>
  32. </el-form-item>
  33. </template>
  34. </el-col>
  35. <!-- 转接来源 -->
  36. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  37. <!-- 手动创建 -->
  38. <template v-if="state.createBy === 'manual'">
  39. <el-form-item label="转接来源" prop="transferPhone"> 暂无 </el-form-item>
  40. </template>
  41. <!-- 来电弹单或者转写工单 -->
  42. <template v-if="['tel', 'transfer'].includes(state.createBy)">
  43. <el-form-item label="转接来源" prop="transferPhone">
  44. <span>{{ state.ruleForm.transferPhone }}</span>
  45. </el-form-item>
  46. </template>
  47. <!-- 互联网来信 -->
  48. <template v-if="state.createBy === 'letter'">
  49. <el-form-item label="转接来源" prop="transferPhone">
  50. <span>{{ state.ruleForm.transferPhone }}</span>
  51. </el-form-item>
  52. </template>
  53. </el-col>
  54. <!-- 来电号码 -->
  55. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="state.ruleForm.sourceChannelCode === 'RGDH'">
  56. <!-- 手动创建 -->
  57. <template v-if="state.createBy === 'manual'">
  58. <el-form-item label="来电号码" prop="fromPhone" :rules="[{ required: true, message: '请填写来电号码', trigger: 'blur' }]">
  59. <el-input v-model="state.ruleForm.fromPhone" placeholder="请填写来电号码" clearable> </el-input>
  60. </el-form-item>
  61. </template>
  62. <!-- 来电弹单 -->
  63. <template v-if="['tel', 'transfer'].includes(state.createBy)">
  64. <el-form-item label="来电号码" prop="fromPhone">
  65. <el-input v-model="state.ruleForm.fromPhone" placeholder="请填写来电号码" disabled> </el-input>
  66. </el-form-item>
  67. </template>
  68. <!-- 互联网来信 -->
  69. <template v-if="state.createBy === 'letter'">
  70. <el-form-item label="来电号码">
  71. <span>{{ state.ruleForm.fromPhone }}</span>
  72. </el-form-item>
  73. </template>
  74. </el-col>
  75. <!-- 服务坐席 -->
  76. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  77. <el-form-item label="服务坐席">
  78. <span>{{ state.ruleForm.acceptorName }}</span>
  79. </el-form-item>
  80. </el-col>
  81. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  82. <el-form-item label="来电人姓名" prop="fromName" :rules="[{ required: true, message: '请填写来电人姓名', trigger: 'blur' }]">
  83. <el-row class="w100">
  84. <el-col :xs="24" :sm="24" :md="24" :lg="18" :xl="18">
  85. <el-input v-model="state.ruleForm.fromName" placeholder="请填写来电人姓名" clearable @input="inputName"> </el-input>
  86. </el-col>
  87. <el-col :xs="24" :sm="24" :md="24" :lg="6" :xl="6" style="text-align: center">
  88. <el-checkbox v-model="state.ruleForm.isSecret" label="保密" />
  89. </el-col>
  90. </el-row>
  91. </el-form-item>
  92. </el-col>
  93. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  94. <el-form-item label="来电人性别" prop="fromGender" :rules="[{ required: true, message: '请选择来电人性别', trigger: 'change' }]">
  95. <el-radio-group v-model="state.ruleForm.fromGender">
  96. <el-radio :value="item.key" v-for="item in state.genderOptions" :key="item.key">{{ item.value }}</el-radio>
  97. </el-radio-group>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  101. <el-form-item label="来电主体" prop="identityType" :rules="[{ required: true, message: '请选择来电主体', trigger: 'change' }]">
  102. <el-radio-group v-model="state.ruleForm.identityType" @change="selectIdentity">
  103. <el-radio :value="item.key" v-for="item in state.identityTypeOptions" :key="item.key">{{ item.value }}</el-radio>
  104. </el-radio-group>
  105. </el-form-item>
  106. </el-col>
  107. <!-- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  108. <el-form-item label="证件类型" prop="licenceTypeObj" :rules="[{ required: false, message: '请选择证件类型', trigger: 'change' }]">
  109. <el-select
  110. v-model="state.ruleForm.licenceTypeObj"
  111. placeholder="请选择证件类型"
  112. class="w100"
  113. clearable
  114. value-key="dicDataValue"
  115. @change="changeLicenceType"
  116. >
  117. <el-option v-for="item in state.licenceTypeOptions" :key="item.dicDataValue" :label="item.dicDataName" :value="item" />
  118. </el-select>
  119. </el-form-item>
  120. </el-col>
  121. &lt;!&ndash; 若“证件类型”有值,则证件号码必填 &ndash;&gt;
  122. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  123. <el-form-item
  124. label="证件号码"
  125. prop="licenceNo"
  126. :rules="[
  127. { required: state.ruleForm.licenceTypeCode, message: '请填写证件号码', trigger: 'blur' },
  128. {
  129. pattern: licenceNoPattern,
  130. message: '证件号码格式错误',
  131. trigger: 'blur',
  132. },
  133. ]"
  134. >
  135. <el-input v-model="state.ruleForm.licenceNo" placeholder="请填写证件号码" clearable> </el-input>
  136. </el-form-item>
  137. </el-col>-->
  138. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  139. <el-form-item label="联系电话" prop="contact" :rules="[{ required: true, message: '请填写联系电话', trigger: 'blur' }]">
  140. <el-input v-model="state.ruleForm.contact" placeholder="请填写联系电话" @blur="searchHistory" clearable> </el-input>
  141. </el-form-item>
  142. </el-col>
  143. <!-- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  144. <el-form-item label="工作单位" prop="company" :rules="[{ required: false, message: '请填写工作单位', trigger: 'blur' }]">
  145. <el-input v-model="state.ruleForm.company" placeholder="请填写工作单位" clearable> </el-input>
  146. </el-form-item>
  147. </el-col>-->
  148. </el-row>
  149. <p class="border-title mb10">诉求信息</p>
  150. <el-row>
  151. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="state.ruleForm.no">
  152. <el-form-item label="工单编码">
  153. {{ state.ruleForm.no }} <span v-if="state.ruleForm?.password">【{{ state.ruleForm.password }}】</span>
  154. </el-form-item>
  155. </el-col>
  156. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  157. <el-form-item label="拓展信息">
  158. <el-button @click="showExpandForm" :loading="extraLoading">
  159. <SvgIcon name="ele-CirclePlus" class="mr3" size="16px" /> 拓展信息
  160. </el-button>
  161. </el-form-item>
  162. </el-col>
  163. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  164. <el-form-item label="受理类型" prop="acceptTypeObj" :rules="[{ required: true, message: '请选择受理类型', trigger: 'change' }]">
  165. <el-select
  166. v-model="state.ruleForm.acceptTypeObj"
  167. placeholder="请选择受理类型"
  168. class="w100"
  169. value-key="dicDataValue"
  170. clearable
  171. @change="changeAcceptType"
  172. >
  173. <el-option
  174. v-for="item in state.acceptTypeOptions"
  175. :key="item.dicDataValue"
  176. :disabled="item.disabled"
  177. :label="item.dicDataName"
  178. :value="item"
  179. />
  180. </el-select>
  181. </el-form-item>
  182. </el-col>
  183. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  184. <el-form-item label="重点标签" prop="focusOnEventsArr" :rules="[{ required: false, message: '请选择重点标签', trigger: 'change' }]">
  185. <el-checkbox-group v-model="state.ruleForm.focusOnEventsArr" @change="changeFocusEvent">
  186. <el-checkbox
  187. :label="item.dicDataName"
  188. :value="item.dicDataValue"
  189. v-for="item in state.focusOnEvents"
  190. :key="item.dicDataValue"
  191. />
  192. </el-checkbox-group>
  193. </el-form-item>
  194. </el-col>
  195. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  196. <el-form-item label="推送分类" prop="orderPushTypes" :rules="[{ required: false, message: '请选择推送分类', trigger: 'change' }]">
  197. <el-select
  198. v-model="state.ruleForm.orderPushTypes"
  199. placeholder="请选择推送分类"
  200. class="w100"
  201. clearable
  202. value-key="pushTypeCode"
  203. multiple
  204. collapse-tags
  205. collapse-tags-tooltip
  206. :max-collapse-tags="2"
  207. >
  208. <el-option v-for="item in state.pushTypeOptions" :key="item.pushTypeCode" :label="item.pushType" :value="item" />
  209. </el-select>
  210. </el-form-item>
  211. </el-col>
  212. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  213. <el-form-item label="工单标签" prop="orderTagObj" :rules="[{ required: false, message: '请选择工单标签', trigger: 'change' }]">
  214. <el-select
  215. v-model="state.ruleForm.orderTagObj"
  216. placeholder="请选择工单标签"
  217. class="w100"
  218. clearable
  219. value-key="dicDataValue"
  220. @change="changeOrderTag"
  221. >
  222. <el-option v-for="item in state.orderTags" :key="item.dicDataValue" :label="item.dicDataName" :value="item" />
  223. </el-select>
  224. </el-form-item>
  225. </el-col>
  226. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  227. <el-form-item label="热点分类" prop="hotspotId" :rules="[{ required: true, message: '请选择热点分类', trigger: 'change' }]">
  228. <hot-spot-select
  229. v-model="state.ruleForm.hotspotId"
  230. v-model:externalArr="state.hotspotExternal"
  231. @change="chooseHotSpot"
  232. placeholder="请选择热点分类"
  233. clearable
  234. @getCurrentData="getCurrentData"
  235. />
  236. </el-form-item>
  237. </el-col>
  238. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  239. <el-row :gutter="0">
  240. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  241. <el-form-item
  242. label="事发地址"
  243. prop="areaCode"
  244. :rules="[{ required: true, message: '请选择事发地址', trigger: 'change' }]"
  245. v-loading="addressLoading"
  246. >
  247. <el-cascader
  248. :options="state.areaOptions"
  249. filterable
  250. :props="{ value: 'id', label: 'areaName', emitPath: false, checkStrictly: true }"
  251. placeholder="请选择事发地址"
  252. class="w100"
  253. v-model="state.ruleForm.areaCode"
  254. ref="areaRef"
  255. @change="changeArea"
  256. >
  257. </el-cascader>
  258. </el-form-item>
  259. </el-col>
  260. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  261. <el-form-item
  262. label=""
  263. prop="street"
  264. :rules="[{ required: false, message: '请填写详细地址', trigger: 'blur' }]"
  265. label-width="10px"
  266. class="w100 flex"
  267. >
  268. <el-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
  269. <el-input v-model="state.ruleForm.street" placeholder="请填写详细地址" clearable> </el-input>
  270. </el-col>
  271. <el-col :xs="24" :sm="24" :md="24" :lg="7" :xl="7" :offset="1">
  272. <el-button type="primary" link @click="selectLocation"><SvgIcon name="ele-Location" size="16px" /> 地图定位</el-button>
  273. </el-col>
  274. </el-form-item>
  275. </el-col>
  276. <div v-if="showRepeatEvent" class="color-danger mb10" style="margin-left: 110px">
  277. 【{{ state.ruleForm.address }}】下存在多起【{{ state.ruleForm.hotspotSpliceName }}】事件,点击前往查看或右侧添加重复性事件
  278. <el-button type="primary" link style="padding: 0 0 3px" @click="onRepeatEvent"> 查看详情</el-button>
  279. </div>
  280. </el-row>
  281. </el-col>
  282. <!-- 系统配置 可以配置是否开启重复工单 -->
  283. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="AppConfigInfo.isOpenRepeatedWorkOrders">
  284. <el-row>
  285. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  286. <el-form-item label="是否重复" prop="isRepeat" :rules="[{ required: true, message: '请选择是否重复', trigger: 'change' }]">
  287. <el-select v-model="state.ruleForm.isRepeat" placeholder="请选择是否重复" class="w100" @change="isRepeatChange">
  288. <el-option v-for="item in state.repeatOptions" :key="item.key" :label="item.value" :value="item.key" />
  289. </el-select>
  290. </el-form-item>
  291. </el-col>
  292. <!-- 必填,若“是否重复”为“是”,则展示重复件选择框 -->
  293. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="state.ruleForm.isRepeat === 'true'">
  294. <el-form-item
  295. label=""
  296. prop="duplicateTitle"
  297. label-width="10px"
  298. :rules="[{ required: true, message: '请选择重复件', trigger: 'change' }]"
  299. >
  300. <el-input v-model="state.ruleForm.duplicateTitle" placeholder="请选择重复件" readonly>
  301. <template #suffix>
  302. <el-button link type="danger" v-if="state.ruleForm.duplicateTitle" @click="clearRepeat" title="清除历史工单">
  303. <SvgIcon name="ele-Delete" size="16px" />
  304. </el-button>
  305. <el-button link type="primary" class="ml1" @click="selectRepeat" title="选择历史工单">
  306. <SvgIcon name="iconfont icon-tianjiatuozhanxinxi" size="18px" />
  307. </el-button>
  308. </template>
  309. </el-input>
  310. </el-form-item>
  311. </el-col>
  312. </el-row>
  313. </el-col>
  314. <!-- 宜宾特殊需求,可配置开关 是否开启是否市州互转 -->
  315. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="AppConfigInfo.isTranspondCity">
  316. <el-row>
  317. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  318. <el-form-item
  319. label="是否市州互转"
  320. prop="transpond"
  321. :rules="[{ required: true, message: '请选择是否市州互转', trigger: 'change' }]"
  322. >
  323. <el-select v-model="state.ruleForm.transpond" placeholder="请选择是否市州互转" class="w100" @change="changeTransPond">
  324. <el-option :key="true" label="是" :value="true" />
  325. <el-option :key="false" label="否" :value="false" />
  326. </el-select>
  327. </el-form-item>
  328. </el-col>
  329. <!-- 必填,若“是否市州互转”为“是”,则展示选择市州选择框 -->
  330. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="state.ruleForm.transpond">
  331. <el-form-item
  332. label=""
  333. prop="transpondCityObj"
  334. label-width="10px"
  335. :rules="[{ required: true, message: '请选择互转市州', trigger: 'change' }]"
  336. >
  337. <el-select
  338. v-model="state.ruleForm.transpondCityObj"
  339. placeholder="请选择互转市州"
  340. class="w100"
  341. value-key="dicDataValue"
  342. @change="changeTranspondCity"
  343. >
  344. <el-option v-for="item in state.transpondCity" :key="item.dicDataValue" :label="item.dicDataName" :value="item" />
  345. </el-select>
  346. </el-form-item>
  347. </el-col>
  348. </el-row>
  349. </el-col>
  350. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  351. <el-form-item
  352. label="工单标题"
  353. prop="title"
  354. :rules="[
  355. { required: true, message: '请填写工单标题', trigger: 'blur' },
  356. { required: true, pattern: '[^ \x20]+', trigger: 'blur', message: '工单标题不能为空' },
  357. ]"
  358. >
  359. <el-input v-model="state.ruleForm.title" placeholder="请填写工单标题" clearable @input="inputTitle"> </el-input>
  360. </el-form-item>
  361. </el-col>
  362. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  363. <el-form-item
  364. label="受理内容"
  365. prop="content"
  366. :rules="[
  367. { required: true, message: '请填写受理内容', trigger: 'blur' },
  368. { required: true, pattern: '[^ \x20]+', trigger: 'blur', message: '受理内容不能为空' },
  369. ]"
  370. >
  371. <common-advice
  372. @chooseAdvice="chooseAdvice"
  373. v-model="state.ruleForm.content"
  374. placeholder="请填写受理内容"
  375. :loading="state.formLoading"
  376. :commonEnum="commonEnum.Seat"
  377. modal
  378. />
  379. </el-form-item>
  380. </el-col>
  381. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  382. <el-form-item label="附件" prop="files" :rules="[{ required: false, message: '请填写诉求内容', trigger: 'change' }]">
  383. <annex-list :businessId="state.ruleForm.id" classify="受理上传" v-model="state.ruleForm.files" v-model:format="filesFormat" />
  384. </el-form-item>
  385. </el-col>
  386. <el-col :xs="24" :sm="12" :md="24" :lg="24" :xl="24">
  387. <el-form-item>
  388. <el-button class="default-button" @click="onCancel" :loading="buttonLoading"> 取消 </el-button>
  389. <!-- <el-button class="default-button" @click="save(ruleFormRef)" :loading="buttonLoading" :disabled="isSaveSuccess"> 保存 </el-button>
  390. <el-button type="primary" @click="submit(ruleFormRef)" :loading="buttonLoading" v-if="canHandle" :disabled="!isSaveSuccess">
  391. 办理
  392. </el-button>-->
  393. <el-button type="primary" @click="save(ruleFormRef)" :loading="buttonLoading" v-if="!isSaveSuccess"> 保存 </el-button>
  394. <el-button type="primary" @click="submit(ruleFormRef)" :loading="buttonLoading" v-if="canHandle && isSaveSuccess">
  395. 办理
  396. </el-button>
  397. <el-button
  398. type="primary"
  399. @click="agentHandle(ruleFormRef)"
  400. :loading="buttonLoading"
  401. v-if="state.ruleForm?.canInsteadHandle && isSaveSuccess"
  402. v-auth="'business:order:handle:instead'"
  403. >代办</el-button
  404. >
  405. <el-text class="ml12" type="danger" tag="b">注意:工单内容填写或者修改后请先保存再办理。</el-text>
  406. </el-form-item>
  407. </el-col>
  408. </el-row>
  409. </el-form>
  410. </el-card>
  411. </el-scrollbar>
  412. </el-col>
  413. <!-- 右侧内容 -->
  414. <el-col :span="10" class="right-content h100">
  415. <el-scrollbar class="h100">
  416. <el-card shadow="never">
  417. <el-tabs v-model="rightActive" @tab-change="handleRight" stretch>
  418. <el-tab-pane label="历史工单" name="history">
  419. <history-order :ruleForm="state.ruleForm" :orderId="state.ruleForm.id" ref="historyOrderRef" />
  420. </el-tab-pane>
  421. <el-tab-pane label="重复性事件" name="repeat">
  422. <repeat-event ref="repeatEventRef" @orderAddRepeat="orderAddRepeat" :repeatIds="state.ruleForm.repeatableEventDetails" />
  423. </el-tab-pane>
  424. <el-tab-pane label="市民画像" name="draw">
  425. <citizen-portrait :orderInfo="state.ruleForm" ref="citizenPortraitRef" />
  426. </el-tab-pane>
  427. </el-tabs>
  428. </el-card>
  429. <el-card shadow="never">
  430. <el-tabs v-model="rightBottomActive" @tab-change="handleRightBottom" stretch>
  431. <el-tab-pane label="知识库" name="knowledge">
  432. <Knowledge ref="knowledgeRef" />
  433. </el-tab-pane>
  434. <el-tab-pane label="预案库" name="aa"> </el-tab-pane>
  435. </el-tabs>
  436. </el-card>
  437. </el-scrollbar>
  438. </el-col>
  439. </el-row>
  440. <!-- 拓展表单 -->
  441. <expand-form ref="ExpandFormRef" @saveExpandForm="saveExpandForm" :orderDetail="state.ruleForm" :extra="extra" />
  442. <!-- 流程审批 -->
  443. <process-audit ref="processAuditRef" @orderProcessSuccess="onCancel" />
  444. <!-- 地图选点 -->
  445. <map-dialog ref="mapDialogRef" @confirm="selectMap" />
  446. <!-- 重复工单选择 -->
  447. <order-repeat-select ref="orderRepeatSelectRef" @orderRepeatSuccess="orderRepeatSuccess" />
  448. <!-- 自贡流程办理 -->
  449. <z-g-process ref="zgProcessRef" @orderProcessSuccess="onCancel"/>
  450. </div>
  451. </template>
  452. <script setup lang="ts" name="orderAccept">
  453. import { computed, defineAsyncComponent, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
  454. import type { FormInstance } from 'element-plus';
  455. import { ElMessage, ElMessageBox } from 'element-plus';
  456. import { storeToRefs } from 'pinia';
  457. import { useRoute } from 'vue-router';
  458. import { useAppConfig } from '@/stores/appConfig';
  459. import { throttle, transformFile } from '@/utils/tools';
  460. import { commonEnum } from '@/utils/constants';
  461. import { orderAdd, orderBaseDataAdd, orderBaseExt, orderDetail, orderEdit } from '@/api/business/order';
  462. import { useUserInfo } from '@/stores/userInfo';
  463. import { treeArea } from '@/api/auxiliary/area';
  464. import mittBus from '@/utils/mitt';
  465. import { orderRepeatEvent } from '@/api/business/repeatEvent';
  466. import { removeDuplicate } from '@/utils/arrayOperation';
  467. import { Session } from '@/utils/storage';
  468. import { watchPausable } from '@vueuse/core';
  469. import { useThemeConfig } from '@/stores/themeConfig';
  470. // 引入组件
  471. const Knowledge = defineAsyncComponent(() => import('@/views/todo/seats/accept/Knowledge.vue')); // 知识库
  472. const HistoryOrder = defineAsyncComponent(() => import('@/views/todo/seats/accept/History.vue')); // 历史工单
  473. const RepeatEvent = defineAsyncComponent(() => import('@/views/todo/seats/accept/Repeat-event.vue')); // 重复事件
  474. const CitizenPortrait = defineAsyncComponent(() => import('@/views/todo/seats/accept/Citizen-portrait.vue')); // 市民画像
  475. const ExpandForm = defineAsyncComponent(() => import('@/views/todo/seats/accept/Expand-form.vue')); // 拓展表单
  476. const OrderRepeatSelect = defineAsyncComponent(() => import('@/views/todo/seats/accept/Order-repeat-select.vue')); // 选择重复工单
  477. const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
  478. const AnnexList = defineAsyncComponent(() => import('@/components/AnnexList/index.vue')); // 附件列表
  479. const ProcessAudit = defineAsyncComponent(() => import('@/components/ProcessAudit/index.vue')); // 流程审批
  480. const MapDialog = defineAsyncComponent(() => import('@/views/todo/seats/accept/Map-Dialog.vue')); // 地图定位
  481. const HotSpotSelect = defineAsyncComponent(() => import('@/components/Hotspot/index.vue')); // 选择热点
  482. const ZGProcess = defineAsyncComponent(() => import('@/components/ProcessAudit/ZGProcess.vue')); // 自贡流程
  483. // 定义变量内容
  484. const storesThemeConfig = useThemeConfig();
  485. const { themeConfig } = storeToRefs(storesThemeConfig);
  486. const state = reactive<any>({
  487. createBy: 'manual', // 工单创建方式 默认手动创建 tel:来电弹单 letter:互联网来信 默认表示手动创建
  488. ruleForm: {
  489. sourceChannel: null, // 来源频道
  490. sourceChannelCode: null, //来源频道code
  491. transferPhone: null, // 转接来源
  492. fromPhone: null, // 来电号码
  493. acceptorName: null, // 员工姓名
  494. acceptorStaffNo: null, // 员工工号
  495. fromName: null, // 来电人姓名
  496. fromGender: 1, // 来电人性别 默认先生
  497. identityType: 2, // 来电/信人身份 默认企业
  498. licenceType: null, // 证件类型
  499. licenceTypeCode: null, // 证件类型code
  500. licenceNo: null, // 证件号码
  501. ageRange: null, // 年龄段
  502. ageRangeCode: null, // 年龄段code
  503. contact: null, // 联系电话
  504. isSecret: false, // 是否保密 默认false
  505. acceptSms: false, // 是否接收短信 默认false
  506. no: null, // 工单编码
  507. title: null, // 工单标题
  508. hotspotId: null, // 热点分类
  509. eventCategoryId: null, // 事件分类
  510. incidentTime: null, // 事发时间
  511. incidentPurpose: null, // 事件目的
  512. areaCode: themeConfig.value.cityCode, // 区域编码
  513. city: themeConfig.value.cityName, // 市
  514. street: null, // 街道
  515. isRepeat: 'false', // 是否重复工单 默认否
  516. pushType: null, // 推送类型
  517. pushTypeCode: null, // 推送类型code
  518. content: '', // 工单内容
  519. duplicateIds: [], //重复工单id
  520. duplicateTitle: null, // 重复工单标题
  521. callAddress: null, // 来电归属地
  522. repeatableEventDetails: [], //重复性事件
  523. orderExtension: null, // 拓展信息
  524. transpond: false, // 是否市州互转
  525. isEnforcementOrder: false, // 是否行政执法工单
  526. focusOnEventsArr: [], // 重点关注事项
  527. focusOnEvents: null, // 重点关注事项 字符串
  528. isFormalistWorkOrder: false, // 是否形式主义工单
  529. isSensitiveWorkOrders: false, // 是否敏感类工单
  530. isUrgent: false, // 是否紧急工单
  531. isThreePartyConference: false, // 是否三方同v话
  532. is24HoursComplete: false, // 24小时紧急工单
  533. company: null, // 工作单位
  534. orderPushTypes: [], // 推送分类多选
  535. acceptType: '咨询', // 受理类型
  536. acceptTypeCode: '10', // 受理类型code
  537. acceptTypeObj:{ // 默认咨询
  538. dicDataValue: '10',
  539. dicDataName:'咨询',
  540. }
  541. },
  542. formLoading: false, // 表单加载状态
  543. hotspotExternal: [], // 热点分类外部数据
  544. eventCategoryExternal: [], // 事件分类外部数据
  545. acceptTypeOptions: [], // 受理类型
  546. channelOptions: [], // 来源频道
  547. genderOptions: [], // 性别
  548. identityTypeOptions: [], //来电主体
  549. licenceTypeOptions: [], // 证件类型
  550. ageRangeOptions: [], // 年龄段
  551. pushTypeOptions: [], //推送分类
  552. areaOptions: [], //省市区
  553. orderTags: [], // 工单标签
  554. transpondCity: [],
  555. repeatOptions: [
  556. //是否重复
  557. {
  558. value: '是',
  559. key: 'true',
  560. },
  561. {
  562. value: '否',
  563. key: 'false',
  564. },
  565. ],
  566. focusOnEvents: [], // 重点关注事项
  567. orderId: null, // 工单id
  568. tagsViewList: [],
  569. });
  570. const storesUserInfo = useUserInfo(); // 用户信息
  571. const { userInfos } = storeToRefs(storesUserInfo); // 用户信息
  572. const appConfigStore = useAppConfig();
  573. const { AppConfigInfo } = storeToRefs(appConfigStore); // 系统配置信息
  574. state.ruleForm.acceptorName = userInfos.value.name; // 员工姓名
  575. state.ruleForm.acceptorStaffNo = userInfos.value.staffNo; // 员工工号
  576. const route = useRoute(); // 路由
  577. // 选择来源渠道
  578. const changeChannel = (val: any) => {
  579. state.ruleForm.fromPhone = null;
  580. state.ruleForm.sourceChannel = val?.dicDataName ?? null;
  581. state.ruleForm.sourceChannelCode = val?.dicDataValue ?? null;
  582. if (route.query.fromTel) {
  583. state.ruleForm.fromPhone = route.query.fromTel;
  584. } else {
  585. ruleFormRef.value.resetFields('fromPhone'); // 清除来电号码
  586. }
  587. const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '7'); // 110
  588. if (['110', 'YB110'].includes(val?.dicDataValue)) {
  589. // 如果来源渠道选择了110 推送分类联动选择110
  590. state.ruleForm.orderPushTypes.push(item);
  591. } else {
  592. // 清除110选择
  593. state.ruleForm.orderPushTypes = state.ruleForm.orderPushTypes.filter((item: any) => item.dicDataValue !== '7');
  594. }
  595. };
  596. // 选择证件类型
  597. /*const changeLicenceType = (val: any) => {
  598. state.ruleForm.licenceType = val?.dicDataName ?? null;
  599. state.ruleForm.licenceTypeCode = val?.dicDataValue ?? null;
  600. };*/
  601. // 选择受理类型
  602. const changeAcceptType = (val: any) => {
  603. state.ruleForm.acceptType = val?.dicDataName ?? null;
  604. state.ruleForm.acceptTypeCode = val?.dicDataValue ?? null;
  605. };
  606. // 选择工单标签
  607. const changeOrderTag = (val: any) => {
  608. state.ruleForm.orderTag = val?.dicDataName ?? null;
  609. state.ruleForm.orderTagCode = val?.dicDataValue ?? null;
  610. };
  611. // 选择是否市州互转
  612. const changeTransPond = (val: any) => {
  613. if (!val) {
  614. ElMessageBox.confirm(`确认要清除选择的互转市州?`, '提示', {
  615. confirmButtonText: '确认',
  616. cancelButtonText: '取消',
  617. type: 'warning',
  618. draggable: true,
  619. cancelButtonClass: 'default-button',
  620. autofocus: false,
  621. })
  622. .then(() => {
  623. setTimeout(() => {
  624. state.ruleForm.transpondCityValue = null;
  625. state.ruleForm.transpondCityName = null;
  626. state.ruleForm.transpondCityId = null;
  627. state.ruleForm.transpondCityObj = null;
  628. }, 0);
  629. })
  630. .catch(() => {
  631. state.ruleForm.transpond = true;
  632. });
  633. }
  634. };
  635. // 选择市州互转
  636. const changeTranspondCity = (val: any) => {
  637. state.ruleForm.transpondCityId = val?.id ?? null;
  638. state.ruleForm.transpondCityValue = val?.dicDataValue ?? null;
  639. state.ruleForm.transpondCityName = val?.dicDataName ?? null;
  640. };
  641. // 选择热点分类
  642. const knowledgeRef = ref<RefType>();
  643. const chooseHotSpot = (val: any, node: any, externalArr: any) => {
  644. state.ruleForm.hotspotSpliceName = val?.hotSpotFullName; // 热点分类拼接名称
  645. state.ruleForm.hotspotName = val?.hotSpotName; // 热点分类名称
  646. state.ruleForm.hotspotCode = val?.provinceCode; // 热点分类code
  647. state.ruleForm.hotspotExternal = externalArr?.join(',') ?? ''; // 热点分类默认展开项
  648. rightActive.value = 'knowledge';
  649. knowledgeRef.value.querySearch(state.ruleForm.hotspotName);
  650. const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '2'); // 交通运输厅
  651. if (val?.trunkNum === '12328') {
  652. // 选择了交通热点需要推送分类关联上交通
  653. // 去重
  654. if (state.ruleForm.orderPushTypes.includes(item)) return;
  655. state.ruleForm.orderPushTypes.push(item);
  656. } else {
  657. // 如果选择其他需要清除
  658. state.ruleForm.orderPushTypes = state.ruleForm.orderPushTypes.filter((item: any) => item.dicDataValue !== '2');
  659. }
  660. };
  661. // 获取事发地址
  662. const areaRef = ref<RefType>();
  663. const changeArea = () => {
  664. const currentNode = areaRef.value.getCheckedNodes();
  665. // 判断数组长度
  666. if (currentNode[0].pathLabels.length <= 4) {
  667. state.ruleForm.city = currentNode[0].pathLabels[0] ?? ''; // 市
  668. state.ruleForm.county = currentNode[0].pathLabels[1] ?? ''; // 区
  669. state.ruleForm.town = currentNode[0].pathLabels[2] ?? ''; // 地区
  670. } else {
  671. // 如果数组长度大于4
  672. state.ruleForm.city = currentNode[0].pathLabels[0] ?? ''; // 市
  673. state.ruleForm.county = currentNode[0].pathLabels[1] ?? ''; // 区
  674. state.ruleForm.town = currentNode[0].pathLabels[2] ?? ''; // 地区
  675. state.ruleForm.areaText = currentNode[0].pathLabels.slice(3).join('') ?? ''; // 地区
  676. console.log(state.ruleForm.areaText);
  677. }
  678. };
  679. // 根据热点和事发地址去查询重复性事件 是否展示重复性事件
  680. const repeatEventRef = ref<RefType>();
  681. const showRepeatEvent = ref<boolean>(false);
  682. const stopWatch = watch([() => state.ruleForm.hotspotSpliceName, () => state.ruleForm.address], (value) => {
  683. if (value[0] && value[1]) {
  684. orderRepeatEvent({ hotspotSpliceName: value[0], address: value[1] }).then((res: any) => {
  685. if (res.result) {
  686. showRepeatEvent.value = true;
  687. repeatEventRef.value.queryList();
  688. } else {
  689. showRepeatEvent.value = false;
  690. }
  691. });
  692. } else {
  693. showRepeatEvent.value = false;
  694. }
  695. });
  696. stopWatch();
  697. // 地图选点
  698. const mapDialogRef = ref<RefType>();
  699. const selectLocation = () => {
  700. const location = {
  701. longitude: state.ruleForm.longitude,
  702. latitude: state.ruleForm.latitude,
  703. adcode: state.ruleForm.areaCode,
  704. formattedAddress: state.ruleForm.street,
  705. };
  706. mapDialogRef.value.openDialog(location);
  707. };
  708. // 地图选点
  709. const ruleFormRef = ref<RefType>();
  710. const selectMap = (location: any) => {
  711. ruleFormRef.value.resetFields('areaCode');
  712. state.ruleForm.longitude = location.longitude;
  713. state.ruleForm.latitude = location.latitude;
  714. state.ruleForm.areaCode = location.adcode;
  715. state.ruleForm.street = location.formattedAddress;
  716. state.ruleForm.address = location.formattedAddress;
  717. };
  718. // 将当前工单添加到重复性事件中
  719. const repeatableEventDetails = ref<EmptyArrayType>([]);
  720. const orderAddRepeat = (row: any) => {
  721. if (route.query.id) {
  722. //编辑
  723. if (row.isDeleted) {
  724. //如果是添加
  725. repeatableEventDetails.value.push({
  726. repeatableId: row.id,
  727. isDeleted: false,
  728. });
  729. repeatableEventDetails.value = removeDuplicate([...repeatableEventDetails.value, ...state.ruleForm.repeatableEventDetails], 'repeatableId');
  730. } else {
  731. // 移除
  732. repeatableEventDetails.value = removeDuplicate([...repeatableEventDetails.value, ...state.ruleForm.repeatableEventDetails], 'repeatableId');
  733. repeatableEventDetails.value = repeatableEventDetails.value.map((item: any) => {
  734. if (item.repeatableId === row.id) {
  735. return {
  736. ...item,
  737. isDeleted: !item.isDeleted,
  738. };
  739. }
  740. return item;
  741. });
  742. }
  743. } else {
  744. // 添加
  745. if (row.isDeleted) {
  746. //如果是添加
  747. repeatableEventDetails.value.push({
  748. repeatableId: row.id,
  749. });
  750. repeatableEventDetails.value = removeDuplicate(repeatableEventDetails.value, 'repeatableId');
  751. } else {
  752. // 移除
  753. repeatableEventDetails.value = repeatableEventDetails.value.filter((item: any) => item.repeatableId !== row.id);
  754. }
  755. }
  756. };
  757. // 查看重复事件
  758. const onRepeatEvent = () => {
  759. rightActive.value = 'repeat';
  760. };
  761. // 选择是否重复
  762. const isRepeatChange = (val: string) => {
  763. if (val === 'false') clearRepeat();
  764. };
  765. // 清除重复件
  766. const clearRepeat = () => {
  767. ElMessageBox.confirm(`确认要清除选择的重复工单?`, '提示', {
  768. confirmButtonText: '确认',
  769. cancelButtonText: '取消',
  770. type: 'warning',
  771. draggable: true,
  772. cancelButtonClass: 'default-button',
  773. autofocus: false,
  774. })
  775. .then(() => {
  776. orderRepeatSelectRef.value.clearSelection();
  777. setTimeout(() => {
  778. state.ruleForm.duplicateTitle = null;
  779. state.ruleForm.duplicateIds = [];
  780. }, 0);
  781. })
  782. .catch(() => {
  783. state.ruleForm.isRepeat = 'true';
  784. });
  785. };
  786. // 选择重复件
  787. const orderRepeatSelectRef = ref<RefType>();
  788. const selectRepeat = () => {
  789. orderRepeatSelectRef.value.openDialog(state.ruleForm);
  790. };
  791. // 确定选择重复工单
  792. const orderRepeatSuccess = (row: any) => {
  793. state.ruleForm.duplicateIds = row.map((item: any) => item.id);
  794. state.ruleForm.duplicateTitle = '已选择';
  795. orderRepeatSelectRef.value.closeDialog();
  796. };
  797. const historyOrderRef = ref<RefType>(); // 历史工单组件
  798. const citizenPortraitRef = ref<RefType>(); // 市民画像组件
  799. // 查询历史工单 和市民画像
  800. const searchHistory = () => {
  801. historyOrderRef.value.searchHistory();
  802. citizenPortraitRef.value.getCitizen();
  803. rightActive.value = 'draw';
  804. };
  805. // 填写来电人姓名时根据填写内容自动选择性别
  806. const inputName = (val: string) => {
  807. if (val.includes('先生')) {
  808. state.ruleForm.fromGender = 1;
  809. } else if (val.includes('女士')) {
  810. state.ruleForm.fromGender = 0;
  811. }
  812. };
  813. // 填写标题时根据填写内容自动选择受理类型
  814. const inputTitle = (val: string) => {
  815. if (!state.ruleForm.acceptType) {
  816. const item = state.acceptTypeOptions.find((item: any) => item.dicDataName === val);
  817. if (item) {
  818. state.ruleForm.acceptTypeObj = item;
  819. state.ruleForm.acceptType = item.dicDataName;
  820. state.ruleForm.acceptTypeCode = item.dicDataValue;
  821. }
  822. }
  823. };
  824. const rightActive = ref<string>('history'); // 右侧顶部Tab
  825. const handleRight = () => {};
  826. const rightBottomActive = ref<string>('knowledge'); // 右侧底部Tab
  827. const handleRightBottom = () => {};
  828. // 打开拓展表单
  829. const ExpandFormRef = ref<RefType>();
  830. const showExpandForm = () => {
  831. ExpandFormRef.value.openDialog();
  832. };
  833. // 拓展表单保存
  834. const saveExpandForm = (val: any) => {
  835. state.ruleForm.orderExtension = val;
  836. };
  837. // 选择重点关注事项
  838. const changeFocusEvent = (val: string[]) => {
  839. state.ruleForm.isUrgent = val.includes('0'); // 是否紧急工单
  840. state.ruleForm.isFormalistWorkOrder = val.includes('1'); // 是否形式主义工单
  841. state.ruleForm.isSensitiveWorkOrders = val.includes('3'); // 是否敏感类工单
  842. state.ruleForm.isEnforcementOrder = val.includes('2'); // 是否行政执法类工单
  843. state.ruleForm.is24HoursComplete = val.includes('4'); // 24小时紧急工单
  844. state.ruleForm.acceptSms = val.includes('5'); // 受理短信
  845. state.ruleForm.isThreePartyConference = val.includes('6'); // 三方通话
  846. state.ruleForm.focusOnEvents = val.join(',');
  847. console.log(
  848. `是否紧急工单:${val.includes('0')},是否行政执法类类工单:${val.includes('2')},是否形式主义工单:${val.includes('1')},是否敏感类工单:${val.includes(
  849. '3'
  850. )},是否24小时紧急工单:${val.includes('4')},是否受理短信:${val.includes('5')},是否三方通话:${val.includes('6')}`
  851. );
  852. };
  853. // 删除不必要的属性
  854. const deleteUnnecessaryProperties = (obj: any) => {
  855. const propertiesToDelete = ['ageRangeObj', 'licenceTypeObj', 'channel', 'acceptTypeObj', 'transpondCity', 'orderTagObj'];
  856. propertiesToDelete.forEach((prop) => Reflect.deleteProperty(obj, prop));
  857. };
  858. const filesFormat = ref<EmptyArrayType>([]); // 附件列表格式化
  859. // 是否打开拓展表单
  860. const shouldOpenDialog = (obj: any) =>
  861. !ExpandFormRef.value.state.validated &&
  862. obj.orderExtension &&
  863. obj.orderExtension.orderTypeCode &&
  864. ['scjgjts,scjgjjb'].includes(obj.orderExtension.orderTypeCode);
  865. const buttonLoading = ref<boolean>(false);
  866. const isSaveSuccess = ref<boolean>(false); // 是否保存成功 保存成功后才展示办理按钮
  867. // 检测表单数据是否有变化
  868. const watchPauseAbleFn = watchPausable(
  869. state.ruleForm,
  870. () => {
  871. isSaveSuccess.value = false; // 工单编辑后重新展示保存按钮
  872. },
  873. { deep: true }
  874. );
  875. watchPauseAbleFn.pause();
  876. // 保存
  877. const save = throttle((formEl: FormInstance | undefined) => {
  878. if (!formEl) return;
  879. formEl.validate((valid: boolean) => {
  880. if (!valid) return;
  881. buttonLoading.value = true;
  882. let orderDetail = {
  883. ...state.ruleForm,
  884. repeatableEventDetails: repeatableEventDetails.value,
  885. files: filesFormat.value,
  886. };
  887. deleteUnnecessaryProperties(orderDetail);
  888. const operation = state.ruleForm.id ? orderEdit : orderAdd;
  889. const addOrderAndNavigate = () => {
  890. operation(orderDetail)
  891. .then((res: any) => {
  892. buttonLoading.value = false;
  893. ElMessage.success('保存成功');
  894. if (res.result) {
  895. const { id, no, password } = res.result;
  896. state.ruleForm.id = id;
  897. state.ruleForm.no = no;
  898. state.ruleForm.password = password;
  899. }
  900. isSaveSuccess.value = true;
  901. setTimeout(() => {
  902. watchPauseAbleFn.resume();
  903. }, 300);
  904. })
  905. .catch(() => {
  906. buttonLoading.value = false;
  907. });
  908. };
  909. if (shouldOpenDialog(orderDetail)) {
  910. ExpandFormRef.value.openDialog(true);
  911. } else {
  912. addOrderAndNavigate();
  913. }
  914. });
  915. }, 300);
  916. // 选择来点人身份如果是企业 推送分类自动选择助企纾困
  917. const selectIdentity = (val: number) => {
  918. if (val === 2) {
  919. const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '8'); // 助企纾困
  920. // 如果已经选择了助企纾困就不添加
  921. if (item) {
  922. if (state.ruleForm.orderPushTypes.includes(item)) return;
  923. state.ruleForm.orderPushTypes.push(item);
  924. }
  925. } else {
  926. // 如果选择其他需要清除
  927. state.ruleForm.orderPushTypes = state.ruleForm.orderPushTypes.filter((item: any) => item.dicDataValue !== '8');
  928. }
  929. };
  930. // 是否可以办理(如果有流程id 并且当前账号可以办理 则可以办理 没有流程ID都可以办理)
  931. const canHandle = computed(() => {
  932. if (!state.ruleForm?.workflowId) {
  933. // 没有流程ID表示发起流程
  934. return true;
  935. } else {
  936. // 有流程ID表示已经发起流程 判断当前账号是否可以办理
  937. return state.ruleForm?.canHandle;
  938. }
  939. });
  940. // 流程审批
  941. const processAuditRef = ref<RefType>();
  942. const zgProcessRef = ref<RefType>();
  943. const processOrder = (orderDetail: any, isAgent = false) => {
  944. buttonLoading.value = false;
  945. if (isAgent) {
  946. // 代办
  947. const params = {
  948. id: orderDetail.workflowId,
  949. processType: '工单代办',
  950. orderDetail,
  951. extra: {
  952. dialogTitle: '工单代办',
  953. inputPlaceholder: '办理意见',
  954. annexName: '办理附件',
  955. },
  956. };
  957. zgProcessRef.value.openDialog(params);
  958. } else {
  959. if (orderDetail.workflowId) {
  960. // 如果已经有流程id 说明已经发起过流程 先更新工单数据 直接调用工单办理
  961. orderEdit(orderDetail).then(() => {
  962. const params = {
  963. id: orderDetail.workflowId,
  964. processType: '工单办理',
  965. orderDetail,
  966. extra: {
  967. dialogTitle: '工单办理',
  968. inputPlaceholder: '办理意见',
  969. annexName: '办理附件',
  970. },
  971. };
  972. zgProcessRef.value.openDialog(params);
  973. });
  974. } else {
  975. // 如果没有流程id 说明没有发起过流程 调用工单受理
  976. const params = {
  977. id: '',
  978. processType: '工单受理',
  979. extra: {
  980. dialogTitle: '工单受理',
  981. inputPlaceholder: '办理意见',
  982. annexName: '办理附件',
  983. },
  984. orderDetail,
  985. };
  986. zgProcessRef.value.openDialog(params);
  987. }
  988. }
  989. };
  990. const handleForm = (orderDetail: any, isAgent = false) => {
  991. if (orderDetail.orderExtension?.orderTypeCode) {
  992. if (ExpandFormRef.value.state.validated) {
  993. processOrder(orderDetail, isAgent);
  994. } else {
  995. ExpandFormRef.value.openDialog(true);
  996. buttonLoading.value = false;
  997. }
  998. } else {
  999. processOrder(orderDetail, isAgent);
  1000. }
  1001. };
  1002. // 提交
  1003. const submit = throttle((formEl: FormInstance | undefined) => {
  1004. if (!formEl) return;
  1005. formEl.validate((valid: boolean) => {
  1006. if (!valid) return;
  1007. buttonLoading.value = true;
  1008. const orderDetail = {
  1009. ...state.ruleForm,
  1010. repeatableEventDetails: repeatableEventDetails.value,
  1011. files: filesFormat.value,
  1012. };
  1013. deleteUnnecessaryProperties(orderDetail);
  1014. handleForm(orderDetail);
  1015. });
  1016. }, 300);
  1017. // 代办
  1018. const agentHandle = throttle((formEl: FormInstance | undefined) => {
  1019. if (!formEl) return;
  1020. formEl.validate((valid: boolean) => {
  1021. if (!valid) return;
  1022. buttonLoading.value = true;
  1023. const orderDetail = {
  1024. ...state.ruleForm,
  1025. repeatableEventDetails: repeatableEventDetails.value,
  1026. files: filesFormat.value,
  1027. };
  1028. deleteUnnecessaryProperties(orderDetail);
  1029. handleForm(orderDetail, true);
  1030. });
  1031. }, 300);
  1032. // 选中常用意见
  1033. const chooseAdvice = (item: any) => {
  1034. state.ruleForm.content += item.content;
  1035. };
  1036. // 取消并关闭当前页
  1037. const onCancel = () => {
  1038. mittBus.emit('clearCache', 'todoSeats');
  1039. mittBus.emit('clearCachePage', ['order', 'todoOrder', 'todoCenter', 'callLog']);
  1040. // 关闭当前 tagsView
  1041. if (state.ruleForm.callId) {
  1042. const currentRoute = state.tagsViewList.find((v: any) => v.query?.callId === state.ruleForm.callId);
  1043. if (currentRoute) {
  1044. // 检测到有callId 并且当前tab页面里面有对应的 就关闭它
  1045. mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...currentRoute }));
  1046. } else {
  1047. mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...route }));
  1048. }
  1049. } else {
  1050. mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...route }));
  1051. }
  1052. };
  1053. // 加载基础数据
  1054. const loadBaseData = async () => {
  1055. try {
  1056. const { result } = await orderBaseDataAdd();
  1057. state.acceptTypeOptions = result?.acceptTypeOptions ?? [];
  1058. state.channelOptions = result?.channelOptions ?? [];
  1059. state.genderOptions = result?.genderOptions ?? [];
  1060. state.identityTypeOptions = result?.identityTypeOptions ?? [];
  1061. orderTypeOptions.value = result?.orderTypeOptions ?? [];
  1062. state.pushTypeOptions = result?.pushTypeOptions ?? [];
  1063. state.licenceTypeOptions = result?.licenceTypeOptions ?? [];
  1064. state.transpondCity = result?.transpondCity ?? [];
  1065. state.focusOnEvents = result?.focusOnEvents ?? [];
  1066. state.orderTags = result?.orderTags ?? [];
  1067. state.pushTypeOptions = state.pushTypeOptions.map((item: any) => {
  1068. return {
  1069. ...item,
  1070. pushTypeCode: item.dicDataValue,
  1071. pushType: item.dicDataName,
  1072. };
  1073. });
  1074. } catch (error) {
  1075. console.log(error);
  1076. }
  1077. };
  1078. // 如果是修改加载表单内容
  1079. const loadForm = async () => {
  1080. state.formLoading = true;
  1081. try {
  1082. if (route.query.createBy) {
  1083. // route.query.createBy createBy 代表来源 tel:来电弹单 letter:互联网来信 默认表示手动创建
  1084. state.createBy = route.query.createBy;
  1085. if (route.query.createBy === 'tel') {
  1086. //通话
  1087. state.ruleForm.sourceChannel = '电话'; //电话
  1088. state.ruleForm.sourceChannelCode = 'RGDH'; //电话
  1089. state.ruleForm.fromPhone = route.query.fromTel; // 来电号码
  1090. state.ruleForm.contact = route.query.fromTel; // 联系电话
  1091. state.ruleForm.callId = route.query.callId; // 通话id
  1092. state.ruleForm.transferPhone = route.query.transfer; // 转接来源
  1093. state.ruleForm.channel = {
  1094. // 来源渠道
  1095. dicDataValue: state.ruleForm.sourceChannelCode,
  1096. dicDataName: state.ruleForm.sourceChannel,
  1097. };
  1098. const isNumberIdentityType = parseInt(<string>route.query.identityType);
  1099. if ([1, 2].includes(isNumberIdentityType)) {
  1100. // 按键接收(1:市民 2:企业 3:智能应答) 默认企业
  1101. state.ruleForm.identityType = isNumberIdentityType;
  1102. } else {
  1103. state.ruleForm.identityType = 2;
  1104. }
  1105. }
  1106. }
  1107. if (route.query.id) {
  1108. // 如果 有id
  1109. state.ruleForm.id = route.query.id;
  1110. const response = await orderDetail(route.query.id);
  1111. // 如果获取到id 调用查询详情
  1112. state.ruleForm = Object.assign(state.ruleForm, response.result);
  1113. state.ruleForm.files = transformFile(response.result.files);
  1114. if (response.result.duplicateIds && response.result.duplicateIds.length) {
  1115. // 是否重复
  1116. state.ruleForm.isRepeat = 'true';
  1117. state.ruleForm.duplicateTitle = '已选择';
  1118. } else {
  1119. state.ruleForm.isRepeat = 'false';
  1120. }
  1121. if (state.ruleForm.focusOnEvents) {
  1122. // 重点关注事项
  1123. state.ruleForm.focusOnEventsArr = response.result.focusOnEvents.split(',');
  1124. }
  1125. if (state.ruleForm.sourceChannelCode) {
  1126. state.ruleForm.channel = {
  1127. // 来源渠道
  1128. dicDataValue: state.ruleForm.sourceChannelCode,
  1129. dicDataName: state.ruleForm.sourceChannel,
  1130. };
  1131. }
  1132. if (state.ruleForm.hotspotExternal) {
  1133. //热点分类默认展开
  1134. state.hotspotExternal = state.ruleForm.hotspotExternal.split(',');
  1135. }
  1136. if (state.ruleForm.eventCategoryExternal) {
  1137. //热点分类默认展开
  1138. state.eventCategoryExternal = state.ruleForm.eventCategoryExternal.split(',');
  1139. }
  1140. if (state.ruleForm.licenceTypeCode) {
  1141. state.ruleForm.licenceTypeObj = {
  1142. // 证件类型
  1143. dicDataValue: state.ruleForm.licenceTypeCode,
  1144. dicDataName: state.ruleForm.licenceType,
  1145. };
  1146. }
  1147. if (!state.ruleForm.acceptType) {
  1148. // 外部输入数据没有受理名称和热点名称 需要根据code调用一次change事件获取
  1149. const currentAcceptType = state.acceptTypeOptions.find((item: any) => {
  1150. return item.dicDataValue === state.ruleForm.acceptTypeCode;
  1151. });
  1152. state.ruleForm.acceptType = currentAcceptType?.dicDataName ?? '';
  1153. }
  1154. if (state.ruleForm.acceptTypeCode) {
  1155. state.ruleForm.acceptTypeObj = {
  1156. // 受理类型
  1157. dicDataValue: state.ruleForm.acceptTypeCode,
  1158. dicDataName: state.ruleForm.acceptType,
  1159. };
  1160. }
  1161. if (state.ruleForm.orderTagCode) {
  1162. state.ruleForm.orderTagObj = {
  1163. // 工单标签
  1164. dicDataValue: state.ruleForm.orderTagCode,
  1165. dicDataName: state.ruleForm.orderTag,
  1166. };
  1167. }
  1168. if (state.ruleForm.transpondCityValue) {
  1169. state.ruleForm.transpondCityObj = {
  1170. // 市州互转
  1171. dicDataValue: state.ruleForm.transpondCityValue,
  1172. dicDataName: state.ruleForm.transpondCityName,
  1173. };
  1174. }
  1175. isSaveSuccess.value = true; // 如果是修改进入 可以直接办理
  1176. setTimeout(() => {
  1177. watchPauseAbleFn.resume();
  1178. }, 300);
  1179. state.formLoading = false;
  1180. } else {
  1181. state.formLoading = false;
  1182. }
  1183. } catch (e) {
  1184. state.formLoading = false;
  1185. }
  1186. };
  1187. // 加载省市区
  1188. const addressLoading = ref<boolean>(false);
  1189. const loadAddress = async () => {
  1190. addressLoading.value = true;
  1191. try {
  1192. const area = await treeArea();
  1193. state.areaOptions = area.result ?? []; //省市区数据
  1194. addressLoading.value = false;
  1195. } catch (error) {
  1196. console.log(error);
  1197. } finally {
  1198. addressLoading.value = false;
  1199. }
  1200. };
  1201. // 加载扩展信息
  1202. const orderTypeOptions = ref<EmptyObjectType>([]); // 工单类型
  1203. // 拓展信息
  1204. const extra = ref<any>({
  1205. ext: {},
  1206. area: {},
  1207. orderTypeOptions: [],
  1208. });
  1209. const extraLoading = ref<boolean>(false);
  1210. const loadExtra = async () => {
  1211. extraLoading.value = true;
  1212. try {
  1213. const ext = await orderBaseExt(); // 扩展信息
  1214. extra.value = { ext: { ...ext.result, orderTypeOptions: orderTypeOptions.value, area: state.areaOptions } }; //补充信息
  1215. } catch (error) {
  1216. console.log(error);
  1217. } finally {
  1218. extraLoading.value = false;
  1219. }
  1220. };
  1221. // 外部输入数据没有受理名称和热点名称 赋值名称
  1222. const getCurrentData = (val: any) => {
  1223. if (state.ruleForm.id || state.ruleForm.no) {
  1224. if (!state.ruleForm.hotspotName || !state.ruleForm.hotspotSpliceName) {
  1225. state.ruleForm.hotspotName = val?.data?.hotSpotName;
  1226. state.ruleForm.hotspotSpliceName = val?.data?.hotSpotFullName;
  1227. state.ruleForm.hotspotCode = val?.data?.provinceCode;
  1228. }
  1229. }
  1230. };
  1231. loadBaseData();
  1232. loadAddress();
  1233. loadExtra();
  1234. const handleBeforeUnload = (event: Event) => {
  1235. event.preventDefault();
  1236. };
  1237. onMounted(async () => {
  1238. await loadForm();
  1239. state.tagsViewList = await Session.get('tagsViewList');
  1240. window.addEventListener('beforeunload', handleBeforeUnload);
  1241. });
  1242. onUnmounted(() => {
  1243. window.removeEventListener('beforeunload', handleBeforeUnload);
  1244. });
  1245. </script>