12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415 |
- <template>
- <div class="order-add-container layout-padding">
- <el-row :gutter="10" class="h100">
- <!-- 左侧工单信息 -->
- <el-col :span="14" class="left-content h100">
- <el-scrollbar class="h100">
- <el-card shadow="never">
- <el-form :model="state.ruleForm" ref="ruleFormRef" label-width="110px" label-position="right" scroll-to-error :disabled="buttonLoading">
- <p class="border-title mb10">来电信息</p>
- <el-row :gutter="20">
- <!-- 来源渠道 -->
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <!-- 手动创建或者来电弹单或者转写工单 -->
- <template v-if="['tel', 'manual', 'transfer'].includes(state.createBy)">
- <el-form-item label="来源渠道" prop="channel" :rules="[{ required: true, message: '请选择来源渠道', trigger: 'change' }]">
- <el-select
- v-model="state.ruleForm.channel"
- placeholder="请选择来源渠道"
- class="w100"
- clearable
- value-key="dicDataValue"
- @change="changeChannel"
- >
- <el-option v-for="item in state.channelOptions" :value="item" :key="item.dicDataValue" :label="item.dicDataName" />
- </el-select>
- </el-form-item>
- </template>
- <!-- 互联网来信 -->
- <template v-if="state.createBy === 'letter'">
- <el-form-item label="来源渠道" prop="channel">
- <span>{{ state.ruleForm.channel }}</span>
- </el-form-item>
- </template>
- </el-col>
- <!-- 转接来源 -->
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <!-- 手动创建 -->
- <template v-if="state.createBy === 'manual'">
- <el-form-item label="转接来源" prop="transferPhone"> 暂无 </el-form-item>
- </template>
- <!-- 来电弹单或者转写工单 -->
- <template v-if="['tel', 'transfer'].includes(state.createBy)">
- <el-form-item label="转接来源" prop="transferPhone">
- <span>{{ state.ruleForm.transferPhone }}</span>
- </el-form-item>
- </template>
- <!-- 互联网来信 -->
- <template v-if="state.createBy === 'letter'">
- <el-form-item label="转接来源" prop="transferPhone">
- <span>{{ state.ruleForm.transferPhone }}</span>
- </el-form-item>
- </template>
- </el-col>
- <!-- 行业类型 来源渠道是随手拍才有这个字段 -->
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="state.ruleForm.sourceChannelCode === 'ZGSSP'">
- <el-form-item label="行业类型" prop="industryObj" :rules="[{ required: true, message: '请选择行业类型', trigger: 'change' }]">
- <el-select
- v-model="state.ruleForm.industryObj"
- placeholder="请选择行业类型"
- class="w100"
- value-key="id"
- clearable
- @change="changeIndustry"
- >
- <el-option v-for="item in state.industryOptions" :key="item.id" :disabled="item.disabled" :label="item.name" :value="item" />
- </el-select>
- </el-form-item>
- </el-col>
- <!-- 来电号码 -->
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="state.ruleForm.sourceChannelCode === 'RGDH'">
- <!-- 手动创建 -->
- <template v-if="state.createBy === 'manual'">
- <el-form-item label="来电号码" prop="fromPhone" :rules="[{ required: true, message: '请填写来电号码', trigger: 'blur' }]">
- <el-input v-model.trim="state.ruleForm.fromPhone" placeholder="请填写来电号码" clearable> </el-input>
- </el-form-item>
- </template>
- <!-- 来电弹单 -->
- <template v-if="['tel', 'transfer'].includes(state.createBy)">
- <el-form-item label="来电号码" prop="fromPhone">
- <el-input v-model.trim="state.ruleForm.fromPhone" placeholder="请填写来电号码" disabled> </el-input>
- </el-form-item>
- </template>
- <!-- 互联网来信 -->
- <template v-if="state.createBy === 'letter'">
- <el-form-item label="来电号码">
- <span>{{ state.ruleForm.fromPhone }}</span>
- </el-form-item>
- </template>
- </el-col>
- <!-- 服务坐席 -->
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item label="服务坐席">
- <span>{{ state.ruleForm.acceptorName }}</span>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item label="来电人姓名" prop="fromName" :rules="[{ required: true, message: '请填写来电人姓名', trigger: 'blur' }]">
- <el-input v-model="state.ruleForm.fromName" placeholder="请填写来电人姓名" clearable @input="inputName"> </el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item label="来电人性别" prop="fromGender" :rules="[{ required: true, message: '请选择来电人性别', trigger: 'change' }]">
- <el-radio-group v-model="state.ruleForm.fromGender">
- <el-radio :value="item.key" v-for="item in state.genderOptions" :key="item.key">{{ item.value }}</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item label="来电主体" prop="identityType" :rules="[{ required: true, message: '请选择来电主体', trigger: 'change' }]">
- <el-radio-group v-model="state.ruleForm.identityType" @change="selectIdentity">
- <el-radio :value="item.key" v-for="item in state.identityTypeOptions" :key="item.key">{{ item.value }}</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col>
- <el-row class="w100" :gutter="10">
- <el-col :span="12">
- <el-form-item
- label="联系电话"
- prop="contact"
- :rules="[
- { required: true, message: '请填写联系电话', trigger: 'blur' },
- { required: true, pattern: '[^ \x20]+', trigger: 'blur', message: '联系电话不能为空' },
- ]"
- >
- <el-input v-model.trim="state.ruleForm.contact" placeholder="请填写联系电话" @blur="searchHistory" clearable> </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-checkbox-group v-model="state.ruleForm.focusOnEventsArr" @change="changeFocusEvent" class="check-group">
- <el-checkbox
- :label="item.dicDataName"
- :value="item.dicDataValue"
- v-for="item in state.focusOnEvents"
- :key="item.dicDataValue"
- />
- </el-checkbox-group>
- </el-col>
- </el-row>
- </el-col>
- </el-row>
- <p class="border-title mb10">诉求信息</p>
- <el-row>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="state.ruleForm.no">
- <el-form-item label="工单编码">
- {{ state.ruleForm.no }} <span v-if="state.ruleForm?.password">【{{ state.ruleForm.password }}】</span>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item label="拓展信息">
- <el-button @click="showExpandForm" :loading="extraLoading">
- <SvgIcon name="ele-CirclePlus" class="mr3" size="16px" /> 拓展信息
- </el-button>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item label="受理类型" prop="acceptTypeObj" :rules="[{ required: true, message: '请选择受理类型', trigger: 'change' }]">
- <el-select
- v-model="state.ruleForm.acceptTypeObj"
- placeholder="请选择受理类型"
- class="w100"
- value-key="dicDataValue"
- clearable
- @change="changeAcceptType"
- >
- <el-option
- v-for="item in state.acceptTypeOptions"
- :key="item.dicDataValue"
- :disabled="item.disabled"
- :label="item.dicDataName"
- :value="item"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item label="推送分类" prop="orderPushTypes" :rules="[{ required: false, message: '请选择推送分类', trigger: 'change' }]">
- <el-select
- v-model="state.ruleForm.orderPushTypes"
- placeholder="请选择推送分类"
- class="w100"
- clearable
- value-key="pushTypeCode"
- multiple
- collapse-tags
- collapse-tags-tooltip
- :max-collapse-tags="2"
- >
- <el-option v-for="item in state.pushTypeOptions" :key="item.pushTypeCode" :label="item.pushType" :value="item" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item label="工单标签" prop="tags" :rules="[{ required: false, message: '请选择工单标签', trigger: 'change' }]">
- <el-cascader
- :options="state.orderTags"
- filterable
- :props="{ value: 'id', label: 'dicDataName', emitPath: false, checkStrictly: true, multiple: true }"
- placeholder="请选择工单标签"
- class="w100"
- v-model="state.ruleForm.tags"
- collapse-tags
- collapse-tags-tooltip
- clearable
- :show-all-levels="false"
- >
- </el-cascader>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
- <el-form-item label="热点分类" prop="hotspotId" :rules="[{ required: true, message: '请选择热点分类', trigger: 'change' }]">
- <hot-spot-select
- v-model="state.ruleForm.hotspotId"
- v-model:externalArr="state.hotspotExternal"
- @change="chooseHotSpot"
- placeholder="请选择热点分类"
- clearable
- @getCurrentData="getCurrentData"
- />
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
- <el-row :gutter="0">
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item
- label="事发地址"
- prop="areaCode"
- :rules="[{ required: true, message: '请选择事发地址', trigger: 'change' }]"
- v-loading="addressLoading"
- >
- <el-cascader
- :options="state.areaOptions"
- filterable
- :props="{ value: 'id', label: 'areaName', emitPath: false, checkStrictly: true }"
- placeholder="请选择事发地址"
- class="w100"
- v-model="state.ruleForm.areaCode"
- ref="areaRef"
- @change="changeArea"
- >
- </el-cascader>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item
- label=""
- prop="street"
- :rules="[{ required: false, message: '请填写详细地址', trigger: 'blur' }]"
- label-width="10px"
- class="w100 flex"
- >
- <el-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
- <el-input v-model="state.ruleForm.street" placeholder="请填写详细地址" clearable> </el-input>
- </el-col>
- <!-- <el-col :xs="24" :sm="24" :md="24" :lg="7" :xl="7" :offset="1">
- <el-button type="primary" link @click="selectLocation"><SvgIcon name="ele-Location" size="16px" /> 地图定位</el-button>
- </el-col>-->
- </el-form-item>
- </el-col>
- <div v-if="showRepeatEvent" class="color-danger mb10" style="margin-left: 110px">
- 【{{ state.ruleForm.address }}】下存在多起【{{ state.ruleForm.hotspotSpliceName }}】事件,点击前往查看或右侧添加重复性事件
- <el-button type="primary" link style="padding: 0 0 3px" @click="onRepeatEvent"> 查看详情</el-button>
- </div>
- </el-row>
- </el-col>
- <!-- 系统配置 可以配置是否开启重复工单 -->
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="AppConfigInfo.isOpenRepeatedWorkOrders">
- <el-row>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item label="是否重复" prop="isRepeat" :rules="[{ required: true, message: '请选择是否重复', trigger: 'change' }]">
- <el-select v-model="state.ruleForm.isRepeat" placeholder="请选择是否重复" class="w100" @change="isRepeatChange">
- <el-option v-for="item in state.repeatOptions" :key="item.key" :label="item.value" :value="item.key" />
- </el-select>
- </el-form-item>
- </el-col>
- <!-- 必填,若“是否重复”为“是”,则展示重复件选择框 -->
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="state.ruleForm.isRepeat === 'true'">
- <el-form-item
- label=""
- prop="duplicateTitle"
- label-width="10px"
- :rules="[{ required: true, message: '请选择重复件', trigger: 'change' }]"
- >
- <el-input v-model="state.ruleForm.duplicateTitle" placeholder="请选择重复件" readonly>
- <template #suffix>
- <el-button link type="danger" v-if="state.ruleForm.duplicateTitle" @click="clearRepeat" title="清除历史工单">
- <SvgIcon name="ele-Delete" size="16px" />
- </el-button>
- <el-button link type="primary" class="ml1" @click="selectRepeat" title="选择历史工单">
- <SvgIcon name="iconfont icon-tianjiatuozhanxinxi" size="18px" />
- </el-button>
- </template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-col>
- <!-- 宜宾特殊需求,可配置开关 是否开启是否市州互转 -->
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="AppConfigInfo.isTranspondCity">
- <el-row>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <el-form-item
- label="是否市州互转"
- prop="transpond"
- :rules="[{ required: true, message: '请选择是否市州互转', trigger: 'change' }]"
- >
- <el-select v-model="state.ruleForm.transpond" placeholder="请选择是否市州互转" class="w100" @change="changeTransPond">
- <el-option :key="true" label="是" :value="true" />
- <el-option :key="false" label="否" :value="false" />
- </el-select>
- </el-form-item>
- </el-col>
- <!-- 必填,若“是否市州互转”为“是”,则展示选择市州选择框 -->
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" v-if="state.ruleForm.transpond">
- <el-form-item
- label=""
- prop="transpondCityObj"
- label-width="10px"
- :rules="[{ required: true, message: '请选择互转市州', trigger: 'change' }]"
- >
- <el-select
- v-model="state.ruleForm.transpondCityObj"
- placeholder="请选择互转市州"
- class="w100"
- value-key="dicDataValue"
- @change="changeTranspondCity"
- >
- <el-option v-for="item in state.transpondCity" :key="item.dicDataValue" :label="item.dicDataName" :value="item" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
- <el-form-item
- label="工单标题"
- prop="title"
- :rules="[
- { required: true, message: '请填写工单标题', trigger: 'blur' },
- { required: true, pattern: '[^ \x20]+', trigger: 'blur', message: '工单标题不能为空' },
- ]"
- >
- <el-input v-model="state.ruleForm.title" placeholder="请填写工单标题" clearable @input="inputTitle"> </el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
- <el-form-item
- label="受理内容"
- prop="content"
- :rules="[
- { required: true, message: '请填写受理内容', trigger: 'blur' },
- { required: true, pattern: '[^ \x20]+', trigger: 'blur', message: '受理内容不能为空' },
- ]"
- >
- <common-advice
- @chooseAdvice="chooseAdvice"
- v-model="state.ruleForm.content"
- placeholder="请填写受理内容"
- :loading="state.formLoading"
- :commonEnum="commonEnum.Seat"
- modal
- @blur="blurContent"
- />
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
- <el-form-item label="附件" prop="files" :rules="[{ required: false, message: '请填写诉求内容', trigger: 'change' }]">
- <annex-list :businessId="state.ruleForm.id" classify="受理上传" v-model="state.ruleForm.files" v-model:format="filesFormat" />
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :md="24" :lg="24" :xl="24">
- <el-form-item>
- <el-button class="default-button" @click="onCancel" :loading="buttonLoading"> 取消 </el-button>
- <!-- <el-button class="default-button" @click="save(ruleFormRef)" :loading="buttonLoading" :disabled="isSaveSuccess"> 保存 </el-button>
- <el-button type="primary" @click="submit(ruleFormRef)" :loading="buttonLoading" v-if="canHandle" :disabled="!isSaveSuccess">
- 办理
- </el-button>-->
- <el-button type="primary" @click="save(ruleFormRef)" :loading="buttonLoading" v-if="!isSaveSuccess"> 保存 </el-button>
- <el-button type="primary" @click="submit(ruleFormRef)" :loading="buttonLoading" v-if="canHandle && isSaveSuccess">
- 办理
- </el-button>
- <el-button
- type="primary"
- @click="agentHandle(ruleFormRef)"
- :loading="buttonLoading"
- v-show="state.ruleForm?.canInsteadHandle && isSaveSuccess"
- v-auth="'business:order:handle:instead'"
- >代办</el-button
- >
- <el-text class="ml12" type="danger" tag="b">注意:工单内容填写或者修改后请先保存再办理。</el-text>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-card>
- </el-scrollbar>
- </el-col>
- <!-- 右侧内容 -->
- <el-col :span="10" class="right-content h100">
- <el-scrollbar class="h100">
- <el-card shadow="never">
- <el-tabs v-model="rightActive" @tab-change="handleRight" stretch>
- <el-tab-pane label="历史工单" name="history">
- <history-order :ruleForm="state.ruleForm" :orderId="state.ruleForm.id" ref="historyOrderRef" />
- </el-tab-pane>
- <el-tab-pane label="重复性事件" name="repeat">
- <repeat-event ref="repeatEventRef" @orderAddRepeat="orderAddRepeat" :repeatIds="state.ruleForm.repeatableEventDetails" />
- </el-tab-pane>
- <el-tab-pane label="市民画像" name="draw">
- <citizen-portrait :orderInfo="state.ruleForm" ref="citizenPortraitRef" />
- </el-tab-pane>
- </el-tabs>
- </el-card>
- <el-card shadow="never">
- <el-tabs v-model="rightBottomActive" @tab-change="handleRightBottom" stretch>
- <el-tab-pane label="知识库" name="knowledge">
- <Knowledge ref="knowledgeRef" :formData="state.ruleForm" @changeYYType="changeYYType" />
- </el-tab-pane>
- <el-tab-pane label="预案库" name="plan">
- <plan ref="planRef" :formData="state.ruleForm" />
- </el-tab-pane>
- </el-tabs>
- </el-card>
- </el-scrollbar>
- </el-col>
- </el-row>
- <!-- 拓展表单 -->
- <expand-form ref="ExpandFormRef" @saveExpandForm="saveExpandForm" :orderDetail="state.ruleForm" :extra="extra" />
- <!-- 流程审批 -->
- <process-audit ref="processAuditRef" @orderProcessSuccess="onCancel" />
- <!-- 地图选点 -->
- <map-dialog ref="mapDialogRef" @confirm="selectMap" />
- <!-- 重复工单选择 -->
- <order-repeat-select ref="orderRepeatSelectRef" @orderRepeatSuccess="orderRepeatSuccess" />
- <!-- 自贡流程办理 -->
- <z-g-process ref="zgProcessRef" @orderProcessSuccess="onCancel" />
- <!-- 泸州流程办理 -->
- <l-z-process ref="lzProcessRef" @orderProcessSuccess="onCancel" />
- <!-- 自贡随手拍办理 -->
- <z-g-s-s-p-process ref="zgSspProcessRef" @orderProcessSuccess="onCancel" />
- </div>
- </template>
- <script setup lang="ts" name="orderAccept">
- import { computed, defineAsyncComponent, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
- import type { FormInstance } from 'element-plus';
- import { ElMessage, ElMessageBox } from 'element-plus';
- import { storeToRefs } from 'pinia';
- import { useRoute } from 'vue-router';
- import { useAppConfig } from '@/stores/appConfig';
- import { throttle, transformFile } from '@/utils/tools';
- import { commonEnum } from '@/utils/constants';
- import { orderAdd, orderBaseDataAdd, orderBaseExt, orderDetail, orderEdit } from '@/api/business/order';
- import { useUserInfo } from '@/stores/userInfo';
- import { treeArea } from '@/api/auxiliary/area';
- import mittBus from '@/utils/mitt';
- import { orderRepeatEvent } from '@/api/business/repeatEvent';
- import { removeDuplicate } from '@/utils/arrayOperation';
- import { Session } from '@/utils/storage';
- import { watchPausable } from '@vueuse/core';
- import { useThemeConfig } from '@/stores/themeConfig';
- // 引入组件
- const Knowledge = defineAsyncComponent(() => import('@/views/todo/seats/accept/Knowledge.vue')); // 知识库
- const Plan = defineAsyncComponent(() => import('@/views/todo/seats/accept/Plan.vue')); // 预案库
- const HistoryOrder = defineAsyncComponent(() => import('@/views/todo/seats/accept/History.vue')); // 历史工单
- const RepeatEvent = defineAsyncComponent(() => import('@/views/todo/seats/accept/Repeat-event.vue')); // 重复事件
- const CitizenPortrait = defineAsyncComponent(() => import('@/views/todo/seats/accept/Citizen-portrait.vue')); // 市民画像
- const ExpandForm = defineAsyncComponent(() => import('@/views/todo/seats/accept/Expand-form.vue')); // 拓展表单
- const OrderRepeatSelect = defineAsyncComponent(() => import('@/views/todo/seats/accept/Order-repeat-select.vue')); // 选择重复工单
- const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
- const AnnexList = defineAsyncComponent(() => import('@/components/AnnexList/index.vue')); // 附件列表
- const ProcessAudit = defineAsyncComponent(() => import('@/components/ProcessAudit/index.vue')); // 流程审批
- const MapDialog = defineAsyncComponent(() => import('@/views/todo/seats/accept/Map-Dialog.vue')); // 地图定位
- const HotSpotSelect = defineAsyncComponent(() => import('@/components/Hotspot/index.vue')); // 选择热点
- const ZGProcess = defineAsyncComponent(() => import('@/components/ProcessAudit/ZGProcess.vue')); // 自贡流程
- const LZProcess = defineAsyncComponent(() => import('@/components/ProcessAudit/LZProcess.vue')); // 泸州流程
- const ZGSSPProcess = defineAsyncComponent(() => import('@/components/ProcessAudit/ZGSSPProcess.vue')); // 自贡随手拍办理流程
- // 定义变量内容
- const storesThemeConfig = useThemeConfig();
- const { themeConfig } = storeToRefs(storesThemeConfig);
- const state = reactive<any>({
- createBy: 'manual', // 工单创建方式 默认手动创建 tel:来电弹单 letter:互联网来信 默认表示手动创建
- ruleForm: {
- sourceChannel: null, // 来源频道
- sourceChannelCode: null, //来源频道code
- transferPhone: null, // 转接来源
- fromPhone: null, // 来电号码
- acceptorName: null, // 员工姓名
- acceptorStaffNo: null, // 员工工号
- fromName: null, // 来电人姓名
- fromGender: 1, // 来电人性别 默认先生
- identityType: 1, // 来电/信人身份 默认市民
- licenceType: null, // 证件类型
- licenceTypeCode: null, // 证件类型code
- licenceNo: null, // 证件号码
- ageRange: null, // 年龄段
- ageRangeCode: null, // 年龄段code
- contact: null, // 联系电话
- isSecret: false, // 是否保密 默认false
- acceptSms: false, // 是否接收短信 默认false
- no: null, // 工单编码
- title: null, // 工单标题
- hotspotId: null, // 热点分类
- hotspotSpliceName: null, // 热点分类拼接名称
- hotspotName: null, // 热点分类名称
- hotspotCode: null, // 热点分类code
- hotspotExternal: [], // 热点分类外部数据
- eventCategoryId: null, // 事件分类
- incidentTime: null, // 事发时间
- incidentPurpose: null, // 事件目的
- areaCode: themeConfig.value.cityCode, // 区域编码
- city: themeConfig.value.cityName, // 市
- street: null, // 街道
- isRepeat: 'false', // 是否重复工单 默认否
- pushType: null, // 推送类型
- pushTypeCode: null, // 推送类型code
- content: '', // 工单内容
- duplicateIds: [], //重复工单id
- duplicateTitle: null, // 重复工单标题
- callAddress: null, // 来电归属地
- repeatableEventDetails: [], //重复性事件
- orderExtension: null, // 拓展信息
- transpond: false, // 是否市州互转
- isEnforcementOrder: false, // 是否行政执法工单
- focusOnEventsArr: [], // 重点关注事项
- focusOnEvents: null, // 重点关注事项 字符串
- isFormalistWorkOrder: false, // 是否形式主义工单
- isSensitiveWorkOrders: false, // 是否敏感类工单
- isUrgent: false, // 是否紧急工单
- isThreePartyConference: false, // 是否三方同v话
- is24HoursComplete: false, // 24小时紧急工单
- company: null, // 工作单位
- orderPushTypes: [], // 推送分类多选
- acceptType: '咨询', // 受理类型
- acceptTypeCode: '10', // 受理类型code
- acceptTypeObj: {
- // 默认咨询
- dicDataValue: '10',
- dicDataName: '咨询',
- },
- industryId: null, // 行业分类
- industryName: null, // 行业分类名称
- knowledgeQuote: [], // 知识库引用
- tags: [], // 工单标签
- longitude: null, //经度
- latitude: null, //纬度
- },
- formLoading: false, // 表单加载状态
- hotspotExternal: [], // 热点分类外部数据
- eventCategoryExternal: [], // 事件分类外部数据
- acceptTypeOptions: [], // 受理类型
- channelOptions: [], // 来源频道
- genderOptions: [], // 性别
- identityTypeOptions: [], //来电主体
- licenceTypeOptions: [], // 证件类型
- ageRangeOptions: [], // 年龄段
- pushTypeOptions: [], //推送分类
- areaOptions: [], //省市区
- orderTags: [], // 工单标签
- transpondCity: [],
- industryOptions: [], // 行业分类
- repeatOptions: [
- //是否重复
- {
- value: '是',
- key: 'true',
- },
- {
- value: '否',
- key: 'false',
- },
- ],
- focusOnEvents: [], // 重点关注事项
- orderId: null, // 工单id
- tagsViewList: [],
- });
- const storesUserInfo = useUserInfo(); // 用户信息
- const { userInfos } = storeToRefs(storesUserInfo); // 用户信息
- const appConfigStore = useAppConfig();
- const { AppConfigInfo } = storeToRefs(appConfigStore); // 系统配置信息
- state.ruleForm.acceptorName = userInfos.value.name; // 员工姓名
- state.ruleForm.acceptorStaffNo = userInfos.value.staffNo; // 员工工号
- state.ruleForm.longitude = AppConfigInfo.value.locationCenter[0]; // 默认经度
- state.ruleForm.latitude = AppConfigInfo.value.locationCenter[1]; // 默认纬度
- const route = useRoute(); // 路由
- // 选择来源渠道
- const changeChannel = (val: any) => {
- state.ruleForm.fromPhone = null;
- state.ruleForm.sourceChannel = val?.dicDataName ?? null;
- state.ruleForm.sourceChannelCode = val?.dicDataValue ?? null;
- if (route.query.fromTel) {
- state.ruleForm.fromPhone = route.query.fromTel;
- } else {
- ruleFormRef.value.resetFields('fromPhone'); // 清除来电号码
- }
- const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '7'); // 110
- if (['110', 'YB110'].includes(val?.dicDataValue)) {
- // 如果来源渠道选择了110 推送分类联动选择110
- state.ruleForm.orderPushTypes.push(item);
- } else {
- // 清除110选择
- state.ruleForm.orderPushTypes = state.ruleForm.orderPushTypes.filter((item: any) => item.dicDataValue !== '7');
- }
- };
- // 选择证件类型
- /*const changeLicenceType = (val: any) => {
- state.ruleForm.licenceType = val?.dicDataName ?? null;
- state.ruleForm.licenceTypeCode = val?.dicDataValue ?? null;
- };*/
- // 选择受理类型
- const changeAcceptType = (val: any) => {
- state.ruleForm.acceptType = val?.dicDataName ?? null;
- state.ruleForm.acceptTypeCode = val?.dicDataValue ?? null;
- };
- // 选择行业类型
- const changeIndustry = (val: any) => {
- state.ruleForm.industryId = val?.id ?? null;
- state.ruleForm.industryName = val?.name ?? null;
- };
- // 选择是否市州互转
- const changeTransPond = (val: any) => {
- if (!val) {
- setTimeout(() => {
- state.ruleForm.transpondCityValue = null;
- state.ruleForm.transpondCityName = null;
- state.ruleForm.transpondCityId = null;
- state.ruleForm.transpondCityObj = null;
- }, 100);
- /* ElMessageBox.confirm(`确认要清除选择的互转市州?`, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- cancelButtonClass: 'default-button',
- autofocus: false,
- })
- .then(() => {
- })
- .catch(() => {
- state.ruleForm.transpond = true;
- });*/
- }
- };
- // 选择市州互转
- const changeTranspondCity = (val: any) => {
- state.ruleForm.transpondCityId = val?.id ?? null;
- state.ruleForm.transpondCityValue = val?.dicDataValue ?? null;
- state.ruleForm.transpondCityName = val?.dicDataName ?? null;
- };
- // 选择热点分类
- const knowledgeRef = ref<RefType>();
- const chooseHotSpot = (val: any, node: any, externalArr: any) => {
- state.ruleForm.hotspotSpliceName = val?.hotSpotFullName; // 热点分类拼接名称
- state.ruleForm.hotspotName = val?.hotSpotName; // 热点分类名称
- state.ruleForm.hotspotCode = val?.provinceCode; // 热点分类code
- state.ruleForm.hotspotExternal = externalArr?.join(',') ?? ''; // 热点分类默认展开项
- knowledgeRef.value.querySearch(state.ruleForm.hotspotName);
- const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '2'); // 交通运输厅
- if (val?.trunkNum === '12328') {
- // 选择了交通热点需要推送分类关联上交通
- // 去重
- if (state.ruleForm.orderPushTypes.includes(item)) return;
- state.ruleForm.orderPushTypes.push(item);
- } else {
- // 如果选择其他需要清除
- state.ruleForm.orderPushTypes = state.ruleForm.orderPushTypes.filter((item: any) => item.dicDataValue !== '2');
- }
- };
- // 获取事发地址
- const areaRef = ref<RefType>();
- const changeArea = () => {
- const currentNode = areaRef.value.getCheckedNodes();
- // 判断数组长度
- if (currentNode[0].pathLabels.length <= 4) {
- state.ruleForm.city = currentNode[0].pathLabels[0] ?? ''; // 市
- state.ruleForm.county = currentNode[0].pathLabels[1] ?? ''; // 区
- state.ruleForm.town = currentNode[0].pathLabels[2] ?? ''; // 乡镇
- } else {
- // 如果数组长度大于4
- state.ruleForm.city = currentNode[0].pathLabels[0] ?? ''; // 市
- state.ruleForm.county = currentNode[0].pathLabels[1] ?? ''; // 区
- state.ruleForm.town = currentNode[0].pathLabels[2] ?? ''; // 乡镇
- state.ruleForm.village = currentNode[0].pathLabels[3] ?? ''; // 村社区
- state.ruleForm.areaText = currentNode[0].pathLabels.slice(3).join('') ?? ''; // 地区
- console.log(state.ruleForm.areaText);
- }
- };
- // 根据热点和事发地址去查询重复性事件 是否展示重复性事件
- const repeatEventRef = ref<RefType>();
- const showRepeatEvent = ref<boolean>(false);
- const stopWatch = watch([() => state.ruleForm.hotspotSpliceName, () => state.ruleForm.address], (value) => {
- if (value[0] && value[1]) {
- orderRepeatEvent({ hotspotSpliceName: value[0], address: value[1] }).then((res: any) => {
- if (res.result) {
- showRepeatEvent.value = true;
- repeatEventRef.value.queryList();
- } else {
- showRepeatEvent.value = false;
- }
- });
- } else {
- showRepeatEvent.value = false;
- }
- });
- stopWatch();
- // 地图选点
- const mapDialogRef = ref<RefType>();
- const selectLocation = () => {
- const location = {
- longitude: state.ruleForm.longitude,
- latitude: state.ruleForm.latitude,
- adcode: state.ruleForm.areaCode,
- formattedAddress: state.ruleForm.street,
- };
- mapDialogRef.value.openDialog(location);
- };
- // 地图选点
- const ruleFormRef = ref<RefType>();
- const selectMap = (location: any) => {
- ruleFormRef.value.resetFields('areaCode');
- state.ruleForm.longitude = location.longitude;
- state.ruleForm.latitude = location.latitude;
- state.ruleForm.areaCode = location.adcode;
- state.ruleForm.street = location.formattedAddress;
- state.ruleForm.address = location.formattedAddress;
- };
- // 将当前工单添加到重复性事件中
- const repeatableEventDetails = ref<EmptyArrayType>([]);
- const orderAddRepeat = (row: any) => {
- if (route.query.id) {
- //编辑
- if (row.isDeleted) {
- //如果是添加
- repeatableEventDetails.value.push({
- repeatableId: row.id,
- isDeleted: false,
- });
- repeatableEventDetails.value = removeDuplicate([...repeatableEventDetails.value, ...state.ruleForm.repeatableEventDetails], 'repeatableId');
- } else {
- // 移除
- repeatableEventDetails.value = removeDuplicate([...repeatableEventDetails.value, ...state.ruleForm.repeatableEventDetails], 'repeatableId');
- repeatableEventDetails.value = repeatableEventDetails.value.map((item: any) => {
- if (item.repeatableId === row.id) {
- return {
- ...item,
- isDeleted: !item.isDeleted,
- };
- }
- return item;
- });
- }
- } else {
- // 添加
- if (row.isDeleted) {
- //如果是添加
- repeatableEventDetails.value.push({
- repeatableId: row.id,
- });
- repeatableEventDetails.value = removeDuplicate(repeatableEventDetails.value, 'repeatableId');
- } else {
- // 移除
- repeatableEventDetails.value = repeatableEventDetails.value.filter((item: any) => item.repeatableId !== row.id);
- }
- }
- };
- // 查看重复事件
- const onRepeatEvent = () => {
- rightActive.value = 'repeat';
- };
- // 选择是否重复
- const isRepeatChange = (val: string) => {
- if (val === 'false') clearRepeat();
- };
- // 清除重复件
- const clearRepeat = () => {
- orderRepeatSelectRef.value?.clearSelection();
- setTimeout(() => {
- state.ruleForm.duplicateTitle = null;
- state.ruleForm.duplicateIds = [];
- }, 100);
- /* ElMessageBox.confirm(`确认要清除选择的重复工单?`, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- cancelButtonClass: 'default-button',
- autofocus: false,
- })
- .then(() => {
- })
- .catch(() => {
- state.ruleForm.isRepeat = 'true';
- });*/
- };
- // 选择重复件
- const orderRepeatSelectRef = ref<RefType>();
- const selectRepeat = () => {
- orderRepeatSelectRef.value.openDialog(state.ruleForm);
- };
- // 确定选择重复工单
- const orderRepeatSuccess = (row: any) => {
- state.ruleForm.duplicateIds = row.map((item: any) => item.id);
- state.ruleForm.duplicateTitle = '已选择';
- orderRepeatSelectRef.value.closeDialog();
- };
- const historyOrderRef = ref<RefType>(); // 历史工单组件
- const citizenPortraitRef = ref<RefType>(); // 市民画像组件
- // 查询历史工单 和市民画像
- const searchHistory = () => {
- historyOrderRef.value.searchHistory();
- citizenPortraitRef.value.getCitizen();
- // rightActive.value = 'draw';
- };
- // 填写来电人姓名时根据填写内容自动选择性别
- const inputName = (val: string) => {
- // state.ruleForm.fromName = state.ruleForm.fromName.replace(/\d/g, ''); // 替换所有数字为空
- if (val.includes('先生')) {
- state.ruleForm.fromGender = 1;
- } else if (val.includes('女士')) {
- state.ruleForm.fromGender = 0;
- }
- };
- // 填写标题时根据填写内容自动选择受理类型
- const inputTitle = (val: string) => {
- const item = state.acceptTypeOptions.find((item: any) => item.dicDataName === val);
- if (item) {
- state.ruleForm.acceptTypeObj = item;
- state.ruleForm.acceptType = item.dicDataName;
- state.ruleForm.acceptTypeCode = item.dicDataValue;
- }
- };
- const rightActive = ref<string>('history'); // 右侧顶部Tab
- const handleRight = () => {};
- const rightBottomActive = ref<string>('knowledge'); // 右侧底部Tab
- const handleRightBottom = () => {};
- // 打开拓展表单
- const ExpandFormRef = ref<RefType>();
- const showExpandForm = () => {
- ExpandFormRef.value.openDialog();
- };
- // 拓展表单保存
- const saveExpandForm = (val: any) => {
- state.ruleForm.orderExtension = val;
- };
- // 受理内容失去焦点查询知识库
- const blurContent = () => {
- if (state.ruleForm.content) {
- knowledgeRef.value.knowledgeRetrievalPaged();
- }
- };
- // 选择重点关注事项
- const changeFocusEvent = (val: string[]) => {
- state.ruleForm.isUrgent = val.includes('0'); // 是否紧急工单
- state.ruleForm.isFormalistWorkOrder = val.includes('1'); // 是否形式主义工单
- state.ruleForm.isSensitiveWorkOrders = val.includes('3'); // 是否敏感类工单
- state.ruleForm.isEnforcementOrder = val.includes('2'); // 是否行政执法类工单
- state.ruleForm.is24HoursComplete = val.includes('4'); // 24小时紧急工单
- state.ruleForm.acceptSms = val.includes('5'); // 受理短信
- state.ruleForm.isThreePartyConference = val.includes('6'); // 三方通话
- state.ruleForm.isSecret = val.includes('99'); // 是否保密
- state.ruleForm.focusOnEventsName = state.focusOnEvents
- .filter((item: any) => val.includes(item.dicDataValue))
- .map((item: any) => item.dicDataName)
- .join(',');
- /* if (state.ruleForm.sourceChannelCode === 'ZGSSP') {
- //如果 选择了自贡随手拍
- if (state.ruleForm.isSecret) {
- // 如果选择了保密 需要吧三方通话也选上
- state.ruleForm.isThreePartyConference = true;
- state.ruleForm.focusOnEventsArr = removeDuplicate([...state.ruleForm.focusOnEventsArr, '6']);
- }
- }*/
- state.ruleForm.focusOnEvents = state.ruleForm.focusOnEventsArr.join(','); // 获取值
- console.log(
- `是否紧急工单:${val.includes('0')},是否行政执法类类工单:${val.includes('2')},是否形式主义工单:${val.includes('1')},是否敏感类工单:${val.includes(
- '3'
- )},是否24小时紧急工单:${val.includes('4')},是否受理短信:${val.includes('5')},是否三方通话:${val.includes('6')},是否保密:${val.includes('99')}`
- );
- };
- // 删除不必要的属性
- const deleteUnnecessaryProperties = (obj: any) => {
- const propertiesToDelete = ['ageRangeObj', 'licenceTypeObj', 'channel', 'acceptTypeObj', 'transpondCity', 'industryObj'];
- propertiesToDelete.forEach((prop) => Reflect.deleteProperty(obj, prop));
- };
- const filesFormat = ref<EmptyArrayType>([]); // 附件列表格式化
- // 是否打开拓展表单
- const shouldOpenDialog = (obj: any) =>
- !ExpandFormRef.value.state.validated &&
- obj.orderExtension &&
- obj.orderExtension.orderTypeCode &&
- ['scjgjts,scjgjjb'].includes(obj.orderExtension.orderTypeCode);
- const buttonLoading = ref<boolean>(false);
- const isSaveSuccess = ref<boolean>(false); // 是否保存成功 保存成功后才展示办理按钮
- // 检测表单数据是否有变化
- const watchPauseAbleFn = watchPausable(
- state.ruleForm,
- () => {
- isSaveSuccess.value = false; // 工单编辑后重新展示保存按钮
- },
- { deep: true }
- );
- watchPauseAbleFn.pause();
- // 保存
- const save = throttle((formEl: FormInstance | undefined) => {
- if (!formEl) return;
- formEl.validate((valid: boolean) => {
- if (!valid) return;
- buttonLoading.value = true;
- let orderDetail = {
- ...state.ruleForm,
- repeatableEventDetails: repeatableEventDetails.value,
- files: filesFormat.value,
- };
- deleteUnnecessaryProperties(orderDetail);
- const operation = state.ruleForm.id ? orderEdit : orderAdd;
- const addOrderAndNavigate = () => {
- operation(orderDetail)
- .then((res: any) => {
- buttonLoading.value = false;
- ElMessage.success('保存成功');
- if (res.result) {
- const { id, no, password } = res.result;
- state.ruleForm.id = id;
- state.ruleForm.no = no;
- state.ruleForm.password = password;
- }
- isSaveSuccess.value = true;
- setTimeout(() => {
- watchPauseAbleFn.resume();
- }, 300);
- })
- .catch(() => {
- buttonLoading.value = false;
- });
- };
- if (shouldOpenDialog(orderDetail)) {
- ExpandFormRef.value.openDialog(true);
- } else {
- addOrderAndNavigate();
- }
- });
- }, 300);
- // 选择来点人身份如果是企业 推送分类自动选择助企纾困
- const selectIdentity = (val: number) => {
- if (val === 2) {
- const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '8'); // 助企纾困
- // 如果已经选择了助企纾困就不添加
- if (item) {
- if (state.ruleForm.orderPushTypes.includes(item)) return;
- state.ruleForm.orderPushTypes.push(item);
- }
- } else {
- // 如果选择其他需要清除
- state.ruleForm.orderPushTypes = state.ruleForm.orderPushTypes.filter((item: any) => item.dicDataValue !== '8');
- }
- };
- // 是否可以办理(如果有流程id 并且当前账号可以办理 则可以办理 没有流程ID都可以办理)
- const canHandle = computed(() => {
- if (!state.ruleForm?.workflowId) {
- // 没有流程ID表示发起流程
- return true;
- } else {
- // 有流程ID表示已经发起流程 判断当前账号是否可以办理
- return state.ruleForm?.canHandle;
- }
- });
- // 知识库引用
- const changeYYType = (data: any) => {
- state.ruleForm.knowledgeQuote = data;
- };
- // 流程审批
- const processAuditRef = ref<RefType>();
- const zgProcessRef = ref<RefType>();
- const lzProcessRef = ref<RefType>();
- const zgSspProcessRef = ref<RefType>();
- const processOrder = (orderDetail: any, isAgent = false) => {
- buttonLoading.value = false;
- if (['ZiGong'].includes(themeConfig.value.appScope)) {
- if (isAgent) {
- // 代办
- const params = {
- id: orderDetail.workflowId,
- processType: '工单代办',
- orderDetail,
- extra: {
- dialogTitle: '工单代办',
- inputPlaceholder: '办理意见',
- annexName: '办理附件',
- },
- };
- if (state.ruleForm.sourceChannelCode === 'ZGSSP') {
- // 随手拍工单办理
- zgSspProcessRef.value.openDialog(params);
- } else {
- zgProcessRef.value.openDialog(params);
- }
- } else {
- if (orderDetail.workflowId) {
- // 如果已经有流程id 说明已经发起过流程 先更新工单数据 直接调用工单办理
- orderEdit(orderDetail).then(() => {
- const params = {
- id: orderDetail.workflowId,
- processType: '工单办理',
- orderDetail,
- extra: {
- dialogTitle: '工单办理',
- inputPlaceholder: '办理意见',
- annexName: '办理附件',
- },
- };
- if (state.ruleForm.sourceChannelCode === 'ZGSSP') {
- // 随手拍工单办理
- zgSspProcessRef.value.openDialog(params);
- } else {
- zgProcessRef.value.openDialog(params);
- }
- });
- } else {
- // 如果没有流程id 说明没有发起过流程 调用工单受理
- const params = {
- id: '',
- processType: '工单受理',
- extra: {
- dialogTitle: '工单受理',
- inputPlaceholder: '办理意见',
- annexName: '办理附件',
- },
- orderDetail,
- };
- if (state.ruleForm.sourceChannelCode === 'ZGSSP') {
- // 随手拍工单办理
- zgSspProcessRef.value.openDialog(params);
- } else {
- zgProcessRef.value.openDialog(params);
- }
- }
- }
- } else if (['LuZhou'].includes(themeConfig.value.appScope)) {
- if (isAgent) {
- // 代办
- const params = {
- id: orderDetail.workflowId,
- processType: '工单代办',
- orderDetail,
- extra: {
- dialogTitle: '工单代办',
- inputPlaceholder: '办理意见',
- annexName: '办理附件',
- },
- };
- lzProcessRef.value.openDialog(params);
- } else {
- if (orderDetail.workflowId) {
- // 如果已经有流程id 说明已经发起过流程 先更新工单数据 直接调用工单办理
- orderEdit(orderDetail).then(() => {
- const params = {
- id: orderDetail.workflowId,
- processType: '工单办理',
- orderDetail,
- extra: {
- dialogTitle: '工单办理',
- inputPlaceholder: '办理意见',
- annexName: '办理附件',
- },
- };
- lzProcessRef.value.openDialog(params);
- });
- } else {
- // 如果没有流程id 说明没有发起过流程 调用工单受理
- const params = {
- id: '',
- processType: '工单受理',
- extra: {
- dialogTitle: '工单受理',
- inputPlaceholder: '办理意见',
- annexName: '办理附件',
- },
- orderDetail,
- };
- lzProcessRef.value.openDialog(params);
- }
- }
- }
- };
- const handleForm = (orderDetail: any, isAgent = false) => {
- if (orderDetail.orderExtension?.orderTypeCode) {
- if (ExpandFormRef.value.state.validated) {
- processOrder(orderDetail, isAgent);
- } else {
- ExpandFormRef.value.openDialog(true);
- buttonLoading.value = false;
- }
- } else {
- processOrder(orderDetail, isAgent);
- }
- };
- // 提交
- const submit = throttle((formEl: FormInstance | undefined) => {
- if (!formEl) return;
- formEl.validate((valid: boolean) => {
- if (!valid) return;
- buttonLoading.value = true;
- const orderDetail = {
- ...state.ruleForm,
- repeatableEventDetails: repeatableEventDetails.value,
- files: filesFormat.value,
- };
- deleteUnnecessaryProperties(orderDetail);
- handleForm(orderDetail);
- });
- }, 300);
- // 代办
- const agentHandle = throttle((formEl: FormInstance | undefined) => {
- if (!formEl) return;
- formEl.validate((valid: boolean) => {
- if (!valid) return;
- buttonLoading.value = true;
- const orderDetail = {
- ...state.ruleForm,
- repeatableEventDetails: repeatableEventDetails.value,
- files: filesFormat.value,
- };
- deleteUnnecessaryProperties(orderDetail);
- handleForm(orderDetail, true);
- });
- }, 300);
- // 选中常用意见
- const chooseAdvice = (item: any) => {
- state.ruleForm.content += item.content;
- };
- // 取消并关闭当前页
- const onCancel = () => {
- mittBus.emit('clearCachePage', ['order', 'todoOrder', 'todoCenter', 'callLog', 'todoSeats']);
- // 关闭当前 tagsView
- if (state.ruleForm.callId) {
- const currentRoute = state.tagsViewList.find((v: any) => v.query?.callId === state.ruleForm.callId);
- if (currentRoute) {
- // 检测到有callId 并且当前tab页面里面有对应的 就关闭它
- mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...currentRoute }));
- } else {
- mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...route }));
- }
- } else {
- mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...route }));
- }
- };
- // 加载基础数据
- const loadBaseData = async () => {
- try {
- const { result } = await orderBaseDataAdd();
- state.acceptTypeOptions = result?.acceptTypeOptions ?? [];
- state.channelOptions = result?.channelOptions ?? [];
- state.genderOptions = result?.genderOptions ?? [];
- state.identityTypeOptions = result?.identityTypeOptions ?? [];
- orderTypeOptions.value = result?.orderTypeOptions ?? [];
- state.pushTypeOptions = result?.pushTypeOptions ?? [];
- state.licenceTypeOptions = result?.licenceTypeOptions ?? [];
- state.transpondCity = result?.transpondCity ?? [];
- state.focusOnEvents = result?.focusOnEvents ?? [];
- state.focusOnEvents.unshift({ dicDataName: '保密', dicDataValue: '99' });
- state.orderTags = result?.orderTags ?? [];
- state.pushTypeOptions = state.pushTypeOptions.map((item: any) => {
- return {
- ...item,
- pushTypeCode: item.dicDataValue,
- pushType: item.dicDataName,
- };
- });
- state.industryOptions = result.industry ?? []; // 行业分类
- const pushTypeCode = route.query.pushTypeCode;
- // 如果是人大代表来电 推送分类需要自动选择人大代表
- if (pushTypeCode === '1') {
- const item = state.pushTypeOptions.find((item: any) => item.dicDataValue === '9'); // 人大代表
- // 去重
- if (state.ruleForm.orderPushTypes.includes(item)) return;
- state.ruleForm.orderPushTypes.push(item);
- }
- await loadAddress(); //请求地址
- } catch (error) {
- console.log(error);
- }
- };
- // 电话进来的来信
- const loadCreatedBy = () => {
- if (route.query.createBy) {
- // route.query.createBy createBy 代表来源 tel:来电弹单 letter:互联网来信 默认表示手动创建
- state.createBy = route.query.createBy;
- if (route.query.createBy === 'tel') {
- //通话
- state.ruleForm.sourceChannel = '电话'; //电话
- state.ruleForm.sourceChannelCode = 'RGDH'; //电话
- state.ruleForm.fromPhone = route.query.fromTel; // 来电号码
- state.ruleForm.contact = route.query.fromTel; // 联系电话
- state.ruleForm.callId = route.query.callId; // 通话id
- state.ruleForm.transferPhone = route.query.transfer; // 转接来源
- state.ruleForm.channel = {
- // 来源渠道
- dicDataValue: state.ruleForm.sourceChannelCode,
- dicDataName: state.ruleForm.sourceChannel,
- };
- const isNumberIdentityType = parseInt(<string>route.query.identityType);
- if ([1, 2].includes(isNumberIdentityType)) {
- // 按键接收(2:市民 1:企业) 默认市民
- if (isNumberIdentityType == 2) state.ruleForm.identityType = 1;
- else state.ruleForm.identityType = 2;
- } else {
- state.ruleForm.identityType = 1;
- }
- }
- }
- };
- loadCreatedBy();
- // 如果是修改加载表单内容
- const loadForm = async () => {
- buttonLoading.value = true;
- try {
- /* if (route.query.createBy) {
- // route.query.createBy createBy 代表来源 tel:来电弹单 letter:互联网来信 默认表示手动创建
- state.createBy = route.query.createBy;
- if (route.query.createBy === 'tel') {
- //通话
- state.ruleForm.sourceChannel = '电话'; //电话
- state.ruleForm.sourceChannelCode = 'RGDH'; //电话
- state.ruleForm.fromPhone = route.query.fromTel; // 来电号码
- state.ruleForm.contact = route.query.fromTel; // 联系电话
- state.ruleForm.callId = route.query.callId; // 通话id
- state.ruleForm.transferPhone = route.query.transfer; // 转接来源
- state.ruleForm.channel = {
- // 来源渠道
- dicDataValue: state.ruleForm.sourceChannelCode,
- dicDataName: state.ruleForm.sourceChannel,
- };
- const isNumberIdentityType = parseInt(<string>route.query.identityType);
- if ([1, 2].includes(isNumberIdentityType)) {
- // 按键接收(2:市民 1:企业) 默认市民
- if (isNumberIdentityType == 2) state.ruleForm.identityType = 1;
- else state.ruleForm.identityType = 2;
- } else {
- state.ruleForm.identityType = 1;
- }
- }
- setTimeout(() => {
- historyOrderRef.value.searchHistory();
- }, 300);
- }*/
- if (route.query.id) {
- // 如果 有id
- state.ruleForm.id = route.query.id;
- const response = await orderDetail(route.query.id);
- // 如果获取到id 调用查询详情
- state.ruleForm = Object.assign(state.ruleForm, response.result);
- state.ruleForm.files = transformFile(response.result.files);
- if (response.result.duplicateIds && response.result.duplicateIds.length) {
- // 是否重复
- state.ruleForm.isRepeat = 'true';
- state.ruleForm.duplicateTitle = '已选择';
- } else {
- state.ruleForm.isRepeat = 'false';
- }
- if (state.ruleForm.focusOnEvents) {
- // 重点关注事项
- state.ruleForm.focusOnEventsArr = response.result.focusOnEvents.split(',');
- }
- if (state.ruleForm.sourceChannelCode) {
- state.ruleForm.channel = {
- // 来源渠道
- dicDataValue: state.ruleForm.sourceChannelCode,
- dicDataName: state.ruleForm.sourceChannel,
- };
- }
- if (state.ruleForm.industryId) {
- state.ruleForm.industryObj = {
- // 行业分类
- id: state.ruleForm.industryId,
- name: state.ruleForm.industryName,
- };
- }
- if (state.ruleForm.hotspotExternal) {
- //热点分类默认展开
- state.hotspotExternal = state.ruleForm.hotspotExternal.split(',');
- }
- if (state.ruleForm.eventCategoryExternal) {
- //热点分类默认展开
- state.eventCategoryExternal = state.ruleForm.eventCategoryExternal.split(',');
- }
- if (state.ruleForm.licenceTypeCode) {
- state.ruleForm.licenceTypeObj = {
- // 证件类型
- dicDataValue: state.ruleForm.licenceTypeCode,
- dicDataName: state.ruleForm.licenceType,
- };
- }
- if (!state.ruleForm.acceptType && state.ruleForm.acceptTypeCode) {
- // 外部输入数据没有受理名称和热点名称 需要根据code调用一次change事件获取
- const currentAcceptType = state.acceptTypeOptions.find((item: any) => {
- return item.dicDataValue === state.ruleForm.acceptTypeCode;
- });
- state.ruleForm.acceptType = currentAcceptType?.dicDataName ?? '';
- state.ruleForm.acceptTypeObj = {
- // 受理类型
- dicDataValue: state.ruleForm.acceptTypeCode,
- dicDataName: state.ruleForm.acceptType,
- };
- } else {
- state.ruleForm.acceptTypeObj = {
- // 受理类型
- dicDataValue: state.ruleForm.acceptTypeCode,
- dicDataName: state.ruleForm.acceptType,
- };
- }
- if (state.ruleForm.transpondCityValue) {
- state.ruleForm.transpondCityObj = {
- // 市州互转
- dicDataValue: state.ruleForm.transpondCityValue,
- dicDataName: state.ruleForm.transpondCityName,
- };
- }
- // 工单标签
- if (state.ruleForm.orderTags && state.ruleForm.orderTags.length) {
- state.ruleForm.tags = state.ruleForm.orderTags.map((item: any) => item.id);
- }
- isSaveSuccess.value = true; // 如果是修改进入 可以直接办理
- setTimeout(() => {
- watchPauseAbleFn.resume();
- }, 300);
- buttonLoading.value = false;
- } else {
- buttonLoading.value = false;
- }
- setTimeout(() => {
- historyOrderRef.value.searchHistory();
- }, 300);
- } catch (e: any) {
- console.log(e);
- buttonLoading.value = false;
- }
- };
- // 加载省市区
- const addressLoading = ref<boolean>(false);
- const loadAddress = async () => {
- addressLoading.value = true;
- try {
- const area = await treeArea();
- state.areaOptions = area.result ?? []; //省市区数据
- addressLoading.value = false;
- await loadExtra();
- } catch (error) {
- console.log(error);
- } finally {
- addressLoading.value = false;
- }
- };
- // 加载扩展信息
- const orderTypeOptions = ref<EmptyObjectType>([]); // 工单类型
- // 拓展信息
- const extra = ref<any>({
- ext: {},
- area: {},
- orderTypeOptions: [],
- });
- const extraLoading = ref<boolean>(false);
- const loadExtra = async () => {
- extraLoading.value = true;
- try {
- const ext = await orderBaseExt(); // 扩展信息
- extra.value = { ext: { ...ext.result, orderTypeOptions: orderTypeOptions.value, area: state.areaOptions } }; //补充信息
- await loadForm(); // 加在表单数据
- } catch (error) {
- console.log(error);
- } finally {
- extraLoading.value = false;
- }
- };
- // 外部输入数据没有受理名称和热点名称 赋值名称
- const getCurrentData = (val: any) => {
- if (state.ruleForm.id || state.ruleForm.no) {
- if (!state.ruleForm.hotspotName || !state.ruleForm.hotspotSpliceName) {
- state.ruleForm.hotspotName = val?.data?.hotSpotName;
- state.ruleForm.hotspotSpliceName = val?.data?.hotSpotFullName;
- state.ruleForm.hotspotCode = val?.data?.provinceCode;
- }
- }
- };
- const handleBeforeUnload = (event: Event) => {
- event.preventDefault();
- };
- onMounted(async () => {
- await loadBaseData();
- state.tagsViewList = await Session.get('tagsViewList');
- window.addEventListener('beforeunload', handleBeforeUnload);
- });
- onUnmounted(() => {
- window.removeEventListener('beforeunload', handleBeforeUnload);
- });
- </script>
- <style lang="scss" scoped>
- .check-group {
- :deep(.el-checkbox) {
- margin-right: 10px;
- }
- }
- </style>
|