databaseList.vue 81 KB

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