btyjj-inspection/src/main/resources/static/route/taskcheck/v2/save-taskcheck.html
2021-03-03 18:35:35 +08:00

763 lines
36 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<style>
.selected-user {
margin-bottom: 15px;
}
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>新增内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item">
<label class="layui-form-label">任务名称</label>
<div class="layui-input-block">
<input type="text" id="taskName" name="taskName" class="layui-input" value="" placeholder="请输入任务名称" lay-verify="required">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">任务描述</label>
<div class="layui-input-block">
<textarea id="taskSummary" name="taskSummary" class="layui-textarea" placeholder="请输入任务描述" lay-verify="required"></textarea>
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">任务种类</label>
<div class="layui-input-block">
<input type="radio" name="taskType" value="1" title="指定任务" checked lay-filter="taskTypeFilter">
<input type="radio" name="taskType" value="2" title="单随机任务" lay-filter="taskTypeFilter">
<input type="radio" name="taskType" value="3" title="双随机任务" lay-filter="taskTypeFilter">
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">子任务种类</label>
<div class="layui-input-block">
<input type="radio" name="taskTypeSub" value="1" title="不限时任务" checked lay-filter="taskTypeSubFilter">
<input type="radio" name="taskTypeSub" value="2" title="限时任务" lay-filter="taskTypeSubFilter">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">选择人员(点击下方空白处打开人员选择)</label>
<div class="layui-input-block">
<input type="hidden" id="selectedUserIds" name="selectedUserIds">
<div id="selectedUserIdsTemplateBox" style="border: 1px solid #e6e6e6; cursor: pointer; padding: 15px 15px 0 15px" lay-filter="selectedUserTemplateBox"></div>
<script id="selectedUserIdsTemplate" type="text/html">
{{# for(var i = 0, item; item = d[i++];) { }}
<button type="button" class="layui-btn layui-btn-sm selected-user">{{item.userName}}</button>
{{# } }}
</script>
</div>
</div>
<div id="startEndTimeBox" class="layui-row" style="display: none;">
<div class="layui-col-md6 layui-col-sm6 layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">开始日期</label>
<div class="layui-input-block">
<input type="text" id="startTime" name="startTime" class="layui-input" value="" placeholder="请选择开始日期">
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6 layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">结束日期</label>
<div class="layui-input-block">
<input type="text" id="endTime" name="endTime" class="layui-input" value="" placeholder="请选择结束日期">
</div>
</div>
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">任务种类</label>
<div class="layui-input-block">
<input type="radio" name="checkItemListType" value="1" title="默认项(关联+自定义)" checked lay-filter="checkItemListType">
<input type="radio" name="checkItemListType" value="2" title="关联项" lay-filter="checkItemListType">
<input type="radio" name="checkItemListType" value="3" title="自定义项" lay-filter="checkItemListType">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">所在区域</label>
<div class="layui-col-md2 layui-col-sm2 layui-col-xs2">
<div class="layui-form" id="area1SelectTemplateBox" lay-filter="area1SelectTemplateBox" style="margin-right: 0px;"></div>
<script id="area1SelectTemplate" type="text/html">
<select id="area1" name="area1" lay-filter="area1">
<option value="">1级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-md2 layui-col-sm2 layui-col-xs2">
<div class="layui-form" id="area2SelectTemplateBox" lay-filter="area2SelectTemplateBox" style="margin-right: 0px;"></div>
<script id="area2SelectTemplate" type="text/html">
<select id="area2" name="area2" lay-filter="area2">
<option value="">2级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-md2 layui-col-sm2 layui-col-xs2">
<div class="layui-form" id="area3SelectTemplateBox" lay-filter="area3SelectTemplateBox" style="margin-right: 0px;"></div>
<script id="area3SelectTemplate" type="text/html">
<select id="area3" name="area3" lay-filter="area3">
<option value="">3级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-md2 layui-col-sm2 layui-col-xs2">
<div class="layui-form" id="area4SelectTemplateBox" lay-filter="area4SelectTemplateBox" style="margin-right: 0px;"></div>
<script id="area4SelectTemplate" type="text/html">
<select id="area4" name="area4" lay-filter="area4">
<option value="">4级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-md2 layui-col-sm2 layui-col-xs2">
<div class="layui-form" id="area5SelectTemplateBox" lay-filter="area5SelectTemplateBox" style="margin-right: 0px;"></div>
<script id="area5SelectTemplate" type="text/html">
<select id="area5" name="area5">
<option value="">5级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">主要污染因子</label>
<div class="layui-input-block">
<div id="pollutionFactorTemplateBox" style="border: 1px solid #e6e6e6;" lay-filter="pollutionFactorTemplateBox"></div>
<script id="pollutionFactorTemplate" type="text/html">
{{# for(var i = 0, item; item = d[i++];) { }}
<input type="checkbox" id="{{item.dictionaryId}}" name="pollutionFactor[{{item.dictionaryId}}]" title="{{item.dictionaryName}}" lay-filter="pollutionFactorFilter">
{{# } }}
</script>
</div>
</div>
<div id="randomCountBox" class="layui-row" style="display: none;">
<div class="layui-col-md10 layui-col-sm10 layui-col-xs10">
<div class="layui-form-item">
<label class="layui-form-label">随机数量</label>
<div class="layui-input-block">
<input type="number" id="randomCount" name="randomCount" min="1" class="layui-input" placeholder="请输入随机数量">
</div>
</div>
</div>
<div class="layui-col-md2 layui-col-sm2 layui-col-xs2">
<div class="layui-form-item">
<button type="button" id="randomButton" class="layui-btn layui-btn-normal" style="width: 100%">点击获得随机列表</button>
</div>
</div>
</div>
<div id="dataTableBox" class="layui-form-item layui-form-text">
<label class="layui-form-label">检查企业</label>
<div class="layui-input-block">
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'table', 'form', 'laydate', 'laytpl', 'tableSelect'], function(){
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var pollutionFactorArray = [];
var tableSelect = layui.tableSelect;
// 检查项列表类型
var checkItemListType = '1';
// 任务类型
var taskType = '1';
// 选中企业列表
var enterprisesTmpObj = {};
var defaultTableUrl = 'api/enterprise/listpage';
var singleRandomTableUrl = 'api/taskcheck/v2/listsinglerandom';
var doubleRandomTableUrl = 'api/taskcheck/v2/listdoublerandom';
var tableUrl = defaultTableUrl;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化选择框、单选、复选模板
function initSelectRadioCheckboxTemplate(templateId, templateBoxId, data, callback) {
laytpl(document.getElementById(templateId).innerHTML).render(data, function(html) {
document.getElementById(templateBoxId).innerHTML = html;
});
form.render('select', templateBoxId);
}
// 初始化表格
function initTable() {
function addContactOption(col) {
col.push({field: 'contactOption', width: 120, title: '关联项', align:'center', fixed: 'right',
templet: function(row) {
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="contactOptionEvent">行业检查项</button>';
}
})
}
function addCustomOption(col) {
col.push({field: 'customOption', width: 120, title: '自定义项', align:'center', fixed: 'right',
templet: function(row) {
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="customOptionEvent">企业检查项</button>';
}
})
}
function addCheckUser(col) {
col.push({field: 'checkUserName', width: 100, title: '检查人', align:'center', fixed: 'right',
templet: function(row) {
return row[this.field];
}
})
}
var cols = [[
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'name', width: 200, title: '名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'address', width: 200, title: '详细地址', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'summary', width: 200, title: '说明', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'typeDictionaryName', width: 120, title: '类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'master', width: 80, title: '负责人', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'phone', width: 120, title: '联系电话', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'industryTypeDictionaryName', width: 120, title: '行业类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'industryDictionaryName', width: 120, title: '所属行业', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
]];
if(!taskType || taskType == '1') {
cols[0].unshift({type:'checkbox', fixed: 'left'});
}
// 单随机选人或者双随机
if( (taskType == '2' && $('#selectedUserIds').val()) || taskType == '3') {
addCheckUser(cols[0]);
}
if(checkItemListType && checkItemListType == '2') {
addContactOption(cols[0]);
} else if(checkItemListType && checkItemListType == '3') {
addCustomOption(cols[0]);
} else {
addContactOption(cols[0]);
addCustomOption(cols[0]);
}
$.extend(table, {config: {checkName: 'checked'}});
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: 300,
where: {
area1: $('#area1').val(),
area2: $('#area2').val(),
area3: $('#area3').val(),
area4: $('#area4').val(),
area5: $('#area5').val(),
pollutionFactors: pollutionFactorArray.toString(),
selectedUserIds: $('#selectedUserIds').val()
},
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
request: {
pageName: 'page',
limitName: 'rows'
},
cols: cols,
page: true,
parseData: function(data) {
if(taskType == '1') {
if(!this.page) {
this.page = true;
}
for(var i = 0, item; item = data.rows[i++];) {
if(enterprisesTmpObj[item.enterpriseId]) {
item.checked = true;
} else {
item.checked = false;
}
}
} else {
if(this.page) {
this.page = false;
}
enterprisesTmpObj = {};
for(var i = 0, item; item = data[i++];) {
enterprisesTmpObj[item.enterpriseId] = item;
}
}
return {
'code': 0,
'msg': '',
'count': taskType == '1' ? data.total : data.length,
'data': taskType == '1' ? data.rows : data
};
}
});
}
// 重载表格
function reloadTable(currentPage) {
table.reload('dataTable', {
url: top.restAjax.path(tableUrl, []),
where: {
area1: $('#area1').val(),
area2: $('#area2').val(),
area3: $('#area3').val(),
area4: $('#area4').val(),
area5: $('#area5').val(),
pollutionFactors: pollutionFactorArray.toString()
},
page: {
curr: currentPage
},
height: 300,
});
}
table.on('checkbox(dataTable)', function(obj) {
if(obj.type == 'one') {
if(obj.checked) {
enterprisesTmpObj[obj.data.enterpriseId] = obj.data;
} else {
delete enterprisesTmpObj[obj.data.enterpriseId];
}
}
if(obj.type == 'all') {
var tableDatas = table.cache['dataTable'];
if(obj.checked) {
for(var i = 0, item; item = tableDatas[i++];) {
enterprisesTmpObj[item.enterpriseId] = item;
}
} else {
for(var i = 0, item; item = tableDatas[i++];) {
delete enterprisesTmpObj[item.enterpriseId];
}
}
}
});
table.on('tool(dataTable)', function(obj) {
var data = obj.data;
var event = obj.event;
var enterpriseObj = enterprisesTmpObj[data.enterpriseId];
if(event === 'contactOptionEvent') {
if(taskType == '1' && !enterpriseObj) {
top.dialog.msg('请先勾选检查企业');
return;
}
top.dialog.dialogData.oldCheckItemArray = !enterpriseObj.industryCheckItems ? [] : enterpriseObj.industryCheckItems;
top.dialog.open({
url: top.restAjax.path('route/industrycheckitem/v2/list-select-industrycheckitem-v2.html?industryId={industryId}', [data.industryType]),
title: '选择行业检查项',
width: '70%',
height: '80%',
onClose: function () {
var newCheckItemArray = top.dialog.dialogData.newCheckItemArray;
enterpriseObj.industryCheckItems = newCheckItemArray;
}
});
} else if(event === 'customOptionEvent') {
if(taskType == '1' && !enterprisesTmpObj[data.enterpriseId]) {
top.dialog.msg('请先勾选检查企业');
return;
}
top.dialog.dialogData.oldCheckItemArray = !enterpriseObj.enterpriseCheckItems ? [] : enterpriseObj.enterpriseCheckItems;
top.dialog.open({
url: top.restAjax.path('route/enterprise/checkitem/v2/list-select-checkitem.html?enterpriseId={enterpriseId}', [data.enterpriseId]),
title: '选择企业检查项',
width: '70%',
height: '80%',
onClose: function () {
var newCheckItemArray = top.dialog.dialogData.newCheckItemArray;
enterpriseObj.enterpriseCheckItems = newCheckItemArray;
}
});
}
});
// 初始化1级区域下拉选择
function initArea1Select() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area1SelectTemplate', 'area1SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化2级区域下拉选择
function initArea2Select(area1) {
if(!area1) {
initSelectRadioCheckboxTemplate('area2SelectTemplate', 'area2SelectTemplateBox', []);
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area2SelectTemplate', 'area2SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化3级区域下拉选择
function initArea3Select(area2) {
$('#area3Box').show();
if(!area2) {
initSelectRadioCheckboxTemplate('area3SelectTemplate', 'area3SelectTemplateBox', []);
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area3SelectTemplate', 'area3SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化4级区域下拉选择
function initArea4Select(area3) {
if(!area3) {
initSelectRadioCheckboxTemplate('area4SelectTemplate', 'area4SelectTemplateBox', []);
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area4SelectTemplate', 'area4SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化5级区域下拉选择
function initArea5Select(area4) {
$('#area5Box').show();
if(!area4) {
initSelectRadioCheckboxTemplate('area5SelectTemplate', 'area5SelectTemplateBox', []);
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area5SelectTemplate', 'area5SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化污染因子
function initPollutionFactorTemplate() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/48b6829b-24b8-4c42-a21d-fe98dbe23fd5', []), {}, null, function(code, data) {
laytpl(document.getElementById('pollutionFactorTemplate').innerHTML).render(data, function(html) {
document.getElementById('pollutionFactorTemplateBox').innerHTML = html;
});
form.render('checkbox');
}, function(code, data) {
top.dialog.msg(data.msg);
})
}
form.on('checkbox(pollutionFactorFilter)', function(data) {
var existIndex = -1
for(var i = 0; i < pollutionFactorArray.length; i++) {
var item = pollutionFactorArray[i];
if(item == data.elem.id) {
existIndex = i;
break;
}
}
if(data.elem.checked && existIndex == -1) {
pollutionFactorArray.push(data.elem.id);
}
if(!data.elem.checked && existIndex > -1) {
pollutionFactorArray.splice(existIndex, 1);
}
reloadTable(1);
});
form.on('radio(taskTypeFilter)', function(data) {
taskType = data.value;
if(data.value == '1') {
$('#randomCountBox').hide();
$('#dataTableBox').show();
tableUrl = defaultTableUrl;
initTable();
} else {
$('#randomCountBox').show();
$('#dataTableBox').hide();
}
});
form.on('radio(taskTypeSubFilter)', function(data) {
if(data.value == '1') {
$('#startEndTimeBox').hide();
} else {
$('#startEndTimeBox').show();
}
});
form.on('radio(checkItemListType)', function(data) {
checkItemListType = data.value;
initTable();
});
$(document).on('click', '#randomButton', function() {
var randomCount = $('#randomCount').val();
if(!randomCount) {
top.dialog.msg('请输入随机数');
return;
}
if(parseInt(randomCount) < 1) {
top.dialog.msg('随机数不能小于1');
return;
}
if(taskType == '2') {
tableUrl = singleRandomTableUrl+ '/'+ $('#randomCount').val();
} else if(taskType == '3') {
tableUrl = doubleRandomTableUrl+ '/'+ $('#randomCount').val();
}
initTable();
$('#dataTableBox').show();
});
function initDate() {
// 日期选择
laydate.render({
elem: '#startTime',
format: 'yyyy-MM-dd HH:mm:ss',
trigger: 'click'
});
laydate.render({
elem: '#endTime',
format: 'yyyy-MM-dd HH:mm:ss',
trigger: 'click'
});
}
// 初始化内容
function initData() {
initDate();
initArea1Select();
initArea2Select();
initArea3Select();
initArea4Select();
initArea5Select();
initPollutionFactorTemplate();
initTable();
}
initData();
// 保存任务
function saveTask(formData) {
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/taskcheck/v2/save', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg('提交成功,任务分配完成后自动下发...', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
// 提交表单
form.on('submit(submitForm)', function(formData) {
var enterprises = [];
for(var key in enterprisesTmpObj) {
var enterprise = enterprisesTmpObj[key];
enterprise.industryId = enterprise.industryType;
enterprises.push(enterprise);
}
formData.field.enterprises = enterprises;
if(taskType != '1' && enterprises.length == 0) {
top.dialog.msg('单随机、双随机的检查企业列表不能为空');
return;
}
if(enterprises.length == 0) {
top.dialog.confirm('您没有单独选择任何的企业,系统将对全部的企业进行任务下发,分配时间较长,确定提交吗?', function(index) {
saveTask(formData);
});
return;
}
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
saveTask(formData);
});
return false;
});
$('#selectedUserIdsTemplateBox').on('click', function() {
top.dialog.dialogData.selectedUserIds = $('#selectedUserIds').val();
top.dialog.open({
url: top.restAjax.path('route/user/departmentuser', []),
title: '选择组织部门人员',
width: '500px',
height: '500px',
onClose: function() {
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
if(selectedUsers != null && selectedUsers.length > 0) {
var selectedUserIds = '';
for (var i = 0, item; item = selectedUsers[i++];) {
if ('' != selectedUserIds) {
selectedUserIds += '_';
}
selectedUserIds += item.userId;
}
$('#selectedUserIds').val(selectedUserIds)
} else {
$('#selectedUserIds').val('');
}
laytpl(document.getElementById('selectedUserIdsTemplate').innerHTML).render(selectedUsers, function(html) {
document.getElementById('selectedUserIdsTemplateBox').innerHTML = html;
});
if(taskType == '1') {
initTable();
}
}
})
});
$('.close').on('click', function() {
closeBox();
});
// area1 选择事件
form.on('select(area1)', function(data) {
initArea2Select(data.value);
initArea3Select();
initArea4Select();
initArea5Select();
reloadTable(1);
});
// area2 选择事件
form.on('select(area2)', function(data) {
initArea3Select(data.value);
initArea4Select();
initArea5Select();
reloadTable(1);
});
// area3 选择事件
form.on('select(area3)', function(data) {
initArea4Select(data.value);
initArea5Select();
reloadTable(1);
});
// area4 选择事件
form.on('select(area4)', function(data) {
initArea5Select(data.value);
reloadTable(1);
});
// 校验
form.verify({
});
});
</script>
</body>
</html>