浏览代码

添加机构联系人字段

庄逸洲 5 年前
父节点
当前提交
f41e33c9c3
共有 4 个文件被更改,包括 21 次插入9 次删除
  1. 6 3
      controllers/org_controller.go
  2. 1 0
      models/org_models.go
  3. 7 3
      static/js/create_org.js
  4. 7 3
      views/new_main/create_org.html

+ 6 - 3
controllers/org_controller.go 查看文件

@@ -66,7 +66,7 @@ func (this *OrgController) Create() {
66 66
 
67 67
 // /org/create/submit [post]
68 68
 // @param name:string
69
-// @param short_name:string
69
+// @param short_name:string 已和 name 同步,不需要传了
70 70
 // @param intro?:string
71 71
 // @param logo?:string
72 72
 // @param province:int
@@ -75,6 +75,7 @@ func (this *OrgController) Create() {
75 75
 // @param address:string
76 76
 // @param ill?:string ("病种1,病种2")
77 77
 // @param category:int
78
+// @param contact_name:string
78 79
 // @param org_phone?:string
79 80
 // @param business_week?:string
80 81
 // @param business_time?:string
@@ -105,7 +106,7 @@ func (this *OrgController) CreateSubmit() {
105 106
 	}
106 107
 
107 108
 	name := this.GetString("name")
108
-	shortName := this.GetString("short_name")
109
+	shortName := name // this.GetString("short_name")
109 110
 	intro := this.GetString("intro")
110 111
 	logo := this.GetString("logo")
111 112
 	province, _ := this.GetInt("province", 0)
@@ -114,7 +115,8 @@ func (this *OrgController) CreateSubmit() {
114 115
 	address := this.GetString("address")
115 116
 	ill := this.GetString("ill")
116 117
 	category, _ := this.GetInt64("category")
117
-	if len(name) == 0 || len(shortName) == 0 || len(address) == 0 || province <= 0 || city <= 0 || district <= 0 || category <= 0 {
118
+	contactName := this.GetString("contact_name")
119
+	if len(name) == 0 || len(shortName) == 0 || len(contactName) == 0 || len(address) == 0 || province <= 0 || city <= 0 || district <= 0 || category <= 0 {
118 120
 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
119 121
 		this.ServeJSON()
120 122
 		return
@@ -151,6 +153,7 @@ func (this *OrgController) CreateSubmit() {
151 153
 		OrgType:         category,
152 154
 		OperatingState:  businessState,
153 155
 		Telephone:       orgPhone,
156
+		ContactName:     contactName,
154 157
 		BusinessWeek:    businessWeek,
155 158
 		BusinessTime:    businessTime,
156 159
 		Gallery:         orgPics,

+ 1 - 0
models/org_models.go 查看文件

@@ -16,6 +16,7 @@ type Org struct {
16 16
 	CreateTime      int64  `gorm:"column:ctime" json:"ctime"` // 创建时间
17 17
 	ModifyTime      int64  `gorm:"column:mtime" json:"mtime"` // 修改时间
18 18
 
19
+	ContactName    string        `gorm:"column:contact_name" json:"contact_name"`
19 20
 	OrgType        int64         `gorm:"column:org_type" json:"org_type"`
20 21
 	Evaluate       float64       `gorm:"column:evaluate" json:"evaluate"`
21 22
 	Comments       int64         `gorm:"column:comments" json:"comments"`

+ 7 - 3
static/js/create_org.js 查看文件

@@ -119,7 +119,8 @@ $(function() {
119 119
 
120 120
         var postData = {
121 121
             name: $("#org_name").val(),
122
-            short_name: $("#org_short_name").val(),
122
+            // short_name: $("#org_short_name").val(),
123
+            contact_name: $("#contact_name").val(),
123 124
             province: $("#province_select option:selected").val(),
124 125
             city: $("#city_select option:selected").val(),
125 126
             district: $("#district_select option:selected").val(),
@@ -144,8 +145,11 @@ function checkInfoFull() {
144 145
     if ($("#org_name").val().length == 0) {
145 146
         return "请填写机构名称";
146 147
     }
147
-    if ($("#org_short_name").val().length == 0) {
148
-        return "请填写机构简称";
148
+    // if ($("#org_short_name").val().length == 0) {
149
+    //     return "请填写机构简称";
150
+    // }
151
+    if ($("#contact_name").val().length == 0) {
152
+        return "请填写联系人姓名";
149 153
     }
150 154
     if ($("#province_select option:selected").val() == "0") {
151 155
         return "请选择省份";

+ 7 - 3
views/new_main/create_org.html 查看文件

@@ -43,9 +43,13 @@
43 43
                     <label class="cell_tit fl">机构名称</label>
44 44
                     <input id="org_name" type="text" class="cell_input" maxlength="50" />
45 45
                 </div>
46
-                <div class="cell clearfix">
46
+                <!-- <div class="cell clearfix">
47 47
                     <label class="cell_tit fl">机构简称</label>
48
-                    <input id="org_short_name" type="text" class="cell_input" maxlength="20" />
48
+                    <input id="org_short_name" type="text" class="cell_input" maxlength="50" />
49
+                </div> -->
50
+                <div class="cell clearfix">
51
+                    <label class="cell_tit fl">联系人姓名</label>
52
+                    <input id="contact_name" type="text" class="cell_input" maxlength="20" />
49 53
                 </div>
50 54
                 <div class="cell clearfix">
51 55
                     <label class="cell_tit fl">机构类型</label>
@@ -115,7 +119,7 @@
115 119
     <script src="/static/js/layer.js"></script>
116 120
     <script src="/static/js/md5.js"></script>
117 121
     <script src="/static/js/common.js"></script>
118
-    <script src="/static/js/create_org.js?v=0.2.4"></script>
122
+    <script src="/static/js/create_org.js?v=0.2.5"></script>
119 123
 </body>
120 124
 
121 125
 </html>