update:甘特图

上级 5ba8dae6
......@@ -106,7 +106,7 @@ layui.config({
// 甘特图
function gantt(data) {
_openNewWindows({
url: "../../tpl/departmentMachining/machiningGantt.html?objectId=" + data.id + '&objectKey=' + data.serviceClassName,
url: "../../tpl/departmentMachining/machiningGantt.html?id=" + data.id,
title: "车间任务安排甘特图",
pageId: "machiningGantt",
area: ['90vw', '90vh'],
......
var objectKey = "";
var objectId = "";
layui.config({
base: basePath,
......@@ -9,48 +7,37 @@ layui.config({
}).define(['window', 'jquery', 'winui', 'form', 'laydate'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
layer = layui.layer,
laydate = layui.laydate;
objectKey = GetUrlParam("objectKey");
objectId = GetUrlParam("objectId");
if (isNull(objectKey) || isNull(objectId)) {
winui.window.msg("请传入适用对象信息", {icon: 2, time: 2000});
return false;
}
form = layui.form;
var id = GetUrlParam("id");
// 根据供应商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();
form.render();
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() {
......@@ -140,44 +127,43 @@ layui.config({
gantt.init("device_load");
gantt.i18n.setLocale("cn"); //使用中文
function render() {
let milestoneId = $("#milestoneId").val();
if (isNull(milestoneId)) {
winui.window.msg("请选择产品", {icon: 2, time: 2000});
return false;
}
let params = {
id: objectId,
// objectKey: objectKey,
// holderId: milestoneId,
// type: $("#type .plan-select").attr("data-type")
};
var tem = getInPoingArr(milestoneList, "id", milestoneId, null);
gantt.config.start_date = new Date(tem.startTime);
gantt.config.end_date = new Date(tem.endTime);
console.log(999)
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: params, type: 'json', method: 'GET', callback: function (json) {
console.log(88,json)
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 render() {
// let milestoneId = $("#milestoneId").val();
// if (isNull(milestoneId)) {
// winui.window.msg("请选择产品", {icon: 2, time: 2000});
// return false;
// }
// let params = {
// id: objectId,
// // objectKey: objectKey,
// // holderId: milestoneId,
// // type: $("#type .plan-select").attr("data-type")
// };
// var tem = getInPoingArr(milestoneList, "id", milestoneId, null);
// gantt.config.start_date = new Date(tem.startTime);
// gantt.config.end_date = new Date(tem.endTime);
// console.log(999)
// AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: params, type: 'json', method: 'GET', callback: function (json) {
// 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
// });
// }});
// }
$("body").on("click", ".type-btn", function (e) {
$(this).parent().find('.type-btn').removeClass("plan-select");
......
......@@ -24,8 +24,6 @@ layui.config({
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));
milestoneList = json.rows;
console.log(123,json.rows)
console.log(456,milestoneList)
var authPermission = teamObjectPermissionUtil.checkTeamBusinessAuthPermission(objectId, 'taskAuthEnum');
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.
先完成此消息的编辑!
想要评论请 注册