tree.vue 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537
  1. <template>
  2. <basic-container>
  3. <el-row :gutter="20">
  4. <el-col :span="10">
  5. <div class="box">
  6. <p>工程节点信息</p>
  7. <div class="flex">
  8. <el-input
  9. placeholder="输入关键字进行过滤"
  10. v-model="filterText"
  11. @input="filterChange"
  12. clearable
  13. ></el-input>
  14. <!-- <el-button type="info" class="mg-l-20">导入划分</el-button> -->
  15. </div>
  16. <el-scrollbar>
  17. <div v-loading="treeLoad">
  18. <el-tree
  19. v-show="!filterText"
  20. class="filter-tree"
  21. lazy
  22. :data="treeData"
  23. :load="loadNode"
  24. @node-click="getNodeDetail"
  25. :props="defaultProps"
  26. :expand-on-click-node="false"
  27. highlight-current
  28. node-key="id"
  29. ref="tree"
  30. >
  31. <span
  32. class="custom-tree-node"
  33. :class="data.moreShow?'show':''"
  34. slot-scope="{ node, data }"
  35. >
  36. <!--@mouseover="mouseover(data)" @mouseleave="mouseout(data)"-->
  37. <span class="pd-r-20">
  38. {{ node.label }}
  39. <el-dropdown
  40. @click="command=>{setLeftType(command,data)}"
  41. @visible-change="visiblechange($event,data)"
  42. >
  43. <el-button
  44. type="text"
  45. icon="el-icon-more"
  46. class="normal-black"
  47. >
  48. </el-button>
  49. <el-dropdown-menu slot="dropdown">
  50. <el-dropdown-item
  51. @click.native="setLeftType(1,data,node)"
  52. icon="el-icon-circle-plus-outline"
  53. v-if="data.deptCategory != 6 && data.isExistForm != 1"
  54. >新增子级</el-dropdown-item>
  55. <el-dropdown-item
  56. @click.native="setLeftType(2,data,node)"
  57. icon="el-icon-edit"
  58. >编辑节点</el-dropdown-item>
  59. <el-dropdown-item
  60. @click.native="setLeftType(3,data,node)"
  61. icon="el-icon-document-copy"
  62. >复制节点</el-dropdown-item>
  63. <el-dropdown-item
  64. @click.native="deleNode(data,node)"
  65. icon="el-icon-close"
  66. v-if="node.level !=1"
  67. >删除节点</el-dropdown-item>
  68. <el-dropdown-item
  69. @click.native="setLeftType(4,data,node)"
  70. icon="iconfont hcicon-danganziliao-biaogetianxie"
  71. class="font-s-12"
  72. >元素公式</el-dropdown-item>
  73. <el-dropdown-item
  74. @click.native="setLeftType(5,data,node)"
  75. icon="el-icon-coin"
  76. >元素设置</el-dropdown-item>
  77. <el-dropdown-item
  78. @click.native="nodeInfo(data,node)"
  79. icon="el-icon-help"
  80. >节点参数</el-dropdown-item>
  81. <el-dropdown-item
  82. @click.native="importTemplate(data,node)"
  83. v-if="node.level == 2"
  84. icon="el-icon-upload"
  85. >导入划分</el-dropdown-item>
  86. <el-dropdown-item
  87. v-if="data.parentId!=0"
  88. @click.native="sortpai(data,node)"
  89. icon="el-icon-sort"
  90. >调整排序</el-dropdown-item>
  91. </el-dropdown-menu>
  92. </el-dropdown>
  93. </span>
  94. </span>
  95. </el-tree>
  96. <el-tree
  97. v-show="filterText"
  98. class="filter-tree"
  99. :data="treeData"
  100. @node-click="getNodeDetail"
  101. :props="defaultProps"
  102. :expand-on-click-node="false"
  103. highlight-current
  104. node-key="id"
  105. :filter-node-method="filterNode"
  106. ref="treeall"
  107. >
  108. <span
  109. class="custom-tree-node"
  110. slot-scope="{ node, data }"
  111. :class="data.moreShow?'show':''"
  112. >
  113. <span class="pd-r-20">
  114. {{ node.label }}
  115. <el-dropdown
  116. @click="command=>{setLeftType(command,data)}"
  117. @visible-change="visiblechange($event,data)"
  118. >
  119. <el-button
  120. type="text"
  121. icon="el-icon-more"
  122. class="normal-black"
  123. >
  124. </el-button>
  125. <el-dropdown-menu slot="dropdown">
  126. <el-dropdown-item
  127. @click.native="setLeftType(1,data,node)"
  128. icon="el-icon-circle-plus-outline"
  129. v-if="data.deptCategory != 6 && data.isExistForm != 1"
  130. >新增子级</el-dropdown-item>
  131. <el-dropdown-item
  132. @click.native="setLeftType(2,data,node)"
  133. icon="el-icon-edit"
  134. >编辑节点</el-dropdown-item>
  135. <el-dropdown-item
  136. @click.native="setLeftType(3,data,node)"
  137. icon="el-icon-document-copy"
  138. >复制节点</el-dropdown-item>
  139. <el-dropdown-item
  140. @click.native="deleNode(data,node)"
  141. icon="el-icon-close"
  142. v-if="node.level !=1"
  143. >删除节点</el-dropdown-item>
  144. <el-dropdown-item
  145. @click.native="setLeftType(4,data,node)"
  146. icon="iconfont hcicon-danganziliao-biaogetianxie"
  147. class="font-s-12"
  148. >元素公式</el-dropdown-item>
  149. <el-dropdown-item
  150. @click.native="setLeftType(5,data,node)"
  151. icon="el-icon-coin"
  152. >元素设置</el-dropdown-item>
  153. <el-dropdown-item
  154. @click.native="nodeInfo(data)"
  155. icon="el-icon-help"
  156. >节点参数</el-dropdown-item>
  157. <el-dropdown-item
  158. @click.native="importTemplate(data,node)"
  159. v-if="node.level == 2"
  160. icon="el-icon-upload"
  161. >导入划分</el-dropdown-item>
  162. </el-dropdown-menu>
  163. </el-dropdown>
  164. </span>
  165. </span>
  166. </el-tree>
  167. </div>
  168. </el-scrollbar>
  169. </div>
  170. </el-col>
  171. <el-col :span="14">
  172. <template v-if="leftType==5">
  173. <p>节点信息</p>
  174. <el-table
  175. :data="tableData"
  176. border
  177. style="width: 100%"
  178. >
  179. <el-table-column
  180. align="center"
  181. prop="deptName"
  182. label="当前节点"
  183. ></el-table-column>
  184. <el-table-column
  185. align="center"
  186. prop="deptCategory"
  187. :formatter="formatCat"
  188. label="节点类型"
  189. width="180"
  190. ></el-table-column>
  191. <el-table-column
  192. align="center"
  193. prop="parentName"
  194. label="上级节点"
  195. ></el-table-column>
  196. </el-table>
  197. <p>
  198. <span>当前项目信息表</span>
  199. <!-- <el-button
  200. @click="showFormElement"
  201. type="text"
  202. icon="el-icon-circle-plus-outline"
  203. class="text-icon mg-l-10"
  204. ></el-button>
  205. <el-button
  206. type="text"
  207. icon="el-icon-document-copy"
  208. class="text-icon"
  209. ></el-button> -->
  210. <i
  211. class="el-icon-edit-outline marleft10"
  212. size="26"
  213. style="color:#409EFF;cursor: pointer;"
  214. @click="editEditElementForm()"
  215. ></i>
  216. <i
  217. class="el-icon-sort marleft10"
  218. size="26"
  219. @click="privateTableSort()"
  220. style="color:#409EFF;cursor: pointer;"
  221. ></i>
  222. </p>
  223. <el-table
  224. :data="formData"
  225. border
  226. style="width: 100%"
  227. >
  228. <el-table-column
  229. align="center"
  230. prop="tableName"
  231. label="表单名称"
  232. ></el-table-column>
  233. <el-table-column
  234. align="center"
  235. prop="elementTotal"
  236. label="字段总量"
  237. ></el-table-column>
  238. <el-table-column
  239. align="center"
  240. prop="tableType"
  241. :formatter="formatTableType"
  242. label="表单类型"
  243. ></el-table-column>
  244. <el-table-column
  245. align="center"
  246. prop="tableOwner"
  247. :formatter="formatOwner"
  248. label="所属方"
  249. ></el-table-column>
  250. <el-table-column label="操作">
  251. <template slot-scope="scope">
  252. <el-button
  253. size="mini"
  254. @click="handleEdit(scope.$index, scope.row)"
  255. >编辑</el-button>
  256. <el-button
  257. size="mini"
  258. type="danger"
  259. @click="handleDelete(scope.$index, scope.row)"
  260. >删除</el-button>
  261. </template>
  262. </el-table-column>
  263. </el-table>
  264. </template>
  265. <template v-if="leftType==4">
  266. <el-table
  267. :data="formData"
  268. border
  269. style="width: 100%"
  270. >
  271. <el-table-column
  272. align="center"
  273. prop="tableName"
  274. label="表单名称"
  275. ></el-table-column>
  276. <el-table-column
  277. align="center"
  278. prop="tableType"
  279. :formatter="formatTableType"
  280. label="表单类型"
  281. ></el-table-column>
  282. <el-table-column
  283. label="是否关联清表"
  284. width="130"
  285. prop="isLinkTable"
  286. align="center"
  287. >
  288. <template slot-scope="scope">
  289. <span v-if="scope.row.isLinkTable == 2">是</span>
  290. <span v-else>否</span>
  291. </template>
  292. </el-table-column>
  293. <el-table-column
  294. align="center"
  295. prop="tableOwner"
  296. :formatter="formatOwner"
  297. label="所属方"
  298. ></el-table-column>
  299. <el-table-column
  300. label="操作"
  301. width="350"
  302. align="center"
  303. >
  304. <template slot-scope="scope">
  305. <el-link
  306. type="primary"
  307. :disabled='scope.row.isLinkTable==-1'
  308. @click="rightClick(scope.row.pkeyId,scope.row.excelId,scope.row.id,scope.row.initTableName)"
  309. >编辑元素</el-link>
  310. <el-link
  311. class="mg-l-10"
  312. type="primary"
  313. @click="Associationlist(scope)"
  314. >关联清表</el-link>
  315. <el-link
  316. class="mg-l-10"
  317. type="primary"
  318. :disabled='scope.row.isLinkTable!=2'
  319. @click="adjustExcel(scope.row.pkeyId,scope.row.excelId)"
  320. >调整表单</el-link>
  321. <el-link
  322. class="mg-l-10"
  323. type="danger"
  324. @click="handleDelete(scope.$index, scope.row)"
  325. >删除表单</el-link>
  326. <!-- <el-button
  327. size="mini"
  328. @click="handleEditFormula(scope.$index, scope.row)">编辑元素公式</el-button> -->
  329. </template>
  330. </el-table-column>
  331. </el-table>
  332. </template>
  333. </el-col>
  334. </el-row>
  335. <!-- 编辑元素表单信息 -->
  336. <el-dialog
  337. title="编辑元素表单信息"
  338. :visible="editElementFormTag"
  339. width="60%"
  340. :modal-append-to-body="false"
  341. >
  342. <div>
  343. <el-table
  344. :data="formDatass"
  345. border
  346. style="width: 100%"
  347. >
  348. <el-table-column
  349. prop="tableName"
  350. label="表名"
  351. >
  352. <template slot-scope="scope">
  353. <el-input
  354. v-model="scope.row.tableName"
  355. placeholder="请输入表名称"
  356. ></el-input>
  357. </template>
  358. </el-table-column>
  359. <el-table-column
  360. prop="tableType"
  361. label="表类型"
  362. >
  363. <template slot-scope="scope">
  364. <el-select
  365. v-model="scope.row.tableType"
  366. placeholder="请选择"
  367. >
  368. <el-option
  369. v-for="(item,key) in tableTypelist"
  370. :key="key"
  371. :label="item.dictValue"
  372. :value="item.dictKey"
  373. >
  374. </el-option>
  375. </el-select>
  376. </template>
  377. </el-table-column>
  378. <el-table-column
  379. prop="tableOwner"
  380. label="所属方"
  381. >
  382. <template slot-scope="scope">
  383. <el-select
  384. v-model="scope.row.tableOwner"
  385. placeholder="请选择"
  386. >
  387. <el-option
  388. v-for="(item,key) in ownerTypeList"
  389. :key="key"
  390. :label="item.dictValue"
  391. :value="item.dictKey"
  392. >
  393. </el-option>
  394. </el-select>
  395. </template>
  396. </el-table-column>
  397. </el-table>
  398. </div>
  399. <span
  400. slot="footer"
  401. class="dialog-footer"
  402. >
  403. <el-button @click="editElementFormTag = false">取 消</el-button>
  404. <el-button
  405. type="primary"
  406. @click="editeditElementFormMF()"
  407. >确 定</el-button>
  408. </span>
  409. </el-dialog>
  410. <!-- 调整表单模板 -->
  411. <div
  412. v-if="excelHtml"
  413. class="excelHtml"
  414. >
  415. <dynamicExcel
  416. @remove="removeExcel"
  417. v-if="excelHtml"
  418. :pkeyId='GLExcelFrom.id'
  419. />
  420. </div>
  421. <!-- 私有wbs树排序弹框 -->
  422. <el-dialog
  423. title="调整排序"
  424. :visible="sortTag"
  425. width="50%"
  426. append-to-body
  427. >
  428. <ManualSorting
  429. v-if="sortTag2"
  430. @bianhua='bianhua()'
  431. :sort='sort'
  432. />
  433. <span
  434. slot="footer"
  435. class="dialog-footer"
  436. >
  437. <el-button @click="sortTag=false,sortTag2=false">取 消</el-button>
  438. <el-button
  439. type="primary"
  440. @click="editSort()"
  441. >确 定</el-button>
  442. </span>
  443. </el-dialog>
  444. <!-- 元素表排序 -->
  445. <el-dialog
  446. title="调整排序"
  447. :visible="excelSortTag"
  448. width="50%"
  449. append-to-body
  450. >
  451. <ManualSorting
  452. v-if="excelSortTag2"
  453. @bianhua='bianhua2()'
  454. :sort='tableSortList'
  455. />
  456. <span
  457. slot="footer"
  458. class="dialog-footer"
  459. >
  460. <el-button @click="excelSortTag=false">取 消</el-button>
  461. <el-button
  462. type="primary"
  463. @click="editPrivateSort()"
  464. >确 定</el-button>
  465. </span>
  466. </el-dialog>
  467. <!-- 关联清表 -->
  468. <el-dialog
  469. title="关联清表"
  470. class="excelBox"
  471. :visible.sync="GLExcel"
  472. width="500px"
  473. modal-append-to-body
  474. append-to-body
  475. @close="GLExcelMD"
  476. >
  477. <div>
  478. <el-select
  479. style="width:400px;"
  480. v-model="GLExcelFrom.name"
  481. placeholder="请选择"
  482. @change="changetherr()"
  483. >
  484. <el-option
  485. v-for="(item,key) in GLExcelData"
  486. :key="key"
  487. :label="item.name"
  488. :value="item.id"
  489. >
  490. </el-option>
  491. </el-select>
  492. <el-scrollbar style="margin-top:20px;height:50vh;">
  493. <el-input
  494. style="width:400px;"
  495. v-model.trim="GLExcelFrom.search"
  496. placeholder="请输入需要选择的内容"
  497. ></el-input>
  498. <el-tree
  499. :filter-node-method="filterNode222"
  500. ref="tree"
  501. class="filter-tree"
  502. style="margin-top:10px;"
  503. :props="GLExcelProps"
  504. :data="exceldata"
  505. node-key="id"
  506. accordion
  507. show-checkbox
  508. @check="checkchange"
  509. >
  510. </el-tree>
  511. </el-scrollbar>
  512. </div>
  513. <span
  514. slot="footer"
  515. class="dialog-footer"
  516. style="display: flex;justify-content: center;align-items: center;"
  517. >
  518. <el-button @click="GLExcelMD()">取 消</el-button>
  519. <el-button
  520. style="margin-left:30px;"
  521. type="primary"
  522. @click="saveLinkTab()"
  523. >确 定</el-button>
  524. </span>
  525. </el-dialog>
  526. <el-dialog
  527. :title="dialogTitle"
  528. :visible.sync="dialogVisible"
  529. width="50%"
  530. append-to-body
  531. :close-on-click-modal="false"
  532. @closed="saveNodeLoading = false"
  533. >
  534. <el-form
  535. ref="nodeDetail"
  536. :model="nodeDetail"
  537. :rules="rules"
  538. label-width="110px"
  539. >
  540. <el-form-item
  541. label="节点名称"
  542. prop="deptName"
  543. >
  544. <el-input v-model="nodeDetail.deptName"></el-input>
  545. </el-form-item>
  546. <el-form-item label="上级节点">
  547. <el-input
  548. v-model="nodeDetail.parentName"
  549. disabled
  550. ></el-input>
  551. </el-form-item>
  552. <el-form-item
  553. label="节点类型"
  554. prop="deptCategory"
  555. >
  556. <el-select
  557. v-model="nodeDetail.deptCategory"
  558. placeholder="请选择"
  559. class="w-100p"
  560. >
  561. <el-option
  562. v-for="item in deptCategorylist"
  563. :key="item.id"
  564. :label="item.dictValue"
  565. :value="item.dictKey"
  566. ></el-option>
  567. </el-select>
  568. </el-form-item>
  569. <el-form-item label="划分编号">
  570. <el-input v-model="nodeDetail.partitionCode"></el-input>
  571. </el-form-item>
  572. <el-form-item label="唯一编码">
  573. <el-input v-model="nodeDetail.uniqueCode"></el-input>
  574. </el-form-item>
  575. <template v-if="nodeDetail.deptCategory == 6">
  576. <el-form-item label="是否有混凝土">
  577. <el-radio-group
  578. v-model="nodeDetail.isConcrete"
  579. size="small"
  580. >
  581. <el-radio
  582. :label="0"
  583. border
  584. >无</el-radio>
  585. <el-radio
  586. :label="1"
  587. border
  588. >有</el-radio>
  589. </el-radio-group>
  590. </el-form-item>
  591. <el-form-item label="是否试验节点">
  592. <el-radio-group
  593. v-model="nodeDetail.isExpernode"
  594. size="small"
  595. >
  596. <el-radio
  597. :label="0"
  598. border
  599. >否</el-radio>
  600. <el-radio
  601. :label="1"
  602. border
  603. >是</el-radio>
  604. </el-radio-group>
  605. </el-form-item>
  606. </template>
  607. <el-form-item label="内业资料类型">
  608. <el-select
  609. v-model="nodeDetail.majorDataType"
  610. placeholder="请选择"
  611. class="w-100p"
  612. >
  613. <el-option
  614. v-for="item in majorDataTypeList"
  615. :key="item.id"
  616. :label="item.dictValue"
  617. :value="item.dictKey"
  618. ></el-option>
  619. </el-select>
  620. </el-form-item>
  621. </el-form>
  622. <span
  623. slot="footer"
  624. class="dialog-footer"
  625. >
  626. <el-button @click="dialogVisible = false">取 消</el-button>
  627. <el-button
  628. type="primary"
  629. @click="saveNode"
  630. :loading="saveNodeLoading"
  631. >确 定</el-button>
  632. </span>
  633. </el-dialog>
  634. <el-dialog
  635. title="创建新的元素表"
  636. :visible.sync="eleVisible"
  637. width="80%"
  638. append-to-body
  639. :close-on-click-modal="false"
  640. >
  641. <el-form
  642. ref="eleDialog"
  643. :model="eleForm"
  644. :rules="eleRules"
  645. label-width="110px"
  646. >
  647. <el-form-item
  648. label="表名"
  649. prop="deptName"
  650. >
  651. <el-input v-model="eleForm.deptName"></el-input>
  652. </el-form-item>
  653. <el-row>
  654. <el-col :span="12">
  655. <el-form-item
  656. label="表类型"
  657. prop="tableType"
  658. >
  659. <el-select
  660. v-model="eleForm.tableType"
  661. placeholder="请选择"
  662. class="w-100p"
  663. >
  664. <el-option
  665. v-for="item in tableTypelist"
  666. :key="item.id"
  667. :label="item.dictValue"
  668. :value="item.dictKey"
  669. ></el-option>
  670. </el-select>
  671. </el-form-item>
  672. </el-col>
  673. <el-col :span="12">
  674. <el-form-item
  675. label="所属方"
  676. prop="tableOwner"
  677. >
  678. <el-select
  679. v-model="eleForm.tableOwner"
  680. placeholder="请选择"
  681. class="w-100p"
  682. >
  683. <el-option
  684. v-for="item in ownerTypeList"
  685. :key="item.id"
  686. :label="item.dictValue"
  687. :value="item.dictKey"
  688. ></el-option>
  689. </el-select>
  690. </el-form-item>
  691. </el-col>
  692. </el-row>
  693. </el-form>
  694. <div class="flex jc-sb">
  695. <div></div>
  696. <div>
  697. <el-link
  698. type="primary"
  699. @click="importVisible = true"
  700. >快捷导入</el-link>
  701. <el-link
  702. type="primary"
  703. class="mg-l-20"
  704. @click="downloadTmp"
  705. >下载导入模版</el-link>
  706. </div>
  707. </div>
  708. <div class="border-grey">
  709. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  710. <el-table
  711. :data="eleForm.elementList"
  712. border
  713. style="width: 100%"
  714. height="400px"
  715. >
  716. <el-table-column
  717. align="center"
  718. type="index"
  719. width="50"
  720. ></el-table-column>
  721. <el-table-column
  722. align="center"
  723. prop="eName"
  724. label="字段名称"
  725. >
  726. <template slot-scope="scope">
  727. <el-input
  728. v-model="scope.row.eName"
  729. size="small"
  730. placeholder="请输入内容"
  731. ></el-input>
  732. </template>
  733. </el-table-column>
  734. <el-table-column
  735. align="center"
  736. prop="eType"
  737. label="数据类型"
  738. width="120"
  739. >
  740. <template slot-scope="scope">
  741. <el-select
  742. v-model="scope.row.eType"
  743. size="small"
  744. placeholder="请选择"
  745. >
  746. <el-option
  747. v-for="item in dataTypeList"
  748. :key="item.id"
  749. :label="item.dictValue"
  750. :value="item.dictKey"
  751. ></el-option>
  752. </el-select>
  753. </template>
  754. </el-table-column>
  755. <el-table-column
  756. align="center"
  757. prop="eLength"
  758. label="长度"
  759. width="120"
  760. >
  761. <template slot-scope="scope">
  762. <el-input
  763. v-model="scope.row.eLength"
  764. size="small"
  765. placeholder="请输入内容"
  766. :disabled="scope.row.eType == 4"
  767. ></el-input>
  768. </template>
  769. </el-table-column>
  770. <el-table-column
  771. align="center"
  772. prop="eAllowDeviation"
  773. label="允许偏差值"
  774. >
  775. <template slot-scope="scope">
  776. <div class="flex">
  777. <el-select
  778. v-model="scope.row.allow"
  779. size="small"
  780. placeholder="请选择"
  781. style="width:120px"
  782. >
  783. <el-option
  784. :key="1"
  785. label="≥"
  786. value="≥"
  787. ></el-option>
  788. <el-option
  789. :key="2"
  790. label="≤"
  791. value="≤"
  792. ></el-option>
  793. <el-option
  794. :key="3"
  795. label="±"
  796. value="±"
  797. ></el-option>
  798. <el-option
  799. :key="4"
  800. label="【】"
  801. value="【】"
  802. ></el-option>
  803. </el-select>
  804. <el-input
  805. v-model="scope.row.deviation"
  806. size="small"
  807. placeholder="请输入内容"
  808. ></el-input>
  809. </div>
  810. </template>
  811. </el-table-column>
  812. <el-table-column
  813. align="center"
  814. prop="eInspectionMethod"
  815. label="检查方法和频率"
  816. >
  817. <template slot-scope="scope">
  818. <el-input
  819. v-model="scope.row.eInspectionMethod"
  820. size="small"
  821. placeholder="请输入内容"
  822. ></el-input>
  823. </template>
  824. </el-table-column>
  825. <el-table-column
  826. align="center"
  827. label="操作"
  828. width="80"
  829. >
  830. <template slot="header">
  831. <el-button
  832. @click="addEleRow(eleForm.elementList)"
  833. type="text"
  834. icon="el-icon-circle-plus-outline"
  835. class="text-icon"
  836. ></el-button>
  837. </template>
  838. <template slot-scope="scope">
  839. <el-button
  840. icon="el-icon-remove-outline"
  841. type="text"
  842. @click="delEleRow(scope.$index,eleForm.elementList)"
  843. class="text-icon text-icon-danger"
  844. ></el-button>
  845. </template>
  846. </el-table-column>
  847. </el-table>
  848. </div>
  849. <span
  850. slot="footer"
  851. class="dialog-footer"
  852. >
  853. <el-button @click="eleVisible = false">取 消</el-button>
  854. <el-button
  855. type="primary"
  856. @click="saveFormAndElementHandle"
  857. >保 存</el-button>
  858. </span>
  859. </el-dialog>
  860. <el-dialog
  861. title="模版导入"
  862. :visible.sync="importVisible"
  863. width="50%"
  864. append-to-body
  865. :close-on-click-modal="false"
  866. >
  867. <p>提示:必须按照系统要求的模版格式上传,否则系统识别无效 <el-link
  868. type="primary"
  869. @click="downloadTmp"
  870. >下载导入模版</el-link>
  871. </p>
  872. <div>
  873. <el-button
  874. size="small"
  875. type="primary"
  876. @click="fileClick2"
  877. >本地上传</el-button>
  878. <input
  879. @change="tmpImport"
  880. type="file"
  881. hidden
  882. ref="file2"
  883. accept=".xls, .xlsx"
  884. >
  885. </div>
  886. <el-table
  887. :data="tempList"
  888. border
  889. style="width: 100%"
  890. >
  891. <el-table-column
  892. align="center"
  893. prop="eName"
  894. label="字段信息"
  895. >
  896. </el-table-column>
  897. <el-table-column
  898. align="center"
  899. prop="eType"
  900. label="数据类型"
  901. width="120"
  902. >
  903. </el-table-column>
  904. <el-table-column
  905. align="center"
  906. prop="eLength"
  907. label="长度"
  908. width="120"
  909. >
  910. </el-table-column>
  911. <el-table-column
  912. align="center"
  913. prop="eAllowDeviation"
  914. label="允许偏差值"
  915. >
  916. </el-table-column>
  917. <el-table-column
  918. align="center"
  919. prop="eInspectionMethod"
  920. label="检查方法和频率"
  921. >
  922. </el-table-column>
  923. </el-table>
  924. <span
  925. slot="footer"
  926. class="dialog-footer"
  927. >
  928. <el-button @click="importVisible = false">取 消</el-button>
  929. <el-button
  930. type="primary"
  931. @click="importHandle"
  932. >确 定</el-button>
  933. </span>
  934. </el-dialog>
  935. <el-dialog
  936. :title="(curEleTable.tableName?curEleTable.tableName:'')+' 元素编辑'"
  937. :visible.sync="editEleVisible"
  938. width="80%"
  939. append-to-body
  940. :close-on-click-modal="false"
  941. >
  942. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  943. <el-table
  944. :data="editEleList"
  945. border
  946. style="width: 100%"
  947. height="400px"
  948. >
  949. <el-table-column
  950. align="center"
  951. type="index"
  952. width="50"
  953. ></el-table-column>
  954. <el-table-column
  955. align="center"
  956. prop="eName"
  957. label="字段信息"
  958. >
  959. <template slot-scope="scope">
  960. <el-input
  961. v-model="scope.row.eName"
  962. size="small"
  963. placeholder="请输入内容"
  964. ></el-input>
  965. </template>
  966. </el-table-column>
  967. <el-table-column
  968. align="center"
  969. prop="eType"
  970. label="数据类型"
  971. width="120"
  972. >
  973. <template slot-scope="scope">
  974. <el-select
  975. v-model="scope.row.eType"
  976. size="small"
  977. placeholder="请选择"
  978. >
  979. <el-option
  980. v-for="item in dataTypeList"
  981. :key="item.id"
  982. :label="item.dictValue"
  983. :value="item.dictKey"
  984. ></el-option>
  985. </el-select>
  986. </template>
  987. </el-table-column>
  988. <el-table-column
  989. align="center"
  990. prop="eLength"
  991. label="长度"
  992. width="120"
  993. >
  994. <template slot-scope="scope">
  995. <el-input
  996. v-model="scope.row.eLength"
  997. size="small"
  998. placeholder="请输入内容"
  999. :disabled="scope.row.eType == 4"
  1000. ></el-input>
  1001. </template>
  1002. </el-table-column>
  1003. <el-table-column
  1004. align="center"
  1005. prop="eAllowDeviation"
  1006. label="允许偏差值"
  1007. >
  1008. <template slot-scope="scope">
  1009. <div class="flex">
  1010. <el-select
  1011. v-model="scope.row.allow"
  1012. size="small"
  1013. placeholder="请选择"
  1014. style="width:120px"
  1015. >
  1016. <el-option
  1017. :key="1"
  1018. label="≥"
  1019. value="≥"
  1020. ></el-option>
  1021. <el-option
  1022. :key="2"
  1023. label="≤"
  1024. value="≤"
  1025. ></el-option>
  1026. <el-option
  1027. :key="3"
  1028. label="±"
  1029. value="±"
  1030. ></el-option>
  1031. <el-option
  1032. :key="4"
  1033. label="【】"
  1034. value="【】"
  1035. ></el-option>
  1036. </el-select>
  1037. <el-input
  1038. v-model="scope.row.deviation"
  1039. size="small"
  1040. placeholder="请输入内容"
  1041. ></el-input>
  1042. </div>
  1043. </template>
  1044. </el-table-column>
  1045. <el-table-column
  1046. align="center"
  1047. prop="eInspectionMethod"
  1048. label="检查方法和频率"
  1049. >
  1050. <template slot-scope="scope">
  1051. <el-input
  1052. v-model="scope.row.eInspectionMethod"
  1053. size="small"
  1054. placeholder="请输入内容"
  1055. ></el-input>
  1056. </template>
  1057. </el-table-column>
  1058. <el-table-column
  1059. align="center"
  1060. label="操作"
  1061. width="120"
  1062. >
  1063. <template slot="header">
  1064. <el-button
  1065. @click="addEleRow(editEleList)"
  1066. type="text"
  1067. icon="el-icon-circle-plus-outline"
  1068. class="text-icon"
  1069. ></el-button>
  1070. </template>
  1071. <template slot-scope="scope">
  1072. <el-button
  1073. v-if="scope.row.id"
  1074. icon="el-icon-remove-outline"
  1075. type="text"
  1076. @click="delEleRowHandle(scope.$index,editEleList)"
  1077. class="text-icon text-icon-danger"
  1078. ></el-button>
  1079. <div
  1080. class="flex"
  1081. v-else
  1082. >
  1083. <el-button
  1084. @click="saveNewEle(scope.row)"
  1085. type="mini"
  1086. >保存</el-button>
  1087. <el-button
  1088. icon="el-icon-remove-outline"
  1089. type="text"
  1090. @click="delEleRowHandle(scope.$index,editEleList)"
  1091. class="text-icon text-icon-danger"
  1092. ></el-button>
  1093. </div>
  1094. </template>
  1095. </el-table-column>
  1096. </el-table>
  1097. <span
  1098. slot="footer"
  1099. class="dialog-footer"
  1100. >
  1101. <el-button @click="editEleVisible = false">取 消</el-button>
  1102. <el-button
  1103. type="primary"
  1104. @click="saveEles"
  1105. >确 定</el-button>
  1106. </span>
  1107. </el-dialog>
  1108. <el-dialog
  1109. title="元素公式"
  1110. :visible.sync="editEleFormulaVisible"
  1111. width="800px"
  1112. append-to-body
  1113. :close-on-click-modal="false"
  1114. >
  1115. <div class="flex mg-b-10">
  1116. <el-input
  1117. v-model="formulaInput"
  1118. placeholder="请输入内容"
  1119. size="samll"
  1120. ></el-input>
  1121. <el-button type="info">保存</el-button>
  1122. </div>
  1123. <el-table
  1124. :data="editEleList"
  1125. border
  1126. style="width: 100%"
  1127. height="400px"
  1128. >
  1129. <el-table-column
  1130. align="center"
  1131. prop="eName"
  1132. label="字段信息"
  1133. >
  1134. </el-table-column>
  1135. <el-table-column
  1136. align="center"
  1137. label="操作"
  1138. width="200"
  1139. >
  1140. <template slot-scope="scope">
  1141. <el-link type="primary">公式配置</el-link>
  1142. <el-link
  1143. class="mg-l-10"
  1144. type="danger"
  1145. @click="delEleRowHandle(scope.$index,editEleList)"
  1146. >删除</el-link>
  1147. </template>
  1148. </el-table-column>
  1149. </el-table>
  1150. </el-dialog>
  1151. <el-dialog
  1152. title="导入划分"
  1153. :visible.sync="importTemplateVisible"
  1154. width="800px"
  1155. append-to-body
  1156. :close-on-click-modal="false"
  1157. >
  1158. <div v-loading="importLoading">
  1159. <div>
  1160. <el-link
  1161. type="primary"
  1162. @click="handleDownload"
  1163. >下载导入模版</el-link>
  1164. </div>
  1165. <div class="mg-t-20">
  1166. <el-button
  1167. type="primary"
  1168. @click="fileClick"
  1169. >选择文件</el-button>
  1170. <span
  1171. v-if="upFile"
  1172. class="mg-l-20"
  1173. >{{upFile.name}}</span>
  1174. <input
  1175. @change="fileChange"
  1176. type="file"
  1177. hidden
  1178. ref="file"
  1179. accept=".xls, .xlsx"
  1180. >
  1181. </div>
  1182. <div v-if="!upFile">当前还未选择文件,请选择需要导入的文件</div>
  1183. </div>
  1184. <span
  1185. slot="footer"
  1186. class="dialog-footer"
  1187. >
  1188. <el-button @click="importTemplateVisible = false">取 消</el-button>
  1189. <el-button
  1190. type="primary"
  1191. @click="importTemplateHandle"
  1192. :loading="importLoading"
  1193. >导 入</el-button>
  1194. </span>
  1195. </el-dialog>
  1196. <el-dialog
  1197. title="节点参数"
  1198. :visible.sync="nodeInfoVisible"
  1199. width="800px"
  1200. append-to-body
  1201. class="jiedian"
  1202. :close-on-click-modal="false"
  1203. :show-close="false"
  1204. >
  1205. <div>
  1206. <el-button
  1207. type="text"
  1208. icon="el-icon-s-operation"
  1209. class="right-btn"
  1210. @click="setNodeParameters()"
  1211. ></el-button>
  1212. <div class="flexEnd">
  1213. <i
  1214. class="el-icon-circle-plus marbottom10"
  1215. @click="addNodeInfoTable()"
  1216. style="font-size:24px;color:rgb(37, 193, 99);cursor: pointer;"
  1217. ></i>
  1218. </div>
  1219. <el-table
  1220. :data="nodeInfoTable"
  1221. border
  1222. style="width: 100%"
  1223. height="400"
  1224. >
  1225. <el-table-column
  1226. align="center"
  1227. prop="name"
  1228. label="参数名称"
  1229. >
  1230. <template slot-scope="scope">
  1231. <el-select
  1232. v-model="scope.row.k"
  1233. placeholder="请选择"
  1234. class="w-100p"
  1235. >
  1236. <el-option
  1237. v-for="item in namelist"
  1238. :key="item.k"
  1239. :label="item.name"
  1240. :value="item.k"
  1241. ></el-option>
  1242. </el-select>
  1243. </template>
  1244. </el-table-column>
  1245. <el-table-column
  1246. align="center"
  1247. prop="value"
  1248. label="参数值设置"
  1249. >
  1250. <template slot-scope="scope">
  1251. <el-input v-model="scope.row.v"></el-input>
  1252. </template>
  1253. </el-table-column>
  1254. <el-table-column
  1255. align="center"
  1256. prop="describe"
  1257. label="描述"
  1258. >
  1259. <template slot-scope="scope">
  1260. <el-input v-model="scope.row.remark"></el-input>
  1261. </template>
  1262. </el-table-column>
  1263. <el-table-column
  1264. label="操作"
  1265. width="120"
  1266. align="center"
  1267. >
  1268. <template slot-scope="scope">
  1269. <el-button
  1270. type="text"
  1271. size="small"
  1272. class="text-icon-danger"
  1273. @click="delNodeInfoss(scope.$index)"
  1274. >删除</el-button>
  1275. </template>
  1276. </el-table-column>
  1277. </el-table>
  1278. </div>
  1279. <span
  1280. slot="footer"
  1281. class="dialog-footer"
  1282. >
  1283. <el-button @click="nodeInfoVisible = false">取 消</el-button>
  1284. <el-button
  1285. type="primary"
  1286. @click="nodeInfoSave()"
  1287. >保 存</el-button>
  1288. </span>
  1289. </el-dialog>
  1290. <!-- 设置参数名称 -->
  1291. <el-dialog
  1292. title="设置参数名称"
  1293. :visible.sync="infoNameVisible"
  1294. width="800px"
  1295. append-to-body
  1296. class="jiedian"
  1297. :close-on-click-modal="false"
  1298. >
  1299. <div>
  1300. <div class="flexEnd">
  1301. <i
  1302. class="el-icon-circle-plus marbottom10"
  1303. @click="setParameterName()"
  1304. style="font-size:24px;color:rgb(37, 193, 99);cursor: pointer;"
  1305. ></i>
  1306. </div>
  1307. <el-table
  1308. :data="namelists"
  1309. border
  1310. style="width: 100%"
  1311. height="400"
  1312. >
  1313. <el-table-column
  1314. align="center"
  1315. prop="name"
  1316. label="参数名称"
  1317. >
  1318. <template slot-scope="scope">
  1319. <el-input v-model="scope.row.name"></el-input>
  1320. </template>
  1321. </el-table-column>
  1322. <el-table-column
  1323. align="center"
  1324. prop="key"
  1325. label="参数值KEY"
  1326. >
  1327. <template slot-scope="scope">
  1328. <el-input v-model="scope.row.k"></el-input>
  1329. </template>
  1330. </el-table-column>
  1331. <el-table-column
  1332. align="center"
  1333. prop="describe"
  1334. label="描述"
  1335. >
  1336. <template slot-scope="scope">
  1337. <el-input v-model="scope.row.remark"></el-input>
  1338. </template>
  1339. </el-table-column>
  1340. <el-table-column
  1341. label="操作"
  1342. width="120"
  1343. align="center"
  1344. >
  1345. <template slot-scope="scope">
  1346. <el-button
  1347. type="text"
  1348. size="small"
  1349. class="text-icon-danger"
  1350. @click="delNodeInfo(scope.$index)"
  1351. >删除</el-button>
  1352. </template>
  1353. </el-table-column>
  1354. </el-table>
  1355. </div>
  1356. <span
  1357. slot="footer"
  1358. class="dialog-footer"
  1359. >
  1360. <el-button @click="addParameterName()">保 存</el-button>
  1361. <el-button @click="closeParameter()">关 闭</el-button>
  1362. </span>
  1363. </el-dialog>
  1364. </basic-container>
  1365. </template>
  1366. <script>
  1367. import ManualSorting from '@/components/WbsTree/ManualSorting'
  1368. import dynamicExcel from "./treeTemplate/dynamicExcel.vue";
  1369. import {
  1370. saveFormAndElement, selectFormElements,
  1371. importWbsTree, findWbsTreePrivateSameLevel, wbsTreePrivateSort, parameters, saveOrUpdateBatch, keymap, updateBatchNodeTableInfo2
  1372. } from "@/api/manager/wbstree";
  1373. import {
  1374. saveElement, remove as removeElement, updateBatchElements, getTemplate,
  1375. importWbsElement
  1376. } from "@/api/manager/wbsformelement";
  1377. import { getLazytree, getDetail, update, findNodeTableByCondition as selectByNodeTable, removeTableByCondition as removeTableById ,removePrivateTreeNode,wbsTreePrivateTableSort} from "@/api/manager/wbsprivate";
  1378. import { findProjectTree as getAlltree } from "@/api/manager/projectinfo";
  1379. import { getList as getAttchFromOriginalName } from "@/api/resource/attach";
  1380. import { getDictionary } from "@/api/system/dict";
  1381. import { mapGetters } from "vuex";
  1382. import { getList, tabLazytreeAll, saveLinkTab, getExcelHtml } from '@/api/exctab/excelmodel'
  1383. export default {
  1384. data () {
  1385. return {
  1386. formDatass: [],
  1387. editElementFormTag: false,
  1388. jiedianId: '',
  1389. //#region
  1390. sortTag: false,
  1391. sortTag2: false,
  1392. sortArray: [],
  1393. //#endregion
  1394. //#region 关联清表
  1395. loading: false,
  1396. GLExcel: false,
  1397. GLExcelFrom: {
  1398. id: "",
  1399. name: '',
  1400. search: '',//搜素框舒服的值
  1401. ids: '',
  1402. excelId: '',
  1403. initTableName: '',
  1404. },
  1405. GLExcelData: [],//
  1406. GLExcelProps: {
  1407. label: 'name',
  1408. children: 'children',
  1409. disabled: 'hasChildren',
  1410. // isLeaf: !'hasChildren',
  1411. },
  1412. exceldata: [],//清表模板
  1413. //#endregion
  1414. //#region 调整表单
  1415. adjustmentExcel: '',
  1416. excelHtml: false,
  1417. //#endregion
  1418. //#region
  1419. id: '',
  1420. projectid: '',
  1421. filterText: '',
  1422. treeData: [],
  1423. treeLoad: false,
  1424. menuShow: false,
  1425. defaultProps: {
  1426. children: 'children',
  1427. label: 'title',
  1428. isLeaf: function (data) {
  1429. return !data.hasChildren;
  1430. }
  1431. },
  1432. leftType: 5,
  1433. curTreeData: {},
  1434. tableData: [],
  1435. nodeDetail: {},
  1436. formData: [],
  1437. editType: 1,
  1438. dialogVisible: false,
  1439. saveNodeLoading: false,
  1440. deptCategorylist: [],
  1441. majorDataTypeList: [],
  1442. rules: {
  1443. deptName: [
  1444. { required: true, message: '请输入节点名称', trigger: 'blur' },
  1445. ],
  1446. deptCategory: [
  1447. { required: true, message: '请选择节点类型', trigger: 'change' }
  1448. ]
  1449. },
  1450. eleVisible: false,
  1451. tableTypelist: [],
  1452. dataTypeList: [],
  1453. ownerTypeList: [],
  1454. eleForm: {
  1455. elementList: [],
  1456. },
  1457. eleRules: {
  1458. deptName: [
  1459. { required: true, message: '请输入表名称', trigger: 'blur' },
  1460. ],
  1461. tableType: [
  1462. { required: true, message: '请选择表类型', trigger: 'change' }
  1463. ],
  1464. tableOwner: [
  1465. { required: true, message: '请选择所属方', trigger: 'change' }
  1466. ],
  1467. },
  1468. importVisible: false,
  1469. tempList: [],
  1470. curEleTable: {},
  1471. editEleVisible: false,
  1472. editEleList: [],
  1473. eleReg: /(≥|≤|±|【】)?([^≥≤±【】]*)/,
  1474. editEleFormulaVisible: false,
  1475. formulaInput: '',
  1476. importTemplateVisible: false,
  1477. fileUrl: '',
  1478. upFile: null,
  1479. importLoading: false,
  1480. nodeInfoVisible: false,
  1481. nodeInfoTable: [],
  1482. namelist: [],
  1483. namelists: [],
  1484. infoNameVisible: false,
  1485. excelSortTag:false,
  1486. excelSortTag2:false,
  1487. tableSortList:[],
  1488. //#endregion
  1489. };
  1490. },
  1491. computed: {
  1492. ...mapGetters(["userInfo"]),
  1493. dialogTitle: function () {
  1494. let text = '节点';
  1495. if (this.leftType == 1) {
  1496. text = '新增' + text;
  1497. } else if (this.leftType == 2) {
  1498. text = '编辑' + text;
  1499. }
  1500. return text;
  1501. },
  1502. },
  1503. created () {
  1504. this.init();
  1505. //console.log(this.userInfo)
  1506. },
  1507. methods: {
  1508. //#region
  1509. init () {
  1510. this.id = this.$route.query.wbsid;
  1511. this.projectid = this.$route.query.pid;
  1512. this.getDeptCategorylist();
  1513. this.getTableTypelist();
  1514. this.getDataTypelist();
  1515. this.getOwnerTypelist();
  1516. },
  1517. loadNode (node, resolve) {
  1518. let pid = 0;
  1519. if (node.level != 0) {
  1520. pid = node.data.id
  1521. }
  1522. getLazytree(this.id, pid, this.userInfo.tenant_id, this.projectid).then((res) => {
  1523. let arr = [];
  1524. if (Array.isArray(res.data.data)) {
  1525. arr = res.data.data;
  1526. }
  1527. return resolve(arr);
  1528. })
  1529. },
  1530. getNodeDetail (data, node) {
  1531. console.log(111);
  1532. let parentName = '';
  1533. if (node.parent.data) {
  1534. parentName = node.parent.data.title;
  1535. }
  1536. this.curTreeData = data;
  1537. this.curTreeData.parentName = parentName;
  1538. getDetail(data.id, this.id, this.projectid).then((res) => {
  1539. res.data.data.parentName = parentName;
  1540. this.tableData = [res.data.data];
  1541. this.nodeDetail = Object.assign({}, res.data.data);
  1542. })
  1543. this.updateNodeTable();
  1544. },
  1545. saveNode () {
  1546. this.$refs['nodeDetail'].validate((valid) => {
  1547. if (valid) {
  1548. if (this.editType == 1) {
  1549. this.addNode();
  1550. } else if (this.editType == 2) {
  1551. this.updateNode();
  1552. }
  1553. } else {
  1554. console.log('error submit!!');
  1555. return false;
  1556. }
  1557. });
  1558. },
  1559. addNode () {
  1560. this.saveNodeLoading = true;
  1561. update(this.nodeDetail).then(() => {
  1562. this.updateTreeNewNode();
  1563. this.dialogVisible = false;
  1564. this.$message({
  1565. type: "success",
  1566. message: "新增成功!"
  1567. });
  1568. })
  1569. },
  1570. updateNode () {
  1571. update(this.nodeDetail).then(() => {
  1572. let node = this.tableData[0];
  1573. node.deptName = this.nodeDetail.deptName;
  1574. node.deptCategory = this.nodeDetail.deptCategory;
  1575. this.curTreeData.title = this.nodeDetail.deptName;
  1576. this.dialogVisible = false;
  1577. this.$message({
  1578. type: "success",
  1579. message: "修改成功!"
  1580. });
  1581. })
  1582. },
  1583. setLeftType (type, data, node) {
  1584. this.jiedianId = data.id
  1585. if (type == 4 || type == 5) {
  1586. this.leftType = type;
  1587. }
  1588. this.curTreeData = data;
  1589. this.$refs.tree.setCurrentKey(data.id);
  1590. if (type == 1 || type == 2) {
  1591. this.getMajorDataTypeList();
  1592. this.dialogVisible = true;
  1593. this.editType = type;
  1594. }
  1595. getDetail(data.id, this.id, this.projectid).then((res) => {
  1596. let parentName = '';
  1597. if (node.parent.data) {
  1598. parentName = node.parent.data.title;
  1599. }
  1600. res.data.data.parentName = parentName;
  1601. this.tableData = [res.data.data];
  1602. if (type == 1) {
  1603. this.nodeDetail = {
  1604. parentId: res.data.data.id,
  1605. parentName: parentName,
  1606. projectId: res.data.data.projectId
  1607. };
  1608. } else {
  1609. this.nodeDetail = Object.assign({}, res.data.data);
  1610. }
  1611. this.nodeDetail.type = 1;// '1'节点 '2'表单
  1612. this.nodeDetail.wbsId = this.id;
  1613. this.nodeDetail.tenantId = this.userInfo.tenant_id
  1614. })
  1615. if (this.leftType == 4) {
  1616. selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
  1617. if (res.data.data.length) {
  1618. this.formData = res.data.data;
  1619. } else {
  1620. this.formData = [];
  1621. }
  1622. })
  1623. }
  1624. },
  1625. showFormElement () {
  1626. if (!this.nodeDetail.id) {
  1627. this.$message({
  1628. type: "warning",
  1629. message: "请先选择在哪个节点下创建表"
  1630. });
  1631. return;
  1632. }
  1633. this.eleVisible = true;
  1634. },
  1635. addEleRow (list) {
  1636. list.push({});
  1637. },
  1638. delEleRow (index, list) {
  1639. list.splice(index, 1);
  1640. },
  1641. saveFormAndElementHandle () {
  1642. this.$refs['eleDialog'].validate((valid) => {
  1643. if (valid) {
  1644. this.eleForm.wbsId = this.id;
  1645. this.eleForm.tenantId = this.userInfo.tenant_id;
  1646. this.eleForm.deptCategory = -1;
  1647. this.eleForm.type = 2;// '1'节点 '2'表单
  1648. this.eleForm.parentId = this.nodeDetail.id;
  1649. this.eleForm.elementList.forEach((element) => {
  1650. element.eAllowDeviation = (element.allow ? element.allow : '') + (element.deviation ? element.deviation : '');
  1651. if (element.eType == 4) {
  1652. element.eLength = 0;
  1653. }
  1654. })
  1655. saveFormAndElement(this.eleForm).then(() => {
  1656. //console.log(res)
  1657. this.updateTreeNewNode();
  1658. this.updateNodeTable();
  1659. this.eleVisible = false;
  1660. this.$message({
  1661. type: "success",
  1662. message: "新增成功!"
  1663. });
  1664. })
  1665. } else {
  1666. console.log('error submit!!');
  1667. return false;
  1668. }
  1669. });
  1670. },
  1671. updateTreeNewNode () {
  1672. getLazytree(this.id, this.nodeDetail.parentId, this.userInfo.tenant_id, this.projectid).then((res) => {
  1673. this.$refs.tree.updateKeyChildren(this.nodeDetail.parentId, res.data.data)
  1674. })
  1675. },
  1676. updateNodeTable () {
  1677. selectByNodeTable(this.curTreeData.id, this.projectid, this.id).then((res) => {
  1678. if (res.data.data.length) {
  1679. this.formData = res.data.data;
  1680. } else {
  1681. this.formData = [];
  1682. }
  1683. })
  1684. },
  1685. deleNode (data, node) {
  1686. this.$confirm('此操作将删除节点【' + data.title + '】, 是否继续?', '提示', {
  1687. confirmButtonText: '确定',
  1688. cancelButtonText: '取消',
  1689. type: 'warning'
  1690. }).then(() => {
  1691. removePrivateTreeNode(data.primaryKeyId).then(() => {
  1692. this.$refs.tree.remove(node);
  1693. this.$message({
  1694. type: "success",
  1695. message: "删除成功!"
  1696. });
  1697. })
  1698. }).catch(() => {
  1699. });
  1700. },
  1701. importHandle () {
  1702. },
  1703. handleEdit (index, row) {
  1704. this.curEleTable = row;
  1705. selectFormElements(this.curEleTable.id).then((res) => {
  1706. res.data.data.forEach((element) => {
  1707. this.eleReg.exec(element.eAllowDeviation);
  1708. // console.log(RegExp.$1)
  1709. // console.log(RegExp.$2)
  1710. element.allow = RegExp.$1 ? RegExp.$1 : '';
  1711. element.deviation = RegExp.$2 ? RegExp.$2 : '';
  1712. })
  1713. this.editEleList = res.data.data;
  1714. })
  1715. this.editEleVisible = true;
  1716. },
  1717. handleDelete (index, row) {
  1718. this.$confirm('是否删除 ' + row.tableName + ' ?', '删除元素表', {
  1719. distinguishCancelAndClose: true,
  1720. confirmButtonText: '删除',
  1721. cancelButtonText: '取消'
  1722. }).then(() => {
  1723. removeTableById(row.id, this.projectid, this.id).then(() => {
  1724. this.formData.splice(index, 1);
  1725. this.$message({
  1726. type: "success",
  1727. message: "删除成功!"
  1728. });
  1729. })
  1730. })
  1731. },
  1732. handleEditFormula (index, row) {
  1733. this.curEleTable = row;
  1734. selectFormElements(this.curEleTable.id).then((res) => {
  1735. this.editEleList = res.data.data;
  1736. })
  1737. this.editEleFormulaVisible = true;
  1738. },
  1739. saveNewEle (row) {
  1740. row.eAllowDeviation = (row.allow ? row.allow : '') + (row.deviation ? row.deviation : '');
  1741. row.fId = this.curEleTable.id;
  1742. row.initTableName = this.curEleTable.initTableName;
  1743. if (row.eType == 4) {
  1744. row.eLength = 0;
  1745. }
  1746. saveElement(row).then((res) => {
  1747. if (res.data.data) {
  1748. this.$set(row, 'id', res.data.data.id);
  1749. this.$set(row, 'ekey', res.data.data.ekey);
  1750. this.$message({
  1751. type: "success",
  1752. message: "保存成功!"
  1753. });
  1754. }
  1755. })
  1756. },
  1757. delEleRowHandle (index, list) {
  1758. let row = list[index];
  1759. if (row.id) {
  1760. //有id需要请求删除
  1761. this.$confirm('是否确认删除?', '删除元素', {
  1762. distinguishCancelAndClose: true,
  1763. confirmButtonText: '删除',
  1764. cancelButtonText: '取消'
  1765. }).then(() => {
  1766. removeElement(row.id, this.curEleTable.initTableName, row.ekey).then(() => {
  1767. list.splice(index, 1);
  1768. })
  1769. })
  1770. } else {
  1771. list.splice(index, 1);
  1772. }
  1773. },
  1774. saveEles () {
  1775. for (let i = 0; i < this.editEleList.length; i++) {
  1776. if (!this.editEleList[i].id) {
  1777. this.$message({
  1778. type: "warning",
  1779. message: "请先将新增的元素点击保存"
  1780. });
  1781. return;
  1782. }
  1783. }
  1784. if (this.editEleList.length > 0) {
  1785. this.editEleList.forEach((element) => {
  1786. element.eAllowDeviation = (element.allow ? element.allow : '') + (element.deviation ? element.deviation : '');
  1787. if (element.eType == 4) {
  1788. element.eLength = 0;
  1789. }
  1790. })
  1791. updateBatchElements(this.editEleList, this.curEleTable.initTableName).then(() => {
  1792. this.editEleVisible = false;
  1793. this.updateNodeTable();
  1794. this.$message({
  1795. type: "success",
  1796. message: "保存成功!"
  1797. });
  1798. })
  1799. } else {
  1800. this.editEleVisible = false;
  1801. this.updateNodeTable();
  1802. this.$message({
  1803. type: "success",
  1804. message: "保存成功!"
  1805. });
  1806. }
  1807. },
  1808. filterChange () {
  1809. //console.log(this.$refs)
  1810. //debugger
  1811. if (this.treeData.length > 0) {
  1812. this.$refs.treeall.filter(this.filterText);
  1813. return;
  1814. }
  1815. this.treeLoad = true;
  1816. getAlltree(this.projectid, this.id).then((res) => {
  1817. this.treeLoad = false;
  1818. this.treeData = res.data.data;
  1819. this.$nextTick(() => {
  1820. this.$refs.treeall.filter(this.filterText);
  1821. })
  1822. })
  1823. },
  1824. importTemplate (data) {
  1825. this.importTemplateVisible = true;
  1826. this.curTreeData = data;
  1827. if (!this.fileUrl) {
  1828. getAttchFromOriginalName(1, 20, {
  1829. originalName: 'WBS划分模板.xls'
  1830. }).then((res) => {
  1831. if (res.data.data.records.length) {
  1832. this.fileUrl = res.data.data.records[0].link;
  1833. } else {
  1834. this.fileUrl = '';
  1835. }
  1836. })
  1837. }
  1838. },
  1839. importTemplateHandle () {
  1840. if (!this.upFile) {
  1841. this.$message({
  1842. type: "warning",
  1843. message: "请先选择文件再进行导入"
  1844. });
  1845. return;
  1846. }
  1847. let forms = new FormData();
  1848. forms.append('excelFile', this.upFile);
  1849. let wbsTreeFu = {
  1850. wbsId: this.id,
  1851. parentId: this.curTreeData.id,
  1852. // ancestors:'0,'+this.curTreeData.id,
  1853. }
  1854. let json = JSON.stringify(wbsTreeFu);
  1855. let blob = new Blob([json], { type: 'application/json' })
  1856. forms.append('wbsTreeFu', blob);
  1857. this.importLoading = true;
  1858. importWbsTree(forms).then(() => {
  1859. //this.$router.go(0)
  1860. let node = this.$refs.tree.getNode(this.curTreeData.id);
  1861. node.isLeaf = false;
  1862. this.importTemplateVisible = false;
  1863. this.upFile = null;
  1864. }).finally(() => {
  1865. this.importLoading = false;
  1866. })
  1867. },
  1868. handleDownload () {
  1869. if (this.fileUrl) {
  1870. window.open(this.fileUrl);
  1871. } else {
  1872. this.$message({
  1873. type: "warning",
  1874. message: "请先在附件管理上传【WBS划分模板.xls】文件"
  1875. });
  1876. }
  1877. },
  1878. fileClick () {
  1879. this.$refs.file.click();
  1880. },
  1881. fileChange (e) {
  1882. const file = e.target.files[0]
  1883. if (!file) {
  1884. // 如果用户没有选择图片,只是点了文件上传这个按钮
  1885. return
  1886. }
  1887. //console.log(file)
  1888. this.upFile = file;
  1889. },
  1890. editNodeInfo (index, row) {
  1891. this.$set(row, 'isEdit', true);
  1892. },
  1893. saveNodeInfoHandle (index, row) {
  1894. row.isEdit = false;
  1895. },
  1896. downloadTmp () {
  1897. getTemplate().then((res) => {
  1898. //console.log(res)
  1899. let blob = new Blob([res.data], {
  1900. type: 'application/vnd.ms-excel'
  1901. });
  1902. //console.log(blob)
  1903. let filename = Date.parse(new Date()) + '.xls';
  1904. if (window.navigator.msSaveOrOpenBlob) {
  1905. // 兼容IE10
  1906. window.navigator.msSaveBlob(blob, filename);
  1907. } else {
  1908. // 兼容chrome/firefox
  1909. let aTag = document.createElement('a');
  1910. aTag.download = Date.parse(new Date()) + '.xls';
  1911. aTag.href = window.URL.createObjectURL(blob);
  1912. aTag.click();
  1913. URL.revokeObjectURL(aTag.href);
  1914. }
  1915. })
  1916. },
  1917. fileClick2 () {
  1918. this.$refs.file2.click();
  1919. },
  1920. tmpImport (e) {
  1921. const file = e.target.files[0];
  1922. const formData = new FormData();
  1923. formData.append('file', file);
  1924. //console.log(file.name)
  1925. importWbsElement(formData).then((res) => {
  1926. res.data.data.forEach((element) => {
  1927. element.eName = element.elementName;
  1928. element.eLength = element.elementLength;
  1929. element.eType = Number(element.elementType);
  1930. element.eAllowDeviation = element.elementAllowDeviation;
  1931. element.eInspectionMethod = element.elementInspectionMethod;
  1932. this.eleReg.exec(element.eAllowDeviation);
  1933. // console.log(RegExp.$1)
  1934. // console.log(RegExp.$2)
  1935. element.allow = RegExp.$1 ? RegExp.$1 : '';
  1936. element.deviation = RegExp.$2 ? RegExp.$2 : '';
  1937. })
  1938. this.eleForm.elementList = res.data.data;
  1939. this.importVisible = false;
  1940. }).finally(() => {
  1941. e.target.value = '';
  1942. })
  1943. },
  1944. visiblechange (value, data) {
  1945. this.$set(data, 'moreShow', value)
  1946. },
  1947. bianhua2 () {
  1948. this.excelSortTag2 = false
  1949. this.$nextTick(() => {
  1950. this.excelSortTag2 = true
  1951. })
  1952. },
  1953. //私有树的元素表修改排序
  1954. privateTableSort(){
  1955. if(!this.curTreeData.id){
  1956. this.$message({
  1957. type: "warning",
  1958. message: "请先选择需要排序的节点"
  1959. })
  1960. return;
  1961. }
  1962. this.tableSortList = this.formData.map((form,index)=>{
  1963. return{
  1964. sort:index+1,
  1965. deptName:form.tableName,
  1966. pkeyId:form.pkeyId,
  1967. }
  1968. })
  1969. this.excelSortTag = true
  1970. this.excelSortTag2 = true
  1971. },
  1972. editPrivateSort(){
  1973. wbsTreePrivateTableSort(this.tableSortList).then(()=>{
  1974. this.updateNodeTable();
  1975. this.$message({
  1976. type: "success",
  1977. message: "排序成功!"
  1978. });
  1979. this.excelSortTag = false;
  1980. this.excelSortTag2 = false;
  1981. })
  1982. },
  1983. getDeptCategorylist () {
  1984. if (this.deptCategorylist.length > 1) {
  1985. return;
  1986. }
  1987. getDictionary({
  1988. code: 'wbs_node_type'
  1989. }).then((res) => {
  1990. res.data.data.forEach(element => {
  1991. element.dictKey = Number(element.dictKey)
  1992. });
  1993. this.deptCategorylist = res.data.data;
  1994. })
  1995. },
  1996. getMajorDataTypeList () {
  1997. if (this.majorDataTypeList.length > 1) {
  1998. return;
  1999. }
  2000. getDictionary({
  2001. code: 'major_data_type'
  2002. }).then((res) => {
  2003. res.data.data.forEach(element => {
  2004. element.dictKey = Number(element.dictKey)
  2005. });
  2006. this.majorDataTypeList = res.data.data;
  2007. })
  2008. },
  2009. getTableTypelist () {
  2010. if (this.tableTypelist.length > 1) {
  2011. return;
  2012. }
  2013. getDictionary({
  2014. code: 'table_type'
  2015. }).then((res) => {
  2016. res.data.data.forEach(element => {
  2017. element.dictKey = Number(element.dictKey)
  2018. });
  2019. this.tableTypelist = res.data.data;
  2020. })
  2021. },
  2022. getDataTypelist () {
  2023. if (this.dataTypeList.length > 1) {
  2024. return;
  2025. }
  2026. getDictionary({
  2027. code: 'data_type'
  2028. }).then((res) => {
  2029. res.data.data.forEach(element => {
  2030. element.dictKey = Number(element.dictKey)
  2031. });
  2032. this.dataTypeList = res.data.data;
  2033. })
  2034. },
  2035. getOwnerTypelist () {
  2036. if (this.ownerTypeList.length > 1) {
  2037. return;
  2038. }
  2039. getDictionary({
  2040. code: 'owner_type'
  2041. }).then((res) => {
  2042. res.data.data.forEach(element => {
  2043. element.dictKey = Number(element.dictKey)
  2044. });
  2045. this.ownerTypeList = res.data.data;
  2046. })
  2047. },
  2048. formatCat (row, column, cellValue) {
  2049. for (let i = 0; i < this.deptCategorylist.length; i++) {
  2050. if (this.deptCategorylist[i].dictKey == cellValue) {
  2051. return this.deptCategorylist[i].dictValue
  2052. }
  2053. }
  2054. return cellValue;
  2055. //console.log(cellValue)
  2056. },
  2057. formatTableType (row, column, cellValue) {
  2058. for (let i = 0; i < this.tableTypelist.length; i++) {
  2059. if (this.tableTypelist[i].dictKey == cellValue) {
  2060. return this.tableTypelist[i].dictValue
  2061. }
  2062. }
  2063. return cellValue;
  2064. //console.log(cellValue)
  2065. },
  2066. formatOwner (row, column, cellValue) {
  2067. for (let i = 0; i < this.ownerTypeList.length; i++) {
  2068. if (this.ownerTypeList[i].dictKey == cellValue) {
  2069. return this.ownerTypeList[i].dictValue
  2070. }
  2071. }
  2072. return cellValue;
  2073. //console.log(cellValue)
  2074. },
  2075. formatdataType (row, column, cellValue) {
  2076. for (let i = 0; i < this.dataTypeList.length; i++) {
  2077. if (this.dataTypeList[i].dictKey == cellValue) {
  2078. return this.dataTypeList[i].dictValue
  2079. }
  2080. }
  2081. return cellValue;
  2082. },
  2083. filterNode (value, data) {
  2084. if (!value) return true;
  2085. return data.title.indexOf(value) !== -1;
  2086. },
  2087. //#endregion
  2088. //#region wbs私有树排序
  2089. async sortpai (data) {
  2090. console.log(data);
  2091. await this.findWbsTreePrivateSameLevel({
  2092. parentId: data.parentId,
  2093. projectId: this.projectid,
  2094. wbsId: this.id
  2095. })
  2096. this.sortTag = true
  2097. this.sortTag2 = true
  2098. },
  2099. editSort () {
  2100. this.wbsTreePrivateSort()
  2101. },
  2102. bianhua () {
  2103. this.sortTag2 = false
  2104. this.$nextTick(() => {
  2105. this.sortTag2 = true
  2106. })
  2107. },
  2108. async wbsTreePrivateSort () {//wbs私有树节点手动排序
  2109. const { data: res } = await wbsTreePrivateSort(this.sort)
  2110. console.log(res);
  2111. if (res.code == 200) {
  2112. this.sortTag = false
  2113. this.sortTag2 = false
  2114. this.getLazytreessss()
  2115. }
  2116. },
  2117. async findWbsTreePrivateSameLevel (da) {//wbs私有树同级节点接口
  2118. const { data: res } = await findWbsTreePrivateSameLevel(da)
  2119. console.log(res);
  2120. if (res.code == 200) {
  2121. this.sort = res.data
  2122. }
  2123. },
  2124. async getLazytreessss () {
  2125. const { data: res } = await getLazytree(this.id, 0, this.userInfo.tenant_id, this.projectid)
  2126. console.log(res);
  2127. if (res.code == 200) {
  2128. this.treeData = res.data
  2129. }
  2130. },
  2131. //#endregion
  2132. //#region 关联清表
  2133. async getList (da) {//获取清表模板信息
  2134. const { data: res } = await getList(da)
  2135. console.log(res);
  2136. if (res.code === 200 && res.msg === '操作成功') {
  2137. this.GLExcelData = res.data.records
  2138. }
  2139. },
  2140. async tabLazytreeAll () {//清表树信息
  2141. const { data: res } = await tabLazytreeAll({
  2142. modeId: this.GLExcelFrom.name,
  2143. name: this.GLExcelFrom.search,
  2144. })
  2145. console.log(res);
  2146. if (res.code === 200 && res.msg === '操作成功') {
  2147. this.exceldata = res.data
  2148. }
  2149. },
  2150. Associationlist (scope) {//关联清表点击事件
  2151. console.log(scope.row);
  2152. this.GLExcel = true
  2153. this.getList({
  2154. current: 1,
  2155. size: 100000,
  2156. parentId: 0,
  2157. })
  2158. this.GLExcelFrom.name = scope.row.modeId
  2159. setTimeout(() => {
  2160. this.$refs.tree.setCheckedKeys([scope.row.excelId])
  2161. }, 2000)
  2162. this.GLExcelFrom.id = scope.row.pkeyId
  2163. this.GLExcelFrom.excelId = scope.row.excelId
  2164. this.GLExcelFrom.ids = scope.row.id
  2165. this.GLExcelFrom.initTableName = scope.row.initTableName
  2166. },
  2167. changetherr () {//清表类型选择框change事件
  2168. if (this.GLExcelFrom.name != "") {
  2169. this.GLExcelFrom.search = ''
  2170. this.tabLazytreeAll()
  2171. }
  2172. },
  2173. GLExcelMD () {//弹框关闭事件
  2174. this.GLExcelFrom.name = ""
  2175. this.GLExcelFrom.search = ''
  2176. this.GLExcelFrom.id = ''
  2177. this.exceldata = []
  2178. this.$refs.tree.setCheckedKeys([])
  2179. this.GLExcel = false
  2180. },
  2181. checkchange (data) {//节点选中回调
  2182. if (this.$refs.tree.getCheckedNodes().length === 0) {
  2183. this.$refs.tree.setCheckedKeys([])
  2184. } else if (this.$refs.tree.getCheckedNodes().length >= 1) {
  2185. this.$refs.tree.setCheckedKeys([data.id])
  2186. }
  2187. },
  2188. async saveLinkTab () {//保存按钮
  2189. if (this.$refs.tree.getCheckedNodes().length > 0) {
  2190. const { data: res } = await saveLinkTab({
  2191. exceTabId: this.$refs.tree.getCheckedNodes()[this.$refs.tree.getCheckedNodes().length - 1].id,
  2192. tabId: this.GLExcelFrom.id,
  2193. })
  2194. console.log(res);
  2195. if (res.code === 200) {
  2196. this.$message({
  2197. type: 'success',
  2198. message: '关联清表成功',
  2199. })
  2200. this.GLExcel = false
  2201. this.rightClick(this.GLExcelFrom.id, this.GLExcelFrom.excelId, this.GLExcelFrom.ids, this.GLExcelFrom.initTableName,)
  2202. }
  2203. } else {
  2204. this.$message({
  2205. type: 'success',
  2206. message: '请先设置清表',
  2207. })
  2208. }
  2209. },
  2210. filterNode222 (value, data) {
  2211. if (!value) return true;
  2212. return data.name.indexOf(value) !== -1;
  2213. },
  2214. //#endregion
  2215. //#region 节点参数
  2216. nodeInfo (data) {//节点参数按钮
  2217. this.keymap()
  2218. this.jiedianId = data.primaryKeyId
  2219. this.parameters(data.primaryKeyId)
  2220. this.nodeInfoVisible = true;
  2221. },
  2222. addNodeInfoTable () {//添加节点参数数据
  2223. this.nodeInfoTable.unshift({ k: '', v: '', remark: '', wbsId: this.jiedianId })
  2224. },
  2225. delNodeInfo (key) {//设置参数名称中的删除按钮
  2226. this.namelists.splice(key, 1)
  2227. },
  2228. delNodeInfoss (key) {//节点参数
  2229. this.nodeInfoTable.splice(key, 1)
  2230. },
  2231. setNodeParameters () {//打开设置节点参数弹框按钮
  2232. this.infoNameVisible = true
  2233. this.namelists = [...this.namelist]
  2234. },
  2235. async setParameterName () {//设置参数名称中添加节点参数按钮
  2236. // wbsId: this.jiedianId
  2237. this.namelists.unshift({ name: '', remark: '', k: '', type: 0, })
  2238. },
  2239. async nodeInfoSave () {//节点参数弹框保存按钮
  2240. if (this.nodeInfoTable) {
  2241. let tag = true
  2242. this.nodeInfoTable.forEach(val => {
  2243. if (!val.k | !val.v) {
  2244. return tag = false
  2245. }
  2246. })
  2247. if (tag) {
  2248. await this.saveOrUpdateBatch(this.nodeInfoTable)
  2249. this.nodeInfoVisible = false
  2250. this.$message({
  2251. type: "success",
  2252. message: "设置参数节点成功!"
  2253. })
  2254. } else {
  2255. this.$message({
  2256. type: "error",
  2257. message: "请填写所有的参数名称和参数值!"
  2258. })
  2259. }
  2260. } else {
  2261. this.$message({
  2262. type: "error",
  2263. message: "请先设置参数节点!"
  2264. })
  2265. }
  2266. },
  2267. async addParameterName () {//设置参数名称中的保存按钮
  2268. if (this.namelists) {
  2269. let tag = true
  2270. this.namelists.forEach(val => {
  2271. if (!val.name || !val.k) {
  2272. return tag = false
  2273. }
  2274. })
  2275. if (tag) {
  2276. await this.saveOrUpdateBatch(this.namelists) //保存设置参数
  2277. this.infoNameVisible = false
  2278. this.keymap()
  2279. } else {
  2280. this.$message({
  2281. type: "error",
  2282. message: "请填写所有的参数名称和参数值KEY!"
  2283. })
  2284. }
  2285. } else {
  2286. this.$message({
  2287. type: "error",
  2288. message: "请设置参数"
  2289. })
  2290. }
  2291. },
  2292. closeParameter () {//设置参数名称,关闭按钮
  2293. this.namelists = []
  2294. this.infoNameVisible = false
  2295. },
  2296. async parameters (wbsId) {//获取接待你参数列表
  2297. const { data: res } = await parameters({ wbsId })
  2298. console.log(res);
  2299. if (res.code == 200) {
  2300. this.nodeInfoTable = res.data
  2301. }
  2302. },
  2303. async saveOrUpdateBatch (da) {//保存
  2304. const { data: res } = await saveOrUpdateBatch(da)
  2305. console.log(res);
  2306. },
  2307. async keymap () {//节点参数枚举
  2308. const { data: res } = await keymap()
  2309. console.log(res);
  2310. if (res.code == 200) {
  2311. this.namelist = res.data
  2312. }
  2313. },
  2314. //#endregion
  2315. //#region 调整表单
  2316. adjustExcel (pkeyId, excelId) {//调整表单
  2317. this.GLExcelFrom.id = pkeyId
  2318. this.getExcelHtml(excelId)
  2319. },
  2320. async getExcelHtml (excelId) {
  2321. const { data: res } = await getExcelHtml({ excelId })
  2322. console.log(res);
  2323. if (res.code === 200) {
  2324. localStorage.setItem('excelHtml', res.data)
  2325. this.adjustmentExcel = res.data
  2326. this.excelHtml = true
  2327. }
  2328. },
  2329. removeExcel () {
  2330. this.excelHtml = false
  2331. },
  2332. //#endregion
  2333. //#region 编辑元素
  2334. async rightClick (pkeyId, excelId, id, initTableName) {
  2335. await this.getExcelHtml2(excelId)
  2336. this.$router.push({
  2337. path: '/project/editElement',
  2338. query: {
  2339. pkeyId: pkeyId,
  2340. excelId: excelId,
  2341. id: id,
  2342. initTableName
  2343. }
  2344. })
  2345. },
  2346. async getExcelHtml2 (excelId) {
  2347. const { data: res } = await getExcelHtml({ excelId })
  2348. console.log(res);
  2349. if (res.code === 200) {
  2350. localStorage.setItem('editElement', res.data)
  2351. }
  2352. },
  2353. //#endregion
  2354. //#region 元素表单信息
  2355. editEditElementForm () {//标记元素
  2356. if (this.formData.length) {
  2357. let da = []
  2358. this.formDatass = [...this.formData]
  2359. this.formDatass.forEach(val => {
  2360. da.push({
  2361. tableType: val.tableType - 0,
  2362. tableOwner: val.tableOwner - 0,
  2363. pkeyId: val.pkeyId,
  2364. tableName: val.tableName,
  2365. })
  2366. })
  2367. this.formDatass = da
  2368. this.editElementFormTag = true
  2369. }
  2370. },
  2371. editeditElementFormMF () {//保存按钮
  2372. let da = []
  2373. let tag = true
  2374. this.formDatass.forEach(val => {
  2375. if (!val.tableName || !val.tableType || !val.tableOwner) {
  2376. tag = false
  2377. return
  2378. } else {
  2379. da.push({
  2380. pkeyId: val.pkeyId,
  2381. deptName: val.tableName,
  2382. tableType: val.tableType,
  2383. tableOwner: val.tableOwner,
  2384. })
  2385. }
  2386. })
  2387. if (tag) {
  2388. this.updateBatchNodeTableInfo2(da)
  2389. } else {
  2390. this.$message({
  2391. type: 'success',
  2392. message: '请填写完整元素表单的所有信息!',
  2393. })
  2394. }
  2395. },
  2396. async updateBatchNodeTableInfo2 (da) {//共有编辑元素
  2397. const { data: res } = await updateBatchNodeTableInfo2(da)
  2398. console.log(res);
  2399. if (res.code == 200) {
  2400. this.editElementFormTag = false
  2401. this.updateNodeTable()
  2402. }
  2403. },
  2404. //#endregion
  2405. },
  2406. watch: {
  2407. 'GLExcelFrom.search' (val) {
  2408. console.log(val);
  2409. if (this.exceldata) {
  2410. this.$refs.tree.filter(val);
  2411. }
  2412. }
  2413. },
  2414. components: {
  2415. dynamicExcel,
  2416. ManualSorting,
  2417. },
  2418. };
  2419. </script>
  2420. <style scoped lang="scss">
  2421. .font-s-12 /deep/ .iconfont {
  2422. font-size: 12px;
  2423. }
  2424. .el-popper[x-placement^="bottom"] {
  2425. margin-top: -6px;
  2426. }
  2427. .right-btn {
  2428. position: absolute;
  2429. right: 20px;
  2430. top: 10px;
  2431. font-size: 20px;
  2432. }
  2433. .custom-tree-node {
  2434. .normal-black {
  2435. display: none;
  2436. }
  2437. &:hover {
  2438. .normal-black {
  2439. display: block;
  2440. }
  2441. }
  2442. &.show .normal-black {
  2443. display: block;
  2444. }
  2445. }
  2446. .excelBox {
  2447. /deep/.el-dialog__body {
  2448. padding: 20px;
  2449. }
  2450. }
  2451. //调整表单样式
  2452. .excelHtml {
  2453. position: absolute;
  2454. z-index: 999999;
  2455. top: 50px;
  2456. left: 0px;
  2457. width: 100%;
  2458. height: 100%;
  2459. }
  2460. .jiedian {
  2461. /deep/.el-dialog__body {
  2462. padding: 10px 20px !important;
  2463. }
  2464. }
  2465. .filter-tree {
  2466. min-width: 100%;
  2467. display: inline-block;
  2468. }
  2469. </style>