| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <?php include Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . "viewc//fc-header.php"; ?>
- <?php include Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . "viewc//fc-leftWrap.php"; ?>
- <div class="warp-content">
- <div class="container">
- <div class="page-header">
- <h2 id="basis-info">编辑项目</h2>
- </div>
- <div class="row">
- <div class="col-md-3">
- <form method="post" action="additem" onsubmit="return judgeSumbit();">
- <div class="form-group">
- <label>项目名称</label>
- <input class="form-control" name="itemname" id="itemname2" placeholder="不要太长就是了" type="text">
- </div>
- <button type="submit" class="btn btn-success">添加项目</button>
- </form>
- </div>
- <div class="col-md-8 col-md-offset-1">
- <table class="table table-hover">
- <thead><tr><th>项目名称</th><th width="70">类别</th><th width="70">报表</th><th width="110">操作</th></tr></thead>
- <tbody>
- <?php if( isset($data['itemlist']) && !empty($data['itemlist']) ): ?>
- <?php foreach($data['itemlist'] as $k1=>$v1): ?>
- <tr><td id="item_id<?php echo $v1['itemid']; ?>"><?php echo $v1['itemname']; ?></td><td><?php echo $v1['catenum']; ?></td><td><?php echo $v1['reportnum']; ?></td><td><a href="#edit-poj" data-toggle="modal" class="btn btn-xs" onclick='edititem("<?php echo $v1['itemname']; ?>","<?php echo $v1['itemid']; ?>")'>编辑</a> <a href="#del-poj" data-toggle="modal" class="btn btn-xs text-danger" onclick='delitem("<?php echo $v1['catenum']; ?>","<?php echo $v1['reportnum']; ?>","<?php echo $v1['itemid']; ?>","<?php echo $v1['itemname']; ?>");'>删除</a></td></tr>
- <?php endforeach; ?>
- <?php endif; ?>
- </tbody>
- </table>
- <nav>
- <ul class="pagination">
- <?php echo $data['pager']; ?>
- </ul>
- </nav>
- </div>
- </div>
- </div>
- </div>
- <!--编辑项目-->
- <div class="modal fade " tabindex="-1" role="dialog" aria-hidden="true" id="edit-poj">
- <div class="modal-dialog ">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title" >编辑项目</h4>
- </div>
- <div class="modal-body">
- <div class="form-group">
- <label>项目名称</label>
- <div class="row">
- <div class="col-xs-9">
- <input type="text" class="form-control input-sm" value="" id="itemname" >
- <input type="hidden" class="form-control input-sm" value="" id="itemid" >
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <a type="button" class="btn btn-success" href="javascript:;" onclick="saveitem();">保存</a>
- </div>
- </div>
- </div>
- </div>
- <!--编辑项目-->
- <!--删除项目-->
- <div class="modal fade " tabindex="-1" role="dialog" aria-hidden="true" id="del-poj">
- <div class="modal-dialog ">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title" >删除项目</h4>
- </div>
- <div class="modal-body">
- <h3 class="text-center" id="delcate" style="display: none;">该项目下包含类别,无法删除</h3>
- <h3 class="text-center" id="delreport" style="display: none;">该项目下包含报表,无法删除</h3>
- <h3 class="text-center" id="delitem" style="display: none;">是否删除 <b></b></h3>
- </div>
- <div class="modal-footer" id="delbtn" style="display: none;">
- <a type="button" class="btn btn-danger" href="#" id="delitembtn">确认删除</a>
- </div>
- </div>
- </div>
- </div>
- <!--删除项目-->
- <script>
- function judgeSumbit(){
- if($('#itemname2').val() ==''){
- alert('请输入您的项目名');
- return false;
- }
- }
- function edititem(itemname,itemid){
- $('#itemname').val(itemname);
- $('#itemid').val(itemid);
- }
- function saveitem(){
- if($.trim($('#itemname').val()) == ''){
- alert('请输入您的项目名');
- return false;
- }else{
- var itemid = $('#itemid').val();
- $.ajax({
- type: 'post',
- url: '<?php echo $data['rootUrl']; ?>updateitem',
- data: {itemname:$.trim($('#itemname').val()),itemid:itemid},
- dataType: 'json',
- success: function(result){
- alert('修改成功');
- $('#edit-poj').modal('hide');
- $('#item_id'+itemid).text($.trim($('#itemname').val()));
- }
- })
- }
- }
- function delitem(catenum,reportnum,id,itemname){
- $('#delcate').hide();
- $('#delreport').hide();
- $('#delitem').hide();
- $('#delbtn').hide();
- if(catenum != 0){
- $('#delcate').show();
- } else if(reportnum != 0){
- $('#delreport').show();
- } else {
- $('#delitem b').text(itemname);
- $('#delitem').show();
- $('#delbtn').show();
- $('#delitembtn').attr('href','<?php echo $data['rootUrl']; ?>deleteitem/'+id);
- }
- }
- </script>
- </body>
- </html>
|