wbs.vue 129 KB

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