123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488 |
- <!DOCTYPE html>
- <html>
- <head>
- <!--#include file="common/_header.html"-->
- <title>项目详情页</title>
- </head>
- <body>
- <article class="page-container">
- <form class="form form-horizontal" id="form1">
- <input type="hidden" class="input-text" id="projectId" name="projectId">
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所属园区:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select class="select" id="parkId" name="parkId">
- </select>
- </span>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>项目名称:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" id="title" name="title">
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>项目签约时间:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input id="startTime" name="startTime" class="input-text" style="width:180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>计划投资:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" id="size" name="size">
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>选址位于:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" id="address" name="address">
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3">用地面积:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" id="landScale" name="landScale">
- </div>
- </div>
- <!-- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>责任单位:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" id="unit" name="unit">
- </div>
- </div> -->
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>相关情况:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" id="detail" name="detail">
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3">相关乡镇场:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <select class="select2" style="width:100%;" id="townshipAdminId" name="townshipAdminId">
- </select>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>项目秘书:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select class="select2" style="width:200px" id="secretaryAdminId" name="secretaryAdminId">
- <option value=""></option>
- </select>
- </span>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>包联领导:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select class="select2" style="width:200px" id="leaderAdminId" name="leaderAdminId">
- <option value=""></option>
- </select>
- </span>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>项目方所属管理员:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select class="select2" style="width:200px" id="projectAdminId" name="projectAdminId" >
- <option value=""></option>
- </select>
- </span>
- </div>
- </div>
- <input type="hidden" class="input-text" id="fileUrls" name="fileUrls">
- </form>
- <div class="form form-horizontal" >
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-3">联系函附件:</label>
- <!--用来存放文件信息-->
- <div class="formControls col-xs-8 col-sm-9">
- <div id="thelist" class="uploader-list"></div>
- <div class="btns">
- <div id="picker">选择文件</div>
- <button class="btn btn-default" id="uploadbtn">开始上传</button>
- </div>
- </div>
- </div>
- </form>
- <div class="row cl">
- <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
- <input class="btn btn-primary radius" type="button" id="subForm" value=" 提交 ">
- </div>
- </div>
- </article>
- <!--_footer 作为公共模版分离出去-->
- <!--#include file="common/_footer.html"-->
- <!--/_footer 作为公共模版分离出去-->
- <!--请在下方写此页面业务相关的脚本-->
- <script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
- <script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
- <script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
- <script type="text/javascript" src="scripts/global.js"></script>
- <!--引入webuploader-->
- <link rel="stylesheet" type="text/css" href="lib/webuploader/0.1.5/webuploader.css">
- <script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.js"></script>
- <!-- select2 start-->
- <link rel="stylesheet" type="text/css" href="lib/select2/select2.min.css" />
- <script src="lib/select2/select2.full.js" type="text/javascript"></script>
- <script src="lib/select2/select2.zh-CN.js" type="text/javascript"></script>
- <!-- select2 end -->
- <script type="text/javascript">
- var path = global_backend_url;
- $(document).ready(function(){
- //获取url中传参
- var id = getQueryString("id");
- var needLoad = false;
-
- var remoteUrl = path + "/project/add";
-
- if(id!=null && id.length>0){
- remoteUrl = path + "/project/update";
- needLoad = true;
- }
-
- $("#form1").validate({
- rules:{
- title:{
- required:true
- },
- startTime:{
- required:true
- },
- size:{
- required:true
- },
- address:{
- required:true
- },
- // unit:{
- // required:true
- // },
- detail:{
- required:true
- },
- secretaryAdminId:{
- required:true
- },
- leaderAdminId:{
- required:true
- },
- projectAdminId:{
- required:true
- }
- },
- onkeyup:false,
- focusCleanup:true,
- success:"valid",
- submitHandler:function(form){
- var loadingIndex = layer.load(1, {shade: [0.1,'#fff']});
- $(form).ajaxSubmit({
- type: 'post',
- url: remoteUrl,
- success: function(data){
- layer.close(loadingIndex);
- if(data.result){
- layer.msg('添加成功!',{icon:1,time:1000});
-
- var index = parent.layer.getFrameIndex(window.name);
-
- if(index>=0){
- parent.reloadList();
- parent.layer.close(index);
- }
- }
- else{
- layer.msg(data.message,{icon:1,time:1000});
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- layer.msg('error!',{icon:1,time:1000});
- }
- });
- }
- });
-
- if(needLoad){
- var loadingIndex = layer.load(1, {shade: [0.1,'#fff']});
-
- $.get(path + "/project/detail/" + id,null, function(json){
- layer.close(loadingIndex);
-
- if(json.result){
- json2Form(json.data,"form1");
- // if(json.data.procInstId != null ){
- // $("#projectAdminId").attr("disabled", true);
- // }
- getSelectMany("townshipAdminId",json.data.townshipAdminId,json.data.townshipAdminName);
- getSelect("secretaryAdminId",json.data.secretaryAdmin);
- getSelect("leaderAdminId",json.data.leaderAdmin);
- getSelect("projectAdminId",json.data.projectAdmin);
- getParkList(json.data.parkId);
-
- loadFile(json.data.pfList);
- }
- else{
- layer.msg(json.message);
- }
- },"json");
- }else{
- getParkList("");
- getSelectMany("townshipAdminId",null,null);
- getSelect("secretaryAdminId",null);
- getSelect("leaderAdminId",null);
- getSelect("projectAdminId",null);
- }
-
- $("#subForm").click(function(){
- $("#form1").submit();
- });
-
- //swf: 'lib/webuploader/0.1.5/Uploader.swf',
- var $list = $("#thelist");
- var uploader = WebUploader.create({
- // swf文件路径
- swf: 'lib/webuploader/0.1.5/Uploader.swf',
- // 文件接收服务端。
- server: path + "/projectFile/fileUpload",
- // 选择文件的按钮。可选。
- // 内部根据当前运行是创建,可能是input元素,也可能是flash.
- pick: '#picker',
- // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
- resize: false
- });
-
- // 当有文件被添加进队列的时候
- uploader.on('uploadBeforeSend', function(obj, data, headers) {
- $.extend(headers, {
- "Authorization": sessionStorage.getItem("token")
- });
- });
-
- // 当有文件被添加进队列的时候
- uploader.on( 'fileQueued', function( file ) {
- $list.append( '<div id="' + file.id + '" class="item">' +
- '<h6 class="info">' + file.name + '</h6>' +
- '<p class="state">等待上传...</p>' +
- '</div>' );
- });
-
- // 文件上传过程中创建进度条实时显示。
- uploader.on( 'uploadProgress', function( file, percentage ) {
- var $li = $( '#'+file.id ),
- $percent = $li.find('.progress .progress-bar');
- // 避免重复创建
- if ( !$percent.length ) {
- $percent = $('<div class="progress progress-striped active">' +
- '<div class="progress-bar" role="progressbar" style="width: 0%">' +
- '</div>' +
- '</div>').appendTo( $li ).find('.progress-bar');
- }
- $li.find('p.state').text('上传中');
- $percent.css( 'width', percentage * 100 + '%' );
- });
-
- uploader.on( 'uploadSuccess', function( file ,response) {
- $( '#'+file.id ).find('p.state').text('已上传');
- var fileUrls = $("#fileUrls").val();
- $("#fileUrls").val(response.data.fileUrls + "*" + fileUrls);
- });
- uploader.on( 'uploadError', function( file ) {
- $( '#'+file.id ).find('p.state').text('上传出错');
- });
- uploader.on( 'uploadComplete', function( file ) {
- $( '#'+file.id ).find('.progress').fadeOut();
- });
-
- $("#uploadbtn").click(function(){
- uploader.upload();
- });
- });
-
- function getSelect(id,value){
- if(value != null){
- var Html = "<option value='"+value.id+"' selected>" + value.realName + "</option>";
- $('#' + id).append(Html);
- //$('#' + id).select2();
- }
-
- $("#" + id).select2({
- language: "zh-CN",
- placeholder:"请输入用户姓名",//文本框的提示信息
- minimumInputLength:0, //至少输入n个字符,才去加载数据
- allowClear: true, //是否允许用户清除文本信息
- ajax:{
- url:path + "/jpAdmin/selectUser", //地址
- type: "POST",
- dataType:'json', //接收的数据类型
- delay:250,
- cache: true,
- processResults: function (data) {
- var results = data.map(function(item){
- return {
- id : item.userId,
- text : item.realName,
- userName: item.userName,
- orgName : item.orgName
- }
- });
- return {
- results: results
- }
- }
- },
- language: "zh-CN",
- templateResult: function (state) {
- var html = "<div>";
- html += "<strong>姓名:" + state.text + "</strong>(" + state.userName + ")<br/>";
- html += "单位:" + state.orgName;
- html += "</div>";
- return $(html);
- }
- });
- }
- function getSelectMany(id,userId,userName){
- $("#" + id).select2({
- language: "zh-CN",
- placeholder:"请输入用户姓名",//文本框的提示信息
- minimumInputLength:0, //至少输入n个字符,才去加载数据
- allowClear: false, //是否允许用户清除文本信息
- multiple:true,
- ajax:{
- url:path + "/jpAdmin/selectUser", //地址
- type: "POST",
- dataType:'json', //接收的数据类型
- delay:250,
- cache: true,
- processResults: function (data) {
- var results = data.map(function(item){
- return {
- id : item.userId,
- text : item.realName,
- userName: item.userName,
- orgName : item.orgName
- }
- });
- return {
- results: results
- }
- }
- },
- language: "zh-CN",
- templateResult: function (state) {
- var html = "<div>";
- html += "<strong>姓名:" + state.text + "</strong>(" + state.userName + ")<br/>";
- html += "单位:" + state.orgName;
- html += "</div>";
- return $(html);
- }
- });
-
- $("#" + id).on("select2-clearing",function(e){
- //alert(true);
- });
-
- if(userId!=null && userId.length>0){
- var ids = userId.split(",");
- var names = userName.split(",");
-
- $('option', $("#" + id)).remove();
- for(var i=0;i<ids.length;i++){
- if(ids[i] != ""){
- $("#" + id).append(new Option(names[i],ids[i], false, false));//第一个参数时id,第二个参数是text
- }
- }
- $($("#" + id)).val(ids).trigger('change');
- }
- else{
- $('option', $("#" + id)).remove();
- $($("#" + id)).val(null).trigger('change');
- }
- }
-
- function getParkList(parkId){
- $.post(path + "/park/allList",function(json){
- if(json.result){
- $.each(json.data,function(index,obj){
- if(parkId!=""){
- if(obj.parkId==parkId){
- $("#parkId").append("<option value='"+obj.parkId+"' selected>"+obj.title+"</option>")
- }else{
- $("#parkId").append("<option value='"+obj.parkId+"'>"+obj.title+"</option>")
- }
- }
- else{
- $("#parkId").append("<option value='"+obj.parkId+"'>"+obj.title+"</option>")
-
- }
- })
- }
- else{
- layer.msg(json.message);
- }
- },"json")
- }
-
- function loadFile(fileList){
- if(fileList.length > 0){
- $("#thelist").append('<h4 class="info">已上传附件</h4>');
- for(var i=0;i<fileList.length;i++){
- $("#thelist").append( '<div id="' + fileList[i].fileId + '" class="item">' +
- '<h6 class="info"><a href="' + fileList[i].realAddress + '" download = "' + fileList[i].fileName + "." + fileList[i].fileType.toLowerCase() + '" target="_blank">' + fileList[i].fileName + "." + fileList[i].fileType.toLowerCase() + '</a>' +
- '<a href="javacript:void(0);" onclick=delFile("' + fileList[i].fileId + '")>删除</a>' +
- '</h6>' +
- '</div>' );
- }
- }
- }
-
- function delFile(fileId){
- layer.confirm("是否删除?",{
- btns:["是","否"]
- },function(){
- $.post(path + "/projectFile/deleteReturnFile/" + fileId,null,function(json){
- if(json.result){
- layer.msg("删除成功!",{icon:1,time:2000});
- var fileList = json.data.fileList;
- $("#thelist").empty();
- if(fileList.length > 0){
- $("#thelist").append('<h4 class="info">已上传附件</h4>');
- for(var i=0;i<fileList.length;i++){
- $("#thelist").append( '<div id="' + fileList[i].fileId + '" class="item">' +
- '<h6 class="info"><a href="' + fileList[i].realAddress + '" download = "' + fileList[i].fileName + "." + fileList[i].fileType.toLowerCase() + '" target="_blank">' + fileList[i].fileName + "." + fileList[i].fileType.toLowerCase() + '</a>' +
- '<a href="javacript:void(0);" onclick=delFile("' + fileList[i].fileId + '")>删除</a>' +
- '</h6>' +
- '</div>' );
- }
- }
- }
- else{
- layer.msg("删除失败!" + json.message);
- }
- });
- });
- }
- </script>
- <!--/请在上方写此页面业务相关的脚本-->
- </body>
- </html>
|