databaseList.vue 68 KB

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