Browse Source

机构管理分类调整

yp 3 years ago
parent
commit
6e4a42b0cb

+ 1 - 0
wxdks/src/main/java/com/c3/wxdks/entity/OrgInfo.java

@@ -1,6 +1,7 @@
 package com.c3.wxdks.entity;
 
 import lombok.Data;
+import org.springframework.data.annotation.Id;
 
 import java.util.Date;
 

+ 7 - 0
wxdks/src/main/java/com/c3/wxdks/mapper/TDictMapper.java

@@ -191,4 +191,11 @@ public interface TDictMapper {
 	 * @return
 	 */
 	Map<String, Object> getDictNameById(@Param("dictId") String dictId);
+
+	/**
+	 * 根据id查询上级信息
+	 * @param toInt
+	 * @return
+	 */
+    Map<String, Object> getFatherInfoById(@Param("dictId") Integer toInt);
 }

+ 20 - 0
wxdks/src/main/java/com/c3/wxdks/service/impl/OrgInfoServiceImpl.java

@@ -3,6 +3,7 @@ package com.c3.wxdks.service.impl;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
+import com.alibaba.fastjson.JSON;
 import com.c3.wxdks.base.Constants;
 import com.c3.wxdks.entity.OrgInfo;
 import com.c3.wxdks.mapper.BasicDataMapper;
@@ -12,6 +13,7 @@ import com.c3.wxdks.mapper.TDictTypeMapper;
 import com.c3.wxdks.service.OrgInfoService;
 import com.c3.wxdks.util.Blank;
 import com.c3.wxdks.util.SendUtil;
+import org.apache.ibatis.annotations.Options;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -35,6 +37,7 @@ public class OrgInfoServiceImpl implements OrgInfoService {
     private TDictTypeMapper dictTypeMapper;
 
     @Override
+    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     public Map<String, Object> addOrgInfo(OrgInfo orgInfo) {
         // 查询机构名称是否重复
         int count = orgInfoMapper.selectSameOrg(orgInfo.getOrgName(), null);
@@ -106,6 +109,7 @@ public class OrgInfoServiceImpl implements OrgInfoService {
         List<Map<String, Object>> typeDataList = new ArrayList<>();
         List<Map<String, Object>> columnIdDataList = new ArrayList<>();
         List<Map<String, Object>> secondList = new ArrayList<>();
+        List<Map<String, Object>> otherCls = new ArrayList<>();
         if (Blank.isNotEmpty(orgInfo)) {
             String typeData = Convert.toStr(orgInfo.get("type"));
             String columnIdData = Convert.toStr(orgInfo.get("columnId"));
@@ -187,10 +191,26 @@ public class OrgInfoServiceImpl implements OrgInfoService {
                 firstGroup.put("children", resultList);
                 secondList.add(firstGroup);
             }
+            // 其他分类信息
+
+            if (Blank.isNotEmpty(orgInfo)) {
+                String classificationExplain = Convert.toStr(orgInfo.get("classificationExplain"));
+                HashMap map = JSON.parseObject(classificationExplain, HashMap.class);
+                for (Object keyName : map.keySet()) {
+                    Map<String, Object> otherMap = new HashMap<>();
+                    Map<String, Object> fatInfo = tDictMapper.getFatherInfoById(Convert.toInt(keyName));
+                    if (Blank.isNotEmpty(fatInfo)) {
+                        otherMap.put("otherDes", map.get(keyName));
+                        otherMap.put("beforeName", fatInfo.get("dictValue"));
+                        otherCls.add(otherMap);
+                    }
+                }
+            }
         }
         orgInfo.put("typeData", typeDataList);
         orgInfo.put("firsTypeData", columnIdDataList);
         orgInfo.put("classification", secondList);
+        orgInfo.put("otherClsData", otherCls);
         return SendUtil.send(true, "", orgInfo);
     }
 

+ 11 - 0
wxdks/src/main/resources/com/c3/wxdks/mapper/TDictMapper.xml

@@ -181,6 +181,17 @@
 		where
 		dict_id = #{dictId}
 	</select>
+	<!--根据id查询上级信息-->
+	<select id="getFatherInfoById" resultType="java.util.Map">
+		select
+		<include refid="baseColumnAll" />
+		from
+		t_dict
+		WHERE
+		parent_key = ( SELECT parent_key FROM `t_dict` WHERE dict_id = #{dictId} )
+		AND dict_key = parent_key
+	</select>
+
 	<select id="getTreeNode" resultType="java.util.Map">
 		select
 			<include refid="baseColumnAll" />

+ 11 - 7
wxdks/src/main/resources/static/page/companyManage.html

@@ -236,14 +236,18 @@
                 <div id="classification"></div>
             </div>
         </div>
-        <div class="layui-form-item" id="classificationShow" style="display: none">
-            <label class="layui-form-label">分类说明:</label>
-            <div class="layui-input-block">
-                <input type="text" name="classificationExplain" id="classificationExplain" maxlength="500"
-                       class="layui-input" placeholder="请输入分类说明"
-                       autocomplete="off">
-            </div>
+        <div id="classificationOther">
+
         </div>
+
+<!--        <div class="layui-form-item" id="classificationShow" style="display: none">-->
+<!--            <label class="layui-form-label">分类说明:</label>-->
+<!--            <div class="layui-input-block">-->
+<!--                <input type="text" name="classificationExplain" id="classificationExplain" maxlength="500"-->
+<!--                       class="layui-input" placeholder="请输入分类说明"-->
+<!--                       autocomplete="off">-->
+<!--            </div>-->
+<!--        </div>-->
         <div class="layui-form-item">
             <label class="layui-form-label">机构头像:</label>
             <div class="layui-input-block">

+ 95 - 30
wxdks/src/main/resources/static/page/js/basic/companyManage.js

@@ -127,9 +127,20 @@ function initCompanyPage(){
     // })
 
     form.on('submit(submit)', function (data){
-    // $('#submit').click(function () {
         var data = form.val('dataForm');
-        // console.log(data)
+        var objs = $("input[name='otherClass']") //选择所有的name属性等于'otherClass'的input元素
+        // console.log(objs)
+        var otherData = {};
+        if (objs && objs.length > 0) {
+            for (var i = 0; i < objs.length; i++){
+                console.log(objs[i].dataset.id)
+                var keyName = objs[i].dataset.id;
+                otherData[keyName] = objs[i].value;
+            }
+        }
+        // console.log(otherData)
+        var clsExplain = JSON.stringify(otherData)
+        data.classificationExplain = clsExplain;
 
         var selectTypeValue = xmSelect.get('#type', true).getValue();
         var selectTypeList = '';
@@ -213,12 +224,7 @@ function initCompanyPage(){
                     // console.log(json);
                     if (json.result) {
                         echoForm(json.data);
-                        if (json.data.classificationExplain) {
-                            $("#classificationShow").show();
-                        }
-                        if (json.data.columnExplain) {
-                            $("#columnShow").show();
-                        }
+                        echoClassification(json.data);
                     } else {
                         layer.msg(json.msg);
                         return false;
@@ -274,6 +280,38 @@ function initCompanyPage(){
     xmSelectRender([]);
 }
 
+function echoClassification(data) {
+    if (data.classificationExplain != '{}') {
+        var othClsData = data.otherClsData;
+        var str = '';
+        if (othClsData && othClsData.length > 0) {
+            for (var i = 0; i < othClsData.length; i++){
+                var beforeName = othClsData[i].beforeName;
+                var otherDes = othClsData[i].otherDes;
+                str += '<div class="layui-form-item"><label class="layui-form-label">'+beforeName+':</label>' +
+                        '<div class="layui-input-block"><input type="text" name="otherClass"' +
+                        'maxlength="500" class="layui-input" ' +
+                        'value="'+ otherDes +'" autocomplete="off"></div></div>';
+            }
+            $("#classificationOther").append(str)
+            form.render()
+        }
+        // var beforeName = arr[i].__node.parent.name;
+        // var otherId = arr[i].value;
+        // var str = '';
+        // if (arr[i].name === '其他') {
+        //     str += '<div class="layui-form-item"><label class="layui-form-label">'+beforeName+':</label>' +
+        //         '<div class="layui-input-block"><input type="text" data-id="'+otherId+'" name="otherClass" id= "otherClass"'+i+' ' +
+        //         'maxlength="500" class="layui-input" ' +
+        //         'placeholder="'+ beforeName +'" autocomplete="off"></div></div>';
+        // }
+        // $("#classificationOther").append(str)
+        // form.render()
+    }
+    // if (json.data.columnExplain) {
+    //     $("#columnShow").show();
+    // }
+}
 function initColumn(){
     ly.ajax({
         type: 'GET',
@@ -559,8 +597,8 @@ function certificateImgUpload() {
  * 清空数据
  */
 function emptyForm(){
-    $("#columnShow").hide();
-    $("#classificationShow").hide();
+    $("#classificationOther").empty();
+
     // 清空input
     var emptyObj = {
         'id': '',
@@ -741,39 +779,66 @@ function xmSelectRenderType(data){
     })
 }
 function xmSelectRender(data, vAttr, kAttr){
-    // var selectData = [];
-    // for (var i = 0; i < data.length; i++) {
-    //     var obj = {
-    //         name: data[i][kAttr],
-    //         value: data[i][vAttr],
-    //     };
-    //     selectData.push(obj);
-    // }
-    // console.log(selectData);
     xmSelect.render({
         el: '#classification',
         tips: '请选择分类',
         data: data,
         on: function(data){
+            $("#classificationOther").empty()
             //arr:  当前多选已选中的数据
             var arr = data.arr;
-            var clsFlag = false;
+            console.log(arr)
             if (arr && arr.length > 0) {
                 for (let i = 0; i < arr.length; i++) {
+                    var beforeName = arr[i].__node.parent.name;
+                    var otherId = arr[i].value;
+                    var str = '';
                     if (arr[i].name === '其他') {
-                        clsFlag = true;
+                        str += '<div class="layui-form-item"><label class="layui-form-label">'+beforeName+':</label>' +
+                            '<div class="layui-input-block"><input type="text" data-id="'+otherId+'" name="otherClass" id= "otherClass"'+i+' ' +
+                            'maxlength="500" class="layui-input" ' +
+                            'placeholder="'+ beforeName +'" autocomplete="off"></div></div>';
                     }
+                    $("#classificationOther").append(str)
+                    form.render()
                 }
             }
-            if (clsFlag) {
-                $("#classificationShow").show();
-            }else {
-                $("#classificationExplain").val('');
-                $("#classificationShow").hide();
-            }
         },
-        // tree: {
-        //     show: true
-        // }
     })
+
+    // var selectData = [];
+    // for (var i = 0; i < data.length; i++) {
+    //     var obj = {
+    //         name: data[i][kAttr],
+    //         value: data[i][vAttr],
+    //     };
+    //     selectData.push(obj);
+    // }
+    // console.log(selectData);
+    // xmSelect.render({
+    //     el: '#classification',
+    //     tips: '请选择分类',
+    //     data: data,
+    //     on: function(data){
+    //         //arr:  当前多选已选中的数据
+    //         var arr = data.arr;
+    //         var clsFlag = false;
+    //         if (arr && arr.length > 0) {
+    //             for (let i = 0; i < arr.length; i++) {
+    //                 if (arr[i].name === '其他') {
+    //                     clsFlag = true;
+    //                 }
+    //             }
+    //         }
+    //         if (clsFlag) {
+    //             $("#classificationShow").show();
+    //         }else {
+    //             $("#classificationExplain").val('');
+    //             $("#classificationShow").hide();
+    //         }
+    //     },
+    //     // tree: {
+    //     //     show: true
+    //     // }
+    // })
 }

+ 6 - 5
wxdks/src/main/resources/static/page/recruitManage.html

@@ -203,22 +203,23 @@
             <label class="layui-form-label"><span class="font-red">*</span>招聘人数:</label>
             <div class="layui-input-block">
                 <input type="text" name="recruitNum" id="recruitNum" maxlength="500"
-                       lay-verify="required" class="layui-input" placeholder="请输入招聘人数"
+                       lay-verify="required" class="layui-input"
+                       onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" placeholder="请输入招聘人数"
                        autocomplete="off">
             </div>
         </div>
         <div class="layui-form-item layui-input-inline">
-            <label class="layui-form-label"><span class="font-red">*</span>学历要求:</label>
+            <label class="layui-form-label">学历要求:</label>
             <div class="layui-input-block">
-                <select name="education" lay-filter="education" id="education" lay-verify="required">
+                <select name="education" lay-filter="education" id="education">
 
                 </select>
             </div>
         </div>
         <div class="layui-form-item layui-input-inline">
-            <label class="layui-form-label"><span class="font-red">*</span>工作经验:</label>
+            <label class="layui-form-label">工作经验:</label>
             <div class="layui-input-block">
-                <select name="workExperience" lay-filter="workExperience" id="workExperience" lay-verify="required">
+                <select name="workExperience" lay-filter="workExperience" id="workExperience">
 
                 </select>
             </div>