717 lines
32 KiB
JavaScript
717 lines
32 KiB
JavaScript
|
|
$(function() {
|
|
layui.use('laydate', function(){
|
|
var laydate = layui.laydate;
|
|
//日期时间选择器
|
|
laydate.render({
|
|
elem: '#startTime',
|
|
done:function (data) {
|
|
var endTime=$("#endTime").val();
|
|
if(data>endTime && endTime!=''){
|
|
layer.msg("开始时间不能大于结束时间");
|
|
$("#startTime").val('');
|
|
}
|
|
}
|
|
});
|
|
laydate.render({
|
|
elem: '#endTime',
|
|
done:function (data) {
|
|
var startTime=$("#startTime").val();
|
|
if(data<startTime && startTime!=''){
|
|
layer.msg("开始时间不能大于结束时间");
|
|
$("#endTime").val('');
|
|
}
|
|
}
|
|
});
|
|
laydate.render({
|
|
elem: '#launchTime'
|
|
});
|
|
laydate.render({
|
|
elem: '#finishTime'
|
|
});
|
|
});
|
|
$(".form_datetime").datetimepicker({
|
|
format : 'yyyy-mm-dd hh:ii'
|
|
});
|
|
getbaseList();
|
|
$("#baseForm").keydown(function(e) {
|
|
keycode = e.which || e.keyCode;
|
|
if (keycode == 13) {
|
|
search();
|
|
}
|
|
});
|
|
|
|
$('#addBtn').on('click', function(e) {
|
|
// 通知浏览器不要执行与事件关联的默认动作
|
|
e.preventDefault();
|
|
|
|
cleanForm();
|
|
findReceiveName("0");
|
|
JY.Model.edit("auDiv", "新增", function() {
|
|
if (JY.Validate.form("auForm")) {
|
|
var that = $(this);
|
|
var receiveName = $("#receiveName ").val();
|
|
var launchTime = $("#launchTime ").val();
|
|
var finishTime = $("#finishTime ").val();
|
|
var remark = $("#remark").val();
|
|
if(launchTime > finishTime){
|
|
layer.msg("采购时间不能大于到货时间");
|
|
return false;
|
|
}
|
|
JY.Ajax.doRequest("auForm", bonuspath + '/backstage/new/add',
|
|
{receiveName:receiveName,
|
|
launchTime:launchTime,
|
|
finishTime:finishTime,
|
|
remark:remark
|
|
}, function(data) {
|
|
that.dialog("close");
|
|
JY.Model.info(data.resMsg, function() {
|
|
search();
|
|
getbaseList();
|
|
}
|
|
);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
);
|
|
|
|
});
|
|
function isFinish(){
|
|
JY.Ajax.doRequest(null, bonuspath + '/backstage/new/isFinish',null, function(data) {
|
|
var l = data.obj.list;
|
|
var str='<option value="0">请选择</option>';
|
|
str+='<option value="0"></option>';
|
|
for(var i=0;i<l.length;i++){
|
|
str+='<option value='+l[i].taskId+'>'+l[i].status+'</option>';
|
|
}
|
|
$("#status").append(str);
|
|
});
|
|
}
|
|
function getbaseList(init) {
|
|
var isSure = $("#status").val();
|
|
if (init == 1)
|
|
$(".pageNum").val(1);
|
|
JY.Model.loading();
|
|
JY.Ajax.doRequest( "baseForm", bonuspath + '/backstage/new/findByPage',
|
|
{
|
|
isSure: isSure
|
|
},
|
|
function(data) {
|
|
|
|
$("#baseTable tbody").empty();
|
|
var obj = data.obj;
|
|
var list = obj.list;
|
|
var results = list.results;
|
|
var permitBtn = obj.permitBtn;
|
|
var pageNum = list.pageNum, pageSize = list.pageSize, totalRecord = list.totalRecord;
|
|
var html = "";
|
|
if (results != null && results.length > 0) {
|
|
var leng = (pageNum - 1) * pageSize;
|
|
for (var i = 0; i < results.length; i++) {
|
|
var l = results[i];
|
|
html += "<tr>";
|
|
html += "<td style='vertical-align:middle;' class='center hidden-480'>" + (i + leng + 1) + "</td>";
|
|
html += "<td style='vertical-align:middle;' class='center'>"+ JY.Object.notEmpty(l.launchName) + "</td>";
|
|
html += "<td style='vertical-align:middle;' class='center'>"+ JY.Object.notEmpty(l.launchTime) + "</td>";
|
|
html += "<td style='vertical-align:middle;' class='center'>"+ JY.Object.notEmpty(l.finishTime) + "</td>";
|
|
html += "<td style='vertical-align:middle;' class='center'>"+ JY.Object.notEmpty(l.maType) + "</td>";
|
|
html += "<td style='vertical-align:middle;' class='center'>"+ JY.Object.notEmpty(l.receiveName) + "</td>";
|
|
if(l.taskStatus == 1 || l.taskStatus == "1"){
|
|
html += "<td style='vertical-align:middle;' class='center'><span class='label label-danger'>待添加采购明细</span></td>";
|
|
}else if(l.taskStatus == 2 || l.taskStatus =='2'){
|
|
html += "<td style='vertical-align:middle;' class='center'><span class='label label-error'>待采购验收</span></td>";
|
|
}else if(l.taskStatus == 3 || l.taskStatus =='3') {
|
|
html += "<td style='vertical-align:middle;' class='center'><span class='label label-warning'>待上传验收附件</span></td>";
|
|
}else if(l.taskStatus >= 4) {
|
|
html += "<td style='vertical-align:middle;' class='center'><span class='label label-success'>已采购完成</span></td>";
|
|
}else{
|
|
html += "<td style='vertical-align:middle;' class='center'></td>";
|
|
}
|
|
html += "<td style='vertical-align:middle;' class='center'>"+ JY.Object.notEmpty(l.remark) + "</td>";
|
|
html += "<td style='vertical-align:middle;' class='center'>";
|
|
html += getCurrentStatusText(l.taskStatus, l.taskId, l.isFinish,l.isExamine,l.isApproval);
|
|
html += "</td>";
|
|
html += rowFunction(l.taskId,l.launchTime,l.finishTime,l.taskStatus,l.isFinish,l.isExamine);
|
|
html += "</tr>";
|
|
}
|
|
$("#baseTable tbody").append(html);
|
|
JY.Page.setPage("baseForm", "pageing", pageSize,pageNum, totalRecord, "getbaseList");
|
|
} else {
|
|
html += "<tr><td colspan='10' class='center'>没有相关数据</td></tr>";
|
|
$("#baseTable tbody").append(html);
|
|
$("#pageing ul").empty();// 清空分页
|
|
}
|
|
JY.Model.loadingClose();
|
|
}
|
|
);
|
|
}
|
|
|
|
|
|
|
|
// 添加获取当前状态文本的函数
|
|
function getCurrentStatusText(taskStatus, taskId, isFinish,isExamine,isApproval) {
|
|
var status = parseInt(taskStatus) || 0;
|
|
var statusText = "";
|
|
var statusClass = "";
|
|
|
|
if (taskStatus=='4' && isFinish=='0'){
|
|
status = 4;
|
|
} else if (taskStatus=='4' && isFinish=='1' && isExamine=='0'){
|
|
status = 5;
|
|
} else if (taskStatus=='4' && isFinish=='1' && isExamine=='1' && isApproval!='0'){
|
|
status = 6;
|
|
} else if (taskStatus=='4' && isFinish=='1' && isExamine=='1' && isApproval=='0'){
|
|
status = 7;
|
|
}
|
|
|
|
// 根据状态获取对应的文本和样式类
|
|
switch(status) {
|
|
case 1:
|
|
statusText = "添加采购明细";
|
|
statusClass = "label-success";
|
|
break;
|
|
case 2:
|
|
statusText = "采购验收";
|
|
statusClass = "label-success";
|
|
break;
|
|
case 3:
|
|
statusText = "上传验收附件";
|
|
statusClass = "label-success";
|
|
break;
|
|
case 4:
|
|
statusText = "采购完成";
|
|
statusClass = "label-success";
|
|
break;
|
|
case 5:
|
|
statusText = "入库";
|
|
statusClass = "label-success";
|
|
break;
|
|
case 6:
|
|
statusText = "新购机具审核";
|
|
statusClass = "label-success";
|
|
break;
|
|
case 7:
|
|
statusText = "新购机具批准";
|
|
statusClass = "label-success";
|
|
break;
|
|
default:
|
|
statusText = "创建申请";
|
|
statusClass = "label-info";
|
|
break;
|
|
}
|
|
|
|
// 返回可点击的状态文本
|
|
return '<span class="label ' + statusClass + ' status-clickable" onclick="viewProcessDetails(\'' + taskId + '\', \'' + taskStatus + '\', \'' + isFinish + '\',\'' + isExamine + '\',\'' + isApproval + '\')" title="点击查看流程详情">' + statusText + '</span>';
|
|
}
|
|
|
|
// 保留原有的查看流程详情函数
|
|
function viewProcessDetails(taskId, taskStatus, isFinish,isExamine,isApproval) {
|
|
const contentHtml = renderProcessSteps(parseInt(taskStatus) || 0, isFinish,isExamine,isApproval);
|
|
|
|
layer.open({
|
|
type: 1,
|
|
title: '流程详情',
|
|
skin: 'layui-layer-demo',
|
|
area: ['800px', '300px'],
|
|
shadeClose: true,
|
|
shade: 0.8,
|
|
maxmin: false,
|
|
content: contentHtml
|
|
});
|
|
}
|
|
|
|
function renderProcessSteps(taskStatus, isFinish,isExamine,isApproval) {
|
|
if (taskStatus=='4' && isFinish=='0'){
|
|
taskStatus = 4;
|
|
} else if (taskStatus=='4' && isFinish=='1' && isExamine=='0'){
|
|
taskStatus = 5;
|
|
} else if (taskStatus=='4' && isFinish=='1' && isExamine=='1' && isApproval!='0'){
|
|
taskStatus = 6;
|
|
} else if (taskStatus=='4' && isFinish=='1' && isExamine=='1' && isApproval=='0'){
|
|
taskStatus = 7;
|
|
}
|
|
// 定义固定的流程节点(顺序不能变)
|
|
const steps = [
|
|
{ value: 0, text: "创建申请" },
|
|
{ value: 1, text: "添加采购明细" },
|
|
{ value: 2, text: "采购验收" },
|
|
{ value: 3, text: "上传验收附件" },
|
|
{ value: 4, text: "已采购完成" },
|
|
{ value: 5, text: "入库" },
|
|
{ value: 6, text: "新购机具审核" },
|
|
{ value: 7, text: "新购机具批准" },
|
|
];
|
|
|
|
let html = '<div style="padding: 20px; font-size: 14px;">';
|
|
html += '<h3 style="text-align:center; margin-bottom: 20px;">采购流程进度</h3>';
|
|
html += '<div style="display: flex; justify-content: space-between; position: relative; margin-bottom: 30px;">';
|
|
|
|
// 绘制连接线(可选美化)
|
|
html += '<div style="position: absolute; top: 16px; left: 0; right: 0; height: 2px; background-color: #ccc; z-index: 1;"></div>';
|
|
|
|
steps.forEach((step, index) => {
|
|
const isCompleted = taskStatus >= step.value;
|
|
const color = isCompleted ? '#333' : '#ccc';
|
|
const fontWeight = isCompleted ? 'bold' : 'normal';
|
|
|
|
html += `
|
|
<div style="text-align: center; z-index: 2; position: relative;">
|
|
<div style="width: 32px; height: 32px; line-height: 32px; border-radius: 50%; background-color: ${isCompleted ? '#1E90FF' : '#eee'}; color: white; margin: 0 auto 8px; font-weight: bold;">
|
|
${index + 1}
|
|
</div>
|
|
<div style="color: ${color}; font-weight: ${fontWeight}; white-space: nowrap;">${step.text}</div>
|
|
</div>
|
|
`;
|
|
});
|
|
|
|
html += '</div></div>';
|
|
return html;
|
|
}
|
|
|
|
function rowFunction(id,launchTime,finishTime,status,isFinish,isExamine) {
|
|
var h = "";
|
|
h += "<td style='vertical-align:middle;' class='center'>";
|
|
h += "<div class='visible-md visible-lg hidden-sm hidden-xs btn-group'>";
|
|
//h += "<a href='#' title='验收单' onclick='checkList('" + id + "')' class='aBtnNoTD' ><i class='icon-list-alt color-p bigger-140'></i></a>";
|
|
if(status == 1){
|
|
h += "<a href='#' title='批次详情' onclick='details('" + id + "','"+ launchTime +"','"+ finishTime +"','"+ isFinish +"')' class='aBtnNoTD' ><i class='icon-zoom-in color-p bigger-140'></i></a>";
|
|
h += "<a href='#' title='修改' onclick='edit('" + id + "')' class='aBtnNoTD' ><i class='icon-edit color-blue bigger-140'></i></a>";
|
|
|
|
}else{
|
|
h += "<a href='#' title='批次详情' onclick='details('" + id + "','"+ launchTime +"','"+ finishTime +"','"+ isFinish +"')' class='aBtnNoTD' ><i class='icon-zoom-in color-p bigger-140'></i></a>";
|
|
h += "<a href='#' title='修改' onclick='edit('" + id + "')' class='aBtnNoTD' ><i class='icon-edit color-blue bigger-140'></i></a>";
|
|
h += "<a href='#' title='采购单' onclick='order('" + id + "','" + launchTime + "')' class='aBtnNoTD' ><i class='icon-list-alt color-p bigger-140'></i></a>";
|
|
}
|
|
if(isExamine != "1"){
|
|
h += "<a href='#' title='删除' onclick='del('" + id + "')' class='aBtnNoTD' ><i class='icon-remove-sign color-p bigger-140'></i></a>";
|
|
}
|
|
/* h += "</div>";
|
|
h += "<div class='visible-xs visible-sm hidden-md hidden-lg'><div class='inline position-relative'>";
|
|
h += "<button class='btn btn-minier btn-primary dropdown-toggle' data-toggle='dropdown'><i class='icon-cog icon-only bigger-110'></i></button>";
|
|
h += "<ul class='dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close'>";
|
|
h += "<li><a href='#' title='批次详情' onclick='details('" + id + "','"+ launchTime +"','"+ finishTime +"')' class='aBtnNoTD' ><i class='icon-zoom-in color-p bigger-140'></i></a></li>";
|
|
//h += "<a href='#' title='打印' onclick='print('" + id + "')' class='aBtnNoTD' ><i class='icon-list-alt color-p bigger-140'></i></a>";
|
|
//h += "<li><a href='#' title='验收单' onclick='checkList('" + id + "')' class='aBtnNoTD' ><i class='icon-list-alt color-p bigger-140'></i></a></li>";
|
|
if(status == 1){
|
|
h += "<li><a href='#' title='修改' onclick='edit('" + id + "')' class='aBtnNoTD' ><i class='icon-edit color-blue bigger-140'></i></a></li>";
|
|
h += "<li><a href='#' title='删除' onclick='del('" + id + "')' class='aBtnNoTD' ><i class='icon-remove-sign col bigger-140'></i></a></li>";
|
|
}
|
|
h += "</ul></div></div>";*/
|
|
h += "</td>";
|
|
return h;
|
|
}
|
|
|
|
|
|
function order(id,launchTime){
|
|
cleanForm(id);
|
|
JY.Ajax.doRequest(null, bonuspath + '/backstage/new/newPurchaseReceipt', {
|
|
id : id
|
|
}, function(data) {
|
|
if(data.obj.list.length != 0){
|
|
setForms(data,launchTime);
|
|
JY.Model.check("auDivss");
|
|
}else {
|
|
var indexMsg = layer.confirm(data.resMsg, {btn: ['关闭']},function(){
|
|
layer.close(indexMsg);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function setForms(data,launchTime) {
|
|
var results = data.obj.list;
|
|
// alert(JSON.stringify(results))
|
|
var html = "";
|
|
$(".launchTime").text(launchTime);
|
|
$(".basic").html("");
|
|
$(".add").remove();
|
|
if(results.length != 0){
|
|
for(var i = 0;i < results.length;i++){
|
|
if(i < 5){
|
|
$("#id"+i).html(i+1);
|
|
$("#machineType"+i).html(results[i].machineType);
|
|
$("#machineModel"+i).html(results[i].machineModel);
|
|
$("#unit"+i).html(results[i].unit);
|
|
$("#arrivalNum"+i).html(results[i].arrivalNum);
|
|
$("#buyPrice"+i).html(results[i].buyPrice);
|
|
$("#venderName"+i).html(results[i].venderName);
|
|
}else{
|
|
html += '<tr class="add">';
|
|
html += '<td style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun">'+(i+1)+'</td>';
|
|
html += '<td style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun">'+results[i].machineType+'</td>';
|
|
html += '<td style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun">'+results[i].machineModel+'</td>';
|
|
html += '<td style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun">'+results[i].unit+'</td>';
|
|
html += '<td style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun">'+results[i].arrivalNum+'</td>';
|
|
html += '<td style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun">'+results[i].buyPrice+'</td>';
|
|
html += '<td style="text-align:center;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun">'+results[i].venderName+'</td>';
|
|
html += '</tr>';
|
|
}
|
|
}
|
|
}
|
|
$("#five").after(html);
|
|
}
|
|
|
|
|
|
|
|
|
|
function addShop(id,creator,createTime,remark){
|
|
var receiveName = $("#receiveName ").val();
|
|
var launchTime = $("#launchTime ").val();
|
|
var finishTime = $("#finishTime ").val();
|
|
cleanForm();
|
|
$.ajax({
|
|
type: "post",
|
|
url: bonuspath + '/backstage/new/add',
|
|
data: {
|
|
id : id,
|
|
creator : creator,
|
|
createTime : createTime,
|
|
remark : remark,
|
|
receiveName : receiveName,
|
|
launchTime : launchTime,
|
|
finishTime : finishTime
|
|
},
|
|
dataType: "json",
|
|
success: function(data) {
|
|
search();
|
|
},
|
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
|
alert("未连接到服务器,请检查网络!");
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
function check(id) {
|
|
cleanForm();
|
|
findReceiveName("0");
|
|
JY.Ajax.doRequest(null, bonuspath + '/backstage/new/find', {
|
|
id : id
|
|
}, function(data) {
|
|
setForm(data);
|
|
JY.Model.check("auDiv");
|
|
});
|
|
}
|
|
|
|
function details(id,launchTime,finishTime,isFinish){
|
|
localStorage.setItem("taskId",id);
|
|
localStorage.setItem("launchTime",launchTime);
|
|
localStorage.setItem("finishTime",finishTime);
|
|
localStorage.setItem("isFinish",isFinish);
|
|
//iframe层-父子操作
|
|
layer.open({
|
|
type: 2,
|
|
title:['机具增加','background-color: #27A3D9;color:#fff'],
|
|
shadeClose:true,
|
|
shade:false,
|
|
maxmin: true,
|
|
area: ['1200px', '600px'],
|
|
content:bonuspath + '/backstage/inputDetails/list'
|
|
});
|
|
}
|
|
|
|
function setForm(data) {
|
|
var l = data.obj;
|
|
$("#auForm input[name$='id']").val(l.id);
|
|
$("#auForm input[name$='receiveName']").val(JY.Object.notEmpty(l.receiveName));
|
|
$("#auForm input[name$='launchTime']").val(JY.Object.notEmpty(l.launchTime));
|
|
$("#auForm input[name$='finishTime']").val(JY.Object.notEmpty(l.finishTime));
|
|
$("#auForm input[name$='remark']").val(JY.Object.notEmpty(l.remark));
|
|
findReceiveName(l.receiveId);
|
|
}
|
|
|
|
function cleanForm() {
|
|
JY.Tags.isValid("auForm", "1");
|
|
JY.Tags.cleanForm("auForm");
|
|
$("#auForm input[name$='id']").val('0');// 上级资源
|
|
$("#auForm input[name$='receiveName']").val('');
|
|
$("#auForm input[name$='launchTime']").val('');
|
|
$("#auForm input[name$='finishTime']").val('');
|
|
$("#auForm input[name$='remark']").val('');
|
|
}
|
|
|
|
function search() {
|
|
$("#searchBtn").trigger("click");
|
|
}
|
|
|
|
function edit(id) {
|
|
cleanForm();
|
|
JY.Ajax.doRequest(null, bonuspath + '/backstage/new/find', {
|
|
id : id
|
|
}, function(data) {
|
|
setForm(data);
|
|
JY.Model.edit("auDiv", "修改", function() {
|
|
if (JY.Validate.form("auForm")) {
|
|
var receiveName = $("#receiveName").val();
|
|
var launchTime = $("#launchTime").val();
|
|
var finishTime = $("#finishTime").val();
|
|
var remark = $("#remark").val();
|
|
var that = $(this);
|
|
JY.Ajax.doRequest("auForm", bonuspath + '/backstage/new/update', {id:id,receiveName:receiveName,launchTime:launchTime,finishTime:finishTime,remark:remark}, function(data) {
|
|
that.dialog("close");
|
|
JY.Model.info(data.resMsg, function() {
|
|
search();
|
|
});
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
function del(id) {
|
|
JY.Model.confirm("确认删除吗?", function() {
|
|
JY.Ajax.doRequest(null, bonuspath + '/backstage/new/del', {
|
|
id : id
|
|
}, function(data) {
|
|
JY.Model.info(data.resMsg, function() {
|
|
search();
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function findReceiveName(receiveId){
|
|
JY.Ajax.doRequest("auForm",bonuspath +'/backstage/new/findAllUserInfo',{},function(data){
|
|
$("#receiveName").html("");
|
|
var results = data.obj.list
|
|
var html="";
|
|
if(results!=null&&results.length>0){
|
|
for(var i=0;i<results.length;i++){
|
|
var l= results[i];
|
|
html+="<option value='"+l.id+"'>"+l.name+"</option>";
|
|
}
|
|
$("#receiveName").append(html);
|
|
$("#receiveName option[value='"+receiveId+"']").attr("selected","selected");
|
|
}else{
|
|
html+="<option ></option>";;
|
|
$("#receiveName").append(html);
|
|
}
|
|
});
|
|
}
|
|
|
|
function cleanAcceptForm() {
|
|
$("#models").html('');
|
|
$("#machineTypes").html('');
|
|
$("#outNums").html('');
|
|
$("#machinesNums").html('');
|
|
$("#venders").html('');
|
|
$("#checkNums").html('');
|
|
$("#exteriorChecks").html('');
|
|
$("#testChecks").html('');
|
|
$("#checkConclusions").html('');
|
|
}
|
|
|
|
function checkList(id) {
|
|
cleanAcceptForm();
|
|
JY.Ajax.doRequest(null, bonuspath + '/backstage/new/findSheet', {
|
|
id : id
|
|
}, function(data) {
|
|
setAcceptForm(data);
|
|
JY.Model.check("acceptDiv");
|
|
});
|
|
}
|
|
|
|
function setAcceptForm(data,batchStatus) {
|
|
var s = 5;
|
|
var l = data.obj;
|
|
var typeName = l.typeName;
|
|
var typeNames = new Array();
|
|
typeNames = typeName.split(";,;");
|
|
var modelName = l.modelName
|
|
var modelNames = new Array();
|
|
modelNames = modelName.split(";,;");
|
|
var machinesNum = l.machinesNum
|
|
var machinesNums = new Array();
|
|
machinesNums = machinesNum.split(";,;");
|
|
var checkNum = l.checkNum;
|
|
var checkNums = new Array();
|
|
checkNums = checkNum.split(";,;");
|
|
var unit = l.unit;
|
|
var units = new Array();
|
|
units = unit.split(";,;");
|
|
var size = modelNames.length;
|
|
var typeNameHtml = "";
|
|
var modelNameHtml = "";
|
|
var machinesNumHtml = "";
|
|
var checkNumHtml = "";
|
|
var applyNumber = l.applyNumber;
|
|
var venderName = l.venderName;
|
|
var maNums = "";
|
|
$(".add").remove();
|
|
if(parseInt(size) > s){
|
|
groupAcceptForm(s,size,typeNames,modelNames,machinesNums,checkNums,units,applyNumber,venderName);
|
|
size = s;
|
|
}
|
|
var tf = false;
|
|
for(var i = 0; i < size; i++){
|
|
maNums = '0' + machinesNums[i].substring(machinesNums[i].length-4);
|
|
if(parseFloat(maNums) < parseFloat(0.001)){
|
|
maNums = machinesNums[i].substring(0,machinesNums[i].length-4);
|
|
}else{
|
|
maNums = machinesNums[i];
|
|
}
|
|
typeNameHtml += '<span style="padding:5px 0px;"><span style="width: 24px;height: 24px;padding:1px; -webkit-border-radius: 50%;font-size: 1em;border:1px solid #000000;">'+(i+1)+'</span>、';
|
|
typeNameHtml += typeNames[i] + " </span>";
|
|
modelNameHtml += '<span style="padding:5px 0px;"><span style="width: 24px;height: 24px;padding:1px; -webkit-border-radius: 50%;font-size: 0.9em;border:1px solid #000000;">'+(i+1)+'</span>、';
|
|
modelNameHtml += modelNames[i] + " </span>";
|
|
machinesNumHtml += '<span style="padding:5px 0px;"><span style="width: 24px;height: 24px;padding:1px; -webkit-border-radius: 50%;font-size: 1.1em;border:1px solid #000000;">'+(i+1)+'</span>、';
|
|
machinesNumHtml += maNums + units[i] + " </span>";
|
|
checkNumHtml += '<span style="padding:5px 0px;"><span style="width: 24px;height: 24px;padding:1px; -webkit-border-radius: 50%;font-size: 1em;border:1px solid #000000;">'+(i+1)+'</span>、';
|
|
checkNumHtml += checkNums[i] + units[i] + " </span>";
|
|
if(checkNums[i] > 0){
|
|
tf = true;
|
|
}
|
|
}
|
|
if(!tf){
|
|
checkNumHtml = "";
|
|
}
|
|
$("#checkCodes").html(JY.Object.notEmpty(applyNumber));
|
|
$("#machineTypes").html(typeNameHtml);
|
|
$("#models").html(JY.Object.notEmpty(modelNameHtml));
|
|
$("#machinesNums").html(JY.Object.notEmpty(machinesNumHtml));
|
|
$("#venders").html(JY.Object.notEmpty(venderName));
|
|
$("#checkNums").html(checkNumHtml);
|
|
}
|
|
|
|
function groupAcceptForm(s,size,typeNames,modelNames,machinesNums,checkNums,units,applyNumber,venderName){
|
|
size -= s;
|
|
var len = parseInt(parseInt(size) / s);
|
|
if(len > 0){
|
|
var ys = parseInt(size) % s;
|
|
if(ys == 0){
|
|
len += 1;
|
|
}
|
|
for(var i = 1; i < len; i++){
|
|
initAcceptForm(s,i,s,typeNames,modelNames,machinesNums,checkNums,units,applyNumber,venderName);
|
|
}
|
|
if(ys > 0){
|
|
initAcceptForm(s,len,ys,typeNames,modelNames,machinesNums,checkNums,units,applyNumber,venderName);
|
|
}
|
|
} else {
|
|
len = 1;
|
|
var ys = parseInt(size) % s;
|
|
if(ys > 0){
|
|
initAcceptForm(s,len,ys,typeNames,modelNames,machinesNums,checkNums,units,applyNumber,venderName);
|
|
}
|
|
}
|
|
}
|
|
|
|
function initAcceptForm(s,i,ys,typeNames,modelNames,machinesNums,checkNums,units,applyNumber,venderName){
|
|
var typeNameHtml = "";
|
|
var modelNameHtml = "";
|
|
var machinesNumHtml = "";
|
|
var checkNumHtml = "";
|
|
var size = s * i + ys;
|
|
var tf = false;
|
|
for(var j = s * i; j < size; j++){
|
|
maNums = '0' + machinesNums[j].substring(machinesNums[j].length-4);
|
|
typeNameHtml += '<span style="padding:5px 0px;"><span style="width: 24px;height: 24px;padding:1px; -webkit-border-radius: 50%;font-size: 1em;border:1px solid #000000;">'+(j+1)+'</span>、';
|
|
typeNameHtml += typeNames[j] + " </span>";
|
|
modelNameHtml += '<span style="padding:5px 0px;"><span style="width: 24px;height: 24px;padding:1px; -webkit-border-radius: 50%;font-size: 0.9em;border:1px solid #000000;">'+(j+1)+'</span>、';
|
|
modelNameHtml += modelNames[j] + " </span>";
|
|
machinesNumHtml += '<span style="padding:5px 0px;"><span style="width: 24px;height: 24px;padding:1px; -webkit-border-radius: 50%;font-size: 1.1em;border:1px solid #000000;">'+(j+1)+'</span>、';
|
|
machinesNumHtml += machinesNums[j] + units[j] + " </span>";
|
|
checkNumHtml += '<span style="padding:5px 0px;"><span style="width: 24px;height: 24px;padding:1px; -webkit-border-radius: 50%;font-size: 1em;border:1px solid #000000;">'+(i+1)+'</span>、';
|
|
checkNumHtml += checkNums[i] + units[j] + " </span>";
|
|
if(checkNums[i] > 0){
|
|
tf = true;
|
|
}
|
|
}
|
|
if(!tf){
|
|
checkNumHtml = "";
|
|
}
|
|
|
|
var html = '';
|
|
html += '<table class="accept add" cellpadding="0" border="0" cellspacing="0" style="width:99%;page-break-before: always;">';
|
|
html += '<tr>';
|
|
html += '<td colspan="6" style="text-align: center; font-size: 1.3em;font-weight: bold;font-family:SimSun">';
|
|
html += '机 具 设 备 到 货 验 收 单';
|
|
html += '</td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td colspan="4" style="padding: 20px 0px 10px 0px;font-family:SimSun">验收日期:<span id="checkTimes"></span></td>';
|
|
html += '<td colspan="2" style="padding: 20px 0px 10px 0px;font-family:SimSun">编号:<span id="checkCodes">'+applyNumber+'</span></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td style="height:120px;text-align:center;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">机具名称</td>';
|
|
html += '<td style="text-align:left;width: 25%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun">'+typeNameHtml+'</td>';
|
|
html += '<td style="text-align:center;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">规格型号</td>';
|
|
html += '<td style="text-align:left;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;">'+modelNameHtml+'</td>';
|
|
html += '<td style="text-align:center;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">数量</td>';
|
|
html += '<td style="text-align:left;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun">'+machinesNumHtml+'</td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td style="height:30px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">生产厂家</td>';
|
|
html += '<td colspan="5" style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun"><span class="basic" style="text-align: center;">'+venderName+'</span></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td style="height:30px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">出厂编号</td>';
|
|
html += '<td colspan="5" style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td colspan="6" style="height:40px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-weight: bold;font-family:SimSun">验收项目</td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td style="height:80px;width: 15%;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">数量</td>';
|
|
html += '<td style="text-align:center;width: 25%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun"><span class="basic" style="text-align: center;">'+checkNumHtml+'</span></td>';
|
|
html += '<td style="text-align:center;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">外观检查</td>';
|
|
html += '<td style="text-align:center;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun"><span class="basic" style="text-align: center;"></span></td>';
|
|
html += '<td style="text-align:center;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">试验检验</td>';
|
|
html += '<td style="text-align:center;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun"><span id="testChecks" class="basic" style="text-align: center;"></span></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td style="height:30px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">验收结论</td>';
|
|
html += '<td rowspan="5" colspan="5" style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun"><span class="basic" style="text-align: center;"></span></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td colspan="6" style="height:30px;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-weight: bold;font-family:SimSun">相关配套资料:<span></span></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td colspan="6" style="height:30px;border-top: 1px dashed #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td colspan="6" style="height:30px;border-top: 1px dashed #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<tr>';
|
|
html += '<td rowspan="7" style="text-align:center;width:15%;border-top: 1px solid #000000;border-left: 1px solid #000000;border-bottom: 1px solid #000000;font-weight: bold;font-family:SimSun">验收签章</td>';
|
|
html += '<td rowspan="2" style="height:80px;width:15%;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">租赁科</td>';
|
|
html += '<td style="text-align:center;width:15%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">采购员</td>';
|
|
html += '<td style="text-align:center;width:15%;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">库管员</td>';
|
|
html += '<td colspan="2" style="text-align:center;width:30%;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-weight: bold;font-family:SimSun">部门负责人</td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td style="height:40px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '<td style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '<td colspan="2" style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td rowspan="2" style="height:80px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">修试科</td>';
|
|
html += '<td colspan="2" style="height:40px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">修试人员</td>';
|
|
html += '<td colspan="2" style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-weight: bold;font-family:SimSun">部门负责人</td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td colspan="2" style="height:40px;width: 15%;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '<td colspan="2" style="text-align:center;width: 15%;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td rowspan="2" style="height:80px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">安全技术科</td>';
|
|
html += '<td colspan="2" style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-weight: bold;font-family:SimSun">检验员</td>';
|
|
html += '<td colspan="2" style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-weight: bold;font-family:SimSun">部门负责人</td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td colspan="2" style="height:50px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '<td colspan="2" style="height:50px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '</tr>';
|
|
html += '<tr>';
|
|
html += '<td style="height:70px;text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-bottom: 1px solid #000000;font-weight: bold;font-family:SimSun">分公司领导</td>';
|
|
html += '<td colspan="4" style="text-align:center;border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;border-bottom: 1px solid #000000;font-family:SimSun"></td>';
|
|
html += '</tr>';
|
|
html += '</table>';
|
|
$("#acceptForm").append(html);
|
|
}
|
|
|