databaseList.vue 82 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767
  1. <template>
  2. <div class="database_container">
  3. <div class="database_top">
  4. <div class="top-left">
  5. <template v-if="!isBasicBase">
  6. <el-button v-permission="permissionBtn.edbDataPermission.edbData_addEdb"
  7. type="primary" @click="addHandler"><!-- 添加指标 -->{{$t('EtaBasePage.add_edb_btn')}}</el-button>
  8. <el-button v-permission="permissionBtn.edbDataPermission.edbData_calcuEdb"
  9. type="primary" @click="addComputedHandler"><!-- 计算指标 -->{{$t('EtaBasePage.calculation_edb_btn')}}</el-button>
  10. <el-button v-permission="permissionBtn.edbDataPermission.edbData_replaceEdb"
  11. type="primary" @click="replaceEdbHandler"><!-- 替换指标 -->{{$t('EtaBasePage.replace_edb_btn')}}</el-button>
  12. <el-button v-permission="permissionBtn.edbDataPermission.edbData_codeRun"
  13. type="primary" @click="$router.push({path: '/codecount'})"><!-- 代码运算 -->{{$t('EtaBasePage.algorithm_btn')}}</el-button>
  14. <el-button v-permission="permissionBtn.edbDataPermission.edbData_dataAdjust"
  15. type="primary" @click="$router.push({path: '/adjustdata'})"><!-- 数据调整 -->{{$t('EtaBasePage.adjustment_btn')}}</el-button>
  16. </template>
  17. </div>
  18. <div class="top-right">
  19. <el-select
  20. v-if="classifyShowType==='public'"
  21. v-model="search_txt"
  22. v-loadMore="searchLoad"
  23. ref="searchRef"
  24. :filterable="!search_txt"
  25. remote
  26. clearable
  27. :placeholder="$t('Edb.InputHolderAll.input_name_orid')"
  28. style="width: 260px;"
  29. :remote-method="searchHandle"
  30. @click.native="inputFocusHandle"
  31. >
  32. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  33. <el-option
  34. v-for="item in searchOptions"
  35. :key="item.EdbInfoId"
  36. :label="currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName"
  37. :value="item.EdbInfoId"
  38. >
  39. <div>
  40. <img
  41. :src="$icons.lock_ico2"
  42. width="18"
  43. height="18"
  44. style="vertical-align:middle"
  45. v-if="!item.HaveOperaAuth"
  46. />
  47. {{currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName}}
  48. </div>
  49. </el-option>
  50. </el-select>
  51. <el-input
  52. v-else
  53. v-model="searchCollectWord"
  54. :placeholder="$t('Edb.InputHolderAll.input_name_orid')"
  55. style="width: 260px;"
  56. @change="getEdbChartList"
  57. clearable
  58. >
  59. <i slot="prefix" class="el-input__icon el-icon-search"/>
  60. </el-input>
  61. </div>
  62. </div>
  63. <!-- <div class="database-label">
  64. <edb-label-list
  65. :currentLang="currentLang"
  66. :labelList="labelList"
  67. :activeLabelId="select_node"
  68. @clickLabel="changeCurrentLabel"
  69. @deleteLabel="deleteLabel"
  70. @moveLabel="({oldIndex,newIndex})=>{labelList[oldIndex] = labelList.splice(newIndex, 1, labelList[oldIndex])[0];}"
  71. />
  72. </div> -->
  73. <div class="database_main box" id="box" v-if="showData">
  74. <!-- 展开收起目录按钮 -->
  75. <span
  76. v-show="!isMainLeftShow"
  77. class="slide-btn-icon slide-right"
  78. @click="isMainLeftShow = !isMainLeftShow"
  79. >
  80. <i :class="{'el-icon-d-arrow-left':isMainLeftShow,'el-icon-d-arrow-right':!isMainLeftShow}"></i>
  81. </span>
  82. <div class="main-left left" id="left" v-show="isMainLeftShow">
  83. <div class="tree-cont">
  84. <el-radio-group
  85. v-model="classifyShowType"
  86. @input="handleChangeClassifyType"
  87. v-if="isBasicBase"
  88. >
  89. <el-radio-button label="public">
  90. 公共指标库
  91. </el-radio-button>
  92. <el-radio-button label="own">
  93. 个人收藏
  94. </el-radio-button>
  95. </el-radio-group>
  96. <div style="padding:20px 0;padding-right:20px;display:flex;justify-content:space-between">
  97. <span><!-- 目录 -->{{$t('EtaBasePage.tab_menu')}}</span>
  98. <!-- <el-checkbox
  99. v-model="IsOnlyMe"
  100. @change="onlyMeHandler"
  101. >{{$t('Edb.only_see_mine')}}</el-checkbox> -->
  102. </div>
  103. <div class="target_tree">
  104. <!-- 指标目录 -->
  105. <el-tree
  106. v-if="classifyShowType==='public'"
  107. ref="menuTree"
  108. :data="treeData"
  109. node-key="UniqueCode"
  110. :props="defaultProp"
  111. :allow-drag="canDragHandle"
  112. :allow-drop="canDropHandle"
  113. :current-node-key="select_node"
  114. :default-expanded-keys="defaultShowNodes"
  115. :draggable="isEdbBtnShow('moveCatalog')"
  116. :expand-on-click-node="false"
  117. check-strictly
  118. empty-text="暂无目录"
  119. lazy
  120. :load="getLazyTreeData"
  121. @node-expand="handleNodeExpand"
  122. @node-collapse="handleNodeCollapse"
  123. @current-change="nodeChange"
  124. @node-drop="dropOverHandle"
  125. @node-drag-end="dropMouseLeave"
  126. @node-drag-leave="dropMouseLeave"
  127. @node-drag-enter="dropMouseOver"
  128. >
  129. <span
  130. class="custom-tree-node"
  131. slot-scope="{ node, data }"
  132. >
  133. <el-input
  134. ref="editVal"
  135. style="width: 90px"
  136. placeholder="请输入值"
  137. class="label-input"
  138. v-model="new_label"
  139. v-if="data.isEdit&&isEdbBtnShow('editCatalog')"
  140. @blur="changeValue(node, data)"
  141. />
  142. <span
  143. @dblclick.stop="editNodeLabel(node, data)"
  144. v-else
  145. class="text_oneLine node_label"
  146. :style="`width:${(select_node === data.UniqueCode && node.Nodewidth) || ''}`"
  147. :id="`node${data.UniqueCode}`"
  148. >
  149. <img
  150. :src="$icons.lock_ico2"
  151. width="18"
  152. height="18"
  153. style="vertical-align:middle"
  154. v-if="!data.HaveOperaAuth&&data.EdbInfoId"
  155. />
  156. <span>{{ currentLang==='en' ? (data.ClassifyNameEn||data.ClassifyName) : data.ClassifyName }}</span>
  157. </span>
  158. <span
  159. style="display: flex; align-items: center"
  160. v-if="select_node===data.UniqueCode&&data.HaveOperaAuth"
  161. >
  162. <!-- <img
  163. src="~@/assets/img/data_m/move_ico.png"
  164. alt=""
  165. style="width: 14px; height: 14px; margin-right: 8px"
  166. v-if="data.Button.MoveButton&&isEdbBtnShow('moveCatalog')"
  167. /> -->
  168. <!-- 添加子项 -->
  169. <img
  170. src="~@/assets/img/set_m/add.png"
  171. alt=""
  172. style="width: 14px; height: 14px; margin-right: 8px"
  173. @click.stop="addNode(node,data)"
  174. v-if="data.Button.AddButton&&isEdbBtnShow('editCatalog')&&node.level<6"
  175. />
  176. <!-- 编辑节点 如果是分类,判断data.Button.OpButton不变;如果是指标,不显示(ETA1.0.3) -->
  177. <img
  178. src="~@/assets/img/set_m/edit.png"
  179. alt=""
  180. style="width: 15px; height: 14px; margin-right: 8px"
  181. @click.stop="editNode(node,data)"
  182. v-if="!data.EdbCode&&(data.Button.OpButton)&&isEdbBtnShow('editCatalog')"
  183. />
  184. <!-- 删除节点 如果是分类,判断data.Button.DeleteButton不变;如果是指标,不显示(ETA1.0.3) -->
  185. <img
  186. slot="reference"
  187. src="~@/assets/img/set_m/del_icon.png"
  188. alt=""
  189. style="width: 14px; height: 14px;"
  190. @click.stop="removeNode(node,data)"
  191. v-if="!data.EdbCode&&(data.Button.DeleteButton)&&isEdbBtnShow('deleteCatalog')"
  192. />
  193. </span>
  194. </span>
  195. </el-tree>
  196. <!-- 收藏目录 -->
  197. <collectEdbMenu
  198. v-else
  199. :data="treeData"
  200. @change="getTreeData"
  201. />
  202. </div>
  203. <template>
  204. <!-- 新增分类 -->
  205. <div class="noDepart" @click="addLevelOneHandle" v-if="classifyShowType==='public'&&CanOpClassify&&isEdbBtnShow('editCatalog')">
  206. <img
  207. src="~@/assets/img/set_m/add_ico.png"
  208. alt=""
  209. style="width: 16px; height: 16px; margin-right: 10px"
  210. />
  211. <span>{{$t('EtaBasePage.add_first_menu_btn')}}</span>
  212. </div>
  213. <!-- 新增收藏分类 -->
  214. <div class="noDepart" @click="handleOpenCollectClassify" v-if="classifyShowType==='own'&&isEdbBtnShow('edbData_edbCollectClassify_save')">
  215. <img
  216. src="~@/assets/img/set_m/add_ico.png"
  217. alt=""
  218. style="width: 16px; height: 16px; margin-right: 10px"
  219. />
  220. <span>{{$t('EtaBasePage.add_first_menu_btn')}}</span>
  221. </div>
  222. </template>
  223. </div>
  224. <span class="move-btn resize" v-drag id="resize" @mousemove="dynamicNode&&resetNodeStyle(dynamicNode)">
  225. </span>
  226. <span
  227. v-show="isMainLeftShow"
  228. class="slide-btn-icon slide-left"
  229. @click="isMainLeftShow = !isMainLeftShow"
  230. >
  231. <i :class="{'el-icon-d-arrow-left':isMainLeftShow,'el-icon-d-arrow-right':!isMainLeftShow}"></i>
  232. </span>
  233. </div>
  234. <!-- 指标关联图模块 -->
  235. <div class="main-right right" id="right" style="background:transparent;border:none;box-shadow:none" v-if="showAssociateChart">
  236. <dataAssociateChart :edbInfoId="selected_edbid" @returnHandle="showAssociateChart=false,showAssociateComputeData=false"></dataAssociateChart>
  237. </div>
  238. <div class="main-right right" id="right" style="background:transparent;border:none;box-shadow:none;padding-top: 30px;box-sizing: border-box;" v-if="showAssociateComputeData">
  239. <dataAssociateComputeData :edbInfoId="selected_edbid" @returnHandle="showAssociateChart=false,showAssociateComputeData=false"></dataAssociateComputeData>
  240. </div>
  241. <!-- 指标图表列表 -->
  242. <div class="main-right right list" id="right" v-show="isShowList">
  243. <p>{{$t('EtaBasePage.total_show',{limit: Total||0})}}</p>
  244. <div class="list-wrap" ref="listRef" @scroll="loadMoreHandle" v-if="Total">
  245. <div class="chart-list-item-wrap">
  246. <div class="list-item" v-for="item in chartList" :key="item.EdbInfoId">
  247. <div class="header">
  248. <span v-show="currentLang=='zh'">{{ item.EdbName }}</span>
  249. <span v-show="currentLang=='en'">{{ item.EdbNameEn || item.EdbName }}</span>
  250. </div>
  251. <!-- !item.HaveOperaAuth ? $icons.lock_big : -->
  252. <div class="image" @click="detailShowHandle(item)"
  253. :style="{background: `no-repeat top/cover url('${ item.ChartImage}')`}">
  254. </div>
  255. <div class="info">
  256. {{$t('EtaBasePage.time_show')}}:{{item.CreateTime?item.CreateTime.substring(0,10):''}}
  257. <!-- wind和钢联化工的指标、计算指标显示 启用/停用-->
  258. <span v-if="([2,34].includes(item.Source) || item.EdbType==2) && isEdbBtnShow('enableOrDisable')&&item.IsSupplierStop!=1"
  259. class="enable-toggle-btn" :style="{'color': item.NoUpdate==1?'#0052D9':'#D54941'}"
  260. @click="toggleEdbRefreshStatus(item)">{{item.NoUpdate==1?$t('SystemManage.DataRefresh.enable'):$t('SystemManage.DataRefresh.disable') }}</span>
  261. <span class="deletesty" v-if="classifyShowType==='own'&&isEdbBtnShow('edbData_edbCollect_collect')" @click="handleRemoveCollect(item)">移出</span>
  262. </div>
  263. <img src="~@/assets/img/icons/edb-stopping.png" class="stop-mark" v-if="([2,34].includes(item.Source) || item.EdbType==2) && ( item.IsSupplierStop==1 || (item.IsSupplierStop==0&&item.NoUpdate==1))" />
  264. </div>
  265. </div>
  266. </div>
  267. <div v-if="!Total" class="nodata">
  268. <tableNoData :text="$t('Table.no_edb_msg')"/>
  269. </div>
  270. </div>
  271. <!-- 指标详情 -->
  272. <div class="main-right right detail-wrap" id="right" v-show="isShowDetail">
  273. <div class="detail" v-if="EdbData.HaveOperaAuth">
  274. <div class="header">
  275. <el-tabs v-model="activeTab" @tab-click="rePainChart">
  276. <el-tab-pane :label="$t('Edb.trend_chart_tab')" name="Chart">
  277. </el-tab-pane>
  278. <el-tab-pane :label="$t('Edb.data_detail_tab')" name="Data">
  279. </el-tab-pane>
  280. </el-tabs>
  281. <div class="edb-tool-icon edb-tool" style="align-items: center;">
  282. <el-button
  283. v-if="([2,34].includes(EdbData.Source) || EdbData.EdbType==2) && isEdbBtnShow('enableOrDisable')&&EdbData.IsSupplierStop!=1"
  284. type="text"
  285. :style="{'color': EdbData.NoUpdate==1?'#0052D9':'#D54941'}"
  286. @click="toggleEdbRefreshStatus(EdbData,'detail')"
  287. >{{EdbData.NoUpdate==1?$t('SystemManage.DataRefresh.enable'):$t('SystemManage.DataRefresh.disable') }}<!-- 启用/停用 --></el-button>
  288. <el-button
  289. v-if="isBasicBase&&isEdbBtnShow('edbData_edbCollect_collect')"
  290. type="text"
  291. @click="classifyShowType==='own'?handleRemoveCollect():handleCollectEdb()"
  292. >{{classifyShowType==='own'?'移出':'收藏'}}</el-button>
  293. <el-button
  294. v-if="isEdbBtnShow('update')"
  295. type="text"
  296. @click="refreshTargetHandle"
  297. >{{$t('Edb.detail_refresh_btn')}}<!-- 刷新 --></el-button>
  298. <el-button
  299. v-if="isEdbBtnShow('edit')"
  300. type="text"
  301. :disabled="!(EdbData.Button.OpButton)"
  302. @click="editNode({},EdbData)"
  303. >{{$t('Edb.detail_edit_btn')}}<!-- 编辑 --></el-button>
  304. <!-- 指保存指标的上下限,在走势图才显示 -->
  305. <el-button
  306. v-if="activeTab==='Chart'&&isEdbBtnShow('saveEdb')"
  307. type="text"
  308. @click.stop="saveEdbLimit"
  309. >{{$t('Edb.detail_save_btn')}}<!-- 保存 --></el-button>
  310. <el-button
  311. v-if="EdbData.EdbType===2&&isEdbBtnShow('toSource')"
  312. type="text"
  313. @click="toHistoryPage(selected_edbid,$route.matched);lookEdbId=selected_edbid"
  314. >{{$t('Edb.detail_trace_btn')}}<!-- 指标溯源 --></el-button>
  315. <el-popover
  316. v-if="showPopver"
  317. placement="bottom-end"
  318. trigger="hover"
  319. popper-class="edb-tool-popover"
  320. width="300" style="display: inline-block;"
  321. >
  322. <div class="edb-tool-wrap">
  323. <el-button
  324. v-if="isEdbBtnShow('setEn')"
  325. type="text"
  326. @click="openLangInfoDia"
  327. >{{$t('Edb.detail_en_btn')}}<!-- 编辑信息 --></el-button>
  328. <el-button
  329. v-if="EdbData.Button.InsertNewDataButton&&isEdbBtnShow('newValue')"
  330. type="text"
  331. @click.stop="updateNewestDataHandle"
  332. >{{(EdbData.DataInsertConfig.Date)?$t('Edb.detail_edit_latest'):$t('Edb.detail_add_latest')}}<!-- 添加最新值 --></el-button>
  333. <el-button
  334. v-if="EdbData.EdbType===2&&isEdbBtnShow('calculateAgain')"
  335. type="text"
  336. @click.stop="reCalculateHandler"
  337. :loading="calculateLoading"
  338. >{{$t('Edb.detail_recalculate_btn')}}<!-- 重新计算 --></el-button>
  339. <el-button
  340. v-if="EdbData.EdbType===1&&isEdbBtnShow('refreshAll')"
  341. type="text"
  342. @click.stop="refreshBaseHandler"
  343. :loading="refreshLoading"
  344. >{{$t('Edb.detail_refresh_all')}}<!-- 全部刷新 --></el-button>
  345. <el-button
  346. v-if="isEdbBtnShow('copyData')"
  347. type="text"
  348. @click="copyCode"
  349. >{{$t('Edb.detail_copydata_btn')}}<!-- 复制数据 --></el-button>
  350. <el-button
  351. v-if="EdbData.EdbType===2&&![58,59,67,68,74].includes(EdbData.Source)&&isEdbBtnShow('checkCalcChart')"
  352. type="text"
  353. @click.stop="viewNode"
  354. >{{$t('Edb.detail_formula_btn')}}<!-- 查看公式 --></el-button>
  355. <el-button
  356. v-if="EdbData.Button.ShowChartRelation&&isEdbBtnShow('checkRelatedChart')"
  357. type="text"
  358. @click="showAssociateChart=true,showAssociateComputeData=false"
  359. >{{$t('Edb.detail_related_charts_btn')}}<!-- 关联图 --></el-button>
  360. <el-button
  361. v-if="EdbData.Button.ShowEdbRelation&&isEdbBtnShow('checkRelatedEdb')"
  362. type="text"
  363. @click="showAssociateComputeData=true,showAssociateChart=false"
  364. >{{$t('Edb.detail_related_metrics_btn')}}<!-- 关联指标 --></el-button>
  365. <el-button
  366. v-if="EdbData.Button.DeleteButton&&isEdbBtnShow('deleteEdb')"
  367. type="text"
  368. @click="removeNode(_,EdbData)"
  369. style="color:#C54322;"
  370. >{{$t('Edb.detail_del_btn')}}<!-- 删除 --></el-button>
  371. </div>
  372. <div class="edb-btn" slot="reference">
  373. <el-button type="text">{{$t('Edb.detail_more_btn')}}<!-- 更多操作 --></el-button>
  374. <i class="el-icon-more" style="font-size: 14px;transform: rotate(90deg);cursor: pointer;color: #3375e1;"/>
  375. </div>
  376. </el-popover>
  377. </div>
  378. </div>
  379. <div class="container" id="detail-container">
  380. <div class="chart" v-show="activeTab==='Chart'">
  381. <chart-trend-render
  382. :edbid="selected_edbid"
  383. :chartLang="currentLang"
  384. :isShowChartBasis="isEdbBtnShow('showChartBasis')"
  385. :isAllowSwitchSeason="isEdbBtnShow('switchSeason')"
  386. :isAllowEditLimit="isEdbBtnShow('editLimit')"
  387. ref="createChart"
  388. @editEnName="openEnNameDia"/>
  389. <div class="info">
  390. <span>{{$t('Edb.Detail.source')}}:{{EdbData.SourceName}}</span>
  391. <span>{{$t('Edb.creater')}}:{{EdbData.SysUserRealName}}</span>
  392. </div>
  393. <ul class="value-ul"
  394. v-show="showTable&&dataList.length">
  395. <li class="value-item" style="background-color: #EBEFF6;">
  396. <span style="width:240px">{{$t('Edb.Detail.e_date')}}({{$t('Edb.Detail.e_fre')}}:{{getFrequencyTrans(EdbData.Frequency)}})</span>
  397. <span style="flex:1;">{{$t('Edb.Detail.e_value')}}</span>
  398. </li>
  399. <li class="value-item"
  400. v-for="item in dataList.slice(0,3)"
  401. :key="item.EdbDataId">
  402. <span class="value-label date" style="width:240px">
  403. <span style="position: relative;">
  404. <i class="new-tag" v-if="EdbData.LatestDate===item.DataTime"></i>
  405. {{item.DataTime}}
  406. </span>
  407. </span>
  408. <span :class="['value-label',{'predict-act': EdbData.DataInsertConfig.Date===item.DataTime}]" style="flex:1;">
  409. <span :class="['value-style',{'predict-act': EdbData.DataInsertConfig.Date===item.DataTime}]">{{item.Value}}</span>
  410. </span>
  411. </li>
  412. <li class="nodata value-item" v-if="!dataList.length"><!-- 暂无数据 -->{{$t('Table.prompt_slogan')}}</li>
  413. </ul>
  414. </div>
  415. <div class="list" v-show="activeTab==='Data'">
  416. <edb-detail-data
  417. ref="edb_detail_data"
  418. :currentLang="currentLang"
  419. :table-data="tableData"
  420. :table-colums-one="tableColumsOne"
  421. :table-colums-two="tableColumsTwo"
  422. :data-list="dataList"
  423. :haveMore="haveMore"
  424. @getNextData="()=>{page_no++;getDataList();}"
  425. />
  426. </div>
  427. </div>
  428. </div>
  429. <noDataAuth v-if="EdbData.HaveOperaAuth===false" :text="$t('MsgPrompt.no_edb_auth')"/>
  430. </div>
  431. </div>
  432. <!-- 目录弹窗 -->
  433. <openDialog
  434. :isOpenDialog="isOpenDialog"
  435. :title="dialog_title"
  436. :isBasicBase="isBasicBase"
  437. :formData="dialogForm"
  438. @closeDia="isOpenDialog=false"
  439. @sucessCallback="sucessCallback"
  440. />
  441. <!-- 指标弹窗 -->
  442. <addTargetDiaBase
  443. ref="addTargetDiaBase"
  444. :isAddTarget="isAddTarget"
  445. @cancelHandle="isAddTarget = false"
  446. @addSuccessHandle="addTargetSuccess"
  447. />
  448. <!-- 完善指标信息 -->
  449. <completeTargetDia
  450. :isOpenDialog="isComplete"
  451. @cancel="cacelCompleteCallback"
  452. :params="add_params"
  453. @addTargetCallback="addTargetCallback"
  454. />
  455. <!-- 计算指标弹窗 -->
  456. <computedDialog
  457. :isOpenComputed="computed_type === 4"
  458. :title="computedTit"
  459. :calulateForm="calulateForm"
  460. :calulateList="calulateList"
  461. @cancel="computed_type=0"
  462. @addCallBack="addComputedCallBack"
  463. @openPrev="isOpenComputed=true"
  464. @lookHistory="id => {toHistoryPage(id,$route.matched);lookEdbId=id;}"
  465. />
  466. <!-- 计算弹窗控制 -->
  467. <el-dialog
  468. :visible.sync="isOpenComputed"
  469. :close-on-click-modal="false"
  470. :modal-append-to-body='false'
  471. @close="isOpenComputed=false;"
  472. custom-class="dialog-computed"
  473. top="6vh"
  474. center
  475. width="920px"
  476. v-dialogDrag>
  477. <div class="dialog-computed-header">
  478. <el-radio-group :value="1" size="medium">
  479. <el-radio-button :label="1">{{$t('EtaBasePage.normal_calculate_tab')}}</el-radio-button>
  480. <span @click="showBatchComputedPop=true">
  481. <el-radio-button :label="2">{{$t('EtaBasePage.batch_calculate_tab')}}</el-radio-button>
  482. </span>
  483. </el-radio-group>
  484. </div>
  485. <ul class="computed-ul">
  486. <li
  487. :class="['cpmputed-li',item.type === computed_type?'act':'']"
  488. v-for="item in computedShowTypes"
  489. :key="item.type"
  490. @click="changeComputedType(item.type)">
  491. {{item.name}}
  492. <el-popover
  493. placement="top-start"
  494. width="500"
  495. trigger="hover"
  496. v-if="tips.get(item.type)"
  497. >
  498. <p style="padding:20px;line-height:25px;" v-html="tips.get(item.type)"/>
  499. <i slot="reference" class="el-icon-warning-outline"/>
  500. </el-popover>
  501. </li>
  502. </ul>
  503. </el-dialog>
  504. <!-- 转月值 同比 同差 平均值弹窗 -->
  505. <operationDialog
  506. :isOperation="([5,6,7,8,12,13,14,22,35,51,52,61,62,63,75].includes(computed_type) || (computed_type===40&&operationForm.view)) && computed_source===1"
  507. :type="computed_type"
  508. :operationForm="operationForm"
  509. @cancel="computed_type=0"
  510. @addCallBack="addComputedCallBack"
  511. @openPrev="isOpenComputed=true"
  512. @lookHistory="id => {toHistoryPage(id,$route.matched);lookEdbId=id;}"
  513. @changeSource="changeComputedType"
  514. />
  515. <!-- 一键更新弹窗 -->
  516. <update-dialog
  517. :isUpdate="isUpdate"
  518. @cancel="isUpdate = false"
  519. />
  520. <!-- 替换指标弹窗 -->
  521. <replace-dialog
  522. :isShow="isReplaceDia"
  523. @cancel="isReplaceDia = false"
  524. />
  525. <!-- 拼接弹窗 -->
  526. <joint-target-dia
  527. :isShow="computed_type === 'joint'"
  528. :params="operationForm"
  529. @cancel="computed_type=0"
  530. @addCallBack="addComputedCallBack"
  531. @openPrev="isOpenComputed=true"
  532. />
  533. <!-- 拟合残差弹窗 -->
  534. <fittingResidueDia
  535. :isShow="computed_type === 37 && computed_source===1"
  536. :type="37"
  537. :operationForm="operationForm"
  538. @cancel="computed_type=0"
  539. @addCallBack="addComputedCallBack"
  540. @openPrev="isOpenComputed=true"
  541. />
  542. <!-- 批量计算弹窗 -->
  543. <batchComputedDialog
  544. :isBatchComputed="[6,7,8,12,13,14,5,61,62,63,75].includes(computed_type) && computed_source===2"
  545. :type="computed_type"
  546. @cancel="computed_type=0"
  547. @addCallBack="addComputedCallBack"
  548. @openPrev="isOpenComputed=true"
  549. @lookHistory="id => {toHistoryPage(id,$route.matched);lookEdbId=id;}"
  550. @changeSource="changeComputedType"
  551. />
  552. <!-- 扩散指数弹窗 -->
  553. <diffusionIndexDialog
  554. :isShow="computed_type === 53 && computed_source===1"
  555. :type="computed_type"
  556. :operationForm="operationForm"
  557. @cancel="computed_type=0"
  558. @addCallBack="addComputedCallBack"
  559. @openPrev="isOpenComputed=true"
  560. />
  561. <!-- 添加最新值弹窗 -->
  562. <updateNewestDataDia
  563. :isShow.sync="isUpdateNewestData"
  564. :edbinfo="tableData[0]"
  565. :dataList="dataList"
  566. @success="updateNewest"
  567. />
  568. <!-- 指数修匀弹窗 -->
  569. <SmoothEdbDialog
  570. :is-open-smooth="computed_type==='alpha'"
  571. :computed-source="computed_source"
  572. :operationForm="operationForm"
  573. @cancel="computed_type=0"
  574. @openPrev="isOpenComputed=true"
  575. @addCallBack="addComputedCallBack"
  576. @lookHistory="id => {toHistoryPage(id,$route.matched);lookEdbId=id;}"
  577. />
  578. <!-- 批量计算指标 -->
  579. <batchComputedV2
  580. :isShow="showBatchComputedPop"
  581. :type="computed_type"
  582. :operationForm="operationForm"
  583. @close="isOpenComputed=false;showBatchComputedPop=false"
  584. @closeSelf="handleCloseBatchPopSelf"
  585. @addCallBack="addComputedCallBack"
  586. />
  587. <!-- 设置对应版本信息弹窗 -->
  588. <setLangInfoDia
  589. :isOpenDialog="isLangInfoDia"
  590. :formData="formItemArray"
  591. @cancel="isLangInfoDia=false"
  592. @updateLang="updateLang"
  593. cType="ebd"
  594. />
  595. <!-- 指标已经被引用 -->
  596. <edbHasUsedDia :show.sync="edbHasUsedDiaShow" :dataList="hasUsedList"/>
  597. <!-- 指标收藏弹窗 -->
  598. <edbCollectDia
  599. ref="edbCollectRef"
  600. :show.sync="isOpenEdbCollectDia"
  601. :edbId="selected_edbid"
  602. @success="edbData.IsCollect=true"
  603. />
  604. <!-- 添加收藏分类弹窗 -->
  605. <addCollectClassifyDia
  606. :show.sync="isOpenCollectClassifyDia"
  607. :form="collectClassifyForm"
  608. @confirm="getTreeData();isOpenEdbCollectDia&&$refs.edbCollectRef.getClassify()"
  609. />
  610. </div>
  611. </template>
  612. <script>
  613. import { dataBaseInterface } from '@/api/api.js';
  614. import { edbCollectInterface } from '@/api/modules/chartApi';
  615. import { getComputedTypes,getBatchComputedTypes,getFormulaTip } from './databaseComponents/util';
  616. import openDialog from './databaseComponents/openDialog';
  617. import addTargetDiaBase from './databaseComponents/addTargetDiaBase';
  618. import completeTargetDia from './databaseComponents/completeTargetDia'
  619. import computedDialog from './databaseComponents/computedDialog';
  620. import operationDialog from './databaseComponents/operationDialog';
  621. // import createChart from './databaseComponents/createChart';
  622. import updateDialog from './databaseComponents/updateDialog';
  623. import replaceDialog from './databaseComponents/replaceDialog';
  624. import jointTargetDia from './databaseComponents/jointTargetDia';
  625. import changeLang from "./components/changeLang.vue"
  626. import setEnNameDia from "./components/setEnNameDia.vue"
  627. import dataAssociateChart from './databaseComponents/dataAssociateChart.vue'
  628. import dataAssociateComputeData from './databaseComponents/dataAssociateComputeData.vue'
  629. import fittingResidueDia from './databaseComponents/fittingResidueDia.vue';
  630. import batchComputedDialog from './databaseComponents/batchComptedDialog.vue';
  631. import diffusionIndexDialog from './databaseComponents/diffusionIndexDia.vue';
  632. import updateNewestDataDia from './databaseComponents/updateNewestDia.vue';
  633. import EdbLabelList from '@/components/edbLabelList.vue';
  634. import chartTrendRender from './databaseComponents/chartTrendRender.vue';
  635. import edbDetailData from './databaseComponents/edbDetailData.vue';
  636. import SmoothEdbDialog from './databaseComponents/smoothEdbDialog.vue';
  637. import batchComputedV2 from './databaseComponents/batchComputedV2.vue';
  638. import setLangInfoDia from './components/setLangInfo.vue'
  639. import edbHasUsedDia from './components/edbHasUsedDia.vue';
  640. import collectEdbMenu from './databaseComponents/collectEdbMenu.vue';
  641. import edbCollectDia from './databaseComponents/edbCollectDia.vue';
  642. import addCollectClassifyDia from './databaseComponents/addCollectClassifyDia.vue';
  643. export default {
  644. name: '',
  645. components: {
  646. openDialog,
  647. addTargetDiaBase,
  648. completeTargetDia,
  649. computedDialog,
  650. operationDialog,
  651. // createChart,
  652. updateDialog,
  653. replaceDialog,
  654. jointTargetDia,
  655. changeLang,
  656. setEnNameDia,
  657. dataAssociateChart,
  658. dataAssociateComputeData,
  659. fittingResidueDia,
  660. batchComputedDialog,
  661. diffusionIndexDialog,
  662. updateNewestDataDia,
  663. EdbLabelList,
  664. chartTrendRender,
  665. edbDetailData,
  666. SmoothEdbDialog,
  667. batchComputedV2,
  668. setLangInfoDia,
  669. edbHasUsedDia,
  670. collectEdbMenu,
  671. edbCollectDia,
  672. addCollectClassifyDia
  673. },
  674. directives: {
  675. drag(el, bindings,vnode) {
  676. el.onmousedown = function(e) {
  677. var init = e.clientX;
  678. var box = $("#box")[0]
  679. let total_wid = box.offsetWidth
  680. var left = $("#left")[0];
  681. var right = $("#right")[0];
  682. var initWidth = left.offsetWidth;
  683. document.onmousemove = function(e) {
  684. var end = e.clientX;
  685. if(end > 310){
  686. var newWidth = end - init + initWidth;
  687. right.style.width = total_wid - newWidth + 'px'
  688. left.style.width = newWidth + "px";
  689. }else{
  690. end = 350;
  691. // 最小宽度300
  692. left.style.width = 300 + "px";
  693. // right.style.width = total_wid-300-20 +'px'
  694. }
  695. };
  696. document.onmouseup = function() {
  697. document.onmousemove = document.onmouseup = null;
  698. e.releaseCapture && e.releaseCapture();
  699. //移动结束触发重绘
  700. vnode.context.rePainChart()
  701. };
  702. e.setCapture && e.setCapture();
  703. return false;
  704. };
  705. }
  706. },
  707. data() {
  708. return {
  709. IsOnlyMe:false,//只看我的
  710. showData: false,
  711. search_txt: '', //搜索词
  712. searchOptions:[],//搜索到的筛选列表
  713. treeData: [], //树形数据
  714. defaultShowNodes:[], //默认展开的节点
  715. defaultProp: {
  716. label: 'ClassifyName',
  717. children: 'Children',
  718. isLeaf:'isLeaf'
  719. },//树结构配置项
  720. tableData: [],
  721. loading:null,
  722. showTable:false,
  723. page_no: 1,
  724. haveMore: true,
  725. selected_edbid: 0,//选中的指标id
  726. dataList: [],//指标数值
  727. new_label: '',//新的节点label值
  728. select_node:'',//当前选中的节点
  729. /* 新增编辑目录弹窗 */
  730. isOpenDialog:false,
  731. dialog_title: '',
  732. dialogForm:{
  733. level:''
  734. },
  735. /* 新增指标弹窗 */
  736. isAddTarget: false,
  737. /* 完善信息 */
  738. isComplete:false,
  739. add_params:{},
  740. defaultWarn:'请在左侧选择指标',//缺省文字
  741. /* 计算指标弹窗 */
  742. isOpenComputed:false,
  743. computedTit:'',
  744. calulateForm:{},
  745. calulateList:[],
  746. computed_type:0,//打开弹窗的类型
  747. operationForm:{},
  748. dynamicNode:null,
  749. edb_source:0,//指标来源 显示计算按钮
  750. calculateLoading: false,//计算指标刷新loading
  751. refreshLoading: false,//基础指标刷新loading
  752. /* 一键更新弹窗 */
  753. isUpdate:false,
  754. /* 替换指标弹窗 */
  755. isReplaceDia: false,
  756. /* 拼接指标弹窗 */
  757. isJoint: false,
  758. search_page: 1,
  759. search_have_more: false,
  760. current_search:'',
  761. // currentLang:'ch', // 语言 ch 中文 en 英文
  762. // -----------------设置英文指标弹窗
  763. setEnName:false,
  764. // 传入的formItem所需内容
  765. formItemArray:[],
  766. // 在哪里更新的英文指标 table(表格上) chart(图表里)
  767. updateType:'table',
  768. // ----------------------
  769. edb_levels:[],//指标的父级分类id
  770. showAssociateChart:false,//显示指标关联的图
  771. showAssociateComputeData:false,//显示指标关联的引用计算指标
  772. computed_source: 1,//计算类型 1常规 2批量
  773. isBatchComputed: false,//批量计算弹窗
  774. //添加最新值弹窗
  775. isUpdateNewestData: false,
  776. /* 查看历史弹窗 */
  777. isLookHistory: false,
  778. lookEdbId: 0,
  779. labelList:[],//标签列表
  780. CanOpClassify: false,
  781. select_classifyId:0,//指标分类id
  782. PageSize:20,
  783. CurrentIndex:1,
  784. Total:0,
  785. IsListEnd:false,//是不是到底了
  786. chartList:[],
  787. activeTab:'',
  788. activeName:'second',
  789. isMainLeftShow:true,
  790. showBatchComputedPop:false,
  791. /* 修改对应版本信息弹窗 替换原有设置英文*/
  792. isLangInfoDia: false,
  793. edbHasUsedDiaShow:false,
  794. hasUsedList:[],
  795. /* 目录分类 */
  796. classifyShowType:'public',
  797. searchCollectWord:'',
  798. //指标收藏弹窗
  799. isOpenEdbCollectDia: false,
  800. //收藏分类弹窗
  801. isOpenCollectClassifyDia: false,
  802. collectClassifyForm: {}
  803. };
  804. },
  805. watch: {
  806. selected_edbid(newval) {
  807. if(!newval) {
  808. this.tableData = [];
  809. this.dataList = [];
  810. this.defaultWarn = '请在左侧选择指标';
  811. this.activeTab=''
  812. }else {
  813. console.log('new val')
  814. this.activeTab='Chart'
  815. this.initGetData();
  816. }
  817. },
  818. /* 选中搜索指标 展开目录 选中指标 展示数据 */
  819. search_txt(newval) {
  820. if (newval) {
  821. let [search_obj] = this.searchOptions.filter(
  822. (item) => item.EdbInfoId === newval
  823. );
  824. this.page_no = 1;
  825. if(this.$refs.edb_detail_data){
  826. this.$refs.edb_detail_data.$refs.valueUl.scrollTop=0
  827. }
  828. this.select_node = search_obj.UniqueCode;
  829. this.selected_edbid = newval;
  830. }
  831. },
  832. select_classifyId(newval){
  833. if(this.$refs.listRef) this.$refs.listRef.scrollTop = 0;
  834. if(newval){
  835. this.CurrentIndex = 1
  836. this.getEdbChartList()
  837. }
  838. },
  839. isMainLeftShow(newVal){
  840. this.rePainChart()
  841. },
  842. },
  843. computed: {
  844. /* 是否是数据查看库 */
  845. isBasicBase() {
  846. return this.$route.path === '/edbBasicbase'
  847. },
  848. /* 计算弹窗控制 */
  849. computedShowTypes() {
  850. return this.computed_source===1 ? getComputedTypes() : getBatchComputedTypes();
  851. },
  852. role() {
  853. let role = localStorage.getItem('Role') || '';
  854. if (['rai_researcher', 'ficc_researcher', 'researcher','ficc_seller','rai_seller','seller'].includes(role)) {
  855. return 'researcher'
  856. }else if(['rai_admin','ficc_admin'].includes(role)) {
  857. return 'admin'
  858. }
  859. else {
  860. return role;
  861. }
  862. },
  863. //指标详情,也就是tableData[0]
  864. EdbData(){
  865. return this.tableData[0]?this.tableData[0]:{Button:{},DataInsertConfig:{},DataList:[]}
  866. },
  867. //是否显示指标列表
  868. isShowList(){
  869. return !this.showAssociateChart&&!this.showAssociateComputeData&&!this.selected_edbid
  870. },
  871. //是否显示指标详情
  872. isShowDetail(){
  873. return !this.showAssociateChart&&!this.showAssociateComputeData&&this.selected_edbid
  874. },
  875. //是否显示更多操作
  876. showPopver(){
  877. return this.isEdbBtnShow('setEn')||
  878. this.EdbData.Button.InsertNewDataButton&&this.isEdbBtnShow('newValue')||
  879. this.EdbData.EdbType===2&&this.isEdbBtnShow('calculateAgain')||
  880. this.EdbData.EdbType===1&&this.isEdbBtnShow('refreshAll')||
  881. this.isEdbBtnShow('copyData')||
  882. this.EdbData.Button.DeleteButton&&this.isEdbBtnShow('deleteEdb')
  883. },
  884. /*表格列 */
  885. tableColumsOne(){
  886. return [
  887. {
  888. label: this.$t('Edb.Detail.e_id'),
  889. key: 'EdbCode',
  890. minwidthsty: '150px'
  891. },
  892. {
  893. label: this.$t('Edb.Detail.e_name'),
  894. key: 'EdbName',
  895. enKey:'EdbNameEn',
  896. inputTip:'点击输入英文指标名称',
  897. minwidthsty: '200px'
  898. },
  899. {
  900. label: this.$t('Edb.Detail.e_fre'),
  901. key: 'Frequency',
  902. enKey:'FrequencyEn',
  903. widthsty: '100px'
  904. },
  905. {
  906. label: this.$t('Edb.Detail.e_unit'),
  907. key: 'Unit',
  908. enKey:'UnitEn',
  909. inputTip:'英文单位',
  910. // minwidthsty: '50px'
  911. widthsty: '100px'
  912. },
  913. {
  914. label: this.$t('Edb.Detail.source'),
  915. key: 'SourceName',
  916. widthsty: '160px'
  917. },
  918. ]
  919. },
  920. tableColumsTwo() {
  921. return [
  922. {
  923. label: this.$t('Edb.Detail.e_menu'),
  924. key: 'Menu',
  925. minwidthsty: '150px',
  926. },
  927. {
  928. label: this.$t('Edb.Detail.e_start_time'),
  929. key: 'StartDate',
  930. minwidthsty: '115px',
  931. },
  932. {
  933. label: this.$t('Edb.Detail.e_update_time'),
  934. key: 'ModifyTime',
  935. minwidthsty: '120px',
  936. },
  937. {
  938. label: this.$t('Edb.creater'),
  939. key: 'SysUserRealName',
  940. widthsty: '160px',
  941. }
  942. ]
  943. },
  944. tips() {//公式说明
  945. return getFormulaTip()
  946. },
  947. currentLang() {
  948. return this.$store.state.lang
  949. }
  950. },
  951. methods: {
  952. //控制页面按钮权限
  953. isEdbBtnShow(type){
  954. const {edbDataPermission,checkPermissionBtn}=this.permissionBtn
  955. const BtnMap = {
  956. 'update':edbDataPermission.edbData_update,//指标更新
  957. 'edit':edbDataPermission.edbData_edit,//指标编辑
  958. /* 'toImg':edbDataPermission.edbData_toImgs, */
  959. 'copyData':edbDataPermission.edbData_copyData,//复制数据
  960. 'toSource':edbDataPermission.edbData_edbSource,//指标溯源
  961. 'setEn':edbDataPermission.edbData_enNameSetting,//设置英文名称
  962. 'newValue':edbDataPermission.edbData_newestValue,//添加/编辑最新值
  963. 'refreshAll':edbDataPermission.edbData_refreshAll,//全部刷新
  964. 'saveEdb':edbDataPermission.edbData_saveEdb,//保存指标
  965. 'deleteEdb':edbDataPermission.edbData_deleteEdb,//删除指标
  966. 'showChartBasis':edbDataPermission.edbData_showChartBasis,//展示/隐藏同比图
  967. 'switchSeason':edbDataPermission.edbData_switchSeason,//切换季节性图
  968. 'editLimit':edbDataPermission.edbData_editLimit,//编辑上下限
  969. 'calculateAgain':edbDataPermission.edbData_calculateAgain,//重新计算
  970. 'editCatalog':edbDataPermission.edbData_classifyOpt_add,//添加编辑目录
  971. 'deleteCatalog':edbDataPermission.edbData_classifyOpt_delete,//删除目录
  972. 'moveCatalog':edbDataPermission.edbData_classifyOpt_move,//删除目录
  973. 'checkRelatedChart':edbDataPermission.edbData_checkRelatedChart,//查看关联图表
  974. 'checkRelatedEdb':edbDataPermission.edbData_checkRelatedEdb,//查看关联指标
  975. 'checkCalcChart':edbDataPermission.edbData_checkCalcChart,//查看计算指标
  976. 'enableOrDisable':edbDataPermission.edbData_enableOrDisable,//启用/停用
  977. 'edbData_edbCollect_collect': edbDataPermission.edbData_edbCollect_collect,//收藏移出
  978. 'edbData_edbCollectClassify_save': edbDataPermission.edbData_edbCollectClassify_save,//收藏分类编辑
  979. 'edbData_edbCollectClassify_remove': edbDataPermission.edbData_edbCollectClassify_remove,//收藏分类删除
  980. 'edbData_edbCollectClassify_move': edbDataPermission.edbData_edbCollectClassify_move,//收藏分类移动
  981. 'edbData_edbCollectClassify_remove': edbDataPermission.edbData_edbCollectClassify_remove,//收藏分类移动
  982. }
  983. return checkPermissionBtn(BtnMap[type])
  984. },
  985. /* 获取树分类数据 */
  986. async getTreeData(params) {
  987. const res = this.classifyShowType==='own'
  988. ? await edbCollectInterface.getEdbCollectClassify({ParentId:0})
  989. : await dataBaseInterface.targetCatalog({
  990. IsOnlyMe:this.IsOnlyMe,
  991. ParentId:0,
  992. ClassifyType: this.isBasicBase ? 0 : 2
  993. })
  994. if(res.Ret!==200) return
  995. this.showData = true;
  996. if(this.classifyShowType==='public') {
  997. const arr=res.Data.AllNodes || []
  998. this.treeData=arr.map(item=>{
  999. return {
  1000. ...item,
  1001. // isLeaf:item.Children.length?false:true
  1002. }
  1003. })
  1004. this.CanOpClassify = res.Data.CanOpClassify;
  1005. /* 处理树展开和选中图表 */
  1006. params && this.selectCurrentNode(params);
  1007. !params && this.select_node && this.$refs.menuTree.setCurrentKey(this.select_node);
  1008. }else {
  1009. this.treeData = res.Data||[]
  1010. this.select_classify =
  1011. this.select_classify ||
  1012. (this.treeData.length ? this.treeData[0].ClassifyId:0);
  1013. }
  1014. },
  1015. /* 获取最新的指标 默认展示 */
  1016. getNewTargetList: _.throttle(function() {
  1017. dataBaseInterface.targetNew().then(res => {
  1018. if(res.Ret === 200) {
  1019. /* 默认选中 默认指标id */
  1020. this.select_node = res.Data ? res.Data.UniqueCode : '';
  1021. this.selected_edbid = res.Data ? res.Data.EdbInfoId : 0;
  1022. this.getTreeData();
  1023. }
  1024. })
  1025. }),
  1026. /* 获取指标数据 */
  1027. getDataList: _.throttle(function(type) {
  1028. dataBaseInterface.targetList({
  1029. PageSize: 20,
  1030. CurrentIndex: this.page_no,
  1031. EdbInfoId: this.selected_edbid,
  1032. // KeyWord: this.search_txt,
  1033. }).then(res => {
  1034. if(res.Ret === 200) {
  1035. this.showTable = true;
  1036. if(res.Data) {
  1037. // res.Data.Item.ModifyTime = res.Data.Item.ModifyTime.substr(0,10);
  1038. let classify_arr = res.Data.ClassifyList || [];
  1039. let str = '';
  1040. classify_arr.length && classify_arr.reverse().map(item => str += item[this.currentLang==='en'?'ClassifyNameEn':'ClassifyName'] + '/');
  1041. this.edb_levels = classify_arr;
  1042. this.$set(res.Data.Item,'Menu',str);
  1043. this.tableData = [res.Data.Item] || [];
  1044. this.edb_source = res.Data.Item.Source;
  1045. this.haveMore = this.page_no < res.Data.Paging.Pages ? true : false;
  1046. this.dataList = this.page_no === 1 ? (res.Data.Item.DataList || []) : this.dataList.concat(res.Data.Item.DataList);
  1047. //将指标添加进标签列表中
  1048. const {EdbNameEn,EdbName,EdbInfoId,UniqueCode,ClassifyId}=res.Data.Item
  1049. this.addLabel({code:UniqueCode,id:EdbInfoId,classifyId:ClassifyId,EdbName,EdbNameEn})
  1050. // 展开目录
  1051. this.defaultShowNodes=classify_arr.map(item=>item.UniqueCode)
  1052. //设置tree高亮
  1053. this.$refs.menuTree&&this.$nextTick(()=>{
  1054. setTimeout(() => {
  1055. this.$refs.menuTree.setCurrentKey(UniqueCode);
  1056. }, 1000);
  1057. })
  1058. // 重绘图表,刷新数据
  1059. this.$refs.createChart&&this.$refs.createChart.getEdbData()
  1060. }else {
  1061. this.tableData = [];
  1062. this.dataList = [];
  1063. this.defaultWarn = type=== 'search' ? '未搜索到该指标' : '请在左侧选择指标'
  1064. this.$refs.menuTree.setCurrentKey(null)
  1065. // 清除当前的label
  1066. this.$message.warning('该图表已删除,自动查看下一图表')
  1067. this.deleteLabel({code:this.select_node,id:this.selected_edbid,classifyId:''})
  1068. }
  1069. if(type==='refresh') {
  1070. if(this.$refs.edb_detail_data){
  1071. this.$refs.edb_detail_data.$refs.valueUl.scrollTop=0
  1072. }
  1073. }
  1074. this.$refs.menuTree&&this.$nextTick(()=>{
  1075. const _node = this.$refs.menuTree.getNode(this.select_node)
  1076. this.dynamicNode = _node;
  1077. this.dynamicNode&&this.resetNodeStyle(this.dynamicNode)
  1078. //滚动到高亮位置
  1079. setTimeout(() => {
  1080. let node = document.getElementById(`node${this.select_node}`)||{}
  1081. let parent = document.getElementsByClassName('target_tree')[0];
  1082. //parent可视区间:[scrollTop,scrollTop+offsetHeight]
  1083. //node位置:node.offsetTop
  1084. const overTop = node.offsetTop+node.clientHeight+30<parent.scrollTop
  1085. const overBottom = node.offsetTop+node.clientHeight+30>parent.scrollTop+parent.offsetHeight
  1086. if(overTop){
  1087. parent.scrollTop = node.offsetTop-60
  1088. }
  1089. if(overBottom){
  1090. parent.scrollTop = node.offsetTop - parent.offsetHeight/2
  1091. }
  1092. },1500)
  1093. })
  1094. }
  1095. })
  1096. }),
  1097. //获取指标图表列表
  1098. async getEdbChartList(){
  1099. const res = this.classifyShowType === 'own'
  1100. ? await edbCollectInterface.getCollectEdb({
  1101. PageSize:this.PageSize,
  1102. CurrentIndex:this.CurrentIndex,
  1103. ClassifyId:this.select_classifyId,
  1104. Keyword: this.searchCollectWord
  1105. })
  1106. : await dataBaseInterface.getEdbChartList({
  1107. PageSize:this.PageSize,
  1108. CurrentIndex:this.CurrentIndex,
  1109. ClassifyId:this.select_classifyId,
  1110. IsOnlyMe:this.IsOnlyMe,
  1111. EdbType: this.isBasicBase?1:2
  1112. })
  1113. if(res.Ret!==200) return
  1114. if(res.Data){
  1115. this.chartList = this.CurrentIndex===1?res.Data.List:[...this.chartList,...res.Data.List]
  1116. this.Total = res.Data.Paging.Totals||0
  1117. this.IsListEnd = res.Data.Paging.IsEnd
  1118. }
  1119. },
  1120. // 切换刷新状态
  1121. async toggleEdbRefreshStatus(item,type='list'){
  1122. let flag = true
  1123. if(item.NoUpdate==0){
  1124. flag=false
  1125. await this.$confirm(this.$t('SystemManage.DataRefresh.disable_indicator_prompt'),this.$t('Confirm.prompt'),{
  1126. type:"warning"
  1127. }).then(res=>{
  1128. flag=true
  1129. }).catch(()=>{})
  1130. }
  1131. if(!flag) return
  1132. let ModifyStatus = item.NoUpdate==1?'启用':'暂停'
  1133. dataBaseInterface.edbRefreshStatusSet({EdbInfoId:item.EdbInfoId,ModifyStatus}).then(res=>{
  1134. if(res.Ret == 200){
  1135. item.NoUpdate=1-item.NoUpdate
  1136. if(type=='detail'){
  1137. this.$refs.createChart.toggleEdbRefreshStatusFun()
  1138. }
  1139. this.$message.success(this.$t('MsgPrompt.operate_success_msg'))
  1140. }
  1141. })
  1142. },
  1143. //指标图表列表-加载更多
  1144. loadMoreHandle: _.throttle(function() {
  1145. let scrollTop = this.$refs.listRef.scrollTop;
  1146. let clientHeight = this.$refs.listRef.clientHeight;
  1147. let scrollHeight = this.$refs.listRef.scrollHeight;
  1148. if(scrollTop + clientHeight >= scrollHeight-210 && !this.IsListEnd){
  1149. this.CurrentIndex++;
  1150. this.getEdbChartList();
  1151. }
  1152. },300),
  1153. /* 搜索 */
  1154. searchHandle(query) {
  1155. this.search_page = 1;
  1156. this.current_search = query;
  1157. this.searchApi(this.current_search)
  1158. },
  1159. searchApi(query,page=1) {
  1160. dataBaseInterface.targetSearchByPage({
  1161. KeyWord:query,
  1162. CurrentIndex: page,
  1163. EdbType: this.isBasicBase?1:2
  1164. }).then(res => {
  1165. if(res.Ret !== 200) return
  1166. const { List,Paging } = res.Data;
  1167. this.search_have_more = page < Paging.Pages;
  1168. this.searchOptions = page === 1 ? List : this.searchOptions.concat(List);
  1169. })
  1170. },
  1171. /* 聚焦获取当前检索 */
  1172. inputFocusHandle(e) {
  1173. this.search_page = 1;
  1174. this.current_search = e.target.value;
  1175. this.searchApi(this.current_search);
  1176. },
  1177. searchLoad() {
  1178. if(!this.search_have_more) return;
  1179. this.searchApi(this.current_search,++this.search_page);
  1180. },
  1181. /* 数值滚动加载 */
  1182. scrollHandle: _.throttle(function() {
  1183. let scrollTop = this.$refs.valueUl.scrollTop;
  1184. let clientHeight = this.$refs.valueUl.clientHeight;
  1185. let scrollHeight = this.$refs.valueUl.scrollHeight;
  1186. console.log('scrollTop:',scrollTop)
  1187. console.log('clientHeight:',clientHeight)
  1188. console.log('scrollHeight:',scrollHeight)
  1189. if(scrollTop + clientHeight >= scrollHeight-10 && this.haveMore){
  1190. this.page_no ++;
  1191. this.getDataList();
  1192. }
  1193. },200),
  1194. openLangInfoDia(type='table') {
  1195. this.updateType = type
  1196. this.formItemArray=[
  1197. {
  1198. label:/* '指标名称' */ this.$t('Edb.Detail.e_name'),
  1199. value: this.currentLang==='en'?this.tableData[0].EdbNameEn:this.tableData[0].EdbName,
  1200. key:'EdbName',
  1201. placeholder:this.$t('Edb.InputHolderAll.input_common',{label:this.$t('Edb.Detail.e_name')}) /* '请输入指标名称' */
  1202. },
  1203. {
  1204. label:this.$t('Edb.Detail.e_unit') /* '单位' */,
  1205. value: this.currentLang==='en'?this.tableData[0].UnitEn:this.tableData[0].Unit,
  1206. key:'Unit',
  1207. placeholder:this.$t('Edb.InputHolderAll.input_common',{label:this.$t('Edb.Detail.e_unit')}) /* '请输入单位' */
  1208. }
  1209. ]
  1210. this.isLangInfoDia = true
  1211. },
  1212. updateLang(item) {
  1213. let params={
  1214. EdbInfoId: Number(this.selected_edbid),
  1215. ...item
  1216. }
  1217. dataBaseInterface.setEdbLangInfo(params).then(res=>{
  1218. if(res.Ret !==200) return
  1219. this.$message.success(res.Msg)
  1220. this.getTreeData()
  1221. this.getDataList()
  1222. if(this.updateType=='chart'){
  1223. // 重绘图表,刷新数据
  1224. this.$refs.createChart.getEdbData()
  1225. }
  1226. this.isLangInfoDia = false
  1227. })
  1228. },
  1229. /* 新增指标 */
  1230. addHandler() {
  1231. this.isAddTarget = true;
  1232. },
  1233. /* 完善指标信息 */
  1234. completeTargetHandle(params) {
  1235. this.add_params = params;
  1236. this.isComplete = true;
  1237. },
  1238. /* 新增指标成功回调 */
  1239. addTargetCallback(params) {
  1240. this.$refs.addTargetDiaBase.init();
  1241. this.isComplete = false;
  1242. this.isAddTarget = false;
  1243. this.getTreeData(params);
  1244. this.changeTreeNode()
  1245. // this.getNewTargetList();
  1246. },
  1247. /* 取消新增回调 */
  1248. cacelCompleteCallback() {
  1249. this.isComplete = false
  1250. this.add_params = {}
  1251. },
  1252. /* 节点变化时 */
  1253. nodeChange(data,node) {
  1254. this.search_txt = '';
  1255. this.select_classifyId = !data.EdbInfoId?data.ClassifyId:0;
  1256. this.select_node = data.UniqueCode;
  1257. this.selected_edbid = data.EdbInfoId;
  1258. this.resetNodeStyle(node);
  1259. this.dynamicNode = node;
  1260. this.showAssociateChart=false
  1261. this.showAssociateComputeData=false
  1262. },
  1263. resetNodeStyle: _.debounce(function(node) {
  1264. const tree = $('.target_tree')[0];
  1265. let width = tree.offsetWidth;
  1266. console.log(width)
  1267. // let label_wid = width > 500 ? 'auto' : (width <= 300 && width < 360) ? 100 : 0.7*width;
  1268. let label_wid =
  1269. width > 500
  1270. ? 'auto'
  1271. : width <= 260
  1272. ? 80
  1273. : 0.4 * width;
  1274. this.$set(node, 'Nodewidth', label_wid + 'px');
  1275. },200),
  1276. /* 双击label出现input修改框 */
  1277. editNodeLabel(node, data) {
  1278. //目录名称可以双击修改 指标不能
  1279. if(!data.EdbCode && this.role === 'admin'&&this.isEdbBtnShow('editCatalog')) {
  1280. this.$set(data,'isEdit',true)
  1281. this.new_label = this.currentLang==='en' ? data.ClassifyNameEn : data.ClassifyName;
  1282. this.$nextTick(() => {
  1283. this.$refs.editVal.focus();
  1284. });
  1285. }
  1286. },
  1287. /* input失去焦点恢复node 修改最新的值*/
  1288. changeValue(node, data) {
  1289. if(this.new_label) {
  1290. this.$set(data,'isEdit',false)
  1291. dataBaseInterface.nodeEdit({
  1292. ClassifyId: data.ClassifyId,
  1293. ClassifyName: this.new_label
  1294. }).then(res => {
  1295. if(res.Ret === 200) {
  1296. this.getTreeData();
  1297. }
  1298. })
  1299. }else {
  1300. this.$message.warning('名称不能为空')
  1301. }
  1302. },
  1303. /* 添加一级目录 */
  1304. addLevelOneHandle() {
  1305. this.dialog_title = '添加';
  1306. this.dialogForm = {
  1307. level_1: '',
  1308. parent_id: '',
  1309. level: 0
  1310. }
  1311. this.isOpenDialog = true;
  1312. },
  1313. // 递归节点
  1314. getNodeParentData(data,arr){
  1315. if(data.level===0) return
  1316. arr.push({classifyName:this.currentLang==='en'?data.data.ClassifyNameEn:data.data.ClassifyName,classifyId:data.data.ClassifyId})
  1317. this.getNodeParentData(data.parent,arr)
  1318. return arr
  1319. },
  1320. /* 添加节点 */
  1321. addNode(node,data) {
  1322. console.log(node);
  1323. this.dialog_title = '添加';
  1324. let arr=[]
  1325. arr=this.getNodeParentData(node,arr)
  1326. // console.log(arr);
  1327. /* 添加目录 */
  1328. this.dialogForm = {
  1329. parentArr:arr,
  1330. parent_id: data.ClassifyId,
  1331. level: node.level,
  1332. levelVal:'',
  1333. isEDB:false
  1334. }
  1335. //存储当前要新增子级的目录code
  1336. sessionStorage.setItem('expandCode', data.UniqueCode);
  1337. this.isOpenDialog = true;
  1338. },
  1339. /* 编辑节点 */
  1340. editNode(node,data) {
  1341. // console.log(node);
  1342. this.dialog_title = '编辑';
  1343. if(data.EdbCode) {
  1344. /* 编辑指标 基础弹窗 */
  1345. (data.EdbType===1 || [58,59,67,68,74,87].includes(data.Source)) && dataBaseInterface.targetDetail({
  1346. EdbInfoId: data.EdbInfoId
  1347. }).then(res => {
  1348. if(res.Ret === 200) {
  1349. // 处理所在目录
  1350. let menuArrId=res.Data.ClassifyList&&res.Data.ClassifyList.map(item=>{
  1351. return item.ClassifyId
  1352. }).reverse()
  1353. this.dialogForm = {
  1354. parentArr:[],
  1355. level: 0,
  1356. levelVal: this.currentLang==='en'?res.Data.EdbNameEn:res.Data.EdbName,
  1357. level_menu:menuArrId||[],
  1358. edbinfo_id: res.Data.EdbInfoId,
  1359. frequency:res.Data.Frequency,
  1360. unit:this.currentLang==='en'?res.Data.UnitEn:res.Data.Unit,
  1361. isEDB:true
  1362. }
  1363. this.isOpenDialog = true;
  1364. }
  1365. });
  1366. /* 编辑计算指标 同比同差转月 */
  1367. (data.EdbType === 2 && ![27,40,58,59].includes(data.Source)) && dataBaseInterface.calculateDetail({
  1368. EdbInfoId: data.EdbInfoId
  1369. }).then(res => {
  1370. if(res.Ret === 200) {
  1371. this.setComputedDialogForm(data.Source,res.Data);
  1372. switch (data.Source) {
  1373. case 23:
  1374. case 24:
  1375. this.computed_type = 'joint';
  1376. break
  1377. case 72:
  1378. case 73:
  1379. this.computed_type = 'alpha';
  1380. break
  1381. default:
  1382. this.computed_type = data.Source;
  1383. break
  1384. }
  1385. // this.computed_type = [23,24].includes(data.Source) ? 'joint' : data.Source;
  1386. // this.computed_type = [72,73].includes(data.Source)? 'alpha': data.Source;
  1387. }
  1388. })
  1389. /* 代码运算 */
  1390. data.Source === 27 && this.$router.push({
  1391. path: '/codecount',
  1392. query: {
  1393. edbid: data.EdbInfoId
  1394. }
  1395. })
  1396. /* 数据调整 */
  1397. data.Source === 40 && this.$router.push({
  1398. path: '/adjustdata',
  1399. query: {
  1400. edbid: data.EdbInfoId,
  1401. }
  1402. })
  1403. }else {
  1404. let arr=[]
  1405. arr=this.getNodeParentData(node.parent,arr)
  1406. /* 编辑目录 */
  1407. this.dialogForm = {
  1408. isEDB:false,
  1409. parentArr:arr,
  1410. levelVal: this.currentLang==='en'?data.ClassifyNameEn:data.ClassifyName,
  1411. classify_id: data.ClassifyId,
  1412. level: node.level-1
  1413. }
  1414. this.isOpenDialog = true;
  1415. }
  1416. },
  1417. /* 保存成功 */
  1418. sucessCallback(type) {
  1419. this.isOpenDialog = false;
  1420. this.getTreeData();
  1421. type==='update' && this.getDataList();
  1422. if(type === 'add') {
  1423. //新增分类完成之后,展开父节点显示刚新增的分类,若已展开节点则不做处理
  1424. let code = sessionStorage.getItem('expandCode');
  1425. let flag = this.defaultShowNodes.some((item) => {
  1426. return item === code
  1427. });
  1428. // console.log(flag)
  1429. !flag &&code&& this.defaultShowNodes.push(code);
  1430. sessionStorage.removeItem('expandCode');
  1431. }
  1432. },
  1433. /* 刷新获取指标最新数据 */
  1434. refreshTargetHandle: _.debounce(function() {
  1435. //如果该指标为暂停刷新,则提示
  1436. if(this.EdbData.NoUpdate){
  1437. this.$message.warning("该指标已暂停刷新")
  1438. return
  1439. }
  1440. if(this.selected_edbid) {
  1441. this.loading = this.$loading({
  1442. lock: true,
  1443. target:'.detail',
  1444. text: this.$t('MsgPrompt.refresh_ing_msg'),
  1445. spinner: 'el-icon-loading',
  1446. background: 'rgba(255, 255, 255, 0.8)'
  1447. });
  1448. dataBaseInterface.targetRefresh({
  1449. EdbInfoId: this.selected_edbid
  1450. }).then(res => {
  1451. if(res.Ret === 200) {
  1452. this.loading.close();
  1453. this.$message.success(res.Msg);
  1454. this.page_no = 1;
  1455. this.getDataList('refresh')
  1456. this.$refs.createChart && this.$refs.createChart.getDataByPath()
  1457. }else{
  1458. this.loading.close();
  1459. }
  1460. })
  1461. }
  1462. },500),
  1463. /* 删除节点校验 */
  1464. removeNode(node,data) {
  1465. dataBaseInterface.nodeDelCheck({
  1466. ClassifyId: data.ClassifyId,
  1467. EdbInfoId: data.EdbInfoId
  1468. }).then(res => {
  1469. if(res.Ret === 200) {
  1470. /**
  1471. * 0 可删除
  1472. * 1 关联指标
  1473. * 2 有子目录无指标
  1474. * 4 当前指标已用作指标运算,不可删除
  1475. * 5 当前指标已用作预测指标,不可删除
  1476. * 6 当前指标已被表格引用,不可删除
  1477. * 7 当前指标已添加到跨品种分析,不可删除
  1478. */
  1479. const deleteLabelMap = {
  1480. 1: /* '该目录关联指标不可删除' */this.$t('Edb.MsgPrompt.del_not_relate_edb'),
  1481. 2: /* '确认删除当前目录及包含的子目录吗?' */this.$t('Edb.MsgPrompt.del_confirm_menu_or_children'),
  1482. 3: /* '当前指标已用作画图,不可删除' */this.$t('Edb.MsgPrompt.del_edb_use_chart'),
  1483. 4: res.Data.TipsMsg,
  1484. 5: res.Data.TipsMsg,
  1485. 6: res.Data.TipsMsg,
  1486. 7: res.Data.TipsMsg,
  1487. }
  1488. if([1,3,4,5,7].includes(res.Data.DeleteStatus)){
  1489. this.$confirm(
  1490. deleteLabelMap[res.Data.DeleteStatus],
  1491. /* '删除失败' */this.$t('Edb.MsgPrompt.del_failed'),
  1492. {
  1493. confirmButtonText:/* '知道了' */this.$t('Dialog.known'),
  1494. showCancelButton:false,
  1495. type: 'error'
  1496. })
  1497. }else if(res.Data.DeleteStatus == 6){
  1498. this.edbHasUsedDiaShow=true
  1499. this.hasUsedList=res.Data.TableList.map(it =>{
  1500. return {...it,routeUrl:this.getRouteUrl(it)}
  1501. })
  1502. }else if([0,2].includes(res.Data.DeleteStatus)) this.$confirm(
  1503. res.Data.DeleteStatus === 2
  1504. ? deleteLabelMap[res.Data.DeleteStatus]
  1505. : data.EdbCode? this.$t('Edb.MsgPrompt.del_edb_confirm')/* '删除后指标和指标值均不可使用,确认删除吗?' */:/* '确定删除当前目录吗?' */this.$t('Edb.MsgPrompt.del_menu_confirm'),
  1506. /* '提示' */this.$t('Dialog.warn_tit'),
  1507. {
  1508. confirmButtonText: /* '确定' */this.$t('Dialog.confirm_btn'),
  1509. cancelButtonText: /* '取消' */this.$t('Dialog.cancel_btn'),
  1510. type: 'warning'
  1511. }).then(() => {
  1512. this.delHandle(data.ClassifyId,data.EdbInfoId);
  1513. }).catch(() => {
  1514. });
  1515. }
  1516. })
  1517. },
  1518. getRouteUrl(table){
  1519. /**
  1520. 1 // 自定义excel
  1521. 2 // 时间序列表格
  1522. 3 // 混合表格
  1523. 4 // 自定义分析表格
  1524. 5 // 平衡表
  1525. */
  1526. let url=''
  1527. switch (table.Source) {
  1528. case 1:
  1529. url = this.$router.resolve({ path: '/sheetAnalysisList',query:{code:table.UniqueCode,id:table.ExcelInfoId}}).href;
  1530. break;
  1531. case 2:
  1532. url = this.$router.resolve({ path: '/sheetTimeList',query:{code:table.UniqueCode,id:table.ExcelInfoId}}).href;
  1533. break;
  1534. case 3:
  1535. url = this.$router.resolve({ path: '/sheetMixedList',query:{code:table.UniqueCode,id:table.ExcelInfoId}}).href;
  1536. break;
  1537. case 4:
  1538. url = this.$router.resolve({ path: '/sheetList',query:{code:table.UniqueCode,id:table.ExcelInfoId}}).href;
  1539. break;
  1540. case 5:
  1541. url = this.$router.resolve({ path: '/viewBalanceSheet',query:{id:table.ExcelInfoId}}).href;
  1542. break;
  1543. default:
  1544. break;
  1545. }
  1546. return url
  1547. },
  1548. /* 删除方法 */
  1549. delHandle(ClassifyId,EdbInfoId) {
  1550. dataBaseInterface.nodeDelete({
  1551. ClassifyId,
  1552. EdbInfoId
  1553. }).then(res => {
  1554. if(res.Ret === 200) {
  1555. this.$message.success(this.$t('MsgPrompt.delete_msg'));
  1556. this.getTreeData();
  1557. this.selected_edbid = 0;
  1558. this.deleteLabel({code:this.select_node,id:EdbInfoId,classifyId:ClassifyId})
  1559. // this.getNewTargetList();
  1560. }
  1561. })
  1562. },
  1563. /* 判断节点是否能被拖拽 */
  1564. canDragHandle({data}) {
  1565. return data.Button.MoveButton;
  1566. },
  1567. /* 判断节点是否能被拖入 */
  1568. canDropHandle(draggingNode, dropNode, type) {
  1569. let canDrop=false
  1570. // 如果拖动的是指标
  1571. if(draggingNode.data.EdbCode){
  1572. if(!(dropNode.level===1&&type!=='inner')){
  1573. canDrop=true
  1574. }
  1575. }else{//拖动的是目录
  1576. // console.log(dropNode.level,draggingNode.level);
  1577. //目录层级不能改变
  1578. if((dropNode.level+1==draggingNode.level&&type==='inner'&&!dropNode.data.EdbCode)||(dropNode.level===draggingNode.level&&type!=='inner')){
  1579. canDrop=true
  1580. }
  1581. }
  1582. return canDrop
  1583. },
  1584. /* 拖拽完成 */
  1585. dropOverHandle(b,a,i,e) {
  1586. // 被拖拽节点对应的 Node、结束拖拽时最后进入的节点、被拖拽节点的放置位置
  1587. console.log(b,a,i);
  1588. const isEDB=b.data.EdbCode?true:false
  1589. let list=a.parent.childNodes;
  1590. let targetIndex=0,PrevClassifyId=0,NextClassifyId=0,ParentClassifyId=0;
  1591. let ClassifyId=0,EdbInfoId=0,PrevEdbInfoId=0,NextEdbInfoId=0;
  1592. ClassifyId=isEDB?0:b.data.ClassifyId
  1593. EdbInfoId=isEDB?b.data.EdbInfoId:0
  1594. if(i!=='inner'){
  1595. ParentClassifyId=a.parent.data.ClassifyId||0
  1596. list.forEach((item,index)=>{
  1597. if(isEDB){
  1598. if(item.data.EdbInfoId===b.data.EdbInfoId){
  1599. targetIndex=index
  1600. }
  1601. }else{
  1602. if(item.data.ClassifyId===b.data.ClassifyId){
  1603. targetIndex=index
  1604. }
  1605. }
  1606. })
  1607. console.log(targetIndex);
  1608. if(targetIndex===0){
  1609. const data=list[targetIndex+1].data
  1610. NextClassifyId=data.EdbCode?0:data.ClassifyId
  1611. NextEdbInfoId=data.EdbCode?data.EdbInfoId:0
  1612. }else if(targetIndex===list.length-1){
  1613. const data=list[targetIndex-1].data
  1614. PrevClassifyId=data.EdbCode?0:data.ClassifyId
  1615. PrevEdbInfoId=data.EdbCode?data.EdbInfoId:0
  1616. }else{
  1617. const pData=list[targetIndex-1].data
  1618. PrevClassifyId=pData.EdbCode?0:pData.ClassifyId
  1619. PrevEdbInfoId=pData.EdbCode?pData.EdbInfoId:0
  1620. const nData=list[targetIndex+1].data
  1621. NextClassifyId=nData.EdbCode?0:nData.ClassifyId
  1622. NextEdbInfoId=nData.EdbCode?nData.EdbInfoId:0
  1623. }
  1624. }else{
  1625. ParentClassifyId=a.data.ClassifyId||0
  1626. }
  1627. const params={
  1628. ClassifyId,
  1629. ParentClassifyId,
  1630. EdbInfoId,
  1631. PrevClassifyId,
  1632. NextClassifyId,
  1633. PrevEdbInfoId,
  1634. NextEdbInfoId
  1635. }
  1636. console.log(params);
  1637. dataBaseInterface.classifyMoveSort(params).then(res=>{
  1638. if(res.Ret===200){
  1639. // this.$message.success('移动成功!')
  1640. this.$message.success(this.$t('MsgPrompt.move_sort_success'))
  1641. }
  1642. this.getTreeData()
  1643. if(this.selected_edbid){
  1644. this.getDataList();
  1645. }
  1646. })
  1647. },
  1648. /* 拖拽覆盖添加背景色 */
  1649. dropMouseOver(node1,node2,e) {
  1650. // console.log(e.layerY);
  1651. // 被拖拽节点对应的 Node、所进入节点对应的 Node、event
  1652. if(!node2.data.EdbInfoId&&(node1.level>node2.level||(node1.data.EdbInfoId>0&&!node2.data.EdbInfoId)) && (e.target.childNodes[0].className.includes('el-tree-node__content')
  1653. || e.target.className.includes('el-tree-node__content'))) {
  1654. // console.log(e.target.childNodes[0])
  1655. e.target.childNodes[0].className.includes('el-tree-node__content')
  1656. ? e.target.childNodes[0].style.backgroundColor = '#409eff'
  1657. : e.target.style.backgroundColor = '#409eff';
  1658. }
  1659. },
  1660. /* 拖拽离开/拖拽完成重置背景色 */
  1661. dropMouseLeave(node1,node2,e) {
  1662. let arrs = $('.el-tree-node__content');
  1663. for( let a of arrs ) {
  1664. a.style.backgroundColor = 'transparent';
  1665. }
  1666. },
  1667. // 树节点展开
  1668. handleNodeExpand (data) {
  1669. // 保存当前展开的节点
  1670. let flag = this.defaultShowNodes.some((item) => item === data.UniqueCode);
  1671. if (!flag) { // 不存在则存到数组里
  1672. this.defaultShowNodes.push(data.UniqueCode)
  1673. }
  1674. },
  1675. // 树节点关闭
  1676. handleNodeCollapse (data) {
  1677. this.defaultShowNodes.some((item, index) => {
  1678. if (item === data.UniqueCode) {
  1679. // 删除关闭节点
  1680. this.defaultShowNodes.length = index
  1681. }
  1682. })
  1683. },
  1684. /* 根据unicode展开树结构并选中指标 */
  1685. selectCurrentNode({ code, id,classifyId }) {
  1686. console.log(code, id,classifyId);
  1687. this.select_node = code;
  1688. this.selected_edbid = id;
  1689. //this.defaultShowNodes=this.findParentNodeForClassifyId(classifyId,code)
  1690. const containerDom = document.getElementById('detail-container')
  1691. containerDom&&(containerDom.scrollTop = 0)
  1692. //滚动到高亮节点位置
  1693. /* this.$nextTick(()=>{
  1694. setTimeout(() => {
  1695. let node = document.getElementById(`node${this.select_node}`)||{}
  1696. let parent = document.getElementsByClassName('tree-cont')[0];
  1697. //console.log('滚动',node,parent);
  1698. if(node.offsetTop > parent.offsetHeight) {
  1699. parent.scrollTop = node.offsetTop - parent.offsetHeight/2
  1700. }
  1701. },400)
  1702. }) */
  1703. },
  1704. // 查找树节点所有父节点
  1705. findParentNodeHandle(arr, id) {
  1706. // 遍历取父级code push数组
  1707. for (let i of arr) {
  1708. if (i.ClassifyId === id) {
  1709. return [i.UniqueCode];
  1710. }
  1711. if (i.Children) {
  1712. let node = this.findParentNodeHandle(i.Children, id);
  1713. if (node) {
  1714. return node.concat(i.UniqueCode);
  1715. }
  1716. }
  1717. }
  1718. },
  1719. // 通过分类id找到指标所属的分类
  1720. findParentNodeForClassifyId(id,code){
  1721. let arr=[]
  1722. this.treeData.forEach(item=>{
  1723. if(item.Children){
  1724. item.Children.forEach(_item=>{
  1725. if(_item.ClassifyId==id){
  1726. arr=[item.UniqueCode,_item.UniqueCode]
  1727. }
  1728. })
  1729. }
  1730. })
  1731. return [...arr,code]
  1732. },
  1733. /* 添加计算指标 */
  1734. addComputedHandler() {
  1735. this.computedTit = '计算指标';
  1736. this.calulateList = [];
  1737. this.calulateForm = {};
  1738. this.operationForm = {};
  1739. this.computed_type=0
  1740. this.isOpenComputed = true;
  1741. },
  1742. /* 新增计算指标回调 */
  1743. addComputedCallBack(type, params) {
  1744. this.computed_type = 0;
  1745. this.computed_source = 1;
  1746. this.showAssociateChart=false
  1747. this.showAssociateComputeData=false
  1748. this.showBatchComputedPop=false
  1749. this.isOpenComputed = false
  1750. console.log(type, params);
  1751. // this.getTreeData();
  1752. type === 'add' ? this.getTreeData(params) : this.getTreeData();
  1753. type === 'edit' && this.initGetData()
  1754. },
  1755. initGetData() {
  1756. this.page_no = 1;
  1757. if(this.$refs.edb_detail_data){
  1758. this.$refs.edb_detail_data.$refs.valueUl.scrollTop=0
  1759. }
  1760. this.getDataList();
  1761. },
  1762. /* 选择计算类型 */
  1763. changeComputedType(type) {
  1764. //保证source的对应关系
  1765. let typeMapSource = {
  1766. 'toMonthSeason': 5,
  1767. 'accumulate': 62
  1768. }
  1769. this.computed_type = typeMapSource[type] || type;
  1770. this.isOpenComputed = false;
  1771. },
  1772. /* 重新计算 */
  1773. reCalculateHandler() {
  1774. this.calculateLoading = true;
  1775. dataBaseInterface.reCalculateTarget({
  1776. EdbInfoId: Number(this.selected_edbid)
  1777. }).then(res => {
  1778. this.calculateLoading = false;
  1779. if(res.Ret !== 200) return;
  1780. this.$message.success(res.Msg);
  1781. this.initDataStatus();
  1782. }).catch(() => {
  1783. this.calculateLoading = false;
  1784. })
  1785. },
  1786. /* 查看计算公式 打开弹窗 */
  1787. viewNode(node,data) {
  1788. const { EdbInfoId,Source } = this.EdbData;
  1789. //代码运算指标
  1790. if( Source === 27 ) return this.$router.push({
  1791. path: '/codecount',
  1792. query: {
  1793. edbid: EdbInfoId,
  1794. isView: true
  1795. }
  1796. })
  1797. dataBaseInterface.calculateDetail({
  1798. EdbInfoId,
  1799. }).then(res => {
  1800. if(res.Ret !== 200) return
  1801. this.setComputedDialogForm(Source,res.Data,true);
  1802. switch (this.EdbData.Source) {
  1803. case 23:
  1804. case 24:
  1805. this.computed_type = 'joint';
  1806. break
  1807. case 72:
  1808. case 73:
  1809. this.computed_type = 'alpha';
  1810. break
  1811. default:
  1812. this.computed_type = this.EdbData.Source;
  1813. break
  1814. }
  1815. })
  1816. },
  1817. /* 设置回显计算指标的表单 */
  1818. setComputedDialogForm(type,res,view=false) {
  1819. //指标运算 or 其他计算类型指标
  1820. // 处理所在目录
  1821. let menuArrId=res.EdbInfoDetail.ClassifyList&&res.EdbInfoDetail.ClassifyList.map(item=>{
  1822. return item.ClassifyId
  1823. }).reverse()
  1824. if( type === 4 ) {
  1825. /* 回显指标和表单 */
  1826. const list = res.CalculateList;
  1827. this.computedTit = view ? '查看计算指标' : '编辑计算指标';
  1828. /* 依赖的指标列表 */
  1829. this.calulateList = list.map(item => {
  1830. return {
  1831. tag: item.FromTag,
  1832. edb_name: item.FromEdbName,
  1833. target: item.FromEdbInfoId,
  1834. start_date: item.StartDate,
  1835. end_date: item.EndDate
  1836. }
  1837. })
  1838. const { EdbInfoId,CalculateFormula,EdbName,EdbNameEn,Unit,UnitEn,Frequency,EmptyType,MaxEmptyType,Extra } = res.EdbInfoDetail;
  1839. /* 公式和表单 */
  1840. this.calulateForm = {
  1841. edb_id: EdbInfoId,
  1842. formula: CalculateFormula,
  1843. menu: menuArrId||[],
  1844. targetName: this.currentLang==='en'?EdbNameEn:EdbName,
  1845. unit: this.currentLang==='en'?UnitEn:Unit,
  1846. frequency: Frequency,
  1847. emptyType: EmptyType,
  1848. maxEmptyType: MaxEmptyType,
  1849. Extra,
  1850. view
  1851. };
  1852. } else {
  1853. // 多指标求和求平均
  1854. if([81,82].includes(type)){
  1855. this.operationForm={...res,view}
  1856. this.showBatchComputedPop=true
  1857. return
  1858. }
  1859. let dataInfo = res.EdbInfoDetail;
  1860. let old_edb = res.CalculateList;
  1861. let public_params = {
  1862. edb_id: dataInfo.EdbInfoId,
  1863. targetName: this.currentLang==='en'?dataInfo.EdbNameEn:dataInfo.EdbName,
  1864. frequency: dataInfo.Frequency,
  1865. unit: this.currentLang==='en'?dataInfo.UnitEn:dataInfo.Unit,
  1866. menu: menuArrId||[],
  1867. Extra:dataInfo.Extra,
  1868. view
  1869. }
  1870. this.operationForm = [23,24,37,53].includes(type)
  1871. ? {
  1872. ...public_params,
  1873. source: dataInfo.Source,
  1874. date: dataInfo.CalculateFormula,
  1875. pre_edb: type === 23 ? old_edb.find(item => item.FromTag === 'A').FromEdbInfoId : '', //俺也不懂为什么这么定义都是江西老表的锅
  1876. after_edb: type === 23 ? old_edb.find(item => item.FromTag === 'B').FromEdbInfoId : '',
  1877. old_stay_edb: type === 24 ? old_edb.find(item => item.FromTag === 'A').FromEdbInfoId : '',
  1878. concat_edb: type === 24 ? old_edb.find(item => item.FromTag === 'B').FromEdbInfoId : '',
  1879. from_arr: old_edb,
  1880. correlationStr: dataInfo.CorrelationStr
  1881. }
  1882. : {
  1883. ...public_params,
  1884. oldedb_id: old_edb[0].FromEdbInfoId,
  1885. oldEdb_name: old_edb[0].FromEdbName,
  1886. formula: dataInfo.CalculateFormula || '',
  1887. moveType: dataInfo.MoveType,
  1888. moveUnit: dataInfo.MoveFrequency,
  1889. moveVal: type === 22 ? dataInfo.CalculateFormula : '',
  1890. calendar_type: type === 35 ? dataInfo.Calendar : '',
  1891. EmptyType:dataInfo.EmptyType||0,
  1892. }
  1893. if([72,73].includes(type)){
  1894. const {EdbName,EdbNameEn,EdbInfoId,Frequency,Unit,UnitEn,ClassifyId,CalculateFormula} = dataInfo
  1895. this.operationForm = {
  1896. edb_id: EdbInfoId,
  1897. oldedb_id: old_edb[0].FromEdbInfoId,
  1898. oldEdb_name: old_edb[0].FromEdbName,
  1899. EdbName: this.currentLang==='en'?EdbNameEn:EdbName,
  1900. Frequency,
  1901. Unit:this.currentLang==='en'?UnitEn:Unit,
  1902. ClassifyId,
  1903. Formula:CalculateFormula,
  1904. view
  1905. }
  1906. }
  1907. }
  1908. },
  1909. /* 基础指标刷新 */
  1910. refreshBaseHandler() {
  1911. if(this.EdbData.NoUpdate){
  1912. this.$message.warning("该指标已暂停刷新")
  1913. return
  1914. }
  1915. this.refreshLoading = true;
  1916. this.loading = this.$loading({
  1917. lock: true,
  1918. target:'.detail',
  1919. text: this.$t('MsgPrompt.refresh_ing_msg'),
  1920. spinner: 'el-icon-loading',
  1921. background: 'rgba(255, 255, 255, 0.8)'
  1922. });
  1923. dataBaseInterface.refreshBaseTarget({
  1924. EdbInfoId: Number(this.selected_edbid)
  1925. }).then(res => {
  1926. this.refreshLoading = false;
  1927. this.loading&&this.loading.close()
  1928. if(res.Ret !== 200) return;
  1929. this.$message.success(res.Msg);
  1930. this.initDataStatus();
  1931. }).catch(() => {
  1932. this.refreshLoading = false;
  1933. })
  1934. },
  1935. /* 重新刷新 重新计算后重置刷数据 */
  1936. initDataStatus() {
  1937. this.page_no = 1;
  1938. if(this.$refs.edb_detail_data){
  1939. this.$refs.edb_detail_data.$refs.valueUl.scrollTop=0
  1940. }
  1941. this.getDataList();
  1942. },
  1943. /* 用于复制指标 */
  1944. async copyCode(){
  1945. const res = await dataBaseInterface.targetList({
  1946. PageSize: 100000,
  1947. CurrentIndex: 1,
  1948. EdbInfoId: this.selected_edbid,
  1949. })
  1950. if (res.Ret===200){
  1951. let arr = res.Data.Item.DataList ||[]
  1952. let str = '日期\t 值\n'
  1953. arr.forEach((item=> str += `${item.DataTime}\t${item.Value}\n`))
  1954. this.$copyText(str).then(
  1955. res => {
  1956. // this.$message.success("已成功复制!");
  1957. this.$message.success(this.$t('MsgPrompt.copy_success_msg'));
  1958. },
  1959. err => {
  1960. this.$message.error(/* "复制失败!" */this.$t('MsgPrompt.copy_fail_msg'));
  1961. } )
  1962. }
  1963. },
  1964. /* 一键更新 */
  1965. updateHandler() {
  1966. this.isUpdate = true;
  1967. },
  1968. /* 替换指标 */
  1969. async replaceEdbHandler () {
  1970. const { Data } = await dataBaseInterface.replaceCheck();
  1971. Data === 2
  1972. ? this.isReplaceDia = true
  1973. : await this.$confirm(this.$t('EtaBasePage.replace_ing_msg'), this.$t('Dialog.warn_tit'), {
  1974. type: 'warning',
  1975. showCancelButton: false,
  1976. })
  1977. },
  1978. /* 添加最新值 */
  1979. updateNewestDataHandle() {
  1980. this.isUpdateNewestData = true;
  1981. },
  1982. updateNewest(){
  1983. this.initGetData()
  1984. this.rePainChart()
  1985. },
  1986. /* 获取标签列表 */
  1987. getlabelList(){
  1988. const List = JSON.parse(sessionStorage.getItem('database'))||[]
  1989. this.labelList = List
  1990. },
  1991. /* 添加标签 params :{code,id,classifyId,EdbName,EdbNameEn}*/
  1992. addLabel(params){
  1993. const index = this.labelList.findIndex(i=>i.code===params.code)
  1994. //标签已存在列表中,更新标签的值
  1995. if(index!==-1){
  1996. this.labelList.splice(index,1,params)
  1997. return
  1998. }
  1999. //根据页面宽度 判断标签数量是否达到上限
  2000. const listWidth = document.querySelector('.database-label')&&document.querySelector('.database-label').offsetWidth
  2001. const minWidth=170+20
  2002. const maxNum = Math.floor(listWidth/minWidth)
  2003. if(this.labelList.length>=maxNum){
  2004. //达到上限则挤出第一个,再添加
  2005. this.labelList.shift()
  2006. }
  2007. this.labelList.push(params)
  2008. sessionStorage.setItem('database',JSON.stringify(this.labelList))
  2009. },
  2010. //改变选中标签,
  2011. changeCurrentLabel(params){
  2012. if(params.code!==this.select_node){
  2013. this.selectCurrentNode(params)
  2014. }
  2015. },
  2016. //删除标签
  2017. deleteLabel(params){
  2018. const index = this.labelList.findIndex(i=>i.code===params.code)
  2019. //如果删除的标签是选中状态
  2020. if(this.select_node===params.code){
  2021. //删除的是唯一一个标签
  2022. if(this.labelList.length===1){
  2023. this.selected_edbid=0
  2024. this.select_node = ''
  2025. this.$refs.menuTree.setCurrentKey(null)
  2026. //不是唯一的标签,则默认选中上一个/下一个
  2027. }else{
  2028. index===0&&this.changeCurrentLabel(this.labelList[1])
  2029. index!==0&&index!==-1&&this.changeCurrentLabel(this.labelList[index-1])
  2030. }
  2031. }
  2032. index!==-1&&this.labelList.splice(index,1)
  2033. sessionStorage.setItem('database',JSON.stringify(this.labelList))
  2034. },
  2035. changeTreeNode(){
  2036. this.$refs.menuTree.setCurrentKey(this.select_node);
  2037. this.$nextTick(()=>{
  2038. const _node = this.$refs.menuTree.getCurrentNode()
  2039. this.dynamicNode = _node;
  2040. this.dynamicNode&&this.resetNodeStyle(this.dynamicNode)
  2041. })
  2042. },
  2043. //只看我的
  2044. onlyMeHandler(){
  2045. this.getTreeData()
  2046. this.CurrentIndex = 1;
  2047. this.$refs.listRef.scrollTop = 0;
  2048. this.getEdbChartList();
  2049. },
  2050. //绑定el-tree的load属性
  2051. async getLazyTreeData (node,resolve){
  2052. if(node.level===0){
  2053. resolve(this.treeData)
  2054. }else{
  2055. let arr=[]
  2056. const res=await dataBaseInterface.targetCatalog({
  2057. ParentId:node.data.ClassifyId,
  2058. IsOnlyMe:this.IsOnlyMe,
  2059. ClassifyType: this.isBasicBase ? 0 : 2
  2060. })
  2061. if (res.Ret === 200) {
  2062. const temarr = res.Data.AllNodes || [];
  2063. arr=temarr.map(item=>{
  2064. return {
  2065. ...item,
  2066. isLeaf:item.EdbInfoId?true:false
  2067. }
  2068. })
  2069. }
  2070. resolve(arr)
  2071. }
  2072. },
  2073. //保存指标上下限
  2074. saveEdbLimit(){
  2075. if(!this.$refs.createChart) return
  2076. //获取指标的上下限
  2077. const {MaxValue=0,MinValue=0} = this.$refs.createChart.chartInfo
  2078. dataBaseInterface.saveEdbChartLimit({
  2079. EdbInfoId:this.EdbData.EdbInfoId,
  2080. MaxValue:Number(MaxValue),
  2081. MinValue:Number(MinValue)
  2082. }).then(res=>{
  2083. if(res.Ret!==200) return
  2084. // this.$message.success('保存成功')
  2085. this.$message.success(this.$t('MsgPrompt.saved_msg'))
  2086. this.$refs.createChart.saveEdbImg(this.EdbData)
  2087. this.$refs.createChart.oldOptions = {}
  2088. })
  2089. },
  2090. //重绘指标图表
  2091. rePainChart(){
  2092. if(this.activeTab!=='Chart') return
  2093. this.$nextTick(()=>{
  2094. this.$refs.createChart.getDataByPath()
  2095. })
  2096. },
  2097. /* 展开对应菜单 显示详情 */
  2098. detailShowHandle({ UniqueCode, EdbInfoId,ClassifyId}) {
  2099. let params = {
  2100. code: UniqueCode,
  2101. id: EdbInfoId,
  2102. classifyId:ClassifyId
  2103. };
  2104. this.selectCurrentNode(params);
  2105. this.select_classifyId = 0;
  2106. },
  2107. // 添加wind wsd指标成功
  2108. addTargetSuccess(params){
  2109. this.getTreeData(params);
  2110. },
  2111. handleCloseBatchPopSelf(){
  2112. this.showBatchComputedPop=false
  2113. this.$nextTick(()=>{//重新打开计算指标选择类型弹窗
  2114. this.isOpenComputed=true
  2115. })
  2116. },
  2117. /* 切换分类类型 */
  2118. handleChangeClassifyType() {
  2119. this.defaultShowNodes = [];
  2120. this.chartList = [];
  2121. this.Total = 0;
  2122. this.selected_edbid = 0;
  2123. this.select_classifyId = 0;
  2124. this.search_txt = '';
  2125. this.searchCollectWord = '';
  2126. this.getTreeData()
  2127. this.getEdbChartList()
  2128. },
  2129. /* 收藏指标 */
  2130. handleCollectEdb() {
  2131. this.isOpenEdbCollectDia = true
  2132. },
  2133. async handleRemoveCollect(item=null) {
  2134. const res = await edbCollectInterface.edbCollectCancel({
  2135. ClassifyId: this.select_classifyId,
  2136. EdbInfoId: item?item.EdbInfoId:this.selected_edbid
  2137. })
  2138. if(res.Ret !== 200) return
  2139. this.$message.success('收藏成功')
  2140. this.getTreeData()
  2141. this.getEdbChartList()
  2142. },
  2143. handleOpenCollectClassify(data=null) {
  2144. this.collectClassifyForm = {
  2145. name: data?data.ClassifyName:'',
  2146. classifyId:data?data.ClassifyId:0
  2147. }
  2148. this.isOpenCollectClassifyDia = true
  2149. }
  2150. },
  2151. //离开页面时保存标签
  2152. beforeRouteLeave(to,from,next){
  2153. sessionStorage.setItem('database',JSON.stringify(this.labelList))
  2154. next()
  2155. },
  2156. mounted() {
  2157. // this.getlabelList()
  2158. this.getEdbChartList()
  2159. this.$route.query.code
  2160. ? this.getTreeData({code: this.$route.query.code,id: this.$route.query.id,classifyId:this.$route.query.classifyId})
  2161. : this.getTreeData();
  2162. //离开页面时保存标签
  2163. window.onbeforeunload = ()=>{
  2164. sessionStorage.setItem('database',JSON.stringify(this.labelList))
  2165. }
  2166. },
  2167. destroyed(){
  2168. window.onbeforeunload = null
  2169. }
  2170. };
  2171. </script>
  2172. <style lang="scss">
  2173. @import "~@/styles/theme-vars.scss";
  2174. .database_container {
  2175. $mini_font: 12px;
  2176. $normal_font: 14px;
  2177. .firstColumTable .el-table__empty-block {
  2178. display: none;
  2179. }
  2180. .firstColumTable .el-table__header th:first-child .cell{
  2181. overflow: visible;
  2182. }
  2183. .el-table td,.el-table th {
  2184. padding: 10px 0;
  2185. }
  2186. .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner {
  2187. background-color: $theme-color !important;
  2188. border-color: $theme-color;
  2189. }
  2190. .el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner {
  2191. background-color: $theme-color !important;
  2192. border-color: $theme-color;
  2193. }
  2194. .el-icon-refresh {
  2195. font-size: 17px;
  2196. margin-left: 5px;
  2197. cursor: pointer;
  2198. }
  2199. @media screen and (min-width: 1711px) {
  2200. .target_tree {
  2201. font-size: $normal_font;
  2202. }
  2203. }
  2204. @media screen and (max-width: 1710px) {
  2205. .target_tree {
  2206. font-size: $mini_font;
  2207. }
  2208. }
  2209. .database_top {
  2210. display: flex;
  2211. justify-content: space-between;
  2212. align-items: center;
  2213. margin-bottom: 20px;
  2214. padding: 20px 30px;
  2215. background: #fff;
  2216. border: 1px solid #ececec;
  2217. border-radius: 4px;
  2218. box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  2219. .top-right,.top-left{
  2220. display: flex;
  2221. align-items: center;
  2222. gap:20px;
  2223. flex-wrap: wrap;
  2224. .el-button + .el-button{
  2225. margin-left: 0;
  2226. }
  2227. }
  2228. /* .top-left{
  2229. display: flex;
  2230. } */
  2231. }
  2232. .database_main {
  2233. display: flex;
  2234. margin-top: 20px;
  2235. position:relative;
  2236. width:100%;
  2237. overflow-x: auto;
  2238. /* div::-webkit-scrollbar {
  2239. width: 5px !important;
  2240. } */
  2241. .main-left {
  2242. width: 400px;
  2243. min-width: 300px;
  2244. background: #fff;
  2245. margin-right: 20px;
  2246. border: 1px solid #ececec;
  2247. border-radius: 4px;
  2248. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  2249. height: calc(100vh - 225px);
  2250. overflow: hidden;
  2251. position: relative;
  2252. box-sizing: border-box;
  2253. .tree-cont {
  2254. padding: 30px;
  2255. /* height: calc(100vh - 290px);
  2256. overflow: auto; */
  2257. }
  2258. .target_tree {
  2259. color: #333;
  2260. height: calc(100vh - 420px);
  2261. overflow: auto;
  2262. .label-input .el-input__inner {
  2263. height: 25px;
  2264. line-height: 25px;
  2265. }
  2266. .custom-tree-node {
  2267. display: flex !important;
  2268. justify-content: space-between;
  2269. align-items: center;
  2270. display: block;
  2271. flex: 1;
  2272. .node_label {
  2273. margin-right: 2px;
  2274. }
  2275. .el-icon-view {
  2276. color: #409eff;
  2277. font-size: 18px;
  2278. margin-left: 5px;
  2279. }
  2280. }
  2281. .el-tree__drop-indicator{
  2282. /* position:absolute; */
  2283. /* left:0;
  2284. right:0; */
  2285. height:3px;
  2286. // margin-top: 8px;
  2287. background-color:$theme-color;
  2288. }
  2289. .el-tree-node__content {
  2290. margin-bottom: 14px !important;
  2291. }
  2292. .el-tree-node__children {
  2293. .el-tree-node {
  2294. /* margin-bottom: 8px !important; */
  2295. margin-bottom: 0px !important;
  2296. padding-left: 18px;
  2297. }
  2298. .el-tree-node__content {
  2299. margin-bottom: 5px !important;
  2300. padding-left: 0 !important;
  2301. }
  2302. }
  2303. .expanded.el-icon-caret-right:before {
  2304. content: url('../../assets/img/set_m/down.png') !important;
  2305. }
  2306. .el-icon-caret-right:before {
  2307. content: url('../../assets/img/set_m/slide.png') !important;
  2308. }
  2309. .el-tree-node__expand-icon.is-leaf.el-icon-caret-right:before {
  2310. content: '' !important;
  2311. }
  2312. .el-tree-node__expand-icon.expanded {
  2313. -webkit-transform: rotate(0deg);
  2314. transform: rotate(0deg);
  2315. }
  2316. .el-tree-node.is-current > .el-tree-node__content {
  2317. background-color: #f0f4ff !important;
  2318. }
  2319. .el-tree-node__content {
  2320. padding-right: 10px !important;
  2321. }
  2322. }
  2323. .noDepart {
  2324. margin: 30px 0;
  2325. display: flex;
  2326. align-items: center;
  2327. justify-content: center;
  2328. color: $theme-color;
  2329. font-size: 16px;
  2330. cursor: pointer;
  2331. }
  2332. .move-btn {
  2333. height: 100%;
  2334. width: 4px;
  2335. /* opacity: 0; */
  2336. position: absolute;
  2337. right: 0px;
  2338. top: 0;
  2339. &:hover {
  2340. cursor: col-resize;
  2341. /* background-color: orange */
  2342. }
  2343. }
  2344. }
  2345. .main-right {
  2346. flex: 1;
  2347. /* width:70%; */
  2348. height: calc(100vh - 225px);
  2349. background: #fff;
  2350. border: 1px solid #ececec;
  2351. border-radius: 4px;
  2352. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  2353. overflow: hidden;
  2354. .value-ul {
  2355. margin-top: 10px;
  2356. border-bottom: 1px solid #EBEFF6;
  2357. //max-height: calc(100vh - 495px);
  2358. //overflow-y: auto;
  2359. .value-item {
  2360. /* width: 100%; */
  2361. padding: 10px 0;
  2362. border: 1px solid #dcdfe6;
  2363. border-bottom: none;
  2364. display: flex;
  2365. justify-content: space-around;
  2366. >span{
  2367. padding:0 16px;
  2368. box-sizing: border-box;
  2369. }
  2370. .value-label {
  2371. position: relative;
  2372. color: #666;
  2373. .value-style{
  2374. /* background-color: #ECF2FE;
  2375. color: #0052D9; */
  2376. padding:5px;
  2377. border-radius: 4px;
  2378. &.predict-act {
  2379. color: orange;
  2380. }
  2381. }
  2382. &.date{
  2383. &::after{
  2384. content: '';
  2385. position:absolute;
  2386. right:0;
  2387. top:-14px;
  2388. height:calc(100% + 28px);
  2389. width:1px;
  2390. background-color: #dcdfe6;
  2391. }
  2392. }
  2393. }
  2394. .predict-act {
  2395. color: orange;
  2396. }
  2397. .new-tag {
  2398. width: 6px;
  2399. height: 6px;
  2400. display: inline-block;
  2401. position: absolute;
  2402. left: -12px;
  2403. top: 50%;
  2404. transform: translateY(-50%);
  2405. border-radius: 50%;
  2406. background: #f00;
  2407. }
  2408. }
  2409. .nodata {
  2410. text-align: center;
  2411. padding: 40px 0;
  2412. color: #999;
  2413. }
  2414. }
  2415. &.list{
  2416. background-color: transparent;
  2417. box-shadow: none;
  2418. border:none;
  2419. padding-left:30px;
  2420. display: flex;
  2421. flex-direction: column;
  2422. .list-wrap{
  2423. flex: 1;
  2424. margin-top: 20px;
  2425. overflow-y: auto;
  2426. .dragShdow {
  2427. box-shadow: 0 1px 8px rgba(64, 158, 255, 0.8);
  2428. opacity: 0.5;
  2429. }
  2430. .list-item{
  2431. width:23%;
  2432. min-width: 210px;
  2433. background-color: #fff;
  2434. display: flex;
  2435. flex-direction: column;
  2436. box-sizing: border-box;
  2437. border-radius: 4px;
  2438. border:1px solid #DCDFE6;
  2439. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  2440. position: relative;
  2441. .header{
  2442. padding:10px;
  2443. box-sizing: border-box;
  2444. text-align: left;
  2445. }
  2446. .info{
  2447. padding:10px;
  2448. box-sizing: border-box;
  2449. display: flex;
  2450. align-items: center;
  2451. justify-content: space-between;
  2452. .enable-toggle-btn{
  2453. cursor: pointer;
  2454. color: #0052D9;
  2455. font-size: 14px;
  2456. }
  2457. }
  2458. .header{
  2459. white-space: nowrap;
  2460. overflow: hidden;
  2461. text-overflow: ellipsis;
  2462. font-size: 16px;
  2463. font-weight: 600;
  2464. box-shadow: 0 3px 6px rgba(37, 37, 239, 0.1);
  2465. }
  2466. .image{
  2467. margin:10px;
  2468. margin-bottom: 0;
  2469. height: 0;
  2470. padding-bottom: 67%;
  2471. cursor: pointer;
  2472. }
  2473. .stop-mark{
  2474. height: 48px;
  2475. width: 48px;
  2476. position: absolute;
  2477. right: -1px;
  2478. top: 0;
  2479. pointer-events: none;
  2480. }
  2481. }
  2482. }
  2483. }
  2484. &.detail-wrap{
  2485. overflow-x:auto;
  2486. }
  2487. .detail{
  2488. display: flex;
  2489. flex-direction: column;
  2490. min-width: 780px;
  2491. height:100%;
  2492. >.header{
  2493. display: flex;
  2494. position: relative;
  2495. height: 60px;
  2496. .el-tabs{
  2497. width:210px;
  2498. .el-tabs__header{
  2499. margin-bottom: 0;
  2500. }
  2501. .el-tabs__nav{
  2502. display: flex;
  2503. width: 100%;
  2504. .el-tabs__item{
  2505. flex: 1;
  2506. text-align: center;
  2507. font-size: 16px;
  2508. height: 60px;
  2509. line-height: 60px;
  2510. }
  2511. }
  2512. }
  2513. .edb-tool{
  2514. flex: 1;
  2515. text-align: right;
  2516. display: flex;
  2517. gap: 16px;
  2518. justify-content: flex-end;
  2519. padding-right: 15px;
  2520. position: relative;
  2521. &::after{
  2522. position: absolute;
  2523. content:'';
  2524. width:100%;
  2525. left: 0;
  2526. bottom: 0;
  2527. height:2px;
  2528. background-color: #E4E7ED;
  2529. }
  2530. }
  2531. }
  2532. .container{
  2533. flex: 1;
  2534. overflow-y: auto;
  2535. padding:15px;
  2536. .chart{
  2537. .info{
  2538. display: flex;
  2539. justify-content: space-between;
  2540. }
  2541. .table{
  2542. margin-top: 16px;
  2543. border:1px solid #E7E7E7 ;
  2544. .table-header{
  2545. display: flex;
  2546. padding:6px;
  2547. span{
  2548. flex: 1;
  2549. border-bottom: 1px solid #E7E7E7;
  2550. }
  2551. }
  2552. }
  2553. }
  2554. .list{
  2555. height: 100%;
  2556. }
  2557. }
  2558. }
  2559. }
  2560. .slide-btn-icon{
  2561. &.slide-left{
  2562. right:0;
  2563. }
  2564. &.slide-right{
  2565. left: 0;
  2566. }
  2567. }
  2568. }
  2569. .dialog-computed {
  2570. .el-dialog__header {
  2571. background-color: #fff;
  2572. .el-dialog__close {
  2573. color: #333;
  2574. }
  2575. }
  2576. .computed-ul {
  2577. box-sizing: border-box;
  2578. max-height: 600px;
  2579. height:65vh;
  2580. overflow-y: auto;
  2581. padding: 40px 92px;
  2582. display: flex;
  2583. flex-wrap: wrap;
  2584. .cpmputed-li {
  2585. width: 180px;
  2586. padding: 19px 0;
  2587. height: 60px;
  2588. box-sizing: border-box;
  2589. color: $theme-color;
  2590. font-size: 16px;
  2591. background:#ECF5FF;
  2592. border-radius: 8px;
  2593. border: 1px solid #99baf0;
  2594. text-align: center;
  2595. cursor: pointer;
  2596. margin-right: 65px;
  2597. margin-bottom: 55px;
  2598. &:nth-child(3n) {
  2599. margin-right:0;
  2600. }
  2601. &:hover {
  2602. background: $theme-color;
  2603. color: #fff;
  2604. }
  2605. &.act {
  2606. background: $theme-color;
  2607. color: #fff;
  2608. }
  2609. }
  2610. }
  2611. }
  2612. }
  2613. .edb-tool-popover{
  2614. .edb-tool-wrap{
  2615. display: flex;
  2616. flex-wrap: wrap;
  2617. gap:10px;
  2618. .el-button + .el-button{
  2619. margin-left: 0;
  2620. }
  2621. }
  2622. }
  2623. </style>