tree.vue 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577
  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. <div style="position: relative; height: calc(100% - 65px);">
  17. <el-scrollbar>
  18. <div v-loading="treeLoad">
  19. <el-tree
  20. v-show="!filterText"
  21. class="filter-tree"
  22. lazy
  23. :data="treeData"
  24. :load="loadNode"
  25. @node-click="getNodeDetail"
  26. :props="defaultProps"
  27. :expand-on-click-node="false"
  28. highlight-current
  29. node-key="id"
  30. ref="tree"
  31. :default-expanded-keys="defaultExpandedKeys"
  32. >
  33. <span
  34. class="custom-tree-node"
  35. :class="data.moreShow?'show':''"
  36. slot-scope="{ node, data }"
  37. >
  38. <!--@mouseover="mouseover(data)" @mouseleave="mouseout(data)"-->
  39. <span class="pd-r-20">
  40. {{ node.label }}
  41. <el-dropdown
  42. @click="command=>{setLeftType(command,data)}"
  43. @visible-change="visiblechange($event,data)"
  44. >
  45. <el-button
  46. type="text"
  47. icon="el-icon-more"
  48. class="normal-black"
  49. >
  50. </el-button>
  51. <el-dropdown-menu slot="dropdown">
  52. <!-- <el-dropdown-item
  53. @click.native="setLeftType(1,data,node)"
  54. icon="el-icon-circle-plus-outline"
  55. v-if="data.deptCategory != 6 && data.isExistForm != 1"
  56. >新增子级</el-dropdown-item> -->
  57. <el-dropdown-item
  58. @click.native="setLeftType(2,data,node)"
  59. icon="el-icon-edit"
  60. >编辑节点</el-dropdown-item>
  61. <el-dropdown-item
  62. @click.native="setLeftType(3,data,node)"
  63. icon="el-icon-document-copy"
  64. >复制节点</el-dropdown-item>
  65. <el-dropdown-item
  66. @click.native="deleNode(data,node)"
  67. icon="el-icon-close"
  68. v-if="node.level !=1"
  69. >删除节点</el-dropdown-item>
  70. <el-dropdown-item
  71. @click.native="setLeftType(4,data,node)"
  72. icon="iconfont hcicon-danganziliao-biaogetianxie"
  73. class="font-s-12"
  74. >元素公式</el-dropdown-item>
  75. <el-dropdown-item
  76. @click.native="setLeftType(5,data,node)"
  77. icon="el-icon-coin"
  78. >元素设置</el-dropdown-item>
  79. <el-dropdown-item
  80. @click.native="nodeInfo(data,node)"
  81. icon="el-icon-help"
  82. >节点参数</el-dropdown-item>
  83. <el-dropdown-item
  84. @click.native="importTemplate(data,node)"
  85. v-if="node.level == 2"
  86. icon="el-icon-upload"
  87. >导入划分</el-dropdown-item>
  88. <el-dropdown-item
  89. v-if="data.parentId!=0"
  90. @click.native="sortpai(data,node)"
  91. icon="el-icon-sort"
  92. >调整排序</el-dropdown-item>
  93. </el-dropdown-menu>
  94. </el-dropdown>
  95. </span>
  96. </span>
  97. </el-tree>
  98. <el-tree
  99. v-show="filterText"
  100. class="filter-tree"
  101. :data="treeData"
  102. @node-click="getNodeDetail"
  103. :props="defaultProps"
  104. :expand-on-click-node="false"
  105. highlight-current
  106. node-key="id"
  107. :filter-node-method="filterNode"
  108. ref="treeall"
  109. >
  110. <span
  111. class="custom-tree-node"
  112. slot-scope="{ node, data }"
  113. :class="data.moreShow?'show':''"
  114. >
  115. <span class="pd-r-20">
  116. {{ node.label }}
  117. <el-dropdown
  118. @click="command=>{setLeftType(command,data)}"
  119. @visible-change="visiblechange($event,data)"
  120. >
  121. <el-button
  122. type="text"
  123. icon="el-icon-more"
  124. class="normal-black"
  125. >
  126. </el-button>
  127. <el-dropdown-menu slot="dropdown">
  128. <!-- <el-dropdown-item
  129. @click.native="setLeftType(1,data,node)"
  130. icon="el-icon-circle-plus-outline"
  131. v-if="data.deptCategory != 6 && data.isExistForm != 1"
  132. >新增子级</el-dropdown-item> -->
  133. <el-dropdown-item
  134. @click.native="setLeftType(2,data,node)"
  135. icon="el-icon-edit"
  136. >编辑节点</el-dropdown-item>
  137. <el-dropdown-item
  138. @click.native="setLeftType(3,data,node)"
  139. icon="el-icon-document-copy"
  140. >复制节点</el-dropdown-item>
  141. <el-dropdown-item
  142. @click.native="deleNode(data,node)"
  143. icon="el-icon-close"
  144. v-if="node.level !=1"
  145. >删除节点</el-dropdown-item>
  146. <el-dropdown-item
  147. @click.native="setLeftType(4,data,node)"
  148. icon="iconfont hcicon-danganziliao-biaogetianxie"
  149. class="font-s-12"
  150. >元素公式</el-dropdown-item>
  151. <el-dropdown-item
  152. @click.native="setLeftType(5,data,node)"
  153. icon="el-icon-coin"
  154. >元素设置</el-dropdown-item>
  155. <el-dropdown-item
  156. @click.native="nodeInfo(data)"
  157. icon="el-icon-help"
  158. >节点参数</el-dropdown-item>
  159. <el-dropdown-item
  160. @click.native="importTemplate(data,node)"
  161. v-if="node.level == 2"
  162. icon="el-icon-upload"
  163. >导入划分</el-dropdown-item>
  164. </el-dropdown-menu>
  165. </el-dropdown>
  166. </span>
  167. </span>
  168. </el-tree>
  169. </div>
  170. </el-scrollbar>
  171. </div>
  172. </div>
  173. </el-col>
  174. <el-col :span="14">
  175. <template v-if="leftType==5">
  176. <p>节点信息</p>
  177. <el-table
  178. :data="tableData"
  179. border
  180. style="width: 100%"
  181. >
  182. <el-table-column
  183. align="center"
  184. prop="deptName"
  185. label="当前节点"
  186. ></el-table-column>
  187. <el-table-column
  188. align="center"
  189. prop="deptCategory"
  190. :formatter="formatCat"
  191. label="节点类型"
  192. width="180"
  193. ></el-table-column>
  194. <el-table-column
  195. align="center"
  196. prop="parentName"
  197. label="上级节点"
  198. ></el-table-column>
  199. </el-table>
  200. <p>
  201. <span>当前项目信息表</span>
  202. <!-- <el-button
  203. @click="showFormElement"
  204. type="text"
  205. icon="el-icon-circle-plus-outline"
  206. class="text-icon mg-l-10"
  207. ></el-button>
  208. <el-button
  209. type="text"
  210. icon="el-icon-document-copy"
  211. class="text-icon"
  212. ></el-button> -->
  213. <el-button
  214. type="text"
  215. style="margin-left:10px;"
  216. icon="el-icon-edit-outline"
  217. class="text-icon"
  218. @click="editEditElementForm()"
  219. ></el-button>
  220. <el-button
  221. type="text"
  222. icon="el-icon-sort"
  223. class="text-icon"
  224. @click="privateTableSort()"
  225. ></el-button>
  226. </p>
  227. <el-table
  228. :data="formData"
  229. border
  230. style="width: 100%"
  231. >
  232. <el-table-column
  233. align="center"
  234. prop="tableName"
  235. label="表单名称"
  236. ></el-table-column>
  237. <el-table-column
  238. align="center"
  239. prop="elementTotal"
  240. label="字段总量"
  241. ></el-table-column>
  242. <el-table-column
  243. align="center"
  244. prop="tableType"
  245. :formatter="formatTableType"
  246. label="表单类型"
  247. ></el-table-column>
  248. <el-table-column
  249. align="center"
  250. prop="tableOwner"
  251. :formatter="formatOwner"
  252. label="所属方"
  253. ></el-table-column>
  254. <el-table-column
  255. label="操作"
  256. min-width="120"
  257. >
  258. <template slot-scope="scope">
  259. <el-button
  260. size="mini"
  261. @click="handleEdit(scope.$index, scope.row)"
  262. >预览</el-button>
  263. <el-button
  264. size="mini"
  265. type="primary"
  266. v-throttle='3000'
  267. v-show="scope.row.status==0"
  268. @click="hideMD(scope.row)"
  269. >取消隐藏</el-button>
  270. <el-button
  271. size="mini"
  272. type="primary"
  273. v-throttle='3000'
  274. v-show="scope.row.status==1"
  275. @click="hideMD(scope.row)"
  276. >隐藏表单</el-button>
  277. <el-button
  278. size="mini"
  279. type="danger"
  280. @click="handleDelete(scope.$index, scope.row)"
  281. >删除</el-button>
  282. </template>
  283. </el-table-column>
  284. </el-table>
  285. </template>
  286. <template v-if="leftType==4">
  287. <el-table
  288. :data="formData"
  289. border
  290. style="width: 100%"
  291. >
  292. <el-table-column
  293. align="center"
  294. prop="tableName"
  295. label="表单名称"
  296. ></el-table-column>
  297. <el-table-column
  298. align="center"
  299. prop="tableType"
  300. :formatter="formatTableType"
  301. label="表单类型"
  302. ></el-table-column>
  303. <el-table-column
  304. label="是否关联清表"
  305. width="130"
  306. prop="isLinkTable"
  307. align="center"
  308. >
  309. <template slot-scope="scope">
  310. <span v-if="scope.row.isLinkTable == 2">是</span>
  311. <span v-else>否</span>
  312. </template>
  313. </el-table-column>
  314. <el-table-column
  315. align="center"
  316. prop="tableOwner"
  317. :formatter="formatOwner"
  318. label="所属方"
  319. ></el-table-column>
  320. <el-table-column
  321. label="操作"
  322. width="400"
  323. align="center"
  324. >
  325. <template slot-scope="scope">
  326. <el-link
  327. type="primary"
  328. @click="Associationlist(scope)"
  329. >关联清表</el-link>
  330. <el-link
  331. class="mg-l-10"
  332. type="primary"
  333. :disabled='scope.row.excelId==-1'
  334. @click="rightClick(scope.row.pkeyId,scope.row.excelId,scope.row.id,scope.row.initTableName)"
  335. >编辑元素</el-link>
  336. <el-link
  337. class="mg-l-10"
  338. type="primary"
  339. :disabled='scope.row.excelId==-1'
  340. @click="adjustExcel(scope.row.pkeyId,scope.row.excelId)"
  341. >调整表单</el-link>
  342. <el-link
  343. class="mg-l-10"
  344. type="primary"
  345. @click="handleEditFormula(scope.$index, scope.row)"
  346. >编辑元素公式</el-link>
  347. <el-link
  348. class="mg-l-10"
  349. type="danger"
  350. @click="handleDelete(scope.$index, scope.row)"
  351. >删除表单</el-link>
  352. </template>
  353. </el-table-column>
  354. </el-table>
  355. </template>
  356. </el-col>
  357. </el-row>
  358. <!-- 编辑元素表单信息 -->
  359. <el-dialog
  360. title="编辑元素表单信息"
  361. :visible="editElementFormTag"
  362. width="60%"
  363. :modal-append-to-body="false"
  364. >
  365. <div>
  366. <el-table
  367. :data="formDatass"
  368. border
  369. style="width: 100%"
  370. >
  371. <el-table-column
  372. prop="tableName"
  373. label="表名"
  374. >
  375. <template slot-scope="scope">
  376. <el-input
  377. v-model="scope.row.tableName"
  378. placeholder="请输入表名称"
  379. ></el-input>
  380. </template>
  381. </el-table-column>
  382. <el-table-column
  383. prop="tableType"
  384. label="表类型"
  385. >
  386. <template slot-scope="scope">
  387. <el-select
  388. v-model="scope.row.tableType"
  389. placeholder="请选择"
  390. >
  391. <el-option
  392. v-for="(item,key) in tableTypelist"
  393. :key="key"
  394. :label="item.dictValue"
  395. :value="item.dictKey"
  396. >
  397. </el-option>
  398. </el-select>
  399. </template>
  400. </el-table-column>
  401. <el-table-column
  402. prop="tableOwner"
  403. label="所属方"
  404. >
  405. <template slot-scope="scope">
  406. <el-select
  407. v-model="scope.row.tableOwner"
  408. placeholder="请选择"
  409. >
  410. <el-option
  411. v-for="(item,key) in ownerTypeList"
  412. :key="key"
  413. :label="item.dictValue"
  414. :value="item.dictKey"
  415. >
  416. </el-option>
  417. </el-select>
  418. </template>
  419. </el-table-column>
  420. </el-table>
  421. </div>
  422. <span
  423. slot="footer"
  424. class="dialog-footer"
  425. >
  426. <el-button @click="editElementFormTag = false">取 消</el-button>
  427. <el-button
  428. type="primary"
  429. @click="editeditElementFormMF()"
  430. >确 定</el-button>
  431. </span>
  432. </el-dialog>
  433. <!-- 调整表单模板 -->
  434. <div
  435. v-if="excelHtml"
  436. class="excelHtml"
  437. >
  438. <dynamicExcel
  439. @remove="removeExcel"
  440. v-if="excelHtml"
  441. :pkeyId='GLExcelFrom.id'
  442. />
  443. </div>
  444. <!-- 私有wbs树排序弹框 -->
  445. <el-dialog
  446. title="调整排序"
  447. :visible="sortTag"
  448. width="50%"
  449. append-to-body
  450. >
  451. <ManualSorting
  452. v-if="sortTag2"
  453. @bianhua='bianhua()'
  454. :sort='sort'
  455. />
  456. <span
  457. slot="footer"
  458. class="dialog-footer"
  459. >
  460. <el-button @click="sortTag=false,sortTag2=false">取 消</el-button>
  461. <el-button
  462. type="primary"
  463. @click="editSort()"
  464. >确 定</el-button>
  465. </span>
  466. </el-dialog>
  467. <!-- 元素表排序 -->
  468. <el-dialog
  469. title="调整排序"
  470. :visible="excelSortTag"
  471. width="50%"
  472. append-to-body
  473. >
  474. <ManualSorting
  475. v-if="excelSortTag2"
  476. @bianhua='bianhua2()'
  477. :sort='tableSortList'
  478. />
  479. <span
  480. slot="footer"
  481. class="dialog-footer"
  482. >
  483. <el-button @click="excelSortTag=false">取 消</el-button>
  484. <el-button
  485. type="primary"
  486. @click="editPrivateSort()"
  487. >确 定</el-button>
  488. </span>
  489. </el-dialog>
  490. <!-- 关联清表 -->
  491. <el-dialog
  492. title="关联清表"
  493. class="excelBox"
  494. :visible.sync="GLExcel"
  495. width="500px"
  496. modal-append-to-body
  497. append-to-body
  498. @close="GLExcelMD"
  499. >
  500. <div>
  501. <el-select
  502. style="width:400px;"
  503. v-model="GLExcelFrom.name"
  504. placeholder="请选择"
  505. @change="changetherr()"
  506. >
  507. <el-option
  508. v-for="(item,key) in GLExcelData"
  509. :key="key"
  510. :label="item.name"
  511. :value="item.id"
  512. >
  513. </el-option>
  514. </el-select>
  515. <el-scrollbar style="margin-top:20px;height:50vh;">
  516. <el-input
  517. style="width:400px;"
  518. v-model.trim="GLExcelFrom.search"
  519. placeholder="请输入需要选择的内容"
  520. ></el-input>
  521. <el-tree
  522. :filter-node-method="filterNode222"
  523. ref="tree"
  524. class="filter-tree"
  525. style="margin-top:10px;"
  526. :props="GLExcelProps"
  527. :data="exceldata"
  528. node-key="id"
  529. accordion
  530. show-checkbox
  531. @check="checkchange"
  532. >
  533. </el-tree>
  534. </el-scrollbar>
  535. </div>
  536. <span
  537. slot="footer"
  538. class="dialog-footer"
  539. style="display: flex;justify-content: center;align-items: center;"
  540. >
  541. <el-button @click="GLExcelMD()">取 消</el-button>
  542. <el-button
  543. style="margin-left:30px;"
  544. type="primary"
  545. v-throttle='2000'
  546. @click="saveLinkTab()"
  547. >确 定</el-button>
  548. </span>
  549. </el-dialog>
  550. <el-dialog
  551. :title="dialogTitle"
  552. :visible.sync="dialogVisible"
  553. width="50%"
  554. append-to-body
  555. :close-on-click-modal="false"
  556. @closed="saveNodeLoading = false"
  557. >
  558. <el-form
  559. ref="nodeDetail"
  560. :model="nodeDetail"
  561. :rules="rules"
  562. label-width="110px"
  563. >
  564. <el-form-item
  565. label="节点名称"
  566. prop="deptName"
  567. >
  568. <el-input v-model="nodeDetail.deptName"></el-input>
  569. </el-form-item>
  570. <el-form-item label="上级节点">
  571. <el-input
  572. v-model="nodeDetail.parentName"
  573. ></el-input>
  574. </el-form-item>
  575. <el-form-item
  576. label="节点类型"
  577. prop="deptCategory"
  578. >
  579. <el-select
  580. v-model="nodeDetail.deptCategory"
  581. disabled
  582. placeholder="请选择"
  583. class="w-100p"
  584. >
  585. <el-option
  586. v-for="item in deptCategorylist"
  587. :key="item.id"
  588. :label="item.dictValue"
  589. :value="item.dictKey"
  590. ></el-option>
  591. </el-select>
  592. </el-form-item>
  593. <el-form-item label="划分编号">
  594. <el-input v-model="nodeDetail.partitionCode"></el-input>
  595. </el-form-item>
  596. <el-form-item label="唯一编码">
  597. <el-input v-model="nodeDetail.uniqueCode"></el-input>
  598. </el-form-item>
  599. <template v-if="nodeDetail.deptCategory == 6">
  600. <el-form-item label="是否有混凝土">
  601. <el-radio-group
  602. v-model="nodeDetail.isConcrete"
  603. size="small"
  604. >
  605. <el-radio
  606. :label="0"
  607. border
  608. >无</el-radio>
  609. <el-radio
  610. :label="1"
  611. border
  612. >有</el-radio>
  613. </el-radio-group>
  614. </el-form-item>
  615. <el-form-item label="是否试验节点">
  616. <el-radio-group
  617. v-model="nodeDetail.isExpernode"
  618. size="small"
  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. import {getStore,setStore} from '@/util/store'
  1303. export default {
  1304. data () {
  1305. var checkMajorDataType = (rule, value, callback) => {
  1306. //console.log(this.nodeDetail.deptCategory)
  1307. //console.log(this.nodeDetail.majorDataType)
  1308. if(this.nodeDetail.deptCategory == 6){
  1309. if(!this.nodeDetail.majorDataType){
  1310. callback(new Error('工序节点必须选择内业资料类型'));
  1311. }
  1312. }
  1313. callback();
  1314. };
  1315. return {
  1316. formDatass: [],
  1317. editElementFormTag: false,
  1318. jiedianId: '',
  1319. //#region
  1320. sortTag: false,
  1321. sortTag2: false,
  1322. sortArray: [],
  1323. //#endregion
  1324. //#region 关联清表
  1325. loading: false,
  1326. GLExcel: false,
  1327. GLExcelFrom: {
  1328. id: "",
  1329. name: '',
  1330. search: '',//搜素框舒服的值
  1331. ids: '',
  1332. excelId: '',
  1333. initTableName: '',
  1334. },
  1335. GLExcelData: [],//
  1336. GLExcelProps: {
  1337. label: 'name',
  1338. children: 'children',
  1339. disabled: 'hasChildren',
  1340. isLeaf: function (data) {
  1341. let tag = false
  1342. if (!data.hasChildren) {
  1343. tag = true
  1344. }
  1345. if (data.isExistForm == 1) {
  1346. tag = true
  1347. }
  1348. return tag
  1349. },
  1350. },
  1351. exceldata: [],//清表模板
  1352. //#endregion
  1353. //#region 调整表单
  1354. adjustmentExcel: '',
  1355. excelHtml: false,
  1356. //#endregion
  1357. //#region
  1358. id: '',
  1359. projectid: '',
  1360. filterText: '',
  1361. treeData: [],
  1362. treeLoad: false,
  1363. menuShow: false,
  1364. defaultProps: {
  1365. children: 'children',
  1366. label: 'title',
  1367. isLeaf: function (data) {
  1368. //console.log(data, !data.hasChildren, data.isExistForm);
  1369. let tag = false
  1370. if (!data.hasChildren) {
  1371. tag = true
  1372. }
  1373. if (data.isExistForm == 1) {
  1374. tag = true
  1375. }
  1376. if (data.deptCategory == 6) {
  1377. tag = true
  1378. }
  1379. return tag
  1380. // return !data.hasChildren || (data.isExistForm == 1);
  1381. },
  1382. },
  1383. leftType: 5,
  1384. curTreeData: {},
  1385. tableData: [],
  1386. nodeDetail: {},
  1387. formData: [],
  1388. editType: 1,
  1389. dialogVisible: false,
  1390. saveNodeLoading: false,
  1391. deptCategorylist: [],
  1392. majorDataTypeList: [],
  1393. rules: {
  1394. deptName: [
  1395. { required: true, message: '请输入节点名称', trigger: 'blur' },
  1396. ],
  1397. deptCategory: [
  1398. { required: true, message: '请选择节点类型', trigger: 'change' }
  1399. ],
  1400. majorDataType:[
  1401. { validator: checkMajorDataType, trigger: 'change' }
  1402. ]
  1403. },
  1404. eleVisible: false,
  1405. tableTypelist: [],
  1406. dataTypeList: [],
  1407. ownerTypeList: [],
  1408. eleForm: {
  1409. elementList: [],
  1410. },
  1411. eleRules: {
  1412. deptName: [
  1413. { required: true, message: '请输入表名称', trigger: 'blur' },
  1414. ],
  1415. tableType: [
  1416. { required: true, message: '请选择表类型', trigger: 'change' }
  1417. ],
  1418. tableOwner: [
  1419. { required: true, message: '请选择所属方', trigger: 'change' }
  1420. ],
  1421. },
  1422. importVisible: false,
  1423. tempList: [],
  1424. curEleTable: {},
  1425. editEleVisible: false,
  1426. editEleList: [],
  1427. eleReg: /(≥|≤|±|【】)?([^≥≤±【】]*)/,
  1428. editEleFormulaVisible: false,
  1429. formulaInput: '',
  1430. importTemplateVisible: false,
  1431. fileUrl: '',
  1432. upFile: null,
  1433. importLoading: false,
  1434. nodeInfoVisible: false,
  1435. nodeInfoTable: [],
  1436. namelist: [],
  1437. namelists: [],
  1438. infoNameVisible: false,
  1439. excelSortTag: false,
  1440. excelSortTag2: false,
  1441. tableSortList: [],
  1442. //#endregion
  1443. defaultExpandedKeys:[],
  1444. expandName:this.$route.fullPath,
  1445. };
  1446. },
  1447. computed: {
  1448. ...mapGetters(["userInfo"]),
  1449. dialogTitle: function () {
  1450. let text = '节点';
  1451. if (this.leftType == 1) {
  1452. text = '新增' + text;
  1453. } else if (this.leftType == 2) {
  1454. text = '编辑' + text;
  1455. }
  1456. return text;
  1457. },
  1458. },
  1459. created () {
  1460. this.init();
  1461. //console.log(this.userInfo)
  1462. },
  1463. methods: {
  1464. //#region
  1465. init () {
  1466. this.id = this.$route.query.wbsid;
  1467. this.projectid = this.$route.query.pid;
  1468. this.getDeptCategorylist();
  1469. this.getTableTypelist();
  1470. this.getDataTypelist();
  1471. this.getOwnerTypelist();
  1472. this.defaultExpandedKeys = getStore({name:this.expandName});
  1473. },
  1474. loadNode (node, resolve) {
  1475. let pid = 0;
  1476. if (node.level != 0) {
  1477. pid = node.data.id
  1478. }
  1479. getLazytree(this.id, pid, this.userInfo.tenant_id, this.projectid).then((res) => {
  1480. let arr = [];
  1481. if (Array.isArray(res.data.data)) {
  1482. arr = res.data.data;
  1483. }
  1484. return resolve(arr);
  1485. })
  1486. },
  1487. getNodeDetail (data, node) {
  1488. let parentName = '';
  1489. if (node.parent.data) {
  1490. parentName = node.parent.data.title;
  1491. }
  1492. this.curTreeData = data;
  1493. this.curTreeData.parentName = parentName;
  1494. getDetail(data.id, this.id, this.projectid).then((res) => {
  1495. res.data.data.parentName = parentName;
  1496. this.tableData = [res.data.data];
  1497. this.nodeDetail = Object.assign({}, res.data.data);
  1498. })
  1499. this.updateNodeTable();
  1500. },
  1501. saveNode () {
  1502. this.$refs['nodeDetail'].validate((valid) => {
  1503. if (valid) {
  1504. if (this.editType == 1) {
  1505. this.addNode();
  1506. } else if (this.editType == 2) {
  1507. this.updateNode();
  1508. }
  1509. } else {
  1510. console.log('error submit!!');
  1511. return false;
  1512. }
  1513. });
  1514. },
  1515. addNode () {
  1516. this.saveNodeLoading = true;
  1517. update(this.nodeDetail).then(() => {
  1518. this.updateTreeNewNode();
  1519. this.dialogVisible = false;
  1520. this.$message({
  1521. type: "success",
  1522. message: "新增成功!"
  1523. });
  1524. })
  1525. },
  1526. updateNode () {
  1527. update(this.nodeDetail).then(() => {
  1528. let node = this.tableData[0];
  1529. node.deptName = this.nodeDetail.deptName;
  1530. node.deptCategory = this.nodeDetail.deptCategory;
  1531. this.curTreeData.title = this.nodeDetail.deptName;
  1532. this.dialogVisible = false;
  1533. this.$message({
  1534. type: "success",
  1535. message: "修改成功!"
  1536. });
  1537. })
  1538. },
  1539. setLeftType (type, data, node) {
  1540. this.jiedianId = data.id
  1541. if (type == 4 || type == 5) {
  1542. this.leftType = type;
  1543. }
  1544. this.curTreeData = data;
  1545. this.$refs.tree.setCurrentKey(data.id);
  1546. if (type == 1 || type == 2) {
  1547. this.getMajorDataTypeList();
  1548. this.dialogVisible = true;
  1549. this.editType = type;
  1550. }
  1551. getDetail(data.id, this.id, this.projectid).then((res) => {
  1552. let parentName = '';
  1553. if (node.parent.data) {
  1554. parentName = node.parent.data.title;
  1555. }
  1556. res.data.data.parentName = parentName;
  1557. this.tableData = [res.data.data];
  1558. if (type == 1) {
  1559. this.nodeDetail = {
  1560. parentId: res.data.data.id,
  1561. parentName: parentName,
  1562. projectId: res.data.data.projectId
  1563. };
  1564. } else {
  1565. this.nodeDetail = Object.assign({}, res.data.data);
  1566. }
  1567. this.nodeDetail.type = 1;// '1'节点 '2'表单
  1568. this.nodeDetail.wbsId = this.id;
  1569. this.nodeDetail.tenantId = this.userInfo.tenant_id
  1570. })
  1571. if (this.leftType == 4) {
  1572. selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
  1573. if (res.data.data.length) {
  1574. this.formData = res.data.data;
  1575. } else {
  1576. this.formData = [];
  1577. }
  1578. })
  1579. }
  1580. //获取节点展开路径
  1581. this.getExpandedKeys(node);
  1582. },
  1583. showFormElement () {
  1584. if (!this.nodeDetail.id) {
  1585. this.$message({
  1586. type: "warning",
  1587. message: "请先选择在哪个节点下创建表"
  1588. });
  1589. return;
  1590. }
  1591. this.eleVisible = true;
  1592. },
  1593. addEleRow (list) {
  1594. list.push({});
  1595. },
  1596. delEleRow (index, list) {
  1597. list.splice(index, 1);
  1598. },
  1599. saveFormAndElementHandle () {
  1600. this.$refs['eleDialog'].validate((valid) => {
  1601. if (valid) {
  1602. this.eleForm.wbsId = this.id;
  1603. this.eleForm.tenantId = this.userInfo.tenant_id;
  1604. this.eleForm.deptCategory = -1;
  1605. this.eleForm.type = 2;// '1'节点 '2'表单
  1606. this.eleForm.parentId = this.nodeDetail.id;
  1607. this.eleForm.elementList.forEach((element) => {
  1608. element.eAllowDeviation = (element.allow ? element.allow : '') + (element.deviation ? element.deviation : '');
  1609. if (element.eType == 4) {
  1610. element.eLength = 0;
  1611. }
  1612. })
  1613. saveFormAndElement(this.eleForm).then(() => {
  1614. //console.log(res)
  1615. this.updateTreeNewNode();
  1616. this.updateNodeTable();
  1617. this.eleVisible = false;
  1618. this.$message({
  1619. type: "success",
  1620. message: "新增成功!"
  1621. });
  1622. })
  1623. } else {
  1624. console.log('error submit!!');
  1625. return false;
  1626. }
  1627. });
  1628. },
  1629. updateTreeNewNode () {
  1630. getLazytree(this.id, this.nodeDetail.parentId, this.userInfo.tenant_id, this.projectid).then((res) => {
  1631. this.$refs.tree.updateKeyChildren(this.nodeDetail.parentId, res.data.data)
  1632. })
  1633. },
  1634. updateNodeTable () {
  1635. selectByNodeTable(this.curTreeData.id, this.projectid, this.id).then((res) => {
  1636. if (res.data.data.length) {
  1637. this.formData = res.data.data;
  1638. } else {
  1639. this.formData = [];
  1640. }
  1641. })
  1642. },
  1643. deleNode (data, node) {
  1644. this.$confirm('此操作将删除节点【' + data.title + '】, 是否继续?', '提示', {
  1645. confirmButtonText: '确定',
  1646. cancelButtonText: '取消',
  1647. type: 'warning'
  1648. }).then(() => {
  1649. removePrivateTreeNode(data.primaryKeyId).then(() => {
  1650. this.$refs.tree.remove(node);
  1651. this.$message({
  1652. type: "success",
  1653. message: "删除成功!"
  1654. });
  1655. })
  1656. }).catch(() => {
  1657. });
  1658. },
  1659. importHandle () {
  1660. },
  1661. handleEdit (index, row) {
  1662. this.curEleTable = row;
  1663. selectFormElements(this.curEleTable.id).then((res) => {
  1664. res.data.data.forEach((element) => {
  1665. this.eleReg.exec(element.eAllowDeviation);
  1666. // console.log(RegExp.$1)
  1667. // console.log(RegExp.$2)
  1668. element.allow = RegExp.$1 ? RegExp.$1 : '';
  1669. element.deviation = RegExp.$2 ? RegExp.$2 : '';
  1670. })
  1671. this.editEleList = res.data.data;
  1672. })
  1673. this.editEleVisible = true;
  1674. },
  1675. handleDelete (index, row) {
  1676. this.$confirm('是否删除 ' + row.tableName + ' ?', '删除元素表', {
  1677. distinguishCancelAndClose: true,
  1678. confirmButtonText: '删除',
  1679. cancelButtonText: '取消'
  1680. }).then(() => {
  1681. removeTableById(row.id, this.projectid, this.id).then(() => {
  1682. this.formData.splice(index, 1);
  1683. this.$message({
  1684. type: "success",
  1685. message: "删除成功!"
  1686. });
  1687. })
  1688. })
  1689. },
  1690. async hideMD (row) {//隐藏按钮
  1691. const code = await this.updateStatus(row.pkeyId, row.status)
  1692. if (code == 200) {
  1693. if (row.status == 0) {
  1694. row.status = 1
  1695. } else {
  1696. row.status = 0
  1697. }
  1698. }
  1699. },
  1700. async updateStatus (pKeyId, status) {//隐藏功能激活
  1701. const { data: res } = await updateStatus({ pKeyId })
  1702. if (res.code == 200) {
  1703. this.$message({
  1704. type: 'success',
  1705. message: status == 1 ? '隐藏成功' : '激活成功'
  1706. })
  1707. }
  1708. return res.code
  1709. },
  1710. handleEditFormula (index, row) {
  1711. this.curEleTable = row;
  1712. selectFormElements(this.curEleTable.id).then((res) => {
  1713. this.editEleList = res.data.data;
  1714. })
  1715. this.editEleFormulaVisible = true;
  1716. },
  1717. saveNewEle (row) {
  1718. row.eAllowDeviation = (row.allow ? row.allow : '') + (row.deviation ? row.deviation : '');
  1719. row.fId = this.curEleTable.id;
  1720. row.initTableName = this.curEleTable.initTableName;
  1721. if (row.eType == 4) {
  1722. row.eLength = 0;
  1723. }
  1724. saveElement(row).then((res) => {
  1725. if (res.data.data) {
  1726. this.$set(row, 'id', res.data.data.id);
  1727. this.$set(row, 'ekey', res.data.data.ekey);
  1728. this.$message({
  1729. type: "success",
  1730. message: "保存成功!"
  1731. });
  1732. }
  1733. })
  1734. },
  1735. delEleRowHandle (index, list) {
  1736. let row = list[index];
  1737. if (row.id) {
  1738. //有id需要请求删除
  1739. this.$confirm('是否确认删除?', '删除元素', {
  1740. distinguishCancelAndClose: true,
  1741. confirmButtonText: '删除',
  1742. cancelButtonText: '取消'
  1743. }).then(() => {
  1744. removeElement(row.id, this.curEleTable.initTableName, row.ekey).then(() => {
  1745. list.splice(index, 1);
  1746. })
  1747. })
  1748. } else {
  1749. list.splice(index, 1);
  1750. }
  1751. },
  1752. saveEles () {
  1753. for (let i = 0; i < this.editEleList.length; i++) {
  1754. if (!this.editEleList[i].id) {
  1755. this.$message({
  1756. type: "warning",
  1757. message: "请先将新增的元素点击保存"
  1758. });
  1759. return;
  1760. }
  1761. }
  1762. if (this.editEleList.length > 0) {
  1763. this.editEleList.forEach((element) => {
  1764. element.eAllowDeviation = (element.allow ? element.allow : '') + (element.deviation ? element.deviation : '');
  1765. if (element.eType == 4) {
  1766. element.eLength = 0;
  1767. }
  1768. })
  1769. updateBatchElements(this.editEleList, this.curEleTable.initTableName).then(() => {
  1770. this.editEleVisible = false;
  1771. this.updateNodeTable();
  1772. this.$message({
  1773. type: "success",
  1774. message: "保存成功!"
  1775. });
  1776. })
  1777. } else {
  1778. this.editEleVisible = false;
  1779. this.updateNodeTable();
  1780. this.$message({
  1781. type: "success",
  1782. message: "保存成功!"
  1783. });
  1784. }
  1785. },
  1786. filterChange () {
  1787. //console.log(this.$refs)
  1788. //debugger
  1789. if (this.treeData.length > 0) {
  1790. this.$refs.treeall.filter(this.filterText);
  1791. return;
  1792. }
  1793. this.treeLoad = true;
  1794. getAlltree(this.projectid, this.id).then((res) => {
  1795. this.treeLoad = false;
  1796. this.treeData = res.data.data;
  1797. this.$nextTick(() => {
  1798. this.$refs.treeall.filter(this.filterText);
  1799. })
  1800. })
  1801. },
  1802. importTemplate (data) {
  1803. this.importTemplateVisible = true;
  1804. this.curTreeData = data;
  1805. if (!this.fileUrl) {
  1806. getAttchFromOriginalName(1, 20, {
  1807. originalName: 'WBS划分模板.xls'
  1808. }).then((res) => {
  1809. if (res.data.data.records.length) {
  1810. this.fileUrl = res.data.data.records[0].link;
  1811. } else {
  1812. this.fileUrl = '';
  1813. }
  1814. })
  1815. }
  1816. },
  1817. importTemplateHandle () {
  1818. if (!this.upFile) {
  1819. this.$message({
  1820. type: "warning",
  1821. message: "请先选择文件再进行导入"
  1822. });
  1823. return;
  1824. }
  1825. let forms = new FormData();
  1826. forms.append('excelFile', this.upFile);
  1827. let wbsTreeFu = {
  1828. wbsId: this.id,
  1829. parentId: this.curTreeData.id,
  1830. // ancestors:'0,'+this.curTreeData.id,
  1831. }
  1832. let json = JSON.stringify(wbsTreeFu);
  1833. let blob = new Blob([json], { type: 'application/json' })
  1834. forms.append('wbsTreeFu', blob);
  1835. this.importLoading = true;
  1836. importWbsTree(forms).then(() => {
  1837. //this.$router.go(0)
  1838. let node = this.$refs.tree.getNode(this.curTreeData.id);
  1839. node.isLeaf = false;
  1840. this.importTemplateVisible = false;
  1841. this.upFile = null;
  1842. }).finally(() => {
  1843. this.importLoading = false;
  1844. })
  1845. },
  1846. handleDownload () {
  1847. if (this.fileUrl) {
  1848. window.open(this.fileUrl);
  1849. } else {
  1850. this.$message({
  1851. type: "warning",
  1852. message: "请先在附件管理上传【WBS划分模板.xls】文件"
  1853. });
  1854. }
  1855. },
  1856. fileClick () {
  1857. this.$refs.file.click();
  1858. },
  1859. fileChange (e) {
  1860. const file = e.target.files[0]
  1861. if (!file) {
  1862. // 如果用户没有选择图片,只是点了文件上传这个按钮
  1863. return
  1864. }
  1865. //console.log(file)
  1866. this.upFile = file;
  1867. },
  1868. editNodeInfo (index, row) {
  1869. this.$set(row, 'isEdit', true);
  1870. },
  1871. saveNodeInfoHandle (index, row) {
  1872. row.isEdit = false;
  1873. },
  1874. downloadTmp () {
  1875. getTemplate().then((res) => {
  1876. //console.log(res)
  1877. let blob = new Blob([res.data], {
  1878. type: 'application/vnd.ms-excel'
  1879. });
  1880. //console.log(blob)
  1881. let filename = Date.parse(new Date()) + '.xls';
  1882. if (window.navigator.msSaveOrOpenBlob) {
  1883. // 兼容IE10
  1884. window.navigator.msSaveBlob(blob, filename);
  1885. } else {
  1886. // 兼容chrome/firefox
  1887. let aTag = document.createElement('a');
  1888. aTag.download = Date.parse(new Date()) + '.xls';
  1889. aTag.href = window.URL.createObjectURL(blob);
  1890. aTag.click();
  1891. URL.revokeObjectURL(aTag.href);
  1892. }
  1893. })
  1894. },
  1895. fileClick2 () {
  1896. this.$refs.file2.click();
  1897. },
  1898. tmpImport (e) {
  1899. const file = e.target.files[0];
  1900. const formData = new FormData();
  1901. formData.append('file', file);
  1902. //console.log(file.name)
  1903. importWbsElement(formData).then((res) => {
  1904. res.data.data.forEach((element) => {
  1905. element.eName = element.elementName;
  1906. element.eLength = element.elementLength;
  1907. element.eType = Number(element.elementType);
  1908. element.eAllowDeviation = element.elementAllowDeviation;
  1909. element.eInspectionMethod = element.elementInspectionMethod;
  1910. this.eleReg.exec(element.eAllowDeviation);
  1911. // console.log(RegExp.$1)
  1912. // console.log(RegExp.$2)
  1913. element.allow = RegExp.$1 ? RegExp.$1 : '';
  1914. element.deviation = RegExp.$2 ? RegExp.$2 : '';
  1915. })
  1916. this.eleForm.elementList = res.data.data;
  1917. this.importVisible = false;
  1918. }).finally(() => {
  1919. e.target.value = '';
  1920. })
  1921. },
  1922. visiblechange (value, data) {
  1923. this.$set(data, 'moreShow', value)
  1924. },
  1925. bianhua2 () {
  1926. this.excelSortTag2 = false
  1927. this.$nextTick(() => {
  1928. this.excelSortTag2 = true
  1929. })
  1930. },
  1931. //私有树的元素表修改排序
  1932. privateTableSort () {
  1933. if (!this.curTreeData.id) {
  1934. this.$message({
  1935. type: "warning",
  1936. message: "请先选择需要排序的节点"
  1937. })
  1938. return;
  1939. }
  1940. this.tableSortList = this.formData.map((form, index) => {
  1941. return {
  1942. sort: index + 1,
  1943. deptName: form.tableName,
  1944. pkeyId: form.pkeyId,
  1945. }
  1946. })
  1947. this.excelSortTag = true
  1948. this.excelSortTag2 = true
  1949. },
  1950. editPrivateSort () {
  1951. wbsTreePrivateTableSort(this.tableSortList).then(() => {
  1952. this.updateNodeTable();
  1953. this.$message({
  1954. type: "success",
  1955. message: "排序成功!"
  1956. });
  1957. this.excelSortTag = false;
  1958. this.excelSortTag2 = false;
  1959. })
  1960. },
  1961. //解析元素数据类型
  1962. eTypeFormatter (row) {
  1963. let text = '';
  1964. for (let i = 0; i < this.dataTypeList.length; i++) {
  1965. if (this.dataTypeList[i].dictKey == row.eType) {
  1966. text = this.dataTypeList[i].dictValue;
  1967. break;
  1968. }
  1969. }
  1970. return text;
  1971. },
  1972. //跳转到公式配置页面
  1973. toFormulaEdit (row) {
  1974. this.$router.push({
  1975. path: '/formula/edit',
  1976. query: {
  1977. wbsid: this.id,
  1978. eleid: row.id,
  1979. nodeid:this.curTreeData.id,
  1980. projectid:this.projectid
  1981. }
  1982. });
  1983. },
  1984. getDeptCategorylist () {
  1985. if (this.deptCategorylist.length > 1) {
  1986. return;
  1987. }
  1988. getDictionary({
  1989. code: 'wbs_node_type'
  1990. }).then((res) => {
  1991. res.data.data.forEach(element => {
  1992. element.dictKey = Number(element.dictKey)
  1993. });
  1994. this.deptCategorylist = res.data.data;
  1995. })
  1996. },
  1997. getMajorDataTypeList () {
  1998. if (this.majorDataTypeList.length > 1) {
  1999. return;
  2000. }
  2001. getDictionary({
  2002. code: 'major_data_type'
  2003. }).then((res) => {
  2004. res.data.data.forEach(element => {
  2005. element.dictKey = Number(element.dictKey)
  2006. });
  2007. this.majorDataTypeList = res.data.data;
  2008. })
  2009. },
  2010. getTableTypelist () {
  2011. if (this.tableTypelist.length > 1) {
  2012. return;
  2013. }
  2014. getDictionary({
  2015. code: 'table_type'
  2016. }).then((res) => {
  2017. res.data.data.forEach(element => {
  2018. element.dictKey = Number(element.dictKey)
  2019. });
  2020. this.tableTypelist = res.data.data;
  2021. })
  2022. },
  2023. getDataTypelist () {
  2024. if (this.dataTypeList.length > 1) {
  2025. return;
  2026. }
  2027. getDictionary({
  2028. code: 'data_type'
  2029. }).then((res) => {
  2030. res.data.data.forEach(element => {
  2031. element.dictKey = Number(element.dictKey)
  2032. });
  2033. this.dataTypeList = res.data.data;
  2034. })
  2035. },
  2036. getOwnerTypelist () {
  2037. if (this.ownerTypeList.length > 1) {
  2038. return;
  2039. }
  2040. getDictionary({
  2041. code: 'owner_type'
  2042. }).then((res) => {
  2043. res.data.data.forEach(element => {
  2044. element.dictKey = Number(element.dictKey)
  2045. });
  2046. this.ownerTypeList = res.data.data;
  2047. })
  2048. },
  2049. formatCat (row, column, cellValue) {
  2050. for (let i = 0; i < this.deptCategorylist.length; i++) {
  2051. if (this.deptCategorylist[i].dictKey == cellValue) {
  2052. return this.deptCategorylist[i].dictValue
  2053. }
  2054. }
  2055. return cellValue;
  2056. //console.log(cellValue)
  2057. },
  2058. formatTableType (row, column, cellValue) {
  2059. for (let i = 0; i < this.tableTypelist.length; i++) {
  2060. if (this.tableTypelist[i].dictKey == cellValue) {
  2061. return this.tableTypelist[i].dictValue
  2062. }
  2063. }
  2064. return cellValue;
  2065. //console.log(cellValue)
  2066. },
  2067. formatOwner (row, column, cellValue) {
  2068. for (let i = 0; i < this.ownerTypeList.length; i++) {
  2069. if (this.ownerTypeList[i].dictKey == cellValue) {
  2070. return this.ownerTypeList[i].dictValue
  2071. }
  2072. }
  2073. return cellValue;
  2074. //console.log(cellValue)
  2075. },
  2076. formatdataType (row, column, cellValue) {
  2077. for (let i = 0; i < this.dataTypeList.length; i++) {
  2078. if (this.dataTypeList[i].dictKey == cellValue) {
  2079. return this.dataTypeList[i].dictValue
  2080. }
  2081. }
  2082. return cellValue;
  2083. },
  2084. filterNode (value, data) {
  2085. if (!value) return true;
  2086. return data.title.indexOf(value) !== -1;
  2087. },
  2088. //#endregion
  2089. //#region wbs私有树排序
  2090. async sortpai (data) {
  2091. console.log(data);
  2092. await this.findWbsTreePrivateSameLevel({
  2093. parentId: data.parentId,
  2094. projectId: this.projectid,
  2095. wbsId: this.id
  2096. })
  2097. this.sortTag = true
  2098. this.sortTag2 = true
  2099. },
  2100. editSort () {
  2101. this.wbsTreePrivateSort()
  2102. },
  2103. bianhua () {
  2104. this.sortTag2 = false
  2105. this.$nextTick(() => {
  2106. this.sortTag2 = true
  2107. })
  2108. },
  2109. async wbsTreePrivateSort () {//wbs私有树节点手动排序
  2110. const { data: res } = await wbsTreePrivateSort(this.sort)
  2111. console.log(res);
  2112. if (res.code == 200) {
  2113. this.sortTag = false
  2114. this.sortTag2 = false
  2115. this.getLazytreessss()
  2116. }
  2117. },
  2118. async findWbsTreePrivateSameLevel (da) {//wbs私有树同级节点接口
  2119. const { data: res } = await findWbsTreePrivateSameLevel(da)
  2120. console.log(res);
  2121. if (res.code == 200) {
  2122. this.sort = res.data
  2123. }
  2124. },
  2125. async getLazytreessss () {
  2126. const { data: res } = await getLazytree(this.id, 0, this.userInfo.tenant_id, this.projectid)
  2127. console.log(res);
  2128. if (res.code == 200) {
  2129. this.treeData = res.data
  2130. }
  2131. },
  2132. //#endregion
  2133. //#region 关联清表
  2134. async getList (da) {//获取清表模板信息
  2135. const { data: res } = await getList(da)
  2136. console.log(res);
  2137. if (res.code === 200 && res.msg === '操作成功') {
  2138. this.GLExcelData = res.data.records
  2139. }
  2140. },
  2141. async tabLazytreeAll () {//清表树信息
  2142. const { data: res } = await tabLazytreeAll({
  2143. modeId: this.GLExcelFrom.name,
  2144. name: this.GLExcelFrom.search,
  2145. })
  2146. console.log(res);
  2147. if (res.code === 200 && res.msg === '操作成功') {
  2148. this.exceldata = res.data
  2149. }
  2150. },
  2151. Associationlist (scope) {//关联清表点击事件
  2152. console.log(scope.row);
  2153. this.GLExcel = true
  2154. this.getList({
  2155. current: 1,
  2156. size: 100000,
  2157. parentId: 0,
  2158. })
  2159. this.GLExcelFrom.name = scope.row.modeId
  2160. setTimeout(() => {
  2161. this.$refs.tree.setCheckedKeys([scope.row.excelId])
  2162. }, 2000)
  2163. this.GLExcelFrom.id = scope.row.pkeyId
  2164. this.GLExcelFrom.excelId = scope.row.excelId
  2165. this.GLExcelFrom.ids = scope.row.id
  2166. this.GLExcelFrom.initTableName = scope.row.initTableName
  2167. },
  2168. changetherr () {//清表类型选择框change事件
  2169. if (this.GLExcelFrom.name != "") {
  2170. this.GLExcelFrom.search = ''
  2171. this.tabLazytreeAll()
  2172. }
  2173. },
  2174. GLExcelMD () {//弹框关闭事件
  2175. this.GLExcelFrom.name = ""
  2176. this.GLExcelFrom.search = ''
  2177. this.GLExcelFrom.id = ''
  2178. this.exceldata = []
  2179. this.$refs.tree.setCheckedKeys([])
  2180. this.GLExcel = false
  2181. },
  2182. checkchange (data) {//节点选中回调
  2183. if (this.$refs.tree.getCheckedNodes().length === 0) {
  2184. this.$refs.tree.setCheckedKeys([])
  2185. } else if (this.$refs.tree.getCheckedNodes().length >= 1) {
  2186. this.$refs.tree.setCheckedKeys([data.id])
  2187. }
  2188. },
  2189. async saveLinkTab () {//保存按钮
  2190. let checkNodes = this.$refs.tree.getCheckedNodes();
  2191. if (checkNodes.length > 0) {
  2192. let node = checkNodes[checkNodes.length - 1];
  2193. if(node.fileType != 3){
  2194. this.$message({
  2195. type: "warning",
  2196. message: "请先上传Excel表"
  2197. });
  2198. return;
  2199. }
  2200. const { data: res } = await saveLinkTab({
  2201. exceTabId: node.id,
  2202. tabId: this.GLExcelFrom.id,
  2203. })
  2204. console.log(res);
  2205. if (res.code === 200) {
  2206. this.$message({
  2207. type: 'success',
  2208. message: '关联清表成功',
  2209. })
  2210. this.GLExcel = false
  2211. this.rightClick(this.GLExcelFrom.id, this.GLExcelFrom.excelId, this.GLExcelFrom.ids, this.GLExcelFrom.initTableName,)
  2212. }
  2213. } else {
  2214. this.$message({
  2215. type: 'warning',
  2216. message: '请先设置清表',
  2217. })
  2218. }
  2219. },
  2220. filterNode222 (value, data) {
  2221. if (!value) return true;
  2222. return data.name.indexOf(value) !== -1;
  2223. },
  2224. //#endregion
  2225. //#region 节点参数
  2226. nodeInfo (data) {//节点参数按钮
  2227. this.keymap()
  2228. this.jiedianId = data.primaryKeyId
  2229. this.parameters(data.primaryKeyId)
  2230. this.nodeInfoVisible = true;
  2231. },
  2232. addNodeInfoTable () {//添加节点参数数据
  2233. this.nodeInfoTable.unshift({ k: '', v: '', remark: '', wbsId: this.jiedianId })
  2234. },
  2235. delNodeInfo (key) {//设置参数名称中的删除按钮
  2236. this.namelists.splice(key, 1)
  2237. },
  2238. delNodeInfoss (key) {//节点参数
  2239. this.nodeInfoTable.splice(key, 1)
  2240. },
  2241. setNodeParameters () {//打开设置节点参数弹框按钮
  2242. this.infoNameVisible = true
  2243. this.namelists = [...this.namelist]
  2244. },
  2245. async setParameterName () {//设置参数名称中添加节点参数按钮
  2246. // wbsId: this.jiedianId
  2247. this.namelists.unshift({ name: '', remark: '', k: '', type: 0, })
  2248. },
  2249. async nodeInfoSave () {//节点参数弹框保存按钮
  2250. if (this.nodeInfoTable) {
  2251. let tag = true
  2252. this.nodeInfoTable.forEach(val => {
  2253. if (!val.k | !val.v) {
  2254. return tag = false
  2255. }
  2256. })
  2257. if (tag) {
  2258. await this.saveOrUpdateBatch(this.nodeInfoTable)
  2259. this.nodeInfoVisible = false
  2260. this.$message({
  2261. type: "success",
  2262. message: "设置参数节点成功!"
  2263. })
  2264. } else {
  2265. this.$message({
  2266. type: "error",
  2267. message: "请填写所有的参数名称和参数值!"
  2268. })
  2269. }
  2270. } else {
  2271. this.$message({
  2272. type: "error",
  2273. message: "请先设置参数节点!"
  2274. })
  2275. }
  2276. },
  2277. async addParameterName () {//设置参数名称中的保存按钮
  2278. if (this.namelists.length) {
  2279. let tag = true
  2280. this.namelists.forEach(val => {
  2281. if (!val.name || !val.k) {
  2282. return tag = false
  2283. }
  2284. })
  2285. if (tag) {
  2286. await this.saveOrUpdateBatch(this.namelists) //保存设置参数
  2287. this.infoNameVisible = false
  2288. this.keymap()
  2289. } else {
  2290. this.$message({
  2291. type: "error",
  2292. message: "请填写所有的参数名称和参数值KEY!"
  2293. })
  2294. }
  2295. } else {
  2296. this.$message({
  2297. type: "warning",
  2298. message: "请先添加参数"
  2299. })
  2300. }
  2301. },
  2302. closeParameter () {//设置参数名称,关闭按钮
  2303. this.namelists = []
  2304. this.infoNameVisible = false
  2305. },
  2306. async parameters (wbsId) {//获取接待你参数列表
  2307. const { data: res } = await parameters({ wbsId })
  2308. console.log(res);
  2309. if (res.code == 200) {
  2310. this.nodeInfoTable = res.data
  2311. }
  2312. },
  2313. async saveOrUpdateBatch (da) {//保存
  2314. const { data: res } = await saveOrUpdateBatch(da)
  2315. console.log(res);
  2316. },
  2317. async keymap () {//节点参数枚举
  2318. const { data: res } = await keymap()
  2319. console.log(res);
  2320. if (res.code == 200) {
  2321. this.namelist = res.data
  2322. }
  2323. },
  2324. //#endregion
  2325. //#region 调整表单
  2326. adjustExcel (pkeyId, excelId) {//调整表单
  2327. this.GLExcelFrom.id = pkeyId
  2328. this.getExcelHtml(pkeyId)
  2329. },
  2330. async getExcelHtml (pkeyId) {
  2331. const { data: res } = await getExcelHtml({ pkeyId })
  2332. console.log(res);
  2333. if (res.code === 200) {
  2334. localStorage.setItem('excelHtml', res.data)
  2335. this.adjustmentExcel = res.data
  2336. this.excelHtml = true
  2337. }
  2338. },
  2339. removeExcel () {
  2340. this.excelHtml = false
  2341. },
  2342. //#endregion
  2343. //#region 编辑元素
  2344. async rightClick (pkeyId, excelId, id, initTableName) {
  2345. await this.getExcelHtml2(pkeyId)
  2346. this.$router.push({
  2347. path: '/project/editElement',
  2348. query: {
  2349. pkeyId: pkeyId,
  2350. excelId: excelId,
  2351. id: id,
  2352. initTableName,
  2353. pid: this.$route.query.pid,
  2354. wbsid: this.$route.query.wbsid,
  2355. nodeid:this.curTreeData.id,
  2356. }
  2357. })
  2358. },
  2359. async getExcelHtml2 (pkeyId) {
  2360. const { data: res } = await getExcelHtml({ pkeyId })
  2361. console.log(res);
  2362. if (res.code === 200) {
  2363. localStorage.setItem('editElement', res.data)
  2364. }
  2365. },
  2366. //#endregion
  2367. //#region 元素表单信息
  2368. editEditElementForm () {//标记元素
  2369. if (this.formData.length) {
  2370. let da = []
  2371. this.formDatass = [...this.formData]
  2372. this.formDatass.forEach(val => {
  2373. da.push({
  2374. tableType: val.tableType - 0,
  2375. tableOwner: val.tableOwner - 0,
  2376. pkeyId: val.pkeyId,
  2377. tableName: val.tableName,
  2378. })
  2379. })
  2380. this.formDatass = da
  2381. this.editElementFormTag = true
  2382. }
  2383. },
  2384. editeditElementFormMF () {//保存按钮
  2385. let da = []
  2386. let tag = true
  2387. this.formDatass.forEach(val => {
  2388. if (!val.tableName || !val.tableType || !val.tableOwner) {
  2389. tag = false
  2390. return
  2391. } else {
  2392. da.push({
  2393. pkeyId: val.pkeyId,
  2394. deptName: val.tableName,
  2395. tableType: val.tableType,
  2396. tableOwner: val.tableOwner,
  2397. })
  2398. }
  2399. })
  2400. if (tag) {
  2401. this.updateBatchNodeTableInfo2(da)
  2402. } else {
  2403. this.$message({
  2404. type: 'success',
  2405. message: '请填写完整元素表单的所有信息!',
  2406. })
  2407. }
  2408. },
  2409. async updateBatchNodeTableInfo2 (da) {//共有编辑元素
  2410. const { data: res } = await updateBatchNodeTableInfo2(da)
  2411. console.log(res);
  2412. if (res.code == 200) {
  2413. this.editElementFormTag = false
  2414. this.updateNodeTable()
  2415. }
  2416. },
  2417. //#endregion
  2418. //获取节点展开路径
  2419. getExpandedKeys(node){
  2420. //console.log(node)
  2421. let expandedKeys = [];
  2422. while(node.parent){
  2423. expandedKeys.push(node.data.id);
  2424. node = node.parent;
  2425. }
  2426. setStore({
  2427. name:this.expandName,
  2428. content:expandedKeys,
  2429. type:true//sessionStorage
  2430. })
  2431. //console.log(expandedKeys)
  2432. }
  2433. },
  2434. watch: {
  2435. 'GLExcelFrom.search' (val) {
  2436. console.log(val);
  2437. if (this.exceldata) {
  2438. this.$refs.tree.filter(val);
  2439. }
  2440. }
  2441. },
  2442. components: {
  2443. dynamicExcel,
  2444. ManualSorting,
  2445. },
  2446. };
  2447. </script>
  2448. <style scoped lang="scss">
  2449. .font-s-12 /deep/ .iconfont {
  2450. font-size: 12px;
  2451. }
  2452. .el-popper[x-placement^="bottom"] {
  2453. margin-top: -6px;
  2454. }
  2455. .right-btn {
  2456. position: absolute;
  2457. right: 20px;
  2458. top: 10px;
  2459. font-size: 20px;
  2460. }
  2461. .custom-tree-node {
  2462. .normal-black {
  2463. display: none;
  2464. }
  2465. &:hover {
  2466. .normal-black {
  2467. display: block;
  2468. }
  2469. }
  2470. &.show .normal-black {
  2471. display: block;
  2472. }
  2473. }
  2474. .excelBox {
  2475. /deep/.el-dialog__body {
  2476. padding: 20px;
  2477. }
  2478. }
  2479. //调整表单样式
  2480. .excelHtml {
  2481. position: absolute;
  2482. z-index: 999999;
  2483. top: 50px;
  2484. left: 0px;
  2485. width: 100%;
  2486. height: 100%;
  2487. }
  2488. .jiedian {
  2489. /deep/.el-dialog__body {
  2490. padding: 10px 20px !important;
  2491. }
  2492. }
  2493. .filter-tree {
  2494. min-width: 100%;
  2495. display: inline-block;
  2496. }
  2497. </style>