add.html 18.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
<include file="public@header"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
    .users_leader{
        border:1px solid #f0f0f0;
        padding:5px 10px;
        height:150px;
        overflow-y: scroll;
    }
    .users_leaders{
        border:1px solid #f0f0f0;
        padding:5px 10px;
        height:100px;
        overflow-y: scroll;
    }
    .users_staff{
        border:1px solid #f0f0f0;
        padding:5px 10px;
        height:250px;
        overflow-y: scroll;
    }
    .users{
        width:250px;
        float:left;
    }
    .user_name{
        text-align: justify;
        text-align-last: justify;
        float:left;
    }
    .box{
        width:20px;
        float:left;
    }
    .check_name{
        margin-bottom:5px;
        margin-top:30px;
        width:50%;
    }
    .add_check{
        background-color: #18BC9C;
        border-color:#18BC9C;
    }
    .add_check:hover{
        background-color: #18BC9C;
        border-color:#18BC9C;
    }
    .add_check_check{
        background-color: #18BC9C;
        border-color:#18BC9C;
    }
    .add_check_check:hover{
        background-color: #18BC9C;
        border-color:#18BC9C;
    }
    .add_user{
        font-size: 14px;
        color:red;
        font-weight: bold;
        background:#EFEEEF;
        text-align: center;
        cursor: pointer;
    }
    .address{
        display: none;
    }
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('AdminProject/index')}">项目管理</a></li>
        <li class="active"><a href="{:url('AdminProject/add')}">添加项目</a></li>
    </ul>
    <form action="{:url('AdminProject/addPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
        <div class="row">
            <div class="col-md-11">
                <table class="table table-bordered">
                    <tr>
                        <th width="150">项目名称<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" required type="text" name="name" placeholder="请输入项目名称"/>
                        </td>
                    </tr>
                    <tr><th><p style="font-size: 20px;color:red;font-weight: bold;">甲方:</p></th></tr>
                    <tr>
                        <th width="150">企业名称<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" required type="text" name="company_name" placeholder="请输入企业名称"/>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            <div class="add_user">
                                <p style="vertical-align: middle;height:35px;line-height: 35px;">添加企业人员</p>
                            </div>
                        </th>
                    </tr>

                    <!--是否有子企业start-->
                    <tr>
                        <th>是否是子企业<span class="form-required">*</span></th>
                        <td>
                            否:<input class="is_check" type="radio" name="is_children" checked value="0"/>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            是:<input class="is_check" type="radio" name="is_children" value="1"/>
                        </td>
                    </tr>
                    <tr class="address company_address">
                        <th>总公司名称</th>
                        <td>
                            <input class="form-control" type="text" name="company_name_head" placeholder="请输入总公司名称"/>
                        </td>
                    </tr>
                    <tr class="address company_address">
                        <th>总公司logo</th>
                        <td>
                            <div>
                                <input type="hidden" name="head_logo" id="head_logo" value="">
                                <a href="javascript:uploadOneImage('图片上传','#head_logo');">
                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                         id="head_logo-preview"
                                         width="100" style="cursor: pointer"/>
                                </a>
                                <input type="button" class="btn btn-sm btn-cancel-head_logo" value="取消图片">
                            </div>
                        </td>
                    </tr>
                    <!--<tr class="address company_address">-->
                        <!--<th>企业地区</th>-->
                        <!--<td>-->
                            <!--<input class="form-control" type="text" name="address" placeholder="请输入企业地区"/>-->
                        <!--</td>-->
                    <!--</tr>-->
                    <!--<tr class="address company_address">-->
                        <!--<th>企业总领导</th>-->
                        <!--<td>-->
                            <!--<input class="form-control" type="text" name="user_login2" placeholder="请输入企业总领导"/>-->
                        <!--</td>-->
                    <!--</tr>-->

                    <tr class="address company_address">
                        <th>企业总领导</th>
                        <td>
                            <div class="users_leaders user_leaders_a">

                            </div>
                        </td>
                    </tr>

                    <!--<tr class="address company_address">-->
                        <!--<th>手机号(唯一)</th>-->
                        <!--<td>-->
                            <!--<input class="form-control" type="tel" name="mobile2" placeholder="请输入总领导手机号" value=""/>-->
                        <!--</td>-->
                    <!--</tr>-->
                    <!--<tr class="address company_address">-->
                        <!--<th>职位</th>-->
                        <!--<td>-->
                            <!--<input class="form-control" type="text" name="position2" placeholder="请输入总领导职位"/>-->
                        <!--</td>-->
                    <!--</tr>-->
                    <!--是否有子企业end-->

                    <tr>
                        <th>企业负责人<span class="form-required">*</span></th>
                        <td>
                            <div class="users_leader user_leader_a">

                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>项目组人员<span class="form-required">*</span></th>
                        <td>
                            <div class="users_staff user_staff_a">

                            </div>
                        </td>
                    </tr>

                    <tr>
                        <th>日检<span class="form-required">*</span></th>
                        <td>
                            供应商:<input type="radio" name="is_inspect" checked value="0"/>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            客户:<input type="radio" name="is_inspect" value="1"/>
                        </td>
                    </tr>
                    <tr>
                        <th>日检点</th>
                        <td>
                            <div class="btn btn-primary js-ajax-submit add_check">添加日检点</div>
                            <div id="check_point">

                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>月检点</th>
                        <td>
                            <div class="btn btn-primary js-ajax-submit add_check_check">添加月检点</div>
                            <div id="check_check">

                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>logo</th>
                        <td>
                            <div>
                                <input type="hidden" name="logo" id="logo" value="">
                                <a href="javascript:uploadOneImage('图片上传','#logo');">
                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                         id="logo-preview"
                                         width="100" style="cursor: pointer"/>
                                </a>
                                <input type="button" class="btn btn-sm btn-cancel-logo" value="取消图片">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>营业执照</th>
                        <td>
                            <div>
                                <input type="hidden" name="license" id="license" value="">
                                <a href="javascript:uploadOneImage('图片上传','#license');">
                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                         id="license-preview"
                                         width="100" style="cursor: pointer"/>
                                </a>
                                <input type="button" class="btn btn-sm btn-cancel-license" value="取消图片">
                            </div>
                        </td>
                    </tr>


                    <!--乙方公司-->
                    <tr><th><p style="font-size: 20px;color:red;font-weight: bold;margin-top:50px;">乙方:</p></th></tr>
                    <tr>
                        <th width="150">企业名称<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control company_name_b" type="text"  placeholder="请输入企业名称" value="{$post.company_name}"/>
                        </td>
                    </tr>
                    <tr>
                        <th>项目组人员<span class="form-required">*</span></th>
                        <td>
                            <div class="users_staff">
                                <volist name="post.u_s_id" id="vo">
                                    <div class="users">
                                        <div class="user_name">{$vo.user_login}({$vo.mobile})</div>
                                        <div class="box"><input type="checkbox" name='u_s_id[]' value="{$vo.id}"/></div>
                                    </div>
                                </volist>
                            </div>
                        </td>
                    </tr>
                </table>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
                        <a class="btn btn-default" href="{:url('AdminProject/index')}">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script type="text/javascript">
    $(function () {
        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        //甲方logo
        $('.btn-cancel-logo').click(function () {
            $('#logo-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#logo').val('');
        });
        //甲方总公司logo
        $('.btn-cancel-head_logo').click(function () {
            $('#head_logo-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#head_logo').val('');
        });
        //甲方营业执照
        $('.btn-cancel-license').click(function () {
            $('#license-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#license').val('');
        });

        $(".company_name_b").attr("onfocus", "this.blur()");
        $('.company_name_b').css("cursor", "not-allowed");
        //添加巡检点
        $('.add_check').click(function(){
            var check_name = '';
            check_name += '<div class="check">';
                check_name += '<input class="form-control check_name" required type="text" name="point_name[]" placeholder="请输入日检点"/>';
                //删除图标
                check_name += '<div class="del" style="cursor: pointer;">';
                    check_name += '<img src="/static/images/del.png" alt="" style="width:16px;height:16px;">';
                check_name += '</div>';

            check_name += '</div>';
            $('#check_point').append(check_name);
            //删除巡检点
            $('.del').click(function(){
                $(this).parent('.check').remove();
            });
        });

        //添加月检点
        $('.add_check_check').click(function(){
            var check_name = '';
            check_name += '<div class="check">';
            check_name += '<input class="form-control check_name" required type="text" name="check_name[]" placeholder="请输入月检点"/>';
            //删除图标
            check_name += '<div class="del_check" style="cursor: pointer;">';
            check_name += '<img src="/static/images/del.png" alt="" style="width:16px;height:16px;">';
            check_name += '</div>';

            check_name += '</div>';
            $('#check_check').append(check_name);
            //删除巡检点
            $('.del_check').click(function(){
                $(this).parent('.check').remove();
            });
        });

        //是否有子企业
        $('.is_check').click(function(){
            var val = $("input[name='is_children']:checked").val();
            if(val == 1){
                $('.company_address').removeClass('address');
            }else{
                $('.company_address').addClass('address');
            }
        });

        //添加人员
        $('.add_user').click(function () {
            addUser();
        });

        //移除领导
        $(document).on('click','.u_l_del',function () {
            $(this).parent('.users').remove();
        });

        //移除总领导
        $(document).on('click','.u_ls_del',function () {
            $(this).parent('.users').remove();
        });

        //移除员工
        $(document).on('click','.u_s_del',function () {
            $(this).parent('.users').remove();
        });
    });

    //添加用户个人信息
    function addUser() {
        openIframeLayer("{:url('AdminProject/user')}", '添加人员', {
            area: ['700px', '400px'],
            btn: ['确认','取消'],
            yes: function (index, layero) {
                var iframeWin = window[layero.find('iframe')[0]['name']];
                var data = iframeWin.save();
                if(data){
                    var html = '';
                    if(data.identity == 0){
                        //员工
                        html += '<div class="users">';
                            html += '<div class="user_name">'+data.user_login+'('+data.mobile+')</div>';
                            //删除图标
                            html += '<div class="u_s_del" style="cursor: pointer;">';
                                html += '<img src="/static/images/del.png" alt="" style="width:16px;height:16px;">';
                            html += '</div>';
                            //隐藏数据,姓名,身份,手机号,职位
                            html += '<input type="hidden" name="user_login[]" value="'+data.user_login+'">';
                            html += '<input type="hidden" name="mobile[]" value="'+data.mobile+'">';
                            html += '<input type="hidden" name="position[]" value="'+data.position+'">';
                        html += '</div>';
                        $('.user_staff_a').append(html);
                    }else if(data.identity == 1){
                        //领导
                        html += '<div class="users">';
                            html += '<div class="user_name">'+data.user_login+'('+data.mobile+')</div>';
                            //删除图标
                            html += '<div class="u_l_del" style="cursor: pointer;">';
                                html += '<img src="/static/images/del.png" alt="" style="width:16px;height:16px;">';
                            html += '</div>';
                            //隐藏数据,姓名,身份,手机号,职位
                            html += '<input type="hidden" name="user_login1[]" value="'+data.user_login+'">';
                            html += '<input type="hidden" name="mobile1[]" value="'+data.mobile+'">';
                            html += '<input type="hidden" name="position1[]" value="'+data.position+'">';
                        html += '</div>';
                        $('.user_leader_a').append(html);
                    }else{
                        //总领导
                        html += '<div class="users">';
                        html += '<div class="user_name">'+data.user_login+'('+data.mobile+')</div>';
                        //删除图标
                        html += '<div class="u_ls_del" style="cursor: pointer;">';
                        html += '<img src="/static/images/del.png" alt="" style="width:16px;height:16px;">';
                        html += '</div>';
                        //隐藏数据,姓名,身份,手机号,职位
                        html += '<input type="hidden" name="user_login2[]" value="'+data.user_login+'">';
                        html += '<input type="hidden" name="mobile2[]" value="'+data.mobile+'">';
                        html += '<input type="hidden" name="position2[]" value="'+data.position+'">';
                        html += '</div>';
                        $('.user_leaders_a').append(html);
                    }

                    layer.close(index); //如果设定了yes回调,需进行手工关闭
                }
            }
        });

    }
</script>
</body>
</html>