edit.vue 100 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457
  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.stop="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.stop="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. filterable
  526. v-model="nodeDetail.nodeType"
  527. placeholder="请选择"
  528. class="w-100p"
  529. @change="nodeTypeChange"
  530. >
  531. <el-option
  532. v-for="item in nodeTypelist"
  533. :key="item.id"
  534. :label="item.dictValue"
  535. :value="item.dictKey"
  536. ></el-option>
  537. </el-select>
  538. </el-form-item>
  539. <el-form-item label="划分编号" v-if="wbsType !== 2&&wbsType !== 5&&wbsType !== 3">
  540. <el-input v-model="nodeDetail.partitionCode"></el-input>
  541. </el-form-item>
  542. <el-form-item label="唯一编码" v-if="wbsType !== 5&wbsType !== 3">
  543. <el-input v-model="nodeDetail.uniqueCode"></el-input>
  544. </el-form-item>
  545. <template v-if="nodeDetail.nodeType == 6&&wbsType !== 3">
  546. <el-form-item label="是否有混凝土">
  547. <el-radio-group
  548. v-model="nodeDetail.isConcrete"
  549. size="small"
  550. >
  551. <el-radio
  552. :label="0"
  553. border
  554. >无</el-radio>
  555. <el-radio
  556. :label="1"
  557. border
  558. >有</el-radio>
  559. </el-radio-group>
  560. </el-form-item>
  561. <el-form-item label="是否试验节点">
  562. <el-radio-group
  563. v-model="nodeDetail.isExpernode"
  564. size="small"
  565. >
  566. <el-radio
  567. :label="0"
  568. border
  569. >否</el-radio>
  570. <el-radio
  571. :label="1"
  572. border
  573. >是</el-radio>
  574. </el-radio-group>
  575. </el-form-item>
  576. </template>
  577. <el-form-item label="内业资料类型" prop="majorDataType" v-if="wbsType !== 2&&wbsType!==5&wbsType !== 3">
  578. <el-select
  579. v-model="nodeDetail.majorDataType"
  580. placeholder="请选择"
  581. class="w-100p"
  582. >
  583. <el-option
  584. v-for="item in majorDataTypeList"
  585. :key="item.id"
  586. :label="item.dictValue"
  587. :value="item.dictKey"
  588. ></el-option>
  589. </el-select>
  590. </el-form-item>
  591. <el-form-item label="勾选相关联试验" prop="mixRatioTestIds" v-if="wbsType === 2 && nodeDetail.nodeType === 53">
  592. <div style="position: relative; height: 300px; border: 1px solid #dddfe6;">
  593. <el-scrollbar class="h-100p">
  594. <div v-loading="testTreeLoad">
  595. <el-tree class="filter-tree"
  596. :data="testTreeData"
  597. :props="defaultProps"
  598. :expand-on-click-node="false"
  599. highlight-current
  600. node-key="id"
  601. ref="treeall"
  602. show-checkbox
  603. :default-checked-keys="mixRatioTestIds"
  604. @check="TestTreeCheckChange"
  605. />
  606. </div>
  607. </el-scrollbar>
  608. </div>
  609. </el-form-item>
  610. </el-form>
  611. <span
  612. slot="footer"
  613. class="dialog-footer"
  614. >
  615. <el-button @click="dialogVisible = false">取 消</el-button>
  616. <el-button
  617. type="primary"
  618. @click="saveNode"
  619. :loading="saveNodeLoading"
  620. >确 定</el-button>
  621. </span>
  622. </el-dialog>
  623. <el-dialog
  624. title="创建新的元素表"
  625. :visible.sync="eleVisible"
  626. width="80%"
  627. append-to-body
  628. :close-on-click-modal="false"
  629. >
  630. <el-form
  631. ref="eleDialog"
  632. :model="eleForm"
  633. :rules="eleRules"
  634. label-width="110px"
  635. >
  636. <el-form-item
  637. label="表名"
  638. prop="nodeName"
  639. >
  640. <el-input v-model="eleForm.nodeName"></el-input>
  641. </el-form-item>
  642. <el-row>
  643. <el-col :span="8">
  644. <el-form-item
  645. label="表类型"
  646. prop="tableType"
  647. >
  648. <el-select
  649. v-model="eleForm.tableType"
  650. placeholder="请选择"
  651. class="w-100p"
  652. >
  653. <el-option
  654. v-for="item in tableTypelist"
  655. :key="item.id"
  656. :label="item.dictValue"
  657. :value="item.dictKey"
  658. ></el-option>
  659. </el-select>
  660. </el-form-item>
  661. </el-col>
  662. <el-col :span="8">
  663. <el-form-item
  664. label="所属方"
  665. prop="tableOwner"
  666. >
  667. <el-select
  668. v-model="eleForm.tableOwner"
  669. placeholder="请选择"
  670. class="w-100p"
  671. >
  672. <el-option
  673. v-for="item in ownerTypeList"
  674. :key="item.id"
  675. :label="item.dictValue"
  676. :value="item.dictKey"
  677. ></el-option>
  678. </el-select>
  679. </el-form-item>
  680. </el-col>
  681. <el-col :span="8">
  682. <el-form-item
  683. label="填报率"
  684. prop="fillRate"
  685. >
  686. <el-input v-model="eleForm.fillRate"></el-input>
  687. </el-form-item>
  688. </el-col>
  689. </el-row>
  690. </el-form>
  691. <div class="flex jc-sb">
  692. <div></div>
  693. <div>
  694. <el-link
  695. type="primary"
  696. @click="importVisible = true"
  697. >快捷导入</el-link>
  698. <el-link
  699. type="primary"
  700. class="mg-l-20"
  701. @click="downloadTmp"
  702. >下载导入模版</el-link>
  703. </div>
  704. </div>
  705. <div class="border-grey">
  706. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  707. <el-table
  708. :data="eleForm.elementList"
  709. border
  710. style="width: 100%"
  711. height="400px"
  712. >
  713. <el-table-column
  714. align="center"
  715. type="index"
  716. width="50"
  717. ></el-table-column>
  718. <el-table-column
  719. align="center"
  720. prop="eName"
  721. label="元素名称"
  722. >
  723. <template slot="header">
  724. <i class="required"></i>
  725. <span>元素名称</span>
  726. </template>
  727. <template slot-scope="scope">
  728. <el-input
  729. v-model="scope.row.eName"
  730. size="small"
  731. placeholder="请输入内容"
  732. ></el-input>
  733. </template>
  734. </el-table-column>
  735. <el-table-column
  736. align="center"
  737. prop="eType"
  738. label="数据类型"
  739. width="120"
  740. >
  741. <template slot="header">
  742. <i class="required"></i>
  743. <span>数据类型</span>
  744. </template>
  745. <template slot-scope="scope">
  746. <el-select
  747. v-model="scope.row.eType"
  748. @change="setDefaultLength(scope.row)"
  749. size="small"
  750. placeholder="请选择"
  751. >
  752. <el-option
  753. v-for="item in dataTypeList"
  754. :key="item.id"
  755. :label="item.dictValue"
  756. :value="item.dictKey"
  757. ></el-option>
  758. </el-select>
  759. </template>
  760. </el-table-column>
  761. <el-table-column
  762. align="center"
  763. prop="eLength"
  764. label="长度"
  765. width="120"
  766. >
  767. <template slot="header">
  768. <i class="required"></i>
  769. <span>长度</span>
  770. </template>
  771. <template slot-scope="scope">
  772. <el-input
  773. v-model="scope.row.eLength"
  774. size="small"
  775. placeholder="请输入内容"
  776. ></el-input>
  777. </template>
  778. </el-table-column>
  779. <el-table-column
  780. align="center"
  781. prop="eAllowDeviation"
  782. label="允许偏差值"
  783. >
  784. <template slot-scope="scope">
  785. <div class="flex">
  786. <el-select
  787. v-model="scope.row.allow"
  788. :popper-append-to-body="false"
  789. size="small"
  790. placeholder="请选择"
  791. style="width:120px"
  792. >
  793. <el-option
  794. :key="1"
  795. label="-"
  796. value="-"
  797. ></el-option>
  798. <el-option
  799. :key="2"
  800. label=">"
  801. value=">"
  802. ></el-option>
  803. <el-option
  804. :key="3"
  805. label="<"
  806. value="<"
  807. ></el-option>
  808. <el-option
  809. :key="4"
  810. label="≥"
  811. value="≥"
  812. ></el-option>
  813. <el-option
  814. :key="5"
  815. label="≤"
  816. value="≤"
  817. ></el-option>
  818. <el-option
  819. :key="6"
  820. label="±"
  821. value="±"
  822. ></el-option>
  823. <el-option
  824. :key="7"
  825. label="【】"
  826. value="【】"
  827. ></el-option>
  828. </el-select>
  829. <el-input
  830. v-model="scope.row.deviation"
  831. size="small"
  832. placeholder="请输入内容"
  833. ></el-input>
  834. </div>
  835. </template>
  836. </el-table-column>
  837. <el-table-column
  838. align="center"
  839. prop="eInspectionMethod"
  840. label="检查方法和频率"
  841. >
  842. <template slot-scope="scope">
  843. <el-input
  844. v-model="scope.row.eInspectionMethod"
  845. size="small"
  846. placeholder="请输入内容"
  847. ></el-input>
  848. </template>
  849. </el-table-column>
  850. <el-table-column
  851. align="center"
  852. label="操作"
  853. width="80"
  854. >
  855. <template slot="header">
  856. <el-button
  857. @click="addEleRow(eleForm.elementList)"
  858. type="text"
  859. icon="el-icon-circle-plus-outline"
  860. class="text-icon"
  861. ></el-button>
  862. </template>
  863. <template slot-scope="scope">
  864. <el-button
  865. icon="el-icon-remove-outline"
  866. type="text"
  867. @click="delEleRow(scope.$index,eleForm.elementList)"
  868. class="text-icon text-icon-danger"
  869. ></el-button>
  870. </template>
  871. </el-table-column>
  872. </el-table>
  873. </div>
  874. <span
  875. slot="footer"
  876. class="dialog-footer"
  877. >
  878. <el-button @click="eleVisible = false">取 消</el-button>
  879. <el-button
  880. type="primary"
  881. @click="saveFormAndElementHandle"
  882. >保 存</el-button>
  883. </span>
  884. </el-dialog>
  885. <el-dialog
  886. title="模版导入"
  887. :visible.sync="importVisible"
  888. width="50%"
  889. append-to-body
  890. :close-on-click-modal="false"
  891. >
  892. <p>提示:必须按照系统要求的模版格式上传,否则系统识别无效 <el-link
  893. type="primary"
  894. @click="downloadTmp"
  895. >下载导入模版</el-link>
  896. </p>
  897. <div>
  898. <el-button
  899. size="small"
  900. type="primary"
  901. @click="fileClick2"
  902. >本地上传</el-button>
  903. <input
  904. @change="tmpImport"
  905. type="file"
  906. hidden
  907. ref="file2"
  908. accept=".xls, .xlsx"
  909. >
  910. </div>
  911. <el-table
  912. :data="tempList"
  913. border
  914. style="width: 100%"
  915. >
  916. <el-table-column
  917. align="center"
  918. prop="eName"
  919. label="元素名称"
  920. >
  921. </el-table-column>
  922. <el-table-column
  923. align="center"
  924. prop="eType"
  925. label="数据类型"
  926. width="120"
  927. >
  928. </el-table-column>
  929. <el-table-column
  930. align="center"
  931. prop="eLength"
  932. label="长度"
  933. width="120"
  934. >
  935. </el-table-column>
  936. <el-table-column
  937. align="center"
  938. prop="eAllowDeviation"
  939. label="允许偏差值"
  940. >
  941. </el-table-column>
  942. <el-table-column
  943. align="center"
  944. prop="eInspectionMethod"
  945. label="检查方法和频率"
  946. >
  947. </el-table-column>
  948. </el-table>
  949. <span
  950. slot="footer"
  951. class="dialog-footer"
  952. >
  953. <el-button @click="importVisible = false">取 消</el-button>
  954. <el-button
  955. type="primary"
  956. @click="importHandle"
  957. >确 定</el-button>
  958. </span>
  959. </el-dialog>
  960. <el-dialog
  961. :title="(curEleTable.tableName?curEleTable.tableName:'')+' 元素编辑'"
  962. :visible.sync="editEleVisible"
  963. width="80%"
  964. append-to-body
  965. :close-on-click-modal="false"
  966. >
  967. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  968. <div style="display:flex;margin-bottom:10px">
  969. <el-input placeholder="请输入你想编辑的元素名称" v-model="searchinput" :size="size" clearable @clear="clearsearchinput" > </el-input>
  970. <el-button type="primary" icon="el-icon-search" size="small" @click="searchinputChange">搜索</el-button>
  971. </div>
  972. <el-table
  973. :data="editEleList"
  974. border
  975. style="width: 100%"
  976. height="400px"
  977. v-loading="editEleloading"
  978. >
  979. <el-table-column
  980. align="center"
  981. type="index"
  982. width="50"
  983. ></el-table-column>
  984. <el-table-column
  985. align="center"
  986. prop="eName"
  987. label="元素名称"
  988. >
  989. <template slot="header">
  990. <i class="required"></i>
  991. <span>元素名称</span>
  992. </template>
  993. <template slot-scope="scope">
  994. <el-input
  995. v-model="scope.row.eName"
  996. size="small"
  997. placeholder="请输入内容"
  998. ></el-input>
  999. </template>
  1000. </el-table-column>
  1001. <el-table-column
  1002. align="center"
  1003. prop="eType"
  1004. label="数据类型"
  1005. width="120"
  1006. >
  1007. <template slot="header">
  1008. <i class="required"></i>
  1009. <span>数据类型</span>
  1010. </template>
  1011. <template slot-scope="scope">
  1012. <el-select
  1013. v-model="scope.row.eType"
  1014. @change="setDefaultLength(scope.row)"
  1015. size="small"
  1016. placeholder="请选择"
  1017. >
  1018. <el-option
  1019. v-for="item in dataTypeList"
  1020. :key="item.id"
  1021. :label="item.dictValue"
  1022. :value="item.dictKey"
  1023. ></el-option>
  1024. </el-select>
  1025. </template>
  1026. </el-table-column>
  1027. <el-table-column
  1028. align="center"
  1029. prop="eLength"
  1030. label="长度"
  1031. width="120"
  1032. >
  1033. <template slot="header">
  1034. <i class="required"></i>
  1035. <span>长度</span>
  1036. </template>
  1037. <template slot-scope="scope">
  1038. <el-input
  1039. v-model="scope.row.eLength"
  1040. size="small"
  1041. placeholder="请输入内容"
  1042. ></el-input>
  1043. </template>
  1044. </el-table-column>
  1045. <el-table-column
  1046. align="center"
  1047. prop="eAllowDeviation"
  1048. label="允许偏差值"
  1049. >
  1050. <template slot-scope="scope">
  1051. <div class="flex">
  1052. <el-select
  1053. v-model="scope.row.allow"
  1054. size="small"
  1055. placeholder="请选择"
  1056. style="width:120px"
  1057. >
  1058. <el-option
  1059. :key="1"
  1060. label="-"
  1061. value="-"
  1062. ></el-option>
  1063. <el-option
  1064. :key="2"
  1065. label=">"
  1066. value=">"
  1067. ></el-option>
  1068. <el-option
  1069. :key="3"
  1070. label="<"
  1071. value="<"
  1072. ></el-option>
  1073. <el-option
  1074. :key="4"
  1075. label="≥"
  1076. value="≥"
  1077. ></el-option>
  1078. <el-option
  1079. :key="5"
  1080. label="≤"
  1081. value="≤"
  1082. ></el-option>
  1083. <el-option
  1084. :key="6"
  1085. label="±"
  1086. value="±"
  1087. ></el-option>
  1088. <el-option
  1089. :key="7"
  1090. label="【】"
  1091. value="【】"
  1092. ></el-option>
  1093. </el-select>
  1094. <el-input
  1095. v-model="scope.row.deviation"
  1096. size="small"
  1097. placeholder="请输入内容"
  1098. ></el-input>
  1099. </div>
  1100. </template>
  1101. </el-table-column>
  1102. <el-table-column
  1103. align="center"
  1104. prop="eInspectionMethod"
  1105. label="检查方法和频率"
  1106. >
  1107. <template slot-scope="scope">
  1108. <el-input
  1109. v-model="scope.row.eInspectionMethod"
  1110. size="small"
  1111. placeholder="请输入内容"
  1112. ></el-input>
  1113. </template>
  1114. </el-table-column>
  1115. <el-table-column
  1116. align="center"
  1117. prop="dynamicDict"
  1118. label="动态字典"
  1119. >
  1120. <template slot="header">
  1121. <span>动态字典</span>
  1122. </template>
  1123. <template slot-scope="scope">
  1124. <el-select
  1125. v-model="scope.row.dynamicDict"
  1126. @change="setDefaultLength(scope.row)"
  1127. size="small"
  1128. placeholder="请选择"
  1129. >
  1130. <el-option
  1131. v-for="item in dynamicDictList"
  1132. :key="item.id"
  1133. :label="item.dictValue"
  1134. :value="item.dictKey"
  1135. ></el-option>
  1136. </el-select>
  1137. </template>
  1138. </el-table-column>
  1139. <el-table-column
  1140. align="center"
  1141. label="操作"
  1142. width="120"
  1143. >
  1144. <template slot="header">
  1145. <el-button
  1146. @click="addEleRow(editEleList)"
  1147. type="text"
  1148. icon="el-icon-circle-plus-outline"
  1149. class="text-icon"
  1150. ></el-button>
  1151. </template>
  1152. <template slot-scope="scope">
  1153. <el-button
  1154. v-if="scope.row.id"
  1155. icon="el-icon-remove-outline"
  1156. type="text"
  1157. @click="delEleRowHandle(scope.$index,editEleList)"
  1158. class="text-icon text-icon-danger"
  1159. ></el-button>
  1160. <div
  1161. class="flex"
  1162. v-else
  1163. >
  1164. <el-button
  1165. @click="saveNewEle(scope.row)"
  1166. type="mini"
  1167. >保存</el-button>
  1168. <el-button
  1169. icon="el-icon-remove-outline"
  1170. type="text"
  1171. @click="delEleRowHandle(scope.$index,editEleList)"
  1172. class="text-icon text-icon-danger"
  1173. ></el-button>
  1174. </div>
  1175. </template>
  1176. </el-table-column>
  1177. </el-table>
  1178. <span
  1179. slot="footer"
  1180. class="dialog-footer"
  1181. >
  1182. <el-button @click="editEleVisible = false">取 消</el-button>
  1183. <el-button
  1184. type="primary"
  1185. @click="saveEles"
  1186. >确 定</el-button>
  1187. </span>
  1188. </el-dialog>
  1189. <el-dialog
  1190. :title="(curEleTable.tableName?curEleTable.tableName:'')+' 元素公式(WBS级)'"
  1191. :visible.sync="editEleFormulaVisible"
  1192. width="800px"
  1193. append-to-body
  1194. :close-on-click-modal="false"
  1195. >
  1196. <div class="flex mg-b-10">
  1197. <el-input
  1198. v-model="formulaInput"
  1199. placeholder="请输入名称"
  1200. size="samll" clearable @clear="searchFormulaName"
  1201. ></el-input>
  1202. <el-button type="info" class="mg-l-10" @click="searchFormulaName">搜索</el-button>
  1203. </div>
  1204. <el-table
  1205. :data="editEleListFilter"
  1206. border
  1207. style="width: 100%"
  1208. height="400px"
  1209. >
  1210. <el-table-column
  1211. align="center"
  1212. prop="eName"
  1213. label="元素名称"
  1214. >
  1215. </el-table-column>
  1216. <el-table-column
  1217. align="center"
  1218. label="操作"
  1219. width="200"
  1220. >
  1221. <template slot-scope="scope">
  1222. <el-link
  1223. :type="scope.row.globalFormula == 1?'warning':'primary'"
  1224. @click="toFormulaEdit(scope.row,1)"
  1225. >全局公式</el-link>
  1226. <el-link
  1227. v-show="scope.row.hasPartFormula"
  1228. class="mg-l-10"
  1229. :type="scope.row.isSaveFormula == 1?'warning':'primary'"
  1230. @click="toFormulaEdit(scope.row,2)"
  1231. >节点公式</el-link>
  1232. <!-- <el-link
  1233. class="mg-l-10"
  1234. type="danger"
  1235. @click="delEleRowHandle(scope.$index,editEleListFilter)"
  1236. >删除元素</el-link> -->
  1237. </template>
  1238. </el-table-column>
  1239. </el-table>
  1240. </el-dialog>
  1241. <el-dialog
  1242. title="导入划分"
  1243. :visible.sync="importTemplateVisible"
  1244. width="800px"
  1245. append-to-body
  1246. @close="daoruClose"
  1247. >
  1248. <div v-loading="importLoading">
  1249. <div>
  1250. <el-link
  1251. type="primary"
  1252. @click="handleDownload"
  1253. >下载导入模版</el-link>
  1254. </div>
  1255. <div class="mg-t-20">
  1256. <el-button
  1257. type="primary"
  1258. @click="fileClick"
  1259. >选择文件</el-button>
  1260. <span
  1261. v-if="upFile"
  1262. class="mg-l-20"
  1263. >{{upFile.name}}</span>
  1264. <input
  1265. @change="fileChange"
  1266. type="file"
  1267. hidden
  1268. ref="file"
  1269. accept=".xls, .xlsx"
  1270. >
  1271. </div>
  1272. <div v-if="!upFile">当前还未选择文件,请选择需要导入的文件</div>
  1273. </div>
  1274. <span
  1275. slot="footer"
  1276. class="dialog-footer"
  1277. >
  1278. <el-button @click="importTemplateVisible = false">取 消</el-button>
  1279. <el-button
  1280. type="primary"
  1281. @click="importTemplateHandle"
  1282. :loading="importLoading"
  1283. >导 入</el-button>
  1284. </span>
  1285. </el-dialog>
  1286. <el-dialog
  1287. title="节点参数"
  1288. :visible.sync="nodeInfoVisible"
  1289. width="800px"
  1290. append-to-body
  1291. class="jiedian"
  1292. :close-on-click-modal="false"
  1293. :show-close="false"
  1294. @close="closenodeInfoVisible"
  1295. >
  1296. <div>
  1297. <el-button
  1298. type="text"
  1299. icon="el-icon-s-operation"
  1300. class="right-btn"
  1301. @click="setNodeParameters()"
  1302. ></el-button>
  1303. <div class="flexEnd">
  1304. <i
  1305. class="el-icon-circle-plus marbottom10"
  1306. @click="addNodeInfoTable()"
  1307. style="font-size:24px;color:rgb(37, 193, 99);cursor: pointer;"
  1308. ></i>
  1309. <i
  1310. class="el-icon-refresh-right marbottom10"
  1311. @click="refreshnfoTable()"
  1312. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1313. ></i>
  1314. </div>
  1315. <el-table
  1316. :data="nodeInfoTable"
  1317. border
  1318. style="width: 100%"
  1319. height="400"
  1320. >
  1321. <el-table-column
  1322. align="center"
  1323. prop="name"
  1324. label="参数名称"
  1325. >
  1326. <template slot-scope="scope">
  1327. <el-select
  1328. v-model="scope.row.k"
  1329. placeholder="请选择"
  1330. class="w-100p"
  1331. >
  1332. <el-option
  1333. v-for="item in namelist"
  1334. :key="item.k"
  1335. :label="item.name"
  1336. :value="item.k"
  1337. ></el-option>
  1338. </el-select>
  1339. </template>
  1340. </el-table-column>
  1341. <el-table-column
  1342. align="center"
  1343. prop="value"
  1344. label="参数值设置"
  1345. >
  1346. <template slot-scope="scope">
  1347. <el-input v-model="scope.row.v"></el-input>
  1348. </template>
  1349. </el-table-column>
  1350. <el-table-column
  1351. align="center"
  1352. prop="describe"
  1353. label="描述"
  1354. >
  1355. <template slot-scope="scope">
  1356. <el-input v-model="scope.row.remark"></el-input>
  1357. </template>
  1358. </el-table-column>
  1359. <el-table-column
  1360. label="操作"
  1361. width="120"
  1362. align="center"
  1363. >
  1364. <template slot-scope="scope">
  1365. <el-button
  1366. type="text"
  1367. size="small"
  1368. class="text-icon-primary"
  1369. @click="linkEle(scope.row)"
  1370. >关联元素</el-button>
  1371. <el-button
  1372. type="text"
  1373. size="small"
  1374. class="text-icon-danger"
  1375. @click="delNodeInfoss(scope.$index,scope.row)"
  1376. >删除</el-button>
  1377. </template>
  1378. </el-table-column>
  1379. </el-table>
  1380. </div>
  1381. <span
  1382. slot="footer"
  1383. class="dialog-footer"
  1384. >
  1385. <el-button @click="nodeInfoVisible = false">取 消</el-button>
  1386. <el-button
  1387. type="primary"
  1388. @click="nodeInfoSave()"
  1389. :loading="nodeInfoSaveload"
  1390. >保 存</el-button>
  1391. </span>
  1392. </el-dialog>
  1393. <el-dialog
  1394. title="设置参数名称"
  1395. :visible.sync="infoNameVisible"
  1396. width="800px"
  1397. append-to-body
  1398. class="jiedian"
  1399. :close-on-click-modal="false"
  1400. >
  1401. <div>
  1402. <div class="flexEnd">
  1403. <i
  1404. class="el-icon-circle-plus marbottom10"
  1405. @click="setParameterName()"
  1406. style="font-size:24px;color:rgb(37, 193, 99);cursor: pointer;"
  1407. ></i>
  1408. </div>
  1409. <el-table
  1410. :data="namelists"
  1411. border
  1412. style="width: 100%"
  1413. height="400"
  1414. >
  1415. <el-table-column
  1416. align="center"
  1417. prop="name"
  1418. label="参数名称"
  1419. >
  1420. <template slot-scope="scope">
  1421. <el-input v-model="scope.row.name"></el-input>
  1422. </template>
  1423. </el-table-column>
  1424. <el-table-column
  1425. align="center"
  1426. prop="key"
  1427. label="参数值KEY"
  1428. >
  1429. <template slot-scope="scope">
  1430. <el-input v-model="scope.row.k"></el-input>
  1431. </template>
  1432. </el-table-column>
  1433. <el-table-column
  1434. align="center"
  1435. prop="describe"
  1436. label="描述"
  1437. >
  1438. <template slot-scope="scope">
  1439. <el-input v-model="scope.row.remark"></el-input>
  1440. </template>
  1441. </el-table-column>
  1442. <el-table-column
  1443. label="操作"
  1444. width="120"
  1445. align="center"
  1446. >
  1447. <template slot-scope="scope">
  1448. <el-button
  1449. type="text"
  1450. size="small"
  1451. class="text-icon-danger"
  1452. @click="delNodeInfo(scope.$index,scope.row)"
  1453. >删除</el-button>
  1454. </template>
  1455. </el-table-column>
  1456. </el-table>
  1457. </div>
  1458. <span
  1459. slot="footer"
  1460. class="dialog-footer"
  1461. >
  1462. <el-button @click="addParameterName()" >保 存</el-button>
  1463. <el-button @click="closeParameter()">关 闭</el-button>
  1464. </span>
  1465. </el-dialog>
  1466. <el-dialog
  1467. title="节点参数设置-关联元素"
  1468. :visible.sync="linkEleVisible"
  1469. width="800px"
  1470. append-to-body
  1471. class="jiedian"
  1472. :close-on-click-modal="false"
  1473. >
  1474. <div>
  1475. <el-table
  1476. :data="linkEleTableList"
  1477. border
  1478. style="width: 100%"
  1479. height="400"
  1480. >
  1481. <el-table-column
  1482. align="center"
  1483. prop="tableName"
  1484. label="元素表名"
  1485. >
  1486. </el-table-column>
  1487. <el-table-column
  1488. align="center"
  1489. prop="elementName"
  1490. label="关联元素字段"
  1491. >
  1492. </el-table-column>
  1493. <el-table-column
  1494. label="操作"
  1495. width="160"
  1496. align="center"
  1497. >
  1498. <template slot-scope="scope">
  1499. <el-button v-if="!scope.row.mappingId"
  1500. type="text"
  1501. size="small"
  1502. class="text-icon-primary"
  1503. @click="tolinkEle(scope.row)"
  1504. >选择元素</el-button>
  1505. <el-button v-if="!!scope.row.mappingId"
  1506. type="text"
  1507. size="small"
  1508. class="text-icon-danger"
  1509. @click="delLink(scope.row)"
  1510. >删除关联</el-button>
  1511. </template>
  1512. </el-table-column>
  1513. </el-table>
  1514. </div>
  1515. <span
  1516. slot="footer"
  1517. class="dialog-footer"
  1518. >
  1519. <!-- <el-button @click="saveLinks">保 存</el-button> -->
  1520. <el-button @click="linkEleVisible = false">关 闭</el-button>
  1521. </span>
  1522. </el-dialog>
  1523. <el-dialog
  1524. title="选择关联元素"
  1525. :visible.sync="linkCheckVisible"
  1526. width="600px"
  1527. append-to-body
  1528. class="jiedian"
  1529. :close-on-click-modal="false"
  1530. >
  1531. <div>
  1532. <div class="flex mg-b-20">
  1533. <el-input v-model="linkEleKey" placeholder="请输入元素关键字搜索"></el-input>
  1534. <el-link class="mg-l-20" :underline="false">
  1535. <i class="el-icon-search" style="font-size:20px" @click="searchEle"></i>
  1536. </el-link>
  1537. </div>
  1538. <el-table
  1539. :data="linkEleList"
  1540. border
  1541. style="width: 100%"
  1542. height="400"
  1543. >
  1544. <el-table-column
  1545. align="center"
  1546. prop="eName"
  1547. label="元素名"
  1548. >
  1549. </el-table-column>
  1550. <el-table-column
  1551. label="操作"
  1552. width="55">
  1553. <template slot-scope="scope">
  1554. <el-checkbox v-model="scope.row.checked" @change="value => linkEleCheck(value,scope.$index)"></el-checkbox>
  1555. </template>
  1556. </el-table-column>
  1557. </el-table>
  1558. </div>
  1559. <span
  1560. slot="footer"
  1561. class="dialog-footer"
  1562. >
  1563. <el-button @click="saveLinkEle">保 存</el-button>
  1564. <el-button @click="linkCheckVisible = false">关 闭</el-button>
  1565. </span>
  1566. </el-dialog>
  1567. <el-dialog
  1568. title="别名"
  1569. :visible.sync="aliasVisible"
  1570. width="600px"
  1571. append-to-body
  1572. :close-on-click-modal="false"
  1573. >
  1574. <div>
  1575. <div class="flex">
  1576. <el-input v-model="aliasInput" placeholder="请输入节点别名"></el-input>
  1577. <el-button class="mg-l-20" type="primary" @click="addAlias">添加</el-button>
  1578. </div>
  1579. <div class="flex" style="flex-wrap:wrap">
  1580. <div class="mg-t-10" v-for="(tag,index) in aliasArr" :key="index">
  1581. <el-tag closable @close="delAlias(index)">
  1582. {{tag}}
  1583. </el-tag>
  1584. <span v-if="index != aliasArr.length-1">、</span>
  1585. </div>
  1586. </div>
  1587. </div>
  1588. <span
  1589. slot="footer"
  1590. class="dialog-footer"
  1591. >
  1592. <el-button @click="aliasVisible = false">取 消</el-button>
  1593. <el-button type="primary" @click="saveAliasHandle">确 定</el-button>
  1594. </span>
  1595. </el-dialog>
  1596. <el-dialog title="" :visible.sync="formulaCompVisible" fullscreen append-to-body class="full-dialog">
  1597. <FormulaEdit :wbsid="id" :nodeid="curTreeData.id" :eleid="formulaCurRow.id" :globaltype="formulaCurRow.globaltype" @hideDialog="formulaCompVisible = false"
  1598. v-if="formulaCompVisible" :fromcurNode="curTreeData" :iswbstype="1"></FormulaEdit>
  1599. </el-dialog>
  1600. <el-dialog title="" :visible.sync="formulaCompVisible1" fullscreen append-to-body class="full-dialog">
  1601. <FormulaEditone :wbsid="id" :nodeid="curTreeData.id" :eleid="formulaCurRow.id" :elementType="formulaCurRow.elementType"
  1602. :globaltype="formulaCurRow.globaltype" @hideDialog="formulaCompVisible1 = false" :fromcurNode="curEleTable" :iswbstype="1"
  1603. v-if="formulaCompVisible1">
  1604. </FormulaEditone>
  1605. </el-dialog>
  1606. </basic-container>
  1607. </template>
  1608. <script>
  1609. import ManualSorting from '@/components/WbsTree/ManualSorting'
  1610. import FormulaEdit from '@/views/formula/edit.vue'
  1611. import FormulaEditone from '@/views/formula/edit1.vue'
  1612. import {
  1613. getLazytree, getDetail, update, selectByNodeTable,getParamElements,delParamElements,specifiedParamElements, getAlltree,
  1614. saveFormAndElement, selectFormElements, removeTableById, findWbsTreeSameLevel, wbsTreeSort, findWbsTreeTableSameLevel, wbsTreeTableSort, parameters, saveOrUpdateBatch, keymap, importwbsTreeFormBatch, exportBatchTemplate, updateBatchNodeTableInfo,
  1615. importWbsTree, exportTemplate, remove as removeTreeNode,submitFullName,refrehPram,getQueryValueByType
  1616. } from "@/api/manager/wbstree";
  1617. import {
  1618. saveElement, remove as removeElement, updateBatchElements, getTemplate,
  1619. importWbsElement
  1620. } from "@/api/manager/wbsformelement";
  1621. import { getDictionary } from "@/api/system/dict";
  1622. import { mapGetters } from "vuex";
  1623. import {getStore,setStore} from '@/util/store'
  1624. export default {
  1625. data () {
  1626. var checkMajorDataType = (rule, value, callback) => {
  1627. //console.log(this.nodeDetail.nodeType)
  1628. //console.log(this.nodeDetail.majorDataType)
  1629. if(this.nodeDetail.nodeType == 6){
  1630. if(!this.nodeDetail.majorDataType){
  1631. callback(new Error('工序节点必须选择内业资料类型'));
  1632. }
  1633. }
  1634. callback();
  1635. };
  1636. return {
  1637. loding: false,
  1638. formDatass: [],
  1639. editElementFormTag: false,
  1640. ImportElementdata: {
  1641. },
  1642. ImportElementFile: [],//导入元素file文件
  1643. ImportElementTag: false,
  1644. jiedianId: '',
  1645. excelSortTag: false,
  1646. excelSortTag2: false,
  1647. sortTag2: false,
  1648. sortTag: false,
  1649. sort: [],
  1650. id: '',
  1651. filterText: '',
  1652. isSearch:false,
  1653. treeData: [],
  1654. searchTreeData:[],
  1655. searchtreeLoad:false,
  1656. searchType:'1',//搜索类型
  1657. treeLoad: false,
  1658. menuShow: false,
  1659. defaultProps: {
  1660. children: 'children',
  1661. label: 'title',
  1662. isLeaf: function (data) {
  1663. if (data.hasChildren && data.isExistForm != 1) {
  1664. return false
  1665. } else if (data.hasChildren && data.isExistForm == 1) {
  1666. return true
  1667. } else {
  1668. return true
  1669. }
  1670. }
  1671. },
  1672. leftType: 5,
  1673. curTreeData: {},
  1674. curTreeNode: {},
  1675. tableData: [],
  1676. nodeDetail: {},
  1677. formData: [],
  1678. editType: 1,
  1679. dialogVisible: false,
  1680. saveNodeLoading: false,
  1681. nodeTypelist: [],
  1682. majorDataTypeList: [],
  1683. rules: {
  1684. nodeName: [
  1685. { required: true, message: '请输入节点名称', trigger: 'blur' },
  1686. ],
  1687. nodeType: [
  1688. { required: true, message: '请选择节点类型', trigger: 'change'}
  1689. ],
  1690. majorDataType:[
  1691. { validator: checkMajorDataType, trigger: 'change' }
  1692. ]
  1693. },
  1694. eleVisible: false,
  1695. tableTypelist: [],
  1696. dataTypeList: [],
  1697. ownerTypeList: [],
  1698. eleForm: {
  1699. elementList: [],
  1700. },
  1701. eleRules: {
  1702. nodeName: [
  1703. { required: true, message: '请输入表名称', trigger: 'blur' },
  1704. ],
  1705. tableType: [
  1706. { required: true, message: '请选择表类型', trigger: 'change' }
  1707. ],
  1708. tableOwner: [
  1709. { required: true, message: '请选择所属方', trigger: 'change' }
  1710. ],
  1711. },
  1712. importVisible: false,
  1713. tempList: [],
  1714. curEleTable: {},
  1715. editEleVisible: false,
  1716. editEleList: [],
  1717. eleReg: /(-|>|<|≥|≤|±|【】)?([^≥≤±【】]*)/,
  1718. editEleFormulaVisible: false,
  1719. formulaInput: '',
  1720. editEleListFilter:[],
  1721. editEleListAll:[],
  1722. importTemplateVisible: false,
  1723. fileUrl: '',
  1724. upFile: null,
  1725. importLoading: false,
  1726. nodeInfoVisible: false,
  1727. nodeInfoTable: [],
  1728. namelist: [],
  1729. namelists: [],
  1730. infoNameVisible: false,
  1731. delids:[],
  1732. //数据类型的默认长度
  1733. dataTypeDefaultMap: {
  1734. 1: 250,//字符串
  1735. 2: 50,//整数
  1736. 3: 50,//小数
  1737. 4: 50,//日期
  1738. 5: 50,//数值
  1739. 6: 50,//签名
  1740. 7: 100,//文件
  1741. },
  1742. //节点参数,关联元素
  1743. curParam:{},//当前节点参数
  1744. linkEleVisible:false,
  1745. linkEleTableList:[],//元素表数组
  1746. curLinkEleTable:{},//当前元素表
  1747. linkCheckVisible:false,//关联弹框
  1748. linkEleList:[],//元素数组
  1749. linkEleKey:'',//搜索关键字
  1750. defaultExpandedKeys:[],
  1751. expandName:this.$route.fullPath,
  1752. aliasVisible:false,//别名
  1753. aliasInput:'',
  1754. aliasArr:[],
  1755. formulaCompVisible:false,//公式弹框
  1756. formulaCompVisible1:false,
  1757. formulaCurRow:{},//当前元素
  1758. testTreeLoad: false,
  1759. testTreeData: [],
  1760. mixRatioTestIds: [],
  1761. searchinput:'',
  1762. editEleloading:false,
  1763. menuvisible:false,//右键菜单
  1764. menuleft:20,
  1765. menutop:0,
  1766. menusData:[
  1767. {icon: 'el-icon-plus', label: '新增节点', key: "add"},
  1768. {icon: 'el-icon-s-promotion', label: '编辑节点', key: "edit"},
  1769. {icon: 'el-icon-sort', label: '排序节点', key: "sort"},
  1770. {icon: 'el-icon-document-copy', label: '复制节点', key: "copy"},
  1771. {icon: 'el-icon-delete', label: '删除节点', key: "del"},
  1772. ],//树组件操作菜单
  1773. menusData1:[{icon: 'el-icon-plus', label: '新增节点', key: "add"}],
  1774. menuKey:'',
  1775. nodeInfoSaveload:false,
  1776. dynamicDictList:[]
  1777. };
  1778. },
  1779. computed: {
  1780. ...mapGetters(["userInfo"]),
  1781. dialogTitle: function () {
  1782. let text = '节点';
  1783. if (this.leftType == 1) {
  1784. text = '新增' + text;
  1785. } else if (this.leftType == 2) {
  1786. text = '编辑' + text;
  1787. }
  1788. return text;
  1789. },
  1790. },
  1791. created () {
  1792. this.init();
  1793. //console.log(this.userInfo)
  1794. },
  1795. methods: {
  1796. //#region 排序
  1797. paixuMD (data) {
  1798. this.sortTag = true
  1799. this.sortTag2 = true
  1800. this.curTreeData = data;
  1801. this.findWbsTreeSameLevel(data.parentId)
  1802. },
  1803. bianhua () {
  1804. this.sortTag2 = false
  1805. this.$nextTick(() => {
  1806. this.sortTag2 = true
  1807. })
  1808. },
  1809. editSort () {//修改排序
  1810. this.wbsTreeSort()
  1811. },
  1812. async wbsTreeSort () {//修改排序
  1813. const { data: res } = await wbsTreeSort(this.sort)
  1814. //console.log(res);
  1815. if (res.code == 200) {
  1816. this.sortTag = false
  1817. this.sortTag2 = false
  1818. this.updateTreeNewNode();
  1819. }
  1820. },
  1821. async findWbsTreeSameLevel (parentId) {//查询当前节点的同级节点
  1822. const { data: res } = await findWbsTreeSameLevel({ parentId })
  1823. //console.log(res);
  1824. if (res.code === 200) {
  1825. this.sort = res.data
  1826. }
  1827. },
  1828. async getLazytree () {//冲洗获取wbs树
  1829. const { data: res } = await getLazytree(this.id, 0, this.userInfo.tenant_id)
  1830. //console.log(res);
  1831. if (res.code == 200) {
  1832. this.treeData = res.data
  1833. }
  1834. },
  1835. bianhua2 () {
  1836. this.excelSortTag2 = false
  1837. this.$nextTick(() => {
  1838. this.excelSortTag2 = true
  1839. })
  1840. },
  1841. editExcelSort () {//确定按钮
  1842. this.wbsTreeTableSort()
  1843. },
  1844. paixucc () {
  1845. if (this.curTreeData.value) {
  1846. this.excelSortTag = true
  1847. this.excelSortTag2 = true
  1848. this.findWbsTreeTableSameLevel(this.curTreeData.value)
  1849. } else {
  1850. this.$message({
  1851. type: "warning",
  1852. message: "请先选择需要排序的节点"
  1853. })
  1854. }
  1855. },
  1856. async findWbsTreeTableSameLevel (id) {//查询表单
  1857. const { data: res } = await findWbsTreeTableSameLevel({ id })
  1858. //console.log(res);
  1859. if (res.code == 200) {
  1860. this.sort = res.data
  1861. }
  1862. },
  1863. async wbsTreeTableSort () {//表单排序
  1864. const { data: res } = await wbsTreeTableSort(this.sort)
  1865. //console.log(res);
  1866. if (res.code == 200) {
  1867. this.excelSortTag = false
  1868. this.excelSortTag2 = false
  1869. this.updateNodeTable();//更新元素表
  1870. }
  1871. },
  1872. //#endregion
  1873. //#region 甘云杰
  1874. init () {
  1875. //this.id = this.$route.params.id;
  1876. const {id, type} = this.$route.query;
  1877. this.id = id
  1878. this.wbsType = Number(type)
  1879. this.getNodeTypelist();
  1880. this.getTableTypelist();
  1881. this.getDataTypelist();
  1882. this.getOwnerTypelist();
  1883. this.getDictTypelist()
  1884. this.defaultExpandedKeys = getStore({name:this.expandName});
  1885. },
  1886. loadNode (node, resolve) {
  1887. let pid = 0;
  1888. if (node.level != 0) {
  1889. pid = node.data.id
  1890. }
  1891. getLazytree(this.id, pid, this.userInfo.tenant_id).then((res) => {
  1892. let arr = [];
  1893. if (Array.isArray(res.data.data)) {
  1894. arr = res.data.data;
  1895. }
  1896. return resolve(arr);
  1897. })
  1898. },
  1899. //搜索树
  1900. searchTreeClick(){
  1901. this.searchtreeLoad=true
  1902. if(this.filterText.length>0){
  1903. this.isSearch=true
  1904. getQueryValueByType({
  1905. queryValue:this.filterText,
  1906. type:this.searchType,
  1907. wbsId:this.id,
  1908. projectId:''
  1909. }).then((res)=>{
  1910. let arr = [];
  1911. if (Array.isArray(res.data.data)) {
  1912. arr = res.data.data;
  1913. this.searchTreeData=arr
  1914. }else{
  1915. this.searchTreeData=[]
  1916. }
  1917. })
  1918. }else{
  1919. this.isSearch=false
  1920. }
  1921. this.searchtreeLoad=false
  1922. },
  1923. clearSearch(){
  1924. this.isSearch=false
  1925. },
  1926. getNodeDetail (data, node) {
  1927. let parentName = '';
  1928. if (node.parent.data) {
  1929. parentName = node.parent.data.title;
  1930. }
  1931. this.curTreeData = data;
  1932. this.curTreeNode = node;
  1933. this.curTreeData.parentName = parentName;
  1934. getDetail(data.id).then((res) => {
  1935. res.data.data.parentName = parentName;
  1936. this.tableData = [res.data.data];
  1937. this.nodeDetail = Object.assign({}, res.data.data);
  1938. if(this.menuKey==='add'){
  1939. this.nodeDetail.nodeName=''
  1940. }
  1941. })
  1942. this.updateNodeTable();
  1943. //获取节点展开路径
  1944. this.getExpandedKeys(node);
  1945. },
  1946. saveNode () {
  1947. const type = this.wbsType
  1948. this.$refs['nodeDetail'].validate((valid) => {
  1949. if (valid) {
  1950. const { mixRatioTestIds, nodeType } = this.nodeDetail
  1951. if (type === 2 && nodeType === 53) {
  1952. if (mixRatioTestIds) {
  1953. if (this.editType == 1) {
  1954. this.addNode();
  1955. } else if (this.editType == 2) {
  1956. this.updateNode();
  1957. }
  1958. } else {
  1959. this.$message({
  1960. type: "error",
  1961. message: '请先选择节点'
  1962. });
  1963. return false;
  1964. }
  1965. } else {
  1966. if (this.editType == 1) {
  1967. this.addNode();
  1968. } else if (this.editType == 2) {
  1969. this.updateNode();
  1970. }
  1971. }
  1972. } else {
  1973. //console.log('error submit!!');
  1974. return false;
  1975. }
  1976. });
  1977. },
  1978. addNode () {
  1979. this.saveNodeLoading = true;
  1980. let subobj=this.nodeDetail
  1981. subobj.id=''
  1982. subobj.parentId=this.curTreeData.id
  1983. subobj.parentName=this.curTreeData.title
  1984. update(subobj).then(() => {
  1985. this.updateTreeNewNode();
  1986. this.dialogVisible = false;
  1987. this.$message({
  1988. type: "success",
  1989. message: "新增成功!"
  1990. });
  1991. })
  1992. },
  1993. updateNode () {
  1994. console.log('编辑节点');
  1995. update(this.nodeDetail).then(() => {
  1996. let node = this.tableData[0];
  1997. node.nodeName = this.nodeDetail.nodeName;
  1998. node.nodeType = this.nodeDetail.nodeType;
  1999. this.curTreeData.title = this.nodeDetail.nodeName;
  2000. this.dialogVisible = false;
  2001. this.$message({
  2002. type: "success",
  2003. message: "修改成功!"
  2004. });
  2005. })
  2006. },
  2007. toSplit(val) {
  2008. return val ? String(val).split(',') : '';
  2009. },
  2010. setLeftType (type, data, node) {
  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 {
  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. getDictionary({
  2553. code: 'major_data_type'
  2554. }).then((res) => {
  2555. res.data.data.forEach(element => {
  2556. element.dictKey = Number(element.dictKey)
  2557. });
  2558. this.majorDataTypeList = res.data.data;
  2559. })
  2560. },
  2561. getTableTypelist () {
  2562. const type = this.wbsType
  2563. if (this.tableTypelist.length > 1) {
  2564. return;
  2565. }
  2566. let code=''
  2567. if(type===5){
  2568. code='table_type'//征拆
  2569. }else if(type===2){
  2570. code='trial_table_type'//试验
  2571. }else{
  2572. code='table_type'//质检
  2573. }
  2574. getDictionary({
  2575. // code: "table_type",
  2576. code:code,
  2577. }).then((res) => {
  2578. res.data.data.forEach(element => {
  2579. element.dictKey = Number(element.dictKey)
  2580. });
  2581. this.tableTypelist = res.data.data;
  2582. })
  2583. },
  2584. getDataTypelist () {
  2585. if (this.dataTypeList.length > 1) {
  2586. return;
  2587. }
  2588. getDictionary({
  2589. code: 'data_type'
  2590. }).then((res) => {
  2591. res.data.data.forEach(element => {
  2592. element.dictKey = Number(element.dictKey)
  2593. });
  2594. this.dataTypeList = res.data.data;
  2595. })
  2596. },
  2597. getDictTypelist () {
  2598. if (this.dynamicDictList.length > 1) {
  2599. return;
  2600. }
  2601. getDictionary({
  2602. code: 'land_field_dict'
  2603. }).then((res) => {
  2604. res.data.data.forEach(element => {
  2605. element.dictKey = Number(element.dictKey)
  2606. });
  2607. this.dynamicDictList = res.data.data;
  2608. })
  2609. },
  2610. getOwnerTypelist () {
  2611. if (this.ownerTypeList.length > 1) {
  2612. return;
  2613. }
  2614. getDictionary({
  2615. code: 'owner_type'
  2616. }).then((res) => {
  2617. res.data.data.forEach(element => {
  2618. element.dictKey = Number(element.dictKey)
  2619. });
  2620. this.ownerTypeList = res.data.data;
  2621. })
  2622. },
  2623. formatCat (row, column, cellValue) {
  2624. for (let i = 0; i < this.nodeTypelist.length; i++) {
  2625. if (this.nodeTypelist[i].dictKey == cellValue) {
  2626. return this.nodeTypelist[i].dictValue
  2627. }
  2628. }
  2629. return cellValue;
  2630. //console.log(cellValue)
  2631. },
  2632. formatTableType (row, column, cellValue) {
  2633. for (let i = 0; i < this.tableTypelist.length; i++) {
  2634. if (this.tableTypelist[i].dictKey == cellValue) {
  2635. return this.tableTypelist[i].dictValue
  2636. }
  2637. }
  2638. return cellValue;
  2639. //console.log(cellValue)
  2640. },
  2641. formatOwner (row, column, cellValue) {
  2642. for (let i = 0; i < this.ownerTypeList.length; i++) {
  2643. if (this.ownerTypeList[i].dictKey == cellValue) {
  2644. return this.ownerTypeList[i].dictValue
  2645. }
  2646. }
  2647. return cellValue;
  2648. //console.log(cellValue)
  2649. },
  2650. formatdataType (row, column, cellValue) {
  2651. for (let i = 0; i < this.dataTypeList.length; i++) {
  2652. if (this.dataTypeList[i].dictKey == cellValue) {
  2653. return this.dataTypeList[i].dictValue
  2654. }
  2655. }
  2656. return cellValue;
  2657. //console.log(cellValue)
  2658. },
  2659. // filterNode (value, data) {
  2660. // //console.log(value)
  2661. // if (!value) return true;
  2662. // return data.title.indexOf(value) !== -1;
  2663. // },
  2664. getReturnNode(node,_array,value){
  2665. let isPass = node.data && node.data.title && node.data.title.indexOf(value) !== -1;
  2666. isPass?_array.push(isPass):'';
  2667. if(!isPass && node.level!=1 && node.parent){
  2668. this.getReturnNode(node.parent,_array,value);
  2669. }
  2670. },
  2671. filterNode(value,data,node) {
  2672. if(!value){
  2673. return true;
  2674. }
  2675. let level = node.level;
  2676. let _array = [];//这里使用数组存储 只是为了存储值。
  2677. this.getReturnNode(node,_array,value);
  2678. let result = false;
  2679. _array.forEach((item)=>{
  2680. result = result || item;
  2681. });
  2682. return result;
  2683. },
  2684. //修改数据类型,给个默认值
  2685. setDefaultLength (row) {
  2686. this.$set(row, 'eLength', this.dataTypeDefaultMap[row.eType]);
  2687. },
  2688. //#endregion
  2689. //#region 节点参数
  2690. nodeInfo (data) {//节点参数按钮
  2691. this.keymap()
  2692. this.jiedianId = data.id
  2693. this.parameters(data.id)
  2694. this.nodeInfoVisible = true;
  2695. },
  2696. closenodeInfoVisible(){
  2697. this.nodeInfoTable=[]
  2698. this.nodeInfoVisible = false;
  2699. },
  2700. addNodeInfoTable () {//添加节点参数数据
  2701. this.nodeInfoTable.unshift({ k: '', v: '', remark: '', nodeId: this.jiedianId,type: 1 })
  2702. },
  2703. refreshnfoTable(){
  2704. //刷新表格
  2705. let prams={
  2706. nodeId: this.jiedianId,
  2707. type: 0,
  2708. }
  2709. refrehPram(prams).then((res)=>{
  2710. console.log(res);
  2711. })
  2712. },
  2713. delNodeInfo (key,obj) {//设置参数名称中的删除按钮
  2714. this.delids.push(obj.id)
  2715. this.namelists.splice(key, 1)
  2716. },
  2717. delNodeInfoss (key,obj) {//节点参数
  2718. this.delids.push(obj.id)
  2719. this.nodeInfoTable.splice(key, 1)
  2720. },
  2721. setNodeParameters () {//打开设置节点参数弹框按钮
  2722. this.infoNameVisible = true
  2723. this.namelists = [...this.namelist]
  2724. },
  2725. async setParameterName () {//设置参数名称中添加节点参数按钮
  2726. // wbsId: this.jiedianId
  2727. this.namelists.unshift({ name: '', remark: '', k: '', type: 0, nodeId: this.jiedianId})
  2728. },
  2729. async nodeInfoSave () {//节点参数弹框保存按钮
  2730. if (this.nodeInfoTable) {
  2731. // if(this.nodeInfoTable.length == 0){
  2732. // await this.saveOrUpdateBatch({projectId:this.projectid,nodeId:this.jiedianId,type:1,delIds:this.delids,wps:[
  2733. // {
  2734. // nodeId: this.jiedianId,
  2735. // type: -1,
  2736. // },
  2737. // ]})
  2738. // this.delIds=[];
  2739. // this.nodeInfoVisible = false
  2740. // this.$message({
  2741. // type: "success",
  2742. // message: "保存参数节点成功!"
  2743. // })
  2744. // return;
  2745. // }
  2746. let tag = true
  2747. this.nodeInfoTable.forEach(val => {
  2748. if (!val.k | !val.v) {
  2749. return tag = false
  2750. }
  2751. //if(!val.name){
  2752. for (let i = 0; i < this.namelist.length; i++) {
  2753. if(this.namelist[i].k == val.k){
  2754. val.name = this.namelist[i].name;
  2755. return;
  2756. }
  2757. }
  2758. //}
  2759. })
  2760. if (tag) {
  2761. this.nodeInfoSaveload=true
  2762. await this.saveOrUpdateBatch({scopeType:1,projectId:this.projectid,nodeId:this.jiedianId,wps:this.nodeInfoTable,type:1,delIds:this.delids})
  2763. this.delIds=[]
  2764. this.$message({
  2765. type: "success",
  2766. message: "设置参数节点成功!"
  2767. })
  2768. this.nodeInfoSaveload=false
  2769. // this.nodeInfoVisible = false;
  2770. this.parameters(this.jiedianId)
  2771. } else {
  2772. this.$message({
  2773. type: "error",
  2774. message: "请填写所有的参数名称和参数值!"
  2775. })
  2776. }
  2777. } else {
  2778. this.$message({
  2779. type: "error",
  2780. message: "请先设置参数节点!"
  2781. })
  2782. }
  2783. },
  2784. async addParameterName () {//设置参数名称中的保存按钮
  2785. if (this.namelists.length) {
  2786. let tag = true
  2787. this.namelists.forEach(val => {
  2788. if (!val.name || !val.k) {
  2789. return tag = false
  2790. }
  2791. })
  2792. if (tag) {
  2793. await this.saveOrUpdateBatch({scopeType:1,projectId:this.projectid,nodeId:this.jiedianId,wps:this.namelists,type:0,delIds:this.delids}) //保存设置参数
  2794. this.infoNameVisible = false;
  2795. this.delIds=[];
  2796. this.keymap()
  2797. } else {
  2798. this.$message({
  2799. type: "error",
  2800. message: "请填写所有的参数名称和参数值KEY!"
  2801. })
  2802. }
  2803. } else {
  2804. this.$message({
  2805. type: "warning",
  2806. message: "请先添加参数"
  2807. })
  2808. }
  2809. },
  2810. closeParameter () {//设置参数名称,关闭按钮
  2811. this.namelists = []
  2812. this.infoNameVisible = false
  2813. },
  2814. async parameters (wbsId) {//获取接待你参数列表
  2815. const { data: res } = await parameters({ wbsId })
  2816. console.log(res);
  2817. if (res.code == 200) {
  2818. if( Array.isArray(res.data)){
  2819. this.nodeInfoTable = res.data
  2820. }
  2821. }
  2822. },
  2823. async saveOrUpdateBatch (da) {//保存
  2824. const { data: res } = await saveOrUpdateBatch(da)
  2825. this.delids=[];
  2826. //console.log(res);
  2827. },
  2828. async keymap () {//节点参数枚举
  2829. const { data: res } = await keymap()
  2830. //console.log(res);
  2831. if (res.code == 200) {
  2832. this.namelist = res.data
  2833. }
  2834. },
  2835. //#endregion
  2836. //#region 导入元素
  2837. ImportElement (data) {//导入元素按钮
  2838. console.log(data);
  2839. this.ImportElementdata.ancestors = data.ancestors
  2840. this.ImportElementdata.id = data.id
  2841. this.ImportElementTag = true
  2842. },
  2843. async pushImportElement () {//确定按钮
  2844. if (this.ImportElementFile.length > 0) {
  2845. let formData = new FormData()
  2846. formData.append('wbsId', this.$route.params.id)
  2847. formData.append('ancestors', this.ImportElementdata.ancestors)
  2848. formData.append('id', this.ImportElementdata.id)
  2849. formData.append('tenantId', this.userInfo.tenant_id)
  2850. formData.append('excelFile', this.ImportElementFile[0].raw)
  2851. await this.importwbsTreeFormBatch(formData)
  2852. this.ImportElementFile = []
  2853. this.ImportElementTag = false
  2854. }
  2855. },
  2856. ImportElementHandleClose () {//关闭弹框事件
  2857. this.ImportElementTag = false
  2858. this.loding = false
  2859. this.ImportElementFile = []
  2860. },
  2861. ElementChange (file, fileList) {//文件上传时的钩子
  2862. //console.log(fileList);
  2863. if (this.ImportElementFile.length == 0) {
  2864. this.ImportElementFile = fileList
  2865. }
  2866. },
  2867. ElementRemove (file, fileList) {
  2868. this.ImportElementFile = fileList
  2869. },
  2870. async importwbsTreeFormBatch (da) {
  2871. this.loding = true
  2872. try {
  2873. const { data: res } = await importwbsTreeFormBatch(da)
  2874. console.log(res);
  2875. if (res.code == 200) {
  2876. this.$message({
  2877. type: "success",
  2878. message: "导入成功!"
  2879. })
  2880. }
  2881. this.loding = false
  2882. } catch (error) {
  2883. this.loding = false
  2884. }
  2885. },
  2886. async exportBatchTemplate () {
  2887. const res = await exportBatchTemplate()
  2888. //console.log(res);
  2889. if (res.status == 200) {
  2890. this.downloadExcel(res.data, '导入元素模板')
  2891. }
  2892. },
  2893. xiazaielement () {
  2894. this.exportBatchTemplate()
  2895. },
  2896. //#endregion
  2897. //#region 元素表单信息
  2898. editEditElementForm () {//标记元素
  2899. if (this.formData.length) {
  2900. let da = []
  2901. this.formDatass = [...this.formData]
  2902. this.formDatass.forEach(val => {
  2903. da.push({
  2904. tableType: val.tableType - 0,
  2905. tableOwner: val.tableOwner - 0,
  2906. id: val.id,
  2907. tableName: val.tableName,
  2908. fillRate: val.fillRate,
  2909. })
  2910. })
  2911. this.formDatass = da
  2912. this.editElementFormTag = true
  2913. }
  2914. },
  2915. editeditElementFormMF () {//保存按钮
  2916. let da = []
  2917. let tag = true
  2918. this.formDatass.forEach(val => {
  2919. if (!val.tableName || !val.tableType || !val.tableOwner) {
  2920. tag = false
  2921. return
  2922. } else {
  2923. da.push({
  2924. id: val.id,
  2925. nodeName: val.tableName,
  2926. tableType: val.tableType,
  2927. tableOwner: val.tableOwner,
  2928. fillRate: val.fillRate,
  2929. })
  2930. }
  2931. })
  2932. if (tag) {
  2933. this.updateBatchNodeTableInfo(da)
  2934. } else {
  2935. this.$message({
  2936. type: 'success',
  2937. message: '请填写完整元素表单的所有信息!',
  2938. })
  2939. }
  2940. },
  2941. async updateBatchNodeTableInfo (da) {//共有编辑元素
  2942. const { data: res } = await updateBatchNodeTableInfo(da)
  2943. //console.log(res);
  2944. if (res.code == 200) {
  2945. this.editElementFormTag = false
  2946. this.updateNodeTable()
  2947. }
  2948. },
  2949. //#endregion
  2950. //获取节点展开路径
  2951. getExpandedKeys(node){
  2952. //console.log(node)
  2953. let expandedKeys = [];
  2954. while(node.parent){
  2955. expandedKeys.push(node.data.id);
  2956. node = node.parent;
  2957. }
  2958. setStore({
  2959. name:this.expandName,
  2960. content:expandedKeys,
  2961. type:true//sessionStorage
  2962. })
  2963. //console.log(expandedKeys)
  2964. },
  2965. //节点参数 关联元素
  2966. linkEle(row){
  2967. if(!row.id){
  2968. this.$message.warning('请先保存数据,再点击关联元素')
  2969. }else{
  2970. this.linkEleVisible = true;
  2971. this.curParam = row;
  2972. getParamElements({nodeId:this.jiedianId,paramId:row.id,scopeType:1}).then((res) => {
  2973. if (res.data.data.length) {
  2974. this.linkEleTableList = res.data.data;
  2975. } else {
  2976. this.linkEleTableList = [];
  2977. }
  2978. })
  2979. }
  2980. },
  2981. //保存关联
  2982. saveLinks(){
  2983. },
  2984. //删除关联
  2985. delLink(data){
  2986. this.$confirm('删除关联, 是否继续?', '提示', {
  2987. confirmButtonText: '确定',
  2988. cancelButtonText: '取消',
  2989. type: 'warning'
  2990. }).then(() => {
  2991. console.log(data)
  2992. delParamElements(data).then(() => {
  2993. this.$message({
  2994. type: "success",
  2995. message: "删除成功!"
  2996. });
  2997. getParamElements({nodeId:this.jiedianId,paramId:this.curParam.id,scopeType:1}).then((res) => {
  2998. if (res.data.data.length) {
  2999. this.linkEleTableList = res.data.data;
  3000. } else {
  3001. this.linkEleTableList = [];
  3002. } })
  3003. })
  3004. }).catch(() => {
  3005. });
  3006. },
  3007. //关联元素弹框
  3008. tolinkEle(row){
  3009. this.curLinkEleTable = row;
  3010. this.linkCheckVisible = true;
  3011. selectFormElements(row.id,{nodeId:this.jiedianId,type:5}).then((res) => {
  3012. res.data.data.forEach((ele)=>{
  3013. ele.checked = false;
  3014. ele.show = true;
  3015. })
  3016. this.linkEleList = res.data.data;
  3017. this.linkEleListAll = [].concat(this.linkEleList);
  3018. })
  3019. },
  3020. linkEleCheck(value,index){
  3021. //console.log(value)
  3022. if(value){
  3023. this.linkEleList.forEach((ele,i)=>{
  3024. if(i != index){
  3025. ele.checked = false;
  3026. }
  3027. })
  3028. }
  3029. },
  3030. //关联元素
  3031. saveLinkEle(){
  3032. let target={}
  3033. this.linkEleList.forEach(e=>{
  3034. if(e.checked==true){
  3035. target={elementId:e.id,paramId:this.curParam.id};
  3036. }
  3037. })
  3038. if(JSON.stringify(target) !== '{}'){
  3039. specifiedParamElements(target).then(data=>{
  3040. this.linkCheckVisible = false;
  3041. getParamElements({nodeId:this.jiedianId,paramId:this.curParam.id,scopeType:1}).then((res) => {
  3042. if (res.data.data.length) {
  3043. this.linkEleTableList = res.data.data;
  3044. } else {
  3045. this.linkEleTableList = [];
  3046. }})
  3047. })
  3048. }else{
  3049. this.$message.warning('请先选择关联元素')
  3050. }
  3051. },
  3052. //筛选元素
  3053. searchEle(){
  3054. this.linkEleList = this.linkEleListAll.filter((ele)=>{
  3055. return ele.eName.indexOf(this.linkEleKey) > -1;
  3056. })
  3057. },
  3058. //触发节点参数
  3059. nodeInfoHandle(){
  3060. if(!this.curTreeData.id){
  3061. this.$message({
  3062. type: "warning",
  3063. message: "请先选择节点"
  3064. })
  3065. return;
  3066. }
  3067. this.nodeInfo(this.curTreeData)
  3068. },
  3069. eleFormulaHandle(){
  3070. if(!this.curTreeData.id || !this.curTreeNode.id){
  3071. this.$message({
  3072. type: "warning",
  3073. message: "请先选择节点"
  3074. })
  3075. return;
  3076. }
  3077. this.setLeftType(4,this.curTreeData,this.curTreeNode);
  3078. },
  3079. addNodeHandle(){
  3080. if(!this.curTreeData.id || !this.curTreeNode.id){
  3081. this.$message({
  3082. type: "warning",
  3083. message: "请先选择节点"
  3084. })
  3085. return;
  3086. }
  3087. if(this.curTreeData.nodeType == 6 || this.curTreeData.isExistForm == 1){
  3088. this.$message({
  3089. type: "warning",
  3090. message: "该节点下无法新增节点"
  3091. })
  3092. return;
  3093. }
  3094. this.mixRatioTestIds = []
  3095. this.setLeftType(1,this.curTreeData,this.curTreeNode)
  3096. },
  3097. editNodeHandle(){
  3098. if(!this.curTreeData.id || !this.curTreeNode.id){
  3099. this.$message({
  3100. type: "warning",
  3101. message: "请先选择节点"
  3102. })
  3103. return;
  3104. }
  3105. this.nodeTypeChange(53)
  3106. this.setLeftType(2,this.curTreeData,this.curTreeNode)
  3107. },
  3108. copyNodeHandle(){
  3109. if(!this.curTreeData.id || !this.curTreeNode.id){
  3110. this.$message({
  3111. type: "warning",
  3112. message: "请先选择节点"
  3113. })
  3114. return;
  3115. }
  3116. },
  3117. delNodeHandle(){
  3118. if(!this.curTreeData.id || !this.curTreeNode.id){
  3119. this.$message({
  3120. type: "warning",
  3121. message: "请先选择节点"
  3122. })
  3123. return;
  3124. }
  3125. if(this.curTreeNode.level == 1){
  3126. this.$message({
  3127. type: "warning",
  3128. message: "当前节点无法删除"
  3129. })
  3130. return;
  3131. }
  3132. this.deleNode(this.curTreeData,this.curTreeNode)
  3133. },
  3134. eleHandle(){
  3135. if(!this.curTreeData.id || !this.curTreeNode.id){
  3136. this.$message({
  3137. type: "warning",
  3138. message: "请先选择节点"
  3139. })
  3140. return;
  3141. }
  3142. this.setLeftType(5,this.curTreeData,this.curTreeNode);
  3143. },
  3144. //显示别名弹窗
  3145. aliasShow(){
  3146. this.aliasVisible = true;
  3147. if(this.nodeDetail.fullName){
  3148. this.aliasArr = this.nodeDetail.fullName.split(',');
  3149. }else{
  3150. this.aliasArr = [];
  3151. }
  3152. this.aliasInput = '';
  3153. },
  3154. addAlias(){
  3155. if(this.aliasInput){
  3156. this.aliasArr.push(this.aliasInput);
  3157. this.aliasInput = '';
  3158. }
  3159. },
  3160. delAlias(index){
  3161. this.aliasArr.splice(index,1);
  3162. },
  3163. saveAliasHandle(){
  3164. this.nodeDetail.fullName = this.aliasArr.join(',');
  3165. if (this.editType == 1) {
  3166. //新增
  3167. this.aliasVisible = false;
  3168. } else if (this.editType == 2) {
  3169. //编辑 公有
  3170. submitFullName(
  3171. this.nodeDetail.id,this.nodeDetail.fullName
  3172. ).then(()=>{
  3173. this.$message({
  3174. type: 'success',
  3175. message: '保存成功',
  3176. })
  3177. this.aliasVisible = false;
  3178. })
  3179. }
  3180. },
  3181. //树形控件菜单相关方法
  3182. mouseout(){
  3183. this.menuvisible=false
  3184. },
  3185. //展示菜单
  3186. showMenu(e,data,node){
  3187. e.preventDefault();
  3188. console.log(e,'e');
  3189. var x = e.pageX; //这个应该是相对于整个浏览器页面的x坐标,左上角为坐标原点(0,0)
  3190. var y = e.pageY; //这个应该是相对于整个浏览器页面的y坐标,左上角为坐标原点(0,0)
  3191. this.menutop = y;
  3192. this.menuleft = x;
  3193. this.menuvisible=true
  3194. },
  3195. menuClick(e,item,data){
  3196. this.menuKey=''
  3197. e.preventDefault();
  3198. if(item.key==='add'){
  3199. this.addNodeHandle()
  3200. this.menuKey='add'
  3201. }
  3202. else if(item.key==='edit'){
  3203. this.editNodeHandle()
  3204. this.menuKey='edit'
  3205. }
  3206. else if(item.key==='del'){
  3207. this.menuKey='del'
  3208. this.delNodeHandle()
  3209. }else if(item.key==='copy'){
  3210. this.$message.info('暂无相关接口')
  3211. }
  3212. else if(item.key==='sort'){
  3213. this.menuKey='sort'
  3214. this.paixuMD(data)
  3215. }
  3216. },
  3217. },
  3218. components: {
  3219. ManualSorting,
  3220. FormulaEdit,
  3221. FormulaEditone
  3222. }
  3223. };
  3224. </script>
  3225. <style scoped lang="scss">
  3226. //树结构超长后产生滚动条
  3227. .el-tree > .el-tree-node {
  3228. min-width: 100%;
  3229. display: inline-block;
  3230. }
  3231. .font-s-12 /deep/ .iconfont {
  3232. font-size: 12px;
  3233. }
  3234. .el-popper[x-placement^="bottom"] {
  3235. margin-top: -6px;
  3236. }
  3237. .right-btn {
  3238. position: absolute;
  3239. right: 20px;
  3240. top: 10px;
  3241. font-size: 20px;
  3242. }
  3243. .custom-tree-node {
  3244. .normal-black {
  3245. display: none;
  3246. }
  3247. &:hover {
  3248. .normal-black {
  3249. display: inline-block;
  3250. }
  3251. }
  3252. &.show .normal-black {
  3253. display: inline-block;
  3254. }
  3255. }
  3256. .jiedian {
  3257. /deep/.el-dialog__body {
  3258. padding: 10px 20px !important;
  3259. }
  3260. }
  3261. .filter-tree {
  3262. min-width: 100%;
  3263. display: inline-block;
  3264. }
  3265. .full-dialog{
  3266. /deep/ .el-dialog__body{
  3267. padding-bottom: 0;
  3268. }
  3269. /deep/ .basic-container{
  3270. height: calc(100vh - 60px);
  3271. }
  3272. }
  3273. .titlerow{
  3274. // float: right;
  3275. background-color:rgba(31, 34, 41, 0.8);
  3276. padding-left:10px;
  3277. padding-right:10px;
  3278. text-align:right;
  3279. margin-top: -20px;
  3280. margin-left: -20px;
  3281. margin-right: -20px;
  3282. }
  3283. // 树形控件菜单样式
  3284. .contextmenu {
  3285. margin: 0;
  3286. background: #fff;
  3287. z-index: 1000;
  3288. position: fixed; //关键样式设置固定定位
  3289. list-style-type: none;
  3290. padding: 5px 0;
  3291. border-radius: 4px;
  3292. font-size: 12px;
  3293. font-weight: 400;
  3294. color: #333;
  3295. box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
  3296. }
  3297. .contextmenu li {
  3298. margin: 0;
  3299. padding: 7px 16px;
  3300. cursor: pointer;
  3301. }
  3302. .contextmenu li:hover {
  3303. background: #eee;
  3304. }
  3305. </style>