tree.vue 75 KB

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