edit.vue 99 KB

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