wbs.vue 131 KB

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