approveJS.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  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. } else {
  80. this.getHeChaList(id)
  81. }
  82. }
  83. })
  84. },
  85. getJiHuaZiBiaoJiSuan (id) {
  86. const sql = `select * from t_rkzztkhcjhzb where parent_id_ = '${id}'`
  87. this.$common.request('sql', sql).then(res => {
  88. const { data = [] } = res.variables || {}
  89. if (data.length > 0) {
  90. const list = []
  91. data.forEach(item => {
  92. const showIndex = this.typeList.findIndex(it => it === item.shi_fou_guo_shen_)
  93. list.push(showIndex + 1)
  94. })
  95. const sum = list.reduce((total, current) => total + current)
  96. const dataLength = data.length
  97. const totalMs = sum / dataLength / 5 * 100
  98. this.getOption(parseInt(totalMs))
  99. }
  100. })
  101. },
  102. getShiShiData (id, activeIndex) {
  103. 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_`
  104. // if (activeIndex === 1) {
  105. // sql = `select * from t_rkzztkhcjhzb where parent_id_ = '${id}' order by tiao_kuan_hao_`
  106. // }
  107. // if (activeIndex === 2 || activeIndex === 3 || activeIndex === 4) {
  108. // }
  109. this.$common.request('sql', sql).then(res => {
  110. const { data = [] } = res.variables || {}
  111. if (data.length > 0) {
  112. this.tableData = data
  113. }
  114. })
  115. },
  116. getBuFuHeXiangMu (id) {
  117. 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_`
  118. this.$common.request('sql', sql).then(res => {
  119. const { data = [] } = res.variables || {}
  120. if (data.length > 0) {
  121. this.buTableData = data
  122. }
  123. })
  124. },
  125. getBuFuHeTuBiao (id) {
  126. const second = this.$store.getters.level.second
  127. 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`
  128. 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`
  129. Promise.all([this.$common.request('sql', sql1), this.$common.request('sql', sql2)]).then(res => {
  130. if (res.length > 0) {
  131. const data1 = res[0].variables.data
  132. const data2 = res[1].variables.data
  133. const list1 = data1.map(item => item.value)
  134. const list2 = data2.map(item => item.value)
  135. const accept = echarts.init(this.$refs.Echart2)
  136. accept.setOption(JSON.parse(JSON.stringify(this.barData(list1, list2))))
  137. }
  138. })
  139. },
  140. getHeChaList (id) {
  141. const second = this.$store.getters.level.second
  142. 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}' WHERE a.party_type_ = 'position' AND a.PATH_ LIKE '%${second}%' AND a.DEPTH_ = '4' GROUP BY a.NAME_ order by a.ID_ desc`
  143. 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.shi_fou_guo_shen_ = '待审核' or b.shi_fou_guo_shen_ = '待确认' or b.shi_fou_guo_shen_ = '已结束') WHERE a.party_type_ = 'position' AND a.PATH_ LIKE '%${second}%' AND a.DEPTH_ = '4' GROUP BY a.NAME_ order by a.ID_ desc`
  144. const sql3 = `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.shi_fou_guo_shen_ = '待分配' or b.shi_fou_guo_shen_ = '待核查') WHERE a.party_type_ = 'position' AND a.PATH_ LIKE '%${second}%' AND a.DEPTH_ = '4' GROUP BY a.NAME_ order by a.ID_ desc`
  145. Promise.all([this.$common.request('sql', sql1), this.$common.request('sql', sql2), this.$common.request('sql', sql3)]).then(res => {
  146. if (res.length > 0) {
  147. const data1 = res[0].variables.data
  148. const data2 = res[1].variables.data
  149. const data3 = res[2].variables.data
  150. const list1 = data1.map(item => item.value)
  151. const list2 = data2.map(item => item.value)
  152. const list3 = data3.map(item => item.value)
  153. const accept = echarts.init(this.$refs.Echart2)
  154. accept.setOption(JSON.parse(JSON.stringify(this.barDataPlan(list1, list2, list3))))
  155. }
  156. })
  157. },
  158. linHeg (value) {
  159. // rowMAx 控制一行多少字
  160. const rowMAx = 1
  161. let overValue = ''
  162. for (let i = 0; i < value.length; i++) {
  163. if ((i % rowMAx === 0) && (i !== 0)) {
  164. overValue += '\n'
  165. overValue += value[i]
  166. } else {
  167. overValue += value[i]
  168. }
  169. }
  170. return overValue
  171. },
  172. getOption (totalMs = 0) {
  173. const option = {
  174. series: [
  175. {
  176. type: 'gauge',
  177. min: 0,
  178. max: 100,
  179. animationDuration: 3000,
  180. axisLine: {
  181. lineStyle: {
  182. width: 30,
  183. color: [
  184. [0.3, '#fd666d'],
  185. [0.7, '#37a2da'],
  186. [1, '#67e0e3']
  187. ]
  188. }
  189. },
  190. pointer: {
  191. itemStyle: {
  192. color: 'auto'
  193. }
  194. },
  195. axisTick: {
  196. distance: -30,
  197. length: 8,
  198. lineStyle: {
  199. color: '#fff',
  200. width: 2
  201. }
  202. },
  203. splitLine: {
  204. distance: -30,
  205. length: 30,
  206. lineStyle: {
  207. color: '#fff',
  208. width: 4
  209. }
  210. },
  211. axisLabel: {
  212. show: true
  213. },
  214. detail: {
  215. valueAnimation: true,
  216. formatter: '{value} %',
  217. color: 'auto',
  218. top: '100%',
  219. offsetCenter: [0, '75%']
  220. },
  221. data: [{ value: totalMs, top: '100%' }]
  222. }
  223. ]
  224. }
  225. const accept = echarts.init(this.$refs.Echart)
  226. accept.setOption(JSON.parse(JSON.stringify(option)))
  227. // this.show1 = true
  228. },
  229. barData (data1, data2) {
  230. const barDataTy = {
  231. // 图例设置
  232. legend: {
  233. textStyle: {
  234. fontSize: 12,
  235. color: '#333'
  236. }
  237. },
  238. title: {
  239. show: true,
  240. text: '条款清单',
  241. textStyle: {
  242. // color: '#fff',
  243. fontSize: 20,
  244. fontWeight: '600'
  245. },
  246. textAlign: 'center',
  247. left: '50%',
  248. top: '20px'
  249. },
  250. xAxis: {
  251. name: '部门',
  252. type: 'category',
  253. data: this.positionList,
  254. axisTick: {
  255. alignWithLabel: true
  256. },
  257. axisLabel: {
  258. rotate: 30,
  259. interval: 0,
  260. margin: 10
  261. }
  262. },
  263. yAxis: {
  264. type: 'value',
  265. name: '数量(项目)',
  266. minInterval: 1,
  267. nameTextStyle: {
  268. fontSize: 14
  269. },
  270. splitLine: {
  271. show: false
  272. }
  273. },
  274. series: [{
  275. name: '符合',
  276. type: 'bar',
  277. barGap: 0,
  278. emphasis: {
  279. focus: 'series'
  280. },
  281. data: data2
  282. },
  283. {
  284. name: '不符合',
  285. type: 'bar',
  286. barGap: 0,
  287. emphasis: {
  288. focus: 'series'
  289. },
  290. data: data1
  291. }],
  292. color: ['#64C7BF', '#fd666d'],
  293. tooltip: {
  294. show: true,
  295. trigger: 'axis'
  296. }
  297. }
  298. return barDataTy
  299. },
  300. barDataPlan (data1, data2, data3) {
  301. const barDataTy = {
  302. // 图例设置
  303. legend: {
  304. textStyle: {
  305. fontSize: 12,
  306. color: '#333'
  307. }
  308. },
  309. title: {
  310. show: true,
  311. text: '核查进度',
  312. textStyle: {
  313. // color: '#fff',
  314. fontSize: 20,
  315. fontWeight: '600'
  316. },
  317. textAlign: 'center',
  318. left: '50%',
  319. top: '20px'
  320. },
  321. xAxis: {
  322. name: '部门',
  323. type: 'category',
  324. data: this.positionList,
  325. axisTick: {
  326. alignWithLabel: true
  327. },
  328. axisLabel: {
  329. rotate: 30,
  330. interval: 0,
  331. margin: 10
  332. }
  333. },
  334. yAxis: {
  335. type: 'value',
  336. name: '数量(项目)',
  337. minInterval: 1,
  338. nameTextStyle: {
  339. fontSize: 14
  340. },
  341. splitLine: {
  342. show: false
  343. }
  344. },
  345. series: [{
  346. name: '总数',
  347. type: 'bar',
  348. barGap: 0,
  349. emphasis: {
  350. focus: 'series'
  351. },
  352. data: data1
  353. },
  354. {
  355. name: '已核查',
  356. type: 'bar',
  357. barGap: 0,
  358. emphasis: {
  359. focus: 'series'
  360. },
  361. data: data2
  362. }, {
  363. name: '未核查',
  364. type: 'bar',
  365. barGap: 0,
  366. emphasis: {
  367. focus: 'series'
  368. },
  369. data: data3
  370. }],
  371. color: ['#037ef3', '#7552cc', '#0cb9c1'],
  372. tooltip: {
  373. show: true,
  374. trigger: 'axis'
  375. }
  376. }
  377. return barDataTy
  378. }
  379. }
  380. }