|
|
@ -142,49 +142,63 @@ |
|
|
|
// $.table.bootstrapTable('resetView'); |
|
|
|
}, |
|
|
|
columns: [{ |
|
|
|
checkbox: true |
|
|
|
checkbox: true, |
|
|
|
}, |
|
|
|
{ title: '主键ID',field: 'id',visible: false}, |
|
|
|
{ title: 'bom号',field: 'bomNo', sortable: true,}, |
|
|
|
{ title: '料号',field: 'materialNo', sortable: true,}, |
|
|
|
{ title: '物料名称',field: 'materialName', sortable: true,}, |
|
|
|
{title: '描述',field: 'describe',}, |
|
|
|
{ title: '品牌',field: 'brand', sortable: true,}, |
|
|
|
{title: '半成品类型',field: 'processMethod', |
|
|
|
formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ title: '单位',field: 'unit',}, |
|
|
|
{ title: '图片',field: 'photoUrl', |
|
|
|
formatter: function(value, row, index) {return $.table.imageView(value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ title: '<span style="color: red;">申请人</span>',field: 'applyUserName', |
|
|
|
formatter: function(value, row, index) {return '<span style="color: red;">' + (value ? value : "-") + '</span>';} |
|
|
|
}, |
|
|
|
{ title: '申请时间',field: 'applyTime',sortable: true,}, |
|
|
|
{title: '上次更新时间',field: 'updateTime',}, |
|
|
|
{ title: '当前状态',field: 'taskName',align: 'center', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
if(row.auditStatus!="1"&&value != "未启动"){ |
|
|
|
return '<span class="badge badge-danger">' + value + '</span>'; |
|
|
|
} |
|
|
|
if(value === "未启动"){ |
|
|
|
return '<span class="badge badge-primary">' + value + '</span>'; |
|
|
|
} |
|
|
|
return '<span class="badge badge-primary">' + value + '</span>'; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ title: '主键ID',field: 'id'}, |
|
|
|
{ title: '流程实例ID',field: 'instanceId',visible: false}, |
|
|
|
{ title: '流程提交实例ID',field: 'submitInstanceId',visible: false}, |
|
|
|
{ title: '流程作废实例ID', field: 'cancelInstanceId',visible: false}, |
|
|
|
{ title: '流程恢复实例ID',field: 'restoreInstanceId',visible: false}, |
|
|
|
{ title: '流程实例类型',field: 'instanceTypeName', visible: false}, |
|
|
|
{ title: '申请人ID',field: 'applyUser',visible: false}, |
|
|
|
{ title: '<span style="color: red;">申请人</span>',field: 'applyUserName', |
|
|
|
formatter: function(value, row, index) {return '<span style="color: red;">' + (value ? value : "-") + '</span>';} |
|
|
|
}, |
|
|
|
{ title: '申请时间',field: 'applyTime',sortable: true,}, |
|
|
|
{ title: '当前任务ID',field: 'taskId',visible: false,}, |
|
|
|
{ title: '待办用户ID',field: 'todoUserId',visible: false,}, |
|
|
|
{ title: '当前任务名称',field: 'taskName',align: 'center', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return '<span class="badge badge-primary">' + value + '</span>'; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ title: '审核状态',field: 'auditStatus',sortable: true, |
|
|
|
{ title: '审核状态',field: 'auditStatus',visible: false, |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(auditStatusDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ title: '使用状态',field: 'useStatus',sortable: true, |
|
|
|
{ title: '使用状态',field: 'useStatus',visible: false, |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(useStatusDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ title: '工程员',field: 'engineer', sortable: true,}, |
|
|
|
{ title: 'bom号',field: 'bomNo', sortable: true,}, |
|
|
|
{ title: '关联料号',field: 'materialNo', sortable: true,}, |
|
|
|
{ title: '图片',field: 'photoUrl',formatter: function(value, row, index) {return $.table.imageView(value);}}, |
|
|
|
{ title: '物料名称',field: 'materialName', sortable: true,}, |
|
|
|
{ title: '物料类型',field: 'materialType',sortable: true, |
|
|
|
{ title: '工程员',field: 'engineer', visible: false}, |
|
|
|
{ title: '物料类型',field: 'materialType',visible: false, |
|
|
|
formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);}}, |
|
|
|
{ title: '加工方式',field: 'processMethod',sortable: true, |
|
|
|
{ title: '加工方式',field: 'processMethod',visible: false, |
|
|
|
formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);} |
|
|
|
}, |
|
|
|
{ title: '单位',field: 'unit', sortable: true,}, |
|
|
|
{ title: '品牌',field: 'brand', sortable: true,}, |
|
|
|
{title: '描述',field: 'describe', sortable: true,}, |
|
|
|
{ title: '父级id',field: 'parentId',visible:false }, |
|
|
|
{title: '层级',field: 'level', visible:false, |
|
|
|
formatter: function(value, row, index) { |
|
|
@ -234,7 +248,15 @@ |
|
|
|
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i> 详情</a> '); |
|
|
|
return actions.join(''); |
|
|
|
} |
|
|
|
}] |
|
|
|
}], |
|
|
|
rowStyle: function (row, index) { |
|
|
|
if (row.auditStatus=="0") { |
|
|
|
// 如果审核状态为待审核,则设置为红色 |
|
|
|
return {css:{"color":"red"}}; |
|
|
|
} |
|
|
|
// 否则使用默认样式 |
|
|
|
return {}; |
|
|
|
} |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
engineer(); |
|
|
@ -740,6 +762,117 @@ |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 导出 |
|
|
|
function exportExcel(formId) { |
|
|
|
// $.table.set(); |
|
|
|
var bomNoData = []; |
|
|
|
var selections = $("#bootstrap-table").bootstrapTable("getSelections"); |
|
|
|
if(selections.length === 0){ |
|
|
|
// $.modal.alertWarning("请至少选择一条bom信息"); |
|
|
|
// return; |
|
|
|
$.modal.confirm("确定导出所有bom吗?", function() { |
|
|
|
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; |
|
|
|
var params = $("#bootstrap-table").bootstrapTable('getOptions'); |
|
|
|
var dataParam = $("#" + currentId).serializeArray(); |
|
|
|
dataParam.push({ "name": "orderByColumn", "value": params.sortName }); |
|
|
|
dataParam.push({ "name": "isAsc", "value": params.sortOrder }); |
|
|
|
$.modal.loading("正在导出数据,请稍后..."); |
|
|
|
$.post(prefix + '/exportAll', dataParam, function(result) { |
|
|
|
if (result.code == web_status.SUCCESS) { |
|
|
|
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; |
|
|
|
} else if (result.code == web_status.WARNING) { |
|
|
|
$.modal.alertWarning(result.msg) |
|
|
|
} else { |
|
|
|
$.modal.alertError(result.msg); |
|
|
|
} |
|
|
|
$.modal.closeLoading(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}else { |
|
|
|
$.modal.confirm("确定导出选中的所有" + table.options.modalName + "吗?", function () { |
|
|
|
//·拼接单号 |
|
|
|
for(let i=0;i<selections.length;i++){ |
|
|
|
bomNoData.push(selections[i].bomNo); |
|
|
|
} |
|
|
|
var bomNos = JSON.stringify(bomNoData); |
|
|
|
// console.log(bomNos); |
|
|
|
$.modal.loading("正在导出数据,请稍后..."); |
|
|
|
var config = { |
|
|
|
url: prefix + '/export', |
|
|
|
type: "post", |
|
|
|
dataType: "json", |
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
data: bomNos, |
|
|
|
success: function(result) { |
|
|
|
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; |
|
|
|
$.modal.alertSuccess("导出成功!") |
|
|
|
$.modal.closeLoading(); |
|
|
|
}, |
|
|
|
error: function (result){ |
|
|
|
$.modal.alertError(result.msg); |
|
|
|
} |
|
|
|
}; |
|
|
|
$.ajax(config) |
|
|
|
// $.operate.saveJson(prefix + "/export", bomNos); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
// 导入 |
|
|
|
function importExcel(formId, width, height) { |
|
|
|
table.set(); |
|
|
|
var currentId = $.common.isEmpty(formId) ? 'importTpl' : formId; |
|
|
|
var _width = $.common.isEmpty(width) ? "400" : width; |
|
|
|
var _height = $.common.isEmpty(height) ? "230" : height; |
|
|
|
layer.open({ |
|
|
|
type: 1, |
|
|
|
area: [_width + 'px', _height + 'px'], |
|
|
|
fix: false, |
|
|
|
// 不固定 |
|
|
|
maxmin: true, |
|
|
|
shade: 0.3, |
|
|
|
title: '导入' + table.options.modalName + '数据', |
|
|
|
content: $('#' + currentId).html(), |
|
|
|
btn: ['<i class="fa fa-check"></i> 导入', '<i class="fa fa-remove"></i> 取消'], |
|
|
|
// 弹层外区域关闭 |
|
|
|
shadeClose: true, |
|
|
|
btn1: function(index, layero){ |
|
|
|
var file = layero.find('#file').val(); |
|
|
|
if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))) { |
|
|
|
$.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
var index = layer.load(2, {shade: false}); |
|
|
|
$.modal.disable(); |
|
|
|
|
|
|
|
// 获取CheckBox的状态 |
|
|
|
var updateSupport = layero.find('#updateSupport').is(':checked'); |
|
|
|
|
|
|
|
var formData = new FormData(layero.find('form')[0]); |
|
|
|
formData.append('updateSupport', updateSupport); // 添加CheckBox的状态到FormData |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
url: table.options.importUrl, |
|
|
|
data: formData, |
|
|
|
cache: false, |
|
|
|
contentType: false, |
|
|
|
processData: false, |
|
|
|
type: 'POST', |
|
|
|
success: function (result) { |
|
|
|
layer.close(index); |
|
|
|
$.modal.enable(); |
|
|
|
|
|
|
|
$.modal.closeAll(); |
|
|
|
$.modal.alertSuccess(result); |
|
|
|
$.table.refresh(); |
|
|
|
}, |
|
|
|
error: function (result){ |
|
|
|
layer.close(index); |
|
|
|
$.modal.alertError(result); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
</script> |
|
|
|
</body> |
|
|
|
<!-- 导入区域 --> |
|
|
|