predictEdb.vue 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792
  1. <template>
  2. <div class="predictEdb-container" >
  3. <span
  4. class="slide-icon slide-right"
  5. @click="isSlideLeft = !isSlideLeft"
  6. v-show="isSlideLeft"
  7. >
  8. <i class="el-icon-d-arrow-right"></i>
  9. </span>
  10. <div class="predict-edb-main" id="box">
  11. <div class="main-left left" id="left" v-show="!isSlideLeft">
  12. <div class="datasheet_top">
  13. <el-button v-permission="permissionBtn.predictEdbPermission.edbPreData_addEdb"
  14. type="primary" @click="addEdbHandle">添加指标</el-button>
  15. <el-button v-permission="permissionBtn.predictEdbPermission.edbPreData_calcuEdb"
  16. type="primary" @click="addComputedHandler" style="margin-right:10px;">计算指标</el-button>
  17. <change-lang v-permission="permissionBtn.predictEdbPermission.edbPreData_switchEn"
  18. :lang="currentLang" style="height: 32px;" @changeLang="changeLangHandle"/>
  19. </div>
  20. <div class="search-cont" v-loading="searchLoading">
  21. <el-select
  22. v-model="search_txt"
  23. ref="searchRef"
  24. :filterable="!search_txt"
  25. remote
  26. clearable
  27. placeholder="指标名称"
  28. style="width: 100%"
  29. :remote-method="searchHandle"
  30. @focus="searchHandle('')"
  31. >
  32. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  33. <el-option
  34. v-for="item in searchOptions"
  35. :key="item.EdbInfoId"
  36. :label="currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName"
  37. :value="item.EdbInfoId"
  38. >
  39. <span>{{ currentLang==='en' ? (item.EdbNameEn||item.EdbName) : item.EdbName }}</span>
  40. </el-option>
  41. </el-select>
  42. </div>
  43. <div style="margin:20px 0;padding:0 20px;display:flex;justify-content:space-between">
  44. <span>目录</span>
  45. <el-checkbox v-model="isOnlyMe" v-permission="permissionBtn.predictEdbPermission.edbPreData_isOnlyMine"
  46. @change="onlyMeHandler">只看我的</el-checkbox>
  47. </div>
  48. <div class="tree-cont">
  49. <el-tree
  50. ref="treeRef"
  51. class="target_tree"
  52. :data="treeData"
  53. node-key="UniqueCode"
  54. :props="defaultProp"
  55. :allow-drag="canDragHandle"
  56. :allow-drop="canDropHandle"
  57. :current-node-key="select_node"
  58. :default-expanded-keys="defaultShowNodes"
  59. draggable
  60. :expand-on-click-node="false"
  61. check-strictly
  62. empty-text="暂无分类"
  63. lazy
  64. :load="getLazyTreeData"
  65. @node-expand="handleNodeExpand"
  66. @node-collapse="handleNodeCollapse"
  67. @current-change="nodeChange"
  68. @node-drop="dropOverHandle"
  69. @node-drag-end="dropMouseLeave"
  70. @node-drag-leave="dropMouseLeave"
  71. @node-drag-enter="dropMouseOver"
  72. >
  73. <span class="custom-tree-node" slot-scope="{ node, data }">
  74. <el-input
  75. ref="editVal"
  76. style="width: 90px"
  77. placeholder="请输入值"
  78. class="label-input"
  79. v-model="new_label"
  80. v-if="data.isEdit"
  81. @blur="changeValue(data)"
  82. />
  83. <span
  84. @dblclick.stop="editNodeLabel(data)"
  85. v-else
  86. class="text_oneLine node_label"
  87. :style="`width:${
  88. (select_node === data.UniqueCode && node.Nodewidth) || ''
  89. }`"
  90. >
  91. <span>{{ currentLang==='en' ? (data.ClassifyNameEn||data.ClassifyName) : data.ClassifyName }}</span>
  92. </span>
  93. <span
  94. style="display: flex; align-items: center"
  95. v-if="select_node === data.UniqueCode"
  96. >
  97. <img
  98. src="~@/assets/img/data_m/move_ico.png"
  99. alt=""
  100. style="width: 14px; height: 14px; margin-right: 8px"
  101. v-if="data.Button.MoveButton"
  102. />
  103. <!-- 添加子项 -->
  104. <img
  105. src="~@/assets/img/set_m/add.png"
  106. alt=""
  107. style="width: 14px; height: 14px; margin-right: 8px"
  108. @click.stop="addNode(node, data)"
  109. v-if="data.Button.AddButton&&!data.EdbInfoId&&isEdbBtnShow('edbPreData_classifyOpt_add')"
  110. />
  111. <!-- 编辑目录 -->
  112. <img
  113. src="~@/assets/img/set_m/edit.png"
  114. alt=""
  115. style="width: 15px; height: 14px; margin-right: 8px"
  116. @click.stop="editNode(node, data)"
  117. v-if="data.Button.OpButton&&!data.EdbInfoId&&isEdbBtnShow('edbPreData_classifyOpt_add')"
  118. />
  119. <!-- 删除目录 -->
  120. <img
  121. slot="reference"
  122. src="~@/assets/img/set_m/del.png"
  123. alt=""
  124. style="width: 14px; height: 14px"
  125. @click.stop="removeNode(node, data)"
  126. v-if="data.Button.DeleteButton&&!data.EdbInfoId&&isEdbBtnShow('edbPreData_classifyOpt_delete')"
  127. />
  128. <!-- 查看预测规则 -->
  129. <i class="el-icon-view" v-if="data.EdbInfoId&&isEdbBtnShow('edbPreData_checkPreRule')" @click.stop="viewNode(node,data)"></i>
  130. <!-- 查看关联图表 -->
  131. <img
  132. v-if="data.Button.ShowChartRelation&&isEdbBtnShow('edbPreData_checkRelatedChart')"
  133. @click.stop="showAssociateChart=true,showAssociateComputeData=false"
  134. src="~@/assets/img/icons/associate_chart.png"
  135. style="width: 14px; height: 14px;margin-left: 8px"
  136. alt=""
  137. />
  138. <!-- 查看关联指标 -->
  139. <img
  140. v-if="data.Button.ShowEdbRelation&&isEdbBtnShow('edbPreData_checkRelatedEdb')"
  141. @click.stop="showAssociateComputeData=true,showAssociateChart=false"
  142. src="~@/assets/img/icons/associate_data.png"
  143. style="width: 14px; height: 14px;margin-left: 8px"
  144. alt=""
  145. />
  146. </span>
  147. </span>
  148. </el-tree>
  149. <div
  150. class="noDepart"
  151. @click="addLevelOneHandle"
  152. v-if="opLevelOneClassify&&isEdbBtnShow('edbPreData_classifyOpt_add')"
  153. >
  154. <img
  155. src="~@/assets/img/set_m/add_ico.png"
  156. alt=""
  157. style="width: 16px; height: 16px; margin-right: 10px"
  158. />
  159. <span>添加一级目录</span>
  160. </div>
  161. </div>
  162. <span
  163. class="move-btn resize"
  164. v-drag
  165. id="resize"
  166. @mousemove="dynamicNode && resetNodeStyle(dynamicNode)"
  167. ></span>
  168. <span class="slide-icon slide-left" @click="isSlideLeft = !isSlideLeft">
  169. <i class="el-icon-d-arrow-left"></i>
  170. </span>
  171. </div>
  172. <div class="main-right" id="right" :style="isSlideLeft ? 'width:100%' : 'width:80%'">
  173. <!-- 详情 -->
  174. <div class="edb-detail-wrapper" v-if="select_id&&!showAssociateChart&&!showAssociateComputeData">
  175. <div class="detail-header">
  176. <el-tabs v-model="activeTab" @tab-click="changeShowType">
  177. <el-tab-pane label="走势图" name="Chart">
  178. </el-tab-pane>
  179. <el-tab-pane label="数据详情" name="Data">
  180. </el-tab-pane>
  181. </el-tabs>
  182. <div class="edb-tool">
  183. <el-button v-permission="permissionBtn.predictEdbPermission.edbPreData_enNameSetting"
  184. type="text" @click="clickEdbNameHandle" v-if="currentLang==='ch'||!edb_nameEn">
  185. 设置英文名称
  186. </el-button>
  187. <el-button v-permission="permissionBtn.predictEdbPermission.edbPreData_edbSource"
  188. type="text" @click="isLookHistory=true;lookEdbId=select_id">指标溯源</el-button>
  189. <el-button v-permission="permissionBtn.predictEdbPermission.edbPreData_update"
  190. type="text" @click="updateEdbPartHandle">刷新</el-button>
  191. <el-button type="text" @click="editEdbHandle('')"
  192. v-if="edbButton.OpButton&&isEdbBtnShow('edbPreData_edit')">编辑</el-button>
  193. <el-button type="text" @click="saveEdbHandle"
  194. v-if="detail_show_chart&&isEdbBtnShow('edbPreData_save')">保存</el-button>
  195. <el-button v-permission="permissionBtn.predictEdbPermission.edbPreData_recalcu"
  196. type="text" @click="updateEdbHandle">重新计算</el-button>
  197. <el-button class="deletesty" @click="delEdbHandle" type="text"
  198. v-if="edbButton.DeleteButton&&isEdbBtnShow('edbPreData_del')">删除</el-button>
  199. <el-button v-permission="permissionBtn.predictEdbPermission.edbPreData_copyData"
  200. type="text" @click="copyData">复制数据</el-button>
  201. <!-- <el-button v-permission="permissionBtn.predictEdbPermission.edbPreData_viewData"
  202. type="text" @click="detail_show_chart=!detail_show_chart">{{detail_show_chart ? '查看数据' : '查看图表'}} </el-button> -->
  203. </div>
  204. </div>
  205. <!-- -->
  206. <div class="detail-wrap">
  207. <component
  208. :is="detail_show_chart?'edbDetail':'childData'"
  209. :id="select_id"
  210. :lang="currentLang"
  211. :isAllowEditLimit="isEdbBtnShow('edbPreData_editLimit')"
  212. ref="detailComponentRef"
  213. @updateTit="setNameBack"
  214. @setCurrentClassify="setCurrentClassify"
  215. @setOpera="(obj) => { edbButton = obj }"
  216. @openEnNameDia="openEnNameDia"
  217. />
  218. </div>
  219. </div>
  220. <!-- 列表 -->
  221. <div class="sheet-list-cont" v-else-if="!select_id">
  222. <div class="list-top">
  223. <span>共{{ edb_total }}个预测指标</span>
  224. </div>
  225. <div
  226. class="edbChartList-wrapper"
  227. ref="listRef"
  228. @scroll="loadMoreHandle"
  229. >
  230. <el-col
  231. :span="6"
  232. style="margin-bottom: 20px; padding-right: 20px"
  233. v-for="item in edbChartList"
  234. :key="item.EdbInfoId"
  235. >
  236. <el-card class="sheet-item">
  237. <div slot="header" class="item-top">
  238. <span class="text_oneLine">{{ currentLang === 'en' ? (item.EdbNameEn||item.EdbName) : item.EdbName }}</span>
  239. </div>
  240. <img
  241. :src="item.ChartImage"
  242. alt=""
  243. class="chart-img"
  244. @click="detailShowHandle(item)"
  245. />
  246. <div class="item-bottom">
  247. <span>创建时间: {{ item.CreateTime.slice(0,10) }}</span>
  248. </div>
  249. </el-card>
  250. </el-col>
  251. </div>
  252. <div v-if="!edb_total" class="nodata">
  253. <tableNoData text="暂无指标"/>
  254. </div>
  255. </div>
  256. <!-- 指标关联图模块 -->
  257. <div class="edb-detail-wrapper" style="padding: 30px 20px;" v-if="showAssociateChart&&select_id">
  258. <dataAssociateChart :edbInfoId="select_id"></dataAssociateChart>
  259. </div>
  260. <div class="edb-detail-wrapper" style="padding: 30px 20px;" v-if="showAssociateComputeData&&select_id">
  261. <dataAssociateComputeData :edbInfoId="select_id"></dataAssociateComputeData>
  262. </div>
  263. </div>
  264. </div>
  265. <!-- 计算弹窗控制 -->
  266. <el-dialog
  267. :visible.sync="isOpenComputed"
  268. :close-on-click-modal="false"
  269. :modal-append-to-body='false'
  270. @close="isOpenComputed=false;"
  271. custom-class="dialog-computed"
  272. top="12vh"
  273. center
  274. width="950px"
  275. v-dialogDrag>
  276. <div class="dialog-computed-header">
  277. <el-radio-group v-model="computed_source" size="medium" @change="computed_type = 0">
  278. <el-radio-button :label="1">常规计算</el-radio-button>
  279. <el-radio-button :label="2">批量计算</el-radio-button>
  280. </el-radio-group>
  281. </div>
  282. <ul class="computed-ul">
  283. <li
  284. :class="['cpmputed-li',{'act':item.type === computed_type}]"
  285. v-for="item in computedTypes"
  286. :key="item.type"
  287. @click="changeComputedType(item.type)"
  288. >
  289. {{item.name}}
  290. <el-popover
  291. placement="top-start"
  292. width="450"
  293. trigger="hover"
  294. v-if="tips.get(item.type)"
  295. >
  296. <p style="padding:20px;line-height:25px;" v-html="tips.get(item.type)"/>
  297. <i slot="reference" class="el-icon-warning-outline"/>
  298. </el-popover>
  299. </li>
  300. </ul>
  301. </el-dialog>
  302. <!-- 指标弹窗 -->
  303. <edb-dialog
  304. :isShow.sync="isEdbDia"
  305. :title="edbdia_title"
  306. :edbForm="edbForm"
  307. @successHandle="handleEdbCallBack"
  308. />
  309. <!-- 分类弹窗 -->
  310. <edbClassifyDia
  311. :isOpenDialog.sync="classifyDia"
  312. :title="dialog_title"
  313. :form="classifyForm"
  314. @successCallback="getTreeData"
  315. />
  316. <!-- 输入英文指标弹窗 -->
  317. <set-en-name-dia
  318. :isOpenDialog="setEnName"
  319. @cancel="setEnName=false"
  320. :formData="formItemArray"
  321. @updateEnName="updateEnName"
  322. cType="predictEbd"
  323. />
  324. <!-- 运算指标弹窗 -->
  325. <computedDialog
  326. :isOpenComputed="computed_type === 31"
  327. :title="computedTit"
  328. :calulateForm="calulateForm"
  329. :calulateList="calulateList"
  330. @cancel="computed_type=0"
  331. @addCallBack="addComputedCallBack"
  332. @openPrev="isOpenComputed=true"
  333. @lookHistory="id => {isLookHistory=true;lookEdbId=id;}"
  334. />
  335. <!-- 同比同差计算弹窗 -->
  336. <!-- 转月值 同比 同差 平均值弹窗 -->
  337. <operationDialog
  338. :isOperation="[42,32,33,39,43,44,45,46,49,54,55,64,65,66,69,70].includes(computed_type) && computed_source===1"
  339. :type="computed_type"
  340. :operationForm="operationForm"
  341. @cancel="computed_type=0"
  342. @addCallBack="addComputedCallBack"
  343. @openPrev="isOpenComputed=true"
  344. @lookHistory="id => {isLookHistory=true;lookEdbId=id;}"
  345. @changeSource="changeComputedType"
  346. />
  347. <!-- 规则详情弹窗 -->
  348. <rules-detail
  349. :isOpenDialog.sync="isShowRuleDialog"
  350. :rules="showRules"
  351. :fromEdbInfo="showFromEdbInfo"
  352. />
  353. <!-- 批量计算弹窗 -->
  354. <batchComputedDialog
  355. :isBatchComputed="[32,33,39,43,44,45,42,64,65,66].includes(computed_type) && computed_source===2"
  356. :type="computed_type"
  357. edbSource="predict"
  358. @cancel="computed_type=0"
  359. @addCallBack="addComputedCallBack"
  360. @openPrev="isOpenComputed=true"
  361. @lookHistory="id => {isLookHistory=true;lookEdbId=id;}"
  362. @changeSource="changeComputedType"
  363. />
  364. <!-- 拼接弹窗 -->
  365. <joint-target-dia
  366. :isShow="computed_type === 'joint'"
  367. :params="operationForm"
  368. :isPredict="true"
  369. @cancel="computed_type=0"
  370. @addCallBack="addComputedCallBack"
  371. @openPrev="isOpenComputed=true"
  372. />
  373. <!-- 拟合残差弹窗 -->
  374. <fittingResidueDia
  375. :isShow="computed_type === 50"
  376. :type="50"
  377. :operationForm="operationForm"
  378. :isPredict="true"
  379. @cancel="computed_type=0"
  380. @addCallBack="addComputedCallBack"
  381. @openPrev="isOpenComputed=true"
  382. />
  383. <!-- 扩散指数弹窗 -->
  384. <diffusionIndexDialog
  385. :isShow="computed_type === 56 && computed_source===1"
  386. :type="computed_type"
  387. :isPredict="true"
  388. :operationForm="operationForm"
  389. @cancel="computed_type=0"
  390. @addCallBack="addComputedCallBack"
  391. @openPrev="isOpenComputed=true"
  392. />
  393. <!-- 指标历史记录 -->
  394. <edbHistoryDialog
  395. :isOpenDialog.sync="isLookHistory"
  396. :edbId="lookEdbId"
  397. />
  398. <!-- 指数修匀弹窗 -->
  399. <SmoothEdbDialog
  400. :is-open-smooth="computed_type==='alpha'"
  401. :computed-source="computed_source"
  402. :operationForm="operationForm"
  403. :isPredict="true"
  404. @cancel="computed_type=0"
  405. @openPrev="isOpenComputed=true"
  406. @addCallBack="addComputedCallBack"
  407. @lookHistory="id => {isLookHistory=true;lookEdbId=id;}"
  408. />
  409. </div>
  410. </template>
  411. <script>
  412. import * as preDictEdbInterface from '@/api/modules/predictEdbApi.js';
  413. import { dataBaseInterface } from '@/api/api.js';
  414. import leftMixin from './mixins/mixin';
  415. import edbDialog from './components/edbDia.vue'
  416. import childChart from './components/childChart.vue'
  417. import childData from './components/childData.vue'
  418. import edbDetail from './components/edbDetail.vue'
  419. import edbClassifyDia from './components/classifyDia.vue'
  420. import changeLang from "@/views/dataEntry_manage/components/changeLang.vue"
  421. import setEnNameDia from "@/views/dataEntry_manage/components/setEnNameDia.vue"
  422. import computedDialog from './components/computedDialog';
  423. import operationDialog from './components/operationDialog';
  424. import rulesDetail from './components/rulesDetailDia.vue'
  425. import batchComputedDialog from '@/views/dataEntry_manage/databaseComponents/batchComptedDialog.vue';
  426. import jointTargetDia from '@/views/dataEntry_manage/databaseComponents/jointTargetDia'
  427. import fittingResidueDia from '@/views/dataEntry_manage/databaseComponents/fittingResidueDia.vue';
  428. import diffusionIndexDialog from '@/views/dataEntry_manage/databaseComponents/diffusionIndexDia.vue';
  429. import { formulaTip } from '@/views/dataEntry_manage/databaseComponents/util';
  430. import dataAssociateChart from '@/views/dataEntry_manage/databaseComponents/dataAssociateChart.vue'
  431. import dataAssociateComputeData from '@/views/dataEntry_manage/databaseComponents/dataAssociateComputeData.vue'
  432. import SmoothEdbDialog from '@/views/dataEntry_manage/databaseComponents/smoothEdbDialog.vue';
  433. export default {
  434. name:'',
  435. components: {
  436. edbDialog,
  437. childChart,
  438. childData,
  439. edbClassifyDia,
  440. changeLang,
  441. setEnNameDia,
  442. computedDialog,
  443. operationDialog,
  444. edbDetail,
  445. rulesDetail,
  446. jointTargetDia,
  447. fittingResidueDia,
  448. batchComputedDialog,
  449. diffusionIndexDialog,
  450. dataAssociateChart,
  451. dataAssociateComputeData,
  452. SmoothEdbDialog
  453. },
  454. mixins:[ leftMixin ],
  455. beforeRouteLeave (to, from, next) {
  456. // 前去编辑则存一次选择的节点
  457. if(to.path=='/editpredictEdb'){
  458. const obj={
  459. code:this.select_node,
  460. id:this.select_id
  461. }
  462. sessionStorage.setItem('predictEdbTreeData',JSON.stringify(obj))
  463. }else{
  464. sessionStorage.setItem('predictEdbTreeData','')
  465. }
  466. next()
  467. },
  468. data () {
  469. return {
  470. showData: false,
  471. search_txt: '',
  472. searchOptions:[],
  473. isSlideLeft: false,//左侧分类收起
  474. select_node: '',//节点唯一标识code
  475. select_classify: '',
  476. new_label:'',//双击修改的value
  477. treeData: [], //分类数据
  478. defaultShowNodes: [], //展开节点
  479. defaultProp: {
  480. label: 'ClassifyName',
  481. children: 'Children',
  482. isLeaf:'isLeaf'
  483. }, //树结构配置项
  484. dynamicNode: null,
  485. edbName: '',
  486. edb_nameEn: '',
  487. edbUserId: '',
  488. /* 分类弹窗 */
  489. dialog_title:'',
  490. classifyDia: false, //
  491. classifyForm: {},
  492. /* 添加指标弹窗 */
  493. isEdbDia: false,
  494. edbdia_title:'',
  495. edbForm: {},
  496. select_id: '',//选中的id
  497. sheetDetailInfo: {},
  498. detail_show_chart: true,//详情展示方式 chart data
  499. /* 列表 */
  500. publicHaveMove: true,//是否还有列表数据
  501. edbChartList: [],
  502. edb_total: 0,
  503. public_page: 1,
  504. public_pages_size: 16,
  505. currentLang:'ch', // ch(中文) en(英文)
  506. setEnName:false,
  507. // 传入的formItem所需内容
  508. formItemArray:[],
  509. /* 计算指标弹窗 */
  510. isOpenComputed:false,
  511. computedTit:'',
  512. calulateForm:{},
  513. operationForm:{},
  514. calulateList:[],
  515. computed_type:0,//打开弹窗的类型
  516. tips: new Map([
  517. [31,formulaTip.get(4)],
  518. [42,formulaTip.get(5)],
  519. [32,formulaTip.get(6)],
  520. [33,formulaTip.get(7)],
  521. [39,formulaTip.get(8)],
  522. [43,formulaTip.get(12)],
  523. [44,formulaTip.get(13)],
  524. [45,formulaTip.get(14)],
  525. ['joint',formulaTip.get('joint')],
  526. [46,formulaTip.get(22)],
  527. [49,formulaTip.get(35)],
  528. [50,formulaTip.get(37)],
  529. [54,formulaTip.get(51)],
  530. [55,formulaTip.get(52)],
  531. [56,formulaTip.get(53)],
  532. ['toMonthSeason',formulaTip.get('toMonthSeason')],
  533. ['accumulate',formulaTip.get('accumulate')],
  534. [64,formulaTip.get(61)],
  535. [65,formulaTip.get(62)],
  536. [66,formulaTip.get(63)],
  537. ['alpha',formulaTip.get('alpha')]
  538. ]),//公式说明
  539. isShowRuleDialog: false,
  540. showRules: [],
  541. showFromEdbInfo: {},
  542. edbButton: {},//详情操作
  543. opLevelOneClassify: false,//一级分类按钮
  544. computed_source: 1,//计算类型 1常规 2批量
  545. isBatchComputed: false,//批量计算弹窗
  546. baseTypes: [
  547. { name: '指标运算',type: 31 },
  548. { name: '同比值',type: 32 },
  549. { name: '同差值',type: 33 },
  550. { name: 'N数值移动平均计算',type: 39 },
  551. { name: '累计值转月/季值',type: 'toMonthSeason' },
  552. { name: 'N数值环比值',type: 43 },
  553. { name: 'N数值环差值',type: 44 },
  554. { name: '升频',type: 45 },
  555. // { name: '指标拼接',type: 'joint' },
  556. { name: '时间移位',type: 46 },
  557. { name: '超季节性',type: 49 },
  558. { name: '拟合残差',type: 50 },
  559. { name: '年化',type: 55 },
  560. { name: '降频',type: 54 },
  561. { name: '扩散指数',type: 56 },
  562. { name: '累计值',type: 'accumulate' },
  563. { name: '指数修匀',type:'alpha'}
  564. ],
  565. batchTypes: [
  566. { name: '同比值',type: 32 },
  567. { name: '同差值',type: 33 },
  568. { name: 'N数值移动平均计算',type: 39 },
  569. { name: 'N数值环比值',type: 43 },
  570. { name: 'N数值环差值',type: 44 },
  571. { name: '升频',type: 45 },
  572. { name: '累计值转月/季值',type: 'toMonthSeason' },
  573. { name: '累计值',type: 'accumulate' },
  574. { name: '指数修匀',type:'alpha'}
  575. ],
  576. isOnlyMe:false,//只看我的
  577. /* 查看历史弹窗 */
  578. isLookHistory: false,
  579. lookEdbId: 0,
  580. searchLoading:false,
  581. showAssociateChart:false,//显示指标关联的图
  582. showAssociateComputeData:false,//显示指标关联的引用计算指标
  583. activeTab:'',
  584. };
  585. },
  586. computed: {
  587. computedTypes() {
  588. return this.computed_source === 1 ? this.baseTypes : this.batchTypes;
  589. },
  590. role() {
  591. let role = localStorage.getItem('Role') || '';
  592. if(['rai_admin','ficc_admin'].includes(role)) {
  593. return 'admin'
  594. }
  595. else {
  596. return role;
  597. }
  598. },
  599. /* 登录角色id */
  600. roleId() {
  601. let id = parseInt(localStorage.getItem('AdminId'));
  602. return id;
  603. },
  604. },
  605. watch: {
  606. /* 设置动态右侧区域宽度 */
  607. isSlideLeft(newval) {
  608. if (!newval) {
  609. this.$nextTick(() => {
  610. this.reloadRightWid();
  611. });
  612. }
  613. },
  614. // /* 表格id */
  615. select_id(newval) {
  616. this.detail_show_chart = true;
  617. this.activeTab='Chart'
  618. this.$nextTick(()=>{
  619. //切换为曲线图 重置选择状态
  620. if(this.$refs.detailComponentRef){
  621. this.$refs.detailComponentRef.$refs.chartInfo.chartInfo.ChartType=1;
  622. this.$refs.detailComponentRef.$refs.chartInfo.year_select=10;
  623. this.$refs.detailComponentRef.$refs.chartInfo.year_select_season=20;
  624. this.$refs.detailComponentRef.$refs.chartInfo.calendar_type='公历';
  625. this.$refs.detailComponentRef.$refs.chartInfo.count_year=5;
  626. this.$refs.detailComponentRef.$refs.chartInfo.count_year_season=5;
  627. this.$refs.detailComponentRef.$refs.chartInfo.select_date=[];
  628. this.$refs.detailComponentRef.$refs.chartInfo.season_year=[];
  629. this.$refs.detailComponentRef.$refs.chartInfo.dateTip='请选择时间段';
  630. }
  631. })
  632. },
  633. select_classify(newval) {
  634. if(this.$refs.listRef) this.$refs.listRef.scrollTop = 0;
  635. if(newval) {
  636. this.activeTab = ''
  637. this.public_page = 1;
  638. this.getPublicList()
  639. }
  640. },
  641. /* 搜索关键词 */
  642. search_txt(newval) {
  643. if(newval) {
  644. let search_obj = this.searchOptions.find(_ => _.EdbInfoId === newval);
  645. let deep_arr = _.cloneDeep(this.treeData);
  646. // 查找图表的分类父级id
  647. let arr = this.findParentNodeHandle(deep_arr, search_obj.ClassifyId).reverse(); // 父的父的父-父的父-父
  648. this.defaultShowNodes = arr;
  649. this.select_node = search_obj.UniqueCode;
  650. this.$refs.treeRef.setCurrentKey(this.select_node);
  651. // 重置筛选状态
  652. this.select_id = newval;
  653. }
  654. }
  655. },
  656. methods: {
  657. isEdbBtnShow(type){
  658. const {predictEdbPermission,checkPermissionBtn}=this.permissionBtn
  659. return checkPermissionBtn(predictEdbPermission[type])||false
  660. },
  661. setCurrentClassify(classifyId){
  662. //获取指标详情后才能拿到准确的classifyId
  663. //根据准备的id查找指标的父级目录并展开
  664. let deep_arr = _.cloneDeep(this.treeData);
  665. let arr = this.findParentNodeHandle(deep_arr, classifyId).reverse();
  666. this.defaultShowNodes = arr;
  667. this.$refs.treeRef.setCurrentKey(this.select_node);
  668. //滚动到高亮节点位置
  669. this.$nextTick(()=>{
  670. setTimeout(() => {
  671. const dom = document.querySelector(".el-tree-node.is-current");
  672. const parentDom = document.querySelector(".target_tree");
  673. if (!dom || !parentDom) {
  674. this.searchLoading = false;
  675. return;
  676. }
  677. /* if (dom.offsetTop > parentDom.offsetHeight) {
  678. parentDom.scrollTo({
  679. top: dom.offsetTop - parentDom.offsetHeight / 2,
  680. left: 0,
  681. behavior: "smooth",
  682. });
  683. } */
  684. //parent可视区间:[scrollTop,scrollTop+offsetHeight]
  685. //node位置:node.offsetTop
  686. const overTop = dom.offsetTop+dom.clientHeight<parentDom.scrollTop
  687. const overBottom = dom.offsetTop+dom.clientHeight+30>parentDom.scrollTop+parentDom.offsetHeight
  688. if(overTop){
  689. parentDom.scrollTop = dom.offsetTop-30
  690. }
  691. if(overBottom){
  692. parentDom.scrollTop = dom.offsetTop - parentDom.offsetHeight/2
  693. }
  694. this.searchLoading = false;
  695. }, 300);
  696. })
  697. },
  698. setNameBack({edb_name,edb_nameEn,userid}) {
  699. this.edbName=edb_name;
  700. this.edb_nameEn= edb_nameEn;
  701. this.edbUserId=userid;
  702. },
  703. /* 添加指标 */
  704. addEdbHandle() {
  705. if(!this.treeData.length) return this.$message.warning('请先添加预测指标分类');
  706. this.$router.push({
  707. path:'/addpredictEdb'
  708. })
  709. },
  710. /* 获取分类 */
  711. getTreeData(params=null) {
  712. preDictEdbInterface.classifyListV2({IsOnlyMe:this.isOnlyMe||false}).then(res => {
  713. const { Ret,Data } = res;
  714. if(Ret !== 200) return
  715. this.treeData = Data.AllNodes || [];
  716. this.opLevelOneClassify = Data.CanOpClassify;
  717. this.currentLang = Data.Language === 'EN' ? 'en' : 'ch';
  718. this.showData = true;
  719. this.$nextTick(() => {
  720. /* 新增完成后 处理树展开和选中 */
  721. params && this.selectCurrentNode(params);
  722. });
  723. })
  724. },
  725. /* 搜索 */
  726. searchHandle(query) {
  727. if (query) {
  728. /* 查找列表 */
  729. preDictEdbInterface
  730. .edbSearch({
  731. Keyword: query,
  732. CurrentIndex: 1,
  733. PageSize: 10000,
  734. IsOnlyMe:this.isOnlyMe||false
  735. })
  736. .then((res) => {
  737. if (res.Ret !== 200) return
  738. this.searchOptions = res.Data.List || [];
  739. });
  740. } else {
  741. this.searchOptions = [];
  742. }
  743. },
  744. /* 选中分类变化时 */
  745. nodeChange({ UniqueCode,EdbInfoId,ClassifyId },node) {
  746. this.search_txt = '';
  747. this.select_node = UniqueCode;
  748. this.select_id = EdbInfoId || 0;
  749. this.select_classify = !EdbInfoId ? ClassifyId : 0;
  750. this.resetNodeStyle(node);
  751. this.dynamicNode = node;
  752. this.showAssociateChart=false
  753. this.showAssociateComputeData=false
  754. },
  755. async saveEdbHandle() {
  756. const {Ret} = await preDictEdbInterface.saveChartInfo({
  757. EdbInfoId: this.select_id,
  758. MaxValue: Number(this.$refs.detailComponentRef.$refs.chartInfo.tableData[0].MaxData),
  759. MinValue: Number(this.$refs.detailComponentRef.$refs.chartInfo.tableData[0].MinData)
  760. })
  761. if(Ret !== 200) return
  762. this.$message.success('保存成功')
  763. this.setChartImage()
  764. },
  765. /* 关联图片 */
  766. setChartImage() {
  767. let svg = this.$refs.detailComponentRef.$refs.chartInfo.$refs.chartRef.chart.getSVG({
  768. chart: {
  769. width: 340,
  770. height: 230,
  771. },
  772. });
  773. let form = new FormData();
  774. form.append("Img", svg);
  775. this.setImageHandle(form);
  776. },
  777. async setImageHandle(form) {
  778. let { Data } = await dataBaseInterface.uploadImgSvg(form);
  779. await preDictEdbInterface.setImg({
  780. EdbInfoId: this.select_id,
  781. ImageUrl: Data.ResourceUrl,
  782. });
  783. },
  784. /* 添加一级目录 */
  785. addLevelOneHandle() {
  786. this.dialog_title = '添加';
  787. this.classifyForm = {
  788. classify_name: '',
  789. Level:0,
  790. ParentId:0
  791. }
  792. this.classifyDia = true;
  793. },
  794. addNode(node,{ClassifyName,ClassifyId}){
  795. this.dialog_title = '添加'
  796. /* 添加目录 */
  797. this.classifyForm = {
  798. classify_name:'',
  799. Level:node.level,
  800. ParentId:ClassifyId,
  801. level_1_Name:node.level === 1
  802. ? ClassifyName
  803. : node.level === 2
  804. ? node.parent.data.ClassifyName
  805. : node.parent.parent.data.ClassifyName,
  806. level_2_Name:node.level === 1
  807. ? ''
  808. : node.level === 2
  809. ? ClassifyName
  810. : node.parent.data.ClassifyName,
  811. }
  812. this.classifyDia = true;
  813. },
  814. /* 编辑节点 */
  815. editNode(node, { ClassifyName,ClassifyId,Level,ParentId}) {
  816. this.dialog_title = '编辑';
  817. /* 编辑目录 */
  818. this.classifyForm = {
  819. classify_name: ClassifyName,
  820. classify_id: ClassifyId,
  821. Level:node.level,
  822. ParentId:ParentId,
  823. level_1_Name:node.level === 1
  824. ? ClassifyName
  825. : node.level === 2
  826. ? node.parent.data.ClassifyName
  827. : node.parent.parent.data.ClassifyName,
  828. level_2_Name:node.level === 1
  829. ? ''
  830. : node.level === 2
  831. ? ClassifyName
  832. : node.parent.data.ClassifyName,
  833. };
  834. this.classifyDia = true;
  835. },
  836. /* 删除节点校验 */
  837. async removeNode(node, { ClassifyId,EdbInfoId }) {
  838. const { Data } = await preDictEdbInterface.classifyDelCheck({ ClassifyId,EdbInfoId })
  839. const { DeleteStatus,TipsMsg } = Data;
  840. // DeleteStatus === 1
  841. // ? this.$confirm('该分类下关联指标不可删除', '删除失败', {
  842. // confirmButtonText: '知道了',
  843. // showCancelButton: false,
  844. // type: 'error',
  845. // }) : DeleteStatus === 0 && !EdbInfoId
  846. // ? this.$confirm('确定删除当前分类吗?', '提示', {
  847. // confirmButtonText: '确定',
  848. // cancelButtonText: '取消',
  849. // type: 'warning',
  850. // }).then(() => {
  851. // this.delApi(ClassifyId, EdbInfoId)
  852. // }): null;
  853. /**
  854. * 0 可删除
  855. * 1 关联指标
  856. * 2 有子目录无指标
  857. */
  858. const deleteLabelMap = {
  859. 1: '该目录关联指标不可删除',
  860. 2: '确认删除当前目录及包含的子目录吗?',
  861. 3: '当前指标已用作画图,不可删除',
  862. 4: TipsMsg
  863. }
  864. if([1,3,4].includes(DeleteStatus)) this.$confirm(
  865. deleteLabelMap[DeleteStatus],
  866. '删除失败',
  867. {
  868. confirmButtonText: '知道了',
  869. showCancelButton:false,
  870. type: 'error'
  871. })
  872. else if([0,2].includes(DeleteStatus)) this.$confirm(
  873. DeleteStatus === 2
  874. ? deleteLabelMap[DeleteStatus]
  875. : EdbInfoId?'删除后指标和指标值均不可使用,确认删除吗?':'确定删除当前目录吗?',
  876. '提示',
  877. {
  878. confirmButtonText: '确定',
  879. cancelButtonText: '取消',
  880. type: 'warning'
  881. }).then(() => {
  882. this.delApi(ClassifyId, EdbInfoId)
  883. }).catch(() => {
  884. });
  885. },
  886. /* 删除方法 */
  887. delApi(ClassifyId, EdbInfoId, type='') {
  888. preDictEdbInterface
  889. .classifyDel({
  890. ClassifyId,
  891. EdbInfoId,
  892. })
  893. .then((res) => {
  894. if (res.Ret !== 200) return
  895. this.$message.success(res.Msg);
  896. if (!res.Data.EdbInfoId || !res.Data) this.select_id = '';
  897. //删除表格后自动显示下一张表格
  898. type && res.Data.EdbInfoId
  899. ? this.getTreeData({
  900. code: res.Data.UniqueCode,
  901. id: res.Data.EdbInfoId,
  902. classifyId:res.Data.ClassifyId
  903. })
  904. : this.getTreeData();
  905. });
  906. },
  907. /* 删除指标 */
  908. delEdbHandle() {
  909. this.$confirm('ETA预测指标删除后不可恢复,确认删除吗?', '提示', {
  910. confirmButtonText: '确定',
  911. cancelButtonText: '取消',
  912. type: 'warning',
  913. })
  914. .then(() => {
  915. this.delApi(
  916. this.select_classify || 0,
  917. this.select_id,
  918. 'del-edb'
  919. );
  920. })
  921. .catch(() => {});
  922. },
  923. /* 分类成功回调 */
  924. classifyCallback(type) {
  925. this.getTreeData();
  926. if (type === 'add') {
  927. //新增分类完成之后,展开父节点显示刚新增的分类,若已展开节点则不做处理
  928. let code = this.add_parent_id;
  929. let flag = this.defaultShowNodes.some(item => item === code);
  930. !flag && this.defaultShowNodes.push(code);
  931. this.add_parent_id = '';
  932. }
  933. },
  934. /* 展开对应菜单 显示详情 */
  935. detailShowHandle({ UniqueCode, EdbInfoId,ClassifyId}) {
  936. let params = {
  937. code: UniqueCode,
  938. id: EdbInfoId,
  939. classifyId:ClassifyId
  940. };
  941. this.selectCurrentNode(params);
  942. this.select_classify = 0;
  943. },
  944. /* 操作指标后 */
  945. handleEdbCallBack(param) {
  946. this.getTreeData(param)
  947. //编辑后刷数据
  948. if(!param) {
  949. console.log('编辑后刷数据');
  950. this.detail_show_chart ? this.$refs.detailComponentRef.getDetail('updateImg') : this.$refs.detailComponentRef.getData();
  951. }
  952. },
  953. /* 更新指标 */
  954. updateEdbHandle: _.debounce(function() {
  955. this.loading = this.$loading({
  956. lock: true,
  957. target:'.edb-detail-wrapper',
  958. text: '刷新数据中...',
  959. spinner: 'el-icon-loading',
  960. background: 'rgba(255, 255, 255, 0.8)'
  961. });
  962. preDictEdbInterface.edbRefresh({
  963. EdbInfoId: this.select_id
  964. }).then(res => {
  965. this.loading.close();
  966. if(res.Ret !== 200) return
  967. this.$message.success(res.Msg)
  968. //更新完刷数据
  969. console.log('更新完刷数据');
  970. this.detail_show_chart ? this.$refs.detailComponentRef.getDetail('updateImg') : this.$refs.detailComponentRef.getData();
  971. })
  972. },300),
  973. /* 部分刷新 */
  974. updateEdbPartHandle: _.debounce(function() {
  975. this.loading = this.$loading({
  976. lock: true,
  977. target:'.edb-detail-wrapper',
  978. text: '刷新数据中...',
  979. spinner: 'el-icon-loading',
  980. background: 'rgba(255, 255, 255, 0.8)'
  981. });
  982. preDictEdbInterface.edbPartRefresh({
  983. EdbInfoId: this.select_id
  984. }).then(res => {
  985. this.loading.close();
  986. if(res.Ret !== 200) return
  987. this.$message.success(res.Msg)
  988. //更新完刷数据
  989. console.log('更新完刷数据');
  990. this.detail_show_chart ? this.$refs.detailComponentRef.getDetail('updateImg') : this.$refs.detailComponentRef.getData();
  991. })
  992. },300),
  993. /* 编辑指标 */
  994. editEdbHandle(type="") {
  995. preDictEdbInterface.edbDetail({
  996. EdbInfoId: this.select_id
  997. }).then(res => {
  998. if(res.Ret !== 200) return
  999. const { RuleList,EdbType,Source,CalculateList } = res.Data;
  1000. // 原始指标
  1001. if(EdbType === 1) {
  1002. !type && this.$router.push({
  1003. path:'/editpredictEdb',
  1004. query:{
  1005. id:this.select_id
  1006. }
  1007. })
  1008. if(type === 'view') {
  1009. this.showRules = RuleList;
  1010. this.showFromEdbInfo = CalculateList[0];
  1011. this.isShowRuleDialog=true};
  1012. } else {
  1013. //计算指标
  1014. this.setComputedDialogForm(res.Data,type);
  1015. this.computed_type =[47,48].includes(Source)?'joint': Source;
  1016. this.computed_type = [72,73].includes(Source)? 'alpha': Source;
  1017. }
  1018. })
  1019. },
  1020. /* 查看指标 */
  1021. viewNode() {
  1022. this.editEdbHandle('view')
  1023. },
  1024. /* 计算指标回显 */
  1025. setComputedDialogForm({Source,CalculateList,CalculateFormula,EdbInfoId,EdbName,Unit,Frequency,ClassifyId,MoveType,MoveFrequency,Calendar,CorrelationStr},type='') {
  1026. //找到指标的父级
  1027. let deep_arr = _.cloneDeep(this.treeData);
  1028. const parentNodes = this.findParentNodeHandle(deep_arr,ClassifyId,'ClassifyId')
  1029. //指标运算 or 其他计算类型指标
  1030. if( Source === 31 ) {
  1031. /* 回显指标和表单 */
  1032. this.computedTit = '编辑计算指标';
  1033. /* 依赖的指标列表 */
  1034. this.calulateList = CalculateList.map(item => ({
  1035. tag: item.FromTag,
  1036. edb_name: item.FromEdbName,
  1037. target: item.FromEdbInfoId,
  1038. start_date: item.StartDate,
  1039. end_date: item.EndDate
  1040. }))
  1041. /* 公式和表单 */
  1042. this.calulateForm = {
  1043. edb_id:EdbInfoId,
  1044. formula: CalculateFormula,
  1045. menu: parentNodes.reverse(),
  1046. targetName: EdbName,
  1047. unit: Unit,
  1048. frequency: Frequency,
  1049. view: type === 'view'
  1050. };
  1051. } else {
  1052. if([47,48,50,56].includes(Source)){//拟合残差
  1053. this.operationForm={
  1054. edb_id:EdbInfoId,
  1055. targetName: EdbName,
  1056. frequency: Frequency,
  1057. unit: Unit,
  1058. menu: parentNodes.reverse(),
  1059. view: type === 'view',
  1060. source: Source,
  1061. date: CalculateFormula,
  1062. pre_edb: Source === 47 ? CalculateList.find(item => item.FromTag === 'A').FromEdbInfoId : '', //俺也不懂为什么这么定义都是江西老表的锅
  1063. after_edb: Source === 47 ? CalculateList.find(item => item.FromTag === 'B').FromEdbInfoId : '',
  1064. old_stay_edb: Source === 48 ? CalculateList.find(item => item.FromTag === 'A').FromEdbInfoId : '',
  1065. concat_edb: Source === 48 ? CalculateList.find(item => item.FromTag === 'B').FromEdbInfoId : '',
  1066. from_arr: CalculateList,
  1067. correlationStr: CorrelationStr
  1068. }
  1069. return
  1070. }
  1071. this.operationForm = {
  1072. oldedb_id: CalculateList[0].FromEdbInfoId,
  1073. oldEdb_name: CalculateList[0].FromEdbName,
  1074. edb_id: EdbInfoId,
  1075. targetName: EdbName,
  1076. unit: Unit,
  1077. menu: parentNodes.reverse(),
  1078. frequency: Frequency,
  1079. formula: CalculateFormula || '',
  1080. view: type === 'view',
  1081. moveType: MoveType,
  1082. moveUnit: MoveFrequency,
  1083. moveVal: Source === 46 ? CalculateFormula : '',
  1084. calendar_type: Source === 49 ? Calendar : '',
  1085. }
  1086. if([72,73].includes(Source)){
  1087. this.operationForm = {
  1088. edb_id: EdbInfoId,
  1089. oldedb_id: CalculateList[0].FromEdbInfoId,
  1090. oldEdb_name: CalculateList[0].FromEdbName,
  1091. EdbName,Frequency,Unit,ClassifyId,Formula:CalculateFormula,
  1092. view: type === 'view'
  1093. }
  1094. }
  1095. }
  1096. },
  1097. /* 复制数据 */
  1098. copyData() {
  1099. preDictEdbInterface.edbDataInfo({
  1100. EdbInfoId: this.select_id,
  1101. CurrentIndex: 1,
  1102. PageSize: 100000,
  1103. }).then(res => {
  1104. if(res.Ret !== 200) return
  1105. const { DataList,PredictDataList } = res.Data.Item;
  1106. let total_data = [...PredictDataList,...DataList];
  1107. let str = '日期\t 值\n';
  1108. total_data.forEach((item) => (str += `${item.DataTime}\t${item.Value}\n`));
  1109. this.$copyText(str).then(
  1110. (res) => {
  1111. this.$message.success('已成功复制!');
  1112. },
  1113. (err) => {
  1114. this.$message.error('复制失败!');
  1115. }
  1116. );
  1117. })
  1118. },
  1119. /* 获取表格列表 */
  1120. getPublicList() {
  1121. preDictEdbInterface.edbList({
  1122. CurrentIndex: this.public_page,
  1123. PageSize: this.public_pages_size,
  1124. ClassifyId: this.select_classify || 0,
  1125. IsOnlyMe:this.isOnlyMe||false,
  1126. }).then(res => {
  1127. if(res.Ret !== 200) return
  1128. this.publicHaveMove = res.Data
  1129. ? this.public_page < res.Data.Paging.Pages
  1130. : false;
  1131. this.edbChartList = res.Data
  1132. ? this.public_page === 1
  1133. ? res.Data.List
  1134. : [...this.edbChartList, ...res.Data.List]
  1135. : [];
  1136. this.edb_total = res.Data ? res.Data.Paging.Totals : 0;
  1137. })
  1138. },
  1139. /* 加载更多 */
  1140. loadMoreHandle: _.throttle(function() {
  1141. let scrollTop = this.$refs.listRef.scrollTop;
  1142. let clientHeight = this.$refs.listRef.clientHeight;
  1143. let scrollHeight = this.$refs.listRef.scrollHeight;
  1144. if(scrollTop + clientHeight >= scrollHeight-10 && this.publicHaveMove){
  1145. this.public_page++;
  1146. this.getPublicList();
  1147. }
  1148. },300),
  1149. /* 切换中英文 */
  1150. changeLangHandle: _.debounce(async function (lang){
  1151. this.search_txt = '';
  1152. this.currentLang = lang;
  1153. await dataBaseInterface.setUserLang({
  1154. ConfigCode: 'predict_edb_language',
  1155. ConfigValue: lang === 'en' ? 'EN' : 'CN'
  1156. })
  1157. },200),
  1158. /* 编辑英文 */
  1159. openEnNameDia(info){
  1160. this.formItemArray=[{
  1161. label:'指标名称',
  1162. value:info.EdbName,
  1163. key:'EdbName',
  1164. notEdit:true
  1165. }]
  1166. // 中文单位有 才能编辑英文单位
  1167. if(info.Unit && info.Unit!='无'){
  1168. this.formItemArray.push({
  1169. label:'单位',
  1170. value:info.Unit,
  1171. key:'Unit',
  1172. notEdit:true
  1173. },
  1174. {
  1175. label:'英文指标名称',
  1176. value:info.EdbNameEn,
  1177. key:'EdbNameEn',
  1178. placeholder:'请输入英文指标名称'
  1179. },
  1180. {
  1181. label:'英文单位',
  1182. value:info.UnitEn,
  1183. key:'UnitEn',
  1184. placeholder:'请输入英文单位'
  1185. })
  1186. }else{
  1187. this.formItemArray.push({
  1188. label:'英文指标名称',
  1189. value:info.EdbNameEn,
  1190. key:'EdbNameEn',
  1191. placeholder:'请输入英文指标名称'
  1192. })
  1193. }
  1194. this.setEnName = true
  1195. },
  1196. clickEdbNameHandle() {
  1197. this.$refs.detailComponentRef.changeEnOptions();
  1198. },
  1199. updateEnName(item){
  1200. let params={
  1201. EdbInfoId: Number(this.select_id),
  1202. ...item
  1203. }
  1204. dataBaseInterface.edbInfoEditEn(params).then(res=>{
  1205. if(res.Ret ==200){
  1206. this.$message({
  1207. message:res.Msg,
  1208. type:"success"
  1209. })
  1210. this.detail_show_chart ? this.$refs.detailComponentRef.getDetail() : this.$refs.detailComponentRef.getData();
  1211. this.setEnName = false
  1212. this.getTreeData({
  1213. code: this.select_node,
  1214. id: this.select_id
  1215. });
  1216. }
  1217. })
  1218. },
  1219. /* 打开计算弹窗 */
  1220. addComputedHandler() {
  1221. this.computedTit = '计算指标';
  1222. this.calulateList = [];
  1223. this.calulateForm = {};
  1224. this.operationForm = {};
  1225. this.isOpenComputed = true;
  1226. },
  1227. /* 选择计算类型 */
  1228. changeComputedType(type) {
  1229. let typeMapSource = {
  1230. 'toMonthSeason': 42,
  1231. 'accumulate': 65
  1232. }
  1233. this.computed_type = typeMapSource[type] || type;;
  1234. this.isOpenComputed = false;
  1235. },
  1236. /* 新增计算指标回调 */
  1237. addComputedCallBack(type, params) {
  1238. this.computed_type = 0;
  1239. this.computed_source = 1;
  1240. this.showAssociateChart=false;
  1241. this.showAssociateComputeData=false;
  1242. type === 'add' ? this.getTreeData(params) : this.getTreeData();
  1243. if(type === 'edit') {
  1244. this.detail_show_chart ? this.$refs.detailComponentRef.getDetail() : this.$refs.detailComponentRef.getData();
  1245. }
  1246. },
  1247. /* 重绘右侧区域宽度 */
  1248. reloadRightWid() {
  1249. let total_wid = $('.predict-edb-main')[0].offsetWidth;
  1250. let left = $('#left')[0].offsetWidth;
  1251. let rigtWid = total_wid - left - 20 + 'px';
  1252. $('#right')[0].style.width = rigtWid;
  1253. },
  1254. //只看我的
  1255. onlyMeHandler(){
  1256. this.getTreeData()
  1257. this.public_page = 1;
  1258. this.$refs.listRef.scrollTop = 0;
  1259. this.getPublicList();
  1260. },
  1261. //懒加载el-tree
  1262. getLazyTreeData(node,resolve,maxLevel=3){
  1263. if(node.level===0){
  1264. resolve(this.treeData)
  1265. }
  1266. if(node.level>0&&node.level<=maxLevel){
  1267. //获取对应层级的Child
  1268. resolve(node.data.Children||[])
  1269. }
  1270. if(node.level===maxLevel){
  1271. //调接口获取该分类下图表的数据
  1272. preDictEdbInterface.classifyChartList({
  1273. ClassifyId:node.data.ClassifyId,
  1274. IsShowMe:this.isOnlyMe
  1275. }).then(res=>{
  1276. if(res.Ret===200){
  1277. let arr=res.Data.EdbInfoList||[]
  1278. arr=arr.map(item=>{
  1279. return {
  1280. ...item,
  1281. isLeaf:true
  1282. }
  1283. })
  1284. resolve(arr)
  1285. }else{
  1286. resolve([])
  1287. }
  1288. this.changeTreeNode()
  1289. })
  1290. }
  1291. if(node.level>maxLevel){
  1292. resolve([])
  1293. }
  1294. },
  1295. changeTreeNode(){
  1296. this.$refs.treeRef.setCurrentKey(this.select_node);
  1297. this.$nextTick(()=>{
  1298. const _node = this.$refs.treeRef.getNode(this.select_node)
  1299. this.dynamicNode = _node;
  1300. this.dynamicNode&&this.resetNodeStyle(this.dynamicNode)
  1301. })
  1302. },
  1303. changeShowType(){
  1304. if(!this.activeTab) return
  1305. this.detail_show_chart = this.activeTab==='Chart'?true:false
  1306. }
  1307. },
  1308. mounted() {
  1309. const obj=sessionStorage.getItem('predictEdbTreeData')
  1310. if(obj||this.$route.query.code){
  1311. let code=obj?JSON.parse(obj).code:this.$route.query.code
  1312. let id=obj?JSON.parse(obj).id:this.$route.query.id
  1313. let classifyId=obj?JSON.parse(obj).classifyId:this.$route.query.classifyId
  1314. this.getTreeData({code: code,id: Number(id),classifyId:Number(classifyId)})
  1315. }else{
  1316. this.getTreeData()
  1317. }
  1318. // 清除缓存数据
  1319. setTimeout(() => {
  1320. sessionStorage.setItem('predictEdbTreeData','')
  1321. }, 1000);
  1322. this.getPublicList();
  1323. window.addEventListener('resize', this.reloadRightWid);
  1324. },
  1325. destroyed() {
  1326. window.removeEventListener('resize', this.reloadRightWid);
  1327. }
  1328. }
  1329. </script>
  1330. <style lang="scss">
  1331. .predictEdb-container{
  1332. .detail-header{
  1333. display: flex;
  1334. position: relative;
  1335. height: 60px;
  1336. .el-tabs{
  1337. width:200px;
  1338. .el-tabs__header{
  1339. margin-bottom: 0;
  1340. }
  1341. .el-tabs__nav{
  1342. display: flex;
  1343. width: 100%;
  1344. .el-tabs__item{
  1345. flex: 1;
  1346. text-align: center;
  1347. font-size: 16px;
  1348. height: 60px;
  1349. line-height: 60px;
  1350. }
  1351. }
  1352. }
  1353. }
  1354. .edb-tool{
  1355. flex: 1;
  1356. text-align: right;
  1357. display: flex;
  1358. gap: 16px;
  1359. justify-content: flex-end;
  1360. padding-right: 15px;
  1361. position: relative;
  1362. &::after{
  1363. position: absolute;
  1364. content:'';
  1365. width:100%;
  1366. left: 0;
  1367. bottom: 0;
  1368. height:2px;
  1369. background-color: #E4E7ED;
  1370. }
  1371. }
  1372. }
  1373. </style>
  1374. <style lang='scss' scoped>
  1375. @import "~@/styles/theme-vars.scss";
  1376. *{ box-sizing: border-box;}
  1377. $mini-font: 12px; $normal-font: 14px;
  1378. .predictEdb-container {
  1379. .slide-icon {
  1380. padding: 20px 0;
  1381. /* display: block; */
  1382. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);
  1383. border-radius: 5px;
  1384. cursor: pointer;
  1385. position: absolute;
  1386. top: 50%;
  1387. transform: translateY(-50%);
  1388. z-index: 99;
  1389. &:hover {
  1390. background-color: rgba(0, 0, 0, 0.05);
  1391. }
  1392. &.slide-left {
  1393. right: 0;
  1394. }
  1395. &.slide-right {
  1396. left: 0;
  1397. }
  1398. }
  1399. .predict-edb-main {
  1400. display: flex;
  1401. .main-left {
  1402. width: 400px;
  1403. min-width: 380px;
  1404. background: #fff;
  1405. margin-right: 20px;
  1406. border: 1px solid #ececec;
  1407. border-radius: 4px;
  1408. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  1409. height: calc(100vh - 120px);
  1410. overflow: hidden;
  1411. position: relative;
  1412. box-sizing: border-box;
  1413. .datasheet_top {
  1414. padding: 20px;
  1415. background: #fff;
  1416. border: 1px solid #ececec;
  1417. box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  1418. margin-bottom: 20px;
  1419. display: flex;
  1420. align-items: center;
  1421. }
  1422. .search-cont {
  1423. padding: 0 20px;
  1424. }
  1425. .tree-cont {
  1426. padding: 0 20px 30px 20px;
  1427. /* max-height: calc(100vh - 280px);
  1428. overflow: auto; */
  1429. }
  1430. .target_tree {
  1431. color: #333;
  1432. max-height: calc(100vh - 400px);
  1433. overflow-y:auto;
  1434. .custom-tree-node {
  1435. display: flex !important;
  1436. justify-content: space-between;
  1437. align-items: center;
  1438. display: block;
  1439. flex: 1;
  1440. .node_label {
  1441. margin-right: 2px;
  1442. }
  1443. .el-icon-view {
  1444. color: #409eff;
  1445. font-size: 18px;
  1446. margin-left: 5px;
  1447. }
  1448. }
  1449. }
  1450. .noDepart {
  1451. margin: 30px 0;
  1452. display: flex;
  1453. align-items: center;
  1454. justify-content: center;
  1455. color: $theme-color;
  1456. font-size: 16px;
  1457. cursor: pointer;
  1458. }
  1459. .move-btn {
  1460. height: 100%;
  1461. width: 4px;
  1462. /* opacity: 0; */
  1463. position: absolute;
  1464. right: 0px;
  1465. top: 0;
  1466. &:hover {
  1467. cursor: col-resize;
  1468. /* background-color: orange */
  1469. }
  1470. }
  1471. }
  1472. .main-right {
  1473. width: 80%;
  1474. .edb-detail-wrapper {
  1475. height: 100%;
  1476. border: 1px solid #ececec;
  1477. border-radius: 4px;
  1478. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  1479. overflow: auto;
  1480. background: #fff;
  1481. .detail-top {
  1482. padding: 20px;
  1483. display: flex;
  1484. justify-content: space-between;
  1485. align-items: center;
  1486. border-bottom: 1px solid #ececec;
  1487. .title {
  1488. font-size: 16px;
  1489. &.disabled { color: #ccc; }
  1490. }
  1491. .action-ul {
  1492. display: flex;
  1493. li { margin: 0 10px; }
  1494. }
  1495. }
  1496. .detail-wrap {
  1497. position: relative;
  1498. padding: 16px;
  1499. height: calc(100vh - 180px);
  1500. overflow-y: auto;
  1501. .toggle-text {
  1502. position: absolute;
  1503. right: 20px;
  1504. top: 40px;
  1505. z-index: 2;
  1506. display: flex;
  1507. align-items: center;
  1508. }
  1509. /* min-height: 500px; */
  1510. }
  1511. }
  1512. .sheet-list-cont {
  1513. color: #333;
  1514. .el-card .el-card__header,
  1515. .el-card__body {
  1516. padding: 10px;
  1517. }
  1518. .list-top {
  1519. display: flex;
  1520. align-items: center;
  1521. justify-content: space-between;
  1522. }
  1523. .edbChartList-wrapper {
  1524. margin-top: 10px;
  1525. display: flex;
  1526. flex-wrap: wrap;
  1527. max-height: calc(100vh - 143px);
  1528. overflow: hidden;
  1529. overflow-y: auto;
  1530. .drag-cont {
  1531. width: 100%;
  1532. display: flex;
  1533. flex-wrap: wrap;
  1534. }
  1535. .dragShdow {
  1536. box-shadow: 0 1px 8px rgba(64, 158, 255, 0.8);
  1537. opacity: 0.5;
  1538. }
  1539. .sheet-item {
  1540. .item-top {
  1541. display: flex;
  1542. justify-content: space-between;
  1543. align-items: center;
  1544. font-size: 16px;
  1545. font-weight: 600;
  1546. }
  1547. .chart-img {
  1548. width: 100%;
  1549. height: 230px;
  1550. object-fit: fill !important;
  1551. cursor: pointer;
  1552. }
  1553. .item-bottom {
  1554. margin-top: 10px;
  1555. display: flex;
  1556. justify-content: space-between;
  1557. font-size: 12px;
  1558. color: #666;
  1559. .collected {
  1560. color: #f00;
  1561. cursor: pointer;
  1562. }
  1563. .join_txt {
  1564. color: $theme-color;
  1565. cursor: pointer;
  1566. }
  1567. }
  1568. }
  1569. }
  1570. .nodata {
  1571. text-align: center;
  1572. }
  1573. }
  1574. }
  1575. }
  1576. .computed-ul {
  1577. max-height: 600px;
  1578. overflow-y: auto;
  1579. padding: 40px 92px;
  1580. display: flex;
  1581. flex-wrap: wrap;
  1582. .cpmputed-li {
  1583. width: 180px;
  1584. padding: 19px 0;
  1585. color: $theme-color;
  1586. font-size: 16px;
  1587. background:#ECF5FF;
  1588. border-radius: 8px;
  1589. border: 1px solid #B3D8FF;
  1590. text-align: center;
  1591. cursor: pointer;
  1592. margin-right: 65px;
  1593. margin-bottom: 55px;
  1594. &:nth-child(3n) {
  1595. margin-right:0;
  1596. }
  1597. &:hover {
  1598. background: $theme-color;
  1599. color: #fff;
  1600. }
  1601. &.act {
  1602. background: $theme-color;
  1603. color: #fff;
  1604. }
  1605. }
  1606. }
  1607. }
  1608. </style>
  1609. <style lang="scss">
  1610. @import "~@/styles/theme-vars.scss";
  1611. .predictEdb-container {
  1612. .label-input .el-input__inner {
  1613. height: 25px;
  1614. line-height: 25px;
  1615. padding: 0 10px;
  1616. }
  1617. .el-dialog--center .el-dialog__body {
  1618. padding: 40px 20px 30px 60px;
  1619. }
  1620. .el-tree__drop-indicator{
  1621. height:3px;
  1622. background-color: $theme-color;
  1623. }
  1624. .el-tree-node__content {
  1625. margin-bottom: 14px !important;
  1626. }
  1627. .el-tree-node__children {
  1628. .el-tree-node {
  1629. /* margin-bottom: 8px !important; */
  1630. margin-bottom: 0px !important;
  1631. padding-left: 18px;
  1632. }
  1633. .el-tree-node__content {
  1634. margin-bottom: 5px !important;
  1635. padding-left: 0 !important;
  1636. }
  1637. }
  1638. .expanded.el-icon-caret-right:before {
  1639. content: url('../../assets/img/set_m/down.png') !important;
  1640. }
  1641. .el-icon-caret-right:before {
  1642. content: url('../../assets/img/set_m/slide.png') !important;
  1643. }
  1644. .el-tree-node__expand-icon.is-leaf.el-icon-caret-right:before {
  1645. content: '' !important;
  1646. }
  1647. .el-tree-node__expand-icon.expanded {
  1648. -webkit-transform: rotate(0deg);
  1649. transform: rotate(0deg);
  1650. }
  1651. .el-tree-node.is-current > .el-tree-node__content {
  1652. background-color: #f0f4ff !important;
  1653. }
  1654. .el-tree-node__content {
  1655. padding-right: 10px !important;
  1656. }
  1657. .dialog-computed {
  1658. .el-dialog__header {
  1659. background-color: #fff;
  1660. .el-dialog__close {
  1661. color: #333;
  1662. }
  1663. }
  1664. }
  1665. }
  1666. </style>