approveJS.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. import dataTemplate from '@/store/modules/ibps/modules/dataTemplate'
  2. import echarts from 'echarts'
  3. export default {
  4. data () {
  5. return {
  6. typeList: ['待分配', '待核查', '待审核', '待确认', '已结束'],
  7. posiList: [],
  8. positionList: []
  9. }
  10. },
  11. methods: {
  12. getPosition () {
  13. const second = this.$store.getters.level.second
  14. const sql = `select * from ibps_party_entity where party_type_ = 'position' and PATH_ like '%${second}%' and DEPTH_ = '4' order by ID_ desc`
  15. this.$common.request('sql', sql).then(res => {
  16. const { data = [] } = res.variables || {}
  17. if (data.length > 0) {
  18. const list = []
  19. const list2 = []
  20. data.forEach(item => {
  21. list.push(item.NAME_)
  22. list2.push(item.NAME_)
  23. })
  24. this.posiList = list
  25. this.positionList = list2
  26. }
  27. })
  28. },
  29. getColorRe (list) {
  30. const colors = [
  31. '#d20962',
  32. '#f47721',
  33. '#7ac143',
  34. '#00a78e',
  35. '#00bce4',
  36. '#7d3f98',
  37. '#037ef3',
  38. '#f85a40',
  39. '#00c16e',
  40. '#ffd900',
  41. '#0cb9c1',
  42. '#7552cc'
  43. ]
  44. const colorList = []
  45. const res = []
  46. list.forEach((item, index) => {
  47. const random = parseInt(Math.random() * 12)
  48. const obj = {
  49. name: item.name,
  50. value: item.count,
  51. textStyle: {
  52. color: colors[index > 12 ? index - 11 : index]
  53. }
  54. }
  55. res.push(obj)
  56. colorList.push(colors[index > 12 ? index - 11 : index])
  57. })
  58. const dt = {
  59. res,
  60. colorList
  61. }
  62. return dt
  63. },
  64. getJiHuaZhuangTai (id) {
  65. const sql = `select * from t_rkzztkhcjh where id_ = '${id}'`
  66. this.$common.request('sql', sql).then(res => {
  67. const { data = [] } = res.variables || {}
  68. if (data.length > 0) {
  69. const index = this.typeList.findIndex(item => item === data[0].shi_fou_guo_shen_)
  70. const addIndex = index + 1
  71. this.activeIndex = addIndex
  72. this.clickIndex = addIndex + 1
  73. this.getShiShiData(id, this.activeIndex)
  74. this.getJiHuaZiBiaoJiSuan(id)
  75. // this.getOption()
  76. if (index === 4) {
  77. this.getBuFuHeXiangMu(id)
  78. this.getBuFuHeTuBiao(id)
  79. }
  80. }
  81. })
  82. },
  83. getJiHuaZiBiaoJiSuan (id) {
  84. const sql = `select * from t_rkzztkhcjhzb where parent_id_ = '${id}'`
  85. this.$common.request('sql', sql).then(res => {
  86. const { data = [] } = res.variables || {}
  87. if (data.length > 0) {
  88. const list = []
  89. data.forEach(item => {
  90. const showIndex = this.typeList.findIndex(it => it === item.shi_fou_guo_shen_)
  91. list.push(showIndex + 1)
  92. })
  93. const sum = list.reduce((total, current) => total + current)
  94. const dataLength = data.length
  95. const totalMs = sum / dataLength / 5 * 100
  96. this.getOption(parseInt(totalMs))
  97. }
  98. })
  99. },
  100. getShiShiData (id, activeIndex) {
  101. const sql = `select a.*,c.NAME_ as zuYuanPosiName,d.NAME_ as zuYuanName,e.NAME_ as zuZhangName,g.NAME_ as zuZhangBnMen,h.NAME_ as yuanZuZhangBuMen,i.NAME_ as yuanZuZhangName from t_rkzztkhcjhzb a left join t_rkzztkhcjhzb b on a.id_ = b.ji_hua_zi_biao_id left join ibps_party_position c on a.bian_zhi_bu_men_ = c.ID_ left join ibps_party_position h on a.bu_men_ = h.ID_ left join ibps_party_employee i on a.zu_chang_ = i.ID_ left join ibps_party_employee d on a.zu_yuan_ = d.ID_ left join t_hcssjhb f on b.parent_id_ = f.id_ left join ibps_party_position g on f.bian_zhi_bu_men_ = g.ID_ left join ibps_party_employee e on f.bian_zhi_ren_ = e.ID_ where a.parent_id_ = '${id}' order by a.tiao_kuan_hao_`
  102. // if (activeIndex === 1) {
  103. // sql = `select * from t_rkzztkhcjhzb where parent_id_ = '${id}' order by tiao_kuan_hao_`
  104. // }
  105. // if (activeIndex === 2 || activeIndex === 3 || activeIndex === 4) {
  106. // }
  107. this.$common.request('sql', sql).then(res => {
  108. const { data = [] } = res.variables || {}
  109. if (data.length > 0) {
  110. this.tableData = data
  111. }
  112. })
  113. },
  114. getBuFuHeXiangMu (id) {
  115. const sql = `select a.*,c.NAME_ as zuYuanPosiName,d.NAME_ as zuYuanName,e.NAME_ as zuZhangName,g.NAME_ as zuZhangBnMen from t_rkzztkhcjhzb a left join t_rkzztkhcjhzb b on a.id_ = b.ji_hua_zi_biao_id left join ibps_party_position c on a.bian_zhi_bu_men_ = c.ID_ left join ibps_party_employee d on a.zu_yuan_ = d.ID_ left join t_hcssjhb f on b.parent_id_ = f.id_ left join ibps_party_position g on f.bian_zhi_bu_men_ = g.ID_ left join ibps_party_employee e on f.bian_zhi_ren_ = e.ID_ where a.parent_id_ = '${id}' and a.shen_he_jie_guo_ = 'N' order by a.tiao_kuan_hao_`
  116. this.$common.request('sql', sql).then(res => {
  117. const { data = [] } = res.variables || {}
  118. if (data.length > 0) {
  119. this.buTableData = data
  120. }
  121. })
  122. },
  123. getBuFuHeTuBiao (id) {
  124. const second = this.$store.getters.level.second
  125. const sql1 = `select a.NAME_ as name,COALESCE(COUNT(b.id_), 0) AS value FROM ibps_party_entity a LEFT JOIN t_rkzztkhcjhzb b ON a.ID_ = b.bu_men_ AND b.parent_id_ = '${id}' AND b.shen_he_jie_guo_ = 'N' WHERE a.party_type_ = 'position' AND a.PATH_ LIKE '%${second}%' AND a.DEPTH_ = '4' GROUP BY a.NAME_ order by a.ID_ desc`
  126. const sql2 = `select a.NAME_ as name,COALESCE(COUNT(b.id_), 0) AS value FROM ibps_party_entity a LEFT JOIN t_rkzztkhcjhzb b ON a.ID_ = b.bu_men_ AND b.parent_id_ = '${id}' AND b.shen_he_jie_guo_ = 'Y' WHERE a.party_type_ = 'position' AND a.PATH_ LIKE '%${second}%' AND a.DEPTH_ = '4' GROUP BY a.NAME_ order by a.ID_ desc`
  127. Promise.all([this.$common.request('sql', sql1), this.$common.request('sql', sql2)]).then(res => {
  128. if (res.length > 0) {
  129. const data1 = res[0].variables.data
  130. const data2 = res[1].variables.data
  131. const list1 = data1.map(item => item.value)
  132. const list2 = data2.map(item => item.value)
  133. const accept = echarts.init(this.$refs.Echart2)
  134. accept.setOption(JSON.parse(JSON.stringify(this.barData(list1, list2))))
  135. }
  136. })
  137. // this.$common.request('sql', sql).then(res => {
  138. // const { data = [] } = res.variables || {}
  139. // if (data.length > 0) {
  140. // // this.buTableData = data
  141. // const list = []
  142. // data.forEach(item => {
  143. // list.push(item.name)
  144. // })
  145. // const dt = this.getColorRe(data)
  146. // const accept = echarts.init(this.$refs.Echart2)
  147. // accept.setOption(JSON.parse(JSON.stringify(this.barData(list, dt.res, dt.colorList))))
  148. // }
  149. // })
  150. },
  151. linHeg (value) {
  152. // rowMAx 控制一行多少字
  153. const rowMAx = 1
  154. let overValue = ''
  155. for (let i = 0; i < value.length; i++) {
  156. if ((i % rowMAx === 0) && (i !== 0)) {
  157. overValue += '\n'
  158. overValue += value[i]
  159. } else {
  160. overValue += value[i]
  161. }
  162. }
  163. return overValue
  164. },
  165. getOption (totalMs = 0) {
  166. const option = {
  167. series: [
  168. {
  169. type: 'gauge',
  170. min: 0,
  171. max: 100,
  172. animationDuration: 3000,
  173. axisLine: {
  174. lineStyle: {
  175. width: 30,
  176. color: [
  177. [0.3, '#fd666d'],
  178. [0.7, '#37a2da'],
  179. [1, '#67e0e3']
  180. ]
  181. }
  182. },
  183. pointer: {
  184. itemStyle: {
  185. color: 'auto'
  186. }
  187. },
  188. axisTick: {
  189. distance: -30,
  190. length: 8,
  191. lineStyle: {
  192. color: '#fff',
  193. width: 2
  194. }
  195. },
  196. splitLine: {
  197. distance: -30,
  198. length: 30,
  199. lineStyle: {
  200. color: '#fff',
  201. width: 4
  202. }
  203. },
  204. axisLabel: {
  205. show: true
  206. },
  207. detail: {
  208. valueAnimation: true,
  209. formatter: '{value} %',
  210. color: 'auto',
  211. top: '100%',
  212. offsetCenter: [0, '75%']
  213. },
  214. data: [{ value: totalMs, top: '100%' }]
  215. }
  216. ]
  217. }
  218. const accept = echarts.init(this.$refs.Echart)
  219. accept.setOption(JSON.parse(JSON.stringify(option)))
  220. // this.show1 = true
  221. },
  222. barData (data1, data2) {
  223. const barDataTy = {
  224. // 图例设置
  225. legend: {
  226. textStyle: {
  227. fontSize: 12,
  228. color: '#333'
  229. }
  230. },
  231. title: {
  232. show: true,
  233. text: '条款清单',
  234. textStyle: {
  235. // color: '#fff',
  236. fontSize: 20,
  237. fontWeight: '600'
  238. },
  239. textAlign: 'center',
  240. left: '50%',
  241. top: '20px'
  242. },
  243. xAxis: {
  244. name: '部门',
  245. type: 'category',
  246. data: this.positionList,
  247. axisTick: {
  248. alignWithLabel: true
  249. },
  250. axisLabel: {
  251. rotate: 30,
  252. interval: 0,
  253. margin: 10
  254. }
  255. },
  256. yAxis: {
  257. type: 'value',
  258. name: '数量(项目)',
  259. minInterval: 1,
  260. nameTextStyle: {
  261. fontSize: 14
  262. },
  263. splitLine: {
  264. show: false
  265. }
  266. },
  267. series: [{
  268. name: '符合',
  269. type: 'bar',
  270. barGap: 0,
  271. emphasis: {
  272. focus: 'series'
  273. },
  274. data: data2
  275. },
  276. {
  277. name: '不符合',
  278. type: 'bar',
  279. barGap: 0,
  280. emphasis: {
  281. focus: 'series'
  282. },
  283. data: data1
  284. }],
  285. color: ['#64C7BF', '#73A0FA'],
  286. tooltip: {
  287. show: true,
  288. trigger: 'axis'
  289. }
  290. }
  291. // const barData = {
  292. // title: {
  293. // show: true,
  294. // text: '不符合条款清单比例',
  295. // textStyle: {
  296. // color: '#000000',
  297. // fontSize: 20,
  298. // fontWeight: '600'
  299. // },
  300. // textAlign: 'center',
  301. // left: '50%',
  302. // top: '10px'
  303. // },
  304. // legend: {
  305. // orient: 'horizontal',
  306. // show: true,
  307. // left: 'center',
  308. // bottom: 10,
  309. // z: 3,
  310. // // itemWidth: 25,
  311. // // itemHeight: 14,
  312. // // itemGap: 10,
  313. // data: legendData
  314. // },
  315. // series: [
  316. // {
  317. // name: '',
  318. // type: 'pie',
  319. // radius: '60%',
  320. // center: ['50%', '50%'],
  321. // data: seriesData,
  322. // itemStyle: {
  323. // emphasis: {
  324. // shadowBlur: 10,
  325. // shadowOffsetX: 0,
  326. // shadowColor: 'rgba(0, 0, 0, 0.5)'
  327. // },
  328. // normal: {
  329. // label: {
  330. // show: true,
  331. // position: 'outer',
  332. // // formatter: `占比:{d}%\n\n\r{b}:{c}`,
  333. // formatter: `{b}:{c}\n占比:{d}%`,
  334. // fontSize: 14
  335. // },
  336. // labelLine: {
  337. // show: true
  338. // }
  339. // }
  340. // }
  341. // }
  342. // ],
  343. // color,
  344. // tooltip: {
  345. // show: true,
  346. // trigger: 'item',
  347. // formatter: '不符合条款清单<br/>{b}:{c}<br/>占比:{d}%'
  348. // }
  349. // }
  350. return barDataTy
  351. }
  352. }
  353. }