personal_data_statistics.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. var year = new Date().getFullYear();
  2. var months = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
  3. var monthsCH = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
  4. var array_year_score = new Array();
  5. var array_check_type = new Array();
  6. var user_id = 2424; // 用户假数据
  7. var score_statistics;
  8. var check_type;
  9. var cur_status;
  10. var hide = false;
  11. var array_points = new Array();
  12. var array_points2 = new Array();
  13. // 默认初始化日期一个月
  14. $(".div-start input").val(new Date().getFullYear() + "-" + (new Date().getMonth() > 10 ? new Date().getMonth() : "0" + new Date().getMonth()) + "-26");
  15. $(".div-end input").val(new Date().getFullYear() + "-" + (new Date().getMonth() + 1 > 10 ? new Date().getMonth() + 1 : "0" + (new Date().getMonth() + 1)) + "-25");
  16. var start_date = dateChange(moment($(".div-start input").val() + " 00:00:00"), 60 * 60 * 1000);
  17. var end_date = $(".div-end input").val() + " 23:00:00";
  18. /**
  19. * 预加载方法
  20. */
  21. $(function() {
  22. setVisit();
  23. //*************************************数据表格******************************************
  24. function initAppealPage(start_date, end_date, user_id) {
  25. initQueryParams();
  26. queryAppeal(start_date, end_date, user_id);
  27. }
  28. function initQueryParams() {
  29. //获取页面参数
  30. var page_params = $.zui.store.get("page_params");
  31. if (page_params && page_params.status) {
  32. cur_status = page_params.status;
  33. }
  34. }
  35. function queryAppeal(start_date, end_date, user_id) {
  36. $("#station_name").html($("#select-dept").find("option:selected").text())
  37. $("#station_user_name").html("-")
  38. //请求数据
  39. var data_t = {
  40. "start_date": start_date,
  41. "end_date": end_date,
  42. "user_id": user_id
  43. }
  44. var url_t = "/statistics/employee/order/detail"
  45. post_common_service(url_t, data_t, function(res) {
  46. $("#c_dept_ranking").html("-");
  47. $("#c_com_ranking").html("-");
  48. $("#c_score_ranking").html("-");
  49. $("#l_dept_ranking").html("-");
  50. $("#l_com_ranking").html("-");
  51. $("#l_score_ranking").html("-");
  52. if (typeof(res.user) != undefined && res.user != null) {
  53. $("#station_user_name").html(res.user.position_name)
  54. }
  55. var isshow_c = false;
  56. var isshow_l = false;
  57. if (typeof(res.currentP) != undefined && res.currentP != null) {
  58. var p = res.currentP;
  59. $("#c_dept_ranking").html(p.fee_station_ranking == undefined ? "-" : p.fee_station_ranking);
  60. $("#c_com_ranking").html(p.company_ranking == undefined ? "-" : p.company_ranking);
  61. $("#c_score_ranking").html(p.check_all_score + p.check_all_m_score);
  62. $("#c_road_ranking").html(p.center_ranking == undefined ? "-" : p.center_ranking);
  63. isshow_c = true;
  64. }
  65. if (typeof(res.lastP) != undefined && res.lastP != null) {
  66. var p = res.lastP;
  67. $("#l_dept_ranking").html(p.fee_station_ranking == undefined ? "-" : p.fee_station_ranking);
  68. $("#l_com_ranking").html(p.company_ranking == undefined ? "-" : p.company_ranking);
  69. $("#l_score_ranking").html(p.check_all_score + p.check_all_m_score);
  70. $("#l_road_ranking").html(p.center_ranking == undefined ? "-" : p.center_ranking);
  71. isshow_l = true;
  72. }
  73. if (isshow_c && isshow_l) {
  74. var p_c = res.currentP;
  75. var p_l = res.lastP;
  76. if (p_c.fee_station_ranking != undefined && p_l.fee_station_ranking != undefined) {
  77. var dept_r = p_c.fee_station_ranking - p_l.fee_station_ranking;
  78. if (dept_r != 0) {
  79. $("#c_dept_ranking").html($("#c_dept_ranking").html() + "<i style='margin-left:10px;color:" + (dept_r > 0 ? "red" : "green") + "' class='icon icon-long-arrow-" + (dept_r > 0 ? "down" : "up") + "'>" + Math.abs(dept_r) + "</i>");
  80. }
  81. var com_r = p_c.company_ranking - p_l.company_ranking;
  82. if (com_r != 0) {
  83. $("#c_com_ranking").html($("#c_com_ranking").html() + "<i style='margin-left:10px;color:" + (com_r > 0 ? "red" : "green") + "' class='icon icon-long-arrow-" + (com_r > 0 ? "down" : "up") + "'>" + Math.abs(com_r) + "</i>");
  84. }
  85. var road_r = p_c.center_ranking - p_l.center_ranking;
  86. if (road_r != 0) {
  87. $("#c_road_ranking").html($("#c_road_ranking").html() + "<i style='margin-left:10px;color:" + (road_r > 0 ? "red" : "green") + "' class='icon icon-long-arrow-" + (road_r > 0 ? "down" : "up") + "'>" + Math.abs(road_r) + "</i>");
  88. }
  89. }
  90. }
  91. }, function(error) {})
  92. $.ajax({
  93. type: "OPTIONS",
  94. url: base_ui_url,
  95. complete: function(x) {
  96. //计算当前周期
  97. var now_date_time = moment(new Date(x.getResponseHeader("Date")))
  98. var current_start_date = null;
  99. if (now_date_time.date() >= 26) {
  100. current_start_date = moment(now_date_time.format("YYYY-MM") + "-25 23:00:00Z").subtract(0, "month");
  101. } else {
  102. current_start_date = moment(now_date_time.format("YYYY-MM") + "-25 23:00:00Z").subtract(1, "month");
  103. }
  104. var end_date_time = moment(end_date + "Z");
  105. if (end_date_time.valueOf() > current_start_date.valueOf()) {
  106. if (hasRole(ROLE_STATION_ADMIN) || hasRole(ROLE_STATION) || roleContains('STATION')) {
  107. $(".score-select").val(1)
  108. }
  109. }
  110. var data = {
  111. "start_date": start_date,
  112. "end_date": end_date,
  113. "user_id": user_id,
  114. "queryType": 0,
  115. }
  116. if ($(".score-select").val() == "0") {
  117. data["score_flag"] = 0;
  118. }
  119. if ($(".score-select").val() == "1") {
  120. data["score_flag"] = 1;
  121. }
  122. if (hasRole(ROLE_STATION_ADMIN) || hasRole(ROLE_STATION) || hasRole(ROLE_JICHA) || roleContains('STATION')) {
  123. hide = true;
  124. }
  125. var cols = [
  126. { width: 50, text: '序号', flex: true, colClass: 'text-center', field: 'num' },
  127. { width: 100, text: '时间段', flex: true, colClass: 'text-center', field: 'check_task_time_name' },
  128. { width: 80, text: '扣分人', flex: true, colClass: 'text-center', field: 'checked_name' },
  129. { width: 40, text: '扣分数', flex: true, colClass: 'text-center', field: 'score', nullvalue: '0' },
  130. { width: 100, text: '考核类型', flex: true, colClass: 'text-center', sort: 'down', field: 'parent_name' },
  131. { width: 100, text: '考核项', flex: true, colClass: 'text-center', sort: 'down', field: 'name' },
  132. { width: 100, text: '扣分凭证', type: 'imagedd', flex: true, hide: hide, field: 'pics' },
  133. ];
  134. if (cur_status == 12 || cur_status == 13) {
  135. data.check_status_arr = [12, 13];
  136. }
  137. $('#personal_data_table').mytable({
  138. 'cols': cols,
  139. 'url': "/statistics/one/checkedItem/detail/info",
  140. 'param': data
  141. });
  142. }
  143. })
  144. }
  145. //*************************************画图******************************************
  146. // 加载图配置
  147. echart();
  148. $(".query button").click(function() {
  149. var user_id = $("#select-personal").val();
  150. var start_date = dateChange(new Date($(".div-start input").val() + " 00:00:00"), 60 * 60 * 1000);
  151. var end_date = $(".div-end input").val() + " 23:00:00";
  152. var startStr = start_date.replace(/-/g, '/');
  153. var endStr = end_date.replace(/-/g, '/');
  154. var start = new Date(startStr);
  155. var end = new Date(endStr);
  156. if (start > end) {
  157. tip("开始时间不能比结束时间大");
  158. return;
  159. }
  160. if ($("#select-personal").text() == '') {
  161. tip("请选择收费站");
  162. return;
  163. }
  164. // 查询图一
  165. init_personal_score_statistics("statistics/one/person/year/info", user_id);
  166. // 查询图二
  167. init_personal_check_type("statistics/one/person/checkedItem/info", user_id, start_date, end_date);
  168. // 表格
  169. initAppealPage(start_date, end_date, user_id);
  170. // 加载图配置
  171. echart();
  172. });
  173. /**
  174. * 初始化图一
  175. * @param {*} url
  176. * @param {*} dept_id
  177. */
  178. function init_personal_score_statistics(url, user_id) {
  179. var param = {
  180. "start_date": (year - 1) + "-" + new Date().getMonth() + "-25" + " 23:00:00",
  181. "end_date": year + "-" + (new Date().getMonth() + 1) + "-25" + " 23:00:00",
  182. "user_id": user_id
  183. }
  184. initRqueset(url, param, 1);
  185. }
  186. /**
  187. * 初始化图二
  188. * @param {*} url
  189. * @param {*} dept_id
  190. */
  191. function init_personal_check_type(url, user_id, start_date, end_date) {
  192. var param = {
  193. "start_date": start_date,
  194. "end_date": end_date,
  195. "user_id": user_id
  196. }
  197. initRqueset(url, param, 2);
  198. }
  199. /**
  200. * 请求
  201. * @param {*} url
  202. * @param {*} param
  203. * @param {*} type
  204. */
  205. function initRqueset(url, param, type) {
  206. post_common_service(url, param, function(data) {
  207. data_array(data, type);
  208. if (type == 1) {
  209. // 画图
  210. score_statistics.setOption(personal_score_statistics());
  211. } else if (type == 2) {
  212. // 画图
  213. check_type.setOption(personal_check_type());
  214. }
  215. }, function(error) {
  216. return "";
  217. });
  218. }
  219. /**
  220. * 数组数据
  221. * @param {*} data
  222. * @param {*} type
  223. */
  224. function data_array(data, type) {
  225. if (type == 1) {
  226. array_year_score.length = 0;
  227. months.length = 0;
  228. if (data.length != 0) {
  229. if (data.length < 14) {
  230. for (var i = 0; i < 14 - data.length; i++) {
  231. array_year_score.push(0)
  232. }
  233. }
  234. var month_arr = month_method_2();
  235. for (var i = 0; i < data.length; i++) {
  236. if (month_arr.indexOf(parseInt(data[i].mth))) {
  237. // 指定位置插入值
  238. array_year_score.splice(month_arr.indexOf(data[i].mth), 0,
  239. (1000 - (filter(data[i].all_check_score, data[i].checked_num, 0))));
  240. }
  241. }
  242. } else {
  243. array_year_score.length = 0;
  244. }
  245. } else if (type == 2) {
  246. array_points = new Array();
  247. array_points2 = new Array();
  248. var map = new HashMap();
  249. if (data.length != 0) {
  250. for (var i = 0; i < data.length; i++) {
  251. if (typeof(data[i].all_check_score) == "undefined" || data[i].all_check_score == null) continue;
  252. if (map.get(data[i].name) == null) {
  253. map.set(data[i].name, data[i].all_check_score);
  254. } else {
  255. map.set(data[i].name, map.get(data[i].name) + data[i].all_check_score);
  256. }
  257. array_points2.push({ "value": (data[i].all_check_score), "name": data[i].checked_name + ($("#select-personal").val() == data[i].user_id ? "" : "(组员)") + " " + data[i].name, "itemStyle": { "normal": { "color": getchildColor(data[i].name, i).hexStr() } } });
  258. }
  259. }
  260. map.forEach(function(value, key) {
  261. array_points.push({ "value": value, "name": key, "itemStyle": { "normal": { "color": getColor(key).hexStr() } } });
  262. });
  263. // array_points.push({ "value": (data.total0), "name": '满分', "itemStyle": { "normal": { "color": '#48CCCD' } } });
  264. // array_points.push({ "value": data.total15, "name": '0-15分', "itemStyle": { "normal": { "color": '#38ACEC' } } });
  265. // array_points.push({ "value": data.total50, "name": '15-50分', "itemStyle": { "normal": { "color": '#FFD801' } } });
  266. // array_points.push({ "value": data.totalOver50, "name": '50分以上', "itemStyle": { "normal": { "color": '#7F38EC' } } });
  267. // array_points2.push({ "value": temp[0], "name": '连云港道管', "itemStyle": { "normal": { "color": '#7BCCB5' } } });
  268. // array_check_type.length = 0;
  269. // if (data.length != 0) {
  270. // for (var i = 0; i < data.length; i++) {
  271. // array_check_type.push({ "value": data[i].all_check_score, "name": data[i].name });
  272. // }
  273. // } else {
  274. // array_check_type.length = 0;
  275. // }
  276. }
  277. }
  278. $("#select-personal").click(function() {
  279. if ($("#select-personal").text() == '') {
  280. tip("请选择收费站");
  281. return;
  282. }
  283. });
  284. // 收费站下拉框
  285. var dept;
  286. if (roleContains("STATION")) {
  287. dept = getCurrentUser().organid;
  288. }
  289. var roadManager;
  290. if (roleContains("ROAD_MANAGER")) {
  291. roadManager = getCurrentUser().organid;
  292. }
  293. var feeList = $.zui.store.get("cache_fee_station_list");
  294. if (roadManager) feeList = cache_road_manager_fee_list_map.get(roadManager);
  295. setFeeSelectValueNoAll(feeList, "#select-dept", dept);
  296. setSecond();
  297. /**
  298. * 部门人员下拉框
  299. */
  300. function setSecond() {
  301. var select_road = $("#select-dept").val();
  302. var sec = document.getElementById('select-personal');
  303. var tempStr = ''
  304. var param = {
  305. "organid": select_road
  306. }
  307. post_common_service("user/getFsUserList", param, function(data) {
  308. if (data.length != 0) {
  309. var userId;
  310. if (hasRole("ROLE_STATION")) {
  311. userId = getCurrentUser().id;
  312. }
  313. for (var i = 0; i < data.length; i++) {
  314. for (var j = 33; j <= 53; j++) {
  315. if (select_road == j) {
  316. if (data[i].id == userId) {
  317. tempStr += "<option value=" + data[i].id + " selected='selected'>" + data[i].truename + "</option>";
  318. } else {
  319. tempStr += "<option value=" + data[i].id + ">" + data[i].truename + "</option>";
  320. }
  321. }
  322. }
  323. sec.innerHTML = tempStr;
  324. }
  325. } else {
  326. sec.innerHTML = '';
  327. }
  328. // 请求数据
  329. getInit();
  330. }, function(error) {
  331. return "";
  332. });
  333. }
  334. function getInit() {
  335. var start_date = dateChange(moment($(".div-start input").val() + " 00:00:00"), 60 * 60 * 1000);
  336. var end_date = $(".div-end input").val() + " 23:00:00";
  337. var user_id = $("#select-personal").val();
  338. // 页面初始化
  339. echart();
  340. initAppealPage(start_date, end_date, user_id);
  341. init_personal_score_statistics("statistics/one/person/year/info", user_id);
  342. init_personal_check_type("statistics/one/person/checkedItem/info", user_id, start_date, end_date);
  343. }
  344. $("#select-dept").change(function() {
  345. setSecond();
  346. });
  347. $("#select-personal").change(function() {
  348. getInit();
  349. })
  350. /**
  351. * 除数为0处理
  352. * @param {*} num
  353. * @param {*} num1
  354. * @param {*} num2
  355. * @param {*} num4
  356. */
  357. function filter(num, num1, num2) {
  358. if (num1 == 0) {
  359. return num2;
  360. } else {
  361. return (num / num1).toFixed(2);
  362. }
  363. }
  364. function echart() {
  365. // 路径配置
  366. require.config({
  367. paths: {
  368. echarts: '/js/lib/echarts/build/dist'
  369. }
  370. });
  371. // 使用
  372. require(
  373. [
  374. 'echarts',
  375. 'echarts/theme/macarons',
  376. 'echarts/chart/line',
  377. 'echarts/chart/pie'
  378. ],
  379. function(ec, theme) {
  380. // 基于准备好的dom,初始化echarts图表
  381. score_statistics = ec.init(document.getElementById('personal-score-statistics'), theme);
  382. check_type = ec.init(document.getElementById('personal-check-type'), theme);
  383. }
  384. );
  385. }
  386. /**
  387. * 图一
  388. */
  389. function personal_score_statistics() {
  390. option = {
  391. color: ['#00ced1'],
  392. tooltip: {
  393. trigger: 'axis'
  394. },
  395. noDataLoadingOption: {
  396. text: '暂无数据',
  397. effect: 'bubble',
  398. effectOption: {
  399. effect: {
  400. n: 0 //气泡个数为0
  401. }
  402. },
  403. textStyle: {
  404. fontSize: 20,
  405. fontFamily: 'cursive',
  406. fontWeight: 'bold'
  407. }
  408. },
  409. grid: {
  410. width: "75%"
  411. },
  412. legend: {
  413. data: ['平均分']
  414. },
  415. toolbox: {
  416. show: true,
  417. },
  418. calculable: true,
  419. xAxis: [{
  420. type: 'category',
  421. boundaryGap: false,
  422. data: month_method_2()
  423. }],
  424. yAxis: [{
  425. type: 'value',
  426. min: 700,
  427. max: 1000,
  428. axisLabel: {
  429. formatter: '{value}'
  430. }
  431. }],
  432. series: [{
  433. name: '平均分',
  434. type: 'line',
  435. data: array_year_score,
  436. markPoint: {
  437. data: [
  438. { type: 'max', name: '最大值' },
  439. { type: 'min', name: '最小值' }
  440. ]
  441. },
  442. markLine: {
  443. data: [
  444. { type: 'average', name: '平均值' }
  445. ]
  446. }
  447. },
  448. ]
  449. };
  450. return option;
  451. }
  452. /**
  453. * 图二
  454. */
  455. function personal_check_type() {
  456. // option = {
  457. // tooltip: {
  458. // trigger: 'item',
  459. // formatter: "个人服务检查问题占比 <br/>{b} : {c}分 ({d}%)"
  460. // },
  461. // noDataLoadingOption: {
  462. // text: '暂无数据',
  463. // effect: 'bubble',
  464. // effectOption: {
  465. // effect: {
  466. // n: 0 //气泡个数为0
  467. // }
  468. // },
  469. // textStyle: {
  470. // fontSize: 20,
  471. // fontFamily: 'cursive',
  472. // fontWeight: 'bold'
  473. // }
  474. // },
  475. // toolbox: {
  476. // show: true,
  477. // feature: {
  478. // magicType: {
  479. // type: ['pie', 'funnel'],
  480. // option: {
  481. // funnel: {
  482. // x: '25%',
  483. // width: '50%',
  484. // funnelAlign: 'left',
  485. // max: 1548
  486. // }
  487. // }
  488. // },
  489. // }
  490. // },
  491. // calculable: true,
  492. // series: [{
  493. // name: '访问来源',
  494. // type: 'pie',
  495. // radius: '55%',
  496. // center: ['50%', '50%'],
  497. // data: array_check_type,
  498. // itemStyle: {
  499. // normal: {
  500. // label: {
  501. // show: true,
  502. // formatter: '{b} :\n{c}分 ({d}%)'
  503. // },
  504. // labelLine: { show: true }
  505. // }
  506. // }
  507. // }]
  508. // };
  509. option = {
  510. tooltip: {
  511. trigger: 'item',
  512. formatter: "个人温馨服务检查问题类别占比 <br/>{b} : {c}分 ({d}%)"
  513. },
  514. noDataLoadingOption: {
  515. text: '暂无数据',
  516. effect: 'bubble',
  517. effectOption: {
  518. effect: {
  519. n: 0 //气泡个数为0
  520. }
  521. },
  522. textStyle: {
  523. fontSize: 20,
  524. fontFamily: 'cursive',
  525. fontWeight: 'bold'
  526. }
  527. },
  528. toolbox: {
  529. show: true,
  530. },
  531. calculable: false,
  532. series: [{
  533. name: '访问来源',
  534. type: 'pie',
  535. selectedMode: 'single',
  536. radius: [0, 80],
  537. // for funnel
  538. x: '20%',
  539. width: '40%',
  540. funnelAlign: 'right',
  541. max: 1548,
  542. itemStyle: {
  543. normal: {
  544. label: {
  545. show: true,
  546. formatter: '{b}:\n{c}分({d}%)',
  547. textStyle: {
  548. alias: 'center',
  549. fontSize: 10,
  550. color: '#888'
  551. }
  552. },
  553. labelLine: {
  554. show: true,
  555. length: 80,
  556. lineStyle: {
  557. color: '#888'
  558. }
  559. }
  560. }
  561. },
  562. data: array_points
  563. },
  564. {
  565. name: '访问来源',
  566. type: 'pie',
  567. radius: [100, 125],
  568. // for funnel
  569. x: '60%',
  570. width: '35%',
  571. funnelAlign: 'left',
  572. max: 1048,
  573. itemStyle: {
  574. normal: {
  575. label: {
  576. show: false,
  577. formatter: '{b}:{c}人({d}%)'
  578. },
  579. labelLine: {
  580. show: false
  581. }
  582. }
  583. },
  584. data: array_points2
  585. }
  586. ]
  587. };
  588. return option;
  589. }
  590. });
  591. function setVisit() {
  592. if (roleContains("STATION")) {
  593. $("#select-dept").attr("disabled", "disabled");
  594. }
  595. if (hasRole("ROLE_STATION")) {
  596. $("#select-personal").attr("disabled", "disabled");
  597. }
  598. }
  599. function getColor(name) {
  600. var color = new $.zui.Color('#52D017');
  601. switch (name) {
  602. case "环境卫生":
  603. { color = new $.zui.Color('#52D017'); break; }
  604. case "仪容仪表着装":
  605. { color = new $.zui.Color('#00FFFF'); break; }
  606. case "动作":
  607. { color = new $.zui.Color('#7F38EC'); break; }
  608. case "表情":
  609. { color = new $.zui.Color('#FFA500'); break; }
  610. case "文明用语":
  611. { color = new $.zui.Color('#0000A0'); break; }
  612. case "环境卫生":
  613. { color = new $.zui.Color('#52D017'); break; }
  614. case "工作纪律及行为举止":
  615. { color = new $.zui.Color('#48CCCD'); break; }
  616. case "便民服务":
  617. { color = new $.zui.Color('#FFFF00'); break; }
  618. case "安全管理":
  619. { color = new $.zui.Color('#00FF00'); break; }
  620. }
  621. return color;
  622. }
  623. function getchildColor(name, p) {
  624. var color1 = getColor(name);
  625. var color = new $.zui.Color(color1.r - p * 20, color1.g - p * 20, color1.b - p * 20);
  626. return color;
  627. }