lzAccept.vue 52 KB

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