-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,077 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<!-- 注意这里不需要写`<html><body>`这些东西,它是一个html片段,不是完整的html页面 --> | ||
<form id="organizationEditForm" lay-filter="organizationEditForm" class="layui-form model-form" | ||
style="padding-right: 20px;"> | ||
<input name="organizationId" type="hidden"/> | ||
<div class="layui-row"> | ||
<div class="layui-col-md6"> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label layui-form-required">上级机构:</label> | ||
<div class="layui-input-block"> | ||
<div id="organizationEditParentSel" class="ew-xmselect-tree"></div> | ||
</div> | ||
</div> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label layui-form-required">机构名称:</label> | ||
<div class="layui-input-block"> | ||
<input name="organizationName" placeholder="请输入机构名称" class="layui-input" | ||
lay-verType="tips" lay-verify="required" required/> | ||
</div> | ||
</div> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label layui-form-required">机构全称:</label> | ||
<div class="layui-input-block"> | ||
<input name="organizationFullName" placeholder="请输入机构全称" class="layui-input" | ||
lay-verType="tips" lay-verify="required" required/> | ||
</div> | ||
</div> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label layui-form-required">机构类型:</label> | ||
<div class="layui-input-block"> | ||
<select name="organizationType" lay-verType="tips" lay-verify="required" required> | ||
<option value="">请选择机构类型</option> | ||
<option value="1">公司</option> | ||
<option value="2">子公司</option> | ||
<option value="3">部门</option> | ||
<option value="4">小组</option> | ||
</select> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="layui-col-md6"> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label layui-form-required">排序号:</label> | ||
<div class="layui-input-block"> | ||
<input name="sortNumber" placeholder="请输入排序号" class="layui-input" type="number" | ||
lay-verType="tips" lay-verify="required" required/> | ||
</div> | ||
</div> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label">备注:</label> | ||
<div class="layui-input-block"> | ||
<textarea name="comments" placeholder="请输入备注" class="layui-textarea"></textarea> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="layui-form-item text-right"> | ||
<button class="layui-btn" lay-filter="organizationEditSubmit" lay-submit>保存</button> | ||
<button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> | ||
</div> | ||
</form> | ||
|
||
<script> | ||
layui.use(['layer', 'form', 'admin', 'xnUtil', 'xmSelect'], function () { | ||
var $ = layui.jquery; | ||
var layer = layui.layer; | ||
var form = layui.form; | ||
var admin = layui.admin; | ||
var xnUtil = layui.xnUtil; | ||
var xmSelect = layui.xmSelect; | ||
|
||
var editData = admin.getLayerData('#extForm').data; | ||
|
||
var extOrgTreeRenderIns = {}; | ||
// admin.req(getProjectUrl() + 'sysOrg/tree', function(res){ | ||
admin.req( 'tree.json', function(res){ | ||
// 渲染下拉树 | ||
extOrgTreeRenderIns = xmSelect.render({ | ||
el: '#extOrgSelectBox', | ||
name: 'orgId', | ||
height: '250px', | ||
layVerify: 'required', | ||
layVerType: 'tips', | ||
data: res.data, | ||
initValue: editData ? [editData.orgId] : [], | ||
model: {label: {type: 'text'}}, | ||
prop: { | ||
name: 'title', | ||
value: 'id' | ||
}, | ||
radio: true, | ||
clickClose: true, | ||
tree: { | ||
show: true, | ||
indent: 15, | ||
strict: false, | ||
expandedKeys: true | ||
}, | ||
tips: '请选择附属机构' | ||
}); | ||
}, {async: false}); | ||
|
||
// 渲染远程数据下拉 | ||
var extPosDataRenderIns = {}; | ||
// admin.req(getProjectUrl() + 'sysPos/list', function(res){ | ||
admin.req( 'sysPosList.json', function(res){ | ||
extPosDataRenderIns = xmSelect.render({ | ||
el: '#extPosSelectBox', | ||
name: 'posId', | ||
data: res.data, | ||
layVerify: 'required', | ||
layVerType: 'tips', | ||
radio: true, | ||
clickClose: true, | ||
model: { icon:'hidden', label: { type: 'text' }}, | ||
prop: { | ||
name: 'name', | ||
value: 'id' | ||
}, | ||
tips: '请选择附属职位' | ||
}); | ||
}, {async: false}); | ||
|
||
if(editData !== null && editData !== undefined) { | ||
form.val('extForm', editData); | ||
extPosDataRenderIns.setValue([editData.posId]); | ||
} | ||
|
||
// 表单提交事件 | ||
form.on('submit(extFormSubmitBtn)', function () { | ||
var resultData = {}; | ||
var selectExtOrgData = extOrgTreeRenderIns.getValue(); | ||
var selectExtPosData = extPosDataRenderIns.getValue(); | ||
resultData.posId = selectExtPosData[0].id; | ||
resultData.posCode = selectExtPosData[0].code; | ||
resultData.posName = selectExtPosData[0].name; | ||
resultData.orgId = selectExtOrgData[0].id; | ||
resultData.orgName = selectExtOrgData[0].title; | ||
admin.putLayerData('formOk', true, '#extForm'); | ||
admin.putLayerData('resultData', resultData, '#extForm'); | ||
admin.closeDialog('#extForm'); | ||
return false; | ||
}); | ||
|
||
}); | ||
</script> |
Oops, something went wrong.