paymentCanvas.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <div>
  3. <div class="node_info">
  4. <div>节点说明:</div>
  5. <div v-for="item in nodeColor" class="dis_flex">
  6. <div class="node_class" :style="{backgroundColor: item.nodeback}" />
  7. {{ item.name }}
  8. </div>
  9. </div>
  10. <div v-show="true" :id="id" style="width: 100%" />
  11. </div>
  12. </template>
  13. <script>
  14. import * as echarts from 'echarts'
  15. const lineStyle = {
  16. color: '#999999',
  17. width: 2,
  18. type: 'dotted'
  19. }
  20. const redLinestyle = {
  21. color: 'red',
  22. width: 2
  23. }
  24. const node = [ // 节点
  25. {
  26. nodeKey: 'curr_user',
  27. name: '经办人发起',
  28. value: [45, 100],
  29. symbol: 'image://' + require('../asste/huifangkuai.png'),
  30. symbolSize: [110, 60]
  31. },
  32. {
  33. nodeKey: 'dept_head_1_0_1',
  34. name: '部门负责人审核',
  35. value: [125, 100],
  36. symbol: 'image://' + require('../asste/huifangkuai.png'),
  37. symbolSize: [110, 60]
  38. },
  39. {
  40. nodeKey: 'flow_cwld_1_0_1',
  41. name: '财务负责人审核',
  42. value: [205, 100],
  43. symbol: 'image://' + require('../asste/huifangkuai.png'),
  44. symbolSize: [110, 60]
  45. },
  46. {
  47. nodeKey: 'flow_fgld_1_0_1',
  48. name: '分管领导审核',
  49. value: [285, 100],
  50. symbol: 'image://' + require('../asste/huifangkuai.png'),
  51. symbolSize: [110, 60]
  52. },
  53. {
  54. name: '总经理审核',
  55. nodeKey: 'flow_sjfgld_1_0_1',
  56. value: [365, 100],
  57. symbol: 'image://' + require('../asste/huifangkuai.png'),
  58. symbolSize: [110, 60]
  59. },
  60. {
  61. nodeKey: 'flow_zyld_1_0_1',
  62. name: '董事长审核',
  63. value: [445, 100],
  64. symbol: 'image://' + require('../asste/huifangkuai.png'),
  65. symbolSize: [110, 60]
  66. },
  67. {
  68. name: '结束',
  69. value: [525, 100],
  70. symbol: 'image://' + require('../asste/huifangkuai.png'),
  71. symbolSize: [110, 60]
  72. },
  73. {
  74. label: {
  75. show: true,
  76. color: 'red', // 节点文字颜色
  77. backgroundColor: '#f5f5f5'
  78. },
  79. itemStyle: {
  80. color: '#f5f5f5'
  81. },
  82. name: '退回发起人',
  83. value: [350, 400],
  84. symbolSize: [70, 20]
  85. },
  86. {
  87. label: {
  88. show: true,
  89. color: 'red', // 节点文字颜色
  90. backgroundColor: '#f5f5f5'
  91. },
  92. itemStyle: {
  93. color: '#f5f5f5'
  94. },
  95. name: ' 退回发起人 ',
  96. value: [300, 350],
  97. symbolSize: [20, 20]
  98. },
  99. {
  100. label: {
  101. show: true,
  102. color: 'red', // 节点文字颜色
  103. backgroundColor: '#f5f5f5'
  104. },
  105. itemStyle: {
  106. color: '#f5f5f5'
  107. },
  108. name: ' 退回发起人 ',
  109. value: [250, 300],
  110. symbolSize: [20, 20]
  111. },
  112. {
  113. label: {
  114. show: true,
  115. color: 'red', // 节点文字颜色
  116. backgroundColor: '#f5f5f5'
  117. },
  118. itemStyle: {
  119. color: '#f5f5f5'
  120. },
  121. name: ' 退回发起人 ',
  122. value: [250, 300],
  123. symbolSize: [20, 20]
  124. },
  125. {
  126. label: {
  127. show: true,
  128. color: 'red', // 节点文字颜色
  129. backgroundColor: '#f5f5f5'
  130. },
  131. itemStyle: {
  132. color: '#f5f5f5'
  133. },
  134. name: ' 退回发起人 ',
  135. value: [175, 250],
  136. symbolSize: [20, 20]
  137. },
  138. {
  139. label: {
  140. show: true,
  141. color: 'red', // 节点文字颜色
  142. backgroundColor: '#f5f5f5'
  143. },
  144. itemStyle: {
  145. color: '#f5f5f5'
  146. },
  147. name: ' 退回发起人 ',
  148. value: [100, 200],
  149. symbolSize: [20, 20]
  150. }
  151. ]
  152. const linesData = [ // 连线
  153. {
  154. nodeKey: 'curr_user',
  155. lineStyle: lineStyle,
  156. coords: [[45, 100], [105, 100]]
  157. },
  158. {
  159. nodeKey: 'dept_head_1_0_1',
  160. lineStyle: lineStyle,
  161. coords: [[125, 100], [185, 100]]
  162. },
  163. {
  164. nodeKey: 'flow_cwld_1_0_1',
  165. lineStyle: lineStyle,
  166. coords: [[205, 100], [265, 100]]
  167. },
  168. {
  169. nodeKey: 'flow_fgld_1_0_1',
  170. lineStyle: lineStyle,
  171. coords: [[285, 100], [345, 100]]
  172. },
  173. {
  174. nodeKey: 'flow_sjfgld_1_0_1',
  175. lineStyle: lineStyle,
  176. coords: [[365, 100], [425, 100]]
  177. },
  178. {
  179. nodeKey: 'flow_zyld_1_0_1',
  180. lineStyle: lineStyle,
  181. coords: [[445, 100], [505, 100]]
  182. },
  183. {
  184. nodeKey: 'flow_zyld_1_0_1_back',
  185. lineStyle: lineStyle,
  186. coords: [[450, 100], [450, 400]],
  187. symbol: 'none'
  188. },
  189. {
  190. nodeKey: 'flow_sjfgld_1_0_1_back',
  191. lineStyle: lineStyle,
  192. coords: [[370, 100], [370, 350]],
  193. symbol: 'none'
  194. },
  195. {
  196. nodeKey: 'flow_fgld_1_0_1_back',
  197. lineStyle: lineStyle,
  198. coords: [[290, 100], [290, 300]],
  199. symbol: 'none'
  200. },
  201. {
  202. nodeKey: 'flow_cwld_1_0_1_back',
  203. lineStyle: lineStyle,
  204. coords: [[210, 100], [210, 250]],
  205. symbol: 'none'
  206. },
  207. {
  208. nodeKey: 'dept_head_1_0_1_back',
  209. lineStyle: lineStyle,
  210. coords: [[130, 100], [130, 200]],
  211. symbol: 'none'
  212. },
  213. // {
  214. // lineStyle: redLinestyle,
  215. // coords: [[50, 100], [50, 400]],
  216. // symbol: 'none'
  217. // },
  218. {
  219. nodeKey: 'flow_zyld_1_0_1_back',
  220. lineStyle: lineStyle,
  221. coords: [[50, 100], [50, 400]],
  222. symbol: 'none'
  223. },
  224. {
  225. nodeKey: 'flow_sjfgld_1_0_1_back',
  226. lineStyle: lineStyle,
  227. coords: [[50, 100], [50, 350]],
  228. symbol: 'none'
  229. },
  230. {
  231. nodeKey: 'flow_fgld_1_0_1_back',
  232. lineStyle: lineStyle,
  233. coords: [[50, 100], [50, 300]],
  234. symbol: 'none'
  235. },
  236. {
  237. nodeKey: 'flow_cwld_1_0_1_back',
  238. lineStyle: lineStyle,
  239. coords: [[50, 100], [50, 250]],
  240. symbol: 'none'
  241. },
  242. {
  243. nodeKey: 'dept_head_1_0_1_back',
  244. lineStyle: lineStyle,
  245. coords: [[50, 100], [50, 200]],
  246. symbol: 'none'
  247. },
  248. {
  249. lineStyle: lineStyle,
  250. nodeKey: 'flow_zyld_1_0_1_back',
  251. coords: [[450, 400], [50, 400]],
  252. symbol: 'none'
  253. },
  254. {
  255. nodeKey: 'flow_sjfgld_1_0_1_back',
  256. lineStyle: lineStyle,
  257. coords: [[370, 350], [50, 350]],
  258. symbol: 'none'
  259. },
  260. {
  261. nodeKey: 'flow_fgld_1_0_1_back',
  262. lineStyle: lineStyle,
  263. coords: [[290, 300], [50, 300]],
  264. symbol: 'none'
  265. },
  266. {
  267. nodeKey: 'flow_cwld_1_0_1_back',
  268. lineStyle: lineStyle,
  269. coords: [[210, 250], [50, 250]],
  270. symbol: 'none'
  271. },
  272. {
  273. nodeKey: 'dept_head_1_0_1_back',
  274. lineStyle: lineStyle,
  275. coords: [[130, 200], [50, 200]],
  276. symbol: 'none'
  277. },
  278. {
  279. lineStyle: lineStyle,
  280. coords: [[50, 150], [50, 150]],
  281. symbol: 'none'
  282. }
  283. ]
  284. export default {
  285. name: 'AddWorkCanvas',
  286. props: {
  287. id: {
  288. type: String,
  289. default: ''
  290. }
  291. },
  292. data() {
  293. return {
  294. linesData: [],
  295. node: [],
  296. nodeColor: [
  297. { name: '审核通过', nodeback: '#2A3980' },
  298. { name: '未经过', nodeback: '#999999' },
  299. { name: '退回', nodeback: '#E04242' },
  300. { name: '审核中', nodeback: '#E08E42' },
  301. { name: '撤回', nodeback: '#4294E0' }
  302. ]
  303. }
  304. },
  305. mounted() {
  306. },
  307. methods: {
  308. baseRequest1(prefix, opUrl, postData) {
  309. return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
  310. },
  311. async createNodeCanvas(row) {
  312. this.linesData = JSON.parse(JSON.stringify(linesData))
  313. this.node = JSON.parse(JSON.stringify(node))
  314. const { data } = await this.baseRequest1('FlowMainController', 'getIMGFlowHistroyByFlowMainId', { flowMainId: row.id })
  315. console.log(data)
  316. for (let i = 0; i < data.length; i++) {
  317. const index = this.node.findIndex((e) => e.nodeKey == data[i].nodeKey)
  318. switch (data[i].nodeKey) {
  319. case 'curr_user':
  320. if (data[i].type == 1) {
  321. this.getImgUrl(index, data[i].type)
  322. this.getLineStyle(data[i].nodeKey)
  323. }
  324. break
  325. case 'dept_head_1_0_1':
  326. if (data[i].type == 1 || data[i].type == 3) {
  327. this.getImgUrl(index, data[i].type)
  328. }
  329. if (data[i].type == 1) {
  330. this.getLineStyle(data[i].nodeKey)
  331. }
  332. if (data[i].type == 2) {
  333. this.getLineStyle('dept_head_1_0_1_back')
  334. this.getImgUrl(index, data[i].type)
  335. }
  336. break
  337. case 'flow_cwld_1_0_1':
  338. if (data[i].type == 1 || data[i].type == 3) {
  339. this.getImgUrl(index, data[i].type)
  340. }
  341. if (data[i].type == 1) {
  342. this.getLineStyle(data[i].nodeKey)
  343. }
  344. if (data[i].type == 2) {
  345. this.getLineStyle('flow_cwld_1_0_1_back')
  346. this.getImgUrl(index, data[i].type)
  347. }
  348. if (data[i].isPass == '1') {
  349. this.getLineStyle('only_tiaoxiujia1')
  350. const index2 = this.node.findIndex((e) => e.nodeKey == 'isPass')
  351. console.log(this.node, index2)
  352. this.node[index2].symbol = 'image://' + require('../asste/lanfangkuai.png')
  353. }
  354. break
  355. case 'only_tiaoxiujia':
  356. if (data[i].type == 1 || data[i].type == 3) {
  357. this.node[index].symbol = 'image://' + require('../asste/lanselingxin.jpg')
  358. this.getLineStyle(data[i].nodeKey)
  359. }
  360. case 'flow_fgld_1_0_1':
  361. this.getImgUrl(index, data[i].type)
  362. if (data[i].type == 1) {
  363. this.getLineStyle('flow_fgld_1_0_1')
  364. }
  365. if (data[i].type == 2) {
  366. this.getLineStyle('flow_fgld_1_0_1_back')
  367. }
  368. break
  369. case 'flow_sjfgld_1_0_1':
  370. this.getLineStyle(data[i].nodeKey)
  371. this.getImgUrl(index, data[i].type)
  372. if (data[i].type == 2) {
  373. this.getLineStyle('flow_sjfgld_1_0_1_back')
  374. // this.node[index].symbol = 'image://' + require('../asste/lanselingxin.jpg')
  375. }
  376. break
  377. case 'flow_zyld_1_0_1':
  378. this.getLineStyle('less_3day1')
  379. if (data[i].type == 1) {
  380. this.getLineStyle('flow_sjfgld_1_0_1')
  381. this.getLineStyle(data[i].nodeKey)
  382. this.getImgUrl(index, data[i].type)
  383. this.getLineStyle('less_3day3')
  384. const endIndex = this.node.findIndex((e) => e.name == '结束')
  385. this.getImgUrl(endIndex, '1')
  386. }
  387. if (data[i].type == 2) {
  388. this.getLineStyle('flow_zyld_1_0_1_back')
  389. // this.node[index].symbol = 'image://' + require('../asste/lanselingxin.jpg')
  390. }
  391. break
  392. //
  393. default:
  394. }
  395. }
  396. this.getNode()
  397. },
  398. reductionLineStyle(nodeKey) {
  399. for (let i = 0; i < this.linesData.length; i++) {
  400. if (this.linesData[i].nodeKey == nodeKey) {
  401. this.linesData[i].lineStyle = lineStyle
  402. }
  403. }
  404. },
  405. getLineStyle(nodeKey) {
  406. for (let i = 0; i < this.linesData.length; i++) {
  407. if (this.linesData[i].nodeKey == nodeKey) {
  408. this.linesData[i].lineStyle = {
  409. color: '#2A3980',
  410. width: 2
  411. }
  412. }
  413. }
  414. },
  415. getImgUrl(index, type) {
  416. if (index == -1) return
  417. switch (type) {
  418. case '1':
  419. this.node[index].symbol = 'image://' + require('../asste/lanfangkuai.png')
  420. break
  421. case '2':
  422. this.node[index].symbol = 'image://' + require('../asste/hongfangkuai.jpg')
  423. break
  424. case '3':
  425. this.node[index].symbol = 'image://' + require('../asste/huangfanmgkuai.png')
  426. break
  427. case '4' || '5':
  428. this.node[index].symbol = 'image://' + require('../asste/qianlanfangkuai.jpg')
  429. break
  430. default:
  431. }
  432. },
  433. getNode() {
  434. this.$nextTick(() => {
  435. const chartDom = document.getElementById(this.id)
  436. let myCharts = null
  437. myCharts = echarts.init(chartDom)
  438. const charts = {
  439. nodes: this.node,
  440. linesData: this.linesData
  441. }
  442. const option = {
  443. xAxis: {
  444. min: 0,
  445. max: 600,
  446. padding: [0, 50, 0, 50],
  447. show: false,
  448. type: 'value'
  449. },
  450. yAxis: {
  451. min: 0,
  452. max: 450,
  453. show: false,
  454. type: 'value'
  455. },
  456. grid: {
  457. left: 50,
  458. right: 0,
  459. bottom: 0,
  460. top: 0
  461. },
  462. series: [
  463. {
  464. type: 'graph',
  465. coordinateSystem: 'cartesian2d',
  466. symbol: 'rect',
  467. symbolSize: [80, 40],
  468. itemStyle: {
  469. color: 'rgb(225,7,7)'
  470. },
  471. symbolOffset: [10, 0],
  472. // force: {
  473. // edgeLength: 100,//连线的长度
  474. // repulsion: 200 //子节点之间的间距
  475. // },
  476. label: {
  477. show: true,
  478. color: 'white' // 节点文字颜色
  479. },
  480. data: charts.nodes
  481. },
  482. {
  483. type: 'lines',
  484. polyline: false,
  485. coordinateSystem: 'cartesian2d',
  486. symbol: ['', 'arrow'],
  487. symbolSize: 10,
  488. data: charts.linesData
  489. }
  490. ]
  491. }
  492. myCharts.clear()
  493. myCharts.setOption(option)
  494. window.addEventListener('resize', () => {
  495. myCharts.resize()
  496. })
  497. })
  498. }
  499. }
  500. }
  501. </script>
  502. <style scoped>
  503. #containeraddworkdetail1 {
  504. height: 600px;
  505. width: 100%;
  506. background: #F5F5F5;
  507. }
  508. #paymanetDetail{
  509. height: 600px;
  510. width: 100%;
  511. background: #F5F5F5;
  512. }
  513. #paymentConfirm{
  514. height: 600px;
  515. width: 100%;
  516. background: #F5F5F5;
  517. }
  518. </style>