|
|
@@ -126,6 +126,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
});
|
|
|
$(".btn-add").data("area", ["100%","100%"]);
|
|
|
$(".btn-edit").data("area", ["100%","100%"]);
|
|
|
+ $(".btn-printing").data("area", ["100%","100%"]);
|
|
|
table.on('post-body.bs.table', function (e, settings, json, xhr) {
|
|
|
$(".btn-editone").data("area", ["100%", "100%"]);
|
|
|
});
|
|
|
@@ -290,7 +291,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
return false;
|
|
|
}
|
|
|
// 判断样品名称是否为空
|
|
|
- var name = $('#c-name').val();
|
|
|
+ var name = $('#c-name').text();
|
|
|
if (name == '' || name == undefined) {
|
|
|
layer.confirm('样品名称不能为空');
|
|
|
return false;
|
|
|
@@ -313,6 +314,31 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
layer.confirm('样品编号不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
+ // 获取备注选中值
|
|
|
+ var requirement = '';
|
|
|
+ $("input[name='requirement']:checked").each(function(){
|
|
|
+ requirement += $(this).val()+"、";
|
|
|
+ });
|
|
|
+ // 获取检后样品处理要求选中值
|
|
|
+ var deal = '';
|
|
|
+ $("input[name='deal']:checked").each(function(){
|
|
|
+ deal += $(this).val()+"、";
|
|
|
+ });
|
|
|
+ // 获取样品保存条件选中值
|
|
|
+ var condition = '';
|
|
|
+ $("input[name='condition']:checked").each(function (){
|
|
|
+ condition += $(this).val()+"、";
|
|
|
+ });
|
|
|
+ // 获取报告发放选中值
|
|
|
+ var isue = '';
|
|
|
+ $("input[name='isue']:checked").each(function (){
|
|
|
+ isue += $(this).val()+"、";
|
|
|
+ });
|
|
|
+ // 获取检测依据标准选中值
|
|
|
+ var standard = '';
|
|
|
+ $("input[name='standard']:checked").each(function(){
|
|
|
+ standard += $(this).val()+"、";
|
|
|
+ });
|
|
|
Fast.api.ajax({
|
|
|
url: 'entrust/commissionsheetup',
|
|
|
data: {
|
|
|
@@ -324,13 +350,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
project:project,
|
|
|
no:no,
|
|
|
status:$("input[name='status']:checked").val(),
|
|
|
- requirement:$("input[name='requirement']:checked").val(),
|
|
|
+ requirement:requirement,
|
|
|
reportnumber:$('#c-reportnumber').val(),
|
|
|
- deal:$("input[name='deal']:checked").val(),
|
|
|
- condition:$("input[name='condition']:checked").val(),
|
|
|
- isue:$("input[name='isue']:checked").val(),
|
|
|
+ deal:deal,
|
|
|
+ condition:condition,
|
|
|
+ isue:isue,
|
|
|
testcost:$('#c-testcost').val(),
|
|
|
- standard:$("input[name='standard']:checked").val()
|
|
|
+ standard:standard
|
|
|
},
|
|
|
}, function (data, ret) {
|
|
|
if (ret.code === 1){
|
|
|
@@ -341,7 +367,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
parent.Fast.api.refreshmenu();
|
|
|
return false;
|
|
|
}, function (data, ret) {
|
|
|
- parent.Toastr.error('添加失败');
|
|
|
+ parent.Toastr.error(ret.msg);
|
|
|
Fast.api.close();
|
|
|
parent.Fast.api.refreshmenu();
|
|
|
return false;
|
|
|
@@ -350,11 +376,108 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
});
|
|
|
},
|
|
|
printing: function (){
|
|
|
- $(document).ready(function (){
|
|
|
- Fast.api.close();
|
|
|
- window.print();
|
|
|
- });
|
|
|
Controller.api.bindevent();
|
|
|
+ Form.api.bindevent($("form[role=form]"), function (data, ret) {
|
|
|
+ Toastr.success("成功");
|
|
|
+ }, function (data, ret) {
|
|
|
+ Toastr.success("失败");
|
|
|
+ }, function (success, error) {
|
|
|
+ // 判断委托编号是否为空
|
|
|
+ var entrust_id = $('#c-entrust_id').val();
|
|
|
+ if (entrust_id == '' || entrust_id == undefined) {
|
|
|
+ layer.confirm('委托编号不能为空');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 判断委托方是否为空
|
|
|
+ var entrust_user = $('#c-entrust_user').val();
|
|
|
+ if (entrust_user == '' || entrust_user == undefined) {
|
|
|
+ layer.confirm('委托方不能为空');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 判断委托日期是否为空
|
|
|
+ var entrust_time = $('#c-entrust_time').val();
|
|
|
+ if (entrust_time == '' || entrust_time == undefined) {
|
|
|
+ layer.confirm('委托日期不能为空');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 循环获取样品信息
|
|
|
+ var sampledata = [];
|
|
|
+ var samplelist = $('#tableprint').find("tr");//样品种数
|
|
|
+ for (var i=4;i<samplelist.length-8;i++){
|
|
|
+ var samdata = [];
|
|
|
+ var name = $(samplelist).eq(i).find('#c-name').text();
|
|
|
+ var status = $(samplelist).eq(i).find("input[name='status']:checked").val();
|
|
|
+ var num = $(samplelist).eq(i).find('#c-num').val();
|
|
|
+ if (num == '' || num == undefined) {
|
|
|
+ layer.confirm('样品数量不能为空');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ var object = $(samplelist).eq(i).find('#c-project').val();
|
|
|
+ var no = $(samplelist).eq(i).find('#c-no').val();
|
|
|
+ samdata.push(name);
|
|
|
+ samdata.push(status);
|
|
|
+ samdata.push(num);
|
|
|
+ samdata.push(object);
|
|
|
+ samdata.push(no);
|
|
|
+ sampledata.push(samdata);
|
|
|
+ }
|
|
|
+ console.log(sampledata);
|
|
|
+ // 获取备注选中值
|
|
|
+ var requirement = '';
|
|
|
+ $("input[name='requirement']:checked").each(function(){
|
|
|
+ requirement += $(this).val()+"、";
|
|
|
+ });
|
|
|
+ // 获取检后样品处理要求选中值
|
|
|
+ var deal = '';
|
|
|
+ $("input[name='deal']:checked").each(function(){
|
|
|
+ deal += $(this).val()+"、";
|
|
|
+ });
|
|
|
+ // 获取样品保存条件选中值
|
|
|
+ var condition = '';
|
|
|
+ $("input[name='condition']:checked").each(function (){
|
|
|
+ condition += $(this).val()+"、";
|
|
|
+ });
|
|
|
+ // 获取报告发放选中值
|
|
|
+ var isue = '';
|
|
|
+ $("input[name='isue']:checked").each(function (){
|
|
|
+ isue += $(this).val()+"、";
|
|
|
+ });
|
|
|
+ // 获取检测依据标准选中值
|
|
|
+ var standard = '';
|
|
|
+ $("input[name='standard']:checked").each(function(){
|
|
|
+ standard += $(this).val()+"、";
|
|
|
+ });
|
|
|
+ Fast.api.ajax({
|
|
|
+ url: 'entrust/printingup',
|
|
|
+ data: {
|
|
|
+ entrust_user:entrust_user,
|
|
|
+ entrust_time:entrust_time,
|
|
|
+ entrust_id:entrust_id,
|
|
|
+ sampledata:sampledata,
|
|
|
+ requirement:requirement,
|
|
|
+ reportnumber:$('#c-reportnumber').val(),
|
|
|
+ deal:deal,
|
|
|
+ condition:condition,
|
|
|
+ isue:isue,
|
|
|
+ testcost:$('#c-testcost').val(),
|
|
|
+ standard:standard
|
|
|
+ },
|
|
|
+ }, function (data, ret) {
|
|
|
+ if (ret.code === 1){
|
|
|
+ window.print();
|
|
|
+ }
|
|
|
+ parent.Toastr.success('添加成功');
|
|
|
+ Fast.api.close();
|
|
|
+ parent.Fast.api.refreshmenu();
|
|
|
+ return false;
|
|
|
+ }, function (data, ret) {
|
|
|
+ parent.Toastr.error(ret.msg);
|
|
|
+ Fast.api.close();
|
|
|
+ parent.Fast.api.refreshmenu();
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ });
|
|
|
},
|
|
|
api: {
|
|
|
bindevent: function () {
|