在采购单据,增加仓库添加功能
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
$.get("../../pages/template/base.html", function(tem) {
|
$.get("../../pages/template/base.html?999", function(tem) {
|
||||||
if(tem) {
|
if(tem) {
|
||||||
var template = Handlebars.compile(tem);
|
var template = Handlebars.compile(tem);
|
||||||
/**
|
/**
|
||||||
* 加载供应商、客户模块
|
* 加载供应商、客户模块
|
||||||
*/
|
*/
|
||||||
$("body").append(template({
|
$("#supplier").html(template({
|
||||||
supplierSelect: true
|
supplierSelect: true
|
||||||
}));
|
}));
|
||||||
$('#supplierDlg').dialog({
|
$('#supplierDlg').dialog({
|
||||||
@@ -24,12 +24,38 @@ $.get("../../pages/template/base.html", function(tem) {
|
|||||||
min:0,
|
min:0,
|
||||||
precision:2
|
precision:2
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#saveSupplier").linkbutton({
|
$("#saveSupplier").linkbutton({
|
||||||
iconCls: 'icon-ok'
|
iconCls: 'icon-ok'
|
||||||
});
|
});
|
||||||
$("#cancelSupplier").linkbutton({
|
$("#cancelSupplier").linkbutton({
|
||||||
iconCls: 'icon-cancel'
|
iconCls: 'icon-cancel'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载仓库
|
||||||
|
*/
|
||||||
|
$("#depot").html(template({
|
||||||
|
depotSelect: true
|
||||||
|
}));
|
||||||
|
$('#depotDlg').dialog({
|
||||||
|
closed: true,
|
||||||
|
modal: true,
|
||||||
|
collapsible: false,
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
$("#depotDlg #name,#depotDlg #address").validatebox({
|
||||||
|
required: true,
|
||||||
|
validType: 'length[2,30]'
|
||||||
|
});
|
||||||
|
$("#depotDlg #warehousing,#depotDlg #truckage").numberbox({
|
||||||
|
min:0,
|
||||||
|
precision:2
|
||||||
|
});
|
||||||
|
$("#saveDepot").linkbutton({
|
||||||
|
iconCls: 'icon-ok'
|
||||||
|
});
|
||||||
|
$("#cancelDepot").linkbutton({
|
||||||
|
iconCls: 'icon-cancel'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -216,9 +216,7 @@
|
|||||||
}
|
}
|
||||||
//初始化页面选项卡
|
//初始化页面选项卡
|
||||||
function initSelectInfo_depot(){
|
function initSelectInfo_depot(){
|
||||||
var options = "";
|
|
||||||
if(depotList !=null) {
|
if(depotList !=null) {
|
||||||
options = "";
|
|
||||||
for(var i = 0 ;i < depotList.length;i++) {
|
for(var i = 0 ;i < depotList.length;i++) {
|
||||||
var depot = depotList[i];
|
var depot = depotList[i];
|
||||||
var config = getSystemConfig();
|
var config = getSystemConfig();
|
||||||
@@ -228,7 +226,6 @@
|
|||||||
if(depot.isDefault){
|
if(depot.isDefault){
|
||||||
defDepotId = depot.id;
|
defDepotId = depot.id;
|
||||||
}
|
}
|
||||||
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
|
|
||||||
depotString = depotString + depot.id + ",";
|
depotString = depotString + depot.id + ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,9 +240,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
depotString = depotString.substring(1, depotString.length-1);
|
depotString = depotString.substring(1, depotString.length-1);
|
||||||
$("#ProjectId").empty().append(options);
|
|
||||||
$("#AllocationProjectId").empty().append(options);
|
|
||||||
$("#searchProjectId").empty().append('<option value="">全部</option>').append(options);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3012,7 +3006,78 @@
|
|||||||
}
|
}
|
||||||
//新增仓库
|
//新增仓库
|
||||||
function appendDepot() {
|
function appendDepot() {
|
||||||
alert("新增仓库");
|
$('#depotDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加仓库信息');
|
||||||
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
|
$('#depotFM').form('clear');
|
||||||
|
$("#depotFM #name").focus();
|
||||||
|
$("#selectType").val("principal");
|
||||||
|
oldDepot = "";
|
||||||
|
depotID = 0;
|
||||||
|
url = '/depot/add';
|
||||||
|
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
|
function checkDepotName() {
|
||||||
|
var name = $.trim($("#name").val());
|
||||||
|
//表示是否存在 true == 存在 false = 不存在
|
||||||
|
var flag = false;
|
||||||
|
//开始ajax名称检验,不能重名
|
||||||
|
if (name.length > 0 && (oldDepot.length == 0 || name != oldDepot)) {
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
url: "/depot/checkIsNameExist",
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
data: ({
|
||||||
|
id: depotID,
|
||||||
|
name: name
|
||||||
|
}),
|
||||||
|
success: function (res) {
|
||||||
|
if(res && res.code === 200) {
|
||||||
|
if(res.data && res.data.status) {
|
||||||
|
flag = res.data.status;
|
||||||
|
if (flag) {
|
||||||
|
$.messager.alert('提示', '仓库名称已经存在', 'info');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//此处添加错误处理
|
||||||
|
error: function () {
|
||||||
|
$.messager.alert('提示', '检查仓库名称是否存在异常,请稍后再试!', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
$("#saveDepot").off("click").on("click", function () {
|
||||||
|
var infoObj = $("#depotFM").serializeObject();
|
||||||
|
infoObj.type = 0;
|
||||||
|
if (checkDepotName()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: "post",
|
||||||
|
dataType: "json",
|
||||||
|
data: ({
|
||||||
|
info: JSON.stringify(infoObj)
|
||||||
|
}),
|
||||||
|
success: function(res) {
|
||||||
|
if(res && res.code === 200) {
|
||||||
|
$('#depotDlg').dialog('close');
|
||||||
|
//加载完以后重新初始化
|
||||||
|
var opts = $("#tableData").datagrid('options');
|
||||||
|
showDepotDetails(opts.pageNumber, opts.pageSize);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//此处添加错误处理
|
||||||
|
error: function () {
|
||||||
|
$.messager.alert('提示', '保存仓库信息异常,请稍后再试!', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
//新增商品
|
//新增商品
|
||||||
function appendMaterial() {
|
function appendMaterial() {
|
||||||
|
|||||||
@@ -282,5 +282,7 @@
|
|||||||
<a href="javascript:void(0)" id="saveOtherMoneyDlg" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
<a href="javascript:void(0)" id="saveOtherMoneyDlg" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||||
<a href="javascript:void(0)" id="cancelOtherMoneyDlg" class="easyui-linkbutton" iconCls="icon-cancel">取消</a>
|
<a href="javascript:void(0)" id="cancelOtherMoneyDlg" class="easyui-linkbutton" iconCls="icon-cancel">取消</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="supplier"></div>
|
||||||
|
<div id="depot"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -92,4 +92,53 @@
|
|||||||
<a href="javascript:void(0)" id="saveSupplier">保存</a>
|
<a href="javascript:void(0)" id="saveSupplier">保存</a>
|
||||||
<a href="javascript:void(0)" id="cancelSupplier" onclick="javascript:$('#supplierDlg').dialog('close')">取消</a>
|
<a href="javascript:void(0)" id="cancelSupplier" onclick="javascript:$('#supplierDlg').dialog('close')">取消</a>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if depotSelect}}
|
||||||
|
<div id="depotDlg" style="width:380px;padding:10px 20px" buttons="#dlg-buttons">
|
||||||
|
<form id="depotFM">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>仓库名称</td>
|
||||||
|
<td style="padding:5px">
|
||||||
|
<input name="name" id="name" style="width: 230px;height: 20px"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>仓库地址</td>
|
||||||
|
<td style="padding:5px">
|
||||||
|
<input name="address" id="address" style="width: 230px;height: 20px"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>仓储费</td>
|
||||||
|
<td style="padding:5px">
|
||||||
|
<input name="warehousing" id="warehousing" style="width: 175px;height: 20px"/> 元/天/KG
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>搬运费</td>
|
||||||
|
<td style="padding:5px">
|
||||||
|
<input name="truckage" id="truckage" placeholder="如上下搬运20元,则填写10元" style="width: 215px;height: 20px"/> 元
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>排序</td>
|
||||||
|
<td style="padding:5px">
|
||||||
|
<input name="sort" id="sort" style="width: 230px;height: 20px"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>描述</td>
|
||||||
|
<td style="padding:5px">
|
||||||
|
<textarea name="remark" id="remark" rows="2" cols="2" style="width: 230px;"></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div id="dlg-buttons">
|
||||||
|
<a href="javascript:void(0)" id="saveDepot">保存</a>
|
||||||
|
<a href="javascript:void(0)" id="cancelDepot" onclick="javascript:$('#depotDlg').dialog('close')">取消</a>
|
||||||
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
Reference in New Issue
Block a user