提交 29c240aa 编写于 作者: Skyeye云's avatar Skyeye云

动态表单加载新增表单id参数,新增必填标识

上级 35758bb2
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</head> </head>
<body> <body>
<div style="margin: 0 auto; padding: 20px;"> <div style="margin: 0 auto; padding: 20px;">
<form class="layui-form" action="" id="showForm"> <form class="layui-form" action="" id="showForm" autocomplete="off">
<div class="layui-form-item layui-col-xs12"> <div class="layui-form-item layui-col-xs12">
<div style="width: 100%; float: left;"> <div style="width: 100%; float: left;">
<ul id="treeDemo" class="ztree fsTree" method="get" isRoot="1" treeIdKey="id" inputs="parentId" treePIdKey="pId" clickCallbackInputs="parentId:$id" treeName="name"></ul> <ul id="treeDemo" class="ztree fsTree" method="get" isRoot="1" treeIdKey="id" inputs="parentId" treePIdKey="pId" clickCallbackInputs="parentId:$id" treeName="name"></ul>
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
</div> </div>
<div class="layui-form-item layui-col-xs12"> <div class="layui-form-item layui-col-xs12">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button> <button class="winui-btn" id="cancle" type="button"><language showName="com.skyeye.cancel"></language></button>
<button class="winui-btn" lay-submit lay-filter="formChooseBean"><language showName="com.skyeye.save"></language></button> <button class="winui-btn" lay-submit lay-filter="formChooseBean">选择</button>
</div> </div>
</div> </div>
</form> </form>
......
...@@ -64,7 +64,7 @@ layui.config({ ...@@ -64,7 +64,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsOthers"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsOthers"]["code"], null);
matchingLanguage(); matchingLanguage();
//商品规格加载变化事件 //商品规格加载变化事件
......
...@@ -64,7 +64,7 @@ layui.config({ ...@@ -64,7 +64,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsOthers"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsOthers"]["code"], null);
matchingLanguage(); matchingLanguage();
//商品规格加载变化事件 //商品规格加载变化事件
......
...@@ -68,7 +68,7 @@ layui.config({ ...@@ -68,7 +68,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["purchaseOrder"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["purchaseOrder"]["code"], null);
matchingLanguage(); matchingLanguage();
// 商品规格加载变化事件 // 商品规格加载变化事件
......
...@@ -48,7 +48,7 @@ layui.config({ ...@@ -48,7 +48,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsPurchase"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsPurchase"]["code"], null);
// 初始化账户 // 初始化账户
systemCommonUtil.getSysAccountListByType(function(json){ systemCommonUtil.getSysAccountListByType(function(json){
......
...@@ -73,7 +73,7 @@ layui.config({ ...@@ -73,7 +73,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsPurchase"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsPurchase"]["code"], null);
matchingLanguage(); matchingLanguage();
//商品规格加载变化事件 //商品规格加载变化事件
......
...@@ -75,7 +75,7 @@ layui.config({ ...@@ -75,7 +75,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsPurchaseReturns"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsPurchaseReturns"]["code"], null);
matchingLanguage(); matchingLanguage();
//商品规格加载变化事件 //商品规格加载变化事件
......
...@@ -77,7 +77,7 @@ layui.config({ ...@@ -77,7 +77,7 @@ layui.config({
} }
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsRetail"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsRetail"]["code"], null);
matchingLanguage(); matchingLanguage();
//商品规格加载变化事件 //商品规格加载变化事件
......
...@@ -76,7 +76,7 @@ layui.config({ ...@@ -76,7 +76,7 @@ layui.config({
} }
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsRetailReturns"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsRetailReturns"]["code"], null);
matchingLanguage(); matchingLanguage();
//商品规格加载变化事件 //商品规格加载变化事件
......
...@@ -74,7 +74,7 @@ layui.config({ ...@@ -74,7 +74,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outchaseOrder"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outchaseOrder"]["code"], null);
matchingLanguage(); matchingLanguage();
//商品规格加载变化事件 //商品规格加载变化事件
......
...@@ -75,7 +75,7 @@ layui.config({ ...@@ -75,7 +75,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsSalesOutlet"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsSalesOutlet"]["code"], null);
//初始化回显数据 //初始化回显数据
function initDataShow(){ function initDataShow(){
......
...@@ -80,7 +80,7 @@ layui.config({ ...@@ -80,7 +80,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsSalesOutlet"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["outIsSalesOutlet"]["code"], null);
matchingLanguage(); matchingLanguage();
//商品规格加载变化事件 //商品规格加载变化事件
......
...@@ -80,7 +80,7 @@ layui.config({ ...@@ -80,7 +80,7 @@ layui.config({
}); });
// 加载动态表单 // 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsSalesReturns"]["code"]); dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsSalesReturns"]["code"], null);
matchingLanguage(); matchingLanguage();
// 商品规格加载变化事件 // 商品规格加载变化事件
......
// 兼容动态表单
var layedit, form;
layui.config({ layui.config({
base: basePath, base: basePath,
version: skyeyeVersion version: skyeyeVersion
}).extend({ }).extend({
window: 'js/winui.window' window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'laydate'], function(exports) { }).define(['window', 'jquery', 'winui', 'laydate', 'tagEditor'].concat(dsFormUtil.mastHaveImport), function(exports) {
winui.renderColor(); winui.renderColor();
layui.use(['form', 'tagEditor'], function(form) { var index = parent.layer.getFrameIndex(window.name);
var index = parent.layer.getFrameIndex(window.name); var $ = layui.$,
var $ = layui.$, laydate = layui.laydate;
laydate = layui.laydate;
var selOption = getFileContent('tpl/template/select-option.tpl'); layedit = layui.layedit,
var handsPersonList = new Array();//经手人员 form = layui.form;
//单据时间 var selOption = getFileContent('tpl/template/select-option.tpl');
laydate.render({ var handsPersonList = new Array();//经手人员
elem: '#operTime',
type: 'datetime',
value: getFormatDate(),
trigger: 'click'
});
// 初始化账户 //单据时间
systemCommonUtil.getSysAccountListByType(function(json){ laydate.render({
// 加载账户数据 elem: '#operTime',
$("#accountId").html(getDataUseHandlebars(selOption, json)); type: 'datetime',
}); value: getFormatDate(),
trigger: 'click'
});
// 初始化列表项选择 // 初始化账户
voucherUtil.init('showVoucherUtilBox'); systemCommonUtil.getSysAccountListByType(function(json){
// 加载账户数据
$("#accountId").html(getDataUseHandlebars(selOption, json));
});
matchingLanguage(); // 初始化列表项选择
form.render(); voucherUtil.init('showVoucherUtilBox');
form.on('submit(formAddBean)', function(data) {
if(winui.verifyForm(data.elem)) { matchingLanguage();
var result = voucherUtil.getData(); form.render();
console.log(result); form.on('submit(formAddBean)', function(data) {
if(result.length < 2){ if(winui.verifyForm(data.elem)) {
return false; var result = voucherUtil.getData();
} console.log(result);
var params = { if(result.length < 2){
organId: sysCustomerUtil.customerMation.id, return false;
handsPersonId: handsPersonList[0].id,
operTime: $("#operTime").val(),
accountId: $("#accountId").val(),
remark: $("#remark").val(),
changeAmount: $("#changeAmount").val(),
initemStr: JSON.stringify(result)
};
// AjaxPostUtil.request({url: reqBasePath + "income002", params: params, type: 'json', method: "POST", callback: function(json) {
// if(json.returnCode == 0) {
// parent.layer.close(index);
// parent.refreshCode = '0';
// } else {
// winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
// }
// }});
} }
return false; var params = {
}); organId: sysCustomerUtil.customerMation.id,
handsPersonId: handsPersonList[0].id,
operTime: $("#operTime").val(),
accountId: $("#accountId").val(),
remark: $("#remark").val(),
changeAmount: $("#changeAmount").val(),
initemStr: JSON.stringify(result)
};
AjaxPostUtil.request({url: reqBasePath + "income002", params: params, type: 'json', method: "POST", callback: function(json) {
if(json.returnCode == 0) {
dsFormUtil.savePageData("dsFormShow", json.bean.id);
parent.layer.close(index);
parent.refreshCode = '0';
} else {
winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
}
}});
}
return false;
});
$('#handsPersonId').tagEditor({ $('#handsPersonId').tagEditor({
initialTags: [], initialTags: [],
placeholder: '请选择经手人员', placeholder: '请选择经手人员',
editorTag: false, editorTag: false,
beforeTagDelete: function(field, editor, tags, val) { beforeTagDelete: function(field, editor, tags, val) {
var inArray = -1; var inArray = -1;
$.each(handsPersonList, function(i, item) { $.each(handsPersonList, function(i, item) {
if(val === item.name) { if(val === item.name) {
inArray = i; inArray = i;
return false; return false;
}
});
if(inArray != -1) { //如果该元素在集合中存在
handsPersonList.splice(inArray, 1);
}
}
});
// 人员选择
$("body").on("click", "#toHandsPersonSelPeople", function(e){
systemCommonUtil.userReturnList = [].concat(handsPersonList);
systemCommonUtil.chooseOrNotMy = "2"; // 人员列表中是否包含自己--1.包含;其他参数不包含
systemCommonUtil.chooseOrNotEmail = "2"; // 人员列表中是否必须绑定邮箱--1.必须;其他参数没必要
systemCommonUtil.checkType = "2"; // 人员选择类型,1.多选;其他。单选
systemCommonUtil.openSysUserStaffChoosePage(function (staffChooseList){
// 移除所有tag
var tags = $('#handsPersonId').tagEditor('getTags')[0].tags;
for (i = 0; i < tags.length; i++) {
$('#handsPersonId').tagEditor('removeTag', tags[i]);
} }
handsPersonList = [].concat(staffChooseList);
// 添加新的tag
$.each(handsPersonList, function(i, item){
$('#handsPersonId').tagEditor('addTag', item.name);
});
}); });
}); if(inArray != -1) { //如果该元素在集合中存在
handsPersonList.splice(inArray, 1);
}
}
});
// 新增行 // 人员选择
$("body").on("click", "#addRow", function() { $("body").on("click", "#toHandsPersonSelPeople", function(e){
voucherUtil.addItem(); systemCommonUtil.userReturnList = [].concat(handsPersonList);
systemCommonUtil.chooseOrNotMy = "2"; // 人员列表中是否包含自己--1.包含;其他参数不包含
systemCommonUtil.chooseOrNotEmail = "2"; // 人员列表中是否必须绑定邮箱--1.必须;其他参数没必要
systemCommonUtil.checkType = "2"; // 人员选择类型,1.多选;其他。单选
systemCommonUtil.openSysUserStaffChoosePage(function (staffChooseList){
// 移除所有tag
var tags = $('#handsPersonId').tagEditor('getTags')[0].tags;
for (i = 0; i < tags.length; i++) {
$('#handsPersonId').tagEditor('removeTag', tags[i]);
}
handsPersonList = [].concat(staffChooseList);
// 添加新的tag
$.each(handsPersonList, function(i, item){
$('#handsPersonId').tagEditor('addTag', item.name);
});
}); });
});
// 客户选择 // 新增行
$("body").on("click", "#customMationSel", function(e){ $("body").on("click", "#addRow", function() {
sysCustomerUtil.openSysCustomerChoosePage(function (customerMation){ voucherUtil.addItem();
$("#customName").val(customerMation.customName); });
});
});
// 选择账套 // 客户选择
$("body").on("click", "#chooseSetOfBooksBtn", function(e){ $("body").on("click", "#customMationSel", function(e){
var _this = $(this); sysCustomerUtil.openSysCustomerChoosePage(function (customerMation){
sysIfsUtil.openIfsSetOfBooksListChoosePage(function (ifsSetOfBooksMation){ $("#customName").val(customerMation.customName);
_this.parent().find("input").val(ifsSetOfBooksMation.name);
});
}); });
});
// 选择单据类型 // 选择账套
$("body").on("click", "#chooseOrderTypeBtn", function(e){ $("body").on("click", "#chooseSetOfBooksBtn", function(e){
var _this = $(this); var _this = $(this);
dsFormUtil.openDsFormObjectRelationChooseByFirstTypeCodeChoosePage("IFS", function (dsFormObjectRelationChoose){ sysIfsUtil.openIfsSetOfBooksListChoosePage(function (ifsSetOfBooksMation){
_this.parent().find("input").val(dsFormObjectRelationChoose.name); _this.parent().find("input").val(ifsSetOfBooksMation.name);
});
}); });
});
$("body").on("click", "#cancle", function() { // 选择单据类型
parent.layer.close(index); $("body").on("click", "#chooseOrderTypeBtn", function(e){
var _this = $(this);
dsFormUtil.openDsFormObjectRelationChooseByFirstTypeCodeChoosePage("IFS", function (dsFormObjectRelationChoose){
_this.parent().find("input").val(dsFormObjectRelationChoose.name);
$("#dsFormShow").html("");
// 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", null, dsFormObjectRelationChoose.id);
}); });
}); });
$("body").on("click", "#cancle", function() {
parent.layer.close(index);
});
}); });
\ No newline at end of file
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
<body> <body>
<div style="margin: 0 auto; padding: 20px;"> <div style="margin: 0 auto; padding: 20px;">
<form class="layui-form" action="" id="showForm"> <form class="layui-form" action="" id="showForm">
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">基本信息</span><hr>
</div>
<div class="layui-form-item layui-col-xs6"> <div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">往来单位<i class="red">*</i></label> <label class="layui-form-label">往来单位<i class="red">*</i></label>
<div class="layui-input-block"> <div class="layui-input-block">
...@@ -69,6 +72,9 @@ ...@@ -69,6 +72,9 @@
<textarea id="remark" name="remark" placeholder="请输入备注" class="layui-textarea" style="height: 100px;" maxlength="200"></textarea> <textarea id="remark" name="remark" placeholder="请输入备注" class="layui-textarea" style="height: 100px;" maxlength="200"></textarea>
</div> </div>
</div> </div>
<div id="dsFormShow">
</div>
<div class="layui-form-item layui-col-xs12"> <div class="layui-form-item layui-col-xs12">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button> <button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button>
......
...@@ -111,8 +111,12 @@ var dsFormUtil = { ...@@ -111,8 +111,12 @@ var dsFormUtil = {
* @param showBoxId要追加的boxid后面 * @param showBoxId要追加的boxid后面
* @param code 动态表单-----业务逻辑表单关联表中的code * @param code 动态表单-----业务逻辑表单关联表中的code
*/ */
loadPageByCode: function(showBoxId, code){ loadPageByCode: function(showBoxId, code, dsFormObjectRelationId){
AjaxPostUtil.request({url: reqBasePath + "dsFormObjectRelation006", params: {dsFormObjectRelationCode: code}, method: "GET", type: 'json', callback: function(json) { var params = {
dsFormObjectRelationCode: isNull(code) ? "" : code,
dsFormObjectRelationId: isNull(dsFormObjectRelationId) ? "" : dsFormObjectRelationId
};
AjaxPostUtil.request({url: reqBasePath + "dsFormObjectRelation006", params: params, method: "GET", type: 'json', callback: function(json) {
if(json.returnCode == 0) { if(json.returnCode == 0) {
dsFormUtil.loadDsFormItem(showBoxId, json); dsFormUtil.loadDsFormItem(showBoxId, json);
} else { } else {
...@@ -156,6 +160,9 @@ var dsFormUtil = { ...@@ -156,6 +160,9 @@ var dsFormUtil = {
$("#" + item.id).val(item.value); //给能通过id赋值的控件赋值 $("#" + item.id).val(item.value); //给能通过id赋值的控件赋值
var _this = $("#" + customBoxId + " .layui-form-item").eq(i);//当前控件 var _this = $("#" + customBoxId + " .layui-form-item").eq(i);//当前控件
if(!isNull(item.require) && item.require.indexOf("required") >= 0){
_this.find(".layui-form-label").append('<i class="red">*</i>');
}
_this.attr("controId", item.id); _this.attr("controId", item.id);
var vid = _this.attr("controlType");//控件类型 var vid = _this.attr("controlType");//控件类型
if(vid === 'color'){//类型为颜色选择器 if(vid === 'color'){//类型为颜色选择器
...@@ -363,7 +370,7 @@ var dsFormUtil = { ...@@ -363,7 +370,7 @@ var dsFormUtil = {
_openNewWindows({ _openNewWindows({
url: "../../tpl/dsFormObjectRelation/dsFormObjectRelationChooseByFirstTypeCode.html?firstTypeCode=" + firstTypeCode, url: "../../tpl/dsFormObjectRelation/dsFormObjectRelationChooseByFirstTypeCode.html?firstTypeCode=" + firstTypeCode,
title: "单据类型", title: "单据类型",
pageId: "dsFormObjectRelationChooseByFirstTypeCode", pageId: "dsFormObjectRelationChooseByFirstTypeCodePage",
area: ['480px', '500px'], area: ['480px', '500px'],
callBack: function(refreshCode){ callBack: function(refreshCode){
if (refreshCode == '0') { if (refreshCode == '0') {
......
...@@ -467,6 +467,8 @@ body .layer-ext-winconfirm .layui-layer-content { ...@@ -467,6 +467,8 @@ body .layer-ext-winconfirm .layui-layer-content {
.red{ .red{
color: #fb5553; color: #fb5553;
font-size: 16px;
font-family: fangsong;
} }
.yl{ .yl{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册