wbs.vue 118 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512
  1. <template>
  2. <div class="h-full">
  3. <div
  4. v-if="wbsTypeTabKey === 'tree'"
  5. v-loading="nodeSaveLoading"
  6. class="hc-layout-box"
  7. element-loading-text="批量保存数据中..."
  8. >
  9. <div
  10. id="wbs-left-tree"
  11. :class="[
  12. isWbsTreeShow ? 'show' : '',
  13. isMouseTree ? 'on-transition' : '',
  14. ]"
  15. :style="`width:${isWbsTreeShow ? leftWidth : 0}px; ${
  16. isWbsTreeShow ? '' : 'display: none'
  17. }`"
  18. class="hc-layout-left-box bg-white"
  19. >
  20. <div class="hc-project-box">
  21. <div class="hc-project-icon-box">
  22. <HcIcon name="stack" />
  23. </div>
  24. <div class="project-name-box ml-2">
  25. <div class="project-alias">
  26. {{ projectInfo?.projectName }}
  27. </div>
  28. </div>
  29. </div>
  30. <div class="hc-tree-box">
  31. <div class="hc-tree-back-to">
  32. <el-link type="primary" @click="gobackHistory">
  33. 回到上一次填报部位
  34. </el-link>
  35. <el-link
  36. type="warning"
  37. class="ml-4"
  38. @click="wbsMapTypeTab"
  39. >
  40. 导图结构填报
  41. </el-link>
  42. <HcTooltip keys="data-fill-wbs-hide-btn">
  43. <el-button
  44. class="data-fill-wbs-hide-btn ml-6"
  45. hc-btn
  46. keys="data-fill-wbs-hide-btn"
  47. :loading="hideSaveLoading"
  48. @click="hideTreeNode"
  49. >
  50. 隐藏
  51. </el-button>
  52. </HcTooltip>
  53. </div>
  54. <div class="hc-search-tree-val">
  55. <el-input
  56. v-model="searchTreeVal"
  57. clearable
  58. block
  59. placeholder="请输入名称关键词检索"
  60. @keyup="searchTreeKeyUp"
  61. >
  62. <template #suffix>
  63. <HcIcon
  64. name="search-2"
  65. ui="text-xl iscusor"
  66. @click="searchTreeClick"
  67. />
  68. </template>
  69. </el-input>
  70. </div>
  71. <div
  72. v-if="isShowLeft"
  73. id="hc-tree-scrollbar"
  74. v-loading="treeLoading"
  75. class="hc-tree-scrollbar"
  76. element-loading-text="获取数据中..."
  77. >
  78. <el-scrollbar
  79. v-show="isSearchTree"
  80. class="scroll-bar-right-16"
  81. >
  82. <HcDataTree
  83. is-load-menu
  84. :datas="searchTreeData"
  85. :is-mark="TreeMark"
  86. :menus="ElTreeMenu"
  87. is-counts
  88. is-type
  89. :auto-expand-keys="TreeAutoExpandKeys"
  90. default-expand-all
  91. @node-tap="wbsElTreeClick"
  92. @menu-tap="ElTreeMenuClick"
  93. @load-menu="loadMenu"
  94. />
  95. </el-scrollbar>
  96. <el-scrollbar
  97. v-show="!isSearchTree"
  98. class="scroll-bar-right-16"
  99. >
  100. <HcLazyTree
  101. ref="wbstree"
  102. is-load-menu
  103. :auto-expand-keys="TreeAutoExpandKeys"
  104. :is-mark="TreeMark"
  105. :menus="ElTreeMenu"
  106. is-counts
  107. is-type
  108. show-checkbox
  109. check-strictly
  110. @load="treeLoadNode"
  111. @menu-tap="ElTreeMenuClick"
  112. @node-loading="ElTreeNodeLoading"
  113. @node-tap="wbsElTreeClick"
  114. @check="ElTreeNodeCheck"
  115. @load-menu="loadMenu"
  116. />
  117. </el-scrollbar>
  118. </div>
  119. </div>
  120. <div class="hc-tree-foot-tip-box">
  121. <div class="dot-view green">已审批</div>
  122. <div class="dot-view black">未填报</div>
  123. <div class="dot-view orange">已填报-待审批</div>
  124. <div class="dot-view blue">已填报-未上报</div>
  125. </div>
  126. <!-- 左右拖动 -->
  127. <div class="horizontal-drag-line" @mousedown="onmousedown" />
  128. </div>
  129. <div
  130. id="wbs-content-box"
  131. v-loading="ListItemLoading"
  132. class="hc-layout-content-box"
  133. >
  134. <!---展开收缩树 -->
  135. <div
  136. class="hc-expansion-contraction-tree"
  137. @click="setWbsTreeShow"
  138. >
  139. <HcIcon v-show="isWbsTreeShow" name="arrow-left-s" />
  140. <HcIcon v-show="!isWbsTreeShow" name="arrow-right-s" />
  141. </div>
  142. <hc-tab-card
  143. :tabs="authBtnTabdata"
  144. :tab-key="authBtnTabKey"
  145. @change="authBtnTabClick"
  146. >
  147. <template #extra>
  148. <HcTooltip keys="wbs_views_sort_btn">
  149. <el-button
  150. v-if="nodeDataInfo?.nodeClass !== 2"
  151. :disabled="ListItemDatas.length <= 0"
  152. hc-btn
  153. type="primary"
  154. @click="sortFormClick"
  155. >
  156. 排序
  157. </el-button>
  158. </HcTooltip>
  159. <HcTooltip keys="wbs_views_node_save_btn">
  160. <el-button
  161. v-if="nodeDataInfo?.nodeClass !== 2"
  162. :loading="nodeSaveLoading"
  163. hc-btn
  164. type="primary"
  165. @click="NodeSaveClick"
  166. >
  167. 辅助保存
  168. </el-button>
  169. </HcTooltip>
  170. <HcTooltip keys="wbs_views_drawings">
  171. <el-button
  172. v-if="nodeDataInfo?.nodeClass !== 2"
  173. :disabled="
  174. nodeDataInfo?.drawingsId === -1
  175. || nodeDataInfo?.drawingsId === null
  176. "
  177. hc-btn
  178. color="#e03997"
  179. @click="viewsDrawings"
  180. >
  181. 图纸
  182. </el-button>
  183. </HcTooltip>
  184. <HcTooltip keys="wbs_preview">
  185. <el-button
  186. :disabled="NodeStatus === '1'"
  187. :loading="bussPdfsLoading"
  188. hc-btn
  189. color="#A16222"
  190. @click="bussPdfsClick"
  191. >
  192. 预览
  193. </el-button>
  194. </HcTooltip>
  195. <el-button
  196. hc-btn
  197. color="#A16222"
  198. @click="attachmentModalShow"
  199. >
  200. 查看附件
  201. </el-button>
  202. <el-button
  203. hc-btn
  204. :disabled="isCanadd"
  205. color="#567722"
  206. @click="addFilelist"
  207. >
  208. 上传附件
  209. </el-button>
  210. <HcTooltip v-if="NodeStatus !== '3'" keys="wbs_report">
  211. <el-button
  212. v-if="nodeDataInfo?.nodeClass !== 2"
  213. :disabled="
  214. NodeStatus === '3' || NodeStatus === '1'
  215. "
  216. :loading="reportLoading"
  217. hc-btn
  218. color="#FF976A"
  219. style="color: white"
  220. @click="reportModalClick"
  221. >
  222. 上报
  223. </el-button>
  224. </HcTooltip>
  225. <HcTooltip v-if="NodeStatus === '3'" keys="wbs_abolish">
  226. <el-button
  227. v-if="nodeDataInfo?.nodeClass !== 2"
  228. hc-btn
  229. :laoding="abolishLoaing"
  230. color="#FF976A"
  231. style="color: white"
  232. @click="abolishOneClick"
  233. >
  234. 撤回上报流程
  235. </el-button>
  236. </HcTooltip>
  237. <HcTooltip keys="wbs_views_sync_data_btn">
  238. <el-button
  239. v-if="
  240. authBtnTabKey === '2'
  241. && nodeDataInfo?.nodeClass !== 2
  242. "
  243. hc-btn
  244. color="#37c0fe"
  245. style="color: white"
  246. :loading="syncdataloading"
  247. @click="syncdata"
  248. >
  249. 同步质检资料
  250. </el-button>
  251. <el-button
  252. v-if="nodeDataInfo?.majorDataType == 2"
  253. hc-btn
  254. color="#12C060"
  255. style="color: white"
  256. :loading="syncWorkloading"
  257. @click="syncWork"
  258. >
  259. 同步工序资料
  260. </el-button>
  261. </HcTooltip>
  262. <HcTooltip v-if="NodeStatus !== '3'" keys="wbs_save">
  263. <el-button
  264. v-if="nodeDataInfo?.nodeClass !== 2"
  265. :disabled="
  266. NodeStatus === '3'
  267. || ListItemDatas.length <= 0
  268. "
  269. :loading="tableFormSaveLoading"
  270. hc-btn
  271. color="#12C060"
  272. style="color: white; font-weight: bold"
  273. @click="tableFormSaveClick"
  274. >
  275. 保存数据
  276. </el-button>
  277. </HcTooltip>
  278. </template>
  279. <el-scrollbar
  280. v-if="ListItemDatas.length > 0"
  281. ref="ListItemScrollRef"
  282. >
  283. <CollapseForm
  284. ref="ListItemRef"
  285. :tree-auto-expand-keys="TreeAutoExpandKeys"
  286. :classify="authBtnTabKey"
  287. :contract-id="contractId"
  288. :datas="ListItemDatas"
  289. :draw-type="!isDrawType"
  290. :primary-key-id="primaryKeyId"
  291. :status="NodeStatus"
  292. :tenant-id="userInfo?.tenant_id"
  293. :wbs-temp-id="
  294. projectInfo?.referenceWbsTemplateIdTrial
  295. "
  296. :wbs-type="2"
  297. :treenode-data-info="nodeDataInfo"
  298. :newlistdata="newlistdata"
  299. @offset-top="ListItemOffsetTop"
  300. @renew="getTableDataAll"
  301. @get-list="searchNodeAllTable1"
  302. />
  303. </el-scrollbar>
  304. <hc-empty v-else title="暂无表单" />
  305. </hc-tab-card>
  306. </div>
  307. </div>
  308. <hc-new-card
  309. v-if="wbsTypeTabKey === 'map'"
  310. id-ref="wbs-node-tree-card-target"
  311. >
  312. <template #header>
  313. <HcTooltip keys="wbs_views_division_btn">
  314. <el-button
  315. class="mr-10"
  316. hc-btn
  317. type="primary"
  318. @click="divisionClick"
  319. >
  320. <HcIcon :line="false" name="node-tree" />
  321. <span>划分变更</span>
  322. </el-button>
  323. </HcTooltip>
  324. <HcNewSwitch
  325. v-if="isDrawer"
  326. :datas="authBtnTabdata"
  327. :keys="authBtnTabKey"
  328. :round="false"
  329. size="default"
  330. @change="authBtnTabClick"
  331. />
  332. </template>
  333. <template #extra>
  334. <HcNewSwitch
  335. :datas="wbsTypeTab"
  336. :keys="wbsTypeTabKey"
  337. size="default"
  338. @change="wbsTypeTabChange"
  339. />
  340. </template>
  341. <NodeTree
  342. ref="NodeTreeRef"
  343. :accordion="NodeTreeAccordion"
  344. :auto-expand-keys="TreeAutoExpandKeys"
  345. :contract-id="contractId"
  346. :is-mark="TreeMark"
  347. :menus="ElTreeMenu"
  348. :project-id="projectId"
  349. @menu-click="NodeTreeMenuClick"
  350. @node-click="NodeTreeClick"
  351. @node-dbl-click="NodeTreeDblClick"
  352. />
  353. <template #action>
  354. <div class="hc-tree-mp-tip-box">
  355. <div class="dot-view green">已审批</div>
  356. <div class="dot-view black">未填报</div>
  357. <div class="dot-view orange">已填报-待审批</div>
  358. <div class="dot-view blue">已填报-未上报</div>
  359. </div>
  360. </template>
  361. <HcDrawer
  362. v-model="isDrawer"
  363. to-id="wbs-node-tree-card-target"
  364. @close="drawerClose"
  365. >
  366. <!-- 清表列表 -->
  367. <el-scrollbar
  368. v-if="ListItemDatas.length > 0"
  369. ref="ListItemScrollRef"
  370. >
  371. <CollapseForm
  372. ref="ListItemsRef"
  373. :classify="authBtnTabKey"
  374. :contract-id="contractId"
  375. :datas="ListItemDatas"
  376. :draw-type="isDrawType"
  377. :primary-key-id="primaryKeyId"
  378. :status="NodeStatus"
  379. :tenant-id="userInfo?.tenant_id"
  380. :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial"
  381. :wbs-type="2"
  382. @offset-top="ListItemOffsetTop"
  383. @renew="getTableDataAll"
  384. />
  385. </el-scrollbar>
  386. <hc-status v-else text="暂无表单" />
  387. <!-- 底部按钮区域 -->
  388. <template #action>
  389. <hc-tooltip v-if="NodeStatus !== '3'" keys="wbs_save">
  390. <el-button
  391. :disabled="
  392. NodeStatus === '3' || ListItemDatas.length <= 0
  393. "
  394. :loading="tableFormSaveLoading"
  395. hc-btn
  396. type="primary"
  397. @click="tableFormSaveClick"
  398. >
  399. <HcIcon name="save" />
  400. <span>保存</span>
  401. </el-button>
  402. </hc-tooltip>
  403. <hc-tooltip v-if="NodeStatus !== '3'" keys="wbs_report">
  404. <el-button
  405. :disabled="NodeStatus === '3' || NodeStatus === '1'"
  406. :loading="reportLoading"
  407. hc-btn
  408. @click="reportModalClick"
  409. >
  410. <HcIcon name="send-plane-2" />
  411. <span>上报</span>
  412. </el-button>
  413. </hc-tooltip>
  414. <hc-tooltip keys="wbs_preview">
  415. <el-button
  416. :disabled="NodeStatus === '1'"
  417. :loading="bussPdfsLoading"
  418. hc-btn
  419. @click="bussPdfsClick"
  420. >
  421. <HcIcon name="eye" />
  422. <span>预览</span>
  423. </el-button>
  424. </hc-tooltip>
  425. <hc-tooltip v-if="NodeStatus === '3'" keys="wbs_abolish">
  426. <el-button hc-btn>
  427. <HcIcon name="arrow-go-back" />
  428. <span>撤回上报流程</span>
  429. </el-button>
  430. </hc-tooltip>
  431. <hc-tooltip keys="wbs_views_drawings">
  432. <el-button
  433. :disabled="!nodeDataInfo?.fileUrl"
  434. hc-btn
  435. @click="viewsDrawings"
  436. >
  437. <HcIcon name="image" />
  438. <span>图纸</span>
  439. </el-button>
  440. </hc-tooltip>
  441. <el-button hc-btn @click="attachmentModalShow">
  442. <HcIcon name="file" />
  443. <span>附件</span>
  444. </el-button>
  445. <el-button hc-btn @click="drawerClose">
  446. <HcIcon name="close" />
  447. <span>关闭填报页面</span>
  448. </el-button>
  449. </template>
  450. </HcDrawer>
  451. </hc-new-card>
  452. <!-- 查看图纸 -->
  453. <hc-drag-modal
  454. :is-show="drawingsShow"
  455. close-icon
  456. lefts="145"
  457. title="查看图纸"
  458. tops="100"
  459. ui="hc-image-preview-box"
  460. widths="380px"
  461. @close="drawingsClose"
  462. >
  463. <div class="hc-image-preview-view">
  464. <!-- <el-image-viewer :url-list="[nodeDataInfo.fileUrl]" /> -->
  465. <el-image :src="drawList" />
  466. </div>
  467. </hc-drag-modal>
  468. <!-- 编辑节点 -->
  469. <hc-new-dialog
  470. v-model="editNodeModal"
  471. :loading="editNodeLoading"
  472. title="编辑节点"
  473. widths="600px"
  474. @save="editNodeClick"
  475. >
  476. <el-form
  477. ref="formEditNodeRef"
  478. :model="formEditNodeModel"
  479. :rules="formEditNodeRules"
  480. label-width="auto"
  481. size="large"
  482. >
  483. <el-form-item label="节点名称" prop="title">
  484. <el-input
  485. v-model="formEditNodeModel.title"
  486. placeholder="请输入节点名称"
  487. />
  488. </el-form-item>
  489. <el-form-item label="上级节点">
  490. <el-input
  491. v-model="formEditNodeModel.parent.title"
  492. disabled
  493. />
  494. </el-form-item>
  495. <el-form-item label="节点类型">
  496. <el-select
  497. v-model="formEditNodeModel.nodeType"
  498. disabled
  499. block
  500. >
  501. <el-option
  502. v-for="item in nodeTypeData"
  503. :key="item.value"
  504. :label="item.label"
  505. :value="item.value"
  506. />
  507. </el-select>
  508. </el-form-item>
  509. <el-form-item label="时间" prop="digitizeTime">
  510. <el-date-picker
  511. v-model="formEditNodeModel.digitizeTime"
  512. class="block"
  513. format="YYYY-MM-DD"
  514. placeholder="请选择"
  515. type="date"
  516. value-format="YYYY-MM-DD"
  517. />
  518. </el-form-item>
  519. <el-form-item
  520. v-if="formEditNodeModel.notExsitChild"
  521. label="标准分类"
  522. prop="className"
  523. >
  524. <el-select
  525. v-model="formEditNodeModel.className"
  526. block
  527. @change="changeStandType"
  528. >
  529. <el-option
  530. v-for="item in standardTypeOptions"
  531. :key="item.value"
  532. :label="item.label"
  533. :value="item.value"
  534. />
  535. </el-select>
  536. </el-form-item>
  537. <el-form-item
  538. v-if="formEditNodeModel.notExsitChild"
  539. label="单位名称"
  540. prop="unitName"
  541. >
  542. <el-select v-model="formEditNodeModel.unitName" block>
  543. <el-option
  544. v-for="item in unitNameOptions"
  545. :key="item.value"
  546. :label="item.dictValue"
  547. :value="item.dictKey"
  548. />
  549. </el-select>
  550. </el-form-item>
  551. <el-row v-if="formEditNodeModel.nodeClass === 2" :gutter="24">
  552. <el-col :span="12">
  553. <el-form-item prop="unitNum" label="单元个数">
  554. <el-input-number
  555. v-model="formEditNodeModel.unitNum"
  556. placeholder="请输入单元个数"
  557. :controls="false"
  558. :min="0"
  559. :precision="0"
  560. class="w-100"
  561. />
  562. </el-form-item>
  563. </el-col>
  564. <el-col :span="12">
  565. <el-form-item prop="excellentNum" label="优良个数">
  566. <el-input-number
  567. v-model="formEditNodeModel.excellentNum"
  568. placeholder="请输入优良个数"
  569. :controls="false"
  570. :min="0"
  571. :precision="0"
  572. class="w-100"
  573. />
  574. </el-form-item>
  575. </el-col>
  576. </el-row>
  577. <el-tooltip
  578. v-if="formEditNodeModel?.isReferenceNumber === 0"
  579. class="item"
  580. effect="light"
  581. content="当前合同段未开启引用标号功能,表格无法获取,请联系维护人员处理"
  582. placement="top"
  583. >
  584. <el-form-item label="划分编号">
  585. <el-input
  586. v-model="formEditNodeModel.partitionCode"
  587. placeholder="请输入划分编号"
  588. />
  589. </el-form-item>
  590. </el-tooltip>
  591. <el-form-item v-else label="划分编号">
  592. <el-input
  593. v-model="formEditNodeModel.partitionCode"
  594. placeholder="请输入划分编号"
  595. />
  596. </el-form-item>
  597. <el-form-item class="hc-position-input-icon" label="模板位置">
  598. <el-input
  599. v-model="formEditNodeModel.position"
  600. :autosize="{ minRows: 3, maxRows: 6 }"
  601. type="textarea"
  602. />
  603. <el-tooltip content="一键复制模板位置">
  604. <HcIcon
  605. name="file-copy-2"
  606. @click="
  607. copyPositionText(formEditNodeModel.position)
  608. "
  609. />
  610. </el-tooltip>
  611. </el-form-item>
  612. </el-form>
  613. </hc-new-dialog>
  614. <!-- 复制节点 -->
  615. <hc-new-dialog
  616. v-model="copyNodeModal"
  617. :loading="copyNodeLoading"
  618. :widths="copyNodeTabKey === '1' ? '600px' : '1200px'"
  619. loading-text="复制节点中,请耐心等待..."
  620. title="复制节点"
  621. >
  622. <div class="header-new-switch">
  623. <el-form
  624. ref="formCopyNodeModelRef"
  625. :model="formCopyNodeModel"
  626. label-position="left"
  627. :rules="formCopyNodeModelRules"
  628. label-width="auto"
  629. size="large"
  630. >
  631. <el-form-item
  632. label="是否复制数据"
  633. prop="isCopyData"
  634. style="margin-bottom: 0"
  635. >
  636. <!-- <el-input v-model="formCopyNodeModel.classify" placeholder="请输入节点名称"/> -->
  637. <el-radio-group v-model="isCopyData">
  638. <el-radio :value="1">是</el-radio>
  639. <el-radio :value="0">否</el-radio>
  640. </el-radio-group>
  641. </el-form-item>
  642. <el-form-item
  643. v-if="isCopyData === 1"
  644. label="所属方"
  645. prop="classify"
  646. style="margin-bottom: 0"
  647. >
  648. <!-- <el-input v-model="formCopyNodeModel.classify" placeholder="请输入节点名称"/> -->
  649. <el-checkbox-group v-model="classifyList">
  650. <el-checkbox value="施工">施工</el-checkbox>
  651. <el-checkbox value="监理">监理</el-checkbox>
  652. </el-checkbox-group>
  653. </el-form-item>
  654. </el-form>
  655. <!-- HcNewSwitch :datas="authBtnTabdata" :keys="classifyType" :round="false" size="default"
  656. @change="classifyTypeTabClick"/ -->
  657. </div>
  658. <div v-if="copyNodeTabKey === '1'" class="copy-node-form-box">
  659. <el-form
  660. ref="formCopyNodeModelRef"
  661. :model="formCopyNodeModel"
  662. :rules="formCopyNodeModelRules"
  663. label-width="auto"
  664. size="large"
  665. >
  666. <el-form-item
  667. v-if="copyNodeTabKey === '1'"
  668. label="节点名称"
  669. prop="title"
  670. style="margin-bottom: 0"
  671. >
  672. <el-input
  673. v-model="formCopyNodeModel.title"
  674. placeholder="请输入节点名称"
  675. />
  676. </el-form-item>
  677. <el-form-item
  678. v-if="copyNodeTabKey === '1'"
  679. label="划分编号"
  680. prop="partitionCode"
  681. style="margin-top: 10px"
  682. >
  683. <el-input
  684. v-model="formCopyNodeModel.partitionCode"
  685. placeholder="请输入划分编号"
  686. />
  687. </el-form-item>
  688. </el-form>
  689. </div>
  690. <div v-if="copyNodeTabKey === '3'" class="copy-node-form-box">
  691. <el-form
  692. ref="formCopyNodeModelRef"
  693. :model="formCopyNodeModel"
  694. :rules="formCopyNodeModelRules"
  695. label-width="auto"
  696. size="large"
  697. >
  698. <el-form-item
  699. label="所属方"
  700. prop="classify"
  701. style="margin-bottom: 0"
  702. >
  703. <!-- <el-input v-model="formCopyNodeModel.classify" placeholder="请输入节点名称"/> -->
  704. <el-checkbox-group v-model="classifyList">
  705. <el-checkbox value="施工">施工</el-checkbox>
  706. <el-checkbox value="监理">监理</el-checkbox>
  707. </el-checkbox-group>
  708. </el-form-item>
  709. </el-form>
  710. </div>
  711. <div v-if="copyNodeTabKey !== '1'" class="copy-node-many-box">
  712. <div class="copy-node-many-tree">
  713. <el-scrollbar>
  714. <hc-lazy-tree
  715. :auto-expand-keys="TreeAutoExpandKeys"
  716. is-type
  717. @load="treeLoadNode"
  718. @node-tap="copyNodeElTreeClick"
  719. />
  720. </el-scrollbar>
  721. </div>
  722. <div class="copy-node-many-table">
  723. <el-scrollbar>
  724. <el-table :data="copyNodeTable" border>
  725. <el-table-column
  726. label="复制到的位置"
  727. prop="title"
  728. />
  729. <el-table-column
  730. v-if="copyNodeTabKey === '2'"
  731. label="节点名称"
  732. prop="nodeName"
  733. >
  734. <template #default="{ row }">
  735. <el-form
  736. ref="copyNodeTableRef"
  737. :model="row"
  738. :rules="copyNodeTableRules"
  739. label-width="0"
  740. size="large"
  741. >
  742. <el-form-item
  743. prop="nodeName"
  744. style="margin-bottom: 0"
  745. >
  746. <el-input
  747. v-model="row.nodeName"
  748. placeholder="请输入节点名称"
  749. />
  750. </el-form-item>
  751. </el-form>
  752. </template>
  753. </el-table-column>
  754. <el-table-column
  755. v-if="copyNodeTabKey === '2'"
  756. label="划分编号"
  757. prop="partitionCode"
  758. >
  759. <template #default="{ row }">
  760. <el-form
  761. ref="copyNodeTableRef"
  762. :model="row"
  763. :rules="copyNodeTableRules"
  764. label-width="0"
  765. size="large"
  766. >
  767. <el-form-item
  768. prop="partitionCode"
  769. style="margin-bottom: 0"
  770. >
  771. <el-input
  772. v-model="row.partitionCode"
  773. placeholder="请输入划分编号"
  774. />
  775. </el-form-item>
  776. </el-form>
  777. </template>
  778. </el-table-column>
  779. <el-table-column
  780. align="center"
  781. label="操作"
  782. prop="action"
  783. width="120"
  784. >
  785. <template #default="{ _, $index }">
  786. <el-button
  787. plain
  788. type="danger"
  789. @click="copyNodeTableDel($index)"
  790. >
  791. 删除
  792. </el-button>
  793. </template>
  794. </el-table-column>
  795. </el-table>
  796. </el-scrollbar>
  797. </div>
  798. </div>
  799. <template #footer>
  800. <div class="lr-dialog-footer">
  801. <div class="left">
  802. <template
  803. v-for="(item, index) in copyNodeTab"
  804. :key="index"
  805. >
  806. <el-button
  807. v-if="item?.key === copyNodeTabKey"
  808. plain
  809. size="large"
  810. type="primary"
  811. @click="copyNodeTabChange(item?.key)"
  812. >
  813. {{ item.name }}
  814. </el-button>
  815. <el-button
  816. v-else
  817. bg
  818. size="large"
  819. text
  820. @click="copyNodeTabChange(item?.key)"
  821. >
  822. {{ item.name }}
  823. </el-button>
  824. </template>
  825. </div>
  826. <div class="right">
  827. <el-button
  828. :disabled="copyNodeLoading"
  829. size="large"
  830. @click="copyNodeModal = false"
  831. >
  832. 取消
  833. </el-button>
  834. <el-button
  835. :loading="copyNodeLoading"
  836. hc-btn
  837. type="primary"
  838. @click="copyNodeClick"
  839. >
  840. 提交
  841. </el-button>
  842. </div>
  843. </div>
  844. </template>
  845. </hc-new-dialog>
  846. <!-- 新增子节点 -->
  847. <hc-new-dialog
  848. v-model="addNodeModal"
  849. :loading="addNodeLoading"
  850. loading-text="新增节点中,请耐心等待..."
  851. title="新增子节点"
  852. widths="720px"
  853. is-table
  854. >
  855. <el-alert
  856. :closable="false"
  857. title="双击节点,可编辑节点名称,编辑完成后,请按回车或输入框消失后,再点提交"
  858. type="warning"
  859. />
  860. <HcTreeNode
  861. v-if="addTreeNodeType === '1'"
  862. :node-id="addTreeNodeId"
  863. :old-id="addTreeNodeOldId"
  864. :contract-id="contractId"
  865. :wbs-id="projectInfo.referenceWbsTemplateId"
  866. :project-id="projectId"
  867. :is-custom="isCustom"
  868. @check-change="addTreeNodeCheckChange"
  869. />
  870. <HcTreeNode
  871. v-if="addTreeNodeType === '2'"
  872. :node-id="addTreeNodeId"
  873. :old-id="addTreeNodeOldId"
  874. :contract-id="contractId"
  875. :wbs-id="projectInfo.referenceWbsTemplateId"
  876. :project-id="projectId"
  877. strictly
  878. :is-custom="isCustom"
  879. @check-change="addTreeNodeCheckChange"
  880. />
  881. <template #footer>
  882. <div class="lr-dialog-footer">
  883. <div class="left flex items-center">
  884. <div class="mr-4">选中方式:</div>
  885. <el-radio-group v-model="addTreeNodeType">
  886. <el-radio label="1">当前及子节点</el-radio>
  887. <el-radio class="ml-4" label="2">
  888. 仅当前节点
  889. </el-radio>
  890. </el-radio-group>
  891. </div>
  892. <div class="right">
  893. <el-button size="large" @click="addNodeModal = false">
  894. 取消
  895. </el-button>
  896. <el-button
  897. :loading="addNodeLoading"
  898. hc-btn
  899. type="primary"
  900. @click="addNodeClick"
  901. >
  902. 提交
  903. </el-button>
  904. </div>
  905. </div>
  906. </template>
  907. </hc-new-dialog>
  908. <!-- 新增自定义节点 -->
  909. <hc-new-dialog
  910. v-model="addNodeModalCus"
  911. :loading="addNodeLoadingCus"
  912. loading-text="新增节点中,请耐心等待..."
  913. title="新增自定义节点(水利工程)"
  914. widths="720px"
  915. @save="addNodeClickCur"
  916. >
  917. <el-form
  918. ref="formWaterNodeRef"
  919. :model="formWaterNodeModel"
  920. :rules="formWaterNodeRules"
  921. label-width="auto"
  922. size="large"
  923. label-position="left"
  924. >
  925. <el-form-item label="节点名称" prop="nodeName">
  926. <el-input
  927. v-model="formWaterNodeModel.nodeName"
  928. placeholder="请输入节点名称"
  929. />
  930. </el-form-item>
  931. <el-form-item label="节点类型" prop="nodeType">
  932. <el-select v-model="formWaterNodeModel.nodeType" block>
  933. <el-option
  934. v-for="item in nodeTypeData"
  935. :key="item.value"
  936. :label="item.label"
  937. :value="item.value"
  938. />
  939. </el-select>
  940. </el-form-item>
  941. </el-form>
  942. </hc-new-dialog>
  943. <!-- 新增自定义节点-数字化文件 -->
  944. <hc-new-dialog
  945. v-model="addNodeModalData"
  946. :loading="addNodeLoadingData"
  947. loading-text="新增节点中,请耐心等待..."
  948. title="新增自定义节点(数字化文件)"
  949. widths="720px"
  950. @save="addNodeClickData"
  951. >
  952. <el-form
  953. ref="formDataNodeRef"
  954. :model="formDataNodeModel"
  955. :rules="formDataNodeRules"
  956. label-width="auto"
  957. size="large"
  958. >
  959. <el-form-item label="节点名称" prop="nodeName">
  960. <el-input
  961. v-model="formDataNodeModel.nodeName"
  962. placeholder="请输入节点名称"
  963. />
  964. </el-form-item>
  965. <el-form-item label="节点类型" prop="nodeType">
  966. <el-select v-model="formDataNodeModel.nodeType" block>
  967. <el-option
  968. v-for="item in nodeTypeData"
  969. :key="item.value"
  970. :label="item.label"
  971. :value="item.value"
  972. />
  973. </el-select>
  974. </el-form-item>
  975. <el-form-item label="是否含单元评定" prop="isClassifition">
  976. <el-radio-group v-model="formDataNodeModel.isClassifition">
  977. <el-radio :value="1">是</el-radio>
  978. <el-radio :value="0">否</el-radio>
  979. </el-radio-group>
  980. </el-form-item>
  981. <el-form-item label="时间" prop="digitizeTime">
  982. <el-date-picker
  983. v-model="formDataNodeModel.digitizeTime"
  984. class="block"
  985. format="YYYY-MM-DD"
  986. placeholder="请选择"
  987. type="date"
  988. value-format="YYYY-MM-DD"
  989. />
  990. </el-form-item>
  991. <el-form-item
  992. v-if="formDataNodeModel.isClassifition === 1"
  993. label="标准分类"
  994. prop="className"
  995. >
  996. <el-select
  997. v-model="formDataNodeModel.className"
  998. block
  999. @change="changeStandType"
  1000. >
  1001. <el-option
  1002. v-for="item in standardTypeOptions"
  1003. :key="item.value"
  1004. :label="item.label"
  1005. :value="item.value"
  1006. />
  1007. </el-select>
  1008. </el-form-item>
  1009. <el-form-item
  1010. v-if="formDataNodeModel.isClassifition === 1"
  1011. label="单元名称"
  1012. prop="unitName"
  1013. >
  1014. <el-select v-model="formDataNodeModel.unitName" block>
  1015. <el-option
  1016. v-for="item in unitNameOptions"
  1017. :key="item.value"
  1018. :label="item.dictValue"
  1019. :value="item.dictKey"
  1020. />
  1021. </el-select>
  1022. </el-form-item>
  1023. <el-row
  1024. v-if="formDataNodeModel.isClassifition === 1"
  1025. :gutter="24"
  1026. >
  1027. <el-col :span="12">
  1028. <el-form-item prop="unitNum" label="单元个数">
  1029. <el-input-number
  1030. v-model="formDataNodeModel.unitNum"
  1031. placeholder="请输入单元个数"
  1032. :controls="false"
  1033. :min="0"
  1034. :precision="0"
  1035. class="w-100"
  1036. />
  1037. </el-form-item>
  1038. </el-col>
  1039. <el-col :span="12">
  1040. <el-form-item prop="excellentNum" label="优良个数">
  1041. <el-input-number
  1042. v-model="formDataNodeModel.excellentNum"
  1043. placeholder="请输入优良个数"
  1044. :controls="false"
  1045. :min="0"
  1046. :precision="0"
  1047. class="w-100"
  1048. />
  1049. </el-form-item>
  1050. </el-col>
  1051. </el-row>
  1052. </el-form>
  1053. </hc-new-dialog>
  1054. <!-- 调整排序 -->
  1055. <hc-new-dialog
  1056. v-model="sortNodeModal"
  1057. :loading="sortNodeLoading"
  1058. title="调整排序"
  1059. widths="700px"
  1060. @save="sortNodeClick"
  1061. >
  1062. <el-alert
  1063. :closable="false"
  1064. title="可拖动排序,也可在后面点击图标,切换排序"
  1065. type="warning"
  1066. />
  1067. <div class="sort-node-body-box list-group header">
  1068. <div class="list-group-item">
  1069. <div class="index-box">序号</div>
  1070. <div class="title-box">节点名称</div>
  1071. <div class="icon-box">排序</div>
  1072. </div>
  1073. </div>
  1074. <Draggable
  1075. :list="sortNodeData"
  1076. class="sort-node-body-box list-group"
  1077. ghost-class="ghost"
  1078. item-key="id"
  1079. @end="sortNodeDrag = false"
  1080. @start="sortNodeDrag = true"
  1081. >
  1082. <template #item="{ element, index }">
  1083. <div class="list-group-item">
  1084. <div class="index-box">{{ index + 1 }}</div>
  1085. <div class="title-box">{{ element.title }}</div>
  1086. <div class="icon-box">
  1087. <span class="icon" @click="downSortClick(index)">
  1088. <HcIcon name="arrow-down" ui="text-lg" />
  1089. </span>
  1090. <span class="icon" @click="upSortClick(index)">
  1091. <HcIcon name="arrow-up" ui="text-lg" />
  1092. </span>
  1093. </div>
  1094. </div>
  1095. </template>
  1096. </Draggable>
  1097. </hc-new-dialog>
  1098. <!-- 批量上报审批 -->
  1099. <hc-report-modal
  1100. :addition="reportAddition"
  1101. :contract-id="
  1102. contractInfo?.contractType == 2
  1103. ? nodeDataInfo?.contractIdRelation
  1104. : contractId
  1105. "
  1106. :flow-contract-id="contractId"
  1107. :ids="reportIds"
  1108. :table-owner="authBtnTabKey"
  1109. :classify-type="classType"
  1110. :project-id="projectId"
  1111. :show="showReportModal"
  1112. :task-name="reportTaskName"
  1113. :type-data="reportTypeData"
  1114. title="批量上报审批"
  1115. type="wbs"
  1116. url="informationWriteQuery/taskOne"
  1117. @finish="showReportFinish"
  1118. @hide="showReportModal = false"
  1119. />
  1120. <!-- 查看附件 -->
  1121. <hc-new-dialog
  1122. v-model="attachmentModal"
  1123. :footer="false"
  1124. is-table
  1125. title="附件列表"
  1126. widths="780px"
  1127. >
  1128. <div
  1129. v-if="attachmentList.length > 0"
  1130. v-loading="attachmentListLoaing"
  1131. >
  1132. <div
  1133. v-for="item in attachmentList"
  1134. :key="item.id"
  1135. class="hc-attachment-card"
  1136. >
  1137. <div class="hc-attachment-header">{{ item?.nodeName }}</div>
  1138. <div class="hc-attachment-content">
  1139. <div
  1140. v-for="item1 in item.fileList"
  1141. :key="item1.id"
  1142. class="hc-attachment-item"
  1143. >
  1144. <div class="hc-attachment-file-name">
  1145. <HcIcon name="attachment" />
  1146. <div class="name">{{ item1?.name }}</div>
  1147. </div>
  1148. <div class="hc-attachment-btn-box">
  1149. <el-button
  1150. plain
  1151. size="small"
  1152. type="primary"
  1153. @click="previewFile(item1)"
  1154. >
  1155. <HcIcon name="eye" />
  1156. <span>预览</span>
  1157. </el-button>
  1158. <el-button
  1159. v-if="NodeStatus != 3"
  1160. plain
  1161. size="small"
  1162. style="margin-left: 16px"
  1163. type="danger"
  1164. :loading="item1?.loading"
  1165. @click="delFile(item1)"
  1166. >
  1167. <HcIcon name="close" />
  1168. <span>删除</span>
  1169. </el-button>
  1170. </div>
  1171. </div>
  1172. </div>
  1173. </div>
  1174. </div>
  1175. <div v-else style="height: 100%; width: 100%">
  1176. <hc-no-data />
  1177. </div>
  1178. </hc-new-dialog>
  1179. <!-- 上传文件 -->
  1180. <hc-new-dialog
  1181. v-model="uploadModal"
  1182. :footer="false"
  1183. title="上传文件"
  1184. widths="38rem"
  1185. @close="uploadModalClose"
  1186. >
  1187. <div class="mb-4">
  1188. <span style="color: red">*</span> 选择附件类型:
  1189. <el-select
  1190. v-model="typevalue"
  1191. placeholder="请选择"
  1192. style="width: 240px"
  1193. clearable
  1194. @change="changeType"
  1195. >
  1196. <el-option
  1197. v-for="item in typeoptions"
  1198. :key="item.value"
  1199. :label="item.label"
  1200. :value="item.value"
  1201. />
  1202. </el-select>
  1203. </div>
  1204. <HcUpload
  1205. :datas="uploadData"
  1206. :file-list="fileListData"
  1207. :is-canupload="false"
  1208. action="/api/blade-manager/exceltab/add-bussfile-node"
  1209. accept="application/pdf"
  1210. accept-tip="允许格式:pdf"
  1211. :auto-upload="false"
  1212. :typevalue="typevalue"
  1213. @change="uploadChange"
  1214. @close="uploadModalClose"
  1215. />
  1216. </hc-new-dialog>
  1217. <!-- 表单排序 -->
  1218. <hc-new-dialog
  1219. v-model="sortFormShow"
  1220. is-table
  1221. title="排序"
  1222. widths="800px"
  1223. is-footer-center
  1224. @close="sortFormClose"
  1225. >
  1226. <hc-table
  1227. ref="tableSortFormRef"
  1228. :column="tableSortFormColumn"
  1229. :datas="tableSortFormData"
  1230. is-row-drop
  1231. is-sort
  1232. quick-sort
  1233. @row-drop="sortFormDropTap"
  1234. @row-sort="rowSortFormTap"
  1235. />
  1236. <template #footer>
  1237. <el-button hc-btn @click="sortFormClose">取消</el-button>
  1238. <el-button
  1239. hc-btn
  1240. type="primary"
  1241. :loading="sortFormLoading"
  1242. @click="sortFormSubmit"
  1243. >
  1244. 提交
  1245. </el-button>
  1246. </template>
  1247. </hc-new-dialog>
  1248. </div>
  1249. </template>
  1250. <script setup>
  1251. import { nextTick, onMounted, ref, watch } from 'vue'
  1252. import { useRoute, useRouter } from 'vue-router'
  1253. import { useAppStore } from '~src/store'
  1254. import { HcIsButton } from '~src/plugins/IsButtons'
  1255. import CollapseForm from './collapse-form/index.vue'
  1256. import NodeTree from './components/nodeTree/index.vue'
  1257. import HcTreeNode from './components/HcTreeNode.vue'
  1258. import { HcUploadFileApi } from 'hc-vue3-ui'
  1259. import { getStoreValue, setStoreValue } from '~src/utils/storage'
  1260. import { getDictionaryData } from '~uti/tools'
  1261. import { getChildList } from '~api/other'
  1262. import {
  1263. arrToKey,
  1264. deepClone,
  1265. formValidate,
  1266. getArrValue,
  1267. getObjVal,
  1268. getObjValue,
  1269. isArrIndex,
  1270. isNullES,
  1271. isString,
  1272. setCopyText,
  1273. } from 'js-fast-way'
  1274. import {
  1275. eVisaTaskCheckApi,
  1276. getDictionary,
  1277. getDictionaryBiz,
  1278. userConfigSave,
  1279. } from '~api/other'
  1280. import wbsApi from '~api/data-fill/wbs'
  1281. import queryApi from '~api/data-fill/query'
  1282. import Draggable from 'vuedraggable'
  1283. import { HcDelMsg, NewDelMsg, useClick } from 'hc-vue3-ui'
  1284. import HcUpload from './components/HcUpload.vue'
  1285. import { toPdfPage } from '~uti/btn-auth'
  1286. import website from '~src/config'
  1287. //初始变量
  1288. const router = useRouter()
  1289. const useRoutes = useRoute()
  1290. const useAppState = useAppStore()
  1291. //全局变量
  1292. const projectId = ref(useAppState.projectId)
  1293. const contractId = ref(useAppState.contractId)
  1294. const projectInfo = ref(useAppState.projectInfo)
  1295. const contractInfo = ref(useAppState.contractInfo)
  1296. const isCollapse = ref(useAppState.getCollapse)
  1297. const userInfo = ref(useAppState.getUserInfo)
  1298. const isLayout = ref(useAppState.isLayout)
  1299. const leftWidth = ref(440)
  1300. //路由参数
  1301. const routerQuery = useRoutes?.query
  1302. // const typeName = routerQuery?.type || 'map'
  1303. const typeName = routerQuery?.type || 'tree'
  1304. //是否是抽屉
  1305. const isDrawType = ref(true)
  1306. //自动展开缓存
  1307. const TreeAutoExpandKeys = ref(getStoreValue('wbsTreeExpandKeys') || [])
  1308. //树搜索
  1309. const isSearchTree = ref(false)
  1310. const wbstreeKey = ref(Math.random())
  1311. const searchElTreeLoadNode = ref(true)
  1312. const searchTreeHeight = ref()
  1313. const getSearchTreeData = async () => {
  1314. treeLoading.value = true
  1315. const { error, code, data }
  1316. = await queryApi.getTreeNodeByQueryValueAndContractId({
  1317. contractId: contractId.value,
  1318. queryValue: searchTreeVal.value,
  1319. tableOwner: authBtnTabKey.value,
  1320. })
  1321. //判断状态
  1322. if (!error && code === 200) {
  1323. let treedata = getArrValue(data)
  1324. searchTreeData.value = treedata
  1325. treeLoading.value = false
  1326. } else {
  1327. treeLoading.value = false
  1328. searchTreeData.value = []
  1329. }
  1330. }
  1331. //监听
  1332. const searchTreeVal = ref('')
  1333. watch(
  1334. () => [useAppState.getCollapse, searchTreeVal.value],
  1335. ([Collapse, search]) => {
  1336. isCollapse.value = Collapse
  1337. if (search.length == 0) {
  1338. isSearchTree.value = false
  1339. }
  1340. },
  1341. )
  1342. //加载树需要的classType
  1343. const classType = ref('')
  1344. watch(
  1345. () => [classType.value, useAppState.isLayout],
  1346. ([classify, isLay]) => {
  1347. isLayout.value = isLay || ''
  1348. if (classify) {
  1349. //重新加载左边树
  1350. isShowLeft.value = false
  1351. setTimeout(() => {
  1352. isShowLeft.value = true
  1353. }, 500)
  1354. }
  1355. },
  1356. )
  1357. //渲染完成
  1358. onMounted(() => {
  1359. console.log(projectInfo.value)
  1360. treeLoading.value = typeName === 'tree'
  1361. const treeWidth = useAppState.getTreeWidth
  1362. leftWidth.value = isNullES(treeWidth) || treeWidth <= 0 ? 440 : treeWidth
  1363. setContractType(contractInfo.value?.contractType)
  1364. getDictionaryApi()
  1365. getStandardTypeOptions()
  1366. })
  1367. //身份按钮切换数据
  1368. const authBtnTabKey = ref('1')
  1369. //变量
  1370. const wbstree = ref(null)
  1371. const isShowLeft = ref(true)
  1372. const authBtnTabClick = (val) => {
  1373. if (!primaryKeyId.value) {
  1374. window?.$message?.warning('请先在左侧项目树选择一个节点')
  1375. } else if (val['key'] !== authBtnTabKey.value) {
  1376. authBtnTabKey.value = val['key']
  1377. //重新加载左边树
  1378. isShowLeft.value = false
  1379. setTimeout(() => {
  1380. isShowLeft.value = true
  1381. }, 500)
  1382. getTableDataAll()
  1383. }
  1384. }
  1385. //contractType, 1施工,2监理
  1386. const setContractType = (contractType) => {
  1387. if (contractType <= 0) {
  1388. authBtnTabKey.value = '1'
  1389. classType.value = '1'
  1390. } else if (contractType === 3) {
  1391. authBtnTabKey.value = '1'
  1392. classType.value = '1'
  1393. } else {
  1394. authBtnTabKey.value = contractType + ''
  1395. classType.value = contractType + ''
  1396. }
  1397. setElTreeMenu(contractType)
  1398. }
  1399. const getTableDataAll = async (key) => {
  1400. await searchNodeAllTable()
  1401. await queryNodeStatus()
  1402. // wbstree.value.resetNode().then((res)=>{
  1403. // if(res){
  1404. // searchNodeAllTable()
  1405. // queryNodeStatus()
  1406. // }
  1407. // })
  1408. //保存后自动展开到当前表单
  1409. if (!isNullES(key)) {
  1410. console.log(key)
  1411. await nextTick(() => {
  1412. ListItemRef.value?.setCollapseKey(key)
  1413. })
  1414. }
  1415. }
  1416. //结构类型tab数据和相关处理
  1417. const wbsTypeTabKey = ref(typeName)
  1418. const wbsTypeTab = ref([
  1419. { key: 'map', name: '导图结构填报' },
  1420. { key: 'tree', name: '树形结构填报' },
  1421. ])
  1422. const authBtnTabdata = ref([
  1423. { key: '1', name: '施工质检' },
  1424. { key: '2', name: '监理质检' },
  1425. ])
  1426. const wbsTypeTabChange = (item) => {
  1427. wbsTypeTabKey.value = item?.key
  1428. ListItemDatas.value = []
  1429. isDrawer.value = false
  1430. treeLoading.value = typeName === 'tree'
  1431. setStoreValue('classifyType', classType.value)
  1432. setStoreValue('tableOwner', authBtnTabKey.value)
  1433. //路由跳转
  1434. router.push({
  1435. path: useRoutes.path,
  1436. query: {
  1437. type: item?.key,
  1438. classifyType: classType.value,
  1439. tableOwner: authBtnTabKey.value,
  1440. },
  1441. })
  1442. getSearchTreeData()
  1443. }
  1444. //切换导图结构
  1445. const wbsMapTypeTab = () => {
  1446. wbsTypeTabChange({ key: 'map', name: '导图结构填报' })
  1447. }
  1448. //设置图纸数据
  1449. const setUploadDrawingsData = async (echoParams, link) => {
  1450. const info = nodeDataInfo.value
  1451. const { error, code, data } = await wbsApi.saveContractTreeDrawings(
  1452. {
  1453. fileUrl: link,
  1454. id: echoParams['drawingsId'],
  1455. primaryKeyId: echoParams['primaryKeyId'],
  1456. },
  1457. false,
  1458. )
  1459. //处理数据
  1460. if (!error && code === 200) {
  1461. if (info['primaryKeyId'] === echoParams['primaryKeyId']) {
  1462. nodeDataInfo.value['drawingsId'] = data
  1463. nodeDataInfo.value['fileUrl'] = link
  1464. window?.$message?.success('图纸上传成功')
  1465. } else {
  1466. window?.$message?.success(
  1467. '图纸上传成功,由于您切换了其他节点,需要手动刷新才能查看到图纸',
  1468. )
  1469. }
  1470. } else {
  1471. window?.$message?.error('图纸保存失败')
  1472. }
  1473. }
  1474. const NodeTreeAccordion = ref(true)
  1475. //设置树菜单数据
  1476. const ElTreeMenu = ref([])
  1477. const TreeMark = ref(false)
  1478. const setElTreeMenu = (contractType) => {
  1479. let newArr = []
  1480. if (contractType === 1) {
  1481. if (HcIsButton('wbs_tree_add')) {
  1482. newArr.push({ icon: 'add-circle', label: '新增节点', key: 'add' })
  1483. newArr.push({
  1484. icon: 'add-circle',
  1485. label: '自定义节点(水利工程)',
  1486. key: 'add1',
  1487. })
  1488. newArr.push({
  1489. icon: 'add-circle',
  1490. label: '自定义节点(数字化文件)',
  1491. key: 'add2',
  1492. })
  1493. }
  1494. if (HcIsButton('wbs_tree_edit')) {
  1495. newArr.push({ icon: 'draft', label: '编辑节点', key: 'edit' })
  1496. }
  1497. if (HcIsButton('wbs_tree_copy')) {
  1498. newArr.push({
  1499. icon: 'file-copy-2',
  1500. label: '复制节点',
  1501. key: 'copy',
  1502. })
  1503. }
  1504. if (HcIsButton('wbs_tree_mark')) {
  1505. newArr.push({ icon: 'star', label: '标记为首件', key: 'mark' })
  1506. TreeMark.value = true
  1507. }
  1508. if (HcIsButton('wbs_tree_upload')) {
  1509. newArr.push({
  1510. icon: 'file-upload',
  1511. label: '上传图纸',
  1512. key: 'upload',
  1513. })
  1514. }
  1515. if (HcIsButton('wbs_tree_sort')) {
  1516. newArr.push({ icon: 'sort-asc', label: '调整排序', key: 'sort' })
  1517. }
  1518. if (HcIsButton('wbs_tree_del')) {
  1519. newArr.push({ icon: 'delete-bin', label: '删除节点', key: 'del' })
  1520. }
  1521. if (HcIsButton('wbs_views_division_btn')) {
  1522. newArr.push({
  1523. icon: 'folder-shared',
  1524. label: '工程划分',
  1525. key: 'nodetree',
  1526. })
  1527. }
  1528. } else if (contractType === 2) {
  1529. if (HcIsButton('wbs_tree_add')) {
  1530. newArr.push({ icon: 'add-circle', label: '新增节点', key: 'add' })
  1531. newArr.push({
  1532. icon: 'add-circle',
  1533. label: '自定义节点(水利工程)',
  1534. key: 'add1',
  1535. })
  1536. newArr.push({
  1537. icon: 'add-circle',
  1538. label: '自定义节点(数字化文件)',
  1539. key: 'add2',
  1540. })
  1541. }
  1542. if (HcIsButton('wbs_tree_copy')) {
  1543. newArr.push({
  1544. icon: 'file-copy-2',
  1545. label: '复制节点',
  1546. key: 'copy',
  1547. })
  1548. }
  1549. }
  1550. ElTreeMenu.value = newArr
  1551. }
  1552. //树相关变量
  1553. const primaryKeyId = ref('')
  1554. const nodeItemInfo = ref({})
  1555. const nodeDataInfo = ref({})
  1556. const searchTreeData = ref([])
  1557. //回车
  1558. const searchTreeKeyUp = (e) => {
  1559. if (e.key === 'Enter') {
  1560. searchTreeClick()
  1561. }
  1562. }
  1563. const treeLoading = ref(true)
  1564. const searchTreeClick = async () => {
  1565. if (searchTreeVal.value) {
  1566. searchTreeHeight.value
  1567. = document.getElementById('hc-tree-scrollbar').offsetHeight
  1568. isSearchTree.value = true
  1569. //treeLoading.value = true
  1570. getSearchTreeData()
  1571. } else {
  1572. isSearchTree.value = false
  1573. }
  1574. }
  1575. //懒加载的数据
  1576. const treeLoadNode = async ({ node, item, level }, resolve) => {
  1577. let contractIdRelation = '',
  1578. parentId = '',
  1579. primaryKeyId = ''
  1580. if (level !== 0) {
  1581. const nodeData = getObjValue(item)
  1582. contractIdRelation = nodeData?.contractIdRelation || ''
  1583. parentId = contractIdRelation ? nodeData?.primaryKeyId : nodeData?.id
  1584. primaryKeyId = nodeData?.id || ''
  1585. }
  1586. //获取数据
  1587. const { data } = await queryApi.queryWbsTreeData({
  1588. contractId: contractId.value || '',
  1589. contractIdRelation,
  1590. primaryKeyId,
  1591. parentId,
  1592. // classifyType: authBtnTabKey.value,
  1593. classifyType: classType.value,
  1594. tableOwner: authBtnTabKey.value,
  1595. })
  1596. treeLoading.value = false
  1597. resolve(getArrValue(data))
  1598. }
  1599. //树被点击
  1600. const wbsElTreeClick = ({ node, data, keys }) => {
  1601. nodeItemInfo.value = node
  1602. nodeDataInfo.value = data
  1603. primaryKeyId.value = data?.primaryKeyId || ''
  1604. const { notExsitChild } = data
  1605. const { hasChildren } = data
  1606. if (notExsitChild || !hasChildren) {
  1607. isCanadd.value = false
  1608. getTableDataAll()
  1609. } else {
  1610. isCanadd.value = true
  1611. ListItemDatas.value = []
  1612. NodeStatus.value = '1'
  1613. }
  1614. setStoreValue('wbsTreeExpandKeys', keys)
  1615. TreeAutoExpandKeys.value = keys || []
  1616. saveHistory(keys.join(','))
  1617. // getTableDataAll()
  1618. }
  1619. //树加载完成
  1620. const ElTreeNodeLoading = () => {
  1621. treeLoading.value = false
  1622. }
  1623. //保存用户填报历史
  1624. const saveHistory = async (endNode) => {
  1625. await wbsApi.saveUserHistory({
  1626. contractId: contractId.value,
  1627. projectId: projectId.value,
  1628. endNode,
  1629. })
  1630. }
  1631. //回到上次填报历史
  1632. const gobackHistory = async () => {
  1633. isSearchTree.value = false
  1634. const { error, code, data, msg } = await wbsApi.getUserHistory({
  1635. contractId: contractId.value,
  1636. projectId: projectId.value,
  1637. })
  1638. if (!error && code === 200) {
  1639. TreeAutoExpandKeys.value = data['endNode'].split(',') || []
  1640. //重新加载左边树
  1641. isShowLeft.value = false
  1642. setTimeout(() => {
  1643. isShowLeft.value = true
  1644. }, 500)
  1645. } else {
  1646. window.$message.warning(msg)
  1647. }
  1648. }
  1649. //树菜单被点击
  1650. const ElTreeMenuClick = async ({ key, node, data, keys }) => {
  1651. nodeItemInfo.value = node
  1652. nodeDataInfo.value = data
  1653. setStoreValue('wbsTreeExpandKeys', keys)
  1654. TreeAutoExpandKeys.value = keys || []
  1655. setTreeMenuDataClick({ key, node, data })
  1656. }
  1657. const treeMenuClick = (data) => {
  1658. console.log(data, 'data1')
  1659. }
  1660. //导图结构数据
  1661. const NodeTreeRef = ref(null)
  1662. //鼠标左键单击事件
  1663. const NodeTreeClick = ({ keys }) => {
  1664. setStoreValue('wbsTreeExpandKeys', keys)
  1665. TreeAutoExpandKeys.value = keys || []
  1666. }
  1667. //双击事件
  1668. const isDrawer = ref(false)
  1669. const NodeTreeDblClick = ({ node, data }) => {
  1670. nodeItemInfo.value = node
  1671. nodeDataInfo.value = data
  1672. primaryKeyId.value = data?.primaryKeyId || ''
  1673. isDrawer.value = true
  1674. getTableDataAll()
  1675. }
  1676. const drawerClose = () => {
  1677. isDrawer.value = false
  1678. ListItemDatas.value = []
  1679. }
  1680. //导图树菜单被点击
  1681. const NodeTreeMenuClick = async ({ key, node, data }) => {
  1682. nodeItemInfo.value = node
  1683. nodeDataInfo.value = data
  1684. setTreeMenuDataClick({ key, node, data })
  1685. }
  1686. const orString = ref('')
  1687. //处理菜单被点击数据
  1688. const setTreeMenuDataClick = ({ key, node, data }) => {
  1689. const tabKey = wbsTypeTabKey.value
  1690. if (key === 'mark' || key === 'cancel_mark') {
  1691. firstItemBox()
  1692. } else if (key === 'edit') {
  1693. console.log(data, 'data')
  1694. let form = {}
  1695. if (tabKey === 'tree') {
  1696. const parent = deepClone(node?.parent?.data || {})
  1697. form = { ...deepClone(data), parent: parent }
  1698. } else if (tabKey === 'map') {
  1699. const parent = deepClone(node?.parentNodes?.data || {})
  1700. form = { ...deepClone(data), parent: parent }
  1701. }
  1702. formEditNodeModel.value = form
  1703. orString.value = formEditNodeModel.value?.className
  1704. changeStandType(formEditNodeModel.value?.className)
  1705. console.log(
  1706. formEditNodeModel.value?.className,
  1707. 'formEditNodeModel.value?.className',
  1708. )
  1709. editNodeModal.value = true
  1710. //处理路径
  1711. let pathArr = []
  1712. getPathName(node, pathArr)
  1713. form.position = pathArr.join('\\')
  1714. formEditNodeModel.value = form
  1715. } else if (key === 'copy') {
  1716. if (tabKey === 'tree') {
  1717. const parent = deepClone(node?.parent?.data || {})
  1718. formCopyNodeModel.value = { ...deepClone(data), parent: parent }
  1719. } else if (tabKey === 'map') {
  1720. const parent = deepClone(node?.parentNodes?.data || {})
  1721. formCopyNodeModel.value = { ...deepClone(data), parent: parent }
  1722. }
  1723. classifyType.value = authBtnTabKey.value
  1724. copyNodeTabKey.value = '1'
  1725. copyNodeTable.value = []
  1726. copyNodeLoading.value = false
  1727. copyNodeModal.value = true
  1728. } else if (key === 'add') {
  1729. const { childNodes } = node
  1730. console.log(childNodes, 'childNodes')
  1731. isCustom.value = data?.isCustom
  1732. addTreeNodeId.value = data?.primaryKeyId
  1733. addTreeNodeOldId.value = data?.oldId
  1734. addNodeLoading.value = false
  1735. if (data?.isClassifition === 1) {
  1736. window.$message.warning('该节点下不能创建子节点')
  1737. addNodeModal.value = false
  1738. return
  1739. }
  1740. {
  1741. addNodeModal.value = true
  1742. }
  1743. } else if (key === 'add1') {
  1744. addTreeNodeId.value = data?.primaryKeyId
  1745. addTreeNodeOldId.value = data?.oldId
  1746. addNodeLoading.value = false
  1747. formWaterNodeModel.value = {
  1748. nodeName: '',
  1749. nodeType: null,
  1750. }
  1751. if (data?.isClassifition === 1) {
  1752. window.$message.warning('该节点下不能创建子节点')
  1753. addNodeModalCus.value = false
  1754. return
  1755. }
  1756. {
  1757. addNodeModalCus.value = true
  1758. }
  1759. } else if (key === 'add2') {
  1760. addTreeNodeId.value = data?.primaryKeyId
  1761. addTreeNodeOldId.value = data?.oldId
  1762. addNodeLoading.value = false
  1763. formDataNodeModel.value = {
  1764. nodeName: '',
  1765. nodeType: null,
  1766. isClassifition: 0,
  1767. className: '',
  1768. unitName: '',
  1769. unitNum: 1,
  1770. excellentNum: 1,
  1771. digitizeTime: '',
  1772. }
  1773. if (data?.isClassifition === 1) {
  1774. window.$message.warning('该节点下不能创建子节点')
  1775. addNodeModalData.value = false
  1776. return
  1777. } else {
  1778. addNodeModalData.value = true
  1779. }
  1780. } else if (key === 'upload') {
  1781. const info = nodeDataInfo.value
  1782. HcUploadFileApi({
  1783. url: '/api/blade-resource/oss/endpoint/put-file',
  1784. accept: '.png,.jpg,jpeg',
  1785. accept_tip: '图片(png、jpg、jpeg)',
  1786. size: 80,
  1787. multiple: false,
  1788. echoParams: {
  1789. drawingsId: info['drawingsId'],
  1790. primaryKeyId: info['primaryKeyId'],
  1791. },
  1792. success: ({ echoParams }, { data }) => {
  1793. setUploadDrawingsData(echoParams.sourceKey, data?.link)
  1794. },
  1795. error: () => {
  1796. window.$message.error('上传失败')
  1797. },
  1798. })
  1799. } else if (key === 'del') {
  1800. console.log(data, 'data')
  1801. if (
  1802. data['colorStatus'] === 1
  1803. || data['colorStatus'] === 2
  1804. || data['colorStatus'] === null
  1805. || data['colorStatus'] === -1
  1806. ) {
  1807. delModalClick()
  1808. } else {
  1809. window?.$message?.warning('该节点已存在上报数据,不允许删除')
  1810. }
  1811. } else if (key === 'sort') {
  1812. let nodes = [],
  1813. childNodes = []
  1814. if (tabKey === 'tree') {
  1815. childNodes
  1816. = node?.parent?.childNodes || node?.parent?.children || []
  1817. } else if (tabKey === 'map') {
  1818. childNodes = node?.parentNodes?.childrenNodes || []
  1819. }
  1820. for (let i = 0; i < childNodes.length; i++) {
  1821. const res = childNodes[i]?.data
  1822. nodes.push({
  1823. id: res?.primaryKeyId,
  1824. title: res?.title,
  1825. })
  1826. }
  1827. sortNodeData.value = nodes
  1828. sortNodeModal.value = true
  1829. } else if (key === 'nodetree') {
  1830. divisionClick()
  1831. }
  1832. }
  1833. //获取节点的路径名字
  1834. const getPathName = (node, pathArr) => {
  1835. if (node.parent?.parent) {
  1836. pathArr.unshift(node.data?.title.replace(/(^\s*)|(\s*$)/g, '')) //去掉头尾空格
  1837. getPathName(node.parent, pathArr)
  1838. } else {
  1839. //根节点结束
  1840. pathArr.unshift(node.data?.title.replace(/(^\s*)|(\s*$)/g, '')) //去掉头尾空格
  1841. return pathArr
  1842. }
  1843. }
  1844. //确认标记为首件
  1845. const firstItemBox = () => {
  1846. const info = nodeDataInfo.value
  1847. window?.$messageBox?.alert(
  1848. `<div class="text-base font-bold">
  1849. <span>请确认将</span>
  1850. <span class="text-main">【${info['title']}】</span>
  1851. <span>${info['isFirst'] ? '取消' : ''}标记为首件</span>
  1852. </div>`,
  1853. '标记首件制',
  1854. {
  1855. showCancelButton: true,
  1856. dangerouslyUseHTMLString: true,
  1857. callback: (action) => {
  1858. if (action === 'confirm') {
  1859. firstItemHttp(info)
  1860. }
  1861. },
  1862. },
  1863. )
  1864. }
  1865. //首件请求
  1866. const firstItemHttp = async (info) => {
  1867. const { error, code, msg } = await wbsApi.wbsTreeFirstSave({
  1868. primaryKeyId: info['primaryKeyId'],
  1869. saveOrDeleted: info['isFirst'] ? 1 : 0,
  1870. })
  1871. //处理数据
  1872. if (!error && code === 200) {
  1873. window?.$message?.success('操作成功')
  1874. window?.location?.reload() //刷新页面
  1875. }
  1876. }
  1877. //编辑节点
  1878. const editNodeModal = ref(false)
  1879. //获取节点类型
  1880. const nodeTypeData = ref([])
  1881. const getDictionaryApi = async () => {
  1882. const { data } = await getDictionary({
  1883. code: 'wbs_node_type',
  1884. })
  1885. //处理数据
  1886. let newArr = []
  1887. const newData = getArrValue(data)
  1888. for (let i = 0; i < newData.length; i++) {
  1889. newArr.push({
  1890. label: newData[i]['dictValue'],
  1891. value: Number(newData[i]['dictKey']),
  1892. })
  1893. }
  1894. nodeTypeData.value = newArr
  1895. }
  1896. const formEditNodeRef = ref(null)
  1897. const formEditNodeModel = ref({
  1898. title: '',
  1899. parent: {
  1900. title: '',
  1901. },
  1902. nodeType: null,
  1903. partitionCode: '',
  1904. position: '',
  1905. notExsitChild: '',
  1906. })
  1907. const formEditNodeRules = {
  1908. title: {
  1909. required: true,
  1910. trigger: 'blur',
  1911. message: '请输入节点名称',
  1912. },
  1913. }
  1914. const editNodeLoading = ref(false)
  1915. //保存编辑节点数据
  1916. const editNodeClick = async () => {
  1917. const validate = await formValidate(formEditNodeRef.value)
  1918. if (validate) {
  1919. //发起请求
  1920. editNodeLoading.value = true
  1921. const {
  1922. primaryKeyId,
  1923. title,
  1924. partitionCode,
  1925. className,
  1926. unitName,
  1927. excellentNum,
  1928. unitNum,
  1929. digitizeTime,
  1930. } = formEditNodeModel.value
  1931. const { error, code, msg } = await wbsApi.wbsTreeUpdateNode({
  1932. nodeName: title || '',
  1933. pKeyId: primaryKeyId || '',
  1934. partitionCode: partitionCode || '',
  1935. className,
  1936. unitName,
  1937. unitNum,
  1938. excellentNum,
  1939. digitizeTime,
  1940. })
  1941. //处理数据
  1942. editNodeLoading.value = false
  1943. if (!error && code === 200) {
  1944. window?.$message?.success('修改成功')
  1945. nodeDataInfo.value['title'] = title || ''
  1946. nodeDataInfo.value['partitionCode'] = partitionCode || ''
  1947. editNodeModal.value = false
  1948. window?.location?.reload() //刷新页面
  1949. }
  1950. }
  1951. }
  1952. //复制节点
  1953. const copyNodeModal = ref(false)
  1954. //复制节点类型tab数据和相关处理
  1955. const copyNodeTabKey = ref('')
  1956. const copyNodeTab = ref([
  1957. { key: '1', name: '单份复制' },
  1958. { key: '2', name: '多份复制' },
  1959. //{key: '3', name: '复制数据'}
  1960. ])
  1961. const copyNodeTabChange = (key) => {
  1962. if (key !== copyNodeTabKey.value) {
  1963. copyNodeTabKey.value = key
  1964. copyNodeTable.value = []
  1965. copyNodeLoading.value = false
  1966. }
  1967. }
  1968. //复制节点变量
  1969. const copyNodeLoading = ref(false)
  1970. const formCopyNodeModel = ref({})
  1971. const classifyList = ref([])
  1972. const copyNodeTable = ref([])
  1973. const isCopyData = ref(0)
  1974. //复制树被点击
  1975. const copyNodeElTreeClick = ({ data, node }) => {
  1976. const TabKey = copyNodeTabKey.value
  1977. const { title, type, partitionCode } = formCopyNodeModel.value
  1978. console.log(formCopyNodeModel.value, 'formCopyNodeModel.value')
  1979. console.log(data, '点击data')
  1980. if (TabKey === '2') {
  1981. // setCopyNodeTable(data, title, partitionCode)
  1982. //1 单位工程,2 分部工程,3 子分部工程,4 分项工程, 5 子分项工程,6 工序
  1983. // //不能复制到本身节点下
  1984. // //只能往上一级点击,不能跨层级点击
  1985. // //已上报的工序节点不能点击选择
  1986. // //如果选择的是父级节点,那不能复制到子级节点
  1987. const { hasChildren } = data
  1988. if (hasChildren === 0) {
  1989. if (
  1990. data['colorStatus'] === 2
  1991. || data['colorStatus'] == 1
  1992. || data['colorStatus'] === null
  1993. || data['colorStatus'] === -1
  1994. ) {
  1995. //已上报的工序不能点击
  1996. if (data['id'] !== formCopyNodeModel.value.id) {
  1997. //不能复制到本身节点下
  1998. //只能往上一级点击,不能跨层级点击
  1999. //如果选择的是父级节点,那不能复制到子级节点
  2000. if (
  2001. type === 6
  2002. && (data['type'] === 4
  2003. || data['type'] === 5
  2004. || data['type'] == 6)
  2005. ) {
  2006. setCopyNodeTable(data, title)
  2007. }
  2008. if (type === 5 && data['type'] === 4) {
  2009. setCopyNodeTable(data, title, partitionCode)
  2010. }
  2011. if (
  2012. type === 4
  2013. && (data['type'] === 2 || data['type'] === 3)
  2014. ) {
  2015. setCopyNodeTable(data, title, partitionCode)
  2016. }
  2017. if (type === 3 && data['type'] === 2) {
  2018. setCopyNodeTable(data, title, partitionCode)
  2019. }
  2020. if (type === 2 && data['type'] === 1) {
  2021. setCopyNodeTable(data, title, partitionCode)
  2022. }
  2023. if (type === 1 && data['type'] === 1) {
  2024. setCopyNodeTable(data, title, partitionCode)
  2025. }
  2026. }
  2027. } else {
  2028. window?.$message?.warning('该节点已存在上报数据,不允许复制')
  2029. }
  2030. } else {
  2031. if (data['id'] !== formCopyNodeModel.value.id) {
  2032. //不能复制到本身节点下
  2033. //只能往上一级点击,不能跨层级点击
  2034. //如果选择的是父级节点,那不能复制到子级节点
  2035. if (
  2036. type === 6
  2037. && (data['type'] === 4
  2038. || data['type'] === 5
  2039. || data['type'] == 6)
  2040. ) {
  2041. setCopyNodeTable(data, title)
  2042. }
  2043. if (type === 5 && data['type'] === 4) {
  2044. setCopyNodeTable(data, title, partitionCode)
  2045. }
  2046. if (type === 4 && (data['type'] === 2 || data['type'] === 3)) {
  2047. setCopyNodeTable(data, title, partitionCode)
  2048. }
  2049. if (type === 3 && data['type'] === 2) {
  2050. setCopyNodeTable(data, title, partitionCode)
  2051. }
  2052. if (type === 2 && data['type'] === 1) {
  2053. setCopyNodeTable(data, title, partitionCode)
  2054. }
  2055. if (type === 1 && data['type'] === 1) {
  2056. setCopyNodeTable(data, title, partitionCode)
  2057. }
  2058. }
  2059. }
  2060. } else if (TabKey === '3') {
  2061. console.log(1111111)
  2062. setCopyNodeTable(data, data?.title)
  2063. }
  2064. }
  2065. const setCopyNodeTable = (data, title) => {
  2066. copyNodeTable.value.push({
  2067. title: data?.title || '',
  2068. nodeName: title || '',
  2069. primaryKeyId: data?.primaryKeyId || '',
  2070. parentId: data?.parentId || '',
  2071. id: data?.id || '',
  2072. })
  2073. }
  2074. //节点表单
  2075. const formCopyNodeModelRef = ref(null)
  2076. const formCopyNodeModelRules = {
  2077. title: {
  2078. required: true,
  2079. trigger: 'blur',
  2080. message: '请输入节点名称',
  2081. },
  2082. }
  2083. //表格节点表单
  2084. const copyNodeTableRef = ref(null)
  2085. const copyNodeTableRules = {
  2086. nodeName: {
  2087. required: true,
  2088. trigger: 'blur',
  2089. message: '请输入节点名称',
  2090. },
  2091. }
  2092. //删除选中的节点
  2093. const copyNodeTableDel = (index) => {
  2094. copyNodeTable.value.splice(index, 1)
  2095. }
  2096. const classifyType = ref(authBtnTabKey.value)
  2097. const classifyTypeTabClick = ({ key }) => {
  2098. classifyType.value = key
  2099. }
  2100. //复制节点
  2101. const copyNodeClick = async () => {
  2102. const type = copyNodeTabKey.value
  2103. const form = formCopyNodeModel.value
  2104. const table = copyNodeTable.value
  2105. let classify = ''
  2106. let arr = []
  2107. if (classifyList.value.length > 0) {
  2108. classifyList.value.forEach((item) => {
  2109. if (item === '施工') {
  2110. arr.push(1)
  2111. } else if (item === '监理') {
  2112. arr.push(2)
  2113. }
  2114. })
  2115. classify = arr.join(',')
  2116. }
  2117. //isSameNode 是否同节点 1=同节点,0=跨节点
  2118. if (table.length > 0) {
  2119. table.forEach((ele) => {
  2120. if (
  2121. ele.parentId === formCopyNodeModel.value.parentId
  2122. || ele.id === formCopyNodeModel.value.parentId
  2123. ) {
  2124. ele.isSameNode = 1
  2125. } else {
  2126. ele.isSameNode = 0
  2127. }
  2128. })
  2129. }
  2130. if (isCopyData.value === 1) {
  2131. if (classify) {
  2132. //效验数据
  2133. if (type === '1') {
  2134. const validate = await formValidate(formCopyNodeModelRef.value)
  2135. if (validate)
  2136. await copyContractTreeNode(type, form, [], classify)
  2137. } else if (type === '2') {
  2138. if (table.length > 0) {
  2139. const validate = await formValidate(copyNodeTableRef.value)
  2140. if (validate)
  2141. await copyContractTreeNode(type, form, table, classify)
  2142. } else {
  2143. window?.$message?.warning('请先在左侧选择要复制到的节点')
  2144. }
  2145. }
  2146. } else {
  2147. window?.$message?.warning('请选择所属方')
  2148. }
  2149. } else {
  2150. if (type === '1') {
  2151. const validate = await formValidate(formCopyNodeModelRef.value)
  2152. if (validate) await copyContractTreeNode(type, form, [], classify)
  2153. } else if (type === '2') {
  2154. if (table.length > 0) {
  2155. const validate = await formValidate(copyNodeTableRef.value)
  2156. if (validate)
  2157. await copyContractTreeNode(type, form, table, classify)
  2158. } else {
  2159. window?.$message?.warning('请先在左侧选择要复制到的节点')
  2160. }
  2161. }
  2162. }
  2163. }
  2164. //单个复制、多份复制请求
  2165. const copyContractTreeNode = async (type, form, table, classify) => {
  2166. copyNodeLoading.value = true
  2167. if (type === '1') {
  2168. const { error, code, msg } = await wbsApi.copyContractTreeNode({
  2169. copyType: type,
  2170. needCopyNodeName: form?.title || '',
  2171. partitionCode: form?.partitionCode || '',
  2172. needCopyPrimaryKeyId: form?.primaryKeyId || '',
  2173. parentPrimaryKeyId: form?.parent?.primaryKeyId || '',
  2174. copyBatchToPaths: table,
  2175. classifyType: classify,
  2176. isCopyData: isCopyData.value,
  2177. })
  2178. //判断状态
  2179. copyNodeLoading.value = false
  2180. if (!error && code === 200) {
  2181. window?.$message?.success('复制成功')
  2182. copyNodeModal.value = false
  2183. window?.location?.reload() //刷新页面
  2184. }
  2185. } else {
  2186. const { error, code, msg } = await wbsApi.copyContractTreeNode({
  2187. copyType: type,
  2188. needCopyNodeName: form?.title || '',
  2189. needCopyPrimaryKeyId: form?.primaryKeyId || '',
  2190. parentPrimaryKeyId: form?.parent?.primaryKeyId || '',
  2191. copyBatchToPaths: table,
  2192. classifyType: classify,
  2193. isCopyData: isCopyData.value,
  2194. })
  2195. //判断状态
  2196. copyNodeLoading.value = false
  2197. if (!error && code === 200) {
  2198. window?.$message?.success('复制成功')
  2199. copyNodeModal.value = false
  2200. window?.location?.reload() //刷新页面
  2201. }
  2202. }
  2203. }
  2204. //复制数据
  2205. const copyContractNodeSubmitBusinessData = async (form, table, classify) => {
  2206. copyNodeLoading.value = true
  2207. const { error, code } = await wbsApi.copyContractNodeSubmitBusinessData({
  2208. needCopyPrimaryKeyId: form?.primaryKeyId || '',
  2209. copyBatchToPaths: table,
  2210. classify: classify,
  2211. })
  2212. //判断状态
  2213. copyNodeLoading.value = false
  2214. if (!error && code === 200) {
  2215. window?.$message?.success('复制成功')
  2216. copyNodeModal.value = false
  2217. window?.location?.reload() //刷新页面
  2218. }
  2219. }
  2220. //新增节点
  2221. const addNodeModal = ref(false)
  2222. const addTreeNodeId = ref('')
  2223. const addTreeNodeOldId = ref('')
  2224. const addTreeNodeType = ref('1')
  2225. const isCustom = ref(null)
  2226. //新增自定义节点
  2227. const addNodeModalCus = ref(false)
  2228. const addNodeLoadingCus = ref(false)
  2229. //水利工程
  2230. const formWaterNodeRef = ref(null)
  2231. const formWaterNodeModel = ref({
  2232. nodeName: '',
  2233. nodeType: null,
  2234. })
  2235. const formWaterNodeRules = {
  2236. nodeName: {
  2237. required: true,
  2238. trigger: 'blur',
  2239. message: '请输入节点名称',
  2240. },
  2241. nodeType: {
  2242. required: true,
  2243. trigger: 'blur',
  2244. message: '请选择节点类型',
  2245. },
  2246. }
  2247. //新增自定义节点-数字化文件
  2248. const addNodeModalData = ref(false)
  2249. const addNodeLoadingData = ref(false)
  2250. const formDataNodeRef = ref(null)
  2251. const formDataNodeModel = ref({
  2252. nodeName: '',
  2253. nodeType: null,
  2254. isClassifition: 0,
  2255. className: '',
  2256. unitName: '',
  2257. unitNum: 1,
  2258. excellentNum: 1,
  2259. digitizeTime: '',
  2260. })
  2261. const standardTypeOptions = ref([])
  2262. const getStandardTypeOptions = async () => {
  2263. const { data } = await getDictionary({
  2264. code: 'classification',
  2265. })
  2266. standardTypeOptions.value = await getDictionaryData(
  2267. 'classification',
  2268. false,
  2269. )
  2270. standardTypeOptions.value.forEach((element) => {
  2271. // element.parentId=
  2272. data.forEach((ele) => {
  2273. if (ele.dictKey == element.value) {
  2274. element.id = ele.id
  2275. }
  2276. })
  2277. })
  2278. // 定义要过滤的 dictKey 值
  2279. const targetKeys = [1, 2, 3, 4, 5]
  2280. // 过滤数组
  2281. standardTypeOptions.value = standardTypeOptions.value.filter((item) =>
  2282. targetKeys.includes(item.value),
  2283. )
  2284. }
  2285. const unitNameOptions = ref([])
  2286. const changeStandType = async (val) => {
  2287. if (val !== orString.value) {
  2288. formEditNodeModel.value.unitName = ''
  2289. }
  2290. formDataNodeModel.value.unitName = ''
  2291. let parentId = ''
  2292. standardTypeOptions.value.forEach((item) => {
  2293. if (item.value == val) {
  2294. parentId = item.id
  2295. }
  2296. })
  2297. const { data } = await getChildList({ current: 1, size: 10000, parentId })
  2298. unitNameOptions.value = data
  2299. unitNameOptions.value = unitNameOptions.value.filter(
  2300. (item) => item.dictKey != -1,
  2301. )
  2302. unitNameOptions.value.forEach((ele) => {
  2303. ele.dictKey = Number(ele.dictKey)
  2304. })
  2305. }
  2306. const formDataNodeRules = {
  2307. nodeName: {
  2308. required: true,
  2309. trigger: 'blur',
  2310. message: '请输入节点名称',
  2311. },
  2312. nodeType: {
  2313. required: true,
  2314. trigger: 'blur',
  2315. message: '请选择节点类型',
  2316. },
  2317. isClassifition: {
  2318. required: true,
  2319. trigger: 'blur',
  2320. message: '请选择是否含单元评定',
  2321. },
  2322. className: {
  2323. required: true,
  2324. trigger: 'blur',
  2325. message: '请选择标准分类',
  2326. },
  2327. unitName: {
  2328. required: true,
  2329. trigger: 'blur',
  2330. message: '请选择单位名称',
  2331. },
  2332. excellentNum: {
  2333. required: true,
  2334. trigger: 'blur',
  2335. message: '请输入优良个数',
  2336. },
  2337. unitNum: {
  2338. required: true,
  2339. trigger: 'blur',
  2340. message: '请输入单元个数',
  2341. },
  2342. digitizeTime: {
  2343. required: true,
  2344. trigger: 'blur',
  2345. message: '请选择时间',
  2346. },
  2347. }
  2348. const addNodeClickData = async () => {
  2349. const validate = await formValidate(formDataNodeRef.value)
  2350. if (!validate) return
  2351. //发起请求
  2352. addNodeClickData.value = true
  2353. const { error, code, msg } = await wbsApi.saveCustomAddContractNode({
  2354. nodeName: formDataNodeModel.value.nodeName,
  2355. nodeType: formDataNodeModel.value?.nodeType || '',
  2356. partitionCode: nodeDataInfo.value?.partitionCode || '',
  2357. primaryKeyId: nodeDataInfo.value?.primaryKeyId || '',
  2358. nodeClass: 2, //数字化文件
  2359. isClassifition: formDataNodeModel.value?.isClassifition || 0,
  2360. className: formDataNodeModel.value?.className || '',
  2361. unitName: Number(formDataNodeModel.value?.unitName) || '',
  2362. excellentNum: formDataNodeModel.value?.excellentNum || 0,
  2363. digitizeTime: formDataNodeModel.value?.digitizeTime || '',
  2364. unitNum: formDataNodeModel.value?.unitNum || 0,
  2365. })
  2366. //判断状态
  2367. addNodeClickData.value = false
  2368. if (!error && code === 200) {
  2369. window?.$message?.success('新增成功')
  2370. addNodeModalData.value = false
  2371. window?.location?.reload() //刷新页面
  2372. }
  2373. }
  2374. //选中的节点
  2375. const allSelectedList = ref([])
  2376. const halfSelectedList = ref([])
  2377. const addTreeNodeCheckChange = (nodes) => {
  2378. let NodesArr = [],
  2379. halfArr = []
  2380. //全选数据
  2381. const keys = nodes.checkedNodes || []
  2382. console.log(keys, 'keys')
  2383. for (let i = 0; i < keys.length; i++) {
  2384. NodesArr.push({
  2385. nodeName: keys[i].nodeName,
  2386. primaryKeyId: keys[i].pKeyId,
  2387. isPeer: keys[i].isPeer || 2,
  2388. })
  2389. }
  2390. allSelectedList.value = NodesArr
  2391. console.log(allSelectedList.value, ' allSelectedList.value')
  2392. //半选数据
  2393. const halfNodes = nodes.halfCheckedNodes || []
  2394. for (let i = 0; i < halfNodes.length; i++) {
  2395. halfArr.push({
  2396. nodeName: halfNodes[i].nodeName,
  2397. primaryKeyId: halfNodes[i].pKeyId,
  2398. isPeer: halfNodes[i].isPeer || 2,
  2399. })
  2400. }
  2401. halfSelectedList.value = halfArr
  2402. console.log(halfSelectedList.value, ' halfSelectedList.value')
  2403. }
  2404. //新增节点
  2405. const addNodeLoading = ref(false)
  2406. const addNodeClick = async () => {
  2407. const keys = allSelectedList.value || []
  2408. if (keys.length <= 0) {
  2409. window?.$message?.warning('请先选择节点')
  2410. } else {
  2411. //发起请求
  2412. addNodeLoading.value = true
  2413. const primaryKeyId = nodeDataInfo.value?.primaryKeyId || ''
  2414. const { error, code } = await wbsApi.saveContractTreeNode({
  2415. projectId: projectId.value,
  2416. contractId: contractId.value,
  2417. saveType: addTreeNodeType.value,
  2418. allSelectedList: allSelectedList.value,
  2419. halfSelectedList: halfSelectedList.value,
  2420. currentNodePrimaryKeyId: primaryKeyId,
  2421. })
  2422. //判断状态
  2423. addNodeLoading.value = false
  2424. if (!error && code === 200) {
  2425. window?.$message?.success('新增成功')
  2426. addNodeModal.value = false
  2427. window?.location?.reload() //刷新页面
  2428. }
  2429. }
  2430. }
  2431. const addNodeClickCur = async () => {
  2432. const validate = await formValidate(formWaterNodeRef.value)
  2433. if (!validate) return
  2434. //发起请求
  2435. addNodeLoadingCus.value = true
  2436. const { error, code, msg } = await wbsApi.saveCustomAddContractNode({
  2437. nodeName: formWaterNodeModel.value.nodeName,
  2438. nodeType: formWaterNodeModel.value?.nodeType || '',
  2439. partitionCode: nodeDataInfo.value?.partitionCode || '',
  2440. primaryKeyId: nodeDataInfo.value?.primaryKeyId || '',
  2441. nodeClass: 1, //1水利化工程,2数字化文件
  2442. })
  2443. //判断状态
  2444. addNodeLoadingCus.value = false
  2445. if (!error && code === 200) {
  2446. window?.$message?.success('新增成功')
  2447. addNodeModalCus.value = false
  2448. window?.location?.reload() //刷新页面
  2449. } else {
  2450. window?.$message?.error(msg || '操作失败')
  2451. }
  2452. }
  2453. //删除节点
  2454. const delModalClick = async () => {
  2455. const { code, msg } = await wbsApi.removeContractTreeNodeJudge({
  2456. ids: nodeDataInfo.value?.primaryKeyId || '',
  2457. })
  2458. if (code === 200) {
  2459. HcDelMsg(async (resolve) => {
  2460. await removeContractTreeNode()
  2461. resolve() //关闭弹窗的回调
  2462. })
  2463. } else {
  2464. NewDelMsg({ text: msg }, async (resolve) => {
  2465. await removeContractTreeNode()
  2466. resolve() //关闭弹窗的回调
  2467. })
  2468. }
  2469. }
  2470. const removeContractTreeNode = async () => {
  2471. const loadingInstance = window.$loading.service({
  2472. fullscreen: true,
  2473. text: '删除节点中,请耐心等待...',
  2474. background: 'rgba(0, 0, 0, 0.7)',
  2475. })
  2476. const { error, code, msg } = await wbsApi.removeContractTreeNode({
  2477. ids: nodeDataInfo.value?.primaryKeyId || '',
  2478. })
  2479. //处理结果
  2480. loadingInstance.close()
  2481. if (!error && code === 200) {
  2482. window?.$message?.success('删除成功')
  2483. window?.location?.reload() //刷新页面
  2484. } else {
  2485. window.$message.error(msg)
  2486. }
  2487. }
  2488. //调整排序
  2489. const sortNodeModal = ref(false)
  2490. const sortNodeLoading = ref(false)
  2491. const sortNodeData = ref([])
  2492. const sortNodeDrag = ref(false)
  2493. //向下
  2494. const downSortClick = (index) => {
  2495. const indexs = index + 1
  2496. const data = sortNodeData.value || []
  2497. if (indexs !== data.length) {
  2498. const tmp = data.splice(indexs, 1)
  2499. sortNodeData.value.splice(index, 0, tmp[0])
  2500. } else {
  2501. window?.$message?.warning('已经处于置底,无法下移')
  2502. }
  2503. }
  2504. //向上
  2505. const upSortClick = (index) => {
  2506. const data = sortNodeData.value || []
  2507. if (index !== 0) {
  2508. const tmp = data.splice(index - 1, 1)
  2509. sortNodeData.value.splice(index, 0, tmp[0])
  2510. } else {
  2511. window?.$message?.warning('已经处于置顶,无法上移')
  2512. }
  2513. }
  2514. //确认排序
  2515. const sortNodeClick = async () => {
  2516. const sortList = []
  2517. const nodes = sortNodeData.value || []
  2518. nodes.forEach((item) => {
  2519. sortList.push(item?.id)
  2520. })
  2521. //发起请求
  2522. sortNodeLoading.value = true
  2523. const { error, code, msg } = await wbsApi.diySortTreeNode({ sortList })
  2524. sortNodeLoading.value = false
  2525. //判断状态
  2526. if (!error && code === 200) {
  2527. window?.$message?.success('保存成功')
  2528. sortNodeModal.value = false
  2529. window?.location?.reload() //刷新页面
  2530. } else {
  2531. window.$message.error(msg)
  2532. }
  2533. }
  2534. //查看图纸
  2535. const drawList = ref('')
  2536. const drawingsShow = ref(false)
  2537. const viewsDrawings = () => {
  2538. const { primaryKeyId, drawingsId } = nodeDataInfo.value
  2539. if (!primaryKeyId) {
  2540. window?.$message?.warning('请先选择树节点')
  2541. } else if (drawingsId === -1 || drawingsId === null) {
  2542. window?.$message?.warning('该节点暂未上传图纸')
  2543. } else {
  2544. drawingsShow.value = true
  2545. getDrawList(drawingsId)
  2546. }
  2547. }
  2548. const drawingsClose = (res) => {
  2549. drawingsShow.value = res
  2550. }
  2551. const getDrawList = async (primaryKeyId) => {
  2552. const { error, code, data } = await wbsApi.getTreeDrawings({
  2553. primaryKeyId,
  2554. })
  2555. //判断状态
  2556. if (!error && code === 200) {
  2557. drawList.value = data
  2558. } else {
  2559. drawList.value = data
  2560. }
  2561. }
  2562. //设置滚动条位置
  2563. const ListItemScrollRef = ref(null)
  2564. const ListItemOffsetTop = (offsetTop) => {
  2565. if (offsetTop > 0) {
  2566. setTimeout(() => {
  2567. ListItemScrollRef.value?.setScrollTop(offsetTop)
  2568. }, 350)
  2569. } else {
  2570. ListItemScrollRef.value?.setScrollTop(offsetTop)
  2571. }
  2572. }
  2573. //获取数据列表
  2574. const ListItemDatas = ref([])
  2575. const ListItemLoading = ref(false)
  2576. const searchNodeAllTable = async () => {
  2577. ListItemLoading.value = true
  2578. ListItemDatas.value = []
  2579. const info = nodeDataInfo.value
  2580. const { data } = await wbsApi.searchNodeAllTable({
  2581. projectId: projectId.value,
  2582. contractId: contractId.value,
  2583. primaryKeyId: info['primaryKeyId'],
  2584. type: authBtnTabKey.value,
  2585. })
  2586. ListItemDatas.value = getArrValue(data)
  2587. ListItemLoading.value = false
  2588. }
  2589. const newlistdata = ref([])
  2590. const searchNodeAllTable1 = async () => {
  2591. console.log('重新获取表单列表')
  2592. const info = nodeDataInfo.value
  2593. const { data } = await wbsApi.searchNodeAllTable({
  2594. projectId: projectId.value,
  2595. contractId: contractId.value,
  2596. primaryKeyId: info['primaryKeyId'],
  2597. type: authBtnTabKey.value,
  2598. })
  2599. newlistdata.value = getArrValue(data)
  2600. }
  2601. //查询状态
  2602. const NodeStatus = ref('1')
  2603. const queryNodeStatus = async () => {
  2604. const info = nodeDataInfo.value
  2605. if (contractInfo.value?.contractType == 1) {
  2606. const { error, code, data } = await wbsApi.queryNodeStatus({
  2607. primaryKeyId: info['primaryKeyId'],
  2608. //classify:1
  2609. classify: authBtnTabKey.value,
  2610. })
  2611. //1 未填报,2待上报,3已上报
  2612. if (!error && code === 200) {
  2613. NodeStatus.value = data ?? '1'
  2614. } else {
  2615. NodeStatus.value = '1'
  2616. }
  2617. } else {
  2618. const { error, code, data } = await wbsApi.queryNodeStatusJl({
  2619. // primaryKeyId: info['contractIdRelation'] ? info['id'] : info['primaryKeyId'],
  2620. primaryKeyId: info['primaryKeyId'],
  2621. //classify: 1
  2622. classify: authBtnTabKey.value,
  2623. })
  2624. //1 未填报,2待上报,3已上报
  2625. if (!error && code === 200) {
  2626. NodeStatus.value = data ?? '1'
  2627. } else {
  2628. NodeStatus.value = '1'
  2629. }
  2630. }
  2631. }
  2632. //批量上报
  2633. const reportIds = ref('')
  2634. const reportTaskName = ref('')
  2635. const reportAddition = ref({})
  2636. const showReportModal = ref(false)
  2637. const reportLoading = ref(false)
  2638. const reportTypeData = ref([])
  2639. const reportModalClick = async () => {
  2640. const info = nodeDataInfo.value
  2641. const rows = ListItemDatas.value
  2642. if (rows.length > 0) {
  2643. reportLoading.value = true
  2644. const taskCheck = await eVisaTaskCheckApi({
  2645. projectId: projectId.value,
  2646. contractId:
  2647. contractInfo.value?.contractType == 2
  2648. ? info?.contractIdRelation
  2649. : contractId.value,
  2650. // contractId: contractId.value
  2651. })
  2652. //处理数据
  2653. let newArr = []
  2654. for (let i = 0; i < rows.length; i++) {
  2655. newArr.push(rows[i]['isTypePrivatePid'])
  2656. }
  2657. reportTypeData.value = newArr
  2658. reportLoading.value = false
  2659. if (taskCheck) {
  2660. //初始弹出弹窗,防呆
  2661. reportIds.value = info['primaryKeyId']
  2662. reportAddition.value = {
  2663. classify: authBtnTabKey.value,
  2664. contractIdRelation: info['contractIdRelation'],
  2665. }
  2666. showReportModal.value = true
  2667. //请求文件题名
  2668. const { data } = await wbsApi.queryDocumentTitle({
  2669. primaryKeyId: info['primaryKeyId'],
  2670. classify: authBtnTabKey.value,
  2671. })
  2672. reportTaskName.value = isString(data) ? data : ''
  2673. }
  2674. } else {
  2675. window.$message?.warning('暂无相关数据')
  2676. }
  2677. }
  2678. //上报完成
  2679. const showReportFinish = () => {
  2680. showReportModal.value = false
  2681. getTableDataAll()
  2682. window?.location?.reload() //刷新页面
  2683. }
  2684. //表单变量
  2685. const ListItemRef = ref(null)
  2686. const ListItemsRef = ref(null)
  2687. //保存
  2688. const tableFormSaveLoading = ref(false)
  2689. const tableFormSaveClick = async () => {
  2690. //获取数据
  2691. let FormData = [],
  2692. FormRegExpJson = {}
  2693. if (isDrawer.value) {
  2694. FormData = await ListItemsRef.value?.getFormData()
  2695. FormRegExpJson = await ListItemsRef.value?.getFormRegExpJson()
  2696. } else {
  2697. FormData = await ListItemRef.value?.getFormData()
  2698. FormRegExpJson = await ListItemRef.value?.getFormRegExpJson()
  2699. }
  2700. //效验数据
  2701. if (getObjVal(FormRegExpJson)) {
  2702. setFormRegExpJson(FormRegExpJson)
  2703. } else if (FormData.length > 0) {
  2704. console.log('保存')
  2705. tableFormSaveLoading.value = true
  2706. console.log('FormData', FormData)
  2707. const { error, code, msg } = await wbsApi.saveExcelBussData({
  2708. dataInfo: { orderList: FormData },
  2709. })
  2710. tableFormSaveLoading.value = false
  2711. if (!error && code === 200) {
  2712. window?.$message?.success('保存成功')
  2713. // await bussPdfsClick()
  2714. const activeKey = ListItemRef.value?.getActiveKey()
  2715. getTableDataAll(activeKey)
  2716. } else {
  2717. window?.$message?.error(msg || '操作失败')
  2718. }
  2719. } else {
  2720. console.log('预览')
  2721. // await bussPdfsClick()
  2722. }
  2723. }
  2724. //效验数据
  2725. const setFormRegExpJson = (FormRegExpJson) => {
  2726. let nodeName = '',
  2727. itemId = ''
  2728. Object.keys(FormRegExpJson).forEach((key) => {
  2729. const name = FormRegExpJson[key]?.nodeName ?? ''
  2730. if (name) {
  2731. if (nodeName) {
  2732. nodeName += ',' + name
  2733. } else {
  2734. nodeName = name
  2735. itemId = FormRegExpJson[key]?.itemId
  2736. }
  2737. }
  2738. })
  2739. //const activeKey = ListItemRef.value?.getActiveKey()
  2740. //弹出提示
  2741. const val
  2742. = '<div style="font-size: 16px;">请先完善 <span style="color:#1ECC95;">'
  2743. + nodeName
  2744. + '</span> 的数据内容</div>'
  2745. window?.$messageBox?.alert(val, '表单完善提醒', {
  2746. confirmButtonText: '确定',
  2747. dangerouslyUseHTMLString: true,
  2748. callback: (action) => {
  2749. if (action === 'confirm') {
  2750. ListItemRef.value?.setActiveKey(itemId)
  2751. ListItemOffsetTop(0)
  2752. setTimeout(() => {
  2753. const offsetTop
  2754. = document.getElementById(itemId)?.offsetTop
  2755. ListItemOffsetTop(offsetTop)
  2756. }, 350)
  2757. }
  2758. },
  2759. })
  2760. }
  2761. //多表预览
  2762. const bussPdfsLoading = ref(false)
  2763. const bussPdfsClick = async () => {
  2764. const info = nodeDataInfo.value
  2765. bussPdfsLoading.value = true
  2766. const { error, code, data } = await wbsApi.getBussPdfs({
  2767. nodeId: info?.primaryKeyId || '',
  2768. classify: authBtnTabKey.value,
  2769. projectId: projectId.value,
  2770. // contractId: contractId.value
  2771. contractId:
  2772. contractInfo.value?.contractType == 2
  2773. ? info?.contractIdRelation
  2774. : contractId.value,
  2775. })
  2776. tableFormSaveLoading.value = false
  2777. bussPdfsLoading.value = false
  2778. if (!error && code === 200) {
  2779. toPdfPage(data)
  2780. //window.open(data, '_blank')
  2781. } else {
  2782. window.$message?.warning('获取PDF失败')
  2783. }
  2784. }
  2785. //撤回上报流程
  2786. const abolishLoaing = ref(false)
  2787. const abolishOneClick = () => {
  2788. window?.$messageBox?.alert('请谨慎考虑后,是否确定撤回?', '撤回上报', {
  2789. showCancelButton: true,
  2790. confirmButtonText: '确定撤回',
  2791. cancelButtonText: '取消',
  2792. callback: (action) => {
  2793. if (action === 'confirm') {
  2794. abolishOneSave()
  2795. }
  2796. },
  2797. })
  2798. }
  2799. //撤回请求
  2800. const abolishOneSave = async () => {
  2801. const info = nodeDataInfo.value
  2802. abolishLoaing.value = true
  2803. const { error, code } = await wbsApi.abolishOne({
  2804. primaryKeyId: info?.primaryKeyId || '',
  2805. classify: authBtnTabKey.value,
  2806. projectId: projectId.value,
  2807. contractId: contractId.value,
  2808. })
  2809. abolishLoaing.value = false
  2810. if (!error && code === 200) {
  2811. window.$message?.success('撤回成功')
  2812. getTableDataAll()
  2813. window?.location?.reload() //刷新页面
  2814. }
  2815. }
  2816. //附件列表
  2817. const attachmentModal = ref(false)
  2818. const attachmentModalShow = () => {
  2819. attachmentModal.value = true
  2820. getAttachmentList()
  2821. }
  2822. const attachmentListLoaing = ref(false)
  2823. const attachmentList = ref([])
  2824. const getAttachmentList = async () => {
  2825. attachmentListLoaing.value = true
  2826. const info = nodeDataInfo.value
  2827. const { error, code, data } = await wbsApi.tablesAndFile({
  2828. primaryKeyId: info?.primaryKeyId || '',
  2829. type: authBtnTabKey.value,
  2830. contractId: contractId.value,
  2831. projectId: projectId.value,
  2832. classify: authBtnTabKey.value,
  2833. })
  2834. attachmentListLoaing.value = false
  2835. if (!error && code === 200) {
  2836. attachmentList.value = getArrValue(data)
  2837. } else {
  2838. attachmentList.value = []
  2839. }
  2840. }
  2841. //预览
  2842. const previewFile = (item) => {
  2843. toPdfPage(item['domainPdfUrl'])
  2844. //window.open(item['domainPdfUrl'], '_blank')
  2845. }
  2846. //删除
  2847. const delFile = async (item) => {
  2848. item.loading = true
  2849. const { error, code, msg } = await wbsApi.removeBussFile({
  2850. ids: item.id,
  2851. })
  2852. item.loading = false
  2853. if (!error && code === 200) {
  2854. window?.$message?.success('删除成功')
  2855. getAttachmentList()
  2856. getTableDataAll()
  2857. return true
  2858. } else {
  2859. window.$message.error(msg)
  2860. return false
  2861. }
  2862. }
  2863. //划分变更
  2864. const divisionClick = () => {
  2865. router.push({
  2866. path: '/data-fill/division',
  2867. })
  2868. }
  2869. //树展开和收起
  2870. const isWbsTreeShow = ref(true)
  2871. const setWbsTreeShow = () => {
  2872. isWbsTreeShow.value = !isWbsTreeShow.value
  2873. }
  2874. //拷贝内容
  2875. const copyPositionText = (val) => {
  2876. if (val) {
  2877. //navigator.clipboard.writeText(val);
  2878. setCopyText(val)
  2879. .then(() => {
  2880. window.$message?.success('复制成功')
  2881. })
  2882. .catch(() => {
  2883. window.$message?.error('复制失败,请手动复制')
  2884. })
  2885. } else {
  2886. window.$message?.warning('没有可复制的数据')
  2887. }
  2888. }
  2889. //左右拖动,改变树形结构宽度
  2890. const isMouseTree = ref(false)
  2891. const onmousedown = () => {
  2892. let leftNum = 0
  2893. if (isLayout.value === 'no') {
  2894. leftNum = 0
  2895. } else {
  2896. leftNum = isCollapse.value ? 142 : 272
  2897. }
  2898. isMouseTree.value = true
  2899. document.onmousemove = async (ve) => {
  2900. let diffVal = ve.clientX - leftNum
  2901. if (diffVal >= 310 && diffVal <= 900) {
  2902. leftWidth.value = diffVal
  2903. }
  2904. }
  2905. document.onmouseup = () => {
  2906. document.onmousemove = null
  2907. document.onmouseup = null
  2908. isMouseTree.value = false
  2909. }
  2910. }
  2911. //更新配置
  2912. watch(
  2913. () => leftWidth.value,
  2914. (diffVal) => {
  2915. setUserConfig(diffVal)
  2916. },
  2917. )
  2918. const setUserConfig = async (data) => {
  2919. await useClick()
  2920. useAppState.setTreeWidth(data)
  2921. await userConfigSave({ treeWidth: data })
  2922. }
  2923. //同步质检资料
  2924. const syncdataloading = ref(false)
  2925. const syncdata = async () => {
  2926. ListItemRef.value?.setActiveKey('')
  2927. const info = nodeDataInfo.value
  2928. syncdataloading.value = true
  2929. const { error, code, msg } = await wbsApi.syncTbadata({
  2930. pKeyId: info?.primaryKeyId || '',
  2931. })
  2932. syncdataloading.value = false
  2933. if (!error && code === 200) {
  2934. window.$message?.success(msg)
  2935. getTableDataAll()
  2936. // window?.location?.reload() //刷新页面
  2937. }
  2938. }
  2939. //同步工序资料
  2940. const syncWorkloading = ref(false)
  2941. const syncWork = async () => {
  2942. ListItemRef.value?.setActiveKey('')
  2943. const info = nodeDataInfo.value
  2944. syncdataloading.value = true
  2945. const { error, code, msg } = await wbsApi.syncWorkDate({
  2946. nodeId: info?.primaryKeyId || '',
  2947. })
  2948. syncdataloading.value = false
  2949. if (!error && code === 200) {
  2950. window.$message?.success(msg)
  2951. getTableDataAll()
  2952. // window?.location?.reload() //刷新页面
  2953. }
  2954. }
  2955. //附件添加
  2956. const typeoptions = ref([
  2957. {
  2958. value: '1',
  2959. label: '模板1',
  2960. },
  2961. {
  2962. value: '2',
  2963. label: '模板2',
  2964. },
  2965. ])
  2966. const getFileTypeApi = async () => {
  2967. const { data } = await getDictionaryBiz({
  2968. code: 'table_file_type',
  2969. })
  2970. //处理数据
  2971. let newArr = []
  2972. const newData = getArrValue(data)
  2973. for (let i = 0; i < newData.length; i++) {
  2974. newArr.push({
  2975. label: newData[i]['dictValue'],
  2976. value: Number(newData[i]['dictKey']),
  2977. })
  2978. }
  2979. typeoptions.value = newArr
  2980. }
  2981. const typevalue = ref('')
  2982. const isCanadd = ref(true)
  2983. const uploadModal = ref(false)
  2984. const fileListData = ref([])
  2985. const uploadData = ref({})
  2986. const uploadModalClose = () => {
  2987. uploadModal.value = false
  2988. typevalue.value = ''
  2989. }
  2990. //获取附件添加列表
  2991. const getBussFileList = async (pkeyId) => {
  2992. const { error, code, data } = await wbsApi.selectTableFileListByTen({
  2993. pkeyid: pkeyId,
  2994. classify: authBtnTabKey.value,
  2995. })
  2996. if (!error && code === 200) {
  2997. fileListData.value = getArrValue(data)
  2998. } else {
  2999. fileListData.value = []
  3000. }
  3001. }
  3002. const addFilelist = async () => {
  3003. getBussFileList(primaryKeyId.value)
  3004. uploadModal.value = true
  3005. await getFileTypeApi()
  3006. //上传的配置
  3007. uploadData.value = {
  3008. classify: authBtnTabKey.value,
  3009. nodeId: primaryKeyId.value,
  3010. type: typevalue.value,
  3011. contractId: contractId.value,
  3012. }
  3013. }
  3014. const changeType = (val) => {
  3015. uploadData.value.type = val
  3016. }
  3017. //上传文件
  3018. const uploadChange = async ({ type }) => {
  3019. if (type === 'success') {
  3020. getBussFileList(primaryKeyId.value)
  3021. } else if (type === 'del') {
  3022. getBussFileList(primaryKeyId.value)
  3023. }
  3024. }
  3025. //树节点被选中
  3026. const treeSelectNode = ref([])
  3027. const treeSelectdata = ref([])
  3028. const ElTreeNodeCheck = (_, { checkedKeys, checkedNodes }) => {
  3029. console.log(checkedNodes, 'checkedNodes')
  3030. treeSelectNode.value = getArrValue(checkedKeys)
  3031. treeSelectdata.value = getArrValue(checkedNodes)
  3032. }
  3033. //隐藏节点
  3034. const hideSaveLoading = ref(false)
  3035. const hideTreeNode = async () => {
  3036. const arr = getArrValue(treeSelectdata.value)
  3037. if (arr.length <= 0) {
  3038. window?.$message?.warning('请先在左侧项目树选择节点')
  3039. return
  3040. }
  3041. let isExist = false
  3042. for (let i = 0; i < arr.length; i++) {
  3043. if ([2, 3, 4].includes(arr[i].colorStatus)) {
  3044. isExist = true
  3045. break
  3046. }
  3047. }
  3048. if (isExist) {
  3049. window.$message.warning('已审批和已填报-待审批状态的节点,不可隐藏;')
  3050. return
  3051. }
  3052. const keys = arrToKey(treeSelectdata.value, 'pKeyId', ',')
  3053. //发起请求
  3054. hideSaveLoading.value = true
  3055. const { error, code, msg } = await wbsApi.updateNodeStates(
  3056. {
  3057. ids: keys,
  3058. status: 2,
  3059. },
  3060. false,
  3061. )
  3062. hideSaveLoading.value = false
  3063. if (!error && code === 200) {
  3064. window?.$message?.success(msg || '操作成功')
  3065. setTimeout(() => {
  3066. window?.location?.reload() //刷新页面
  3067. }, 1000)
  3068. }
  3069. }
  3070. const loadMenu = ({ node, item, level }, resolve) => {
  3071. setElTreeMenu(contractInfo.value?.contractType)
  3072. let menusArr = ElTreeMenu.value
  3073. //const { isCustomChild, notExsitChild } = item //isCustomChild===1//代表子级是自定义节点
  3074. // const { isCustom } = item
  3075. // if (isCustom === 1 && isCustomChild === 0 && notExsitChild) {//无子级,显示两个按钮
  3076. // menusArr.unshift( { icon: 'add-circle', label: '新增自定义节点', key: 'add1' })
  3077. // resolve(menusArr)
  3078. // } else if (isCustom === 1 && isCustomChild === 1) {//自定义节点类型下如果有自定义节点,就不允许新增节点
  3079. // menusArr.unshift( { icon: 'add-circle', label: '新增自定义节点', key: 'add1' })
  3080. // let menusArr1 = arrDelKey(menusArr, 'label', '新增节点') // [{id:1}]
  3081. // resolve(menusArr1)
  3082. // } else if (isCustom === 1 && isCustomChild === 0 && !notExsitChild) { //自定义节点类型下如果有划分节点,就不允许新增自定义节点
  3083. // resolve(menusArr)
  3084. // } else if (level === 1) {
  3085. // menusArr = [ { icon: 'add-circle', label: '新增自定义节点', key: 'add1' }]
  3086. // resolve(menusArr)
  3087. // } else {
  3088. // resolve(menusArr)
  3089. // }
  3090. if (level === 1) {
  3091. menusArr = [
  3092. {
  3093. icon: 'add-circle',
  3094. label: '自定义节点(水利工程)',
  3095. key: 'add1',
  3096. },
  3097. {
  3098. icon: 'add-circle',
  3099. label: '自定义节点(数字化文件)',
  3100. key: 'add2',
  3101. },
  3102. ]
  3103. resolve(menusArr)
  3104. } else {
  3105. resolve(menusArr)
  3106. }
  3107. }
  3108. //批量保存
  3109. const nodeSaveLoading = ref(false)
  3110. const NodeSaveClick = async () => {
  3111. const keys = treeSelectNode.value
  3112. const rows = treeSelectdata.value
  3113. if (rows.length <= 0 || keys.length <= 0) {
  3114. window?.$message?.warning('请先在左侧项目树选择节点')
  3115. return
  3116. }
  3117. //判断是否满足条件
  3118. let result = false
  3119. if (!website.localModel) {
  3120. result = rows.every(({ colorStatus }) => {
  3121. return colorStatus === 1 || colorStatus === 2
  3122. })
  3123. } else {
  3124. //183 甬台温
  3125. result = rows.every(({ colorStatus }) => {
  3126. return colorStatus === 1 || colorStatus === 2 || colorStatus === 4
  3127. })
  3128. }
  3129. if (!result) {
  3130. window?.$message?.warning('只能选择未上报的节点进行辅助保存')
  3131. return
  3132. }
  3133. //发起请求
  3134. nodeSaveLoading.value = true
  3135. const { error, code, msg } = await wbsApi.save_nodeId(
  3136. {
  3137. projectId: projectId.value,
  3138. contractId: contractId.value,
  3139. classify: authBtnTabKey.value,
  3140. nodeIds: keys.join(),
  3141. },
  3142. false,
  3143. )
  3144. nodeSaveLoading.value = false
  3145. if (!error && code === 200) {
  3146. window?.$message?.success('批量保存成功')
  3147. window?.location?.reload() //刷新页面
  3148. }
  3149. }
  3150. //排序
  3151. const tableSortFormRef = ref(null)
  3152. const sortFormShow = ref(false)
  3153. const tableSortFormColumn = [{ key: 'nodeName', name: '名称' }]
  3154. const tableSortFormData = ref([])
  3155. const sortFormClick = () => {
  3156. sortFormShow.value = true
  3157. tableSortFormData.value = deepClone(ListItemDatas.value)
  3158. }
  3159. // 行拖拽
  3160. const sortFormDropTap = (rows) => {
  3161. tableSortFormData.value = [] // 先清空,否则排序会异常
  3162. nextTick(() => {
  3163. tableSortFormRef.value?.setData(rows)
  3164. })
  3165. }
  3166. // 点击排序
  3167. const rowSortFormTap = (rows) => {
  3168. tableSortFormData.value = [] // 先清空,否则排序会异常
  3169. nextTick(() => {
  3170. tableSortFormData.value = rows
  3171. })
  3172. }
  3173. //关闭排序
  3174. const sortFormClose = () => {
  3175. sortFormShow.value = false
  3176. sortFormLoading.value = false
  3177. tableSortFormData.value = []
  3178. }
  3179. //提交排序
  3180. const sortFormLoading = ref(false)
  3181. const sortFormSubmit = async () => {
  3182. const treeId = primaryKeyId.value
  3183. if (isNullES(treeId)) {
  3184. window?.$message?.warning('请先在左侧项目树选择一个节点')
  3185. return
  3186. }
  3187. const rows = tableSortFormData.value
  3188. const ids = arrToKey(rows, 'pkeyId')
  3189. //发起请求
  3190. sortFormLoading.value = true
  3191. const { error, code, msg } = await wbsApi.formTableSort(
  3192. {
  3193. projectId: projectId.value,
  3194. contractId: contractId.value,
  3195. classify: authBtnTabKey.value,
  3196. nodeIds: treeId,
  3197. ids: ids,
  3198. },
  3199. false,
  3200. )
  3201. sortFormLoading.value = false
  3202. if (!error && code === 200) {
  3203. window?.$message?.success('操作成功')
  3204. window?.location?.reload() //刷新页面
  3205. }
  3206. }
  3207. </script>
  3208. <style lang="scss" scoped>
  3209. @import "../../styles/data-fill/wbs.scss";
  3210. .hc-add-node-modal-foot-box {
  3211. position: relative;
  3212. display: flex;
  3213. align-items: center;
  3214. .left-box {
  3215. position: relative;
  3216. flex: 1;
  3217. display: flex;
  3218. align-items: center;
  3219. }
  3220. .right-box {
  3221. position: relative;
  3222. }
  3223. }
  3224. .hc-expansion-contraction-tree {
  3225. position: absolute;
  3226. left: -13px;
  3227. top: 0;
  3228. width: 10px;
  3229. height: 100%;
  3230. user-select: none;
  3231. cursor: pointer;
  3232. display: flex;
  3233. justify-content: center;
  3234. align-items: center;
  3235. color: #8c9099;
  3236. font-size: 22px;
  3237. border-radius: 5px;
  3238. transition: background 0.2s;
  3239. background: rgba(255, 255, 255, 0);
  3240. &:hover {
  3241. background: #f1f5f8;
  3242. color: var(--el-color-primary);
  3243. }
  3244. }
  3245. .hc-table-form-action-tip {
  3246. position: absolute;
  3247. bottom: 77px;
  3248. width: 100%;
  3249. }
  3250. .data-fill-wbs-hide-btn {
  3251. background: #fff;
  3252. color: #ffffff;
  3253. }
  3254. html.dark .data-fill-wbs-hide-btn {
  3255. background: #141414;
  3256. color: #141414;
  3257. }
  3258. html.theme-dark {
  3259. .bg-svg-xml {
  3260. background-color: initial;
  3261. background-image: initial;
  3262. }
  3263. .hc-layout-box
  3264. .hc-layout-content-box
  3265. .hc-card-max-h-box.node-tree
  3266. .hc-tree-foot-tip-box {
  3267. border-top: 1px solid #303030;
  3268. }
  3269. }
  3270. </style>
  3271. <style lang="scss">
  3272. .hc-tree-box .el-tree-node {
  3273. .el-checkbox {
  3274. margin-right: 0;
  3275. .el-checkbox__inner {
  3276. display: none;
  3277. }
  3278. }
  3279. .is-leaf + .el-checkbox {
  3280. margin-right: 8px;
  3281. .el-checkbox__inner {
  3282. display: inline-block;
  3283. }
  3284. }
  3285. }
  3286. .data-fill-wbs-content {
  3287. position: relative;
  3288. height: 100%;
  3289. .n-drawer-container {
  3290. margin: -20px -24px;
  3291. }
  3292. .n-drawer.n-drawer--top-placement {
  3293. height: auto !important;
  3294. background-color: initial;
  3295. pointer-events: none;
  3296. bottom: 0;
  3297. }
  3298. .drawer-data-fill-content-box {
  3299. position: relative;
  3300. height: 100%;
  3301. padding: 24px;
  3302. .n-card {
  3303. pointer-events: auto;
  3304. height: 100%;
  3305. overflow: auto;
  3306. }
  3307. .data-fill-content {
  3308. position: relative;
  3309. height: 100%;
  3310. overflow-y: auto;
  3311. scroll-behavior: smooth;
  3312. .data-fill-list-box .data-fill-list-item-content {
  3313. height: calc(100vh - 470px);
  3314. .data-fill-table-form-box {
  3315. height: 100%;
  3316. }
  3317. }
  3318. }
  3319. .data-fill-foot {
  3320. position: relative;
  3321. text-align: center;
  3322. }
  3323. }
  3324. }
  3325. .n-card.hc-card-overflow-box .n-card__content {
  3326. padding: 24px;
  3327. }
  3328. .n-card.hc-custom-card > .n-card-header {
  3329. padding: 15px 24px;
  3330. }
  3331. .n-card.hc-custom-card.copy {
  3332. width: 1200px;
  3333. max-height: 90vh;
  3334. overflow: auto;
  3335. .n-card-header .n-card-header__close {
  3336. display: none;
  3337. }
  3338. &.one {
  3339. width: 600px;
  3340. }
  3341. &.many {
  3342. width: 1200px;
  3343. }
  3344. }
  3345. .img-preview-box {
  3346. position: relative;
  3347. height: 100%;
  3348. width: 100%;
  3349. }
  3350. .hc-layout-content-box {
  3351. position: relative;
  3352. }
  3353. .iscusor {
  3354. cursor: pointer;
  3355. }
  3356. .hc-table-form-action-tip .hc-alert {
  3357. background-color: #f1f5f8;
  3358. display: inline;
  3359. vertical-align: middle;
  3360. box-shadow: -2px 0 10px 0 rgba(32, 37, 50, 0.03),
  3361. 0 10px 21px 20px rgba(32, 37, 50, 0.03);
  3362. }
  3363. .copy-node-form-box {
  3364. margin-top: 24px;
  3365. padding-top: 24px;
  3366. border-top: 1px solid #efeff5;
  3367. }
  3368. .hc-position-input-icon {
  3369. position: relative;
  3370. margin-bottom: 0;
  3371. .el-form-item__content {
  3372. position: relative;
  3373. .el-textarea .el-textarea__inner {
  3374. padding-right: 30px;
  3375. }
  3376. .hc-icon-i {
  3377. position: absolute;
  3378. right: 10px;
  3379. bottom: 0;
  3380. font-size: 20px;
  3381. cursor: pointer;
  3382. color: #0081ff;
  3383. opacity: 1;
  3384. transition: opacity 0.2s;
  3385. &:hover {
  3386. opacity: 0.5;
  3387. }
  3388. }
  3389. }
  3390. }
  3391. </style>