创建版本
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<a data-toggle="dialog-view" data-url="product/product/dialog" data-form_id="product_formula" data-id="product_id" data-name="product_name" data-title="产品" data-is_grid="1" data-multi="1" class="btn btn-sm btn-default"><i class="fa fa-plus-circle"></i> 添加</a>
|
||||
<a class="btn btn-default btn-sm" id="product_formula_delete"><i class="fa fa-times"></i> 删除</a>
|
||||
<a class="btn btn-default btn-sm" id="product_formula-form-submit"><i class="fa fa-check"></i> 保存</a>
|
||||
<a data-toggle="layer-frame-close" class="btn btn-default btn-sm"><i class="fa fa-sign-out"></i> 退出</a>
|
||||
</div>
|
||||
<form class="product_formula_form" method="post" action="{{url('configSave')}}" id="product_formula" name="product_formula">
|
||||
<div id="grid_product_formula" style="width:100%;" class="ag-theme-balham"></div>
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.form-panel-header {
|
||||
box-shadow: none;
|
||||
}
|
||||
.product_formula_form {
|
||||
margin-top: 50px;
|
||||
}
|
||||
.content-body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
(function($) {
|
||||
var id = '{{$id}}';
|
||||
var options = {
|
||||
title:'',
|
||||
master: 'product_formula',
|
||||
table: 'product_formula',
|
||||
heightTop: 0
|
||||
};
|
||||
options.columns = [
|
||||
{field:"id",hide:true},
|
||||
{hide:true,field:"product_id"},
|
||||
{hide:true,field:"material_id"},
|
||||
{cellClass:"text-center",headerName:"存货编码",width:120,field:"product_code"},
|
||||
{suppressNavigable: false, headerName:"产品名称",editable:true,width:220,cellEditorParams:{form_type:"dialog",title:"产品",type:"product",field:"product_name",url:"product/product/dialog",query:{form_id:"product_formula",id:"product_id",name:"product_name"}},cellEditor:"dialogCellEditor",field:"product_name"},
|
||||
{cellClass:"text-center",headerName:"规格型号",width:120,field:"product_spec"},
|
||||
{cellClass:"text-center",headerName:"计量单位",width:80,field:"product_unit"},
|
||||
{suppressNavigable: false, cellClass:"text-right",headerName:"用量",editable:true,width:80,field:"quantity"},
|
||||
{suppressNavigable: false, cellClass:"text-right",headerName:"出品率",editable:true,width:80,field:"ratio"},
|
||||
];
|
||||
options.links = {
|
||||
product_id: {
|
||||
product_id:'id',
|
||||
product_code:"code",
|
||||
product_name:"name",
|
||||
product_spec:"spec",
|
||||
product_unit:"unit_id_name",
|
||||
}
|
||||
};
|
||||
var grid = gridForm("product_formula", options);
|
||||
grid.dataKey = 'product_id';
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = {id: id};
|
||||
|
||||
gdoo.event.set('product_formula.product_id', {
|
||||
query(query) {
|
||||
},
|
||||
onSelect() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 读取数据
|
||||
grid.remoteData();
|
||||
|
||||
$('#product_formula_delete').on('click', function() {
|
||||
var rows = grid.api.getSelectedRows();
|
||||
if (rows.length > 0) {
|
||||
grid.api.deleteRow({id: rows[0].id});
|
||||
}
|
||||
});
|
||||
|
||||
ajaxSubmit('product_formula', function(res) {
|
||||
if (res.status) {
|
||||
toastrSuccess(res.data);
|
||||
location.reload();
|
||||
} else {
|
||||
toastrError(res.data);
|
||||
}
|
||||
});
|
||||
|
||||
formGridList['product_formula'] = [grid];
|
||||
gdoo.forms[product_formula] = grid;
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,96 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
|
||||
@if($form['action'] == 'show')
|
||||
@else
|
||||
<a href="javascript:planDialog();" class="btn btn-sm btn-default">
|
||||
参照营销计划
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</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 grid = null;
|
||||
var table = '{{$form["table"]}}';
|
||||
var master_id = '{{$form["row"]["id"]}}';
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.produce_plan_data', {
|
||||
init() {
|
||||
grid = this;
|
||||
grid.enableCellTextSelection = false;
|
||||
grid.enableRangeSelection = true;
|
||||
grid.suppressContextMenu = false;
|
||||
grid.numberEmptyDefaultValue = true;
|
||||
grid.defaultColDef.cellStyle = function(params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
var field = params.colDef.field;
|
||||
var value = params.value || 0;
|
||||
var style = {};
|
||||
// 'font-weight':'bold',
|
||||
if (field == "xqzc_num" && value > 0) {
|
||||
style = {'color':'red'};
|
||||
}
|
||||
if (field == "dkzc_num" && value > 0) {
|
||||
style = {'color':'red'};
|
||||
}
|
||||
if (field == "yxjh_num") {
|
||||
style = {'color':'blue'};
|
||||
}
|
||||
if (field == "yxjh_num1") {
|
||||
style = {'color':'blue'};
|
||||
}
|
||||
if (field == "yxjh_num2") {
|
||||
style = {'color':'blue'};
|
||||
}
|
||||
return style;
|
||||
};
|
||||
},
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
onSaveAfter(res) {
|
||||
if (master_id > 0) {
|
||||
delete res.url;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
});
|
||||
|
||||
var planDialog = function () {
|
||||
var plan_date = $('#produce_plan_date').val().trim();
|
||||
if (plan_date == '') {
|
||||
toastrError('请选选择计划日期。');
|
||||
return;
|
||||
}
|
||||
var loading = layer.msg('数据提取中...', {
|
||||
icon: 16, shade: 0.1, time: 1000 * 120
|
||||
});
|
||||
$.get('{{url("produce/plan/orderPlan")}}', {plan_date: plan_date}, function(res) {
|
||||
layer.close(loading);
|
||||
if (res.status) {
|
||||
grid.api.setRowData([]);
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
var row = res.data[i];
|
||||
grid.api.memoryStore.create(row);
|
||||
}
|
||||
grid.generatePinnedBottomData();
|
||||
} else {
|
||||
toastrError(res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,61 @@
|
||||
{{$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.rowSelection = 'single';
|
||||
options.autoColumnsToFit = false;
|
||||
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,129 @@
|
||||
<div class="panel no-border" id="material_plan-controller">
|
||||
|
||||
<div class="wrapper-sm">
|
||||
@include('searchForm7')
|
||||
<a class="btn btn-sm btn-default" data-toggle="material_plan" data-action="filter"><i class="fa fa-search"></i> 筛选</a>
|
||||
<a class="btn btn-sm btn-default" data-toggle="material_plan" data-action="export"><i class="fa fa-share"></i> 导出</a>
|
||||
</div>
|
||||
|
||||
<div class='list-jqgrid'>
|
||||
<div id="material_plan-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.ag-row {
|
||||
display:table;
|
||||
}
|
||||
.rowspan {
|
||||
background-color: #fff;
|
||||
top: -1px;
|
||||
border-top: 1px solid #d9dcde !important;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.rowspan_end {
|
||||
border-bottom: 1px solid #d9dcde !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
var searchOpen = false;
|
||||
var table = 'material_plan';
|
||||
var search = JSON.parse('{{json_encode($search)}}');
|
||||
var cols = [
|
||||
{field: "sn", cellClass: "text-center", suppressSizeToFit: true, headerName: "", type: 'sn', width: 40},
|
||||
{field: "product_name", headerName: "成品品种", sortable: false, suppressMenu: true, width: 140},
|
||||
{field: "product_spec", headerName: "规格型号", sortable: false, suppressMenu: true, cellClass: "text-center", width: 120},
|
||||
{field: "product_unit", headerName: "计量单位", sortable: false, suppressMenu: true, cellClass: "text-center", width: 60},
|
||||
{field: "plan_num", headerName: "计划数量", sortable: false, suppressMenu: true, cellClass: "text-right", width: 80},
|
||||
// {field: "quantity", headerName: "生产数量", sortable: false, suppressMenu: true, width: 140},
|
||||
{field: "remark", headerName: "备注", sortable: false, suppressMenu: true, width: 100},
|
||||
{field: "date", headerName: "计划日期", sortable: false, suppressMenu: true, cellClass: "text-center", width: 100},
|
||||
];
|
||||
|
||||
var grid = new agGridOptions();
|
||||
grid.suppressRowTransform = true;
|
||||
var gridDiv = document.querySelector("#material_plan-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = search.query;
|
||||
grid.columnDefs = cols;
|
||||
grid.rowSelection = 'single';
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
|
||||
// 读取数据
|
||||
grid.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);
|
||||
}
|
||||
});
|
||||
|
||||
var data = search.forms;
|
||||
var search = $("#material_plan-search-form-advanced");
|
||||
search.searchForm({
|
||||
data: data,
|
||||
advanced: 1,
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var params = search.serializeArray();
|
||||
$.map(params, function(row) {
|
||||
data[row.name] = row.value;
|
||||
});
|
||||
grid.remoteData(data);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#material_plan-controller').on('click', '[data-toggle="material_plan"]', function() {
|
||||
var data = $(this).data();
|
||||
if (data.action == 'filter') {
|
||||
searchBox();
|
||||
}
|
||||
if (data.action == 'export') {
|
||||
LocalExport(grid, '生产计划单导出');
|
||||
}
|
||||
});
|
||||
|
||||
var searchBox = function() {
|
||||
$(search).dialog({
|
||||
title: '筛选条件',
|
||||
modalClass: 'no-padder',
|
||||
buttons: [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},{
|
||||
text: "确定",
|
||||
'class': "btn-info",
|
||||
click: function() {
|
||||
var data = search.serializeArray();
|
||||
var params = {};
|
||||
search.queryType = 'advanced';
|
||||
$.map(data, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
params['page'] = 1;
|
||||
grid.remoteData(params);
|
||||
$(this).dialog("close");
|
||||
return false;
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
if (searchOpen == false) {
|
||||
searchBox();
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user