zgAccept.vue 53 KB

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