edit.vue 100 KB

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