edit.vue 98 KB

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