123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561 |
- @extends('admin/layout')
- @section('header')
- <link rel="stylesheet" href="{{asset('js/plugins/bootstrap-select-1.13.9/dist/css/bootstrap-select.min.css')}}">
- <style>
- .area {
- resize: vertical;
- width: 280px;
- }
- .taskStatus {
- font-weight: bold;
- font-size: 14px;
- }
- .addBtn {
- margin-left: 10px;
- width: 50px;
- height: 30px;
- line-height: 30px;
- border: none;
- background-color: #ff6700;
- color: white;
- outline: none;
- }
- .my-select {
- width: 128px !important;
- }
- .navNav {
- padding: 10px 0 10px 10px;
- position: fixed;
- top: 10px;
- left: 10px;
- border: 1px solid gray;
- }
- .nav-ul {
- list-style-type: none;
- margin: 0;
- padding: 0;
- float: left;
- }
- .clearfix::after {
- content: '';
- display: block;
- clear: both;
- }
- .nav-ul li {
- margin-right: 12px;
- float: left;
- width: 80px;
- height: 32px;
- line-height: 32px;
- background-color: white;
- text-align: center;
- font-weight: bold;
- cursor: pointer;
- }
- .nav-active {
- background-color: #0d8ddb !important;
- color: white;
- }
- .man-section {
- display: none;
- }
- .section-active {
- display: block;
- }
- </style>
- @endsection
- @section('content')
- <body class="gray-bg" style="padding:10px">
- {{-- <div class="col-md-12">
- <form class="row" id="searchForm" action="/admin/plan/week-task/indexSelf" method="get">
- <div class="col-md-12">
- <div class="input-group" style="width: 250px;margin: 0 auto;">
- <select class="my-select" name="duty_id" id="duty_id">
- @foreach($allUserList as $item)
- <option value="{{$item->id}}"
- @if($item->id==$dutyId) selected @endif>{{$item->nickname}}</option>
- @endforeach
- </select>
- <span class="input-group-btn">
- <button type="button" id="submitbut" class="btn btn-md btn-primary"> 搜索</button>
- </span>
- </div>
- </div>
- </form>
- </div>--}}
- <nav class="navNav clearfix">
- <ul class="nav-ul">
- <li class="nav-li nav-active" data-section="0">前端</li>
- <li class="nav-li" data-section="1">设计</li>
- </ul>
- @if ($type =='next')
- <button type="button" class="btn btn-danger" onclick="units.migrate()"
- style="float: left;margin-right: 10px">迁移
- </button>
- @endif
- </nav>
- <main style="margin-top: 60px;touch-action: none">
- @foreach(\App\Http\Models\WeekTaskInfo::TypeList as $typeIndex=>$typeItem)
- <section class="man-section @if($typeIndex=='web') section-active @endif">
- <div class="ibox-content" style="position: fixed;top: 0;right: 0;z-index: 99;border: 1px solid grey">
- @foreach($typeItem as $inx=>$name)
- <a href="#{{$typeIndex.$inx}}" style="margin-right:20px;">{{$name}}</a>
- @endforeach
- </div>
- @foreach($typeItem as $inx=>$name)
- <div class="ibox float-e-margins" id="{{$typeIndex.$inx}}">
- <div class="ibox-title">
- {{$name}}
- </div>
- @if(substr($inx,0,3)=='wfp')
- @php $limit=1; @endphp
- @else
- @php $limit=5; @endphp
- @endif
- <div class="ibox-content">
- <ul style="list-style-type: none">
- @for($day=1;$day<=$limit;$day++)
- <li>
- @php
- if (substr($inx,0,3)=='wfp') {
- $dayDataList=array_get($taskInfoList,sprintf('%s.%s',$inx,0));
- } else {
- $dayDataList=array_get($taskInfoList,sprintf('%s.%s',$inx,$day));
- }
- $dayDataList=collect($dayDataList??[])->sortBy('sort')->toArray();
- @endphp
- @if(!empty($dayDataList))
- @if(substr($inx,0,3)!='wfp') <span
- style="font-weight: bold;font-size: 18px">周 {{\App\Http\Models\WeekTaskInfo::DayMap[$day]??'???'}} </span>
- @endif
- @php $isAllowAdd=true; @endphp
- @if( ($day==date('w') &&$type=='now'&&date('H')>=10&&substr($inx,0,3)!='wfp'))
- @php $isAllowAdd=false; @endphp
- @endif
- <table class="table">
- <thead>
- <tr>
- <th>状态</th>
- <th>类型</th>
- <th>任务描述</th>
- <th>负责人</th>
- <th>设计</th>
- <th>前端</th>
- @php $authUser=auth()->user(); @endphp
- @if($authUser->role_id!=14)
- <th>检查反馈</th>
- @endif
- <th>deadline</th>
- <th>备注</th>
- <th>
- 操作
- @if( $isAllowAdd)
- <button type="button" class="addBtn"
- onclick="units.add(this)">新增
- </button>
- @endif
- </th>
- </tr>
- </thead>
- <tbody
- @if($isAllowAdd) class="connectedSortable"
- @endif data-day="{{$day}}" data-user-type="{{$inx}}">
- <tr>
- <td colspan="8"></td>
- </tr>
- @foreach($dayDataList as $dayData)
- <tr class="sortableList">
- <td>
- <span class="taskStatus">
- {{\App\Http\Models\WeekTaskInfo::StatusMap[$dayData['status']]??''}}
- </span>
- <input type="hidden" name="status"
- value="{{$dayData['status']}}">
- </td>
- <td>
- <select name="cond_id" class="form-control"
- onchange="units.condChange(this)">
- <option value="">请选择</option>
- @foreach($condList[$typeIndex] as $cond)
- <option value="{{$cond->id}}"
- @if($cond->id==$dayData['cond_id']) selected @endif>{{$cond->name}}</option>
- @endforeach
- </select>
- </td>
- <td>
- <textarea class="form-control" name="describe" rows="2"
- style="resize: vertical">{{$dayData['describe']}}</textarea>
- </td>
- <td>
- <select class="my-select" name="duty_id">
- <option value="">请选择</option>
- @foreach($allUserList as $item)
- <option value="{{$item->id}}"
- @if($item->id==$dayData['duty_id']) selected @endif>{{$item->nickname}}</option>
- @endforeach
- </select>
- </td>
- <td>
- <select class="my-select" name="design_id">
- <option value="">请选择</option>
- @foreach($designerList as $item)
- <option value="{{$item->id}}"
- @if($item->id==$dayData['design_id']) selected @endif>{{$item->nickname}}</option>
- @endforeach
- </select>
- </td>
- <td>
- <select class="my-select" name="web_id">
- <option value="">请选择</option>
- @foreach($webList as $item)
- <option value="{{$item->id}}"
- @if($item->id==$dayData['web_id']) selected @endif>{{$item->nickname}}</option>
- @endforeach
- </select>
- </td>
- @php $authUser=auth()->user(); @endphp
- @if($authUser->role_id!=14)
- <td>
- {{-- <input type="text" class="form-control" name="feedback"
- value="{{$dayData['feedback']}}">--}}
- @php $selectItems=$condItems[$dayData['cond_id']]??[]; @endphp
- <select name="cond_item_id" class="form-control">
- <option value="">请先选择类型</option>
- @foreach($selectItems as $item)
- <option value="{{$item->id}}"
- @if($item->id==$dayData['cond_item_id']) selected @endif>{{$item->name}}</option>
- @endforeach
- </select>
- </td>
- @endif
- <td><input type="text" class="form-control" name="deadline"
- value="{{$dayData['deadline']}}"
- @if($dayData['deadline']) readonly="readonly" @endif>
- </td>
- {{--<td><input type="text" class="form-control" name="remark"
- value="{{$dayData['remark']}}"></td>--}}
- <td>
- <textarea type="text" class="form-control" name="remark"
- style="overflow: hidden"
- {{--value="{{$dayData['remark']}}"--}}>{{$dayData['remark']}}
- </textarea>
- </td>
- <td style="position:relative">
- <div>
- <input type="hidden" name="taskId"
- value="{{$dayData['id']}}">
- <button type="button" class="btn btn-default btn-sm"
- onclick="units.changeStatus(this,'reset')">重置
- </button>
- <button type="button" class="btn btn-info btn-sm"
- onclick="units.changeStatus(this,'ok')">完成
- </button>
- <button type="button" class="btn btn-success btn-sm"
- onclick="units.changeStatus(this,'pause')">暂停
- </button>
- </div>
- <div>
- <button type="button" class="btn btn-warning btn-sm"
- onclick="units.del(this)">删除
- </button>
- <button type="button" class="btn btn-primary btn-sm"
- onclick="units.singleSave(this)">保存
- </button>
- </div>
- </td>
- </tr>
- @endforeach
- </tbody>
- </table>
- @endif
- </li>
- @endfor
- </ul>
- </div>
- </div>
- @endforeach
- </section>
- @endforeach
- </main>
- </body>
- @endsection
- @section('footer')
- <script src="{{asset('js/plugins/bootstrap-select-1.13.9/dist/js/bootstrap-select.min.js')}}"></script>
- <script src="{{asset('js/jquery-ui-1.10.4.min.js')}}"></script>
- <script>
- $("#submitbut").click(function () {
- $("#searchForm").submit();
- });
- $(function () {
- $('.my-select').selectpicker({
- liveSearch: true
- });
- $("tbody").sortable({
- connectWith: ".connectedSortable"
- }).disableSelection();
- $(document).on('click', '.nav-li', function () {
- var sectionInx = $(this).data('section');
- $(".nav-li").each(function (inx) {
- if (inx === sectionInx) {
- $(this).addClass("nav-active");
- } else {
- $(this).removeClass("nav-active");
- }
- });
- $(".man-section").each(function (inx) {
- if (inx === sectionInx) {
- $(this).show();
- } else {
- $(this).hide();
- }
- })
- });
- });
- var units = {
- condChange: function (_this) {
- var condId = $(_this).find(":selected").val();
- var optionStr = '<option value="">请选择</option>';
- if (condId) {
- var ajaxConfig = {
- url: '/admin/plan/week-task/cond-items?condId=' + condId,
- type: 'get',
- success: function (result) {
- $.each(result.data, function (inx, item) {
- optionStr += '<option value="' + item.id + '">' + item.name + '</option>';
- });
- $(_this).parent().parent().find("[name=cond_item_id]").html(optionStr);
- }
- };
- tips.ajax(ajaxConfig);
- } else {
- $(_this).parent().parent().find("[name=cond_item_id]").html(optionStr);
- }
- },
- add: function (_this) {
- var section = $(".nav-active").data('section');
- var tpl = '<tr class="sortableList">' +
- '<td><span class="taskStatus"></span><input type="hidden" name="status" value=""></td>' +
- '<td>' +
- '<select name="cond_id" class="form-control" onchange="units.condChange(this)"><option value="">请选择</option>';
- var webStr, designStr;
- webStr = '' +
- @foreach($condList['web'] as $cond)
- '<option value="{{$cond->id}}">{{$cond->name}}</option>' +
- @endforeach
- +'';
- designStr = '' +
- @foreach($condList['design'] as $cond)
- '<option value="{{$cond->id}}">{{$cond->name}}</option>' +
- @endforeach
- +'';
- var foot = '</select>' +
- '</td>' +
- '<td><textarea class="form-control" name="describe" rows="2" style="resize: vertical"></textarea></td>\n' +
- ' <td><select class="my-select" name="duty_id">\n' +
- '<option value="">请选择</option>' +
- @foreach($allUserList as $item)
- ' <option value="{{$item->id}}">{{$item->nickname}}</option>\n' +
- @endforeach
- ' </select></td>\n' +
- ' <td><select class="my-select" name="design_id">\n' +
- ' <option value="">请选择</option>' +
- @foreach($designerList as $item)
- ' <option value="{{$item->id}}">{{$item->nickname}}</option>\n' +
- @endforeach
- ' </select></td>\n' +
- ' <td><select class="my-select" name="web_id">\n' +
- ' <option value="">请选择</option>' +
- @foreach($webList as $item)
- ' <option value="{{$item->id}}">{{$item->nickname}}</option>\n' +
- @endforeach
- ' </select></td>\n' +
- ' <td><select name="cond_item_id" class="form-control">\n' +
- ' <option value="">请选择</option>' +
- ' </select></td>\n' +
- ' <td><input type="text" class="form-control" name="deadline"></td>\n' +
- ' <td><input type="text" class="form-control" name="remark"></td>\n' +
- ' <td style="position:relative">\n' +
- ' <div> <input type="hidden" name="taskId" value="0">' +
- ' <button type="button" class="btn btn-default btn-sm" onclick="units.changeStatus(this,\'reset\')">重置\n' + '</button>' +
- ' <button type="button" class="btn btn-info btn-sm" onclick="units.changeStatus(this,\'ok\')">完成</button>\n' +
- ' <button type="button" class="btn btn-success btn-sm" onclick="units.changeStatus(this,\'pause\')">暂停</button></div>' +
- ' <div><button type="button" class="btn btn-warning btn-sm" onclick="units.del(this)">删除</button>\n' +
- ' <button type="button" class="btn btn-primary btn-sm"\n' +
- ' onclick="units.singleSave(this)">保存\n' +
- ' </button></div>' +
- ' </td>\n' +
- ' </tr>';
- var result;
- if (section == 0) {
- result = tpl + webStr + foot;
- } else if (section == 1) {
- result = tpl + designStr + foot;
- }
- var tBody = $(_this).parent().parent().parent().next();
- tBody.append(result);
- $('.my-select').selectpicker({
- liveSearch: true
- });
- },
- del: function (_this) {
- var inx = layer.confirm('确认删除', {icon: 3, title: '删除'}, function () {
- var taskId = $(_this).parent().parent().find("[name=taskId]").val();
- if (taskId > 0) {
- var ajaxConfig = {
- url: '/admin/plan/week-task/del',
- type: 'post',
- data: {taskId: taskId},
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1000}, function () {
- });
- }
- };
- tips.ajax(ajaxConfig);
- }
- $(_this).parent().parent().parent().remove();
- layer.close(inx);
- });
- },
- singleSave: function (_this) {
- var tBody = $(_this).parent().parent().parent().parent();
- var tr = $(_this).parent().parent().parent();
- var taskId = tr.find("[name=taskId]").val();
- var data = {
- user_type: tBody.data('user-type'),
- day: tBody.data('day'),
- describe: tr.find("[name=describe]").val(),
- duty_id: tr.find("[name=duty_id]").val(),
- design_id: tr.find("[name=design_id]").val(),
- web_id: tr.find("[name=web_id]").val(),
- feedback: tr.find("[name=feedback]").val(),
- remark: tr.find("[name=remark]").val(),
- deadline: tr.find("[name=deadline]").val(),
- status: tr.find("[name=status]").val(),
- cond_id: tr.find("[name=cond_id] :selected").val(),
- cond_item_id: tr.find("[name=cond_item_id] :selected").val()
- };
- var sortIds = [];
- tBody.find("tr.sortableList").each(function () {
- sortIds.push($(this).find("[name=taskId]").val());
- });
- var ajaxConfig = {
- url: '/admin/plan/week-task/single-save',
- type: 'post',
- data: {data: data, taskId: taskId, sortIds: sortIds, type: "{{$type}}"},
- success: function (result) {
- var iconNum = 6;
- if (result['addId'] > 0) {
- tr.find("[name=taskId]").val(result['addId']);
- }
- if (result['code'] && result['code'] == '201') {
- iconNum = 3;
- }
- layer.msg(result.message, {icon: iconNum, time: 1000}, function () {
- });
- }
- };
- tips.ajax(ajaxConfig);
- },
- migrate: function () {
- layer.confirm('确认迁移', {icon: 3, title: '迁移'}, function () {
- var ajaxConfig = {
- url: '/admin/plan/week-task/migrate',
- type: 'post',
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1500}, function () {
- window.location.reload();
- });
- }
- };
- tips.ajax(ajaxConfig);
- });
- },
- changeStatus: function (_this, statusType) {
- var mapData = {ok: "完成", pause: "暂停", reset: ""};
- $(_this).parent().parent().parent().find(".taskStatus").text(mapData[statusType]);
- $(_this).parent().parent().parent().find("[name=status]").val(statusType);
- }
- };
- </script>
- @endsection
|