tree.vue 117 KB

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