edit.vue 99 KB

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