databaseList.vue 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084
  1. <template>
  2. <div class="database_container">
  3. <div class="database_top">
  4. <div>
  5. <el-button v-permission="permissionBtn.edbDataPermission.edbData_addEdb"
  6. type="primary" @click="addHandler">添加指标</el-button>
  7. <el-button v-permission="permissionBtn.edbDataPermission.edbData_calcuEdb"
  8. type="primary" @click="addComputedHandler">计算指标</el-button>
  9. <el-button v-permission="permissionBtn.edbDataPermission.edbData_replaceEdb"
  10. type="primary" @click="replaceEdbHandler">替换指标</el-button>
  11. <el-button v-permission="permissionBtn.edbDataPermission.edbData_codeRun"
  12. type="primary" @click="$router.push({path: '/codecount'})">代码运算</el-button>
  13. <el-button v-permission="permissionBtn.edbDataPermission.edbData_dataAdjust"
  14. type="primary" @click="$router.push({path: '/adjustdata'})">数据调整</el-button>
  15. <el-button v-permission="permissionBtn.edbDataPermission.edbData_batchUpdate"
  16. type="primary" plain @click="updateHandler">一键更新</el-button>
  17. </div>
  18. <div class="top-right">
  19. <change-lang v-permission="permissionBtn.edbDataPermission.edbData_switchEn"
  20. :lang="currentLang" style="height: 32px;" @changeLang="changeLanguage"/>
  21. <el-select
  22. v-model="search_txt"
  23. v-loadMore="searchLoad"
  24. ref="searchRef"
  25. :filterable="!search_txt"
  26. remote
  27. clearable
  28. placeholder="指标ID/指标名称"
  29. style="width: 400px;margin-left:10px;"
  30. :remote-method="searchHandle"
  31. @click.native="inputFocusHandle"
  32. >
  33. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  34. <el-option
  35. v-for="item in searchOptions"
  36. :key="item.EdbInfoId"
  37. :label="currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName"
  38. :value="item.EdbInfoId"
  39. >
  40. </el-option>
  41. </el-select>
  42. </div>
  43. </div>
  44. <div class="database-label">
  45. <edb-label-list
  46. :currentLang="currentLang"
  47. :labelList="labelList"
  48. :activeLabelId="select_node"
  49. @clickLabel="changeCurrentLabel"
  50. @deleteLabel="deleteLabel"
  51. @moveLabel="({oldIndex,newIndex})=>{labelList[oldIndex] = labelList.splice(newIndex, 1, labelList[oldIndex])[0];}"
  52. />
  53. </div>
  54. <div class="database_main box" id="box" v-if="showData">
  55. <div class="main-left left" id="left">
  56. <div class="tree-cont">
  57. <el-tree
  58. ref="menuTree"
  59. class="target_tree"
  60. :data="treeData"
  61. node-key="UniqueCode"
  62. :props="defaultProp"
  63. :allow-drag="canDragHandle"
  64. :allow-drop="canDropHandle"
  65. :current-node-key="select_node"
  66. :default-expanded-keys="defaultShowNodes"
  67. draggable
  68. :expand-on-click-node="false"
  69. check-strictly
  70. empty-text="暂无目录"
  71. lazy
  72. :load="getLazyTreeData"
  73. @node-expand="handleNodeExpand"
  74. @node-collapse="handleNodeCollapse"
  75. @current-change="nodeChange"
  76. @node-drop="dropOverHandle"
  77. @node-drag-end="dropMouseLeave"
  78. @node-drag-leave="dropMouseLeave"
  79. @node-drag-enter="dropMouseOver"
  80. >
  81. <span
  82. class="custom-tree-node"
  83. slot-scope="{ node, data }"
  84. >
  85. <el-input
  86. ref="editVal"
  87. style="width: 90px"
  88. placeholder="请输入值"
  89. class="label-input"
  90. v-model="new_label"
  91. v-if="data.isEdit"
  92. @blur="changeValue(node, data)"
  93. />
  94. <span
  95. @dblclick.stop="editNodeLabel(node, data)"
  96. v-else
  97. class="text_oneLine node_label"
  98. :style="`width:${(select_node === data.UniqueCode && node.Nodewidth) || ''}`"
  99. :id="`node${data.UniqueCode}`"
  100. >
  101. <span>{{ currentLang==='en' ? (data.ClassifyNameEn||data.ClassifyName) : data.ClassifyName }}</span>
  102. </span>
  103. <span
  104. style="display: flex; align-items: center"
  105. v-if="select_node === data.UniqueCode"
  106. >
  107. <img
  108. src="~@/assets/img/data_m/move_ico.png"
  109. alt=""
  110. style="width: 14px; height: 14px; margin-right: 8px"
  111. v-if="data.Button.MoveButton"
  112. />
  113. <img
  114. src="~@/assets/img/set_m/add.png"
  115. alt=""
  116. style="width: 14px; height: 14px; margin-right: 8px"
  117. @click.stop="addNode(node,data)"
  118. v-if="data.Button.AddButton"
  119. />
  120. <!--如果是分类,判断data.Button.OpButton不变;如果是指标,再加上checkPermissionBtn判断-->
  121. <img
  122. src="~@/assets/img/set_m/edit.png"
  123. alt=""
  124. style="width: 15px; height: 14px; margin-right: 8px"
  125. @click.stop="editNode(node,data)"
  126. v-if="data.EdbCode
  127. ?(data.Button.OpButton&&permissionBtn.checkPermissionBtn(permissionBtn.edbDataPermission.edbData_edit))
  128. :(data.Button.OpButton)"
  129. />
  130. <img
  131. slot="reference"
  132. src="~@/assets/img/set_m/del.png"
  133. alt=""
  134. style="width: 14px; height: 14px;"
  135. @click.stop="removeNode(node,data)"
  136. v-if="data.Button.DeleteButton"
  137. />
  138. <i class="el-icon-view" v-if="data.EdbType===2&&![58,59,67,68].includes(data.Source)" @click.stop="viewNode(node,data)"></i>
  139. <img
  140. v-if="data.Button.ShowChartRelation"
  141. @click.stop="showAssociateChart=true,showAssociateComputeData=false"
  142. src="~@/assets/img/icons/associate_chart.png"
  143. style="width: 14px; height: 14px;margin-left: 8px"
  144. alt=""
  145. />
  146. <img
  147. v-if="data.Button.ShowEdbRelation"
  148. @click.stop="showAssociateComputeData=true,showAssociateChart=false"
  149. src="~@/assets/img/icons/associate_data.png"
  150. style="width: 14px; height: 14px;margin-left: 8px"
  151. alt=""
  152. />
  153. </span>
  154. </span>
  155. </el-tree>
  156. <div class="noDepart" @click="addLevelOneHandle" v-if="CanOpClassify">
  157. <img
  158. src="~@/assets/img/set_m/add_ico.png"
  159. alt=""
  160. style="width: 16px; height: 16px; margin-right: 10px"
  161. />
  162. <span>添加一级目录</span>
  163. </div>
  164. </div>
  165. <span class="move-btn resize" v-drag id="resize" @mousemove="dynamicNode&&resetNodeStyle(dynamicNode)">
  166. </span>
  167. </div>
  168. <!-- 指标关联图模块 -->
  169. <div class="main-right right" id="right" style="background:transparent;border:none;box-shadow:none" v-if="showAssociateChart">
  170. <dataAssociateChart :edbInfoId="selected_edbid"></dataAssociateChart>
  171. </div>
  172. <div class="main-right right" id="right" style="background:transparent;border:none;box-shadow:none" v-if="showAssociateComputeData">
  173. <dataAssociateComputeData :edbInfoId="selected_edbid"></dataAssociateComputeData>
  174. </div>
  175. <div class="main-right right" id="right" v-show="!showAssociateChart&&!showAssociateComputeData">
  176. <el-table
  177. :data="tableData"
  178. style="box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2);"
  179. class="firstColumTable"
  180. border>
  181. <el-table-column
  182. v-for="item in tableColumsOne"
  183. :key="item.label"
  184. :width="item.widthsty"
  185. :min-width="item.minwidthsty"
  186. align="center"
  187. >
  188. <template slot="header" slot-scope="scope">
  189. <div class="chartEn-mark" style="top: -10px;" v-show="scope.$index ==0 && tableData[0] && tableData[0].IsEnEdb" >En</div>
  190. <span>{{item.label}}</span>
  191. </template>
  192. <template slot-scope="scope">
  193. <!-- 中文 -->
  194. <span v-show="currentLang=='ch'">{{ scope.row[item.key] }}</span>
  195. <span v-show="currentLang=='en'">{{scope.row[item.enKey||item.key] || scope.row[item.key]}}</span>
  196. </template>
  197. </el-table-column>
  198. </el-table>
  199. <el-table
  200. :data="tableData"
  201. style="box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2);"
  202. border>
  203. <el-table-column
  204. v-for="item in tableColumsTwo"
  205. :key="item.label"
  206. :label="item.label"
  207. :width="item.widthsty"
  208. :min-width="item.minwidthsty"
  209. align="center"
  210. >
  211. <template #header>
  212. <span>{{ item.label }}</span>
  213. </template>
  214. <template slot-scope="scope">
  215. <span>{{ scope.row[item.key] }}</span>
  216. </template>
  217. </el-table-column>
  218. <el-table-column
  219. width="260"
  220. align="center"
  221. label="操作"
  222. >
  223. <template slot-scope="scope">
  224. <el-button v-permission="permissionBtn.edbDataPermission.edbData_update"
  225. size="mini" type="text" @click="refreshTargetHandle" >更新</el-button>
  226. <el-button
  227. v-permission="permissionBtn.edbDataPermission.edbData_edit"
  228. size="mini"
  229. type="text"
  230. :disabled="!scope.row.Button.OpButton"
  231. @click="editNode({
  232. level: 4,
  233. parent: {
  234. data: { ClassifyId:edb_levels[2].ClassifyId },
  235. parent:{
  236. data: { ClassifyId:edb_levels[1].ClassifyId },
  237. parent:{
  238. data: { ClassifyId:edb_levels[0].ClassifyId },
  239. }
  240. },
  241. }
  242. },scope.row)"
  243. >编辑</el-button>
  244. <el-button size="mini" type="text" @click.stop="reCalculateHandler" v-if="scope.row.EdbType===2" :loading="calculateLoading">重新计算</el-button>
  245. <el-button v-if="permissionBtn.checkPermissionBtn(permissionBtn.edbDataPermission.edbData_toImgs)"
  246. size="mini" type="text" @click.stop="createChartHandle(scope.row.EdbInfoId)">一键成图</el-button>
  247. <el-button v-if="permissionBtn.checkPermissionBtn(permissionBtn.edbDataPermission.edbData_copyData)"
  248. size="mini" type="text" @click="copyCode">复制数据</el-button>
  249. <!-- <lookEdbHistory :showType="2" :edbId="selected_edbid" v-if="scope.row.EdbType===2"/> -->
  250. <el-button size="mini" type="text"
  251. v-if="scope.row.EdbType===2&&permissionBtn.checkPermissionBtn(permissionBtn.edbDataPermission.edbData_edbSource)" @click="isLookHistory=true;lookEdbId=selected_edbid">指标溯源</el-button>
  252. <el-button v-if="permissionBtn.checkPermissionBtn(permissionBtn.edbDataPermission.edbData_enNameSetting)"
  253. size="mini" type="text" @click="openEnNameDia">设置英文名称</el-button>
  254. <el-button size="mini" type="text" @click.stop="updateNewestDataHandle"
  255. v-if="scope.row.Button.InsertNewDataButton&&permissionBtn.checkPermissionBtn(permissionBtn.edbDataPermission.edbData_newestValue)" >{{scope.row.DataInsertConfig.Date?'编辑最新值':'添加最新值'}}</el-button>
  256. <el-button size="mini" type="text" @click.stop="refreshBaseHandler"
  257. v-if="scope.row.EdbType===1&&permissionBtn.checkPermissionBtn(permissionBtn.edbDataPermission.edbData_refreshAll)" :loading="refreshLoading">全部刷新</el-button>
  258. </template>
  259. </el-table-column>
  260. <div slot="empty" style="padding: 50px 0 320px;">
  261. <tableNoData :text="defaultWarn"/>
  262. </div>
  263. </el-table>
  264. <ul
  265. class="value-ul"
  266. ref="valueUl"
  267. @scroll="scrollHandle"
  268. v-show="showTable&&dataList.length">
  269. <li
  270. class="value-item"
  271. v-for="item in dataList"
  272. :key="item.EdbDataId"
  273. >
  274. <span class="value-label">
  275. <i class="new-tag" v-if="tableData[0].LatestDate===item.DataTime"></i>
  276. {{item.DataTime}}
  277. </span>
  278. <span :class="['value-label',{'predict-act': tableData[0].DataInsertConfig.Date===item.DataTime}]" style="min-width:200px;text-align:center;">{{item.Value}}</span>
  279. </li>
  280. <li class="nodata value-item" v-if="!dataList.length">暂无数据</li>
  281. </ul>
  282. </div>
  283. </div>
  284. <!-- 输入英文指标弹窗 -->
  285. <set-en-name-dia :isOpenDialog="setEnName" @cancel="setEnName=false"
  286. :formData="formItemArray" @updateEnName="updateEnName" cType="ebd" />
  287. <!-- 目录弹窗 -->
  288. <openDialog
  289. :isOpenDialog="isOpenDialog"
  290. :title="dialog_title"
  291. :formData="dialogForm"
  292. @closeDia="isOpenDialog=false"
  293. @sucessCallback="sucessCallback"
  294. />
  295. <!-- 指标弹窗 -->
  296. <addTargetDiaBase
  297. ref="addTargetDiaBase"
  298. :isAddTarget="isAddTarget"
  299. @cancelHandle="isAddTarget = false"
  300. />
  301. <!-- 完善指标信息 -->
  302. <completeTargetDia
  303. :isOpenDialog="isComplete"
  304. @cancel="cacelCompleteCallback"
  305. :params="add_params"
  306. @addTargetCallback="addTargetCallback"
  307. />
  308. <!-- 计算指标弹窗 -->
  309. <computedDialog
  310. :isOpenComputed="computed_type === 4"
  311. :title="computedTit"
  312. :calulateForm="calulateForm"
  313. :calulateList="calulateList"
  314. @cancel="computed_type=0"
  315. @addCallBack="addComputedCallBack"
  316. @openPrev="isOpenComputed=true"
  317. @lookHistory="id => {isLookHistory=true;lookEdbId=id;}"
  318. />
  319. <!-- 计算弹窗控制 -->
  320. <el-dialog
  321. :visible.sync="isOpenComputed"
  322. :close-on-click-modal="false"
  323. :modal-append-to-body='false'
  324. @close="isOpenComputed=false;"
  325. custom-class="dialog-computed"
  326. top="12vh"
  327. center
  328. width="920px"
  329. v-dialogDrag>
  330. <div class="dialog-computed-header">
  331. <el-radio-group v-model="computed_source" size="medium" @change="computed_type = 0">
  332. <el-radio-button :label="1">常规计算</el-radio-button>
  333. <el-radio-button :label="2">批量计算</el-radio-button>
  334. </el-radio-group>
  335. </div>
  336. <ul class="computed-ul">
  337. <li
  338. :class="['cpmputed-li',{'act':item.type === computed_type}]"
  339. v-for="item in computedTypes"
  340. :key="item.type"
  341. @click="changeComputedType(item.type)">
  342. {{item.name}}
  343. <el-popover
  344. placement="top-start"
  345. width="450"
  346. trigger="hover"
  347. v-if="tips.get(item.type)"
  348. >
  349. <p style="padding:20px;line-height:25px;" v-html="tips.get(item.type)"/>
  350. <i slot="reference" class="el-icon-warning-outline"/>
  351. </el-popover>
  352. </li>
  353. </ul>
  354. </el-dialog>
  355. <!-- 转月值 同比 同差 平均值弹窗 -->
  356. <operationDialog
  357. :isOperation="([5,6,7,8,12,13,14,22,35,51,52,61,62,63].includes(computed_type) || (computed_type===40&&operationForm.view)) && computed_source===1"
  358. :type="computed_type"
  359. :operationForm="operationForm"
  360. @cancel="computed_type=0"
  361. @addCallBack="addComputedCallBack"
  362. @openPrev="isOpenComputed=true"
  363. @lookHistory="id => {isLookHistory=true;lookEdbId=id;}"
  364. @changeSource="changeComputedType"
  365. />
  366. <!-- 一键成图弹窗 -->
  367. <create-chart
  368. :isCreateChart="isCreateChart"
  369. :edbid="selected_edbid"
  370. :chartLang="currentLang"
  371. ref="createChart"
  372. @close="isCreateChart = false"
  373. @editEnName="openEnNameDia"
  374. />
  375. <!-- 一键更新弹窗 -->
  376. <update-dialog
  377. :isUpdate="isUpdate"
  378. @cancel="isUpdate = false"
  379. />
  380. <!-- 替换指标弹窗 -->
  381. <replace-dialog
  382. :isShow="isReplaceDia"
  383. @cancel="isReplaceDia = false"
  384. />
  385. <!-- 拼接弹窗 -->
  386. <joint-target-dia
  387. :isShow="computed_type === 'joint'"
  388. :params="operationForm"
  389. @cancel="computed_type=0"
  390. @addCallBack="addComputedCallBack"
  391. @openPrev="isOpenComputed=true"
  392. />
  393. <!-- 拟合残差弹窗 -->
  394. <fittingResidueDia
  395. :isShow="computed_type === 37 && computed_source===1"
  396. :type="37"
  397. :operationForm="operationForm"
  398. @cancel="computed_type=0"
  399. @addCallBack="addComputedCallBack"
  400. @openPrev="isOpenComputed=true"
  401. />
  402. <!-- 批量计算弹窗 -->
  403. <batchComputedDialog
  404. :isBatchComputed="[6,7,8,12,13,14,5,61,62,63].includes(computed_type) && computed_source===2"
  405. :type="computed_type"
  406. @cancel="computed_type=0"
  407. @addCallBack="addComputedCallBack"
  408. @openPrev="isOpenComputed=true"
  409. @lookHistory="id => {isLookHistory=true;lookEdbId=id;}"
  410. @changeSource="changeComputedType"
  411. />
  412. <!-- 扩散指数弹窗 -->
  413. <diffusionIndexDialog
  414. :isShow="computed_type === 53 && computed_source===1"
  415. :type="computed_type"
  416. :operationForm="operationForm"
  417. @cancel="computed_type=0"
  418. @addCallBack="addComputedCallBack"
  419. @openPrev="isOpenComputed=true"
  420. />
  421. <!-- 添加最新值弹窗 -->
  422. <updateNewestDataDia
  423. :isShow.sync="isUpdateNewestData"
  424. :edbinfo="tableData[0]"
  425. :dataList="dataList"
  426. @success="initGetData"
  427. />
  428. <!-- 指标历史记录 -->
  429. <edbHistoryDialog
  430. :isOpenDialog.sync="isLookHistory"
  431. :edbId="lookEdbId"
  432. />
  433. </div>
  434. </template>
  435. <script>
  436. import { dataBaseInterface } from '@/api/api.js';
  437. import { computedTypes,computedBatchTypes,formulaTip } from './databaseComponents/util';
  438. import openDialog from './databaseComponents/openDialog';
  439. import addTargetDiaBase from './databaseComponents/addTargetDiaBase';
  440. import completeTargetDia from './databaseComponents/completeTargetDia'
  441. import computedDialog from './databaseComponents/computedDialog';
  442. import operationDialog from './databaseComponents/operationDialog';
  443. import createChart from './databaseComponents/createChart';
  444. import updateDialog from './databaseComponents/updateDialog';
  445. import replaceDialog from './databaseComponents/replaceDialog';
  446. import jointTargetDia from './databaseComponents/jointTargetDia';
  447. import changeLang from "./components/changeLang.vue"
  448. import setEnNameDia from "./components/setEnNameDia.vue"
  449. import dataAssociateChart from './databaseComponents/dataAssociateChart.vue'
  450. import dataAssociateComputeData from './databaseComponents/dataAssociateComputeData.vue'
  451. import fittingResidueDia from './databaseComponents/fittingResidueDia.vue';
  452. import batchComputedDialog from './databaseComponents/batchComptedDialog.vue';
  453. import diffusionIndexDialog from './databaseComponents/diffusionIndexDia.vue';
  454. import updateNewestDataDia from './databaseComponents/updateNewestDia.vue';
  455. import EdbLabelList from '@/components/edbLabelList.vue';
  456. export default {
  457. name: '',
  458. components: {
  459. openDialog,
  460. addTargetDiaBase,
  461. completeTargetDia,
  462. computedDialog,
  463. operationDialog,
  464. createChart,
  465. updateDialog,
  466. replaceDialog,
  467. jointTargetDia,
  468. changeLang,
  469. setEnNameDia,
  470. dataAssociateChart,
  471. dataAssociateComputeData,
  472. fittingResidueDia,
  473. batchComputedDialog,
  474. diffusionIndexDialog,
  475. updateNewestDataDia,
  476. EdbLabelList
  477. },
  478. directives: {
  479. drag(el, bindings) {
  480. el.onmousedown = function(e) {
  481. var init = e.clientX;
  482. // console.log(init);
  483. var box = $("#box")[0]
  484. // console.log(box.clientWidth)
  485. let total_wid = box.offsetWidth
  486. var left = $("#left")[0];
  487. var right = $("#right")[0];
  488. var initWidth = left.offsetWidth;
  489. document.onmousemove = function(e) {
  490. var end = e.clientX;
  491. // console.log(total_wid,initWidth,end);
  492. if(end > 310){
  493. var newWidth = end - init + initWidth;
  494. // right.style.width = total_wid-end+80 +'px'
  495. right.style.width = total_wid - newWidth + 'px'
  496. left.style.width = newWidth + "px";
  497. }else{
  498. end = 350;
  499. // 最小宽度300
  500. left.style.width = 300 + "px";
  501. // right.style.width = total_wid-300-20 +'px'
  502. }
  503. };
  504. document.onmouseup = function() {
  505. document.onmousemove = document.onmouseup = null;
  506. e.releaseCapture && e.releaseCapture();
  507. };
  508. e.setCapture && e.setCapture();
  509. return false;
  510. };
  511. }
  512. },
  513. data() {
  514. return {
  515. showData: false,
  516. search_txt: '', //搜索词
  517. searchOptions:[],//搜索到的筛选列表
  518. treeData: [], //树形数据
  519. defaultShowNodes:[], //默认展开的节点
  520. defaultProp: {
  521. label: 'ClassifyName',
  522. children: 'Children',
  523. isLeaf:'isLeaf'
  524. },//树结构配置项
  525. tableData: [],
  526. loading:null,
  527. showTable:false,
  528. page_no: 1,
  529. /*表格列 */
  530. tableColumsOne: [
  531. {
  532. label: '指标ID',
  533. key: 'EdbCode',
  534. minwidthsty: '150px'
  535. },
  536. {
  537. label: '指标名称',
  538. key: 'EdbName',
  539. enKey:'EdbNameEn',
  540. inputTip:'点击输入英文指标名称',
  541. minwidthsty: '200px'
  542. },
  543. {
  544. label: '频度',
  545. key: 'Frequency',
  546. enKey:'FrequencyEn',
  547. widthsty: '100px'
  548. },
  549. {
  550. label: '单位',
  551. key: 'Unit',
  552. enKey:'UnitEn',
  553. inputTip:'英文单位',
  554. // minwidthsty: '50px'
  555. widthsty: '100px'
  556. },
  557. {
  558. label: '数据来源',
  559. key: 'SourceName',
  560. widthsty: '160px'
  561. },
  562. ],
  563. tableColumsTwo: [
  564. {
  565. label: '指标目录',
  566. key: 'Menu',
  567. minwidthsty: '117px',
  568. },
  569. {
  570. label: '起始时间',
  571. key: 'StartDate',
  572. minwidthsty: '115px',
  573. },
  574. {
  575. label: '更新时间',
  576. key: 'ModifyTime',
  577. minwidthsty: '118px',
  578. },
  579. {
  580. label: '添加人',
  581. key: 'SysUserRealName',
  582. widthsty: '100px',
  583. }
  584. ],
  585. haveMore: true,
  586. selected_edbid: 0,//选中的指标id
  587. dataList: [],//指标数值
  588. new_label: '',//新的节点label值
  589. select_node:'',//当前选中的节点
  590. /* 新增编辑目录弹窗 */
  591. isOpenDialog:false,
  592. dialog_title: '',
  593. dialogForm:{
  594. level:''
  595. },
  596. /* 新增指标弹窗 */
  597. isAddTarget: false,
  598. /* 完善信息 */
  599. isComplete:false,
  600. add_params:{},
  601. defaultWarn:'请在左侧选择指标',//缺省文字
  602. /* 计算指标弹窗 */
  603. isOpenComputed:false,
  604. computedTit:'',
  605. calulateForm:{},
  606. calulateList:[],
  607. computed_type:0,//打开弹窗的类型
  608. operationForm:{},
  609. dynamicNode:null,
  610. edb_source:0,//指标来源 显示计算按钮
  611. calculateLoading: false,//计算指标刷新loading
  612. refreshLoading: false,//基础指标刷新loading
  613. /* 一键成图弹窗 */
  614. isCreateChart: false,
  615. /* 一键更新弹窗 */
  616. isUpdate:false,
  617. /* 替换指标弹窗 */
  618. isReplaceDia: false,
  619. /* 拼接指标弹窗 */
  620. isJoint: false,
  621. search_page: 1,
  622. search_have_more: false,
  623. current_search:'',
  624. currentLang:'ch', // 语言 ch 中文 en 英文
  625. // -----------------设置英文指标弹窗
  626. setEnName:false,
  627. // 传入的formItem所需内容
  628. formItemArray:[],
  629. // 在哪里更新的英文指标 table(表格上) chart(图表里)
  630. updateType:'table',
  631. // ----------------------
  632. edb_levels:[],//指标的父级分类id
  633. showAssociateChart:false,//显示指标关联的图
  634. showAssociateComputeData:false,//显示指标关联的引用计算指标
  635. tips: formulaTip,//公式说明
  636. computedBatchTypes,
  637. computed_source: 1,//计算类型 1常规 2批量
  638. isBatchComputed: false,//批量计算弹窗
  639. //添加最新值弹窗
  640. isUpdateNewestData: false,
  641. /* 查看历史弹窗 */
  642. isLookHistory: false,
  643. lookEdbId: 0,
  644. labelList:[],//标签列表
  645. CanOpClassify: false
  646. };
  647. },
  648. watch: {
  649. selected_edbid(newval) {
  650. if(!newval) {
  651. this.tableData = [];
  652. this.dataList = [];
  653. this.defaultWarn = '请在左侧选择指标';
  654. }else {
  655. this.initGetData();
  656. }
  657. },
  658. /* 选中搜索指标 展开目录 选中指标 展示数据 */
  659. search_txt(newval) {
  660. if (newval) {
  661. let [search_obj] = this.searchOptions.filter(
  662. (item) => item.EdbInfoId === newval
  663. );
  664. this.page_no = 1;
  665. this.$refs.valueUl.scrollTop = 0;
  666. // 查找图表的父级code
  667. //this.defaultShowNodes = this.findParentNodeHandle(this.treeData,search_obj.ClassifyId);
  668. this.select_node = search_obj.UniqueCode;
  669. this.selected_edbid = newval;
  670. //滚动到高亮节点位置
  671. /* setTimeout(() => {
  672. this.$refs.menuTree.setCurrentKey(this.select_node);
  673. let node = document.getElementById(`node${this.select_node}`);
  674. let parent = document.getElementsByClassName('tree-cont')[0];
  675. if(node.offsetTop > parent.offsetHeight) {
  676. parent.scrollTop = node.offsetTop - parent.offsetHeight/2
  677. }
  678. },400) */
  679. }
  680. },
  681. },
  682. computed: {
  683. /* 计算弹窗控制 */
  684. computedTypes() {
  685. return this.computed_source===1 ? computedTypes : computedBatchTypes;
  686. },
  687. role() {
  688. let role = localStorage.getItem('Role') || '';
  689. if (['rai_researcher', 'ficc_researcher', 'researcher','ficc_seller','rai_seller','seller'].includes(role)) {
  690. return 'researcher'
  691. }else if(['rai_admin','ficc_admin'].includes(role)) {
  692. return 'admin'
  693. }
  694. else {
  695. return role;
  696. }
  697. },
  698. /* 登录角色id */
  699. roleId() {
  700. let id = parseInt(localStorage.getItem('AdminId'));
  701. return id;
  702. },
  703. },
  704. methods: {
  705. /* 获取树分类数据 */
  706. getTreeData(params) {
  707. dataBaseInterface.menuListV3().then(res=>{
  708. if(res.Ret===200){
  709. const arr=res.Data.AllNodes || []
  710. this.treeData=arr.map(item=>{
  711. return {
  712. ...item,
  713. isLeaf:item.Children.length?false:true
  714. }
  715. })
  716. this.CanOpClassify = res.Data.CanOpClassify;
  717. this.currentLang = res.Data.Language === 'EN' ? 'en' : 'ch';
  718. this.setLangIntoStore()
  719. this.showData = true;
  720. /* 处理树展开和选中图表 */
  721. params && this.selectCurrentNode(params);
  722. !params && this.select_node && this.$refs.menuTree.setCurrentKey(this.select_node);
  723. }
  724. })
  725. },
  726. /* 获取最新的指标 默认展示 */
  727. getNewTargetList: _.throttle(function() {
  728. dataBaseInterface.targetNew().then(res => {
  729. if(res.Ret === 200) {
  730. /* 默认选中 默认指标id */
  731. this.select_node = res.Data ? res.Data.UniqueCode : '';
  732. this.selected_edbid = res.Data ? res.Data.EdbInfoId : 0;
  733. this.getTreeData();
  734. }
  735. })
  736. }),
  737. /* 获取指标数据 */
  738. getDataList: _.throttle(function(type) {
  739. dataBaseInterface.targetList({
  740. PageSize: 20,
  741. CurrentIndex: this.page_no,
  742. EdbInfoId: this.selected_edbid,
  743. // KeyWord: this.search_txt,
  744. }).then(res => {
  745. if(res.Ret === 200) {
  746. this.showTable = true;
  747. if(res.Data) {
  748. // res.Data.Item.ModifyTime = res.Data.Item.ModifyTime.substr(0,10);
  749. let classify_arr = res.Data.ClassifyList || [];
  750. let str = '';
  751. classify_arr.length && classify_arr.reverse().map((item) => str += item.ClassifyName + '/');
  752. this.edb_levels = classify_arr;
  753. this.$set(res.Data.Item,'Menu',str);
  754. this.tableData = [res.Data.Item] || [];
  755. this.edb_source = res.Data.Item.Source;
  756. this.haveMore = this.page_no < res.Data.Paging.Pages ? true : false;
  757. this.dataList = this.page_no === 1 ? (res.Data.Item.DataList || []) : this.dataList.concat(res.Data.Item.DataList);
  758. //将指标添加进标签列表中
  759. const {EdbNameEn,EdbName,EdbInfoId,UniqueCode,ClassifyId}=res.Data.Item
  760. this.addLabel({code:UniqueCode,id:EdbInfoId,classifyId:ClassifyId,EdbName,EdbNameEn})
  761. this.defaultShowNodes=this.findParentNodeHandle(this.treeData,ClassifyId)
  762. //设置tree高亮
  763. this.$refs.menuTree.setCurrentKey(UniqueCode);
  764. }else {
  765. this.tableData = [];
  766. this.dataList = [];
  767. this.defaultWarn = type=== 'search' ? '未搜索到该指标' : '请在左侧选择指标'
  768. this.$refs.menuTree.setCurrentKey(null)
  769. }
  770. if(type==='refresh') {
  771. this.$refs.valueUl.scrollTop = 0;
  772. }
  773. this.$nextTick(()=>{
  774. const _node = this.$refs.menuTree.getNode(this.select_node)
  775. this.dynamicNode = _node;
  776. this.dynamicNode&&this.resetNodeStyle(this.dynamicNode)
  777. //滚动到高亮位置
  778. setTimeout(() => {
  779. let node = document.getElementById(`node${this.select_node}`)||{}
  780. let parent = document.getElementsByClassName('tree-cont')[0];
  781. if(node.offsetTop > parent.offsetHeight) {
  782. parent.scrollTop = node.offsetTop - parent.offsetHeight/2
  783. }
  784. },400)
  785. })
  786. }
  787. })
  788. }),
  789. /* 搜索 */
  790. searchHandle(query) {
  791. this.search_page = 1;
  792. this.current_search = query;
  793. this.searchApi(this.current_search)
  794. },
  795. searchApi(query,page=1) {
  796. dataBaseInterface.targetSearchByPage({
  797. KeyWord:query,
  798. CurrentIndex: page
  799. }).then(res => {
  800. if(res.Ret !== 200) return
  801. const { List,Paging } = res.Data;
  802. this.search_have_more = page < Paging.Pages;
  803. this.searchOptions = page === 1 ? List : this.searchOptions.concat(List);
  804. })
  805. },
  806. /* 聚焦获取当前检索 */
  807. inputFocusHandle(e) {
  808. this.search_page = 1;
  809. this.current_search = e.target.value;
  810. this.searchApi(this.current_search);
  811. },
  812. searchLoad() {
  813. if(!this.search_have_more) return;
  814. this.searchApi(this.current_search,++this.search_page);
  815. },
  816. /* 存储中英文状态 */
  817. setLangIntoStore() {
  818. this.$store.commit('edb/SET_LANG',this.currentLang)
  819. },
  820. /* 数值滚动加载 */
  821. scrollHandle: _.throttle(function() {
  822. let scrollTop = this.$refs.valueUl.scrollTop;
  823. let clientHeight = this.$refs.valueUl.clientHeight;
  824. let scrollHeight = this.$refs.valueUl.scrollHeight;
  825. console.log('scrollTop:',scrollTop)
  826. console.log('clientHeight:',clientHeight)
  827. console.log('scrollHeight:',scrollHeight)
  828. if(scrollTop + clientHeight >= scrollHeight-10 && this.haveMore){
  829. this.page_no ++;
  830. this.getDataList();
  831. }
  832. },200),
  833. /* 切换中英文 */
  834. changeLanguage: _.debounce(async function (lang){
  835. this.search_txt = '';
  836. this.currentLang = lang;
  837. await dataBaseInterface.setUserLang({
  838. ConfigCode: 'edb_language',
  839. ConfigValue: lang === 'en' ? 'EN' : 'CN'
  840. })
  841. this.setLangIntoStore()
  842. },200),
  843. // 打开 编辑英文名称弹窗
  844. openEnNameDia(type='table'){
  845. this.updateType = type
  846. this.formItemArray=[{
  847. label:'指标名称',
  848. value:this.tableData[0].EdbName,
  849. key:'EdbName',
  850. notEdit:true
  851. }]
  852. // 中文单位有 才能编辑英文单位
  853. if(this.tableData[0].Unit && this.tableData[0].Unit!='无'){
  854. this.formItemArray.push({
  855. label:'单位',
  856. value:this.tableData[0].Unit,
  857. key:'Unit',
  858. notEdit:true
  859. },
  860. {
  861. label:'英文指标名称',
  862. value:this.tableData[0].EdbNameEn,
  863. key:'EdbNameEn',
  864. placeholder:'请输入英文指标名称'
  865. },
  866. {
  867. label:'英文单位',
  868. value:this.tableData[0].UnitEn,
  869. key:'UnitEn',
  870. placeholder:'请输入英文单位'
  871. })
  872. }else{
  873. this.formItemArray.push({
  874. label:'英文指标名称',
  875. value:this.tableData[0].EdbNameEn,
  876. key:'EdbNameEn',
  877. placeholder:'请输入英文指标名称'
  878. })
  879. }
  880. this.setEnName = true
  881. },
  882. updateEnName(item){
  883. let params={
  884. EdbInfoId: Number(this.selected_edbid),
  885. ...item
  886. }
  887. dataBaseInterface.edbInfoEditEn(params).then(res=>{
  888. if(res.Ret ==200){
  889. this.$message({
  890. message:res.Msg,
  891. type:"success"
  892. })
  893. /* this.tableData[0].EdbNameEn = params.EdbNameEn
  894. this.tableData[0].UnitEn = params.UnitEn
  895. // 判断图表英文名称和英文单位是否都有,都有需要打上 英文标记
  896. console.log(this.tableData[0].EdbNameEn,this.tableData[0].UnitEn);
  897. if(this.tableData[0].EdbNameEn && (this.tableData[0].UnitEn || this.tableData[0].Unit == '无')){
  898. this.tableData[0].IsEnEdb=true
  899. }else{
  900. this.tableData[0].IsEnEdb=false
  901. } */
  902. this.getTreeData()
  903. this.getDataList()
  904. if(this.updateType=='chart'){
  905. // 重绘图表,刷新数据
  906. this.$refs.createChart.getEdbData()
  907. }
  908. this.setEnName = false
  909. }
  910. })
  911. },
  912. /* 新增指标 */
  913. addHandler() {
  914. this.isAddTarget = true;
  915. },
  916. /* 完善指标信息 */
  917. completeTargetHandle(params) {
  918. this.add_params = params;
  919. this.isComplete = true;
  920. },
  921. /* 新增指标成功回调 */
  922. addTargetCallback(params) {
  923. this.$refs.addTargetDiaBase.init();
  924. this.isComplete = false;
  925. this.isAddTarget = false;
  926. this.getTreeData(params);
  927. this.changeTreeNode()
  928. // this.getNewTargetList();
  929. },
  930. /* 取消新增回调 */
  931. cacelCompleteCallback() {
  932. this.isComplete = false
  933. this.add_params = {}
  934. },
  935. /* 节点变化时 */
  936. nodeChange(data,node) {
  937. this.dynamicNode = node;
  938. this.search_txt = '';
  939. this.showAssociateChart=false
  940. this.showAssociateComputeData=false
  941. // this.page_no = 1;
  942. // this.$refs.valueUl.scrollTop = 0;
  943. this.select_node = data.UniqueCode;
  944. this.selected_edbid = data.EdbInfoId;
  945. this.resetNodeStyle(node);
  946. },
  947. resetNodeStyle: _.debounce(function(node) {
  948. const tree = $('.target_tree')[0];
  949. let width = tree.offsetWidth;
  950. console.log(width)
  951. // let label_wid = width > 500 ? 'auto' : (width <= 300 && width < 360) ? 100 : 0.7*width;
  952. let label_wid =
  953. width > 500
  954. ? 'auto'
  955. : width <= 260
  956. ? 80
  957. : 0.5 * width;
  958. this.$set(node, 'Nodewidth', label_wid + 'px');
  959. },200),
  960. /* 双击label出现input修改框 */
  961. editNodeLabel(node, data) {
  962. //目录名称可以双击修改 指标不能
  963. if(!data.EdbCode && this.role === 'admin') {
  964. this.$set(data,'isEdit',true)
  965. this.new_label = data.ClassifyName;
  966. this.$nextTick(() => {
  967. this.$refs.editVal.focus();
  968. });
  969. }
  970. },
  971. /* input失去焦点恢复node 修改最新的值*/
  972. changeValue(node, data) {
  973. if(this.new_label) {
  974. this.$set(data,'isEdit',false)
  975. this.new_label !== data.ClassifyName && dataBaseInterface.nodeEdit({
  976. ClassifyId: data.ClassifyId,
  977. ClassifyName: this.new_label
  978. }).then(res => {
  979. if(res.Ret === 200) {
  980. this.getTreeData();
  981. }
  982. })
  983. }else {
  984. this.$message.warning('名称不能为空')
  985. }
  986. },
  987. /* 添加一级目录 */
  988. addLevelOneHandle() {
  989. this.dialog_title = '添加';
  990. this.dialogForm = {
  991. level_1: '',
  992. parent_id: '',
  993. level: 0
  994. }
  995. this.isOpenDialog = true;
  996. },
  997. /* 添加节点 */
  998. addNode(node,data) {
  999. // console.log(node,data);
  1000. this.dialog_title = '添加';
  1001. /* 添加目录 */
  1002. this.dialogForm = {
  1003. level_1: node.level === 1
  1004. ? data.ClassifyName
  1005. :node.level === 2
  1006. ? node.parent.data.ClassifyName
  1007. : node.parent.parent.data.ClassifyName,
  1008. level_2: node.level === 1
  1009. ? ''
  1010. :node.level === 2
  1011. ? data.ClassifyName
  1012. : node.parent.data.ClassifyName,
  1013. // level_3: node.level === 3
  1014. // ? data.ClassifyName
  1015. // : '',
  1016. parent_id: data.ClassifyId,
  1017. level: node.level
  1018. }
  1019. //存储当前要新增子级的目录code
  1020. sessionStorage.setItem('expandCode', data.UniqueCode);
  1021. this.isOpenDialog = true;
  1022. },
  1023. /* 编辑节点 */
  1024. editNode(node,data) {
  1025. this.dialog_title = '编辑';
  1026. if(data.EdbCode) {
  1027. /* 编辑指标 */
  1028. (data.EdbType===1 || [58,59,67,68].includes(data.Source)) && dataBaseInterface.targetDetail({
  1029. EdbInfoId: data.EdbInfoId
  1030. }).then(res => {
  1031. if(res.Ret === 200) {
  1032. this.dialogForm = {
  1033. level: node.level,
  1034. level_4: res.Data.EdbName,
  1035. level_menu:[
  1036. node.parent.parent.parent.data.ClassifyId,
  1037. node.parent.parent.data.ClassifyId,
  1038. node.parent.data.ClassifyId
  1039. ],
  1040. edbinfo_id: res.Data.EdbInfoId,
  1041. frequency:res.Data.Frequency,
  1042. unit:res.Data.Unit
  1043. }
  1044. this.isOpenDialog = true;
  1045. }
  1046. });
  1047. /* 编辑计算指标 同比同差转月 */
  1048. (data.EdbType === 2 && ![27,40,58,59].includes(data.Source)) && dataBaseInterface.calculateDetail({
  1049. EdbInfoId: data.EdbInfoId
  1050. }).then(res => {
  1051. if(res.Ret === 200) {
  1052. this.setComputedDialogForm(data.Source,node,data,res.Data);
  1053. this.computed_type = [23,24].includes(data.Source) ? 'joint' : data.Source;
  1054. }
  1055. })
  1056. /* 代码运算 */
  1057. data.Source === 27 && this.$router.push({
  1058. path: '/codecount',
  1059. query: {
  1060. edbid: data.EdbInfoId
  1061. }
  1062. })
  1063. /* 数据调整 */
  1064. data.Source === 40 && this.$router.push({
  1065. path: '/adjustdata',
  1066. query: {
  1067. edbid: data.EdbInfoId,
  1068. }
  1069. })
  1070. }else {
  1071. /* 编辑目录 */
  1072. this.dialogForm = {
  1073. level_1: node.level === 1
  1074. ? data.ClassifyName
  1075. :node.level === 2
  1076. ? node.parent.data.ClassifyName
  1077. : node.parent.parent.data.ClassifyName,
  1078. level_2: node.level === 1
  1079. ? ''
  1080. :node.level === 2
  1081. ? data.ClassifyName
  1082. : node.parent.data.ClassifyName,
  1083. level_3: node.level === 3
  1084. ? data.ClassifyName
  1085. : '',
  1086. classify_id: data.ClassifyId,
  1087. level: node.level
  1088. }
  1089. this.isOpenDialog = true;
  1090. }
  1091. },
  1092. /* 保存成功 */
  1093. sucessCallback(type) {
  1094. this.isOpenDialog = false;
  1095. this.getTreeData();
  1096. type==='update' && this.getDataList();
  1097. if(type === 'add') {
  1098. //新增分类完成之后,展开父节点显示刚新增的分类,若已展开节点则不做处理
  1099. let code = sessionStorage.getItem('expandCode');
  1100. let flag = this.defaultShowNodes.some((item) => {
  1101. return item === code
  1102. });
  1103. // console.log(flag)
  1104. !flag &&code&& this.defaultShowNodes.push(code);
  1105. sessionStorage.removeItem('expandCode');
  1106. }
  1107. },
  1108. /* 刷新获取指标最新数据 */
  1109. refreshTargetHandle: _.debounce(function() {
  1110. if(this.selected_edbid) {
  1111. this.loading = this.$loading({
  1112. lock: true,
  1113. target:'.main-right',
  1114. text: '刷新数据中...',
  1115. spinner: 'el-icon-loading',
  1116. background: 'rgba(255, 255, 255, 0.8)'
  1117. });
  1118. dataBaseInterface.targetRefresh({
  1119. EdbInfoId: this.selected_edbid
  1120. }).then(res => {
  1121. if(res.Ret === 200) {
  1122. this.loading.close();
  1123. this.$message.success(res.Msg);
  1124. this.page_no = 1;
  1125. this.getDataList('refresh')
  1126. }else{
  1127. this.loading.close();
  1128. }
  1129. })
  1130. }
  1131. },500),
  1132. /* 删除节点校验 */
  1133. removeNode(node,data) {
  1134. dataBaseInterface.nodeDelCheck({
  1135. ClassifyId: data.ClassifyId,
  1136. EdbInfoId: data.EdbInfoId
  1137. }).then(res => {
  1138. if(res.Ret === 200) {
  1139. /**
  1140. * 0 可删除
  1141. * 1 关联指标
  1142. * 2 有子目录无指标
  1143. */
  1144. const deleteLabelMap = {
  1145. 1: '该目录关联指标不可删除',
  1146. 2: '确认删除当前目录及包含的子目录吗?',
  1147. 3: '当前指标已用作画图,不可删除',
  1148. 4: res.Data.TipsMsg
  1149. }
  1150. if([1,3,4].includes(res.Data.DeleteStatus)) this.$confirm(
  1151. deleteLabelMap[res.Data.DeleteStatus],
  1152. '删除失败',
  1153. {
  1154. confirmButtonText: '知道了',
  1155. showCancelButton:false,
  1156. type: 'error'
  1157. })
  1158. else if([0,2].includes(res.Data.DeleteStatus)) this.$confirm(
  1159. res.Data.DeleteStatus === 2
  1160. ? deleteLabelMap[res.Data.DeleteStatus]
  1161. : data.EdbCode?'删除后指标和指标值均不可使用,确认删除吗?':'确定删除当前目录吗?',
  1162. '提示',
  1163. {
  1164. confirmButtonText: '确定',
  1165. cancelButtonText: '取消',
  1166. type: 'warning'
  1167. }).then(() => {
  1168. this.delHandle(data.ClassifyId,data.EdbInfoId);
  1169. }).catch(() => {
  1170. });
  1171. }
  1172. })
  1173. },
  1174. /* 删除方法 */
  1175. delHandle(ClassifyId,EdbInfoId) {
  1176. dataBaseInterface.nodeDelete({
  1177. ClassifyId,
  1178. EdbInfoId
  1179. }).then(res => {
  1180. if(res.Ret === 200) {
  1181. this.$message.success(res.Msg);
  1182. this.getTreeData();
  1183. this.selected_edbid = 0;
  1184. this.deleteLabel({code:this.select_node,id:EdbInfoId,classifyId:ClassifyId})
  1185. // this.getNewTargetList();
  1186. }
  1187. })
  1188. },
  1189. /* 判断节点是否能被拖拽 */
  1190. canDragHandle({data}) {
  1191. return data.Button.MoveButton;
  1192. },
  1193. /* 判断节点是否能被拖入 */
  1194. canDropHandle(draggingNode, dropNode, type) {
  1195. let canDrop=false
  1196. // 移动的是一级目录
  1197. if(draggingNode.level===1&&dropNode.level===1&&type!=='inner') {
  1198. canDrop=true
  1199. }
  1200. // 二级目录
  1201. if(draggingNode.level===2){
  1202. if((dropNode.level===1&&type==='inner')||(dropNode.level===2&&type!=='inner')){
  1203. canDrop=true
  1204. }
  1205. }
  1206. //三级目录
  1207. if(draggingNode.level===3){
  1208. if((dropNode.level===2&&type==='inner')||(dropNode.level===3&&type!=='inner')){
  1209. canDrop=true
  1210. }
  1211. }
  1212. //四级指标
  1213. if(draggingNode.level===4){
  1214. if((dropNode.level===3&&type==='inner')||(dropNode.level===4&&type!=='inner')){
  1215. canDrop=true
  1216. }
  1217. }
  1218. return canDrop
  1219. },
  1220. /* 拖拽完成 */
  1221. dropOverHandle(b,a,i,e) {
  1222. // 被拖拽节点对应的 Node、结束拖拽时最后进入的节点、被拖拽节点的放置位置
  1223. if(b.level===1||b.level===2||b.level===3){
  1224. this.handleMoveCatalogue(b,a,i,e)
  1225. }
  1226. // 指标层
  1227. if(b.level===4){
  1228. this.handleMoveEdb(b,a,i,e)
  1229. }
  1230. },
  1231. // 移动的为一、二、三级目录
  1232. handleMoveCatalogue(b,a,i,e){
  1233. let list=a.parent.childNodes,targetIndex=0,PrevClassifyId=0,NextClassifyId=0,ParentClassifyId=0;
  1234. list.forEach((item,index)=>{
  1235. if(item.data.ClassifyId===b.data.ClassifyId){
  1236. targetIndex=index
  1237. return
  1238. }
  1239. })
  1240. if(targetIndex===0){
  1241. PrevClassifyId=0
  1242. NextClassifyId=list[targetIndex+1].data.ClassifyId
  1243. }else if(targetIndex===list.length-1){
  1244. PrevClassifyId=list[targetIndex-1].data.ClassifyId
  1245. NextClassifyId=0
  1246. }else{
  1247. PrevClassifyId=list[targetIndex-1].data.ClassifyId
  1248. NextClassifyId=list[targetIndex+1].data.ClassifyId
  1249. }
  1250. if(b.level===2){
  1251. if(i==='inner'){
  1252. ParentClassifyId=a.data.ClassifyId
  1253. PrevClassifyId=0
  1254. NextClassifyId=a.data.Children.length>1?a.data.Children[1].ClassifyId:0
  1255. }else{
  1256. ParentClassifyId=a.data.ParentId
  1257. }
  1258. }
  1259. if(b.level===3){
  1260. if(i==='inner'){
  1261. ParentClassifyId=a.data.ClassifyId
  1262. PrevClassifyId=0
  1263. NextClassifyId=a.data.Children.length>1?a.data.Children[1].ClassifyId:0
  1264. }else{
  1265. ParentClassifyId=a.data.ParentId
  1266. }
  1267. }
  1268. dataBaseInterface.classifyMove({
  1269. ClassifyId:b.data.ClassifyId,
  1270. ParentClassifyId:ParentClassifyId,
  1271. PrevClassifyId:PrevClassifyId,
  1272. NextClassifyId:NextClassifyId
  1273. }).then(res=>{
  1274. if(res.Ret===200){
  1275. this.$message.success('移动成功!')
  1276. }
  1277. this.getTreeData();
  1278. })
  1279. },
  1280. // 移动的为指标层 四级
  1281. handleMoveEdb(b,a,i,e){
  1282. let PrevEdbInfoId=0,NextEdbInfoId=0,targetIndex=0,list=a.parent.childNodes.map(_ => _.data)
  1283. if(i==='inner'){
  1284. PrevEdbInfoId=0
  1285. NextEdbInfoId=a.data.Children.length>1?a.data.Children[1].EdbInfoId:0
  1286. }else{
  1287. list.forEach((item,index)=>{
  1288. if(item.EdbInfoId===b.data.EdbInfoId){
  1289. targetIndex=index
  1290. return
  1291. }
  1292. })
  1293. if(targetIndex===0){
  1294. PrevEdbInfoId=0
  1295. NextEdbInfoId=list[targetIndex+1].EdbInfoId
  1296. }else if(targetIndex===list.length-1){
  1297. PrevEdbInfoId=list[targetIndex-1].EdbInfoId
  1298. NextEdbInfoId=0
  1299. }else{
  1300. PrevEdbInfoId=list[targetIndex-1].EdbInfoId
  1301. NextEdbInfoId=list[targetIndex+1].EdbInfoId
  1302. }
  1303. }
  1304. dataBaseInterface.targetMove({
  1305. ClassifyId: a.data.ClassifyId,
  1306. EdbInfoId: b.data.EdbInfoId,
  1307. PrevEdbInfoId:PrevEdbInfoId,
  1308. NextEdbInfoId:NextEdbInfoId
  1309. }).then(res => {
  1310. if(res.Ret === 200) {
  1311. this.$message.success('移动成功!')
  1312. }
  1313. this.getTreeData();
  1314. })
  1315. },
  1316. /* 拖拽覆盖添加背景色 */
  1317. dropMouseOver(node1,node2,e) {
  1318. // 被拖拽节点对应的 Node、所进入节点对应的 Node、event
  1319. if(((node1.level===2&&node2.level === 1)||(node1.level===3&&node2.level === 2)) && (e.target.childNodes[0].className.includes('el-tree-node__content')
  1320. || e.target.className.includes('el-tree-node__content'))) {
  1321. // console.log(e.target.childNodes[0])
  1322. e.target.childNodes[0].className.includes('el-tree-node__content')
  1323. ? e.target.childNodes[0].style.backgroundColor = '#409eff'
  1324. : e.target.style.backgroundColor = '#409eff';
  1325. }
  1326. },
  1327. /* 拖拽离开/拖拽完成重置背景色 */
  1328. dropMouseLeave(node1,node2,e) {
  1329. let arrs = $('.el-tree-node__content');
  1330. for( let a of arrs ) {
  1331. a.style.backgroundColor = 'transparent';
  1332. }
  1333. },
  1334. // 树节点展开
  1335. handleNodeExpand (data) {
  1336. // 保存当前展开的节点
  1337. let flag = false
  1338. this.defaultShowNodes.some(item => {
  1339. if (item === data.UniqueCode) { // 判断当前节点是否存在, 存在不做处理
  1340. flag = true
  1341. return true
  1342. }
  1343. })
  1344. if (!flag) { // 不存在则存到数组里
  1345. this.defaultShowNodes.push(data.UniqueCode)
  1346. }
  1347. },
  1348. // 树节点关闭
  1349. handleNodeCollapse (data) {
  1350. this.defaultShowNodes.some((item, index) => {
  1351. if (item === data.UniqueCode) {
  1352. // 删除关闭节点
  1353. this.defaultShowNodes.length = index
  1354. }
  1355. })
  1356. },
  1357. /* 根据unicode展开树结构并选中指标 */
  1358. selectCurrentNode({ code, id,classifyId }) {
  1359. console.log(code, id,classifyId);
  1360. this.select_node = code;
  1361. this.selected_edbid = id;
  1362. //this.defaultShowNodes=this.findParentNodeForClassifyId(classifyId,code)
  1363. //滚动到高亮节点位置
  1364. this.$nextTick(()=>{
  1365. setTimeout(() => {
  1366. let node = document.getElementById(`node${this.select_node}`)||{}
  1367. let parent = document.getElementsByClassName('tree-cont')[0];
  1368. //console.log('滚动',node,parent);
  1369. if(node.offsetTop > parent.offsetHeight) {
  1370. parent.scrollTop = node.offsetTop - parent.offsetHeight/2
  1371. }
  1372. },400)
  1373. })
  1374. },
  1375. // 查找树节点所有父节点
  1376. findParentNodeHandle(arr, id) {
  1377. // 遍历取父级code push数组
  1378. for (let i of arr) {
  1379. if (i.ClassifyId === id) {
  1380. return [i.UniqueCode];
  1381. }
  1382. if (i.Children) {
  1383. let node = this.findParentNodeHandle(i.Children, id);
  1384. if (node) {
  1385. return node.concat(i.UniqueCode);
  1386. }
  1387. }
  1388. }
  1389. },
  1390. // 通过分类id找到指标所属的分类
  1391. findParentNodeForClassifyId(id,code){
  1392. let arr=[]
  1393. this.treeData.forEach(item=>{
  1394. if(item.Children){
  1395. item.Children.forEach(_item=>{
  1396. if(_item.ClassifyId==id){
  1397. arr=[item.UniqueCode,_item.UniqueCode]
  1398. }
  1399. })
  1400. }
  1401. })
  1402. return [...arr,code]
  1403. },
  1404. // 懒加载tree
  1405. handleTreeLoad(node,resolve){
  1406. if(node.level===0){
  1407. resolve(this.treeData)
  1408. }
  1409. if(node.level===1){
  1410. let arr=[]
  1411. this.treeData.forEach(item=>{
  1412. if(item.UniqueCode===node.data.UniqueCode){
  1413. arr=item.Children
  1414. }
  1415. })
  1416. resolve(arr)
  1417. }
  1418. if(node.level===2){
  1419. dataBaseInterface.getEdbListForClassify({ClassifyId:node.data.ClassifyId}).then(res=>{
  1420. if(res.Ret===200){
  1421. let arr=res.Data.EdbInfoList||[]
  1422. arr=arr.map(item=>{
  1423. return {
  1424. ...item,
  1425. isLeaf:true
  1426. }
  1427. })
  1428. resolve(arr)
  1429. }else{
  1430. resolve([])
  1431. }
  1432. this.changeTreeNode()
  1433. })
  1434. }
  1435. if(node.level>2){
  1436. resolve([])
  1437. }
  1438. },
  1439. /* 添加计算指标 */
  1440. addComputedHandler() {
  1441. this.computedTit = '计算指标';
  1442. this.calulateList = [];
  1443. this.calulateForm = {};
  1444. this.operationForm = {};
  1445. this.isOpenComputed = true;
  1446. },
  1447. /* 新增计算指标回调 */
  1448. addComputedCallBack(type, params) {
  1449. this.computed_type = 0;
  1450. this.computed_source = 1;
  1451. this.showAssociateChart=false
  1452. this.showAssociateComputeData=false
  1453. // this.getTreeData();
  1454. type === 'add' ? this.getTreeData(params) : this.getTreeData();
  1455. type === 'edit' && this.initGetData()
  1456. },
  1457. initGetData() {
  1458. this.page_no = 1;
  1459. if(this.$refs.valueUl){
  1460. this.$refs.valueUl.scrollTop = 0;
  1461. }
  1462. this.getDataList();
  1463. },
  1464. /* 选择计算类型 */
  1465. changeComputedType(type) {
  1466. //保证source的对应关系
  1467. let typeMapSource = {
  1468. 'toMonthSeason': 5,
  1469. 'accumulate': 62
  1470. }
  1471. this.computed_type = typeMapSource[type] || type;
  1472. this.isOpenComputed = false;
  1473. },
  1474. /* 重新计算 */
  1475. reCalculateHandler() {
  1476. this.calculateLoading = true;
  1477. dataBaseInterface.reCalculateTarget({
  1478. EdbInfoId: Number(this.selected_edbid)
  1479. }).then(res => {
  1480. this.calculateLoading = false;
  1481. if(res.Ret !== 200) return;
  1482. this.$message.success(res.Msg);
  1483. this.initDataStatus();
  1484. }).catch(() => {
  1485. this.calculateLoading = false;
  1486. })
  1487. },
  1488. /* 查看计算公式 打开弹窗 */
  1489. viewNode(node,data) {
  1490. const { EdbInfoId,Source } = data;
  1491. //代码运算指标
  1492. if( Source === 27 ) return this.$router.push({
  1493. path: '/codecount',
  1494. query: {
  1495. edbid: EdbInfoId,
  1496. isView: true
  1497. }
  1498. })
  1499. dataBaseInterface.calculateDetail({
  1500. EdbInfoId,
  1501. }).then(res => {
  1502. if(res.Ret !== 200) return
  1503. this.setComputedDialogForm(Source,node,data,res.Data,true);
  1504. this.computed_type = [23,24].includes(Source) ? 'joint' : Source;
  1505. })
  1506. },
  1507. /* 设置回显计算指标的表单 */
  1508. setComputedDialogForm(type,node,data,res,view=false) {
  1509. //指标运算 or 其他计算类型指标
  1510. if( type === 4 ) {
  1511. /* 回显指标和表单 */
  1512. const list = res.CalculateList;
  1513. this.computedTit = view ? '查看计算指标' : '编辑计算指标';
  1514. /* 依赖的指标列表 */
  1515. this.calulateList = list.map(item => {
  1516. return {
  1517. tag: item.FromTag,
  1518. edb_name: item.FromEdbName,
  1519. target: item.FromEdbInfoId,
  1520. start_date: item.StartDate,
  1521. end_date: item.EndDate
  1522. }
  1523. })
  1524. /* 公式和表单 */
  1525. this.calulateForm = {
  1526. edb_id:res.EdbInfoDetail.EdbInfoId,
  1527. formula: res.EdbInfoDetail.CalculateFormula,
  1528. menu: [
  1529. node.parent.parent.parent.data.ClassifyId,
  1530. node.parent.parent.data.ClassifyId,
  1531. data.ClassifyId
  1532. ],
  1533. targetName: res.EdbInfoDetail.EdbName,
  1534. unit: res.EdbInfoDetail.Unit,
  1535. frequency: res.EdbInfoDetail.Frequency,
  1536. view
  1537. };
  1538. } else {
  1539. let dataInfo = res.EdbInfoDetail;
  1540. let old_edb = res.CalculateList;
  1541. let public_params = {
  1542. edb_id: dataInfo.EdbInfoId,
  1543. targetName: dataInfo.EdbName,
  1544. frequency: dataInfo.Frequency,
  1545. unit: dataInfo.Unit,
  1546. menu: [
  1547. node.parent.parent.parent.data.ClassifyId,
  1548. node.parent.parent.data.ClassifyId,
  1549. data.ClassifyId
  1550. ],
  1551. view
  1552. }
  1553. this.operationForm = [23,24,37,53].includes(type)
  1554. ? {
  1555. ...public_params,
  1556. source: dataInfo.Source,
  1557. date: dataInfo.CalculateFormula,
  1558. pre_edb: type === 23 ? old_edb.find(item => item.FromTag === 'A').FromEdbInfoId : '', //俺也不懂为什么这么定义都是江西老表的锅
  1559. after_edb: type === 23 ? old_edb.find(item => item.FromTag === 'B').FromEdbInfoId : '',
  1560. old_stay_edb: type === 24 ? old_edb.find(item => item.FromTag === 'A').FromEdbInfoId : '',
  1561. concat_edb: type === 24 ? old_edb.find(item => item.FromTag === 'B').FromEdbInfoId : '',
  1562. from_arr: old_edb,
  1563. }
  1564. : {
  1565. ...public_params,
  1566. oldedb_id: old_edb[0].FromEdbInfoId,
  1567. oldEdb_name: old_edb[0].FromEdbName,
  1568. formula: dataInfo.CalculateFormula || '',
  1569. moveType: dataInfo.MoveType,
  1570. moveUnit: dataInfo.MoveFrequency,
  1571. moveVal: type === 22 ? dataInfo.CalculateFormula : '',
  1572. calendar_type: type === 35 ? dataInfo.Calendar : '',
  1573. }
  1574. }
  1575. },
  1576. /* 基础指标刷新 */
  1577. refreshBaseHandler() {
  1578. this.refreshLoading = true;
  1579. dataBaseInterface.refreshBaseTarget({
  1580. EdbInfoId: Number(this.selected_edbid)
  1581. }).then(res => {
  1582. this.refreshLoading = false;
  1583. if(res.Ret !== 200) return;
  1584. this.$message.success(res.Msg);
  1585. this.initDataStatus();
  1586. }).catch(() => {
  1587. this.refreshLoading = false;
  1588. })
  1589. },
  1590. /* 一键成图 */
  1591. createChartHandle() {
  1592. this.isCreateChart = true;
  1593. },
  1594. /* 重新刷新 重新计算后重置刷数据 */
  1595. initDataStatus() {
  1596. this.page_no = 1;
  1597. this.$refs.valueUl.scrollTop = 0;
  1598. this.getDataList();
  1599. },
  1600. /* 用于复制指标 */
  1601. async copyCode(){
  1602. const res = await dataBaseInterface.targetList({
  1603. PageSize: 100000,
  1604. CurrentIndex: 1,
  1605. EdbInfoId: this.selected_edbid,
  1606. })
  1607. if (res.Ret===200){
  1608. let arr = res.Data.Item.DataList ||[]
  1609. let str = '日期\t 值\n'
  1610. arr.forEach((item=> str += `${item.DataTime}\t${item.Value}\n`))
  1611. this.$copyText(str).then(
  1612. res => {
  1613. this.$message.success("已成功复制!");
  1614. },
  1615. err => {
  1616. this.$message.error("复制失败!");
  1617. } )
  1618. }
  1619. },
  1620. /* 一键更新 */
  1621. updateHandler() {
  1622. this.isUpdate = true;
  1623. },
  1624. /* 替换指标 */
  1625. async replaceEdbHandler () {
  1626. const { Data } = await dataBaseInterface.replaceCheck();
  1627. Data === 2
  1628. ? this.isReplaceDia = true
  1629. : await this.$confirm('当前正在替换中,请耐心等待', '提示', {
  1630. type: 'warning',
  1631. showCancelButton: false,
  1632. })
  1633. },
  1634. /* 添加最新值 */
  1635. updateNewestDataHandle() {
  1636. this.isUpdateNewestData = true;
  1637. },
  1638. /* 获取标签列表 */
  1639. getlabelList(){
  1640. const List = JSON.parse(sessionStorage.getItem('database'))||[]
  1641. this.labelList = List
  1642. },
  1643. /* 添加标签 params :{code,id,classifyId,EdbName,EdbNameEn}*/
  1644. addLabel(params){
  1645. const index = this.labelList.findIndex(i=>i.code===params.code)
  1646. //标签已存在列表中,更新标签的值
  1647. if(index!==-1){
  1648. this.labelList.splice(index,1,params)
  1649. return
  1650. }
  1651. //根据页面宽度 判断标签数量是否达到上限
  1652. const listWidth = document.querySelector('.database-label').offsetWidth
  1653. const minWidth=170+20
  1654. const maxNum = Math.floor(listWidth/minWidth)
  1655. if(this.labelList.length>=maxNum){
  1656. //达到上限则挤出第一个,再添加
  1657. this.labelList.shift()
  1658. }
  1659. this.labelList.push(params)
  1660. sessionStorage.setItem('database',JSON.stringify(this.labelList))
  1661. },
  1662. //改变选中标签,
  1663. changeCurrentLabel(params){
  1664. if(params.code!==this.select_node){
  1665. this.selectCurrentNode(params)
  1666. }
  1667. },
  1668. //删除标签
  1669. deleteLabel(params){
  1670. const index = this.labelList.findIndex(i=>i.code===params.code)
  1671. //如果删除的标签是选中状态
  1672. if(this.select_node===params.code){
  1673. //删除的是唯一一个标签
  1674. if(this.labelList.length===1){
  1675. this.selected_edbid=0
  1676. this.select_node = ''
  1677. this.$refs.menuTree.setCurrentKey(null)
  1678. //不是唯一的标签,则默认选中上一个/下一个
  1679. }else{
  1680. index===0&&this.changeCurrentLabel(this.labelList[1])
  1681. index!==0&&index!==-1&&this.changeCurrentLabel(this.labelList[index-1])
  1682. }
  1683. }
  1684. index!==-1&&this.labelList.splice(index,1)
  1685. sessionStorage.setItem('database',JSON.stringify(this.labelList))
  1686. },
  1687. changeTreeNode(){
  1688. this.$refs.menuTree.setCurrentKey(this.select_node);
  1689. this.$nextTick(()=>{
  1690. const _node = this.$refs.menuTree.getNode(this.select_node)
  1691. this.dynamicNode = _node;
  1692. this.dynamicNode&&this.resetNodeStyle(this.dynamicNode)
  1693. })
  1694. },
  1695. //绑定el-tree的load属性
  1696. getLazyTreeData (node,resolve,maxLevel=3){
  1697. if(node.level===0){
  1698. resolve(this.treeData)
  1699. }
  1700. if(node.level>0&&node.level<=maxLevel){
  1701. //获取对应层级的Child
  1702. resolve(node.data.Children||[])
  1703. }
  1704. if(node.level===maxLevel){
  1705. //调接口获取该分类下指标的数据
  1706. dataBaseInterface.getEdbListForClassify({ClassifyId:node.data.ClassifyId}).then(res=>{
  1707. if(res.Ret===200){
  1708. let arr=res.Data.EdbInfoList||[]
  1709. arr=arr.map(item=>{
  1710. return {
  1711. ...item,
  1712. isLeaf:true
  1713. }
  1714. })
  1715. resolve(arr)
  1716. }else{
  1717. resolve([])
  1718. }
  1719. this.changeTreeNode()
  1720. })
  1721. }
  1722. if(node.level>maxLevel){
  1723. resolve([])
  1724. }
  1725. }
  1726. },
  1727. //离开页面时保存标签
  1728. beforeRouteLeave(to,from,next){
  1729. sessionStorage.setItem('database',JSON.stringify(this.labelList))
  1730. next()
  1731. },
  1732. mounted() {
  1733. this.getlabelList()
  1734. this.$route.query.code
  1735. ? this.getTreeData({code: this.$route.query.code,id: this.$route.query.id,classifyId:this.$route.query.classifyId})
  1736. : this.getTreeData();
  1737. //离开页面时保存标签
  1738. window.onbeforeunload = ()=>{
  1739. sessionStorage.setItem('database',JSON.stringify(this.labelList))
  1740. }
  1741. },
  1742. destroyed(){
  1743. window.onbeforeunload = null
  1744. }
  1745. };
  1746. </script>
  1747. <style lang="scss">
  1748. @import "~@/styles/theme-vars.scss";
  1749. .database_container {
  1750. $mini_font: 12px;
  1751. $normal_font: 14px;
  1752. .firstColumTable .el-table__empty-block {
  1753. display: none;
  1754. }
  1755. .firstColumTable .el-table__header th:first-child .cell{
  1756. overflow: visible;
  1757. }
  1758. .el-table td,.el-table th {
  1759. padding: 10px 0;
  1760. }
  1761. .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner {
  1762. background-color: $theme-color !important;
  1763. border-color: $theme-color;
  1764. }
  1765. .el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner {
  1766. background-color: $theme-color !important;
  1767. border-color: $theme-color;
  1768. }
  1769. .el-icon-refresh {
  1770. font-size: 17px;
  1771. margin-left: 5px;
  1772. cursor: pointer;
  1773. }
  1774. @media screen and (min-width: 1711px) {
  1775. .target_tree {
  1776. font-size: $normal_font;
  1777. }
  1778. }
  1779. @media screen and (max-width: 1710px) {
  1780. .target_tree {
  1781. font-size: $mini_font;
  1782. }
  1783. }
  1784. .database_top {
  1785. display: flex;
  1786. justify-content: space-between;
  1787. align-items: center;
  1788. margin-bottom: 20px;
  1789. padding: 20px 30px;
  1790. background: #fff;
  1791. border: 1px solid #ececec;
  1792. border-radius: 4px;
  1793. box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  1794. .top-right {
  1795. display: flex;
  1796. align-items: center;
  1797. }
  1798. }
  1799. .database_main {
  1800. display: flex;
  1801. margin-top: 20px;
  1802. div::-webkit-scrollbar {
  1803. width: 5px !important;
  1804. }
  1805. .main-left {
  1806. width: 500px;
  1807. min-width: 300px;
  1808. background: #fff;
  1809. margin-right: 20px;
  1810. border: 1px solid #ececec;
  1811. border-radius: 4px;
  1812. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  1813. height: calc(100vh - 225px);
  1814. overflow: hidden;
  1815. position: relative;
  1816. box-sizing: border-box;
  1817. .tree-cont {
  1818. padding: 30px;
  1819. height: calc(100vh - 290px);
  1820. overflow: auto;
  1821. }
  1822. .target_tree {
  1823. color: #333;
  1824. .label-input .el-input__inner {
  1825. height: 25px;
  1826. line-height: 25px;
  1827. }
  1828. .custom-tree-node {
  1829. display: flex !important;
  1830. justify-content: space-between;
  1831. align-items: center;
  1832. display: block;
  1833. flex: 1;
  1834. .node_label {
  1835. margin-right: 2px;
  1836. }
  1837. .el-icon-view {
  1838. color: #409eff;
  1839. font-size: 18px;
  1840. margin-left: 5px;
  1841. }
  1842. }
  1843. .el-tree__drop-indicator{
  1844. /* position:absolute; */
  1845. /* left:0;
  1846. right:0; */
  1847. height:3px;
  1848. // margin-top: 8px;
  1849. background-color:$theme-color;
  1850. }
  1851. .el-tree-node__content {
  1852. margin-bottom: 14px !important;
  1853. }
  1854. .el-tree-node__children {
  1855. .el-tree-node {
  1856. /* margin-bottom: 8px !important; */
  1857. margin-bottom: 0px !important;
  1858. padding-left: 18px;
  1859. }
  1860. .el-tree-node__content {
  1861. margin-bottom: 5px !important;
  1862. padding-left: 0 !important;
  1863. }
  1864. }
  1865. .expanded.el-icon-caret-right:before {
  1866. content: url('../../assets/img/set_m/down.png') !important;
  1867. }
  1868. .el-icon-caret-right:before {
  1869. content: url('../../assets/img/set_m/slide.png') !important;
  1870. }
  1871. .el-tree-node__expand-icon.is-leaf.el-icon-caret-right:before {
  1872. content: '' !important;
  1873. }
  1874. .el-tree-node__expand-icon.expanded {
  1875. -webkit-transform: rotate(0deg);
  1876. transform: rotate(0deg);
  1877. }
  1878. .el-tree-node.is-current > .el-tree-node__content {
  1879. background-color: #f0f4ff !important;
  1880. }
  1881. .el-tree-node__content {
  1882. padding-right: 10px !important;
  1883. }
  1884. }
  1885. .noDepart {
  1886. margin: 60px 0;
  1887. display: flex;
  1888. align-items: center;
  1889. justify-content: center;
  1890. color: $theme-color;
  1891. font-size: 16px;
  1892. cursor: pointer;
  1893. }
  1894. .move-btn {
  1895. height: 100%;
  1896. width: 4px;
  1897. /* opacity: 0; */
  1898. position: absolute;
  1899. right: 0px;
  1900. top: 0;
  1901. &:hover {
  1902. cursor: col-resize;
  1903. /* background-color: orange */
  1904. }
  1905. }
  1906. }
  1907. .main-right {
  1908. flex: 1;
  1909. /* width:70%; */
  1910. height: calc(100vh - 288px);
  1911. background: #fff;
  1912. border: 1px solid #ececec;
  1913. border-radius: 4px;
  1914. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  1915. padding: 30px;
  1916. overflow: hidden;
  1917. .value-ul {
  1918. margin-top: 10px;
  1919. border-bottom: 1px solid #dcdfe6;
  1920. max-height: calc(100vh - 560px);
  1921. overflow-y: auto;
  1922. .value-item {
  1923. /* width: 100%; */
  1924. padding: 14px 0;
  1925. border: 1px solid #dcdfe6;
  1926. border-bottom: none;
  1927. display: flex;
  1928. justify-content: space-around;
  1929. .value-label {
  1930. position: relative;
  1931. color: #666;
  1932. }
  1933. .predict-act {
  1934. color: orange;
  1935. }
  1936. .new-tag {
  1937. width: 6px;
  1938. height: 6px;
  1939. display: inline-block;
  1940. position: absolute;
  1941. left: -12px;
  1942. top: 50%;
  1943. transform: translateY(-50%);
  1944. border-radius: 50%;
  1945. background: #f00;
  1946. }
  1947. }
  1948. .nodata {
  1949. text-align: center;
  1950. padding: 40px 0;
  1951. color: #999;
  1952. }
  1953. }
  1954. }
  1955. }
  1956. .dialog-computed {
  1957. .el-dialog__header {
  1958. background-color: #fff;
  1959. .el-dialog__close {
  1960. color: #333;
  1961. }
  1962. }
  1963. .computed-ul {
  1964. max-height: 600px;
  1965. overflow-y: auto;
  1966. padding: 40px 92px;
  1967. display: flex;
  1968. flex-wrap: wrap;
  1969. .cpmputed-li {
  1970. width: 180px;
  1971. padding: 19px 0;
  1972. color: $theme-color;
  1973. font-size: 16px;
  1974. background:#ECF5FF;
  1975. border-radius: 8px;
  1976. border: 1px solid #99baf0;
  1977. text-align: center;
  1978. cursor: pointer;
  1979. margin-right: 65px;
  1980. margin-bottom: 55px;
  1981. &:nth-child(3n) {
  1982. margin-right:0;
  1983. }
  1984. &:hover {
  1985. background: $theme-color;
  1986. color: #fff;
  1987. }
  1988. &.act {
  1989. background: $theme-color;
  1990. color: #fff;
  1991. }
  1992. }
  1993. }
  1994. }
  1995. }
  1996. </style>