zgAccept.vue 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400
  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. eventCategoryId: null, // 事件分类
  504. incidentTime: null, // 事发时间
  505. incidentPurpose: null, // 事件目的
  506. areaCode: themeConfig.value.cityCode, // 区域编码
  507. city: themeConfig.value.cityName, // 市
  508. street: null, // 街道
  509. isRepeat: 'false', // 是否重复工单 默认否
  510. pushType: null, // 推送类型
  511. pushTypeCode: null, // 推送类型code
  512. content: '', // 工单内容
  513. duplicateIds: [], //重复工单id
  514. duplicateTitle: null, // 重复工单标题
  515. callAddress: null, // 来电归属地
  516. repeatableEventDetails: [], //重复性事件
  517. orderExtension: null, // 拓展信息
  518. transpond: false, // 是否市州互转
  519. isEnforcementOrder: false, // 是否行政执法工单
  520. focusOnEventsArr: [], // 重点关注事项
  521. focusOnEvents: null, // 重点关注事项 字符串
  522. isFormalistWorkOrder: false, // 是否形式主义工单
  523. isSensitiveWorkOrders: false, // 是否敏感类工单
  524. isUrgent: false, // 是否紧急工单
  525. isThreePartyConference: false, // 是否三方同v话
  526. is24HoursComplete: false, // 24小时紧急工单
  527. company: null, // 工作单位
  528. orderPushTypes: [], // 推送分类多选
  529. acceptType: '咨询', // 受理类型
  530. acceptTypeCode: '10', // 受理类型code
  531. acceptTypeObj: {
  532. // 默认咨询
  533. dicDataValue: '10',
  534. dicDataName: '咨询',
  535. },
  536. industryId: null, // 行业分类
  537. industryName: null, // 行业分类名称
  538. knowledgeQuote: [], // 知识库引用
  539. tags: [], // 工单标签
  540. longitude:null,//经度
  541. latitude:null,//纬度
  542. },
  543. formLoading: false, // 表单加载状态
  544. hotspotExternal: [], // 热点分类外部数据
  545. eventCategoryExternal: [], // 事件分类外部数据
  546. acceptTypeOptions: [], // 受理类型
  547. channelOptions: [], // 来源频道
  548. genderOptions: [], // 性别
  549. identityTypeOptions: [], //来电主体
  550. licenceTypeOptions: [], // 证件类型
  551. ageRangeOptions: [], // 年龄段
  552. pushTypeOptions: [], //推送分类
  553. areaOptions: [], //省市区
  554. orderTags: [], // 工单标签
  555. transpondCity: [],
  556. industryOptions: [], // 行业分类
  557. repeatOptions: [
  558. //是否重复
  559. {
  560. value: '是',
  561. key: 'true',
  562. },
  563. {
  564. value: '否',
  565. key: 'false',
  566. },
  567. ],
  568. focusOnEvents: [], // 重点关注事项
  569. orderId: null, // 工单id
  570. tagsViewList: [],
  571. });
  572. const storesUserInfo = useUserInfo(); // 用户信息
  573. const { userInfos } = storeToRefs(storesUserInfo); // 用户信息
  574. const appConfigStore = useAppConfig();
  575. const { AppConfigInfo } = storeToRefs(appConfigStore); // 系统配置信息
  576. state.ruleForm.acceptorName = userInfos.value.name; // 员工姓名
  577. state.ruleForm.acceptorStaffNo = userInfos.value.staffNo; // 员工工号
  578. state.ruleForm.longitude = AppConfigInfo.value.locationCenter[0]; // 默认经度
  579. state.ruleForm.latitude = AppConfigInfo.value.locationCenter[1]; // 默认纬度
  580. const route = useRoute(); // 路由
  581. // 选择来源渠道
  582. const changeChannel = (val: any) => {
  583. state.ruleForm.fromPhone = null;
  584. state.ruleForm.sourceChannel = val?.dicDataName ?? null;
  585. state.ruleForm.sourceChannelCode = val?.dicDataValue ?? null;
  586. if (route.query.fromTel) {
  587. state.ruleForm.fromPhone = route.query.fromTel;
  588. } else {
  589. ruleFormRef.value.resetFields('fromPhone'); // 清除来电号码
  590. }
  591. const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '7'); // 110
  592. if (['110', 'YB110'].includes(val?.dicDataValue)) {
  593. // 如果来源渠道选择了110 推送分类联动选择110
  594. state.ruleForm.orderPushTypes.push(item);
  595. } else {
  596. // 清除110选择
  597. state.ruleForm.orderPushTypes = state.ruleForm.orderPushTypes.filter((item: any) => item.dicDataValue !== '7');
  598. }
  599. };
  600. // 选择证件类型
  601. /*const changeLicenceType = (val: any) => {
  602. state.ruleForm.licenceType = val?.dicDataName ?? null;
  603. state.ruleForm.licenceTypeCode = val?.dicDataValue ?? null;
  604. };*/
  605. // 选择受理类型
  606. const changeAcceptType = (val: any) => {
  607. state.ruleForm.acceptType = val?.dicDataName ?? null;
  608. state.ruleForm.acceptTypeCode = val?.dicDataValue ?? null;
  609. };
  610. // 选择行业类型
  611. const changeIndustry = (val: any) => {
  612. state.ruleForm.industryId = val?.id ?? null;
  613. state.ruleForm.industryName = val?.name ?? null;
  614. };
  615. // 选择是否市州互转
  616. const changeTransPond = (val: any) => {
  617. if (!val) {
  618. ElMessageBox.confirm(`确认要清除选择的互转市州?`, '提示', {
  619. confirmButtonText: '确认',
  620. cancelButtonText: '取消',
  621. type: 'warning',
  622. draggable: true,
  623. cancelButtonClass: 'default-button',
  624. autofocus: false,
  625. })
  626. .then(() => {
  627. setTimeout(() => {
  628. state.ruleForm.transpondCityValue = null;
  629. state.ruleForm.transpondCityName = null;
  630. state.ruleForm.transpondCityId = null;
  631. state.ruleForm.transpondCityObj = null;
  632. }, 100);
  633. })
  634. .catch(() => {
  635. state.ruleForm.transpond = true;
  636. });
  637. }
  638. };
  639. // 选择市州互转
  640. const changeTranspondCity = (val: any) => {
  641. state.ruleForm.transpondCityId = val?.id ?? null;
  642. state.ruleForm.transpondCityValue = val?.dicDataValue ?? null;
  643. state.ruleForm.transpondCityName = val?.dicDataName ?? null;
  644. };
  645. // 选择热点分类
  646. const knowledgeRef = ref<RefType>();
  647. const chooseHotSpot = (val: any, node: any, externalArr: any) => {
  648. state.ruleForm.hotspotSpliceName = val?.hotSpotFullName; // 热点分类拼接名称
  649. state.ruleForm.hotspotName = val?.hotSpotName; // 热点分类名称
  650. state.ruleForm.hotspotCode = val?.provinceCode; // 热点分类code
  651. state.ruleForm.hotspotExternal = externalArr?.join(',') ?? ''; // 热点分类默认展开项
  652. knowledgeRef.value.querySearch(state.ruleForm.hotspotName);
  653. const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '2'); // 交通运输厅
  654. if (val?.trunkNum === '12328') {
  655. // 选择了交通热点需要推送分类关联上交通
  656. // 去重
  657. if (state.ruleForm.orderPushTypes.includes(item)) return;
  658. state.ruleForm.orderPushTypes.push(item);
  659. } else {
  660. // 如果选择其他需要清除
  661. state.ruleForm.orderPushTypes = state.ruleForm.orderPushTypes.filter((item: any) => item.dicDataValue !== '2');
  662. }
  663. };
  664. // 获取事发地址
  665. const areaRef = ref<RefType>();
  666. const changeArea = () => {
  667. const currentNode = areaRef.value.getCheckedNodes();
  668. // 判断数组长度
  669. if (currentNode[0].pathLabels.length <= 4) {
  670. state.ruleForm.city = currentNode[0].pathLabels[0] ?? ''; // 市
  671. state.ruleForm.county = currentNode[0].pathLabels[1] ?? ''; // 区
  672. state.ruleForm.town = currentNode[0].pathLabels[2] ?? ''; // 乡镇
  673. } else {
  674. // 如果数组长度大于4
  675. state.ruleForm.city = currentNode[0].pathLabels[0] ?? ''; // 市
  676. state.ruleForm.county = currentNode[0].pathLabels[1] ?? ''; // 区
  677. state.ruleForm.town = currentNode[0].pathLabels[2] ?? ''; // 乡镇
  678. state.ruleForm.village = currentNode[0].pathLabels[3] ?? ''; // 村社区
  679. state.ruleForm.areaText = currentNode[0].pathLabels.slice(3).join('') ?? ''; // 地区
  680. console.log(state.ruleForm.areaText);
  681. }
  682. };
  683. // 根据热点和事发地址去查询重复性事件 是否展示重复性事件
  684. const repeatEventRef = ref<RefType>();
  685. const showRepeatEvent = ref<boolean>(false);
  686. const stopWatch = watch([() => state.ruleForm.hotspotSpliceName, () => state.ruleForm.address], (value) => {
  687. if (value[0] && value[1]) {
  688. orderRepeatEvent({ hotspotSpliceName: value[0], address: value[1] }).then((res: any) => {
  689. if (res.result) {
  690. showRepeatEvent.value = true;
  691. repeatEventRef.value.queryList();
  692. } else {
  693. showRepeatEvent.value = false;
  694. }
  695. });
  696. } else {
  697. showRepeatEvent.value = false;
  698. }
  699. });
  700. stopWatch();
  701. // 地图选点
  702. const mapDialogRef = ref<RefType>();
  703. const selectLocation = () => {
  704. const location = {
  705. longitude: state.ruleForm.longitude,
  706. latitude: state.ruleForm.latitude,
  707. adcode: state.ruleForm.areaCode,
  708. formattedAddress: state.ruleForm.street,
  709. };
  710. mapDialogRef.value.openDialog(location);
  711. };
  712. // 地图选点
  713. const ruleFormRef = ref<RefType>();
  714. const selectMap = (location: any) => {
  715. ruleFormRef.value.resetFields('areaCode');
  716. state.ruleForm.longitude = location.longitude;
  717. state.ruleForm.latitude = location.latitude;
  718. state.ruleForm.areaCode = location.adcode;
  719. state.ruleForm.street = location.formattedAddress;
  720. state.ruleForm.address = location.formattedAddress;
  721. };
  722. // 将当前工单添加到重复性事件中
  723. const repeatableEventDetails = ref<EmptyArrayType>([]);
  724. const orderAddRepeat = (row: any) => {
  725. if (route.query.id) {
  726. //编辑
  727. if (row.isDeleted) {
  728. //如果是添加
  729. repeatableEventDetails.value.push({
  730. repeatableId: row.id,
  731. isDeleted: false,
  732. });
  733. repeatableEventDetails.value = removeDuplicate([...repeatableEventDetails.value, ...state.ruleForm.repeatableEventDetails], 'repeatableId');
  734. } else {
  735. // 移除
  736. repeatableEventDetails.value = removeDuplicate([...repeatableEventDetails.value, ...state.ruleForm.repeatableEventDetails], 'repeatableId');
  737. repeatableEventDetails.value = repeatableEventDetails.value.map((item: any) => {
  738. if (item.repeatableId === row.id) {
  739. return {
  740. ...item,
  741. isDeleted: !item.isDeleted,
  742. };
  743. }
  744. return item;
  745. });
  746. }
  747. } else {
  748. // 添加
  749. if (row.isDeleted) {
  750. //如果是添加
  751. repeatableEventDetails.value.push({
  752. repeatableId: row.id,
  753. });
  754. repeatableEventDetails.value = removeDuplicate(repeatableEventDetails.value, 'repeatableId');
  755. } else {
  756. // 移除
  757. repeatableEventDetails.value = repeatableEventDetails.value.filter((item: any) => item.repeatableId !== row.id);
  758. }
  759. }
  760. };
  761. // 查看重复事件
  762. const onRepeatEvent = () => {
  763. rightActive.value = 'repeat';
  764. };
  765. // 选择是否重复
  766. const isRepeatChange = (val: string) => {
  767. if (val === 'false') clearRepeat();
  768. };
  769. // 清除重复件
  770. const clearRepeat = () => {
  771. ElMessageBox.confirm(`确认要清除选择的重复工单?`, '提示', {
  772. confirmButtonText: '确认',
  773. cancelButtonText: '取消',
  774. type: 'warning',
  775. draggable: true,
  776. cancelButtonClass: 'default-button',
  777. autofocus: false,
  778. })
  779. .then(() => {
  780. orderRepeatSelectRef.value.clearSelection();
  781. setTimeout(() => {
  782. state.ruleForm.duplicateTitle = null;
  783. state.ruleForm.duplicateIds = [];
  784. }, 100);
  785. })
  786. .catch(() => {
  787. state.ruleForm.isRepeat = 'true';
  788. });
  789. };
  790. // 选择重复件
  791. const orderRepeatSelectRef = ref<RefType>();
  792. const selectRepeat = () => {
  793. orderRepeatSelectRef.value.openDialog(state.ruleForm);
  794. };
  795. // 确定选择重复工单
  796. const orderRepeatSuccess = (row: any) => {
  797. state.ruleForm.duplicateIds = row.map((item: any) => item.id);
  798. state.ruleForm.duplicateTitle = '已选择';
  799. orderRepeatSelectRef.value.closeDialog();
  800. };
  801. const historyOrderRef = ref<RefType>(); // 历史工单组件
  802. const citizenPortraitRef = ref<RefType>(); // 市民画像组件
  803. // 查询历史工单 和市民画像
  804. const searchHistory = () => {
  805. historyOrderRef.value.searchHistory();
  806. citizenPortraitRef.value.getCitizen();
  807. rightActive.value = 'draw';
  808. };
  809. // 填写来电人姓名时根据填写内容自动选择性别
  810. const inputName = (val: string) => {
  811. if (val.includes('先生')) {
  812. state.ruleForm.fromGender = 1;
  813. } else if (val.includes('女士')) {
  814. state.ruleForm.fromGender = 0;
  815. }
  816. };
  817. // 填写标题时根据填写内容自动选择受理类型
  818. const inputTitle = (val: string) => {
  819. const item = state.acceptTypeOptions.find((item: any) => item.dicDataName === val);
  820. if (item) {
  821. state.ruleForm.acceptTypeObj = item;
  822. state.ruleForm.acceptType = item.dicDataName;
  823. state.ruleForm.acceptTypeCode = item.dicDataValue;
  824. }
  825. };
  826. const rightActive = ref<string>('history'); // 右侧顶部Tab
  827. const handleRight = () => {};
  828. const rightBottomActive = ref<string>('knowledge'); // 右侧底部Tab
  829. const handleRightBottom = () => {};
  830. // 打开拓展表单
  831. const ExpandFormRef = ref<RefType>();
  832. const showExpandForm = () => {
  833. ExpandFormRef.value.openDialog();
  834. };
  835. // 拓展表单保存
  836. const saveExpandForm = (val: any) => {
  837. state.ruleForm.orderExtension = val;
  838. };
  839. // 受理内容失去焦点查询知识库
  840. const blurContent = () => {
  841. if (state.ruleForm.content) {
  842. knowledgeRef.value.knowledgeRetrievalPaged();
  843. }
  844. };
  845. // 选择重点关注事项
  846. const changeFocusEvent = (val: string[]) => {
  847. state.ruleForm.isUrgent = val.includes('0'); // 是否紧急工单
  848. state.ruleForm.isFormalistWorkOrder = val.includes('1'); // 是否形式主义工单
  849. state.ruleForm.isSensitiveWorkOrders = val.includes('3'); // 是否敏感类工单
  850. state.ruleForm.isEnforcementOrder = val.includes('2'); // 是否行政执法类工单
  851. state.ruleForm.is24HoursComplete = val.includes('4'); // 24小时紧急工单
  852. state.ruleForm.acceptSms = val.includes('5'); // 受理短信
  853. state.ruleForm.isThreePartyConference = val.includes('6'); // 三方通话
  854. state.ruleForm.isSecret = val.includes('99'); // 是否保密
  855. state.ruleForm.focusOnEventsName = state.focusOnEvents
  856. .filter((item: any) => val.includes(item.dicDataValue))
  857. .map((item: any) => item.dicDataName)
  858. .join(',');
  859. if (state.ruleForm.sourceChannelCode === 'ZGSSP') {
  860. //如果 选择了自贡随手拍
  861. if (state.ruleForm.isSecret) {
  862. // 如果选择了保密 需要吧三方通话也选上
  863. state.ruleForm.isThreePartyConference = true;
  864. state.ruleForm.focusOnEventsArr = removeDuplicate([...state.ruleForm.focusOnEventsArr, '6']);
  865. }
  866. }
  867. state.ruleForm.focusOnEvents = state.ruleForm.focusOnEventsArr.join(','); // 获取值
  868. console.log(
  869. `是否紧急工单:${val.includes('0')},是否行政执法类类工单:${val.includes('2')},是否形式主义工单:${val.includes('1')},是否敏感类工单:${val.includes(
  870. '3'
  871. )},是否24小时紧急工单:${val.includes('4')},是否受理短信:${val.includes('5')},是否三方通话:${val.includes('6')},是否保密:${val.includes('99')}`
  872. );
  873. };
  874. // 删除不必要的属性
  875. const deleteUnnecessaryProperties = (obj: any) => {
  876. const propertiesToDelete = ['ageRangeObj', 'licenceTypeObj', 'channel', 'acceptTypeObj', 'transpondCity', 'industryObj'];
  877. propertiesToDelete.forEach((prop) => Reflect.deleteProperty(obj, prop));
  878. };
  879. const filesFormat = ref<EmptyArrayType>([]); // 附件列表格式化
  880. // 是否打开拓展表单
  881. const shouldOpenDialog = (obj: any) =>
  882. !ExpandFormRef.value.state.validated &&
  883. obj.orderExtension &&
  884. obj.orderExtension.orderTypeCode &&
  885. ['scjgjts,scjgjjb'].includes(obj.orderExtension.orderTypeCode);
  886. const buttonLoading = ref<boolean>(false);
  887. const isSaveSuccess = ref<boolean>(false); // 是否保存成功 保存成功后才展示办理按钮
  888. // 检测表单数据是否有变化
  889. const watchPauseAbleFn = watchPausable(
  890. state.ruleForm,
  891. () => {
  892. isSaveSuccess.value = false; // 工单编辑后重新展示保存按钮
  893. },
  894. { deep: true }
  895. );
  896. watchPauseAbleFn.pause();
  897. // 保存
  898. const save = throttle((formEl: FormInstance | undefined) => {
  899. if (!formEl) return;
  900. formEl.validate((valid: boolean) => {
  901. if (!valid) return;
  902. buttonLoading.value = true;
  903. let orderDetail = {
  904. ...state.ruleForm,
  905. repeatableEventDetails: repeatableEventDetails.value,
  906. files: filesFormat.value,
  907. };
  908. deleteUnnecessaryProperties(orderDetail);
  909. const operation = state.ruleForm.id ? orderEdit : orderAdd;
  910. const addOrderAndNavigate = () => {
  911. operation(orderDetail)
  912. .then((res: any) => {
  913. buttonLoading.value = false;
  914. ElMessage.success('保存成功');
  915. if (res.result) {
  916. const { id, no, password } = res.result;
  917. state.ruleForm.id = id;
  918. state.ruleForm.no = no;
  919. state.ruleForm.password = password;
  920. }
  921. isSaveSuccess.value = true;
  922. setTimeout(() => {
  923. watchPauseAbleFn.resume();
  924. }, 300);
  925. })
  926. .catch(() => {
  927. buttonLoading.value = false;
  928. });
  929. };
  930. if (shouldOpenDialog(orderDetail)) {
  931. ExpandFormRef.value.openDialog(true);
  932. } else {
  933. addOrderAndNavigate();
  934. }
  935. });
  936. }, 300);
  937. // 选择来点人身份如果是企业 推送分类自动选择助企纾困
  938. const selectIdentity = (val: number) => {
  939. if (val === 2) {
  940. const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '8'); // 助企纾困
  941. // 如果已经选择了助企纾困就不添加
  942. if (item) {
  943. if (state.ruleForm.orderPushTypes.includes(item)) return;
  944. state.ruleForm.orderPushTypes.push(item);
  945. }
  946. } else {
  947. // 如果选择其他需要清除
  948. state.ruleForm.orderPushTypes = state.ruleForm.orderPushTypes.filter((item: any) => item.dicDataValue !== '8');
  949. }
  950. };
  951. // 是否可以办理(如果有流程id 并且当前账号可以办理 则可以办理 没有流程ID都可以办理)
  952. const canHandle = computed(() => {
  953. if (!state.ruleForm?.workflowId) {
  954. // 没有流程ID表示发起流程
  955. return true;
  956. } else {
  957. // 有流程ID表示已经发起流程 判断当前账号是否可以办理
  958. return state.ruleForm?.canHandle;
  959. }
  960. });
  961. // 知识库引用
  962. const changeYYType = (data: any) => {
  963. state.ruleForm.knowledgeQuote = data;
  964. };
  965. // 流程审批
  966. const processAuditRef = ref<RefType>();
  967. const zgProcessRef = ref<RefType>();
  968. const lzProcessRef = ref<RefType>();
  969. const zgSspProcessRef = ref<RefType>();
  970. const processOrder = (orderDetail: any, isAgent = false) => {
  971. buttonLoading.value = false;
  972. if (['ZiGong'].includes(themeConfig.value.appScope)) {
  973. if (isAgent) {
  974. // 代办
  975. const params = {
  976. id: orderDetail.workflowId,
  977. processType: '工单代办',
  978. orderDetail,
  979. extra: {
  980. dialogTitle: '工单代办',
  981. inputPlaceholder: '办理意见',
  982. annexName: '办理附件',
  983. },
  984. };
  985. if (state.ruleForm.sourceChannelCode === 'ZGSSP') {
  986. // 随手拍工单办理
  987. zgSspProcessRef.value.openDialog(params);
  988. } else {
  989. zgProcessRef.value.openDialog(params);
  990. }
  991. } else {
  992. if (orderDetail.workflowId) {
  993. // 如果已经有流程id 说明已经发起过流程 先更新工单数据 直接调用工单办理
  994. orderEdit(orderDetail).then(() => {
  995. const params = {
  996. id: orderDetail.workflowId,
  997. processType: '工单办理',
  998. orderDetail,
  999. extra: {
  1000. dialogTitle: '工单办理',
  1001. inputPlaceholder: '办理意见',
  1002. annexName: '办理附件',
  1003. },
  1004. };
  1005. if (state.ruleForm.sourceChannelCode === 'ZGSSP') {
  1006. // 随手拍工单办理
  1007. zgSspProcessRef.value.openDialog(params);
  1008. } else {
  1009. zgProcessRef.value.openDialog(params);
  1010. }
  1011. });
  1012. } else {
  1013. // 如果没有流程id 说明没有发起过流程 调用工单受理
  1014. const params = {
  1015. id: '',
  1016. processType: '工单受理',
  1017. extra: {
  1018. dialogTitle: '工单受理',
  1019. inputPlaceholder: '办理意见',
  1020. annexName: '办理附件',
  1021. },
  1022. orderDetail,
  1023. };
  1024. if (state.ruleForm.sourceChannelCode === 'ZGSSP') {
  1025. // 随手拍工单办理
  1026. zgSspProcessRef.value.openDialog(params);
  1027. } else {
  1028. zgProcessRef.value.openDialog(params);
  1029. }
  1030. }
  1031. }
  1032. } else if (['LuZhou'].includes(themeConfig.value.appScope)) {
  1033. if (isAgent) {
  1034. // 代办
  1035. const params = {
  1036. id: orderDetail.workflowId,
  1037. processType: '工单代办',
  1038. orderDetail,
  1039. extra: {
  1040. dialogTitle: '工单代办',
  1041. inputPlaceholder: '办理意见',
  1042. annexName: '办理附件',
  1043. },
  1044. };
  1045. lzProcessRef.value.openDialog(params);
  1046. } else {
  1047. if (orderDetail.workflowId) {
  1048. // 如果已经有流程id 说明已经发起过流程 先更新工单数据 直接调用工单办理
  1049. orderEdit(orderDetail).then(() => {
  1050. const params = {
  1051. id: orderDetail.workflowId,
  1052. processType: '工单办理',
  1053. orderDetail,
  1054. extra: {
  1055. dialogTitle: '工单办理',
  1056. inputPlaceholder: '办理意见',
  1057. annexName: '办理附件',
  1058. },
  1059. };
  1060. lzProcessRef.value.openDialog(params);
  1061. });
  1062. } else {
  1063. // 如果没有流程id 说明没有发起过流程 调用工单受理
  1064. const params = {
  1065. id: '',
  1066. processType: '工单受理',
  1067. extra: {
  1068. dialogTitle: '工单受理',
  1069. inputPlaceholder: '办理意见',
  1070. annexName: '办理附件',
  1071. },
  1072. orderDetail,
  1073. };
  1074. lzProcessRef.value.openDialog(params);
  1075. }
  1076. }
  1077. }
  1078. };
  1079. const handleForm = (orderDetail: any, isAgent = false) => {
  1080. if (orderDetail.orderExtension?.orderTypeCode) {
  1081. if (ExpandFormRef.value.state.validated) {
  1082. processOrder(orderDetail, isAgent);
  1083. } else {
  1084. ExpandFormRef.value.openDialog(true);
  1085. buttonLoading.value = false;
  1086. }
  1087. } else {
  1088. processOrder(orderDetail, isAgent);
  1089. }
  1090. };
  1091. // 提交
  1092. const submit = throttle((formEl: FormInstance | undefined) => {
  1093. if (!formEl) return;
  1094. formEl.validate((valid: boolean) => {
  1095. if (!valid) return;
  1096. buttonLoading.value = true;
  1097. const orderDetail = {
  1098. ...state.ruleForm,
  1099. repeatableEventDetails: repeatableEventDetails.value,
  1100. files: filesFormat.value,
  1101. };
  1102. deleteUnnecessaryProperties(orderDetail);
  1103. handleForm(orderDetail);
  1104. });
  1105. }, 300);
  1106. // 代办
  1107. const agentHandle = throttle((formEl: FormInstance | undefined) => {
  1108. if (!formEl) return;
  1109. formEl.validate((valid: boolean) => {
  1110. if (!valid) return;
  1111. buttonLoading.value = true;
  1112. const orderDetail = {
  1113. ...state.ruleForm,
  1114. repeatableEventDetails: repeatableEventDetails.value,
  1115. files: filesFormat.value,
  1116. };
  1117. deleteUnnecessaryProperties(orderDetail);
  1118. handleForm(orderDetail, true);
  1119. });
  1120. }, 300);
  1121. // 选中常用意见
  1122. const chooseAdvice = (item: any) => {
  1123. state.ruleForm.content += item.content;
  1124. };
  1125. // 取消并关闭当前页
  1126. const onCancel = () => {
  1127. mittBus.emit('clearCachePage', ['order', 'todoOrder', 'todoCenter', 'callLog', 'todoSeats']);
  1128. // 关闭当前 tagsView
  1129. if (state.ruleForm.callId) {
  1130. const currentRoute = state.tagsViewList.find((v: any) => v.query?.callId === state.ruleForm.callId);
  1131. if (currentRoute) {
  1132. // 检测到有callId 并且当前tab页面里面有对应的 就关闭它
  1133. mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...currentRoute }));
  1134. } else {
  1135. mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...route }));
  1136. }
  1137. } else {
  1138. mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...route }));
  1139. }
  1140. };
  1141. // 加载基础数据
  1142. const loadBaseData = async () => {
  1143. try {
  1144. const { result } = await orderBaseDataAdd();
  1145. state.acceptTypeOptions = result?.acceptTypeOptions ?? [];
  1146. state.channelOptions = result?.channelOptions ?? [];
  1147. state.genderOptions = result?.genderOptions ?? [];
  1148. state.identityTypeOptions = result?.identityTypeOptions ?? [];
  1149. orderTypeOptions.value = result?.orderTypeOptions ?? [];
  1150. state.pushTypeOptions = result?.pushTypeOptions ?? [];
  1151. state.licenceTypeOptions = result?.licenceTypeOptions ?? [];
  1152. state.transpondCity = result?.transpondCity ?? [];
  1153. state.focusOnEvents = result?.focusOnEvents ?? [];
  1154. state.focusOnEvents.unshift({ dicDataName: '保密', dicDataValue: '99' });
  1155. state.orderTags = result?.orderTags ?? [];
  1156. state.pushTypeOptions = state.pushTypeOptions.map((item: any) => {
  1157. return {
  1158. ...item,
  1159. pushTypeCode: item.dicDataValue,
  1160. pushType: item.dicDataName,
  1161. };
  1162. });
  1163. state.industryOptions = result.industry ?? []; // 行业分类
  1164. await loadAddress(); //请求地址
  1165. } catch (error) {
  1166. console.log(error);
  1167. }
  1168. };
  1169. // 电话进来的来信
  1170. const loadCreatedBy = () => {
  1171. if (route.query.createBy) {
  1172. // route.query.createBy createBy 代表来源 tel:来电弹单 letter:互联网来信 默认表示手动创建
  1173. state.createBy = route.query.createBy;
  1174. if (route.query.createBy === 'tel') {
  1175. //通话
  1176. state.ruleForm.sourceChannel = '电话'; //电话
  1177. state.ruleForm.sourceChannelCode = 'RGDH'; //电话
  1178. state.ruleForm.fromPhone = route.query.fromTel; // 来电号码
  1179. state.ruleForm.contact = route.query.fromTel; // 联系电话
  1180. state.ruleForm.callId = route.query.callId; // 通话id
  1181. state.ruleForm.transferPhone = route.query.transfer; // 转接来源
  1182. state.ruleForm.channel = {
  1183. // 来源渠道
  1184. dicDataValue: state.ruleForm.sourceChannelCode,
  1185. dicDataName: state.ruleForm.sourceChannel,
  1186. };
  1187. const isNumberIdentityType = parseInt(<string>route.query.identityType);
  1188. if ([1, 2].includes(isNumberIdentityType)) {
  1189. // 按键接收(2:市民 1:企业) 默认市民
  1190. if (isNumberIdentityType == 2) state.ruleForm.identityType = 1;
  1191. else state.ruleForm.identityType = 2;
  1192. } else {
  1193. state.ruleForm.identityType = 1;
  1194. }
  1195. }
  1196. }
  1197. };
  1198. loadCreatedBy();
  1199. // 如果是修改加载表单内容
  1200. const loadForm = async () => {
  1201. buttonLoading.value = true;
  1202. try {
  1203. /* if (route.query.createBy) {
  1204. // route.query.createBy createBy 代表来源 tel:来电弹单 letter:互联网来信 默认表示手动创建
  1205. state.createBy = route.query.createBy;
  1206. if (route.query.createBy === 'tel') {
  1207. //通话
  1208. state.ruleForm.sourceChannel = '电话'; //电话
  1209. state.ruleForm.sourceChannelCode = 'RGDH'; //电话
  1210. state.ruleForm.fromPhone = route.query.fromTel; // 来电号码
  1211. state.ruleForm.contact = route.query.fromTel; // 联系电话
  1212. state.ruleForm.callId = route.query.callId; // 通话id
  1213. state.ruleForm.transferPhone = route.query.transfer; // 转接来源
  1214. state.ruleForm.channel = {
  1215. // 来源渠道
  1216. dicDataValue: state.ruleForm.sourceChannelCode,
  1217. dicDataName: state.ruleForm.sourceChannel,
  1218. };
  1219. const isNumberIdentityType = parseInt(<string>route.query.identityType);
  1220. if ([1, 2].includes(isNumberIdentityType)) {
  1221. // 按键接收(2:市民 1:企业) 默认市民
  1222. if (isNumberIdentityType == 2) state.ruleForm.identityType = 1;
  1223. else state.ruleForm.identityType = 2;
  1224. } else {
  1225. state.ruleForm.identityType = 1;
  1226. }
  1227. }
  1228. setTimeout(() => {
  1229. historyOrderRef.value.searchHistory();
  1230. }, 300);
  1231. }*/
  1232. if (route.query.id) {
  1233. // 如果 有id
  1234. state.ruleForm.id = route.query.id;
  1235. const response = await orderDetail(route.query.id);
  1236. // 如果获取到id 调用查询详情
  1237. state.ruleForm = Object.assign(state.ruleForm, response.result);
  1238. state.ruleForm.files = transformFile(response.result.files);
  1239. if (response.result.duplicateIds && response.result.duplicateIds.length) {
  1240. // 是否重复
  1241. state.ruleForm.isRepeat = 'true';
  1242. state.ruleForm.duplicateTitle = '已选择';
  1243. } else {
  1244. state.ruleForm.isRepeat = 'false';
  1245. }
  1246. if (state.ruleForm.focusOnEvents) {
  1247. // 重点关注事项
  1248. state.ruleForm.focusOnEventsArr = response.result.focusOnEvents.split(',');
  1249. }
  1250. if (state.ruleForm.sourceChannelCode) {
  1251. state.ruleForm.channel = {
  1252. // 来源渠道
  1253. dicDataValue: state.ruleForm.sourceChannelCode,
  1254. dicDataName: state.ruleForm.sourceChannel,
  1255. };
  1256. }
  1257. if (state.ruleForm.industryId) {
  1258. state.ruleForm.industryObj = {
  1259. // 行业分类
  1260. id: state.ruleForm.industryId,
  1261. name: state.ruleForm.industryName,
  1262. };
  1263. }
  1264. if (state.ruleForm.hotspotExternal) {
  1265. //热点分类默认展开
  1266. state.hotspotExternal = state.ruleForm.hotspotExternal.split(',');
  1267. }
  1268. if (state.ruleForm.eventCategoryExternal) {
  1269. //热点分类默认展开
  1270. state.eventCategoryExternal = state.ruleForm.eventCategoryExternal.split(',');
  1271. }
  1272. if (state.ruleForm.licenceTypeCode) {
  1273. state.ruleForm.licenceTypeObj = {
  1274. // 证件类型
  1275. dicDataValue: state.ruleForm.licenceTypeCode,
  1276. dicDataName: state.ruleForm.licenceType,
  1277. };
  1278. }
  1279. if (!state.ruleForm.acceptType && state.ruleForm.acceptTypeCode) {
  1280. // 外部输入数据没有受理名称和热点名称 需要根据code调用一次change事件获取
  1281. const currentAcceptType = state.acceptTypeOptions.find((item: any) => {
  1282. return item.dicDataValue === state.ruleForm.acceptTypeCode;
  1283. });
  1284. state.ruleForm.acceptType = currentAcceptType?.dicDataName ?? '';
  1285. state.ruleForm.acceptTypeObj = {
  1286. // 受理类型
  1287. dicDataValue: state.ruleForm.acceptTypeCode,
  1288. dicDataName: state.ruleForm.acceptType,
  1289. };
  1290. } else {
  1291. state.ruleForm.acceptTypeObj = {
  1292. // 受理类型
  1293. dicDataValue: state.ruleForm.acceptTypeCode,
  1294. dicDataName: state.ruleForm.acceptType,
  1295. };
  1296. }
  1297. if (state.ruleForm.transpondCityValue) {
  1298. state.ruleForm.transpondCityObj = {
  1299. // 市州互转
  1300. dicDataValue: state.ruleForm.transpondCityValue,
  1301. dicDataName: state.ruleForm.transpondCityName,
  1302. };
  1303. }
  1304. // 工单标签
  1305. if (state.ruleForm.orderTags && state.ruleForm.orderTags.length) {
  1306. state.ruleForm.tags = state.ruleForm.orderTags.map((item: any) => item.id);
  1307. }
  1308. isSaveSuccess.value = true; // 如果是修改进入 可以直接办理
  1309. setTimeout(() => {
  1310. watchPauseAbleFn.resume();
  1311. }, 300);
  1312. buttonLoading.value = false;
  1313. } else {
  1314. buttonLoading.value = false;
  1315. }
  1316. setTimeout(() => {
  1317. historyOrderRef.value.searchHistory();
  1318. }, 300);
  1319. } catch (e: any) {
  1320. console.log(e);
  1321. buttonLoading.value = false;
  1322. }
  1323. };
  1324. // 加载省市区
  1325. const addressLoading = ref<boolean>(false);
  1326. const loadAddress = async () => {
  1327. addressLoading.value = true;
  1328. try {
  1329. const area = await treeArea();
  1330. state.areaOptions = area.result ?? []; //省市区数据
  1331. addressLoading.value = false;
  1332. await loadExtra();
  1333. } catch (error) {
  1334. console.log(error);
  1335. } finally {
  1336. addressLoading.value = false;
  1337. }
  1338. };
  1339. // 加载扩展信息
  1340. const orderTypeOptions = ref<EmptyObjectType>([]); // 工单类型
  1341. // 拓展信息
  1342. const extra = ref<any>({
  1343. ext: {},
  1344. area: {},
  1345. orderTypeOptions: [],
  1346. });
  1347. const extraLoading = ref<boolean>(false);
  1348. const loadExtra = async () => {
  1349. extraLoading.value = true;
  1350. try {
  1351. const ext = await orderBaseExt(); // 扩展信息
  1352. extra.value = { ext: { ...ext.result, orderTypeOptions: orderTypeOptions.value, area: state.areaOptions } }; //补充信息
  1353. await loadForm(); // 加在表单数据
  1354. } catch (error) {
  1355. console.log(error);
  1356. } finally {
  1357. extraLoading.value = false;
  1358. }
  1359. };
  1360. // 外部输入数据没有受理名称和热点名称 赋值名称
  1361. const getCurrentData = (val: any) => {
  1362. if (state.ruleForm.id || state.ruleForm.no) {
  1363. if (!state.ruleForm.hotspotName || !state.ruleForm.hotspotSpliceName) {
  1364. state.ruleForm.hotspotName = val?.data?.hotSpotName;
  1365. state.ruleForm.hotspotSpliceName = val?.data?.hotSpotFullName;
  1366. state.ruleForm.hotspotCode = val?.data?.provinceCode;
  1367. }
  1368. }
  1369. };
  1370. const handleBeforeUnload = (event: Event) => {
  1371. event.preventDefault();
  1372. };
  1373. onMounted(async () => {
  1374. await loadBaseData();
  1375. state.tagsViewList = await Session.get('tagsViewList');
  1376. window.addEventListener('beforeunload', handleBeforeUnload);
  1377. });
  1378. onUnmounted(() => {
  1379. window.removeEventListener('beforeunload', handleBeforeUnload);
  1380. });
  1381. </script>
  1382. <style lang="scss" scoped>
  1383. .check-group {
  1384. :deep(.el-checkbox) {
  1385. margin-right: 10px;
  1386. }
  1387. }
  1388. </style>