|
@@ -0,0 +1,381 @@
|
|
|
+<!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">
|
|
|
+ <input id="exitTime" name="exitTime" class="input-text" style="width:180px;"
|
|
|
+ onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
|
|
|
+ <input type="hidden" class="input-text" id="status" name="status" value="8">
|
|
|
+ </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="exitRemark" name="exitRemark">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ <div class="form form-horizontal">
|
|
|
+ <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: {
|
|
|
+ exitTime: {
|
|
|
+ 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 () {
|
|
|
+ $("#status").val("8");
|
|
|
+ $("#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>
|