databaseList.vue 58 KB

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