创建版本

This commit is contained in:
2021-02-22 12:17:00 +08:00
commit af555f49c3
2332 changed files with 369202 additions and 0 deletions
@@ -0,0 +1,122 @@
<div class="form-panel">
<div class="form-panel-header">
<div class="pull-right">
</div>
{{$form['btn']}}
</div>
<div class="form-panel-body panel-form-{{$form['action']}}">
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
{{$form['tpl']}}
</form>
</div>
</div>
<script>
var table = '{{$form["table"]}}';
$(function() {
$('#stock_record08_data_tool').append('<a class="btn btn-sm btn-default" href="javascript:importExcel();">导入</a>');
});
// 发货记录
function importExcel() {
var url = app.url('stock/record08/importExcel');
formDialog({
title: '导入数据',
url: url,
id: 'import_excel',
dialogClass:'modal-md',
onSubmit: function() {
var me = this;
var form = $('#import_excel');
var file = document.querySelector("#import_file").files[0];
var formData = new FormData();
formData.append('file', file);
var loading = layer.msg('数据提交中...', {
icon: 16, shade: 0.1, time: 1000 * 120
});
$.ajax(url, {
method: "post",
data: formData,
processData: false,
contentType: false,
complete: function() {
layer.close(loading);
},
success: function (res) {
if (res.status) {
grid.api.setRowData([]);
for (var i = 0; i < res.data.length; i++) {
var row = res.data[i];
grid.api.memoryStore.create(row);
}
$(me).dialog('close');
toastrSuccess('导入数据成功。');
} else {
toastrError(res.data);
}
},
error: function (res) {
toastrError(res.data);
}
});
}
});
}
window.importExcel = importExcel;
// grid初始化事件
gdoo.event.set('grid.stock_record08_data',{
ready(me) {
grid = me;
grid.dataKey = 'product_id';
},
editable: {
product_name(params) {
return has_warehouse_id();
},
poscode(params) {
return has_warehouse_id();
}
}
});
function get_warehouse_id() {
var warehouse_id = $('#stock_record08_warehouse_id').val();
return warehouse_id || 0;
}
function has_warehouse_id() {
var warehouse_id = get_warehouse_id();
if (warehouse_id == 0) {
toastrError('请先选择仓库');
return false;
} else {
return true;
}
}
// 子表对话框
gdoo.event.set('stock_record08_data.product_id', {
query(query) {
},
onSelect(row, selectedRow) {
return true;
}
});
// 选择货位编号
gdoo.event.set('stock_record08_data.poscode', {
query(query) {
var warehouse_id = get_warehouse_id();
if (warehouse_id > 0) {
query.warehouse_id = warehouse_id;
}
},
onSelect(row, selectedRow) {
row.poscode = selectedRow.code;
row.posname = selectedRow.name;
return true;
}
});
</script>
@@ -0,0 +1,59 @@
{{$header["js"]}}
<div class="panel no-border" id="{{$header['master_table']}}-controller">
@include('headers')
<div class='list-jqgrid'>
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
</div>
</div>
<script>
(function ($) {
var table = '{{$header["master_table"]}}';
var config = gdoo.grids[table];
var action = config.action;
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);
options.remoteDataUrl = '{{url()}}';
options.remoteParams = search.advanced.query;
options.columnDefs = config.cols;
options.onRowDoubleClicked = function (params) {
if (params.node.rowPinned) {
return;
}
if (params.data == undefined) {
return;
}
if (params.data.master_id > 0) {
action.show(params.data);
}
};
new agGrid.Grid(gridDiv, options);
// 读取数据
options.remoteData({page: 1});
// 绑定自定义事件
var $gridDiv = $(gridDiv);
$gridDiv.on('click', '[data-toggle="event"]', function () {
var data = $(this).data();
if (data.master_id > 0) {
action[data.action](data);
}
});
config.grid = options;
})(jQuery);
</script>
@include('footers')
@@ -0,0 +1 @@
{{$form['tpl']}}
@@ -0,0 +1,87 @@
<div id="div1">
<div style="line-height:40px;font-size:14pt;" align=center><strong><font>{{$setting['print_title']}}{{$form['template']['name']}}</font></strong></div>
<table border=0 cellspacing=0 cellpadding=0 width="100%" style="font-size:11pt;">
<tbody>
<tr>
<td width="43%"><font>单据编号:<span>{{$master['sn']}}</span></font></td>
<td width="33%"><font>入库日期:<span>{{$master['invoice_dt']}}</span></font></td>
<td><font>仓库:{{$master['warehouse_name']}}</font></td></tr>
<tr>
<td><font>入库类别:<span>{{$master['type_name']}}</span></font></td>
<td><font>部门:<span>{{$master['department_name']}}</span></font><font></font></td>
<td><font>备注:{{$master['remark']}}</font></td></tr>
</tbody></table>
</div>
</div>
<div id="div2">
<style>
td { padding: 2px; }
</style>
<table style="font-size:11pt;" border="1" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse" bordercolor="#000000">
<tr>
<td align="center">产品编码</td>
<td align="center">产品名称</td>
<td align="center">规格型号</td>
<td align="center">单位</td>
<td align="center">数量</td>
<td align="center">批号</td>
<td align="center">货位</td>
</tr>
</thead>
@foreach($rows as $row)
<tr>
<td align="center">{{$row['product_code']}}</td>
<td align="center">{{$row['product_name']}}</td>
<td align="center">{{$row['product_spec']}}</td>
<td align="center">{{$row['product_unit']}}</td>
<td align="right">@number($row['quantity'], 2)</td>
<td align="center">{{$row['batch_sn']}}</td>
<td align="center">{{$row['posname']}}</td>
</tr>
@endforeach
<tfoot>
<td align="center">合计</td>
<td></td>
<td></td>
<td></td>
<td tdata="Sum" format="#,##0.00" align="right"><font id="id01">###</font></td>
<td></td>
<td></td>
</tfoot>
</table>
</div>
<div id="div3">
<table width="100%" style="LINE-HEIGHT:30px;font-size:11pt;" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tr>
<td width="40%">制单人:{{auth()->user()->name}}</td>
<td width="40%">交货人:</td>
<td width="20%" align="right"><font tdata="PageNO">##</font>页,<font tdata="PageCount">##</font></span>页</td>
</tr>
</table>
</div>
<script language="javascript" src="{{$asset_url}}/vendor/LodopFuncs.js"></script>
<script language="javascript" type="text/javascript">
var LODOP;
function PrintMytable() {
LODOP = getLodop();
LODOP.PRINT_INIT("{{$form['template']['name']}}");
LODOP.SET_PRINT_PAGESIZE(0, 2100, 930, "CreateCustomPage");
var strStyle="<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>"
LODOP.ADD_PRINT_TABLE(75, "6%", "88%", 475, strStyle + document.getElementById("div2").innerHTML);
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
LODOP.ADD_PRINT_HTM(0, "6%", "88%", 109, document.getElementById("div1").innerHTML);
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
LODOP.ADD_PRINT_HTM(555, "6%","88%", 54, document.getElementById("div3").innerHTML);
LODOP.SET_PRINT_STYLEA(0,"ItemType", 1);
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", 1);
LODOP.PREVIEW();
};
</script>
@@ -0,0 +1,109 @@
<style>
.modal-body { overflow:hidden; }
</style>
<div class="wrapper-sm" style="padding-bottom:0;">
<div id="dialog-promotion-toolbar">
<form id="dialog-promotion-search-form" name="dialog_promotion_search_form" class="search-inline-form form-inline" method="get">
@include('searchForm3')
</form>
</div>
</div>
<div class="m-t-sm">
<div id="ref_promotion" class="ag-theme-balham" style="width:100%;height:140px;"></div>
</div>
<div class="m-t-sm">
<div id="ref_promotion_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
</div>
<script>
var $ref_promotion = null;
var $ref_promotion_data = null;
var params = JSON.parse('{{json_encode($query)}}');
(function($) {
params['master'] = 1;
var mGridDiv = document.querySelector("#ref_promotion");
var mGrid = new agGridOptions();
mGrid.remoteDataUrl = '{{url()}}';
mGrid.remoteParams = params;
//mGrid.rowMultiSelectWithClick = true;
mGrid.rowSelection = 'multiple';
mGrid.autoColumnsToFit = false;
mGrid.defaultColDef.suppressMenu = true;
mGrid.defaultColDef.sortable = false;
mGrid.columnDefs = [
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
{field:'customer_name', headerName: '客户名称', width: 160},
{field:'warehouse_contact', headerName: '收货人', width: 160},
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
{field:'warehouse_address', headerName: '收货地址', width: 260},
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
];
mGrid.onSelectionChanged = function() {
var rows = mGrid.api.getSelectedRows();
var ids = [];
for (let i = 0; i < rows.length; i++) {
ids.push(rows[i].id);
}
params.promotion_ids = ids;
sGrid.remoteData(params);
};
new agGrid.Grid(mGridDiv, mGrid);
// 读取数据
mGrid.remoteData();
$ref_promotion = mGrid;
params['master'] = 0;
var sGridDiv = document.querySelector("#ref_promotion_data");
var sGrid = new agGridOptions();
sGrid.remoteDataUrl = '{{url()}}';
sGrid.remoteParams = params;
//sGrid.rowMultiSelectWithClick = true;
sGrid.rowSelection = 'multiple';
sGrid.autoColumnsToFit = false;
sGrid.defaultColDef.suppressMenu = true;
sGrid.defaultColDef.sortable = false;
sGrid.columnDefs = [
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
{field: 'product_name', headerName: '商品名称', minWidth: 180},
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
];
new agGrid.Grid(sGridDiv, sGrid);
// 读取数据
sGrid.remoteData();
$ref_promotion_data = sGrid;
var data = JSON.parse('{{json_encode($search["forms"])}}');
var search = $('#dialog-promotion-search-form').searchForm({
data: data,
init:function(e) {}
});
search.find('#search-submit').on('click', function() {
var query = search.serializeArray();
$.map(query, function(row) {
params[row.name] = row.value;
});
params['master'] = 1;
mGrid.remoteData(params);
params['master'] = 0;
sGrid.remoteData(params);
return false;
});
})(jQuery);
</script>