tree.vue 72 KB

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