edit.vue 102 KB

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