修改优化
This commit is contained in:
parent
62fff0da7b
commit
a8abd8e55f
|
@ -204,9 +204,6 @@ public class NdNewController extends BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtils.isNull(ndNew.getPublishTime())){
|
|
||||||
ndNew.setPublishTime(new Date());
|
|
||||||
}
|
|
||||||
// ndNew.setAbstracts(stripHtml(ndNew.getContent()));
|
// ndNew.setAbstracts(stripHtml(ndNew.getContent()));
|
||||||
return toAjax(ndNewService.updateNdNew(ndNew));
|
return toAjax(ndNewService.updateNdNew(ndNew));
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.portal.back.controller;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.portal.back.domain.NdNew;
|
||||||
import com.ruoyi.portal.back.domain.NdNewType;
|
import com.ruoyi.portal.back.domain.NdNewType;
|
||||||
import com.ruoyi.portal.back.service.INdNewTypeService;
|
import com.ruoyi.portal.back.service.INdNewTypeService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
@ -143,6 +144,13 @@ public class NdNewTypeController extends BaseController
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(value = { "/selectTypeNewTree" })
|
||||||
|
public String selectTypeNewTree( ModelMap mmap)
|
||||||
|
{
|
||||||
|
return prefix + "/tree2";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载新闻类型树列表
|
* 加载新闻类型树列表
|
||||||
*/
|
*/
|
||||||
|
@ -155,4 +163,13 @@ public class NdNewTypeController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/treeData2")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> treeData2(NdNew ndNew)
|
||||||
|
{
|
||||||
|
List<Ztree> ztrees = ndNewTypeService.selectNdNewTypeTree2(ndNew);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.portal.back.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
|
import com.ruoyi.portal.back.domain.NdNew;
|
||||||
import com.ruoyi.portal.back.domain.NdNewType;
|
import com.ruoyi.portal.back.domain.NdNewType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,4 +67,6 @@ public interface INdNewTypeService
|
||||||
* @return 所有新闻类型信息
|
* @return 所有新闻类型信息
|
||||||
*/
|
*/
|
||||||
public List<Ztree> selectNdNewTypeTree();
|
public List<Ztree> selectNdNewTypeTree();
|
||||||
|
|
||||||
|
List<Ztree> selectNdNewTypeTree2(NdNew ndNew);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package com.ruoyi.portal.back.service.impl;
|
package com.ruoyi.portal.back.service.impl;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.portal.back.domain.NdNew;
|
||||||
import com.ruoyi.portal.back.domain.NdNewType;
|
import com.ruoyi.portal.back.domain.NdNewType;
|
||||||
|
import com.ruoyi.portal.back.mapper.NdNewMapper;
|
||||||
import com.ruoyi.portal.back.mapper.NdNewTypeMapper;
|
import com.ruoyi.portal.back.mapper.NdNewTypeMapper;
|
||||||
import com.ruoyi.portal.back.service.INdNewTypeService;
|
import com.ruoyi.portal.back.service.INdNewTypeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -22,6 +26,8 @@ public class NdNewTypeServiceImpl implements INdNewTypeService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private NdNewTypeMapper ndNewTypeMapper;
|
private NdNewTypeMapper ndNewTypeMapper;
|
||||||
|
@Autowired
|
||||||
|
private NdNewMapper ndNewMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询新闻类型
|
* 查询新闻类型
|
||||||
|
@ -118,4 +124,30 @@ public class NdNewTypeServiceImpl implements INdNewTypeService
|
||||||
}
|
}
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Ztree> selectNdNewTypeTree2(NdNew ndNew) {
|
||||||
|
List<NdNewType> ndNewTypeList = ndNewTypeMapper.selectNdNewTypeList(new NdNewType());
|
||||||
|
|
||||||
|
String newTypeIdd[] = ndNew.getNewType().split(",");
|
||||||
|
|
||||||
|
List<Ztree> ztrees = new ArrayList<Ztree>();
|
||||||
|
for (NdNewType ndNewType : ndNewTypeList)
|
||||||
|
{
|
||||||
|
Ztree ztree = new Ztree();
|
||||||
|
ztree.setId(ndNewType.getId());
|
||||||
|
ztree.setpId(ndNewType.getParentId());
|
||||||
|
ztree.setName(ndNewType.getName());
|
||||||
|
ztree.setTitle(ndNewType.getName());
|
||||||
|
ztrees.add(ztree);
|
||||||
|
if(newTypeIdd.length>0){
|
||||||
|
for(int i=0;i<newTypeIdd.length;i++){
|
||||||
|
if(StringUtils.equals(newTypeIdd[i],ndNewType.getId()+"")){
|
||||||
|
ztree.setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,6 +172,16 @@ public class SysDeptController extends BaseController
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(value = { "/selectDeptTree2/{deptId}", "/selectDeptTree2/{deptId}/{excludeId}" })
|
||||||
|
public String selectDeptTree2(@PathVariable("deptId") Long deptId,
|
||||||
|
@PathVariable(value = "excludeId", required = false) Long excludeId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dept", deptService.selectDeptById(deptId));
|
||||||
|
mmap.put("excludeId", excludeId);
|
||||||
|
return prefix + "/tree2";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载部门列表树(排除下级)
|
* 加载部门列表树(排除下级)
|
||||||
*/
|
*/
|
||||||
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
|
@ -381,12 +381,12 @@ html {
|
||||||
|
|
||||||
.details_title h2 {
|
.details_title h2 {
|
||||||
margin: 1.6rem 0rem .8rem 0rem;
|
margin: 1.6rem 0rem .8rem 0rem;
|
||||||
font-family: PingFangSC-Semibold;
|
font-family: SourceHanSerifCN-Bold !important;
|
||||||
color: #1c1c1c;
|
color: #1c1c1c;
|
||||||
letter-spacing: .0192rem;
|
letter-spacing: .0192rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: none;
|
border: none;
|
||||||
font-size: 1.2rem;
|
font-size:1.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.details_title ul {
|
.details_title ul {
|
||||||
|
@ -402,7 +402,7 @@ html {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
line-height: 1.2rem;
|
line-height: 1.2rem;
|
||||||
font-size: .86rem;
|
font-size: .7rem;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,10 @@ src:url("../fonts/bdzy.woff2") format("woff2"),
|
||||||
url("../fonts/bdzy.woff") format("woff");
|
url("../fonts/bdzy.woff") format("woff");
|
||||||
font-weight:400;
|
font-weight:400;
|
||||||
font-style:normal}
|
font-style:normal}
|
||||||
|
@font-face{font-family: 'FZXBSJW';
|
||||||
|
src: url('../fonts/FZXBSJW.TTF') format("true");
|
||||||
|
font-weight:normal;
|
||||||
|
font-style:normal}
|
||||||
@font-face{font-family:"SourceHanSerifCN-Bold";
|
@font-face{font-family:"SourceHanSerifCN-Bold";
|
||||||
src:url("../fonts/SourceHanSerifCN-Bold.woff2") format("woff2"),
|
src:url("../fonts/SourceHanSerifCN-Bold.woff2") format("woff2"),
|
||||||
url("../fonts/SourceHanSerifCN-Bold.woff") format("woff");
|
url("../fonts/SourceHanSerifCN-Bold.woff") format("woff");
|
||||||
|
@ -117,6 +121,7 @@ h2,h3{page-break-after:avoid}
|
||||||
::-moz-selection{background:#0662d4;color:#fff}
|
::-moz-selection{background:#0662d4;color:#fff}
|
||||||
::-webkit-selection{background:#0662d4;color:#fff}
|
::-webkit-selection{background:#0662d4;color:#fff}
|
||||||
*/
|
*/
|
||||||
|
.newimg{width:20px; height:20px;margin-top:9px;margin-right:8px;}
|
||||||
.clearfix:after{clear:both;display:block;visibility:hidden;overflow:hidden;height:0;content:"."}
|
.clearfix:after{clear:both;display:block;visibility:hidden;overflow:hidden;height:0;content:"."}
|
||||||
.l{float:left}
|
.l{float:left}
|
||||||
.r{float:right}
|
.r{float:right}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
|
@ -5,23 +5,15 @@
|
||||||
<th:block th:include="include :: datetimepicker-css" />
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||||
<th:block th:include="include :: summernote-css" />
|
<th:block th:include="include :: summernote-css" />
|
||||||
|
<th:block th:include="include :: ztree-css" />
|
||||||
</head>
|
</head>
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-new-add">
|
<form class="form-horizontal m" id="form-new-add">
|
||||||
<div id="element" class="form-group">
|
<div id="element" class="form-group">
|
||||||
<label class="col-sm-3 control-label">栏目类型:</label>
|
<label class="col-sm-3 control-label">栏目类型:</label>
|
||||||
<div class="col-sm-4">
|
<input name="newType" id="newType" type="hidden" class="form-control" required></input>
|
||||||
<select class="form-control" name="firstType" id="firstType" th:onchange="handleFirst()">
|
<div id="tree" class="col-sm-8 ztree treeselect" style="height:200px;overflow-y:auto;" ></div>
|
||||||
<option value="">请选择</option>
|
|
||||||
<option th:value="${item.v}" th:each="item : ${data}">[[${item.n}]]</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<select class="form-control" name="newType" id="newType" th:onchange="handleSecond()">
|
|
||||||
<option value="">请选择</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" id="col1">
|
<div class="form-group" id="col1">
|
||||||
<label class="col-sm-3 control-label">内容类型:</label>
|
<label class="col-sm-3 control-label">内容类型:</label>
|
||||||
|
@ -93,18 +85,89 @@
|
||||||
<th:block th:include="include :: datetimepicker-js" />
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||||
<th:block th:include="include :: summernote-js" />
|
<th:block th:include="include :: summernote-js" />
|
||||||
|
<th:block th:include="include :: ztree-js" />
|
||||||
<!-- <th:block th:include="include :: jquery-cxselect-js" />-->
|
<!-- <th:block th:include="include :: jquery-cxselect-js" />-->
|
||||||
<!-- <script th:src="@{/ajax/libs/cxselect/jquery.cxselect.js}"></script>-->
|
<!-- <script th:src="@{/ajax/libs/cxselect/jquery.cxselect.js}"></script>-->
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
||||||
|
|
||||||
var prefix = ctx + "back/news/news"
|
var prefix = ctx + "back/news/news"
|
||||||
|
var prefix2 = ctx + "back/news/type"
|
||||||
function submitHandler() {
|
function submitHandler() {
|
||||||
if ($.validate.form()) {
|
if ($.validate.form()) {
|
||||||
$.operate.save(prefix + "/add", $('#form-new-add').serialize());
|
$.operate.save(prefix + "/add", $('#form-new-add').serialize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*部门管理-新增-选择父部门树*/
|
||||||
|
function selectDeptTree() {
|
||||||
|
var options = {
|
||||||
|
title: '文章分类选择',
|
||||||
|
width: "380",
|
||||||
|
url: prefix2 + "/selectTypeNewTree",
|
||||||
|
callBack: doSubmit,
|
||||||
|
};
|
||||||
|
$.modal.openOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var url = ctx + "back/news/type/treeData";
|
||||||
|
var options = {
|
||||||
|
url: url,
|
||||||
|
expandLevel: 1,
|
||||||
|
onCheck : zOnCheck,
|
||||||
|
check: { enable: true, chkStyle: "checkbox" },
|
||||||
|
};
|
||||||
|
$.tree.init(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 全局变量
|
||||||
|
var checks = "";
|
||||||
|
// 复选框调用
|
||||||
|
function zOnCheck(event, treeId, treeNode) {
|
||||||
|
if (treeNode.checked) {//如果是选中节点
|
||||||
|
if (treeNode.isParent) {//如果选中的是父节点
|
||||||
|
//获取选中的父节点的所有子节点
|
||||||
|
var childrenNodes = treeNode.children;
|
||||||
|
for (var i = 0; i < childrenNodes.length; i++) {
|
||||||
|
checks = checks +childrenNodes[i].id+",";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
checks = checks +treeNode.id+",";
|
||||||
|
}
|
||||||
|
} else {//如果是取消选中
|
||||||
|
if (treeNode.isParent) {//如果取消的是父节点
|
||||||
|
//获取父节点的所有子节点,并移除取消项
|
||||||
|
var childrenNodes = treeNode.children;
|
||||||
|
for (var i = 0; i < childrenNodes.length; i++) {
|
||||||
|
removeCheck(childrenNodes[i].id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
removeCheck(treeNode.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("checks",checks)
|
||||||
|
$("#newType").val(checks);
|
||||||
|
if(checks=='48' || checks=='48,'){
|
||||||
|
handleSecond();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 移除元素
|
||||||
|
function removeCheck(chkid) {
|
||||||
|
console.log("removeCheck",chkid)
|
||||||
|
checks = checks.replace(chkid+",","");
|
||||||
|
console.log("checks",checks)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function doSubmit(index, layero){
|
||||||
|
var body = $.modal.getChildFrame(index);
|
||||||
|
console.log('treeId-=-->',body.find('#treeId'))
|
||||||
|
|
||||||
|
$.modal.close(index);
|
||||||
|
}
|
||||||
|
|
||||||
function handleFirst(){
|
function handleFirst(){
|
||||||
var record = document.getElementById("firstType").value;
|
var record = document.getElementById("firstType").value;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -128,7 +191,7 @@
|
||||||
|
|
||||||
function handleSecond(){
|
function handleSecond(){
|
||||||
var record = document.getElementById("newType").value;
|
var record = document.getElementById("newType").value;
|
||||||
if(record == '48'){
|
if(record == '48' || record == '48,'){
|
||||||
$("#col1").css("display","none");
|
$("#col1").css("display","none");
|
||||||
$("#col3").css("display","none");
|
$("#col3").css("display","none");
|
||||||
$("#contentDiv").css("display","none");
|
$("#contentDiv").css("display","none");
|
||||||
|
|
|
@ -1,268 +1,316 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<th:block th:include="include :: header('修改栏目')" />
|
<th:block th:include="include :: header('修改栏目')"/>
|
||||||
<th:block th:include="include :: datetimepicker-css" />
|
<th:block th:include="include :: datetimepicker-css"/>
|
||||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||||
<th:block th:include="include :: summernote-css" />
|
<th:block th:include="include :: summernote-css"/>
|
||||||
|
<th:block th:include="include :: ztree-css"/>
|
||||||
</head>
|
</head>
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-new-edit" th:object="${ndNew}">
|
<form class="form-horizontal m" id="form-new-edit" th:object="${ndNew}">
|
||||||
<input name="id" th:field="*{id}" type="hidden">
|
<input name="id" th:field="*{id}" type="hidden">
|
||||||
<div id="element" class="form-group">
|
<div id="element" class="form-group">
|
||||||
<label class="col-sm-3 control-label">栏目类型:</label>
|
<label class="col-sm-3 control-label">栏目类型:</label>
|
||||||
<div class="col-sm-4">
|
|
||||||
<select class="form-control" name="firstType" id="firstType" th:onchange="handleFirst('')">
|
<input name="newType" id="newType" type="hidden" class="form-control" th:field="*{newType}"
|
||||||
<option th:value="${item.v}" th:each="item : ${data}">[[${item.n}]]</option>
|
required></input>
|
||||||
</select>
|
<div id="tree" class="col-sm-8 ztree treeselect" style="height:200px;overflow-y:auto;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="form-group" id="col1">
|
||||||
<select class="form-control" name="newType" id="newType" th:onchange="handleSecond('')">
|
<label class="col-sm-3 control-label">内容类型:</label>
|
||||||
</select>
|
<div class="col-sm-8">
|
||||||
|
<div class="radio-box" th:each="dict : ${@dict.getType('news_content_type')}">
|
||||||
|
<input type="radio" th:id="${'type_' + dict.dictCode}" name="type" th:value="${dict.dictValue}"
|
||||||
|
th:field="*{type}" th:onchange="'javascript:handleRadioChange()'">
|
||||||
|
<label th:for="${'type_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" id="col1">
|
</div>
|
||||||
<label class="col-sm-3 control-label">内容类型:</label>
|
<div class="form-group">
|
||||||
<div class="col-sm-8">
|
<label class="col-sm-3 control-label">标题:</label>
|
||||||
<div class="radio-box" th:each="dict : ${@dict.getType('news_content_type')}">
|
<div class="col-sm-8">
|
||||||
<input type="radio" th:id="${'type_' + dict.dictCode}" name="type" th:value="${dict.dictValue}" th:field="*{type}" th:onchange="'javascript:handleRadioChange()'">
|
<input name="title" th:field="*{title}" class="form-control" required>
|
||||||
<label th:for="${'type_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">来源或作者:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="sourceAuthor" th:field="*{sourceAuthor}" class="form-control" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="form-group">-->
|
||||||
|
<!-- <label class="col-sm-3 control-label">发布时间:</label>-->
|
||||||
|
<!-- <div class="col-sm-8">-->
|
||||||
|
<!-- <div class="input-group date">-->
|
||||||
|
<!-- <input name="publishTime" th:value="${#dates.format(ndNew.publishTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
|
||||||
|
<!-- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<div id="contentDiv" class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">内容:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="hidden" class="form-control" th:field="*{content}">
|
||||||
|
<div class="summernote" id="content"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="linkUrlDiv" class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">超链接:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<textarea name="linkUrl" type="url" class="form-control">[[*{linkUrl}]]</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" id="col3">
|
||||||
|
<label class="col-sm-3 control-label">缩略图:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="hidden" name="imagePath" th:field="*{imagePath}">
|
||||||
|
<div class="file-loading">
|
||||||
|
<input class="form-control file-upload" id="imagePath" name="file" type="file" accept="image/*">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label class="col-sm-3 control-label">标题:</label>
|
<div class="form-group">
|
||||||
<div class="col-sm-8">
|
<label class="col-sm-3 control-label">附件:</label>
|
||||||
<input name="title" th:field="*{title}" class="form-control" required>
|
<div class="col-sm-8">
|
||||||
|
<input type="hidden" name="filePath" th:field="*{filePath}">
|
||||||
|
<div class="file-loading">
|
||||||
|
<input class="form-control file-uploadb" id="filePath" name="file" type="file" accept="*" multiple>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label class="col-sm-3 control-label">来源或作者:</label>
|
</form>
|
||||||
<div class="col-sm-8">
|
</div>
|
||||||
<input name="sourceAuthor" th:field="*{sourceAuthor}" class="form-control" type="text">
|
<th:block th:include="include :: footer"/>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="form-group">-->
|
|
||||||
<!-- <label class="col-sm-3 control-label">发布时间:</label>-->
|
|
||||||
<!-- <div class="col-sm-8">-->
|
|
||||||
<!-- <div class="input-group date">-->
|
|
||||||
<!-- <input name="publishTime" th:value="${#dates.format(ndNew.publishTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
|
|
||||||
<!-- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<div id="contentDiv" class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">内容:</label>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input type="hidden" class="form-control" th:field="*{content}">
|
|
||||||
<div class="summernote" id="content"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="linkUrlDiv" class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">超链接:</label>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<textarea name="linkUrl" type="url" class="form-control">[[*{linkUrl}]]</textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group" id="col3">
|
|
||||||
<label class="col-sm-3 control-label">缩略图:</label>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input type="hidden" name="imagePath" th:field="*{imagePath}">
|
|
||||||
<div class="file-loading">
|
|
||||||
<input class="form-control file-upload" id="imagePath" name="file" type="file" accept="image/*">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">附件:</label>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input type="hidden" name="filePath" th:field="*{filePath}">
|
|
||||||
<div class="file-loading">
|
|
||||||
<input class="form-control file-uploadb" id="filePath" name="file" type="file" accept="*" multiple>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<th:block th:include="include :: footer" />
|
|
||||||
<!-- <th:block th:include="include :: jquery-min-js" />-->
|
<!-- <th:block th:include="include :: jquery-min-js" />-->
|
||||||
<th:block th:include="include :: datetimepicker-js" />
|
<th:block th:include="include :: datetimepicker-js"/>
|
||||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||||
<th:block th:include="include :: summernote-js" />
|
<th:block th:include="include :: summernote-js"/>
|
||||||
|
<th:block th:include="include :: ztree-js"/>
|
||||||
<!-- <th:block th:include="include :: jquery-cxselect-js" />-->
|
<!-- <th:block th:include="include :: jquery-cxselect-js" />-->
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
||||||
var prefix = ctx + "back/news/news";
|
var ndNew = [[${ndNew}]];
|
||||||
$("#form-new-edit").validate({
|
var prefix = ctx + "back/news/news";
|
||||||
focusCleanup: true
|
$("#form-new-edit").validate({
|
||||||
});
|
focusCleanup: true
|
||||||
|
});
|
||||||
|
|
||||||
function submitHandler() {
|
function submitHandler() {
|
||||||
if ($.validate.form()) {
|
if ($.validate.form()) {
|
||||||
$.operate.save(prefix + "/edit", $('#form-new-edit').serialize());
|
$.operate.save(prefix + "/edit", $('#form-new-edit').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var url = ctx + "back/news/type/treeData2?newType=" + ndNew.newType;
|
||||||
|
var options = {
|
||||||
|
id: "tree",
|
||||||
|
url: url,
|
||||||
|
expandLevel: 1,
|
||||||
|
onCheck : zOnCheck,
|
||||||
|
check: { enable: true, chkStyle: "checkbox" },
|
||||||
|
};
|
||||||
|
$.tree.init(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 全局变量
|
||||||
|
var checks = "";
|
||||||
|
// 复选框调用
|
||||||
|
function zOnCheck(event, treeId, treeNode) {
|
||||||
|
if (treeNode.checked) {//如果是选中节点
|
||||||
|
if (treeNode.isParent) {//如果选中的是父节点
|
||||||
|
//获取选中的父节点的所有子节点
|
||||||
|
var childrenNodes = treeNode.children;
|
||||||
|
for (var i = 0; i < childrenNodes.length; i++) {
|
||||||
|
checks = checks +childrenNodes[i].id+",";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
checks = checks +treeNode.id+",";
|
||||||
|
}
|
||||||
|
} else {//如果是取消选中
|
||||||
|
if (treeNode.isParent) {//如果取消的是父节点
|
||||||
|
//获取父节点的所有子节点,并移除取消项
|
||||||
|
var childrenNodes = treeNode.children;
|
||||||
|
for (var i = 0; i < childrenNodes.length; i++) {
|
||||||
|
removeCheck(childrenNodes[i].id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
removeCheck(treeNode.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log("checks",checks)
|
||||||
|
$("#newType").val(checks);
|
||||||
|
}
|
||||||
|
// 移除元素
|
||||||
|
function removeCheck(chkid) {
|
||||||
|
console.log("removeCheck",chkid)
|
||||||
|
checks = checks.replace(chkid+",","");
|
||||||
|
console.log("checks",checks)
|
||||||
|
}
|
||||||
|
|
||||||
async function handleFirst(newType){
|
async function handleFirst(newType){
|
||||||
var record = document.getElementById("firstType").value;
|
var record = document.getElementById("firstType").value;
|
||||||
await $.ajax({
|
await $.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/back/news/news/getNewType",
|
url: "/back/news/news/getNewType",
|
||||||
data: {
|
data: {
|
||||||
"id": record,
|
"id": record,
|
||||||
"fragment":'fragment-tasklist'
|
"fragment":'fragment-tasklist'
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
console.log('2222->',data);
|
||||||
|
var rows = data.rows;
|
||||||
|
var optionhtml = `<option value="">请选择</option>`;
|
||||||
|
for(var i = 0; i < rows.length; i++) {
|
||||||
|
optionhtml += `<option value="${rows[i].v}">${rows[i].n}</option>`;
|
||||||
|
}
|
||||||
|
document.getElementById("newType").innerHTML = optionhtml;
|
||||||
|
if(newType){
|
||||||
|
document.getElementById("newType").value = newType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSecond(newType){
|
||||||
|
var record = document.getElementById("newType").value;
|
||||||
|
if(newType!=''){
|
||||||
|
record = newType;
|
||||||
|
}
|
||||||
|
if(record == '48'||record == '48,'){
|
||||||
|
$("#col1").css("display","none");
|
||||||
|
$("#col3").css("display","none");
|
||||||
|
$("#contentDiv").css("display","none");
|
||||||
|
$("#linkUrlDiv").css("display","none");
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$("#col1").css("display","block");
|
||||||
|
$("#col3").css("display","block");
|
||||||
|
$("#contentDiv").css("display","block");
|
||||||
|
$("#linkUrlDiv").css("display","block");
|
||||||
|
handleRadioChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
// 直接返回获取
|
||||||
|
// var data = [[${data}]];
|
||||||
|
// $('#element').cxSelect({
|
||||||
|
// selects: ['first', 'second'],
|
||||||
|
// jsonValue: 'v',
|
||||||
|
// data: data
|
||||||
|
// });
|
||||||
|
// document.getElementById("firstType").value =ndNew.firstType;
|
||||||
|
// handleFirst(ndNew.newType);
|
||||||
|
handleSecond(ndNew.newType)
|
||||||
|
$('.summernote').each(function(i) {
|
||||||
|
$('#' + this.id).summernote({
|
||||||
|
lang: 'zh-CN',
|
||||||
|
dialogsInBody: true,
|
||||||
|
height: '300px',
|
||||||
|
callbacks: {
|
||||||
|
onChange: function(contents, $edittable) {
|
||||||
|
$("input[name='" + this.id + "']").val(contents);
|
||||||
},
|
},
|
||||||
success: function(data) {
|
onImageUpload: function(files) {
|
||||||
console.log('2222->',data);
|
var obj = this;
|
||||||
var rows = data.rows;
|
var data = new FormData();
|
||||||
var optionhtml = `<option value="">请选择</option>`;
|
data.append("file", files[0]);
|
||||||
for(var i = 0; i < rows.length; i++) {
|
$.ajax({
|
||||||
optionhtml += `<option value="${rows[i].v}">${rows[i].n}</option>`;
|
type: "post",
|
||||||
}
|
url: ctx + "common/upload",
|
||||||
document.getElementById("newType").innerHTML = optionhtml;
|
data: data,
|
||||||
if(newType){
|
cache: false,
|
||||||
document.getElementById("newType").value = newType;
|
contentType: false,
|
||||||
}
|
processData: false,
|
||||||
}
|
dataType: 'json',
|
||||||
});
|
success: function(result) {
|
||||||
}
|
if (result.code == web_status.SUCCESS) {
|
||||||
|
$('#' + obj.id).summernote('insertImage', result.url);
|
||||||
function handleSecond(newType){
|
} else {
|
||||||
var record = document.getElementById("newType").value;
|
$.modal.alertError(result.msg);
|
||||||
if(newType!=''){
|
|
||||||
record = newType;
|
|
||||||
}
|
|
||||||
if(record == '48'){
|
|
||||||
$("#col1").css("display","none");
|
|
||||||
$("#col3").css("display","none");
|
|
||||||
$("#contentDiv").css("display","none");
|
|
||||||
$("#linkUrlDiv").css("display","none");
|
|
||||||
|
|
||||||
}else{
|
|
||||||
$("#col1").css("display","block");
|
|
||||||
$("#col3").css("display","block");
|
|
||||||
$("#contentDiv").css("display","block");
|
|
||||||
$("#linkUrlDiv").css("display","block");
|
|
||||||
handleRadioChange();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
var ndNew = [[${ndNew}]];
|
|
||||||
// 直接返回获取
|
|
||||||
// var data = [[${data}]];
|
|
||||||
// $('#element').cxSelect({
|
|
||||||
// selects: ['first', 'second'],
|
|
||||||
// jsonValue: 'v',
|
|
||||||
// data: data
|
|
||||||
// });
|
|
||||||
document.getElementById("firstType").value =ndNew.firstType;
|
|
||||||
handleFirst(ndNew.newType);
|
|
||||||
handleSecond(ndNew.newType)
|
|
||||||
$('.summernote').each(function(i) {
|
|
||||||
$('#' + this.id).summernote({
|
|
||||||
lang: 'zh-CN',
|
|
||||||
dialogsInBody: true,
|
|
||||||
height: '300px',
|
|
||||||
callbacks: {
|
|
||||||
onChange: function(contents, $edittable) {
|
|
||||||
$("input[name='" + this.id + "']").val(contents);
|
|
||||||
},
|
|
||||||
onImageUpload: function(files) {
|
|
||||||
var obj = this;
|
|
||||||
var data = new FormData();
|
|
||||||
data.append("file", files[0]);
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: ctx + "common/upload",
|
|
||||||
data: data,
|
|
||||||
cache: false,
|
|
||||||
contentType: false,
|
|
||||||
processData: false,
|
|
||||||
dataType: 'json',
|
|
||||||
success: function(result) {
|
|
||||||
if (result.code == web_status.SUCCESS) {
|
|
||||||
$('#' + obj.id).summernote('insertImage', result.url);
|
|
||||||
} else {
|
|
||||||
$.modal.alertError(result.msg);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(error) {
|
|
||||||
$.modal.alertWarning("图片上传失败。");
|
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
}
|
error: function(error) {
|
||||||
|
$.modal.alertWarning("图片上传失败。");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
var content = $("input[name='" + this.id + "']").val();
|
});
|
||||||
$('#' + this.id).summernote('code', content);
|
var content = $("input[name='" + this.id + "']").val();
|
||||||
|
$('#' + this.id).summernote('code', content);
|
||||||
|
})
|
||||||
|
|
||||||
|
$("input[name='publishTime']").datetimepicker({
|
||||||
|
format: "yyyy-mm-dd",
|
||||||
|
minView: "month",
|
||||||
|
autoclose: true
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".file-upload").each(function (i) {
|
||||||
|
var val = $("input[name='" + this.id + "']").val()
|
||||||
|
$(this).fileinput({
|
||||||
|
'uploadUrl': ctx + 'common/upload',
|
||||||
|
initialPreviewAsData: true,
|
||||||
|
initialPreview: [val],
|
||||||
|
maxFileCount: 1,
|
||||||
|
autoReplace: true
|
||||||
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||||
|
}).on('fileremoved', function (event, id, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||||
})
|
})
|
||||||
|
$(this).fileinput('_initFileActions');
|
||||||
$("input[name='publishTime']").datetimepicker({
|
});
|
||||||
format: "yyyy-mm-dd",
|
|
||||||
minView: "month",
|
|
||||||
autoclose: true
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".file-upload").each(function (i) {
|
|
||||||
var val = $("input[name='" + this.id + "']").val()
|
|
||||||
$(this).fileinput({
|
|
||||||
'uploadUrl': ctx + 'common/upload',
|
|
||||||
initialPreviewAsData: true,
|
|
||||||
initialPreview: [val],
|
|
||||||
maxFileCount: 1,
|
|
||||||
autoReplace: true
|
|
||||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
|
||||||
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
|
||||||
}).on('fileremoved', function (event, id, index) {
|
|
||||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
|
||||||
})
|
|
||||||
$(this).fileinput('_initFileActions');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$(".file-uploadb").each(function (i) {
|
$(".file-uploadb").each(function (i) {
|
||||||
var val = $("input[name='" + this.id + "']").val()
|
var val = $("input[name='" + this.id + "']").val()
|
||||||
$(this).fileinput({
|
$(this).fileinput({
|
||||||
'uploadUrl': ctx + 'common/upload',
|
'uploadUrl': ctx + 'common/upload',
|
||||||
initialPreviewAsData: true,
|
initialPreviewAsData: true,
|
||||||
initialPreview: [val],
|
initialPreview: [val],
|
||||||
maxFileCount: 10,
|
maxFileCount: 10,
|
||||||
autoReplace: true
|
autoReplace: true
|
||||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||||
var inputaaa = $("input[name='" + event.currentTarget.id + "']").val();
|
var inputaaa = $("input[name='" + event.currentTarget.id + "']").val();
|
||||||
$("input[name='" + event.currentTarget.id + "']").val(inputaaa+"|"+data.response.url)
|
$("input[name='" + event.currentTarget.id + "']").val(inputaaa+"|"+data.response.url)
|
||||||
}).on('fileremoved', function (event, id, index) {
|
}).on('fileremoved', function (event, id, index) {
|
||||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||||
})
|
})
|
||||||
$(this).fileinput('_initFileActions');
|
$(this).fileinput('_initFileActions');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleRadioChange() {
|
function handleRadioChange() {
|
||||||
var radios = document.getElementsByName("type");
|
var radios = document.getElementsByName("type");
|
||||||
for (var i = 0; i < radios.length; i++) {
|
for (var i = 0; i < radios.length; i++) {
|
||||||
if (radios[i].checked) {
|
if (radios[i].checked) {
|
||||||
if(radios[i].value == 1){
|
if(radios[i].value == 1){
|
||||||
$("#contentDiv").show();
|
$("#contentDiv").show();
|
||||||
$("#linkUrlDiv").hide();
|
$("#linkUrlDiv").hide();
|
||||||
}
|
}
|
||||||
if(radios[i].value == 2){
|
if(radios[i].value == 2){
|
||||||
$("#contentDiv").hide();
|
$("#contentDiv").hide();
|
||||||
$("#linkUrlDiv").show();
|
$("#linkUrlDiv").show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleRadioChange();
|
handleRadioChange();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!-- <script th:src="@{/ajax/libs/cxselect/jquery.cxselect.js}"></script>-->
|
<!-- <script th:src="@{/ajax/libs/cxselect/jquery.cxselect.js}"></script>-->
|
||||||
<script th:src="@{/ajax/libs/cxselect/jquery.cxselect.js}"></script>
|
<script th:src="@{/ajax/libs/cxselect/jquery.cxselect.js}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,10 +1,11 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<th:block th:include="include :: header('修改栏目')" />
|
<th:block th:include="include :: header('修改栏目')"/>
|
||||||
<th:block th:include="include :: datetimepicker-css" />
|
<th:block th:include="include :: datetimepicker-css"/>
|
||||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||||
<th:block th:include="include :: summernote-css" />
|
<th:block th:include="include :: summernote-css"/>
|
||||||
|
<th:block th:include="include :: ztree-css"/>
|
||||||
</head>
|
</head>
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
@ -12,21 +13,17 @@
|
||||||
<input name="id" th:field="*{id}" type="hidden">
|
<input name="id" th:field="*{id}" type="hidden">
|
||||||
<div id="element" class="form-group">
|
<div id="element" class="form-group">
|
||||||
<label class="col-sm-3 control-label">栏目类型:</label>
|
<label class="col-sm-3 control-label">栏目类型:</label>
|
||||||
<div class="col-sm-4">
|
|
||||||
<select class="form-control" name="firstType" id="firstType" th:onchange="handleFirst('')">
|
<input name="newType" id="newType" type="hidden" class="form-control" th:field="*{newType}"
|
||||||
<option th:value="${item.v}" th:each="item : ${data}">[[${item.n}]]</option>
|
required></input>
|
||||||
</select>
|
<div id="tree" class="col-sm-8 ztree treeselect" style="height:200px;overflow-y:auto;"></div>
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<select class="form-control" name="newType" id="newType" th:onchange="handleSecond('')">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" id="col1">
|
<div class="form-group" id="col1">
|
||||||
<label class="col-sm-3 control-label">内容类型:</label>
|
<label class="col-sm-3 control-label">内容类型:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="radio-box" th:each="dict : ${@dict.getType('news_content_type')}">
|
<div class="radio-box" th:each="dict : ${@dict.getType('news_content_type')}">
|
||||||
<input type="radio" th:id="${'type_' + dict.dictCode}" name="type" th:value="${dict.dictValue}" th:field="*{type}" th:onchange="'javascript:handleRadioChange()'">
|
<input type="radio" th:id="${'type_' + dict.dictCode}" name="type" th:value="${dict.dictValue}"
|
||||||
|
th:field="*{type}" th:onchange="'javascript:handleRadioChange()'">
|
||||||
<label th:for="${'type_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
<label th:for="${'type_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -43,15 +40,15 @@
|
||||||
<input name="sourceAuthor" th:field="*{sourceAuthor}" class="form-control" type="text">
|
<input name="sourceAuthor" th:field="*{sourceAuthor}" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">发布时间:</label>
|
<label class="col-sm-3 control-label">发布时间:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="input-group date">
|
<div class="input-group date">
|
||||||
<input name="publishTime" th:value="${#dates.format(ndNew.publishTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
<input name="publishTime" th:value="${#dates.format(ndNew.publishTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="contentDiv" class="form-group">
|
<div id="contentDiv" class="form-group">
|
||||||
<label class="col-sm-3 control-label">内容:</label>
|
<label class="col-sm-3 control-label">内容:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
@ -85,72 +82,123 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: footer"/>
|
||||||
<!-- <th:block th:include="include :: jquery-min-js" />-->
|
<!-- <th:block th:include="include :: jquery-min-js" />-->
|
||||||
<th:block th:include="include :: datetimepicker-js" />
|
<th:block th:include="include :: datetimepicker-js"/>
|
||||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||||
<th:block th:include="include :: summernote-js" />
|
<th:block th:include="include :: summernote-js"/>
|
||||||
|
<th:block th:include="include :: ztree-js"/>
|
||||||
<!-- <th:block th:include="include :: jquery-cxselect-js" />-->
|
<!-- <th:block th:include="include :: jquery-cxselect-js" />-->
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
||||||
|
var ndNew = [[${ndNew}]];
|
||||||
var prefix = ctx + "back/news/news";
|
var prefix = ctx + "back/news/news";
|
||||||
$("#form-new-edit").validate({
|
$("#form-new-edit").validate({
|
||||||
focusCleanup: true
|
focusCleanup: true
|
||||||
});
|
});
|
||||||
|
|
||||||
function submitHandler() {
|
function submitHandler() {
|
||||||
if ($.validate.form()) {
|
if ($.validate.form()) {
|
||||||
$.operate.save(prefix + "/edit", $('#form-new-edit').serialize());
|
$.operate.save(prefix + "/edit", $('#form-new-edit').serialize());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var url = ctx + "back/news/type/treeData2?newType=" + ndNew.newType;
|
||||||
|
var options = {
|
||||||
|
id: "tree",
|
||||||
|
url: url,
|
||||||
|
expandLevel: 1,
|
||||||
|
onCheck : zOnCheck,
|
||||||
|
check: { enable: true, chkStyle: "checkbox" },
|
||||||
|
};
|
||||||
|
$.tree.init(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 全局变量
|
||||||
|
var checks = "";
|
||||||
|
// 复选框调用
|
||||||
|
function zOnCheck(event, treeId, treeNode) {
|
||||||
|
if (treeNode.checked) {//如果是选中节点
|
||||||
|
if (treeNode.isParent) {//如果选中的是父节点
|
||||||
|
//获取选中的父节点的所有子节点
|
||||||
|
var childrenNodes = treeNode.children;
|
||||||
|
for (var i = 0; i < childrenNodes.length; i++) {
|
||||||
|
checks = checks +childrenNodes[i].id+",";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
checks = checks +treeNode.id+",";
|
||||||
|
}
|
||||||
|
} else {//如果是取消选中
|
||||||
|
if (treeNode.isParent) {//如果取消的是父节点
|
||||||
|
//获取父节点的所有子节点,并移除取消项
|
||||||
|
var childrenNodes = treeNode.children;
|
||||||
|
for (var i = 0; i < childrenNodes.length; i++) {
|
||||||
|
removeCheck(childrenNodes[i].id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
removeCheck(treeNode.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("checks",checks)
|
||||||
|
$("#newType").val(checks);
|
||||||
|
}
|
||||||
|
// 移除元素
|
||||||
|
function removeCheck(chkid) {
|
||||||
|
console.log("removeCheck",chkid)
|
||||||
|
checks = checks.replace(chkid+",","");
|
||||||
|
console.log("checks",checks)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleFirst(newType){
|
async function handleFirst(newType){
|
||||||
var record = document.getElementById("firstType").value;
|
var record = document.getElementById("firstType").value;
|
||||||
await $.ajax({
|
await $.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/back/news/news/getNewType",
|
url: "/back/news/news/getNewType",
|
||||||
data: {
|
data: {
|
||||||
"id": record,
|
"id": record,
|
||||||
"fragment":'fragment-tasklist'
|
"fragment":'fragment-tasklist'
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
console.log('2222->',data);
|
console.log('2222->',data);
|
||||||
var rows = data.rows;
|
var rows = data.rows;
|
||||||
var optionhtml = `<option value="">请选择</option>`;
|
var optionhtml = `<option value="">请选择</option>`;
|
||||||
for(var i = 0; i < rows.length; i++) {
|
for(var i = 0; i < rows.length; i++) {
|
||||||
optionhtml += `<option value="${rows[i].v}">${rows[i].n}</option>`;
|
optionhtml += `<option value="${rows[i].v}">${rows[i].n}</option>`;
|
||||||
}
|
}
|
||||||
document.getElementById("newType").innerHTML = optionhtml;
|
document.getElementById("newType").innerHTML = optionhtml;
|
||||||
if(newType){
|
if(newType){
|
||||||
document.getElementById("newType").value = newType;
|
document.getElementById("newType").value = newType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSecond(newType){
|
function handleSecond(newType){
|
||||||
var record = document.getElementById("newType").value;
|
var record = document.getElementById("newType").value;
|
||||||
if(newType!=''){
|
if(newType!=''){
|
||||||
record = newType;
|
record = newType;
|
||||||
}
|
}
|
||||||
if(record == '48'){
|
if(record == '48'||record == '48,'){
|
||||||
$("#col1").css("display","none");
|
$("#col1").css("display","none");
|
||||||
$("#col3").css("display","none");
|
$("#col3").css("display","none");
|
||||||
$("#contentDiv").css("display","none");
|
$("#contentDiv").css("display","none");
|
||||||
$("#linkUrlDiv").css("display","none");
|
$("#linkUrlDiv").css("display","none");
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$("#col1").css("display","block");
|
$("#col1").css("display","block");
|
||||||
$("#col3").css("display","block");
|
$("#col3").css("display","block");
|
||||||
$("#contentDiv").css("display","block");
|
$("#contentDiv").css("display","block");
|
||||||
$("#linkUrlDiv").css("display","block");
|
$("#linkUrlDiv").css("display","block");
|
||||||
handleRadioChange();
|
handleRadioChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var ndNew = [[${ndNew}]];
|
|
||||||
// 直接返回获取
|
// 直接返回获取
|
||||||
// var data = [[${data}]];
|
// var data = [[${data}]];
|
||||||
// $('#element').cxSelect({
|
// $('#element').cxSelect({
|
||||||
|
@ -158,86 +206,86 @@
|
||||||
// jsonValue: 'v',
|
// jsonValue: 'v',
|
||||||
// data: data
|
// data: data
|
||||||
// });
|
// });
|
||||||
document.getElementById("firstType").value =ndNew.firstType;
|
// document.getElementById("firstType").value =ndNew.firstType;
|
||||||
handleFirst(ndNew.newType);
|
// handleFirst(ndNew.newType);
|
||||||
handleSecond(ndNew.newType)
|
handleSecond(ndNew.newType)
|
||||||
$('.summernote').each(function(i) {
|
$('.summernote').each(function(i) {
|
||||||
$('#' + this.id).summernote({
|
$('#' + this.id).summernote({
|
||||||
lang: 'zh-CN',
|
lang: 'zh-CN',
|
||||||
dialogsInBody: true,
|
dialogsInBody: true,
|
||||||
height: '300px',
|
height: '300px',
|
||||||
callbacks: {
|
callbacks: {
|
||||||
onChange: function(contents, $edittable) {
|
onChange: function(contents, $edittable) {
|
||||||
$("input[name='" + this.id + "']").val(contents);
|
$("input[name='" + this.id + "']").val(contents);
|
||||||
},
|
},
|
||||||
onImageUpload: function(files) {
|
onImageUpload: function(files) {
|
||||||
var obj = this;
|
var obj = this;
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append("file", files[0]);
|
data.append("file", files[0]);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: ctx + "common/upload",
|
url: ctx + "common/upload",
|
||||||
data: data,
|
data: data,
|
||||||
cache: false,
|
cache: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.code == web_status.SUCCESS) {
|
if (result.code == web_status.SUCCESS) {
|
||||||
$('#' + obj.id).summernote('insertImage', result.url);
|
$('#' + obj.id).summernote('insertImage', result.url);
|
||||||
} else {
|
} else {
|
||||||
$.modal.alertError(result.msg);
|
$.modal.alertError(result.msg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(error) {
|
error: function(error) {
|
||||||
$.modal.alertWarning("图片上传失败。");
|
$.modal.alertWarning("图片上传失败。");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var content = $("input[name='" + this.id + "']").val();
|
var content = $("input[name='" + this.id + "']").val();
|
||||||
$('#' + this.id).summernote('code', content);
|
$('#' + this.id).summernote('code', content);
|
||||||
})
|
})
|
||||||
|
|
||||||
$("input[name='publishTime']").datetimepicker({
|
$("input[name='publishTime']").datetimepicker({
|
||||||
format: "yyyy-mm-dd",
|
format: "yyyy-mm-dd",
|
||||||
minView: "month",
|
minView: "month",
|
||||||
autoclose: true
|
autoclose: true
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".file-upload").each(function (i) {
|
$(".file-upload").each(function (i) {
|
||||||
var val = $("input[name='" + this.id + "']").val()
|
var val = $("input[name='" + this.id + "']").val()
|
||||||
$(this).fileinput({
|
$(this).fileinput({
|
||||||
'uploadUrl': ctx + 'common/upload',
|
'uploadUrl': ctx + 'common/upload',
|
||||||
initialPreviewAsData: true,
|
initialPreviewAsData: true,
|
||||||
initialPreview: [val],
|
initialPreview: [val],
|
||||||
maxFileCount: 1,
|
maxFileCount: 1,
|
||||||
autoReplace: true
|
autoReplace: true
|
||||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||||
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||||
}).on('fileremoved', function (event, id, index) {
|
}).on('fileremoved', function (event, id, index) {
|
||||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||||
})
|
})
|
||||||
$(this).fileinput('_initFileActions');
|
$(this).fileinput('_initFileActions');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(".file-uploadb").each(function (i) {
|
$(".file-uploadb").each(function (i) {
|
||||||
var val = $("input[name='" + this.id + "']").val()
|
var val = $("input[name='" + this.id + "']").val()
|
||||||
$(this).fileinput({
|
$(this).fileinput({
|
||||||
'uploadUrl': ctx + 'common/upload',
|
'uploadUrl': ctx + 'common/upload',
|
||||||
initialPreviewAsData: true,
|
initialPreviewAsData: true,
|
||||||
initialPreview: [val],
|
initialPreview: [val],
|
||||||
maxFileCount: 10,
|
maxFileCount: 10,
|
||||||
autoReplace: true
|
autoReplace: true
|
||||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||||
var inputaaa = $("input[name='" + event.currentTarget.id + "']").val();
|
var inputaaa = $("input[name='" + event.currentTarget.id + "']").val();
|
||||||
$("input[name='" + event.currentTarget.id + "']").val(inputaaa+"|"+data.response.url)
|
$("input[name='" + event.currentTarget.id + "']").val(inputaaa+"|"+data.response.url)
|
||||||
}).on('fileremoved', function (event, id, index) {
|
}).on('fileremoved', function (event, id, index) {
|
||||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||||
})
|
})
|
||||||
$(this).fileinput('_initFileActions');
|
$(this).fileinput('_initFileActions');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
var options = {
|
var options = {
|
||||||
url: url,
|
url: url,
|
||||||
expandLevel: 2,
|
expandLevel: 2,
|
||||||
onClick : zOnClick
|
onClick : zOnClick,
|
||||||
};
|
};
|
||||||
$.tree.init(options);
|
$.tree.init(options);
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('新闻类型树选择')" />
|
||||||
|
<th:block th:include="include :: ztree-css" />
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
body{height:auto;font-family: "Microsoft YaHei";}
|
||||||
|
button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
|
||||||
|
</style>
|
||||||
|
<body class="hold-transition box box-main">
|
||||||
|
<input id="treeId" name="treeId" type="hidden" th:value="${ndNewType?.id}"/>
|
||||||
|
<input id="treeName" name="treeName" type="hidden" th:value="${ndNewType?.name}"/>
|
||||||
|
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
|
||||||
|
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
|
||||||
|
<label id="btnHide" title="隐藏搜索">︽</label>
|
||||||
|
</div>
|
||||||
|
<div class="treeSearchInput" id="search">
|
||||||
|
<label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
|
||||||
|
<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
|
||||||
|
</div>
|
||||||
|
<div class="treeExpandCollapse">
|
||||||
|
<a href="javascript:;" onclick="$.tree.expand()">展开</a> /
|
||||||
|
<a href="javascript:;" onclick="$.tree.collapse()">折叠</a>
|
||||||
|
</div>
|
||||||
|
<div id="tree" class="ztree treeselect"></div>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<th:block th:include="include :: ztree-js" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
$(function() {
|
||||||
|
var url = ctx + "back/news/type/treeData";
|
||||||
|
var options = {
|
||||||
|
url: url,
|
||||||
|
expandLevel: 1,
|
||||||
|
onCheck : zOnCheck,
|
||||||
|
check: { enable: true, chkStyle: "checkbox" },
|
||||||
|
callBack: callBack // 回显回调方法
|
||||||
|
};
|
||||||
|
$.tree.init(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 全局变量
|
||||||
|
var checks = [];
|
||||||
|
|
||||||
|
// 复选框调用
|
||||||
|
function zOnCheck(event, treeId, treeNode) {
|
||||||
|
if (treeNode.checked) {//如果是选中节点
|
||||||
|
if (treeNode.isParent) {//如果选中的是父节点
|
||||||
|
//获取选中的父节点的所有子节点
|
||||||
|
var childrenNodes = treeNode.children;
|
||||||
|
for (var i = 0; i < childrenNodes.length; i++) {
|
||||||
|
checks.push({id: childrenNodes[i].id, name: childrenNodes[i].name});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
checks.push({id: treeNode.id, name: treeNode.name});
|
||||||
|
}
|
||||||
|
} else {//如果是取消选中
|
||||||
|
if (treeNode.isParent) {//如果取消的是父节点
|
||||||
|
//获取父节点的所有子节点,并移除取消项
|
||||||
|
var childrenNodes = treeNode.children;
|
||||||
|
for (var i = 0; i < childrenNodes.length; i++) {
|
||||||
|
removeCheck(childrenNodes[i].id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
removeCheck(treeNode.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("checks",checks)
|
||||||
|
$("#treeId").val(checks);
|
||||||
|
var menuIds = $.tree.getCheckedNodes();
|
||||||
|
console.log("menuIds",menuIds)
|
||||||
|
}
|
||||||
|
// 移除元素
|
||||||
|
function removeCheck(chkid) {
|
||||||
|
$.each(checks, function (idx, item) {
|
||||||
|
if (item != undefined && item.id == chkid) {
|
||||||
|
checks.splice(idx, 1);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 回显选中
|
||||||
|
function callBack () {
|
||||||
|
var treeObj = $.fn.zTree.getZTreeObj("tree"); // 获取到树
|
||||||
|
if (undefined !== treeObj) {
|
||||||
|
$.each(checks, function (idx, item) {
|
||||||
|
//根据id获取节点
|
||||||
|
var nodes = treeObj.getNodesByParamFuzzy("id", item.id, null);
|
||||||
|
if (nodes.length > 0) {
|
||||||
|
treeObj.checkNode(nodes[0], true, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function zOnClick(event, treeId, treeNode) {
|
||||||
|
|
||||||
|
var menuIds = $.tree.getCheckedNodes();
|
||||||
|
console.log("11111menuIds",menuIds)
|
||||||
|
// console.log(event, treeId, treeNode)
|
||||||
|
// var treeId = treeNode.id;
|
||||||
|
// var treeName = treeNode.name;
|
||||||
|
// $("#treeId").val(menuIds);
|
||||||
|
// $("#treeName").val(treeName);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -40,16 +40,16 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="details_title">
|
<div class="details_title">
|
||||||
<h2 style="font-family: 'FZXiaoBiaoSong-Z04S', '方正小标宋简体';font-size: 22px;margin-top: 20px;margin-bottom: 20px;font-weight:700;">[[${info.title}]]</h2>
|
<h2 >[[${info.title}]]</h2>
|
||||||
<ul style="margin-top: 32px;margin-bottom: 20px;font-size: 18px;">
|
<ul>
|
||||||
<li>日期:[[${#dates.format(info.publishTime, 'YYYY-MM-dd')}]]</li>
|
<li>日期:[[${#dates.format(info.publishTime, 'YYYY-MM-dd')}]]</li>
|
||||||
<li>编辑:[[${info.sourceAuthor}]]</li>
|
<li>编辑:[[${info.sourceAuthor}]]</li>
|
||||||
<li>点击率:[[${info.clickRate}]]</li>
|
<li>点击率:[[${info.clickRate}]]</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="con deheligh" style="min-height:400px;margin-top: 70px;">
|
<div class="con deheligh" style="min-height:400px;margin-top: 70px;" >
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<div style="text-indent:1.5rem;width:100%;float:left;" id="contentID">
|
<div style="text-indent:1.5rem;width:100%; line-height:1.3rem;float:left;" id="contentID">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
|
|
||||||
|
|
||||||
var newType = [[${newType}]]
|
var newType = [[${newType}]]
|
||||||
|
var newImg = "../../portal/images/down.png";
|
||||||
var url = "/portal/dataList";
|
var url = "/portal/dataList";
|
||||||
var div = document.getElementById("dataSource");
|
var div = document.getElementById("dataSource");
|
||||||
var dataParam = {newType:newType}
|
var dataParam = {newType:newType}
|
||||||
|
@ -75,18 +76,14 @@
|
||||||
var url = item.filePath;
|
var url = item.filePath;
|
||||||
prve += `
|
prve += `
|
||||||
<li class="clearfix">
|
<li class="clearfix">
|
||||||
<a title="${item.title}" class="clearfix">
|
<a title="${item.title}" class="clearfix" style="padding:10px 0">
|
||||||
|
<img class="left" src="${newImg}" style="width:20px; height:20px;margin-top:8px;margin-right:8px;"/>
|
||||||
<div class="left txt">
|
<div class="left txt">
|
||||||
<div class="fnt_22 title">${item.title}<button class="down_button" onclick="download('${url}')">下载</button></div>`
|
<div class="fnt_22 title">${item.title}<button class="down_button" onclick="download('${url}')">下载</button></div>`
|
||||||
if(item.sourceAuthor){
|
|
||||||
prve +=`<div class="des">${item.sourceAuthor}</div>`
|
|
||||||
}else{
|
|
||||||
prve +=`<div class="des">吉林省新农长白山创新学院</div>`
|
|
||||||
}
|
|
||||||
prve +=`</div>
|
prve +=`</div>
|
||||||
<div class="right time">
|
<div class="right time">
|
||||||
<div class="ta">${item.publishTime}</div>
|
<div class="ta">${item.publishTime}</div>
|
||||||
<div>发布时间</div>
|
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -162,19 +159,16 @@
|
||||||
let str = result.rows.reduce(function (prve, item) {
|
let str = result.rows.reduce(function (prve, item) {
|
||||||
var url = item.filePath;
|
var url = item.filePath;
|
||||||
prve += `
|
prve += `
|
||||||
<li class="clearfix">
|
|
||||||
<a title="${item.title}" class="clearfix">
|
<li class="clearfix">
|
||||||
<div class="left txt">
|
<a title="${item.title}" class="clearfix" style="padding:10px 0">
|
||||||
<div class="fnt_22 title">${item.title}<button class="down_button" onclick="download('${url}')">下载</button></div>`
|
<img class="left" src="${newImg}" style="width:20px; height:20px;margin-top:8px;margin-right:8px;"/>
|
||||||
if(item.sourceAuthor){
|
<div class="left txt">
|
||||||
prve +=`<div class="des">${item.sourceAuthor}</div>`
|
<div class="fnt_22 title">${item.title}<button class="down_button" onclick="download('${url}')">下载</button></div>`
|
||||||
}else{
|
|
||||||
prve +=`<div class="des">吉林省新农长白山创新学院</div>`
|
prve +=`</div>
|
||||||
}
|
|
||||||
prve +=`</div>
|
|
||||||
<div class="right time">
|
<div class="right time">
|
||||||
<div class="ta">${item.publishTime}</div>
|
<div class="ta">${item.publishTime}</div>
|
||||||
<div>发布时间</div>
|
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
|
|
||||||
var newType = [[${threeCode}]]
|
var newType = [[${threeCode}]]
|
||||||
|
|
||||||
|
var newImg = "../../portal/images/newst.png";
|
||||||
var url = "/portal/dataList";
|
var url = "/portal/dataList";
|
||||||
var div = document.getElementById("dataSource");
|
var div = document.getElementById("dataSource");
|
||||||
var dataParam = {newType:newType}
|
var dataParam = {newType:newType}
|
||||||
|
@ -100,7 +101,8 @@
|
||||||
}
|
}
|
||||||
prve += `
|
prve += `
|
||||||
<li class="clearfix">
|
<li class="clearfix">
|
||||||
<a href="${url}" target="_blank" title="${item.title}" class="clearfix">
|
<a href="${url}" target="_blank" title="${item.title}" class="clearfix" style="padding:10px 0">
|
||||||
|
<img class="left newimg" src="${newImg}"/>
|
||||||
<div class="left txt">
|
<div class="left txt">
|
||||||
<div class="fnt_22 title">${item.title}</div>`
|
<div class="fnt_22 title">${item.title}</div>`
|
||||||
if(item.abstracts){
|
if(item.abstracts){
|
||||||
|
@ -143,14 +145,15 @@
|
||||||
let str = result.rows.reduce(function (prve, item) {
|
let str = result.rows.reduce(function (prve, item) {
|
||||||
prve += `
|
prve += `
|
||||||
<li class="clearfix">
|
<li class="clearfix">
|
||||||
<a href="/portal/details?id=${item.id}" target="_blank" class="clearfix">
|
<a href="/portal/details?id=${item.id}" target="_blank" class="clearfix" style="padding:10px 0">
|
||||||
|
<img class="left" src="${newImg}" style="width:20px; height:20px;margin-top:8px;margin-right:8px;"/>
|
||||||
<div class="left txt">
|
<div class="left txt">
|
||||||
<div class="fnt_22 title">${item.title}</div>
|
<div class="fnt_22 title">${item.title}</div>
|
||||||
<div class="des">${item.abstracts}</div>
|
// <div class="des">${item.abstracts}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right time">
|
<div class="right time">
|
||||||
<div class="ta">${item.publishTime}</div>
|
<div class="ta">${item.publishTime}</div>
|
||||||
<div>发布时间</div>
|
// <div>发布时间</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('部门树选择')" />
|
||||||
|
<th:block th:include="include :: ztree-css" />
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
body{height:auto;font-family: "Microsoft YaHei";}
|
||||||
|
button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
|
||||||
|
</style>
|
||||||
|
<body class="hold-transition box box-main">
|
||||||
|
<input id="treeId" name="treeId" type="hidden" th:value="${dept.deptId}"/>
|
||||||
|
<input id="treeName" name="treeName" type="hidden" th:value="${dept.deptName}"/>
|
||||||
|
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
|
||||||
|
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
|
||||||
|
<label id="btnHide" title="隐藏搜索">︽</label>
|
||||||
|
</div>
|
||||||
|
<div class="treeSearchInput" id="search">
|
||||||
|
<label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
|
||||||
|
<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
|
||||||
|
</div>
|
||||||
|
<div class="treeExpandCollapse">
|
||||||
|
<a href="javascript:;" onclick="$.tree.expand()">展开</a> /
|
||||||
|
<a href="javascript:;" onclick="$.tree.collapse()">折叠</a>
|
||||||
|
</div>
|
||||||
|
<div id="tree" class="ztree treeselect"></div>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<th:block th:include="include :: ztree-js" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var prefix = ctx + "system/dept"
|
||||||
|
var deptId = [[${deptId}]];
|
||||||
|
var excludeId = [[${excludeId}]];
|
||||||
|
$(function() {
|
||||||
|
var url = prefix + "/treeData/" + excludeId;
|
||||||
|
var options = {
|
||||||
|
url: url,
|
||||||
|
expandLevel: 2,
|
||||||
|
onClick : zOnClick,
|
||||||
|
check: { enable: true },
|
||||||
|
};
|
||||||
|
$.tree.init(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
function zOnClick(event, treeId, treeNode) {
|
||||||
|
var treeId = treeNode.id;
|
||||||
|
var treeName = treeNode.name;
|
||||||
|
$("#treeId").val(treeId);
|
||||||
|
$("#treeName").val(treeName);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Binary file not shown.
|
@ -58,16 +58,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
inner join nd_new_type c on b.parent_id = c.id
|
inner join nd_new_type c on b.parent_id = c.id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<sql id="selectNdNewVo2">
|
||||||
|
select GROUP_CONCAT(b.name) as new_type_str,a.* from nd_new a
|
||||||
|
left join nd_new_type b on FIND_IN_SET(b.id,a.new_type)
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
|
||||||
<select id="selectNdNewList" parameterType="NdNew" resultMap="NdNewResult">
|
<select id="selectNdNewList" parameterType="NdNew" resultMap="NdNewResult">
|
||||||
<include refid="selectNdNewVo"/>
|
<include refid="selectNdNewVo2"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="firstType != null and firstType != ''"> and b.parent_id = #{firstType}</if>
|
<if test="firstType != null and firstType != ''"> and b.parent_id = #{firstType}</if>
|
||||||
<if test="newType != null and newType != ''"> and a.new_type = #{newType}</if>
|
<if test="newType != null and newType != ''"> and FIND_IN_SET(#{newType},a.new_type) </if>
|
||||||
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
||||||
<if test="delFlag != null and delFlag != ''"> and a.del_flag = #{delFlag}</if>
|
<if test="delFlag != null and delFlag != ''"> and a.del_flag = #{delFlag}</if>
|
||||||
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>
|
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>
|
||||||
<if test="params.beginPublishTime != null and params.beginPublishTime != '' and params.endPublishTime != null and params.endPublishTime != ''"> and a.publish_time between #{params.beginPublishTime} and #{params.endPublishTime}</if>
|
<if test="params.beginPublishTime != null and params.beginPublishTime != '' and params.endPublishTime != null and params.endPublishTime != ''"> and a.publish_time between #{params.beginPublishTime} and #{params.endPublishTime}</if>
|
||||||
</where>
|
</where>
|
||||||
|
GROUP BY new_type,id
|
||||||
order by a.publish_time desc,a.create_time desc
|
order by a.publish_time desc,a.create_time desc
|
||||||
<if test="paramLimitno != null and paramLimitno != ''"> limit ${paramLimitno}</if>
|
<if test="paramLimitno != null and paramLimitno != ''"> limit ${paramLimitno}</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -58,16 +58,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
inner join nd_new_type c on b.parent_id = c.id
|
inner join nd_new_type c on b.parent_id = c.id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<sql id="selectNdNewVo2">
|
||||||
|
select GROUP_CONCAT(b.name) as new_type_str,a.* from nd_new a
|
||||||
|
left join nd_new_type b on FIND_IN_SET(b.id,a.new_type)
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
|
||||||
<select id="selectNdNewList" parameterType="NdNew" resultMap="NdNewResult">
|
<select id="selectNdNewList" parameterType="NdNew" resultMap="NdNewResult">
|
||||||
<include refid="selectNdNewVo"/>
|
<include refid="selectNdNewVo2"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="firstType != null and firstType != ''"> and b.parent_id = #{firstType}</if>
|
<if test="firstType != null and firstType != ''"> and b.parent_id = #{firstType}</if>
|
||||||
<if test="newType != null and newType != ''"> and a.new_type = #{newType}</if>
|
<if test="newType != null and newType != ''"> and FIND_IN_SET(#{newType},a.new_type) </if>
|
||||||
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
||||||
<if test="delFlag != null and delFlag != ''"> and a.del_flag = #{delFlag}</if>
|
<if test="delFlag != null and delFlag != ''"> and a.del_flag = #{delFlag}</if>
|
||||||
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>
|
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>
|
||||||
<if test="params.beginPublishTime != null and params.beginPublishTime != '' and params.endPublishTime != null and params.endPublishTime != ''"> and a.publish_time between #{params.beginPublishTime} and #{params.endPublishTime}</if>
|
<if test="params.beginPublishTime != null and params.beginPublishTime != '' and params.endPublishTime != null and params.endPublishTime != ''"> and a.publish_time between #{params.beginPublishTime} and #{params.endPublishTime}</if>
|
||||||
</where>
|
</where>
|
||||||
|
GROUP BY new_type,id
|
||||||
order by a.publish_time desc,a.create_time desc
|
order by a.publish_time desc,a.create_time desc
|
||||||
<if test="paramLimitno != null and paramLimitno != ''"> limit ${paramLimitno}</if>
|
<if test="paramLimitno != null and paramLimitno != ''"> limit ${paramLimitno}</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in New Issue