chartSetting.vue 97 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958
  1. <template>
  2. <div class="chartSetting_container">
  3. <div class="chartSetting_main box" id="box" v-if="showData">
  4. <span
  5. class="slide-icon slide-right"
  6. @click="slideHandle"
  7. v-show="isSlideLeft"
  8. >
  9. <i class="el-icon-d-arrow-right"></i>
  10. </span>
  11. <div class="chartSetting-label-list">
  12. <edb-label-list
  13. :currentLang="currentLang"
  14. :labelList="labelList"
  15. :activeLabelId="select_node"
  16. @clickLabel="changeCurrentLabel"
  17. @deleteLabel="deleteLabel"
  18. @moveLabel="({oldIndex,newIndex})=>{labelList[oldIndex] = labelList.splice(newIndex, 1, labelList[oldIndex])[0];}"
  19. />
  20. </div>
  21. <div class="chartSetting-main">
  22. <div class="main-left left" id="left" v-show="!isSlideLeft">
  23. <div class="add-chart-cont">
  24. <el-button v-permission="permissionBtn.chartLibPermission.chartLib_add"
  25. @click="$router.push({path: '/addchart'})" type="primary">添加图表</el-button>
  26. <change-lang v-permission="permissionBtn.chartLibPermission.chartLib_switchEn"
  27. :lang="currentLang" @changeLang="changeLanguage" style="margin-left: 10px;"/>
  28. </div>
  29. <ul class="left-tab">
  30. <li :class="['tab',{'act': leftShowLabel===tab}]" v-for="tab in ['目录','坐标轴']" :key="tab" @click="leftShowLabel=tab">{{tab}}</li>
  31. <li >
  32. <el-checkbox v-model="isOnlyMe" @change="onlyMeHandler">只看我的</el-checkbox>
  33. </li>
  34. </ul>
  35. <!-- 目录 -->
  36. <template v-if="leftShowLabel === '目录'">
  37. <div class="chartSetting_main_top">
  38. <el-select
  39. v-model="search_txt"
  40. v-loadMore="searchLoad"
  41. :filterable="!search_txt"
  42. remote
  43. clearable
  44. placeholder="请输入图表名称"
  45. style="width: 100%; margin-top: 20px"
  46. :remote-method="searchHandle"
  47. @click.native="inputFocusHandle"
  48. >
  49. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  50. <el-option
  51. v-for="item in searchOptions"
  52. :key="item.ChartInfoId"
  53. :label="currentLang==='en'?(item.ChartNameEn||item.ChartName):item.ChartName"
  54. :value="item.ChartInfoId"
  55. >
  56. </el-option>
  57. </el-select>
  58. </div>
  59. <div class="tree-cont">
  60. <el-tree
  61. ref="treeRef"
  62. class="target_tree"
  63. :data="treeData"
  64. node-key="UniqueCode"
  65. :props="defaultProp"
  66. :allow-drag="canDragHandle"
  67. :allow-drop="canDropHandle"
  68. :current-node-key="select_node"
  69. :default-expanded-keys="defaultShowNodes"
  70. draggable
  71. :expand-on-click-node="false"
  72. check-strictly
  73. empty-text="暂无分类"
  74. lazy
  75. :load="getLazyTreeData"
  76. @node-expand="handleNodeExpand"
  77. @node-collapse="handleNodeCollapse"
  78. @current-change="nodeChange"
  79. @node-drop="dropOverHandle"
  80. @node-drag-end="dropMouseLeave"
  81. @node-drag-leave="dropMouseLeave"
  82. @node-drag-enter="dropMouseOver"
  83. >
  84. <span class="custom-tree-node" slot-scope="{ node, data }">
  85. <el-input
  86. ref="editVal"
  87. style="width: 90px"
  88. placeholder="请输入值"
  89. class="label-input"
  90. v-model="new_label"
  91. v-if="data.isEdit"
  92. @blur="changeValue(node, data)"
  93. />
  94. <span
  95. @dblclick.stop="editNodeLabel(node, data)"
  96. v-else
  97. class="text_oneLine node_label"
  98. :style="`width:${
  99. (select_node === data.UniqueCode && node.Nodewidth) || ''
  100. }`"
  101. :id="`node${data.UniqueCode}`"
  102. >
  103. <span>{{ currentLang==='en' ? (data.ChartClassifyNameEn||data.ChartClassifyName) : data.ChartClassifyName }}</span>
  104. </span>
  105. <span
  106. style="display: flex; align-items: center"
  107. v-if="select_node === data.UniqueCode"
  108. >
  109. <img
  110. src="~@/assets/img/data_m/move_ico.png"
  111. alt=""
  112. style="width: 14px; height: 14px; margin-right: 8px"
  113. v-if="data.Button.MoveButton"
  114. />
  115. <img
  116. src="~@/assets/img/set_m/add.png"
  117. alt=""
  118. style="width: 14px; height: 14px; margin-right: 8px"
  119. @click.stop="addNode(node, data)"
  120. v-if="data.Button.AddButton"
  121. />
  122. <img
  123. src="~@/assets/img/set_m/edit.png"
  124. alt=""
  125. style="width: 15px; height: 14px; margin-right: 8px"
  126. @click.stop="editNode(node, data)"
  127. v-if="data.Button.OpButton"
  128. />
  129. <img
  130. slot="reference"
  131. src="~@/assets/img/set_m/del.png"
  132. alt=""
  133. style="width: 14px; height: 14px"
  134. @click.stop="removeNode(node, data)"
  135. v-if="data.Button.DeleteButton"
  136. />
  137. </span>
  138. </span>
  139. </el-tree>
  140. <div
  141. class="noDepart"
  142. @click="addLevelOneHandle"
  143. v-if="CanOpClassify"
  144. >
  145. <img
  146. src="~@/assets/img/set_m/add_ico.png"
  147. alt=""
  148. style="width: 16px; height: 16px; margin-right: 10px"
  149. />
  150. <span>添加图表分类</span>
  151. </div>
  152. </div>
  153. </template>
  154. <!-- 坐标轴 -->
  155. <div class="targetset-cont" v-else>
  156. <!-- 仅用于散点图配置提出 -->
  157. <div class="scatter-setting" v-if="chartInfo.ChartType === 5 && tableData.length">
  158. <div style="display: flex;margin-right: 15px;">
  159. <span style="margin-right: 3px">线条颜色:</span>
  160. <el-color-picker
  161. v-model="tableData[0].ChartColor"
  162. size="mini"
  163. show-alpha
  164. :predefine="predefineColors"
  165. ></el-color-picker>
  166. </div>
  167. <el-checkbox v-model="tableData[0].IsOrder">逆序</el-checkbox>
  168. </div>
  169. <el-collapse v-model="activeNames" class="target-list" v-if="tableData.length">
  170. <el-collapse-item v-for="(item,index) in tableData" :key="item.EdbInfoId" :disabled="[2,5,7,10].includes(chartInfo.ChartType)">
  171. <template slot="title">
  172. <span class="text_oneLine">{{item.EdbName}}</span>
  173. </template>
  174. <ul class="setting-cont">
  175. <!-- 堆叠图 或组合图中的堆叠类型 非第一项隐藏配置 -->
  176. <template v-if="showYOptionsHandle(item,index)">
  177. <li>
  178. <el-checkbox v-model="item.IsOrder">逆序</el-checkbox>
  179. </li>
  180. <li>
  181. <el-radio-group v-model="item.IsAxis" size="mini">
  182. <el-radio-button :label="1">左轴</el-radio-button>
  183. <el-radio-button :label="0">右轴</el-radio-button>
  184. <!-- 指标有右轴时才可以选右2轴 不然没有右2这个概念的意义 -->
  185. <el-radio-button
  186. v-if="[1,6].includes(chartInfo.ChartType)"
  187. :label="2"
  188. :disabled="(tableData.findIndex(_ => _.IsAxis===0) === -1)
  189. || (tableData.findIndex(_ => _.IsAxis===0) === index
  190. && tableData.filter(_ => _.IsAxis===0).length === 1)"
  191. >右2轴</el-radio-button>
  192. </el-radio-group>
  193. </li>
  194. </template>
  195. <li style="min-width: 250px">
  196. <el-radio
  197. v-model="item.EdbInfoType"
  198. :label="1"
  199. @change="getPreviewChartInfo"
  200. >标准指标</el-radio
  201. >
  202. <div style="margin-top: 15px">
  203. <el-radio
  204. v-model="item.EdbInfoType"
  205. :label="0"
  206. style="margin-right: 10px"
  207. @change="getPreviewChartInfo"
  208. >领先指标</el-radio
  209. >
  210. <template v-if="item.EdbInfoType === 0">
  211. 领先
  212. <el-input
  213. style="width: 60px"
  214. size="mini"
  215. type="number"
  216. min="0"
  217. v-model="item.LeadValue"
  218. @change="getPreviewChartInfo"
  219. @keyup.native="filterCode(item)"
  220. ></el-input>
  221. <el-select
  222. v-model="item.LeadUnit"
  223. placeholder=""
  224. style="width: 60px"
  225. size="mini"
  226. @change="getPreviewChartInfo"
  227. >
  228. <el-option
  229. v-for="item in fre_options"
  230. :key="item"
  231. :label="item"
  232. :value="item"
  233. >
  234. </el-option>
  235. </el-select>
  236. </template>
  237. </div>
  238. </li>
  239. <li>
  240. <div style="display: flex">
  241. <span style="margin-right: 3px">线条颜色:</span>
  242. <el-color-picker
  243. v-model="item.ChartColor"
  244. size="mini"
  245. show-alpha
  246. :predefine="predefineColors"
  247. ></el-color-picker>
  248. </div>
  249. <div style="display: flex;margin-top: 12px" v-if="item.EdbInfoCategoryType === 1">
  250. <span style="margin-right: 3px">预测值颜色:</span>
  251. <el-color-picker
  252. v-model="item.PredictChartColor"
  253. size="mini"
  254. show-alpha
  255. :predefine="predefineColors"
  256. ></el-color-picker>
  257. </div>
  258. <div
  259. style="margin-top: 12px"
  260. v-if="chartInfo.ChartType === 1
  261. || (chartInfo.ChartType === 6 && item.ChartStyle==='spline')"
  262. >
  263. 线条粗细:
  264. <el-input
  265. style="width: 60px"
  266. size="mini"
  267. type="number"
  268. :min="1"
  269. v-model="item.ChartWidth"
  270. @keyup.native="filterWidth(item)"
  271. />
  272. </div>
  273. </li>
  274. <li v-if="chartInfo.ChartType === 6">
  275. <div style="display: flex">
  276. <span style="margin-right: 3px">生成样式:</span>
  277. <el-select
  278. v-model="item.ChartStyle"
  279. placeholder="请选择生成样式"
  280. style="width: 50%"
  281. class="edb-item-style"
  282. >
  283. <el-option
  284. v-for="item in chartItemStyleArr"
  285. :key="item.key"
  286. :label="item.label"
  287. :value="item.value"
  288. >
  289. </el-option>
  290. </el-select>
  291. </div>
  292. </li>
  293. </ul>
  294. </el-collapse-item>
  295. </el-collapse>
  296. <div v-else class="nodata">
  297. <tableNoData text="暂无信息"/>
  298. </div>
  299. </div>
  300. <span
  301. class="move-btn resize"
  302. v-drag
  303. id="resize"
  304. @mousemove="dynamicNode && resetNodeStyle(dynamicNode)"
  305. ></span>
  306. <span class="slide-icon slide-left" @click="slideHandle">
  307. <i class="el-icon-d-arrow-left"></i>
  308. </span>
  309. </div>
  310. <div
  311. class="main-right right"
  312. id="right"
  313. :style="isSlideLeft ? 'width:100%' : `width:${dynamicWidth}`"
  314. >
  315. <!-- =============具体图表区域============== -->
  316. <div class="chart-min-cont" v-if="tableData.length">
  317. <div class="cont-top">
  318. <div class="top-left">
  319. <!-- 默认曲线图 -->
  320. <template v-if="sameOptionType.includes(chartInfo.ChartType)">
  321. <el-button
  322. type="primary"
  323. v-for="item in yearSelector"
  324. :key="item.value"
  325. size="medium"
  326. :plain="item.value !== year_select"
  327. class="year-btn"
  328. @click.native="changeYear(item)"
  329. >{{ item.name }}</el-button
  330. >
  331. <el-button type="text" class="btn-sty" @click="openDateDia">{{
  332. dateTip
  333. }}</el-button>
  334. </template>
  335. <!-- 季节性图选择年份区间 -->
  336. <!-- <date-picker
  337. v-else-if="chartInfo.ChartType === 2"
  338. v-model="season_year"
  339. type="month"
  340. value-type="format"
  341. range
  342. placeholder="年份日期选择"
  343. @change="seasonYearChange"
  344. /> -->
  345. <div v-else-if="chartInfo.ChartType === 2" @click="openDateDia" class="date-setting">
  346. {{ season_year && season_year.length>0 ? season_year[0]+'~'+season_year[1]:"年份日期选择" }}
  347. </div>
  348. </div>
  349. </div>
  350. <div class="cont-bottom">
  351. <el-row class="bottom-min">
  352. <el-col
  353. :span="21"
  354. style="padding-bottom: 30px;"
  355. >
  356. <div class="chartEn-mark" v-show="chartInfo.IsEnChart" style="top: 0;left: 0;">En</div>
  357. <div class="chart-show-cont" v-if="!chartInfo.WarnMsg">
  358. <div class="chartWrapper" id="chartWrapper">
  359. <h2 class="chart-title">{{ currentLang==='en'?(chartInfo.ChartNameEn||chartInfo.ChartName):chartInfo.ChartName }}</h2>
  360. <Chart :options="options" ref="chartRef" />
  361. <div class="range-cont left" v-if="leftIndex != -1">
  362. <el-input
  363. style="width: 60px; display: block"
  364. size="mini"
  365. type="number"
  366. placeholder="上限"
  367. v-model="tableData[leftIndex].MaxData"
  368. />
  369. <el-input
  370. class="min-data-input"
  371. size="mini"
  372. type="number"
  373. placeholder="下限"
  374. v-model="tableData[leftIndex].MinData"
  375. />
  376. </div>
  377. <div
  378. class="range-cont right"
  379. v-if="rightIndex != -1"
  380. >
  381. <el-input
  382. style="width: 60px; display: block"
  383. size="mini"
  384. type="number"
  385. placeholder="上限"
  386. v-model="tableData[rightIndex].MaxData"
  387. />
  388. <el-input
  389. class="min-data-input"
  390. size="mini"
  391. type="number"
  392. placeholder="下限"
  393. v-model="tableData[rightIndex].MinData"
  394. />
  395. </div>
  396. <!-- 右2上下限设置 -->
  397. <div class="range-cont rightTwo" v-if="rightTwoIndex != -1">
  398. <el-input
  399. style="width: 60px; display: block"
  400. size="mini"
  401. type="number"
  402. placeholder="上限"
  403. v-model="tableData[rightTwoIndex].MaxData"
  404. />
  405. <el-input
  406. class="min-data-input"
  407. size="mini"
  408. type="number"
  409. placeholder="下限"
  410. v-model="tableData[rightTwoIndex].MinData"
  411. />
  412. </div>
  413. <!-- 后续新图专用上下限 和其他数据依赖不公用 柱形图 截面散点-->
  414. <template v-if="[7,10].includes(chartInfo.ChartType)">
  415. <div class="range-cont left">
  416. <el-input
  417. style="width: 60px; display: block"
  418. size="mini"
  419. type="number"
  420. placeholder="上限"
  421. v-model="chartLimit.max"
  422. @change="changeLimit"
  423. />
  424. <el-input
  425. class="min-data-input"
  426. size="mini"
  427. type="number"
  428. placeholder="下限"
  429. v-model="chartLimit.min"
  430. @change="changeLimit"
  431. />
  432. </div>
  433. <!-- x轴上下限 -->
  434. <div class="range-cont bottom" v-if="chartLimit.x_min||chartLimit.x_max">
  435. <el-input
  436. class="left"
  437. size="mini"
  438. type="number"
  439. placeholder="下限"
  440. v-model="chartLimit.x_min"
  441. @change="changeLimit"
  442. />
  443. <el-input
  444. class="left"
  445. size="mini"
  446. type="number"
  447. placeholder="上限"
  448. v-model="chartLimit.x_max"
  449. @change="changeLimit"
  450. />
  451. </div>
  452. </template>
  453. </div>
  454. <span class="chart-author"
  455. >作者:{{ chartInfo.SysUserRealName || '' }}</span
  456. >
  457. <!-- 公历农历切换 只用于季节性图 -->
  458. <el-radio-group
  459. v-model="calendar_type"
  460. class="calendar-cont"
  461. v-if="chartInfo.ChartType === 2"
  462. @change="getPreviewChartInfo"
  463. >
  464. <el-radio-button label="公历" />
  465. <el-radio-button label="农历" />
  466. </el-radio-group>
  467. </div>
  468. <!-- 异常显示 -->
  469. <p class="error-tip" style="min-height: 400px;" v-if="chartInfo.WarnMsg">{{chartInfo.WarnMsg}}</p>
  470. </el-col>
  471. <el-col :span="3" style="position: absolute;height: 100%;right: 0;">
  472. <ul class="right-actions">
  473. <li>操作</li>
  474. <li
  475. v-permission="permissionBtn.chartLibPermission.chartLib_share"
  476. class="span-item shareLink"
  477. @click="copyChartConfirm('url')"
  478. :data-clipboard-text="linkUrl"
  479. v-if="!chartInfo.Disabled"
  480. >
  481. <i class="el-icon-share"/>&nbsp;分享
  482. </li>
  483. <li
  484. v-permission="permissionBtn.chartLibPermission.chartLib_addMy"
  485. class="span-item"
  486. @click="addMychartHandle(chartInfo)"
  487. >
  488. <img
  489. :src="$icons.chart_join_ico"
  490. alt=""
  491. style="width: 13px; height: 12px; vertical-align: middle"
  492. />加入我的图库
  493. </li>
  494. <li v-permission="permissionBtn.chartLibPermission.chartLib_refresh"
  495. class="span-item" @click="refreshHandle">
  496. <span><i class="el-icon-refresh" style="margin-left:0"/>&nbsp;刷新 </span>
  497. </li>
  498. <li v-permission="permissionBtn.chartLibPermission.chartLib_save"
  499. class="span-item"
  500. >
  501. <span @click="saveChartHandle('')">
  502. <i class="el-icon-collection" />&nbsp;保存
  503. </span>
  504. </li>
  505. <li v-permission="permissionBtn.chartLibPermission.chartLib_otherSave"
  506. class="span-item"
  507. >
  508. <span @click="saveChartOtherHandle">
  509. <i class="el-icon-document-add" />&nbsp;另存为
  510. </span>
  511. </li>
  512. <li v-permission="permissionBtn.chartLibPermission.chartLib_edit"
  513. class="span-item"
  514. v-if="chartInfo.IsEdit"
  515. @click="editChartHandle"
  516. >
  517. <img
  518. src="~@/assets/img/set_m/edit.png"
  519. alt=""
  520. style="width: 13px; height: 12px;"
  521. />&nbsp;编辑
  522. </li>
  523. <li v-permission="permissionBtn.chartLibPermission.chartLib_copyOffice"
  524. class="span-item copy"
  525. @click="copyChartConfirm('office')"
  526. v-if="!chartInfo.Disabled"
  527. >
  528. <i class="el-icon-document-copy" />&nbsp;复制至office
  529. </li>
  530. <li v-permission="permissionBtn.chartLibPermission.chartLib_copyWechat"
  531. class="span-item copy"
  532. @click="copyChartConfirm('微信')"
  533. v-if="!chartInfo.Disabled"
  534. >
  535. <img style="width: 13px; height: 12px;vertical-align: middle" src="~@/assets/img/chart_m/WeChat.jpg" />&nbsp;复制至微信
  536. </li>
  537. <li v-permission="permissionBtn.chartLibPermission.chartLib_enNameSetting"
  538. class="span-item copy"
  539. @click="openEnNameDia"
  540. >
  541. <img style="width: 16px;vertical-align: middle" :src="$icons.to_en" />&nbsp;设置英文名称
  542. </li>
  543. <li v-permission="permissionBtn.chartLibPermission.chartLib_del"
  544. class="span-item"
  545. style="color: #ff4040"
  546. @click="delChartHandle"
  547. v-if="chartInfo.IsEdit"
  548. >
  549. <i class="el-icon-delete" style="color: #ff4040" />&nbsp;删除
  550. </li>
  551. </ul>
  552. </el-col>
  553. </el-row>
  554. <el-table
  555. :data="tableData"
  556. ref="tableRef"
  557. highlight-current-row
  558. border
  559. >
  560. <el-table-column
  561. v-for="item in tableColums"
  562. :key="item.label"
  563. :label="item.label"
  564. :width="item.widthsty"
  565. :min-width="item.minwidthsty"
  566. align="center"
  567. >
  568. <template slot-scope="scope">
  569. <span v-if="item.key==='SourceName'">
  570. {{scope.row[item.key]}}
  571. <i
  572. class="el-icon-tickets"
  573. style="color:#409EFF;font-size:18px"
  574. @click="isLookHistory=true;lookEdbId=scope.row.EdbInfoId"
  575. v-if="scope.row.EdbType===2"
  576. />
  577. </span>
  578. <span v-else>{{ currentLang==='en' ? (scope.row[item.enKey]||scope.row[item.key]) : scope.row[item.key] }}</span>
  579. </template>
  580. </el-table-column>
  581. <el-table-column
  582. label="操作"
  583. key="Copy"
  584. align="center"
  585. width="110"
  586. >
  587. <template slot-scope="scope">
  588. <span v-permission="permissionBtn.chartLibPermission.chartLib_copyData"
  589. class="editsty" @click="copyCode(scope.row)">
  590. <i class="el-icon-document-copy" />&nbsp;复制数据</span
  591. >
  592. <span v-permission="permissionBtn.chartLibPermission.chartLib_viewData"
  593. class="editsty"
  594. @click="viewTarget(scope.row)"
  595. >查看数据</span>
  596. </template>
  597. </el-table-column>
  598. <div slot="empty">
  599. <tableNoData text="暂无指标" size="mini"/>
  600. </div>
  601. </el-table>
  602. </div>
  603. </div>
  604. <!-- ==============图表列表展示============= -->
  605. <div class="chart-public-cont" v-else>
  606. <span>共{{ public_total }}张图表</span>
  607. <div
  608. class="chart-public-list"
  609. ref="listChartPage"
  610. @scroll="loadMorePublicChart"
  611. >
  612. <el-col
  613. :span="6"
  614. style="margin-bottom: 20px; padding-right: 20px"
  615. v-for="chart in chartPublicList"
  616. :key="chart.ChartInfoId"
  617. >
  618. <el-card class="public-chart-item">
  619. <div slot="header" class="item-top" style="position: relative;">
  620. <div class="chartEn-mark" v-show="chart.IsEnChart" style="top: -10px;left:-10px;">En</div>
  621. <span class="text_oneLine" :style="{'padding-left':chart.IsEnChart?'24px':''}">{{ currentLang === 'en' ? (chart.ChartNameEn||chart.ChartName) : chart.ChartName }}</span>
  622. </div>
  623. <img
  624. :src="chart.ChartImage"
  625. alt=""
  626. class="chart-img"
  627. @click="detailShowHandle(chart)"
  628. />
  629. <div class="item-bottom">
  630. <span>创建时间: {{ chart.CreateTime.slice(0,10) }}</span>
  631. <span v-permission="permissionBtn.chartLibPermission.chartLib_addMy"
  632. class="join_txt"
  633. @click="addMychartHandle(chart)"
  634. >
  635. <img
  636. :src="$icons.chart_join_ico"
  637. alt=""
  638. style="width: 13px; height: 12px; vertical-align: middle"
  639. />
  640. 加入我的图库
  641. </span>
  642. </div>
  643. </el-card>
  644. </el-col>
  645. </div>
  646. <div v-if="!public_total" class="nodata">
  647. <tableNoData text="暂无图表"/>
  648. </div>
  649. </div>
  650. </div>
  651. <img :src="drawImg" alt="" class="drawImg" />
  652. </div>
  653. </div>
  654. <!-- 目录弹窗 -->
  655. <chartDialog
  656. :isOpenDialog="isOpenDialog"
  657. :title="dialog_title"
  658. :formData="dialogForm"
  659. @closeDia="isOpenDialog = false"
  660. @sucessCallback="sucessCallback"
  661. />
  662. <!-- 日期端选择弹窗 -->
  663. <DateChooseDia
  664. :isDateDia="isDateDia"
  665. :dateForm="dateForm"
  666. :earliestDate="earliestDate"
  667. @cancel="isDateDia = false"
  668. @dateBack="dataChangeBack"
  669. />
  670. <!-- 加入我的图库弹窗 -->
  671. <addMyClassifyDia
  672. :isAddMyDialog="isAddMyChart"
  673. :add_id="add_chart_id"
  674. :add_ids="add_ids"
  675. @cancel="isAddMyChart = false"
  676. @addSuccess="addMySuccess"
  677. />
  678. <!-- 图表另存 -->
  679. <SaveChartOther
  680. :show.sync="isShowSaveOther"
  681. fromType="chartsetting"
  682. :data="chartInfo"
  683. @ensure="getTreeData"
  684. />
  685. <!-- 输入英文指标弹窗 -->
  686. <set-en-name-dia
  687. :isOpenDialog="setEnName"
  688. @cancel="setEnName=false"
  689. @updateEnName="updateEnName"
  690. :formData="formItemArray"
  691. :chartType="chartInfo.ChartType"
  692. :datainfo="chartInfo.ChartType===10?JSON.parse(chartInfo.ExtraConfig):null"
  693. :edblist="chartInfo.ChartType===10?tableData:[]"
  694. />
  695. <!-- 指标历史记录 -->
  696. <edbHistoryDialog
  697. :isOpenDialog.sync="isLookHistory"
  698. :edbId="lookEdbId"
  699. />
  700. </div>
  701. </template>
  702. <script>
  703. import html2canvas from 'html2canvas';
  704. import { dataBaseInterface, mychartInterface } from '@/api/api.js';
  705. import {
  706. copyOtherOptions
  707. } from '@/utils/defaultOptions';
  708. import { chartSetMixin } from './mixins/chartPublic'
  709. import mPage from '@/components/mPage';
  710. import Chart from './components/chart';
  711. import chartDialog from './components/chartDialog';
  712. import DateChooseDia from './components/DateChooseDia';
  713. import addMyClassifyDia from './components/addMyClassifyDia';
  714. import SaveChartOther from './components/SaveChartOther';
  715. import changeLang from "./components/changeLang.vue"
  716. import setEnNameDia from "./components/setEnNameDia.vue"
  717. import EdbLabelList from '../../components/edbLabelList.vue';
  718. export default {
  719. name: '',
  720. components: {
  721. mPage,
  722. chartDialog,
  723. Chart,
  724. DateChooseDia,
  725. addMyClassifyDia,
  726. SaveChartOther,
  727. changeLang,
  728. setEnNameDia,
  729. EdbLabelList
  730. },
  731. directives: {
  732. drag(el, bindings) {
  733. el.onmousedown = function (e) {
  734. var init = e.clientX;
  735. // console.log(init);
  736. var box = $('#box')[0];
  737. // console.log(box.clientWidth)
  738. let total_wid = box.offsetWidth;
  739. var left = $('#left')[0];
  740. var right = $('#right')[0];
  741. var initWidth = left.offsetWidth;
  742. document.onmousemove = function (e) {
  743. var end = e.clientX;
  744. var newWidth = end - init + initWidth;
  745. left.style.width = newWidth + 'px';
  746. right.style.width = newWidth > 300 ? total_wid - newWidth + 'px' : total_wid - 320 + 'px';
  747. };
  748. document.onmouseup = function () {
  749. document.onmousemove = document.onmouseup = null;
  750. e.releaseCapture && e.releaseCapture();
  751. };
  752. e.setCapture && e.setCapture();
  753. return false;
  754. };
  755. },
  756. },
  757. mixins: [chartSetMixin],
  758. data() {
  759. return {
  760. showData: false,
  761. treeData: [], //树数据
  762. defaultShowNodes: [], //展开节点
  763. defaultProp: {
  764. label: 'ChartClassifyName',
  765. children: 'Children',
  766. isLeaf:'isLeaf'
  767. }, //树结构配置项
  768. loading: null,
  769. selected_chartid: '', //当前选中的图表id
  770. selected_chartClassify: '', //当前选中的图表所属分类
  771. new_label: '', //新的节点label值
  772. select_node: '', //当前选中的节点
  773. /* 右侧 */
  774. chartInfo: {}, //图表信息
  775. search_txt: '', //搜索词
  776. searchOptions: [], //搜索到的图表列表
  777. expandKey: [], //展开数组
  778. /* 新增编辑目录弹窗 */
  779. isOpenDialog: false,
  780. dialog_title: '',
  781. dialogForm: {
  782. level: '',
  783. },
  784. drawImg: '',
  785. dynamicWidth: '',
  786. /* 季节性图 */
  787. season_year: '', //显示的年份
  788. selected_chartType: '', //选择的图表类型 获取图表信息时用
  789. calendar_type: '公历',
  790. isSlideLeft: false,
  791. dynamicNode: null, //当前选中的node对象 用于拖动宽度时动态改变label宽度
  792. /* 公共图库列表展示 */
  793. isShowPublicChart: false,
  794. publicHaveMove: true, // 是否还有下一页
  795. default_classify: '',
  796. public_page_no: 1,
  797. public_page_size: 12,
  798. public_total: 0,
  799. chartPublicList: [],
  800. isAddMyChart: false, //加入图库弹窗
  801. add_chart_id: 0, //要加入的图表
  802. /* 左侧更改目录和坐标轴切换 */
  803. leftShowLabel: '目录',
  804. add_ids:[],//加入时已有的分类
  805. // 只看我的?
  806. isOnlyMe:false,
  807. search_page: 1,
  808. search_have_more: false,
  809. current_search:'',
  810. /* 查看历史弹窗 */
  811. isLookHistory: false,
  812. lookEdbId: 0,
  813. labelList:[],//标签列表
  814. CanOpClassify: false,//添加分类按钮控制
  815. };
  816. },
  817. watch: {
  818. /* 设置动态右侧区域宽度 */
  819. isSlideLeft(newval) {
  820. if (!newval) {
  821. this.$nextTick(() => {
  822. this.reloadRightWid();
  823. });
  824. }
  825. },
  826. // 公用图库关联分类
  827. default_classify(newval) {
  828. //重置滚动高度 防止触底加载
  829. if(this.$refs.listChartPage) this.$refs.listChartPage.scrollTop = 0;
  830. if (newval) {
  831. this.public_page_no = 1;
  832. this.getPublicChartList();
  833. }
  834. },
  835. selected_chartid(newval) {
  836. if (!newval) {
  837. this.year_select = this.yearSelector[0].value;
  838. this.calendar_type = '公历';
  839. this.season_year = '';
  840. this.tableData = [];
  841. this.chartInfo = {};
  842. } else {
  843. sessionStorage.removeItem('beforeOptions');
  844. newval && this.getChartDetail();
  845. this.formItemArray=[]
  846. }
  847. },
  848. /* 选中搜索图表 展开目录 选中图表 展示图表 */
  849. search_txt(newval) {
  850. if (newval) {
  851. let [search_obj] = this.searchOptions.filter(
  852. (item) => item.ChartInfoId === newval
  853. );
  854. // 查找图表的父级id
  855. let arr = this.findParentNodeHandle(this.treeData,search_obj.ChartClassifyId);
  856. this.defaultShowNodes = arr;
  857. this.select_node = search_obj.UniqueCode;
  858. this.selected_chartClassify = search_obj.ChartClassifyId; //图表所属分类
  859. this.year_select = search_obj.DateType; //年份选择
  860. this.calendar_type = search_obj.Calendar || '公历'; //公历/农历
  861. this.season_year = [
  862. search_obj.SeasonStartDate,
  863. search_obj.SeasonEndDate,
  864. ]; //季节年份区间
  865. this.select_date = [search_obj.StartDate, search_obj.EndDate];
  866. this.selected_chartType = search_obj.ChartType; //图表类型
  867. this.selected_chartid = newval;
  868. //滚动到高亮节点位置
  869. setTimeout(() => {
  870. this.$refs.treeRef.setCurrentKey(this.select_node);
  871. let node = document.getElementById(`node${this.select_node}`);
  872. let parent = document.getElementsByClassName('tree-cont')[0];
  873. if(node.offsetTop > parent.offsetHeight) {
  874. parent.scrollTop = node.offsetTop - parent.offsetHeight/2
  875. }
  876. },400)
  877. }
  878. },
  879. tableData: {
  880. handler(newval, oldval) {
  881. newval.length && !this.chartInfo.WarnMsg && this.setChartOptionHandle(newval);
  882. },
  883. deep: true,
  884. },
  885. },
  886. computed: {
  887. role() {
  888. let role = localStorage.getItem('Role') || '';
  889. if (['rai_researcher', 'ficc_researcher', 'researcher','ficc_seller','rai_seller','seller'].includes(role)) {
  890. return 'researcher';
  891. } else if (['rai_admin', 'ficc_admin'].includes(role)) {
  892. return 'admin';
  893. } else {
  894. return role;
  895. }
  896. },
  897. /* 登录角色id */
  898. roleId() {
  899. let id = parseInt(localStorage.getItem('AdminId'));
  900. return id;
  901. },
  902. //登录角色姓名
  903. roleName() {
  904. let name = localStorage.getItem('userName') || '';
  905. return name;
  906. },
  907. //禁用条件
  908. isDisabled() {
  909. if (
  910. this.selected_chartid &&
  911. this.role !== 'admin' &&
  912. this.chartInfo.SysUserId !== this.roleId
  913. ) {
  914. return true;
  915. } else {
  916. return false;
  917. }
  918. },
  919. /* 分享地址 */
  920. linkUrl() {
  921. const LINK_CHART_URL = this.$setting.dynamicOutLinks.ChartViewUrl+'/chartshow';
  922. return `${LINK_CHART_URL}?code=${this.chartInfo.UniqueCode}&fromType=share&lang=${this.currentLang}`
  923. }
  924. },
  925. methods: {
  926. getTreeData(params) {
  927. // dataBaseInterface.chartTree({IsShowMe:this.isOnlyMe}).then((res) => {
  928. dataBaseInterface.chartClassify({IsShowMe:this.isOnlyMe}).then((res) => {
  929. if (res.Ret === 200) {
  930. this.showData = true;
  931. this.currentLang = res.Data.Language === 'EN' ? 'en' : 'ch';
  932. this.setLangIntoStore();
  933. const arr=res.Data.AllNodes || [];
  934. this.treeData = arr.map(item=>{
  935. return {
  936. ...item,
  937. isLeaf:item.Children.length?false:true
  938. }
  939. })
  940. this.CanOpClassify = res.Data.CanOpClassify;
  941. this.$nextTick(() => {
  942. /* 新增完成后 处理树展开和选中图表 */
  943. params && this.selectCurrentNode(params);
  944. });
  945. }
  946. });
  947. },
  948. /* 节点变化时 */
  949. nodeChange(data, node) {
  950. this.search_txt = '';
  951. this.dynamicNode = node;
  952. sessionStorage.removeItem('beforeOptions');
  953. //详情时判断是否是本人添加图表 若不是不用做保存校验 新增时要进入保存校验逻辑
  954. if (
  955. (this.selected_chartid &&
  956. (this.role === 'admin' ||
  957. this.chartInfo.SysUserId === this.roleId)) ||
  958. !this.chartInfo.SysUserId
  959. ) {
  960. let arr = sessionStorage.getItem('defaultArr');
  961. if (
  962. arr &&
  963. this.selected_chartid &&
  964. arr !== JSON.stringify(this.tableData)
  965. ) {
  966. this.$confirm('您还未保存此图表,是否确认保存?', '提示', {
  967. confirmButtonText: '确定',
  968. cancelButtonText: '取消',
  969. type: 'warning',
  970. showClose: false,
  971. closeOnClickModal: false,
  972. })
  973. .then(() => {
  974. this.saveChartHandle('');
  975. })
  976. .catch(() => {
  977. this.select_node = data.UniqueCode;
  978. this.selected_chartid = data.ChartInfoId;
  979. this.selected_chartType = data.ChartType;
  980. this.selected_chartClassify = data.ChartInfoId
  981. ? data.ChartClassifyId
  982. : '';
  983. this.calendar_type = data.ChartInfoId ? data.Calendar : '公历'; //公历/农历
  984. this.season_year = data.ChartInfoId
  985. ? [data.SeasonStartDate, data.SeasonEndDate]
  986. : ''; //季节年份区间
  987. this.year_select = data.ChartInfoId ? data.DateType : this.yearSelector[0].value; //图表年份选择
  988. this.select_date =
  989. this.year_select === 5 || this.year_select === 6
  990. ? [data.StartDate, data.EndDate]
  991. : '';
  992. this.resetNodeStyle(node);
  993. this.tableData =
  994. !this.selected_chartClassify && this.tableData.length
  995. ? []
  996. : this.tableData;
  997. });
  998. return;
  999. }
  1000. }
  1001. this.select_node = data.UniqueCode;
  1002. this.selected_chartid = data.ChartInfoId;
  1003. this.selected_chartType = data.ChartType;
  1004. this.selected_chartClassify = data.ChartInfoId
  1005. ? data.ChartClassifyId
  1006. : '';
  1007. this.calendar_type = data.ChartInfoId ? data.Calendar : '公历'; //公历/农历
  1008. this.season_year = data.ChartInfoId
  1009. ? [data.SeasonStartDate, data.SeasonEndDate]
  1010. : ''; //季节年份区间
  1011. this.year_select = data.ChartInfoId ? data.DateType : this.yearSelector[0].value; //图表年份选择
  1012. this.select_date =
  1013. this.year_select === 5 || this.year_select === 6
  1014. ? [data.StartDate, data.EndDate]
  1015. : '';
  1016. this.resetNodeStyle(node);
  1017. this.tableData =
  1018. !this.selected_chartClassify && this.tableData.length
  1019. ? []
  1020. : this.tableData;
  1021. //公用图库关联分类
  1022. this.default_classify = !data.ChartInfoId ? data.ChartClassifyId : '';
  1023. },
  1024. resetNodeStyle: _.debounce(function (node) {
  1025. const tree = $('.target_tree')[0];
  1026. let width = tree.offsetWidth;
  1027. let label_wid = width > 500 ? 'auto' : width <= 250 ? 80 : 0.4 * width;
  1028. this.$set(node, 'Nodewidth', label_wid + 'px');
  1029. }, 300),
  1030. /* 双击label出现input修改框 */
  1031. editNodeLabel(node, data) {
  1032. //目录名称可以双击修改 指标不能
  1033. if (!data.ChartInfoId && data.Button.OpButton) {
  1034. this.$set(data, 'isEdit', true);
  1035. this.new_label = data.ChartClassifyName;
  1036. this.$nextTick(() => {
  1037. this.$refs.editVal.focus();
  1038. });
  1039. }
  1040. },
  1041. /* input失去焦点恢复node 修改最新的值*/
  1042. changeValue(node, data) {
  1043. if (this.new_label) {
  1044. this.$set(data, 'isEdit', false);
  1045. this.new_label !== data.ChartClassifyName &&
  1046. dataBaseInterface
  1047. .editChartClassify({
  1048. ChartClassifyId: data.ChartClassifyId,
  1049. ChartClassifyName: this.new_label,
  1050. })
  1051. .then((res) => {
  1052. if (res.Ret === 200) {
  1053. this.getTreeData();
  1054. }
  1055. });
  1056. } else {
  1057. this.$message.warning('名称不能为空');
  1058. }
  1059. },
  1060. // 只看我的 复选框改变事件
  1061. onlyMeHandler(){
  1062. this.getTreeData();
  1063. this.getPublicChartList()
  1064. },
  1065. /* 添加一级目录 */
  1066. addLevelOneHandle() {
  1067. this.dialog_title = '添加';
  1068. this.dialogForm = {
  1069. level_1: '',
  1070. parent_id: '',
  1071. level: 0,
  1072. };
  1073. this.isOpenDialog = true;
  1074. },
  1075. /* 添加节点 */
  1076. addNode(node, data) {
  1077. this.dialog_title = '添加';
  1078. /* 添加目录 */
  1079. this.dialogForm = {
  1080. level_1:
  1081. node.level === 1
  1082. ? data.ChartClassifyName
  1083. : node.level === 2
  1084. ? node.parent.data.ChartClassifyName
  1085. : node.parent.parent.data.ChartClassifyName,
  1086. level_2:
  1087. node.level === 1
  1088. ? ''
  1089. : node.level === 2
  1090. ? data.ChartClassifyName
  1091. : node.parent.data.ChartClassifyName,
  1092. // level_3: node.level === 3 ? data.ChartClassifyName : '',
  1093. parent_id: data.ChartClassifyId,
  1094. level: node.level,
  1095. };
  1096. this.isOpenDialog = true;
  1097. //存储当前要新增子级的目录code
  1098. sessionStorage.setItem('expandCode', data.UniqueCode);
  1099. },
  1100. /* 编辑节点 */
  1101. editNode(node, data) {
  1102. this.dialog_title = '编辑';
  1103. /* 编辑目录 */
  1104. this.dialogForm = {
  1105. level_1:
  1106. node.level === 1
  1107. ? data.ChartClassifyName
  1108. : node.level === 2
  1109. ? node.parent.data.ChartClassifyName
  1110. : node.parent.parent.data.ChartClassifyName,
  1111. level_2:
  1112. node.level === 1
  1113. ? ''
  1114. : node.level === 2
  1115. ? data.ChartClassifyName
  1116. : node.parent.data.ChartClassifyName,
  1117. level_3: node.level === 3 ? data.ChartClassifyName : '',
  1118. classify_id: data.ChartClassifyId,
  1119. level: node.level,
  1120. };
  1121. this.isOpenDialog = true;
  1122. },
  1123. /* 删除节点校验 */
  1124. removeNode(node, data) {
  1125. dataBaseInterface
  1126. .delChartCheck({
  1127. ChartClassifyId: data.ChartClassifyId,
  1128. ChartInfoId: data.ChartInfoId,
  1129. })
  1130. .then((res) => {
  1131. if (res.Ret === 200) {
  1132. /**
  1133. * 0 可删除
  1134. * 1 关联图表一
  1135. * 2 有子目录无图表
  1136. */
  1137. const deleteLabelMap = {
  1138. 1: '该分类下关联图表不可删除',
  1139. 2: '确认删除当前分类及包含的子分类吗?',
  1140. 4: res.Data.TipsMsg
  1141. }
  1142. if([1,4].includes(res.Data.DeleteStatus)) this.$confirm(
  1143. deleteLabelMap[res.Data.DeleteStatus],
  1144. '删除失败',
  1145. {
  1146. confirmButtonText: '知道了',
  1147. showCancelButton:false,
  1148. type: 'error'
  1149. })
  1150. else if([0,2].includes(res.Data.DeleteStatus)) this.$confirm(
  1151. res.Data.DeleteStatus === 2
  1152. ? deleteLabelMap[res.Data.DeleteStatus]
  1153. : data.ChartInfoId?'删除后该图表将不能再引用,确认删除吗?':'确定删除当前分类吗?',
  1154. '提示',
  1155. {
  1156. confirmButtonText: '确定',
  1157. cancelButtonText: '取消',
  1158. type: 'warning'
  1159. }).then(() => {
  1160. res.Data.DeleteStatus === 0 && data.ChartInfoId
  1161. ? this.delHandle(data.ChartClassifyId, data.ChartInfoId, 1)
  1162. : this.delHandle(data.ChartClassifyId, data.ChartInfoId);
  1163. }).catch(() => {
  1164. });
  1165. }
  1166. });
  1167. },
  1168. /* 删除方法 */
  1169. delHandle(ChartClassifyId, ChartInfoId, type) {
  1170. dataBaseInterface
  1171. .delChartClassify({
  1172. ChartClassifyId,
  1173. ChartInfoId,
  1174. })
  1175. .then((res) => {
  1176. if (res.Ret === 200) {
  1177. this.$message.success(res.Msg);
  1178. const label = this.labelList.find(i=>i.id===ChartInfoId)
  1179. if (!res.Data.ChartInfoId) this.selected_chartid = '';
  1180. if(type && res.Data.ChartInfoId){
  1181. this.getTreeData({
  1182. code: res.Data.UniqueCode,
  1183. id: res.Data.ChartInfoId,
  1184. type: res.Data.ChartType,
  1185. })
  1186. label&&this.deleteLabel(label,'chart')
  1187. }else{
  1188. this.getTreeData();
  1189. label&&this.deleteLabel(label)
  1190. }
  1191. //如果router.query里的图表被删除,则清掉参数
  1192. if(Number(this.$route.query.id)===ChartInfoId){
  1193. this.$router.replace({path: '/chartsetting'})
  1194. }
  1195. }
  1196. });
  1197. },
  1198. /* 新增/编辑分类成功 */
  1199. sucessCallback(type) {
  1200. this.isOpenDialog = false;
  1201. this.getTreeData();
  1202. if (type === 'add') {
  1203. //新增分类完成之后,展开父节点显示刚新增的分类,若已展开节点则不做处理
  1204. let code = sessionStorage.getItem('expandCode');
  1205. let flag = this.defaultShowNodes.some((item) => {
  1206. return item === code;
  1207. });
  1208. // console.log(flag)
  1209. !flag && code && this.defaultShowNodes.push(code);
  1210. sessionStorage.removeItem('expandCode');
  1211. }
  1212. },
  1213. /* 判断节点是否能被拖拽 */
  1214. canDragHandle(node) {
  1215. let canMove = false;
  1216. if (node.data.Button.MoveButton) {
  1217. canMove = true;
  1218. }
  1219. return canMove;
  1220. },
  1221. /* 判断节点是否能被拖入 4*/
  1222. canDropHandle(draggingNode, dropNode, type) {
  1223. let canDrop = false;
  1224. // 移动的是一级目录
  1225. if(draggingNode.level===1&&dropNode.level===1&&type!=='inner') {
  1226. canDrop=true
  1227. }
  1228. // 二级目录
  1229. if(draggingNode.level===2){
  1230. if((dropNode.level===1&&type==='inner')||(dropNode.level===2&&type!=='inner')){
  1231. canDrop=true
  1232. }
  1233. }
  1234. //三级目录
  1235. if(draggingNode.level===3){
  1236. if((dropNode.level===2&&type==='inner')||(dropNode.level===3&&type!=='inner')){
  1237. canDrop=true
  1238. }
  1239. }
  1240. //四级指标层
  1241. if(draggingNode.level===4){
  1242. if((dropNode.level===3&&type==='inner')||(dropNode.level===4&&type!=='inner')){
  1243. canDrop=true
  1244. }
  1245. }
  1246. return canDrop;
  1247. },
  1248. /* 拖拽完成 */
  1249. dropOverHandle(b, a, i, e) {
  1250. // console.log(i, a);
  1251. // 被拖拽节点对应的 Node、结束拖拽时最后进入的节点、被拖拽节点的放置位置
  1252. // 一/二级目录
  1253. if (b.level === 1 || b.level === 2||b.level===3) {
  1254. this.handleMoveCatalogue(b, a, i, e)
  1255. }
  1256. // 指标层
  1257. if (b.level === 4) {
  1258. this.handleMoveChart(b, a, i, e)
  1259. }
  1260. },
  1261. // 移动的为一、二、三级目录
  1262. handleMoveCatalogue(b,a,i,e){
  1263. let list=a.parent.childNodes,targetIndex=0,PrevClassifyId=0,NextClassifyId=0,ParentClassifyId=0;
  1264. list.forEach((item,index)=>{
  1265. if(item.data.ChartClassifyId===b.data.ChartClassifyId){
  1266. targetIndex=index
  1267. return
  1268. }
  1269. })
  1270. if(targetIndex===0){
  1271. PrevClassifyId=0
  1272. NextClassifyId=list[targetIndex+1].data.ChartClassifyId
  1273. }else if(targetIndex===list.length-1){
  1274. PrevClassifyId=list[targetIndex-1].data.ChartClassifyId
  1275. NextClassifyId=0
  1276. }else{
  1277. PrevClassifyId=list[targetIndex-1].data.ChartClassifyId
  1278. NextClassifyId=list[targetIndex+1].data.ChartClassifyId
  1279. }
  1280. if(b.level===2){
  1281. if(i==='inner'){
  1282. ParentClassifyId=a.data.ChartClassifyId
  1283. PrevClassifyId=0
  1284. NextClassifyId=a.data.Children.length>1?a.data.Children[1].ChartClassifyId:0
  1285. }else{
  1286. ParentClassifyId=a.data.ParentId
  1287. }
  1288. }
  1289. if(b.level===3){
  1290. if(i==='inner'){
  1291. ParentClassifyId=a.data.ChartClassifyId
  1292. PrevClassifyId=0
  1293. NextClassifyId=a.data.Children.length>1?a.data.Children[1].ChartClassifyId:0
  1294. }else{
  1295. ParentClassifyId=a.data.ParentId
  1296. }
  1297. }
  1298. dataBaseInterface.chartClassifyMove({
  1299. ClassifyId: b.data.ChartClassifyId,
  1300. ParentClassifyId: ParentClassifyId,
  1301. PrevClassifyId: PrevClassifyId,
  1302. NextClassifyId:NextClassifyId
  1303. }).then((res) => {
  1304. if (res.Ret === 200) {
  1305. this.$message.success('移动成功!');
  1306. this.getTreeData();
  1307. }
  1308. });
  1309. },
  1310. // 移动的为指标层 四级
  1311. handleMoveChart(b,a,i,e){
  1312. let PrevChartInfoId=0,NextChartInfoId=0,targetIndex=0, list=a.parent.childNodes.map(_ => _.data)
  1313. if(i==='inner'){
  1314. PrevChartInfoId=0
  1315. NextChartInfoId=a.data.Children.length>1?a.data.Children[1].ChartInfoId:0
  1316. }else{
  1317. list.forEach((item,index)=>{
  1318. if(item.ChartInfoId===b.data.ChartInfoId){
  1319. targetIndex=index
  1320. return
  1321. }
  1322. })
  1323. if(targetIndex===0){
  1324. PrevChartInfoId=0
  1325. NextChartInfoId=list[targetIndex+1].ChartInfoId
  1326. }else if(targetIndex===list.length-1){
  1327. PrevChartInfoId=list[targetIndex-1].ChartInfoId
  1328. NextChartInfoId=0
  1329. }else{
  1330. PrevChartInfoId=list[targetIndex-1].ChartInfoId
  1331. NextChartInfoId=list[targetIndex+1].ChartInfoId
  1332. }
  1333. }
  1334. dataBaseInterface.chartMove({
  1335. ChartClassifyId: a.data.ChartClassifyId,
  1336. ChartInfoId: b.data.ChartInfoId,
  1337. PrevChartInfoId: PrevChartInfoId,
  1338. NextChartInfoId:NextChartInfoId
  1339. }).then((res) => {
  1340. if (res.Ret === 200) {
  1341. this.$message.success('移动成功!');
  1342. }
  1343. this.getTreeData();
  1344. });
  1345. },
  1346. /* 拖拽覆盖添加背景色 */
  1347. dropMouseOver(node1, node2, e) {
  1348. if (
  1349. ((node1.level === 2 && node2.level === 1) ||
  1350. (node1.level === 3 && node2.level === 2)) &&
  1351. (e.target.childNodes[0].className.includes('el-tree-node__content') ||
  1352. e.target.className.includes('el-tree-node__content'))
  1353. ) {
  1354. // console.log(e.target.childNodes[0])
  1355. e.target.childNodes[0].className.includes('el-tree-node__content')
  1356. ? (e.target.childNodes[0].style.backgroundColor = '#409eff')
  1357. : (e.target.style.backgroundColor = '#409eff');
  1358. }
  1359. // if (
  1360. // node2.level === 2 &&
  1361. // (e.target.childNodes[0].className.includes(
  1362. // 'el-tree-node__content'
  1363. // ) ||
  1364. // e.target.className.includes('el-tree-node__content'))
  1365. // ) {
  1366. // e.target.childNodes[0].className.includes('el-tree-node__content')
  1367. // ? (e.target.childNodes[0].style.backgroundColor = '#409eff')
  1368. // : (e.target.style.backgroundColor = '#409eff');
  1369. // }
  1370. },
  1371. /* 拖拽离开/拖拽完成重置背景色 */
  1372. dropMouseLeave(node1, node2, e) {
  1373. let arrs = $('.el-tree-node__content');
  1374. for (let a of arrs) {
  1375. a.style.backgroundColor = 'transparent';
  1376. }
  1377. },
  1378. // 树节点展开
  1379. handleNodeExpand(data) {
  1380. // 保存当前展开的节点
  1381. let flag = false;
  1382. this.defaultShowNodes.some((item) => {
  1383. if (item === data.UniqueCode) {
  1384. // 判断当前节点是否存在, 存在不做处理
  1385. flag = true;
  1386. return true;
  1387. }
  1388. });
  1389. if (!flag) {
  1390. // 不存在则存到数组里
  1391. this.defaultShowNodes.push(data.UniqueCode);
  1392. }
  1393. },
  1394. // 树节点关闭
  1395. handleNodeCollapse(data) {
  1396. this.defaultShowNodes.some((item, index) => {
  1397. if (item === data.UniqueCode) {
  1398. // 删除关闭节点
  1399. this.defaultShowNodes.length = index;
  1400. }
  1401. });
  1402. // console.log(this.defaultShowNodes)
  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.getChartListForClassify({
  1420. ChartClassifyId:node.data.ChartClassifyId,
  1421. IsShowMe:this.isOnlyMe
  1422. }).then(res=>{
  1423. if(res.Ret===200){
  1424. let arr=res.Data.AllNodes||[]
  1425. arr=arr.map(item=>{
  1426. return {
  1427. ...item,
  1428. isLeaf:true
  1429. }
  1430. })
  1431. resolve(arr)
  1432. }else{
  1433. resolve([])
  1434. }
  1435. this.changeTreeNode()
  1436. })
  1437. }
  1438. if(node.level>2){
  1439. resolve([])
  1440. }
  1441. },
  1442. //绑定el-tree的load属性
  1443. getLazyTreeData (node,resolve,maxLevel=3){
  1444. if(node.level===0){
  1445. resolve(this.treeData)
  1446. }
  1447. if(node.level>0&&node.level<=maxLevel){
  1448. //获取对应层级的Child
  1449. resolve(node.data.Children||[])
  1450. }
  1451. if(node.level===maxLevel){
  1452. //调接口获取该分类下图表的数据
  1453. dataBaseInterface.getChartListForClassify({
  1454. ChartClassifyId:node.data.ChartClassifyId,
  1455. IsShowMe:this.isOnlyMe
  1456. }).then(res=>{
  1457. if(res.Ret===200){
  1458. let arr=res.Data.AllNodes||[]
  1459. arr=arr.map(item=>{
  1460. return {
  1461. ...item,
  1462. isLeaf:true
  1463. }
  1464. })
  1465. resolve(arr)
  1466. }else{
  1467. resolve([])
  1468. }
  1469. this.changeTreeNode()
  1470. })
  1471. }
  1472. if(node.level>maxLevel){
  1473. resolve([])
  1474. }
  1475. },
  1476. /* 获取图表详情 回显参数 */
  1477. async getChartDetail() {
  1478. const res = await dataBaseInterface.getChartInfoById({
  1479. ChartInfoId: this.selected_chartid
  1480. })
  1481. if (res.Ret !== 200) return;
  1482. this.chartInfo = res.Data.ChartInfo;
  1483. this.tableData = res.Data.EdbInfoList;
  1484. // 设置起始日期和最新日期
  1485. this.setExtremumDate()
  1486. this.setDefaultDateSelect(); //设置默认的日期选中
  1487. sessionStorage.setItem('defaultArr',JSON.stringify(res.Data.EdbInfoList));
  1488. const chartTypeMap = {
  1489. 7: this.initBarData, //柱形图
  1490. 10: this.initSectionScatterData //截面散点
  1491. }
  1492. chartTypeMap[this.chartInfo.ChartType] && chartTypeMap[this.chartInfo.ChartType](res.Data);
  1493. //将指标添加进标签列表中
  1494. const {ChartNameEn,ChartName,ChartInfoId,UniqueCode,ChartClassifyId}=res.Data.ChartInfo
  1495. this.addLabel({code:UniqueCode,id:ChartInfoId,classifyId:ChartClassifyId,EdbName:ChartName,EdbNameEn:ChartNameEn,chartData:res.Data.ChartInfo})
  1496. this.defaultShowNodes=this.findParentNodeHandle(this.treeData,ChartClassifyId)
  1497. this.changeTreeNode()
  1498. },
  1499. /* 设置默认时间选中项 */
  1500. setDefaultDateSelect() {
  1501. this.year_select = this.chartInfo.DateType;
  1502. this.select_date = [this.chartInfo.StartDate, this.chartInfo.EndDate];
  1503. this.calendar_type = this.chartInfo.Calendar; //日历类型
  1504. this.season_year = [
  1505. this.chartInfo.SeasonStartDate,
  1506. this.chartInfo.SeasonEndDate,
  1507. ];
  1508. this.dateTip =
  1509. this.chartInfo.DateType === 5
  1510. ? `${this.chartInfo.StartDate}~${this.chartInfo.EndDate}`
  1511. : this.chartInfo.DateType === 6
  1512. ? `${this.chartInfo.StartDate}~至今`
  1513. : '请选择时间段';
  1514. },
  1515. /* 获取图表详情信息 type为refresh刷新指标不存储时间 */
  1516. async getPreviewChartInfo(type) {
  1517. let params = {
  1518. ChartType: this.chartInfo.ChartType,
  1519. DateType: this.year_select,
  1520. StartDate: [5, 6].includes(this.year_select)
  1521. ? this.select_date[0]
  1522. : '',
  1523. EndDate: this.year_select === 5 ? this.select_date[1] : '',
  1524. Calendar: this.calendar_type,
  1525. SeasonStartDate: this.season_year ? this.season_year[0] : '',
  1526. SeasonEndDate: this.season_year ? this.season_year[1] : '',
  1527. ChartEdbInfoList: this.tableData.map(_ => ({
  1528. EdbInfoId: _.EdbInfoId,
  1529. EdbInfoType: _.EdbInfoType,
  1530. LeadValue: _.EdbInfoType ? 0 : Number(_.LeadValue),
  1531. LeadUnit: _.EdbInfoType ? '' : _.LeadUnit,
  1532. }))
  1533. }
  1534. const res = await dataBaseInterface.getSplinePreviewData(params)
  1535. if(res.Ret !== 200) return
  1536. const { EdbInfoList } = res.Data;
  1537. this.tableData.forEach((item) => {
  1538. let edbData = EdbInfoList.find(_ => _.EdbInfoId===item.EdbInfoId);
  1539. item.DataList = edbData.DataList;
  1540. if(edbData.EdbInfoCategoryType===1) item.MoveLatestDate = edbData.MoveLatestDate;
  1541. });
  1542. // // 判断图标类型 设置参数
  1543. // let params =
  1544. // this.sameOptionType.includes(this.selected_chartType)
  1545. // ? {
  1546. // ChartInfoId: this.selected_chartid,
  1547. // DateType: this.year_select,
  1548. // StartDate:
  1549. // this.year_select === 5 || this.year_select === 6
  1550. // ? this.select_date[0]
  1551. // : '',
  1552. // EndDate: this.year_select === 5 ? this.select_date[1] : '',
  1553. // }
  1554. // : {
  1555. // ChartInfoId: this.selected_chartid,
  1556. // Calendar: this.calendar_type,
  1557. // SeasonStartDate: this.season_year ? this.season_year[0] : '',
  1558. // SeasonEndDate: this.season_year ? this.season_year[1] : '',
  1559. // };
  1560. // dataBaseInterface.chartInfo(params).then((res) => {
  1561. // if (res.Ret === 200) {
  1562. // this.chartInfo = res.Data.ChartInfo;
  1563. // let beforeOptions = sessionStorage.getItem('beforeOptions')
  1564. // ? JSON.parse(sessionStorage.getItem('beforeOptions'))
  1565. // : '';
  1566. // //合并缓存配置和新的数据
  1567. // let newarr = res.Data.EdbInfoList.map((item, index) => {
  1568. // if (beforeOptions && type === 'refresh') {
  1569. // const DataList = item.DataList;
  1570. // return {
  1571. // ...beforeOptions[index],
  1572. // DataList,
  1573. // };
  1574. // } else {
  1575. // return item;
  1576. // }
  1577. // });
  1578. // this.tableData = newarr;
  1579. // // 刷新最新的指标数据 防止领先配置已保存 指标数据确实原数据的情况 针对正常图
  1580. // if (
  1581. // type === 'refresh' &&
  1582. // beforeOptions &&
  1583. // (this.sameOptionType.includes(this.chartInfo.ChartType) && this.chartInfo.ChartType!==5)
  1584. // )
  1585. // this.refreshTarget();
  1586. // sessionStorage.setItem(
  1587. // 'defaultArr',
  1588. // JSON.stringify(res.Data.EdbInfoList)
  1589. // );
  1590. // if (!type) {
  1591. // this.year_select = this.chartInfo.DateType;
  1592. // this.select_date = [
  1593. // this.chartInfo.StartDate,
  1594. // this.chartInfo.EndDate,
  1595. // ];
  1596. // this.calendar_type = this.chartInfo.Calendar; //日历类型
  1597. // // this.season_year = [ this.chartInfo.SeasonStartDate, this.chartInfo.SeasonEndDate ];
  1598. // this.dateTip =
  1599. // this.chartInfo.DateType === 5
  1600. // ? `${this.chartInfo.StartDate}~${this.chartInfo.EndDate}`
  1601. // : this.chartInfo.DateType === 6
  1602. // ? `${this.chartInfo.StartDate}~至今`
  1603. // : '请选择时间段';
  1604. // //新图表类型 依赖数据不同单独init 数据
  1605. // const typeInitMap = {
  1606. // 7: this.initBarData,
  1607. // 10: this.initSectionScatterData
  1608. // }
  1609. // typeInitMap[this.chartInfo.ChartType] && typeInitMap[this.chartInfo.ChartType](res.Data);
  1610. // }
  1611. // //将指标添加进标签列表中
  1612. // const {ChartNameEn,ChartName,ChartInfoId,UniqueCode,ChartClassifyId}=res.Data.ChartInfo
  1613. // this.addLabel({code:UniqueCode,id:ChartInfoId,classifyId:ChartClassifyId,EdbName:ChartName,EdbNameEn:ChartNameEn,chartData:res.Data.ChartInfo})
  1614. // this.defaultShowNodes=this.findParentNodeHandle(this.treeData,ChartClassifyId)
  1615. // this.changeTreeNode()
  1616. // }
  1617. // });
  1618. },
  1619. /* 搜索 */
  1620. searchHandle(query) {
  1621. this.search_page = 1;
  1622. this.current_search = query;
  1623. this.searchApi(this.current_search)
  1624. },
  1625. searchApi(query,page=1) {
  1626. /* 查找列表 */
  1627. dataBaseInterface
  1628. .chartSearchByEs({
  1629. Keyword: query,
  1630. IsShowMe:this.isOnlyMe,
  1631. CurrentIndex: page
  1632. })
  1633. .then((res) => {
  1634. if (res.Ret !== 200) return
  1635. const { List,Paging } = res.Data;
  1636. this.search_have_more = page < Paging.Pages;
  1637. this.searchOptions = page === 1 ? List : [...this.searchOptions,...List];
  1638. });
  1639. },
  1640. /* 聚焦获取当前检索 */
  1641. inputFocusHandle(e) {
  1642. this.search_page = 1;
  1643. this.current_search = e.target.value;
  1644. if(this.current_search) {
  1645. this.searchApi(this.current_search)
  1646. }else {
  1647. this.searchOptions = [];
  1648. }
  1649. },
  1650. searchLoad() {
  1651. if(!this.search_have_more) return;
  1652. this.searchApi(this.current_search,++this.search_page);
  1653. },
  1654. /* 保存当前图表配置 */
  1655. saveChartHandle: _.debounce(function () {
  1656. if (this.selected_chartid) {
  1657. //遍历每条线的指标配置
  1658. let arr = this.tableData.map((item) => {
  1659. return {
  1660. ChartColor: item.ChartColor,
  1661. PredictChartColor: item.PredictChartColor,
  1662. ChartStyle: item.ChartStyle,
  1663. ChartWidth: Number(item.ChartWidth),
  1664. EdbInfoId: item.EdbInfoId,
  1665. EdbInfoType: item.EdbInfoType,
  1666. IsAxis: item.IsAxis,
  1667. IsOrder: item.IsOrder,
  1668. LeadUnit: item.EdbInfoType ? '' : item.LeadUnit,
  1669. LeadValue: item.EdbInfoType ? 0 : Number(item.LeadValue),
  1670. MaxData: Number(item.MaxData),
  1671. MinData: Number(item.MinData),
  1672. };
  1673. });
  1674. let public_param = {
  1675. ChartClassifyId: this.selected_chartClassify,
  1676. ChartInfoId: this.selected_chartid || 0,
  1677. ChartEdbInfoList: arr,
  1678. }
  1679. let typeChartParam = {};
  1680. switch(this.chartInfo.ChartType) {
  1681. case 2:
  1682. typeChartParam = {
  1683. ...public_param,
  1684. Calendar: this.calendar_type,
  1685. SeasonStartDate: this.season_year ? this.season_year[0] : '',
  1686. SeasonEndDate: this.season_year ? this.season_year[1] : '',
  1687. }
  1688. break
  1689. case 7:
  1690. typeChartParam = {
  1691. ...public_param,
  1692. DateType: 6,
  1693. LeftMin: String(this.chartLimit.min),
  1694. LeftMax: String(this.chartLimit.max),
  1695. }
  1696. case 10:
  1697. typeChartParam = {
  1698. ...public_param,
  1699. DateType: 6,
  1700. Calendar: "公历",
  1701. ExtraConfig: JSON.stringify({
  1702. ...JSON.parse(this.chartInfo.ExtraConfig),
  1703. XMinValue: String(this.chartLimit.x_min),
  1704. XMaxValue: String(this.chartLimit.x_max),
  1705. YMinValue: String(this.chartLimit.min),
  1706. YMaxValue: String(this.chartLimit.max),
  1707. })
  1708. }
  1709. }
  1710. let params = this.sameOptionType.includes(this.selected_chartType)
  1711. ? {
  1712. ...public_param,
  1713. DateType: this.year_select,
  1714. StartDate:
  1715. this.year_select === 5 || this.year_select === 6
  1716. ? this.select_date[0]
  1717. : '',
  1718. EndDate: this.year_select === 5 ? this.select_date[1] : '',
  1719. }
  1720. : typeChartParam;
  1721. dataBaseInterface.chartSave(params).then((res) => {
  1722. if (res.Ret === 200) {
  1723. this.$message.success('保存成功');
  1724. sessionStorage.removeItem('beforeOptions');
  1725. sessionStorage.setItem(
  1726. 'defaultArr',
  1727. JSON.stringify(this.tableData)
  1728. );
  1729. this.getTreeData();
  1730. //关联图表和图片
  1731. this.setChartImage();
  1732. }
  1733. });
  1734. }
  1735. }, 500),
  1736. // 英文面板时候的判断
  1737. copyChartConfirm(type){
  1738. if(this.currentLang=='en'){
  1739. // 是否所有数据都填写完
  1740. let flag=true
  1741. // 是否有英文表格名称
  1742. if(!this.chartInfo.ChartNameEn) flag = false
  1743. if(flag){
  1744. for (const data of this.tableData) {
  1745. // 单位中文名为空时 英文名不做判断
  1746. if(data.EdbNameEn=="" || (data.UnitEn=="" && data.Unit!="")){
  1747. flag = false
  1748. break
  1749. }
  1750. }
  1751. }
  1752. if(!flag){
  1753. this.$confirm('英文名称未输入完整,分享图表上可能出现空名称的情况,确定继续分享吗?', '提示', {
  1754. confirmButtonText: '确定',
  1755. cancelButtonText: '取消',
  1756. type: 'warning',
  1757. })
  1758. .then(() => {
  1759. if(type==='url'){
  1760. // this.shareUrl()
  1761. const input = document.createElement('input')
  1762. input.setAttribute('readonly','readonly')
  1763. input.value = this.linkUrl
  1764. document.body.appendChild(input)
  1765. input.select();
  1766. document.execCommand('copy');
  1767. document.body.removeChild(input);
  1768. this.$message.success('复制链接成功')
  1769. }else{
  1770. this.copyChartHandle(type)
  1771. }
  1772. })
  1773. .catch(() => {});
  1774. }else{
  1775. if(type=='url'){
  1776. this.shareUrl()
  1777. }else{
  1778. this.copyChartHandle(type)
  1779. }
  1780. }
  1781. }else{
  1782. if(type=='url'){
  1783. this.shareUrl()
  1784. }else{
  1785. this.copyChartHandle(type)
  1786. }
  1787. }
  1788. },
  1789. /* 点击复制先用canvas画出 转成图片在放到粘贴板中 */
  1790. copyChartHandle:_.debounce(function(type){{
  1791. let chartsName = this.currentLang=='ch'?this.chartInfo.ChartName:this.chartInfo.ChartNameEn
  1792. let { heightNum, widthNum , newTitle , dynamic_copyOptions} = this.dynamicWidthAndHeight(type,this.chartInfo.ChartType,chartsName,this.chartInfo.Source === 1?this.tableData.length:this.commodityChartData.length)
  1793. const chartType = this.sameOptionType.includes(this.chartInfo.ChartType)?'legend':'seasonLegend'
  1794. // 英文转SVG设置变动
  1795. if(this.currentLang == 'en'){
  1796. // 散点图 如果横轴单位为'英文单位',表示客户没填,转成svg时置为空
  1797. if(this.chartInfo.ChartType == 5){
  1798. this.$refs.chartRef.chart.options.xAxis.forEach(it => {
  1799. if(it.title.text == '英文单位') it.title.text=''
  1800. });
  1801. }
  1802. // 如果竖轴坐标单位为'英文单位',表示客户没填,转成svg时置为空
  1803. this.$refs.chartRef.chart.options.yAxis.forEach(it => {
  1804. if(it.title.text == '英文单位') it.title.text=''
  1805. });
  1806. }
  1807. let svg = this.$refs.chartRef.chart.getSVG({
  1808. chart:{
  1809. width:widthNum,
  1810. height:heightNum,
  1811. backgroundColor:"rgba(255, 255, 255, 0)",
  1812. },
  1813. title: {
  1814. text: newTitle,
  1815. margin: 10,
  1816. style: {
  1817. fontSize: '18px'
  1818. }
  1819. },
  1820. legend:{
  1821. ...copyOtherOptions[chartType],
  1822. ...dynamic_copyOptions[chartType]
  1823. }
  1824. });
  1825. this.copyBlobItem(widthNum,heightNum,svg,type);
  1826. }
  1827. },500) ,
  1828. // 选择
  1829. getSelect(targetNode) {
  1830. if (window.getSelection) {
  1831. //chrome等主流浏览器
  1832. var selection = window.getSelection();
  1833. var range = document.createRange();
  1834. range.selectNode(targetNode);
  1835. selection.removeAllRanges();
  1836. selection.addRange(range);
  1837. } else if (document.body.createTextRange) {
  1838. //ie
  1839. var range = document.body.createTextRange();
  1840. range.moveToElementText(targetNode);
  1841. range.select();
  1842. }
  1843. },
  1844. /* 点击删除图表 */
  1845. delChartHandle() {
  1846. this.$confirm('删除后该图表将不能再引用,确认删除吗?', '提示', {
  1847. confirmButtonText: '确定',
  1848. cancelButtonText: '取消',
  1849. type: 'warning',
  1850. })
  1851. .then(() => {
  1852. this.delHandle(
  1853. this.selected_chartClassify || 0,
  1854. this.selected_chartid,
  1855. 1
  1856. );
  1857. })
  1858. .catch(() => {});
  1859. },
  1860. /* 图表未保存时更新图表数据 */
  1861. refreshTarget() {
  1862. for (let i in this.tableData) {
  1863. let params = {
  1864. EdbInfoId: this.tableData[i].EdbInfoId,
  1865. DateType: this.year_select,
  1866. StartDate:
  1867. this.year_select === 5 || this.year_select === 6
  1868. ? this.select_date[0]
  1869. : '',
  1870. EndDate: this.year_select === 5 ? this.select_date[1] : '',
  1871. EdbInfoType: this.tableData[i].EdbInfoType,
  1872. LeadValue: this.tableData[i].EdbInfoType
  1873. ? 0
  1874. : this.tableData[i].LeadValue,
  1875. LeadUnit: this.tableData[i].EdbInfoType
  1876. ? ''
  1877. : this.tableData[i].LeadUnit,
  1878. };
  1879. dataBaseInterface.edbinfoDetail(params).then((res) => {
  1880. if (res.Ret === 200) {
  1881. let newData = res.Data.EdbInfo;
  1882. this.tableData[i].DataList = newData.DataList;
  1883. if(newData.EdbInfoCategoryType===1) this.tableData[i].MoveLatestDate = newData.MoveLatestDate;
  1884. }
  1885. });
  1886. }
  1887. },
  1888. /* 年份改变 重新刷新图表接口 保存当前的图表配置和上下限 只改变图表 */
  1889. changeYear(item) {
  1890. this.year_select = item.value;
  1891. this.select_date = '';
  1892. this.dateTip = '请选择时间段';
  1893. //保存表格配置和上下限 曲线图需要保存表格配置 季节图就不用了
  1894. this.saveNowOptions();
  1895. // 图表已存在
  1896. this.selected_chartid && this.getPreviewChartInfo();
  1897. },
  1898. /* 打开时间段弹窗 */
  1899. openDateDia() {
  1900. // 自定义时间段回显
  1901. this.dateForm = {
  1902. date_type: this.year_select,
  1903. start_date:
  1904. this.year_select === 5 || this.year_select === 6
  1905. ? this.select_date[0]
  1906. : '',
  1907. end_date: this.year_select === 5 ? this.select_date[1] : '',
  1908. count_year: this.year_select === 100 ? this.count_year : ''
  1909. };
  1910. this.isDateDia = true;
  1911. },
  1912. /* 保存完自定义日期 刷新数据 保存当前的图表配置和上下限 只改变图表*/
  1913. dataChangeBack(data) {
  1914. // console.log(data,'timeData');
  1915. this.year_select = data.dateType;
  1916. this.isDateDia = false;
  1917. this.select_date = [data.start_date, data.end_date];
  1918. this.count_year = data.count_year
  1919. if(chartInfo.ChartType === 2){
  1920. // 季节性图
  1921. this.season_year[0]
  1922. }else{
  1923. if(data.dateType==100){
  1924. this.dateTip = `最近${data.count_year}年`
  1925. }else if (data.dateType === 5) {
  1926. this.dateTip = `${data.start_date}~${data.end_date}`;
  1927. } else {
  1928. this.dateTip = `${data.start_date}~至今`;
  1929. }
  1930. }
  1931. // this.saveNowOptions();
  1932. // this.getPreviewChartInfo();
  1933. },
  1934. /* 编辑图表 跳转 */
  1935. editChartHandle() {
  1936. this.$router.push({
  1937. path: '/editchart',
  1938. query: {
  1939. code: this.chartInfo.UniqueCode
  1940. }
  1941. })
  1942. },
  1943. /* 根据unicode展开树结构并选中当前图表 重置图表配置 日期区间 */
  1944. // 如果有chartData则说明是从图列表点击来的,如果没有 则说明是路由中带的参数此时要获取一下详情
  1945. async selectCurrentNode({ code, id, type,chartData }) {
  1946. let deep_arr = _.cloneDeep(this.treeData);
  1947. // 查找选中的节点信息
  1948. let select_obj = chartData?chartData:await this.findNode(deep_arr, id);
  1949. // 查找图表的分类父级id
  1950. let arr = this.findParentNodeHandle(this.treeData,select_obj.ChartClassifyId); // 父的父的父-父的父-父
  1951. this.defaultShowNodes = arr;
  1952. this.select_node = code;
  1953. // 重置筛选状态
  1954. this.selected_chartClassify = select_obj.ChartClassifyId; //图表所属分类
  1955. this.year_select = select_obj.DateType; //年份选择
  1956. this.calendar_type = select_obj.Calendar || '公历'; //公历/农历
  1957. this.season_year = [select_obj.SeasonStartDate, select_obj.SeasonEndDate]; //季节年份区间
  1958. this.select_date = [select_obj.StartDate, select_obj.EndDate]; //曲线日期选择
  1959. this.selected_chartType = select_obj.ChartType;
  1960. this.selected_chartid = id;
  1961. //滚动到高亮节点位置
  1962. setTimeout(() => {
  1963. this.$refs.treeRef.setCurrentKey(this.select_node);
  1964. let node = document.getElementById(`node${this.select_node}`);
  1965. let parent = document.getElementsByClassName('tree-cont')[0];
  1966. if(node.offsetTop > parent.offsetHeight) {
  1967. parent.scrollTop = node.offsetTop - parent.offsetHeight/2
  1968. }
  1969. },400)
  1970. },
  1971. /* 根据图表id 查找对象 */
  1972. findNode(arr, id) {
  1973. // 由于目录第三级图表改为懒加载 故从新增图跳转回来情况只能获取一下图详情了 不能直接去分类数据里面查了
  1974. return new Promise((resolve,reject)=>{
  1975. dataBaseInterface.chartInfo({
  1976. ChartInfoId: id,
  1977. }).then(res=>{
  1978. if(res.Ret==200){
  1979. resolve(res.Data.ChartInfo)
  1980. }
  1981. })
  1982. })
  1983. // 遍历取父级code push数组
  1984. // for (let i of arr) {
  1985. // if (i.ChartInfoId === id) {
  1986. // return i;
  1987. // }
  1988. // if (i.Children) {
  1989. // let node = this.findNode(i.Children, id);
  1990. // if (node) {
  1991. // return node;
  1992. // }
  1993. // }
  1994. // }
  1995. },
  1996. /* 点击表格行展开配置项 */
  1997. rowClickHandle(row) {
  1998. this.expandKey =
  1999. this.expandKey.length && this.expandKey[0] === row.EdbCode
  2000. ? []
  2001. : [row.EdbCode];
  2002. //曲线图点击行 自动置底
  2003. // if (this.selected_chartType === 1) {
  2004. // this.$nextTick(() => {
  2005. // $('.chart-min-cont')[0].scrollTop = 10000;
  2006. // });
  2007. // }
  2008. },
  2009. /* 设置row-key */
  2010. getRowKey(row) {
  2011. return row.EdbCode;
  2012. },
  2013. /* 控制展开一行收起其他行并高亮 */
  2014. expandChangeHandle(row, expandedRows) {
  2015. this.expandKey =
  2016. this.expandKey.length && this.expandKey[0] === row.EdbCode
  2017. ? []
  2018. : [row.EdbCode];
  2019. //曲线图点击行 自动置底
  2020. // if (this.selected_chartType === 1) {
  2021. // this.$nextTick(() => {
  2022. // $('.chart-min-cont')[0].scrollTop = 10000;
  2023. // });
  2024. // }
  2025. this.$refs.tableRef.setCurrentRow(row);
  2026. },
  2027. // 查找树节点所有父节点
  2028. findParentNodeHandle(arr, id) {
  2029. // 遍历取父级code push数组
  2030. for (let i of arr) {
  2031. if (i.ChartClassifyId === id) {
  2032. return [i.UniqueCode];
  2033. }
  2034. if (i.Children) {
  2035. let node = this.findParentNodeHandle(i.Children, id);
  2036. if (node) {
  2037. return node.concat(i.UniqueCode);
  2038. }
  2039. }
  2040. }
  2041. },
  2042. // 通过分类id找到指标所属的分类
  2043. findParentNodeForClassifyId(id,code){
  2044. let arr=[]
  2045. this.treeData.forEach(item=>{
  2046. if(item.Children){
  2047. item.Children.forEach(_item=>{
  2048. if(_item.ChartClassifyId==id){
  2049. arr=[item.UniqueCode,_item.UniqueCode]
  2050. }
  2051. })
  2052. }
  2053. })
  2054. return [...arr]
  2055. },
  2056. /* 向左收起 展开 */
  2057. slideHandle() {
  2058. this.isSlideLeft = !this.isSlideLeft;
  2059. },
  2060. /* 保存图表当前配置项 上下限 */
  2061. saveNowOptions() {
  2062. // const dataArr = _.cloneDeep(this.tableData);
  2063. // dataArr.forEach((item) => {
  2064. // item.MaxData = Number(item.MaxData);
  2065. // item.MinData = Number(item.MinData);
  2066. // delete item.DataList;
  2067. // });
  2068. // sessionStorage.setItem('beforeOptions', JSON.stringify(dataArr));
  2069. },
  2070. /* 季节图切换年份 保持当前配置 */
  2071. seasonYearChange() {
  2072. this.saveNowOptions();
  2073. this.getPreviewChartInfo();
  2074. },
  2075. /* 一键刷新 超长等待..*/
  2076. refreshHandle() {
  2077. this.refreshLoading = this.$loading({
  2078. lock: true,
  2079. target: '.main-right',
  2080. text: '刷新图表中...',
  2081. spinner: 'el-icon-loading',
  2082. background: 'rgba(255, 255, 255, 0.8)',
  2083. });
  2084. dataBaseInterface
  2085. .chartRefresh({
  2086. ChartInfoId: this.selected_chartid,
  2087. })
  2088. .then((res) => {
  2089. this.refreshLoading.close();
  2090. if (res.Ret === 200) {
  2091. this.getPreviewChartInfo();
  2092. this.$message.success(res.Msg);
  2093. }
  2094. });
  2095. },
  2096. /* 重绘右侧区域宽度 */
  2097. reloadRightWid() {
  2098. let total_wid = $('#box')[0].offsetWidth;
  2099. let left = $('#left')[0].offsetWidth;
  2100. let rigtWid = total_wid - left - 20 + 'px';
  2101. $('#right')[0].style.width = rigtWid;
  2102. },
  2103. /* 转base64 */
  2104. svgToBase64(svg) {
  2105. const base64img = `data:image/svg+xml;base64,${window.btoa(
  2106. unescape(encodeURI(svg))
  2107. )}`;
  2108. // console.log(base64img)
  2109. return base64img;
  2110. },
  2111. /* 点击保存时关联图表和截取的图片 */
  2112. setChartImage() {
  2113. let svg = this.$refs.chartRef.chart.getSVG({
  2114. chart:{
  2115. width: 340,
  2116. height: 230,
  2117. }
  2118. });
  2119. let form = new FormData();
  2120. form.append('Img', svg);
  2121. this.setImageHandle(form);
  2122. },
  2123. async setImageHandle(form) {
  2124. let { Data } = await dataBaseInterface.uploadImgSvg(form);
  2125. // let { Data } = await dataBaseInterface.uploadImg(form);
  2126. await dataBaseInterface.setChartImage({
  2127. ChartInfoId: this.selected_chartid,
  2128. ImageUrl: Data.ResourceUrl,
  2129. });
  2130. },
  2131. /* 分享图表 */
  2132. shareUrl() {
  2133. var clipboard = new this.Clipboard('.shareLink')
  2134. clipboard.on('success', e => {
  2135. console.log(e);
  2136. this.$message.success('复制链接成功')
  2137. e.clearSelection() // 释放内存
  2138. clipboard.destroy()
  2139. })
  2140. // // 浏览器不支持
  2141. clipboard.on('error', e => {
  2142. this.$message.warning('浏览器暂不支持')
  2143. // 释放内存
  2144. clipboard.destroy()
  2145. })
  2146. },
  2147. /* ----------------公用图库part-------------------- */
  2148. getPublicChartList() {
  2149. mychartInterface
  2150. .publicList({
  2151. PageSize: this.public_page_size,
  2152. CurrentIndex: this.public_page_no,
  2153. ChartClassifyId: this.default_classify || 0,
  2154. IsShowMe:this.isOnlyMe || false
  2155. })
  2156. .then((res) => {
  2157. if (res.Ret !== 200) return;
  2158. // this.isShowPublicChart = res.Data ? true : false;
  2159. this.publicHaveMove = res.Data
  2160. ? this.public_page_no < res.Data.Paging.Pages
  2161. : false;
  2162. this.chartPublicList = res.Data
  2163. ? this.public_page_no === 1
  2164. ? res.Data.List
  2165. : [...this.chartPublicList, ...res.Data.List]
  2166. : [];
  2167. this.public_total = res.Data ? res.Data.Paging.Totals : 0;
  2168. });
  2169. },
  2170. /* 加载更多 */
  2171. loadMorePublicChart:_.throttle(function(e) {
  2172. let scrollTop = this.$refs.listChartPage.scrollTop;
  2173. let clientHeight = this.$refs.listChartPage.clientHeight;
  2174. let scrollHeight = this.$refs.listChartPage.scrollHeight;
  2175. console.log('scrollTop:',scrollTop)
  2176. console.log('clientHeight:',clientHeight)
  2177. console.log('scrollHeight:',scrollHeight)
  2178. if(scrollTop + clientHeight >= scrollHeight-10 && this.publicHaveMove){
  2179. this.public_page_no++;
  2180. this.getPublicChartList();
  2181. }
  2182. },300),
  2183. /* 点击图表区域跳转详情 选中左侧图表菜单 */
  2184. detailShowHandle(item) {
  2185. this.leftShowLabel = '目录';
  2186. this.$nextTick(() => {
  2187. let params = {
  2188. code: item.UniqueCode,
  2189. id: item.ChartInfoId,
  2190. type: item.ChartType,
  2191. chartData:item
  2192. };
  2193. this.selectCurrentNode(params);
  2194. this.default_classify = '';
  2195. this.reloadRightWid();
  2196. })
  2197. },
  2198. /* 加入我的图库 */
  2199. addMychartHandle(item) {
  2200. this.add_chart_id = item.ChartInfoId;
  2201. //已有的分类ids
  2202. this.add_ids = item.MyChartClassifyId ? item.MyChartClassifyId.split(',').map(item => Number(item)) : [];
  2203. this.isAddMyChart = true;
  2204. },
  2205. /* 加入我的图库成功 */
  2206. addMySuccess(params) {
  2207. this.isAddMyChart = false;
  2208. /* 判断是详情还是图库列表 */
  2209. if (this.selected_chartid) {
  2210. this.chartInfo.IsAdd = true;
  2211. this.chartInfo.MyChartId = params.MyChartInfoId;
  2212. this.chartInfo.MyChartClassifyId = params.MyChartClassifyId;
  2213. } else {
  2214. this.chartPublicList.forEach((item) => {
  2215. if (item.ChartInfoId === this.add_chart_id) {
  2216. item.IsAdd = true;
  2217. item.MyChartId = params.MyChartInfoId;
  2218. item.MyChartClassifyId = params.MyChartClassifyId
  2219. }
  2220. });
  2221. }
  2222. },
  2223. /* 存储中英文状态 */
  2224. setLangIntoStore() {
  2225. this.$store.commit('edb/SET_CAHRT_LANG',this.currentLang)
  2226. },
  2227. /* 获取标签列表 */
  2228. getlabelList(){
  2229. const List = JSON.parse(sessionStorage.getItem('etachart'))||[]
  2230. this.labelList = List
  2231. },
  2232. /* 添加标签 params 基本属性{code,id,classifyId,EdbName,EdbNameEn}*/
  2233. addLabel(params){
  2234. const index = this.labelList.findIndex(i=>i.code===params.code)
  2235. //标签已存在列表中,更新标签的值
  2236. if(index!==-1){
  2237. this.labelList.splice(index,1,params)
  2238. return
  2239. }
  2240. //根据页面宽度 判断标签数量是否达到上限
  2241. const listWidth = document.querySelector('.chartSetting-label-list').offsetWidth
  2242. const minWidth=170+20
  2243. const maxNum = Math.floor(listWidth/minWidth)
  2244. if(this.labelList.length>=maxNum){
  2245. //达到上限则挤出第一个,再添加
  2246. this.labelList.shift()
  2247. }
  2248. this.labelList.push(params)
  2249. },
  2250. //改变选中标签,
  2251. changeCurrentLabel(params){
  2252. if(params.code!==this.select_node){
  2253. this.selectCurrentNode(params)
  2254. }
  2255. },
  2256. //删除标签
  2257. deleteLabel(params,type="label"){
  2258. const index = this.labelList.findIndex(i=>i.code===params.code)
  2259. //如果删除的标签是选中状态
  2260. if(this.select_node===params.code){
  2261. //删除的是唯一一个标签
  2262. if(this.labelList.length===1){
  2263. this.selected_chartid=''
  2264. this.select_node = ''
  2265. this.$refs.treeRef.setCurrentKey(null)
  2266. this.getPublicChartList()
  2267. //不是唯一的标签,则默认选中上一个/下一个
  2268. }else{
  2269. type==='label'&&index===0&&this.changeCurrentLabel(this.labelList[1])
  2270. type==='label'&&index!==0&&index!==-1&&this.changeCurrentLabel(this.labelList[index-1])
  2271. }
  2272. }
  2273. index!==-1&&this.labelList.splice(index,1)
  2274. },
  2275. changeTreeNode(){
  2276. this.$refs.treeRef.setCurrentKey(this.select_node);
  2277. this.$nextTick(()=>{
  2278. const _node = this.$refs.treeRef.getNode(this.select_node)
  2279. this.dynamicNode = _node;
  2280. this.dynamicNode&&this.resetNodeStyle(this.dynamicNode)
  2281. })
  2282. }
  2283. },
  2284. //离开页面时保存标签
  2285. beforeRouteLeave(to,from,next){
  2286. sessionStorage.setItem('etachart',JSON.stringify(this.labelList))
  2287. next()
  2288. },
  2289. mounted() {
  2290. this.getlabelList()
  2291. if(this.$route.query.code) {
  2292. this.getTreeData({code: this.$route.query.code,id: Number(this.$route.query.id)})
  2293. } else {
  2294. this.getTreeData();
  2295. this.getPublicChartList();
  2296. }
  2297. window.addEventListener('resize', this.reloadRightWid);
  2298. //离开页面时保存标签
  2299. window.onbeforeunload = ()=>{
  2300. sessionStorage.setItem('etachart',JSON.stringify(this.labelList))
  2301. }
  2302. },
  2303. destroyed() {
  2304. window.removeEventListener('resize', this.reloadRightWid);
  2305. window.onbeforeunload = null
  2306. },
  2307. };
  2308. </script>
  2309. <style lang="scss">
  2310. @import './css/chartfit.scss';
  2311. .chartSetting_container {
  2312. * {box-sizing: border-box;}
  2313. .flip-list-move {
  2314. transition: transform 0.4s;
  2315. }
  2316. .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner {
  2317. background-color: #409eff !important;
  2318. border-color: #409eff;
  2319. }
  2320. .el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner {
  2321. background-color: #409eff !important;
  2322. border-color: #409eff;
  2323. }
  2324. .el-card .el-card__header {
  2325. padding: 14px 20px;
  2326. }
  2327. .main-left {
  2328. .add-chart-cont {
  2329. padding: 15px 20px;
  2330. border: 1px solid #ECECEC;
  2331. display: flex;
  2332. box-shadow: 0px 3px 6px rgba(167, 167, 167, 0.09);
  2333. }
  2334. .left-tab {
  2335. display: flex;
  2336. align-items: center;
  2337. padding: 20px 20px 0;
  2338. .tab {
  2339. cursor: pointer;
  2340. font-size: 16px;
  2341. border-bottom: 2px solid transparent;
  2342. margin-right: 40px;
  2343. padding-bottom: 5px;
  2344. &.act{
  2345. color: #409eff;
  2346. border-color: #409eff;
  2347. }
  2348. &:hover {
  2349. color: #409eff;
  2350. }
  2351. }
  2352. }
  2353. .targetset-cont {
  2354. padding: 30px 20px 20px;
  2355. height: calc(100vh - 290px);
  2356. overflow-y: auto;
  2357. .target-list {
  2358. border: 1px solid #DCDFE6;
  2359. .setting-cont {
  2360. padding: 20px 20px 0;
  2361. li {
  2362. padding-bottom: 20px;
  2363. margin-bottom: 20px;
  2364. border-bottom: 1px solid #DCDFE6;
  2365. &:last-child {
  2366. padding-bottom: 0;
  2367. margin-bottom: 0;
  2368. border-bottom: none;
  2369. }
  2370. }
  2371. }
  2372. }
  2373. .scatter-setting {
  2374. display: flex;
  2375. margin-bottom: 20px;
  2376. }
  2377. .el-input__inner {
  2378. height: 27px;
  2379. line-height: 27px;
  2380. padding: 0 4px;
  2381. }
  2382. .el-input-number .el-input__inner {
  2383. padding: 0 34px 0 4px;
  2384. }
  2385. .el-color-picker--mini .el-color-picker__trigger {
  2386. width: 60px;
  2387. height: 25px;
  2388. padding: 0;
  2389. }
  2390. .el-color-picker--mini .el-color-picker__mask {
  2391. width: 60px;
  2392. height: 25px;
  2393. }
  2394. .el-collapse-item__header {
  2395. background-color: #F0F2F5;
  2396. margin-bottom: 0;
  2397. border-bottom: 1px solid #DCDFE6;
  2398. padding: 0 20px 0 30px;
  2399. .el-collapse-item__arrow {
  2400. position: absolute;
  2401. left: 8px;
  2402. }
  2403. }
  2404. }
  2405. }
  2406. .cont-bottom {
  2407. .error-tip{ color: #D03F28; font-size: 16px;padding: 25px 0 0 25px; }
  2408. .bottom-min {
  2409. border: 1px solid #DCDFE6;
  2410. margin-bottom: 20px;
  2411. .right-actions {
  2412. /* max-width: 160px; */
  2413. height: 100%;
  2414. padding: 20px 10px;
  2415. border-left: 1px solid #DCDFE6;
  2416. li {
  2417. margin-bottom: 15px;
  2418. }
  2419. @media screen and (max-width: 1710px) {
  2420. font-size: 12px;
  2421. }
  2422. .span-item {
  2423. color: #409eff;
  2424. cursor: pointer;
  2425. &:hover {
  2426. text-decoration: underline;
  2427. }
  2428. .el-icon-collection,
  2429. .el-icon-document-copy {
  2430. color: #409eff;
  2431. }
  2432. }
  2433. }
  2434. .calendar-cont {
  2435. .el-radio-button__inner {
  2436. padding: 8px 16px;
  2437. }
  2438. }
  2439. }
  2440. }
  2441. /* ===================== */
  2442. .chart-public-cont {
  2443. color: #333;
  2444. .el-card .el-card__header,
  2445. .el-card__body {
  2446. padding: 10px;
  2447. }
  2448. .chart-public-list {
  2449. margin-top: 10px;
  2450. display: flex;
  2451. flex-wrap: wrap;
  2452. max-height: calc(100vh - 143px);
  2453. overflow: hidden;
  2454. overflow-y: auto;
  2455. .drag-cont {
  2456. width: 100%;
  2457. display: flex;
  2458. flex-wrap: wrap;
  2459. }
  2460. .dragShdow {
  2461. box-shadow: 0 1px 8px rgba(64, 158, 255, 0.8);
  2462. opacity: 0.5;
  2463. }
  2464. .public-chart-item {
  2465. .item-top {
  2466. display: flex;
  2467. justify-content: space-between;
  2468. align-items: center;
  2469. font-size: 16px;
  2470. font-weight: 600;
  2471. }
  2472. .chart-img {
  2473. width: 100%;
  2474. height: 230px;
  2475. object-fit: fill !important;
  2476. cursor: pointer;
  2477. }
  2478. .item-bottom {
  2479. margin-top: 10px;
  2480. display: flex;
  2481. justify-content: space-between;
  2482. font-size: 12px;
  2483. color: #666;
  2484. .collected {
  2485. color: #f00;
  2486. cursor: pointer;
  2487. }
  2488. .join_txt {
  2489. color: #409eff;
  2490. cursor: pointer;
  2491. }
  2492. }
  2493. }
  2494. }
  2495. }
  2496. .nodata {
  2497. /* height: calc(100vh - 240px); */
  2498. text-align: center;
  2499. font-size: 16px;
  2500. color: #666;
  2501. }
  2502. .copy-excel {
  2503. color: #409eff;
  2504. font-size: 14px;
  2505. padding-left: 50px;
  2506. padding-right: 10px;
  2507. }
  2508. @media screen and (min-width: 1711px) {
  2509. .el-icon-refresh {
  2510. font-size: 17px;
  2511. margin-left: 5px;
  2512. cursor: pointer;
  2513. }
  2514. .chartSetting_top {
  2515. display: flex;
  2516. justify-content: space-between;
  2517. align-items: center;
  2518. margin-bottom: 20px;
  2519. padding: 20px 30px;
  2520. background: #fff;
  2521. border: 1px solid #ececec;
  2522. border-radius: 4px;
  2523. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  2524. .el-select__input {
  2525. margin-left: 30px;
  2526. }
  2527. }
  2528. .chartSetting_main {
  2529. /* display: flex; */
  2530. div::-webkit-scrollbar {
  2531. width: 5px !important;
  2532. }
  2533. .slide-icon {
  2534. padding: 20px 0;
  2535. /* display: block; */
  2536. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);
  2537. border-radius: 5px;
  2538. cursor: pointer;
  2539. position: absolute;
  2540. top: 50%;
  2541. transform: translateY(-50%);
  2542. z-index: 99;
  2543. &:hover {
  2544. background-color: rgba(0, 0, 0, 0.05);
  2545. }
  2546. &.slide-left {
  2547. right: 0;
  2548. }
  2549. &.slide-right {
  2550. left: 0;
  2551. }
  2552. }
  2553. .main-left {
  2554. width: 400px;
  2555. min-width: 350px;
  2556. background: #fff;
  2557. margin-right: 20px;
  2558. border: 1px solid #ececec;
  2559. border-radius: 4px;
  2560. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  2561. height: calc(100vh - 113px);
  2562. overflow: hidden;
  2563. position: relative;
  2564. box-sizing: border-box;
  2565. .chartSetting_main_top {
  2566. padding: 10px 20px 15px;
  2567. .add-cont {
  2568. cursor: pointer;
  2569. font-size: 15px;
  2570. color: #409eff;
  2571. }
  2572. }
  2573. .tree-cont {
  2574. padding: 15px 20px 30px;
  2575. overflow: auto;
  2576. max-height: calc(100vh - 330px);
  2577. }
  2578. .target_tree {
  2579. font-size: 14px;
  2580. color: #333;
  2581. .label-input .el-input__inner {
  2582. height: 25px;
  2583. line-height: 25px;
  2584. }
  2585. .custom-tree-node {
  2586. display: flex !important;
  2587. justify-content: space-between;
  2588. align-items: center;
  2589. display: block;
  2590. flex: 1;
  2591. .node_label {
  2592. margin-right: 2px;
  2593. }
  2594. }
  2595. .el-tree__drop-indicator {
  2596. /* position:absolute; */
  2597. /* left:0;
  2598. right:0; */
  2599. height: 3px;
  2600. // margin-top: 8px;
  2601. background-color: #409eff;
  2602. }
  2603. .el-tree-node__content {
  2604. margin-bottom: 14px !important;
  2605. }
  2606. .el-tree-node__children {
  2607. .el-tree-node {
  2608. /* margin-bottom: 8px !important; */
  2609. margin-bottom: 0px !important;
  2610. padding-left: 18px;
  2611. }
  2612. .el-tree-node__content {
  2613. margin-bottom: 5px !important;
  2614. padding-left: 0 !important;
  2615. }
  2616. }
  2617. .expanded.el-icon-caret-right:before {
  2618. content: url('../../assets/img/set_m/down.png') !important;
  2619. }
  2620. .el-icon-caret-right:before {
  2621. content: url('../../assets/img/set_m/slide.png') !important;
  2622. }
  2623. .el-tree-node__expand-icon.is-leaf.el-icon-caret-right:before {
  2624. content: '' !important;
  2625. }
  2626. .el-tree-node__expand-icon.expanded {
  2627. -webkit-transform: rotate(0deg);
  2628. transform: rotate(0deg);
  2629. }
  2630. .el-tree-node.is-current > .el-tree-node__content {
  2631. background-color: #f0f4ff !important;
  2632. }
  2633. .el-tree-node__content {
  2634. padding-right: 10px !important;
  2635. }
  2636. }
  2637. .noDepart {
  2638. margin: 60px 0;
  2639. display: flex;
  2640. align-items: center;
  2641. justify-content: center;
  2642. color: #409eff;
  2643. font-size: 16px;
  2644. cursor: pointer;
  2645. }
  2646. .move-btn {
  2647. height: 100%;
  2648. width: 4px;
  2649. /* opacity: 0; */
  2650. position: absolute;
  2651. right: 0px;
  2652. top: 0;
  2653. &:hover {
  2654. cursor: col-resize;
  2655. /* background-color: orange */
  2656. }
  2657. }
  2658. }
  2659. .main-right {
  2660. width: 80%;
  2661. .mx-datepicker {
  2662. width: 220px !important;
  2663. }
  2664. /* =================== */
  2665. .chart-min-cont {
  2666. background: #fff;
  2667. border: 1px solid #ececec;
  2668. height: calc(100vh - 114px);
  2669. overflow: auto;
  2670. /* overflow: hidden; */
  2671. border-radius: 4px;
  2672. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  2673. .cont-top {
  2674. padding: 12px 30px;
  2675. border-bottom: 1px solid #ececec;
  2676. display: flex;
  2677. justify-content: space-between;
  2678. align-items: center;
  2679. box-shadow: 0px 3px 6px rgba(167, 167, 167, 0.09);
  2680. .top-left {
  2681. .year-btn {
  2682. font-size: 14px;
  2683. margin-right: 5px;
  2684. margin-bottom: 5px;
  2685. }
  2686. .btn-sty {
  2687. font-size: 16px;
  2688. padding: 10px;
  2689. border: 1px solid #409eff;
  2690. }
  2691. .date-setting{
  2692. width: 210px;
  2693. height: 40px;
  2694. padding: 12px;
  2695. border: 1px solid #DCDFE6;
  2696. border-radius: 4px;
  2697. cursor: pointer;
  2698. font-size: 14px;
  2699. color: #333333;
  2700. }
  2701. }
  2702. .top-right {
  2703. font-size: 16px;
  2704. .join_txt {
  2705. color: #409eff;
  2706. cursor: pointer;
  2707. &:hover {
  2708. text-decoration: underline;
  2709. }
  2710. }
  2711. .collected {
  2712. color: #f00;
  2713. cursor: pointer;
  2714. &:hover {
  2715. text-decoration: underline;
  2716. }
  2717. }
  2718. .span-item {
  2719. color: #409eff;
  2720. cursor: pointer;
  2721. &:hover {
  2722. text-decoration: underline;
  2723. }
  2724. .el-icon-collection,
  2725. .el-icon-document-copy {
  2726. color: #409eff;
  2727. }
  2728. }
  2729. }
  2730. }
  2731. .cont-bottom {
  2732. padding: 20px 30px;
  2733. /* height: calc(100vh - 250px);
  2734. overflow: auto; */
  2735. .el-input__inner {
  2736. height: 27px;
  2737. line-height: 27px;
  2738. padding: 0 4px;
  2739. }
  2740. .el-input-number .el-input__inner {
  2741. padding: 0 34px 0 4px;
  2742. }
  2743. .el-color-picker--mini .el-color-picker__trigger {
  2744. width: 60px;
  2745. height: 25px;
  2746. padding: 0;
  2747. }
  2748. .el-color-picker--mini .el-color-picker__mask {
  2749. width: 60px;
  2750. height: 25px;
  2751. }
  2752. .el-table__expanded-cell {
  2753. padding: 20px 26px;
  2754. }
  2755. .highcharts-range-selector-group {
  2756. display: none;
  2757. .highcharts-input-group {
  2758. display: none;
  2759. }
  2760. }
  2761. .highcharts-axis-title {
  2762. display: block;
  2763. }
  2764. .calendar-cont {
  2765. display: block;
  2766. margin: 10px auto 0;
  2767. text-align: center;
  2768. }
  2769. /* =================== */
  2770. .chart-show-cont {
  2771. padding: 0 160px 0 120px;
  2772. position: relative;
  2773. .chart-title {
  2774. font-size: 16px;
  2775. font-weight: normal;
  2776. text-align: center;
  2777. margin-bottom: 10px;
  2778. }
  2779. .chart-author {
  2780. font-size: 14px;
  2781. color: #333;
  2782. position: absolute;
  2783. bottom: -20px;
  2784. right: 50px;
  2785. }
  2786. .chartWrapper {
  2787. position: relative;
  2788. .range-cont {
  2789. position: absolute;
  2790. top: 13%;
  2791. .min-data-input {
  2792. width: 60px;
  2793. display: block;
  2794. margin-top: 320px;
  2795. }
  2796. &.left {
  2797. left: -80px;
  2798. }
  2799. &.right {
  2800. right: -65px;
  2801. }
  2802. &.rightTwo {
  2803. right: -130px;
  2804. }
  2805. &.bottom {
  2806. width: 100%;
  2807. display: flex;
  2808. justify-content: space-between;
  2809. top: auto;
  2810. right: 0;
  2811. bottom: -3%;
  2812. .left {
  2813. width: 60px;
  2814. display: block;
  2815. flex-shrink: 0;
  2816. }
  2817. }
  2818. }
  2819. }
  2820. }
  2821. .options-cont {
  2822. display: flex;
  2823. flex-wrap: wrap;
  2824. justify-content: space-between;
  2825. }
  2826. }
  2827. }
  2828. }
  2829. .chartSetting-main{
  2830. display: flex;
  2831. }
  2832. .chartSetting-label-list{
  2833. margin-bottom: 22px;
  2834. }
  2835. }
  2836. .drawImg {
  2837. position: absolute;
  2838. top: -999px;
  2839. z-index: -100;
  2840. }
  2841. }
  2842. }
  2843. </style>
  2844. <style lang="scss">
  2845. .edb-item-style .el-input__icon {
  2846. line-height: 27px;
  2847. }
  2848. </style>