From a1bb62e3ea757c41ad11be1d13a6fc63cf79fbd1 Mon Sep 17 00:00:00 2001
From: zhaoxiaohao <913652501@qq.com>
Date: Sat, 08 Aug 2020 18:00:11 +0800
Subject: [PATCH] 修改  组织树的bug

---
 kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor_form.html |   81 ++++++++++++++++++++++++----------------
 1 files changed, 49 insertions(+), 32 deletions(-)

diff --git a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor_form.html b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor_form.html
index ece5883..c741722 100644
--- a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor_form.html
+++ b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor_form.html
@@ -8,6 +8,7 @@
                     <input name="hospitalName" id="hospitalName" placeholder="请输入医院名称" type="text" class="layui-input"
                         maxlength="50" lay-verify="required" required style="width: 150px;" />
                     <input type="hidden" name="hospitalId" id="hospitalId" />
+                    <input type="hidden" name="id" id="id" />
                 </div>
             </div>
             <div class="layui-inline">
@@ -31,14 +32,6 @@
                     </select>
                 </div>
             </div>
-
-            <!-- </div>
-        <div class="layui-form-item"> -->
-
-            <!-- </div>
-
-        <div class="layui-form-item"> -->
-
         </div>
     </div>
     <div style="display:flex">
@@ -67,13 +60,6 @@
                     </select>
                 </div>
             </div>
-
-            <!-- </div>
-        <div class="layui-form-item"> -->
-
-            <!-- </div>
-        <div class="layui-form-item"> -->
-
         </div>
     </div>
     <div style="display:flex">
@@ -152,17 +138,17 @@
                         lay-verify="required" required />
                 </div>
             </div>
-            <div class="layui-inline">
+            <div class="layui-inline" id="password_div">
                 <label class="layui-form-label">登录密码</label>
                 <div class="layui-input-block" style="width: 150px;">
-                    <input name="password" type="password" lay-verify="required" class="layui-input" maxlength="20"
+                    <input name="password" type="password" id="password"  class="layui-input" maxlength="20"
                         lay-verify="required|phone" required />
-                </div>
-            </div>
-            <div class="layui-inline">
+                </div> 
+            </div> 
+            <div class="layui-inline" id="passwordSure_div">
                 <label class="layui-form-label">确认密码</label>
                 <div class="layui-input-block" style="width: 150px;">
-                    <input name="passwordSure" type="password" lay-verify="required|confirmPass" class="layui-input"
+                    <input name="passwordSure" type="password" id="passwordSure" lay-verify="required|confirmPass" class="layui-input"
                         maxlength="20" />
                 </div>
             </div>
@@ -228,6 +214,8 @@
         var formSelects = layui.formSelects;
         var $ = layui.jquery;
 
+
+
         //获取角色
         var get_role = function () {
             admin.req('api-user/findByMap?tenant_id=hospital', {}, function (data) {
@@ -260,7 +248,7 @@
                 } else {
                     layer.msg('获取角色失败', {
                         icon: 2,
-                        time: 500
+                        time: 2000
                     });
                 }
             }, 'GET');
@@ -276,13 +264,13 @@
                         $("#" + username_id).val("")
                         layer.msg("该登录帐号已经使用", {
                             icon: 2,
-                            time: 500
+                            time: 2000
                         })
                     }
                 } else {
                     layer.msg(data.msg, {
                         icon: 2,
-                        time: 500
+                        time: 2000
                     });
                 }
             }, 'post');
@@ -354,20 +342,22 @@
         //         }
         //     });
         // };
+
+
         // 表单提交事件
         form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
-            data.field.hospitalId = parseInt($("#hospitalId").val());
+            data.field.hospitalId = $("#hospitalId").val();
             if (data.field.roleId != null && data.field.roleId != "") {
                 data.field.roles = data.field.roleId.split(',');
             }
-            data.field.hospitalId = ""+data.field.hospitalId;
+            // data.field.hospitalId = ""+data.field.hospitalId;
             data.field.roleId = null;
-            debugger
             admin.req('api-user/sysdoctor', JSON.stringify(data.field), function (data) {
                 layer.closeAll('loading');
                 if (data.code == 0) {
                     layer.closeAll();
+                    parent.layui.table.reload('app-table', {});
                 } else {
                     layer.msg(data.msg, {
                         icon: 2,
@@ -415,7 +405,7 @@
                 } else {
                     layer.msg(data.msg, {
                         icon: 2,
-                        time: 500
+                        time: 2000
                     });
                 }
             }, 'get');
@@ -423,7 +413,7 @@
         //职称添加数据
         var getZhiCheng = function () {
             admin.req('api-user/sysdictionaries/findAll', JSON.stringify({
-                dictionariesClassId: "1248150699682988034"
+                dictionariesClassId: "DOCTOR_RANK"
             }), function (data) {
                 layer.closeAll('loading');
                 if (0 === data.code) {
@@ -442,7 +432,7 @@
                 } else {
                     layer.msg(data.msg, {
                         icon: 2,
-                        time: 500
+                        time: 2000
                     });
                 }
             }, 'Post');
@@ -461,7 +451,7 @@
                 } else {
                     layer.msg(data.msg, {
                         icon: 2,
-                        time: 500
+                        time: 2000
                     });
                 }
             }, 'get');
@@ -516,7 +506,7 @@
                 username_is_usered("username");
             })
         };
-        loadEditData();
+
         //自动完成-医院名称
         autocomplete.render({
             elem: $('#hospitalName')[0],
@@ -525,10 +515,37 @@
             template_val: '{{d.hospitalName}}', //选择后文本框显示的数据字段
             template_txt: "<div class='layui-table-cell'>{{d.hospitalName}}</div>", //下拉列表模板
             onselect: function (resp) {
+
                 $("#hospitalId").val(resp.id);
                 //重新装载科室
                 getdepartment(resp.id);
             }
         });
+        //数据的回显
+        var doctor = admin.getTempData('t_doctor');
+        $('#app-form-add').attr('method', 'POST');
+        if (doctor) {
+            //重新装载科室
+            getdepartment(doctor.hospitalId);
+            //获取职称的
+            getZhiCheng();
+            //获取销售代表
+            getXiaoShouDaiBiao();
+            //获取角色
+            get_role();
+            form.val('app-form-add', doctor);
+            $("#hospitalId").val(doctor.hospitalId);
+            $("#password_div").hide();
+            $("#passwordSure_div").hide();
+            $('#demo2').append('<img src="' + doctor.doctorLogo +
+                            '" width="50px" height="50px" alt="' + "name" +
+                            '" class="layui-upload-img">')
+            $("#password").removeAttr("lay-verify")
+            $("#password").removeAttr("required")
+            $("#passwordSure").removeAttr("lay-verify")
+            form.render();
+        } else {
+            loadEditData();
+        }
     });
 </script>
\ No newline at end of file

--
Gitblit v1.8.0