zgAccept.vue 55 KB

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