predictEdb.vue 44 KB

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