66 Commits 3ef08aa633 ... cc2f9d3a43

Auteur SHA1 Message Date
  XMTT cc2f9d3a43 pdg.reload 7 ans auparavant
  XMTT 6bb18ee6f0 专家学术领域的字数限制改为15字 7 ans auparavant
  XMTT be40c52b5a 完善细节,更改日期选择方式 7 ans auparavant
  XMTT 801c3c3d36 新版专家录入和专家录入审核 7 ans auparavant
  XMTT fb81022453 去掉默认帐号密码 7 ans auparavant
  XMTT 57fca2c3ea auth_type 7 ans auparavant
  XMTT a6c9a0c45d 专家权重设置 7 ans auparavant
  XMTT d3a2b2e39b authtype =1 7 ans auparavant
  XMTT 2676a86705 资源导入 7 ans auparavant
  XMTT db87093f3f 00 7 ans auparavant
  XMTT 96994955e1 图表 7 ans auparavant
  XMTT f77f5aa02b aa 7 ans auparavant
  XMTT 658b81b33b aa 7 ans auparavant
  XMTT a5f210317f 专家录入和专家录入审核功能 7 ans auparavant
  XMTT 30eafab053 dd 7 ans auparavant
  XMTT 85b7a5f4c3 机构管理 增加 修改 图片上传 webUploader 7 ans auparavant
  XMTT 73d69ffbca modify bug 7 ans auparavant
  XMTT 5d65a56d04 邮件发送 7 ans auparavant
  XMTT 3bc9f3f9f5 客户跟踪管理界面新增发送邀请邮件功能 7 ans auparavant
  XMTT cce0dd33b5 身份证号码录入 7 ans auparavant
  XMTT 3f10b54e54 认证图片路径 7 ans auparavant
  XMTT 205335ad9f Merge branch 'master' of http://121.42.53.174:3000/jiapeng/console-front 7 ans auparavant
  XMTT b10546735c 更改需求状态 7 ans auparavant
  XMTT d8f601d475 需求管理 7 ans auparavant
  yunkai 18d85bade9 00 7 ans auparavant
  XMTT 79e80ccd76 流量统计表优化 7 ans auparavant
  XMTT 3caa255ebf 用户流量统计 7 ans auparavant
  XMTT 9cb877dffe Merge remote-tracking branch 'origin/master' 7 ans auparavant
  XMTT 80c4a4f066 咨询管理 7 ans auparavant
  XMTT 9dfcf030a7 客户池管理 机构 typeahead 7 ans auparavant
  XMTT 7b4747be64 11 7 ans auparavant
  XMTT f1357b140a 00 7 ans auparavant
  XMTT 25a7684ae4 客户姓名跳转 7 ans auparavant
  XMTT b5ce68136d Merge branch 'TT' 7 ans auparavant
  XMTT 6847ee6756 编辑用户>更新头像 7 ans auparavant
  XMTT 5923473d49 add UserEdit 7 ans auparavant
  yunkai 7f9339ab80 Merge branch 'master' of 7 ans auparavant
  XMTT 9e08fc080a add 个人业绩 7 ans auparavant
  XMTT b3bfbfd39b interval 7 ans auparavant
  XMTT 6f91f97f38 Merge branch 'TT' 7 ans auparavant
  XMTT 618fcd462a Merge branch 'master' of http://121.42.53.174:3000/jiapeng/console-front 7 ans auparavant
  XMTT ccf815fc22 Merge branch 'TT' 7 ans auparavant
  yunkai 63271c542c 0 7 ans auparavant
  yunkai 860694e5c5 0 7 ans auparavant
  yunkai f29414fdc0 Merge remote-tracking branch 'origin/master' 7 ans auparavant
  yunkai e6d0e14104 0 7 ans auparavant
  XMTT b56b115d9f lixin+zhao 7 ans auparavant
  jiapeng f1cbf7cd87 00 7 ans auparavant
  jiapeng d314e417d4 0 7 ans auparavant
  jiapeng 75b018a028 0 7 ans auparavant
  jiapeng 3434ca5879 0 7 ans auparavant
  jiapeng ec579280f8 00 7 ans auparavant
  jiapeng acacb8280b 000 7 ans auparavant
  jiapeng 62859fea38 111 7 ans auparavant
  jiapeng f38e1292b2 3 7 ans auparavant
  root ce75edb146 i 7 ans auparavant
  jiapeng e5a31753d5 111 7 ans auparavant
  root bd334074e9 iu 7 ans auparavant
  jiapeng f4c87426c2 qq 7 ans auparavant
  jiapeng a1cf46f098 dd 7 ans auparavant
  jiapeng 88b04163ec 7 ans auparavant
  jiapeng e5030f4c42 ddd 7 ans auparavant
  root ffd87df46e uu 7 ans auparavant
  pengjia 193c266265 add ignore 7 ans auparavant
  jiapeng 61ee1f46df ddd 7 ans auparavant
  jiapeng e551a43561 init 7 ans auparavant

+ 0 - 144
html/model/sys/org/details.html

@ -1,144 +0,0 @@
1
<div class="sys_org_details centerModal">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div class="container newForm">
6
        <div class="row">
7
            <div class="col-2 item-caption">企业名称</div>
8
            <div class="col-6">
9
                <div class="form-item text readOnly" defVal="" name="name"></div>
10
            </div>
11
        </div>
12
        <div class="row">
13
            <div class="col-2 item-caption">企业简称</div>
14
            <div class="col-6">
15
                <div class="form-item text" defVal="" name="forShort"></div>
16
            </div>
17
            <span class="requiredSpan">*</span>
18
        </div>
19
        <div class="row">
20
            <div class="col-2 item-caption">企业网址</div>
21
            <div class="col-6">
22
                <div class="form-item text" defVal="" name="orgUrl"></div>
23
            </div>
24
        </div>
25
        <div class="row">
26
            <div class="col-2 item-caption">创建时间</div>
27
            <div class="col-4">
28
                <div class="form-item date" defVal="" name="foundTime"></div>
29
            </div>
30
        </div>
31
        <div class="row">
32
            <div class="col-2 item-caption">地址</div>
33
            <div class="col-8">
34
                <form action="" name="form1">
35
                    <div class=" col-6 citybox">
36
														<span class="frmtype frmtypeW" id="Province">
37
				                                        	<em class="mr_sj"></em>
38
				                                            <i class="mr_show" id="oprovince">请选择省份</i>
39
				                                            <ul>
40
				                                                <li><a href="javascript:void(0)" alt="请选择省份">请选择省份</a></li>
41
				                                            </ul>
42
				                                            <input type="hidden" name="cho_Province"
43
                                                                   value="请选择省份">
44
				                                        </span>
45
                    </div>
46
                    <div class="col-6 citybox">
47
														<span class="frmtype frmtypeW" id="City">
48
				                                       		<em class="mr_sj"></em>
49
				                                            <i class="mr_show" id="ocity"></i>
50
				                                            <ul>
51
				                                                <li><a href="javascript:void(0)" alt="请选择城市">请选择城市</a></li>
52
				                                            </ul>
53
				                                            <input type="hidden" name="cho_City" value="请选择城市 ">
54
				                                        </span>
55
                    </div>
56
                </form>
57
            </div>
58
        </div>
59
        <div class="row">
60
            <div class="col-2 item-caption">简介</div>
61
            <div class="col-4">
62
                <div class="form-item textarea" defVal="" name="descp"></div>
63
            </div>
64
        </div>
65
        <div class="row">
66
            <div class="col-2 item-caption">标签</div>
67
            <div class="col-4">
68
                <div class="form-item select" defVal="" dictCode="typeOrg" name="orgType"></div>
69
            </div>
70
        </div>
71
        <div class="row">
72
            <div class="col-2 item-caption">所属行业</div>
73
            <div class="col-4">
74
                <div class="form-item text" defVal="" name="newIndustry"></div>
75
            </div>
76
            <div class="col-2">
77
                <div class="btn pull-right opt-industry">
78
                    <i class="icon-check"></i> SAVE
79
                </div>
80
            </div>
81
        </div>
82
        <div class="row">
83
            <div class="col-2"></div>
84
            <div class="col-6">
85
                <div class="form-item dyn-mselect orgSize"  name="industryList"></div>
86
            </div>
87
        </div>
88
        <div class="row">
89
            <div class="col-2 item-caption">专注领域</div>
90
            <div class="col-4">
91
                <div class="form-item text" defVal="" name="newSubject"></div>
92
            </div>
93
            <div class="col-2">
94
                <div class="btn pull-right opt-subject">
95
                    <i class="icon-check"></i> SAVE
96
                </div>
97
            </div>
98
        </div>
99
        <div class="row">
100
            <div class="col-2"></div>
101
            <div class="col-6">
102
                <div class="form-item dyn-mselect orgSize"  name="subjectList"></div>
103
            </div>
104
        </div>
105
        <div class="row">
106
            <div class="col-2 item-caption">企业规模</div>
107
            <div class="col-4">
108
                <div class="form-item select" defVal="" dictCode="orgSize" name="orgSize"></div>
109
            </div>
110
        </div>
111
        <div class="row">
112
            <div class="col-2 item-caption">企业资质</div>
113
            <div class="col-4">
114
                <div class="form-item text" defVal="" name="newQualification"></div>
115
            </div>
116
            <div class="col-2">
117
                <div class="btn pull-right opt-qf">
118
                    <i class="icon-check"></i> SAVE
119
                </div>
120
            </div>
121
        </div>
122
        <div class="row">
123
            <div class="col-2"></div>
124
            <div class="col-6">
125
                <div class="form-item dyn-mselect orgSize"  name="qualificationList"></div>
126
            </div>
127
        </div>
128
        <div class="row">
129
            <div class="col-10"></div>
130
            <div class="col-2">
131
                <div class="btn pull-right opt-save">
132
                    <i class="icon-check"></i> SAVE
133
                </div>
134
            </div>
135
        </div>
136
        <div class="head-ctn">
137
            <div id="uploader-demo">
138
                <div id="fileList" class="uploader-list"></div>
139
                <div id="filePicker">选择图片</div>
140
            </div>
141
        </div>
142
143
    </div>
144
</div>

+ 7 - 1
html/model/sys/org/edit.html

@ -6,7 +6,13 @@
6 6
        <div class="row">
7 7
            <div class="col-2 item-caption">企业名称</div>
8 8
            <div class="col-6">
9
                <div class="form-item text readOnly" defVal="" name="name"></div>
9
                <div class="form-item text" defVal="" name="name"></div>
10
            </div>
11
        </div>
12
        <div class="row">
13
            <div class="col-2 item-caption">邮箱账户</div>
14
            <div class="col-6">
15
                <div class="form-item text showOnly" defVal="" name="email"></div>
10 16
            </div>
11 17
        </div>
12 18
        <div class="row">

+ 4 - 10
html/model/sys/org/index.html

@ -40,19 +40,13 @@
40 40
	<div class="container tpl-btns">
41 41
		<div class="row">
42 42
			<div class="btn opt-new">
43
				新增账户
43
				<i class="icon-plus"></i> 增加
44 44
			</div>
45 45
			<div class="btn opt-edit">
46
				修改账户信息
46
				<i class="icon-edit"></i>编缉
47 47
			</div>
48
			<div class="btn opt-details">
49
				编辑企业资料
50
			</div>
51
			<div class="btn opt-view">
52
				查看企业信息
53
			</div>
54
			<div class="btn opt-data">
55
				设置业务数据
48
			<div class="btn opt-del">
49
				<i class="icon-remove-sign"></i>删除
56 50
			</div>
57 51
		</div>
58 52
	</div>

+ 130 - 8
html/model/sys/org/new.html

@ -4,28 +4,150 @@
4 4
    </div>
5 5
    <div class="container newForm">
6 6
        <div class="row">
7
            <div class="col-2 item-caption">邮箱</div>
7
            <div class="col-2 item-caption">企业名称</div>
8 8
            <div class="col-6">
9
                <div class="form-item text required" placeholder="请输入正确的邮箱地址" name="email"></div>
9
                <div class="form-item text" defVal="" name="name"></div>
10 10
            </div>
11
            <span class="requiredSpan">*</span>
11 12
        </div>
12
        <span class="requiredSpan">*</span>
13 13
        <div class="row">
14
            <div class="col-2 item-caption">用户名</div>
14
            <div class="col-2 item-caption">邮箱账户</div>
15 15
            <div class="col-6">
16
                <div class="form-item text required" placeholder="姓名最长为10个字" name="name"></div>
16
                <div class="form-item text" defVal="" name="email"></div>
17
            </div>
18
            <span class="requiredSpan">*</span>
19
        </div>
20
        <div class="row">
21
            <div class="col-2 item-caption">企业简称</div>
22
            <div class="col-6">
23
                <div class="form-item text" defVal="" name="forShort"></div>
24
            </div>
25
            <span class="requiredSpan">*</span>
26
        </div>
27
        <div class="row">
28
            <div class="col-2 item-caption">企业网址</div>
29
            <div class="col-6">
30
                <div class="form-item text" defVal="" name="orgUrl"></div>
31
            </div>
32
        </div>
33
        <div class="row">
34
            <div class="col-2 item-caption">创建时间</div>
35
            <div class="col-4">
36
                <div class="form-item date" defVal="" name="foundTime"></div>
37
            </div>
38
        </div>
39
        <div class="row">
40
            <div class="col-2 item-caption">地址</div>
41
            <div class="col-8">
42
                <form action="" name="form1">
43
                    <div class=" col-6 citybox">
44
														<span class="frmtype frmtypeW" id="Province">
45
				                                        	<em class="mr_sj"></em>
46
				                                            <i class="mr_show" id="oprovince">请选择省份</i>
47
				                                            <ul>
48
				                                                <li><a href="javascript:void(0)" alt="请选择省份">请选择省份</a></li>
49
				                                            </ul>
50
				                                            <input type="hidden" name="cho_Province"
51
                                                                   value="请选择省份">
52
				                                        </span>
53
                    </div>
54
                    <div class="col-6 citybox">
55
														<span class="frmtype frmtypeW" id="City">
56
				                                       		<em class="mr_sj"></em>
57
				                                            <i class="mr_show" id="ocity"></i>
58
				                                            <ul>
59
				                                                <li><a href="javascript:void(0)" alt="请选择城市">请选择城市</a></li>
60
				                                            </ul>
61
				                                            <input type="hidden" name="cho_City" value="请选择城市 ">
62
				                                        </span>
63
                    </div>
64
                </form>
65
            </div>
66
            <span class="requiredSpan">*</span>
67
        </div>
68
        <div class="row">
69
            <div class="col-2 item-caption">简介</div>
70
            <div class="col-4">
71
                <div class="form-item textarea" defVal="" name="descp"></div>
72
            </div>
73
        </div>
74
        <div class="row">
75
            <div class="col-2 item-caption">标签</div>
76
            <div class="col-4">
77
                <div class="form-item select" defVal="" dictCode="typeOrg" name="orgType"></div>
78
            </div>
79
        </div>
80
        <div class="row">
81
            <div class="col-2 item-caption">所属行业</div>
82
            <div class="col-4">
83
                <div class="form-item text" defVal="" name="newIndustry"></div>
84
            </div>
85
            <div class="col-2">
86
                <div class="btn pull-right opt-industry">
87
                    <i class="icon-check"></i> SAVE
88
                </div>
89
            </div>
90
        </div>
91
        <div class="row">
92
            <div class="col-2"></div>
93
            <div class="col-6">
94
                <div class="form-item dyn-mselect orgSize"  name="industryList"></div>
95
            </div>
96
        </div>
97
        <div class="row">
98
            <div class="col-2 item-caption">专注领域</div>
99
            <div class="col-4">
100
                <div class="form-item text" defVal="" name="newSubject"></div>
101
            </div>
102
            <div class="col-2">
103
                <div class="btn pull-right opt-subject">
104
                    <i class="icon-check"></i> SAVE
105
                </div>
106
            </div>
107
        </div>
108
        <div class="row">
109
            <div class="col-2"></div>
110
            <div class="col-6">
111
                <div class="form-item dyn-mselect orgSize"  name="subjectList"></div>
112
            </div>
113
        </div>
114
        <div class="row">
115
            <div class="col-2 item-caption">企业规模</div>
116
            <div class="col-4">
117
                <div class="form-item select" defVal="" dictCode="orgSize" name="orgSize"></div>
118
            </div>
119
        </div>
120
        <div class="row">
121
            <div class="col-2 item-caption">企业资质</div>
122
            <div class="col-4">
123
                <div class="form-item text" defVal="" name="newQualification"></div>
124
            </div>
125
            <div class="col-2">
126
                <div class="btn pull-right opt-qf">
127
                    <i class="icon-check"></i> SAVE
128
                </div>
129
            </div>
130
        </div>
131
        <div class="row">
132
            <div class="col-2"></div>
133
            <div class="col-6">
134
                <div class="form-item dyn-mselect orgSize"  name="qualificationList"></div>
17 135
            </div>
18 136
        </div>
19
        <span class="requiredSpan">*</span>
20 137
        <div class="row">
21 138
            <div class="col-10"></div>
22 139
            <div class="col-2">
23 140
                <div class="btn pull-right opt-save">
24 141
                    <i class="icon-check"></i> SAVE
25 142
                </div>
26
27 143
            </div>
28 144
        </div>
29
    </div>
145
        <div class="head-ctn">
146
            <div id="uploader-demo">
147
                <div id="fileList" class="uploader-list"></div>
148
                <div id="filePicker">选择图片</div>
149
            </div>
150
        </div>
30 151
152
    </div>
31 153
</div>

+ 0 - 203
js/model/sys/org/details.js

@ -1,203 +0,0 @@
1
/**
2
 * Created by TT on 2017/7/19.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "util", "form", "upload"], function (spa, util, fb, upload) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_org_new");
10
                var ca = {ready: true, items: []};
11
                var form = fb.build(root.find(".newForm"), {
12
                    industryList: ca,
13
                    subjectList: ca,
14
                    qualificationList: ca
15
                });
16
                var id = util.data("loginUser").id;
17
                var cacheImageKey = null;
18
                var oValue;
19
                var oJudge;
20
                var saveBtn = root.find(".opt-save"),
21
                    headArea = root.find(".head-ctn"),
22
                    save = function () {
23
                        form.val({inviterId: id});
24
                        form.val({
25
                            industry: oString(form.val().industryList),
26
                            subject: oString(form.val().subjectList),
27
                            qualification: oString(form.val().qualificationList)
28
                        });
29
                        if (form.val().orgType == null) {
30
                            form.val({orgType: 1});
31
                        }
32
                        if (form.val().forShort == null) {
33
                            util.alert("请输入企业简称");
34
                        } else form.doPost("../ajax/sys/org/create", function () {
35
                            spa.closeModal();
36
                            if (data) {
37
                                data();
38
                            }
39
                        },function (data) {
40
                            util.alert(data.msg);
41
                        });
42
                    };
43
                root.find(".modal-ctrl .icon-times").on("click", function () {
44
                    spa.closeModal();
45
                });
46
47
                var part = function (one, list) {
48
                    oValue = one;
49
                    oJudge = list || [];
50
                    var repeat,
51
                        b;
52
                    if (!oValue) {
53
                        util.alert('提示', '请先填写内容');
54
                        return;
55
                    }
56
                    if (oValue.length > 10) {
57
                        util.alert('提示', '添加内容不能超过10个字');
58
                        return;
59
                    } else {
60
                        var oValueList = oValue.split(","),
61
                            length = oValueList.length;
62
                        for (var j = 0; j < length; j++) {
63
                            for (var n = j + 1; n < oValueList.length + 1;) {
64
                                if (oValueList[j] == oValueList[n]) {
65
                                    oValueList.remove(n);
66
                                    repeat = false;
67
                                } else {
68
                                    n++;
69
                                }
70
                            }
71
                        }
72
                        for (var j = 0; j < oValueList.length;) {
73
                            for (var i = 0; i < oJudge.length; i++) {
74
                                if (oValueList[j] == oJudge[i]) {
75
                                    oValueList.remove(j);
76
                                    repeat = false;
77
                                    b = true;
78
                                }
79
                            }
80
                            if (b) {
81
                                b = false
82
                            } else j++;
83
                        }
84
                        if (repeat == false) {
85
                            util.alert('提示', '添加内容不能重复');
86
                        }
87
                        for (var m = 0; m < oValueList.length; m++) {
88
                            ca.items.push({code: oValueList[m], caption: oValueList[m]});
89
                            oJudge.push(oValueList[m]);
90
                        }
91
                    }
92
                };
93
94
                Array.prototype.remove = function (obj) {
95
                    for (var i = 0; i < this.length; i++) {
96
                        var temp = this[i];
97
                        if (!isNaN(obj)) {
98
                            temp = i;
99
                        }
100
                        if (temp == obj) {
101
                            for (var j = i; j < this.length; j++) {
102
                                this[j] = this[j + 1];
103
                            }
104
                            this.length = this.length - 1;
105
                        }
106
                    }
107
                };
108
109
                function oString(data) {
110
                    var arry = new Array();
111
                    if (data) {
112
                        for (var i = 0; i < data.length; i++) {
113
                            arry.push(data[i]);
114
                        }
115
                    }
116
                    return arry.join(",");
117
                }
118
119
                root.find(".opt-industry").on("click", function () {
120
                    part(form.val().newIndustry, form.val().industryList);
121
                    form.val({newIndustry: "", industryList: oJudge});
122
                });
123
                root.find(".opt-subject").on("click", function () {
124
                    part(form.val().newSubject, form.val().subjectList);
125
                    form.val({newSubject: "", subjectList: oJudge});
126
                });
127
                root.find(".opt-qf").on("click", function () {
128
                    part(form.val().newQualification, form.val().qualificationList);
129
                    form.val({newQualification: "", qualificationList: oJudge});
130
                });
131
132
                var $list = $('#fileList'),
133
                    ratio = window.devicePixelRatio || 1,
134
                    thumbnailWidth = 100 * ratio,
135
                    thumbnailHeight = 100 * ratio,
136
                    uploader;
137
                uploader = WebUploader.create({
138
                    auto: true,
139
                    server: '../ajax/cachedFileUpload',
140
141
                    pick: '#filePicker',
142
143
                    accept: {
144
                        title: 'Images',
145
                        extensions: 'gif,jpg,jpeg,bmp,png',
146
                        mimeTypes: 'image/jpg,image/jpeg,image/png'
147
                    }
148
                });
149
                uploader.on('fileQueued', function (file) {
150
                    var $li = $(
151
                            '<div id="' + file.id + '" class="file-item thumbnail">' +
152
                            '<img>' +
153
                            '</div>'
154
                        ),
155
                        $btns = $('<div class="file-panel">' +
156
                            '<span class="cancel icon-remove-sign">删除</span>' +
157
                            '</div>').appendTo($li),
158
                        $img = $li.find('img');
159
160
                    $list.html($li);
161
162
                    uploader.makeThumb(file, function (error, src) {
163
                        if (error) {
164
                            $img.replaceWith('<span>不能预览</span>');
165
                            return;
166
                        }
167
168
                        $img.attr('src', src);
169
                    }, thumbnailWidth, thumbnailHeight);
170
171
                });
172
                uploader.on('uploadSuccess', function (file, data) {
173
                    $('#' + file.id).addClass('upload-state-done');
174
                    cacheImageKey = data.data[0].cacheKey;
175
                    form.val({fn: cacheImageKey});
176
                });
177
                uploader.on('uploadComplete', function (file) {
178
                    $('#' + file.id).find('.progress').remove();
179
                });
180
                $list.on("click", ".cancel", function () {
181
                    $(this).parent().parent().remove();
182
                });
183
                uploader.on('beforeFileQueued', function (file) {
184
                    uploader.reset();
185
                });
186
                $.fn.citySelect();
187
                $(document).on("click", "#City li a", function () {
188
                    var aVal = $(this).text();
189
                    $(this).parent().parent().parent().find('.mr_show').text(aVal);
190
                    $(this).parent().parent().parent().find('input[name=cho_City]').val(aVal);
191
                    if ($("#ocity").text() == "请选择城市") {
192
                        $("#ocity").removeClass("mr_select");
193
                    } else {
194
                        $("#ocity").addClass("mr_select");
195
                    }
196
                    // console.log($("#ocity").text(),$("#oprovince").text())
197
                    form.val({province: $("#oprovince").text(), city: $("#ocity").text()});
198
                });
199
                saveBtn.on("click", save);
200
            }
201
        }
202
    });
203
});

+ 188 - 45
js/model/sys/org/new.js

@ -3,63 +3,206 @@
3 3
 */
4 4
;
5 5
spa_define(function () {
6
    return $.use(["spa", "util", "form"], function (spa, util, fb) {
6
    return $.use(["spa", "util", "form", "upload"], function (spa, util, fb, upload) {
7 7
        return {
8 8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_userinfo_new");
10
                var form = fb.build(root.find(".newForm"));
11
                var trim = function (str) { //删除左右两端的空格			  
12
                    return str.replace(/(^\s*)|(\s*$)/g, "");
13
                };
9
                var root = spa.findInModal(".sys_org_new");
10
                var ca = {ready: true, items: []};
11
                var form = fb.build(root.find(".newForm"), {
12
                    industryList: ca,
13
                    subjectList: ca,
14
                    qualificationList: ca
15
                });
16
                var id = util.data("loginUser").id;
17
                var cacheImageKey = null;
18
                var oValue;
19
                var oJudge;
14 20
                var saveBtn = root.find(".opt-save"),
21
                    headArea = root.find(".head-ctn"),
15 22
                    save = function () {
16
                        if (form.val().email) {
17
                            var email = trim(form.val().email);
18
                            var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
19
                            if (!gunf.test(email)) {
20
                                util.alert("注册邮箱格式有误,请检查后重新填写");
21
                                return;
22
                            }
23
                        }else{
24
                            util.alert("请输入邮箱")
25
                            return;
23
                        form.val({inviterId: id});
24
                        form.val({
25
                            industry: oString(form.val().industryList),
26
                            subject: oString(form.val().subjectList),
27
                            qualification: oString(form.val().qualificationList)
28
                        });
29
                        if (form.val().orgType == null) {
30
                            form.val({orgType: 1});
26 31
                        }
27
                        if (form.val().name) {
28
                            var name = trim(form.val().name);
29
                            if (name.length > 50) {
30
                                util.alert("企业名称最长为50个字");
31
                                return;
32
                            }
33
                        }else {
34
                            util.alert("请填写企业名称");
35
                            return;
32
                        if (form.val().name == null) {
33
                            util.alert("请输入企业名称");
34
                        } else if (form.val().email == null) {
35
                            util.alert("请输入邮箱账户")
36
                        } else if (form.val().forShort == null) {
37
                            util.alert("请输入企业简称")
38
                        } else if (form.val().city == null || form.val().city === "请选择城市") {
39
                            util.alert("请选择企业所在城市")
36 40
                        }
37
                        if (form.val().name && form.val().email) {
38
                            util.get("../ajax/sys/org/entryCheck", {
39
                                name: form.val().name,
40
                                email: form.val().email
41
                            },function (success) {
42
                                if (success){
43
                                    form.val({pMobile: form.val().mobile});
44
                                    form.val({pEmail: form.val().email});
45
                                    form.doPost("../ajax/sys/org/createAccount", function () {
46
                                        spa.closeModal();
47
                                        if (data) {
48
                                            data();
49
                                        }
50
                                    }, {});
51
                                }else {
52
                                    util.alert("该账号已存在");
41
                        else form.doPost("../ajax/sys/org/create", function () {
42
                                spa.closeModal();
43
                                if (data) {
44
                                    data();
53 45
                                }
46
                            },function (data) {
47
                                util.alert(data.msg);
54 48
                            });
55
                        } else {
56
                            util.alert("邮箱和企业名称都必须输入");
57
                        }
58 49
                    };
59
60 50
                root.find(".modal-ctrl .icon-times").on("click", function () {
61 51
                    spa.closeModal();
62 52
                });
53
54
                var part = function (one, list) {
55
                    oValue = one;
56
                    oJudge = list || [];
57
                    var repeat,
58
                        b;
59
                    if (!oValue) {
60
                        util.alert('提示', '请先填写内容');
61
                        return;
62
                    }
63
                    if (oValue.length > 10) {
64
                        util.alert('提示', '添加内容不能超过10个字');
65
                        return;
66
                    } else {
67
                        var oValueList = oValue.split(","),
68
                            length = oValueList.length;
69
                        for (var j = 0; j < length; j++) {
70
                            for (var n = j + 1; n < oValueList.length + 1;) {
71
                                if (oValueList[j] == oValueList[n]) {
72
                                    oValueList.remove(n);
73
                                    repeat = false;
74
                                } else {
75
                                    n++;
76
                                }
77
                            }
78
                        }
79
                        for (var j = 0; j < oValueList.length;) {
80
                            for (var i = 0; i < oJudge.length; i++) {
81
                                if (oValueList[j] == oJudge[i]) {
82
                                    oValueList.remove(j);
83
                                    repeat = false;
84
                                    b = true;
85
                                }
86
                            }
87
                            if (b) {
88
                                b = false
89
                            } else j++;
90
                        }
91
                        if (repeat == false) {
92
                            util.alert('提示', '添加内容不能重复');
93
                        }
94
                        for (var m = 0; m < oValueList.length; m++) {
95
                            ca.items.push({code: oValueList[m], caption: oValueList[m]});
96
                            oJudge.push(oValueList[m]);
97
                        }
98
                    }
99
                };
100
101
                Array.prototype.remove = function (obj) {
102
                    for (var i = 0; i < this.length; i++) {
103
                        var temp = this[i];
104
                        if (!isNaN(obj)) {
105
                            temp = i;
106
                        }
107
                        if (temp == obj) {
108
                            for (var j = i; j < this.length; j++) {
109
                                this[j] = this[j + 1];
110
                            }
111
                            this.length = this.length - 1;
112
                        }
113
                    }
114
                };
115
116
                function oString(data) {
117
                    var arry = new Array();
118
                    if (data) {
119
                        for (var i = 0; i < data.length; i++) {
120
                            arry.push(data[i]);
121
                        }
122
                    }
123
                    return arry.join(",");
124
                }
125
126
                root.find(".opt-industry").on("click", function () {
127
                    part(form.val().newIndustry, form.val().industryList);
128
                    form.val({newIndustry: "", industryList: oJudge});
129
                });
130
                root.find(".opt-subject").on("click", function () {
131
                    part(form.val().newSubject, form.val().subjectList);
132
                    form.val({newSubject: "", subjectList: oJudge});
133
                });
134
                root.find(".opt-qf").on("click", function () {
135
                    part(form.val().newQualification, form.val().qualificationList);
136
                    form.val({newQualification: "", qualificationList: oJudge});
137
                });
138
139
                var $list = $('#fileList'),
140
                    ratio = window.devicePixelRatio || 1,
141
                    thumbnailWidth = 100 * ratio,
142
                    thumbnailHeight = 100 * ratio,
143
                    uploader;
144
                uploader = WebUploader.create({
145
                    auto: true,
146
                    server: '../ajax/cachedFileUpload',
147
148
                    pick: '#filePicker',
149
150
                    accept: {
151
                        title: 'Images',
152
                        extensions: 'gif,jpg,jpeg,bmp,png',
153
                        mimeTypes: 'image/jpg,image/jpeg,image/png'
154
                    }
155
                });
156
                uploader.on('fileQueued', function (file) {
157
                    var $li = $(
158
                            '<div id="' + file.id + '" class="file-item thumbnail">' +
159
                            '<img>' +
160
                            '</div>'
161
                        ),
162
                        $btns = $('<div class="file-panel">' +
163
                            '<span class="cancel icon-remove-sign">删除</span>' +
164
                            '</div>').appendTo($li),
165
                        $img = $li.find('img');
166
167
                    $list.html($li);
168
169
                    uploader.makeThumb(file, function (error, src) {
170
                        if (error) {
171
                            $img.replaceWith('<span>不能预览</span>');
172
                            return;
173
                        }
174
175
                        $img.attr('src', src);
176
                    }, thumbnailWidth, thumbnailHeight);
177
178
                });
179
                uploader.on('uploadSuccess', function (file, data) {
180
                    $('#' + file.id).addClass('upload-state-done');
181
                    cacheImageKey = data.data[0].cacheKey;
182
                    form.val({fn: cacheImageKey});
183
                });
184
                uploader.on('uploadComplete', function (file) {
185
                    $('#' + file.id).find('.progress').remove();
186
                });
187
                $list.on("click", ".cancel", function () {
188
                    $(this).parent().parent().remove();
189
                });
190
                uploader.on('beforeFileQueued', function (file) {
191
                    uploader.reset();
192
                });
193
                $.fn.citySelect();
194
                $(document).on("click", "#City li a", function () {
195
                    var aVal = $(this).text();
196
                    $(this).parent().parent().parent().find('.mr_show').text(aVal);
197
                    $(this).parent().parent().parent().find('input[name=cho_City]').val(aVal);
198
                    if ($("#ocity").text() == "请选择城市") {
199
                        $("#ocity").removeClass("mr_select");
200
                    } else {
201
                        $("#ocity").addClass("mr_select");
202
                    }
203
                    // console.log($("#ocity").text(),$("#oprovince").text())
204
                    form.val({province: $("#oprovince").text(), city: $("#ocity").text()});
205
                });
63 206
                saveBtn.on("click", save);
64 207
            }
65 208
        }