list.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  1. <template>
  2. <div class="fittingEquation-chart-container pub-chart-box" v-if="showData">
  3. <span
  4. class="slide-icon slide-right"
  5. @click="isSlideLeft = !isSlideLeft"
  6. v-show="isSlideLeft"
  7. >
  8. <i class="el-icon-d-arrow-right"></i>
  9. </span>
  10. <div class="data-sheet-main" id="box">
  11. <div class="main-left left" id="left" v-show="!isSlideLeft">
  12. <div class="datasheet_top">
  13. <el-button type="primary" @click="goAddChart" v-permission="permissionBtn.statisticPermission.rangeAnalysis_addChart">{{
  14. $t("StatisticAnalysis.ChartRelevance.chart_add_btn")
  15. }}</el-button>
  16. </div>
  17. <div class="search-cont">
  18. <!-- <el-checkbox
  19. v-permission="permissionBtn.statisticPermission.rangeAnalysis_onlyMine"
  20. v-model="isShowMe"
  21. @change="
  22. () => {
  23. getTreeData();
  24. getPublicList();
  25. }
  26. "
  27. >{{
  28. $t("StatisticAnalysis.ChartRelevance.only_see_mine")
  29. }}</el-checkbox
  30. > -->
  31. <el-select
  32. v-model="search_txt"
  33. v-loadMore="searchLoad"
  34. :filterable="!search_txt"
  35. remote
  36. clearable
  37. :placeholder="$t('Chart.search_chart_placeholder')"
  38. style="width: 100%; margin-top: 20px"
  39. :remote-method="searchHandle"
  40. @click.native="inputFocusHandle"
  41. >
  42. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  43. <el-option
  44. v-for="item in searchOptions"
  45. :key="item.ChartInfoId"
  46. :label="
  47. currentLang === 'en'
  48. ? item.ChartNameEn || item.ChartName
  49. : item.ChartName
  50. "
  51. :value="item.ChartInfoId"
  52. >
  53. </el-option>
  54. </el-select>
  55. </div>
  56. <div class="tree-cont">
  57. <el-tree
  58. class="target_tree"
  59. ref="menuTree"
  60. :data="treeData"
  61. node-key="UniqueCode"
  62. :props="defaultProp"
  63. :allow-drag="canDragHandle"
  64. :allow-drop="canDropHandle"
  65. :current-node-key="select_node"
  66. :default-expanded-keys="defaultShowNodes"
  67. :draggable="isEdbBtnShow('moveCatalog')"
  68. :expand-on-click-node="false"
  69. check-strictly
  70. empty-text="暂无目录"
  71. lazy
  72. :load="getLazyTreeData"
  73. @node-expand="handleNodeExpand"
  74. @node-collapse="handleNodeCollapse"
  75. @current-change="nodeChange"
  76. @node-drop="dropOverHandle"
  77. @node-drag-end="dropMouseLeave"
  78. @node-drag-leave="dropMouseLeave"
  79. @node-drag-enter="dropMouseOver"
  80. >
  81. <span class="custom-tree-node" slot-scope="{ node, data }">
  82. <el-input
  83. ref="editVal"
  84. style="width: 90px"
  85. placeholder="请输入值"
  86. class="label-input"
  87. v-model="new_label"
  88. v-if="data.isEdit && isEdbBtnShow('editCatalog')"
  89. @blur="changeValue(node, data)"
  90. />
  91. <span
  92. @dblclick.stop="editNodeLabel(node, data)"
  93. v-else
  94. class="text_oneLine node_label"
  95. :style="`width:${
  96. (select_node === data.UniqueCode && node.Nodewidth) || ''
  97. }`"
  98. :id="`node${data.UniqueCode}`"
  99. >
  100. <img
  101. :src="$icons.lock_ico2"
  102. width="18"
  103. height="18"
  104. style="vertical-align: middle"
  105. v-if="!data.HaveOperaAuth && data.EdbInfoId"
  106. />
  107. <span>{{
  108. currentLang === "en"
  109. ? data.ChartClassifyNameEn || data.ChartClassifyName
  110. : data.ChartClassifyName
  111. }}</span>
  112. </span>
  113. <span
  114. style="display: flex; align-items: center"
  115. v-if="select_node === data.UniqueCode && data.HaveOperaAuth"
  116. >
  117. <!-- 添加子项 -->
  118. <img
  119. src="~@/assets/img/set_m/add.png"
  120. alt=""
  121. style="width: 14px; height: 14px; margin-right: 8px"
  122. @click.stop="addNode(node, data)"
  123. v-if="
  124. !data.ChartInfoId &&
  125. isEdbBtnShow('editCatalog') &&
  126. node.level < 6
  127. "
  128. />
  129. <!-- 编辑节点 如果是分类,判断data.Button.OpButton不变;如果是指标,不显示(ETA1.0.3) -->
  130. <img
  131. src="~@/assets/img/set_m/edit.png"
  132. alt=""
  133. style="width: 15px; height: 14px; margin-right: 8px"
  134. @click.stop="editNode(node, data)"
  135. v-if="
  136. !data.ChartInfoId &&
  137. isEdbBtnShow('editCatalog')
  138. "
  139. />
  140. <!-- 删除节点 如果是分类,判断data.Button.DeleteButton不变;如果是指标,不显示(ETA1.0.3) -->
  141. <img
  142. slot="reference"
  143. src="~@/assets/img/set_m/del.png"
  144. alt=""
  145. style="width: 14px; height: 14px"
  146. @click.stop="removeNode(node, data)"
  147. v-if="
  148. !data.ChartInfoId &&
  149. isEdbBtnShow('deleteCatalog')
  150. "
  151. />
  152. </span>
  153. </span>
  154. </el-tree>
  155. <div class="noDepart" @click="addLevelOneHandle" v-if="isEdbBtnShow('editCatalog')">
  156. <img
  157. src="~@/assets/img/set_m/add_ico.png"
  158. alt=""
  159. style="width: 16px; height: 16px; margin-right: 10px"
  160. />
  161. <span>{{ $t("EtaBasePage.add_first_menu_btn") }}</span>
  162. </div>
  163. </div>
  164. <span
  165. class="move-btn resize"
  166. v-drag
  167. id="resize"
  168. @mousemove="dynamicNode && resetNodeStyle(dynamicNode)"
  169. ></span>
  170. <span class="slide-icon slide-left" @click="isSlideLeft = !isSlideLeft">
  171. <i class="el-icon-d-arrow-left"></i>
  172. </span>
  173. </div>
  174. <div
  175. class="main-right"
  176. id="right"
  177. :style="isSlideLeft ? 'width:100%' : 'width:80%'"
  178. >
  179. <!-- 图表详情 -->
  180. <div class="chart-detail-wrapper" v-if="chartInfo.ChartInfoId">
  181. <div class="cont-top">
  182. <div class="top-left">
  183. <template>
  184. <el-button
  185. type="primary"
  186. v-for="item in yearSelector"
  187. :key="item.value"
  188. size="medium"
  189. :plain="item.value !== year_select"
  190. class="year-btn"
  191. @click.native="changeYear(item)"
  192. >{{ item.name }}</el-button
  193. >
  194. <el-button type="text" class="btn-sty" @click="openDateDia">{{
  195. dateTip
  196. }}</el-button>
  197. </template>
  198. </div>
  199. </div>
  200. <el-row class="bottom-min">
  201. <el-col :span="21" style="padding: 20px 0">
  202. <div class="chart-show-cont" v-if="!chartInfo.WarnMsg">
  203. <div class="chartWrapper" id="chartWrapper">
  204. <h2 class="chart-title">
  205. {{
  206. currentLang === "en"
  207. ? chartInfo.ChartNameEn || chartInfo.ChartName
  208. : chartInfo.ChartName
  209. }}
  210. </h2>
  211. <Chart
  212. :options="options"
  213. :chartInfo="chartInfo"
  214. minHeight="440px"
  215. height="500px"
  216. ref="chartRef"
  217. />
  218. <template>
  219. <div class="range-cont left" v-if="leftIndex !== -1">
  220. <el-input
  221. style="width: 60px; display: block"
  222. size="mini"
  223. type="number"
  224. :placeholder="$t('Chart.up_limit')"
  225. v-model="chartLimit.max"
  226. @change="changeLimit"
  227. />
  228. <el-input
  229. class="min-data-input"
  230. size="mini"
  231. type="number"
  232. :placeholder="$t('Chart.low_limit')"
  233. v-model="chartLimit.min"
  234. @change="changeLimit"
  235. />
  236. </div>
  237. <div class="range-cont right" v-if="rightIndex !== -1">
  238. <el-input
  239. style="width: 60px; display: block"
  240. size="mini"
  241. type="number"
  242. :placeholder="$t('Chart.up_limit')"
  243. v-model="chartLimit.rightMax"
  244. @change="changeLimit"
  245. />
  246. <el-input
  247. class="min-data-input"
  248. size="mini"
  249. type="number"
  250. :placeholder="$t('Chart.low_limit')"
  251. v-model="chartLimit.rightMin"
  252. @change="changeLimit"
  253. />
  254. </div>
  255. <!-- 右2上下限设置 -->
  256. <div
  257. class="range-cont rightTwo"
  258. v-if="rightTwoIndex !== -1"
  259. >
  260. <el-input
  261. style="width: 60px; display: block"
  262. size="mini"
  263. type="number"
  264. :placeholder="$t('Chart.up_limit')"
  265. v-model="chartLimit.rightTwoMax"
  266. @change="changeLimit"
  267. />
  268. <el-input
  269. class="min-data-input"
  270. size="mini"
  271. type="number"
  272. :placeholder="$t('Chart.low_limit')"
  273. v-model="chartLimit.rightTwoMin"
  274. @change="changeLimit"
  275. />
  276. </div>
  277. </template>
  278. </div>
  279. <div class="chart-bottom-insruction-info">
  280. <div class="chart-source">
  281. <span
  282. v-if="chartInfo.SourcesFrom"
  283. :style="`
  284. color: ${
  285. JSON.parse(chartInfo.SourcesFrom).isShow
  286. ? JSON.parse(chartInfo.SourcesFrom).color
  287. : '#999'
  288. };
  289. fontSize: ${
  290. JSON.parse(chartInfo.SourcesFrom).fontSize
  291. }px;
  292. `"
  293. ><!-- 来源 -->{{ $t("Chart.Detail.source") }}:{{
  294. JSON.parse(chartInfo.SourcesFrom).text
  295. }}
  296. </span>
  297. </div>
  298. <!-- 图表说明 -->
  299. <div
  300. class="chart-instruction"
  301. v-if="
  302. chartInfo.Instructions &&
  303. JSON.parse(chartInfo.Instructions).isShow
  304. "
  305. v-text="JSON.parse(chartInfo.Instructions).text"
  306. :style="`
  307. color: ${JSON.parse(chartInfo.Instructions).color};
  308. fontSize: ${JSON.parse(chartInfo.Instructions).fontSize}px
  309. `"
  310. ></div>
  311. </div>
  312. <span class="chart-author"
  313. >{{ $t("MsgPrompt.author") }}:{{
  314. chartInfo.SysUserRealName
  315. }}</span
  316. >
  317. </div>
  318. <!-- 异常显示 -->
  319. <p
  320. class="error-tip"
  321. style="min-height: 400px"
  322. v-if="chartInfo.WarnMsg"
  323. >
  324. {{ chartInfo.WarnMsg }}
  325. </p>
  326. </el-col>
  327. <el-col
  328. :span="3"
  329. style="position: absolute; height: 100%; right: 0"
  330. >
  331. <!-- 操作 -->
  332. <chartHandlesWrap
  333. :chartInfo="chartInfo"
  334. :linkUrl="linkUrl"
  335. @copyChartConfirm="copyChartConfirm"
  336. @addMychartHandle="addMychartHandle"
  337. @refreshHandle="handleChartRefresh('detail')"
  338. @saveChartOtherHandle="handleSaveOther(chartInfo)"
  339. @editChartHandle="editChartHandle(chartInfo)"
  340. @delChartHandle="handleDeleteChart(chartInfo)"
  341. @saveChartHandle="handleChartSave(chartInfo)"
  342. />
  343. </el-col>
  344. </el-row>
  345. <!-- 指标列表 -->
  346. <edbTableSection :tableData="tableData" :showCopyDataBtn="false"/>
  347. </div>
  348. <!-- 列表 -->
  349. <chartListTableWrap
  350. v-else
  351. :total="chart_total"
  352. :list="chartList"
  353. @refresh="handleChartRefresh"
  354. @saveOther="handleSaveOther"
  355. @deleteChart="handleDeleteChart"
  356. @loadMoreHandle="loadMoreHandle"
  357. @detailShowHandle="detailShowHandle"
  358. @addMychartHandle="addMychartHandle"
  359. @edit="editChartHandle"
  360. />
  361. </div>
  362. </div>
  363. <!-- 目录弹窗 -->
  364. <openDialog
  365. :isOpenDialog="isOpenDialog"
  366. :title="dialog_title"
  367. :formData="dialogForm"
  368. @closeDia="isOpenDialog = false"
  369. @sucessCallback="classifyCallback"
  370. />
  371. <!-- 图表另存 -->
  372. <SaveChartOther
  373. :show.sync="isShowSaveOther"
  374. fromType="interval_analysis"
  375. source="interval_analysis"
  376. :data="saveOtherChartInfo"
  377. @ensure="getTreeData"
  378. />
  379. <!-- 加入我的图库弹窗 -->
  380. <addMyClassifyDia
  381. :isAddMyDialog="isAddMyChart"
  382. :add_id="add_chart_id"
  383. :add_ids="add_ids"
  384. @cancel="isAddMyChart = false"
  385. @addSuccess="addMySuccess"
  386. />
  387. <!-- 日期端选择弹窗 -->
  388. <DateChooseDia
  389. :isDateDia="isDateDia"
  390. :dateForm="dateForm"
  391. :earliestDate="earliestDate"
  392. @cancel="isDateDia = false"
  393. @dateBack="dataChangeBack"
  394. />
  395. </div>
  396. </template>
  397. <script>
  398. import apiIntervalAnalysis from '@/api/modules/intervalAnalysis'
  399. import leftMixin from './mixin/leftMixin';
  400. import Chart from '@/views/dataEntry_manage/components/chart';
  401. import openDialog from '@/views/dataEntry_manage/databaseComponents/openDialog';
  402. import addMyClassifyDia from '@/views/dataEntry_manage/components/addMyClassifyDia';
  403. import SaveChartOther from '@/views/dataEntry_manage/components/SaveChartOther';
  404. import { chartSetMixin } from '@/views/dataEntry_manage/mixins/chartPublic';
  405. import addOrEditMixn from '@/views/dataEntry_manage/mixins/addOreditMixin';
  406. import { copyOtherOptions } from '@/utils/defaultOptions';
  407. import DateChooseDia from '@/views/dataEntry_manage/components/DateChooseDia';
  408. import edbTableSection from '@/views/chartRelevance_manage/crossVarietyAnalysis/components/edbTableSection.vue';
  409. export default {
  410. components: {
  411. openDialog,
  412. Chart,
  413. addMyClassifyDia,
  414. SaveChartOther,
  415. edbTableSection,
  416. DateChooseDia
  417. },
  418. mixins: [leftMixin, chartSetMixin,addOrEditMixn],
  419. computed: {
  420. /* 分享地址 */
  421. linkUrl() {
  422. const LINK_CHART_URL = this.$setting.dynamicOutLinks.ChartViewUrl + '/chartshow';
  423. return `${LINK_CHART_URL}?code=${this.chartInfo.UniqueCode}&fromType=share?&lang=${this.currentLang}`
  424. }
  425. },
  426. data() {
  427. return {
  428. showData: false,
  429. refreshLoading: false,
  430. isShowMe: true,
  431. search_txt: '',
  432. searchOptions: [],
  433. isSlideLeft: false,//左侧分类收起
  434. select_node: '',//节点唯一标识code
  435. select_classify: '',
  436. select_id: '',//选中的图表id
  437. chartInfo: {},
  438. chart_title: '',//图表标题 双击标题修改时来存储最新值
  439. /* 图表列表 */
  440. listLoading: false,
  441. listFinished: true,//是否还有列表数据
  442. chartList: [],
  443. chart_total: 0,
  444. chart_page: 1,
  445. chart_pages_size: 30,
  446. search_page: 1,
  447. search_have_more: false,
  448. current_search: '',
  449. isShowSaveOther: false,//另存为
  450. saveOtherChartInfo: {},
  451. isAddMyChart: false, //加入图库弹窗
  452. add_chart_id: 0, //要加入的图表
  453. add_ids: [],//加入时已有的分类
  454. };
  455. },
  456. methods: {
  457. /* 添加图表 */
  458. goAddChart() {
  459. if (!this.treeData.length) return this.$message.warning('请先添加分类');
  460. this.$router.push({ path: '/rangeAnalysisChartEditor' });
  461. },
  462. /* 搜索 */
  463. searchHandle(query) {
  464. this.search_page = 1;
  465. this.current_search = query;
  466. this.searchApi(this.current_search)
  467. },
  468. searchApi(query, page = 1) {
  469. /* 查找列表 */
  470. apiIntervalAnalysis
  471. .chartSearch({
  472. Keyword: query,
  473. IsShowMe: this.isShowMe,
  474. CurrentIndex: page
  475. })
  476. .then((res) => {
  477. if (res.Ret !== 200) return
  478. const { List, Paging } = res.Data;
  479. this.search_have_more = page < Paging.Pages;
  480. this.searchOptions = page === 1 ? List : [...this.searchOptions, ...List];
  481. });
  482. },
  483. /* 聚焦获取当前检索 */
  484. inputFocusHandle(e) {
  485. this.search_page = 1;
  486. this.current_search = e.target.value;
  487. if (this.current_search) {
  488. this.searchApi(this.current_search)
  489. } else {
  490. this.searchOptions = [];
  491. }
  492. },
  493. searchLoad() {
  494. if (!this.search_have_more) return;
  495. this.searchApi(this.current_search, ++this.search_page);
  496. },
  497. /* 获取图表列表 */
  498. getPublicList() {
  499. this.listLoading = true
  500. apiIntervalAnalysis.getChartList({
  501. CurrentIndex: this.chart_page,
  502. PageSize: this.chart_pages_size,
  503. ChartClassifyId: this.select_classify || 0,
  504. IsShowMe: this.isShowMe
  505. }).then(res => {
  506. this.listLoading = false
  507. if (res.Ret !== 200) return
  508. if(res.Data) {
  509. this.listFinished = res.Data.Paging.IsEnd
  510. this.chartList = res.Data
  511. ? this.chart_page === 1
  512. ? res.Data.List
  513. : [...this.chartList, ...res.Data.List]
  514. : [];
  515. this.chart_total = res.Data ? res.Data.Paging.Totals : 0;
  516. }else {
  517. this.chartList = []
  518. this.chart_total = 0;
  519. }
  520. }).catch(() => {
  521. this.listLoading = false
  522. })
  523. },
  524. loadMoreHandle() {
  525. if (this.listLoading || this.listFinished) return
  526. this.chart_page++
  527. this.getPublicList()
  528. },
  529. detailShowHandle(e) {
  530. this.select_id = e.ChartInfoId
  531. },
  532. handleInitList() {
  533. this.listFinished = false
  534. this.chart_page = 1
  535. this.chartList = []
  536. this.chart_total = 0
  537. this.getPublicList()
  538. },
  539. /* 年份改变 重新刷新图表接口 保存当前的图表配置和上下限 只改变图表 */
  540. changeYear(item) {
  541. this.year_select = item.value;
  542. this.select_date = '';
  543. this.dateTip =/* '请选择时间段' */ this.$t('Chart.choose_time');
  544. this.getChartInfo()
  545. },
  546. /* 打开时间段弹窗 */
  547. openDateDia() {
  548. // 自定义时间段回显
  549. let selectDateStart = this.chartInfo.ChartType === 2 ? this.season_year[0] : this.select_date[0]
  550. let selectDateEnd = this.chartInfo.ChartType === 2 ? this.season_year[1] : this.select_date[1]
  551. this.dateForm = {
  552. date_type: this.year_select,
  553. start_date:
  554. this.year_select === 5 || this.year_select === 6
  555. ? selectDateStart
  556. : '',
  557. end_date: this.year_select === 5 ? selectDateEnd : '',
  558. count_year: this.year_select === 20 ? this.count_year : ''
  559. };
  560. this.isDateDia = true;
  561. },
  562. /* 保存完自定义日期 刷新数据 保存当前的图表配置和上下限 只改变图表*/
  563. dataChangeBack(data) {
  564. this.year_select = data.dateType;
  565. this.isDateDia = false;
  566. this.count_year = data.count_year
  567. let dateStart = data.start_date
  568. let dateEnd = data.end_date
  569. let latestYear = parseInt(this.latestDate.substring(0, 4))
  570. if (data.dateType == 20) {
  571. dateStart = `${latestYear - data.count_year + 1}-01-01`
  572. dateEnd = `${latestYear}-12-31`
  573. }
  574. // 因为原本季节性图不支持 DateType为5和6的 所以季节性也将StartDate和EndDate传过去
  575. this.select_date = [dateStart, dateEnd];
  576. if (data.dateType == 20) {
  577. this.dateTip = /* `最近${data.count_year}年` */ this.$t('Chart.date_tip_count', { year: data.count_year })
  578. } else if (data.dateType === 5) {
  579. this.dateTip = `${data.start_date}~${data.end_date}`;
  580. } else {
  581. this.dateTip = /* `${data.start_date}~至今` */ this.$t('Chart.data_tip_since', { date: data.start_date });
  582. }
  583. this.getChartInfo()
  584. },
  585. /* 设置默认时间选中项 */
  586. setDefaultDateSelect() {
  587. this.year_select = this.chartInfo.DateType;
  588. this.select_date = [this.chartInfo.StartDate, this.chartInfo.EndDate];
  589. this.count_year = this.chartInfo.StartYear;
  590. this.dateTip =
  591. this.chartInfo.DateType === 5
  592. ? `${this.chartInfo.StartDate}~${this.chartInfo.EndDate}`
  593. : this.chartInfo.DateType === 6
  594. ? /* `${this.chartInfo.StartDate}~至今` */ this.$t('Chart.data_tip_since',{date:this.chartInfo.StartDate})
  595. : this.chartInfo.DateType === 20
  596. ?/* `最近${this.chartInfo.StartYear}年` */ this.$t('Chart.date_tip_count',{year:this.chartInfo.StartYear})
  597. :/* '请选择时间段' */this.$t('Chart.choose_time');
  598. },
  599. /* 获取图表详情 */
  600. getChartInfo(type) {
  601. let params={
  602. ChartInfoId: this.select_id,
  603. }
  604. if(type!=='init'){
  605. params={
  606. ...params,
  607. DateType: this.year_select,
  608. StartDate: [5 , 6].includes(this.year_select)
  609. ? this.select_date[0]
  610. : '',
  611. EndDate: this.year_select === 5 ? this.select_date[1] : '',
  612. StartYear:this.count_year || 0,
  613. }
  614. }
  615. apiIntervalAnalysis.chartInfo(params).then(res => {
  616. if (res.Ret !== 200) return
  617. this.tableData=res.Data.EdbInfoList
  618. this.chartInfo=res.Data.ChartInfo
  619. if(type==='init'){
  620. this.setDefaultDateSelect()
  621. }
  622. this.initIntervalAnalysisChartData(res.Data)
  623. // 展开左侧目录树
  624. this.defaultShowNodes = res.Data.ClassifyLevels || []
  625. //设置tree高亮
  626. this.$nextTick(() => {
  627. setTimeout(() => {
  628. this.$refs.menuTree.setCurrentKey(res.Data.ChartInfo.UniqueCode);
  629. }, 1000);
  630. })
  631. })
  632. },
  633. /* 删除图表 */
  634. handleDeleteChart(e) {
  635. const { ChartClassifyId, ChartInfoId } = e;
  636. this.$confirm(this.$t('Chart.OptMsg.chart_del_confirm'), this.$t('Confirm.prompt'), {
  637. type: 'warning',
  638. }).then(() => {
  639. this.delClassify(ChartClassifyId, ChartInfoId, 'del_chart');
  640. })
  641. .catch(() => { });
  642. },
  643. /* 刷新图表 */
  644. handleChartRefresh(e) {
  645. this.refreshLoading = this.$loading({
  646. lock: true,
  647. target: '.main-right',
  648. text: /* '刷新图表中...' */this.$t('Chart.OptMsg.refresh_ing_msg'),
  649. spinner: 'el-icon-loading',
  650. background: 'rgba(255, 255, 255, 0.8)',
  651. });
  652. const params = {
  653. ChartInfoId: e === 'detail' ? this.chartInfo.ChartInfoId : e.ChartInfoId
  654. }
  655. apiIntervalAnalysis.chartRefresh(params).then((res) => {
  656. this.refreshLoading.close();
  657. if (res.Ret === 200) {
  658. if (e === 'detail') {
  659. this.getChartInfo()
  660. }
  661. this.$message.success(res.Msg);
  662. }
  663. });
  664. },
  665. //保存图表
  666. handleChartSave(e){
  667. const {
  668. min, max, rightMin, rightMax, rightTwoMin, rightTwoMax
  669. } = this.chartLimit
  670. const params={
  671. ChartInfoId:e.ChartInfoId,
  672. DateType: this.year_select,
  673. StartDate: [5, 6].includes(this.year_select)
  674. ? this.select_date[0]
  675. : '',
  676. EndDate: this.year_select === 5 ? this.select_date[1] : '',
  677. StartYear: this.count_year || 0,
  678. LeftMin: min + '',
  679. LeftMax: max + '',
  680. RightMin: rightMin + '',
  681. RightMax: rightMax + '',
  682. Right2Min: rightTwoMin + '',
  683. Right2Max: rightTwoMax + '',
  684. MinMaxSave: Number(!this.getLimitInfo()),
  685. }
  686. console.log(params);
  687. apiIntervalAnalysis.chartSave(params).then(res=>{
  688. if(res.Ret===200){
  689. this.$message.success(this.$t('MsgPrompt.saved_msg'));
  690. }
  691. })
  692. },
  693. // 显示另存为
  694. handleSaveOther(e) {
  695. this.saveOtherChartInfo = e
  696. this.isShowSaveOther = true
  697. },
  698. /* 编辑图表 */
  699. editChartHandle(e) {
  700. this.$router.push({
  701. path: '/rangeAnalysisChartEditor',
  702. query: {
  703. code: e.UniqueCode,
  704. id: e.ChartInfoId
  705. }
  706. })
  707. },
  708. /* 加入我的图库 */
  709. addMychartHandle(item) {
  710. this.add_chart_id = item.ChartInfoId;
  711. //已有的分类ids
  712. this.add_ids = item.MyChartClassifyId
  713. ? item.MyChartClassifyId.split(",").map((item) => Number(item))
  714. : [];
  715. this.isAddMyChart = true;
  716. },
  717. /* 加入我的图库成功 */
  718. addMySuccess(params) {
  719. this.isAddMyChart = false;
  720. /* 判断是详情还是图库列表 */
  721. if (this.select_id) {
  722. this.chartInfo.IsAdd = true;
  723. this.chartInfo.MyChartId = params.MyChartInfoId;
  724. this.chartInfo.MyChartClassifyId = params.MyChartClassifyId;
  725. }
  726. },
  727. copyChartHandle: _.debounce(function (type) {
  728. let chartsName = this.currentLang == 'zh' ? this.chartInfo.ChartName : this.chartInfo.ChartNameEn
  729. let { heightNum, widthNum, newTitle, dynamic_copyOptions } = this.dynamicWidthAndHeight(type, this.chartInfo.ChartType, chartsName, 1)
  730. const chartType = 'seasonLegend';
  731. // 英文转SVG设置变动
  732. if (this.currentLang == 'en') {
  733. // 如果竖轴坐标单位为'英文单位',表示客户没填,转成svg时置为空
  734. this.$refs.chartRef.chart.options.yAxis.forEach(it => {
  735. if (it.title.text == '英文单位') it.title.text = ''
  736. });
  737. }
  738. let svg = this.$refs.chartRef.chart.getSVG({
  739. chart: {
  740. width: widthNum,
  741. height: heightNum,
  742. backgroundColor: "rgba(255, 255, 255, 0)",
  743. },
  744. title: {
  745. text: newTitle,
  746. margin: 10,
  747. style: {
  748. fontSize: '18px'
  749. }
  750. },
  751. legend: {
  752. ...copyOtherOptions[chartType],
  753. ...dynamic_copyOptions[chartType]
  754. }
  755. });
  756. this.copyBlobItem(widthNum, heightNum, svg, type);
  757. }, 500),
  758. copyChartConfirm(type) {
  759. type !== "url" && this.copyChartHandle(type);
  760. type == "url" && this.shareUrl();
  761. },
  762. /* 分享图表 */
  763. shareUrl() {
  764. var clipboard = new this.Clipboard(".shareLink");
  765. clipboard.on("success", (e) => {
  766. console.log(e);
  767. this.$message.success(/* "复制链接成功" */this.$t('Chart.OptMsg.copy_link_success'));
  768. e.clearSelection(); // 释放内存
  769. clipboard.destroy();
  770. });
  771. // // 浏览器不支持
  772. clipboard.on("error", (e) => {
  773. this.$message.warning(/* "浏览器暂不支持" */this.$t('MsgPrompt.browser_not_support'));
  774. // 释放内存
  775. clipboard.destroy();
  776. });
  777. },
  778. },
  779. mounted() {
  780. if (this.$route.query.code) {
  781. this.getTreeData({ code: this.$route.query.code, id: Number(this.$route.query.id) })
  782. } else {
  783. this.getTreeData();
  784. this.getPublicList();
  785. }
  786. window.addEventListener('resize', this.reloadRightWid);
  787. },
  788. destroyed() {
  789. window.removeEventListener('resize', this.reloadRightWid);
  790. }
  791. }
  792. </script>
  793. <style lang='scss' scoped>
  794. @import "~@/views/chartRelevance_manage/css/index.scss";
  795. .pub-chart-box .data-sheet-main .main-left {
  796. width: 400px;
  797. }
  798. .main-right {
  799. .chart-detail-wrapper {
  800. .cont-top {
  801. display: flex;
  802. justify-content: space-between;
  803. align-items: center;
  804. box-shadow: 0px 3px 6px rgba(167, 167, 167, 0.09);
  805. .top-left {
  806. .year-btn {
  807. margin-right: 5px;
  808. margin-bottom: 5px;
  809. }
  810. .btn-sty {
  811. border: 1px solid #409eff;
  812. }
  813. .date-setting {
  814. border: 1px solid #dcdfe6;
  815. border-radius: 4px;
  816. cursor: pointer;
  817. color: #333333;
  818. line-height: 16px;
  819. }
  820. }
  821. .top-right {
  822. font-size: 16px;
  823. .join_txt {
  824. color: #409eff;
  825. cursor: pointer;
  826. &:hover {
  827. text-decoration: underline;
  828. }
  829. }
  830. .collected {
  831. color: #f00;
  832. cursor: pointer;
  833. &:hover {
  834. text-decoration: underline;
  835. }
  836. }
  837. .span-item {
  838. color: #409eff;
  839. cursor: pointer;
  840. &:hover {
  841. text-decoration: underline;
  842. }
  843. .el-icon-collection,
  844. .el-icon-document-copy {
  845. color: #409eff;
  846. }
  847. }
  848. }
  849. }
  850. @media screen and (min-width: 1711px) {
  851. .min-data-input {
  852. margin-top: 310px;
  853. }
  854. .btn-sty {
  855. padding: 10px;
  856. }
  857. .year-btn,
  858. .btn-sty {
  859. font-size: 14px;
  860. }
  861. }
  862. @media screen and (max-width: 1710px) {
  863. .min-data-input {
  864. margin-top: 230px;
  865. }
  866. .year-btn {
  867. font-size: 12px;
  868. margin-left: 5px;
  869. margin-right: 5px;
  870. margin-bottom: 5px;
  871. padding: 6px 12px;
  872. }
  873. .btn-sty {
  874. font-size: 12px;
  875. margin-left: 5px;
  876. padding: 6px;
  877. border: 1px solid #409eff;
  878. }
  879. .date-setting {
  880. width: 180px;
  881. height: 36px;
  882. padding: 10px;
  883. font-size: 12px;
  884. }
  885. }
  886. }
  887. }
  888. </style>
  889. <style lang="scss">
  890. @import "~@/views/chartRelevance_manage/css/pub.scss";
  891. </style>