update:甘特图

上级 5ba8dae6
...@@ -106,7 +106,7 @@ layui.config({ ...@@ -106,7 +106,7 @@ layui.config({
// 甘特图 // 甘特图
function gantt(data) { function gantt(data) {
_openNewWindows({ _openNewWindows({
url: "../../tpl/departmentMachining/machiningGantt.html?objectId=" + data.id + '&objectKey=' + data.serviceClassName, url: "../../tpl/departmentMachining/machiningGantt.html?id=" + data.id,
title: "车间任务安排甘特图", title: "车间任务安排甘特图",
pageId: "machiningGantt", pageId: "machiningGantt",
area: ['90vw', '90vh'], area: ['90vw', '90vh'],
......
var objectKey = "";
var objectId = "";
layui.config({ layui.config({
base: basePath, base: basePath,
...@@ -9,48 +7,37 @@ layui.config({ ...@@ -9,48 +7,37 @@ layui.config({
}).define(['window', 'jquery', 'winui', 'form', 'laydate'], function (exports) { }).define(['window', 'jquery', 'winui', 'form', 'laydate'], function (exports) {
winui.renderColor(); winui.renderColor();
var $ = layui.$, var $ = layui.$,
form = layui.form, form = layui.form;
layer = layui.layer, var id = GetUrlParam("id");
laydate = layui.laydate;
objectKey = GetUrlParam("objectKey");
objectId = GetUrlParam("objectId");
if (isNull(objectKey) || isNull(objectId)) {
winui.window.msg("请传入适用对象信息", {icon: 2, time: 2000});
return false;
}
// 根据供应商id获取所有审批通过之后的里程碑列表
let milestoneList = [];
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinById", params: {id: objectId}, type: 'json', method: 'GET', callback: function (json) {
$("#milestoneId").html(getDataUseHandlebars(getFileContent('tpl/template/select-option-must.tpl'), json));
milestoneList = json.bean.machinChildList;
console.log(1,json)
console.log(2,milestoneList)
// var authPermission = teamObjectPermissionUtil.checkTeamBusinessAuthPermission(objectId, 'taskAuthEnum');
// var btnStr = `<div style="" class="type-group" id="type">`;
// var firstBtn = true;
// if (authPermission['list']) {
// var defaultClassName = firstBtn ? 'plan-select' : '';
// firstBtn = false;
// btnStr += `<button type="button" class="layui-btn layui-btn-primary type-btn ${defaultClassName}" data-type="list" table-id="messageTable"><i class="layui-icon"></i>所有任务</button>`
// }
// if (authPermission['myExecute']) {
// var defaultClassName = firstBtn ? 'plan-select' : '';
// firstBtn = false;
// btnStr += `<button type="button" class="layui-btn layui-btn-primary type-btn ${defaultClassName}" data-type="myExecute" table-id="messageTable"><i class="layui-icon"></i>我执行的任务</button>`
// }
// if (authPermission['myCreate']) {
// var defaultClassName = firstBtn ? 'plan-select' : '';
// btnStr += `<button type="button" class="layui-btn layui-btn-primary type-btn ${defaultClassName}" data-type="myCreate" table-id="messageTable"><i class="layui-icon"></i>我创建的任务</button>`
// }
// btnStr += `</div>`;
// $(".txtcenter").before(btnStr);
// 根据id查询加工单信息
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) {
console.log(json)
matchingLanguage(); matchingLanguage();
form.render(); form.render();
renderPanel(); renderPanel();
render(); // render();
gantt.clearAll(); //清空缓存
let nodeList = json.bean.node;
if (isNull(nodeList) || nodeList.length == 0) {
return;
}
$.each(nodeList, function (i, item) {
item.start_date = new Date(item.start_date);
item.end_date = new Date(item.end_date);
});
let linkList = json.bean.link;
if (isNull(linkList) || linkList.length == 0) {
linkList = [];
}
// 解析
gantt.parse({
data: nodeList,
links: linkList
});
}}); }});
function renderPanel() { function renderPanel() {
...@@ -140,44 +127,43 @@ layui.config({ ...@@ -140,44 +127,43 @@ layui.config({
gantt.init("device_load"); gantt.init("device_load");
gantt.i18n.setLocale("cn"); //使用中文 gantt.i18n.setLocale("cn"); //使用中文
function render() { // function render() {
let milestoneId = $("#milestoneId").val(); // let milestoneId = $("#milestoneId").val();
if (isNull(milestoneId)) { // if (isNull(milestoneId)) {
winui.window.msg("请选择产品", {icon: 2, time: 2000}); // winui.window.msg("请选择产品", {icon: 2, time: 2000});
return false; // return false;
} // }
let params = { // let params = {
id: objectId, // id: objectId,
// objectKey: objectKey, // // objectKey: objectKey,
// holderId: milestoneId, // // holderId: milestoneId,
// type: $("#type .plan-select").attr("data-type") // // type: $("#type .plan-select").attr("data-type")
}; // };
var tem = getInPoingArr(milestoneList, "id", milestoneId, null); // var tem = getInPoingArr(milestoneList, "id", milestoneId, null);
gantt.config.start_date = new Date(tem.startTime); // gantt.config.start_date = new Date(tem.startTime);
gantt.config.end_date = new Date(tem.endTime); // gantt.config.end_date = new Date(tem.endTime);
console.log(999) // console.log(999)
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: params, type: 'json', method: 'GET', callback: function (json) { // AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: params, type: 'json', method: 'GET', callback: function (json) {
console.log(88,json) // gantt.clearAll(); //清空缓存
gantt.clearAll(); //清空缓存 // let nodeList = json.bean.node;
let nodeList = json.bean.node; // if (isNull(nodeList) || nodeList.length == 0) {
if (isNull(nodeList) || nodeList.length == 0) { // return;
return; // }
} // $.each(nodeList, function (i, item) {
$.each(nodeList, function (i, item) { // item.start_date = new Date(item.start_date);
item.start_date = new Date(item.start_date); // item.end_date = new Date(item.end_date);
item.end_date = new Date(item.end_date); // });
}); // let linkList = json.bean.link;
let linkList = json.bean.link; // if (isNull(linkList) || linkList.length == 0) {
if (isNull(linkList) || linkList.length == 0) { // linkList = [];
linkList = []; // }
} // // 解析
// 解析 // gantt.parse({
gantt.parse({ // data: nodeList,
data: nodeList, // links: linkList
links: linkList // });
}); // }});
}}); // }
}
$("body").on("click", ".type-btn", function (e) { $("body").on("click", ".type-btn", function (e) {
$(this).parent().find('.type-btn').removeClass("plan-select"); $(this).parent().find('.type-btn').removeClass("plan-select");
......
...@@ -24,8 +24,6 @@ layui.config({ ...@@ -24,8 +24,6 @@ layui.config({
AjaxPostUtil.request({url: sysMainMation.projectBasePath + "queryAllApprovalMilestoneList", params: {objectId: objectId}, type: 'json', method: 'GET', callback: function (json) { AjaxPostUtil.request({url: sysMainMation.projectBasePath + "queryAllApprovalMilestoneList", params: {objectId: objectId}, type: 'json', method: 'GET', callback: function (json) {
$("#milestoneId").html(getDataUseHandlebars(getFileContent('tpl/template/select-option-must.tpl'), json)); $("#milestoneId").html(getDataUseHandlebars(getFileContent('tpl/template/select-option-must.tpl'), json));
milestoneList = json.rows; milestoneList = json.rows;
console.log(123,json.rows)
console.log(456,milestoneList)
var authPermission = teamObjectPermissionUtil.checkTeamBusinessAuthPermission(objectId, 'taskAuthEnum'); var authPermission = teamObjectPermissionUtil.checkTeamBusinessAuthPermission(objectId, 'taskAuthEnum');
var btnStr = `<div style="" class="type-group" id="type">`; var btnStr = `<div style="" class="type-group" id="type">`;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册