123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
- <jsp:include page="../../common/include.jsp" />
- <% String basePath = request.getScheme()+ "://" + request.getServerName() + ":" +request.getServerPort() + request.getContextPath(); %>
- <script type="text/javascript">
- //性别
- var templetTypeObj = null;
- var templetType_array = null;
- var editor = null;
- var editor_up = null;
- KindEditor.ready(function(K) {
- editor = K.create('#editor_content');
- editor_up = K.create('#editor_content2');
- });
- $(function() {
-
- //模板类型
- $.ajax({
- type: "post",//使用post方法访问后台
- dataType: "json",//返回json格式的数据
- url: "aa10Action_listAa10All",//要访问的后台地址
- data:{"aa10.letter":"templetType" ,"aa10.name":"模板类型" },
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- if(msg.success){
- templetTypeObj = msg.obj.rows;
- var select_arr = [];
- var data = templetTypeObj;
- for(var nItem = 0; nItem < data.length; nItem++ ){
- select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
- }
- templetType_array = select_arr.join("");
- $("#templetType").append(templetType_array);
- }
- }
- });
- $.ajax({
- type: "post",
- dataType: "json",
- url: "columnSetAction_listColumn?tname=templet",
- complete :function(){$("#load").hide();},
- success: function(msg){
- if(msg.success){
- setId();
- var data = msg.obj;
- for(var i = 0;i<data.length;i++){
- if("1"==data[i].type){
- if(typeof(data[i].formatter)!="undefined"){
- data[i].formatter=eval(data[i].formatter);
- }
- user_columns.push(data[i]);
- }else{
- user_frozenColumns.push(data[i]);
- }
- }
- columns.push(user_columns);
- frozenColumns.push(user_frozenColumns);
-
- $('#templetDataGrid').datagrid({
- rownumbers:true,
- fit:true,
- pageSize:20,
- pageList : [ 10, 20, 30, 40, 50 ],
- fitColumns:false,
- border:false,
- sortOrder:'desc',
- pagination:true,
- idField:'id',
- url:whzl.basePath + '/templetAction_List',
- toolbar:'#searchtool',
- checkOnSelect:true,
- selectOnCheck:true,
- singleSelect:true,
- showFooter: true,
- columns:columns,
- frozenColumns:frozenColumns,
- loadFilter:function(result){
- if(result.success){
- return result.obj;
- }else{
- $.messager.alert("提示",result.message);
- return ;
- }
- }
- });
- toolBar("templetDataGrid","setTempletDialog","templet");
- }
- }
- });
-
- /**合同模板信息列表**/
- /*$('#templetDataGrid').datagrid({
- rownumbers:true,
- fit:true,
- pageSize:10,
- pageList : [ 10, 20, 30, 40, 50 ],
- fitColumns:false,
- border:false,
- sortOrder:'desc',
- pagination:true,
- idField:'id',
- toolbar:'#searchtool',
- checkOnSelect:true,
- selectOnCheck:true,
- nowrap:true,
- singleSelect: true,
- loadFilter:function(result){
- if(result.success){
- return result.obj;
- }else{
- alert(result.message);
- return ;
- }
- }
- }
- );*/
-
- //searchFun();
- });
- /**查询**/
- function searchFun(){
- $("#templetDataGrid").datagrid("load", {
- "templet.title":trim($("#title").val()),
- "templet.templetType":trim($('#templetType').val())
- });
- $('#templetDataGrid').datagrid({url:whzl.basePath + '/templetAction_List',pageNumber:1});
- $('#templetDataGrid').datagrid({
- columns:columns,
- frozenColumns:frozenColumns
- });
- toolBar("templetDataGrid","setTempletDialog","templet");
-
- /*var params = encodeURI("templet.title="+ trim($("#tblQuery").find("input[id='title']").val())
- + "&templet.templetType=" + trim($("#tblQuery").find("select[id='templetType']").val())
- );
- $('#templetDataGrid').datagrid({url:whzl.basePath + '/templetAction_List?'+params,pageNumber:1});*/
- }
- /*清除查询条件**/
- function ClearQuery() {
- $("#tblQuery").find("input").val("");
- $("#tblQuery").find("select").val("-1");
- }
- /**增加功能**/
- function templetAdd(){
- $('#addTempletDialog').dialog(
- {
- buttons : [
- {
- text : '生成',
- iconCls : 'icon-ok',
- handler : function(){
- $('#addTempletForm').form('submit',
- {
- url : whzl.basePath+'/templetAction_add',
- onSubmit:function(){
- var flag = $('#addTempletForm').form('validate');
- if(flag){
- parent.$.messager.progress({
- title : '提示',
- text : '请稍候....'
- });
- }
- return flag;
- },
- success : function(result){
- var parseResult = $.parseJSON(result);
- if(parseResult.success){
- parent.$.messager.progress('close');
- $("#addTempletDialog").dialog("close");
- searchFun();
- }else{
- parent.$.messager.progress('close');
- $.messager.alert("提示",parseResult.message);
- }
- }
- }
- );
- }
- },
- {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function(){
- $("#addTempletDialog").dialog("close");
- }
- }
- ],
- onLoad : function(){
- $("#templetType_add").append(templetType_array);
- }
- }
- );
- }
- var createdByFormatter = function(value , row , index){
- return row.createUser.fullName;
- }
- /**删除**/
- var delFormatter = function(value , row , index){
- return "<img src='<%=basePath%>/images/edit_remove.png' title='删除' onclick=deleteRow(" + row.id + ") style='cursor:pointer' />";
- };
- /**删除功能**/
- function deleteRow(){
- var row = $('#templetDataGrid').datagrid('getSelected');
- if(row == null){
- $.messager.alert("提示","请先选择要修改的模板内容!");
- }
- var id = row.id;
-
- $.messager.confirm('删除提示', '确定删除这条记录吗?', function(r){
- if (r){
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "templetAction_delete",//要访问的后台地址
- data: "templet.id="+id,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- if(msg.success){
- $.messager.alert('提示','删除成功!');
- $('#templetDataGrid').datagrid('reload');
- }else{
- $.messager.alert('提示',msg.message);
- }
- }
- });
- }
- });
- }
- /**标题连接*/
- var titleFormatter = function(value , row , index)
- {
- return "<a href='javascript:' title='查看详情' onclick=templetDetails(" + row.id + ") >" + row.title + "</a>";
- };
- var templetTypeFormatter = function(value , row , index){
- var templetType = "";
- for(var nItem = 0; nItem < templetTypeObj.length; nItem++ ){
- if(templetTypeObj[nItem].code == value){
- templetType = templetTypeObj[nItem].value;
- }
- }
- return templetType;
- }
- /**详细页面对话框*/
- var templetDetails = function(id){
- $("#detailTempletDialog").dialog(
- {
- maximizable: true,
- buttons : [
- {
- text : '确定',
- iconCls : 'icon-ok',
- handler : function(){
- $("#detailTempletDialog").dialog("close");
- }
- }
- ],
- onLoad : function(){
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "templetAction_findById",//要访问的后台地址
- data: {"templet.id":id},//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- $("#title_detail").text(msg.obj.title);
- $("#content_detail").html(msg.obj.content);
- var templetType = "";
- for(var nItem = 0; nItem < templetTypeObj.length; nItem++ ){
- if(templetTypeObj[nItem].code == msg.obj.templetType){
- templetType = templetTypeObj[nItem].value;
- }
- }
- $("#templetType_detail").text(templetType);
- }
- });
- }
- }
- );
- };
- /**编辑**/
- var updateFormatter = function(value , row , index){
- return "<img src='<%=basePath%>/images/pencil.png' title='编辑' onclick=updateRow(" + row.id + ") style='cursor:pointer' />";
- };
- /**编辑功能**/
- function updateRow(){
- //var updateIndex = $('#templetDataGrid').datagrid('getRowIndex',id);
- var row = $('#templetDataGrid').datagrid('getSelected');
- if(row == null){
- $.messager.alert("提示","请先选择要修改的模板内容!");
- }
- var id = row.id;
-
- $('#updateTempletDialog').dialog(
- {
- maximizable: true,
- buttons : [
- {
- text : '提交',
- iconCls : 'icon-ok',
- handler : function(){
- $('#updateTempletForm').form('submit',
- {
- url : whzl.basePath+'/templetAction_update',
- onSubmit:function(){
- var flag = $('#updateTempletForm').form('validate');
- if(flag){
- parent.$.messager.progress({
- title : '提示',
- text : '请稍候....'
- });
- }
- return flag;
- },
- success : function(result){
- parent.$.messager.progress('close');
- var parseResult = $.parseJSON(result);
- if(parseResult.success){
- //修改完数据,更新对应行的数据
- $("#templetDataGrid").datagrid('reload');
- $("#updateTempletDialog").dialog("close");
- }else{
- parent.$.messager.progress('close');
- $.messager.alert("提示",parseResult.message);
- }
- }
- }
- );
- }
- },
- {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function(){
- $("#updateTempletDialog").dialog("close");
- }
- }
- ],
- onLoad : function(){
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "templetAction_findById",//要访问的后台地址
- data: "templet.id="+id,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- if(msg.success){
- $("#id_update").val(msg.obj.id);
- dealSelect(templetTypeObj,msg.obj.templetType,"templetType_update");
- editor_up.html(msg.obj.content);
- var json = {
- 'templet.title' : msg.obj.title
- };
- $('#updateTempletForm').form('load', json);
- }else{
- $.messager.alert("提示", msg.message);
- $("#updateTempletDialog").dialog("close");
- }
- }
- });
- }
- });
- }
-
-
- function valueReplace(v) {
- v = v.toString().replace(new RegExp('(["\"])', 'g'), "\\\"");
- return v;
- }
-
- var dateFormatter = function(value , row , index){
- return dealDate(row.createDate);
- };
- </script>
- <div class="easyui-layout" data-options="fit:true,border:false" style="margin: 0px;padding: 0px;">
- <div data-options="region:'center',border:false">
- <div id="searchtool" data-options="region:'north' , border:false">
- <table id="tblQuery" style="width:100%;">
- <tr>
- <td align="right" style="width: 10%"><span>标题</span></td>
- <td style="width: 10%">
- <input id="title" type="text"/>
- </td>
-
- <td align="right" style="width: 8%"><span>模板类型</span></td>
- <td style="width: 14%">
- <select id="templetType" onchange="searchFun();" >
- <option value="">请选择</option>
- </select>
- </td>
-
- <td style="width: 58%">
- <a href="javascript:searchFun();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查询</a>
- <a href="javascript:ClearQuery();" class="easyui-linkbutton" data-options="iconCls:'icon-emptied',plain:true">清空</a>
- <a href="javascript:templetAdd();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">增加</a>
- <a href="javascript:updateRow();" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">修改</a>
- <a href="javascript:deleteRow();" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">删除</a>
- </td>
- </tr>
- </table>
- </div>
-
- <table id="templetDataGrid">
- <!--<thead frozen="true">
- <tr>
- <th data-options="field:'id',checkbox:true,width:50">ID</th>
- </tr>
- </thead>
- <thead>
- <tr>
- <th data-options="field:'title',sortable:false,width:250,formatter:titleFormatter">标题</th>
- <th data-options="field:'createdBy',width:80">创建人</th>
- <th data-options="field:'createdOn',width:140">创建时间</th>
- <th data-options="field:'templetType',width:140,formatter:templetTypeFormatter">模板类型</th>
- <th data-options="field:'update',align:'center',formatter:updateFormatter,width:50">编辑</th>
- <th data-options="field:'del',align:'center',formatter:delFormatter,width:50">删除</th>
- </tr>
- </thead>-->
- </table>
- </div>
- </div>
- <div id="addTempletDialog" data-options="title:' 新增合同模板信息',iconCls:'icon-edit',width:800,height:400,modal:true,href:'<%=basePath %>/templetAction_toAdd'">
- </div>
- <div id="detailTempletDialog" data-options="title:' 合同模板详细信息',iconCls:'icon-details',width:800,height:400,modal:true,href:'<%=basePath %>/templetAction_toDetail'">
- </div>
- <div id="updateTempletDialog" data-options="title:' 更新合同模板信息',iconCls:'icon-edit',width:800,height:400,modal:true,href:'<%=basePath %>/templetAction_toUpdate'">
- </div>
- <div id="setTempletDialog" data-options="title:' 个性化设置',iconCls:'icon-cog',width:500,height:370,modal:true,href:'<%=basePath %>/columnSetAction_toSet?tname=templet'">
- </div>
- <script type="text/javascript">
- <!--
- $(function(){
- parent.$.messager.progress('close');
- });
- //-->
- </script>
|