tree.vue 116 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892
  1. <template>
  2. <div style="height: 100%;">
  3. <basic-container v-show="showType == 1" >
  4. <el-row class="titlerow">
  5. <el-col >
  6. <div style="position:relative" >
  7. <span style="float: left; margin-top: 15px;color: white;">{{projectName }}</span>
  8. <!-- 同步按钮 -->
  9. <el-button
  10. size="medium"
  11. icon="el-icon-arrow-down"
  12. style="margin-right:10px"
  13. @click="showSyncbtn"
  14. v-show="!isshowSyncbtn"
  15. >数据同步</el-button >
  16. <el-button
  17. size="medium"
  18. icon="el-icon-arrow-up"
  19. style="margin-right:10px"
  20. @click="showSyncbtn"
  21. v-show="isshowSyncbtn"
  22. >数据同步</el-button >
  23. <!-- <el-select v-model="menuvalue" placeholder="数据同步" class="selectBtn" v-if="isshowSyncbtn">
  24. <el-option
  25. v-for="item in menuoptions"
  26. :key="item.value"
  27. :label="item.label"
  28. :value="item.value">
  29. <span style="float: left">{{ item.label }}</span>
  30. </el-option>
  31. </el-select> -->
  32. <ul
  33. v-show="isshowSyncbtn"
  34. class="contextmenu selectBtn"
  35. >
  36. <li v-for="item in menuoptions" :key="item" @click="menuClick($event,item,data)" v-loading="item.load">
  37. {{item.label}}
  38. </li>
  39. </ul>
  40. <el-button
  41. size="medium"
  42. icon="el-icon-s-grid"
  43. @click="eleFormulaHandle"
  44. v-if="leftType == 5"
  45. >表单设置</el-button
  46. >
  47. <el-button
  48. size="medium"
  49. icon="el-icon-s-grid"
  50. @click="eleHandle"
  51. v-else
  52. >元素设置</el-button
  53. >
  54. <!-- <el-button
  55. class="el-btn-purple"
  56. type="primary"
  57. size="medium"
  58. icon="el-icon-upload"
  59. :loading="syncBtnLoad"
  60. @click="syncInfoHandle"
  61. >同步节点参数</el-button
  62. > -->
  63. <el-button
  64. size="medium"
  65. icon="el-icon-help"
  66. @click="nodeInfoHandle"
  67. >节点参数设置</el-button
  68. >
  69. <el-button
  70. style="margin-top:10px"
  71. size="medium"
  72. icon="el-icon-price-tag"
  73. @click="independent"
  74. >独立表单库</el-button
  75. >
  76. <el-button
  77. style="margin-top:10px"
  78. size="medium"
  79. icon="el-icon-time"
  80. @click="archiveTimeClick"
  81. >归档文件时间设置</el-button
  82. >
  83. <!-- <el-button
  84. :loading="syncElectricLoad"
  85. style="margin-top:10px"
  86. class="el-btn-purple"
  87. type="primary"
  88. size="medium"
  89. icon="el-icon-upload"
  90. @click="syncElectric"
  91. >同步电签默认信息</el-button
  92. > -->
  93. </div>
  94. </el-col>
  95. </el-row>
  96. <el-row :gutter="20" class="h-100p" style="padding:10px">
  97. <el-col :span="10" class="h-100p">
  98. <div class="h-100p flex flex-d-c">
  99. <p style="margin-top:2px">工程节点信息</p>
  100. <div class="flex " style="align-items: center;justify-content: space-between;">
  101. <el-input
  102. placeholder="输入关键字进行过滤"
  103. v-model="filterText"
  104. clearable
  105. style="width: 65%;margin-right: 15px;"
  106. @clear="clearSearch"
  107. ></el-input>
  108. <el-switch
  109. v-model="searchType"
  110. active-value="1"
  111. inactive-value="2"
  112. inline-prompt
  113. active-text="按节点"
  114. inactive-text="按表名"
  115. />
  116. <el-button type="primary" @click="searchTreeClick">搜索</el-button>
  117. </div>
  118. <div class="flex1 ov-hidden">
  119. <el-scrollbar class="h-100p">
  120. <div v-loading="treeLoad">
  121. <el-tree
  122. class="filter-tree"
  123. lazy
  124. :load="loadNode"
  125. @node-click="getNodeDetail"
  126. :props="defaultProps"
  127. :expand-on-click-node="false"
  128. highlight-current
  129. node-key="id"
  130. ref="tree"
  131. :default-expanded-keys="defaultExpandedKeys"
  132. v-show="!isSearch"
  133. >
  134. <span
  135. class="custom-tree-node "
  136. :class="data.moreShow ? 'show' : ''"
  137. slot-scope="{ node, data }"
  138. @mouseleave="mouseout(data)"
  139. >
  140. <div class="pd-r-20 " >
  141. {{ node.label }}
  142. <div class="normal-black ">
  143. <div >
  144. <el-link :underline="false">
  145. <i
  146. class="el-icon-menu "
  147. @click="showMenu($event,data, node)"
  148. v-if="node.level != 1"
  149. ></i>
  150. </el-link>
  151. <!-- 因右键自定义菜单事件需要获取当前点击的位置,所以此处绑定动态样式来控制菜单实时跟踪鼠标右键点击位置 -->
  152. <ul
  153. v-show="menuvisible"
  154. :style="{ left: menuleft + 'px', top: menutop + 'px' }"
  155. class="contextmenu"
  156. >
  157. <li v-for="item in menusData" :key="item" @click="menuClick($event,item,data)">
  158. <i :class="item.icon"></i>
  159. <el-tooltip class="item" effect="light" :content="item.content" placement="right-start">
  160. <span>{{item.label}}</span>
  161. </el-tooltip>
  162. </li>
  163. </ul>
  164. </div>
  165. </div>
  166. </div>
  167. </span>
  168. </el-tree>
  169. <el-tree
  170. :load="searchtreeLoad"
  171. :data="searchTreeData"
  172. @node-click="getNodeDetail"
  173. :props="defaultProps"
  174. :expand-on-click-node="false"
  175. highlight-current
  176. node-key="id"
  177. v-show="isSearch"
  178. default-expand-all
  179. >
  180. <span
  181. class="custom-tree-node "
  182. :class="data.moreShow ? 'show' : ''"
  183. slot-scope="{ node, data }"
  184. @mouseleave="mouseout(data)"
  185. >
  186. <div class="pd-r-20 " >
  187. {{ node.label }}
  188. <div class="normal-black ">
  189. <div >
  190. <el-link :underline="false">
  191. <i
  192. class="el-icon-menu "
  193. @click="showMenu($event,data, node)"
  194. v-if="node.level != 1"
  195. ></i>
  196. </el-link>
  197. <ul
  198. v-show="menuvisible"
  199. :style="{ left: menuleft + 'px', top: menutop + 'px' }"
  200. class="contextmenu"
  201. >
  202. <li v-for="item in menusData" :key="item" @click="menuClick($event,item,data)">
  203. <i :class="item.icon"></i>{{item.label}}
  204. </li>
  205. </ul>
  206. </div>
  207. </div>
  208. </div>
  209. </span>
  210. </el-tree>
  211. </div>
  212. </el-scrollbar>
  213. </div>
  214. </div>
  215. </el-col>
  216. <el-col :span="14" class="h-100p flex flex-d-c">
  217. <template v-if="leftType == 5">
  218. <div class="mg-b-10">节点信息</div>
  219. <div>
  220. <el-table :data="tableData" border style="width: 100%">
  221. <el-table-column
  222. align="center"
  223. prop="nodeName"
  224. label="当前节点"
  225. ></el-table-column>
  226. <el-table-column
  227. align="center"
  228. prop="nodeType"
  229. :formatter="formatCat"
  230. label="节点类型"
  231. width="180"
  232. ></el-table-column>
  233. <el-table-column
  234. align="center"
  235. prop="parentName"
  236. label="上级节点"
  237. ></el-table-column>
  238. </el-table>
  239. </div>
  240. <div class="flex jc-sb">
  241. <p>
  242. <span>当前项目信息表</span>
  243. <!-- <el-button
  244. @click="showFormElement"
  245. type="text"
  246. icon="el-icon-circle-plus-outline"
  247. class="text-icon mg-l-10"
  248. ></el-button>
  249. <el-button
  250. type="text"
  251. icon="el-icon-document-copy"
  252. class="text-icon"
  253. ></el-button> -->
  254. <el-button
  255. type="text"
  256. style="margin-left: 10px"
  257. icon="el-icon-edit-outline"
  258. class="text-icon"
  259. @click="editEditElementForm()"
  260. ></el-button>
  261. <el-button
  262. type="text"
  263. icon="el-icon-sort"
  264. class="text-icon"
  265. @click="privateTableSort()"
  266. ></el-button>
  267. </p>
  268. <div class="mg-t-10"></div>
  269. </div>
  270. <div style="flex: 1; position: relative">
  271. <el-table
  272. :data="formData"
  273. border
  274. height="100%"
  275. style="width: 100%; position: absolute"
  276. >
  277. <el-table-column
  278. align="center"
  279. prop="tableName"
  280. label="表单名称"
  281. ></el-table-column>
  282. <el-table-column
  283. align="center"
  284. prop="elementTotal"
  285. width="80"
  286. label="字段总量"
  287. ></el-table-column>
  288. <el-table-column
  289. align="center"
  290. prop="fillRate"
  291. width="100"
  292. label="填报率"
  293. ></el-table-column>
  294. <el-table-column
  295. align="center"
  296. prop="tableType"
  297. :formatter="formatTableType"
  298. width="100"
  299. label="表单类型"
  300. ></el-table-column>
  301. <el-table-column
  302. align="center"
  303. prop="tableOwner"
  304. :formatter="formatOwner"
  305. label="所属方"
  306. ></el-table-column>
  307. <el-table-column label="操作" width="240">
  308. <template slot-scope="scope">
  309. <el-button
  310. size="mini"
  311. @click="handleEdit(scope.$index, scope.row)"
  312. >预览</el-button
  313. >
  314. <el-button
  315. size="mini"
  316. type="primary"
  317. v-throttle="3000"
  318. v-show="scope.row.status == 0"
  319. @click="hideMD(scope.row)"
  320. >取消隐藏</el-button
  321. >
  322. <el-button
  323. size="mini"
  324. type="primary"
  325. v-throttle="3000"
  326. v-show="scope.row.status == 1"
  327. @click="hideMD(scope.row)"
  328. >隐藏表单</el-button
  329. >
  330. <el-button
  331. size="mini"
  332. type="danger"
  333. @click="handleDelete(scope.$index, scope.row)"
  334. >删除</el-button
  335. >
  336. </template>
  337. </el-table-column>
  338. </el-table>
  339. </div>
  340. </template>
  341. <template v-if="leftType == 4">
  342. <div style="flex: 1; position: relative">
  343. <el-table
  344. :data="formData"
  345. border
  346. height="100%"
  347. style="width: 100%; position: absolute"
  348. >
  349. <el-table-column
  350. align="center"
  351. prop="tableName"
  352. label="表单名称"
  353. ></el-table-column>
  354. <el-table-column
  355. align="center"
  356. prop="tableType"
  357. :formatter="formatTableType"
  358. label="表单类型"
  359. ></el-table-column>
  360. <el-table-column
  361. align="center"
  362. prop="fillRate"
  363. label="填报率"
  364. ></el-table-column>
  365. <el-table-column
  366. label="是否关联清表"
  367. prop="isLinkTable"
  368. align="center"
  369. >
  370. <template slot-scope="scope">
  371. <span v-if="scope.row.isLinkTable == 2">是</span>
  372. <span v-else>否</span>
  373. </template>
  374. </el-table-column>
  375. <el-table-column
  376. align="center"
  377. prop="tableOwner"
  378. :formatter="formatOwner"
  379. label="所属方"
  380. ></el-table-column>
  381. <el-table-column label="操作" width="450" align="center">
  382. <template slot-scope="scope">
  383. <el-link type="primary" @click="Associationlist(scope)"
  384. >关联清表</el-link
  385. >
  386. <el-link
  387. class="mg-l-10"
  388. type="primary"
  389. :disabled="scope.row.excelId == -1||scope.row.excelId == null"
  390. @click="
  391. rightClick(
  392. scope.row.pkeyId,
  393. scope.row.excelId,
  394. scope.row.id,
  395. scope.row.initTableName,
  396. scope.row.initTableId
  397. )
  398. "
  399. >编辑元素</el-link
  400. >
  401. <el-link
  402. class="mg-l-10"
  403. type="primary"
  404. :disabled="scope.row.excelId == -1||scope.row.excelId == null"
  405. @click="adjustExcel(scope.row.pkeyId, scope.row.excelId)"
  406. >调整表单</el-link
  407. >
  408. <el-link
  409. class="mg-l-10"
  410. type="primary"
  411. @click="handleEditFormula(scope.$index, scope.row)"
  412. >编辑元素公式.</el-link
  413. >
  414. <el-button
  415. class="mg-l-10"
  416. type="text"
  417. :loading="handlesyncLoad"
  418. @click="handlesync(scope.$index, scope.row)"
  419. >表单同步</el-button>
  420. <el-link
  421. class="mg-l-10"
  422. type="danger"
  423. @click="handleDelete(scope.$index, scope.row)"
  424. >删除表单</el-link
  425. >
  426. </template>
  427. </el-table-column>
  428. </el-table>
  429. </div>
  430. </template>
  431. </el-col>
  432. </el-row>
  433. </basic-container>
  434. <el-row class="h-100p" v-show="showType == 2">
  435. <el-col :span="6" class="h-100p">
  436. <basic-container>
  437. <el-scrollbar class="h-100p">
  438. <el-tree
  439. class="filter-tree"
  440. lazy
  441. :data="typeTreeData"
  442. :load="typeTreeLoadNode"
  443. @node-click="getTypeTreeDetail"
  444. :props="defaultProps"
  445. :expand-on-click-node="false"
  446. highlight-current
  447. node-key="id"
  448. >
  449. </el-tree>
  450. </el-scrollbar>
  451. </basic-container>
  452. </el-col>
  453. <el-col :span="18" class="h-100p">
  454. <basic-container>
  455. <div class="flex h-100p flex-d-c">
  456. <div style="flex: 1; position: relative">
  457. <el-table
  458. :data="formData"
  459. border
  460. height="100%"
  461. style="width: 100%; position: absolute"
  462. >
  463. <el-table-column
  464. align="center"
  465. prop="tableName"
  466. label="表单名称"
  467. ></el-table-column>
  468. <el-table-column
  469. align="center"
  470. prop="tableType"
  471. :formatter="formatTableType"
  472. label="表单类型"
  473. ></el-table-column>
  474. <el-table-column
  475. align="center"
  476. prop="fillRate"
  477. label="填报率"
  478. ></el-table-column>
  479. <el-table-column
  480. label="是否关联清表"
  481. prop="isLinkTable"
  482. align="center"
  483. >
  484. <template slot-scope="scope">
  485. <span v-if="scope.row.isLinkTable == 2">是</span>
  486. <span v-else>否</span>
  487. </template>
  488. </el-table-column>
  489. <el-table-column
  490. align="center"
  491. prop="tableOwner"
  492. :formatter="formatOwner"
  493. label="所属方"
  494. ></el-table-column>
  495. <el-table-column label="操作" align="center">
  496. <template slot-scope="scope">
  497. <el-link type="primary" @click="Associationlist(scope)"
  498. >关联清表</el-link
  499. >
  500. <el-link
  501. class="mg-l-10"
  502. type="primary"
  503. :disabled="scope.row.excelId == -1||scope.row.excelId == null"
  504. @click="
  505. rightClick(
  506. scope.row.pkeyId,
  507. scope.row.excelId,
  508. scope.row.id,
  509. scope.row.initTableName,
  510. scope.row.initTableId
  511. )
  512. "
  513. >编辑元素</el-link
  514. >
  515. <el-link
  516. class="mg-l-10"
  517. type="primary"
  518. :disabled="scope.row.excelId == -1||scope.row.excelId == null"
  519. @click="adjustExcel(scope.row.pkeyId, scope.row.excelId)"
  520. >调整表单</el-link
  521. >
  522. <el-link
  523. class="mg-l-10"
  524. type="primary"
  525. @click="handleEditFormula(scope.$index, scope.row)"
  526. >编辑元素公式</el-link
  527. >
  528. <el-link
  529. class="mg-l-10"
  530. type="danger"
  531. @click="handleDelete(scope.$index, scope.row)"
  532. >删除表单</el-link
  533. >
  534. </template>
  535. </el-table-column>
  536. </el-table>
  537. </div>
  538. <div class="mg-t-10 flex jc-sb">
  539. <div></div>
  540. <el-button size="medium" @click="showType = 1"
  541. >返回WBS树</el-button
  542. >
  543. </div>
  544. </div>
  545. </basic-container>
  546. </el-col>
  547. </el-row>
  548. <!-- 编辑元素表单信息 -->
  549. <el-dialog
  550. title="编辑元素表单信息"
  551. :visible.sync="editElementFormTag"
  552. width="60%"
  553. :modal-append-to-body="false"
  554. >
  555. <div>
  556. <el-table :data="formDatass" border style="width: 100%">
  557. <el-table-column prop="tableName" label="表名">
  558. <template slot-scope="scope">
  559. <el-input
  560. v-model="scope.row.tableName"
  561. placeholder="请输入表名称"
  562. ></el-input>
  563. </template>
  564. </el-table-column>
  565. <el-table-column prop="tableType" label="表类型">
  566. <template slot-scope="scope">
  567. <el-select v-model="scope.row.tableType" placeholder="请选择">
  568. <el-option
  569. v-for="(item, key) in tableTypelist"
  570. :key="key"
  571. :label="item.dictValue"
  572. :value="item.dictKey"
  573. >
  574. </el-option>
  575. </el-select>
  576. </template>
  577. </el-table-column>
  578. <el-table-column prop="tableOwner" label="所属方">
  579. <template slot-scope="scope">
  580. <el-select v-model="scope.row.tableOwner" placeholder="请选择">
  581. <el-option
  582. v-for="(item, key) in ownerTypeList"
  583. :key="key"
  584. :label="item.dictValue"
  585. :value="item.dictKey"
  586. >
  587. </el-option>
  588. </el-select>
  589. </template>
  590. </el-table-column>
  591. <el-table-column prop="fillRate" label="填报率">
  592. <template slot-scope="scope">
  593. <el-input
  594. v-model="scope.row.fillRate"
  595. placeholder="请输入填报率"
  596. ></el-input>
  597. </template>
  598. </el-table-column>
  599. </el-table>
  600. </div>
  601. <span slot="footer" class="dialog-footer">
  602. <el-button @click="editElementFormTag = false">取 消</el-button>
  603. <el-button type="primary" @click="editeditElementFormMF()" :loading="editeditElementFormMFLoading"
  604. >确 定</el-button
  605. >
  606. </span>
  607. </el-dialog>
  608. <!-- 调整表单模板 -->
  609. <div v-if="excelHtml" class="excelHtml">
  610. <dynamicExcel
  611. @remove="removeExcel"
  612. v-if="excelHtml"
  613. :pkeyId="GLExcelFrom.id"
  614. />
  615. </div>
  616. <!-- 私有wbs树排序弹框 -->
  617. <!-- <el-dialog
  618. title="调整排序"
  619. :visible.sync="sortTag"
  620. width="50%"
  621. append-to-body
  622. >
  623. <ManualSorting v-if="sortTag2" @bianhua="bianhua()" :sort="sort" />
  624. <span slot="footer" class="dialog-footer">
  625. <el-button @click="(sortTag = false), (sortTag2 = false)"
  626. >取 消</el-button
  627. >
  628. <el-button type="primary" @click="editSort()">确 定</el-button>
  629. </span>
  630. </el-dialog> -->
  631. <el-dialog
  632. title="调整排序"
  633. :visible.sync="sortTag"
  634. width="50%"
  635. append-to-body
  636. >
  637. <ManualSorting v-if="sortTag2" @bianhua="bianhua()" :sort="sort" />
  638. <span slot="footer" class="dialog-footer">
  639. <el-button @click="(sortTag = false), (sortTag2 = false)"
  640. >取 消</el-button
  641. >
  642. <el-button type="primary" @click="editSort()" v-loading="sureSortload">确 定</el-button>
  643. </span>
  644. </el-dialog>
  645. <!-- 元素表排序 -->
  646. <el-dialog
  647. title="调整排序"
  648. :visible="excelSortTag"
  649. width="50%"
  650. append-to-body
  651. >
  652. <ManualSorting
  653. v-if="excelSortTag2"
  654. @bianhua="bianhua2()"
  655. :sort="tableSortList"
  656. />
  657. <span slot="footer" class="dialog-footer">
  658. <el-button @click="excelSortTag = false">取 消</el-button>
  659. <el-button type="primary" @click="editPrivateSort()" v-loading="surePrivateSortload">确 定</el-button>
  660. </span>
  661. </el-dialog>
  662. <!-- 关联清表 -->
  663. <el-dialog
  664. title="关联清表"
  665. class="excelBox"
  666. :visible.sync="GLExcel"
  667. width="500px"
  668. modal-append-to-body
  669. append-to-body
  670. @close="GLExcelMD"
  671. >
  672. <div>
  673. <el-select
  674. style="width: 400px"
  675. v-model="GLExcelFrom.name"
  676. placeholder="请选择"
  677. @change="changetherr()"
  678. >
  679. <el-option
  680. v-for="(item, key) in GLExcelData"
  681. :key="key"
  682. :label="item.name"
  683. :value="item.id"
  684. >
  685. </el-option>
  686. </el-select>
  687. <el-scrollbar style="margin-top: 20px; height: 50vh">
  688. <el-input
  689. style="width: 400px"
  690. v-model.trim="GLExcelFrom.search"
  691. placeholder="请输入需要选择的内容"
  692. ></el-input>
  693. <el-tree
  694. :filter-node-method="filterNode222"
  695. ref="tree"
  696. class="filter-tree"
  697. style="margin-top: 10px"
  698. :props="GLExcelProps"
  699. :data="exceldata"
  700. node-key="id"
  701. accordion
  702. show-checkbox
  703. @check="checkchange"
  704. v-loading="GLExcelLoading"
  705. >
  706. </el-tree>
  707. </el-scrollbar>
  708. </div>
  709. <span
  710. slot="footer"
  711. class="dialog-footer"
  712. style="display: flex; justify-content: center; align-items: center"
  713. >
  714. <el-button @click="GLExcelMD()">取 消</el-button>
  715. <el-button
  716. style="margin-left: 30px"
  717. type="primary"
  718. v-throttle="2000"
  719. @click="saveLinkTab()"
  720. >确 定</el-button
  721. >
  722. </span>
  723. </el-dialog>
  724. <!-- 节点详情 -->
  725. <el-dialog
  726. :title="dialogTitle"
  727. :visible.sync="dialogVisible"
  728. width="50%"
  729. append-to-body
  730. :close-on-click-modal="false"
  731. @closed="saveNodeLoading = false"
  732. >
  733. <el-form
  734. ref="nodeDetail"
  735. :model="nodeDetail"
  736. :rules="rules"
  737. label-width="140px"
  738. >
  739. <el-form-item label="节点名称" prop="nodeName">
  740. <div class="flex">
  741. <el-input v-model="nodeDetail.nodeName"></el-input>
  742. <el-button class="mg-l-10" type="primary" @click="aliasShow"
  743. >添加别名</el-button
  744. >
  745. </div>
  746. </el-form-item>
  747. <el-form-item label="上级节点">
  748. <el-input v-model="nodeDetail.parentName" disabled></el-input>
  749. </el-form-item>
  750. <el-form-item label="节点类型" prop="nodeType">
  751. <el-select
  752. v-model="nodeDetail.nodeType"
  753. placeholder="请选择"
  754. class="w-100p"
  755. @change="nodeTypeChange"
  756. >
  757. <el-option
  758. v-for="item in nodeTypelist"
  759. :key="item.id"
  760. :label="item.dictValue"
  761. :value="item.dictKey"
  762. ></el-option>
  763. </el-select>
  764. </el-form-item>
  765. <el-form-item label="划分编号" v-if="wbsType !== 2&&wbsType !== 5">
  766. <el-input v-model="nodeDetail.partitionCode"></el-input>
  767. </el-form-item>
  768. <el-form-item label="唯一编码" v-if="wbsType !== 5">
  769. <el-input v-model="nodeDetail.uniqueCode"></el-input>
  770. </el-form-item>
  771. <template v-if="nodeDetail.nodeType == 6">
  772. <el-form-item label="是否有混凝土">
  773. <el-radio-group v-model="nodeDetail.isConcrete" size="small">
  774. <el-radio :label="0" border>无</el-radio>
  775. <el-radio :label="1" border>有</el-radio>
  776. </el-radio-group>
  777. </el-form-item>
  778. <el-form-item label="是否试验节点">
  779. <el-radio-group v-model="nodeDetail.isExpernode" size="small">
  780. <el-radio :label="0" border>否</el-radio>
  781. <el-radio :label="1" border>是</el-radio>
  782. </el-radio-group>
  783. </el-form-item>
  784. </template>
  785. <el-form-item
  786. label="内业资料类型"
  787. prop="majorDataType"
  788. v-if="wbsType !== 2&&wbsType !== 5"
  789. >
  790. <el-select
  791. v-model="nodeDetail.majorDataType"
  792. placeholder="请选择"
  793. class="w-100p"
  794. >
  795. <el-option
  796. v-for="item in majorDataTypeList"
  797. :key="item.id"
  798. :label="item.dictValue"
  799. :value="item.dictKey"
  800. ></el-option>
  801. </el-select>
  802. </el-form-item>
  803. <el-form-item
  804. label="勾选相关联试验"
  805. prop="mixRatioTestIds"
  806. v-if="wbsType === 2 && nodeDetail.nodeType === 53"
  807. >
  808. <div
  809. style="position: relative; height: 300px; border: 1px solid #dddfe6"
  810. >
  811. <el-scrollbar class="h-100p">
  812. <div v-loading="testTreeLoad">
  813. <el-tree
  814. class="filter-tree"
  815. :data="testTreeData"
  816. :props="defaultProps"
  817. :expand-on-click-node="false"
  818. highlight-current
  819. node-key="id"
  820. ref="treeall"
  821. show-checkbox
  822. :default-checked-keys="mixRatioTestIds"
  823. @check="TestTreeCheckChange"
  824. />
  825. </div>
  826. </el-scrollbar>
  827. </div>
  828. </el-form-item>
  829. </el-form>
  830. <span slot="footer" class="dialog-footer">
  831. <el-button @click="dialogVisible = false">取 消</el-button>
  832. <el-button type="primary" @click="saveNode" :loading="saveNodeLoading"
  833. >确 定</el-button
  834. >
  835. </span>
  836. </el-dialog>
  837. <!-- 创建新的元素表 -->
  838. <el-dialog
  839. title="创建新的元素表"
  840. :visible.sync="eleVisible"
  841. width="80%"
  842. append-to-body
  843. :close-on-click-modal="false"
  844. >
  845. <el-form
  846. ref="eleDialog"
  847. :model="eleForm"
  848. :rules="eleRules"
  849. label-width="110px"
  850. >
  851. <el-form-item label="表名" prop="nodeName">
  852. <el-input v-model="eleForm.nodeName"></el-input>
  853. </el-form-item>
  854. <el-row>
  855. <el-col :span="12">
  856. <el-form-item label="表类型" prop="tableType">
  857. <el-select
  858. v-model="eleForm.tableType"
  859. placeholder="请选择"
  860. class="w-100p"
  861. >
  862. <el-option
  863. v-for="item in tableTypelist"
  864. :key="item.id"
  865. :label="item.dictValue"
  866. :value="item.dictKey"
  867. ></el-option>
  868. </el-select>
  869. </el-form-item>
  870. </el-col>
  871. <el-col :span="12">
  872. <el-form-item label="所属方" prop="tableOwner">
  873. <el-select
  874. v-model="eleForm.tableOwner"
  875. placeholder="请选择"
  876. class="w-100p"
  877. >
  878. <el-option
  879. v-for="item in ownerTypeList"
  880. :key="item.id"
  881. :label="item.dictValue"
  882. :value="item.dictKey"
  883. ></el-option>
  884. </el-select>
  885. </el-form-item>
  886. </el-col>
  887. </el-row>
  888. </el-form>
  889. <div class="flex jc-sb">
  890. <div></div>
  891. <div>
  892. <el-link type="primary" @click="importVisible = true"
  893. >快捷导入</el-link
  894. >
  895. <el-link type="primary" class="mg-l-20" @click="downloadTmp"
  896. >下载导入模版</el-link
  897. >
  898. </div>
  899. </div>
  900. <div class="border-grey">
  901. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  902. <el-table
  903. :data="eleForm.elementList"
  904. border
  905. style="width: 100%"
  906. height="400px"
  907. >
  908. <el-table-column
  909. align="center"
  910. type="index"
  911. width="50"
  912. ></el-table-column>
  913. <el-table-column align="center" prop="eName" label="字段名称">
  914. <template slot-scope="scope">
  915. <el-input
  916. v-model="scope.row.eName"
  917. size="small"
  918. placeholder="请输入内容"
  919. ></el-input>
  920. </template>
  921. </el-table-column>
  922. <el-table-column
  923. align="center"
  924. prop="eType"
  925. label="数据类型"
  926. width="120"
  927. >
  928. <template slot-scope="scope">
  929. <el-select
  930. v-model="scope.row.eType"
  931. size="small"
  932. placeholder="请选择"
  933. >
  934. <el-option
  935. v-for="item in dataTypeList"
  936. :key="item.id"
  937. :label="item.dictValue"
  938. :value="item.dictKey"
  939. ></el-option>
  940. </el-select>
  941. </template>
  942. </el-table-column>
  943. <el-table-column
  944. align="center"
  945. prop="eLength"
  946. label="长度"
  947. width="120"
  948. >
  949. <template slot-scope="scope">
  950. <el-input
  951. v-model="scope.row.eLength"
  952. size="small"
  953. placeholder="请输入内容"
  954. :disabled="scope.row.eType == 4"
  955. ></el-input>
  956. </template>
  957. </el-table-column>
  958. <el-table-column
  959. align="center"
  960. prop="eAllowDeviation"
  961. label="允许偏差值"
  962. >
  963. <template slot-scope="scope">
  964. <div class="flex">
  965. <el-select
  966. v-model="scope.row.allow"
  967. size="small"
  968. placeholder="请选择"
  969. style="width: 120px"
  970. >
  971. <el-option :key="1" label="≥" value="≥"></el-option>
  972. <el-option :key="2" label="≤" value="≤"></el-option>
  973. <el-option :key="3" label="±" value="±"></el-option>
  974. <el-option :key="4" label="【】" value="【】"></el-option>
  975. </el-select>
  976. <el-input
  977. v-model="scope.row.deviation"
  978. size="small"
  979. placeholder="请输入内容"
  980. ></el-input>
  981. </div>
  982. </template>
  983. </el-table-column>
  984. <el-table-column
  985. align="center"
  986. prop="eInspectionMethod"
  987. label="检查方法和频率"
  988. >
  989. <template slot-scope="scope">
  990. <el-input
  991. v-model="scope.row.eInspectionMethod"
  992. size="small"
  993. placeholder="请输入内容"
  994. ></el-input>
  995. </template>
  996. </el-table-column>
  997. <el-table-column align="center" label="操作" width="80">
  998. <template slot="header">
  999. <el-button
  1000. @click="addEleRow(eleForm.elementList)"
  1001. type="text"
  1002. icon="el-icon-circle-plus-outline"
  1003. class="text-icon"
  1004. ></el-button>
  1005. </template>
  1006. <template slot-scope="scope">
  1007. <el-button
  1008. icon="el-icon-remove-outline"
  1009. type="text"
  1010. @click="delEleRow(scope.$index, eleForm.elementList)"
  1011. class="text-icon text-icon-danger"
  1012. ></el-button>
  1013. </template>
  1014. </el-table-column>
  1015. </el-table>
  1016. </div>
  1017. <span slot="footer" class="dialog-footer">
  1018. <el-button @click="eleVisible = false">取 消</el-button>
  1019. <el-button type="primary" @click="saveFormAndElementHandle"
  1020. >保 存</el-button
  1021. >
  1022. </span>
  1023. </el-dialog>
  1024. <!-- 模板导入 -->
  1025. <el-dialog
  1026. title="模版导入"
  1027. :visible.sync="importVisible"
  1028. width="50%"
  1029. append-to-body
  1030. :close-on-click-modal="false"
  1031. >
  1032. <p>
  1033. 提示:必须按照系统要求的模版格式上传,否则系统识别无效
  1034. <el-link type="primary" @click="downloadTmp">下载导入模版</el-link>
  1035. </p>
  1036. <div>
  1037. <el-button size="small" type="primary" @click="fileClick2"
  1038. >本地上传</el-button
  1039. >
  1040. <input
  1041. @change="tmpImport"
  1042. type="file"
  1043. hidden
  1044. ref="file2"
  1045. accept=".xls, .xlsx"
  1046. />
  1047. </div>
  1048. <el-table :data="tempList" border style="width: 100%">
  1049. <el-table-column align="center" prop="eName" label="字段信息">
  1050. </el-table-column>
  1051. <el-table-column
  1052. align="center"
  1053. prop="eType"
  1054. label="数据类型"
  1055. width="120"
  1056. >
  1057. </el-table-column>
  1058. <el-table-column align="center" prop="eLength" label="长度" width="120">
  1059. </el-table-column>
  1060. <el-table-column
  1061. align="center"
  1062. prop="eAllowDeviation"
  1063. label="允许偏差值"
  1064. >
  1065. </el-table-column>
  1066. <el-table-column
  1067. align="center"
  1068. prop="eInspectionMethod"
  1069. label="检查方法和频率"
  1070. >
  1071. </el-table-column>
  1072. </el-table>
  1073. <span slot="footer" class="dialog-footer">
  1074. <el-button @click="importVisible = false">取 消</el-button>
  1075. <el-button type="primary" @click="importHandle">确 定</el-button>
  1076. </span>
  1077. </el-dialog>
  1078. <!-- 编辑元素 -->
  1079. <el-dialog
  1080. :title="(curEleTable.tableName ? curEleTable.tableName : '') + ''"
  1081. :visible.sync="editEleVisible"
  1082. width="80%"
  1083. append-to-body
  1084. :close-on-click-modal="false"
  1085. >
  1086. <!-- <p class="font-c-warning">编辑元素信息(请谨慎操作)</p> -->
  1087. <el-table :data="editEleList" border style="width: 100%" height="400px">
  1088. <el-table-column
  1089. align="center"
  1090. type="index"
  1091. width="50"
  1092. ></el-table-column>
  1093. <el-table-column align="center" prop="eName" label="字段信息">
  1094. </el-table-column>
  1095. <el-table-column
  1096. align="center"
  1097. prop="eType"
  1098. label="数据类型"
  1099. width="120"
  1100. :formatter="eTypeFormatter"
  1101. >
  1102. </el-table-column>
  1103. <el-table-column align="center" prop="eLength" label="长度" width="120">
  1104. </el-table-column>
  1105. <el-table-column
  1106. align="center"
  1107. prop="eAllowDeviation"
  1108. label="允许偏差值"
  1109. >
  1110. </el-table-column>
  1111. <el-table-column
  1112. align="center"
  1113. prop="eInspectionMethod"
  1114. label="检查方法和频率"
  1115. >
  1116. </el-table-column>
  1117. </el-table>
  1118. <span slot="footer" class="dialog-footer">
  1119. <el-button @click="editEleVisible = false">取 消</el-button>
  1120. <!-- <el-button
  1121. type="primary"
  1122. @click="saveEles"
  1123. >确 定</el-button> -->
  1124. </span>
  1125. </el-dialog>
  1126. <!-- 元素公式 -->
  1127. <el-dialog
  1128. :title="(curEleTable.tableName?curEleTable.tableName:'')+' 元素公式..'"
  1129. :visible.sync="editEleFormulaVisible"
  1130. width="800px"
  1131. append-to-body
  1132. :close-on-click-modal="false"
  1133. >
  1134. <div class="flex mg-b-10">
  1135. <el-input
  1136. v-model="formulaInput"
  1137. placeholder="请输入名称"
  1138. size="samll"
  1139. clearable
  1140. @clear="searchFormulaName"
  1141. ></el-input>
  1142. <el-button type="info" class="mg-l-10" @click="searchFormulaName"
  1143. >搜索</el-button
  1144. >
  1145. </div>
  1146. <el-table
  1147. :data="editEleListFilter"
  1148. border
  1149. style="width: 100%"
  1150. height="400px"
  1151. >
  1152. <el-table-column align="center" prop="eName" label="字段信息">
  1153. </el-table-column>
  1154. <el-table-column align="center" label="操作" width="200">
  1155. <template slot-scope="scope">
  1156. <el-link
  1157. :type="scope.row.globalFormula == 1 ? 'warning' : 'primary'"
  1158. @click="toFormulaEdit(scope.row,10)"
  1159. >全局公式</el-link
  1160. >
  1161. <el-link
  1162. class="mg-l-10"
  1163. :type="scope.row.isSaveFormula == 1 ? 'warning' : 'primary'"
  1164. @click="toFormulaEdit(scope.row,20)"
  1165. >节点公式</el-link
  1166. >
  1167. <!-- <el-link
  1168. class="mg-l-10"
  1169. type="danger"
  1170. @click="delEleRowHandle(scope.$index,editEleListFilter)"
  1171. >删除</el-link> -->
  1172. </template>
  1173. </el-table-column>
  1174. </el-table>
  1175. </el-dialog>
  1176. <!-- 导入划分 -->
  1177. <el-dialog
  1178. title="导入划分"
  1179. :visible.sync="importTemplateVisible"
  1180. width="800px"
  1181. append-to-body
  1182. :close-on-click-modal="false"
  1183. >
  1184. <div v-loading="importLoading">
  1185. <div>
  1186. <el-link type="primary" @click="handleDownload">下载导入模版</el-link>
  1187. </div>
  1188. <div class="mg-t-20">
  1189. <el-button type="primary" @click="fileClick">选择文件</el-button>
  1190. <span v-if="upFile" class="mg-l-20">{{ upFile.name }}</span>
  1191. <input
  1192. @change="fileChange"
  1193. type="file"
  1194. hidden
  1195. ref="file"
  1196. accept=".xls, .xlsx"
  1197. />
  1198. </div>
  1199. <div v-if="!upFile">当前还未选择文件,请选择需要导入的文件</div>
  1200. </div>
  1201. <span slot="footer" class="dialog-footer">
  1202. <el-button @click="importTemplateVisible = false">取 消</el-button>
  1203. <el-button
  1204. type="primary"
  1205. @click="importTemplateHandle"
  1206. :loading="importLoading"
  1207. >导 入</el-button
  1208. >
  1209. </span>
  1210. </el-dialog>
  1211. <!-- 节点参数 -->
  1212. <el-dialog
  1213. title="节点参数"
  1214. :visible.sync="nodeInfoVisible"
  1215. width="800px"
  1216. append-to-body
  1217. class="jiedian"
  1218. :close-on-click-modal="false"
  1219. :show-close="false"
  1220. @close="closenodeInfoVisible"
  1221. >
  1222. <div>
  1223. <el-button
  1224. type="text"
  1225. icon="el-icon-s-operation"
  1226. class="right-btn"
  1227. @click="setNodeParameters()"
  1228. ></el-button>
  1229. <div class="flexEnd">
  1230. <i
  1231. class="el-icon-circle-plus marbottom10"
  1232. @click="addNodeInfoTable()"
  1233. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1234. ></i>
  1235. <i
  1236. class="el-icon-refresh-right marbottom10"
  1237. @click="refreshnfoTable()"
  1238. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1239. ></i>
  1240. </div>
  1241. <el-table :data="nodeInfoTable" border style="width: 100%" height="400" v-loading="nodeInfoTableLoad">
  1242. <el-table-column align="center" prop="name" label="参数名称">
  1243. <template slot-scope="scope">
  1244. <el-select
  1245. v-model="scope.row.k"
  1246. placeholder="请选择"
  1247. class="w-100p"
  1248. >
  1249. <el-option
  1250. v-for="item in namelist"
  1251. :key="item.k"
  1252. :label="item.name"
  1253. :value="item.k"
  1254. ></el-option>
  1255. </el-select>
  1256. </template>
  1257. </el-table-column>
  1258. <el-table-column align="center" prop="value" label="参数值设置">
  1259. <template slot-scope="scope">
  1260. <el-input v-model="scope.row.v"></el-input>
  1261. </template>
  1262. </el-table-column>
  1263. <el-table-column align="center" prop="describe" label="描述">
  1264. <template slot-scope="scope">
  1265. <el-input v-model="scope.row.remark"></el-input>
  1266. </template>
  1267. </el-table-column>
  1268. <el-table-column label="操作" width="120" align="center">
  1269. <template slot-scope="scope">
  1270. <el-button
  1271. type="text"
  1272. size="small"
  1273. class="text-icon-primary"
  1274. @click="linkEle(scope.row)"
  1275. >关联元素</el-button>
  1276. <el-button
  1277. type="text"
  1278. size="small"
  1279. class="text-icon-danger"
  1280. @click="delNodeInfoss(scope.$index,scope.row)"
  1281. >删除</el-button
  1282. >
  1283. </template>
  1284. </el-table-column>
  1285. </el-table>
  1286. </div>
  1287. <span slot="footer" class="dialog-footer">
  1288. <el-button @click="nodeInfoVisible = false">取 消</el-button>
  1289. <el-button type="primary" @click="nodeInfoSave()" :loading="nodeInfoSaveload">保 存</el-button>
  1290. </span>
  1291. </el-dialog>
  1292. <!-- 设置参数名称 -->
  1293. <el-dialog
  1294. title="设置参数名称"
  1295. :visible.sync="infoNameVisible"
  1296. width="800px"
  1297. append-to-body
  1298. class="jiedian"
  1299. :close-on-click-modal="false"
  1300. >
  1301. <div>
  1302. <div class="flexEnd">
  1303. <i
  1304. class="el-icon-circle-plus marbottom10"
  1305. @click="setParameterName()"
  1306. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1307. ></i>
  1308. </div>
  1309. <el-table :data="namelists" border style="width: 100%" height="400">
  1310. <el-table-column align="center" prop="name" label="参数名称">
  1311. <template slot-scope="scope">
  1312. <el-input v-model="scope.row.name"></el-input>
  1313. </template>
  1314. </el-table-column>
  1315. <el-table-column align="center" prop="key" label="参数值KEY">
  1316. <template slot-scope="scope">
  1317. <el-input v-model="scope.row.k"></el-input>
  1318. </template>
  1319. </el-table-column>
  1320. <el-table-column align="center" prop="describe" label="描述">
  1321. <template slot-scope="scope">
  1322. <el-input v-model="scope.row.remark"></el-input>
  1323. </template>
  1324. </el-table-column>
  1325. <el-table-column label="操作" width="120" align="center">
  1326. <template slot-scope="scope">
  1327. <el-button
  1328. type="text"
  1329. size="small"
  1330. class="text-icon-danger"
  1331. @click="delNodeInfo(scope.$index,scope.row)"
  1332. >删除</el-button
  1333. >
  1334. </template>
  1335. </el-table-column>
  1336. </el-table>
  1337. </div>
  1338. <span slot="footer" class="dialog-footer">
  1339. <el-button @click="addParameterName()">保 存</el-button>
  1340. <el-button @click="closeParameter()">关 闭</el-button>
  1341. </span>
  1342. </el-dialog>
  1343. <el-dialog
  1344. title="别名"
  1345. :visible.sync="aliasVisible"
  1346. width="600px"
  1347. append-to-body
  1348. :close-on-click-modal="false"
  1349. >
  1350. <div>
  1351. <div class="flex">
  1352. <el-input
  1353. v-model="aliasInput"
  1354. placeholder="请输入节点别名"
  1355. ></el-input>
  1356. <el-button class="mg-l-20" type="primary" @click="addAlias"
  1357. >添加</el-button
  1358. >
  1359. </div>
  1360. <div class="flex" style="flex-wrap: wrap">
  1361. <div class="mg-t-10" v-for="(tag, index) in aliasArr" :key="index">
  1362. <el-tag closable @close="delAlias(index)">
  1363. {{ tag }}
  1364. </el-tag>
  1365. <span v-if="index != aliasArr.length - 1">、</span>
  1366. </div>
  1367. </div>
  1368. </div>
  1369. <span slot="footer" class="dialog-footer">
  1370. <el-button @click="aliasVisible = false">取 消</el-button>
  1371. <el-button type="primary" @click="saveAliasHandle">确 定</el-button>
  1372. </span>
  1373. </el-dialog>
  1374. <!-- 节点公式 -->
  1375. <el-dialog
  1376. :title="(curEleTable.tableName?curEleTable.tableName:'')+' 元素公式2'"
  1377. :visible.sync="formulaCompVisible"
  1378. fullscreen
  1379. append-to-body
  1380. class="full-dialog"
  1381. @close="closeformulaComp"
  1382. >
  1383. <FormulaEdit
  1384. :fromcurNode="curTreeData"
  1385. :projectid="projectid"
  1386. :wbsid="id"
  1387. :nodeid="curTreeData.id"
  1388. :eleid="formulaCurRow.id"
  1389. :globaltype="formulaCurRow.globaltype"
  1390. :iswbstype="0"
  1391. @hideDialog="formulaCompVisible = false"
  1392. v-if="formulaCompVisible"
  1393. ></FormulaEdit>
  1394. </el-dialog>
  1395. <!-- 全局公式 -->
  1396. <el-dialog title="" :visible.sync="formulaCompVisible1" fullscreen append-to-body class="full-dialog" @close="closeformulaComp1">
  1397. <FormulaEditone :wbsid="id" :nodeid="curTreeData.id" :eleid="formulaCurRow.id" :elementType="formulaCurRow.elementType" :projectid="projectid" :tableType="istableType"
  1398. :globaltype="formulaCurRow.globaltype" @hideDialog="formulaCompVisible1 = false" :fromcurNode="curEleTable" :iswbstype="0"
  1399. v-if="formulaCompVisible1">
  1400. </FormulaEditone>
  1401. </el-dialog>
  1402. <!-- 编辑元素 -->
  1403. <el-dialog
  1404. title=" "
  1405. :visible.sync="editElementVisible"
  1406. fullscreen
  1407. append-to-body
  1408. class="full-dialog"
  1409. >
  1410. <EditElement
  1411. :editElementQuery="curTreeData"
  1412. :pkeyId="editElementQuery.pkeyId"
  1413. :excelId="editElementQuery.excelId"
  1414. :id="editElementQuery.id"
  1415. :initTableName="editElementQuery.initTableName"
  1416. :pid="editElementQuery.pid"
  1417. :wbsid="editElementQuery.wbsid"
  1418. :initTableId="editElementQuery.initTableId"
  1419. :nodeid="editElementQuery.nodeid"
  1420. @hideDialog="editElementVisible = false"
  1421. @adjustExcel="adjustExcel"
  1422. v-if="editElementVisible"
  1423. ></EditElement>
  1424. </el-dialog>
  1425. <el-dialog
  1426. title="节点参数设置-关联元素"
  1427. :visible.sync="linkEleVisible"
  1428. width="800px"
  1429. append-to-body
  1430. class="jiedian"
  1431. :close-on-click-modal="false"
  1432. >
  1433. <div>
  1434. <el-table
  1435. :data="linkEleTableList"
  1436. border
  1437. style="width: 100%"
  1438. height="400"
  1439. >
  1440. <el-table-column
  1441. align="center"
  1442. prop="tableName"
  1443. label="元素表名"
  1444. >
  1445. </el-table-column>
  1446. <el-table-column
  1447. align="center"
  1448. prop="elementName"
  1449. label="关联元素字段"
  1450. >
  1451. </el-table-column>
  1452. <el-table-column
  1453. label="操作"
  1454. width="160"
  1455. align="center"
  1456. >
  1457. <template slot-scope="scope">
  1458. <el-button v-if="!scope.row.mappingId"
  1459. type="text"
  1460. size="small"
  1461. class="text-icon-primary"
  1462. @click="tolinkEle(scope.row)"
  1463. >选择元素</el-button>
  1464. <el-button v-if="!!scope.row.mappingId"
  1465. type="text"
  1466. size="small"
  1467. class="text-icon-danger"
  1468. @click="delLink(scope.row)"
  1469. >删除关联</el-button>
  1470. </template>
  1471. </el-table-column>
  1472. </el-table>
  1473. </div>
  1474. <span
  1475. slot="footer"
  1476. class="dialog-footer"
  1477. >
  1478. <!-- <el-button @click="saveLinks">保 存</el-button> -->
  1479. <el-button @click="linkEleVisible = false">关 闭</el-button>
  1480. </span>
  1481. </el-dialog>
  1482. <el-dialog
  1483. title="选择关联元素"
  1484. :visible.sync="linkCheckVisible"
  1485. width="600px"
  1486. append-to-body
  1487. class="jiedian"
  1488. :close-on-click-modal="false"
  1489. >
  1490. <div>
  1491. <div class="flex mg-b-20">
  1492. <el-input v-model="linkEleKey" placeholder="请输入元素关键字搜索"></el-input>
  1493. <el-link class="mg-l-20" :underline="false">
  1494. <i class="el-icon-search" style="font-size:20px" @click="searchEle"></i>
  1495. </el-link>
  1496. </div>
  1497. <el-table
  1498. :data="linkEleList"
  1499. border
  1500. style="width: 100%"
  1501. height="400"
  1502. >
  1503. <el-table-column
  1504. align="center"
  1505. prop="eName"
  1506. label="元素名"
  1507. >
  1508. </el-table-column>
  1509. <el-table-column
  1510. label="操作"
  1511. width="55">
  1512. <template slot-scope="scope">
  1513. <el-checkbox v-model="scope.row.checked" @change="value => linkEleCheck(value,scope.$index)"></el-checkbox>
  1514. </template>
  1515. </el-table-column>
  1516. </el-table>
  1517. </div>
  1518. <span
  1519. slot="footer"
  1520. class="dialog-footer"
  1521. >
  1522. <el-button @click="saveLinkEle">保 存</el-button>
  1523. <el-button @click="linkCheckVisible = false">关 闭</el-button>
  1524. </span>
  1525. </el-dialog>
  1526. </div>
  1527. </template>
  1528. <script>
  1529. import ManualSorting from "@/components/WbsTree/ManualSorting";
  1530. import dynamicExcel from "./treeTemplate/dynamicExcel.vue";
  1531. import FormulaEdit from "@/views/formula/edit.vue";
  1532. import FormulaEditone from '@/views/formula/edit1.vue'
  1533. import EditElement from "@/views/manager/projectinfo/editElement/editElement.vue";
  1534. import {
  1535. saveFormAndElement,
  1536. selectFormElements,
  1537. importWbsTree,
  1538. findWbsTreePrivateSameLevel,
  1539. wbsTreePrivateSort,
  1540. parameters,
  1541. saveOrUpdateBatch,
  1542. keymap,
  1543. updateBatchNodeTableInfo2,
  1544. updateStatus,
  1545. getParamElements,
  1546. specifiedParamElements,
  1547. delParamElements, selectPrivateFormElements,syncCurrentFormInProject,getQueryValueByType
  1548. } from "@/api/manager/wbstree";
  1549. import {
  1550. saveElement,
  1551. remove as removeElement,
  1552. updateBatchElements,
  1553. getTemplate,
  1554. importWbsElement,
  1555. } from "@/api/manager/wbsformelement";
  1556. import {
  1557. getLazytree,
  1558. getDetail,
  1559. update,
  1560. findNodeTableByCondition as selectByNodeTable,
  1561. removeTableByCondition as removeTableById,
  1562. removePrivateTreeNode,
  1563. wbsTreePrivateTableSort,
  1564. privateSubmitFullName,
  1565. syncNodeParam,
  1566. syncProjecteVisa,
  1567. syncNodeTable,
  1568. syncNodeinfo,
  1569. tabTypeLazyTree,
  1570. syncContractTabSort
  1571. } from "@/api/manager/wbsprivate";
  1572. import { findProjectTree as getAlltree } from "@/api/manager/projectinfo";
  1573. import { findProjectTreeTrial as getAlltreeTrial } from "@/api/manager/projectinfo";
  1574. import {refrehPram} from "@/api/manager/wbstree"
  1575. import {getTableElments} from "@/api/manager/wbstree";
  1576. import { getList as getAttchFromOriginalName } from "@/api/resource/attach";
  1577. import { getDictionary } from "@/api/system/dict";
  1578. import { mapGetters } from "vuex";
  1579. import {
  1580. getList,
  1581. tabLazytreeAll,
  1582. saveLinkTab,
  1583. getExcelHtml,
  1584. } from "@/api/exctab/excelmodel";
  1585. import { getStore, setStore } from "@/util/store";
  1586. import { log } from '@antv/g2plot/lib/utils';
  1587. export default {
  1588. data() {
  1589. var checkMajorDataType = (rule, value, callback) => {
  1590. //console.log(this.nodeDetail.nodeType)
  1591. //console.log(this.nodeDetail.majorDataType)
  1592. if (this.nodeDetail.nodeType == 6) {
  1593. if (!this.nodeDetail.majorDataType) {
  1594. callback(new Error("工序节点必须选择内业资料类型"));
  1595. }
  1596. }
  1597. callback();
  1598. };
  1599. return {
  1600. fromcurNode:{},
  1601. formDatass: [],
  1602. editElementFormTag: false,
  1603. editeditElementFormMFLoading:false,
  1604. jiedianId: "",
  1605. //#region
  1606. sortTag: false,
  1607. sortTag2: false,
  1608. sureSortload:false,
  1609. surePrivateSortload:false,
  1610. sort:[],
  1611. //#endregion
  1612. //#region 关联清表
  1613. loading: false,
  1614. GLExcel: false,
  1615. GLExcelFrom: {
  1616. id: "",
  1617. name: "",
  1618. search: "", //搜素框舒服的值
  1619. ids: "",
  1620. excelId: "",
  1621. initTableName: "",
  1622. initTableId:""
  1623. },
  1624. GLExcelData: [], //
  1625. GLExcelProps: {
  1626. label: "name",
  1627. children: "children",
  1628. disabled: "hasChildren",
  1629. isLeaf: function (data) {
  1630. let tag = false;
  1631. if (!data.hasChildren) {
  1632. tag = true;
  1633. }
  1634. if (data.isExistForm == 1) {
  1635. tag = true;
  1636. }
  1637. return tag;
  1638. },
  1639. },
  1640. exceldata: [], //清表模板
  1641. GLExcelLoading: false,
  1642. //#endregion
  1643. //#region 调整表单
  1644. adjustmentExcel: "",
  1645. excelHtml: false,
  1646. //#endregion
  1647. //#region
  1648. id: "",
  1649. projectid: "",
  1650. filterText: "",
  1651. treeData: [],
  1652. searchType:'1',
  1653. isSearch:false,
  1654. searchTreeData:[],
  1655. searchtreeLoad:false,
  1656. treeLoad: false,
  1657. menuShow: false,
  1658. defaultProps: {
  1659. children: "children",
  1660. label: "title",
  1661. isLeaf: function (data) {
  1662. //console.log(data, !data.hasChildren, data.isExistForm);
  1663. let tag = false;
  1664. if (!data.hasChildren) {
  1665. tag = true;
  1666. }
  1667. if (data.isExistForm == 1) {
  1668. tag = true;
  1669. }
  1670. if (data.nodeType >= 6 && data.nodeType <= 13) {
  1671. tag = true;
  1672. }
  1673. //中间交工。开工报告、质量评定)
  1674. if (
  1675. data.majorDataType == 1 ||
  1676. data.majorDataType == 2 ||
  1677. data.majorDataType == 3
  1678. ) {
  1679. tag = true;
  1680. }
  1681. return tag;
  1682. // return !data.hasChildren || (data.isExistForm == 1);
  1683. },
  1684. },
  1685. leftType: 5,
  1686. curTreeData: {},
  1687. curTreeNode: {},
  1688. tableData: [],
  1689. nodeDetail: {},
  1690. formData: [],
  1691. editType: 1,
  1692. dialogVisible: false,
  1693. saveNodeLoading: false,
  1694. nodeTypelist: [],
  1695. majorDataTypeList: [],
  1696. rules: {
  1697. nodeName: [
  1698. { required: true, message: "请输入节点名称", trigger: "blur" },
  1699. ],
  1700. nodeType: [
  1701. { required: true, message: "请选择节点类型", trigger: "change" },
  1702. ],
  1703. majorDataType: [{ validator: checkMajorDataType, trigger: "change" }],
  1704. },
  1705. eleVisible: false,
  1706. tableTypelist: [],
  1707. dataTypeList: [],
  1708. ownerTypeList: [],
  1709. eleForm: {
  1710. elementList: [],
  1711. },
  1712. eleRules: {
  1713. nodeName: [
  1714. { required: true, message: "请输入表名称", trigger: "blur" },
  1715. ],
  1716. tableType: [
  1717. { required: true, message: "请选择表类型", trigger: "change" },
  1718. ],
  1719. tableOwner: [
  1720. { required: true, message: "请选择所属方", trigger: "change" },
  1721. ],
  1722. },
  1723. importVisible: false,
  1724. tempList: [],
  1725. curEleTable: {},
  1726. istableType:true,
  1727. editEleVisible: false,
  1728. editEleList: [],
  1729. eleReg: /(≥|≤|±|【】)?([^≥≤±【】]*)/,
  1730. editEleFormulaVisible: false,
  1731. formulaInput: "",
  1732. editEleListFilter: [],
  1733. editEleListAll: [],
  1734. importTemplateVisible: false,
  1735. fileUrl: "",
  1736. upFile: null,
  1737. importLoading: false,
  1738. nodeInfoVisible: false,
  1739. nodeInfoTable: [],
  1740. nodeInfoTableLoad:false,
  1741. namelist: [],
  1742. namelists: [],
  1743. delids:[],
  1744. infoNameVisible: false,
  1745. excelSortTag: false,
  1746. excelSortTag2: false,
  1747. tableSortList: [],
  1748. //#endregion
  1749. defaultExpandedKeys: [],
  1750. expandName: this.$route.fullPath,
  1751. aliasVisible: false, //别名
  1752. aliasInput: "",
  1753. aliasArr: [],
  1754. formulaCompVisible: false, //公式弹框
  1755. formulaCompVisible1:false,
  1756. formulaCurRow: {}, //当前元素
  1757. editElementVisible: false, //编辑元素弹框
  1758. editElementQuery: {
  1759. pkeyId: "",
  1760. excelId: "",
  1761. id: "",
  1762. initTableName: "",
  1763. initTableId:"",
  1764. pid: "",
  1765. wbsid: "",
  1766. nodeid: ""
  1767. }, //传参
  1768. syncBtnLoad: false,
  1769. syncElectricLoad:false,
  1770. showType: 1,
  1771. typeTreeData: [],
  1772. testTreeLoad: false,
  1773. testTreeData: [],
  1774. mixRatioTestIds: [],
  1775. //节点参数,关联元素
  1776. curParam:{},//当前节点参数
  1777. linkEleVisible:false,
  1778. linkEleTableList:[],//元素表数组
  1779. curLinkEleTable:{},//当前元素表
  1780. linkCheckVisible:false,//关联弹框
  1781. linkEleList:[],//元素数组
  1782. linkEleKey:'',//搜索关键字
  1783. menusData:[
  1784. // {icon: 'el-icon-s-promotion', label: '新增节点', key: "add"},
  1785. {icon: 'el-icon-s-promotion', label: '编辑节点', key: "edit",content:'编辑节点'},
  1786. {icon: 'el-icon-upload', label: '同步新增元素表单', key: "sync1",content:'同步新增元素表单'},
  1787. {icon: 'el-icon-upload', label: '同步元素表单排序到合同段', key: "sync3",content:'同步元素表单排序到合同段'},
  1788. {icon: 'el-icon-s-promotion', label: '同步节点基础信息及表单URL', key: "sync2",content:'同步节点的基础信息、类型名称、表单url等信息'},
  1789. {icon: 'el-icon-sort', label: '调整排序', key: "sort",content:'调整排序'},
  1790. {icon: 'el-icon-s-promotion', label: '删除节点', key: "del",content:'删除节点'},
  1791. ],//树组件操作菜单
  1792. menuvisible:false,
  1793. menuleft:20,
  1794. menutop:0,
  1795. //同步菜单按钮
  1796. menuoptions:[
  1797. {
  1798. value: 'jdSync',
  1799. label: '节点参数同步',
  1800. load:false,
  1801. }, {
  1802. value: 'dqSync',
  1803. label: '电签同步',
  1804. load:false,
  1805. },
  1806. {
  1807. value: 'gsSync',
  1808. label: '公式同步',
  1809. load:false,
  1810. },
  1811. ],
  1812. menuvalue: '',
  1813. isshowSyncbtn:false,
  1814. projectName:'',
  1815. nodeInfoSaveload:false,
  1816. handlesyncLoad:false//表单同步
  1817. };
  1818. },
  1819. computed: {
  1820. ...mapGetters(["userInfo"]),
  1821. // dialogTitle: function () {
  1822. // let text = "节点";
  1823. // if (this.leftType == 1) {
  1824. // text = "新增" + text;
  1825. // } else if (this.leftType == 2) {
  1826. // text = "编辑" + text;
  1827. // }
  1828. // return text;
  1829. // },
  1830. },
  1831. created() {
  1832. this.init();
  1833. //console.log(this.userInfo)
  1834. },
  1835. methods: {
  1836. //#region
  1837. init() {
  1838. //this.id = this.$route.query.wbsid;
  1839. //this.projectid = this.$route.query.pid;
  1840. const { wbsid, pid, type } = this.$route.query;
  1841. this.id = wbsid;
  1842. this.projectid = pid;
  1843. this.wbsType = type ? Number(type) : 1;
  1844. this.getNodeTypelist();
  1845. this.getTableTypelist();
  1846. this.getDataTypelist();
  1847. this.getOwnerTypelist();
  1848. this.defaultExpandedKeys = getStore({ name: this.expandName });
  1849. this.projectName=this.$route.query.projectName
  1850. },
  1851. loadNode(node, resolve) {
  1852. let pid = 0;
  1853. if (node.level != 0) {
  1854. pid = node.data.id;
  1855. }
  1856. const type = this.wbsType;
  1857. getLazytree(this.id, pid, this.userInfo.tenant_id, this.projectid, {
  1858. wbsType: type,
  1859. }).then((res) => {
  1860. let arr = [];
  1861. if (Array.isArray(res.data.data)) {
  1862. arr = res.data.data;
  1863. }
  1864. return resolve(arr);
  1865. });
  1866. },
  1867. getNodeDetail(data, node) {
  1868. console.log('getNodeDetail',data);
  1869. let parentName = "";
  1870. if (node.parent.data) {
  1871. parentName = node.parent.data.title;
  1872. }
  1873. this.curTreeData = data;
  1874. this.curTreeNode = node;
  1875. this.curTreeData.parentName = parentName;
  1876. getDetail(data.id, this.id, this.projectid).then((res) => {
  1877. res.data.data.parentName = parentName;
  1878. this.tableData = [res.data.data];
  1879. this.nodeDetail = Object.assign({}, res.data.data);
  1880. });
  1881. this.updateNodeTable();
  1882. this.nodeTypeChange(53)
  1883. //获取节点展开路径
  1884. this.getExpandedKeys(node);
  1885. },
  1886. saveNode() {
  1887. const type = this.wbsType;
  1888. this.$refs["nodeDetail"].validate((valid) => {
  1889. if (valid) {
  1890. const { mixRatioTestIds, nodeType } = this.nodeDetail;
  1891. if (type === 2 && nodeType === 53) {
  1892. if (mixRatioTestIds) {
  1893. if (this.editType == 1) {
  1894. this.addNode();
  1895. } else if (this.editType == 2) {
  1896. this.updateNode();
  1897. }
  1898. } else {
  1899. this.$message({
  1900. type: "error",
  1901. message: "请先选择节点",
  1902. });
  1903. return false;
  1904. }
  1905. } else {
  1906. if (this.editType == 1) {
  1907. this.addNode();
  1908. } else if (this.editType == 2) {
  1909. this.updateNode();
  1910. }
  1911. }
  1912. } else {
  1913. console.log("error submit!!");
  1914. return false;
  1915. }
  1916. });
  1917. },
  1918. addNode() {
  1919. this.saveNodeLoading = true;
  1920. update(this.nodeDetail).then(() => {
  1921. this.updateTreeNewNode();
  1922. this.dialogVisible = false;
  1923. this.$message({
  1924. type: "success",
  1925. message: "新增成功!",
  1926. });
  1927. });
  1928. },
  1929. updateNode() {
  1930. update(this.nodeDetail).then(() => {
  1931. let node = this.tableData[0];
  1932. node.nodeName = this.nodeDetail.nodeName;
  1933. node.nodeType = this.nodeDetail.nodeType;
  1934. this.curTreeData.title = this.nodeDetail.nodeName;
  1935. this.dialogVisible = false;
  1936. this.$message({
  1937. type: "success",
  1938. message: "修改成功!",
  1939. });
  1940. });
  1941. },
  1942. toSplit(val) {
  1943. return val ? String(val).split(",") : "";
  1944. },
  1945. setLeftType(type, data, node) {
  1946. this.jiedianId = data.id;
  1947. if (type == 4 || type == 5) {
  1948. this.leftType = type;
  1949. }
  1950. this.curTreeData = data;
  1951. this.curTreeNode = node;
  1952. this.$refs.tree.setCurrentKey(data.id);
  1953. if (type == 1 || type == 2) {
  1954. this.getMajorDataTypeList();
  1955. this.dialogVisible = true;
  1956. this.editType = type;
  1957. }
  1958. getDetail(data.id, this.id, this.projectid).then((res) => {
  1959. let parentName = "";
  1960. if (node.parent.data) {
  1961. parentName = node.parent.data.title;
  1962. }
  1963. res.data.data.parentName = parentName;
  1964. this.tableData = [res.data.data];
  1965. if (type == 1) {
  1966. this.nodeDetail = {
  1967. parentId: res.data.data.id,
  1968. parentName: parentName,
  1969. projectId: res.data.data.projectId,
  1970. };
  1971. } else {
  1972. this.nodeDetail = Object.assign({}, res.data.data);
  1973. this.mixRatioTestIds = this.toSplit(res.data.data.mixRatioTestIds);
  1974. }
  1975. this.nodeDetail.type = 1; // '1'节点 '2'表单
  1976. this.nodeDetail.wbsId = this.id;
  1977. this.nodeDetail.tenantId = this.userInfo.tenant_id;
  1978. });
  1979. if (this.leftType == 4) {
  1980. selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
  1981. if (res.data.data.length) {
  1982. this.formData = res.data.data;
  1983. this.formData.forEach((ele)=>{
  1984. ele.handlesyncLoad=false
  1985. })
  1986. } else {
  1987. this.formData = [];
  1988. }
  1989. });
  1990. }
  1991. //获取节点展开路径
  1992. this.getExpandedKeys(node);
  1993. },
  1994. showFormElement() {
  1995. if (!this.nodeDetail.id) {
  1996. this.$message({
  1997. type: "warning",
  1998. message: "请先选择在哪个节点下创建表",
  1999. });
  2000. return;
  2001. }
  2002. this.eleVisible = true;
  2003. },
  2004. addEleRow(list) {
  2005. list.push({});
  2006. },
  2007. delEleRow(index, list) {
  2008. list.splice(index, 1);
  2009. },
  2010. saveFormAndElementHandle() {
  2011. this.$refs["eleDialog"].validate((valid) => {
  2012. if (valid) {
  2013. this.eleForm.wbsId = this.id;
  2014. this.eleForm.tenantId = this.userInfo.tenant_id;
  2015. this.eleForm.nodeType = -1;
  2016. this.eleForm.type = 2; // '1'节点 '2'表单
  2017. this.eleForm.parentId = this.nodeDetail.id;
  2018. this.eleForm.elementList.forEach((element) => {
  2019. element.eAllowDeviation =
  2020. (element.allow ? element.allow : "") +
  2021. (element.deviation ? element.deviation : "");
  2022. if (element.eType == 4) {
  2023. element.eLength = 0;
  2024. }
  2025. });
  2026. saveFormAndElement(this.eleForm).then(() => {
  2027. //console.log(res)
  2028. this.updateTreeNewNode();
  2029. this.updateNodeTable();
  2030. this.eleVisible = false;
  2031. this.$message({
  2032. type: "success",
  2033. message: "新增成功!",
  2034. });
  2035. });
  2036. } else {
  2037. console.log("error submit!!");
  2038. return false;
  2039. }
  2040. });
  2041. },
  2042. updateTreeNewNode() {
  2043. getLazytree(
  2044. this.id,
  2045. this.nodeDetail.parentId,
  2046. this.userInfo.tenant_id,
  2047. this.projectid
  2048. ).then((res) => {
  2049. this.$refs.tree.updateKeyChildren(
  2050. this.nodeDetail.parentId,
  2051. res.data.data
  2052. );
  2053. });
  2054. },
  2055. updateNodeTable() {
  2056. selectByNodeTable(this.curTreeData.id, this.projectid, this.id).then(
  2057. (res) => {
  2058. if (res.data.data&&res.data.data.length) {
  2059. this.formData = res.data.data;
  2060. } else {
  2061. this.formData = [];
  2062. }
  2063. }
  2064. );
  2065. },
  2066. deleNode(data, node) {
  2067. let pid=data.primaryKeyId?data.primaryKeyId:data.pKeyId
  2068. this.$confirm(
  2069. "此操作将删除节点【" + data.title + "】, 是否继续?",
  2070. "提示",
  2071. {
  2072. confirmButtonText: "确定",
  2073. cancelButtonText: "取消",
  2074. type: "warning",
  2075. }
  2076. )
  2077. .then(() => {
  2078. removePrivateTreeNode(pid).then(() => {
  2079. this.$refs.tree.remove(node);
  2080. this.$message({
  2081. type: "success",
  2082. message: "删除成功!",
  2083. });
  2084. });
  2085. })
  2086. .catch(() => {});
  2087. },
  2088. importHandle() {},
  2089. handleEdit(index, row) {
  2090. this.curEleTable = row;
  2091. selectPrivateFormElements(this.curEleTable.initTableId).then((res) => {
  2092. res.data.data.forEach((element) => {
  2093. this.eleReg.exec(element.eAllowDeviation);
  2094. element.allow = RegExp.$1 ? RegExp.$1 : "";
  2095. element.deviation = RegExp.$2 ? RegExp.$2 : "";
  2096. });
  2097. this.editEleList = res.data.data;
  2098. });
  2099. this.editEleVisible = true;
  2100. },
  2101. handleDelete(index, row) {
  2102. this.$confirm("是否删除 " + row.tableName + " ?", "删除元素表", {
  2103. distinguishCancelAndClose: true,
  2104. confirmButtonText: "删除",
  2105. cancelButtonText: "取消",
  2106. }).then(() => {
  2107. removeTableById(row.id, this.projectid, this.id).then(() => {
  2108. this.formData.splice(index, 1);
  2109. this.$message({
  2110. type: "success",
  2111. message: "删除成功!",
  2112. });
  2113. });
  2114. });
  2115. },
  2116. async hideMD(row) {
  2117. //隐藏按钮
  2118. const code = await this.updateStatus(row.pkeyId, row.status);
  2119. if (code == 200) {
  2120. if (row.status == 0) {
  2121. row.status = 1;
  2122. } else {
  2123. row.status = 0;
  2124. }
  2125. }
  2126. },
  2127. async updateStatus(pKeyId, status) {
  2128. //隐藏功能激活
  2129. const { data: res } = await updateStatus({ pKeyId });
  2130. if (res.code == 200) {
  2131. this.$message({
  2132. type: "success",
  2133. message: status == 1 ? "隐藏成功" : "激活成功",
  2134. });
  2135. }
  2136. return res.code;
  2137. },
  2138. handleEditFormula(index, row) {
  2139. this.curEleTable = row;
  2140. selectFormElements(this.curEleTable.pkeyId,{type:0}).then((res) => {
  2141. this.editEleListFilter = res.data.data;
  2142. this.editEleListAll = [].concat(this.editEleListFilter);
  2143. });
  2144. this.editEleFormulaVisible = true;
  2145. },
  2146. //表单同步
  2147. handlesync(index, row){
  2148. this.handlesyncLoad=true
  2149. syncCurrentFormInProject({pKeyId:row.pkeyId}).then((res)=>{
  2150. if(res.data.code==200){
  2151. this.$message.success('操作成功');
  2152. }
  2153. }).finally(()=>{
  2154. this.handlesyncLoad=false
  2155. })
  2156. },
  2157. //搜索 筛选
  2158. searchFormulaName() {
  2159. this.editEleListFilter = this.editEleListAll.filter((ele) => {
  2160. return ele.eName.indexOf(this.formulaInput) > -1;
  2161. });
  2162. },
  2163. saveNewEle(row) {
  2164. row.eAllowDeviation =
  2165. (row.allow ? row.allow : "") + (row.deviation ? row.deviation : "");
  2166. row.fId = this.curEleTable.initTableId;
  2167. row.initTableName = this.curEleTable.initTableName;
  2168. if (row.eType == 4) {
  2169. row.eLength = 0;
  2170. }
  2171. saveElement(row).then((res) => {
  2172. if (res.data.data) {
  2173. this.$set(row, "id", res.data.data.id);
  2174. this.$set(row, "ekey", res.data.data.ekey);
  2175. this.$message({
  2176. type: "success",
  2177. message: "保存成功!",
  2178. });
  2179. }
  2180. });
  2181. },
  2182. delEleRowHandle(index, list) {
  2183. let row = list[index];
  2184. if (row.id) {
  2185. //有id需要请求删除
  2186. this.$confirm("是否确认删除?", "删除元素", {
  2187. distinguishCancelAndClose: true,
  2188. confirmButtonText: "删除",
  2189. cancelButtonText: "取消",
  2190. }).then(() => {
  2191. removeElement(row.id, this.curEleTable.initTableName, row.ekey).then(
  2192. () => {
  2193. list.splice(index, 1);
  2194. }
  2195. );
  2196. });
  2197. } else {
  2198. list.splice(index, 1);
  2199. }
  2200. },
  2201. saveEles() {
  2202. for (let i = 0; i < this.editEleList.length; i++) {
  2203. if (!this.editEleList[i].id) {
  2204. this.$message({
  2205. type: "warning",
  2206. message: "请先将新增的元素点击保存",
  2207. });
  2208. return;
  2209. }
  2210. }
  2211. if (this.editEleList.length > 0) {
  2212. this.editEleList.forEach((element) => {
  2213. element.eAllowDeviation =
  2214. (element.allow ? element.allow : "") +
  2215. (element.deviation ? element.deviation : "");
  2216. if (element.eType == 4) {
  2217. element.eLength = 0;
  2218. }
  2219. });
  2220. updateBatchElements(
  2221. this.editEleList,
  2222. this.curEleTable.initTableName
  2223. ).then(() => {
  2224. this.editEleVisible = false;
  2225. this.updateNodeTable();
  2226. this.$message({
  2227. type: "success",
  2228. message: "保存成功!",
  2229. });
  2230. });
  2231. } else {
  2232. this.editEleVisible = false;
  2233. this.updateNodeTable();
  2234. this.$message({
  2235. type: "success",
  2236. message: "保存成功!",
  2237. });
  2238. }
  2239. },
  2240. nodeTypeChange(val) {
  2241. console.log(333333333);
  2242. if (val === 53) {
  2243. // if (this.testTreeData.length > 0) {
  2244. // return;
  2245. // }
  2246. this.testTreeLoad = true;
  2247. // getAlltreeTrial(this.projectid, this.id, this.curTreeData.primaryKeyId).then((res) => {
  2248. // this.testTreeLoad = false;
  2249. // console.log(res.data.data,'data');
  2250. // let trialdata=res.data.data
  2251. // if(trialdata&&trialdata.allTree){
  2252. // this.testTreeData = trialdata.allTree[0];
  2253. // if(trialdata.allStatusIds.length>0){
  2254. // //设置勾选相关联试验全选
  2255. // this.mixRatioTestIds =trialdata.allStatusIds[0];
  2256. // }
  2257. // }
  2258. // });
  2259. let pid=this.curTreeData.primaryKeyId?this.curTreeData.primaryKeyId:this.curTreeData.pKeyId
  2260. getAlltree(this.projectid, this.id, pid).then((res) => {
  2261. this.testTreeLoad = false;
  2262. console.log(res.data.data,'data');
  2263. this.testTreeData=res.data.data
  2264. });
  2265. }
  2266. },
  2267. //根据逗号联合
  2268. toJoin(arr) {
  2269. return arr ? arr.join() : "";
  2270. },
  2271. TestTreeCheckChange(_, { checkedKeys, halfCheckedKeys }) {
  2272. // const newarr = [...checkedKeys, ...halfCheckedKeys];
  2273. const newarr = [...checkedKeys]
  2274. this.nodeDetail.mixRatioTestIds = this.toJoin(newarr);
  2275. },
  2276. // filterChange() {
  2277. // if (this.treeData.length > 0) {
  2278. // this.$refs.treeall.filter(this.filterText);
  2279. // return;
  2280. // }
  2281. // this.treeLoad = true;
  2282. // getAlltree(this.projectid, this.id).then((res) => {
  2283. // this.treeLoad = false;
  2284. // this.treeData = res.data.data;
  2285. // console.log(res.data.data,'res.data.data');
  2286. // this.$nextTick(() => {
  2287. // this.$refs.treeall.filter(this.filterText);
  2288. // });
  2289. // });
  2290. // },
  2291. //搜索树
  2292. //搜索树
  2293. searchTreeClick(){
  2294. if(this.filterText.length>0){
  2295. this.isSearch=true
  2296. this.searchtreeLoad=true
  2297. getQueryValueByType({
  2298. queryValue:this.filterText,
  2299. type:this.searchType,
  2300. wbsId:this.id,
  2301. projectId: this.projectid
  2302. }).then((res)=>{
  2303. let arr = [];
  2304. if (Array.isArray(res.data.data)) {
  2305. arr = res.data.data;
  2306. this.searchTreeData=arr
  2307. }else{
  2308. this.searchTreeData=[]
  2309. }
  2310. })
  2311. }else{
  2312. this.isSearch=false
  2313. }
  2314. this.searchtreeLoad=false
  2315. },
  2316. clearSearch(){
  2317. this.isSearch=false
  2318. },
  2319. importTemplate(data) {
  2320. this.importTemplateVisible = true;
  2321. this.curTreeData = data;
  2322. if (!this.fileUrl) {
  2323. getAttchFromOriginalName(1, 20, {
  2324. originalName: "WBS划分模板.xls",
  2325. }).then((res) => {
  2326. if (res.data.data.records.length) {
  2327. this.fileUrl = res.data.data.records[0].link;
  2328. } else {
  2329. this.fileUrl = "";
  2330. }
  2331. });
  2332. }
  2333. },
  2334. importTemplateHandle() {
  2335. if (!this.upFile) {
  2336. this.$message({
  2337. type: "warning",
  2338. message: "请先选择文件再进行导入",
  2339. });
  2340. return;
  2341. }
  2342. let forms = new FormData();
  2343. forms.append("excelFile", this.upFile);
  2344. let wbsTreeFu = {
  2345. wbsId: this.id,
  2346. parentId: this.curTreeData.id,
  2347. // ancestors:'0,'+this.curTreeData.id,
  2348. };
  2349. let json = JSON.stringify(wbsTreeFu);
  2350. let blob = new Blob([json], { type: "application/json" });
  2351. forms.append("wbsTreeFu", blob);
  2352. this.importLoading = true;
  2353. importWbsTree(forms)
  2354. .then(() => {
  2355. //this.$router.go(0)
  2356. let node = this.$refs.tree.getNode(this.curTreeData.id);
  2357. node.isLeaf = false;
  2358. this.importTemplateVisible = false;
  2359. this.upFile = null;
  2360. })
  2361. .finally(() => {
  2362. this.importLoading = false;
  2363. });
  2364. },
  2365. handleDownload() {
  2366. if (this.fileUrl) {
  2367. window.open(this.fileUrl);
  2368. } else {
  2369. this.$message({
  2370. type: "warning",
  2371. message: "请先在附件管理上传【WBS划分模板.xls】文件",
  2372. });
  2373. }
  2374. },
  2375. fileClick() {
  2376. this.$refs.file.click();
  2377. },
  2378. fileChange(e) {
  2379. const file = e.target.files[0];
  2380. if (!file) {
  2381. // 如果用户没有选择图片,只是点了文件上传这个按钮
  2382. return;
  2383. }
  2384. //console.log(file)
  2385. this.upFile = file;
  2386. },
  2387. editNodeInfo(index, row) {
  2388. this.$set(row, "isEdit", true);
  2389. },
  2390. saveNodeInfoHandle(index, row) {
  2391. row.isEdit = false;
  2392. },
  2393. downloadTmp() {
  2394. getTemplate().then((res) => {
  2395. //console.log(res)
  2396. let blob = new Blob([res.data], {
  2397. type: "application/vnd.ms-excel",
  2398. });
  2399. //console.log(blob)
  2400. let filename = Date.parse(new Date()) + ".xls";
  2401. if (window.navigator.msSaveOrOpenBlob) {
  2402. // 兼容IE10
  2403. window.navigator.msSaveBlob(blob, filename);
  2404. } else {
  2405. // 兼容chrome/firefox
  2406. let aTag = document.createElement("a");
  2407. aTag.download = Date.parse(new Date()) + ".xls";
  2408. aTag.href = window.URL.createObjectURL(blob);
  2409. aTag.click();
  2410. URL.revokeObjectURL(aTag.href);
  2411. }
  2412. });
  2413. },
  2414. fileClick2() {
  2415. this.$refs.file2.click();
  2416. },
  2417. tmpImport(e) {
  2418. const file = e.target.files[0];
  2419. const formData = new FormData();
  2420. formData.append("file", file);
  2421. //console.log(file.name)
  2422. importWbsElement(formData)
  2423. .then((res) => {
  2424. res.data.data.forEach((element) => {
  2425. element.eName = element.elementName;
  2426. element.eLength = element.elementLength;
  2427. element.eType = Number(element.elementType);
  2428. element.eAllowDeviation = element.elementAllowDeviation;
  2429. element.eInspectionMethod = element.elementInspectionMethod;
  2430. this.eleReg.exec(element.eAllowDeviation);
  2431. // console.log(RegExp.$1)
  2432. // console.log(RegExp.$2)
  2433. element.allow = RegExp.$1 ? RegExp.$1 : "";
  2434. element.deviation = RegExp.$2 ? RegExp.$2 : "";
  2435. });
  2436. this.eleForm.elementList = res.data.data;
  2437. this.importVisible = false;
  2438. })
  2439. .finally(() => {
  2440. e.target.value = "";
  2441. });
  2442. },
  2443. visiblechange(value, data) {
  2444. this.$set(data, "moreShow", value);
  2445. },
  2446. bianhua2() {
  2447. this.excelSortTag2 = false;
  2448. this.$nextTick(() => {
  2449. this.excelSortTag2 = true;
  2450. });
  2451. },
  2452. //私有树的元素表修改排序
  2453. privateTableSort() {
  2454. if (!this.curTreeData.id) {
  2455. this.$message({
  2456. type: "warning",
  2457. message: "请先选择需要排序的节点",
  2458. });
  2459. return;
  2460. }
  2461. this.tableSortList = this.formData.map((form, index) => {
  2462. return {
  2463. sort: index + 1,
  2464. nodeName: form.tableName,
  2465. pkeyId: form.pkeyId,
  2466. };
  2467. });
  2468. this.excelSortTag = true;
  2469. this.excelSortTag2 = true;
  2470. },
  2471. editPrivateSort() {
  2472. this.surePrivateSortload=true
  2473. wbsTreePrivateTableSort(this.tableSortList).then(() => {
  2474. this.$message({
  2475. type: "success",
  2476. message: "排序成功!",
  2477. });
  2478. this.updateNodeTable();
  2479. this.surePrivateSortload=false
  2480. this.excelSortTag = false;
  2481. this.excelSortTag2 = false;
  2482. });
  2483. },
  2484. //解析元素数据类型
  2485. eTypeFormatter(row) {
  2486. let text = "";
  2487. for (let i = 0; i < this.dataTypeList.length; i++) {
  2488. if (this.dataTypeList[i].dictKey == row.eType) {
  2489. text = this.dataTypeList[i].dictValue;
  2490. break;
  2491. }
  2492. }
  2493. return text;
  2494. },
  2495. //跳转到公式配置页面
  2496. toFormulaEdit(row,type) {
  2497. // this.$router.push({
  2498. // path: '/formula/edit',
  2499. // query: {
  2500. // wbsid: this.id,
  2501. // eleid: row.id,
  2502. // nodeid:this.curTreeData.id,
  2503. // projectid:this.projectid
  2504. // }
  2505. // });
  2506. this.formulaCurRow = row;
  2507. this.formulaCurRow.globaltype = type;
  2508. if(type===10){
  2509. this.formulaCompVisible1 = true;
  2510. this.formulaCurRow.elementType = false;
  2511. this.istableType=true;
  2512. }else{
  2513. this.formulaCompVisible = true;
  2514. }
  2515. },
  2516. //关闭公式弹窗
  2517. closeformulaComp(){
  2518. console.log('关闭');
  2519. selectFormElements( this.curEleTable.pkeyId,{type:0}).then((res) => {
  2520. this.editEleListFilter = res.data.data;
  2521. this.editEleListAll = [].concat(this.editEleListFilter);
  2522. })
  2523. },
  2524. //关闭公式弹窗
  2525. closeformulaComp1(){
  2526. console.log('关闭');
  2527. selectFormElements( this.curEleTable.pkeyId,{type:0}).then((res) => {
  2528. this.editEleListFilter = res.data.data;
  2529. this.editEleListAll = [].concat(this.editEleListFilter);
  2530. })
  2531. },
  2532. getNodeTypelist() {
  2533. const type = this.wbsType;
  2534. if (this.nodeTypelist.length > 1) {
  2535. return;
  2536. }
  2537. let code=''
  2538. if(type===5){
  2539. code='lar_node_type'//征拆
  2540. }else if(type===2){
  2541. code='trial_node_type'//试验
  2542. }else{
  2543. code='wbs_node_type'//质检
  2544. }
  2545. getDictionary({
  2546. code
  2547. // code: type === 2 ? "trial_node_type" : "wbs_node_type",
  2548. }).then((res) => {
  2549. res.data.data.forEach((element) => {
  2550. element.dictKey = Number(element.dictKey);
  2551. });
  2552. this.nodeTypelist = res.data.data;
  2553. });
  2554. },
  2555. getMajorDataTypeList() {
  2556. if (this.majorDataTypeList.length > 1) {
  2557. return;
  2558. }
  2559. getDictionary({
  2560. code: "major_data_type",
  2561. }).then((res) => {
  2562. res.data.data.forEach((element) => {
  2563. element.dictKey = Number(element.dictKey);
  2564. });
  2565. this.majorDataTypeList = res.data.data;
  2566. });
  2567. },
  2568. getTableTypelist() {
  2569. const type = this.wbsType
  2570. if (this.tableTypelist.length > 1) {
  2571. return;
  2572. }
  2573. let code=''
  2574. if(type===5){
  2575. code='table_type'//征拆
  2576. }else if(type===2){
  2577. code='trial_table_type'//试验
  2578. }else{
  2579. code='table_type'//质检
  2580. }
  2581. getDictionary({
  2582. // code: "table_type",
  2583. // code: type === 2 ? "trial_table_type" : "table_type",
  2584. code
  2585. }).then((res) => {
  2586. res.data.data.forEach((element) => {
  2587. element.dictKey = Number(element.dictKey);
  2588. });
  2589. this.tableTypelist = res.data.data;
  2590. });
  2591. },
  2592. getDataTypelist() {
  2593. if (this.dataTypeList.length > 1) {
  2594. return;
  2595. }
  2596. getDictionary({
  2597. code: "data_type",
  2598. }).then((res) => {
  2599. res.data.data.forEach((element) => {
  2600. element.dictKey = Number(element.dictKey);
  2601. });
  2602. this.dataTypeList = res.data.data;
  2603. });
  2604. },
  2605. getOwnerTypelist() {
  2606. if (this.ownerTypeList.length > 1) {
  2607. return;
  2608. }
  2609. getDictionary({
  2610. code: "owner_type",
  2611. }).then((res) => {
  2612. res.data.data.forEach((element) => {
  2613. element.dictKey = Number(element.dictKey);
  2614. });
  2615. this.ownerTypeList = res.data.data;
  2616. });
  2617. },
  2618. formatCat(row, column, cellValue) {
  2619. for (let i = 0; i < this.nodeTypelist.length; i++) {
  2620. if (this.nodeTypelist[i].dictKey == cellValue) {
  2621. return this.nodeTypelist[i].dictValue;
  2622. }
  2623. }
  2624. return cellValue;
  2625. //console.log(cellValue)
  2626. },
  2627. formatTableType(row, column, cellValue) {
  2628. for (let i = 0; i < this.tableTypelist.length; i++) {
  2629. if (this.tableTypelist[i].dictKey == cellValue) {
  2630. return this.tableTypelist[i].dictValue;
  2631. }
  2632. }
  2633. return cellValue;
  2634. //console.log(cellValue)
  2635. },
  2636. formatOwner(row, column, cellValue) {
  2637. for (let i = 0; i < this.ownerTypeList.length; i++) {
  2638. if (this.ownerTypeList[i].dictKey == cellValue) {
  2639. return this.ownerTypeList[i].dictValue;
  2640. }
  2641. }
  2642. return cellValue;
  2643. //console.log(cellValue)
  2644. },
  2645. formatdataType(row, column, cellValue) {
  2646. for (let i = 0; i < this.dataTypeList.length; i++) {
  2647. if (this.dataTypeList[i].dictKey == cellValue) {
  2648. return this.dataTypeList[i].dictValue;
  2649. }
  2650. }
  2651. return cellValue;
  2652. },
  2653. // filterNode(value, data) {
  2654. // if (!value) return true;
  2655. // return data.title.indexOf(value) !== -1;
  2656. // },
  2657. getReturnNode(node,_array,value){
  2658. let isPass = node.data && node.data.title && node.data.title.indexOf(value) !== -1;
  2659. isPass?_array.push(isPass):'';
  2660. if(!isPass && node.level!=1 && node.parent){
  2661. this.getReturnNode(node.parent,_array,value);
  2662. }
  2663. },
  2664. filterNode(value,data,node) {
  2665. if(!value){
  2666. return true;
  2667. }
  2668. let level = node.level;
  2669. let _array = [];//这里使用数组存储 只是为了存储值。
  2670. this.getReturnNode(node,_array,value);
  2671. let result = false;
  2672. _array.forEach((item)=>{
  2673. result = result || item;
  2674. });
  2675. return result;
  2676. },
  2677. //#endregion
  2678. //#region wbs私有树排序
  2679. async sortpai(data) {
  2680. console.log(data);
  2681. await this.findWbsTreePrivateSameLevel({
  2682. parentId: data.parentId,
  2683. projectId: this.projectid,
  2684. wbsId: this.id,
  2685. });
  2686. this.sortTag = true;
  2687. this.sortTag2 = true;
  2688. },
  2689. editSort() {
  2690. this.wbsTreePrivateSort();
  2691. },
  2692. bianhua() {
  2693. this.sortTag2 = false;
  2694. this.$nextTick(() => {
  2695. this.sortTag2 = true;
  2696. });
  2697. },
  2698. async wbsTreePrivateSort() {
  2699. this.sureSortload=true
  2700. //wbs私有树节点手动排序
  2701. const { data: res } = await wbsTreePrivateSort(this.sort);
  2702. console.log(res);
  2703. if (res.code == 200) {
  2704. this.sortTag = false;
  2705. this.sortTag2 = false;
  2706. this.$message({
  2707. type: "success",
  2708. message: "排序成功!",
  2709. });
  2710. this.sureSortload=false
  2711. this.getLazytreessss();
  2712. }
  2713. },
  2714. async findWbsTreePrivateSameLevel(da) {
  2715. //wbs私有树同级节点接口
  2716. const { data: res } = await findWbsTreePrivateSameLevel(da);
  2717. if (res.code == 200) {
  2718. this.sort = res.data;
  2719. }
  2720. },
  2721. async getLazytreessss() {
  2722. const type=this.wbsType
  2723. const { data: res } = await getLazytree(
  2724. this.id,
  2725. 0,
  2726. this.userInfo.tenant_id,
  2727. this.projectid,
  2728. { wbsType: type,}
  2729. );
  2730. console.log(res);
  2731. if (res.code == 200) {
  2732. this.treeData = res.data;
  2733. }
  2734. },
  2735. //#endregion
  2736. //#region 关联清表
  2737. async getList(da) {
  2738. //获取清表模板信息
  2739. const { data: res } = await getList(da);
  2740. console.log(res);
  2741. if (res.code === 200 && res.msg === "操作成功") {
  2742. this.GLExcelData = res.data.records;
  2743. }
  2744. },
  2745. async tabLazytreeAll() {
  2746. //清表树信息
  2747. this.GLExcelLoading = true;
  2748. const { data: res } = await tabLazytreeAll({
  2749. modeId: this.GLExcelFrom.name,
  2750. name: this.GLExcelFrom.search,
  2751. });
  2752. this.GLExcelLoading = false;
  2753. console.log(res);
  2754. if (res.code === 200 && res.msg === "操作成功") {
  2755. this.exceldata = res.data;
  2756. }
  2757. },
  2758. Associationlist(scope) {
  2759. //关联清表点击事件
  2760. console.log(scope.row);
  2761. this.GLExcel = true;
  2762. this.getList({
  2763. current: 1,
  2764. size: 100000,
  2765. parentId: 0,
  2766. });
  2767. this.GLExcelFrom.name = scope.row.modeId;
  2768. setTimeout(() => {
  2769. this.$refs.tree.setCheckedKeys([scope.row.excelId]);
  2770. }, 2000);
  2771. this.GLExcelFrom.initTableId = scope.row.initTableId;
  2772. this.GLExcelFrom.id = scope.row.pkeyId;
  2773. this.GLExcelFrom.excelId = scope.row.excelId;
  2774. this.GLExcelFrom.ids = scope.row.id;
  2775. this.GLExcelFrom.initTableName = scope.row.initTableName;
  2776. console.log(this.GLExcelFrom,'this.GLExcelFrom');
  2777. },
  2778. changetherr() {
  2779. //清表类型选择框change事件
  2780. if (this.GLExcelFrom.name != "") {
  2781. this.GLExcelFrom.search = "";
  2782. this.tabLazytreeAll();
  2783. }
  2784. },
  2785. GLExcelMD() {
  2786. //弹框关闭事件
  2787. this.GLExcelFrom.name = "";
  2788. this.GLExcelFrom.search = "";
  2789. this.GLExcelFrom.id = "";
  2790. this.exceldata = [];
  2791. this.$refs.tree.setCheckedKeys([]);
  2792. this.GLExcel = false;
  2793. },
  2794. checkchange(data) {
  2795. //节点选中回调
  2796. if (this.$refs.tree.getCheckedNodes().length === 0) {
  2797. this.$refs.tree.setCheckedKeys([]);
  2798. } else if (this.$refs.tree.getCheckedNodes().length >= 1) {
  2799. this.$refs.tree.setCheckedKeys([data.id]);
  2800. }
  2801. },
  2802. async saveLinkTab() {
  2803. //保存按钮
  2804. let checkNodes = this.$refs.tree.getCheckedNodes();
  2805. if (checkNodes.length > 0) {
  2806. let node = checkNodes[checkNodes.length - 1];
  2807. if (node.fileType != 3) {
  2808. this.$message({
  2809. type: "warning",
  2810. message: "请先上传Excel表",
  2811. });
  2812. return;
  2813. }
  2814. const { data: res } = await saveLinkTab({
  2815. exceTabId: node.id,
  2816. tabId: this.GLExcelFrom.id,
  2817. });
  2818. console.log(res);
  2819. if (res.code === 200) {
  2820. this.$message({
  2821. type: "success",
  2822. message: "关联清表成功",
  2823. });
  2824. // selectByNodeTable刷新表单列表
  2825. this.updateNodeTable();
  2826. this.GLExcel = false;
  2827. console.log(this.GLExcelFrom,'GLExcelFrom');
  2828. this.rightClick(
  2829. this.GLExcelFrom.id,
  2830. this.GLExcelFrom.excelId,
  2831. this.GLExcelFrom.ids,
  2832. this.GLExcelFrom.initTableName,
  2833. this.GLExcelFrom.initTableId
  2834. );
  2835. }
  2836. } else {
  2837. this.$message({
  2838. type: "warning",
  2839. message: "请先设置清表",
  2840. });
  2841. }
  2842. },
  2843. getReturnNode2(node,_array,value){
  2844. let isPass = node.data && node.data.name && node.data.name.indexOf(value) !== -1;
  2845. isPass?_array.push(isPass):'';
  2846. if(!isPass && node.level!=1 && node.parent){
  2847. this.getReturnNode2(node.parent,_array,value);
  2848. }
  2849. },
  2850. filterNode222(value,data,node) {
  2851. if(!value){
  2852. return true;
  2853. }
  2854. let level = node.level;
  2855. let _array = [];//这里使用数组存储 只是为了存储值。
  2856. this.getReturnNode2(node,_array,value);
  2857. let result = false;
  2858. _array.forEach((item)=>{
  2859. result = result || item;
  2860. });
  2861. return result;
  2862. },
  2863. //#endregion
  2864. //#region 节点参数
  2865. nodeInfo(data) {
  2866. //节点参数按钮
  2867. this.keymap();
  2868. //console.log(data)
  2869. let pid=data.primaryKeyId?data.primaryKeyId:data.pKeyId
  2870. this.jiedianId = pid;
  2871. this.parameters(pid);
  2872. this.nodeInfoVisible = true;
  2873. },
  2874. closenodeInfoVisible(){
  2875. this.nodeInfoTable=[]
  2876. this.nodeInfoVisible = false;
  2877. },
  2878. addNodeInfoTable() {
  2879. //添加节点参数数据
  2880. this.nodeInfoTable.unshift({
  2881. k: "",
  2882. v: "",
  2883. remark: "",
  2884. nodeId: this.jiedianId,
  2885. type: 1,
  2886. });
  2887. console.log(this.nodeInfoTable)
  2888. },
  2889. refreshnfoTable(){
  2890. //刷新表格
  2891. let prams={
  2892. nodeId: this.jiedianId,
  2893. type: 1,
  2894. projectId: this.projectid
  2895. }
  2896. this.nodeInfoTableLoad=true
  2897. refrehPram(prams).then((res)=>{
  2898. this.nodeInfoTableLoad=false;
  2899. if(res.data.code==200){
  2900. this.$message.success('刷新成功');
  2901. }
  2902. })
  2903. },
  2904. delNodeInfo(key,obj) {
  2905. this.delids.push(obj.id)
  2906. //设置参数名称中的删除按钮
  2907. this.namelists.splice(key, 1);
  2908. },
  2909. delNodeInfoss(key,obj) {
  2910. this.delids.push(obj.id)
  2911. //节点参数
  2912. this.nodeInfoTable.splice(key, 1);
  2913. },
  2914. setNodeParameters() {
  2915. //打开设置节点参数弹框按钮
  2916. this.infoNameVisible = true;
  2917. this.namelists = [...this.namelist];
  2918. },
  2919. async setParameterName() {
  2920. //设置参数名称中添加节点参数按钮
  2921. // wbsId: this.jiedianId
  2922. this.namelists.unshift({ name: "", remark: "", k: "", type: 0 ,nodeId:this.jiedianId});
  2923. },
  2924. async nodeInfoSave() {
  2925. //节点参数弹框保存按钮
  2926. if (this.nodeInfoTable) {
  2927. // if (this.nodeInfoTable.length == 0) {
  2928. // await this.saveOrUpdateBatch({projectId:this.projectid,nodeId:this.jiedianId,type:1,delIds:this.delids,wps:[
  2929. // {
  2930. // nodeId: this.jiedianId,
  2931. // type: -1,
  2932. // },
  2933. // ]});
  2934. // this.nodeInfoVisible = false;
  2935. // this.delIds=[];
  2936. // this.$message({
  2937. // type: "success",
  2938. // message: "保存参数节点成功!",
  2939. // });
  2940. // return;
  2941. // }
  2942. console.log(this.namelist)
  2943. let tag = true;
  2944. this.nodeInfoTable.forEach((val) => {
  2945. if (!val.k | !val.v) {
  2946. return (tag = false);
  2947. }
  2948. if (!val.name) {
  2949. for (let i = 0; i < this.namelist.length; i++) {
  2950. if (this.namelist[i].k == val.k) {
  2951. val.name = this.namelist[i].name;
  2952. return;
  2953. }
  2954. }
  2955. }
  2956. });
  2957. if (tag) {
  2958. this.nodeInfoSaveload=true
  2959. await this.saveOrUpdateBatch({scopeType:10,projectId:this.projectid,nodeId:this.jiedianId,wps:this.nodeInfoTable,type:1,delIds:this.delids});
  2960. this.delIds=[];
  2961. this.$message({
  2962. type: "success",
  2963. message: "设置参数节点成功!",
  2964. });
  2965. this.nodeInfoSaveload=false
  2966. this.parameters(this.jiedianId)
  2967. // this.nodeInfoVisible = false;
  2968. } else {
  2969. this.$message({
  2970. type: "error",
  2971. message: "请填写所有的参数名称和参数值!",
  2972. });
  2973. }
  2974. } else {
  2975. this.$message({
  2976. type: "error",
  2977. message: "请先设置参数节点!",
  2978. });
  2979. }
  2980. },
  2981. async addParameterName() {
  2982. //设置参数名称中的保存按钮
  2983. if (this.namelists.length) {
  2984. let tag = true;
  2985. this.namelists.forEach((val) => {
  2986. if (!val.name || !val.k) {
  2987. return (tag = false);
  2988. }
  2989. });
  2990. if (tag) {
  2991. await this.saveOrUpdateBatch({scopeType:10,projectId:this.projectid,nodeId:this.jiedianId,wps:this.namelists,type:0,delIds:this.delids}); //保存设置参数
  2992. this.infoNameVisible = false;
  2993. this.delIds=[];
  2994. this.keymap();
  2995. } else {
  2996. this.$message({
  2997. type: "error",
  2998. message: "请填写所有的参数名称和参数值KEY!",
  2999. });
  3000. }
  3001. } else {
  3002. this.$message({
  3003. type: "warning",
  3004. message: "请先添加参数",
  3005. });
  3006. }
  3007. },
  3008. closeParameter() {
  3009. //设置参数名称,关闭按钮
  3010. this.namelists = [];
  3011. this.infoNameVisible = false;
  3012. },
  3013. async parameters(wbsId) {
  3014. //获取接待你参数列表
  3015. const { data: res } = await parameters({ wbsId });
  3016. console.log(res);
  3017. if (res.code == 200) {
  3018. if( Array.isArray(res.data)){
  3019. this.nodeInfoTable = res.data
  3020. }
  3021. }
  3022. },
  3023. async saveOrUpdateBatch(da) {
  3024. //保存
  3025. const { data: res } = await saveOrUpdateBatch(da);
  3026. this.delids=[];
  3027. console.log(res);
  3028. },
  3029. async keymap() {
  3030. //节点参数枚举
  3031. const { data: res } = await keymap();
  3032. console.log(res);
  3033. if (res.code == 200) {
  3034. this.namelist = res.data;
  3035. }
  3036. },
  3037. //#endregion
  3038. //#region 调整表单
  3039. adjustExcel(pkeyId, excelId) {
  3040. //调整表单
  3041. this.GLExcelFrom.id = pkeyId;
  3042. this.getExcelHtml(pkeyId);
  3043. },
  3044. async getExcelHtml(pkeyId) {
  3045. const { data: res } = await getExcelHtml({ pkeyId });
  3046. console.log(res);
  3047. if (res.code === 200) {
  3048. localStorage.setItem("excelHtml", res.data);
  3049. this.adjustmentExcel = res.data;
  3050. this.excelHtml = true;
  3051. }
  3052. },
  3053. removeExcel() {
  3054. this.excelHtml = false;
  3055. },
  3056. //#endregion
  3057. //#region 编辑元素
  3058. async rightClick(pkeyId, excelId, id, initTableName,initTableId) {
  3059. await this.getExcelHtml2(pkeyId);
  3060. this.editElementQuery.pkeyId = pkeyId;
  3061. this.editElementQuery.excelId = excelId;
  3062. this.editElementQuery.id = id;
  3063. this.editElementQuery.initTableName = initTableName;
  3064. this.editElementQuery.initTableId = initTableId;
  3065. this.editElementQuery.pid = this.$route.query.pid;
  3066. this.editElementQuery.wbsid = this.$route.query.wbsid;
  3067. this.editElementQuery.nodeid = this.curTreeData.id;
  3068. this.editElementVisible = true;
  3069. },
  3070. async getExcelHtml2(pkeyId) {
  3071. const { data: res } = await getExcelHtml({ pkeyId });
  3072. console.log(res);
  3073. if (res.code === 200) {
  3074. localStorage.setItem("editElement", res.data);
  3075. }
  3076. },
  3077. //#endregion
  3078. //#region 元素表单信息
  3079. editEditElementForm() {
  3080. //标记元素
  3081. if (this.formData.length) {
  3082. let da = [];
  3083. this.formDatass = [...this.formData];
  3084. this.formDatass.forEach((val) => {
  3085. da.push({
  3086. tableType: val.tableType - 0,
  3087. tableOwner: val.tableOwner - 0,
  3088. pkeyId: val.pkeyId,
  3089. tableName: val.tableName,
  3090. fillRate: val.fillRate,
  3091. });
  3092. });
  3093. this.formDatass = da;
  3094. this.editElementFormTag = true;
  3095. }
  3096. },
  3097. editeditElementFormMF() {
  3098. //保存按钮
  3099. let da = [];
  3100. let tag = true;
  3101. this.formDatass.forEach((val) => {
  3102. if (!val.tableName || !val.tableType || !val.tableOwner) {
  3103. tag = false;
  3104. return;
  3105. } else {
  3106. da.push({
  3107. pkeyId: val.pkeyId,
  3108. nodeName: val.tableName,
  3109. tableType: val.tableType,
  3110. tableOwner: val.tableOwner,
  3111. fillRate: val.fillRate,
  3112. });
  3113. }
  3114. });
  3115. if (tag) {
  3116. this.updateBatchNodeTableInfo2(da);
  3117. } else {
  3118. this.$message({
  3119. type: "success",
  3120. message: "请填写完整元素表单的所有信息!",
  3121. });
  3122. }
  3123. },
  3124. async updateBatchNodeTableInfo2(da) {
  3125. this.editeditElementFormMFLoading=true
  3126. //共有编辑元素
  3127. const { data: res } = await updateBatchNodeTableInfo2(da);
  3128. if (res.code == 200) {
  3129. this.editElementFormTag = false;
  3130. this.updateNodeTable();
  3131. this.editeditElementFormMFLoading=false
  3132. }
  3133. this.editeditElementFormMFLoading=false
  3134. },
  3135. //#endregion
  3136. //获取节点展开路径
  3137. getExpandedKeys(node) {
  3138. //console.log(node)
  3139. let expandedKeys = [];
  3140. while (node.parent) {
  3141. expandedKeys.push(node.data.id);
  3142. node = node.parent;
  3143. }
  3144. setStore({
  3145. name: this.expandName,
  3146. content: expandedKeys,
  3147. type: true, //sessionStorage
  3148. });
  3149. //console.log(expandedKeys)
  3150. },
  3151. //触发节点参数
  3152. nodeInfoHandle() {
  3153. if (!this.curTreeData.id) {
  3154. this.$message({
  3155. type: "warning",
  3156. message: "请先选择节点",
  3157. });
  3158. return;
  3159. }
  3160. this.nodeInfo(this.curTreeData);
  3161. },
  3162. eleFormulaHandle() {
  3163. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3164. this.$message({
  3165. type: "warning",
  3166. message: "请先选择节点",
  3167. });
  3168. return;
  3169. }
  3170. this.setLeftType(4, this.curTreeData, this.curTreeNode);
  3171. // this.showType = 2;
  3172. },
  3173. editNodeHandle() {
  3174. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3175. this.$message({
  3176. type: "warning",
  3177. message: "请先选择节点",
  3178. });
  3179. return;
  3180. }
  3181. this.mixRatioTestIds = [];
  3182. this.nodeTypeChange(53);
  3183. this.dialogTitle='编辑节点'
  3184. this.setLeftType(2, this.curTreeData, this.curTreeNode);
  3185. },
  3186. addNodeHandle() {
  3187. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3188. this.$message({
  3189. type: "warning",
  3190. message: "请先选择节点",
  3191. });
  3192. return;
  3193. }
  3194. this.mixRatioTestIds = [];
  3195. this.nodeTypeChange(53);
  3196. this.dialogTitle='新增节点'
  3197. this.setLeftType(1, this.curTreeData, this.curTreeNode);
  3198. },
  3199. copyNodeHandle() {
  3200. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3201. this.$message({
  3202. type: "warning",
  3203. message: "请先选择节点",
  3204. });
  3205. return;
  3206. }
  3207. },
  3208. delNodeHandle() {
  3209. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3210. this.$message({
  3211. type: "warning",
  3212. message: "请先选择节点",
  3213. });
  3214. return;
  3215. }
  3216. if (this.curTreeNode.level == 1) {
  3217. this.$message({
  3218. type: "warning",
  3219. message: "当前节点无法删除",
  3220. });
  3221. return;
  3222. }
  3223. this.deleNode(this.curTreeData, this.curTreeNode);
  3224. },
  3225. eleHandle() {
  3226. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3227. this.$message({
  3228. type: "warning",
  3229. message: "请先选择节点",
  3230. });
  3231. return;
  3232. }
  3233. this.setLeftType(5, this.curTreeData, this.curTreeNode);
  3234. },
  3235. syncInfoHandle(item) {
  3236. if(this.curTreeData.primaryKeyId||this.curTreeData.pKeyId){
  3237. this.$confirm("是否同步节点参数?", "提示", {
  3238. confirmButtonText: "确定",
  3239. cancelButtonText: "取消",
  3240. type: "warning",
  3241. }).then(() => {
  3242. this.syncBtnLoad = true;
  3243. this.menuoptions.forEach((ele)=>{
  3244. if(item.value==ele.value){
  3245. ele.load=true
  3246. }
  3247. })
  3248. let pid=this.curTreeData.primaryKeyId?this.curTreeData.primaryKeyId:this.curTreeData.pKeyId
  3249. syncNodeParam(this.projectid,pid)
  3250. .then(() => {
  3251. this.$message({
  3252. type: "success",
  3253. message: "同步成功!",
  3254. });
  3255. })
  3256. .finally(() => {
  3257. this.syncBtnLoad = false;
  3258. this.menuoptions.forEach((ele)=>{
  3259. if(item.value==ele.value){
  3260. ele.load=false
  3261. }
  3262. })
  3263. });
  3264. });
  3265. }else{
  3266. this.$message.warning('请先选择左侧节点')
  3267. }
  3268. },
  3269. //显示别名弹窗
  3270. aliasShow() {
  3271. this.aliasVisible = true;
  3272. if (this.nodeDetail.fullName) {
  3273. this.aliasArr = this.nodeDetail.fullName.split(",");
  3274. } else {
  3275. this.aliasArr = [];
  3276. }
  3277. this.aliasInput = "";
  3278. },
  3279. addAlias() {
  3280. if (this.aliasInput) {
  3281. this.aliasArr.push(this.aliasInput);
  3282. this.aliasInput = "";
  3283. }
  3284. },
  3285. delAlias(index) {
  3286. this.aliasArr.splice(index, 1);
  3287. },
  3288. saveAliasHandle() {
  3289. this.nodeDetail.fullName = this.aliasArr.join(",");
  3290. if (this.editType == 1) {
  3291. //新增
  3292. this.aliasVisible = false;
  3293. } else if (this.editType == 2) {
  3294. //编辑 私有
  3295. privateSubmitFullName(
  3296. this.nodeDetail.pKeyId,
  3297. this.nodeDetail.fullName
  3298. ).then(() => {
  3299. this.$message({
  3300. type: "success",
  3301. message: "保存成功",
  3302. });
  3303. this.aliasVisible = false;
  3304. });
  3305. }
  3306. },
  3307. syncNodeTableHandle(data) {
  3308. this.$confirm("是否同步节点【" + data.title + "】?", "提示", {
  3309. confirmButtonText: "确定",
  3310. cancelButtonText: "取消",
  3311. type: "warning",
  3312. }).then(() => {
  3313. let notify = this.$notify({
  3314. title: "提示",
  3315. message: "节点数据同步中...",
  3316. duration: 0,
  3317. });
  3318. let pid=data.primaryKeyId?data.primaryKeyId:data.pKeyId
  3319. syncNodeTable(pid)
  3320. .then(() => {
  3321. this.updateNodeTable();
  3322. this.$message({
  3323. type: "success",
  3324. message: "同步成功",
  3325. });
  3326. })
  3327. .catch(() => {
  3328. this.$message({
  3329. type: "error",
  3330. message: "同步失败",
  3331. });
  3332. })
  3333. .finally(() => {
  3334. notify.close();
  3335. });
  3336. });
  3337. },
  3338. syncProjectHandle (data) {
  3339. this.$confirm("是否同步节点【" + data.title + "】到合同段?", "提示", {
  3340. confirmButtonText: "确定",
  3341. cancelButtonText: "取消",
  3342. type: "warning",
  3343. }).then(() => {
  3344. let notify = this.$notify({
  3345. title: "提示",
  3346. message: "节点数据同步中...",
  3347. duration: 0,
  3348. });
  3349. let pid=data.primaryKeyId?data.primaryKeyId:data.pKeyId
  3350. syncNodeinfo(pid)
  3351. .then(() => {
  3352. this.updateNodeTable();
  3353. this.$message({
  3354. type: "success",
  3355. message: "同步成功",
  3356. });
  3357. })
  3358. .catch(() => {
  3359. this.$message({
  3360. type: "error",
  3361. message: "同步失败",
  3362. });
  3363. })
  3364. .finally(() => {
  3365. notify.close();
  3366. });
  3367. });
  3368. },
  3369. //同步元素表单排序到合同段
  3370. syncSortHandle (data) {
  3371. this.$confirm("同步元素表单排序到合同段", "提示", {
  3372. confirmButtonText: "确定",
  3373. cancelButtonText: "取消",
  3374. type: "warning",
  3375. }).then(() => {
  3376. let notify = this.$notify({
  3377. title: "提示",
  3378. message: "节点数据同步中...",
  3379. duration: 0,
  3380. });
  3381. syncContractTabSort(this.projectid)
  3382. .then(() => {
  3383. this.updateNodeTable();
  3384. this.$message({
  3385. type: "success",
  3386. message: "同步成功",
  3387. });
  3388. })
  3389. .catch(() => {
  3390. this.$message({
  3391. type: "error",
  3392. message: "同步失败",
  3393. });
  3394. })
  3395. .finally(() => {
  3396. notify.close();
  3397. });
  3398. });
  3399. },
  3400. typeTreeLoadNode(node, resolve) {
  3401. let pid = 0;
  3402. if (node.level != 0) {
  3403. pid = node.data.id;
  3404. }
  3405. tabTypeLazyTree(pid, this.projectid).then((res) => {
  3406. let arr = [];
  3407. if (Array.isArray(res.data.data)) {
  3408. arr = res.data.data;
  3409. }
  3410. return resolve(arr);
  3411. });
  3412. },
  3413. getTypeTreeDetail() {},
  3414. independent(){
  3415. this.$router.push({
  3416. path: '/project/independent',
  3417. query: { pid: this.projectid,wbsid:this.$route.query.wbsid }
  3418. });
  3419. },
  3420. archiveTimeClick(){
  3421. this.$router.push({
  3422. path: '/project/archiveTime',
  3423. query: { pid: this.projectid,wbsid:this.$route.query.wbsid }
  3424. });
  3425. },
  3426. syncElectric(item){
  3427. if(this.curTreeData.primaryKeyId||this.curTreeData.pKeyId){
  3428. console.log('同步电签默认信息');
  3429. this.$confirm("是否同步电签默认信息?", "提示", {
  3430. confirmButtonText: "确定",
  3431. cancelButtonText: "取消",
  3432. type: "warning",
  3433. }).then(() => {
  3434. this.syncElectricLoad = true;
  3435. this.menuoptions.forEach((ele)=>{
  3436. if(item.value==ele.value){
  3437. ele.load=true
  3438. }
  3439. })
  3440. let pid=this.curTreeData.primaryKeyId?this.curTreeData.primaryKeyId:this.curTreeData.pKeyId
  3441. syncProjecteVisa(this.projectid,pid)
  3442. .then(() => {
  3443. this.$message({
  3444. type: "success",
  3445. message: "同步成功!",
  3446. });
  3447. })
  3448. .finally(() => {
  3449. this.syncElectricLoad = false;
  3450. this.menuoptions.forEach((ele)=>{
  3451. if(item.value==ele.value){
  3452. ele.load=false
  3453. }
  3454. })
  3455. });
  3456. });
  3457. }else{
  3458. this.$message.warning('请先选择左侧节点')
  3459. }
  3460. },
  3461. //节点参数 关联元素
  3462. linkEle(row){
  3463. console.log(row,'row');
  3464. if(!row.id){
  3465. this.$message.warning('请先保存数据,再点击关联元素')
  3466. }else{
  3467. this.linkEleVisible = true;
  3468. this.curParam = row;
  3469. getParamElements({nodeId:this.curTreeData.id,projectId:this.projectid,paramId:row.id,scopeType:10}).then((res) => {
  3470. if (res.data.data.length) {
  3471. this.linkEleTableList = res.data.data;
  3472. } else {
  3473. this.linkEleTableList = [];
  3474. }
  3475. })
  3476. }
  3477. },
  3478. //关联元素弹框
  3479. tolinkEle(row){
  3480. this.curLinkEleTable = row;
  3481. this.linkCheckVisible = true;
  3482. let pid=this.curTreeData.primaryKeyId?this.curTreeData.primaryKeyId:this.curTreeData.pKeyId
  3483. selectFormElements(row.id,{type:3,nodeId:pid}).then((res) => {
  3484. res.data.data.forEach((ele)=>{
  3485. ele.checked = false;
  3486. ele.show = true;
  3487. })
  3488. this.linkEleList = res.data.data;
  3489. this.linkEleListAll = [].concat(this.linkEleList);
  3490. })
  3491. },
  3492. //删除关联
  3493. delLink(data){
  3494. this.$confirm('删除关联, 是否继续?', '提示', {
  3495. confirmButtonText: '确定',
  3496. cancelButtonText: '取消',
  3497. type: 'warning'
  3498. }).then(() => {
  3499. console.log(data)
  3500. delParamElements(data).then(() => {
  3501. this.$message({
  3502. type: "success",
  3503. message: "删除成功!"
  3504. });
  3505. getParamElements({nodeId:this.curTreeData.id,projectId:this.projectid,paramId:this.curParam.id,scopeType:10}).then((res) => {
  3506. if (res.data.data.length) {
  3507. this.linkEleTableList = res.data.data;
  3508. } else {
  3509. this.linkEleTableList = [];
  3510. } })
  3511. })
  3512. }).catch(() => {
  3513. });
  3514. },
  3515. //筛选元素
  3516. searchEle(){
  3517. this.linkEleList = this.linkEleListAll.filter((ele)=>{
  3518. return ele.eName.indexOf(this.linkEleKey) > -1;
  3519. })
  3520. },
  3521. linkEleCheck(value,index){
  3522. //console.log(value)
  3523. if(value){
  3524. this.linkEleList.forEach((ele,i)=>{
  3525. if(i != index){
  3526. ele.checked = false;
  3527. }
  3528. })
  3529. }
  3530. },
  3531. //关联元素
  3532. saveLinkEle(){
  3533. let target={}
  3534. this.linkEleList.forEach(e=>{
  3535. if(e.checked==true){
  3536. target={elementId:e.id,paramId:this.curParam.id};
  3537. }
  3538. })
  3539. if(JSON.stringify(target) !== '{}'){
  3540. specifiedParamElements(target).then(data=>{
  3541. this.linkCheckVisible = false;
  3542. getParamElements({nodeId:this.curTreeData.id,projectId:this.projectid,paramId:this.curParam.id,scopeType:10}).then((res) => {
  3543. if (res.data.data.length) {
  3544. this.linkEleTableList = res.data.data;
  3545. } else {
  3546. this.linkEleTableList = [];
  3547. }})
  3548. })
  3549. }else{
  3550. this.$message.warning('请先选择关联元素')
  3551. }
  3552. },
  3553. //树形控件菜单相关方法
  3554. mouseout(){
  3555. this.menuvisible=false
  3556. },
  3557. //展示菜单
  3558. showMenu(e,data,node){
  3559. e.preventDefault();
  3560. console.log(e,'e');
  3561. var x = e.pageX; //这个应该是相对于整个浏览器页面的x坐标,左上角为坐标原点(0,0)
  3562. var y = e.pageY; //这个应该是相对于整个浏览器页面的y坐标,左上角为坐标原点(0,0)
  3563. this.menutop = y;
  3564. this.menuleft = x;
  3565. this.menuvisible=true
  3566. },
  3567. menuClick(e,item,data){
  3568. e.preventDefault();
  3569. if(item.key==='sort'){
  3570. this.sortpai(data)
  3571. }else if(item.key==='sync1'){
  3572. this.syncNodeTableHandle(data)
  3573. }else if(item.key==='sync2'){
  3574. this.syncProjectHandle(data)
  3575. }//
  3576. else if(item.key==='sync3'){
  3577. this.syncSortHandle(data)
  3578. }
  3579. else if(item.key==='add'){
  3580. this.addNodeHandle()
  3581. }
  3582. else if(item.key==='edit'){
  3583. this.editNodeHandle()
  3584. }
  3585. else if(item.key==='del'){
  3586. this.delNodeHandle()
  3587. }else if(item.value==='jdSync'){
  3588. this.syncInfoHandle(item)
  3589. }else if(item.value==='gsSync'){
  3590. this.$message({
  3591. type: "info",
  3592. message: "暂无相关接口!"
  3593. });
  3594. }else if(item.value==='dqSync'){
  3595. this.syncElectric(item)
  3596. }
  3597. },
  3598. //展示数据同步下拉框
  3599. showSyncbtn(){
  3600. this.isshowSyncbtn=!this.isshowSyncbtn
  3601. }
  3602. },
  3603. watch: {
  3604. "GLExcelFrom.search"(val) {
  3605. console.log(val);
  3606. if (this.exceldata) {
  3607. this.$refs.tree.filter(val);
  3608. }
  3609. },
  3610. },
  3611. components: {
  3612. dynamicExcel,
  3613. ManualSorting,
  3614. FormulaEdit,
  3615. EditElement,
  3616. FormulaEditone
  3617. },
  3618. };
  3619. </script>
  3620. <style scoped lang="scss">
  3621. .font-s-12 /deep/ .iconfont {
  3622. font-size: 12px;
  3623. }
  3624. .el-popper[x-placement^="bottom"] {
  3625. margin-top: -6px;
  3626. }
  3627. .right-btn {
  3628. position: absolute;
  3629. right: 20px;
  3630. top: 10px;
  3631. font-size: 20px;
  3632. }
  3633. .custom-tree-node {
  3634. .normal-black {
  3635. display: none;
  3636. }
  3637. &:hover {
  3638. .normal-black {
  3639. display: inline-block;
  3640. }
  3641. }
  3642. &.show .normal-black {
  3643. display: inline-block;
  3644. }
  3645. }
  3646. .excelBox {
  3647. /deep/.el-dialog__body {
  3648. padding: 20px;
  3649. }
  3650. }
  3651. //调整表单样式
  3652. .excelHtml {
  3653. position: absolute;
  3654. z-index: 999999;
  3655. top: 50px;
  3656. left: 0px;
  3657. width: 100%;
  3658. height: 100%;
  3659. }
  3660. .jiedian {
  3661. /deep/.el-dialog__body {
  3662. padding: 10px 20px !important;
  3663. }
  3664. }
  3665. .filter-tree {
  3666. min-width: 100%;
  3667. display: inline-block;
  3668. }
  3669. .full-dialog {
  3670. /deep/ .el-dialog__body {
  3671. padding-bottom: 0;
  3672. padding-top: 0;
  3673. }
  3674. /deep/ .basic-container {
  3675. height: calc(100vh - 60px);
  3676. }
  3677. }
  3678. .my-basic-con {
  3679. padding: 6px 6px;
  3680. }
  3681. // 树形控件菜单样式
  3682. .contextmenu {
  3683. margin: 0;
  3684. background: #fff;
  3685. z-index: 1000;
  3686. position: fixed; //关键样式设置固定定位
  3687. list-style-type: none;
  3688. padding: 5px 0;
  3689. border-radius: 4px;
  3690. font-size: 12px;
  3691. font-weight: 400;
  3692. color: #333;
  3693. box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
  3694. }
  3695. .contextmenu li {
  3696. margin: 0;
  3697. padding: 7px 16px;
  3698. cursor: pointer;
  3699. }
  3700. .contextmenu li:hover {
  3701. background: #eee;
  3702. }
  3703. .selectBtn{
  3704. position:absolute;
  3705. top:50px;
  3706. right: 408px;
  3707. z-index:1000;
  3708. width:140px;
  3709. text-align: left;
  3710. }
  3711. .titlerow{
  3712. // float: right;
  3713. background-color:rgba(31, 34, 41, 0.8);
  3714. // width:104%;
  3715. padding-left:10px;
  3716. padding-right:10px;
  3717. text-align:right;
  3718. margin-top: -20px;
  3719. margin-left: -20px;
  3720. margin-right: -20px;
  3721. }
  3722. </style>