archivetree.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307
  1. <template>
  2. <basic-container
  3. ref="container"
  4. style="height:100%;"
  5. >
  6. <el-row
  7. :gutter="20"
  8. :style="{'height':heights-80+'px','overflow': 'hidden'}"
  9. >
  10. <el-col
  11. :span="12"
  12. class='marleft20'
  13. >
  14. <el-tabs v-model="activeName" @tab-click="handleClick">
  15. <el-tab-pane label="竣工档案目录" name="first">
  16. <div>
  17. <!-- <h2>归档目录树</h2> -->
  18. <el-input
  19. placeholder="输入关键字进行过滤"
  20. clearable
  21. v-model="filterText"
  22. >
  23. </el-input>
  24. <div class="scrollClass" style="height:721px">
  25. <el-scrollbar style="height:100%">
  26. <el-tree
  27. v-show="!filterText"
  28. ref="trees1"
  29. :props="props"
  30. :load="loadNode"
  31. node-key="id"
  32. lazy
  33. style="box-sizing: border-box;width:120%;"
  34. >
  35. <span
  36. class=" flexStar"
  37. slot-scope="{ node, data }"
  38. @mouseover="mouseOver(data)"
  39. @mouseleave="mouseLeave(data)"
  40. style="box-sizing: border-box;width:100%;"
  41. >
  42. <span>{{ data.title }}</span>
  43. <!--知识点过长处理,鼠标悬浮文字弹框显示全部内容-->
  44. <!-- <span class="custom-tree-node">
  45. <el-tooltip class="item" effect="light" :content="data.title" placement="top-start">
  46. <span > {{ data.title | ellipsis(25) }} </span>
  47. </el-tooltip>
  48. <div>
  49. </div>
  50. </span> -->
  51. <span
  52. class="marleft10"
  53. v-show="data.moreShow"
  54. >
  55. <i
  56. @click.stop='addtree(data,node)'
  57. class="el-icon-circle-plus-outline"
  58. style="fontSize:18px;"
  59. v-if="data.isStorageNode!=1"
  60. ></i>
  61. <i
  62. @click.stop='edittree(data,node)'
  63. class="el-icon-edit-outline marleft5"
  64. style="fontSize:18px;"
  65. v-if="node.level!=1"
  66. ></i>
  67. <i
  68. @click.stop='deletetree(node)'
  69. class="el-icon-delete marleft5"
  70. style="fontSize:18px;"
  71. v-if="node.level!=1"
  72. ></i>
  73. <i
  74. @click.stop='paixuMD(data)'
  75. class="el-icon-sort marleft5"
  76. style="fontSize:18px;"
  77. v-if="node.level!=1"
  78. ></i>
  79. </span>
  80. </span>
  81. </el-tree>
  82. </el-scrollbar>
  83. </div>
  84. <el-tree
  85. v-show="filterText"
  86. :default-expanded-keys='defaultExpanded'
  87. :props="props"
  88. :data="data"
  89. node-key="id"
  90. ref="trees2"
  91. :default-expand-all="true"
  92. :filter-node-method="filterNode"
  93. >
  94. <span
  95. class=" flexStar"
  96. slot-scope="{ node, data }"
  97. @mouseover="mouseOver(data)"
  98. @mouseleave="mouseLeave(data)"
  99. style="box-sizing: border-box;width:100%;"
  100. >
  101. <span>{{ data.title }}</span>
  102. <span
  103. class="marleft10"
  104. v-show="data.moreShow"
  105. >
  106. <i
  107. @click.stop='addtree(data,node)'
  108. class="el-icon-circle-plus-outline"
  109. style="fontSize:18px;"
  110. v-if="data.isStorageNode!=1"
  111. ></i>
  112. <i
  113. @click.stop='edittree(data,node)'
  114. class="el-icon-edit-outline marleft5"
  115. style="fontSize:18px;"
  116. v-if="node.level!=1"
  117. ></i>
  118. <i
  119. @click.stop='deletetree(node)'
  120. class="el-icon-delete marleft5"
  121. style="fontSize:18px;"
  122. v-if="node.level!=1"
  123. ></i>
  124. <i
  125. @click.stop='paixuMD(data)'
  126. class="el-icon-sort marleft5"
  127. style="fontSize:18px;"
  128. v-if="node.level!=1"
  129. ></i>
  130. </span>
  131. </span>
  132. </el-tree>
  133. </div>
  134. </el-tab-pane>
  135. <el-tab-pane label="文书档案目录" name="second">
  136. <div>
  137. <!-- <h2>归档目录树</h2> -->
  138. <el-input
  139. placeholder="输入关键字进行过滤"
  140. clearable
  141. v-model="filterText"
  142. >
  143. </el-input>
  144. <div class="scrollClass" style="height:721px">
  145. <el-scrollbar style="height:100%">
  146. <el-tree
  147. style="box-sizing: border-box;width:120%;"
  148. v-show="!filterText"
  149. ref="trees1"
  150. :props="props"
  151. :load="loadNode"
  152. node-key="id"
  153. lazy >
  154. <span
  155. class=" flexStar"
  156. slot-scope="{ node, data }"
  157. @mouseover="mouseOver(data)"
  158. @mouseleave="mouseLeave(data)"
  159. >
  160. <span style="text-overflow: ellipsis;">{{ data.title }}</span>
  161. <!--知识点过长处理,鼠标悬浮文字弹框显示全部内容-->
  162. <!-- <span class="custom-tree-node">
  163. <el-tooltip class="item" effect="light" :content="data.title" placement="top-start">
  164. <span > {{ data.title | ellipsis(25) }} </span>
  165. </el-tooltip>
  166. <div>
  167. </div>
  168. </span> -->
  169. <span
  170. class="marleft10"
  171. v-show="data.moreShow"
  172. >
  173. <i
  174. @click.stop='addtree(data,node)'
  175. class="el-icon-circle-plus-outline"
  176. style="fontSize:18px;"
  177. v-if="data.isStorageNode!=1"
  178. ></i>
  179. <i
  180. @click.stop='edittree(data,node)'
  181. class="el-icon-edit-outline marleft5"
  182. style="fontSize:18px;"
  183. v-if="node.level!=1"
  184. ></i>
  185. <i
  186. @click.stop='deletetree(node)'
  187. class="el-icon-delete marleft5"
  188. style="fontSize:18px;"
  189. v-if="node.level!=1"
  190. ></i>
  191. <i
  192. @click.stop='paixuMD(data)'
  193. class="el-icon-sort marleft5"
  194. style="fontSize:18px;"
  195. v-if="node.level!=1"
  196. ></i>
  197. </span>
  198. </span>
  199. </el-tree>
  200. </el-scrollbar>
  201. </div>
  202. <el-tree
  203. v-show="filterText"
  204. :default-expanded-keys='defaultExpanded'
  205. :props="props"
  206. :data="data"
  207. node-key="id"
  208. ref="trees2"
  209. :default-expand-all="true"
  210. :filter-node-method="filterNode"
  211. >
  212. <span
  213. class=" flexStar"
  214. slot-scope="{ node, data }"
  215. @mouseover="mouseOver(data)"
  216. @mouseleave="mouseLeave(data)"
  217. style="box-sizing: border-box;width:120%;"
  218. >
  219. <span style="text-overflow: ellipsis;">{{ data.title }}</span>
  220. <span
  221. class="marleft10"
  222. v-show="data.moreShow"
  223. >
  224. <i
  225. @click.stop='addtree(data,node)'
  226. class="el-icon-circle-plus-outline"
  227. style="fontSize:18px;"
  228. v-if="data.isStorageNode!=1"
  229. ></i>
  230. <i
  231. @click.stop='edittree(data,node)'
  232. class="el-icon-edit-outline marleft5"
  233. style="fontSize:18px;"
  234. v-if="node.level!=1"
  235. ></i>
  236. <i
  237. @click.stop='deletetree(node)'
  238. class="el-icon-delete marleft5"
  239. style="fontSize:18px;"
  240. v-if="node.level!=1"
  241. ></i>
  242. <i
  243. @click.stop='paixuMD(data)'
  244. class="el-icon-sort marleft5"
  245. style="fontSize:18px;"
  246. v-if="node.level!=1"
  247. ></i>
  248. </span>
  249. </span>
  250. </el-tree>
  251. </div>
  252. </el-tab-pane>
  253. </el-tabs>
  254. </el-col>
  255. <el-col
  256. :span="9"
  257. style="padding-top:30px;"
  258. >
  259. <!-- <h3>上传文件入口显示配置</h3> -->
  260. <div
  261. class="peizhi"
  262. :style="{'height':heights-210+'px','overflow': 'hidden'}"
  263. >
  264. <el-button type="primary" @click="handleentrybtn">立卷规则</el-button>
  265. <el-button type="info" @click="handlerulebtn">工程文件入口配置</el-button>
  266. <el-button type="warning" v-if="!isentryTree" @click="savebtn">保存设置</el-button>
  267. <div class="flexEnd" v-if="isentryTree">
  268. <i
  269. @click="rightPushTree"
  270. class="el-icon-plus"
  271. style="backgroundColor:#2A97DF;color:#fff;fontSize:20px;cursor: pointer;"
  272. ></i>
  273. </div>
  274. <el-tree
  275. :props="Rightprops"
  276. :data="rightData"
  277. node-key="id"
  278. accordion
  279. ref="tree"
  280. class="filter-tree"
  281. v-if="isentryTree"
  282. >
  283. </el-tree>
  284. <!-- 立卷规则 -->
  285. <div v-if="!isentryTree" style="margin-top:20px">
  286. <el-checkbox-group v-model="checkList">
  287. <el-checkbox label="设置为最高并卷层级"></el-checkbox>
  288. <el-checkbox label="设置为分类并卷层级"></el-checkbox>
  289. <el-checkbox label="设置为单独并卷层级"></el-checkbox>
  290. </el-checkbox-group>
  291. <div style="margin-top:20px;border:1px solid #e5e5e5;padding:20px">
  292. <!-- 选择默认划分树 -->
  293. <div style="display: flex;justify-content: space-between;">
  294. <el-select v-model="publictreevalue" clearable placeholder="请选择公有质检化分树" style=" width:45%;">
  295. <el-option
  296. v-for="item in publictreeoptions"
  297. :key="item.value"
  298. :label="item.label"
  299. :value="item.value">
  300. </el-option>
  301. </el-select>
  302. <el-select v-model="testtreevalue" clearable placeholder="请选择公有试验化分树" style=" width: 45%;">
  303. <el-option
  304. v-for="item in testtreeoptions"
  305. :key="item.value"
  306. :label="item.label"
  307. :value="item.value">
  308. </el-option>
  309. </el-select>
  310. </div>
  311. <div class="scrollClass" style="height:658px ;margin-top:20px">
  312. <el-scrollbar style="height:100%">
  313. <el-input
  314. placeholder="输入关键字进行过滤"
  315. v-model="rulefilterText">
  316. </el-input>
  317. <el-tree
  318. class="filter-tree"
  319. :data="ruledata"
  320. :props="ruledefaultProps"
  321. default-expand-all
  322. :filter-node-method="rulefilterNode"
  323. ref="ruletree">
  324. </el-tree>
  325. </el-scrollbar>
  326. </div>
  327. </div>
  328. </div>
  329. </div>
  330. </el-col>
  331. </el-row>
  332. <!-- 新增编辑 -->
  333. <el-dialog
  334. :title="form.id?'编辑':'新增'"
  335. :visible.sync="treeTap"
  336. width="700px"
  337. :modal-append-to-body="false"
  338. @close="treeClose"
  339. >
  340. <div>
  341. <el-form
  342. ref="form"
  343. :model="form"
  344. label-width="120px"
  345. :rules="rules"
  346. >
  347. <el-form-item
  348. label="节点名称"
  349. prop="nodeName"
  350. >
  351. <el-input
  352. v-model="form.nodeName"
  353. style="width:400px;"
  354. ></el-input>
  355. </el-form-item>
  356. <el-form-item
  357. label="岗位类型"
  358. prop="postType"
  359. >
  360. <el-select
  361. v-model="form.postType"
  362. placeholder="请选择岗位"
  363. style="width:400px;"
  364. >
  365. <el-option
  366. v-for="item in JobTypeList"
  367. :key="item.id"
  368. :label="item.title"
  369. :value="item.id"
  370. ></el-option>
  371. </el-select>
  372. </el-form-item>
  373. <el-form-item
  374. label="节点类型"
  375. prop="nodeType"
  376. >
  377. <el-select
  378. :disabled='form.id!=""'
  379. v-model="form.nodeType"
  380. placeholder="请选择节点"
  381. style="width:400px;"
  382. >
  383. <el-option
  384. v-for="item in nodeTypeList"
  385. :key="item.value"
  386. :label="item.label"
  387. :value="item.value"
  388. ></el-option>
  389. </el-select>
  390. </el-form-item>
  391. <template v-if="form.nodeType==2">
  392. <el-form-item
  393. label="是否存储节点"
  394. prop="isStorageNode"
  395. >
  396. <el-select
  397. :disabled='form.id!=""'
  398. v-model="form.isStorageNode"
  399. style="width:400px;"
  400. >
  401. <el-option
  402. v-for="item in storageNodeList"
  403. :key="item.value"
  404. :label="item.label"
  405. :value="item.value"
  406. ></el-option>
  407. </el-select>
  408. </el-form-item>
  409. <template v-if="form.isStorageNode==1">
  410. <el-form-item
  411. label="是否竣工图"
  412. prop="isBuiltDrawing"
  413. >
  414. <el-select
  415. v-model="form.isBuiltDrawing"
  416. style="width:400px;"
  417. >
  418. <el-option
  419. v-for="item in builtDrawingList"
  420. :key="item.value"
  421. :label="item.label"
  422. :value="item.value"
  423. ></el-option>
  424. </el-select>
  425. </el-form-item>
  426. <el-form-item
  427. label="是否接口节点"
  428. prop="isInterfaceNode"
  429. >
  430. <el-select
  431. v-model="form.isInterfaceNode"
  432. style="width:400px;"
  433. >
  434. <el-option
  435. v-for="item in interfaceNodeList"
  436. :key="item.value"
  437. :label="item.label"
  438. :value="item.value"
  439. ></el-option>
  440. </el-select>
  441. </el-form-item>
  442. <template v-if="form.isInterfaceNode==1">
  443. <el-form-item label="选择接口类型">
  444. <el-select
  445. v-model="form.interfaceType"
  446. style="width:400px;"
  447. >
  448. <el-option
  449. v-for="item in interfaceTypeList"
  450. :key="item.value"
  451. :label="item.label"
  452. :value="item.value"
  453. ></el-option>
  454. </el-select>
  455. </el-form-item>
  456. </template>
  457. </template>
  458. </template>
  459. <!-- 数字化文件上传 -->
  460. <template v-if="form.nodeType==1">
  461. <el-form-item
  462. label="关联类型"
  463. prop="associationType"
  464. >
  465. <el-select
  466. v-model="form.associationType"
  467. style="width:400px;"
  468. placeholder="请选择"
  469. >
  470. <el-option
  471. v-for="item in associationTypeList"
  472. :key="item.value"
  473. :label="item.label"
  474. :value="item.value"
  475. ></el-option>
  476. </el-select>
  477. </el-form-item>
  478. <template v-if="form.associationType==1">
  479. <el-form-item
  480. label="业内资料类型"
  481. prop="majorDataType"
  482. >
  483. <el-checkbox-group v-model="form.majorDataType">
  484. <el-checkbox
  485. v-for="item in majorDataTypeList"
  486. :key="item.dictKey"
  487. :label="item.dictKey"
  488. name="type"
  489. >{{item.dictValue}}</el-checkbox>
  490. </el-checkbox-group>
  491. </el-form-item>
  492. <el-form-item
  493. label="显示层级"
  494. prop="displayHierarchy"
  495. >
  496. <el-select
  497. v-model="form.displayHierarchy"
  498. style="width:400px;"
  499. placeholder="请选择"
  500. >
  501. <el-option
  502. v-for="item in displayHierarchyList"
  503. :key="item.dictKey"
  504. :label="item.dictValue"
  505. :value="item.dictKey"
  506. ></el-option>
  507. </el-select>
  508. </el-form-item>
  509. </template>
  510. </template>
  511. </el-form>
  512. </div>
  513. <span
  514. slot="footer"
  515. class="dialog-footer"
  516. >
  517. <el-button @click="treeTap=false">取 消</el-button>
  518. <el-button
  519. type="primary"
  520. @click="saveTree"
  521. >保 存</el-button>
  522. </span>
  523. </el-dialog>
  524. <!-- 右侧树 -->
  525. <el-dialog
  526. title="上传文件入口显示配置"
  527. :visible.sync="pushfileTap"
  528. :modal-append-to-body='false'
  529. width="800px"
  530. @close="pushFileClose"
  531. >
  532. <div>
  533. <el-tree
  534. :props="dialogProps"
  535. show-checkbox
  536. :data="dialogData"
  537. node-key="id"
  538. accordion
  539. ref="trees"
  540. class="filter-tree"
  541. >
  542. </el-tree>
  543. </div>
  544. <span
  545. slot="footer"
  546. class="dialog-footer"
  547. >
  548. <el-button @click="pushfileTap = false">取 消</el-button>
  549. <el-button
  550. type="primary"
  551. @click="saveFile"
  552. >确 定</el-button>
  553. </span>
  554. </el-dialog>
  555. <!-- wbs树排序弹框 -->
  556. <el-dialog
  557. title="调整排序"
  558. :visible="sortTag"
  559. width="50%"
  560. append-to-body
  561. >
  562. <ManualSorting
  563. v-if="sortTag2"
  564. @bianhua='bianhua()'
  565. :sort='sort'
  566. />
  567. <span
  568. slot="footer"
  569. class="dialog-footer"
  570. >
  571. <el-button @click="sortTag=false,sortTag2=false">取 消</el-button>
  572. <el-button
  573. type="primary"
  574. @click="editSort()"
  575. >确 定</el-button>
  576. </span>
  577. </el-dialog>
  578. </basic-container>
  579. </template>
  580. <script>
  581. import ManualSorting from '@/components/WbsTree/ManualSorting'
  582. import { archiveTreeInit, lazyTree, dictionary, remove, archiveTreeSave, archiveTreeUpdate, archiveTreeDetail, archiveTreetree, submitDisplayConfigTree, getSameGradeNode, submitArchiveTreeSort } from "@/api/manager/archivetree";
  583. import { getToken } from '@/util/auth';
  584. import { roletree } from "@/api/system/role.js";
  585. export default {
  586. components: {
  587. ManualSorting,
  588. },
  589. data () {
  590. return {
  591. publictreeoptions: [{//公有质检话分数
  592. value: '选项1',
  593. label: '公有质检划分树1'
  594. }, {
  595. value: '选项2',
  596. label: '公有质检划分树2'
  597. }, {
  598. value: '选项3',
  599. label: '公有质检划分树3'
  600. }],
  601. publictreevalue:'',
  602. testtreeoptions: [{//公有质检话分数
  603. value: '选项1',
  604. label: '公有试验划分树1'
  605. }, {
  606. value: '选项2',
  607. label: '公有试验划分树2'
  608. }, {
  609. value: '选项3',
  610. label: '公有试验划分树3'
  611. }],
  612. testtreevalue:'',
  613. activeName: 'second',
  614. isentryTree:true,
  615. checkList:[],
  616. //#region 左侧树
  617. defaultExpanded: [],//默认选中的节点
  618. filterText: '',//筛选条件
  619. treeNode: {},
  620. nodeNames: '',
  621. token: '',
  622. props: {
  623. label: 'title',
  624. children: 'children',
  625. isLeaf: 'hasChildren'
  626. },
  627. data: [],//树节点枚举值
  628. //#endregion
  629. //#region 新增编辑节点弹框
  630. treeTap: false,
  631. form: {
  632. id: '',//新增还是编辑
  633. parentId: '', //上级节点id
  634. nodeName: "", //节点名称
  635. nodeType: '', // 节点类型 2 = 数字化上传文件
  636. postType: '', //岗位类型
  637. isStorageNode: '', //是否为存储节点
  638. isBuiltDrawing: '', //竣工图
  639. isInterfaceNode: '', //是否接口节点
  640. interfaceType: '', //选择接口类型
  641. associationType: '', //关联类型
  642. majorDataType: [], //内业资料类型
  643. displayHierarchy: '' //显示层级
  644. },
  645. rules: {
  646. nodeName: [{ required: true, message: '请输入节点名称', trigger: 'blur' }],
  647. postType: [{ required: true, message: '请选择岗位类型', trigger: 'change' }],
  648. nodeType: [{ required: true, message: '请选择节点类型', trigger: 'change' }],
  649. isStorageNode: [{ required: true, message: '请选择存储节点', trigger: 'change' }],
  650. isBuiltDrawing: [{ required: true, message: '请选择竣工图', trigger: 'change' }],
  651. isInterfaceNode: [{ required: true, message: '请选择接口节点', trigger: 'change' }],
  652. interfaceType: [{ required: true, message: '请选择接口类型', trigger: 'change' }],
  653. associationType: [{ required: true, message: '请选择关联类型', trigger: 'change' }],
  654. majorDataType: [{ required: true, message: '请选择业内资料类型', trigger: 'change' }],
  655. displayHierarchy: [{ required: true, message: '请选择显示层级', trigger: 'change' }],
  656. },
  657. JobTypeList: [],//岗位类型枚举
  658. nodeTypeList: [
  659. {
  660. label: '关联电子原生文件',
  661. value: 1
  662. }, {
  663. label: '数字化上传文件',
  664. value: 2
  665. },
  666. ],//节点类型枚举
  667. storageNodeList: [{
  668. label: '是',
  669. value: 1
  670. }, {
  671. label: '否',
  672. value: 2
  673. },],//存储节点枚举
  674. builtDrawingList: [{
  675. label: '是',
  676. value: 1
  677. }, {
  678. label: '否',
  679. value: 2
  680. },],//竣工图枚举
  681. interfaceNodeList: [{
  682. label: '是',
  683. value: 1
  684. }, {
  685. label: '否',
  686. value: 2
  687. },],//接口节点枚举
  688. interfaceTypeList: [
  689. {
  690. label: '试验接口',
  691. value: 1
  692. }, {
  693. label: '计量接口',
  694. value: 2
  695. },
  696. ],//选择接口类型枚举
  697. associationTypeList: [{
  698. label: '质检资料',
  699. value: 1
  700. },
  701. {
  702. label: '试验资料',
  703. value: 2
  704. },
  705. {
  706. label: '影像资料',
  707. value: 3
  708. },
  709. {
  710. label: '台账资料',
  711. value: 4
  712. }],//
  713. majorDataTypeList: [],//
  714. displayHierarchyList: [],//
  715. //#endregion
  716. //#region 右侧树节点
  717. pushfileTap: false,//开关
  718. Rightprops: {
  719. label: 'title'
  720. },
  721. rightData: [],
  722. //#endregion
  723. //#region 右侧树弹框
  724. dialogProps: {
  725. label: 'title'
  726. },
  727. dialogData: [],
  728. checkXuan: [],
  729. //#endregion
  730. heights: '',
  731. sortTag2: false,
  732. sortTag: false,
  733. sort: [],
  734. ruledata: [{
  735. id: 1,
  736. label: '一级 1',
  737. children: [{
  738. id: 4,
  739. label: '二级 1-1',
  740. children: [{
  741. id: 9,
  742. label: '三级 1-1-1'
  743. }, {
  744. id: 10,
  745. label: '三级 1-1-2'
  746. }]
  747. }]
  748. }, {
  749. id: 2,
  750. label: '一级 2',
  751. children: [{
  752. id: 5,
  753. label: '二级 2-1'
  754. }, {
  755. id: 6,
  756. label: '二级 2-2'
  757. }]
  758. }, {
  759. id: 3,
  760. label: '一级 3',
  761. children: [{
  762. id: 7,
  763. label: '二级 3-1'
  764. }, {
  765. id: 8,
  766. label: '二级 3-2'
  767. }]
  768. }],
  769. ruledefaultProps: {
  770. children: 'children',
  771. label: 'label'
  772. }
  773. }
  774. },
  775. methods: {
  776. //切换tabs
  777. handleClick(tab, event) {
  778. console.log(tab, event);
  779. },
  780. handleentrybtn(){
  781. console.log(this.entrybtn,'entrybtn');
  782. this.isentryTree=false;
  783. },
  784. handlerulebtn(){
  785. this.isentryTree=true;
  786. console.log(this.rulebtn,'rulebtn');
  787. },
  788. savebtn(){
  789. this.isentryTree=true;
  790. },
  791. paixuMD (data) {
  792. this.sortTag = true
  793. this.sortTag2 = true
  794. this.curTreeData = data;
  795. this.findWbsTreeSameLevel(data.id)
  796. },
  797. async findWbsTreeSameLevel (parentId) {//查询当前节点的同级节点
  798. const { data: res } = await getSameGradeNode({ id: parentId })
  799. //console.log(res);
  800. if (res.code === 200) {
  801. this.sort = res.data
  802. }
  803. },
  804. bianhua () {
  805. this.sortTag2 = false
  806. this.$nextTick(() => {
  807. this.sortTag2 = true
  808. })
  809. },
  810. editSort () {//修改排序
  811. let sortArr = this.sort, newArr = []
  812. for (let i = 0; i < sortArr.length; i++) {
  813. newArr.push({
  814. id: sortArr[i].id,
  815. nodeName: sortArr[i].nodeName
  816. })
  817. }
  818. this.wbsTreeSort(newArr)
  819. },
  820. async wbsTreeSort (newArr) {//修改排序
  821. const { data: res } = await submitArchiveTreeSort(newArr)
  822. //console.log(res);
  823. if (res.code == 200) {
  824. this.sortTag = false
  825. this.sortTag2 = false
  826. //刷新页面
  827. window.location.reload()
  828. }
  829. },
  830. //#region 左侧树方法
  831. async loadNode (node, resolve) {
  832. console.log(node);
  833. if (node.level === 0) {
  834. let ks = await this.lazyTree(0)
  835. if (ks.length) {
  836. resolve(ks)
  837. } else {
  838. this.archiveTreeInit()
  839. }
  840. } else {
  841. resolve(await this.lazyTree(node.data.id))
  842. }
  843. },
  844. async archiveTreeInit () {//添加根节点
  845. const { data: res } = await archiveTreeInit()
  846. console.log(res);
  847. if (res.code == 200 && res.msg == '操作成功') {
  848. res.data.forEach(val => {
  849. val.hasChildren = !val.hasChildren
  850. });
  851. return res.data
  852. } else if (res.code == 200 && res.msg == "未查询到信息") {
  853. return []
  854. }
  855. },
  856. async lazyTree (parentId) {//树节点懒加载
  857. const { data: res } = await lazyTree({
  858. parentId,
  859. token: this.token
  860. })
  861. console.log(res);
  862. if (res.code == 200 && res.msg == '操作成功') {
  863. res.data.forEach(val => {
  864. val.hasChildren = !val.hasChildren
  865. });
  866. return res.data
  867. } else if (res.code == 200 && res.msg == "未查询到信息") {
  868. return []
  869. }
  870. },
  871. mouseLeave (data) {
  872. if (data.moreShow) {
  873. this.$set(data, 'moreShow', false)
  874. }
  875. },
  876. mouseOver (data) {
  877. if (!data.moreShow) {
  878. this.$set(data, 'moreShow', true)
  879. }
  880. },
  881. addtree (data, node) {//添加树
  882. console.log(data);
  883. if (this.JobTypeList.length == 0) {
  884. this.roletree()
  885. }
  886. if (this.majorDataTypeList.length == 0) {
  887. this.major_data_type()//内业资料类型
  888. }
  889. if (this.displayHierarchyList.length == 0) {
  890. this.display_hierarchy()//显示层级
  891. }
  892. this.form.postType = data.postType
  893. this.form.id = ''
  894. this.form.parentId = data.id
  895. if (this.filterText) {
  896. this.defaultExpanded = [data.id]
  897. }
  898. this.treeTap = true
  899. },
  900. async edittree (data) {//编辑树
  901. if (this.JobTypeList.length == 0) {
  902. this.roletree()
  903. }
  904. if (this.majorDataTypeList.length == 0) {
  905. this.major_data_type()//内业资料类型
  906. }
  907. if (this.displayHierarchyList.length == 0) {
  908. this.display_hierarchy()//显示层级
  909. }
  910. await this.archiveTreeDetail(data)
  911. this.form.id = data.id
  912. this.form.parentId = ''
  913. this.treeNode = data
  914. this.treeTap = true
  915. },
  916. deletetree (node) {//删除树
  917. console.log(node);
  918. let _that = this
  919. this.$confirm('是否删除此数据', '提示', {
  920. distinguishCancelAndClose: true,
  921. confirmButtonText: '确认',
  922. cancelButtonText: '取消'
  923. })
  924. .then(() => {
  925. this.remove(node.data.id).then(()=>{
  926. _that.$refs.trees1.remove(node) //删除界面上的节点
  927. }).catch(()=>{
  928. })
  929. })
  930. .catch(() => {
  931. });
  932. },
  933. async remove (id) {//删除接口
  934. const { data: res } = await remove({ id })
  935. console.log(res);
  936. if (res.code == 200) {
  937. this.$message({
  938. type: 'success',
  939. message: '删除成功'
  940. })
  941. }
  942. },
  943. async archiveTreeDetail (data) {//详情接口
  944. console.log(data);
  945. const { data: res } = await archiveTreeDetail({ id: data.id })
  946. console.log(res);
  947. if (res.code == 200) {
  948. this.form.nodeName = res.data.fullName //节点名称
  949. this.form.nodeType = res.data.nodeType // 节点类型 2 = 数字化上传文件
  950. this.form.postType = res.data.postType //岗位类型
  951. this.form.isStorageNode = res.data.isStorageNode //是否为存储节点
  952. this.form.isBuiltDrawing = res.data.isBuiltDrawing //竣工图
  953. this.form.isInterfaceNode = res.data.isInterfaceNode //是否接口节点
  954. this.form.interfaceType = res.data.interfaceType //选择接口类型
  955. this.form.associationType = res.data.associationType //关联类型
  956. this.form.majorDataType = res.data.majorDataType //内业资料类型
  957. this.form.displayHierarchy = res.data.displayHierarchy //显示层级
  958. }
  959. },
  960. async archiveTreetree4 () {//全加载左侧树
  961. const { data: res } = await archiveTreetree({
  962. token: this.token
  963. })
  964. console.log(res);
  965. if (res.code == 200 && res.msg == "操作成功") {
  966. this.data = res.data
  967. }
  968. },
  969. filterNode (value,data,node) {//筛选条件
  970. // 如果什么都没填就直接返回
  971. if(!value){
  972. return true;
  973. }
  974. let _array = [];//这里使用数组存储 只是为了存储值。
  975. this.getReturnNode(node,_array,value);
  976. let result = false;
  977. _array.forEach((item)=>{
  978. result = result || item;
  979. });
  980. return result;
  981. },
  982. //判断节点是否匹配
  983. getReturnNode(node,_array,value){
  984. let isPass = node.data && node.data.title && node.data.title.indexOf(value) !== -1;
  985. isPass?_array.push(isPass):'';
  986. //判断节点是否是父节点
  987. if(!isPass && node.level!=1 && node.parent){
  988. this.getReturnNode(node.parent,_array,value);
  989. }
  990. },
  991. //#endregion
  992. //#region 新增编辑节点弹框
  993. treeClose () {//弹框关闭事件
  994. this.form = {
  995. parentId: '', //上级节点id
  996. nodeName: "", //节点名称
  997. nodeType: '', // 节点类型 2 = 数字化上传文件
  998. postType: '', //岗位类型
  999. isStorageNode: '', //是否为存储节点
  1000. isBuiltDrawing: '', //竣工图
  1001. isInterfaceNode: '', //是否接口节点
  1002. interfaceType: '', //选择接口类型
  1003. associationType: '', //关联类型
  1004. majorDataType: [], //内业资料类型
  1005. displayHierarchy: '' //显示层级
  1006. }
  1007. this.$refs.form.resetFields();
  1008. this.form.id = ''
  1009. this.treeTap = false
  1010. },
  1011. async roletree () {//岗位类型枚举
  1012. const { data: res } = await roletree()
  1013. console.log(res);
  1014. if (res.code == 200) {
  1015. this.JobTypeList = res.data
  1016. }
  1017. },
  1018. async major_data_type () {//内业资料类型
  1019. const { data: res } = await dictionary({ code: 'major_data_type' })
  1020. console.log(res);
  1021. if (res.code == 200) {
  1022. this.majorDataTypeList = res.data
  1023. }
  1024. },
  1025. async display_hierarchy () {//显示层级
  1026. const { data: res } = await dictionary({ code: 'display_hierarchy' })
  1027. console.log(res);
  1028. if (res.code == 200) {
  1029. this.displayHierarchyList = res.data
  1030. }
  1031. },
  1032. saveTree () {//保存按钮
  1033. this.$refs.form.validate(val => {
  1034. if (val) {
  1035. if (this.form.nodeType == 2) {
  1036. if (this.form.isStorageNode == 1) {
  1037. if (this.form.isInterfaceNode == 1) {
  1038. this.baocun({
  1039. id: this.form.id,
  1040. parentId: this.form.parentId, //上级节点id
  1041. nodeName: this.form.nodeName, //节点名称
  1042. nodeType: this.form.nodeType, // 节点类型
  1043. postType: this.form.postType, //岗位类型
  1044. isStorageNode: this.form.isStorageNode, //是否为存储节点
  1045. isBuiltDrawing: this.form.isBuiltDrawing, //竣工图
  1046. isInterfaceNode: this.form.isInterfaceNode, //是否接口节点
  1047. interfaceType: this.form.interfaceType, //选择接口类型
  1048. })
  1049. } else {
  1050. this.baocun({
  1051. id: this.form.id,
  1052. parentId: this.form.parentId, //上级节点id
  1053. nodeName: this.form.nodeName, //节点名称
  1054. nodeType: this.form.nodeType, // 节点类型
  1055. postType: this.form.postType, //岗位类型
  1056. isStorageNode: this.form.isStorageNode, //是否为存储节点
  1057. isBuiltDrawing: this.form.isBuiltDrawing, //竣工图
  1058. isInterfaceNode: this.form.isInterfaceNode, //是否接口节点
  1059. })
  1060. }
  1061. } else {
  1062. this.baocun({
  1063. id: this.form.id,
  1064. parentId: this.form.parentId, //上级节点id
  1065. nodeName: this.form.nodeName, //节点名称
  1066. nodeType: this.form.nodeType, // 节点类型
  1067. postType: this.form.postType, //岗位类型
  1068. isStorageNode: this.form.isStorageNode, //是否为存储节点
  1069. })
  1070. }
  1071. } else if (this.form.nodeType == 1) {
  1072. if (this.form.associationType == 1) {
  1073. this.baocun({
  1074. id: this.form.id,
  1075. parentId: this.form.parentId, //上级节点id
  1076. nodeName: this.form.nodeName, //节点名称
  1077. nodeType: this.form.nodeType, // 节点类型
  1078. associationType: this.form.associationType, //关联类型
  1079. majorDataType: this.form.majorDataType, //内业资料类型
  1080. displayHierarchy: this.form.displayHierarchy, //显示层级
  1081. })
  1082. } else {
  1083. this.baocun({
  1084. id: this.form.id,
  1085. parentId: this.form.parentId, //上级节点id
  1086. nodeName: this.form.nodeName, //节点名称
  1087. nodeType: this.form.nodeType, // 节点类型
  1088. associationType: this.form.associationType, //关联类型
  1089. })
  1090. }
  1091. }
  1092. }
  1093. })
  1094. },
  1095. async baocun (da) {
  1096. if (da.majorDataType) {
  1097. if (da.majorDataType.length > 0) {
  1098. let das = ''
  1099. da.majorDataType.forEach((val, key) => {
  1100. das += val
  1101. if (da.majorDataType.length - 1 != key) {
  1102. das += ','
  1103. }
  1104. })
  1105. da.majorDataType = das
  1106. }
  1107. }
  1108. if (this.form.id) {
  1109. await this.archiveTreeUpdate(da)
  1110. } else {
  1111. await this.archiveTreeSave(da)
  1112. }
  1113. if (this.filterText) {
  1114. this.archiveTreetree4()
  1115. }
  1116. },
  1117. async archiveTreeSave (da) {//新增
  1118. console.log(da);
  1119. const { data: res } = await archiveTreeSave(da)
  1120. console.log(res);
  1121. if (res.code == 200) {
  1122. this.$message({
  1123. type: 'success',
  1124. message: '新增成功'
  1125. })
  1126. this.treeTap = false
  1127. let das = await this.lazyTree(da.parentId)
  1128. this.$refs.trees1.updateKeyChildren(da.parentId, das)
  1129. let node = this.$refs.trees1.getNode(da.parentId);
  1130. node.isLeaf = false;
  1131. node.isLeafByUser = false;
  1132. }
  1133. },
  1134. async archiveTreeUpdate (da) {//编辑
  1135. const { data: res } = await archiveTreeUpdate(da)
  1136. console.log(res);
  1137. if (res.code == 200) {
  1138. this.$message({
  1139. type: 'success',
  1140. message: '编辑成功'
  1141. })
  1142. this.treeTap = false
  1143. this.treeNode.title = da.nodeName
  1144. this.treeNode.postType = da.postType
  1145. }
  1146. },
  1147. //#endregion
  1148. //#region 右侧树节点
  1149. async rightPushTree () {//右侧节点树
  1150. this.checkXuan = []
  1151. await this.archiveTreetree2({
  1152. token: this.token,
  1153. nodeType: 2,
  1154. })
  1155. this.pushfileTap = true
  1156. await this.saixuan(this.dialogData)
  1157. console.log(this.checkXuan);
  1158. this.$refs.trees.setCheckedKeys(this.checkXuan);
  1159. },
  1160. // 赛选
  1161. saixuan (da) {//赛选
  1162. if (da.length > 0) {
  1163. let tag = true
  1164. da.forEach(val => {
  1165. if (val.isDisplayTree == 1 && val.hasChildren) {
  1166. let ks = this.saixuan(val.children)
  1167. if (ks) {
  1168. this.checkXuan.push(val.id)
  1169. }
  1170. } else if (val.isDisplayTree == 1 && !val.hasChildren) {
  1171. this.checkXuan.push(val.id)
  1172. } else {
  1173. tag = false
  1174. }
  1175. })
  1176. return tag
  1177. }
  1178. },
  1179. pushFileClose () {//弹框关闭事件
  1180. this.checkXuan = []
  1181. },
  1182. async archiveTreetree (da) {//右侧树全加载接口
  1183. const { data: res } = await archiveTreetree(da)
  1184. console.log(res);
  1185. if (res.code == 200 && res.msg == "操作成功") {
  1186. this.rightData = res.data
  1187. }
  1188. },
  1189. //#endregion
  1190. //#region 右侧树弹框
  1191. async submitDisplayConfigTree (ids) {//保存接口
  1192. const { data: res } = await submitDisplayConfigTree({ ids })
  1193. console.log(res);
  1194. if (res.code == 200) {
  1195. this.$message({
  1196. type: 'success',
  1197. message: '设置成功'
  1198. })
  1199. this.archiveTreetree({
  1200. token: this.token,
  1201. disPlayTree: 1,
  1202. nodeType: 2,
  1203. })
  1204. this.pushfileTap = false
  1205. }
  1206. },
  1207. async archiveTreetree2 (da) {//右侧树全加载接口
  1208. const { data: res } = await archiveTreetree(da)
  1209. console.log(res);
  1210. if (res.code == 200 && res.msg == "操作成功") {
  1211. this.dialogData = res.data
  1212. }
  1213. },
  1214. saveFile () {//保存按钮
  1215. let zi = this.$refs.trees.getCheckedKeys() //返回选中子节点的key
  1216. let fu = this.$refs.trees.getHalfCheckedKeys()//返回选中子节点的父节点的key
  1217. let arr = [...zi, ...fu]
  1218. if (arr.length > 0) {
  1219. let ids = ''
  1220. arr.forEach((val, key) => {
  1221. ids += val
  1222. if (key != arr.length - 1) {
  1223. ids += ','
  1224. }
  1225. })
  1226. this.submitDisplayConfigTree(ids)
  1227. } else {
  1228. this.$message({
  1229. type: 'error',
  1230. message: '请先设置配置文件'
  1231. })
  1232. }
  1233. },
  1234. //#endregion
  1235. },
  1236. watch: {
  1237. filterText (val) {
  1238. this.$refs.trees2.filter(val);
  1239. },
  1240. rulefilterText(val) {
  1241. this.$refs.ruletree.filter(val);
  1242. }
  1243. },
  1244. created () {
  1245. this.token = 'bearer ' + getToken()
  1246. this.archiveTreetree({
  1247. token: this.token,
  1248. disPlayTree: 1,
  1249. nodeType: 2,
  1250. })
  1251. this.archiveTreetree4()//全加载左侧树
  1252. },
  1253. mounted () {
  1254. this.heights = this.$refs.container.$el.offsetHeight
  1255. }
  1256. }
  1257. </script>
  1258. <style lang="scss" scoped>
  1259. .peizhi {
  1260. border: 1px solid #e5e5e5;
  1261. border-radius: 5px;
  1262. padding: 15px 10px;
  1263. }
  1264. .btnground{
  1265. background-color: #e5e5e5;
  1266. }
  1267. </style>