btgxq-partybuilding/src/main/resources/static/route/partyorganize/update-partyorganize.html
2020-11-05 16:24:12 +08:00

844 lines
41 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<base href="/partybuilding/">
<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">
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
</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">组织名称<span style="color:red;">*</span></label>
<div class="layui-input-block">
<input type="text" id="name" name="name" class="layui-input" value="" placeholder="请输入组织名称" lay-verify="required">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">组织LOGO</label>
<div class="layui-input-block">
<input type="hidden" id="logo" name="logo">
<div class="layui-btn-container" id="logoFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="logoFileDownload" type="text/html">
{{# var fileName = 'logo'; }}
{{# if(d[fileName].length > 0) { }}
{{# var files = d[fileName];}}
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<div class="upload-image-box">
<span class="upload-image-span">
<img src="route/file/downloadfile/false/{{item.fileId}}" align="加载失败">
</span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="logoRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 1) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="组织logo" data-name="logo" lay-filter="logoUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">组织类型<span style="color:red;">*</span></label>
<div class="layui-input-block layui-form" id="typeSelectTemplateBox" lay-filter="typeSelectTemplateBox"></div>
<script id="typeSelectTemplate" type="text/html">
<select id="type" name="type" lay-verify="required">
<option value="">请选择组织类型</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">直属类型</label>
<div class="layui-input-block layui-form" id="belongTypeSelectTemplateBox" lay-filter="belongTypeSelectTemplateBox"></div>
<script id="belongTypeSelectTemplate" type="text/html">
<select id="belongType" name="belongType">
<option value="">请选择直属类型</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">
<label class="layui-form-label">自治区</label>
<div class="layui-input-block layui-form" id="areaSelectTemplateBox" lay-filter="areaSelectTemplateBox"></div>
<input type="hidden" id="areaName" name="areaName">
<script id="areaSelectTemplate" type="text/html">
<select id="area" name="area" lay-filter="area">
<option value="">请选择所在区域-自治区</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.areaId}}">{{item.areaName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item" id="divCity">
<label class="layui-form-label">盟市</label>
<div class="layui-input-block layui-form" id="areaCitySelectTemplateBox" lay-filter="areaCitySelectTemplateBox"></div>
<input type="hidden" id="areaCityName" name="areaCityName">
<script id="areaCitySelectTemplate" type="text/html">
<select id="areaCity" name="areaCity" lay-filter="areaCity">
<option value="">请选择所在区域-盟市</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.areaId}}">{{item.areaName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item" id="divCounty">
<label class="layui-form-label">旗县</label>
<div class="layui-input-block layui-form" id="areaCountySelectTemplateBox" lay-filter="areaCountySelectTemplateBox"></div>
<input type="hidden" id="areaCountyName" name="areaCountyName">
<script id="areaCountySelectTemplate" type="text/html">
<select id="areaCounty" name="areaCounty" lay-filter="areaCounty">
<option value="">请选择所在区域-旗县</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.areaId}}">{{item.areaName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item" id="divRural">
<label class="layui-form-label">乡村</label>
<div class="layui-input-block layui-form" id="areaRuralSelectTemplateBox" lay-filter="areaRuralSelectTemplateBox"></div>
<input type="hidden" id="areaRuralName" name="areaRuralName">
<script id="areaRuralSelectTemplate" type="text/html">
<select id="areaRural" name="areaRural" lay-filter="areaRural">
<option value="">请选择所在区域-乡村</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.areaId}}">{{item.areaName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item" id="divStreet">
<label class="layui-form-label">街道</label>
<div class="layui-input-block layui-form" id="areaStreetSelectTemplateBox" lay-filter="areaStreetSelectTemplateBox"></div>
<input type="hidden" id="areaStreetName" name="areaStreetName">
<script id="areaStreetSelectTemplate" type="text/html">
<select id="areaStreet" name="areaStreet" lay-filter="areaStreet">
<option value="">请选择所在区域-街道</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.areaId}}">{{item.areaName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">所属级别</label>
<div class="layui-input-block layui-form">
<select id="belongLevel" name="belongLevel" lay-filter="belongLevel">
<option value="">请选择所属级别</option>
<option value="1">1级</option>
<option value="2">2级</option>
<option value="3">3级</option>
<option value="4">4级</option>
<option value="5">5级</option>
</select>
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">隶属类型</label>
<div class="layui-input-block layui-form" id="subjectionTypeSelectTemplateBox" lay-filter="subjectionTypeSelectTemplateBox"></div>
<script id="subjectionTypeSelectTemplate" type="text/html">
<select id="subjectionType" name="subjectionType">
<option value="">请选择隶属类型</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-row" pane>
<div class="layui-col-lg6">
<label class="layui-form-label">区域面积</label>
<div class="layui-input-block">
<input type="number" step="0.01" id="areaMeasure" name="areaMeasure" class="layui-input" value="" placeholder="请输入区域面积" lay-verify="required">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">阵地建设</label>
<div class="layui-input-block layui-form">
<input type="radio" name="position" value="0" title="否" checked>
<input type="radio" name="position" value="1" title="是">
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">所属单位</label>
<div class="layui-input-block">
<input type="text" id="belongCompany" name="belongCompany" class="layui-input" value="" placeholder="请输入所属单位" >
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">单位类型</label>
<div class="layui-input-block">
<input type="text" id="companyTypeName" name="companyTypeName" class="layui-input" value="" placeholder="请选择单位类型" >
<input type="hidden" id="companyType" name="companyType" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg5">
<label class="layui-form-label">所在经度</label>
<div class="layui-input-block">
<input type="text" id="longitude" name="longitude" class="layui-input" value="" placeholder="请输入所在经度">
</div>
</div>
<div class="layui-col-lg5">
<label class="layui-form-label">所在纬度</label>
<div class="layui-input-block">
<input type="text" id="latitude" name="latitude" class="layui-input" value="" placeholder="请输入所在纬度" style="width:490px;">
</div>
</div>
<div>
<div class="layui-input-block">
<button type="button" class="layui-btn layui-btn-normal" id="findMapButton" style="margin-left: 82px;">选择组织地址</button>
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">负责人</label>
<div class="layui-input-block">
<input type="text" id="linkMan" name="linkMan" class="layui-input" value="" placeholder="请输入负责人" >
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">电话</label>
<div class="layui-input-block">
<input type="text" id="phone" name="phone" class="layui-input" value="" placeholder="请输入电话" >
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">建立时间</label>
<div class="layui-input-block">
<input type="text" id="creatTime" name="creatTime" class="layui-input" value="" placeholder="请选择建立时间" lay-verify="required" readonly style="cursor: pointer;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">详细地址</label>
<div class="layui-input-block">
<input type="text" id="location" name="location" class="layui-input" value="" placeholder="请输入详细地址" >
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label layui-form">简介</label>
<div class="layui-input-block">
<div id="introduction"></div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label layui-form">备注</label>
<div class="layui-input-block">
<div id="remake"></div>
</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" id="submitBtn">提交编辑</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var partyOrganizeId = top.restAjax.params(window.location.href).partyOrganizeId;
var show = top.restAjax.params(window.location.href).show;
var wangEditor = window.wangEditor;
var wangEditorObj = {};
var viewerObj = {};
if(show) {
$('#submitBtn').hide();
}
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function refreshDownloadTemplet(fileName, file) {
var dataRander = {};
dataRander[fileName] = file;
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
document.getElementById(fileName +'FileBox').innerHTML = html;
});
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化视频
function initVideo(fileName, data) {
for(var i = 0, item; item = data[i++];) {
var player = new ckplayer({
container: '#'+ fileName + i,
variable: 'player',
flashplayer: false,
video: {
file: 'route/file/downloadfile/true/'+ item.fileId,
type: 'video/mp4'
}
});
}
}
// 初始化简介富文本
function initIntroductionRichText(value) {
var editor = new wangEditor('#introduction');
editor.customConfig.zIndex = 1000;
editor.customConfig.uploadImgMaxSize = 5 * 1024 * 1024;
editor.customConfig.uploadImgMaxLength = 1;
editor.customConfig.uploadFileName = 'image';
editor.customConfig.uploadImgServer = 'api/file/wangeditorimage';
editor.customConfig.uploadImgHooks = {
fail: function (xhr, editor, result) {
top.dialog.msg('系统错误,图片上传失败');
},
error: function (xhr, editor) {
top.dialog.msg('网络异常');
},
timeout: function (xhr, editor) {
top.dialog.msg('网络请求超时');
}
};
editor.create();
editor.txt.html(value);
wangEditorObj['introduction'] = editor;
}
// 初始化隶属类型下拉选择
function initSubjectionTypeSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/189701ac-eaf4-411e-9971-6194cb232849', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('subjectionTypeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('subjectionTypeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'subjectionTypeSelectTemplateBox');
var selectObj = {};
selectObj['subjectionType'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化组织类型下拉选择
function initTypeSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/93ea58d2-f59f-4df5-8a69-bc947dfdc723', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('typeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('typeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'typeSelectTemplateBox');
var selectObj = {};
selectObj['type'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化直属类型下拉选择
function initBelongTypeSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/a8eabfdb-ee8e-4d63-9f02-c6bb2d61b722', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('belongTypeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('belongTypeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'belongTypeSelectTemplateBox');
var selectObj = {};
selectObj['belongType'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化组织logo图片上传
function initLogoUploadFile() {
var files = $('#logo').val();
initFileList('logo', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(logoUploadFile)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
}
}
});
});
form.on('button(logoRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 1);
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
});
}
// 初始化所在区域-自治区下拉选择
function initAreaSelect(selectValue, value, dataValue) {
if(!dataValue) {
var data = [
{
areaId: '',
areaName: '请选择上级数据'
}
];
laytpl(document.getElementById('areaSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaSelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaSelectTemplateBox');
}else {
top.restAjax.get(top.restAjax.path('app/dataarea/listareabyparentidrelease/0', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('areaSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaSelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaSelectTemplateBox');
var selectObj = {};
selectObj['area'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
}
// 初始化所在区域-盟市下拉选择
function initAreaCitySelect(selectValue, value, dataValue) {
if(!dataValue) {
var data = [
{
areaId: '',
areaName: '请选择上级数据'
}
];
laytpl(document.getElementById('areaCitySelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaCitySelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaCitySelectTemplateBox');
}else {
top.restAjax.get(top.restAjax.path('app/dataarea/listareabyparentidrelease/' + selectValue, []), {}, null, function(code, data, args) {
laytpl(document.getElementById('areaCitySelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaCitySelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaCitySelectTemplateBox');
var selectObj = {};
selectObj['areaCity'] = value;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
}
// 初始化所在区域-旗县下拉选择
function initAreaCountySelect(selectValue, value, dataValue) {
if(!dataValue) {
var data = [
{
areaId: '',
areaName: '请选择上级数据'
}
];
laytpl(document.getElementById('areaCountySelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaCountySelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaCountySelectTemplateBox');
}else {
top.restAjax.get(top.restAjax.path('app/dataarea/listareabyparentidrelease/' + selectValue, []), {}, null, function(code, data, args) {
laytpl(document.getElementById('areaCountySelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaCountySelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaCountySelectTemplateBox');
var selectObj = {};
selectObj['areaCounty'] = value;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
}
// 初始化所在区域-乡村下拉选择
function initAreaRuralSelect(selectValue, value, dataValue) {
if(!dataValue) {
var data = [
{
areaId: '',
areaName: '请选择上级数据'
}
];
laytpl(document.getElementById('areaRuralSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaRuralSelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaRuralSelectTemplateBox');
}else {
top.restAjax.get(top.restAjax.path('app/dataarea/listareabyparentidrelease/' + selectValue, []), {}, null, function(code, data, args) {
laytpl(document.getElementById('areaRuralSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaRuralSelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaRuralSelectTemplateBox');
var selectObj = {};
selectObj['areaRural'] = value;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
}
// 初始化所在区域-街道下拉选择
function initAreaStreetSelect(selectValue, value, dataValue) {
if(!dataValue) {
var data = [
{
areaId: '',
areaName: '请选择上级数据'
}
];
laytpl(document.getElementById('areaStreetSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaStreetSelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaStreetSelectTemplateBox');
}else {
top.restAjax.get(top.restAjax.path('app/dataarea/listareabyparentidrelease/' + selectValue, []), {}, null, function(code, data, args) {
laytpl(document.getElementById('areaStreetSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaStreetSelectTemplateBox').innerHTML = html;
});
form.render('select', 'areaStreetSelectTemplateBox');
var selectObj = {};
selectObj['areaStreet'] = value;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
}
// 所在区域-自治区change事件
form.on('select(area)', function(data){
if(!data.value) {
$('#areaName').val('')
$('#divCity').hide();
$('#divCounty').hide();
$('#divRural').hide();
$('#divStreet').hide();
}else {
$('#areaName').val($("#area").find("option:selected").text())
$('#divCity').show();
$('#divCounty').hide();
$('#divRural').hide();
$('#divStreet').hide();
initAreaCitySelect(data.value, '', '非空');
}
$("#areaCity").empty();
form.render("select");
});
// 所在区域-盟市change事件
form.on('select(areaCity)', function(data){
if(!data.value) {
$('#areaCityName').val('')
$('#divCounty').hide();
$('#divRural').hide();
$('#divStreet').hide();
}else {
$('#areaCityName').val($("#areaCity").find("option:selected").text())
$('#divCounty').show();
$('#divRural').hide();
$('#divStreet').hide();
initAreaCountySelect(data.value, '', '非空');
}
$("#areaCounty").empty();
form.render("select");
});
// 所在区域-旗县change事件
form.on('select(areaCounty)', function(data){
if(!data.value) {
$('#areaCountyName').val('')
$('#divRural').hide();
$('#divStreet').hide();
}else {
$('#areaCountyName').val($("#areaCounty").find("option:selected").text())
$('#divRural').show();
$('#divStreet').hide();
initAreaRuralSelect(data.value, '', '非空');
}
$("#areaRural").empty();
form.render("select");
});
// 所在区域-乡村change事件
form.on('select(areaRural)', function(data){
if(!data.value) {
$('#areaRuralName').val('')
$('#divStreet').hide();
}else {
$('#areaRuralName').val($("#areaRural").find("option:selected").text())
$('#divStreet').show();
initAreaStreetSelect(data.value, '', '非空');
}
$("#areaStreet").empty();
form.render("select");
});
// 所在区域-街道change事件
form.on('select(areaStreet)', function(data){
if(!data.value) {
$('#areaStreetName').val('')
}else {
$('#areaStreetName').val($("#areaStreet").find("option:selected").text())
}
});
//地图点击件事
$("#findMapButton").on('click',function(){
top.dialog.open({
url: top.restAjax.path('route/partyorganize/map.html', []),
title: '地址选择',
width: '1040px',
height: '98%',
onClose: function(data) {
$("#longitude").val(top.dialog.dialogData.activityAddressX);
$("#latitude").val(top.dialog.dialogData.activityAddressY);
}
});
});
// 点击单位类型选择输入框,弹出层方法
$(document).on('click', '#companyTypeName', function() {
top.dialog.open({
url: top.restAjax.path('route/partyorganize/list-tree.html?companyType={companyType}', [$('#companyType').val()]),
title: '选择单位类型',
width: '1040px',
height: '100%',
onClose: function(data) {
$("#companyType").val(top.dialog.dialogData.companyType);
$("#companyTypeName").val(top.dialog.dialogData.companyTypeName);
}
});
});
// 初始化建立时间日期
function initCreatTimeDate() {
laydate.render({
elem: '#creatTime',
type: 'date',
trigger: 'click'
});
}
// 初始化备注富文本
function initRemakeRichText(value) {
var editor = new wangEditor('#remake');
editor.customConfig.zIndex = 1000;
editor.customConfig.uploadImgMaxSize = 5 * 1024 * 1024;
editor.customConfig.uploadImgMaxLength = 1;
editor.customConfig.uploadFileName = 'image';
editor.customConfig.uploadImgServer = 'api/file/wangeditorimage';
editor.customConfig.uploadImgHooks = {
fail: function (xhr, editor, result) {
top.dialog.msg('系统错误,图片上传失败');
},
error: function (xhr, editor) {
top.dialog.msg('网络异常');
},
timeout: function (xhr, editor) {
top.dialog.msg('网络请求超时');
}
};
editor.create();
editor.txt.html(value);
wangEditorObj['remake'] = editor;
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/partyorganize/getpartyorganizebyid/{partyOrganizeId}', [partyOrganizeId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initIntroductionRichText(data['introduction']);
initSubjectionTypeSelect(data['subjectionType']);
initLogoUploadFile();
initTypeSelect(data['type']);
initBelongTypeSelect(data['belongType']);
initAreaSelect(data['area'], data['area'], data['area']);
console.log(data['area'])
initAreaCitySelect(data['area'], data['areaCity'], data['areaCity']);
initAreaCountySelect(data['areaCity'], data['areaCounty'], data['areaCounty']);
initAreaRuralSelect(data['areaCounty'], data['areaRural'], data['areaRural']);
initAreaStreetSelect(data['areaRural'], data['areaStreet'], data['areaStreet']);
initCreatTimeDate();
initRemakeRichText(data['remake']);
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
formData.field['introduction'] = wangEditorObj['introduction'].txt.html();
formData.field['remake'] = wangEditorObj['remake'].txt.html();
top.restAjax.put(top.restAjax.path('api/partyorganize/updatepartyorganize/{partyOrganizeId}', [partyOrganizeId]), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
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);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>