update:甘特图点击事件

上级 9a9e21bb
...@@ -14,58 +14,119 @@ layui.config({ ...@@ -14,58 +14,119 @@ layui.config({
var $ = layui.$, var $ = layui.$,
form = layui.form, form = layui.form,
table = layui.table; table = layui.table;
var selTemplate = getFileContent('tpl/template/select-option.tpl'); // var selTemplate = getFileContent('tpl/template/select-option.tpl');
let farmId = getNotUndefinedVal(GetUrlParam("id")); let farmId = getNotUndefinedVal(GetUrlParam("id"));
// 改 // 改
let assetMap = {}; // let assetMap = {};
initTableChooseUtil.initTable({ initTableChooseUtil.initTable({
id: "arrangeList", id: "arrangeList",
cols: [ cols: [
{id: 'workshopId', title: '安排车间', formType: 'input', width: '150', verify: 'required'}, {id: 'workshopId', title: '安排车间', formType: 'select', width: '150', verify: 'required',templet: function(d) {
{id: 'operNumber', title: '安排任务数量', formType: 'input', width: '140', verify: 'required|number'} var options = queryWorkshopList();
return '<select name="workshop" class="workshop-select">' + options + '</select>';
}
},
{id: 'taskNumber', title: '安排任务数量', formType: 'input', width: '140', verify: 'required|number'}
], ],
deleteRowCallback: function (trcusid) { deleteRowCallback: function (trcusid) {
delete allChooseFarm[trcusid]; delete allChooseFarm[trcusid];
}, },
addRowCallback: function (trcusid) { addRowCallback: function (trcusid) {
if (!isNull(farmId)) { // if (!isNull(farmId)) {
if (isNull(assetMap[farmId])) { // if (isNull(assetMap[farmId])) {
AjaxPostUtil.request({url: sysMainMation.admBasePath + "queryAssetById", params: {"id": farmId}, type: 'json', method: 'GET', callback: function (json) { // AjaxPostUtil.request({url: sysMainMation.admBasePath + "queryAssetById", params: {"id": farmId}, type: 'json', method: 'GET', callback: function (json) {
assetMap[farmId] = json.bean // assetMap[farmId] = json.bean
}, async: false}); // }, async: false});
} // }
let chooseAssetMation = assetMap[farmId] // let chooseAssetMation = assetMap[farmId]
// 获取表格行号 // // 获取表格行号
var thisRowKey = trcusid.replace("tr", ""); // var thisRowKey = trcusid.replace("tr", "");
// 资产名称赋值 // // 资产名称赋值
$("#farmId" + thisRowKey).val(chooseAssetMation.name); // $("#farmId" + thisRowKey).val(chooseAssetMation.name);
$("#farmId" + thisRowKey).attr(initTableChooseUtil.chooseInputDataIdKey, chooseAssetMation.id); // $("#farmId" + thisRowKey).attr(initTableChooseUtil.chooseInputDataIdKey, chooseAssetMation.id);
// 资产赋值 // // 资产赋值
// 车间赋值 // allChooseFarm[trcusid] = chooseAssetMation;
allChooseFarm[trcusid] = chooseAssetMation; // }
}
}, },
form: form, form: form,
minData: 1 minData: 1
}); });
//
// var workshopId = "";
// form.on('select(workshopId)', function(data) {
// console.log(555,data)
// // var thisRowValue = data.value;
// // workshopId = isNull(thisRowValue) ? "" : thisRowValue;
// aaa();
// });
// 渲染表格
// function aaa(){
// table.render({
// id: 'arrangeList',//表格
// elem: '#workshopId', //表格里的元素
// method: 'post',
// url: sysMainMation.erpBasePath + 'erpfarm001',
// where: getTableParams(),
// even: true,
// page: true,
// limits: getLimits(),
// limit: getLimit(),
// done: function(json){
// // 表格渲染完成后的回调
// // 在这里添加事件监听
// $('select[name="workshop"]').on('change', function(){
// console.log('Workshop selected', $(this).val());
// // 如果需要,可以在这里打印'123'或进行其他操作
// });
//
// $('input[name="taskNumber"]').on('click', function(){
// console.log('taskNumber input clicked');
// // 打印'123'或其他操作
// });
// }
// // done: function(json){
// // console.log(json)
// // // matchingLanguage();
// // // $('select[name="workshop"]').each(function(){
// // // $(this).empty();
// // // workshopData.forEach(function(item){
// // // $(this).append('<option value="' + item.id + '">' + item.name + '</option>');
// // // }, $(this));
// // // });
// // }
// });
// }
$("body").on("click", "farmId", function (e) { function queryWorkshopList() {
// 查询车间列表 // 假设您有一个函数可以处理Ajax请求
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page:1,limit:30}, type: 'json', method: "POST", callback: function(json) { AjaxPostUtil.request({
console.log(666,json) url: sysMainMation.erpBasePath + "erpfarm001",
// $("#workshopId").html(getDataUseHandlebars(selTemplate, json)); params: {page: 1, limit: 30},
// form.render('select'); type: 'json',
// initTable(); method: "POST",
}, async: false}); callback: function(json) {
}); console.log(666, json);
}
});
}
var workshopId = ""; // $("body").on("click", "workshopId", function (e) {
form.on('select(workshopId)', function(data) { // // 查询车间列表
var thisRowValue = data.value; // AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page:1,limit:30}, type: 'json', method: "POST", callback: function(json) {
workshopId = isNull(thisRowValue) ? "" : thisRowValue; // console.log(666,json)
loadTable(); // // $("#workshopId").html(getDataUseHandlebars(selTemplate, json));
}); // // form.render('select');
// // initTable();
// }, async: false});
// });
// var workshopId = "";
// form.on('select(workshopId)', function(data) {
// var thisRowValue = data.value;
// workshopId = isNull(thisRowValue) ? "" : thisRowValue;
// loadTable();
// });
// AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page: page, limit: 15}, type: 'json', method: 'POST', callback: function (json) { // AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page: page, limit: 15}, type: 'json', method: 'POST', callback: function (json) {
// parent.layer.close(index); // parent.layer.close(index);
...@@ -85,9 +146,9 @@ layui.config({ ...@@ -85,9 +146,9 @@ layui.config({
$.each(result.dataList, function(i, item) { $.each(result.dataList, function(i, item) {
// 获取行编号 // 获取行编号
var thisRowKey = item["trcusid"].replace("tr", ""); var thisRowKey = item["trcusid"].replace("tr", "");
if (parseInt(item.operNumber) == 0) { if (parseInt(item.taskNumber) == 0) {
$("#operNumber" + thisRowKey).addClass("layui-form-danger"); $("#taskNumber" + thisRowKey).addClass("layui-form-danger");
$("#operNumber" + thisRowKey).focus(); $("#taskNumber" + thisRowKey).focus();
winui.window.msg('数量不能为0', {icon: 2, time: 2000}); winui.window.msg('数量不能为0', {icon: 2, time: 2000});
noError = true; noError = true;
return false; return false;
...@@ -138,7 +199,7 @@ layui.config({ ...@@ -138,7 +199,7 @@ layui.config({
}); });
function loadTable() { function loadTable() {
table.reloadData("messageTable", {where: getTableParams()}); table.reloadData("arrangeList", {where: getTableParams()});
} }
function getTableParams() { function getTableParams() {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</div> </div>
</div> </div>
<div style="margin:0 auto;padding:20px;"> <div style="margin:0 auto;padding:20px;margin-top:40px">
<form class="layui-form" action="" autocomplete="off"> <form class="layui-form" action="" autocomplete="off">
<div class="layui-form-item layui-col-xs12"> <div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">详细安排</label> <label class="layui-form-label">详细安排</label>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册