提交 6e22c5d3 编写于 作者: doc_wei's avatar doc_wei

公司信息添加,列表展示,删除完成

上级 2bccbe23
......@@ -19,4 +19,8 @@ public interface CompanyMationDao {
public int editCompanyMationById(Map<String, Object> map) throws Exception;
public List<Map<String, Object>> queryOverAllCompanyMationList(Map<String, Object> map) throws Exception;
public Map<String, Object> queryCompanyMationById(Map<String, Object> map) throws Exception;
}
......@@ -15,4 +15,6 @@ public interface CompanyMationService {
public void editCompanyMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryOverAllCompanyMationList(InputObject inputObject, OutputObject outputObject) throws Exception;
}
......@@ -74,7 +74,12 @@ public class CompanyMationServiceImpl implements CompanyMationService{
@Override
public void deleteCompanyMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
companyMationDao.deleteCompanyMationById(map);
Map<String, Object> bean = companyMationDao.queryCompanyMationById(map);
if(Integer.parseInt(bean.get("childsNum").toString()) == 0){
companyMationDao.deleteCompanyMationById(map);
}else{
outputObject.setreturnMessage("该公司下存在子公司,无法直接删除。");
}
}
/**
......@@ -115,5 +120,25 @@ public class CompanyMationServiceImpl implements CompanyMationService{
outputObject.setreturnMessage("该公司信息已注册,请确认。");
}
}
/**
*
* @Title: queryOverAllCompanyMationList
* @Description: 获取总公司信息列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void queryOverAllCompanyMationList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = companyMationDao.queryOverAllCompanyMationList(map);
if(!beans.isEmpty()){
outputObject.setBeans(beans);
outputObject.settotal(beans.size());
}
}
}
......@@ -94,4 +94,20 @@ public class CompanyMationController {
companyMationService.editCompanyMationById(inputObject, outputObject);
}
/**
*
* @Title: queryOverAllCompanyMationList
* @Description: 获取总公司信息列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/CompanyMationController/queryOverAllCompanyMationList")
@ResponseBody
public void queryOverAllCompanyMationList(InputObject inputObject, OutputObject outputObject) throws Exception{
companyMationService.queryOverAllCompanyMationList(inputObject, outputObject);
}
}
......@@ -25,18 +25,6 @@
<if test="companyName != '' and companyName != null">
AND a.company_name LIKE '%${companyName}%'
</if>
<if test="provinceId != '' and provinceId != null">
AND a.address_province = #{provinceId}
</if>
<if test="cityId != '' and cityId != null">
AND a.address_city = #{cityId}
</if>
<if test="areaId != '' and areaId != null">
AND a.address_area = #{areaId}
</if>
<if test="townshipId != '' and townshipId != null">
AND a.address_township = #{townshipId}
</if>
ORDER BY a.create_time DESC
</select>
......@@ -57,7 +45,18 @@
(#{id}, #{companyName}, #{companyDesc}, #{pId}, #{provinceId}, #{cityId}, #{areaId}, #{townshipId}, #{addressDetailed}, #{createId}, #{createTime})
</insert>
<delete id="deleteCompanyMationMationById" parameterType="java.util.Map">
<select id="queryCompanyMationById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.company_name companyName,
a.p_id pId,
(SELECT COUNT(*) FROM company_mation b WHERE b.p_id = a.id) childsNum
FROM
company_mation a
WHERE a.id = #{id}
</select>
<delete id="deleteCompanyMationById" parameterType="java.util.Map">
DELETE
FROM
company_mation
......@@ -110,4 +109,14 @@
WHERE id = #{id}
</update>
<select id="queryOverAllCompanyMationList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.company_name name
FROM
company_mation a
WHERE a.p_id = '0'
ORDER BY a.create_time DESC
</select>
</mapper>
\ No newline at end of file
......@@ -734,10 +734,17 @@
<!-- 公司管理开始 -->
<url id="companymation001" path="/post/CompanyMationController/queryCompanyMationList" val="获取公司信息列表" allUse="1">
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
<property id="companyName" name="companyName" ref="" var="公司名称"/>
</url>
<url id="companymation002" path="/post/CompanyMationController/insertCompanyMation" val="添加公司信息信息" allUse="1">
<property id="companyName" name="companyName" ref="required" var="公司名称"/>
<property id="companyDesc" name="companyDesc" ref="" var="公司简介"/>
<property id="pId" name="pId" ref="required" var="公司总公司"/>
<property id="provinceId" name="provinceId" ref="required" var="行政区划省"/>
<property id="cityId" name="cityId" ref="" var="行政区划市"/>
<property id="areaId" name="areaId" ref="" var="行政区划县"/>
<property id="townshipId" name="townshipId" ref="" var="行政区划镇"/>
<property id="addressDetailed" name="addressDetailed" ref="required" var="行政区划具体地址"/>
</url>
<url id="companymation003" path="/post/CompanyMationController/deleteCompanyMationById" val="删除公司信息信息" allUse="1">
<property id="rowId" name="id" ref="required" var="公司信息id"/>
......@@ -748,6 +755,8 @@
<url id="companymation005" path="/post/CompanyMationController/editCompanyMationById" val="编辑公司信息信息" allUse="1">
<property id="rowId" name="id" ref="required" var="公司信息id"/>
</url>
<url id="companymation006" path="/post/CompanyMationController/queryOverAllCompanyMationList" val="获取总公司信息列表" allUse="1">
</url>
<!-- 公司管理结束 -->
</controller>
\ No newline at end of file
......@@ -2312,7 +2312,9 @@ layui.config({
var index=$(this).attr("data-index");
var list=table.getDataList(that.config.id);
var o=list[index];
that.config.onDblClickRow(index,o);
if(!isNull(that.config.onDblClickRow)){
that.config.onDblClickRow(index,o);
}
});
//拖拽调整宽度
th.unbind('mousemove').on('mousemove', function(e){
......
......@@ -26,6 +26,19 @@ layui.config({
});
form.render();
showGrid({
id: "OverAllCompany",
url: reqBasePath + "companymation006",
params: {},
pagination: false,
template: getFileContent('tpl/template/select-option.tpl'),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
form.render('select');
}
});
//默认隐藏子公司
$("#parentIdBox").addClass("layui-hide");
......@@ -47,11 +60,40 @@ layui.config({
form.on('submit(formAddBean)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
var pId = '0';
if($("input[name='companyType']:checked").val() == '2'){
if(isNull($("#OverAllCompany").val())){
top.winui.window.msg('请选择总公司', {icon: 2,time: 2000});
return false;
}else{
pId = $("#OverAllCompany").val();
}
}
var provinceId = "", cityId = "", areaId = "", townshipId = "";
if(!isNull($("#provinceId").val())){
provinceId = $("#provinceId").val();
}
if(!isNull($("#cityId").val())){
cityId = $("#cityId").val();
}
if(!isNull($("#areaId").val())){
areaId = $("#areaId").val();
}
if(!isNull($("#townshipId").val())){
townshipId = $("#townshipId").val();
}
var params = {
companyName: $("#companyName").val(),
companyDesc: encodeURI(layedit.getContent(layContent)),
pId: pId,
provinceId: provinceId,
cityId: cityId,
areaId: areaId,
townshipId: townshipId,
addressDetailed: $("#addressDetailed").val(),
};
AjaxPostUtil.request({url:reqBasePath + "icon002", params:params, type:'json', callback:function(json){
AjaxPostUtil.request({url:reqBasePath + "companymation002", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
......@@ -89,7 +131,7 @@ layui.config({
function loadChildProvinceArea(){
AjaxPostUtil.request({url:reqBasePath + "commontarea001", params:{}, type:'json', callback:function(json){
if(json.returnCode == 0){
var str = '<dd class="layui-col-xs3"><select class="areaProvince" id="provinceId" lay-filter="areaProvince" lay-search=""><option value="">请选择</option>';
var str = '<dd class="layui-col-xs3"><select id="provinceId" win-verify="required" lay-filter="areaProvince" lay-search=""><option value="">请选择</option>';
for(var i = 0; i < json.rows.length; i++){
str += '<option value="' + json.rows[i].id + '">' + json.rows[i].name + '</option>';
}
......@@ -106,7 +148,7 @@ layui.config({
function loadChildCityArea(){
AjaxPostUtil.request({url:reqBasePath + "commontarea002", params:{rowId: $("#provinceId").val()}, type:'json', callback:function(json){
if(json.returnCode == 0){
var str = '<dd class="layui-col-xs3"><select class="areaCity" id="cityId" lay-filter="areaCity" lay-search=""><option value="">请选择</option>';
var str = '<dd class="layui-col-xs3"><select id="cityId" lay-filter="areaCity" lay-search=""><option value="">请选择</option>';
for(var i = 0; i < json.rows.length; i++){
str += '<option value="' + json.rows[i].id + '">' + json.rows[i].name + '</option>';
}
......@@ -123,7 +165,7 @@ layui.config({
function loadChildArea(){
AjaxPostUtil.request({url:reqBasePath + "commontarea003", params:{rowId: $("#cityId").val()}, type:'json', callback:function(json){
if(json.returnCode == 0){
var str = '<dd class="layui-col-xs3"><select class="area" id="areaId" lay-filter="area" lay-search=""><option value="">请选择</option>';
var str = '<dd class="layui-col-xs3"><select id="areaId" lay-filter="area" lay-search=""><option value="">请选择</option>';
for(var i = 0; i < json.rows.length; i++){
str += '<option value="' + json.rows[i].id + '">' + json.rows[i].name + '</option>';
}
......@@ -140,7 +182,7 @@ layui.config({
function loadChildAreaTownShip(){
AjaxPostUtil.request({url:reqBasePath + "commontarea004", params:{rowId: $("#areaId").val()}, type:'json', callback:function(json){
if(json.returnCode == 0){
var str = '<dd class="layui-col-xs3"><select class="areaTownShip" id="townshipId" lay-filter="areaTownShip" lay-search=""><option value="">请选择</option>';
var str = '<dd class="layui-col-xs3"><select id="townshipId" lay-filter="areaTownShip" lay-search=""><option value="">请选择</option>';
for(var i = 0; i < json.rows.length; i++){
str += '<option value="' + json.rows[i].id + '">' + json.rows[i].name + '</option>';
}
......
......@@ -19,13 +19,16 @@ layui.config({
idField: 'id',
url: reqBasePath + 'companymation001',
cellMinWidth: 100,
where:{companyName: $("#companyName").val()},
treeId: 'id',//树形id字段名称
treeUpId: 'pId',//树形父id字段名称
treeShowName: 'companyName',//以树形式显示的字段
cols: [[
{ field:'companyName', width:150, title: '公司名称'},
{ field:'companyDesc', width:200, title: '公司简介'},
{ field:'id', width:200, title: '公司地址', templet: function(d){
{ field:'companyName', width:300, title: '公司名称'},
{ field:'companyDesc', width:100, title: '公司简介', templet: function(d){
return '<i class="fa fa-fw fa-html5 cursor" lay-event="companyDesc"></i>';
}},
{ field:'id', width:400, title: '公司地址', templet: function(d){
var str = d.provinceName + " ";
if(!isNull(d.cityName)){
str += d.cityName + " ";
......@@ -41,6 +44,7 @@ layui.config({
}
return str;
}},
{ field:'createTime', width:150, title: '录入时间'},
{ title: '操作', fixed: 'right', align: 'center', width: 240, toolbar: '#tableBar'}
]],
isPage:false
......@@ -53,6 +57,15 @@ layui.config({
del(data, obj);
}else if (layEvent === 'edit') { //编辑
edit(data);
}else if (layEvent === 'companyDesc') { //公司简介
layer.open({
id: '公司简介',
type: 1,
title: '公司简介',
shade: 0.3,
area: ['1200px', '600px'],
content: data.companyDesc,
});
}
});
......@@ -122,7 +135,7 @@ layui.config({
});
function loadTable(){
treeGrid.query("messageTable", {where:{}});
treeGrid.query("messageTable", {where:{companyName: $("#companyName").val()}});
}
exports('companymationlist', {});
......
......@@ -26,6 +26,9 @@
<div class="layui-form-item" id="parentIdBox">
<label class="layui-form-label">总公司<i class="red">*</i></label>
<div class="layui-input-block">
<select id="OverAllCompany" lay-filter="OverAllCompany" lay-search="">
<option value="">请选择</option>
</select>
</div>
</div>
<div class="layui-form-item">
......
......@@ -12,7 +12,10 @@
<form class="layui-form layui-form-pane" action="" autocomplete="off">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">公司名称</label>
<div class="layui-input-inline">
<input id="companyName" name="companyName" class="layui-input" />
</div>
</div>
</div>
<div class="layui-form-item">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册