123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- @extends('admin/site/side_layout')
- @section('header_extend')
- <link rel="stylesheet"
- href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
- <style>
- .ul-content {
- margin: 0;
- padding: 0;
- list-style-type: none;
- }
- .ul-content li {
- padding: 20px 10px 10px;
- display: none;
- }
- .ul-content .active {
- display: block;
- }
- .my-table {
- margin-top: 10px;
- width: 100%;
- }
- .my-table tr {
- border: 1px solid #f1f1f1;
- }
- .my-table td {
- padding: 8px;
- }
- .operateAdd, .operateDel {
- font-weight: 600;
- cursor: pointer;
- text-align: center;
- }
- .mainStep {
- border: 1px solid #999;
- padding: 12px;
- margin-top: 20px;
- }
- .mainStepText {
- display: inline-block;
- width: 180px;
- }
- </style>
- @endsection
- @section('right')
- <ul class="nav nav-tabs">
- <li class="active"><a>流程</a></li>
- <li><a href="/admin/bqTraffic/bqProcessTpl/{{$siteId}}">模板</a></li>
- </ul>
- <ul class="ul-content">
- <li class="active">
- <main id="main">
- <button type="button" class="btn btn-success" onclick="utils.initFlow()">初始化模版</button>
- {{--<button type="button" class="btn btn-success" onclick="utils.addMain()">新增步骤</button>--}}
- <button type="button" class="btn btn-success" onclick="utils.flowReport()" style="margin-left:4px">
- 流程报表
- </button>
- <button type="button" class="btn btn-info" onclick="utils.saveFlowTpl()">保存</button>
- @foreach($tplStageList as $stage)
- <div class="mainStep">
- <h4 style="display: inline-block">完成步骤:<input type="text" class="form-control mainStepText"
- name="step_title" value="{{$stage['title']}}"
- data-id="{{$stage['id']}}"
- style="width: 260px;display: inline-block"></h4>
- <h4 style="display: inline-block">预计时间:
- <input type="text" class="form-control my-date" name="expected_date"
- value="{{substr($stage['expected_date']??'',0,10)}}"
- style="width: 110px;display: inline-block" onclick="utils.bindDate(this)"></h4>
- {{--<a onclick="utils.addBig(this)">添加大流程</a>--}}
- <a onclick="utils.delMain(this)">删除步骤</a>
- <div>
- @foreach($stage['bq_flow_info'] as $info)
- <table class="my-table">
- <colgroup>
- <col span="3" style="width: 20%">
- <col style="width: 12%">
- <col style="width: 10%">
- <col style="width: 18%">
- </colgroup>
- <thead>
- <tr>
- <td>具体流程 <input type="hidden" value="{{$info['id']}}" name="infoId"></td>
- <td>备注</td>
- <td>完成时间</td>
- <td>对接人</td>
- <td class="operateAdd">
- <a href="javascript:;"
- onclick="utils.add(this)">添加</a>
- {{--<a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>--}}
- </td>
- </tr>
- </thead>
- <tbody class="connectedSortable">
- @foreach($info['detail_list'] as $item)
- @foreach($item['children'] as $index)
- <tr>
- <td><input type="text" class="form-control" name="flow_name"
- value="{{$index['flow_name']}}"></td>
- <td><input type="text" class="form-control" name="flow_remark"
- value="{{$index['flow_remark']}}"></td>
- <td><input type="text" class="form-control my-date"
- onclick="utils.bindDate(this)" name="flow_done_date"
- value="{{$index['flow_done_date']}}"></td>
- <td>
- <select name="duty_user" class="my-select" multiple
- data-container="body" data-live-search="true"
- data-man="{{json_encode($index['duty_man']??[])}}">
- @foreach($userList as $user)
- @if(!in_array($user['role_id'],$index['duty_man']??[])) @continue @endif
- <option value="{{$user['id']}}"
- @if(is_array($index['duty_user']??'') && in_array($user['id'],$index['duty_user'])) selected @endif>
- {{$user['nickname']}}
- 【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}
- 】
- </option>
- @endforeach
- </select>
- <span style="font-weight: 600;">
- @foreach($index['duty_man']??[] as $v)
- {{\App\Http\Models\FlowInfoTpl::RoleScope[$v]??''}}
- @endforeach
- </span>
- </td>
- <td class="operateDel" onclick="utils.del(this)">删除</td>
- </tr>
- @endforeach
- @endforeach
- </tbody>
- </table>
- @endforeach
- </div>
- </div>
- @endforeach
- </main>
- </li>
- </ul>
- @endsection
- @section('footer_extend')
- <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
- <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
- <script src="{{asset('js/jquery-ui-1.10.4.min.js')}}"></script>
- <script>
- $(function () {
- $('.my-select').selectpicker({
- liveSearch: true
- });
- $("tbody").sortable({
- connectWith: ".connectedSortable"
- }).disableSelection();
- });
- $(function () {
- $(".my-date").trigger('click');
- $('.my-select').selectpicker();
- });
- var utils = {
- add: function (_this) {
- var rowspan = $(_this).parent().next().attr('rowspan');
- $(_this).parent().next().attr('rowspan', rowspan + 1)
- var str = ' <tr>\n' +
- ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
- ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
- ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
- ' <td>\n' +
- ' <select name="duty_man" class="my-select" multiple data-container="body">\n' +
- @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
- ' <option value="{{$roleId}}">{{$roleName}}</option>' +
- @endforeach
- ' </select>' +
- ' </td>\n' +
- ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
- ' </tr>';
- $(_this).parent().parent().parent().next().append(str);
- $(".my-date").trigger('click');
- $('.my-select').selectpicker();
- },
- del: function (_this) {
- var mergedTd = $(_this).parent().parent().find(".mergedTd")
- var rowspan = mergedTd.attr('rowspan');
- mergedTd.attr('rowspan', rowspan - 1);
- $(_this).parent().remove();
- },
- addBig: function (_this) {
- var str = '<table class="my-table">\n' +
- ' <colgroup>\n' +
- ' <col span="3" style="width: 20%">\n' +
- ' <col style="width: 12%">\n' +
- ' <col style="width: 10%">\n' +
- ' <col style="width: 18%">\n' +
- ' </colgroup>\n' +
- ' <thead>\n' +
- ' <tr>\n' +
- ' <td>具体流程 <input type="hidden" value="0" name="infoId"> </td>\n' +
- ' <td>备注</td>\n' +
- '\n' +
- ' <td>完成时间</td>\n' +
- ' <td>对接人</td>\n' +
- ' <td class="operateAdd">\n' +
- ' <a href="javascript:;" onclick="utils.add(this)">添加</a>\n' +
- /*' <a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>\n' +*/
- ' </td>\n' +
- ' </tr>\n' +
- ' </thead>\n' +
- ' <tbody>\n' +
- ' <tr>\n' +
- ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
- ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
- ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
- ' <td>\n' +
- ' <select name="duty_man" class="my-select" multiple data-container="body">\n' +
- @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
- ' <option value="{{$roleId}}">{{$roleName}}</option>' +
- @endforeach
- ' </select>\n' +
- ' </td>\n' +
- ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
- ' </tr>\n' +
- ' </tbody>\n' +
- ' </table>';
- $(_this).next().next().append(str);
- $(".my-date").trigger('click');
- $('.my-select').selectpicker();
- },
- delBig: function (_this) {
- $(_this).parent().parent().parent().parent().remove()
- },
- delMain: function (_this) {
- $(_this).parent().remove()
- },
- addMain: function () {
- var str = ' <div class="mainStep">\n' +
- ' <h4 style="display: inline-block">建站步骤:<input type="text" class="form-control mainStepText"\n' +
- ' name="step_title" data-id="0"></h4>\n' +
- /*' <a onclick="utils.addBig(this)">添加大流程</a>\n' +*/
- ' <a onclick="utils.delMain(this)">删除步骤</a>\n' +
- ' <div>\n' +
- ' <table class="my-table">\n' +
- ' <colgroup>\n' +
- ' <col span="3" style="width: 20%">\n' +
- ' <col style="width: 12%">\n' +
- ' <col style="width: 10%">\n' +
- ' <col style="width: 18%">\n' +
- ' </colgroup>\n' +
- ' <thead>\n' +
- ' <tr>\n' +
- ' <td>具体流程 <input type="hidden" value="0" name="infoId"> </td>\n' +
- ' <td>备注</td>\n' +
- '\n' +
- ' <td>完成时间</td>\n' +
- ' <td>对接人</td>\n' +
- ' <td class="operateAdd">\n' +
- ' <a href="javascript:;" onclick="utils.add(this)">添加</a>\n' +
- /*' <a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>\n' +*/
- ' </td>\n' +
- ' </tr>\n' +
- ' </thead>\n' +
- ' <tbody>\n' +
- ' <tr>\n' +
- ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
- ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
- ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
- ' <td>\n' +
- ' <select name="duty_man" class="my-select" multiple data-container="body">\n' +
- @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
- '<option value="{{$roleId}}">{{$roleName}}</option>' +
- @endforeach
- ' </select>\n' +
- ' </td>\n' +
- ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
- ' </tr>\n' +
- ' </tbody>\n' +
- ' </table>\n' +
- '\n' +
- ' </div>\n' +
- ' </div>';
- $("#main").append(str);
- $(".my-date").trigger('click');
- $('.my-select').selectpicker();
- },
- initFlow: function () {
- var ajaxConfig = {
- url: '/admin/bqTraffic/bqProcessReset/{{$siteId}}',
- type: 'post',
- success: function () {
- window.location.reload();
- }
- };
- tips.ajax(ajaxConfig);
- },
- flowReport: function () {
- window.open('/wap/{{base64_encode($siteId)}}/optimizationFlow');
- },
- saveFlowTpl: function () {
- var flowAll = [];
- var errMsg = '';
- $(".mainStep").each(function () {
- var step_title_obj = $(this).find("[name=step_title]");
- var step_title = step_title_obj.val();
- var expected_date_obj = $(this).find("[name=expected_date]");
- var expected_date = expected_date_obj.val();
- var stepId = step_title_obj.data('id');
- var stepData = {
- step_title: step_title,
- expected_date: expected_date,
- step_id: stepId,
- children: []
- };
- if (!step_title) {
- errMsg += '建站步骤不能为空<br>';
- }
- $(this).find("table").each(function () {
- var flowData = {
- info_id: $(this).find("[name=infoId]").val(),
- children: []
- };
- $(this).find("tbody tr").each(function () {
- var flow_name = $(this).find("[name=flow_name]").val();
- var flow_remark = $(this).find("[name=flow_remark]").val();
- var flow_done_date = $(this).find("[name=flow_done_date]").val();
- var duty_user = $(this).find("[name=duty_user]").val();
- var duty_man = $(this).find("[name=duty_user]").data('man');
- if (!duty_man) {
- duty_man = [];
- }
- if (!duty_user) {
- duty_user = [];
- }
- if (!flow_name) {
- errMsg += '具体流程不能为空<br>';
- }
- var temp = {
- flow_name: flow_name,
- duty_man: duty_man,
- flow_remark: flow_remark,
- flow_done_date: flow_done_date,
- duty_user: duty_user
- };
- flowData.children.push(temp);
- });
- stepData.children.push(flowData);
- });
- flowAll.push(stepData);
- });
- if (errMsg !== '') {
- layer.alert(errMsg, {icon: 5});
- return;
- }
- var ajaxConfig = {
- url: '/admin/bqTraffic/bqProcessSave/{{$siteId}}',
- type: 'post',
- data: {
- dataList: flowAll
- }
- };
- tips.ajax(ajaxConfig);
- },
- bindDate: function (that) {
- var routeTime = {
- type: 'date',
- elem: that
- };
- laydate.render(routeTime);
- },
- };
- </script>
- @endsection
|