Browse Source

机构管理

yp 3 years ago
parent
commit
ce6b00d27a

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

@@ -110,6 +110,7 @@ public class OrgInfoServiceImpl implements OrgInfoService {
         List<Map<String, Object>> columnIdDataList = new ArrayList<>();
         List<Map<String, Object>> secondList = new ArrayList<>();
         List<Map<String, Object>> otherCls = new ArrayList<>();
+        List<Map<String, Object>> otherClo = new ArrayList<>();
         if (Blank.isNotEmpty(orgInfo)) {
             String typeData = Convert.toStr(orgInfo.get("type"));
             String columnIdData = Convert.toStr(orgInfo.get("columnId"));
@@ -194,6 +195,7 @@ public class OrgInfoServiceImpl implements OrgInfoService {
             // 其他分类信息
             if (Blank.isNotEmpty(orgInfo)) {
                 String classificationExplain = Convert.toStr(orgInfo.get("classificationExplain"));
+                String columnExplain = Convert.toStr(orgInfo.get("columnExplain"));
                 if (Blank.isNotEmpty(classificationExplain)) {
                     HashMap map = JSON.parseObject(classificationExplain, HashMap.class);
                     for (Object keyName : map.keySet()) {
@@ -207,12 +209,26 @@ public class OrgInfoServiceImpl implements OrgInfoService {
                         }
                     }
                 }
+                if (Blank.isNotEmpty(columnExplain)) {
+                    HashMap colMap = JSON.parseObject(columnExplain, HashMap.class);
+                    for (Object keyName : colMap.keySet()) {
+                        Map<String, Object> otherMap = new HashMap<>();
+                        Map<String, Object> fatInfo = tDictMapper.getFatherInfoById(Convert.toInt(keyName));
+                        if (Blank.isNotEmpty(fatInfo)) {
+                            otherMap.put("otherDes", colMap.get(keyName));
+                            otherMap.put("beforeName", fatInfo.get("dictValue"));
+                            otherMap.put("beforeDataId", fatInfo.get("dictId"));
+                            otherClo.add(otherMap);
+                        }
+                    }
+                }
             }
         }
         orgInfo.put("typeData", typeDataList);
         orgInfo.put("firsTypeData", columnIdDataList);
         orgInfo.put("classification", secondList);
         orgInfo.put("otherClsData", otherCls);
+        orgInfo.put("otherCloData", otherClo);
         return SendUtil.send(true, "", orgInfo);
     }
 

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

@@ -174,14 +174,17 @@
                 <div id="columnId"></div>
             </div>
         </div>
-        <div class="layui-form-item" id="columnShow" style="display: none">
-            <label class="layui-form-label">栏目说明:</label>
-            <div class="layui-input-block">
-                <input type="text" name="columnExplain" id="columnExplain" maxlength="500"
-                       class="layui-input" placeholder="请输入栏目说明"
-                       autocomplete="off">
-            </div>
+        <div id="columnOther">
+
         </div>
+<!--        <div class="layui-form-item" id="columnShow" style="display: none">-->
+<!--            <label class="layui-form-label">栏目说明:</label>-->
+<!--            <div class="layui-input-block">-->
+<!--                <input type="text" name="columnExplain" id="columnExplain" maxlength="500"-->
+<!--                       class="layui-input" placeholder="请输入栏目说明"-->
+<!--                       autocomplete="off">-->
+<!--            </div>-->
+<!--        </div>-->
 <!--        <div class="layui-form-item layui-input-inline">-->
 <!--            <label class="layui-form-label"><span class="font-red">*</span>栏目:</label>-->
 <!--            <div class="layui-input-block">-->

+ 42 - 25
wxdks/src/main/resources/static/page/js/basic/companyManage.js

@@ -128,16 +128,15 @@ function initCompanyPage(){
 
     form.on('submit(submit)', function (data){
         var data = form.val('dataForm');
-        // 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;
-        //     }
-        // }
+
+        var otherColumnData = {};
+        $('#columnOther').find($("input[name='otherColumnClass']")).each(function (){
+            var keyN = $(this).attr("data-id");
+            otherColumnData[keyN] = $(this).val();
+        })
+        var colExplain = JSON.stringify(otherColumnData)
+        data.columnExplain = colExplain;
+
         var otherData = {};
         $('#classificationOther').find($("input[name='otherClass']")).each(function (){
             var keyName = $(this).attr("data-id");
@@ -229,6 +228,7 @@ function initCompanyPage(){
                     if (json.result) {
                         echoForm(json.data);
                         echoClassification(json.data);
+                        echoColumn(json.data);
                     } else {
                         layer.msg(json.msg);
                         return false;
@@ -283,7 +283,25 @@ function initCompanyPage(){
     xmSelectRenderColumnId([ ]);
     xmSelectRender([ ]);
 }
-
+function echoColumn (data) {
+    if (data.columnExplain != '{}') {
+        var othCloData = data.otherCloData;
+        var str = '';
+        if (othCloData && othCloData.length > 0) {
+            for (var i = 0; i < othCloData.length; i++){
+                var beforeName = othCloData[i].beforeName;
+                var otherDes = othCloData[i].otherDes;
+                var beforeDataId = othCloData[i].beforeDataId;
+                str += '<div class="layui-form-item"><label class="layui-form-label">'+beforeName+':</label>' +
+                    '<div class="layui-input-block"><input type="text" data-id="'+beforeDataId+'" name="otherColumnClass"' +
+                    'maxlength="500" class="layui-input" ' +
+                    'value="'+ otherDes +'" autocomplete="off"></div></div>';
+            }
+            $("#columnOther").append(str)
+            form.render()
+        }
+    }
+}
 function echoClassification(data) {
     if (data.classificationExplain != '{}') {
         var othClsData = data.otherClsData;
@@ -302,9 +320,6 @@ function echoClassification(data) {
             form.render()
         }
     }
-    if (data.columnExplain) {
-        $("#columnShow").show();
-    }
 }
 function initColumn(){
     ly.ajax({
@@ -591,6 +606,7 @@ function certificateImgUpload() {
  * 清空数据
  */
 function emptyForm(){
+    $("#columnOther").empty();
     $("#classificationOther").empty();
     // 清空input
     var emptyObj = {
@@ -726,26 +742,28 @@ function xmSelectRenderColumnId(data){
         el: '#columnId',
         tips: '请选择栏目',
         on: function(data){
+            $("#columnOther").empty()
             //arr:  当前多选已选中的数据
             var arr = data.arr;
-            var colFlag = false;
+            var dictIds = '';
             if (arr && arr.length > 0) {
-                var dictIds = '';
                 for (let i = 0; i < arr.length; i++) {
                     dictIds += arr[i].value + ','
+                    var otherId = arr[i].value;
+                    var str = '';
                     if (arr[i].name === '其他') {
-                        colFlag = true;
+                        str += '<div class="layui-form-item"><label class="layui-form-label">栏目说明:</label>' +
+                            '<div class="layui-input-block"><input type="text" data-id="'+otherId+'" name="otherColumnClass"' +
+                            'maxlength="500" class="layui-input" ' +
+                            'placeholder="其他(需注明)" autocomplete="off"></div></div>';
                     }
+                    $("#columnOther").append(str)
+                    form.render()
                 }
                 dictIds = dictIds.substring(0, dictIds.lastIndexOf(","))
             }
-            if (colFlag) {
-                $("#columnShow").show()
-            }else {
-                $("#columnExplain").val('');
-                $("#columnShow").hide()
-            }
             initClassify(dictIds)
+            $("#classificationOther").empty();
         },
         data: data,
     })
@@ -780,7 +798,6 @@ function xmSelectRender(data, vAttr, kAttr){
             $("#classificationOther").empty()
             //arr:  当前多选已选中的数据
             var arr = data.arr;
-            console.log(arr)
             if (arr && arr.length > 0) {
                 for (let i = 0; i < arr.length; i++) {
                     var beforeName = arr[i].__node.parent.name;
@@ -790,7 +807,7 @@ function xmSelectRender(data, vAttr, kAttr){
                         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"' +
                             'maxlength="500" class="layui-input" ' +
-                            'placeholder="'+ beforeName +'" autocomplete="off"></div></div>';
+                            'placeholder="'+ beforeName +' 其他(需注明)" autocomplete="off"></div></div>';
                     }
                     $("#classificationOther").append(str)
                     form.render()