edit.vue 102 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442
  1. <template>
  2. <basic-container>
  3. <el-row class="titlerow">
  4. <el-col style="margin-bottom: 0px; margin-top: 8px">
  5. <div style="position: relative">
  6. <!-- <el-button type="primary" size="medium" icon="el-icon-plus" class="mg-b-10" @click="addNodeHandle">新增节点</el-button>
  7. <el-button type="primary" size="medium" icon="el-icon-edit-outline" class="mg-b-10" @click="editNodeHandle">编辑当前节点</el-button>
  8. <el-button type="primary" size="medium" icon="el-icon-document-copy" class="mg-b-10" @click="copyNodeHandle">复制当前节点</el-button>
  9. <el-button type="warning" size="medium" icon="el-icon-delete" class="mg-b-10" @click="delNodeHandle">删除当前节点</el-button> -->
  10. <el-button
  11. type="primary"
  12. size="medium"
  13. icon="el-icon-upload"
  14. v-show="curTreeNode && curTreeNode.level == 2"
  15. class="mg-b-10"
  16. @click="importTemplate(curTreeData, curTreeNode)"
  17. >导入划分</el-button
  18. >
  19. <el-button
  20. class="mg-b-10"
  21. size="medium"
  22. icon="el-icon-s-grid"
  23. @click="eleFormulaHandle"
  24. v-if="leftType == 5"
  25. >元素公式设置</el-button
  26. >
  27. <el-button
  28. class="mg-b-10"
  29. size="medium"
  30. icon="el-icon-s-grid"
  31. @click="eleHandle"
  32. v-else
  33. >元素设置</el-button
  34. >
  35. <el-button
  36. class="mg-b-10"
  37. size="medium"
  38. icon="el-icon-help"
  39. @click="nodeInfoHandle"
  40. >节点参数设置</el-button
  41. >
  42. </div>
  43. </el-col>
  44. </el-row>
  45. <el-row :gutter="20" class="h-100p">
  46. <el-col :span="10" style="height: 85%">
  47. <div class="h-100p flex flex-d-c">
  48. <p>工程节点信息</p>
  49. <div
  50. class="flex"
  51. style="align-items: center; justify-content: space-between"
  52. >
  53. <el-input
  54. placeholder="输入关键字进行搜索"
  55. v-model="filterText"
  56. clearable
  57. style="width: 70%; margin-right: 15px"
  58. @clear="clearSearch"
  59. ></el-input>
  60. <el-switch
  61. v-model="searchType"
  62. active-value="1"
  63. inactive-value="2"
  64. inline-prompt
  65. active-text="按节点"
  66. inactive-text="按表名"
  67. />
  68. <el-button type="primary" @click="searchTreeClick">搜索</el-button>
  69. </div>
  70. <div class="flex1 ov-hidden" v-loading="treeLoad">
  71. <el-scrollbar class="h-100p">
  72. <div>
  73. <el-tree
  74. v-show="!isSearch"
  75. class="filter-tree"
  76. lazy
  77. :load="loadNode"
  78. @node-click="getNodeDetail"
  79. :props="defaultProps"
  80. :expand-on-click-node="false"
  81. highlight-current
  82. node-key="id"
  83. ref="tree"
  84. :default-expanded-keys="defaultExpandedKeys"
  85. :data="treeData"
  86. >
  87. <span
  88. class="custom-tree-node"
  89. :class="data.moreShow ? 'show' : ''"
  90. slot-scope="{ node, data }"
  91. @mouseleave="mouseout(data)"
  92. >
  93. <div class="pd-r-20">
  94. {{ node.label }}
  95. <div class="normal-black">
  96. <!-- <el-link :underline="false">
  97. <i class="el-icon-sort" @click="paixuMD(data)" v-if="node.level != 1" title="调整排序"></i>
  98. </el-link> -->
  99. <div>
  100. <el-link :underline="false">
  101. <i
  102. class="el-icon-menu"
  103. @click.stop="showMenu($event, data, node)"
  104. ></i>
  105. </el-link>
  106. <!-- 因右键自定义菜单事件需要获取当前点击的位置,所以此处绑定动态样式来控制菜单实时跟踪鼠标右键点击位置 -->
  107. <ul
  108. v-show="menuvisible"
  109. :style="{
  110. left: menuleft + 'px',
  111. top: menutop + 'px',
  112. }"
  113. class="contextmenu"
  114. >
  115. <li
  116. v-for="item in menusData"
  117. :key="item"
  118. @click="menuClick($event, item, data)"
  119. v-if="node.level !== 1"
  120. >
  121. <i :class="item.icon"></i>{{ item.label }}
  122. </li>
  123. <li
  124. v-for="item in menusData1"
  125. :key="item"
  126. @click="menuClick($event, item, data)"
  127. v-if="node.level === 1"
  128. >
  129. <i :class="item.icon"></i>{{ item.label }}
  130. </li>
  131. </ul>
  132. </div>
  133. </div>
  134. </div>
  135. </span>
  136. </el-tree>
  137. <el-tree
  138. v-show="isSearch"
  139. :data="searchTreeData"
  140. @node-click="getNodeDetail"
  141. :props="defaultProps"
  142. :expand-on-click-node="false"
  143. highlight-current
  144. node-key="id"
  145. :load="searchtreeLoad"
  146. default-expand-all
  147. >
  148. <span
  149. class="custom-tree-node"
  150. slot-scope="{ node, data }"
  151. :class="data.moreShow ? 'show' : ''"
  152. @mouseleave="mouseout(data)"
  153. >
  154. <div class="pd-r-20">
  155. {{ node.label }}
  156. <div class="normal-black">
  157. <div>
  158. <el-link :underline="false">
  159. <i
  160. class="el-icon-menu"
  161. @click.stop="showMenu($event, data, node)"
  162. v-if="node.level != 1"
  163. ></i>
  164. </el-link>
  165. <ul
  166. v-show="menuvisible"
  167. :style="{
  168. left: menuleft + 'px',
  169. top: menutop + 'px',
  170. }"
  171. class="contextmenu"
  172. >
  173. <li
  174. v-for="item in menusData"
  175. :key="item"
  176. @click="menuClick($event, item, data)"
  177. >
  178. <i :class="item.icon"></i>{{ item.label }}
  179. </li>
  180. </ul>
  181. </div>
  182. </div>
  183. </div>
  184. </span>
  185. </el-tree>
  186. </div>
  187. </el-scrollbar>
  188. </div>
  189. </div>
  190. </el-col>
  191. <el-col :span="14" class="h-100p flex flex-d-c">
  192. <!-- <div>
  193. <el-button type="primary" size="medium" icon="el-icon-plus" class="mg-b-10" @click="addNodeHandle">新增节点</el-button>
  194. <el-button type="primary" size="medium" icon="el-icon-edit-outline" class="mg-b-10" @click="editNodeHandle">编辑当前节点</el-button>
  195. <el-button type="primary" size="medium" icon="el-icon-document-copy" class="mg-b-10" @click="copyNodeHandle">复制当前节点</el-button>
  196. <el-button type="warning" size="medium" icon="el-icon-delete" class="mg-b-10" @click="delNodeHandle">删除当前节点</el-button>
  197. <el-button type="primary" size="medium" icon="el-icon-upload" v-show="curTreeNode && curTreeNode.level == 2" class="mg-b-10" @click="importTemplate(curTreeData,curTreeNode)">导入划分</el-button>
  198. <el-button class="el-btn-purple mg-b-10" type="primary" size="medium" icon="el-icon-s-grid" @click="eleFormulaHandle" v-if="leftType==5">元素公式设置</el-button>
  199. <el-button class="el-btn-purple mg-b-10" type="primary" size="medium" icon="el-icon-s-grid" @click="eleHandle" v-else>元素设置</el-button>
  200. <el-button class="el-btn-purple mg-b-10" type="primary" size="medium" icon="el-icon-help" @click="nodeInfoHandle">节点参数设置</el-button>
  201. </div> -->
  202. <template v-if="leftType == 5">
  203. <p class="mg-b-10">节点信息</p>
  204. <div>
  205. <el-table :data="tableData" border style="width: 100%">
  206. <el-table-column
  207. align="center"
  208. prop="nodeName"
  209. label="当前节点"
  210. ></el-table-column>
  211. <el-table-column
  212. align="center"
  213. prop="nodeType"
  214. :formatter="formatCat"
  215. label="节点类型"
  216. width="180"
  217. ></el-table-column>
  218. <el-table-column
  219. align="center"
  220. prop="parentName"
  221. label="上级节点"
  222. ></el-table-column>
  223. </el-table>
  224. </div>
  225. <div class="flex jc-sb">
  226. <p>
  227. <span>当前已创建的元素表</span>
  228. <el-button
  229. @click="showFormElement"
  230. type="text"
  231. icon="el-icon-circle-plus-outline"
  232. class="text-icon mg-l-10"
  233. ></el-button>
  234. <el-button
  235. type="text"
  236. icon="el-icon-document-copy"
  237. class="text-icon"
  238. ></el-button>
  239. <el-button
  240. type="text"
  241. icon="el-icon-edit-outline"
  242. class="text-icon"
  243. @click="editEditElementForm()"
  244. ></el-button>
  245. <el-button
  246. type="text"
  247. icon="el-icon-sort"
  248. class="text-icon"
  249. @click="paixucc()"
  250. ></el-button>
  251. </p>
  252. <div class="mg-t-10"></div>
  253. </div>
  254. <div style="flex: 1; position: relative">
  255. <el-table
  256. :data="formData"
  257. border
  258. height="100%"
  259. style="width: 100%; position: absolute"
  260. >
  261. <el-table-column
  262. align="center"
  263. prop="tableName"
  264. label="表单名称"
  265. ></el-table-column>
  266. <el-table-column
  267. align="center"
  268. prop="elementTotal"
  269. label="元素总量"
  270. ></el-table-column>
  271. <el-table-column
  272. align="center"
  273. prop="fillRate"
  274. label="填报率"
  275. ></el-table-column>
  276. <el-table-column
  277. align="center"
  278. prop="tableType"
  279. :formatter="formatTableType"
  280. label="表单类型"
  281. ></el-table-column>
  282. <el-table-column
  283. align="center"
  284. prop="tableOwner"
  285. :formatter="formatOwner"
  286. label="所属方"
  287. ></el-table-column>
  288. <el-table-column label="操作">
  289. <template slot-scope="scope">
  290. <el-button
  291. size="mini"
  292. @click="handleEdit(scope.$index, scope.row)"
  293. >编辑</el-button
  294. >
  295. <el-button
  296. size="mini"
  297. type="danger"
  298. @click="handleDelete(scope.$index, scope.row)"
  299. >删除</el-button
  300. >
  301. </template>
  302. </el-table-column>
  303. </el-table>
  304. </div>
  305. </template>
  306. <template v-if="leftType == 4">
  307. <div style="flex: 1; position: relative">
  308. <el-table
  309. :data="formData"
  310. border
  311. height="100%"
  312. style="width: 100%; position: absolute"
  313. >
  314. <el-table-column
  315. align="center"
  316. prop="tableName"
  317. label="表单名称"
  318. ></el-table-column>
  319. <el-table-column
  320. align="center"
  321. prop="elementTotal"
  322. label="元素总量"
  323. ></el-table-column>
  324. <el-table-column
  325. align="center"
  326. prop="fillRate"
  327. label="填报率"
  328. ></el-table-column>
  329. <el-table-column
  330. align="center"
  331. prop="tableType"
  332. :formatter="formatTableType"
  333. label="表单类型"
  334. ></el-table-column>
  335. <el-table-column
  336. align="center"
  337. prop="tableOwner"
  338. :formatter="formatOwner"
  339. label="所属方"
  340. ></el-table-column>
  341. <el-table-column label="操作" width="200">
  342. <template slot-scope="scope">
  343. <el-button
  344. size="mini"
  345. @click="handleEditFormula(scope.$index, scope.row)"
  346. >编辑元素公式</el-button
  347. >
  348. <el-button
  349. size="mini"
  350. type="danger"
  351. @click="handleDelete(scope.$index, scope.row)"
  352. >删除</el-button
  353. >
  354. </template>
  355. </el-table-column>
  356. </el-table>
  357. </div>
  358. </template>
  359. </el-col>
  360. </el-row>
  361. <!-- 编辑元素表单信息 -->
  362. <el-dialog
  363. title="编辑元素表单信息"
  364. :visible.sync="editElementFormTag"
  365. width="60%"
  366. :modal-append-to-body="false"
  367. >
  368. <div>
  369. <el-table :data="formDatass" border style="width: 100%">
  370. <el-table-column prop="tableName" label="表名">
  371. <template slot-scope="scope">
  372. <el-input
  373. v-model="scope.row.tableName"
  374. placeholder="请输入表名称"
  375. ></el-input>
  376. </template>
  377. </el-table-column>
  378. <el-table-column prop="tableType" label="表类型">
  379. <template slot-scope="scope">
  380. <el-select v-model="scope.row.tableType" placeholder="请选择">
  381. <el-option
  382. v-for="(item, key) in tableTypelist"
  383. :key="key"
  384. :label="item.dictValue"
  385. :value="item.dictKey"
  386. >
  387. </el-option>
  388. </el-select>
  389. </template>
  390. </el-table-column>
  391. <el-table-column prop="tableOwner" label="所属方">
  392. <template slot-scope="scope">
  393. <el-select v-model="scope.row.tableOwner" placeholder="请选择">
  394. <el-option
  395. v-for="(item, key) in ownerTypeList"
  396. :key="key"
  397. :label="item.dictValue"
  398. :value="item.dictKey"
  399. >
  400. </el-option>
  401. </el-select>
  402. </template>
  403. </el-table-column>
  404. <el-table-column prop="fillRate" label="填报率">
  405. <template slot-scope="scope">
  406. <el-input
  407. v-model="scope.row.fillRate"
  408. placeholder="请输入填报率"
  409. ></el-input>
  410. </template>
  411. </el-table-column>
  412. </el-table>
  413. </div>
  414. <span slot="footer" class="dialog-footer">
  415. <el-button @click="editElementFormTag = false">取 消</el-button>
  416. <el-button type="primary" @click="editeditElementFormMF()"
  417. >确 定</el-button
  418. >
  419. </span>
  420. </el-dialog>
  421. <!-- 导入元素 -->
  422. <el-dialog
  423. title="导入元素"
  424. :visible.sync="ImportElementTag"
  425. width="30%"
  426. :modal-append-to-body="false"
  427. :before-close="ImportElementHandleClose"
  428. >
  429. <div>
  430. <el-link type="primary" @click="xiazaielement">下载导入模版</el-link>
  431. </div>
  432. <el-upload
  433. class="upload-demo martop10"
  434. action="#"
  435. accept=".xlsx,.xls"
  436. :multiple="false"
  437. :limit="1"
  438. :auto-upload="false"
  439. :on-change="ElementChange"
  440. :file-list="ImportElementFile"
  441. :on-remove="ElementRemove"
  442. >
  443. <el-button
  444. v-if="ImportElementFile.length === 0"
  445. size="small"
  446. type="primary"
  447. >点击上传</el-button
  448. >
  449. <div slot="tip" class="el-upload__tip">只能上传xlsx / xls文件</div>
  450. </el-upload>
  451. <span slot="footer" class="dialog-footer">
  452. <el-button @click="ImportElementHandleClose()">取 消</el-button>
  453. <el-button type="primary" :disabled="loding" @click="pushImportElement"
  454. >确 定</el-button
  455. >
  456. </span>
  457. </el-dialog>
  458. <!-- wbs树排序弹框 -->
  459. <el-dialog
  460. title="调整排序"
  461. :visible.sync="sortTag"
  462. width="50%"
  463. append-to-body
  464. >
  465. <ManualSorting v-if="sortTag2" @bianhua="bianhua()" :sort="sort" />
  466. <span slot="footer" class="dialog-footer">
  467. <el-button @click="(sortTag = false), (sortTag2 = false)"
  468. >取 消</el-button
  469. >
  470. <el-button type="primary" @click="editSort()">确 定</el-button>
  471. </span>
  472. </el-dialog>
  473. <!-- 元素表排序 -->
  474. <el-dialog
  475. title="调整排序"
  476. :visible="excelSortTag"
  477. width="50%"
  478. append-to-body
  479. >
  480. <ManualSorting v-if="excelSortTag2" @bianhua="bianhua2()" :sort="sort" />
  481. <span slot="footer" class="dialog-footer">
  482. <el-button @click="excelSortTag = false">取 消</el-button>
  483. <el-button type="primary" @click="editExcelSort()">确 定</el-button>
  484. </span>
  485. </el-dialog>
  486. <el-dialog
  487. :title="dialogTitle"
  488. :visible.sync="dialogVisible"
  489. width="50%"
  490. append-to-body
  491. :close-on-click-modal="false"
  492. @closed="saveNodeLoading = false"
  493. >
  494. <el-form
  495. ref="nodeDetail"
  496. :model="nodeDetail"
  497. :rules="rules"
  498. label-width="140px"
  499. >
  500. <el-form-item label="节点名称" prop="nodeName">
  501. <div class="flex">
  502. <el-input v-model="nodeDetail.nodeName"></el-input>
  503. <el-button class="mg-l-10" type="primary" @click="aliasShow"
  504. >添加别名</el-button
  505. >
  506. </div>
  507. </el-form-item>
  508. <el-form-item label="上级节点">
  509. <el-input v-model="nodeDetail.parentName" disabled></el-input>
  510. </el-form-item>
  511. <el-form-item label="节点类型" prop="nodeType">
  512. <el-select
  513. filterable
  514. v-model="nodeDetail.nodeType"
  515. placeholder="请选择"
  516. class="w-100p"
  517. @change="nodeTypeChange"
  518. clearable
  519. >
  520. <el-option
  521. v-for="item in nodeTypelist"
  522. :key="item.id"
  523. :label="item.dictValue"
  524. :value="item.dictKey"
  525. ></el-option>
  526. </el-select>
  527. </el-form-item>
  528. <el-form-item
  529. label="划分编号"
  530. v-if="wbsType !== 2 && wbsType !== 5 && wbsType !== 3"
  531. >
  532. <el-input v-model="nodeDetail.partitionCode"></el-input>
  533. </el-form-item>
  534. <el-form-item label="唯一编码" v-if="(wbsType !== 5) & (wbsType !== 3)">
  535. <el-input v-model="nodeDetail.uniqueCode"></el-input>
  536. </el-form-item>
  537. <template v-if="nodeDetail.nodeType == 6 && wbsType !== 3">
  538. <el-form-item label="是否有混凝土">
  539. <el-radio-group v-model="nodeDetail.isConcrete" size="small">
  540. <el-radio :label="0" border>无</el-radio>
  541. <el-radio :label="1" border>有</el-radio>
  542. </el-radio-group>
  543. </el-form-item>
  544. <el-form-item label="是否试验节点">
  545. <el-radio-group v-model="nodeDetail.isExpernode" size="small">
  546. <el-radio :label="0" border>否</el-radio>
  547. <el-radio :label="1" border>是</el-radio>
  548. </el-radio-group>
  549. </el-form-item>
  550. </template>
  551. <el-form-item
  552. label="内业资料类型"
  553. prop="majorDataType"
  554. v-if="wbsType !== 2 && (wbsType !== 5) & (wbsType !== 3)"
  555. >
  556. <el-select
  557. v-model="nodeDetail.majorDataType"
  558. placeholder="请选择"
  559. class="w-100p"
  560. clearable
  561. >
  562. <el-option
  563. v-for="item in majorDataTypeList"
  564. :key="item.id"
  565. :label="item.dictValue"
  566. :value="item.dictKey"
  567. ></el-option>
  568. </el-select>
  569. </el-form-item>
  570. <el-form-item
  571. label="勾选相关联试验"
  572. prop="mixRatioTestIds"
  573. v-if="wbsType === 2 && nodeDetail.nodeType === 53"
  574. >
  575. <div
  576. style="position: relative; height: 300px; border: 1px solid #dddfe6"
  577. >
  578. <el-scrollbar class="h-100p">
  579. <div v-loading="testTreeLoad">
  580. <el-tree
  581. class="filter-tree"
  582. :data="testTreeData"
  583. :props="defaultProps"
  584. :expand-on-click-node="false"
  585. highlight-current
  586. node-key="id"
  587. ref="treeall"
  588. show-checkbox
  589. :default-checked-keys="mixRatioTestIds"
  590. @check="TestTreeCheckChange"
  591. />
  592. </div>
  593. </el-scrollbar>
  594. </div>
  595. </el-form-item>
  596. <el-form-item label="标准分类">
  597. <el-select
  598. v-model="nodeDetail.className"
  599. placeholder="请选择"
  600. class="w-100p"
  601. @change="changeStandType"
  602. clearable
  603. >
  604. <el-option
  605. v-for="item in standardTypeOptions"
  606. :key="item.id"
  607. :label="item.dictValue"
  608. :value="item.dictKey"
  609. ></el-option>
  610. </el-select>
  611. </el-form-item>
  612. <el-form-item label="单元名称">
  613. <el-select
  614. v-model="nodeDetail.unitName"
  615. placeholder="请选择"
  616. class="w-100p"
  617. clearable
  618. >
  619. <el-option
  620. v-for="item in unitOptions"
  621. :key="item.id"
  622. :label="item.dictValue"
  623. :value="item.dictKey"
  624. ></el-option>
  625. </el-select>
  626. </el-form-item>
  627. </el-form>
  628. <span slot="footer" class="dialog-footer">
  629. <el-button @click="dialogVisible = false">取 消</el-button>
  630. <el-button type="primary" @click="saveNode" :loading="saveNodeLoading"
  631. >确 定</el-button
  632. >
  633. </span>
  634. </el-dialog>
  635. <el-dialog
  636. title="创建新的元素表"
  637. :visible.sync="eleVisible"
  638. width="80%"
  639. append-to-body
  640. :close-on-click-modal="false"
  641. >
  642. <el-form
  643. ref="eleDialog"
  644. :model="eleForm"
  645. :rules="eleRules"
  646. label-width="110px"
  647. >
  648. <el-form-item label="表名" prop="nodeName">
  649. <el-input v-model="eleForm.nodeName"></el-input>
  650. </el-form-item>
  651. <el-row>
  652. <el-col :span="8">
  653. <el-form-item label="表类型" prop="tableType">
  654. <el-select
  655. v-model="eleForm.tableType"
  656. placeholder="请选择"
  657. class="w-100p"
  658. >
  659. <el-option
  660. v-for="item in tableTypelist"
  661. :key="item.id"
  662. :label="item.dictValue"
  663. :value="item.dictKey"
  664. ></el-option>
  665. </el-select>
  666. </el-form-item>
  667. </el-col>
  668. <el-col :span="8">
  669. <el-form-item label="所属方" prop="tableOwner">
  670. <el-select
  671. v-model="eleForm.tableOwner"
  672. placeholder="请选择"
  673. class="w-100p"
  674. >
  675. <el-option
  676. v-for="item in ownerTypeList"
  677. :key="item.id"
  678. :label="item.dictValue"
  679. :value="item.dictKey"
  680. ></el-option>
  681. </el-select>
  682. </el-form-item>
  683. </el-col>
  684. <el-col :span="8">
  685. <el-form-item label="填报率" prop="fillRate">
  686. <el-input v-model="eleForm.fillRate"></el-input>
  687. </el-form-item>
  688. </el-col>
  689. </el-row>
  690. </el-form>
  691. <div class="flex jc-sb">
  692. <div></div>
  693. <div>
  694. <el-link type="primary" @click="importVisible = true"
  695. >快捷导入</el-link
  696. >
  697. <el-link type="primary" class="mg-l-20" @click="downloadTmp"
  698. >下载导入模版</el-link
  699. >
  700. </div>
  701. </div>
  702. <div class="border-grey">
  703. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  704. <el-table
  705. :data="eleForm.elementList"
  706. border
  707. style="width: 100%"
  708. height="400px"
  709. >
  710. <el-table-column
  711. align="center"
  712. type="index"
  713. width="50"
  714. ></el-table-column>
  715. <el-table-column align="center" prop="eName" label="元素名称">
  716. <template slot="header">
  717. <i class="required"></i>
  718. <span>元素名称</span>
  719. </template>
  720. <template slot-scope="scope">
  721. <el-input
  722. v-model="scope.row.eName"
  723. size="small"
  724. placeholder="请输入内容"
  725. ></el-input>
  726. </template>
  727. </el-table-column>
  728. <el-table-column
  729. align="center"
  730. prop="eType"
  731. label="数据类型"
  732. width="120"
  733. >
  734. <template slot="header">
  735. <i class="required"></i>
  736. <span>数据类型</span>
  737. </template>
  738. <template slot-scope="scope">
  739. <el-select
  740. v-model="scope.row.eType"
  741. @change="setDefaultLength(scope.row)"
  742. size="small"
  743. placeholder="请选择"
  744. >
  745. <el-option
  746. v-for="item in dataTypeList"
  747. :key="item.id"
  748. :label="item.dictValue"
  749. :value="item.dictKey"
  750. ></el-option>
  751. </el-select>
  752. </template>
  753. </el-table-column>
  754. <el-table-column
  755. align="center"
  756. prop="eLength"
  757. label="长度"
  758. width="120"
  759. >
  760. <template slot="header">
  761. <i class="required"></i>
  762. <span>长度</span>
  763. </template>
  764. <template slot-scope="scope">
  765. <el-input
  766. v-model="scope.row.eLength"
  767. size="small"
  768. placeholder="请输入内容"
  769. ></el-input>
  770. </template>
  771. </el-table-column>
  772. <el-table-column
  773. align="center"
  774. prop="eAllowDeviation"
  775. label="允许偏差值"
  776. >
  777. <template slot-scope="scope">
  778. <div class="flex">
  779. <el-select
  780. v-model="scope.row.allow"
  781. :popper-append-to-body="false"
  782. size="small"
  783. placeholder="请选择"
  784. style="width: 120px"
  785. >
  786. <el-option :key="1" label="-" value="-"></el-option>
  787. <el-option :key="2" label=">" value=">"></el-option>
  788. <el-option :key="3" label="<" value="<"></el-option>
  789. <el-option :key="4" label="≥" value="≥"></el-option>
  790. <el-option :key="5" label="≤" value="≤"></el-option>
  791. <el-option :key="6" label="±" value="±"></el-option>
  792. <el-option :key="7" label="【】" value="【】"></el-option>
  793. </el-select>
  794. <el-input
  795. v-model="scope.row.deviation"
  796. size="small"
  797. placeholder="请输入内容"
  798. ></el-input>
  799. </div>
  800. </template>
  801. </el-table-column>
  802. <el-table-column
  803. align="center"
  804. prop="eInspectionMethod"
  805. label="检查方法和频率"
  806. >
  807. <template slot-scope="scope">
  808. <el-input
  809. v-model="scope.row.eInspectionMethod"
  810. size="small"
  811. placeholder="请输入内容"
  812. ></el-input>
  813. </template>
  814. </el-table-column>
  815. <el-table-column align="center" label="操作" width="80">
  816. <template slot="header">
  817. <el-button
  818. @click="addEleRow(eleForm.elementList)"
  819. type="text"
  820. icon="el-icon-circle-plus-outline"
  821. class="text-icon"
  822. ></el-button>
  823. </template>
  824. <template slot-scope="scope">
  825. <el-button
  826. icon="el-icon-remove-outline"
  827. type="text"
  828. @click="delEleRow(scope.$index, eleForm.elementList)"
  829. class="text-icon text-icon-danger"
  830. ></el-button>
  831. </template>
  832. </el-table-column>
  833. </el-table>
  834. </div>
  835. <span slot="footer" class="dialog-footer">
  836. <el-button @click="eleVisible = false">取 消</el-button>
  837. <el-button type="primary" @click="saveFormAndElementHandle"
  838. >保 存</el-button
  839. >
  840. </span>
  841. </el-dialog>
  842. <el-dialog
  843. title="模版导入"
  844. :visible.sync="importVisible"
  845. width="50%"
  846. append-to-body
  847. :close-on-click-modal="false"
  848. >
  849. <p>
  850. 提示:必须按照系统要求的模版格式上传,否则系统识别无效
  851. <el-link type="primary" @click="downloadTmp">下载导入模版</el-link>
  852. </p>
  853. <div>
  854. <el-button size="small" type="primary" @click="fileClick2"
  855. >本地上传</el-button
  856. >
  857. <input
  858. @change="tmpImport"
  859. type="file"
  860. hidden
  861. ref="file2"
  862. accept=".xls, .xlsx"
  863. />
  864. </div>
  865. <el-table :data="tempList" border style="width: 100%">
  866. <el-table-column align="center" prop="eName" label="元素名称">
  867. </el-table-column>
  868. <el-table-column
  869. align="center"
  870. prop="eType"
  871. label="数据类型"
  872. width="120"
  873. >
  874. </el-table-column>
  875. <el-table-column align="center" prop="eLength" label="长度" width="120">
  876. </el-table-column>
  877. <el-table-column
  878. align="center"
  879. prop="eAllowDeviation"
  880. label="允许偏差值"
  881. >
  882. </el-table-column>
  883. <el-table-column
  884. align="center"
  885. prop="eInspectionMethod"
  886. label="检查方法和频率"
  887. >
  888. </el-table-column>
  889. </el-table>
  890. <span slot="footer" class="dialog-footer">
  891. <el-button @click="importVisible = false">取 消</el-button>
  892. <el-button type="primary" @click="importHandle">确 定</el-button>
  893. </span>
  894. </el-dialog>
  895. <el-dialog
  896. :title="
  897. (curEleTable.tableName ? curEleTable.tableName : '') + ' 元素编辑'
  898. "
  899. :visible.sync="editEleVisible"
  900. width="80%"
  901. append-to-body
  902. :close-on-click-modal="false"
  903. >
  904. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  905. <div style="display: flex; margin-bottom: 10px">
  906. <el-input
  907. placeholder="请输入你想编辑的元素名称"
  908. v-model="searchinput"
  909. :size="size"
  910. clearable
  911. @clear="clearsearchinput"
  912. >
  913. </el-input>
  914. <el-button
  915. type="primary"
  916. icon="el-icon-search"
  917. size="small"
  918. @click="searchinputChange"
  919. >搜索</el-button
  920. >
  921. </div>
  922. <el-table
  923. :data="editEleList"
  924. border
  925. style="width: 100%"
  926. height="400px"
  927. v-loading="editEleloading"
  928. >
  929. <el-table-column
  930. align="center"
  931. type="index"
  932. width="50"
  933. ></el-table-column>
  934. <el-table-column align="center" prop="eName" label="元素名称">
  935. <template slot="header">
  936. <i class="required"></i>
  937. <span>元素名称</span>
  938. </template>
  939. <template slot-scope="scope">
  940. <el-input
  941. v-model="scope.row.eName"
  942. size="small"
  943. placeholder="请输入内容"
  944. ></el-input>
  945. </template>
  946. </el-table-column>
  947. <el-table-column
  948. align="center"
  949. prop="eType"
  950. label="数据类型"
  951. width="120"
  952. >
  953. <template slot="header">
  954. <i class="required"></i>
  955. <span>数据类型</span>
  956. </template>
  957. <template slot-scope="scope">
  958. <el-select
  959. v-model="scope.row.eType"
  960. @change="setDefaultLength(scope.row)"
  961. size="small"
  962. placeholder="请选择"
  963. >
  964. <el-option
  965. v-for="item in dataTypeList"
  966. :key="item.id"
  967. :label="item.dictValue"
  968. :value="item.dictKey"
  969. ></el-option>
  970. </el-select>
  971. </template>
  972. </el-table-column>
  973. <el-table-column align="center" prop="eLength" label="长度" width="120">
  974. <template slot="header">
  975. <i class="required"></i>
  976. <span>长度</span>
  977. </template>
  978. <template slot-scope="scope">
  979. <el-input
  980. v-model="scope.row.eLength"
  981. size="small"
  982. placeholder="请输入内容"
  983. ></el-input>
  984. </template>
  985. </el-table-column>
  986. <el-table-column
  987. align="center"
  988. prop="eAllowDeviation"
  989. label="允许偏差值"
  990. >
  991. <template slot-scope="scope">
  992. <div class="flex">
  993. <el-select
  994. v-model="scope.row.allow"
  995. size="small"
  996. placeholder="请选择"
  997. style="width: 120px"
  998. >
  999. <el-option :key="1" label="-" value="-"></el-option>
  1000. <el-option :key="2" label=">" value=">"></el-option>
  1001. <el-option :key="3" label="<" value="<"></el-option>
  1002. <el-option :key="4" label="≥" value="≥"></el-option>
  1003. <el-option :key="5" label="≤" value="≤"></el-option>
  1004. <el-option :key="6" label="±" value="±"></el-option>
  1005. <el-option :key="7" label="【】" value="【】"></el-option>
  1006. </el-select>
  1007. <el-input
  1008. v-model="scope.row.deviation"
  1009. size="small"
  1010. placeholder="请输入内容"
  1011. ></el-input>
  1012. </div>
  1013. </template>
  1014. </el-table-column>
  1015. <el-table-column
  1016. align="center"
  1017. prop="eInspectionMethod"
  1018. label="检查方法和频率"
  1019. >
  1020. <template slot-scope="scope">
  1021. <el-input
  1022. v-model="scope.row.eInspectionMethod"
  1023. size="small"
  1024. placeholder="请输入内容"
  1025. ></el-input>
  1026. </template>
  1027. </el-table-column>
  1028. <el-table-column align="center" prop="dynamicDict" label="动态字典">
  1029. <template slot="header">
  1030. <span>动态字典</span>
  1031. </template>
  1032. <template slot-scope="scope">
  1033. <el-select
  1034. v-model="scope.row.dynamicDict"
  1035. @change="setDefaultLength(scope.row)"
  1036. filterable
  1037. size="small"
  1038. placeholder="请选择"
  1039. >
  1040. <el-option
  1041. v-for="item in dynamicDictList"
  1042. :key="item.id"
  1043. :label="item.dictValue"
  1044. :value="item.dictKey"
  1045. ></el-option>
  1046. </el-select>
  1047. </template>
  1048. </el-table-column>
  1049. <el-table-column align="center" label="操作" width="120">
  1050. <template slot="header">
  1051. <el-button
  1052. @click="addEleRow(editEleList)"
  1053. type="text"
  1054. icon="el-icon-circle-plus-outline"
  1055. class="text-icon"
  1056. ></el-button>
  1057. </template>
  1058. <template slot-scope="scope">
  1059. <el-button
  1060. v-if="scope.row.id"
  1061. icon="el-icon-remove-outline"
  1062. type="text"
  1063. @click="delEleRowHandle(scope.$index, editEleList)"
  1064. class="text-icon text-icon-danger"
  1065. ></el-button>
  1066. <div class="flex" v-else>
  1067. <el-button @click="saveNewEle(scope.row)" type="mini"
  1068. >保存</el-button
  1069. >
  1070. <el-button
  1071. icon="el-icon-remove-outline"
  1072. type="text"
  1073. @click="delEleRowHandle(scope.$index, editEleList)"
  1074. class="text-icon text-icon-danger"
  1075. ></el-button>
  1076. </div>
  1077. </template>
  1078. </el-table-column>
  1079. </el-table>
  1080. <span slot="footer" class="dialog-footer">
  1081. <el-button @click="editEleVisible = false">取 消</el-button>
  1082. <el-button type="primary" @click="saveEles">确 定</el-button>
  1083. </span>
  1084. </el-dialog>
  1085. <el-dialog
  1086. :title="
  1087. (curEleTable.tableName ? curEleTable.tableName : '') +
  1088. ' 元素公式(WBS级)'
  1089. "
  1090. :visible.sync="editEleFormulaVisible"
  1091. width="800px"
  1092. append-to-body
  1093. :close-on-click-modal="false"
  1094. >
  1095. <div class="flex mg-b-10">
  1096. <el-input
  1097. v-model="formulaInput"
  1098. placeholder="请输入名称"
  1099. size="samll"
  1100. clearable
  1101. @clear="searchFormulaName"
  1102. ></el-input>
  1103. <el-button type="info" class="mg-l-10" @click="searchFormulaName"
  1104. >搜索</el-button
  1105. >
  1106. </div>
  1107. <el-table
  1108. :data="editEleListFilter"
  1109. border
  1110. style="width: 100%"
  1111. height="400px"
  1112. >
  1113. <el-table-column align="center" prop="eName" label="元素名称">
  1114. </el-table-column>
  1115. <el-table-column align="center" label="操作" width="200">
  1116. <template slot-scope="scope">
  1117. <el-link
  1118. :type="scope.row.globalFormula == 1 ? 'warning' : 'primary'"
  1119. @click="toFormulaEdit(scope.row, 1)"
  1120. >全局公式</el-link
  1121. >
  1122. <el-link
  1123. v-show="scope.row.hasPartFormula"
  1124. class="mg-l-10"
  1125. :type="scope.row.isSaveFormula == 1 ? 'warning' : 'primary'"
  1126. @click="toFormulaEdit(scope.row, 2)"
  1127. >节点公式</el-link
  1128. >
  1129. <!-- <el-link
  1130. class="mg-l-10"
  1131. type="danger"
  1132. @click="delEleRowHandle(scope.$index,editEleListFilter)"
  1133. >删除元素</el-link> -->
  1134. </template>
  1135. </el-table-column>
  1136. </el-table>
  1137. </el-dialog>
  1138. <el-dialog
  1139. title="导入划分"
  1140. :visible.sync="importTemplateVisible"
  1141. width="800px"
  1142. append-to-body
  1143. @close="daoruClose"
  1144. >
  1145. <div v-loading="importLoading">
  1146. <div>
  1147. <el-link type="primary" @click="handleDownload">下载导入模版</el-link>
  1148. </div>
  1149. <div class="mg-t-20">
  1150. <el-button type="primary" @click="fileClick">选择文件</el-button>
  1151. <span v-if="upFile" class="mg-l-20">{{ upFile.name }}</span>
  1152. <input
  1153. @change="fileChange"
  1154. type="file"
  1155. hidden
  1156. ref="file"
  1157. accept=".xls, .xlsx"
  1158. />
  1159. </div>
  1160. <div v-if="!upFile">当前还未选择文件,请选择需要导入的文件</div>
  1161. </div>
  1162. <span slot="footer" class="dialog-footer">
  1163. <el-button @click="importTemplateVisible = false">取 消</el-button>
  1164. <el-button
  1165. type="primary"
  1166. @click="importTemplateHandle"
  1167. :loading="importLoading"
  1168. >导 入</el-button
  1169. >
  1170. </span>
  1171. </el-dialog>
  1172. <el-dialog
  1173. title="节点参数"
  1174. :visible.sync="nodeInfoVisible"
  1175. width="800px"
  1176. append-to-body
  1177. class="jiedian"
  1178. :close-on-click-modal="false"
  1179. :show-close="false"
  1180. @close="closenodeInfoVisible"
  1181. >
  1182. <div>
  1183. <el-button
  1184. type="text"
  1185. icon="el-icon-s-operation"
  1186. class="right-btn"
  1187. @click="setNodeParameters()"
  1188. ></el-button>
  1189. <div class="flexEnd">
  1190. <i
  1191. class="el-icon-circle-plus marbottom10"
  1192. @click="addNodeInfoTable()"
  1193. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1194. ></i>
  1195. <i
  1196. class="el-icon-refresh-right marbottom10"
  1197. @click="refreshnfoTable()"
  1198. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer" v-loading="nodeInfoTableLoad"
  1199. ></i>
  1200. </div>
  1201. <el-table :data="nodeInfoTable" border style="width: 100%" height="400">
  1202. <el-table-column align="center" prop="name" label="参数名称">
  1203. <template slot-scope="scope">
  1204. <el-select
  1205. v-model="scope.row.k"
  1206. placeholder="请选择"
  1207. class="w-100p"
  1208. >
  1209. <el-option
  1210. v-for="item in namelist"
  1211. :key="item.k"
  1212. :label="item.name"
  1213. :value="item.k"
  1214. ></el-option>
  1215. </el-select>
  1216. </template>
  1217. </el-table-column>
  1218. <el-table-column align="center" prop="value" label="参数值设置">
  1219. <template slot-scope="scope">
  1220. <el-input v-model="scope.row.v"></el-input>
  1221. </template>
  1222. </el-table-column>
  1223. <el-table-column align="center" prop="describe" label="描述">
  1224. <template slot-scope="scope">
  1225. <el-input v-model="scope.row.remark"></el-input>
  1226. </template>
  1227. </el-table-column>
  1228. <el-table-column label="操作" width="120" align="center">
  1229. <template slot-scope="scope">
  1230. <el-button
  1231. type="text"
  1232. size="small"
  1233. class="text-icon-primary"
  1234. @click="linkEle(scope.row)"
  1235. >关联元素</el-button
  1236. >
  1237. <el-button
  1238. type="text"
  1239. size="small"
  1240. class="text-icon-danger"
  1241. @click="delNodeInfoss(scope.$index, scope.row)"
  1242. >删除</el-button
  1243. >
  1244. </template>
  1245. </el-table-column>
  1246. </el-table>
  1247. </div>
  1248. <span slot="footer" class="dialog-footer">
  1249. <el-button @click="nodeInfoVisible = false">取 消</el-button>
  1250. <el-button
  1251. type="primary"
  1252. @click="nodeInfoSave()"
  1253. :loading="nodeInfoSaveload"
  1254. >保 存</el-button
  1255. >
  1256. </span>
  1257. </el-dialog>
  1258. <el-dialog
  1259. title="设置参数名称"
  1260. :visible.sync="infoNameVisible"
  1261. width="800px"
  1262. append-to-body
  1263. class="jiedian"
  1264. :close-on-click-modal="false"
  1265. >
  1266. <div>
  1267. <div class="flexEnd">
  1268. <i
  1269. class="el-icon-circle-plus marbottom10"
  1270. @click="setParameterName()"
  1271. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1272. ></i>
  1273. </div>
  1274. <el-table :data="namelists" border style="width: 100%" height="400">
  1275. <el-table-column align="center" prop="name" label="参数名称">
  1276. <template slot-scope="scope">
  1277. <el-input v-model="scope.row.name"></el-input>
  1278. </template>
  1279. </el-table-column>
  1280. <el-table-column align="center" prop="key" label="参数值KEY">
  1281. <template slot-scope="scope">
  1282. <el-input v-model="scope.row.k"></el-input>
  1283. </template>
  1284. </el-table-column>
  1285. <el-table-column align="center" prop="describe" label="描述">
  1286. <template slot-scope="scope">
  1287. <el-input v-model="scope.row.remark"></el-input>
  1288. </template>
  1289. </el-table-column>
  1290. <el-table-column label="操作" width="120" align="center">
  1291. <template slot-scope="scope">
  1292. <el-button
  1293. type="text"
  1294. size="small"
  1295. class="text-icon-danger"
  1296. @click="delNodeInfo(scope.$index, scope.row)"
  1297. >删除</el-button
  1298. >
  1299. </template>
  1300. </el-table-column>
  1301. </el-table>
  1302. </div>
  1303. <span slot="footer" class="dialog-footer">
  1304. <el-button @click="addParameterName()">保 存</el-button>
  1305. <el-button @click="closeParameter()">关 闭</el-button>
  1306. </span>
  1307. </el-dialog>
  1308. <el-dialog
  1309. title="节点参数设置-关联元素"
  1310. :visible.sync="linkEleVisible"
  1311. width="800px"
  1312. append-to-body
  1313. class="jiedian"
  1314. :close-on-click-modal="false"
  1315. >
  1316. <div>
  1317. <el-table
  1318. :data="linkEleTableList"
  1319. border
  1320. style="width: 100%"
  1321. height="400"
  1322. >
  1323. <el-table-column align="center" prop="tableName" label="元素表名">
  1324. </el-table-column>
  1325. <el-table-column
  1326. align="center"
  1327. prop="elementName"
  1328. label="关联元素字段"
  1329. >
  1330. </el-table-column>
  1331. <el-table-column label="操作" width="160" align="center">
  1332. <template slot-scope="scope">
  1333. <el-button
  1334. v-if="!scope.row.mappingId"
  1335. type="text"
  1336. size="small"
  1337. class="text-icon-primary"
  1338. @click="tolinkEle(scope.row)"
  1339. >选择元素</el-button
  1340. >
  1341. <el-button
  1342. v-if="!!scope.row.mappingId"
  1343. type="text"
  1344. size="small"
  1345. class="text-icon-danger"
  1346. @click="delLink(scope.row)"
  1347. >删除关联</el-button
  1348. >
  1349. </template>
  1350. </el-table-column>
  1351. </el-table>
  1352. </div>
  1353. <span slot="footer" class="dialog-footer">
  1354. <!-- <el-button @click="saveLinks">保 存</el-button> -->
  1355. <el-button @click="linkEleVisible = false">关 闭</el-button>
  1356. </span>
  1357. </el-dialog>
  1358. <el-dialog
  1359. title="选择关联元素"
  1360. :visible.sync="linkCheckVisible"
  1361. width="600px"
  1362. append-to-body
  1363. class="jiedian"
  1364. :close-on-click-modal="false"
  1365. >
  1366. <div>
  1367. <div class="flex mg-b-20">
  1368. <el-input
  1369. v-model="linkEleKey"
  1370. placeholder="请输入元素关键字搜索"
  1371. ></el-input>
  1372. <el-link class="mg-l-20" :underline="false">
  1373. <i
  1374. class="el-icon-search"
  1375. style="font-size: 20px"
  1376. @click="searchEle"
  1377. ></i>
  1378. </el-link>
  1379. </div>
  1380. <el-table :data="linkEleList" border style="width: 100%" height="400">
  1381. <el-table-column align="center" prop="eName" label="元素名">
  1382. </el-table-column>
  1383. <el-table-column label="操作" width="55">
  1384. <template slot-scope="scope">
  1385. <el-checkbox
  1386. v-model="scope.row.checked"
  1387. @change="(value) => linkEleCheck(value, scope.$index)"
  1388. ></el-checkbox>
  1389. </template>
  1390. </el-table-column>
  1391. </el-table>
  1392. </div>
  1393. <span slot="footer" class="dialog-footer">
  1394. <el-button @click="saveLinkEle">保 存</el-button>
  1395. <el-button @click="linkCheckVisible = false">关 闭</el-button>
  1396. </span>
  1397. </el-dialog>
  1398. <el-dialog
  1399. title="别名"
  1400. :visible.sync="aliasVisible"
  1401. width="600px"
  1402. append-to-body
  1403. :close-on-click-modal="false"
  1404. >
  1405. <div>
  1406. <div class="flex">
  1407. <el-input
  1408. v-model="aliasInput"
  1409. placeholder="请输入节点别名"
  1410. ></el-input>
  1411. <el-button class="mg-l-20" type="primary" @click="addAlias"
  1412. >添加</el-button
  1413. >
  1414. </div>
  1415. <div class="flex" style="flex-wrap: wrap">
  1416. <div class="mg-t-10" v-for="(tag, index) in aliasArr" :key="index">
  1417. <el-tag closable @close="delAlias(index)">
  1418. {{ tag }}
  1419. </el-tag>
  1420. <span v-if="index != aliasArr.length - 1">、</span>
  1421. </div>
  1422. </div>
  1423. </div>
  1424. <span slot="footer" class="dialog-footer">
  1425. <el-button @click="aliasVisible = false">取 消</el-button>
  1426. <el-button type="primary" @click="saveAliasHandle">确 定</el-button>
  1427. </span>
  1428. </el-dialog>
  1429. <el-dialog
  1430. title=""
  1431. :visible.sync="formulaCompVisible"
  1432. fullscreen
  1433. append-to-body
  1434. class="full-dialog"
  1435. >
  1436. <FormulaEdit
  1437. :wbsid="id"
  1438. :nodeid="curTreeData.id"
  1439. :eleid="formulaCurRow.id"
  1440. :globaltype="formulaCurRow.globaltype"
  1441. @hideDialog="formulaCompVisible = false"
  1442. v-if="formulaCompVisible"
  1443. :fromcurNode="curTreeData"
  1444. :iswbstype="1"
  1445. ></FormulaEdit>
  1446. </el-dialog>
  1447. <el-dialog
  1448. title=""
  1449. :visible.sync="formulaCompVisible1"
  1450. fullscreen
  1451. append-to-body
  1452. class="full-dialog"
  1453. >
  1454. <FormulaEditone
  1455. :wbsid="id"
  1456. :nodeid="curTreeData.id"
  1457. :eleid="formulaCurRow.id"
  1458. :elementType="formulaCurRow.elementType"
  1459. :globaltype="formulaCurRow.globaltype"
  1460. @hideDialog="formulaCompVisible1 = false"
  1461. :fromcurNode="curEleTable"
  1462. :iswbstype="1"
  1463. v-if="formulaCompVisible1"
  1464. >
  1465. </FormulaEditone>
  1466. </el-dialog>
  1467. </basic-container>
  1468. </template>
  1469. <script>
  1470. import ManualSorting from "@/components/WbsTree/ManualSorting";
  1471. import FormulaEdit from "@/views/formula/edit.vue";
  1472. import FormulaEditone from "@/views/formula/edit1.vue";
  1473. import {
  1474. getLazytree,
  1475. getDetail,
  1476. update,
  1477. selectByNodeTable,
  1478. getParamElements,
  1479. delParamElements,
  1480. specifiedParamElements,
  1481. getAlltree,
  1482. saveFormAndElement,
  1483. selectFormElements,
  1484. removeTableById,
  1485. findWbsTreeSameLevel,
  1486. wbsTreeSort,
  1487. findWbsTreeTableSameLevel,
  1488. wbsTreeTableSort,
  1489. parameters,
  1490. saveOrUpdateBatch,
  1491. keymap,
  1492. importwbsTreeFormBatch,
  1493. exportBatchTemplate,
  1494. updateBatchNodeTableInfo,
  1495. importWbsTree,
  1496. exportTemplate,
  1497. remove as removeTreeNode,
  1498. submitFullName,
  1499. refrehPram,
  1500. getQueryValueByType,
  1501. } from "@/api/manager/wbstree";
  1502. import {
  1503. saveElement,
  1504. remove as removeElement,
  1505. updateBatchElements,
  1506. getTemplate,
  1507. importWbsElement,
  1508. } from "@/api/manager/wbsformelement";
  1509. import { getDictionary, getChildList } from "@/api/system/dict";
  1510. import { mapGetters } from "vuex";
  1511. import { getStore, setStore } from "@/util/store";
  1512. export default {
  1513. data() {
  1514. var checkMajorDataType = (rule, value, callback) => {
  1515. //console.log(this.nodeDetail.nodeType)
  1516. //console.log(this.nodeDetail.majorDataType)
  1517. if (this.nodeDetail.nodeType == 6) {
  1518. if (!this.nodeDetail.majorDataType) {
  1519. callback(new Error("工序节点必须选择内业资料类型"));
  1520. }
  1521. }
  1522. callback();
  1523. };
  1524. return {
  1525. loding: false,
  1526. nodeInfoTableLoad: false,
  1527. formDatass: [],
  1528. editElementFormTag: false,
  1529. ImportElementdata: {},
  1530. ImportElementFile: [], //导入元素file文件
  1531. ImportElementTag: false,
  1532. jiedianId: "",
  1533. excelSortTag: false,
  1534. excelSortTag2: false,
  1535. sortTag2: false,
  1536. sortTag: false,
  1537. sort: [],
  1538. id: "",
  1539. filterText: "",
  1540. isSearch: false,
  1541. treeData: [],
  1542. searchTreeData: [],
  1543. searchtreeLoad: false,
  1544. searchType: "1", //搜索类型
  1545. treeLoad: false,
  1546. menuShow: false,
  1547. defaultProps: {
  1548. children: "children",
  1549. label: "title",
  1550. isLeaf: function (data) {
  1551. if (data.hasChildren && data.isExistForm != 1) {
  1552. return false;
  1553. } else if (data.hasChildren && data.isExistForm == 1) {
  1554. return true;
  1555. } else {
  1556. return true;
  1557. }
  1558. },
  1559. },
  1560. leftType: 5,
  1561. curTreeData: {},
  1562. curTreeNode: {},
  1563. tableData: [],
  1564. nodeDetail: {},
  1565. formData: [],
  1566. editType: 1,
  1567. dialogVisible: false,
  1568. saveNodeLoading: false,
  1569. nodeTypelist: [],
  1570. majorDataTypeList: [],
  1571. rules: {
  1572. nodeName: [
  1573. { required: true, message: "请输入节点名称", trigger: "blur" },
  1574. ],
  1575. nodeType: [
  1576. { required: true, message: "请选择节点类型", trigger: "change" },
  1577. ],
  1578. majorDataType: [{ validator: checkMajorDataType, trigger: "change" }],
  1579. },
  1580. eleVisible: false,
  1581. tableTypelist: [],
  1582. dataTypeList: [],
  1583. ownerTypeList: [],
  1584. eleForm: {
  1585. elementList: [],
  1586. },
  1587. eleRules: {
  1588. nodeName: [
  1589. { required: true, message: "请输入表名称", trigger: "blur" },
  1590. ],
  1591. tableType: [
  1592. { required: true, message: "请选择表类型", trigger: "change" },
  1593. ],
  1594. tableOwner: [
  1595. { required: true, message: "请选择所属方", trigger: "change" },
  1596. ],
  1597. },
  1598. importVisible: false,
  1599. tempList: [],
  1600. curEleTable: {},
  1601. editEleVisible: false,
  1602. editEleList: [],
  1603. eleReg: /(-|>|<|≥|≤|±|【】)?([^≥≤±【】]*)/,
  1604. editEleFormulaVisible: false,
  1605. formulaInput: "",
  1606. editEleListFilter: [],
  1607. editEleListAll: [],
  1608. importTemplateVisible: false,
  1609. fileUrl: "",
  1610. upFile: null,
  1611. importLoading: false,
  1612. nodeInfoVisible: false,
  1613. nodeInfoTable: [],
  1614. namelist: [],
  1615. namelists: [],
  1616. infoNameVisible: false,
  1617. delids: [],
  1618. //数据类型的默认长度
  1619. dataTypeDefaultMap: {
  1620. 1: 250, //字符串
  1621. 2: 50, //整数
  1622. 3: 50, //小数
  1623. 4: 50, //日期
  1624. 5: 50, //数值
  1625. 6: 50, //签名
  1626. 7: 100, //文件
  1627. },
  1628. //节点参数,关联元素
  1629. curParam: {}, //当前节点参数
  1630. linkEleVisible: false,
  1631. linkEleTableList: [], //元素表数组
  1632. curLinkEleTable: {}, //当前元素表
  1633. linkCheckVisible: false, //关联弹框
  1634. linkEleList: [], //元素数组
  1635. linkEleKey: "", //搜索关键字
  1636. defaultExpandedKeys: [],
  1637. expandName: this.$route.fullPath,
  1638. aliasVisible: false, //别名
  1639. aliasInput: "",
  1640. aliasArr: [],
  1641. formulaCompVisible: false, //公式弹框
  1642. formulaCompVisible1: false,
  1643. formulaCurRow: {}, //当前元素
  1644. testTreeLoad: false,
  1645. testTreeData: [],
  1646. mixRatioTestIds: [],
  1647. searchinput: "",
  1648. editEleloading: false,
  1649. menuvisible: false, //右键菜单
  1650. menuleft: 20,
  1651. menutop: 0,
  1652. menusData: [
  1653. { icon: "el-icon-plus", label: "新增节点", key: "add" },
  1654. { icon: "el-icon-s-promotion", label: "编辑节点", key: "edit" },
  1655. { icon: "el-icon-sort", label: "排序节点", key: "sort" },
  1656. { icon: "el-icon-document-copy", label: "复制节点", key: "copy" },
  1657. { icon: "el-icon-delete", label: "删除节点", key: "del" },
  1658. ], //树组件操作菜单
  1659. menusData1: [{ icon: "el-icon-plus", label: "新增节点", key: "add" }],
  1660. menuKey: "",
  1661. nodeInfoSaveload: false,
  1662. dynamicDictList: [],
  1663. standardTypeOptions: [], //标准分类
  1664. unitOptions: [], //单位名称
  1665. };
  1666. },
  1667. computed: {
  1668. ...mapGetters(["userInfo"]),
  1669. dialogTitle: function () {
  1670. let text = "节点";
  1671. if (this.leftType == 1) {
  1672. text = "新增" + text;
  1673. } else if (this.leftType == 2) {
  1674. text = "编辑" + text;
  1675. }
  1676. return text;
  1677. },
  1678. },
  1679. created() {
  1680. this.init();
  1681. //console.log(this.userInfo)
  1682. },
  1683. methods: {
  1684. //#region 排序
  1685. paixuMD(data) {
  1686. this.sortTag = true;
  1687. this.sortTag2 = true;
  1688. this.curTreeData = data;
  1689. this.findWbsTreeSameLevel(data.parentId);
  1690. },
  1691. bianhua() {
  1692. this.sortTag2 = false;
  1693. this.$nextTick(() => {
  1694. this.sortTag2 = true;
  1695. });
  1696. },
  1697. editSort() {
  1698. //修改排序
  1699. this.wbsTreeSort();
  1700. },
  1701. async wbsTreeSort() {
  1702. //修改排序
  1703. const { data: res } = await wbsTreeSort(this.sort);
  1704. //console.log(res);
  1705. if (res.code == 200) {
  1706. this.sortTag = false;
  1707. this.sortTag2 = false;
  1708. this.updateTreeNewNode();
  1709. }
  1710. },
  1711. async findWbsTreeSameLevel(parentId) {
  1712. //查询当前节点的同级节点
  1713. const { data: res } = await findWbsTreeSameLevel({ parentId });
  1714. //console.log(res);
  1715. if (res.code === 200) {
  1716. this.sort = res.data;
  1717. }
  1718. },
  1719. async getLazytree() {
  1720. //冲洗获取wbs树
  1721. const { data: res } = await getLazytree(
  1722. this.id,
  1723. 0,
  1724. this.userInfo.tenant_id
  1725. );
  1726. //console.log(res);
  1727. if (res.code == 200) {
  1728. this.treeData = res.data;
  1729. }
  1730. },
  1731. bianhua2() {
  1732. this.excelSortTag2 = false;
  1733. this.$nextTick(() => {
  1734. this.excelSortTag2 = true;
  1735. });
  1736. },
  1737. editExcelSort() {
  1738. //确定按钮
  1739. this.wbsTreeTableSort();
  1740. },
  1741. paixucc() {
  1742. if (this.curTreeData.value) {
  1743. this.excelSortTag = true;
  1744. this.excelSortTag2 = true;
  1745. this.findWbsTreeTableSameLevel(this.curTreeData.value);
  1746. } else {
  1747. this.$message({
  1748. type: "warning",
  1749. message: "请先选择需要排序的节点",
  1750. });
  1751. }
  1752. },
  1753. async findWbsTreeTableSameLevel(id) {
  1754. //查询表单
  1755. const { data: res } = await findWbsTreeTableSameLevel({ id });
  1756. //console.log(res);
  1757. if (res.code == 200) {
  1758. this.sort = res.data;
  1759. }
  1760. },
  1761. async wbsTreeTableSort() {
  1762. //表单排序
  1763. const { data: res } = await wbsTreeTableSort(this.sort);
  1764. //console.log(res);
  1765. if (res.code == 200) {
  1766. this.excelSortTag = false;
  1767. this.excelSortTag2 = false;
  1768. this.updateNodeTable(); //更新元素表
  1769. }
  1770. },
  1771. //#endregion
  1772. //#region 甘云杰
  1773. init() {
  1774. //this.id = this.$route.params.id;
  1775. const { id, type } = this.$route.query;
  1776. this.id = id;
  1777. this.wbsType = Number(type);
  1778. this.getNodeTypelist();
  1779. this.getTableTypelist();
  1780. this.getDataTypelist();
  1781. this.getOwnerTypelist();
  1782. this.getDictTypelist();
  1783. this.getStandardTypeOptions();
  1784. this.defaultExpandedKeys = getStore({ name: this.expandName });
  1785. },
  1786. loadNode(node, resolve) {
  1787. let pid = 0;
  1788. if (node.level != 0) {
  1789. pid = node.data.id;
  1790. }
  1791. getLazytree(this.id, pid, this.userInfo.tenant_id).then((res) => {
  1792. let arr = [];
  1793. if (Array.isArray(res.data.data)) {
  1794. arr = res.data.data;
  1795. }
  1796. return resolve(arr);
  1797. });
  1798. },
  1799. //搜索树
  1800. searchTreeClick() {
  1801. this.searchtreeLoad = true;
  1802. if (this.filterText.length > 0) {
  1803. this.isSearch = true;
  1804. getQueryValueByType({
  1805. queryValue: this.filterText,
  1806. type: this.searchType,
  1807. wbsId: this.id,
  1808. projectId: "",
  1809. }).then((res) => {
  1810. let arr = [];
  1811. if (Array.isArray(res.data.data)) {
  1812. arr = res.data.data;
  1813. this.searchTreeData = arr;
  1814. } else {
  1815. this.searchTreeData = [];
  1816. }
  1817. });
  1818. } else {
  1819. this.isSearch = false;
  1820. }
  1821. this.searchtreeLoad = false;
  1822. },
  1823. clearSearch() {
  1824. this.isSearch = false;
  1825. },
  1826. getNodeDetail(data, node) {
  1827. let parentName = "";
  1828. if (node.parent.data) {
  1829. parentName = node.parent.data.title;
  1830. }
  1831. this.curTreeData = data;
  1832. this.curTreeNode = node;
  1833. this.curTreeData.parentName = parentName;
  1834. getDetail(data.id).then((res) => {
  1835. res.data.data.parentName = parentName;
  1836. this.tableData = [res.data.data];
  1837. this.nodeDetail = Object.assign({}, res.data.data);
  1838. if (this.menuKey === "add") {
  1839. this.nodeDetail.nodeName = "";
  1840. this.nodeDetail.className = "";
  1841. this.nodeDetail.unitName = "";
  1842. this.nodeDetail.partitionCode = "";
  1843. this.nodeDetail.uniqueCode = "";
  1844. }
  1845. });
  1846. this.updateNodeTable();
  1847. //获取节点展开路径
  1848. this.getExpandedKeys(node);
  1849. },
  1850. saveNode() {
  1851. const type = this.wbsType;
  1852. this.$refs["nodeDetail"].validate((valid) => {
  1853. if (valid) {
  1854. const { mixRatioTestIds, nodeType } = this.nodeDetail;
  1855. if (type === 2 && nodeType === 53) {
  1856. if (mixRatioTestIds) {
  1857. if (this.editType == 1) {
  1858. this.addNode();
  1859. } else if (this.editType == 2) {
  1860. this.updateNode();
  1861. }
  1862. } else {
  1863. this.$message({
  1864. type: "error",
  1865. message: "请先选择节点",
  1866. });
  1867. return false;
  1868. }
  1869. } else {
  1870. if (this.editType == 1) {
  1871. this.addNode();
  1872. } else if (this.editType == 2) {
  1873. this.updateNode();
  1874. }
  1875. }
  1876. } else {
  1877. //console.log('error submit!!');
  1878. return false;
  1879. }
  1880. });
  1881. },
  1882. addNode() {
  1883. this.saveNodeLoading = true;
  1884. let subobj = this.nodeDetail;
  1885. subobj.id = "";
  1886. subobj.parentId = this.curTreeData.id;
  1887. subobj.parentName = this.curTreeData.title;
  1888. update(subobj).then(() => {
  1889. this.updateTreeNewNode();
  1890. this.dialogVisible = false;
  1891. this.$message({
  1892. type: "success",
  1893. message: "新增成功!",
  1894. });
  1895. });
  1896. },
  1897. updateNode() {
  1898. console.log("编辑节点");
  1899. update(this.nodeDetail).then(() => {
  1900. let node = this.tableData[0];
  1901. node.nodeName = this.nodeDetail.nodeName;
  1902. node.nodeType = this.nodeDetail.nodeType;
  1903. this.curTreeData.title = this.nodeDetail.nodeName;
  1904. this.dialogVisible = false;
  1905. this.$message({
  1906. type: "success",
  1907. message: "修改成功!",
  1908. });
  1909. });
  1910. },
  1911. toSplit(val) {
  1912. return val ? String(val).split(",") : "";
  1913. },
  1914. setLeftType(type, data, node) {
  1915. this.jiedianId = data.id;
  1916. if (type == 4 || type == 5) {
  1917. this.leftType = type;
  1918. }
  1919. this.curTreeData = data;
  1920. this.curTreeNode = node;
  1921. this.$refs.tree.setCurrentKey(data.id);
  1922. this.mixRatioTestIds = [];
  1923. if (type == 1 || type == 2) {
  1924. this.getMajorDataTypeList();
  1925. this.dialogVisible = true;
  1926. this.editType = type;
  1927. }
  1928. getDetail(data.id).then((res) => {
  1929. let parentName = "";
  1930. if (node.parent.data) {
  1931. parentName = node.parent.data.title;
  1932. }
  1933. res.data.data.parentName = parentName;
  1934. this.tableData = [res.data.data];
  1935. if (type === 1) {
  1936. this.nodeDetail = {
  1937. parentId: res.data.data.id,
  1938. parentName: data.title,
  1939. };
  1940. console.log(this.nodeDetail, " this.nodeDetail");
  1941. } else {
  1942. this.nodeDetail = Object.assign({}, res.data.data);
  1943. this.mixRatioTestIds = this.toSplit(res.data.data.mixRatioTestIds);
  1944. }
  1945. this.nodeDetail.type = 1; // '1'节点 '2'表单
  1946. this.nodeDetail.wbsId = this.id;
  1947. this.nodeDetail.tenantId = this.userInfo.tenant_id;
  1948. this.changeStandType(this.nodeDetail.className);
  1949. });
  1950. if (this.leftType == 4) {
  1951. selectByNodeTable(data.id).then((res) => {
  1952. if (res.data.data.length) {
  1953. this.formData = res.data.data;
  1954. } else {
  1955. this.formData = [];
  1956. }
  1957. });
  1958. }
  1959. //获取节点展开路径
  1960. this.getExpandedKeys(node);
  1961. },
  1962. deleNode(data, node) {
  1963. this.$confirm(
  1964. "此操作将删除节点【" + data.title + "】, 是否继续?",
  1965. "提示",
  1966. {
  1967. confirmButtonText: "确定",
  1968. cancelButtonText: "取消",
  1969. type: "warning",
  1970. }
  1971. )
  1972. .then(() => {
  1973. removeTreeNode(data.id).then(() => {
  1974. this.$refs.tree.remove(node);
  1975. this.$message({
  1976. type: "success",
  1977. message: "删除成功!",
  1978. });
  1979. });
  1980. })
  1981. .catch(() => {});
  1982. },
  1983. showFormElement() {
  1984. if (!this.nodeDetail.id) {
  1985. this.$message({
  1986. type: "warning",
  1987. message: "请先选择在哪个节点下创建表",
  1988. });
  1989. return;
  1990. }
  1991. this.eleForm = {
  1992. elementList: [],
  1993. };
  1994. this.eleVisible = true;
  1995. },
  1996. addEleRow(list) {
  1997. list.push({});
  1998. },
  1999. delEleRow(index, list) {
  2000. list.splice(index, 1);
  2001. },
  2002. saveFormAndElementHandle() {
  2003. this.$refs["eleDialog"].validate((valid) => {
  2004. if (valid) {
  2005. this.eleForm.wbsId = this.id;
  2006. this.eleForm.tenantId = this.userInfo.tenant_id;
  2007. this.eleForm.nodeType = -1;
  2008. this.eleForm.type = 2; // '1'节点 '2'表单
  2009. this.eleForm.parentId = this.nodeDetail.id;
  2010. for (let i = 0; i < this.eleForm.elementList.length; i++) {
  2011. if (!this.eleForm.elementList[i].eName) {
  2012. this.$message({
  2013. type: "warning",
  2014. message: "请填写第" + (i + 1) + "条元素名称",
  2015. });
  2016. return;
  2017. }
  2018. if (!this.eleForm.elementList[i].eType) {
  2019. this.$message({
  2020. type: "warning",
  2021. message: "请选择第" + (i + 1) + "条数据类型",
  2022. });
  2023. return;
  2024. }
  2025. if (!this.eleForm.elementList[i].eLength) {
  2026. this.$message({
  2027. type: "warning",
  2028. message: "请填写第" + (i + 1) + "条长度",
  2029. });
  2030. return;
  2031. }
  2032. }
  2033. this.eleForm.elementList.forEach((element) => {
  2034. element.eAllowDeviation =
  2035. (element.allow ? element.allow : "") +
  2036. (element.deviation ? element.deviation : "");
  2037. // if (element.eType == 4) {
  2038. // this.$set(element, 'eLength', 0);
  2039. // //element.eLength = 0;
  2040. // }
  2041. });
  2042. saveFormAndElement(this.eleForm).then(() => {
  2043. //console.log(res)
  2044. //this.updateTreeNewNode();
  2045. this.updateNodeTable();
  2046. this.eleVisible = false;
  2047. this.$message({
  2048. type: "success",
  2049. message: "新增成功!",
  2050. });
  2051. });
  2052. } else {
  2053. //console.log('error submit!!');
  2054. return false;
  2055. }
  2056. });
  2057. },
  2058. updateTreeNewNode() {
  2059. let detail = this.nodeDetail.parentId
  2060. ? this.nodeDetail
  2061. : this.curTreeData;
  2062. getLazytree(this.id, detail.parentId).then((res) => {
  2063. let node = this.$refs.tree.getNode(detail.parentId);
  2064. node.isLeaf = false;
  2065. node.isLeafByUser = false;
  2066. //console.log(node)
  2067. this.$refs.tree.updateKeyChildren(detail.parentId, res.data.data);
  2068. });
  2069. },
  2070. updateNodeTable() {
  2071. selectByNodeTable(this.curTreeData.id).then((res) => {
  2072. if (res.data.data && res.data.data.length) {
  2073. this.formData = res.data.data;
  2074. } else {
  2075. this.formData = [];
  2076. }
  2077. });
  2078. },
  2079. importHandle() {},
  2080. //获取编辑元素表格数据
  2081. getSelectFormElements() {
  2082. this.editEleloading = true;
  2083. selectFormElements(this.curEleTable.id, {
  2084. type: 1,
  2085. search: this.searchinput,
  2086. }).then((res) => {
  2087. res.data.data.forEach((element) => {
  2088. this.eleReg.exec(element.eAllowDeviation);
  2089. element.allow = RegExp.$1 ? RegExp.$1 : "";
  2090. element.deviation = RegExp.$2 ? RegExp.$2 : "";
  2091. });
  2092. this.editEleloading = false;
  2093. this.editEleList = res.data.data;
  2094. });
  2095. },
  2096. //编辑元素搜索相关
  2097. clearsearchinput() {
  2098. this.getSelectFormElements();
  2099. },
  2100. searchinputChange() {
  2101. this.getSelectFormElements();
  2102. },
  2103. handleEdit(index, row) {
  2104. this.curEleTable = row;
  2105. // selectFormElements(this.curEleTable.id,{type:1}).then((res) => {
  2106. // res.data.data.forEach((element) => {
  2107. // this.eleReg.exec(element.eAllowDeviation);
  2108. // element.allow = RegExp.$1 ? RegExp.$1 : '';
  2109. // element.deviation = RegExp.$2 ? RegExp.$2 : '';
  2110. // })
  2111. // this.editEleList = res.data.data;
  2112. // })
  2113. this.getSelectFormElements();
  2114. this.editEleVisible = true;
  2115. },
  2116. handleDelete(index, row) {
  2117. this.$confirm("是否删除 " + row.tableName + " ?", "删除元素表", {
  2118. distinguishCancelAndClose: true,
  2119. confirmButtonText: "删除",
  2120. cancelButtonText: "取消",
  2121. }).then(() => {
  2122. removeTableById(row.id).then((res) => {
  2123. //console.log(res)
  2124. if (res.data.success) {
  2125. this.formData.splice(index, 1);
  2126. //this.updateTreeNewNode();
  2127. this.$message({
  2128. type: "success",
  2129. message: "删除成功!",
  2130. });
  2131. } else {
  2132. this.$message({
  2133. type: "error",
  2134. message: res.data.msg,
  2135. });
  2136. }
  2137. });
  2138. });
  2139. },
  2140. handleEditFormula(index, row) {
  2141. this.curEleTable = row;
  2142. selectFormElements(this.curEleTable.id, { type: 1 }).then((res) => {
  2143. this.editEleListFilter = res.data.data;
  2144. this.editEleListAll = [].concat(this.editEleListFilter);
  2145. });
  2146. this.editEleFormulaVisible = true;
  2147. },
  2148. //搜索 筛选
  2149. searchFormulaName() {
  2150. this.editEleListFilter = this.editEleListAll.filter((ele) => {
  2151. return ele.eName.indexOf(this.formulaInput) > -1;
  2152. });
  2153. },
  2154. saveNewEle(row) {
  2155. if (!row.eName) {
  2156. this.$message({
  2157. type: "warning",
  2158. message: "请填写元素名称",
  2159. });
  2160. return;
  2161. }
  2162. if (!row.eType) {
  2163. this.$message({
  2164. type: "warning",
  2165. message: "请选择数据类型",
  2166. });
  2167. return;
  2168. }
  2169. row.eAllowDeviation =
  2170. (row.allow ? row.allow : "") + (row.deviation ? row.deviation : "");
  2171. row.fId = this.curEleTable.initTableId;
  2172. row.initTableName = this.curEleTable.initTableName;
  2173. // if (row.eType == 4) {
  2174. // this.$set(row, 'eLength', 0);
  2175. // //row.eLength = 0;
  2176. // } else
  2177. if (!row.eLength) {
  2178. this.$message({
  2179. type: "warning",
  2180. message: "请填写长度",
  2181. });
  2182. return;
  2183. }
  2184. saveElement(row).then((res) => {
  2185. if (res.data.data) {
  2186. this.$set(row, "id", res.data.data.id);
  2187. this.$set(row, "ekey", res.data.data.ekey);
  2188. this.$message({
  2189. type: "success",
  2190. message: "保存成功!",
  2191. });
  2192. }
  2193. });
  2194. },
  2195. delEleRowHandle(index, list) {
  2196. let row = list[index];
  2197. if (row.id) {
  2198. //有id需要请求删除
  2199. this.$confirm("是否确认删除?", "删除元素", {
  2200. distinguishCancelAndClose: true,
  2201. confirmButtonText: "删除",
  2202. cancelButtonText: "取消",
  2203. }).then(() => {
  2204. removeElement(row.id, this.curEleTable.initTableName, row.ekey).then(
  2205. () => {
  2206. list.splice(index, 1);
  2207. }
  2208. );
  2209. this.curEleTable.elementTotal--;
  2210. });
  2211. } else {
  2212. list.splice(index, 1);
  2213. }
  2214. },
  2215. saveEles() {
  2216. for (let i = 0; i < this.editEleList.length; i++) {
  2217. if (!this.editEleList[i].id) {
  2218. this.$message({
  2219. type: "warning",
  2220. message: "请先将新增的元素点击保存",
  2221. });
  2222. return;
  2223. }
  2224. if (!this.editEleList[i].eName) {
  2225. this.$message({
  2226. type: "warning",
  2227. message: "请填写第" + (i + 1) + "条元素名称",
  2228. });
  2229. return;
  2230. }
  2231. if (!this.editEleList[i].eType) {
  2232. this.$message({
  2233. type: "warning",
  2234. message: "请选择第" + (i + 1) + "条数据类型",
  2235. });
  2236. return;
  2237. }
  2238. if (!this.editEleList[i].eLength) {
  2239. this.$message({
  2240. type: "warning",
  2241. message: "请填写第" + (i + 1) + "条长度",
  2242. });
  2243. return;
  2244. }
  2245. }
  2246. if (this.editEleList.length > 0) {
  2247. this.editEleList.forEach((element) => {
  2248. element.eAllowDeviation =
  2249. (element.allow ? element.allow : "") +
  2250. (element.deviation ? element.deviation : "");
  2251. // if (element.eType == 4) {
  2252. // this.$set(element, 'eLength', 0);
  2253. // //element.eLength = 0;
  2254. // }
  2255. });
  2256. updateBatchElements(
  2257. this.editEleList,
  2258. this.curEleTable.initTableName
  2259. ).then(() => {
  2260. this.editEleVisible = false;
  2261. this.updateNodeTable();
  2262. this.$message({
  2263. type: "success",
  2264. message: "保存成功!",
  2265. });
  2266. });
  2267. } else {
  2268. this.editEleVisible = false;
  2269. this.updateNodeTable();
  2270. this.$message({
  2271. type: "success",
  2272. message: "保存成功!",
  2273. });
  2274. }
  2275. },
  2276. nodeTypeChange(val) {
  2277. if (val === 53) {
  2278. if (this.testTreeData.length > 0) {
  2279. return;
  2280. }
  2281. this.testTreeLoad = true;
  2282. getAlltree(this.userInfo.tenant_id, 1, this.id).then((res) => {
  2283. this.testTreeLoad = false;
  2284. this.testTreeData = res.data.data;
  2285. });
  2286. }
  2287. },
  2288. //根据逗号联合
  2289. toJoin(arr) {
  2290. return arr ? arr.join() : "";
  2291. },
  2292. TestTreeCheckChange(_, { checkedKeys, halfCheckedKeys }) {
  2293. // const newarr = [...checkedKeys, ...halfCheckedKeys]
  2294. const newarr = [...checkedKeys];
  2295. this.nodeDetail.mixRatioTestIds = this.toJoin(newarr);
  2296. },
  2297. // filterChange () {
  2298. // if (this.treeData.length > 0) {
  2299. // this.$refs.treeall.filter(this.filterText);
  2300. // return;
  2301. // }
  2302. // this.treeLoad = true;
  2303. // getAlltree(this.userInfo.tenant_id, 1, this.id).then((res) => {
  2304. // this.treeLoad = false;
  2305. // this.treeData = res.data.data;
  2306. // this.$nextTick(() => {
  2307. // this.$refs.treeall.filter(this.filterText);
  2308. // })
  2309. // })
  2310. // },
  2311. importTemplate(data) {
  2312. this.importTemplateVisible = true;
  2313. this.curTreeData = data;
  2314. },
  2315. daoruClose() {
  2316. this.upFile = null;
  2317. },
  2318. importTemplateHandle() {
  2319. if (!this.upFile) {
  2320. this.$message({
  2321. type: "warning",
  2322. message: "请先选择文件再进行导入",
  2323. });
  2324. return;
  2325. }
  2326. let forms = new FormData();
  2327. forms.append("excelFile", this.upFile);
  2328. let wbsTreeFu = {
  2329. wbsId: this.id,
  2330. parentId: this.curTreeData.id,
  2331. // ancestors:'0,'+this.curTreeData.id,
  2332. };
  2333. let json = JSON.stringify(wbsTreeFu);
  2334. let blob = new Blob([json], { type: "application/json" });
  2335. forms.append("wbsTreeFu", blob);
  2336. this.importLoading = true;
  2337. importWbsTree(forms)
  2338. .then(() => {
  2339. //this.$router.go(0)
  2340. let node = this.$refs.tree.getNode(this.curTreeData.id);
  2341. node.isLeaf = false;
  2342. this.importTemplateVisible = false;
  2343. this.upFile = null;
  2344. })
  2345. .finally(() => {
  2346. this.importLoading = false;
  2347. });
  2348. },
  2349. handleDownload() {
  2350. //WBS划分模板
  2351. exportTemplate().then((res) => {
  2352. this.downloadExcel(res.data, "WBS划分模板");
  2353. });
  2354. },
  2355. fileClick() {
  2356. this.$refs.file.click();
  2357. },
  2358. fileChange(e) {
  2359. const file = e.target.files[0];
  2360. if (!file) {
  2361. // 如果用户没有选择图片,只是点了文件上传这个按钮
  2362. return;
  2363. }
  2364. //console.log(file)
  2365. this.upFile = file;
  2366. },
  2367. downloadTmp() {
  2368. getTemplate().then((res) => {
  2369. //console.log(res)
  2370. this.downloadExcel(res.data, "元素模板");
  2371. });
  2372. },
  2373. fileClick2() {
  2374. this.$refs.file2.click();
  2375. },
  2376. tmpImport(e) {
  2377. const file = e.target.files[0];
  2378. const formData = new FormData();
  2379. formData.append("file", file);
  2380. //console.log(file.name)
  2381. importWbsElement(formData)
  2382. .then((res) => {
  2383. res.data.data.forEach((element) => {
  2384. element.eName = element.elementName;
  2385. element.eLength = element.elementLength;
  2386. element.eType = Number(element.elementType);
  2387. element.eAllowDeviation = element.elementAllowDeviation;
  2388. element.eInspectionMethod = element.elementInspectionMethod;
  2389. if (element.eAllowDeviation.indexOf(",") > 0) {
  2390. element.allow = "【】";
  2391. element.deviation = element.eAllowDeviation;
  2392. } else {
  2393. this.eleReg.exec(element.eAllowDeviation);
  2394. // console.log(RegExp.$1)
  2395. // console.log(RegExp.$2)
  2396. element.allow = RegExp.$1 ? RegExp.$1 : "";
  2397. element.deviation = RegExp.$2 ? RegExp.$2 : "";
  2398. }
  2399. });
  2400. this.eleForm.elementList = res.data.data;
  2401. this.importVisible = false;
  2402. })
  2403. .finally(() => {
  2404. e.target.value = "";
  2405. });
  2406. },
  2407. visiblechange(value, data) {
  2408. this.$set(data, "moreShow", value);
  2409. },
  2410. downloadExcel(data, filename = "") {
  2411. let blob = new Blob([data], {
  2412. type: "application/vnd.ms-excel",
  2413. });
  2414. //console.log(blob)
  2415. if (!filename) {
  2416. filename = Date.parse(new Date());
  2417. }
  2418. filename = filename + ".xls";
  2419. if (window.navigator.msSaveOrOpenBlob) {
  2420. // 兼容IE10
  2421. window.navigator.msSaveBlob(blob, filename);
  2422. } else {
  2423. // 兼容chrome/firefox
  2424. let aTag = document.createElement("a");
  2425. aTag.download = filename;
  2426. aTag.href = window.URL.createObjectURL(blob);
  2427. aTag.click();
  2428. URL.revokeObjectURL(aTag.href);
  2429. }
  2430. },
  2431. toFormulaEdit(row, type) {
  2432. // this.$router.push({
  2433. // path: '/formula/edit',
  2434. // query: {
  2435. // wbsid: this.id,
  2436. // eleid: row.id,
  2437. // nodeid:this.curTreeData.id
  2438. // }
  2439. // });
  2440. //this.editEleFormulaVisible = false;
  2441. this.curEleTable = row;
  2442. this.formulaCurRow = row;
  2443. this.formulaCurRow.globaltype = type;
  2444. if (type === 1) {
  2445. this.formulaCompVisible1 = true;
  2446. this.formulaCurRow.elementType = false;
  2447. } else {
  2448. this.formulaCompVisible = true;
  2449. }
  2450. },
  2451. getNodeTypelist() {
  2452. const type = this.wbsType;
  2453. console.log(this.nodeTypelist, "this.nodeTypelist");
  2454. if (this.nodeTypelist.length > 1) {
  2455. return;
  2456. }
  2457. let code = "";
  2458. if (type === 5) {
  2459. code = "lar_node_type"; //征拆
  2460. } else if (type === 2) {
  2461. code = "trial_node_type"; //试验
  2462. } else if (type === 3) {
  2463. code = "meter_node_type"; //计量
  2464. } else {
  2465. {
  2466. code = "wbs_node_type"; //质检
  2467. }
  2468. }
  2469. getDictionary({
  2470. code,
  2471. }).then((res) => {
  2472. res.data.data.forEach((element) => {
  2473. element.dictKey = Number(element.dictKey);
  2474. });
  2475. this.nodeTypelist = res.data.data;
  2476. });
  2477. },
  2478. getMajorDataTypeList() {
  2479. getDictionary({
  2480. code: "major_data_type",
  2481. }).then((res) => {
  2482. res.data.data.forEach((element) => {
  2483. element.dictKey = Number(element.dictKey);
  2484. });
  2485. this.majorDataTypeList = res.data.data;
  2486. });
  2487. },
  2488. getStandardTypeOptions() {
  2489. getDictionary({
  2490. code: "classification",
  2491. }).then((res) => {
  2492. res.data.data.forEach((element) => {
  2493. element.dictKey = Number(element.dictKey);
  2494. });
  2495. // 定义要过滤的 dictKey 值
  2496. const targetKeys = [1, 2, 3, 4, 5];
  2497. // 过滤数组
  2498. const filteredOptions = res.data.data.filter((item) =>
  2499. targetKeys.includes(item.dictKey)
  2500. );
  2501. this.standardTypeOptions = filteredOptions;
  2502. });
  2503. },
  2504. changeStandType(val) {
  2505. let parentId = "";
  2506. this.standardTypeOptions.forEach((item) => {
  2507. if (item.dictKey == val) {
  2508. parentId = item.id; // 找到匹配项,提取 parentId
  2509. }
  2510. });
  2511. getChildList(1, 10000, parentId).then((res) => {
  2512. res.data.data.forEach((element) => {
  2513. element.dictKey = Number(element.dictKey);
  2514. });
  2515. this.unitOptions = res.data.data;
  2516. this.unitOptions = this.unitOptions.filter(
  2517. (item) => item.dictKey != -1
  2518. );
  2519. });
  2520. },
  2521. getTableTypelist() {
  2522. const type = this.wbsType;
  2523. if (this.tableTypelist.length > 1) {
  2524. return;
  2525. }
  2526. let code = "";
  2527. if (type === 5) {
  2528. code = "table_type"; //征拆
  2529. } else if (type === 2) {
  2530. code = "trial_table_type"; //试验
  2531. } else {
  2532. code = "table_type"; //质检
  2533. }
  2534. getDictionary({
  2535. // code: "table_type",
  2536. code: code,
  2537. }).then((res) => {
  2538. res.data.data.forEach((element) => {
  2539. element.dictKey = Number(element.dictKey);
  2540. });
  2541. this.tableTypelist = res.data.data;
  2542. });
  2543. },
  2544. getDataTypelist() {
  2545. if (this.dataTypeList.length > 1) {
  2546. return;
  2547. }
  2548. getDictionary({
  2549. code: "data_type",
  2550. }).then((res) => {
  2551. res.data.data.forEach((element) => {
  2552. element.dictKey = Number(element.dictKey);
  2553. });
  2554. this.dataTypeList = res.data.data;
  2555. });
  2556. },
  2557. getDictTypelist() {
  2558. if (this.dynamicDictList.length > 1) {
  2559. return;
  2560. }
  2561. getDictionary({
  2562. code: "land_field_dict",
  2563. }).then((res) => {
  2564. res.data.data.forEach((element) => {
  2565. element.dictKey = Number(element.dictKey);
  2566. });
  2567. this.dynamicDictList = res.data.data;
  2568. });
  2569. },
  2570. getOwnerTypelist() {
  2571. if (this.ownerTypeList.length > 1) {
  2572. return;
  2573. }
  2574. getDictionary({
  2575. code: "owner_type",
  2576. }).then((res) => {
  2577. res.data.data.forEach((element) => {
  2578. element.dictKey = Number(element.dictKey);
  2579. });
  2580. this.ownerTypeList = res.data.data;
  2581. });
  2582. },
  2583. formatCat(row, column, cellValue) {
  2584. for (let i = 0; i < this.nodeTypelist.length; i++) {
  2585. if (this.nodeTypelist[i].dictKey == cellValue) {
  2586. return this.nodeTypelist[i].dictValue;
  2587. }
  2588. }
  2589. return cellValue;
  2590. //console.log(cellValue)
  2591. },
  2592. formatTableType(row, column, cellValue) {
  2593. for (let i = 0; i < this.tableTypelist.length; i++) {
  2594. if (this.tableTypelist[i].dictKey == cellValue) {
  2595. return this.tableTypelist[i].dictValue;
  2596. }
  2597. }
  2598. return cellValue;
  2599. //console.log(cellValue)
  2600. },
  2601. formatOwner(row, column, cellValue) {
  2602. for (let i = 0; i < this.ownerTypeList.length; i++) {
  2603. if (this.ownerTypeList[i].dictKey == cellValue) {
  2604. return this.ownerTypeList[i].dictValue;
  2605. }
  2606. }
  2607. return cellValue;
  2608. //console.log(cellValue)
  2609. },
  2610. formatdataType(row, column, cellValue) {
  2611. for (let i = 0; i < this.dataTypeList.length; i++) {
  2612. if (this.dataTypeList[i].dictKey == cellValue) {
  2613. return this.dataTypeList[i].dictValue;
  2614. }
  2615. }
  2616. return cellValue;
  2617. //console.log(cellValue)
  2618. },
  2619. // filterNode (value, data) {
  2620. // //console.log(value)
  2621. // if (!value) return true;
  2622. // return data.title.indexOf(value) !== -1;
  2623. // },
  2624. getReturnNode(node, _array, value) {
  2625. let isPass =
  2626. node.data && node.data.title && node.data.title.indexOf(value) !== -1;
  2627. isPass ? _array.push(isPass) : "";
  2628. if (!isPass && node.level != 1 && node.parent) {
  2629. this.getReturnNode(node.parent, _array, value);
  2630. }
  2631. },
  2632. filterNode(value, data, node) {
  2633. if (!value) {
  2634. return true;
  2635. }
  2636. let level = node.level;
  2637. let _array = []; //这里使用数组存储 只是为了存储值。
  2638. this.getReturnNode(node, _array, value);
  2639. let result = false;
  2640. _array.forEach((item) => {
  2641. result = result || item;
  2642. });
  2643. return result;
  2644. },
  2645. //修改数据类型,给个默认值
  2646. setDefaultLength(row) {
  2647. this.$set(row, "eLength", this.dataTypeDefaultMap[row.eType]);
  2648. },
  2649. //#endregion
  2650. //#region 节点参数
  2651. nodeInfo(data) {
  2652. //节点参数按钮
  2653. this.keymap();
  2654. this.jiedianId = data.id;
  2655. this.parameters(data.id);
  2656. this.nodeInfoVisible = true;
  2657. },
  2658. closenodeInfoVisible() {
  2659. this.nodeInfoTable = [];
  2660. this.nodeInfoVisible = false;
  2661. },
  2662. addNodeInfoTable() {
  2663. //添加节点参数数据
  2664. this.nodeInfoTable.unshift({
  2665. k: "",
  2666. v: "",
  2667. remark: "",
  2668. nodeId: this.jiedianId,
  2669. type: 1,
  2670. });
  2671. },
  2672. refreshnfoTable() {
  2673. //刷新表格
  2674. let prams = {
  2675. nodeId: this.jiedianId,
  2676. type: 0,
  2677. };
  2678. this.nodeInfoTableLoad = true;
  2679. refrehPram(prams).then((res) => {
  2680. console.log(res);
  2681. if (res.data.code == 200) {
  2682. this.nodeInfoTableLoad = false;
  2683. this.$message.success("刷新成功");
  2684. }
  2685. });
  2686. },
  2687. delNodeInfo(key, obj) {
  2688. //设置参数名称中的删除按钮
  2689. this.delids.push(obj.id);
  2690. this.namelists.splice(key, 1);
  2691. },
  2692. delNodeInfoss(key, obj) {
  2693. //节点参数
  2694. this.delids.push(obj.id);
  2695. this.nodeInfoTable.splice(key, 1);
  2696. },
  2697. setNodeParameters() {
  2698. //打开设置节点参数弹框按钮
  2699. this.infoNameVisible = true;
  2700. this.namelists = [...this.namelist];
  2701. },
  2702. async setParameterName() {
  2703. //设置参数名称中添加节点参数按钮
  2704. // wbsId: this.jiedianId
  2705. this.namelists.unshift({
  2706. name: "",
  2707. remark: "",
  2708. k: "",
  2709. type: 0,
  2710. nodeId: this.jiedianId,
  2711. });
  2712. },
  2713. async nodeInfoSave() {
  2714. //节点参数弹框保存按钮
  2715. if (this.nodeInfoTable) {
  2716. // if(this.nodeInfoTable.length == 0){
  2717. // await this.saveOrUpdateBatch({projectId:this.projectid,nodeId:this.jiedianId,type:1,delIds:this.delids,wps:[
  2718. // {
  2719. // nodeId: this.jiedianId,
  2720. // type: -1,
  2721. // },
  2722. // ]})
  2723. // this.delIds=[];
  2724. // this.nodeInfoVisible = false
  2725. // this.$message({
  2726. // type: "success",
  2727. // message: "保存参数节点成功!"
  2728. // })
  2729. // return;
  2730. // }
  2731. let tag = true;
  2732. this.nodeInfoTable.forEach((val) => {
  2733. if (!val.k | !val.v) {
  2734. return (tag = false);
  2735. }
  2736. //if(!val.name){
  2737. for (let i = 0; i < this.namelist.length; i++) {
  2738. if (this.namelist[i].k == val.k) {
  2739. val.name = this.namelist[i].name;
  2740. return;
  2741. }
  2742. }
  2743. //}
  2744. });
  2745. if (tag) {
  2746. this.nodeInfoSaveload = true;
  2747. await this.saveOrUpdateBatch({
  2748. scopeType: 1,
  2749. projectId: this.projectid,
  2750. nodeId: this.jiedianId,
  2751. wps: this.nodeInfoTable,
  2752. type: 1,
  2753. delIds: this.delids,
  2754. });
  2755. this.delIds = [];
  2756. this.$message({
  2757. type: "success",
  2758. message: "设置参数节点成功!",
  2759. });
  2760. this.nodeInfoSaveload = false;
  2761. // this.nodeInfoVisible = false;
  2762. this.parameters(this.jiedianId);
  2763. } else {
  2764. this.$message({
  2765. type: "error",
  2766. message: "请填写所有的参数名称和参数值!",
  2767. });
  2768. }
  2769. } else {
  2770. this.$message({
  2771. type: "error",
  2772. message: "请先设置参数节点!",
  2773. });
  2774. }
  2775. },
  2776. async addParameterName() {
  2777. //设置参数名称中的保存按钮
  2778. if (this.namelists.length) {
  2779. let tag = true;
  2780. this.namelists.forEach((val) => {
  2781. if (!val.name || !val.k) {
  2782. return (tag = false);
  2783. }
  2784. });
  2785. if (tag) {
  2786. await this.saveOrUpdateBatch({
  2787. scopeType: 1,
  2788. projectId: this.projectid,
  2789. nodeId: this.jiedianId,
  2790. wps: this.namelists,
  2791. type: 0,
  2792. delIds: this.delids,
  2793. }); //保存设置参数
  2794. this.infoNameVisible = false;
  2795. this.delIds = [];
  2796. this.keymap();
  2797. } else {
  2798. this.$message({
  2799. type: "error",
  2800. message: "请填写所有的参数名称和参数值KEY!",
  2801. });
  2802. }
  2803. } else {
  2804. this.$message({
  2805. type: "warning",
  2806. message: "请先添加参数",
  2807. });
  2808. }
  2809. },
  2810. closeParameter() {
  2811. //设置参数名称,关闭按钮
  2812. this.namelists = [];
  2813. this.infoNameVisible = false;
  2814. },
  2815. async parameters(wbsId) {
  2816. //获取接待你参数列表
  2817. const { data: res } = await parameters({ wbsId });
  2818. console.log(res);
  2819. if (res.code == 200) {
  2820. if (Array.isArray(res.data)) {
  2821. this.nodeInfoTable = res.data;
  2822. }
  2823. }
  2824. },
  2825. async saveOrUpdateBatch(da) {
  2826. //保存
  2827. const { data: res } = await saveOrUpdateBatch(da);
  2828. this.delids = [];
  2829. //console.log(res);
  2830. },
  2831. async keymap() {
  2832. //节点参数枚举
  2833. const { data: res } = await keymap();
  2834. //console.log(res);
  2835. if (res.code == 200) {
  2836. this.namelist = res.data;
  2837. }
  2838. },
  2839. //#endregion
  2840. //#region 导入元素
  2841. ImportElement(data) {
  2842. //导入元素按钮
  2843. console.log(data);
  2844. this.ImportElementdata.ancestors = data.ancestors;
  2845. this.ImportElementdata.id = data.id;
  2846. this.ImportElementTag = true;
  2847. },
  2848. async pushImportElement() {
  2849. //确定按钮
  2850. if (this.ImportElementFile.length > 0) {
  2851. let formData = new FormData();
  2852. formData.append("wbsId", this.$route.params.id);
  2853. formData.append("ancestors", this.ImportElementdata.ancestors);
  2854. formData.append("id", this.ImportElementdata.id);
  2855. formData.append("tenantId", this.userInfo.tenant_id);
  2856. formData.append("excelFile", this.ImportElementFile[0].raw);
  2857. await this.importwbsTreeFormBatch(formData);
  2858. this.ImportElementFile = [];
  2859. this.ImportElementTag = false;
  2860. }
  2861. },
  2862. ImportElementHandleClose() {
  2863. //关闭弹框事件
  2864. this.ImportElementTag = false;
  2865. this.loding = false;
  2866. this.ImportElementFile = [];
  2867. },
  2868. ElementChange(file, fileList) {
  2869. //文件上传时的钩子
  2870. //console.log(fileList);
  2871. if (this.ImportElementFile.length == 0) {
  2872. this.ImportElementFile = fileList;
  2873. }
  2874. },
  2875. ElementRemove(file, fileList) {
  2876. this.ImportElementFile = fileList;
  2877. },
  2878. async importwbsTreeFormBatch(da) {
  2879. this.loding = true;
  2880. try {
  2881. const { data: res } = await importwbsTreeFormBatch(da);
  2882. console.log(res);
  2883. if (res.code == 200) {
  2884. this.$message({
  2885. type: "success",
  2886. message: "导入成功!",
  2887. });
  2888. }
  2889. this.loding = false;
  2890. } catch (error) {
  2891. this.loding = false;
  2892. }
  2893. },
  2894. async exportBatchTemplate() {
  2895. const res = await exportBatchTemplate();
  2896. //console.log(res);
  2897. if (res.status == 200) {
  2898. this.downloadExcel(res.data, "导入元素模板");
  2899. }
  2900. },
  2901. xiazaielement() {
  2902. this.exportBatchTemplate();
  2903. },
  2904. //#endregion
  2905. //#region 元素表单信息
  2906. editEditElementForm() {
  2907. //标记元素
  2908. if (this.formData.length) {
  2909. let da = [];
  2910. this.formDatass = [...this.formData];
  2911. this.formDatass.forEach((val) => {
  2912. da.push({
  2913. tableType: val.tableType - 0,
  2914. tableOwner: val.tableOwner - 0,
  2915. id: val.id,
  2916. tableName: val.tableName,
  2917. fillRate: val.fillRate,
  2918. });
  2919. });
  2920. this.formDatass = da;
  2921. this.editElementFormTag = true;
  2922. }
  2923. },
  2924. editeditElementFormMF() {
  2925. //保存按钮
  2926. let da = [];
  2927. let tag = true;
  2928. this.formDatass.forEach((val) => {
  2929. if (!val.tableName || !val.tableType || !val.tableOwner) {
  2930. tag = false;
  2931. return;
  2932. } else {
  2933. da.push({
  2934. id: val.id,
  2935. nodeName: val.tableName,
  2936. tableType: val.tableType,
  2937. tableOwner: val.tableOwner,
  2938. fillRate: val.fillRate,
  2939. });
  2940. }
  2941. });
  2942. if (tag) {
  2943. this.updateBatchNodeTableInfo(da);
  2944. } else {
  2945. this.$message({
  2946. type: "success",
  2947. message: "请填写完整元素表单的所有信息!",
  2948. });
  2949. }
  2950. },
  2951. async updateBatchNodeTableInfo(da) {
  2952. //共有编辑元素
  2953. const { data: res } = await updateBatchNodeTableInfo(da);
  2954. //console.log(res);
  2955. if (res.code == 200) {
  2956. this.editElementFormTag = false;
  2957. this.updateNodeTable();
  2958. }
  2959. },
  2960. //#endregion
  2961. //获取节点展开路径
  2962. getExpandedKeys(node) {
  2963. //console.log(node)
  2964. let expandedKeys = [];
  2965. while (node.parent) {
  2966. expandedKeys.push(node.data.id);
  2967. node = node.parent;
  2968. }
  2969. setStore({
  2970. name: this.expandName,
  2971. content: expandedKeys,
  2972. type: true, //sessionStorage
  2973. });
  2974. //console.log(expandedKeys)
  2975. },
  2976. //节点参数 关联元素
  2977. linkEle(row) {
  2978. if (!row.id) {
  2979. this.$message.warning("请先保存数据,再点击关联元素");
  2980. } else {
  2981. this.linkEleVisible = true;
  2982. this.curParam = row;
  2983. getParamElements({
  2984. nodeId: this.jiedianId,
  2985. paramId: row.id,
  2986. scopeType: 1,
  2987. }).then((res) => {
  2988. if (res.data.data.length) {
  2989. this.linkEleTableList = res.data.data;
  2990. } else {
  2991. this.linkEleTableList = [];
  2992. }
  2993. });
  2994. }
  2995. },
  2996. //保存关联
  2997. saveLinks() {},
  2998. //删除关联
  2999. delLink(data) {
  3000. this.$confirm("删除关联, 是否继续?", "提示", {
  3001. confirmButtonText: "确定",
  3002. cancelButtonText: "取消",
  3003. type: "warning",
  3004. })
  3005. .then(() => {
  3006. console.log(data);
  3007. delParamElements(data).then(() => {
  3008. this.$message({
  3009. type: "success",
  3010. message: "删除成功!",
  3011. });
  3012. getParamElements({
  3013. nodeId: this.jiedianId,
  3014. paramId: this.curParam.id,
  3015. scopeType: 1,
  3016. }).then((res) => {
  3017. if (res.data.data.length) {
  3018. this.linkEleTableList = res.data.data;
  3019. } else {
  3020. this.linkEleTableList = [];
  3021. }
  3022. });
  3023. });
  3024. })
  3025. .catch(() => {});
  3026. },
  3027. //关联元素弹框
  3028. tolinkEle(row) {
  3029. this.curLinkEleTable = row;
  3030. this.linkCheckVisible = true;
  3031. selectFormElements(row.id, { nodeId: this.jiedianId, type: 5 }).then(
  3032. (res) => {
  3033. res.data.data.forEach((ele) => {
  3034. ele.checked = false;
  3035. ele.show = true;
  3036. });
  3037. this.linkEleList = res.data.data;
  3038. this.linkEleListAll = [].concat(this.linkEleList);
  3039. }
  3040. );
  3041. },
  3042. linkEleCheck(value, index) {
  3043. //console.log(value)
  3044. if (value) {
  3045. this.linkEleList.forEach((ele, i) => {
  3046. if (i != index) {
  3047. ele.checked = false;
  3048. }
  3049. });
  3050. }
  3051. },
  3052. //关联元素
  3053. saveLinkEle() {
  3054. let target = {};
  3055. this.linkEleList.forEach((e) => {
  3056. if (e.checked == true) {
  3057. target = { elementId: e.id, paramId: this.curParam.id };
  3058. }
  3059. });
  3060. if (JSON.stringify(target) !== "{}") {
  3061. specifiedParamElements(target).then((data) => {
  3062. this.linkCheckVisible = false;
  3063. getParamElements({
  3064. nodeId: this.jiedianId,
  3065. paramId: this.curParam.id,
  3066. scopeType: 1,
  3067. }).then((res) => {
  3068. if (res.data.data.length) {
  3069. this.linkEleTableList = res.data.data;
  3070. } else {
  3071. this.linkEleTableList = [];
  3072. }
  3073. });
  3074. });
  3075. } else {
  3076. this.$message.warning("请先选择关联元素");
  3077. }
  3078. },
  3079. //筛选元素
  3080. searchEle() {
  3081. this.linkEleList = this.linkEleListAll.filter((ele) => {
  3082. return ele.eName.indexOf(this.linkEleKey) > -1;
  3083. });
  3084. },
  3085. //触发节点参数
  3086. nodeInfoHandle() {
  3087. if (!this.curTreeData.id) {
  3088. this.$message({
  3089. type: "warning",
  3090. message: "请先选择节点",
  3091. });
  3092. return;
  3093. }
  3094. this.nodeInfo(this.curTreeData);
  3095. },
  3096. eleFormulaHandle() {
  3097. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3098. this.$message({
  3099. type: "warning",
  3100. message: "请先选择节点",
  3101. });
  3102. return;
  3103. }
  3104. this.setLeftType(4, this.curTreeData, this.curTreeNode);
  3105. },
  3106. addNodeHandle() {
  3107. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3108. this.$message({
  3109. type: "warning",
  3110. message: "请先选择节点",
  3111. });
  3112. return;
  3113. }
  3114. if (
  3115. this.curTreeData.nodeType == 6 ||
  3116. this.curTreeData.isExistForm == 1 ||
  3117. this.curTreeData.unitName ||
  3118. this.curTreeData.className
  3119. ) {
  3120. this.$message({
  3121. type: "warning",
  3122. message: "该节点下无法新增节点",
  3123. });
  3124. return;
  3125. }
  3126. this.mixRatioTestIds = [];
  3127. this.setLeftType(1, this.curTreeData, this.curTreeNode);
  3128. },
  3129. editNodeHandle() {
  3130. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3131. this.$message({
  3132. type: "warning",
  3133. message: "请先选择节点",
  3134. });
  3135. return;
  3136. }
  3137. this.nodeTypeChange(53);
  3138. this.setLeftType(2, this.curTreeData, this.curTreeNode);
  3139. },
  3140. copyNodeHandle() {
  3141. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3142. this.$message({
  3143. type: "warning",
  3144. message: "请先选择节点",
  3145. });
  3146. return;
  3147. }
  3148. },
  3149. delNodeHandle() {
  3150. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3151. this.$message({
  3152. type: "warning",
  3153. message: "请先选择节点",
  3154. });
  3155. return;
  3156. }
  3157. if (this.curTreeNode.level == 1) {
  3158. this.$message({
  3159. type: "warning",
  3160. message: "当前节点无法删除",
  3161. });
  3162. return;
  3163. }
  3164. this.deleNode(this.curTreeData, this.curTreeNode);
  3165. },
  3166. eleHandle() {
  3167. if (!this.curTreeData.id || !this.curTreeNode.id) {
  3168. this.$message({
  3169. type: "warning",
  3170. message: "请先选择节点",
  3171. });
  3172. return;
  3173. }
  3174. this.setLeftType(5, this.curTreeData, this.curTreeNode);
  3175. },
  3176. //显示别名弹窗
  3177. aliasShow() {
  3178. this.aliasVisible = true;
  3179. if (this.nodeDetail.fullName) {
  3180. this.aliasArr = this.nodeDetail.fullName.split(",");
  3181. } else {
  3182. this.aliasArr = [];
  3183. }
  3184. this.aliasInput = "";
  3185. },
  3186. addAlias() {
  3187. if (this.aliasInput) {
  3188. this.aliasArr.push(this.aliasInput);
  3189. this.aliasInput = "";
  3190. }
  3191. },
  3192. delAlias(index) {
  3193. this.aliasArr.splice(index, 1);
  3194. },
  3195. saveAliasHandle() {
  3196. this.nodeDetail.fullName = this.aliasArr.join(",");
  3197. if (this.editType == 1) {
  3198. //新增
  3199. this.aliasVisible = false;
  3200. } else if (this.editType == 2) {
  3201. //编辑 公有
  3202. submitFullName(this.nodeDetail.id, this.nodeDetail.fullName).then(
  3203. () => {
  3204. this.$message({
  3205. type: "success",
  3206. message: "保存成功",
  3207. });
  3208. this.aliasVisible = false;
  3209. }
  3210. );
  3211. }
  3212. },
  3213. //树形控件菜单相关方法
  3214. mouseout() {
  3215. this.menuvisible = false;
  3216. },
  3217. //展示菜单
  3218. showMenu(e, data, node) {
  3219. e.preventDefault();
  3220. console.log(e, "e");
  3221. var x = e.pageX; //这个应该是相对于整个浏览器页面的x坐标,左上角为坐标原点(0,0)
  3222. var y = e.pageY; //这个应该是相对于整个浏览器页面的y坐标,左上角为坐标原点(0,0)
  3223. this.menutop = y;
  3224. this.menuleft = x;
  3225. this.menuvisible = true;
  3226. },
  3227. menuClick(e, item, data) {
  3228. this.menuKey = "";
  3229. e.preventDefault();
  3230. if (item.key === "add") {
  3231. this.addNodeHandle();
  3232. this.menuKey = "add";
  3233. } else if (item.key === "edit") {
  3234. this.editNodeHandle();
  3235. this.menuKey = "edit";
  3236. } else if (item.key === "del") {
  3237. this.menuKey = "del";
  3238. this.delNodeHandle();
  3239. } else if (item.key === "copy") {
  3240. this.$message.info("暂无相关接口");
  3241. } else if (item.key === "sort") {
  3242. this.menuKey = "sort";
  3243. this.paixuMD(data);
  3244. }
  3245. },
  3246. },
  3247. components: {
  3248. ManualSorting,
  3249. FormulaEdit,
  3250. FormulaEditone,
  3251. },
  3252. };
  3253. </script>
  3254. <style scoped lang="scss">
  3255. //树结构超长后产生滚动条
  3256. .el-tree > .el-tree-node {
  3257. min-width: 100%;
  3258. display: inline-block;
  3259. }
  3260. .font-s-12 ::v-deep .iconfont {
  3261. font-size: 12px;
  3262. }
  3263. .el-popper[x-placement^="bottom"] {
  3264. margin-top: -6px;
  3265. }
  3266. .right-btn {
  3267. position: absolute;
  3268. right: 20px;
  3269. top: 10px;
  3270. font-size: 20px;
  3271. }
  3272. .custom-tree-node {
  3273. .normal-black {
  3274. display: none;
  3275. }
  3276. &:hover {
  3277. .normal-black {
  3278. display: inline-block;
  3279. }
  3280. }
  3281. &.show .normal-black {
  3282. display: inline-block;
  3283. }
  3284. }
  3285. .jiedian {
  3286. ::v-deep.el-dialog__body {
  3287. padding: 10px 20px !important;
  3288. }
  3289. }
  3290. .filter-tree {
  3291. min-width: 100%;
  3292. display: inline-block;
  3293. }
  3294. .full-dialog {
  3295. ::v-deep .el-dialog__body {
  3296. padding-bottom: 0;
  3297. }
  3298. ::v-deep .basic-container {
  3299. height: calc(100vh - 60px);
  3300. }
  3301. }
  3302. .titlerow {
  3303. // float: right;
  3304. background-color: rgba(31, 34, 41, 0.8);
  3305. padding-left: 10px;
  3306. padding-right: 10px;
  3307. text-align: right;
  3308. margin-top: -20px;
  3309. margin-left: -20px;
  3310. margin-right: -20px;
  3311. }
  3312. // 树形控件菜单样式
  3313. .contextmenu {
  3314. margin: 0;
  3315. background: #fff;
  3316. z-index: 1000;
  3317. position: fixed; //关键样式设置固定定位
  3318. list-style-type: none;
  3319. padding: 5px 0;
  3320. border-radius: 4px;
  3321. font-size: 12px;
  3322. font-weight: 400;
  3323. color: #333;
  3324. box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
  3325. }
  3326. .contextmenu li {
  3327. margin: 0;
  3328. padding: 7px 16px;
  3329. cursor: pointer;
  3330. }
  3331. .contextmenu li:hover {
  3332. background: #eee;
  3333. }
  3334. </style>