costCanvas.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  1. <template>
  2. <div>
  3. <div class="node_info">
  4. <div>节点说明:</div>
  5. <div class="dis_flex" v-for="item in nodeColor">
  6. <div class="node_class" :style="{backgroundColor: item.nodeback}"></div>
  7. {{ item.name }}
  8. </div>
  9. </div>
  10. <div v-if="chartStatus" id="costCanvas" style="width: 100%"></div>
  11. <!-- <el-button @click="reseat"> 重置</el-button>-->
  12. </div>
  13. </template>
  14. <script>
  15. import * as echarts from 'echarts'
  16. const lineStyle = {
  17. color: '#999999',
  18. width: 2,
  19. type: 'dotted'
  20. }
  21. const redLinestyle = {
  22. color: 'red',
  23. width: 2
  24. }
  25. const node = [ // 节点
  26. {
  27. name: '申请人发起',
  28. nodeKey: 'curr_user',
  29. value: [0, 375],
  30. symbol: 'image://' + require('../asste/huifangkuai.png'),
  31. symbolSize: [110, 60]
  32. },
  33. {
  34. nodeKey: 'dept_superior_1_0_1-yes',
  35. name: '直接上级审核',
  36. value: [75, 375],
  37. symbol: 'image://' + require('../asste/huifangkuai.png'),
  38. symbolSize: [110, 60]
  39. },
  40. {
  41. nodeKey: 'dept_head_1_0_1-yes',
  42. name: '部门负责人审核',
  43. value: [150, 375],
  44. symbol: 'image://' + require('../asste/huifangkuai.png'),
  45. symbolSize: [110, 60]
  46. },
  47. {
  48. name: '报支金额',
  49. value: [225, 375],
  50. nodeKey: 'flow_cnzf_0_0_1-yes',
  51. label: {
  52. show: true,
  53. color: '#777777' // 节点文字颜色
  54. },
  55. symbol: 'image://' + require('../asste/lingxing.png'),
  56. symbolSize: [80, 80]
  57. },
  58. {
  59. nodeKey: 'flow_cnzf_0_0_1-yes@noenough',
  60. name: '出纳支付',
  61. value: [225, 500],
  62. symbol: 'image://' + require('../asste/huifangkuai.png'),
  63. symbolSize: [110, 60]
  64. },
  65. {
  66. name: '分管领导审核',
  67. nodeKey: 'flow_fgld_1_0_1-yes',
  68. value: [225, 250],
  69. symbol: 'image://' + require('../asste/huifangkuai.png'),
  70. symbolSize: [110, 60]
  71. },
  72. {
  73. name: '上级分管领导审核',
  74. nodeKey: 'flow_sjfgld_1_0_1-yes',
  75. value: [300, 250],
  76. symbol: 'image://' + require('../asste/huifangkuai.png'),
  77. symbolSize: [110, 60]
  78. },
  79. {
  80. name: '主要领导审核',
  81. nodeKey: 'flow_zyld_1_0_1-yes',
  82. value: [375, 250],
  83. symbol: 'image://' + require('../asste/huifangkuai.png'),
  84. symbolSize: [110, 60]
  85. },
  86. {
  87. name: '出纳支付 ',
  88. nodeKey: 'flow_cnzf_0_0_1-yes@enough',
  89. value: [450, 250],
  90. symbol: 'image://' + require('../asste/huifangkuai.png'),
  91. symbolSize: [110, 60]
  92. },
  93. {
  94. nodeKey: 'flow_zffh_0_0_1-yes@end',
  95. name: '支付复核',
  96. value: [450, 375],
  97. symbol: 'image://' + require('../asste/huifangkuai.png'),
  98. symbolSize: [110, 60]
  99. },
  100. {
  101. nodeKey: '结束',
  102. name: '结束',
  103. value: [525, 375],
  104. symbol: 'image://' + require('../asste/huifangkuai.png'),
  105. symbolSize: [110, 60]
  106. }
  107. ]
  108. const linesData = [ // 连线
  109. {
  110. label: {
  111. show: true,
  112. position: 'middle',
  113. opacity: 1,
  114. width: 10,
  115. height: 15,
  116. fontSize: 16,
  117. lineHeight: 0,
  118. color: 'red',
  119. padding: [15, 15, 15, 15],
  120. verticalAlign: 'middle'
  121. },
  122. name: '退回发起人',
  123. nodeKey: '小于三千出纳退回线',
  124. lineStyle: lineStyle,
  125. coords: [[225, 500], [5, 500]],
  126. symbol: 'none'
  127. },
  128. {
  129. nodeKey: '小于三千出纳退回线',
  130. lineStyle: lineStyle,
  131. symbol: 'none',
  132. coords: [[5, 500], [5, 405]]
  133. },
  134. {
  135. nodeKey: '直接上级审核退回线',
  136. lineStyle: lineStyle,
  137. coords: [[5, 445], [5, 405]]
  138. },
  139. {
  140. nodeKey: '部门负责人审核退回线',
  141. lineStyle: lineStyle,
  142. coords: [[5, 475], [5, 405]]
  143. },
  144. {
  145. nodeKey: '部门负责人审核退回线',
  146. lineStyle: lineStyle,
  147. coords: [[150, 375], [150, 475]],
  148. symbol: 'none'
  149. },
  150. {
  151. label: {
  152. show: true,
  153. position: 'middle',
  154. opacity: 1,
  155. width: 10,
  156. height: 15,
  157. fontSize: 16,
  158. lineHeight: 0,
  159. color: 'red',
  160. padding: [15, 15, 15, 15],
  161. verticalAlign: 'middle'
  162. },
  163. name: '退回发起人',
  164. lineStyle: lineStyle,
  165. nodeKey: '部门负责人审核退回线',
  166. coords: [[150, 475], [5, 475]],
  167. symbol: 'none'
  168. },
  169. {
  170. name: '直接上级审核退回',
  171. nodeKey: '直接上级审核退回线',
  172. lineStyle: lineStyle,
  173. coords: [
  174. [75, 375],
  175. [75, 445]
  176. ],
  177. symbol: 'none'
  178. },
  179. {
  180. label: {
  181. show: true,
  182. position: 'middle',
  183. opacity: 1,
  184. width: 10,
  185. height: 15,
  186. fontSize: 16,
  187. lineHeight: 0,
  188. color: 'red',
  189. padding: [15, 15, 15, 15],
  190. verticalAlign: 'middle'
  191. },
  192. name: '退回发起人',
  193. nodeKey: '直接上级审核退回线',
  194. lineStyle: lineStyle,
  195. coords: [[75, 445], [5, 445]],
  196. symbol: 'none'
  197. },
  198. {
  199. nodeKey: '直接上级审核退回线',
  200. name: '直接上级退回',
  201. lineStyle: lineStyle,
  202. coords: [
  203. [75, 375],
  204. [75, 445]
  205. ],
  206. symbol: 'none'
  207. },
  208. {
  209. nodeKey: '报支金额<500',
  210. lineStyle: lineStyle,
  211. coords: [[229.5, 410], [229.5, 470]]
  212. },
  213. {
  214. label: {
  215. show: true,
  216. position: 'end',
  217. opacity: 1,
  218. fontSize: 16,
  219. color: 'red'
  220. },
  221. name: '报支金额<500',
  222. coords: [[255, 440], [255, 440]],
  223. symbol: 'none'
  224. },
  225. {
  226. nodeKey: 'dept_superior_1_0_1-yes',
  227. lineStyle: lineStyle,
  228. coords: [[0, 375], [55, 375]]
  229. },
  230. {
  231. nodeKey: 'dept_head_1_0_1-yes',
  232. lineStyle: lineStyle,
  233. coords: [[75, 375], [130, 375]]
  234. },
  235. {
  236. nodeKey: 'flow_cnzf_0_0_1-yes',
  237. lineStyle: lineStyle,
  238. coords: [[165, 375], [213, 375]]
  239. },
  240. {
  241. nodeKey: '报支金额>500',
  242. lineStyle: lineStyle,
  243. coords: [[229.5, 340], [229.5, 280]]
  244. },
  245. {
  246. label: {
  247. show: true,
  248. position: 'end',
  249. opacity: 1,
  250. fontSize: 16,
  251. color: 'red'
  252. },
  253. name: '报支金额>500',
  254. lineStyle: {
  255. color: '#00116a',
  256. width: 2,
  257. type: 'dotted'
  258. },
  259. coords: [[255, 320], [255, 320]],
  260. symbol: 'none'
  261. },
  262. {
  263. nodeKey: '分管领导退回线',
  264. lineStyle: lineStyle,
  265. coords: [[229.5, 270], [229.5, 180]],
  266. symbol: 'none'
  267. },
  268. {
  269. label: {
  270. show: true,
  271. position: 'middle',
  272. opacity: 1,
  273. width: 10,
  274. height: 15,
  275. fontSize: 16,
  276. lineHeight: 0,
  277. color: 'red',
  278. padding: [15, 15, 15, 15],
  279. verticalAlign: 'middle'
  280. },
  281. nodeKey: '分管领导退回线',
  282. name: '退回发起人',
  283. lineStyle: lineStyle,
  284. coords: [[229.5, 180], [5, 180]],
  285. symbol: 'none'
  286. },
  287. {
  288. name: '申请人发起下面的那条线',
  289. lineStyle: lineStyle,
  290. coords: [[5, 85], [5, 345]]
  291. },
  292. {
  293. name: '分管领导退回线',
  294. lineStyle: lineStyle,
  295. coords: [[5, 180], [5, 345]]
  296. },
  297. {
  298. name: '大于500出纳支付退回线',
  299. lineStyle: lineStyle,
  300. coords: [[5, 85], [5, 345]]
  301. },
  302. {
  303. nodeKey: '上级分管领导退回线',
  304. lineStyle: lineStyle,
  305. coords: [[305, 250], [305, 145]],
  306. symbol: 'none'
  307. },
  308. {
  309. name: '上级分管领导退回线',
  310. lineStyle: lineStyle,
  311. coords: [[5, 145], [5, 345]]
  312. },
  313. {
  314. label: {
  315. show: true,
  316. position: 'middle',
  317. opacity: 1,
  318. width: 10,
  319. height: 15,
  320. fontSize: 16,
  321. lineHeight: 0,
  322. color: 'red',
  323. padding: [15, 15, 15, 15],
  324. verticalAlign: 'middle'
  325. },
  326. nodeKey: '上级分管领导退回线',
  327. name: '退回发起人',
  328. lineStyle: lineStyle,
  329. coords: [[305, 145], [5, 145]],
  330. symbol: 'none'
  331. },
  332. {
  333. nodeKey: '主要领导退回线',
  334. lineStyle: lineStyle,
  335. coords: [[380, 245], [380, 115]],
  336. symbol: 'none'
  337. },
  338. {
  339. nodeKey: '主要领导退回线',
  340. lineStyle: lineStyle,
  341. coords: [[5, 115], [5, 345]]
  342. },
  343. {
  344. label: {
  345. show: true,
  346. position: 'middle',
  347. opacity: 1,
  348. width: 10,
  349. height: 15,
  350. fontSize: 16,
  351. lineHeight: 0,
  352. color: 'red',
  353. padding: [15, 15, 15, 15],
  354. verticalAlign: 'middle'
  355. },
  356. nodeKey: '主要领导退回线',
  357. name: '退回发起人',
  358. lineStyle: lineStyle,
  359. coords: [[380, 115], [5, 115]],
  360. symbol: 'none'
  361. },
  362. {
  363. nodeKey: '大于500出纳支付退回线',
  364. lineStyle: lineStyle,
  365. coords: [[455, 250], [455, 85]],
  366. symbol: 'none'
  367. },
  368. {
  369. label: {
  370. show: true,
  371. position: 'middle',
  372. opacity: 1,
  373. width: 10,
  374. height: 15,
  375. fontSize: 16,
  376. lineHeight: 0,
  377. color: 'red',
  378. padding: [15, 15, 15, 15],
  379. verticalAlign: 'middle'
  380. },
  381. nodeKey: '大于500出纳支付退回线',
  382. name: '退回发起人',
  383. lineStyle: lineStyle,
  384. coords: [[455, 85], [5, 85]],
  385. symbol: 'none'
  386. },
  387. {
  388. name: '',
  389. // 小于三千复核退回
  390. lineStyle: lineStyle,
  391. coords: [[229.5, 550], [229.5, 530]]
  392. },
  393. {
  394. label: {
  395. show: true,
  396. position: 'middle',
  397. opacity: 1,
  398. width: 10,
  399. height: 15,
  400. fontSize: 16,
  401. lineHeight: 0,
  402. color: 'red',
  403. padding: [15, 15, 15, 15],
  404. verticalAlign: 'middle'
  405. },
  406. name: '返回上一节点',
  407. lineStyle: lineStyle,
  408. coords: [[229.5, 550], [470, 550]],
  409. symbol: 'none'
  410. },
  411. {
  412. name: '大于三千出纳退回线',
  413. lineStyle: lineStyle,
  414. coords: [[470, 550], [470, 280]]
  415. },
  416. {
  417. name: '返回上一节点',
  418. label: {
  419. show: true,
  420. position: 'end',
  421. opacity: 1,
  422. fontSize: 16,
  423. color: 'red'
  424. },
  425. lineStyle: lineStyle,
  426. coords: [[495, 310], [495, 310]],
  427. symbol: 'none'
  428. },
  429. {
  430. nodeKey: '出纳支付过审线',
  431. lineStyle: lineStyle,
  432. coords: [[225, 500], [455, 500]],
  433. symbol: 'none'
  434. },
  435. {
  436. nodeKey: '出纳支付过审线',
  437. lineStyle: lineStyle,
  438. coords: [[455, 500], [455, 405]]
  439. },
  440. {
  441. nodeKey: '大于500出纳支付过审线',
  442. lineStyle: lineStyle,
  443. coords: [[455, 280], [455, 350]]
  444. },
  445. {
  446. nodeKey: 'flow_fgld_1_0_1-yes',
  447. // 分管领导审核过审
  448. lineStyle: lineStyle,
  449. coords: [[225, 250], [280, 250]]
  450. },
  451. {
  452. nodeKey: '上级分管领导过审线',
  453. lineStyle: lineStyle,
  454. coords: [[325, 250], [355, 250]]
  455. },
  456. {
  457. nodeKey: '主要领导过审线',
  458. lineStyle: lineStyle,
  459. coords: [[385, 250], [430, 250]]
  460. },
  461. {
  462. name: '',
  463. nodeKey: '结束',
  464. lineStyle: lineStyle,
  465. coords: [[450, 375], [505, 375]]
  466. }
  467. ]
  468. export default {
  469. data() {
  470. return {
  471. chartStatus: true,
  472. linesData: [],
  473. node: [],
  474. myCharts: null,
  475. nodeColor: [
  476. { name: '审核通过', nodeback: '#2A3980' },
  477. { name: '未经过', nodeback: '#999999' },
  478. { name: '退回', nodeback: '#E04242' },
  479. { name: '审核中', nodeback: '#E08E42' },
  480. { name: '撤回', nodeback: '#4294E0' }
  481. ]
  482. }
  483. },
  484. mounted() {
  485. },
  486. methods: {
  487. reseat() {
  488. this.linesData = [...linesData]
  489. this.node = [...node]
  490. console.log(node)
  491. this.getNode()
  492. },
  493. baseRequest1(prefix, opUrl, postData) {
  494. return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
  495. },
  496. async createNodeCanvas(row) {
  497. this.linesData = JSON.parse(JSON.stringify(linesData))
  498. this.node = JSON.parse(JSON.stringify(node))
  499. const { data } = await this.baseRequest1('FlowMainController', 'getIMGFlowHistroyByFlowMainId', { flowMainId: row.id })
  500. console.log(data)
  501. try {
  502. for (let i = 0; i < data.length; i++) {
  503. let index = this.node.findIndex((e) => e.nodeKey == data[i].nodeKey)
  504. switch (data[i].nodeKey) {
  505. case 'curr_user':
  506. if (data[i].type == 1) {
  507. this.getImgUrl(index, data[i].type)
  508. this.getLineStyle(data[i].nodeKey)
  509. }
  510. break
  511. case 'dept_superior_1_0_1-yes':
  512. this.getImgUrl(index, data[i].type)
  513. if (data[i].type == 1 || data[i].type == 3) {
  514. this.getLineStyle(data[i].nodeKey)
  515. }
  516. if (data[i].type == 2) this.getLineStyle('直接上级审核退回线')
  517. break
  518. case 'dept_head_1_0_1-yes':
  519. if (data[i].type == 1 || data[i].type == 3) {
  520. this.getLineStyle(data[i].nodeKey)
  521. this.getImgUrl(index, data[i].type)
  522. }
  523. if (data[i].type == 2) {
  524. this.getLineStyle(data[i].nodeKey)
  525. this.getLineStyle('部门负责人审核退回线')
  526. this.getImgUrl(index, data[i].type)
  527. }
  528. if (data[i].isPass == '1') {
  529. this.getLineStyle('only_tiaoxiujia1')
  530. let index2 = this.node.findIndex((e) => e.nodeKey == 'isPass')
  531. console.log(this.node, index2)
  532. this.node[index2].symbol = 'image://' + require('../asste/lanfangkuai.png')
  533. }
  534. break
  535. case 'flow_cnzf_0_0_1-yes@noenough':
  536. // noenough代表这是小于3千
  537. this.getImgUrl(index, data[i].type)
  538. this.getLineStyle(data[i].nodeKey)
  539. if (data[i].type == 1 || data[i].type == 3) {
  540. this.node[this.node.findIndex((e) => e.nodeKey == 'flow_cnzf_0_0_1-yes')].symbol = 'image://' + require('../asste/lanselingxin.jpg')
  541. this.getLineStyle('flow_cnzf_0_0_1-yes')
  542. this.getLineStyle('报支金额<500')
  543. }
  544. if (data[i].type == 1) {
  545. this.getLineStyle('出纳支付过审线')
  546. }
  547. if (data[i].type == 2) {
  548. this.node[this.node.findIndex((e) => e.nodeKey == 'flow_cnzf_0_0_1-yes')].symbol = 'image://' + require('../asste/lanselingxin.jpg')
  549. this.getLineStyle('flow_cnzf_0_0_1-yes')
  550. this.getLineStyle('报支金额<500')
  551. this.getLineStyle('小于三千出纳退回线')
  552. }
  553. break
  554. case 'flow_zffh_0_0_1-yes@end':
  555. // noenough代表这是小于3千
  556. this.getImgUrl(index, data[i].type)
  557. this.getLineStyle(data[i].nodeKey)
  558. if (data[i].type == 1 || data[i].type == 3) {
  559. this.getLineStyle('flow_cnzf_0_0_1-yes')
  560. }
  561. if (data[i].type == 1) {
  562. let endIndex = this.node.findIndex((e) => e.name == '结束')
  563. this.getLineStyle('结束')
  564. this.getImgUrl(endIndex, '1')
  565. }
  566. break
  567. case 'flow_fgld_1_0_1-yes':
  568. // flow_cnzf_0_0_1-yes
  569. this.getImgUrl(index, data[i].type)
  570. this.node[this.node.findIndex((e) => e.nodeKey == 'flow_cnzf_0_0_1-yes')].symbol = 'image://' + require('../asste/lanselingxin.jpg')
  571. this.getLineStyle('flow_cnzf_0_0_1-yes')
  572. this.getLineStyle('报支金额>500')
  573. if (data[i].type == 1) {
  574. this.getLineStyle(data[i].nodeKey)
  575. }
  576. if (data[i].type == 2) {
  577. this.getLineStyle('分管领导退回线')
  578. }
  579. break
  580. case 'flow_sjfgld_1_0_1-yes':
  581. this.getImgUrl(index, data[i].type)
  582. if (data[i].type == 1) {
  583. this.getLineStyle(data[i].nodeKey)
  584. this.getLineStyle('上级分管领导过审线')
  585. }
  586. if (data[i].type == 2) {
  587. this.getLineStyle('上级分管领导退回线')
  588. }
  589. break
  590. case 'flow_zyld_1_0_1-yes':
  591. this.getImgUrl(index, data[i].type)
  592. if (data[i].type == 1) {
  593. this.getLineStyle(data[i].nodeKey)
  594. this.getLineStyle('主要领导过审线')
  595. }
  596. if (data[i].type == 2) {
  597. this.getLineStyle('主要领导退回线')
  598. }
  599. break
  600. case 'flow_cnzf_0_0_1-yes@enough':
  601. this.getImgUrl(index, data[i].type)
  602. if (data[i].type == 1) {
  603. this.getLineStyle(data[i].nodeKey)
  604. this.getLineStyle('大于500出纳支付过审线')
  605. }
  606. if (data[i].type == 2) {
  607. this.getLineStyle('大于500出纳支付退回线')
  608. }
  609. break
  610. //
  611. default:
  612. }
  613. }
  614. } catch (e) {
  615. console.log(e)
  616. }
  617. this.getNode()
  618. },
  619. reductionLineStyle(nodeKey) {
  620. for (let i = 0; i < this.linesData.length; i++) {
  621. if (this.linesData[i].nodeKey == nodeKey) {
  622. this.linesData[i].lineStyle = lineStyle
  623. }
  624. }
  625. },
  626. getLineStyle(nodeKey) {
  627. for (let i = 0; i < this.linesData.length; i++) {
  628. if (this.linesData[i].nodeKey == nodeKey) {
  629. this.linesData[i].lineStyle = {
  630. color: '#2A3980',
  631. width: 2
  632. }
  633. }
  634. }
  635. },
  636. getImgUrl(index, type) {
  637. if (index == -1) return
  638. switch (type) {
  639. case '1':
  640. this.node[index].symbol = 'image://' + require('../asste/lanfangkuai.png')
  641. break
  642. case '2':
  643. this.node[index].symbol = 'image://' + require('../asste/hongfangkuai.jpg')
  644. break
  645. case '3':
  646. this.node[index].symbol = 'image://' + require('../asste/huangfanmgkuai.png')
  647. break
  648. case '4' || '5':
  649. this.node[index].symbol = 'image://' + require('../asste/qianlanfangkuai.jpg')
  650. break
  651. default:
  652. }
  653. },
  654. getNode() {
  655. let chartDom = document.getElementById('costCanvas')
  656. this.myCharts = null
  657. this.myCharts = echarts.init(chartDom)
  658. let charts = {
  659. nodes: this.node,
  660. linesData: this.linesData
  661. }
  662. let option = {
  663. xAxis: {
  664. min: 0,
  665. max: 600,
  666. show: false,
  667. type: 'value'
  668. },
  669. yAxis: {
  670. min: 0,
  671. max: 600,
  672. show: false,
  673. type: 'value'
  674. },
  675. grid: {
  676. left: 100,
  677. right: 0,
  678. bottom: 0,
  679. top: 0
  680. },
  681. series: [
  682. {
  683. type: 'graph',
  684. coordinateSystem: 'cartesian2d',
  685. symbol: 'rect',
  686. symbolSize: [80, 40],
  687. itemStyle: {
  688. color: 'rgb(225,7,7)'
  689. },
  690. symbolOffset: [10, 0],
  691. force: {
  692. edgeLength: 100,//连线的长度
  693. repulsion: 200 //子节点之间的间距
  694. },
  695. label: {
  696. show: true,
  697. color: 'white' // 节点文字颜色
  698. },
  699. data: charts.nodes
  700. },
  701. {
  702. type: 'lines',
  703. polyline: false,
  704. coordinateSystem: 'cartesian2d',
  705. symbol: ['', 'arrow'],
  706. symbolSize: 10,
  707. data: charts.linesData
  708. }
  709. ]
  710. }
  711. this.chartStatus = false
  712. this.$nextTick(() => {
  713. this.myCharts.clear()
  714. this.$forceUpdate()
  715. this.myCharts.setOption(option, true)
  716. })
  717. this.chartStatus = true
  718. window.addEventListener('resize', () => {
  719. this.myCharts.resize()
  720. })
  721. }
  722. }
  723. }
  724. </script>
  725. <style scoped>
  726. #costCanvas {
  727. width: 100%;
  728. height: 600px;
  729. background: #F5F5F5;
  730. }
  731. </style>