archivetree.vue 42 KB

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