| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635 |
- <template>
- <div class="project-task-page">
- <ContentWrap class="page-header">
- <div class="page-header__main">
- <div class="page-header__icon">
- <Icon :icon="formType === 'create' ? 'ep:document-add' : 'ep:edit-pen'" />
- </div>
- <div>
- <h2 class="page-header__title">
- {{ formType === 'create' ? '新增项目任务' : '编辑项目任务' }}
- </h2>
- <p class="page-header__subtitle">{{ t('iotprojecttask.iotproject820427-0') }}</p>
- </div>
- </div>
- <el-button size="default" @click="close">
- <Icon icon="ep:arrow-left" class="mr-5px" />{{ t('iotprojecttask.iotproject820427-1') }}</el-button>
- </ContentWrap>
- <ContentWrap v-loading="formLoading" class="project-summary-section">
- <div class="section-heading">
- <div class="section-heading__title">{{ t('iotprojecttask.iotproject820427-2') }}</div>
- <span class="section-heading__hint">{{ t('iotprojecttask.iotproject820427-3') }}</span>
- </div>
- <el-form
- ref="formRef"
- :model="formData"
- :rules="formRules"
- label-width="100px"
- size="default"
- class="project-summary-form">
- <el-row :gutter="24">
- <el-col :span="12">
- <el-form-item :label="t('iotprojecttask.iotproject820427-4')" prop="contractName">
- <el-select
- v-model="formData.contractId"
- :placeholder="t('iotprojecttask.iotproject820427-5')"
- @change="getProjectInfo"
- disabled>
- <el-option
- v-for="item in projectList"
- :key="item.id"
- :label="item.contractName"
- :value="item.id"
- clearable />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item :label="t('iotprojecttask.iotproject820427-6')" prop="contractCode">
- <el-input v-model="formData.contractCode" :placeholder="t('iotprojecttask.iotproject820427-7')" disabled />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <el-col :span="12">
- <el-form-item :label="t('iotprojecttask.iotproject820427-8')" prop="manufacturerId">
- <el-select
- clearable
- @clear="zzClear"
- v-model="formData.manufacturerId"
- :placeholder="t('deviceForm.mfgHolder')"
- disabled>
- <el-option :label="formData.manufactureName" :value="formData.manufacturerId" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item :label="t('project.payment')" prop="payment">
- <el-select v-model="formData.payment" :placeholder="t('iotprojecttask.iotproject820427-5')" disabled>
- <el-option
- v-for="dict in getStrDictOptions(DICT_TYPE.PMS_PROJECT_SETTLEMENT)"
- :key="dict.id"
- :label="dict.label"
- :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <el-col :span="12">
- <el-form-item :label="t('iotprojecttask.iotproject820427-9')" prop="startTime">
- <el-date-picker
- v-model="formData.startTime"
- type="date"
- value-format="x"
- :placeholder="t('iotprojecttask.iotproject820427-10')"
- disabled />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item :label="t('iotprojecttask.iotproject820427-11')" prop="endTime">
- <el-date-picker
- v-model="formData.endTime"
- type="date"
- value-format="x"
- :placeholder="t('iotprojecttask.iotproject820427-12')"
- disabled />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <el-col :span="12"
- ><el-form-item :label="t('iotprojecttask.iotproject820427-13')" prop="projectDeptId">
- <el-select
- v-model="formData.projectDeptId"
- :options="deptOptions"
- filterable
- :placeholder="t('iotprojecttask.iotproject820427-14')"
- clearable
- disabled /> </el-form-item
- ></el-col>
- <el-col :span="12"
- ><el-form-item :label="t('iotprojecttask.iotproject820427-15')" prop="remark">
- <el-input
- v-model="formData.remark"
- :placeholder="t('iotprojecttask.iotproject820427-16')"
- type="textarea"
- disabled />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </ContentWrap>
- <ContentWrap v-if="false">
- <div class="content">
- <div class="toolbar">
- <div class="actions">
- <!-- 操作按钮已移动到表单区域 -->
- </div>
- </div>
- <div class="table-container">
- <el-table
- :data="tableData"
- empty-text="暂无数据"
- highlight-current-row
- @current-change="handleRowClick">
- <el-table-column prop="wellName" :label="t('iotprojecttask.iotproject820427-17')" />
- <el-table-column prop="wellType" :label="t('iotprojecttask.iotproject820427-18')">
- <template #default="{ row }">
- {{ getWellTypeLabel(row.wellType) }}
- </template>
- </el-table-column>
- <el-table-column prop="wellCategory" :label="t('iotprojecttask.iotproject820427-19')">
- <template #default="{ row }">
- {{ getWellCategoryLabel(row.wellCategory) }}
- </template>
- </el-table-column>
- <el-table-column prop="location" :label="t('iotprojecttask.iotproject820427-20')" />
- <el-table-column :label="t('project.technology')">
- <template #default="{ row }">
- {{ getTechniqueLabel(row.technique) }}
- </template>
- </el-table-column>
- <el-table-column prop="workloadDesign" :label="t('iotprojecttask.iotproject820427-21')" />
- <el-table-column :label="t('project.unit')">
- <template #default="{ row }">
- {{ getWorkloadUnitLabel(row.workloadUnit) }}
- </template>
- </el-table-column>
- <el-table-column prop="deptIds" :label="t('iotprojecttask.iotproject820427-22')">
- <template #default="{ row }">
- <el-tooltip
- effect="dark"
- :content="getAllDeptNames(row.deptIds)"
- placement="top"
- :disabled="!row.deptIds || row.deptIds.length <= 1">
- <span class="dept-names">
- {{ getDeptNames(row.deptIds) }}
- </span>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column prop="deviceIds" :label="t('iotprojecttask.iotproject820427-23')">
- <template #default="{ row }">
- <el-tooltip
- :content="getAllDeviceNames(row.deviceIds)"
- placement="top"
- :disabled="row.deviceIds && row.deviceIds.length <= 1">
- <span class="device-names">
- {{ getDeviceNames(row.deviceIds) }}
- </span>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column prop="responsiblePerson" :label="t('iotprojecttask.iotproject820427-24')">
- <template #default="{ row }">
- <el-tooltip
- :content="getAllResponsiblePersonNames(row.responsiblePerson)"
- placement="top"
- :disabled="!row.responsiblePerson || row.responsiblePerson.length <= 1">
- <span class="responsible-names">
- {{ getResponsiblePersonNames(row.responsiblePerson) }}
- </span>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column prop="remark" :label="t('iotprojecttask.iotproject820427-15')" />
- </el-table>
- </div>
- </div>
- </ContentWrap>
- <!-- 新增任务详情编辑表单 -->
- <ContentWrap class="task-detail-section">
- <div class="section-heading">
- <div class="section-heading__title">{{ t('iotprojecttask.iotproject820427-25') }}</div>
- <span class="section-heading__hint">{{ t('iotprojecttask.iotproject820427-26') }}</span>
- </div>
- <el-form
- ref="taskFormRef"
- :model="currentTask"
- :rules="taskFormRules"
- label-width="108px"
- size="default"
- class="task-edit-form">
- <el-row :gutter="24">
- <el-col :span="8">
- <el-form-item :label="t('iotprojecttask.iotproject820427-17')" prop="wellName">
- <el-input
- v-model="currentTask.wellName"
- :placeholder="t('iotprojecttask.iotproject820427-27')"
- :disabled="currentTask.platformWell === '1'" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item :label="t('project.workArea')" prop="location">
- <el-autocomplete
- ref="workAreaAutocomplete"
- v-model="currentTask.location"
- :fetch-suggestions="querySearch"
- :trigger-on-focus="true"
- :placeholder="t('iotprojecttask.iotproject820427-28')"
- @focus="handleWorkAreaFocus"
- @select="handleSelect"
- :disabled="!workAreaOptions.length"
- popper-class="work-area-autocomplete">
- <template #prefix>
- <el-icon v-if="loadingWorkAreaOptions" class="is-loading">
- <Loading />
- </el-icon>
- </template>
- </el-autocomplete>
- <div v-if="!workAreaOptions.length" class="el-form-item__error">{{ t('iotprojecttask.iotproject820427-29') }}</div>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item :label="t('project.technology')" prop="technique">
- <el-select
- v-model="currentTask.technique"
- :placeholder="t('iotprojecttask.iotproject820427-30')"
- clearable
- :loading="loadingTechnologyOptions">
- <el-option
- v-for="dict in technologyOptions"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value" />
- </el-select>
- <div
- v-if="!technologyOptions.length && !loadingTechnologyOptions"
- class="el-form-item__error">{{ t('iotprojecttask.iotproject820427-31') }}</div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <el-col :span="8">
- <el-form-item :label="t('iotprojecttask.iotproject820427-21')" prop="workloadDesign">
- <el-tooltip
- :disabled="!workloadDesignError"
- :content="workloadDesignError"
- placement="top"
- effect="light"
- popper-class="workload-design-tooltip"
- :show-after="0">
- <el-input
- v-model="currentTask.workloadDesign"
- :placeholder="t('iotprojecttask.iotproject820427-32')"
- :disabled="currentTask.platformWell === '1'"
- class="workload-input-with-button"
- :class="{ 'error-input': workloadDesignError }"
- @blur="validateWorkloadDesign">
- <template #append>
- <el-tooltip :content="t('iotprojecttask.iotproject820427-33')" placement="top">
- <el-button
- class="workload-add-btn"
- @click="openWorkloadDialog"
- :disabled="getWorkloadAddBtnDisabled">
- <span class="btn-text">+</span>
- </el-button>
- </el-tooltip>
- </template>
- </el-input>
- </el-tooltip>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item :label="t('project.unit')" prop="workloadUnit">
- <el-select
- v-model="currentTask.workloadUnit"
- :placeholder="t('iotprojecttask.iotproject820427-34')"
- clearable
- :disabled="currentTask.platformWell === '1'">
- <el-option
- v-for="dict in getStrDictOptions(DICT_TYPE.PMS_PROJECT_WORKLOAD_UNIT)"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- :disabled="
- getFormSelectedWorkloadUnits().includes(dict.value) &&
- dict.value !== currentTask.workloadUnit
- " />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item :label="t('iotprojecttask.iotproject820427-22')" prop="deptIds">
- <el-tree-select
- multiple
- :multiple-limit="formData.deptId === 157 ? 1 : 0"
- v-model="currentTask.deptIds"
- :data="deptList"
- :props="treeSelectProps"
- :default-expanded-keys="defaultExpandedKeys"
- check-strictly
- node-key="id"
- filterable
- :placeholder="t('iotprojecttask.iotproject820427-35')"
- clearable
- @visible-change="handleTreeVisibleChange"
- collapse-tags
- collapse-tags-tooltip
- :max-collapse-tags="1"
- class="department-tree-select single-line-tree-select" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24" class="resource-row">
- <el-col :span="isSpecialDept ? 8 : 12">
- <el-form-item :label="t('iotprojecttask.iotproject820427-23')" prop="deviceIds" class="resource-select-item">
- <el-button @click="openDeviceDialogForForm" type="primary" plain size="default">{{ t('iotprojecttask.iotproject820427-36') }}</el-button>
- <!--
- <span v-if="currentTask.deviceIds && currentTask.deviceIds.length > 0" style="margin-left: 10px;">
- 已选 {{ currentTask.deviceIds.length }} 台设备
- </span> -->
- <el-tooltip
- v-if="currentTask.deviceIds && currentTask.deviceIds.length > 0"
- :content="getAllDeviceNamesForForm(currentTask.deviceIds)"
- placement="top">
- <span class="selection-summary">
- {{ formatDevicesForForm(currentTask.deviceIds) }}
- </span>
- </el-tooltip>
- <span v-else class="selection-summary selection-summary--empty">{{ t('iotprojecttask.iotproject820427-37') }}</span>
- </el-form-item>
- </el-col>
- <el-col :span="isSpecialDept ? 8 : 12">
- <el-form-item
- ::label="t('iotprojecttask.iotproject820427-38')"
- prop="responsiblePerson"
- class="resource-select-item">
- <el-button
- @click="openResponsiblePersonDialogForForm"
- type="primary"
- plain
- size="default">
- 选择{{ isSpecialDept ? '带班干部' : '责任人' }}
- </el-button>
- <el-tooltip
- v-if="currentTask.responsiblePerson && currentTask.responsiblePerson.length > 0"
- :content="getAllResponsiblePersonNamesForForm(currentTask.responsiblePerson)"
- placement="top">
- <span class="selection-summary">
- {{ formatResponsiblePersonsForForm(currentTask.responsiblePerson) }}
- </span>
- </el-tooltip>
- <span v-else class="selection-summary selection-summary--empty">
- 暂未选择{{ isSpecialDept ? '带班干部' : '责任人' }}
- </span>
- </el-form-item>
- </el-col>
- <el-col :span="8" v-if="isSpecialDept">
- <el-form-item :label="t('iotprojecttask.iotproject820427-39')" prop="submitter" class="resource-select-item">
- <el-button @click="openSubmitterDialogForForm" type="primary" plain size="default">{{ t('iotprojecttask.iotproject820427-40') }}</el-button>
- <el-tooltip
- v-if="currentTask.submitter && currentTask.submitter.length > 0"
- :content="getAllSubmitterNamesForForm(currentTask.submitter)"
- placement="top">
- <span class="selection-summary">
- {{ formatSubmittersForForm(currentTask.submitter) }}
- </span>
- </el-tooltip>
- <span v-else class="selection-summary selection-summary--empty">{{ t('iotprojecttask.iotproject820427-41') }}</span>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <el-col :span="8" v-if="isSpecialDept && showPlatformWellSwitch">
- <el-form-item :label="t('iotprojecttask.iotproject820427-42')" prop="platformWell">
- <el-switch
- v-model="currentTask.platformWell"
- active-value="1"
- inactive-value="0"
- @change="handlePlatformWellChange" />
- </el-form-item>
- </el-col>
- </el-row>
- <!-- 动态属性部分 -->
- <el-row v-if="dynamicAttrs.length > 0" :gutter="24">
- <el-col
- v-for="attr in dynamicAttrs"
- :key="attr.id"
- :span="attr.dataType === 'textarea' ? 24 : 8">
- <el-form-item
- :label="attr.name + (attr.unit ? `(${attr.unit})` : '')"
- :prop="attr.identifier"
- :rules="getDynamicAttrRules(attr)">
- <!-- 文本类型 -->
- <el-input
- v-if="attr.dataType === 'text'"
- v-model="currentTask[attr.identifier]"
- ::placeholder="t('iotprojecttask.iotproject820427-43')" />
- <!-- 文本域类型 -->
- <el-input
- v-else-if="attr.dataType === 'textarea'"
- v-model="currentTask[attr.identifier]"
- ::placeholder="t('iotprojecttask.iotproject820427-43')"
- type="textarea"
- :rows="3" />
- <!-- 数字类型 -->
- <el-input
- v-else-if="attr.dataType === 'double'"
- v-model="currentTask[attr.identifier]"
- ::placeholder="t('iotprojecttask.iotproject820427-43')"
- type="number"
- :min="attr.minValue || undefined"
- :max="attr.maxValue || undefined" />
- <!-- 日期类型 -->
- <el-date-picker
- v-else-if="attr.dataType === 'date'"
- v-model="currentTask[attr.identifier]"
- type="date"
- value-format="x"
- ::placeholder="t('iotprojecttask.iotproject820427-44')"
- style="width: 100%" />
- <!-- 默认文本输入 -->
- <el-input
- v-else
- v-model="currentTask[attr.identifier]"
- ::placeholder="t('iotprojecttask.iotproject820427-43')" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <el-col :span="24">
- <el-form-item :label="t('iotprojecttask.iotproject820427-15')" prop="remark">
- <el-input
- v-model="currentTask.remark"
- :placeholder="t('iotprojecttask.iotproject820427-16')"
- type="textarea"
- :rows="3" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item class="task-reset-action">
- <el-button v-if="isNewTask" size="default" @click="resetTaskForm">
- <Icon icon="ep:refresh" class="mr-5px" />{{ t('iotprojecttask.iotproject820427-45') }}</el-button>
- </el-form-item>
- </el-form>
- </ContentWrap>
- <ContentWrap v-if="companyName === 'ry'" class="attachment-section">
- <div class="section-heading">
- <div class="section-heading__title">{{ t('iotprojecttask.iotproject820427-46') }}</div>
- <span class="section-heading__hint">{{ t('iotprojecttask.iotproject820427-47') }}</span>
- </div>
- <div class="attachment-content">
- <el-form-item size="default" :label="t('iotprojecttask.iotproject820427-48')">
- <el-upload
- v-model:file-list="constructionFiles"
- :action="uploadUrl"
- multiple
- :headers="{ 'tenant-id': 1, 'device-id': 'undefined' }"
- name="files"
- class="w-50%"
- @preview="handlePreview">
- <el-button type="primary">{{ t('iotprojecttask.iotproject820427-49') }}</el-button>
- <template #tip>
- <div class="el-upload__tip">文件大小不能超过50MB </div>
- </template>
- </el-upload>
- </el-form-item>
- <el-form-item size="default" :label="t('iotprojecttask.iotproject820427-50')">
- <el-upload
- v-model:file-list="geologicalFiles"
- :action="uploadUrl"
- multiple
- :headers="{ 'tenant-id': 1, 'device-id': 'undefined' }"
- name="files"
- class="w-50%"
- @preview="handlePreview">
- <el-button type="primary">{{ t('iotprojecttask.iotproject820427-51') }}</el-button>
- <template #tip>
- <div class="el-upload__tip">文件大小不能超过50MB </div>
- </template>
- </el-upload>
- </el-form-item>
- <el-form-item size="default" :label="t('iotprojecttask.iotproject820427-52')">
- <el-upload
- v-model:file-list="completionFiles"
- :action="uploadUrl"
- multiple
- :headers="{ 'tenant-id': 1, 'device-id': 'undefined' }"
- name="files"
- class="w-50%"
- @preview="handlePreview">
- <el-button :disabled="tableData[0].status !== 'wg'" type="primary"
- >{{ t('iotprojecttask.iotproject820427-53') }}</el-button
- >
- <template #tip>
- <div class="el-upload__tip">文件大小不能超过50MB </div>
- </template>
- </el-upload>
- </el-form-item>
- </div>
- </ContentWrap>
- <ContentWrap v-if="currentTask.platformWell === '1'" class="platform-well-section">
- <div class="section-heading">
- <div class="section-heading__title">{{ t('iotprojecttask.iotproject820427-42') }}</div>
- <span class="section-heading__hint">{{ t('iotprojecttask.iotproject820427-54') }}</span>
- </div>
- <el-table :data="currentTask.platformWellDetails" style="width: 100%">
- <el-table-column prop="wellName" :label="t('iotprojecttask.iotproject820427-17')">
- <template #default="{ $index }">
- <el-input
- v-model="currentTask.platformWellDetails[$index].wellName"
- :placeholder="t('iotprojecttask.iotproject820427-27')" />
- </template>
- </el-table-column>
- <el-table-column :label="t('iotprojecttask.iotproject820427-55')" width="150">
- <template #default="{ $index }">
- <el-select
- v-model="currentTask.platformWellDetails[$index].workloadUnit"
- :placeholder="t('iotprojecttask.iotproject820427-34')"
- clearable
- :disabled="
- getPlatformWellWorkloadUnits($index).includes(
- currentTask.platformWellDetails[$index].workloadUnit
- ) &&
- currentTask.platformWellDetails[$index].workloadUnit !== currentTask.workloadUnit
- ">
- <el-option
- v-for="dict in getStrDictOptions(DICT_TYPE.PMS_PROJECT_WORKLOAD_UNIT)"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- :disabled="
- getPlatformWellWorkloadUnits($index).includes(dict.value) &&
- dict.value !== currentTask.platformWellDetails[$index].workloadUnit
- " />
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="workloadDesign" :label="t('iotprojecttask.iotproject820427-21')">
- <template #default="{ $index }">
- <el-tooltip
- :disabled="!currentTask.platformWellDetails[$index].workloadDesignError"
- :content="currentTask.platformWellDetails[$index].workloadDesignError"
- placement="top"
- effect="light"
- popper-class="workload-design-tooltip"
- :show-after="0">
- <el-input
- v-model="currentTask.platformWellDetails[$index].workloadDesign"
- :placeholder="t('iotprojecttask.iotproject820427-32')"
- class="workload-input-with-button"
- :class="{
- 'error-input': currentTask.platformWellDetails[$index].workloadDesignError
- }"
- @blur="validatePlatformWellWorkloadDesign($index)">
- <template #append>
- <el-tooltip :content="t('iotprojecttask.iotproject820427-33')" placement="top">
- <el-button
- class="workload-add-btn"
- @click="openPlatformWellWorkloadDialog($index)"
- :disabled="getPlatformWellWorkloadAddBtnDisabled($index)">
- <span class="btn-text">+</span>
- </el-button>
- </el-tooltip>
- </template>
- </el-input>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column :label="t('iotprojecttask.iotproject820427-56')" width="100">
- <template #default="{ $index }">
- <el-button
- type="danger"
- size="default"
- @click="removePlatformWellDetail($index)"
- :disabled="isMainPlatformWellDetail($index)">{{ t('iotprojecttask.iotproject820427-57') }}</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-button type="primary" plain size="default" @click="addPlatformWellDetail">
- <Icon icon="ep:plus" class="mr-5px" />{{ t('iotprojecttask.iotproject820427-58') }}</el-button>
- </ContentWrap>
- <div class="form-actions">
- <el-button size="default" type="primary" :loading="formLoading" @click="submitForm">
- <Icon icon="ep:check" class="mr-5px" />{{ t('iotprojecttask.iotproject820427-59') }}</el-button>
- <el-button size="default" @click="close">{{ t('iotprojecttask.iotproject820427-60') }}</el-button>
- </div>
- <!-- 设备选择对话框 -->
- <el-dialog
- v-model="deviceDialogVisible"
- :title="t('iotprojecttask.iotproject820427-61')"
- width="min(960px, calc(100vw - 32px))"
- :before-close="handleDeviceDialogClose"
- class="device-select-dialog">
- <div class="transfer-container">
- <el-transfer
- v-model="selectedDeviceIds"
- :data="filteredDeviceList"
- :titles="['可选设备', '已选设备']"
- :props="{ key: 'id', label: 'deviceCode' }"
- filterable
- :filter-method="filterDeviceMethod"
- class="transfer-component"
- @change="handleTransferChange">
- <template #default="{ option }">
- <el-tooltip
- effect="dark"
- placement="top"
- :content="`${option.deviceCode || ''} - ${option.deviceName || ''}`"
- :disabled="!option.deviceCode && !option.deviceName"
- transition="fade-in-linear">
- <span class="transfer-option-text">
- {{ option.deviceCode }} - {{ option.deviceName }}
- </span>
- </el-tooltip>
- </template>
- </el-transfer>
- </div>
- <template #footer>
- <span class="dialog-footer">
- <el-button size="default" @click="handleDeviceDialogClose">{{ t('iotprojecttask.iotproject820427-60') }}</el-button>
- <el-button size="default" type="primary" @click="confirmDeviceSelection">{{ t('iotprojecttask.iotproject820427-62') }}</el-button>
- </span>
- </template>
- </el-dialog>
- <!-- 责任人选择对话框 -->
- <el-dialog
- v-model="responsiblePersonDialogVisible"
- :title="t('iotprojecttask.iotproject820427-63')"
- width="min(960px, calc(100vw - 32px))"
- :before-close="handleResponsiblePersonDialogClose"
- class="responsible-person-select-dialog">
- <div class="transfer-container">
- <el-transfer
- v-model="selectedResponsiblePersonIds"
- :data="responsiblePersonList"
- :titles="['可选人员', '已选人员']"
- :props="{ key: 'id', label: 'nickname' }"
- filterable
- class="transfer-component">
- <template #default="{ option }">
- <el-tooltip
- effect="dark"
- placement="top"
- ::content="t('iotprojecttask.iotproject820427-64')">
- <span class="transfer-option-text">
- {{ option.nickname }} - {{ option.deptName || '未分配部门' }}
- </span>
- </el-tooltip>
- </template>
- </el-transfer>
- </div>
- <template #footer>
- <span class="dialog-footer">
- <el-button size="default" @click="handleResponsiblePersonDialogClose">{{ t('iotprojecttask.iotproject820427-60') }}</el-button>
- <el-button size="default" type="primary" @click="confirmResponsiblePersonSelection">{{ t('iotprojecttask.iotproject820427-62') }}</el-button>
- </span>
- </template>
- </el-dialog>
- <!-- 填报人选择对话框 -->
- <el-dialog
- v-model="submitterDialogVisible"
- :title="t('iotprojecttask.iotproject820427-40')"
- width="min(960px, calc(100vw - 32px))"
- :before-close="handleSubmitterDialogClose"
- class="responsible-person-select-dialog">
- <div class="transfer-container">
- <el-transfer
- v-model="selectedSubmitterIds"
- :data="submitterList"
- :titles="['可选人员', '已选人员']"
- :props="{ key: 'id', label: 'nickname' }"
- filterable
- class="transfer-component">
- <template #default="{ option }">
- <el-tooltip
- effect="dark"
- placement="top"
- ::content="t('iotprojecttask.iotproject820427-64')">
- <span class="transfer-option-text">
- {{ option.nickname }} - {{ option.deptName || '未分配部门' }}
- </span>
- </el-tooltip>
- </template>
- </el-transfer>
- </div>
- <template #footer>
- <span class="dialog-footer">
- <el-button size="default" @click="handleSubmitterDialogClose">{{ t('iotprojecttask.iotproject820427-60') }}</el-button>
- <el-button size="default" type="primary" @click="confirmSubmitterSelection">{{ t('iotprojecttask.iotproject820427-62') }}</el-button>
- </span>
- </template>
- </el-dialog>
- <!-- 工作量维护对话框 -->
- <el-dialog
- v-model="workloadDialogVisible"
- :title="t('iotprojecttask.iotproject820427-21')"
- width="min(680px, calc(100vw - 32px))"
- class="workload-dialog">
- <el-table :data="workloadList" style="width: 100%">
- <el-table-column prop="workloadUnit" :label="t('iotprojecttask.iotproject820427-55')" width="200">
- <template #default="{ $index }">
- <el-select
- v-model="workloadList[$index].workloadUnit"
- :placeholder="t('iotprojecttask.iotproject820427-34')"
- :disabled="$index === 0 && hasInitialWorkload">
- <el-option
- v-for="dict in getStrDictOptions(DICT_TYPE.PMS_PROJECT_WORKLOAD_UNIT)"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- :disabled="getSelectedWorkloadUnits($index).includes(dict.value)" />
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="workloadDesign" :label="t('iotprojecttask.iotproject820427-65')">
- <template #default="{ $index }">
- <el-tooltip
- :disabled="!workloadList[$index].workloadDesignError"
- :content="workloadList[$index].workloadDesignError"
- placement="top"
- effect="light"
- popper-class="workload-design-tooltip"
- :show-after="0">
- <el-input
- v-model="workloadList[$index].workloadDesign"
- :placeholder="t('iotprojecttask.iotproject820427-66')"
- :disabled="$index === 0 && hasInitialWorkload"
- :class="{ 'error-input': workloadList[$index].workloadDesignError }"
- @blur="validateWorkloadDialogDesign($index)" />
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column :label="t('iotprojecttask.iotproject820427-56')" width="80">
- <template #default="{ $index }">
- <el-button
- type="danger"
- size="default"
- @click="removeWorkloadItem($index)"
- :disabled="$index === 0 && hasInitialWorkload">{{ t('iotprojecttask.iotproject820427-57') }}</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-button type="primary" plain size="default" @click="addWorkloadItem">
- <Icon icon="ep:plus" class="mr-5px" />{{ t('iotprojecttask.iotproject820427-58') }}</el-button>
- <template #footer>
- <span class="dialog-footer">
- <el-button size="default" @click="workloadDialogVisible = false">{{ t('iotprojecttask.iotproject820427-60') }}</el-button>
- <el-button size="default" type="primary" @click="confirmWorkloadSelection">{{ t('iotprojecttask.iotproject820427-62') }}</el-button>
- </span>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup lang="ts">
- // 导入部分保持不变,与原始代码相同
- import { IotProjectInfoApi, IotProjectInfoVO } from '@/api/pms/iotprojectinfo'
- import { handleTree } from '@/utils/tree'
- import * as DeptApi from '@/api/system/dept'
- import { ref, reactive, computed, onMounted, watch } from 'vue'
- import { useUserStore } from '@/store/modules/user'
- import { IotProjectTaskApi, IotProjectTaskVO } from '@/api/pms/iotprojecttask'
- import { ElMessage } from 'element-plus'
- import { useTagsViewStore } from '@/store/modules/tagsView'
- import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
- import * as UserApi from '@/api/system/user'
- import { IotProjectTaskAttrsApi } from '@/api/pms/iotprojecttaskattrs'
- import { DICT_TYPE, getStrDictOptions, getDictLabel } from '@/utils/dict'
- import { IotOpeationFillApi } from '@/api/pms/iotopeationfill'
- import { Base64 } from 'js-base64'
- import { useRoute } from 'vue-router'
- // import { Plus } from '@element-plus/icons-vue'
- const { query, params, name } = useRoute() // 查询参数
- console.log('idaaaaaaaaaaaaaaaa', useRoute().query.deptId)
- const id = params.id
- let deptId = ref(params.deptId)
- const uploadUrl = import.meta.env.VITE_BASE_URL + '/admin-api/rq/file/upload'
- const constructionFiles = ref<any>([])
- const geologicalFiles = ref<any>([])
- const completionFiles = ref<any>([])
- // 修改projectId获取逻辑:优先使用params.projectId,其次使用query.projectId
- const projectId = ref<string>('')
- // 获取projectId的逻辑
- if (params.projectId) {
- projectId.value = Array.isArray(params.projectId) ? params.projectId[0] : params.projectId
- } else if (query.projectId) {
- projectId.value = Array.isArray(query.projectId as any)
- ? query.projectId[0]
- : (query.projectId as string)
- }
- function handlePreview(file: any) {
- if (!file.response) {
- message.error('附件路径不存在')
- return
- }
- try {
- const filePath = file.response.data.filePath ?? file.response.data.files[0].filePath
- const encodedPath = encodeURIComponent(Base64.encode(filePath))
- window.open(`http://doc.deepoil.cc:8012/onlinePreview?url=${encodedPath}`)
- } catch (error) {
- console.error('预览附件失败:', error)
- message.error('预览附件失败')
- }
- }
- const deptLoading = ref(false)
- const deptOptions = ref<any[]>([])
- const user = useUserStore().getUser
- const userdeptId = user.deptId
- async function loadDept(deptId?: number) {
- deptLoading.value = true
- try {
- const res = await DeptApi.specifiedSimpleDepts(deptId ?? userdeptId)
- deptOptions.value = res
- .map((item: any) => ({
- label: item.name,
- value: item.id,
- raw: item
- }))
- .filter((item) => item.raw.type === '2')
- } catch (error) {
- } finally {
- deptLoading.value = false
- }
- }
- onMounted(() => {
- loadDept()
- })
- // 施工队伍 选择树 响应式变量
- const defaultExpandedKeys = ref<number[]>([]) // 默认展开的部门节点keys
- const treeSelectRef = ref() // 树选择组件的引用
- const { delView } = useTagsViewStore() // 视图操作
- const { currentRoute, push } = useRouter()
- const { t } = useI18n() // 国际化
- const message = useMessage() // 消息弹窗
- const deptList = ref<Tree[]>([]) // 树形结构
- const deviceList = ref<IotDeviceVO[]>([]) // 设备列表
- // 设备映射表(ID->设备对象)
- const deviceMap = ref<Record<number, IotDeviceVO>>({})
- const dialogVisible = ref(true) // 弹窗的是否展示
- const dialogTitle = ref('') // 弹窗的标题
- const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
- const taskList = ref<IotProjectTaskVO[]>([]) // 列表的数据
- const projectList = ref<IotProjectInfoVO[]>([])
- const formType = ref('') // 表单的类型:create - 新增;update - 修改
- const loading = ref(true) // 列表的加载中
- // 设备选择相关变量
- const deviceDialogVisible = ref(false)
- const filteredDeviceList = ref<IotDeviceVO[]>([]) // 过滤后的设备列表
- const selectedDeviceIds = ref<number[]>([]) // 选中的设备ID
- // 责任人相关变量
- const responsiblePersonDialogVisible = ref(false)
- const responsiblePersonList = ref([]) // 所有责任人列表
- const selectedResponsiblePersonIds = ref([]) // 选中的责任人ID
- const currentEditingRowForResponsible = ref(null) // 当前正在编辑责任人的行
- const submitterDialogVisible = ref(false)
- const submitterList = ref([]) // 所有填报人列表
- const selectedSubmitterIds = ref([]) // 选中的日报填报人ID
- // 动态属性相关变量
- const dynamicAttrs = ref<any[]>([]) // 存储动态属性列表
- // 跟踪是否已从任务数据中获取动态属性
- const hasDynamicAttrsFromTask = ref(false)
- // 添加 workAreaOptions 引用和加载状态
- const workAreaOptions = ref<any[]>([])
- const loadingWorkAreaOptions = ref(false)
- const workAreaAutocomplete = ref() // 添加对el-autocomplete的引用
- // currentDictLabel 响应式变量
- const currentDictLabel = ref('') // 存储当前项目对应的施工区域字典类型
- // 当前正在操作的平台井索引
- const currentPlatformWellIndex = ref(-1)
- // 施工工艺相关变量
- const technologyOptions = ref<any[]>([])
- const loadingTechnologyOptions = ref(false)
- const currentTechnologyDictLabel = ref('') // 存储当前项目对应的施工工艺字典类型
- // 添加一个变量来保存平台井详情数据
- const platformWellDetailsBackup = ref([])
- // 存储井号到工作量列表的映射(key: wellName, value: Array<{workloadUnit, workloadDesign}>)
- const workloadMap = ref(new Map())
- // 工作量数据备份
- const workloadBackup = ref<Map<string, any[]>>(new Map())
- // 工作量维护相关变量
- const workloadDialogVisible = ref(false)
- const workloadList = ref<any[]>([])
- const hasInitialWorkload = ref(false)
- // 跟踪设备列表是否为空
- const hasDevicesAvailable = ref(false) // 默认假设有设备,等接口返回后更新
- // 设计工作量错误信息
- const workloadDesignError = ref('')
- /** 项目信息 表单 */
- defineOptions({ name: 'IotProjectTaskInfo' })
- const formData = ref({
- id: undefined,
- contractId: undefined,
- contractName: undefined,
- contractCode: undefined,
- workloadTotal: undefined,
- workloadFinish: undefined,
- workloadUnit: undefined,
- startTime: undefined,
- endTime: undefined,
- location: undefined,
- technique: undefined,
- payment: undefined,
- remark: undefined,
- manufactureName: undefined,
- manufacturerId: undefined,
- userName: undefined,
- userId: undefined,
- deptId: undefined, // 新增项目部门ID字段
- projectDeptId: undefined // 新增项目部门ID字段
- })
- const close = () => {
- delView(unref(currentRoute))
- push({ name: 'IotProjectTask', params: {} })
- }
- // 添加计算属性来判断是否为特定部门
- const isSpecialDept = computed(() => {
- return formData.value.deptId === 163
- })
- // 仅隐藏平台井切换入口,保留既有平台井数据的查看和编辑能力
- const showPlatformWellSwitch = false
- // 定义新的树选择器配置,添加禁用逻辑
- const treeSelectProps = {
- children: 'children',
- label: 'name',
- disabled: (data: any) => {
- // 只有叶子节点(type = 3)可以选择,非叶子节点禁用
- return data.type !== '3'
- }
- }
- const getProjectInfo = async (contractId: number) => {
- const project = projectList.value.find((item) => item.id === contractId)
- if (project) {
- formData.value.contractName = project.contractName
- formData.value.contractCode = project.contractCode
- formData.value.payment = project.payment
- formData.value.workloadTotal = project.workloadTotal
- formData.value.startTime = project.startTime
- formData.value.endTime = project.endTime
- formData.value.remark = project.remark
- formData.value.manufactureName = project.manufactureName
- formData.value.manufacturerId = project.manufacturerId
- formData.value.id = project.id
- formData.value.deptId = project.deptId // 保存项目部门ID
- formData.value.projectDeptId = project.projectDeptId // 保存项目部门ID
- // 获取施工区域数据字典集合
- await loadWorkAreaOptions(formData.value.deptId)
- // 获取施工工艺数据字典集合
- await loadTechnologyOptions(formData.value.deptId)
- // 获取动态属性
- await fetchDynamicAttrs()
- }
- }
- const queryParams = reactive({
- projectId: undefined,
- id: undefined
- })
- const formRules = reactive({
- contractId: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
- manufacturerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
- payment: [{ required: true, message: '结算方式不能为空', trigger: 'blur' }],
- // workloadTotal: [{ required: true, message: '工作量总数不能为空', trigger: 'blur' }],
- startTime: [{ required: true, message: '开始时间不能为空', trigger: 'blur' }],
- endTime: [{ required: true, message: '结束时间不能为空', trigger: 'blur' }]
- })
- const formRef = ref() // 表单 Ref
- const zzClear = () => {
- formData.value.manufacturerId = undefined
- formData.value.manufactureName = undefined
- }
- // 根据部门ID获取部门名称
- const getDeptNames = (deptIds) => {
- if (!deptIds || deptIds.length === 0) return ''
- const names = []
- const findDept = (list, id) => {
- for (const item of list) {
- if (item.id === id) {
- names.push(item.name)
- return true
- }
- if (item.children && findDept(item.children, id)) {
- return true
- }
- }
- return false
- }
- deptIds.forEach((id) => findDept(deptList.value, id))
- if (names.length > 1) {
- return `${names[0]}...`
- }
- return names.join(', ')
- }
- const getAllDeptNames = (deptIds) => {
- if (!deptIds || deptIds.length === 0) return '无施工队伍'
- const names = []
- const findDept = (list, id) => {
- for (const item of list) {
- if (item.id === id) {
- names.push(item.name)
- return true
- }
- if (item.children && findDept(item.children, id)) {
- return true
- }
- }
- return false
- }
- deptIds.forEach((id) => findDept(deptList.value, id))
- return names.join(', ') || '无有效施工队伍'
- }
- const getDeviceNames = (deviceIds: number[]) => {
- if (!deviceIds || deviceIds.length === 0) return ''
- // 获取所有有效设备名称
- const deviceNames = deviceIds
- .map((id) => deviceMap.value[id]?.deviceCode)
- .filter((name) => name !== undefined && name !== '')
- if (deviceNames.length === 0) return ''
- // 如果设备数量超过2个,显示前两个加省略号
- if (deviceNames.length > 2) {
- return `${deviceNames[0]}, ${deviceNames[1]}...`
- }
- // 设备数量不超过2个,正常显示所有
- return deviceNames.join(', ')
- }
- const initDynamicAttrsToCurrentTask = () => {
- dynamicAttrs.value.forEach((attr) => {
- if (!currentTask.value.hasOwnProperty(attr.identifier)) {
- // 如果是从任务数据中获取的属性,并且有实际值,使用实际值
- if (
- hasDynamicAttrsFromTask.value &&
- attr.actualValue !== undefined &&
- attr.actualValue !== null &&
- attr.actualValue !== ''
- ) {
- currentTask.value[attr.identifier] = attr.actualValue
- } else {
- // 否则使用默认值
- currentTask.value[attr.identifier] = attr.defaultValue || ''
- }
- }
- })
- }
- // 当前编辑的任务
- const currentTask = ref({
- id: undefined,
- wellName: '',
- wellType: '',
- wellCategory: '',
- location: '',
- dictType: '',
- technique: '',
- workloadDesign: '',
- workloadUnit: '',
- deptIds: [],
- deviceIds: [],
- responsiblePerson: [],
- submitter: [],
- remark: '',
- projectId: '',
- platformWell: '0', // 新增平台井字段,默认非平台井
- platformWellDetails: [] // 新增平台井详情列表
- })
- const isNewTask = ref(false) // 是否是新任务
- const taskFormRef = ref() // 任务表单ref
- const currentEditingIndex = ref(-1) // 当前编辑的行索引
- // 任务表单验证规则
- const taskFormRules = computed(() => {
- const rules = {
- wellName: [
- { required: currentTask.value.platformWell !== '1', message: '井号不能为空', trigger: 'blur' }
- ],
- wellType: [{ required: true, message: '井型不能为空', trigger: 'change' }],
- location: [{ required: true, message: '施工地点不能为空', trigger: 'blur' }],
- technique: [{ required: true, message: '施工工艺不能为空', trigger: 'change' }],
- workloadDesign: [
- {
- required: currentTask.value.platformWell !== '1',
- message: '设计工作量不能为空',
- trigger: 'blur'
- },
- {
- validator: (rule, value, callback) => {
- if (currentTask.value.platformWell === '1') {
- callback()
- return
- }
- if (value === '' || value === null || value === undefined) {
- callback(new Error('设计工作量不能为空'))
- return
- }
- const numValue = Number(value)
- if (isNaN(numValue) || numValue < 0) {
- callback(new Error('请填写大于0的数字'))
- } else {
- callback()
- }
- },
- trigger: 'blur'
- }
- ],
- workloadUnit: [
- {
- required: currentTask.value.platformWell !== '1',
- message: '工作量单位不能为空',
- trigger: 'change'
- }
- ],
- deptIds: [{ required: true, message: '施工队伍不能为空', trigger: 'change' }],
- deviceIds: [
- { required: hasDevicesAvailable.value, message: '施工设备不能为空', trigger: 'change' }
- ],
- responsiblePerson: [
- {
- required: true,
- message: isSpecialDept.value ? '带班干部不能为空' : '责任人不能为空',
- trigger: 'change',
- validator: (rule, value, callback) => {
- if (!value || value.length === 0) {
- callback(new Error(isSpecialDept.value ? '带班干部不能为空' : '责任人不能为空'))
- } else {
- callback()
- }
- }
- }
- ],
- submitter: [
- {
- required: isSpecialDept.value,
- message: '填报人不能为空',
- trigger: 'change',
- validator: (rule, value, callback) => {
- if (isSpecialDept.value && (!value || value.length === 0)) {
- callback(new Error('填报人不能为空'))
- } else {
- callback()
- }
- }
- }
- ]
- }
- return rules
- })
- // 动态属性验证规则
- const getDynamicAttrRules = (attr) => {
- const rules = []
- if (attr.required === 1) {
- rules.push({ required: true, message: `${attr.name}不能为空`, trigger: 'blur' })
- }
- // 数字类型验证
- if (attr.dataType === 'double') {
- rules.push({
- validator: (rule, value, callback) => {
- if (value === '' || value === null || value === undefined) {
- callback()
- return
- }
- const numValue = Number(value)
- if (isNaN(numValue)) {
- callback(new Error(`${attr.name}必须是数字`))
- } else if (attr.minValue !== null && numValue < Number(attr.minValue)) {
- // callback(new Error(`${attr.name}不能小于${attr.minValue}`));
- } else if (attr.maxValue !== null && numValue > Number(attr.maxValue)) {
- // callback(new Error(`${attr.name}不能大于${attr.maxValue}`));
- } else {
- callback()
- }
- },
- trigger: 'blur'
- })
- }
- return rules
- }
- const tableData = ref([])
- // 打开责任人选择对话框(用于表单)
- const openResponsiblePersonDialogForForm = async () => {
- if (!currentTask.value.deptIds || currentTask.value.deptIds.length === 0) {
- ElMessage.warning('请先选择施工队伍')
- return
- }
- selectedResponsiblePersonIds.value = [...(currentTask.value.responsiblePerson || [])]
- try {
- const params = {
- deptIds: currentTask.value.deptIds, // 使用当前项目所属部门的deptId
- deptId: deptId.value
- }
- const response = await UserApi.selectedDeptsEmployee(params)
- responsiblePersonList.value = response
- responsiblePersonDialogVisible.value = true
- } catch (error) {
- ElMessage.error('获取责任人列表失败')
- console.error('获取责任人列表失败:', error)
- }
- }
- // 打开工单人选择对话框(用于表单)
- const openSubmitterDialogForForm = async () => {
- if (!currentTask.value.deptIds || currentTask.value.deptIds.length === 0) {
- ElMessage.warning('请先选择施工队伍')
- return
- }
- selectedSubmitterIds.value = [...(currentTask.value.submitter || [])]
- try {
- const params = {
- deptIds: currentTask.value.deptIds // 使用当前项目所属部门的deptId
- }
- const response = await UserApi.selectedDeptsEmployee(params)
- submitterList.value = response
- submitterDialogVisible.value = true
- } catch (error) {
- ElMessage.error('获取填报人列表失败')
- console.error('获取填报人列表失败:', error)
- }
- }
- // 获取动态属性
- const fetchDynamicAttrs = async () => {
- // 如果已经通过任务数据获取了动态属性,则不再调用接口
- if (hasDynamicAttrsFromTask.value) {
- return
- }
- if (!formData.value.deptId) {
- console.warn('部门ID为空,无法获取动态属性')
- return
- }
- try {
- const queryParams = {
- deptId: formData.value.deptId
- }
- const response = await IotProjectTaskAttrsApi.getIotProjectTaskAttrsList(queryParams)
- dynamicAttrs.value = response || []
- // 初始化动态属性到当前任务
- initDynamicAttrsToCurrentTask()
- } catch (error) {
- console.error('获取动态属性失败:', error)
- ElMessage.error('获取动态属性失败')
- }
- }
- // 打开设备选择对话框(用于表单)
- const openDeviceDialogForForm = async () => {
- if (!currentTask.value.deptIds || currentTask.value.deptIds.length === 0) {
- ElMessage.warning('请先选择施工队伍')
- return
- }
- selectedDeviceIds.value = [...(currentTask.value.deviceIds || [])]
- console.log('sssssssssssssssssss', params)
- try {
- const params = {
- deptIds: currentTask.value.deptIds,
- deptId: deptId.value
- }
- const data = await IotDeviceApi.getDevicesByDepts(params)
- // 更新 hasDevicesAvailable 状态
- hasDevicesAvailable.value = data && data.length > 0
- // 更新设备映射表
- const newDeviceMap = { ...deviceMap.value }
- data.forEach((device) => {
- newDeviceMap[device.id] = device
- })
- deviceMap.value = newDeviceMap
- filteredDeviceList.value = data
- deviceDialogVisible.value = true
- // 如果没有设备可用,显示提示信息
- if (!hasDevicesAvailable.value) {
- ElMessage.info('当前施工队伍下没有可用设备,设备字段为非必填项')
- }
- } catch (error) {
- ElMessage.error('获取设备列表失败')
- console.error('获取设备列表失败:', error)
- // 如果获取失败,也设为非必填,避免用户无法提交
- hasDevicesAvailable.value = false
- }
- }
- // 打开工作量维护对话框
- const openWorkloadDialog = () => {
- currentPlatformWellIndex.value = -1 // 设置为-1表示普通井模式
- // 前置校验:设计工作量不合法则直接返回
- if (!validateWorkloadDesign()) {
- ElMessage.error(workloadDesignError.value)
- return
- }
- // 重置列表
- workloadList.value = []
- hasInitialWorkload.value = false
- // 获取当前操作的井号(兼容普通井/平台井)
- let currentWellName = ''
- if (currentTask.value.platformWell === '1') {
- // 平台井:取主井号(优先当前任务wellName,其次取平台井详情第一个)
- currentWellName =
- currentTask.value.wellName ||
- (currentTask.value.platformWellDetails.length > 0
- ? currentTask.value.platformWellDetails[0].wellName
- : '')
- } else {
- // 普通井:直接取当前任务井号
- currentWellName = currentTask.value.wellName
- }
- if (!currentWellName) {
- ElMessage.warning('请先填写井号')
- return
- }
- // 从Map中回显当前井号的工作量数据
- if (workloadMap.value.has(currentWellName)) {
- // 深拷贝避免原数据被修改
- workloadList.value = JSON.parse(JSON.stringify(workloadMap.value.get(currentWellName)))
- hasInitialWorkload.value = workloadList.value.length > 0
- } else {
- // 无历史数据时,沿用原有逻辑(取表单已有值初始化首行)
- if (currentTask.value.workloadUnit && currentTask.value.workloadDesign) {
- workloadList.value.push({
- workloadUnit: currentTask.value.workloadUnit,
- workloadDesign: currentTask.value.workloadDesign
- })
- hasInitialWorkload.value = true
- }
- }
- workloadDialogVisible.value = true
- }
- // 添加工作量项
- const addWorkloadItem = () => {
- workloadList.value.push({
- workloadUnit: '',
- workloadDesign: ''
- })
- }
- // 删除工作量项
- const removeWorkloadItem = (index: number) => {
- workloadList.value.splice(index, 1)
- }
- // 确认工作量选择
- const confirmWorkloadSelection = () => {
- // 验证工作量对话框中的所有数据
- let allValid = true
- workloadList.value.forEach((item, index) => {
- if (!validateWorkloadDialogDesign(index)) {
- allValid = false
- }
- })
- if (!allValid) {
- ElMessage.error('请完善所有工作量信息')
- return
- }
- // 验证工作量单位唯一性
- const unitList = workloadList.value.map((item) => item.workloadUnit).filter(Boolean)
- const uniqueUnits = new Set(unitList)
- if (unitList.length !== uniqueUnits.size) {
- ElMessage.error('工作量单位不能重复,请选择不同的单位')
- return
- }
- // 获取当前井号并存储到Map
- let currentWellName = ''
- if (currentPlatformWellIndex.value >= 0) {
- // 平台井模式
- const wellDetail = currentTask.value.platformWellDetails[currentPlatformWellIndex.value]
- currentWellName = wellDetail.wellName
- // 同步更新平台井表格中的工作量单位
- if (workloadList.value.length > 0) {
- const firstItem = workloadList.value[0]
- if (wellDetail.workloadUnit !== firstItem.workloadUnit) {
- wellDetail.workloadUnit = firstItem.workloadUnit
- }
- wellDetail.workloadDesign = firstItem.workloadDesign
- }
- } else {
- // 普通井模式
- currentWellName = currentTask.value.wellName
- // 同步更新表单中的工作量单位
- if (workloadList.value.length > 0) {
- const firstItem = workloadList.value[0]
- if (currentTask.value.workloadUnit !== firstItem.workloadUnit) {
- currentTask.value.workloadUnit = firstItem.workloadUnit
- }
- currentTask.value.workloadDesign = firstItem.workloadDesign
- }
- }
- // 存储到Map
- if (currentWellName) {
- workloadMap.value.set(currentWellName, JSON.parse(JSON.stringify(workloadList.value)))
- }
- workloadDialogVisible.value = false
- currentPlatformWellIndex.value = -1 // 重置索引
- ElMessage.success('工作量信息已更新')
- }
- // 处理穿梭框变化
- const handleTransferChange = (value, direction, movedKeys) => {
- // 可以添加额外的处理逻辑
- }
- // 确认设备选择(用于表单)
- const confirmDeviceSelection = () => {
- currentTask.value.deviceIds = [...selectedDeviceIds.value]
- // 强制更新视图
- currentTask.value = { ...currentTask.value }
- deviceDialogVisible.value = false
- }
- // 确认责任人选择(用于表单)
- const confirmResponsiblePersonSelection = () => {
- currentTask.value.responsiblePerson = [...selectedResponsiblePersonIds.value]
- responsiblePersonDialogVisible.value = false
- // 立即触发责任人字段验证
- nextTick(() => {
- taskFormRef.value.validateField('responsiblePerson')
- })
- }
- // 确认填报人选择(用于表单)
- const confirmSubmitterSelection = () => {
- currentTask.value.submitter = [...selectedSubmitterIds.value]
- submitterDialogVisible.value = false
- // 立即触发填报人字段验证
- nextTick(() => {
- taskFormRef.value.validateField('submitter')
- })
- }
- // 关闭设备选择对话框
- const handleDeviceDialogClose = () => {
- deviceDialogVisible.value = false
- }
- // 关闭责任人选择对话框
- const handleResponsiblePersonDialogClose = () => {
- responsiblePersonDialogVisible.value = false
- }
- // 关闭填报人选择对话框
- const handleSubmitterDialogClose = () => {
- submitterDialogVisible.value = false
- }
- // 获取井型标签的方法
- const getWellTypeLabel = (value) => {
- const options = getStrDictOptions(DICT_TYPE.PMS_PROJECT_WELL_TYPE)
- const option = options.find((opt) => opt.value === value)
- return option ? option.label : value
- }
- // 获取井别标签的方法
- const getWellCategoryLabel = (value) => {
- const options = getStrDictOptions(DICT_TYPE.PMS_PROJECT_WELL_CATEGORY)
- const option = options.find((opt) => opt.value === value)
- return option ? option.label : value
- }
- // 获取施工工艺标签的方法
- const getTechniqueLabel = (value) => {
- const options = getStrDictOptions(DICT_TYPE.PMS_PROJECT_TECHNOLOGY)
- const option = options.find((opt) => opt.value === value)
- return option ? option.label : value
- }
- // 获取 工作量单位 标签的方法
- const getWorkloadUnitLabel = (value) => {
- const options = getStrDictOptions(DICT_TYPE.PMS_PROJECT_WORKLOAD_UNIT)
- const option = options.find((opt) => opt.value === value)
- return option ? option.label : value
- }
- // 打开平台井工作量对话框
- const openPlatformWellWorkloadDialog = (index) => {
- currentPlatformWellIndex.value = index
- const wellDetail = currentTask.value.platformWellDetails[index]
- // 前置校验
- if (!validatePlatformWellWorkloadDesign(index)) {
- ElMessage.error(wellDetail.workloadDesignError)
- return
- }
- // 重置列表
- workloadList.value = []
- hasInitialWorkload.value = false
- if (!wellDetail.wellName) {
- ElMessage.warning('请先填写井号')
- return
- }
- // 从Map中回显工作量数据
- if (workloadMap.value.has(wellDetail.wellName)) {
- workloadList.value = JSON.parse(JSON.stringify(workloadMap.value.get(wellDetail.wellName)))
- hasInitialWorkload.value = workloadList.value.length > 0
- } else {
- // 无历史数据时,使用当前行的值初始化
- if (wellDetail.workloadUnit && wellDetail.workloadDesign) {
- workloadList.value.push({
- workloadUnit: wellDetail.workloadUnit,
- workloadDesign: wellDetail.workloadDesign
- })
- hasInitialWorkload.value = true
- }
- }
- workloadDialogVisible.value = true
- }
- // 校验平台井设计工作量
- const validatePlatformWellWorkloadDesign = (index) => {
- const wellDetail = currentTask.value.platformWellDetails[index]
- wellDetail.workloadDesignError = ''
- const value = wellDetail.workloadDesign
- if (value === '' || value === null || value === undefined) {
- wellDetail.workloadDesignError = '设计工作量不能为空'
- return false
- }
- const numValue = Number(value)
- if (isNaN(numValue) || numValue < 0) {
- wellDetail.workloadDesignError = '请填写大于0的数字'
- return false
- }
- return true
- }
- /** 同步当前任务表单数据到表格数据 */
- const syncCurrentTaskToTable = () => {
- // 平台井模式特殊处理
- if (currentTask.value.platformWell === '1') {
- if (currentTask.value.platformWellDetails.length === 0) {
- ElMessage.warning('请先添加平台井详情')
- return false
- }
- // 验证平台井详情数据
- const invalidDetails = currentTask.value.platformWellDetails.some(
- (detail) => !detail.wellName || !detail.wellName.trim() || !detail.workloadDesign
- )
- if (invalidDetails) {
- ElMessage.error('请完善平台井的井号和设计工作量信息')
- return false
- }
- // 平台井模式:为每个平台井详情生成任务对象
- const platformTasks = []
- // 查找当前编辑的主任务对应的平台井详情
- let mainTaskDetailIndex = -1
- // 如果有当前任务ID,查找对应的平台井详情
- if (currentTask.value.id) {
- mainTaskDetailIndex = currentTask.value.platformWellDetails.findIndex(
- (detail) => detail.taskId === currentTask.value.id
- )
- }
- // 如果没有找到对应的详情,使用第一个详情作为主任务
- if (mainTaskDetailIndex === -1 && currentTask.value.platformWellDetails.length > 0) {
- mainTaskDetailIndex = 0
- }
- // 处理每个平台井详情
- currentTask.value.platformWellDetails.forEach((detail, index) => {
- // 获取当前井号的工作量数据
- const workloadData = workloadMap.value.get(detail.wellName) || []
- if (index === mainTaskDetailIndex) {
- // 主任务:使用当前任务对象
- currentTask.value.wellName = detail.wellName
- currentTask.value.workloadDesign = detail.workloadDesign
- currentTask.value.workloadUnit = detail.workloadUnit
- // platformWell 保持为 '1' - 主平台井任务
- currentTask.value.platformWell = '1'
- platformTasks.push({ ...currentTask.value })
- } else {
- // 子任务:创建新的任务对象
- const newTask = {
- ...currentTask.value, // 拷贝所有属性
- id: detail.taskId || undefined, // 已有任务使用taskId,新增任务为undefined
- wellName: detail.wellName,
- workloadDesign: detail.workloadDesign,
- workloadUnit: detail.workloadUnit,
- platformWell: detail.taskId ? '2' : '2' // 子任务platformWell设为2
- }
- // 移除不需要的属性
- delete newTask.platformWellDetails
- platformTasks.push(newTask)
- }
- })
- // 设置项目ID
- platformTasks.forEach((task) => {
- task.projectId = formData.value.id
- })
- if (isNewTask.value) {
- // 新增任务 - 为所有任务生成ID
- let maxId =
- tableData.value.length > 0 ? Math.max(...tableData.value.map((item) => item.id)) : 0
- platformTasks.forEach((task) => {
- maxId += 1
- task.id = maxId
- tableData.value.unshift({ ...task })
- })
- isNewTask.value = false
- } else {
- // 更新现有任务 - 比较复杂,需要先删除原有任务再添加新任务
- // 这里简化处理:删除当前任务相关的所有平台井任务,然后重新添加
- const currentTaskId = currentTask.value.id
- tableData.value = tableData.value.filter((item) => item.id !== currentTaskId)
- platformTasks.forEach((task) => {
- tableData.value.unshift({ ...task })
- })
- }
- return true
- } else {
- // 非平台井模式,验证原有字段
- if (!currentTask.value.wellName) {
- ElMessage.warning('请先填写任务详情')
- return false
- }
- // 设置项目ID
- currentTask.value.projectId = formData.value.id
- if (isNewTask.value) {
- // 新增任务 - 生成唯一ID并添加到表格
- const newId =
- tableData.value.length > 0 ? Math.max(...tableData.value.map((item) => item.id)) + 1 : 1
- currentTask.value.id = newId
- tableData.value.unshift({ ...currentTask.value })
- isNewTask.value = false
- } else {
- // 更新现有任务
- const index = tableData.value.findIndex((item) => item.id === currentTask.value.id)
- if (index !== -1) {
- tableData.value.splice(index, 1, { ...currentTask.value })
- } else {
- // 如果没有找到,添加到表格(可能是意外情况)
- tableData.value.unshift({ ...currentTask.value })
- }
- }
- return true
- }
- }
- // 重置任务表单
- const resetTaskForm = () => {
- // 记录旧井号,用于清理Map
- const oldWellName = currentTask.value.wellName
- currentTask.value = {
- id: undefined,
- wellName: '',
- wellType: '',
- wellCategory: '',
- location: '',
- technique: '',
- workloadDesign: '',
- workloadUnit: '',
- deptIds: [],
- deviceIds: [],
- responsiblePerson: [],
- remark: '',
- projectId: formData.value.id,
- platformWell: '0', // 重置平台井状态
- platformWellDetails: [], // 清空平台井详情
- // 如果是特殊部门,初始化填报人字段
- ...(isSpecialDept.value ? { submitter: [] } : {})
- }
- // 清理当前井号对应的Map数据
- if (oldWellName) {
- if (workloadMap.value.has(oldWellName)) {
- workloadMap.value.delete(oldWellName)
- }
- if (workloadBackup.value.has(oldWellName)) {
- workloadBackup.value.delete(oldWellName)
- }
- }
- // 重新初始化动态属性
- initDynamicAttrsToCurrentTask()
- isNewTask.value = false
- taskFormRef.value?.resetFields()
- // 清除表单验证状态
- nextTick(() => {
- taskFormRef.value?.clearValidate()
- })
- }
- // 获取已选的工作量单位(排除当前行) ==========
- const getSelectedWorkloadUnits = (currentIndex) => {
- if (!workloadList.value || workloadList.value.length === 0) {
- return []
- }
- // 过滤当前行 + 空值,收集已选的单位
- return workloadList.value
- .filter((_, index) => index !== currentIndex)
- .map((item) => item.workloadUnit)
- .filter((unit) => unit && unit.trim() !== '')
- }
- // 处理行点击事件
- const handleRowClick = (row, index) => {
- if (row) {
- currentTask.value = { ...row }
- currentEditingIndex.value = index // 保存当前编辑的行索引
- isNewTask.value = false
- }
- }
- // 设备过滤方法
- const filterDeviceMethod = (query: string, item: IotDeviceVO) => {
- if (!query) return true
- const searchText = query.toLowerCase()
- const deviceCode = (item.deviceCode || '').toLowerCase()
- const deviceName = (item.deviceName || '').toLowerCase()
- // 同时匹配设备编码和设备名称
- return deviceCode.includes(searchText) || deviceName.includes(searchText)
- }
- // 根据责任人ID获取责任人名称
- const getResponsiblePersonNames = (responsiblePersonIds: number[]) => {
- if (!responsiblePersonIds || responsiblePersonIds.length === 0) return ''
- // 获取所有有效责任人名称
- const personNames = responsiblePersonIds
- .map((id) => {
- const person = responsiblePersonList.value.find((p) => p.id === id)
- return person ? person.nickname : ''
- })
- .filter((name) => name !== undefined && name !== '')
- if (personNames.length === 0) return ''
- // 如果责任人数量超过2个,显示前两个加省略号
- if (personNames.length > 2) {
- return `${personNames[0]}, ${personNames[1]}...`
- }
- // 责任人数量不超过2个,正常显示所有
- return personNames.join(', ')
- }
- // 获取所有责任人名称(用于tooltip提示)
- const getAllResponsiblePersonNames = (responsiblePersonIds: number[]) => {
- if (!responsiblePersonIds || responsiblePersonIds.length === 0) return '无责任人'
- const personNames = responsiblePersonIds
- .map((id) => {
- const person = responsiblePersonList.value.find((p) => p.id === id)
- return person ? person.nickname : '未知人员'
- })
- .filter((name) => name !== '未知人员')
- return personNames.join(', ') || '无有效责任人'
- }
- // 获取所有设备名称(用于tooltip提示)
- const getAllDeviceNames = (deviceIds: number[]) => {
- if (!deviceIds || deviceIds.length === 0) return '无设备'
- const deviceNames = deviceIds
- .map((id) => deviceMap.value[id]?.deviceCode || '未知设备')
- .filter((name) => name !== '未知设备')
- return deviceNames.join(', ') || '无有效设备'
- }
- const companyName = ref('')
- /** 打开弹窗 */
- const open = async () => {
- resetForm()
- resetTaskForm()
- hasDynamicAttrsFromTask.value = false // 重置标志
- // 修改时,设置数据
- if (id) {
- formType.value = 'update'
- formLoading.value = true
- try {
- queryParams.id = id
- const data = await IotProjectTaskApi.getIotProjectTaskPage(queryParams)
- tableData.value = data.list
- const company = await IotOpeationFillApi.getOrgName(tableData.value[0].deptId)
- companyName.value = company
- // 收集所有设备ID
- const allDeviceIds = new Set<number>()
- // 收集所有责任人ID
- const allResponsiblePersonIds = new Set<number>()
- // 收集所有填报人ID
- const allSubmitterIds = new Set<number>()
- data.list.forEach((item) => {
- if (item.deviceIds?.length) {
- item.deviceIds.forEach((id) => allDeviceIds.add(id))
- }
- if (item.responsiblePerson?.length) {
- item.responsiblePerson.forEach((id) => allResponsiblePersonIds.add(id))
- }
- if (item.submitter?.length) {
- item.submitter.forEach((id) => allSubmitterIds.add(id))
- }
- })
- // 批量获取设备信息
- if (allDeviceIds.size > 0) {
- const deviceIdsArray = Array.from(allDeviceIds)
- const devices = await IotDeviceApi.getDevicesByDepts({
- deviceIds: deviceIdsArray
- })
- // 更新设备列表和映射表
- deviceList.value = devices
- deviceMap.value = {}
- devices.forEach((device) => {
- deviceMap.value[device.id] = device
- })
- }
- // 批量获取责任人信息
- if (allResponsiblePersonIds.size > 0) {
- const personIdsArray = Array.from(allResponsiblePersonIds)
- const params = {
- userIds: personIdsArray
- }
- const persons = await UserApi.companyDeptsEmployee(params)
- // 更新责任人列表
- responsiblePersonList.value = persons
- }
- // 批量获取填报人信息
- if (allSubmitterIds.size > 0) {
- const personIdsArray = Array.from(allSubmitterIds)
- const params = {
- userIds: personIdsArray
- }
- const persons = await UserApi.companyDeptsEmployee(params)
- // 更新责任人列表
- submitterList.value = persons
- }
- if (tableData.value && tableData.value.length > 0) {
- // 使用深拷贝,避免修改表单时直接影响表格数据
- currentTask.value = JSON.parse(JSON.stringify(tableData.value[0]))
- isNewTask.value = false
- // 如果当前任务有施工队伍,立即查询设备并更新 hasDevicesAvailable
- if (currentTask.value.deptIds && currentTask.value.deptIds.length > 0) {
- try {
- const params = {
- deptIds: currentTask.value.deptIds,
- deptId: deptId.value
- }
- const deviceData = await IotDeviceApi.getDevicesByDepts(params)
- // 更新 hasDevicesAvailable 状态
- hasDevicesAvailable.value = deviceData && deviceData.length > 0
- // 更新设备列表和映射表(如果有设备)
- if (hasDevicesAvailable.value) {
- deviceList.value = deviceData
- deviceMap.value = {}
- deviceData.forEach((device) => {
- deviceMap.value[device.id] = device
- })
- }
- } catch (error) {
- console.error('初始化查询设备失败:', error)
- hasDevicesAvailable.value = false
- }
- } else {
- // 如果没有施工队伍,默认没有设备可用
- hasDevicesAvailable.value = false
- }
- // 处理平台井数据
- // 将数字类型的 platformWell 转换为字符串类型
- currentTask.value.platformWell = currentTask.value.platformWell?.toString() || '0'
- // 如果 platformWell 为 1,处理 platformWells 数据
- if (currentTask.value.platformWell === '1' && currentTask.value.platformWells) {
- // 将 platformWells 映射到 platformWellDetails
- currentTask.value.platformWellDetails = currentTask.value.platformWells.map(
- (item: any) => ({
- taskId: item.id,
- wellName: item.wellName,
- workloadUnit: item.workloadUnit || '', // 确保有workloadUnit字段
- workloadDesign: item.workloadDesign || '',
- workloadDesignError: '' // 新增错误信息字段
- })
- )
- // 使用专门的排序方法
- sortPlatformWellDetails()
- // 初始化备份数据
- platformWellDetailsBackup.value = [...currentTask.value.platformWellDetails]
- // 处理每个平台井的工作量数据
- processPlatformWellWorkloadData(currentTask.value.platformWells)
- } else {
- // 非平台井模式,确保 platformWellDetails 是数组
- currentTask.value.platformWellDetails = currentTask.value.platformWellDetails || []
- platformWellDetailsBackup.value = []
- // 处理非平台井的工作量数据
- if (currentTask.value.extProperty?.[0]?.dropdownList) {
- processWorkloadDataForWell(
- currentTask.value.wellName,
- currentTask.value.extProperty[0].dropdownList
- )
- }
- }
- // 检查任务数据中是否有extProperty
- if (tableData.value[0].extProperty && tableData.value[0].extProperty.length > 0) {
- // 使用任务数据中的extProperty作为动态属性
- dynamicAttrs.value = tableData.value[0].extProperty
- hasDynamicAttrsFromTask.value = true
- // 将extProperty中的值设置到当前任务
- tableData.value[0].extProperty.forEach((attr) => {
- if (attr.identifier) {
- // 优先使用actualValue,如果没有则使用defaultValue
- currentTask.value[attr.identifier] =
- attr.actualValue !== undefined &&
- attr.actualValue !== null &&
- attr.actualValue !== ''
- ? attr.actualValue
- : attr.defaultValue || ''
- }
- })
- }
- const attachments = tableData.value[0].attachments || []
- constructionFiles.value = attachments
- .filter((item) => item.type === 'CONSTRUCTION_DESIGN')
- .map((item) => ({
- name: item.filename,
- percentage: 100,
- response: { data: item },
- status: 'success',
- uid: item.createTime
- }))
- geologicalFiles.value = attachments
- .filter((item) => item.type === 'GEOLOGICAL_DESIGN')
- .map((item) => ({
- name: item.filename,
- percentage: 100,
- response: { data: item },
- status: 'success',
- uid: item.createTime
- }))
- completionFiles.value = attachments
- .filter((item) => item.type === 'COMPLETION_DESIGN')
- .map((item) => ({
- name: item.filename,
- percentage: 100,
- response: { data: item },
- status: 'success',
- uid: item.createTime
- }))
- }
- } finally {
- formLoading.value = false
- }
- } else {
- formType.value = 'create'
- // 初始化备份数据
- platformWellDetailsBackup.value = []
- }
- // 如果有projectId参数,自动选中对应的合同
- if (projectId.value) {
- autoSelectContract(projectId.value)
- }
- }
- defineExpose({ open }) // 提供 open 方法,用于打开弹窗
- // 获取平台井已选的工作量单位(排除当前行)
- const getPlatformWellWorkloadUnits = (currentIndex) => {
- if (
- !currentTask.value.platformWellDetails ||
- currentTask.value.platformWellDetails.length === 0
- ) {
- return []
- }
- // 获取当前井号的井名
- const currentWellName = currentTask.value.platformWellDetails[currentIndex]?.wellName
- if (!currentWellName) {
- return []
- }
- // 从workloadMap中获取当前井号的工作量列表
- const currentWellWorkloadList = workloadMap.value.get(currentWellName) || []
- return currentWellWorkloadList
- .filter((_, index) => index !== 0)
- .map((item) => item.workloadUnit)
- .filter((unit) => unit && unit.trim() !== '')
- }
- /** 自动选择合同 */
- const autoSelectContract = async (projectId: string) => {
- console.log('项目id:' + projectId)
- // 查找匹配的合同
- const project = projectList.value.find((item) => item.id === Number(projectId))
- if (project) {
- // 设置选中值
- formData.value.contractId = project.id
- // 触发合同信息加载
- getProjectInfo(project.id)
- } else {
- ElMessage.warning('未找到指定的合同信息')
- }
- }
- /** 校验所有行数据 */
- const validateAllRows = (): boolean => {
- // 判断任务列表是否为空
- if (!tableData.value || tableData.value.length === 0) {
- ElMessage.error('没有任务数据,无法保存')
- return false
- }
- let allValid = true
- tableData.value.forEach((row) => {
- if (!row.wellName || row.wellName.trim() === '') {
- allValid = false
- }
- // 对于平台井模式下的后续任务,platformWell为0,但wellName和workloadDesign仍需验证
- if (!row.workloadDesign) {
- allValid = false
- }
- if (!row.location || row.location.trim() === '') {
- allValid = false
- }
- if (!row.technique || row.technique.trim() === '') {
- allValid = false
- }
- if (!row.deptIds || row.deptIds.length === 0) {
- allValid = false
- }
- // 修改:只有当有设备可用时才验证设备字段
- if (hasDevicesAvailable.value && (!row.deviceIds || row.deviceIds.length === 0)) {
- allValid = false
- }
- if (!row.responsiblePerson || row.responsiblePerson.length === 0) {
- allValid = false
- }
- // 如果是特殊部门,验证填报人
- if (isSpecialDept.value && (!row.submitter || row.submitter.length === 0)) {
- allValid = false
- }
- })
- if (!allValid) {
- ElMessage.error('请检查表格中的数据,部分必填项未填写或格式不正确')
- }
- return allValid
- }
- // 添加表单专用的格式化方法
- // 格式化设备显示(用于表单)
- const formatDevicesForForm = (deviceIds: number[]) => {
- if (!deviceIds || deviceIds.length === 0) return ''
- const deviceInfos = deviceIds
- .map((id) => {
- const device = deviceMap.value[id]
- return device ? `${device.deviceCode}-${device.deviceName}` : ''
- })
- .filter((info) => info !== '')
- if (deviceInfos.length === 0) return ''
- return deviceInfos.join(', ')
- }
- // 获取所有设备名称(用于表单的tooltip)
- const getAllDeviceNamesForForm = (deviceIds: number[]) => {
- if (!deviceIds || deviceIds.length === 0) return '无设备'
- const deviceInfos = deviceIds
- .map((id) => {
- const device = deviceMap.value[id]
- return device ? `${device.deviceCode}-${device.deviceName}` : '未知设备'
- })
- .filter((info) => info !== '未知设备')
- return deviceInfos.join(', ') || '无有效设备'
- }
- // 格式化责任人显示(用于表单)
- const formatResponsiblePersonsForForm = (responsiblePersonIds: number[]) => {
- if (!responsiblePersonIds || responsiblePersonIds.length === 0) return ''
- const personNames = responsiblePersonIds
- .map((id) => {
- const person = responsiblePersonList.value.find((p) => p.id === id)
- return person ? person.nickname : ''
- })
- .filter((name) => name !== undefined && name !== '')
- if (personNames.length === 0) return ''
- return personNames.join(', ')
- }
- // 获取任务的工作量dropdownList数据
- const getWorkloadDropdownListForTask = (task: any) => {
- const dropdownList = []
- // 从workloadMap中获取当前任务井号的工作量数据
- const workloadItems = workloadMap.value.get(task.wellName) || []
- if (workloadItems.length > 0) {
- // 如果workloadMap中有数据,使用workloadMap的数据
- workloadItems.forEach((item) => {
- if (item.workloadUnit && item.workloadDesign) {
- // 获取工作量单位的标签
- const unitOptions = getStrDictOptions(DICT_TYPE.PMS_PROJECT_WORKLOAD_UNIT)
- const unitLabel =
- unitOptions.find((opt) => opt.value === item.workloadUnit)?.label || item.workloadUnit
- dropdownList.push({
- name: unitLabel, // 工作量单位名称
- value: item.workloadDesign // 工作量值
- })
- }
- })
- } else {
- // 【新增】如果workloadMap中没有数据,使用任务本身的工作量数据(直接从表格行中填写的数据)
- if (task.workloadUnit && task.workloadDesign) {
- const unitOptions = getStrDictOptions(DICT_TYPE.PMS_PROJECT_WORKLOAD_UNIT)
- const unitLabel =
- unitOptions.find((opt) => opt.value === task.workloadUnit)?.label || task.workloadUnit
- dropdownList.push({
- name: unitLabel,
- value: task.workloadDesign
- })
- }
- }
- return dropdownList
- }
- // 平台井工作量加号按钮禁用状态
- const getPlatformWellWorkloadAddBtnDisabled = (index) => {
- const wellDetail = currentTask.value.platformWellDetails[index]
- return !wellDetail.workloadUnit || !!wellDetail.workloadDesignError
- }
- // 格式化填报人显示(用于表单)
- const formatSubmittersForForm = (submitterIds: number[]) => {
- if (!submitterIds || submitterIds.length === 0) return ''
- const personNames = submitterIds
- .map((id) => {
- const person = submitterList.value.find((p) => p.id === id)
- return person ? person.nickname : ''
- })
- .filter((name) => name !== undefined && name !== '')
- if (personNames.length === 0) return ''
- return personNames.join(', ')
- }
- // 获取所有责任人名称(用于表单的tooltip)
- const getAllResponsiblePersonNamesForForm = (responsiblePersonIds: number[]) => {
- if (!responsiblePersonIds || responsiblePersonIds.length === 0) return '无责任人'
- const personNames = responsiblePersonIds
- .map((id) => {
- const person = responsiblePersonList.value.find((p) => p.id === id)
- return person ? person.nickname : '未知人员'
- })
- .filter((name) => name !== '未知人员')
- return personNames.join(', ') || '无有效责任人'
- }
- // 获取所有填报人名称(用于表单的tooltip)
- const getAllSubmitterNamesForForm = (submitterIds: number[]) => {
- if (!submitterIds || submitterIds.length === 0) return '无填报人'
- const personNames = submitterIds
- .map((id) => {
- const person = submitterList.value.find((p) => p.id === id)
- return person ? person.nickname : '未知人员'
- })
- .filter((name) => name !== '未知人员')
- return personNames.join(', ') || '无有效填报人'
- }
- /** 提交表单 */
- const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
- // 处理平台井工作量数据
- const processPlatformWellWorkloadData = (platformWells: any[]) => {
- if (!platformWells || !platformWells.length) return
- platformWells.forEach((well: any) => {
- if (well.wellName && well.extProperty?.[0]?.dropdownList) {
- processWorkloadDataForWell(well.wellName, well.extProperty[0].dropdownList)
- }
- })
- }
- // 处理单个井的工作量数据
- const processWorkloadDataForWell = (wellName: string, dropdownList: any[]) => {
- if (!wellName || !dropdownList || !dropdownList.length) return
- // 转换dropdownList格式为workloadMap需要的格式
- const workloadData = dropdownList.map((item) => ({
- workloadUnit: getWorkloadUnitValueByName(item.name), // 通过name获取对应的value
- workloadDesign: item.value
- }))
- // 存储到workloadMap
- workloadMap.value.set(wellName, workloadData)
- // 如果这个井在platformWellDetails中,更新其工作量单位和工作量设计
- if (currentTask.value.platformWellDetails) {
- const detailIndex = currentTask.value.platformWellDetails.findIndex(
- (detail: any) => detail.wellName === wellName
- )
- if (detailIndex !== -1 && workloadData.length > 0) {
- // 使用第一个工作量项作为平台井表格中显示的值
- currentTask.value.platformWellDetails[detailIndex].workloadUnit = workloadData[0].workloadUnit
- currentTask.value.platformWellDetails[detailIndex].workloadDesign =
- workloadData[0].workloadDesign
- }
- }
- // 如果是主任务井,也更新当前任务的工作量数据
- if (wellName === currentTask.value.wellName && workloadData.length > 0) {
- currentTask.value.workloadUnit = workloadData[0].workloadUnit
- currentTask.value.workloadDesign = workloadData[0].workloadDesign
- }
- }
- // 通过工作量单位名称获取对应的值
- const getWorkloadUnitValueByName = (name: string): string => {
- const options = getStrDictOptions(DICT_TYPE.PMS_PROJECT_WORKLOAD_UNIT)
- const option = options.find((opt) => opt.label === name)
- return option ? option.value : ''
- }
- const submitForm = async () => {
- // 施工区域的数据字典类型
- currentTask.value.dictType = currentDictLabel.value
- // 先校验设计工作量
- if (currentTask.value.platformWell !== '1' && !validateWorkloadDesign()) {
- ElMessage.error('请完善设计工作量信息')
- return
- }
- // 在同步任务前,确保平台井关联井的工作量数据正确设置
- if (currentTask.value.platformWell === '1') {
- currentTask.value.platformWellDetails.forEach((detail) => {
- // 如果该关联井在workloadMap中没有数据,但表格行中有工作量数据,则设置到workloadMap中
- if (
- detail.wellName &&
- !workloadMap.value.has(detail.wellName) &&
- detail.workloadUnit &&
- detail.workloadDesign
- ) {
- workloadMap.value.set(detail.wellName, [
- {
- workloadUnit: detail.workloadUnit,
- workloadDesign: detail.workloadDesign
- }
- ])
- }
- })
- }
- // 先同步当前任务表单数据到表格
- if (!syncCurrentTaskToTable()) {
- return
- }
- // 校验表单
- await formRef.value.validate()
- // 校验所有行数据
- if (!validateAllRows()) {
- return
- }
- const getFileType = (filename: string) => {
- const ext = filename.split('.').pop()?.toLowerCase()
- if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(ext || '')) {
- return 'image'
- } else if (['pdf'].includes(ext || '')) {
- return 'pdf'
- } else if (['doc', 'docx'].includes(ext || '')) {
- return 'word'
- } else if (['xls', 'xlsx'].includes(ext || '')) {
- return 'excel'
- } else {
- return 'other'
- }
- }
- const formatFileSize = (bytes: number) => {
- if (bytes === 0) return '0 Bytes'
- const k = 1024
- const sizes = ['Bytes', 'KB', 'MB', 'GB']
- const i = Math.floor(Math.log(bytes) / Math.log(k))
- return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
- }
- function formatterAttachments(attachments: any[], type: string, taskId: number) {
- return attachments.flatMap((item) => {
- if (item.response.data.files) {
- return item.response.data.files.map((file) => ({
- category: 'DAILY_REPORT',
- bizId: taskId,
- filename: file.name || '未知文件',
- fileType: getFileType(file.name),
- filePath: file.filePath,
- fileSize: formatFileSize(file.size || 0),
- remark: '',
- type
- }))
- } else return item.response.data
- })
- }
- // 处理动态属性数据
- const processedTableData = tableData.value.map((task) => {
- // 获取当前任务的工作量数据并转换为dropdownList格式
- const workloadDropdownList = getWorkloadDropdownListForTask(task)
- // 为每个任务构建extProperty数组
- const extProperties = dynamicAttrs.value.map((attr) => {
- return {
- name: attr.name,
- sort: attr.sort,
- unit: attr.unit,
- actualValue: task[attr.identifier] || '', // 从任务中获取用户填写的值
- dataType: attr.dataType,
- maxValue: attr.maxValue,
- minValue: attr.minValue,
- required: attr.required,
- accessMode: attr.accessMode,
- identifier: attr.identifier,
- defaultValue: attr.defaultValue,
- // 添加dropdownList到任务对象中
- dropdownList: workloadDropdownList
- }
- })
- // 返回处理后的任务数据,包含extProperty字段
- return {
- ...task,
- dictType: task.dictType || currentDictLabel.value, // 确保每个任务都有dictType
- extProperty: extProperties,
- attachments: formatterAttachments(constructionFiles.value, 'CONSTRUCTION_DESIGN', task.id)
- .concat(formatterAttachments(geologicalFiles.value, 'GEOLOGICAL_DESIGN', task.id))
- .concat(formatterAttachments(completionFiles.value, 'COMPLETION_REPORT', task.id))
- }
- })
- // 提交请求
- formLoading.value = true
- try {
- tableData.value.forEach((item) => {
- item.projectId = formData.value.id
- })
- const data = {
- taskList: processedTableData
- }
- if (formType.value === 'create') {
- await IotProjectTaskApi.createIotProjectTask(data)
- message.success(t('common.createSuccess'))
- } else {
- await IotProjectTaskApi.updateIotProjectTask(data)
- message.success(t('common.updateSuccess'))
- }
- // 发送操作成功的事件
- emit('success')
- close()
- } finally {
- formLoading.value = false
- }
- }
- // 判断是否为主要的平台井详情(不能删除)
- const isMainPlatformWellDetail = (index: number) => {
- if (
- !currentTask.value.platformWellDetails ||
- currentTask.value.platformWellDetails.length === 0
- ) {
- return false
- }
- const detail = currentTask.value.platformWellDetails[index]
- // 主记录的条件:是第一条记录且有关联的任务ID,或者是自动从非平台井转换过来的主记录
- return (
- index === 0 &&
- (detail.taskId === currentTask.value.id ||
- (detail.wellName === currentTask.value.wellName &&
- detail.workloadDesign === currentTask.value.workloadDesign))
- )
- }
- // 处理平台井开关变化
- const handlePlatformWellChange = (value) => {
- if (value === '1') {
- // 切换到平台井模式前,备份当前井号的工作量数据
- if (currentTask.value.wellName) {
- const currentWorkload = workloadMap.value.get(currentTask.value.wellName)
- if (currentWorkload) {
- workloadBackup.value.set(currentTask.value.wellName, [...currentWorkload])
- }
- }
- // 检查是否是从非平台井切换过来,且当前任务有井号信息
- const hasWellName = currentTask.value.wellName && currentTask.value.wellName.trim() !== ''
- const hasWorkloadDesign = currentTask.value.workloadDesign
- if (hasWellName && hasWorkloadDesign) {
- // 从非平台井切换到平台井,自动添加一条记录
- const mainDetail = {
- taskId: currentTask.value.id, // 关联当前任务ID
- wellName: currentTask.value.wellName,
- workloadUnit: currentTask.value.workloadUnit, // 同步工作量单位
- workloadDesign: currentTask.value.workloadDesign,
- workloadDesignError: ''
- }
- // 如果workloadMap中有主井数据,同步到平台井表格
- if (workloadMap.value.has(currentTask.value.wellName)) {
- const workloadData = workloadMap.value.get(currentTask.value.wellName)
- if (workloadData && workloadData.length > 0) {
- mainDetail.workloadUnit = workloadData[0].workloadUnit
- mainDetail.workloadDesign = workloadData[0].workloadDesign
- }
- }
- // 清空现有详情,添加主记录
- currentTask.value.platformWellDetails = [mainDetail]
- } else {
- // 恢复之前保存的数据或初始化
- if (platformWellDetailsBackup.value.length > 0) {
- currentTask.value.platformWellDetails = [...platformWellDetailsBackup.value]
- sortPlatformWellDetails()
- } else {
- addPlatformWellDetail()
- }
- }
- // 更新备份数据
- platformWellDetailsBackup.value = [...currentTask.value.platformWellDetails]
- } else {
- // 如果有平台井详情,将第一个详情的数据设置回主任务
- if (currentTask.value.platformWellDetails.length > 0) {
- const mainDetail = currentTask.value.platformWellDetails[0]
- currentTask.value.wellName = mainDetail.wellName || ''
- currentTask.value.workloadDesign = mainDetail.workloadDesign || ''
- // 恢复工作量数据
- if (mainDetail.wellName && workloadBackup.value.has(mainDetail.wellName)) {
- const backupWorkload = workloadBackup.value.get(mainDetail.wellName)
- if (backupWorkload && backupWorkload.length > 0) {
- workloadMap.value.set(mainDetail.wellName, [...backupWorkload])
- // 恢复表单中的工作量单位(取第一项)
- currentTask.value.workloadUnit = backupWorkload[0].workloadUnit
- currentTask.value.workloadDesign = backupWorkload[0].workloadDesign
- }
- }
- }
- // 切换到非平台井模式,保存当前数据到备份
- platformWellDetailsBackup.value = [...currentTask.value.platformWellDetails]
- // 切换到非平台井模式,清空详情列表
- currentTask.value.platformWellDetails = []
- }
- }
- // 校验工作量对话框中的设计工作量
- const validateWorkloadDialogDesign = (index) => {
- const workloadItem = workloadList.value[index]
- workloadItem.workloadDesignError = ''
- const value = workloadItem.workloadDesign
- if (value === '' || value === null || value === undefined) {
- workloadItem.workloadDesignError = '设计工作量不能为空'
- return false
- }
- const numValue = Number(value)
- if (isNaN(numValue) || numValue < 0) {
- workloadItem.workloadDesignError = '请填写大于0的数字'
- return false
- }
- return true
- }
- // 获取表单中已选的工作量单位(来自workloadMap)
- const getFormSelectedWorkloadUnits = () => {
- // 兼容普通井/平台井的井号获取逻辑(与工作量弹窗逻辑一致)
- let currentWellName = ''
- if (currentTask.value.platformWell === '1') {
- // 平台井:取主井号(优先当前任务wellName,其次取平台井详情第一个)
- currentWellName =
- currentTask.value.wellName ||
- (currentTask.value.platformWellDetails.length > 0
- ? currentTask.value.platformWellDetails[0].wellName
- : '')
- } else {
- // 普通井:直接取当前任务井号
- currentWellName = currentTask.value.wellName
- }
- // 从Map中获取当前井号的工作量列表,提取已选单位
- const workloadList = workloadMap.value.get(currentWellName) || []
- return workloadList.map((item) => item.workloadUnit).filter((unit) => unit && unit.trim() !== '') // 过滤空值
- }
- // 添加平台井详情行
- const addPlatformWellDetail = () => {
- const newDetail = {
- taskId: '',
- wellName: '',
- workloadUnit: '', // 新增工作量单位字段
- workloadDesign: '',
- workloadDesignError: '' // 新增错误信息字段
- }
- // 将新记录添加到数组末尾,而不是开头
- currentTask.value.platformWellDetails.push(newDetail)
- }
- // 删除平台井详情行
- const removePlatformWellDetail = (index: number) => {
- // 获取被删除的井号,清理Map
- const removedDetail = currentTask.value.platformWellDetails[index]
- if (removedDetail.wellName && workloadMap.value.has(removedDetail.wellName)) {
- workloadMap.value.delete(removedDetail.wellName)
- }
- currentTask.value.platformWellDetails.splice(index, 1)
- // 删除后重新排序
- sortPlatformWellDetails()
- }
- // 平台井详情排序方法
- const sortPlatformWellDetails = () => {
- if (
- !currentTask.value.platformWellDetails ||
- currentTask.value.platformWellDetails.length === 0
- ) {
- return
- }
- currentTask.value.platformWellDetails.sort((a, b) => {
- // 主记录(关联当前任务ID或从非平台井转换过来的记录)排在最前面
- const aIsMain = a.taskId === currentTask.value.id
- const bIsMain = b.taskId === currentTask.value.id
- if (aIsMain && !bIsMain) return -1
- if (!aIsMain && bIsMain) return 1
- // 其他记录保持原有顺序
- return 0
- })
- }
- /** 重置表单 */
- const resetForm = () => {
- formData.value = {
- id: undefined,
- contractId: undefined,
- contractName: undefined,
- contractCode: undefined,
- workloadTotal: undefined,
- workloadFinish: undefined,
- workloadUnit: undefined,
- startTime: undefined,
- endTime: undefined,
- location: undefined,
- technique: undefined,
- payment: undefined,
- remark: undefined,
- manufactureName: undefined,
- manufacturerId: undefined,
- userName: undefined,
- userId: undefined
- }
- formRef.value?.resetFields()
- }
- // 加载工作区域选项的方法
- const loadWorkAreaOptions = async (deptId: number) => {
- // 如果正在加载,直接返回
- if (loadingWorkAreaOptions.value) return
- loadingWorkAreaOptions.value = true
- try {
- // 先尝试通过 getDictLabel 获取字典标签
- const dictLabel = await getDictLabel(DICT_TYPE.PMS_PROJECT_WORK_AREA, deptId)
- console.log('当前专业公司的施工区域数据字典类型:' + dictLabel)
- // 将 dictLabel 存储到 currentDictLabel
- currentDictLabel.value = dictLabel || '' // 如果没有获取到,设为空字符串
- if (dictLabel) {
- // 如果获取到标签,再获取完整的字典选项
- const dictOptions = getStrDictOptions(dictLabel)
- console.log('当前专业公司的施工区域数据字典集合长度:' + dictOptions.length)
- workAreaOptions.value = dictOptions.map((option) => ({
- value: option.label, // 使用标签作为显示值
- id: option.value // 保留原始值
- }))
- } else {
- // 如果获取不到标签,清空选项
- workAreaOptions.value = []
- }
- } catch (error) {
- console.error('获取工作区域选项失败:', error)
- workAreaOptions.value = []
- } finally {
- loadingWorkAreaOptions.value = false
- }
- }
- // 当没有查询字符串时返回所有选项
- const querySearch = (queryString: string, cb: any) => {
- // 如果没有查询字符串,返回所有选项
- if (!queryString) {
- cb(workAreaOptions.value)
- return
- }
- // 有查询字符串时进行筛选
- const results = workAreaOptions.value.filter((option) =>
- option.value.toLowerCase().includes(queryString.toLowerCase())
- )
- // 调用 callback 返回建议列表的数据
- cb(results)
- }
- // 添加处理施工区域获取焦点的方法
- const handleWorkAreaFocus = async () => {
- // 如果已经有选项数据,直接显示下拉框
- if (workAreaOptions.value.length > 0) {
- // 使用Element Plus提供的方法触发下拉框
- try {
- // 直接调用el-autocomplete的focus方法
- if (workAreaAutocomplete.value && typeof workAreaAutocomplete.value.focus === 'function') {
- workAreaAutocomplete.value.focus()
- }
- } catch (error) {
- console.error('触发下拉框显示失败:', error)
- }
- return
- }
- // 如果没有选项数据,尝试加载
- if (formData.value.deptId && !loadingWorkAreaOptions.value) {
- await loadWorkAreaOptions(formData.value.deptId)
- // 加载完成后尝试显示下拉框
- if (workAreaOptions.value.length > 0) {
- try {
- if (workAreaAutocomplete.value && typeof workAreaAutocomplete.value.focus === 'function') {
- workAreaAutocomplete.value.focus()
- }
- } catch (error) {
- console.error('触发下拉框显示失败:', error)
- }
- }
- }
- }
- // 添加选择处理方法
- const handleSelect = (item: any) => {
- // 这里可以根据需要处理选择后的逻辑
- console.log('选择了:', item.value)
- }
- // 加载施工工艺选项的方法
- const loadTechnologyOptions = async (deptId: number) => {
- if (loadingTechnologyOptions.value) return
- loadingTechnologyOptions.value = true
- try {
- // 先尝试通过 getDictLabel 获取字典标签
- const dictLabel = await getDictLabel(DICT_TYPE.PMS_PROJECT_TECHNOLOGY, deptId)
- console.log('当前专业公司的施工工艺数据字典类型:' + dictLabel)
- // 将 dictLabel 存储到 currentTechnologyDictLabel
- currentTechnologyDictLabel.value = dictLabel || '' // 如果没有获取到,设为空字符串
- if (dictLabel) {
- // 如果获取到标签,再获取完整的字典选项
- const dictOptions = getStrDictOptions(dictLabel)
- console.log('当前专业公司的施工工艺数据字典集合长度:' + dictOptions.length)
- technologyOptions.value = dictOptions.map((option) => ({
- value: option.value,
- label: option.label
- }))
- } else {
- // 如果获取不到标签,清空选项
- technologyOptions.value = []
- }
- } catch (error) {
- console.error('获取施工工艺选项失败:', error)
- technologyOptions.value = []
- } finally {
- loadingTechnologyOptions.value = false
- }
- }
- // 工作量加号按钮禁用状态(计算属性)
- const getWorkloadAddBtnDisabled = computed(() => {
- // 禁用条件:无工作量单位 || 平台井模式 || 设计工作量校验失败
- return (
- !currentTask.value.workloadUnit ||
- currentTask.value.platformWell === '1' ||
- !!workloadDesignError.value
- )
- })
- // 监听平台井状态变化,清空错误信息
- watch(
- () => currentTask.value.platformWell,
- () => {
- workloadDesignError.value = ''
- }
- )
- // 监听工作量单位变化,同步更新到 workloadMap
- watch(
- () => currentTask.value.workloadUnit,
- (newWorkloadUnit, oldWorkloadUnit) => {
- if (!newWorkloadUnit || newWorkloadUnit === oldWorkloadUnit) return
- // 获取当前井号(兼容普通井/平台井)
- let currentWellName = ''
- if (currentTask.value.platformWell === '1') {
- currentWellName =
- currentTask.value.wellName ||
- (currentTask.value.platformWellDetails.length > 0
- ? currentTask.value.platformWellDetails[0].wellName
- : '')
- } else {
- currentWellName = currentTask.value.wellName
- }
- if (!currentWellName) return
- // 如果workloadMap中存在当前井号的工作量数据,更新第一项的workloadUnit
- if (workloadMap.value.has(currentWellName)) {
- const workloadList = workloadMap.value.get(currentWellName)
- if (workloadList && workloadList.length > 0) {
- // 更新第一项的workloadUnit
- workloadList[0].workloadUnit = newWorkloadUnit
- // 重新设置到Map中(虽然引用相同,但为了确保响应性)
- workloadMap.value.set(currentWellName, [...workloadList])
- } else {
- // 如果列表为空但有设计工作量,创建新项
- if (currentTask.value.workloadDesign) {
- workloadMap.value.set(currentWellName, [
- {
- workloadUnit: newWorkloadUnit,
- workloadDesign: currentTask.value.workloadDesign
- }
- ])
- }
- }
- } else if (currentTask.value.workloadDesign) {
- // 如果Map中不存在但有设计工作量,创建新条目
- workloadMap.value.set(currentWellName, [
- {
- workloadUnit: newWorkloadUnit,
- workloadDesign: currentTask.value.workloadDesign
- }
- ])
- }
- },
- { deep: true }
- )
- // 校验设计工作量
- const validateWorkloadDesign = () => {
- workloadDesignError.value = ''
- if (currentTask.value.platformWell === '1') {
- return true
- }
- const value = currentTask.value.workloadDesign
- if (value === '' || value === null || value === undefined) {
- workloadDesignError.value = '设计工作量不能为空'
- return false
- }
- const numValue = Number(value)
- if (isNaN(numValue) || numValue < 0) {
- workloadDesignError.value = '请填写大于0的数字'
- return false
- }
- return true
- }
- // 监听设计工作量变化
- watch(
- () => currentTask.value.workloadDesign,
- () => {
- if (workloadDesignError.value) {
- validateWorkloadDesign()
- }
- }
- )
- // 监听当前任务的变化,设置默认展开的keys
- watch(
- () => currentTask.value.deptIds,
- (newVal, oldVal) => {
- if (newVal && newVal.length > 0) {
- defaultExpandedKeys.value = [...newVal]
- }
- // 【新增】施工队伍变化时,重新查询设备并更新状态
- const params = {
- deptIds: newVal
- }
- /* IotDeviceApi.getDevicesByDepts(params).then(data => {
- // 更新 hasDevicesAvailable 状态
- hasDevicesAvailable.value = data && data.length > 0;
- // 更新设备列表和映射表
- if (hasDevicesAvailable.value) {
- const newDeviceMap = {...deviceMap.value};
- data.forEach(device => {
- newDeviceMap[device.id] = device;
- });
- deviceMap.value = newDeviceMap;
- }
- }).catch(error => {
- console.error('施工队伍变化时查询设备失败:', error);
- hasDevicesAvailable.value = false;
- }); */
- if (!newVal || newVal.length === 0) {
- // 清空施工队伍时,同时清空相关人员和设备
- currentTask.value.responsiblePerson = []
- currentTask.value.submitter = []
- currentTask.value.deviceIds = []
- // 重置设备可用状态
- hasDevicesAvailable.value = true
- // 清除相关字段的验证状态
- nextTick(() => {
- taskFormRef.value?.validateField('responsiblePerson')
- taskFormRef.value?.validateField('submitter')
- taskFormRef.value?.validateField('deviceIds')
- })
- } else if (newVal !== oldVal) {
- // 施工队伍发生变化时,重置设备可用状态(因为不同队伍可能有不同的设备)
- // hasDevicesAvailable.value = true;
- }
- },
- { immediate: true, deep: true }
- )
- // 监听部门列表加载完成
- watch(
- () => deptList.value,
- (newVal) => {
- if (
- newVal &&
- newVal.length > 0 &&
- currentTask.value.deptIds &&
- currentTask.value.deptIds.length > 0
- ) {
- // defaultExpandedKeys.value = [...currentTask.value.deptIds];
- // 过滤掉非叶子节点的ID,只保留叶子节点
- const leafNodeIds = currentTask.value.deptIds.filter((id) => {
- const node = findDeptNodeById(newVal, id)
- return node && node.type === '3'
- })
- if (leafNodeIds.length > 0) {
- defaultExpandedKeys.value = [...leafNodeIds]
- }
- }
- },
- { immediate: true, deep: true }
- )
- // 根据ID在部门树中查找节点
- const findDeptNodeById = (tree: any[], id: number): any => {
- for (const node of tree) {
- if (node.id === id) {
- return node
- }
- if (node.children && node.children.length > 0) {
- const found = findDeptNodeById(node.children, id)
- if (found) return found
- }
- }
- return null
- }
- // 监听项目列表变化,确保列表加载完成后才执行自动选择
- watch(projectList, (newVal) => {
- if (newVal && newVal.length > 0) {
- // 如果是编辑模式,使用任务数据中的合同ID
- if (id && tableData.value.length > 0 && tableData.value[0].projectId) {
- autoSelectContract(tableData.value[0].projectId.toString())
- }
- // 如果是新增模式且有传递的projectId,使用传递的projectId
- else if (!id && projectId.value) {
- console.log('watch-新增模式且有传递的projectId' + projectId.value + ' projectId not found')
- autoSelectContract(projectId.value)
- }
- }
- })
- // 处理树形下拉框可见性变化
- const handleTreeVisibleChange = (visible: boolean) => {
- if (visible && currentTask.value.deptIds && currentTask.value.deptIds.length > 0) {
- // 当下拉框显示且当前任务有已选部门时,设置默认展开的keys
- defaultExpandedKeys.value = [...currentTask.value.deptIds]
- // 使用nextTick确保DOM更新后再执行展开操作
- nextTick(() => {
- if (treeSelectRef.value) {
- // 尝试访问内部树实例并展开节点
- const treeInstance = treeSelectRef.value.treeRef
- if (treeInstance && treeInstance.setExpandedKeys) {
- treeInstance.setExpandedKeys(defaultExpandedKeys.value)
- }
- }
- })
- }
- }
- onMounted(async () => {
- // 查询当前登录人所属公司下的所有部门
- deptList.value = handleTree(await DeptApi.companyLevelChildrenDepts())
- let deptId = useUserStore().getUser.deptId
- projectList.value = await IotProjectInfoApi.getIotProjectInfoUser(deptId)
- // 初始化时过滤当前任务中的部门ID,移除非叶子节点
- if (currentTask.value.deptIds && currentTask.value.deptIds.length > 0) {
- const validDeptIds = currentTask.value.deptIds.filter((id) => {
- const node = findDeptNodeById(deptList.value, id)
- return node && node.type === '3'
- })
- if (validDeptIds.length !== currentTask.value.deptIds.length) {
- currentTask.value.deptIds = validDeptIds
- }
- }
- // 查询当前任务已经选中的设备信息
- open()
- })
- </script>
- <style scoped>
- @media (width <= 1200px) {
- .task-edit-form :deep(.el-col-8) {
- flex: 0 0 50%;
- max-width: 50%;
- }
- .project-task-page .attachment-content {
- grid-template-columns: minmax(0, 1fr);
- gap: 0;
- }
- }
- @media (width <= 768px) {
- .project-task-page .page-header :deep(.el-card__body) {
- align-items: flex-start;
- }
- .project-task-page .page-header__subtitle,
- .project-task-page .section-heading__hint {
- display: none;
- }
- .project-task-page .project-summary-form,
- .project-task-page .task-edit-form {
- padding-right: 12px;
- padding-left: 12px;
- }
- .project-summary-form :deep(.el-col-12),
- .task-edit-form :deep(.el-col-8),
- .task-edit-form :deep(.el-col-12) {
- flex: 0 0 100%;
- max-width: 100%;
- }
- .project-task-page .transfer-component {
- display: block;
- }
- .transfer-component :deep(.el-transfer-panel) {
- width: 100% !important;
- }
- .transfer-component :deep(.el-transfer__buttons) {
- display: flex;
- justify-content: center;
- padding: 12px 0;
- }
- }
- .project-task-page {
- display: flex;
- flex-direction: column;
- gap: 12px;
- min-height: calc(
- 100vh - 20px - var(--top-tool-height) - var(--tags-view-height) - var(--app-footer-height)
- );
- }
- .page-header,
- .project-summary-section,
- .task-detail-section,
- .attachment-section,
- .platform-well-section {
- margin-bottom: 0;
- overflow: hidden;
- border-radius: 8px;
- }
- .page-header :deep(.el-card__body) {
- display: flex;
- align-items: center;
- justify-content: space-between;
- min-height: 64px;
- padding: 12px 16px;
- }
- .page-header__main {
- display: flex;
- align-items: center;
- min-width: 0;
- }
- .page-header__icon {
- display: inline-flex;
- flex: 0 0 auto;
- align-items: center;
- justify-content: center;
- width: 38px;
- height: 38px;
- margin-right: 12px;
- color: var(--el-color-primary);
- background: var(--el-color-primary-light-9);
- border: 1px solid var(--el-color-primary-light-7);
- border-radius: 6px;
- }
- .page-header__title {
- margin: 0;
- font-size: 16px;
- font-weight: 600;
- line-height: 24px;
- letter-spacing: 0;
- color: var(--el-text-color-primary);
- }
- .page-header__subtitle {
- margin: 2px 0 0;
- font-size: 12px;
- line-height: 18px;
- color: var(--el-text-color-secondary);
- }
- .project-summary-section :deep(.el-card__body),
- .task-detail-section :deep(.el-card__body),
- .attachment-section :deep(.el-card__body),
- .platform-well-section :deep(.el-card__body) {
- padding: 0;
- }
- .section-heading {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 42px;
- padding: 0 16px;
- background: var(--el-fill-color-extra-light);
- border-bottom: 1px solid var(--el-border-color-lighter);
- }
- .section-heading__title {
- position: relative;
- padding-left: 13px;
- font-size: 15px;
- font-weight: 600;
- line-height: 22px;
- color: var(--el-text-color-primary);
- }
- .section-heading__title::before {
- position: absolute;
- top: 50%;
- left: 0;
- width: 4px;
- height: 17px;
- background: var(--el-color-primary);
- border-radius: 2px;
- content: '';
- transform: translateY(-50%);
- }
- .section-heading__hint {
- font-size: 12px;
- color: var(--el-text-color-secondary);
- }
- .project-summary-form,
- .task-edit-form {
- padding: 18px 18px 2px;
- }
- .project-summary-form :deep(.el-select),
- .project-summary-form :deep(.el-date-editor),
- .task-edit-form :deep(.el-select),
- .task-edit-form :deep(.el-tree-select),
- .task-edit-form :deep(.el-date-editor),
- .task-edit-form :deep(.el-autocomplete) {
- width: 100%;
- }
- .project-summary-form :deep(.el-form-item),
- .task-edit-form :deep(.el-form-item) {
- margin-bottom: 24px;
- }
- .project-summary-form :deep(.el-form-item__label),
- .task-edit-form :deep(.el-form-item__label) {
- white-space: nowrap;
- }
- .resource-select-item :deep(.el-form-item__content) {
- display: flex;
- flex-wrap: nowrap;
- align-items: flex-start;
- gap: 10px;
- min-width: 0;
- }
- .selection-summary {
- display: block;
- height: 32px;
- min-width: 0;
- padding: 0 10px;
- overflow: hidden;
- line-height: 30px;
- color: var(--el-text-color-regular);
- text-overflow: ellipsis;
- white-space: nowrap;
- border: 1px solid var(--el-border-color);
- border-radius: 4px;
- flex: 1;
- }
- .selection-summary--empty {
- color: var(--el-text-color-placeholder);
- }
- .task-reset-action :deep(.el-form-item__content) {
- justify-content: flex-end;
- }
- .attachment-content {
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 20px;
- padding: 18px 20px 0;
- }
- .attachment-content :deep(.el-upload),
- .attachment-content :deep(.el-upload-list) {
- width: 100%;
- }
- .attachment-content :deep(.el-form-item) {
- margin-bottom: 18px;
- }
- .platform-well-section :deep(.el-table) {
- width: calc(100% - 40px) !important;
- margin: 16px 20px 12px;
- }
- .platform-well-section > :deep(.el-button),
- .workload-dialog :deep(.el-dialog__body > .el-button) {
- margin: 0 20px 16px;
- }
- .form-actions {
- position: sticky;
- bottom: 0;
- z-index: 10;
- display: flex;
- width: 100%;
- min-height: 58px;
- padding: 10px 16px;
- margin-top: auto;
- background: var(--el-bg-color);
- border-top: 1px solid var(--el-border-color-lighter);
- box-shadow: 0 -4px 12px rgb(0 0 0 / 4%);
- box-sizing: border-box;
- flex-shrink: 0;
- flex-direction: row-reverse;
- gap: 10px;
- align-items: center;
- }
- .form-actions :deep(.el-button) {
- margin-left: 0;
- }
- .device-select-dialog :deep(.el-dialog__header),
- .responsible-person-select-dialog :deep(.el-dialog__header),
- .workload-dialog :deep(.el-dialog__header) {
- padding: 16px 20px;
- margin-right: 0;
- border-bottom: 1px solid var(--el-border-color-lighter);
- }
- .device-select-dialog :deep(.el-dialog__body),
- .responsible-person-select-dialog :deep(.el-dialog__body),
- .workload-dialog :deep(.el-dialog__body) {
- padding: 18px 20px;
- }
- .device-select-dialog :deep(.el-dialog__footer),
- .responsible-person-select-dialog :deep(.el-dialog__footer),
- .workload-dialog :deep(.el-dialog__footer) {
- padding: 12px 20px;
- border-top: 1px solid var(--el-border-color-lighter);
- }
- .edit-input {
- margin-right: 10px;
- }
- .error-message {
- margin-top: 5px;
- font-size: 12px;
- color: #f56c6c;
- }
- .action-cell {
- display: flex;
- gap: 8px;
- }
- .transfer-container {
- width: 100%;
- }
- .transfer-component {
- display: flex;
- align-items: center;
- width: 100%;
- min-width: 0;
- }
- :deep(.el-transfer-panel) {
- flex: 1;
- width: auto !important;
- }
- .transfer-component :deep(.el-transfer__buttons) {
- flex: 0 0 auto;
- padding: 0 16px;
- }
- :deep(.el-transfer-panel__item) {
- display: flex !important;
- height: 32px !important;
- padding: 0 8px !important;
- margin: 0 !important;
- overflow: hidden;
- line-height: 32px !important;
- text-overflow: ellipsis;
- white-space: nowrap;
- align-items: center !important;
- }
- /* 4. 选项文本:确保继承父容器宽度,省略号正常生效 */
- .transfer-option-text {
- display: inline-block;
- max-width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- /* 设备名称显示区域样式 */
- .device-names {
- max-width: 200px; /* 根据实际列宽调整 */
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- :deep(.el-transfer-panel__list) {
- width: 100% !important;
- }
- /* 责任人名称显示区域样式 */
- .responsible-names {
- max-width: 200px; /* 根据实际列宽调整 */
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- /* 添加部门名称的样式 */
- .dept-names {
- display: inline-block;
- max-width: 200px; /* 根据实际列宽调整 */
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- vertical-align: bottom;
- }
- /* 部门选择器样式优化 */
- :deep(.department-tree-select .el-select__tags) {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- flex-wrap: nowrap;
- }
- :deep(.department-tree-select .el-select__tags .el-tag) {
- display: inline-block;
- max-width: 120px;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- :deep(.department-tree-select .el-select__tags .el-tag + .el-tag) {
- margin-left: 6px;
- }
- :deep(.department-tree-select .el-select__tags-text) {
- display: inline-block;
- max-width: 100px;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- /* 当有多个标签被折叠时显示的 "+N" 标签样式 */
- :deep(.department-tree-select .el-select__collapse-tags) {
- display: inline-block;
- white-space: nowrap;
- }
- /* 按钮文字样式 - 红色字体 */
- :deep(.workload-add-btn .btn-text) {
- font-size: 18px; /* 更大的字号 */
- font-weight: 900; /* 更粗的字体 */
- line-height: 1;
- color: #f00 !important;
- }
- /* 设计工作量加号按钮 - 启用状态(深蓝色) */
- :deep(.workload-add-btn .el-icon) {
- color: #f00 !important; /* Element Plus 主色调深蓝色,可替换为 #003366 等自定义深蓝色 */
- }
- /* 按钮禁用状态 */
- :deep(.workload-add-btn:disabled .btn-text) {
- color: #c0c4cc !important;
- }
- /* 调整按钮整体样式,确保icon居中 */
- :deep(.workload-add-btn) {
- display: flex;
- width: 40px;
- height: 100%;
- max-width: 40px;
- min-width: 40px;
- padding: 0;
- box-sizing: border-box;
- align-items: center;
- justify-content: center;
- }
- /* 调整输入框append部分的宽度 */
- :deep(.workload-input-with-button .el-input-group__append) {
- width: 40px;
- max-width: 40px;
- min-width: 40px;
- padding: 0;
- box-sizing: border-box;
- }
- :deep(.workload-add-btn:focus-visible) {
- outline-offset: -2px;
- }
- /* 确保按钮在禁用状态下有正确的样式 */
- :deep(.workload-add-btn:disabled) {
- cursor: not-allowed;
- background-color: #f5f7fa;
- border-color: #e4e7ed;
- }
- /* 设计工作量错误输入框样式 */
- :deep(.error-input .el-input__inner) {
- background-color: #fef0f0 !important;
- border-color: #f56c6c !important;
- box-shadow: 0 0 0 1px rgb(245 108 108 / 40%) !important;
- }
- :deep(.error-input .el-input__inner:hover) {
- background-color: #fef0f0 !important;
- border-color: #f56c6c !important;
- }
- :deep(.error-input .el-input__inner:focus) {
- background-color: #fef0f0 !important;
- border-color: #f56c6c !important;
- box-shadow: 0 0 0 1px rgb(245 108 108 / 20%) !important;
- }
- /* 设计工作量tooltip样式 */
- :deep(.workload-design-tooltip) {
- max-width: 300px;
- padding: 8px 12px;
- font-size: 12px;
- color: #f56c6c !important;
- background: #fef0f0 !important;
- border: 1px solid #fbc4c4 !important;
- }
- /* 隐藏 Tooltip 箭头 */
- :deep(.workload-design-tooltip .el-tooltip__arrow),
- :deep(.workload-design-tooltip .el-tooltip__arrow::before) {
- display: none !important;
- width: 0 !important;
- height: 0 !important;
- }
- </style>
|