From c76dadaf1bbb9666f1743951eca1260acfc034ad Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Sat, 20 Jul 2024 22:09:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A0=E5=B7=A5=E5=8D=95=E7=94=98?= =?UTF-8?q?=E7=89=B9=E5=9B=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../departmentMachiningList.js | 4 +- .../js/departmentMachining/machiningGantt.js | 53 +++++++++++++------ .../departmentMachining/machiningGantt.html | 15 ------ 3 files changed, 39 insertions(+), 33 deletions(-) diff --git a/erp-produce/src/main/resources/template/js/departmentMachining/departmentMachiningList.js b/erp-produce/src/main/resources/template/js/departmentMachining/departmentMachiningList.js index fbe173baa..2920d3db2 100644 --- a/erp-produce/src/main/resources/template/js/departmentMachining/departmentMachiningList.js +++ b/erp-produce/src/main/resources/template/js/departmentMachining/departmentMachiningList.js @@ -110,11 +110,11 @@ layui.config({ // 甘特图 function gantt(data) { - _openNewWindows({ + parent._openNewWindows({ url: "../../tpl/departmentMachining/machiningGantt.html?id=" + data.id, title: "车间任务安排甘特图", pageId: "machiningGantt", - area: ['90vw', '90vh'], + area: ['100vw', '100vh'], callBack: function (refreshCode) { winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); loadTable(); diff --git a/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js b/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js index 513281b23..a6955eef9 100644 --- a/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js +++ b/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js @@ -10,14 +10,18 @@ layui.config({ form = layui.form; var id = GetUrlParam("id"); + let noteList = []; // 根据id查询加工单信息 AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) { matchingLanguage(); form.render(); renderPanel(); + gantt.config.start_date = new Date(json.bean.mathinTime.start_time); + gantt.config.end_date = new Date(json.bean.mathinTime.end_time); gantt.clearAll(); //清空缓存 // 解析 + noteList = json.bean.node; gantt.parse({ data: json.bean.node, links: json.bean.link @@ -25,7 +29,7 @@ layui.config({ }}); function renderPanel() { - document.getElementById('device_load').style.cssText = 'height:' + ($(window).height() - 140) + 'px'; + document.getElementById('device_load').style.cssText = 'height:' + $(window).height() + 'px'; } $(window).resize(function () { renderPanel(); @@ -45,12 +49,30 @@ layui.config({ align: "center", tree: true, resize: true + }, { + name: "types", + label: "类型", + width: 60, + align: "center", + resize: true, + template: function (item) { + if (item.types == "project") { + return "产品"; + } + return "工序"; + } }, { name: "start_date", label: "开始日期", width: 100, align: "center", resize: true + }, { + name: "end_date", + label: "结束日期", + width: 100, + align: "center", + resize: true }, { name: "duration", label: "持续时间", @@ -58,6 +80,7 @@ layui.config({ align: "center", resize: true }]; + // 是否可以编辑 gantt.config.readonly = true; gantt.config.row_height = 40; gantt.config.scale_height = 50; @@ -69,6 +92,18 @@ layui.config({ gantt.attachEvent("onTaskDblClick", function (id, e) { return false; }); + gantt.attachEvent("onTaskClick", function(id, e){ + // 这里的代码会在节点被点击时执行 + // id 参数是被点击的任务的ID + // e 参数是点击事件的事件对象 + let item = getInPoingArr(noteList, "id", id, null); + if (item.types != "project") { + console.log(item) + alert("Task with ID " + id + " was clicked"); + } + // 返回true以允许默认行为继续,返回false可以阻止默认行为 + return true; + }); gantt.config.show_tasks_outside_timescale = true; gantt.plugins({ auto_scheduling: true, //自动排程 @@ -78,8 +113,7 @@ layui.config({ gantt.config.layout = { css: "gantt_container", cols: [{ - width: 400, - min_width: 300, + width: 500, rows: [ { view: "grid", @@ -111,18 +145,5 @@ layui.config({ gantt.init("device_load"); gantt.i18n.setLocale("cn"); //使用中文 - $("body").on("click", ".type-btn", function (e) { - $(this).parent().find('.type-btn').removeClass("plan-select"); - $(this).addClass("plan-select"); - render(); - }); - - form.on('submit(formSearch)', function (data) { - if (winui.verifyForm(data.elem)) { - render(); - } - return false; - }); - exports('machiningGantt', {}); }); \ No newline at end of file diff --git a/erp-produce/src/main/resources/template/tpl/departmentMachining/machiningGantt.html b/erp-produce/src/main/resources/template/tpl/departmentMachining/machiningGantt.html index 92428b0db..6bef340c3 100644 --- a/erp-produce/src/main/resources/template/tpl/departmentMachining/machiningGantt.html +++ b/erp-produce/src/main/resources/template/tpl/departmentMachining/machiningGantt.html @@ -39,21 +39,6 @@ -
-
-
-
- -
- -
- - -
-
-
-
-- GitLab