| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407 |
- <template>
- <div class="app-container">
- <!-- 设备清单 -->
- <ContentWrap title="设备信息">
- <!-- 搜索工作栏 -->
- <ContentWrap>
- <el-form
- :model="equipQueryParams"
- ref="equipQueryFormRef"
- :inline="true"
- label-width="80px"
- >
- <!-- 基本信息查询部分 -->
- <div class="flex flex-wrap items-start gap-x-2">
- <!-- <el-form-item label="设备代码" prop="equipCode">-->
- <!-- <el-input-->
- <!-- v-model="equipQueryParams.equipCode"-->
- <!-- placeholder="请输入设备注册代码"-->
- <!-- clearable-->
- <!-- @keyup.enter="handleEquipQuery"-->
- <!-- class="!w-240px"-->
- <!-- />-->
- <!-- </el-form-item>-->
- <el-form-item label="部门" prop="relateDepartment">
- <DeptSelect
- v-model="equipQueryParams.relateDepartment"
- placeholder="请选择部门"
- clearable
- class="!w-240px"
- />
- </el-form-item>
- <el-form-item label="使用状态" prop="useStatus">
- <el-select
- v-model="equipQueryParams.useStatus"
- placeholder="选择使用状态"
- clearable
- multiple
- collapse-tags
- collapse-tags-tooltip
- class="!w-240px"
- >
- <el-option
- v-for="dict in getStrDictOptions(DICT_TYPE.PIPE_USE_STATUS)"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="临检时间" prop="nextDate">
- <div class="flex items-center gap-x-2">
- <el-select v-model="datePickerType" class="!w-[90px]">
- <el-option label="时间段" value="daterange" />
- <el-option label="月份" value="month" />
- </el-select>
- <el-date-picker
- v-if="datePickerType === 'daterange'"
- v-model="daterange"
- type="daterange"
- value-format="YYYY-MM-DD"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- class="!w-[210px]"
- @change="handleDateChange"
- />
- <el-date-picker
- v-else
- v-model="month"
- type="month"
- value-format="YYYY-MM"
- placeholder="选择月份"
- class="!w-[140px]"
- @change="handleMonthChange"
- />
- </div>
- </el-form-item>
- </div>
- <!-- 区域和时间查询部分 -->
- <div class="flex flex-wrap items-start gap-x-2">
- <el-form-item label="区域" prop="equipDistrict">
- <AreaSelect
- v-model="equipQueryParams.equipDistrict"
- placeholder="请选择区域"
- class="!w-[240px]"
- multiple
- collapse-tags
- collapse-tags-tooltip
- :clearable="true"
- @clear="handleAreaClear"
- @change="handleAreaChange"
- />
- </el-form-item>
- <el-form-item label="街道" prop="equipStreet">
- <StreetSelect
- v-model="equipQueryParams.equipStreet"
- :district-ids="equipQueryParams.equipDistrict"
- placeholder="请选择街道"
- class="!w-[240px]"
- multiple
- collapse-tags
- collapse-tags-tooltip
- :clearable="true"
- @clear="handleStreetClear"
- @change="handleStreetChange"
- />
- </el-form-item>
- </div>
- <div class="">
- <el-form-item class="!w-full !mr-0px" label="管道归类" prop="typeList">
- <el-checkbox-group
- v-model="equipQueryParams.typeList"
- class="flex flex-wrap gap-2"
- @change="handleTypeListChange"
- >
- <el-checkbox
- v-for="dict in containerTypeOptions"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-checkbox-group>
- </el-form-item>
- </div>
- <!-- 操作按钮 -->
- <div class="flex justify-center">
- <el-form-item class="!mb-0">
- <el-button @click="handleEquipQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
- <el-button @click="resetEquipQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
- <!-- 删除设备 -->
- <el-button type="danger" :disabled="selectedDetailRows.length === 0 && selectedRows.length === 0" @click="handleRejectEquip">
- <Icon icon="ep:failed" class="mr-5px" /> 拒绝约检
- </el-button>
- <el-button type="primary" @click="handleAddEquip"><Icon icon="ep:plus" class="mr-5px" /> 添加设备</el-button>
- <el-button type="primary" @click="handleBatchEditFn" :disabled="selectedRows.length === 0">
- <Icon icon="ep:edit" class="mr-5px" /> 批量修改约检联系人
- </el-button>
- <el-button type="primary" @click="handleBatchEditLocationFn" :disabled="selectedRows.length === 0">
- <Icon icon="ep:edit" class="mr-5px" /> 批量修改地址
- </el-button>
- </el-form-item>
- </div>
- </el-form>
- </ContentWrap>
- <!-- 设备列表 -->
- <ContentWrap>
- <el-table
- v-loading="loading"
- ref="tableRef"
- :data="equipList"
- stripe
- border
- @selection-change="handleSelectionChange"
- @sort-change="handleSortChange"
- :row-key="(row) => row.id"
- :row-class-name="getMainRowClassName"
- @row-click="handleMainRowClick"
- @expand-change="handleExpandChange"
- :expand-row-keys="expandRowKeys"
- >
- <el-table-column type="selection" width="50" fixed="left"/>
- <el-table-column type="expand" width="120" class-name="hidden-expand-column" >
- <template #default="props">
- <div class="ml-15px mr-15px">
- <el-table :data="props.row.detailSaveReqVOS" border
- :header-cell-style="{background: '#f5f7fa', color: '#606266'}"
- :ref="(el) => setDetailTableRef(el, props.row.id)"
- @selection-change="(selection) => handleDetailSelectionChange(selection, props.row)"
- :row-class-name="getRowClassName"
- class="inner-table"
- @row-click="handleRowClick"
- >
- <el-table-column type="selection" width="50" fixed="left"/>
- <el-table-column label="注册代码" prop="equipCode" min-width="120" show-overflow-tooltip/>
- <el-table-column label="管道名称" prop="pipeName" min-width="120" show-overflow-tooltip/>
- <el-table-column label="管道编号" prop="pipeNo" min-width="120" show-overflow-tooltip/>
- <el-table-column label="管道级别" prop="pipeLevel" min-width="120" show-overflow-tooltip/>
- <el-table-column label="管道品种" prop="pipeType" min-width="120" show-overflow-tooltip/>
- <el-table-column label="长度" prop="pipeLength" min-width="100" show-overflow-tooltip/>
- <el-table-column label="管道材质" prop="pipeMaterial" min-width="120" show-overflow-tooltip/>
- <el-table-column label="材料标准" prop="materialStandard" min-width="120" show-overflow-tooltip/>
- <el-table-column label="定期安全状况等级" prop="legalSafetyStatusLevel" min-width="130" show-overflow-tooltip/>
- <el-table-column label="年度安全状况等级" prop="yearSafetyStatusLevel" min-width="130" show-overflow-tooltip/>
- </el-table>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="工程号"
- align="center"
- prop="projectNo"
- min-width="120"
- >
- <template #default="{ row }">
- <div
- v-if="row.projectNo"
- class="cursor-pointer"
- @click.stop="toggleExpand(row)"
- >
- <div class="flex items-center justify-center gap-1 schedule-link">
- <span class="text-xs color-blue">{{row.projectNo}}</span>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="工程名称"
- align="center"
- prop="projectName"
- min-width="120"
- show-overflow-tooltip
- />
- <!-- 区域 -->
- <el-table-column
- label="区域/街道"
- align="center"
- prop="pipeStreet"
- min-width="120"
- show-overflow-tooltip
- >
- <template #default="{ row }">
- <span class="text-xs">{{ row.equipStreetName ?? row.equipDistrictName}}</span>
- </template>
- </el-table-column>
- <!-- 管道类别 -->
- <el-table-column label="管道类别" align="center" prop="pipeCategory">
- <template #default="scope">
- {{ containerTypeOptions.find(i => i.value == scope.row.pipeCategory)?.label }}
- </template>
- </el-table-column>
- <el-table-column
- label="约检联系人"
- align="center"
- prop="contact"
- min-width="120"
- show-overflow-tooltip
- />
- <el-table-column
- label="约检联系人电话"
- align="center"
- prop="contactPhone"
- min-width="140"
- show-overflow-tooltip
- />
- </el-table>
- <!-- 分页 -->
- <Pagination
- :total="equipTotal"
- v-model:page="equipQueryParams.pageNo"
- v-model:limit="equipQueryParams.pageSize"
- @pagination="handleEquipQuery"
- />
- </ContentWrap>
- </ContentWrap>
- <!-- 受检单位基本信息 -->
- <ContentWrap title="受检单位基本信息" v-if="unitData.id">
- <div class="mb-[5px]">
- <el-button class="mb-[10px]" type="primary" @click="handleUnitCodeFn(unitData.id)">工商信息</el-button>
- <el-descriptions :column="3" border class="flex-1">
- <el-descriptions-item label="单位名称">{{ unitData.name || '-' }}</el-descriptions-item>
- <el-descriptions-item label="登记状态">{{ unitData.regstateCn || '-' }}</el-descriptions-item>
- <el-descriptions-item label="市场主体类型">{{ unitData.enterpriseType || '-' }}</el-descriptions-item>
- <el-descriptions-item label="单位地址">{{ unitData.addr || '-' }}</el-descriptions-item>
- </el-descriptions>
- </div>
- </ContentWrap>
- <unitContainerForm ref="unitContainerFormRef" />
- <!-- 受检信息表单 -->
- <ContentWrap title="受检信息">
- <el-form :model="formData" :rules="formRules" ref="formRef" label-width="120px" class="p-3">
- <!-- <div class="check-info-label-title">受理单位</div> -->
- <div class="check-info-label-title">单位信息 </div>
- <el-row class="form-group" :gutter="24">
- <el-col :span="8">
- <!-- 申请单位名称 unitName -->
- <el-form-item label="申请单位名称" prop="unitName" class="unit-form-item">
- <el-input v-if="useInputUnitName" v-model="formData.unitName.name" placeholder="请输入单位名称" :maxlength="50" />
- <CustomLargeListSelect
- v-else
- v-model:modelValue="formData.unitName"
- :fetchFunc="getUnitNewList"
- label-key="name"
- value-key="id"
- searchKeyProp="name"
- @change="handleChangeUnit"
- />
- <el-button type="primary" link @click="() => useInputUnitName = !useInputUnitName">{{useInputUnitName ? '选择单位' : '手动输入'}}</el-button>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 统一社会信用代码 socialCreditCode -->
- <el-form-item label="统一社会信用代码" prop="socialCreditCode" label-width="120px">
- <el-input v-model="formData.socialCreditCode" placeholder="请输入统一社会信用代码" :maxlength="50"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 申请单位地址 unitAddress -->
- <el-form-item label="申请单位地址" prop="unitAddress" label-width="120px">
- <el-input v-model="formData.unitAddress" placeholder="请输入申请单位地址" :maxlength="50"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 邮政编码 zipCode -->
- <el-form-item label="申请单位邮政编码" prop="zipCode">
- <el-input v-model="formData.zipCode" placeholder="请输入申请单位邮政编码" :maxlength="50"/>
- </el-form-item>
- </el-col>
- </el-row>
- <!-- <div class="check-info-label-title">使用单位</div> -->
- <el-row class="form-group" :gutter="24">
- <el-col :span="8">
- <!-- 使用单位名称 useUnitName -->
- <el-form-item label="使用单位名称" prop="useUnitName" class="unit-form-item">
- <el-input v-if="useInputUseUnitName" v-model="formData.useUnitName.name" placeholder="请输入使用单位名称" :maxlength="50" @blur="handleChangeUseUnitInput" @keyup.enter="handleChangeUseUnitInput" />
- <CustomLargeListSelect
- v-else
- v-model:modelValue="formData.useUnitName"
- :fetchFunc="getUnitNewList"
- label-key="name"
- value-key="id"
- searchKeyProp="name"
- @change="handleChangeUseUnit"
- />
- <el-button type="primary" link @click="() => useInputUseUnitName = !useInputUseUnitName">{{useInputUseUnitName ? '选择单位' : '手动输入'}}</el-button>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 统一社会信用代码 -->
- <el-form-item label="统一社会信用代码" prop="useUnitSocialCreditCode" label-width="120px">
- <el-input v-model="formData.useUnitSocialCreditCode" placeholder="请输入统一社会信用代码" :maxlength="50"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 使用单位地址 useUnitAddress -->
- <el-form-item label="使用单位地址" prop="useUnitAddress" label-width="120px">
- <el-input v-model="formData.useUnitAddress" placeholder="请输入使用单位地址" :maxlength="50"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 邮政编码 useUnitZipcode -->
- <el-form-item label="使用邮政编码" prop="useUnitZipcode">
- <el-input v-model="formData.useUnitZipcode" placeholder="请输入使用邮政编码" :maxlength="50"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 单位联系人 useUnitContact -->
- <el-form-item label="单位联系人" prop="useUnitContact" label-width="120px">
- <el-input v-model="formData.useUnitContact" placeholder="请输入单位联系人" :maxlength="50"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 联系人电话 useUnitPhone -->
- <el-form-item label="联系人电话" prop="useUnitPhone" label-width="120px">
- <el-input v-model="formData.useUnitPhone" placeholder="请输入联系人电话" :maxlength="11"/>
- </el-form-item>
- </el-col>
- </el-row>
- <div class="check-info-label-title">联系人信息</div>
- <el-row class="form-group" :gutter="24">
- <el-col :span="8">
- <!-- 约检联系人 unitContact -->
- <el-form-item label="约检联系人" prop="unitContact">
- <el-input v-model="formData.unitContact" placeholder="请输入约检联系人" :maxlength="50"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 约检联系人电话unitPhone -->
- <el-form-item label="联系人电话" prop="unitPhone" label-width="120px">
- <el-input v-model="formData.unitPhone" placeholder="请输入约检联系人电话" :maxlength="11"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 约检联系人电话email -->
- <el-form-item label="联系人邮箱" prop="email" label-width="120px">
- <el-input v-model="formData.email" placeholder="请输入约检联系人邮箱"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 电子报告接收人 recipient -->
- <el-form-item label="电子报告接收人" prop="recipient" label-width="120px">
- <el-input v-model="formData.recipient" placeholder="请输入电子报告接收人" :maxlength="50"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 接收人电话 recipientPhone -->
- <el-form-item label="接收人电话" prop="recipientPhone">
- <el-input v-model="formData.recipientPhone" placeholder="请输入接收人电话" :maxlength="11"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="接收人邮箱" prop="recipientEmail">
- <el-input v-model="formData.recipientEmail" placeholder="请输入接收人邮箱"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="缴费联系人" prop="payerContactName" label-width="120px">
- <el-input v-model="formData.payerContactName" placeholder="请输入缴费联系人" :maxlength="50"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 接收人电话 payerContact -->
- <el-form-item label="缴费人电话" prop="payerContact">
- <el-input v-model="formData.payerContact" placeholder="请输入缴费人电话" :maxlength="11"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="缴费人邮箱" prop="payerMail">
- <el-input v-model="formData.payerMail" placeholder="请输入缴费人邮箱"/>
- </el-form-item>
- </el-col>
- </el-row>
- <div class="check-info-label-title">受理信息</div>
- <el-row class="form-group" :gutter="24">
- <el-col :span="8">
- <!-- 检验部门 deptId -->
- <el-form-item label="检验部门" prop="deptId">
- <!-- <el-input v-model="formData.deptId" placeholder="请输入检验部门"/> -->
- <DeptSelect
- v-model="formData.deptId"
- placeholder="请选择部门"
- clearable
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 联系电话 deptPhone -->
- <el-form-item label="联系电话" prop="deptPhone" label-width="120px">
- <el-input v-model="formData.deptPhone" placeholder="请输入联系电话" :maxlength="20"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <!-- 约检时间 appointmentDate -->
- <el-form-item label="约检时间" prop="appointmentDate" label-width="120px">
- <el-date-picker
- v-model="formData.appointmentDate"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="请选择约检时间"
- :disabled-date="disabledDate"
- />
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <!-- 检验员 teamList -->
- <el-form-item label="检验员" prop="teamList">
- <!-- <CheckerSelect-->
- <!-- ref="checkerSelectRef"-->
- <!-- v-model="selectedCheckers"-->
- <!-- :dept-id="userStore.getUser.deptId?.toString() || '1'"-->
- <!-- :disabled="false"-->
- <!-- :has-data="true"-->
- <!-- empty-text="暂无检验员数据"-->
- <!-- :multiple="true"-->
- <!-- @change="handleCheckerChange"-->
- <!-- />-->
- <div v-if="formattedCheckers.length > 0" class="selected-checkers">
- <el-tag
- v-for="checker in formattedCheckers"
- :key="checker.id"
- effect="plain"
- class="mr-8px mb-8px"
- >
- {{ checker.label }}
- </el-tag>
- </div>
- <span v-else>-</span>
- </el-form-item>
- </el-col>
- </el-row>
- <div class="check-info-label-title">异常信息</div>
- <el-row class="m-b-20px">
- <el-button v-if="!exceptionInfo.id" type="primary" @click="addExceptionInfo">添加异常单</el-button>
- <el-button v-else type="primary" @click="deleteExceptionInfo">删除异常单</el-button>
- </el-row>
- <el-row v-if="exceptionInfo.id" class="form-group" :gutter="24">
- <el-col :span="8">
- <el-form-item label="有效日期调整原因" prop="effectiveDateAdjustReason">
- <el-input v-model="exceptionInfo.effectiveDateAdjustReason" placeholder="请输入有效日期调整原因"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="受理建议" prop="acceptSuggeston">
- <el-input v-model="exceptionInfo.acceptSuggeston" placeholder="请输入受理建议"/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="调整有效日期" prop="adjustEffectiveDate">
- <el-date-picker
- v-model="exceptionInfo.adjustEffectiveDate"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="请选择调整有效日期"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="情况说明" prop="descrition">
- <component :is="getExceptionItem('descrition', 'descritionAttach')" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="重启表" prop="restartTable">
- <component :is="getExceptionItem('restartTable', 'restartTableAttach')" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="指令书" prop="instrustionBook">
- <component :is="getExceptionItem('instrustionBook', 'instrustionBookAttach')" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="受理回执" prop="acceptReceipt">
- <component :is="getExceptionItem('acceptReceipt', 'acceptReceiptAttach')" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="其他" prop="other">
- <component :is="getExceptionItem('other', 'otherAttach')" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="提前检验申请函" prop="earlyCheckApply">
- <component :is="getExceptionItem('earlyCheckApply', 'earlyCheckApplyAttach')" />
- </el-form-item>
- </el-col>
- </el-row>
- <div class="check-info-label-title">检验收费</div>
- <el-row class="form-group" :gutter="24">
- <el-col :span="24">
- <!-- 定期检查&超年限检查 -->
- <el-form-item label="检验性质" prop="checkType" label-width="120px">
- <el-select disabled v-model="formData.checkType" placeholder="请选择检验性质" clearable class="!w-120px">
- <el-option
- v-for="(item, key) in checkStatusMap"
- :key="key"
- :label="item"
- :value="key"
- />
- </el-select>
- </el-form-item>
- <!-- 收费性质 feeNature -->
- <el-form-item prop="feeNature" >
- <template #label>
- <div class="flex flex-col text-right">
- <span>收费性质</span>
- <span>(行政事业收费)</span>
- </div>
- </template>
- <el-radio-group v-model="formData.feeNature">
- <el-radio v-for="(item, key) in PressureFeeNatureMap" :key="key" :value="key" :label="item"/>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <!-- 收费形式 feeType -->
- <el-form-item label="收费形式" prop="feeType">
- <el-radio-group v-model="formData.feeType">
- <el-radio label="100">非合同收费</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <!-- 收费金额 actualAmount -->
- <!-- <el-form-item label="收费金额" prop="actualAmount" class="actualAmountFormItem">
- <el-input-number
- :controls="false"
- v-model="formData.actualAmount"
- placeholder="请输入收费金额"
- :min="0"
- />
- <div style="padding-left: 8px;">大写({{numberToChinese(formData.actualAmount)}})含税</div>
- </el-form-item>-->
- <div class="flex items-center gap-32 ml-40px text-14px">
- <span>应收法定金额: {{ formData.shouldAmount }}</span>
- <span>服务收费金额:{{ formData.serviceAmount }}</span>
- <span>免征费用: {{ formData.reduceFee }}</span>
- </div>
- </el-col>
- <!-- <el-col :span="24">
- <!– 年度检查 –>
- <el-form-item label="" prop="feeDate" label-width="30" v-if="orderDetail?.checkType == 200">
- <div class="feeDate_box">
- 甲方在本服务单签订之日起
- <el-input-number :controls="false" v-model="formData.feeDate" placeholder="请输入" :maxlength="50"/>
- 日内一次性支付。
- </div>
- </el-form-item>
- </el-col>-->
- </el-row>
- </el-form>
- </ContentWrap>
- <!-- 添加设备弹窗 -->
- <PipeAddEquipDialog
- v-model:visible="addEquipVisible"
- type="confirm"
- :target-id="orderDetail?.id || ''"
- :unit-code="orderDetail?.unitCode || ''"
- :unit-name="orderDetail?.unitName || ''"
- @success="handleAddEquipSuccess"
- />
- <!-- 拒绝约检弹窗 -->
- <el-dialog
- v-model="rejectDialogVisible"
- title="拒绝约检"
- width="600px"
- destroy-on-close
- :close-on-click-modal="false"
- >
- <div class="mb-4">
- <!-- <div v-for="equip in selectedRows" :key="equip.id" class="mb-2">
- 工程号:{{ equip.projectNo }}
- </div> -->
- 管道数量: {{ selectedPipeCount }}
- </div>
-
- <div class="mb-4">
- 检验性质:{{ orderDetail?.checkType ? allCheckTypeMap[orderDetail.equipMainType][orderDetail.checkType] : '' }}
- </div>
- <div class="mb-4 flex flex-start items-center">
- <div class="!w-80px">拒绝原因:</div>
- <el-select v-model="rejectForm.reasonDict" placeholder="请选择拒绝原因" @change="() => {rejectForm.reason = ''}">
- <el-option
- v-for="dict in getStrDictOptions('refuseInspectedCategory')"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </div>
- <div class="mb-4" v-if="rejectForm.reasonDict == '5'">
- <div class="mb-2">说明:</div>
- <el-input
- v-model.trim="rejectForm.reason"
- type="textarea"
- :rows="4"
- placeholder="请输入"
- resize="none"
- :maxlength="100"
- show-word-limit
- />
- </div>
- <template #footer>
- <div class="flex justify-end items-center">
- <!-- 拒绝约检:拒绝原因=检验项目调整(6)时只显示"无需上报"(不进入上报中心,只在约检单中删除设备);其他原因显示"上报市局" -->
- <el-button v-if="rejectForm.reasonDict != '6'" type="primary" :loading="rejectLoading" @click="handleRejectConfirm(100)">上报市局</el-button>
- <el-button v-if="rejectForm.reasonDict == '6'" type="warning" :loading="rejectLoading" @click="handleRejectConfirm(300)">无需上报</el-button>
- <el-button @click="rejectDialogVisible = false">取消</el-button>
- </div>
- </template>
- </el-dialog>
- <!-- 页面底部按钮 -->
- <div class="flex justify-center pb-4">
- <el-button @click="handleClose" :loading="loading">关闭</el-button>
- <el-button v-if="!route.query.id || orderDetail?.createAcceptOrder === false" type="primary" :loading="loading" @click="handleGenerateAcceptance">
- 生产任务单
- </el-button>
- <el-button type="primary" @click="handleSave" :loading="loading">保存</el-button>
- </div>
- <PipeBatchEditForm ref="batchEditFormRef" @success="()=>handleEquipQuery(true)"/>
- <EquipContainerForm ref="EquipContainerFormRef" />
- <FileUploadModal ref="fileUploadModalRef" @success="handleFileUploadSuccess" />
- <!-- 批量修改地址弹窗 -->
- <el-dialog v-model="batchEditLocationVisible" title="批量修改地址" width="500px" :close-on-click-modal="false">
- <el-form ref="batchEditLocationFormRef" :model="batchEditLocationFormData" :rules="batchEditLocationFormRules" label-width="140px">
- <el-form-item label="设备所在行政区" prop="equipDistrict">
- <AreaSelect v-model="batchEditLocationFormData.equipDistrict" :areaType="batchEditLocationFormData.areaType" @area-type-change="changeArea" @change="changeAddress" placeholder="请选择设备所在行政区" />
- </el-form-item>
- <el-form-item label="设备所在街道" prop="equipStreet">
- <StreetSelect v-model="batchEditLocationFormData.equipStreet" :district-ids="[batchEditLocationFormData.equipDistrict]" placeholder="请选择设备所在街道" />
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button :loading="batchEditLocationLoading" @click="batchEditLocationVisible = false">取消</el-button>
- <el-button type="primary" :loading="batchEditLocationLoading" @click="batchEditLocationSubmitForm">批量修改</el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup lang="tsx">
- import { ref, onMounted, computed, watch, nextTick } from 'vue'
- import { useRoute, useRouter } from 'vue-router'
- import { ElMessage, ElMessageBox } from 'element-plus'
- import PipeBatchEditForm from '../planNew/components/PipeBatchEditForm.vue'
- import {
- BoilerAppointmentConfirmOrderApi,
- BoilerAppointmentConfirmOrderEquipmentVO,
- BoilerAppointmentConfirmOrderVO
- } from '@/api/pressure2/appointmentconfirmorder'
- import { EquipBoilerSchedulingEquipVO } from '@/api/pressure2/equipboilerscheduling'
- import dayjs from 'dayjs'
- import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
- import DeptSelect from '../../pressure2/equipboilerscheduling/components/DeptSelect.vue'
- import AreaSelect from '../../system/equipcontainer/components/AreaSelect.vue'
- import StreetSelect from '../../system/equipcontainer/components/StreetSelect.vue'
- import PipeAddEquipDialog from '../schedule/components/PipeAddEquipDialog.vue'
- import {formatArrayDate, formatDate} from '@/utils/formatTime'
- import EquipContainerForm from '@/components/EquipContainerForm/index.vue'
- import { useTagsViewStore } from '@/store/modules/tagsView'
- import {
- PressureCheckTypeMap,
- PressureFeeTypeMap,
- PressureFeeNatureMap,
- PressureFeeNature,
- allCheckTypeMap
- } from '@/utils/constants'
- import { useEmitt } from '@/hooks/web/useEmitt'
- import { getUnitNewList, getUnitContacts } from '@/api/laboratory/unit'
- import { getUnitInfo, UpdateUnitVO } from '@/api/laboratory/unit'
- import unitContainerForm from '@/components/unitContainerForm/index.vue'
- import { numberToChinese } from '@/utils/formatter'
- import FileUploadModal from './components/ImportFile.vue'
- import { buildFileUrl } from '@/utils'
- import { Icon } from '@/components/Icon'
- import { cloneDeep } from 'lodash-es'
- import {
- PipeEquipmentApi,
- PipeEquipmentDetailVO,
- PipeEquipmentVO
- } from "@/api/pressure2/pipeequipment";
- import {PipeAppointmentConfirmOrderApi} from "@/api/pressure2/pipeappointmentconfirmorder";
- import { EquipPipeSchedulingApi } from "@/api/pressure2/pipescheduling";
- import {UserQualificationsApi} from "@/api/pressure2/userQualifications";
- import CheckerSelect, { type CheckerItem } from '@/views/pressure2/components/CheckerSelect'
- import { useUserStoreWithOut } from '@/store/modules/user'
- import { getDept } from '@/api/system/dept'
- import { EquipPipeApi } from '@/api/pressure2/equippipe'
- const { emitter } = useEmitt()
- const route = useRoute()
- const router = useRouter()
- const tagsViewStore = useTagsViewStore()
- const batchEditFormRef = ref()
- const unitData = ref<UpdateUnitVO>({} as UpdateUnitVO)
- const unitContainerFormRef = ref<InstanceType<typeof unitContainerForm>>()
- const getUnitDetail = async (unitId: string) => {
- try {
- const res = await getUnitInfo({ id: unitId })
- unitData.value = res
- } catch (error) {
- console.error('获取单位详情失败:', error)
- }
- }
- const handleUnitCodeFn = (id) => {
- if (!id) { return ElMessage.warning('该单位信息异常!') }
- unitContainerFormRef.value?.open(id)
- }
- const batchEditLocationVisible = ref(false)
- const batchEditLocationLoading = ref(false)
- const batchEditLocationFormRef = ref()
- const batchEditLocationFormData = ref({
- areaType: '',
- equipDistrict: '',
- equipStreet: '',
- })
- const batchEditLocationFormRules = {
- equipDistrict: [{ required: true, message: '请选择设备所在行政区', trigger: 'change' }],
- equipStreet: [{ required: true, message: '请选择设备所在街道', trigger: 'change' }],
- }
- const orderDetail = ref<BoilerAppointmentConfirmOrderVO>()
- const checkTypeMap = PressureCheckTypeMap
- const boilerTypeOptions = getStrDictOptions(DICT_TYPE.SYSTEM_EQUIP_BOILER_TYPE)
- const formData = ref<Record<string,any>>({
- checkType: '', //检验性质
- appointmentDate: '',
- teamList: [] as string[],
- unitName: {
- name: '',
- id: ''
- },
- deptName: '',
- equipDistrict: undefined as number | undefined,
- equipDistrictName: '',
- equipStreet: '',
- equipStreetName: '',
- unitContact: '',
- unitCode: '',
- unitContactDept: '',
- unitAddress: '',
- unitPhone: '',
- zipCode: '',
- mobile: '',
- remark: '',
- email: '',
- isAttach: false,
- sendType: '100',
- vehicle: '100',
- feeType: '100',
- acceptType: '100',
- actualAmount: 0,
- serviceAmount: 0,
- shouldAmount: 0,
- reduceFee: 0,
- planMaker: '',
- deptId: '',
- operator: '',
- areaDisplay: '',
- socialCreditCode: '',
- recipient: '',
- recipientPhone: '',
- recipientEmail: '',
- useUnitName: {
- name: '',
- id: ''
- },
- useUnitId: '',
- useUnitSocialCreditCode: '',
- useUnitAddress: '',
- useUnitZipcode: '',
- useUnitContact: '',
- useUnitPhone: '',
- deptPhone: '',
- feeNature: '',
- feeDate: 0,
- descritionFile: [],
- })
- const checkStatusMap = {
- '100': '定期检验',
- '200': '年度检查',
- }
- const loading = ref(false)
- // 检验员组件引用
- const checkerSelectRef = ref()
- // 选中的检验员对象列表
- const selectedCheckers = ref<CheckerItem[]>([])
- const userStore = useUserStoreWithOut()
- const EquipContainerFormRef = ref<InstanceType<typeof EquipContainerForm>>()
- // 记录每个区域下已选择的街道
- const areaStreetMap = ref(new Map<number, number[]>())
- const selectedRows = ref([]) // 选中的行
- const selectedDetailRows = ref([]) // 选中的行
- const tableRef = ref()
- // 设备查询相关
- const equipQueryParams = ref({
- pageNo: 1,
- pageSize: 50,
- equipDistrict: undefined as number[] | undefined,
- equipStreet: undefined as number[] | undefined,
- equipCode: '',
- productNo: '',
- relateDepartment: '' as string | number | undefined,
- typeList: [] as string[],
- nextDate: [] as string[],
- useStatus: [] as string[],
- })
- const equipQueryFormRef = ref()
- const equipLoading = ref(false)
- const equipList = ref<EquipBoilerSchedulingEquipVO[]>([])
- // 选中的设备
- const selectedEquips = ref<EquipBoilerSchedulingEquipVO[]>([])
- const equipTotal = ref(0)
- const equipCategoryOptions = getStrDictOptions(DICT_TYPE.SYSTEM_EQUIP_CONTAINER_EQUIP_CATEGORY)
- const containerTypeOptions = getStrDictOptions(DICT_TYPE.PIPE_TYPE)
- // 临检时间相关
- const datePickerType = ref<'daterange' | 'month'>('month')
- const daterange = ref<string[]>([])
- const month = ref<string>('')
- // 添加设备相关
- const addEquipVisible = ref(false)
- // 拒绝约检相关
- const rejectDialogVisible = ref(false)
- const rejectLoading = ref(false)
- const rejectForm = ref({
- reason: '',
- reasonDict: ''
- })
- const formRef = ref() // 表单引用
- /** 约检确认详情 */
- defineOptions({ name: 'OrderConfirmDetail' })
- // 表单验证规则
- const formRules = {
- // unitContact: [
- // { required: true, message: '请输入单位联系人', trigger: 'blur' }
- // ],
- // unitPhone: [
- // { required: true, message: '请输入单位联系电话', trigger: 'blur' },
- // ],
- // mobile: [
- // { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
- // ],
- email: [
- { pattern: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/, message: '请输入正确的邮箱', trigger: 'blur' }
- ],
- // unitPhone: [
- // { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
- // ],
- // recipientPhone: [
- // { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
- // ],
- recipientEmail: [
- { pattern: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/, message: '请输入正确的邮箱', trigger: 'blur' }
- ],
- // payerContact: [
- // { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
- // ],
- payerMail: [
- { pattern: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/, message: '请输入正确的邮箱', trigger: 'blur' }
- ],
- sendType: [
- { required: true, message: '请选择送达方式', trigger: 'blur' }
- ],
- // feeType: [
- // { required: true, message: '请选择收费类型', trigger: 'blur' }
- // ],
- acceptType: [
- { required: true, message: '请选择受理方式', trigger: 'blur' }
- ],
- vehicle: [
- { required: true, message: '请选择交通工具', trigger: 'blur' }
- ],
- checkType: [
- { required: true, message: '请选择检验性质', trigger: 'blur' }
- ]
- }
- // 区域显示属性,与formData.areaDisplay分离
- const areaDisplay = computed(() => {
- const district = formData.value.equipDistrictName || ''
- const street = formData.value.equipStreetName || ''
- if (district && street) {
- return `${district}-${street}`
- }
- return district
- })
- const selectedPipeCount = computed(() => {
- let count = 0
- for (const row of selectedRows.value) {
- const selectedSubRows = selectedDetailRows.value.filter(item => item.equipPipeId === row.id)
- if (selectedSubRows.length > 0) {
- count += selectedSubRows.length
- } else {
- count += (row.detailSaveReqVOS || []).length
- }
- }
- return count
- })
- // 获取约检详情
- const getDetail = async () => {
- const id = route.query?.id as string
- if (!id) return
-
- loading.value = true
- try {
- const res = await PipeAppointmentConfirmOrderApi.getAppointmentConfirmOrder(id);
- let { unitCode, payerContact, payerContactName, payerMail, email } = res;
- orderDetail.value = res || {};
- // 更新表单数据
- formData.value = {
- ...formData.value,
- checkType: `${orderDetail.value?.checkType }`,
- appointmentDate: formatArrayDate(orderDetail.value?.appointmentDate || []),
- unitName: {
- name: orderDetail.value?.unitName || '',
- id: ''
- },
- useUnitName: {
- name: orderDetail.value?.useUnitName || '',
- id: orderDetail.value?.useUnitId || ''
- },
- useUnitId: orderDetail.value?.useUnitId || '',
- deptName: orderDetail.value?.deptName || '',
- equipDistrict: orderDetail.value?.equipDistrict ? Number(orderDetail.value.equipDistrict) : undefined,
- equipDistrictName: orderDetail.value?.equipDistrictName || '',
- unitContact: orderDetail.value?.unitContact || '',
- unitCode,
- unitAddress: orderDetail.value?.unitAddress || '',
- unitPhone: orderDetail.value?.unitPhone || '',
- zipCode: orderDetail.value?.zipCode || '',
- mobile: orderDetail.value?.mobile || '',
- remark: orderDetail.value?.remark || '',
- // email: orderDetail.value?.email || '',
- isAttach: orderDetail.value?.isAttach || false,
- sendType: String(orderDetail.value?.sendType || 100),
- vehicle: String(orderDetail.value?.vehicle || 100),
- feeType: String(orderDetail.value?.feeType || 100),
- acceptType: String(orderDetail.value?.acceptType || 100),
- actualAmount: orderDetail.value?.actualAmount || 0,
- serviceAmount: orderDetail.value?.serviceAmount || 0,
- shouldAmount: orderDetail.value?.shouldAmount || 0,
- reduceFee: orderDetail.value?.reduceFee || 0,
- deptId: orderDetail.value?.deptId || '',
- operator: orderDetail.value?.operator || '',
- equipStreetName: orderDetail.value?.equipStreetName || '',
- areaDisplay: areaDisplay.value,
- socialCreditCode: orderDetail.value?.socialCreditCode,
- recipient: orderDetail.value?.recipient,
- recipientPhone: orderDetail.value?.recipientPhone,
- recipientEmail: orderDetail.value?.recipientEmail,
- useUnitSocialCreditCode: orderDetail.value?.useUnitSocialCreditCode,
- useUnitAddress: orderDetail.value?.useUnitAddress,
- useUnitZipcode: orderDetail.value?.useUnitZipcode,
- useUnitContact: orderDetail.value?.useUnitContact,
- useUnitPhone: orderDetail.value?.useUnitPhone,
- deptPhone: orderDetail.value?.deptPhone,
- feeNature: `${orderDetail.value?.feeNature}`,
- feeDate: orderDetail.value?.feeDate || 0,
- payerContact,
- payerContactName,
- payerMail,
- email,
- }
- // 更新异常信息数据
- // 更新检验员数据
- const orderExceptionRespVO = res.orderExceptionRespVO
- if(orderExceptionRespVO){
- exceptionInfo.value = {
- ...orderExceptionRespVO,
- adjustEffectiveDate: orderExceptionRespVO.adjustEffectiveDate ? dayjs(orderExceptionRespVO.adjustEffectiveDate.join('-')).format('YYYY-MM-DD') : '',
- }
- }
- console.log(exceptionInfo.value, 'exceptionInfo')
- const teamList = orderDetail.value?.teamList?.flatMap((team: any) => {
- const teamMembers: any[] = []
-
- // 处理组长
- if (team.leaders && team.leaders.length > 0) {
- team.leaders.forEach((leader: any) => {
- if (leader) {
- teamMembers.push({
- memberId: leader.id,
- groupTeamId: team.groupTeamId,
- isLeader: true,
- member: leader
- })
- }
- })
- }
-
- // 处理组员
- if (team.members && team.members.length > 0) {
- team.members.forEach((member: any) => {
- if (member) {
- teamMembers.push({
- memberId: member.id,
- groupTeamId: team.groupTeamId,
- isLeader: false,
- member: member
- })
- }
- })
- }
-
- return teamMembers
- }) || []
- if (teamList.length > 0) {
- selectedCheckers.value = teamList
- formData.value.teamList = teamList
- }
-
- // 加载检验员列表(默认当前登录人的部门)
- const deptId = userStore.getUser.deptId?.toString()
- if (deptId) {
- await nextTick()
- checkerSelectRef.value?.getCheckerList(deptId)
- }
- // 加载单位详细信息
- if (orderDetail.value?.useUnitId) {
- await getUnitDetail(orderDetail.value.useUnitId)
- }
- } catch (error) {
- console.error('获取计划详情失败:', error)
- ElMessage.error('获取计划详情失败')
- router.back()
- } finally {
- loading.value = false
- }
- }
- /** 处理检验员变化 */
- const handleCheckerChange = (checkers: CheckerItem[]) => {
- selectedCheckers.value = checkers
- // 同步更新 formData.value.teamList
- formData.value.teamList = checkers
- }
- /** 禁用日期 */
- const disabledDate = (time: Date) => {
- // 获取所有设备的最早检验日期
- const dates = equipList.value.map(item => {
- if (orderDetail.value?.checkType === 100) {
- return item.nextCheckDate ? formatArrayDate(item.nextCheckDate) : null
- } else if (orderDetail.value?.checkType === 200) {
- return item.nextYearCheckDate ? formatArrayDate(item.nextYearCheckDate) : null
- } else {
- return item.nextExpiredCheckDate ? formatArrayDate(item.nextExpiredCheckDate) : null
- }
- }).filter(Boolean) as any
-
- // 如果没有有效日期,则禁用过去的日期
- if (dates.length === 0) {
- return time.getTime() < dayjs().startOf('day').valueOf()
- }
- // 找到最早的检验日期
- const earliestDate = new Date(Math.min(...dates.map(date => new Date(date).getTime())))
-
- // 禁用早于最早检验日期的日期
- return time.getTime() > earliestDate.getTime()
- }
- // 存储所有子表引用的对象
- const detailTableRefs = ref<Record<string, any>>({})
- const setDetailTableRef = (el: any, parentId: string) => {
- if (el) {
- detailTableRefs.value[parentId] = el;
- }
- }
- const getDetailTableRef = (parentId: string) => {
- return detailTableRefs.value[parentId];
- }
- const handleDetailSelectionChange = (selection: any[], mainRow: any) => {
- // 如果正在恢复选中状态,不更新缓存(避免展开时 toggleRowSelection 触发此函数覆盖缓存)
- if (isRestoringSelection.value) {
- return
- }
-
- const rowId = mainRow.id
-
- // 更新缓存中的选中状态(如果缓存不存在则创建)
- if (!expandedRowsCache.value.has(rowId)) {
- // 如果该行还未展开,初始化缓存
- expandedRowsCache.value.set(rowId, {
- pipes: mainRow.detailSaveReqVOS || [],
- selectedIds: new Set<string>()
- })
- }
- const cache = expandedRowsCache.value.get(rowId)!
- cache.selectedIds = new Set(selection.map((item: any) => item.id))
-
- // 更新全局选中的子表数据
- selectedDetailRows.value = selectedDetailRows.value.filter((item) => item.equipPipeId !== mainRow.id)
- selectedDetailRows.value = [...selectedDetailRows.value.filter(row => !selection.some(sel => sel.id === row.id)), ...selection]
-
- // 如果子表有选中项,则自动选中主表行;否则取消选中主表行
- nextTick(() => {
- if (selection.length > 0) {
- // 子表有选中项,选中主表行
- tableRef.value.toggleRowSelection(mainRow, true);
- } else if (!selectedDetailRows.value.map(row => row.equipPipeId).includes(mainRow.id)) {
- const currentlySelected = selectedRows.value.some(row => row.id === mainRow.id);
- if (currentlySelected && selection.length === 0) {
- // 只有当主行当前是选中状态且子表没有任何选中项时才取消主行选择
- tableRef.value.toggleRowSelection(mainRow, false);
- }
- }
- });
- }
- const handleSelectionChange = async (selection: any[]) => {
- // 计算取消选择的行
- const deselectedRows = selectedRows.value.filter(
- item => !selection.includes(item)
- );
- selectedRows.value = selection
-
- // 清除取消选中行的子表选择(包括展开的和收起的)
- deselectedRows.forEach(item => {
- const rowId = item.id
- // 如果该行是展开状态,直接清除表格选中
- const tableRef = getDetailTableRef(rowId)
- if (tableRef) {
- tableRef.clearSelection()
- }
-
- // 无论是否展开,都清除缓存中的选中状态
- if (expandedRowsCache.value.has(rowId)) {
- expandedRowsCache.value.get(rowId)!.selectedIds.clear()
- }
-
- // 从全局选中的子表数据中移除
- selectedDetailRows.value = selectedDetailRows.value.filter(
- detailRow => detailRow.equipPipeId !== rowId
- )
- })
- }
- // 标志位:防止展开时恢复选中状态触发 handleDetailSelectionChange 覆盖缓存
- const isRestoringSelection = ref(false)
- // 已展开行的 key 列表
- const expandRowKeys = ref<string[]>([])
- // 缓存展开行的子表数据和选中状态
- const expandedRowsCache = ref<Map<string, { pipes: any[], selectedIds: Set<string> }>>(new Map())
- const getMainRowClassName = ({ row }) => {
- const isSelected = tableRef.value?.getSelectionRows().some((item) =>
- item.id === row.id
- )
- return isSelected ? 'selected-row' : ''
- }
- const getRowClassName = ({row}) => {
- // 找到当前行所在的分组,从 Map 中获取对应的表格实例
- const tableRef = getDetailTableRef(row.equipPipeId)
- if (tableRef) {
- const isSelected = tableRef.getSelectionRows().some((item) =>
- item.id === row.id
- )
- return isSelected ? 'selected-row' : ''
- }
- return ''
- }
- const handleExpandChange = (row, expandedRows: any[]) => {
- const rowId = row.id
- const isExpanded = expandedRows.some((r) => r.id === rowId)
-
- if (isExpanded) {
- // 展开时,从缓存中恢复或初始化
- if (!expandedRowsCache.value.has(rowId)) {
- // 首次展开,初始化缓存
- expandedRowsCache.value.set(rowId, {
- pipes: row.detailSaveReqVOS || [],
- selectedIds: new Set<string>()
- })
- }
- // 恢复选中状态
- nextTick(() => {
- const cache = expandedRowsCache.value.get(rowId)
- const tableRef = getDetailTableRef(rowId)
- if (cache && tableRef && cache.pipes.length > 0) {
- // 设置标志位,防止触发 handleDetailSelectionChange
- isRestoringSelection.value = true
-
- cache.pipes.forEach((pipe) => {
- if (cache.selectedIds.has(pipe.id)) {
- tableRef.toggleRowSelection(pipe, true)
- }
- })
-
- // 恢复完成后,延迟重置标志位
- nextTick(() => {
- isRestoringSelection.value = false
- })
- }
- })
- } else {
- // 收起时,保存当前选中状态
- const tableRef = getDetailTableRef(rowId)
- if (tableRef) {
- const currentSelection = tableRef.getSelectionRows()
- const selectedIds = new Set(currentSelection.map((item: any) => item.id))
- expandedRowsCache.value.set(rowId, {
- pipes: row.detailSaveReqVOS || [],
- selectedIds: selectedIds
- })
- }
- }
-
- // 更新展开的行 key 列表
- expandRowKeys.value = expandedRows.map((r) => r.id)
- }
- /** 处理行点击勾选 */
- const handleMainRowClick = (row, _event,_column) => {
- tableRef.value?.toggleRowSelection(row)
- }
- const handleRowClick = (row, _event, column) => {
- // 如果点击的是选择列,不处理
- if (column.type === 'selection') {
- return
- }
- // 找到当前行所在的分组,从 Map 中获取对应的表格实例
- const tableRef = getDetailTableRef(row.equipPipeId)
- if (tableRef && tableRef.toggleRowSelection) {
- tableRef.toggleRowSelection(row)
- }
- }
- const toggleExpand = async (row: any) => {
- const key = row.id
- if (!expandRowKeys.value.includes(key)) {
- await PipeAppointmentConfirmOrderApi.getPipeEquipmentDetailListByPipeEquipmentId(orderDetail.value.id, key).then((res) => {
- let find = equipList.value.find(item => item.id === key);
- find.detailSaveReqVOS = res.list
- })
- }
- tableRef.value.toggleRowExpansion(row)
- }
- const handleSortChange = ({ prop, order }) => {
- if (!prop || !order) {
- equipList.value.sort((a, b) => 0) // 重置排序
- return
- }
- equipList.value.sort((a, b) => {
- const aValue = a[prop] || ''
- const bValue = b[prop] || ''
- if (order === 'ascending') {
- return aValue > bValue ? 1 : -1
- } else {
- return aValue < bValue ? 1 : -1
- }
- })
- }
- // 设备查询相关
- const handleEquipQuery = async (isUpdateContact: boolean = false) => {
- equipLoading.value = true
- try {
- const params = {
- pageNo: equipQueryParams.value.pageNo,
- pageSize: equipQueryParams.value.pageSize,
- orderId: orderDetail.value?.id,
- equipCode: equipQueryParams.value.equipCode,
- productNo: equipQueryParams.value.productNo,
- relateDepartment: equipQueryParams.value.relateDepartment,
- equipDistrict: equipQueryParams.value.equipDistrict,
- equipStreet: equipQueryParams.value.equipStreet,
- typeList: equipQueryParams.value.typeList || [],
- nextDate: equipQueryParams.value.nextDate || [],
- useStatus: equipQueryParams.value.useStatus && equipQueryParams.value.useStatus.length > 0
- ? equipQueryParams.value.useStatus.map((item) => +item)
- : [],
- unitName: formData.value.useUnitName.name,
- }
-
- // 移除空值
- Object.keys(params).forEach(key => {
- if (params[key] === '' || params[key] === undefined || params[key] === null) {
- delete params[key]
- }
- // 处理空数组
- if (Array.isArray(params[key]) && params[key].length === 0) {
- delete params[key]
- }
- })
- // 重置展开状态、选中状态和缓存
- expandRowKeys.value = []
- selectedDetailRows.value = []
- selectedRows.value = []
- expandedRowsCache.value.clear()
- // 调用后端API获取数据
- const res = await PipeAppointmentConfirmOrderApi.getAppointmentConfirmOrderEquipmentList(params)
- equipList.value = res.list
- equipTotal.value = res.total
- // 批量修改约检联系人后,申请单位约检联系人与手机号,报告接收人与手机号同步修改。若使用单位与申请单位一致时,也需进行同步修改
- if(isUpdateContact && equipList.value.length > 0){
- const { contact, contactPhone } = equipList.value[0]
- formData.value.unitContact = contact
- formData.value.unitPhone = contactPhone
- formData.value.recipient = contact
- formData.value.recipientPhone = contactPhone
- if(formData.value.unitName.name === formData.value.useUnitName.name){
- formData.value.useUnitContact = contact
- formData.value.useUnitPhone = contactPhone
- }
- try {
- // 组装提交数据
- const submitData = {
- id: orderDetail.value?.id,
- unitContact: formData.value.unitContact,
- unitPhone: formData.value.unitPhone,
- recipient: formData.value.recipient,
- recipientPhone: formData.value.recipientPhone,
- useUnitContact: formData.value.useUnitContact,
- useUnitPhone: formData.value.useUnitPhone,
- }
- await PipeAppointmentConfirmOrderApi.saveAcceptOrder(submitData)
- } catch (error) {
- ElMessage.error('提交失败')
- }
- }
-
- } finally {
- equipLoading.value = false
- }
- }
- const handleEquipCodeFn = (id?: number) => {
- EquipContainerFormRef.value.open(id)
- }
- const resetEquipQuery = () => {
- // 重置查询参数
- equipQueryParams.value = {
- pageNo: 1,
- pageSize: 50,
- equipDistrict: undefined,
- equipStreet: undefined,
- equipCode: '',
- productNo: '',
- relateDepartment: '',
- typeList: [],
- nextDate: [],
- useStatus: [],
- }
-
- // 重置区域-街道映射
- areaStreetMap.value.clear()
-
- // 重置日期相关字段
- daterange.value = []
- month.value = ''
- datePickerType.value = 'month'
-
- // 重新查询数据
- handleEquipQuery()
- }
- const handleEquipSelectionChange = (selection) => {
- // 实现设备选择逻辑
- selectedEquips.value = selection
- }
- const handleEquipSortChange = (sort) => {
- // 实现设备排序逻辑
- }
- /** 处理区域变化 */
- const handleAreaChange = (areas: number[]) => {
- // 获取移除的区域(通过比较之前的区域列表和现在的区域列表)
- const prevAreas = Array.from(areaStreetMap.value.keys())
- const removedAreas = prevAreas.filter(area => !areas.includes(area))
-
- // 移除取消选择的区域下的街道
- if (removedAreas.length > 0) {
- const currentStreets = equipQueryParams.value.equipStreet || []
- removedAreas.forEach(areaId => {
- const streetsToRemove = areaStreetMap.value.get(areaId) || []
- // 从当前选中的街道中移除这些街道
- equipQueryParams.value.equipStreet = currentStreets.filter(
- streetId => !streetsToRemove.includes(streetId)
- )
- // 从映射中移除该区域
- areaStreetMap.value.delete(areaId)
- })
- }
- }
- /** 处理区域清空 */
- const handleAreaClear = () => {
- // 清空所有选中的街道
- equipQueryParams.value.equipStreet = []
- // 清空区域-街道映射
- areaStreetMap.value.clear()
- }
- /** 处理街道变化 */
- const handleStreetChange = (streets: number[], areaId: number) => {
- // 更新区域-街道映射
- if (equipQueryParams.value.equipDistrict?.includes(areaId)) {
- areaStreetMap.value.set(areaId, streets)
- }
- }
- /** 处理街道清空 */
- const handleStreetClear = () => {
- // 清空所有区域下的街道选择
- areaStreetMap.value.clear()
- }
- /** 处理日期范围变化 */
- const handleDateChange = (val: [string, string] | null) => {
- daterange.value = val || []
- equipQueryParams.value.nextDate = val
- ? [
- dayjs(val[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'),
- dayjs(val[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
- ]
- : []
- }
- /** 处理月份变化 */
- const handleMonthChange = (val: string | null) => {
- if (!val) {
- equipQueryParams.value.nextDate = []
- return
- }
-
- const date = dayjs(val)
- equipQueryParams.value.nextDate = [
- date.startOf('month').format('YYYY-MM-DD HH:mm:ss'),
- date.endOf('month').format('YYYY-MM-DD HH:mm:ss')
- ]
- month.value = val
- }
- // 监听日期类型变化
- watch(datePickerType, (newVal) => {
- // 清空日期相关字段
- daterange.value = []
- month.value = ''
- equipQueryParams.value.nextDate = []
- })
- /** 拒绝约检 */
- const handleRejectEquip = async () => {
- if (selectedRows.value.length === 0 && selectedDetailRows.value.length === 0) {
- ElMessage.warning('请选择要拒绝约检的设备')
- return
- }
- // 为未加载子表数据的主表行预加载子表,确保管道数量正确显示
- const unloadedRows = selectedRows.value.filter(row => !row.detailSaveReqVOS || row.detailSaveReqVOS.length === 0)
- if (unloadedRows.length > 0) {
- const promises = unloadedRows.map(row =>
- PipeAppointmentConfirmOrderApi.getPipeEquipmentDetailListByPipeEquipmentId(orderDetail.value.id, row.id)
- )
- const results = await Promise.all(promises)
- results.forEach((res, index) => {
- const row = unloadedRows[index]
- const find = equipList.value.find(item => item.id === row.id)
- if (find) {
- find.detailSaveReqVOS = res.list || []
- }
- })
- }
- rejectForm.value.reasonDict = ''
- rejectForm.value.reason = ''
- rejectDialogVisible.value = true
- }
- /** 处理批量修改 */
- const handleBatchEditFn = () => {
- if (selectedRows.value.length === 0) {
- ElMessage.warning('请至少选择一条设备数据')
- return
- }
- batchEditFormRef.value.open(selectedRows.value, '1')
- }
- /** 批量修改地址 */
- const handleBatchEditLocationFn = () => {
- if (selectedRows.value.length === 0) {
- ElMessage.warning('请先选择设备')
- return
- }
- const firstEquip = selectedRows.value[0]
- batchEditLocationFormData.value.areaType = firstEquip.areaType || ''
- batchEditLocationFormData.value.equipDistrict = firstEquip.equipDistrict || ''
- batchEditLocationFormData.value.equipStreet = firstEquip.equipStreet || ''
- batchEditLocationVisible.value = true
- }
- const changeArea = (areaType: 'all' | 'gz') => {
- batchEditLocationFormData.value.areaType = areaType
- }
- const changeAddress = () => {
- batchEditLocationFormData.value.equipStreet = null as any
- setTimeout(() => {
- batchEditLocationFormRef.value?.clearValidate(['equipStreet'])
- }, 0)
- }
- const batchEditLocationSubmitForm = async () => {
- if (!batchEditLocationFormRef.value) return
- const valid = await batchEditLocationFormRef.value.validate()
- if (!valid) return
- batchEditLocationLoading.value = true
- try {
- const data = {
- ...batchEditLocationFormData.value,
- ids: selectedRows.value.map((item: any) => item.id)
- }
- await EquipPipeSchedulingApi.batchUpdateDistrict(data)
- ElMessage.success('修改成功')
- handleEquipQuery()
- batchEditLocationVisible.value = false
- } catch {
- ElMessage.error('修改失败')
- } finally {
- batchEditLocationLoading.value = false
- }
- }
- /** 确认拒绝约检 */
- const handleRejectConfirm = async (type) => {
- if (!rejectForm.value.reasonDict) {
- ElMessage.warning('请选择拒绝原因')
- return
- }
- if (rejectForm.value.reasonDict == '5' && !rejectForm.value.reason) {
- ElMessage.warning('请输入说明')
- return
- }
- const equipIds = selectedRows.value.map(e => e.id)
- let detailEquipRows = selectedDetailRows.value
- // 勾选了主表没有勾选子表,将子表全部加到detailEquipRows
- for (let i = 0; i < equipIds.length; i++) {
- const equipId = equipIds[i]
- if (!detailEquipRows.find(item => item.equipPipeId === equipId)) {
- const detailRows = await PipeAppointmentConfirmOrderApi.getPipeEquipmentDetailListByPipeEquipmentId(orderDetail.value.id, equipId)
- detailEquipRows = detailEquipRows.concat(detailRows.list)
- }
- }
- const submitData = {
- equipIds,
- orderId: orderDetail.value?.id,
- detailEquipRows,
- type,
- reasonDict: rejectForm.value.reasonDict,
- reason: rejectForm.value.reason,
- orderNo: orderDetail.value?.appointmentNo,
- checkType: orderDetail.value?.checkType
- }
- let alertText = ''
- switch(type) {
- case 100:
- alertText = '上报市局'
- break
- case 200:
- alertText = '拒绝约检'
- break
- case 300:
- alertText = '无需上报'
- break
- default:
- alertText = ''
- }
- rejectLoading.value = true
- try {
- // 调用api
- const res = await PipeAppointmentConfirmOrderApi.refuseAppointmentConfirmOrder(submitData)
- ElMessage.success(alertText + '操作成功')
- rejectLoading.value = false
- // 提交成功后重置表单和关闭对话框
- rejectForm.value.reason = ''
- rejectForm.value.reasonDict = ''
- rejectDialogVisible.value = false
- handleEquipQuery() // 刷新设备列表
- } catch (e) {
- rejectLoading.value = false
- ElMessage.error(alertText + '操作失败')
- }
- }
- /** 添加设备 */
- const handleAddEquip = () => {
- addEquipVisible.value = true
- }
- /** 添加设备成功 */
- const handleAddEquipSuccess = (selectedEquips) => {
- ElMessage.success('添加设备成功')
- // 更新设备列表
- handleEquipQuery()
- }
- /** 生成受理单 */
- const handleGenerateAcceptance = () => {
- console.log('开始验证表单', formRef.value)
- // 表单验证
- if (!formRef.value) {
- ElMessage.warning('表单引用获取失败')
- return
- }
- // 手动触发表单验证
- formRef.value.validate((valid, fields) => {
-
- if (!valid) {
- ElMessage.warning('请完善必填信息')
- console.log('验证失败的字段:', fields)
- return
- }
-
- // 检查排期时间和检验员
- if (!formData.value.appointmentDate) {
- ElMessage.warning('请选择约检时间')
- return
- }
-
- if(!equipList.value.length){
- ElMessage.warning('请添加设备')
- return
- }
-
- // 二次确认
- ElMessageBox.confirm(
- '确认要生成受理单吗?提交后将无法修改。',
- '操作确认',
- {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- }
- ).then(async () => {
- if(exceptionInfo.value.id){
- await handleSaveException()
- }
- // 确认后提交
- submitAcceptance()
- }).catch(() => {
- // 用户取消操作
- console.log('用户取消操作')
- })
- })
- }
- /** 提交受理单 */
- const submitAcceptance = async () => {
- try {
- let { unitCode='' } = formData.value;
- loading.value = true
- // 组装提交数据
- const submitData: Record<string, any> = {
- id: orderDetail.value?.id,
- ...formData.value,
- appointmentDate: formData.value.appointmentDate,
- unitName: formData.value?.unitName?.name,
- unitAddress: formData.value?.unitAddress,
- unitCode,
- unitContact: formData.value.unitContact,
- unitContactDept: formData.value.unitContactDept,
- unitPhone: formData.value.unitPhone,
- equipDistrict: orderDetail.value?.equipDistrict,
- equipStreet: orderDetail.value?.equipStreet,
- zipCode: formData.value.zipCode,
- checkType: orderDetail.value?.checkType,
- equipType: orderDetail.value?.equipType,
- equipMainType: orderDetail.value?.equipMainType,
- deptId: orderDetail.value?.deptId,
- email: formData.value.email,
- mobile: formData.value.mobile,
- remark: formData.value.remark,
- isAttach: formData.value.isAttach,
- sendType: formData.value.sendType,
- vehicle: formData.value.vehicle,
- feeType: formData.value.feeType,
- acceptType: formData.value.acceptType,
- actualAmount: formData.value.actualAmount,
- serviceAmount: formData.value.serviceAmount,
- shouldAmount: formData.value.shouldAmount,
- reduceFee: formData.value.reduceFee,
- useUnitName: formData.value?.useUnitName?.name,
- useUnitId: formData.value?.useUnitName?.id,
- teamList: selectedCheckers.value.reduce((acc: any[], item: any) => {
- const existingGroup = acc.find(
- group => group.groupTeamId === item.groupTeamId
- );
- if (existingGroup) {
- // 避免重复添加相同的 userId,且不添加 leaderId
- if (!item.isLeader && !existingGroup.userIds.includes(item.memberId)) {
- existingGroup.userIds.push(item.memberId);
- }
- } else {
- acc.push({
- groupTeamId: item.groupTeamId,
- leaderId: item.isLeader ? item.memberId : '',
- userIds: item.isLeader ? [] : [item.memberId]
- });
- }
- return acc;
- }, []),
- equipIds: equipList.value.map(e => e.id),
- }
- if(exceptionInfo.value.id){
- submitData.boilerOrderExceptionSaveReqVO = cloneDeep({
- ...exceptionInfo.value,
- adjustEffectiveDate: unref(exceptionInfo).adjustEffectiveDate && unref(exceptionInfo).adjustEffectiveDate.split('-').map(item=>Number(item)),
- })
- }
- // console.log('submitData:', submitData);
-
- // 调用API提交受理单
- await PipeAppointmentConfirmOrderApi.submitAppointmentConfirmOrder(submitData);
- emitter.emit('refresh-list')
- ElMessage.success('受理单生成成功')
- handleClose()
- } catch (error) {
- console.error('生成受理单失败:', error)
- ElMessage.error('生成受理单失败')
- } finally {
- loading.value = false
- }
- }
- /** 保存约检单 */
- const handleSave = () => {
- // console.log('开始验证表单', formRef.value)
- // 表单验证
- if (!formRef.value) return ElMessage.warning('表单引用获取失败')
- // 手动触发表单验证
- formRef.value.validate((valid, fields) => {
- if (!valid) return ElMessage.warning('请完善必填信息')
- // 检查排期时间
- if (!formData.value.appointmentDate) return ElMessage.warning('请选择约检时间')
-
- // 二次确认
- ElMessageBox.confirm(
- '确认保存吗?',
- '操作确认',
- {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- }
- ).then(async () => {
- if(exceptionInfo.value.id){
- await handleSaveException()
- }
- saveAcceptance()
- })
- })
- }
- const saveAcceptance = async () => {
- try {
- loading.value = true
- // 组装提交数据
- let submitData = {
- id: orderDetail.value?.id,
- ...formData.value,
- equipType: orderDetail.value?.equipType,
- equipNum: orderDetail.value?.equipNum,
- unitName: orderDetail.value?.unitName?.name,
- warningDay: orderDetail.value?.warningDay,
- useUnitName: formData.value?.useUnitName?.name,
- useUnitId: formData.value?.useUnitName?.id,
- teamList: formData.value.teamList.reduce((acc: any[], item: any) => {
- const existingGroup = acc.find(
- group => group.groupTeamId === item.groupTeamId
- );
- if (existingGroup) {
- // 避免重复添加相同的 userId,且不添加 leaderId
- if (!item.isLeader && !existingGroup.userIds.includes(item.memberId)) {
- existingGroup.userIds.push(item.memberId);
- }
- } else {
- acc.push({
- groupTeamId: item.groupTeamId,
- leaderId: item.isLeader ? item.memberId : '',
- userIds: item.isLeader ? [] : [item.memberId]
- });
- }
- return acc;
- }, [])
- }
- // 调用API保存
- const res2 = await PipeAppointmentConfirmOrderApi.saveAcceptOrder(submitData)
- if(res2) {
- ElMessage.success('保存成功')
- emitter.emit('refresh-list')
- handleClose()
- }
- } catch (error) {
- ElMessage.error('保存失败')
- } finally {
- loading.value = false
- }
- }
- // 手动输入单位
- const useInputUseUnitName = ref(false)
- const useInputUnitName = ref(false)
- // 清空与单位相关字段的函数
- const clearUnitFields = () => {
- formData.value.unitName.name = ''
- formData.value.socialCreditCode = ''
- formData.value.unitAddress = ''
- formData.value.unitContact = ''
- formData.value.unitPhone = ''
- formData.value.recipient = ''
- formData.value.recipientPhone = ''
- }
- // 监听 useInputUnitName 变化
- watch(useInputUnitName, (newValue) => {
- if (newValue) {
- clearUnitFields()
- }
- })
- // 清空与使用单位相关的字段
- const clearUseUnitFields = () => {
- formData.value.useUnitName.name = ''
- formData.value.useUnitSocialCreditCode = ''
- formData.value.useUnitAddress = ''
- formData.value.useUnitZipcode = ''
- formData.value.useUnitContact = ''
- formData.value.useUnitPhone = ''
- }
- // 监听 useInputUseUnitName 变化
- watch(useInputUseUnitName, (newValue) => {
- if (newValue) {
- clearUseUnitFields()
- }
- })
- // 申请单位名称 change
- const handleChangeUnit = async (unitInfo:any) => {
- formData.value.socialCreditCode = unitInfo.socialCreditCode;
- formData.value.unitAddress = unitInfo.addr
- formData.value.zipCode = unitInfo.post
- if(orderDetail.value?.checkType != 200){
- formData.value.feeNature = unitInfo.isExempt === '1' ? `${PressureFeeNature.SMZFC}` : `${PressureFeeNature.BSMZFC}`
- }
- // 获取单位默认联系人
- const {list: unitDefaultContact} = await getUnitContacts({
- pageNo: 1,
- pageSize: 10,
- unitId: unitInfo.id,
- isDefault: '1'
- })
- if(unitDefaultContact && unitDefaultContact?.length > 0) {
- formData.value.unitContact = unitDefaultContact[0].contactName
- formData.value.unitPhone = unitDefaultContact[0].contactPhone
- formData.value.recipient = unitDefaultContact[0].contactName
- formData.value.recipientPhone = unitDefaultContact[0].contactPhone
- }
- }
- // 使用单位名称 change
- const handleChangeUseUnit = async (unitInfo:any) => {
- console.log('使用单位名称 change:', unitInfo)
- formData.value.useUnitSocialCreditCode = unitInfo.socialCreditCode;
- formData.value.useUnitAddress = unitInfo.addr
- formData.value.useUnitZipcode = unitInfo.post
- formData.value.useUnitId = unitInfo.id
- // 获取单位默认联系人
- const {list: unitDefaultContact} = await getUnitContacts({
- pageNo: 1,
- pageSize: 10,
- unitId: unitInfo.id,
- isDefault: '1'
- })
- if(unitDefaultContact && unitDefaultContact?.length > 0) {
- formData.value.useUnitContact = unitDefaultContact[0].contactName
- formData.value.useUnitPhone = unitDefaultContact[0].contactPhone
- }
- await handleEquipQuery()
- }
- // 使用单位名称input框失焦 & 回车按钮进行查询
- const handleChangeUseUnitInput = () => {
- handleEquipQuery()
- }
- /** 关闭 */
- const handleClose = () => {
- tagsViewStore.closeSelectedTag(route)
- router.push({
- name: 'OrderConfirm',
- })
- }
- // 监听表单区域相关字段变化,更新areaDisplay
- watch([() => formData.value.equipDistrictName, () => formData.value.equipStreetName], () => {
- formData.value.areaDisplay = areaDisplay.value
- })
- const exceptionInfo = ref<Record<string, any>>({})
- const getExceptionItem = (field: string, fieldAttr: string)=>{
- const fileUrl = exceptionInfo.value[fieldAttr] && buildFileUrl(exceptionInfo.value[fieldAttr])
- const fileName = exceptionInfo.value[field]
- if(fileUrl) {
- return (
- <>
- <div class="flex items-center w-full p-l-10px p-r-10px hover:bg-gray-100 rounded-6px">
- {/* <el-tooltip content={fileName}> */}
- <span class="flex-1 text-ellipsis overflow-hidden whitespace-nowrap">{fileName}</span>
- {/* </el-tooltip> */}
- <div class="ml-10px">
- <el-link href={fileUrl} underline={false} download target="_blank" type="primary">下载</el-link>
- </div>
- <div class="ml-10px">
- <el-button link type="danger" onClick={()=>handleRemove(field, fieldAttr)}>删除</el-button>
- </div>
- </div>
- </>
- )
- } else {
- return (
- <el-button type="primary" onClick={()=>handleOpenFileUploadModal(field, fieldAttr)}>
- <Icon icon="ep:upload-filled" />
- <span>附件上传</span>
- </el-button>
- )
- }
- }
- const addExceptionInfo = () => {
- const orderId = formData.value.id || route.query?.id;
- if(!orderId) {
- // ElMessage.error('请先保存订单')
- return
- }
- PipeAppointmentConfirmOrderApi.createExceptionInfo({
- orderId: formData.value.id || route.query?.id,
- orderType: 100,
- }).then((res) => {
- if(res) {
- ElMessage.success('生成成功')
- handleGetExceptionInfo(res)
- }
- }).catch((error)=>{
- ElMessage.error(error)
- })
- }
- const deleteExceptionInfo = () => {
- ElMessageBox.confirm('确定删除异常单吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }).then(() => {
- PipeAppointmentConfirmOrderApi.deleteExceptionInfo(exceptionInfo.value.id).then(res=>{
- if(res) {
- ElMessage.success('删除成功')
- exceptionInfo.value = {}
- }
- })
- }).catch(() => {
- // 取消删除
- });
- }
- // 更新异常信息
- const handleSaveException=()=>{
- return new Promise((resolve, reject)=>{
- const { adjustEffectiveDate } = unref(exceptionInfo)
- const params = {
- ...exceptionInfo.value,
- adjustEffectiveDate: adjustEffectiveDate && adjustEffectiveDate.split('-').map(item=>Number(item)),
- }
- PipeAppointmentConfirmOrderApi.updateExceptionInfo(params).then(res=>{
- resolve(res)
- }).catch((error)=>{
- reject(error)
- })
- })
- }
- const getExceptionInfoList = () => {
- PipeAppointmentConfirmOrderApi.getExceptionInfoList({
- orderId: formData.value.id || route.query?.id,
- }).then(res=>{
- console.log('getExceptionInfoList:',res)
- })
- }
- const handleGetExceptionInfo = (id: string) => {
- PipeAppointmentConfirmOrderApi.getExceptionInfo(id).then((res) => {
- if(res) exceptionInfo.value = {
- ...res,
- adjustEffectiveDate: res.adjustEffectiveDate?.join('-')
- }
- }).catch((error)=>{
- console.log(error, '-----error--->')
- ElMessage.error(error)
- })
- }
- const fileUploadModalRef = ref<InstanceType<typeof FileUploadModal>>();
- const currentUploadMap = reactive({
- field: '',
- fieldAttr: '',
- })
- const handleOpenFileUploadModal = (type: string, attach: string) => {
- currentUploadMap.field = type
- currentUploadMap.fieldAttr = attach
- fileUploadModalRef.value?.open()
- }
- const handleFileUploadSuccess = (fileInfo:{fileName: string, fileUrl: string}) => {
- exceptionInfo.value[currentUploadMap.field] = fileInfo.fileName
- exceptionInfo.value[currentUploadMap.fieldAttr] = fileInfo.fileUrl
- console.log('handleFileUploadSuccess:', exceptionInfo.value)
- }
- const handleRemove = (type: string, attach: string) => {
- exceptionInfo.value[type] = ''
- exceptionInfo.value[attach] = ''
- }
- const fillNullOrEmptyValWithDefaultVal = (obj, key, defaultValue) => {
- if(obj[key] == null) {
- obj[key] = defaultValue
- return
- }
- if(typeof obj[key] === 'string' && obj[key] === '') {
- obj[key] = defaultValue
- }
- }
- const fillDefaultVal = async () => {
- const [equipPipe, dept] = await Promise.all([
- EquipPipeApi.getEquipPipe(equipList.value[0].id),
- getDept(formData.value.deptId)
- ])
- if(equipPipe) {
- fillNullOrEmptyValWithDefaultVal(formData.value, 'unitContact', equipPipe?.contact || '')
- fillNullOrEmptyValWithDefaultVal(formData.value, 'unitPhone', equipPipe?.contactPhone || '')
- fillNullOrEmptyValWithDefaultVal(formData.value, 'email', equipPipe?.contactEmail || '')
- // fillNullOrEmptyValWithDefaultVal(formData.value, 'recipient', equipPipe?.recipient || '')
- // fillNullOrEmptyValWithDefaultVal(formData.value, 'recipientPhone', equipPipe?.recipientPhone || '')
- // fillNullOrEmptyValWithDefaultVal(formData.value, 'recipientEmail', equipPipe?.recipientEmail || '')
- // fillNullOrEmptyValWithDefaultVal(formData.value, 'payerContactName', equipPipe?.payment || '')
- // fillNullOrEmptyValWithDefaultVal(formData.value, 'payerContact', equipPipe?.paymentPhone || '')
- // fillNullOrEmptyValWithDefaultVal(formData.value, 'payerMail', equipPipe?.paymentEmail || '')
- }
- if(dept) {
- fillNullOrEmptyValWithDefaultVal(formData.value, 'deptPhone', dept?.phone || '')
- }
- }
- // 页面加载时获取详情
- onMounted(async () => {
- await getDetail()
- if(route.query?.id) {
- await handleEquipQuery()
- // await handleGetExceptionInfo('eb9a57fe2ed98a45e1a892aef4cc13f0')
- }
- await fillDefaultVal()
- })
- const formattedCheckers = computed(() => {
- const teamList = formData.value.teamList
- console.log("teamList",teamList)
- if (!teamList || !Array.isArray(teamList) || teamList.length === 0) return []
- const result: { id: string; label: string }[] = []
- teamList.forEach((team: any, teamIndex: number) => {
- if (team.isLeader) {
- result.push({
- id: `leader-${team.member.id || teamIndex}`,
- label: `组长: ${team.member.nickname || ''}`
- })
- }else{
- result.push({
- id: `member-${team.member.id || teamIndex}`,
- label: `${team.member.nickname || ''}`
- })
- }
- })
- return result
- })
- </script>
- <style lang="scss" scoped>
- .form-group {
- &:not(:last-child) {
- margin-bottom: 16px;
- }
-
- &-title {
- color: #606266;
- font-size: 13px;
- font-weight: 500;
- margin-bottom: 0;
- }
- }
- .p-3 {
- padding-top: 0;
- }
- .check-info-label-title {
- width: 100%;
- line-height: 32px;
- display: flex;
- align-items: center;
- margin-bottom: 12px;
- &::before {
- content: '';
- display: inline-block;
- width: 4px;
- height: 16px;
- background: var(--el-color-primary);
- margin-right: 8px;
- }
- }
- .feeDate_box {
- color: #606266;
- :deep(.el-input-number) {
- width: 120px !important;
- }
- }
- .unit-form-item {
- :deep(.el-form-item__content) {
- display: flex;
- align-items: center;
- flex-wrap: nowrap;
- .el-button {
- margin-left: 8px;
- }
- }
- }
- .unit-name {
- display: flex;
- align-items: center;
- padding: 0 0 8px;
-
- .label {
- width: 90px;
- color: #606266;
- font-size: 13px;
- text-align: right;
- padding-right: 12px;
- }
-
- .value {
- flex: 1;
- font-size: 14px;
- color: #303133;
- }
- }
- :deep(.el-form) {
- .el-form-item {
- margin-bottom: 12px;
- align-items: center;
- &__label {
- height: auto;
- font-size: 13px;
- line-height: 20px;
- color: #606266;
- padding-right: 8px;
- }
- .el-date-editor.el-input, .el-input-number {
- width: 100%;
- .el-input__inner {
- text-align: left;
- }
- }
- &.actualAmountFormItem {
- .el-form-item__content {
- display: flex;
- .el-input-number {
- width: 300px;
- }
- }
- }
- }
- }
- .selected-checkers {
- display: inline-flex;
- flex-wrap: wrap;
- gap: 8px;
- min-height: 32px;
- padding: 4px 8px;
-
- .el-tag {
- margin: 0;
- height: 24px;
- line-height: 22px;
-
- &:hover {
- cursor: default;
- }
- }
- }
- .reject-dialog {
- :deep(.el-dialog__header) {
- margin: 0;
- padding: 16px 20px;
- border-bottom: 1px solid #dcdfe6;
- }
-
- :deep(.el-dialog__body) {
- padding: 20px;
- }
- .reject-content {
- .equip-list {
- margin-bottom: 20px;
- color: #606266;
- line-height: 1.6;
- }
- .check-type {
- color: #606266;
- }
- .reject-reason {
- .reason-label {
- color: #606266;
- }
-
- :deep(.el-textarea__inner) {
- background-color: #f5f7fa;
- border-color: #e4e7ed;
-
- &:focus {
- background-color: #fff;
- }
- }
- }
- }
- .reject-footer {
- margin-top: 20px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .time-tag {
- :deep(.el-tag) {
- height: 32px;
- line-height: 30px;
- font-size: 16px;
- padding: 0 12px;
- }
- }
- .action-buttons {
- .el-button + .el-button {
- margin-left: 12px;
- }
- }
- }
- }
- // 内层表格复选框样式
- ::v-deep .inner-table .el-checkbox__input.is-checked .el-checkbox__inner,
- ::v-deep .inner-table .el-checkbox__input.is-indeterminate .el-checkbox__inner {
- background-color: #67c23a; // 绿色
- border-color: #67c23a;
- }
- /* 隐藏默认展开图标 */
- :deep(.el-table__expand-icon) {
- display: none;
- }
- /* 完全隐藏展开列的单元格(包括内容和边框) */
- :deep(.hidden-expand-column),
- :deep(.hidden-expand-column .cell),
- :deep(.hidden-expand-column .el-table__expand-icon) {
- display: none !important;
- }
- ::v-deep .inner-table .el-checkbox__input.is-checked .el-checkbox__inner::after {
- border-color: #fff;
- }
- // 内层表格选中行背景色
- ::v-deep .inner-table .el-table__body tr.current-row > td {
- background-color: #f0f9eb;
- }
- :deep(.selected-row){
- background-color: #ecf5ff !important;
- }
- // 子表选中行特殊背景色(浅绿色)
- :deep(.inner-table .selected-row) {
- background-color: #e8f5e9 !important;
- }
- .schedule-link {
- color: var(--el-color-primary);
- &:hover {
- color: var(--el-color-primary-light-3);
- }
- }
- </style>
|