增加部门下拉选择树,处理案件的问题

This commit is contained in:
TS-QD1 2023-10-17 12:56:17 +08:00
parent 4cb281d215
commit d9eb38bac5
5 changed files with 168 additions and 16 deletions

View File

@ -1,6 +1,6 @@
server:
port: 7022
url: http://192.168.0.15:7022/servicecity
url: http://127.0.0.1:7022/servicecity
title: 生态环保网格化监督平台
servlet:
context-path: /servicecity
@ -24,7 +24,7 @@ spring:
max-request-size: 1GB
datasource:
druid:
url: jdbc:mysql://192.168.0.151:3306/db_btgxq_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/db_btgxq_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false
db-type: mysql
driver-class-name: com.mysql.jdbc.Driver
username: root
@ -55,7 +55,7 @@ spring:
config: classpath:ehcache.xml
data:
mongodb:
uri: mongodb://city:city@192.168.0.156:27017/systemcity
uri: mongodb://city:city@127.0.0.1:27017/systemcity
# 数据库
mybatis:
@ -81,7 +81,7 @@ file:
# 安全
security:
oauth2:
oauth-server: http://192.168.0.15:7021/usercenter
oauth-server: http://127.0.0.1:7021/usercenter
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
client:
client-id: c024a89b35b04d4d8b5b4ea4d66a8acb

View File

@ -32,6 +32,7 @@
<result property="handleUserDepartmentName" column="handle_user_department_name"/>
<result property="handleUserCommunityName" column="handle_user_community_name"/>
<result property="handleUserUsername" column="handle_user_username"/>
<result property="handleUserName" column="handle_user_name"/>
</resultMap>
<resultMap id="reportCaseRegisterDTO" type="com.cm.systemcity.pojo.dtos.reportcase.ReportCaseRegisterDTO" extends="reportCaseDTO">
@ -133,9 +134,19 @@
t1.case_reporter,
t1.creator,
LEFT(t1.gmt_create, 19) gmt_create,
LEFT(t1.gmt_modified, 19) gmt_modified
LEFT(t1.gmt_modified, 19) gmt_modified,
t2.handle_user_name,
t3.user_username handle_user_username
FROM
city_report_case t1
LEFT JOIN
city_report_case_handle t2
ON
t1.report_case_id = t2.case_id
LEFT JOIN
sys_user t3
ON
t2.creator = t3.user_id
WHERE
t1.is_delete = 1
<if test="caseNumber != null and caseNumber != ''">
@ -148,7 +159,19 @@
AND t1.community_id = #{communityId}
</if>
<if test="caseTypeId != null and caseTypeId != ''">
AND t1.case_type_id = #{caseTypeId}
AND t1.case_type_id IN (
SELECT
cd.dict_id
FROM
city_dict cd
WHERE
cd.is_delete = 0
AND (
dict_id = #{caseTypeId}
OR
dict_parent_id = #{caseTypeId}
)
)
</if>
<if test="caseStatus != null">
AND t1.case_status = #{caseStatus}
@ -193,6 +216,26 @@
)
)
</if>
<if test="departmentId != null and departmentId != ''">
AND
t1.report_case_id IN (
SELECT
st1.case_id
FROM
city_report_case_assign st1
WHERE
st1.is_delete = 0
AND
st1.handle_user_id IN (
SELECT
sst1.user_id
FROM
sys_department_user sst1
WHERE
sst1.department_id = #{departmentId}
)
)
</if>
ORDER BY t1.gmt_modified DESC
</select>
@ -1784,7 +1827,19 @@
AND t1.community_id = #{communityId}
</if>
<if test="caseTypeId != null and caseTypeId != ''">
AND t1.case_type_id = #{caseTypeId}
AND t1.case_type_id IN (
SELECT
cd.dict_id
FROM
city_dict cd
WHERE
cd.is_delete = 0
AND (
dict_id = #{caseTypeId}
OR
dict_parent_id = #{caseTypeId}
)
)
</if>
<if test="startTime != null and startTime != ''">
AND t1.gmt_create <![CDATA[ >= ]]> #{startTime}

View File

@ -0,0 +1,82 @@
layui.define(['ztree'], function(exports){
let $ = layui.$;
function dept(opt) {
let elem = $(opt.elem);
let name = opt.name;
let treeContainer = `${name}TreeContainer`;
let treeName = `${name}ZTree`;
let selectName = `${name}Name`;
let selectId = `${name}Id`;
let deleteBtn = `${name}DeleteBtn`;
let ztree;
let init = function() {
elem.css({
position: 'relative'
})
elem.append(`
<input type="text" id="${selectName}" class="layui-input search-item" readonly="readonly" placeholder="专管机构" style="height: 38px;width:150px;cursor: pointer">
<input type="hidden" id="${selectId}">
<a href="javascript:void(0);" id="${deleteBtn}" style="position: absolute; top: 8px; right: 5px;"><i class="fa fa-times"></i></a>
<div id="${treeContainer}" class="tree-container" style="display: none; position: absolute; top: 40px; left: 0; width: 100%; height: 200px; overflow: auto; border: 1px solid #eeeeee; z-index: 999; background-color: #FFF;">
<ul id="${treeName}" class="ztree"></ul>
</div>
`);
}
let renderTree = function () {
var setting = {
async: {
enable: true,
autoLoad: true,
type: 'get',
url: top.restAjax.path('api/department/listztreedepartment', []),
autoParam: ['id'],
otherParam: {},
dataFilter: function (treeId, parentNode, childNodes) {
if (!childNodes) return null;
for (var i = 0, l = childNodes.length; i < l; i++) {
childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
}
return childNodes;
}
},
callback: {
onClick: function (event, treeId, treeNode) {
$(`#${selectName}`).val(treeNode.name);
$(`#${selectId}`).val(treeNode.id);
return false;
}
},
};
var zTree = $.fn.zTree.init($(`#${treeName}`), setting);
}
let addEvent = function() {
$(`#${deleteBtn}`).click(function() {
$(`#${selectName}`).val('');
$(`#${selectId}`).val('');
});
$(document).on('click', `#${selectName}`, function(e) {
$(`#${treeContainer}`).show();
e.stopPropagation();
})
$(document).on('click', `:not(#${selectName})`, function(e) {
console.log(2)
$(`#${treeContainer}`).hide();
e.stopPropagation();
})
}
init();
renderTree();
addEvent();
}
exports('selecttree', {
dept: dept
})
})

View File

@ -9,6 +9,7 @@
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" href="assets/js/vendor/zTree3/css/metroStyle/metroStyle.css"/>
</head>
<body>
@ -80,7 +81,7 @@
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laytpl', 'form','laydate'], function() {
}).use(['index', 'table', 'laytpl', 'form','laydate', 'selecttree'], function() {
var $ = layui.$;
var $win = $(window);
var laytpl = layui.laytpl;
@ -88,6 +89,7 @@
var admin = layui.admin;
var form = layui.form;
var laydate = layui.laydate;
var selecttree = layui.selecttree;
var tableUrl = 'api/reportcase/listcasestatisticratio';
var dataLoading = false;
@ -205,7 +207,7 @@
dataLoading = true;
var caseTypeId = $('#caseTypeId').val();
var childCaseTypeId = $('#childCaseTypeId').val();
if(childCaseTypeId != ''){
if(childCaseTypeId) {
caseTypeId = childCaseTypeId;
}
table.reload('dataTable', {

View File

@ -13,6 +13,7 @@
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" href="assets/js/vendor/zTree3/css/metroStyle/metroStyle.css"/>
<style>
.layui-table-cell{
height: auto;
@ -69,6 +70,7 @@
{{# } }}
</select>
</script>
<div class="layui-inline" id="deptContainer"></div>
<div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item"
readonly="readonly" placeholder="开始时间" style="height: 38px;width:150px;cursor: pointer" autocomplete="off">
@ -99,7 +101,7 @@
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laytpl', 'form','laydate'], function() {
}).use(['index', 'table', 'laytpl', 'form','laydate', 'selecttree'], function() {
var $ = layui.$;
var $win = $(window);
var laytpl = layui.laytpl;
@ -107,7 +109,13 @@
var admin = layui.admin;
var form = layui.form;
var laydate = layui.laydate;
var tableUrl = 'api/reportcase/list-page-report-disputed';
var selecttree = layui.selecttree;
var tableUrl = 'api/reportcase/list-page-report-disputed'
selecttree.dept({
elem: '#deptContainer',
name: 'dept',
});
// 初始化表格
function initTable() {
@ -192,7 +200,7 @@
'<div class="info-row"><span class="col-left">上报时间</span><span class="col-right">'+ row.reportDate +'</span></div>'+
'<div class="info-row"><span class="col-left">上报人员</span><span class="col-right">'+ row.caseReporter +'</span></div>'+
'<div class="info-row"><span class="col-left">删除时间</span><span class="col-right">'+ row.gmtModified +'</span></div>'+
'<div class="info-row"><span class="col-left"></span><span class="col-right"></span></div>'+
'<div class="info-row"><span class="col-left">处理人员</span><span class="col-right">'+ row.handleUserName +'</span></div>'+
'</div>';
return value;
}
@ -288,13 +296,15 @@
var startTime = $('#startTime').val();
var endTime = $('#endTime').val();
var caseNumber = $('#caseNumber').val();
var deptId = $('#deptId').val();
var params = '?t='+ new Date().getTime();
if('' != areaId && 'undefined' != typeof(areaId)) {
params += '&areaId='+ areaId;
}
if('' != caseTypeId && '' != childCaseTypeId) {
params += '&caseTypeId='+ childCaseTypeId;
} else {
if(childCaseTypeId) {
caseTypeId = childCaseTypeId;
}
if(caseTypeId) {
params += '&caseTypeId='+ caseTypeId;
}
if('' != startTime) {
@ -306,6 +316,9 @@
if('' != caseNumber) {
params += '&caseNumber='+ caseNumber;
}
if('' != deptId) {
params += '&departmentId='+ deptId;
}
return url + params;
}