predictEdb.vue 51 KB

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