123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- @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="ul-content">
- <li class="active">
- <main id="main">
- <button type="button" class="btn btn-success" onclick="utils.addMain()">新增步骤</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>
- <a onclick="utils.delMain(this)">删除步骤</a>
- <div>
- @foreach($stage['optimization_flow_info_list'] as $info)
- <table class="my-table">
- <colgroup>
- <col style="width: 20%">
- <col style="width: 20%">
- <col style="width: 10%">
- <col style="width: 10%">
- <col style="width: 20%">
- <col style="width: 10%">
- </colgroup>
- <thead>
- <tr>
- <td>具体流程 <input type="hidden" value="{{$info['id']}}" name="infoId"></td>
- <td>备注</td>
- <td>开始时间</td>
- <td>截止时间</td>
- <td>执行人</td>
- <td class="operateAdd">
- <a href="javascript:;"
- onclick="utils.add(this)">添加</a>
- </td>
- </tr>
- </thead>
- <tbody class="connectedSortable">
- @foreach($info['detail_list'] as $item)
- @if(!empty($item['children']))
- @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_start_date"
- value="{{$index['flow_start_date']??''}}"></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><input type="text" class="form-control" name="duty_man"
- value="{{$index['duty_man']??''}}">
- </td>
- <td class="operateDel" onclick="utils.del(this)">删除</td>
- </tr>
- @endforeach
- @endif
- @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>' +
- ' <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_start_date" onclick="utils.bindDate(this)"></td>\n' +
- ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
- ' <td><input type="text" class="form-control" name="duty_man"></td>'+
- ' </td>'+
- ' <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 style="width: 20%">\n' +
- ' <col style="width: 20%">\n' +
- ' <col style="width: 10%">\n' +
- ' <col style="width: 10%">\n' +
- ' <col style="width: 20%">\n' +
- ' <col style="width: 10%">\n' +
- ' </colgroup>\n' +
- ' <thead>\n' +
- ' <tr>\n' +
- ' <td>具体流程 <input type="hidden" value="0" name="infoId"> </td>\n' +
- ' <td>备注</td>\n' +
- ' <td>开始时间</td>\n' +
- ' <td>截止时间</td>\n' +
- ' <td>执行人</td>\n' +
- ' <td class="operateAdd">\n' +
- ' <a href="javascript:;" onclick="utils.add(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_start_date" onclick="utils.bindDate(this)"></td>\n' +
- ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
- ' <td><input type="text" class="form-control" name="flow_remark"></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.delMain(this)">删除步骤</a>\n' +
- ' <div>\n' +
- ' <table class="my-table">\n' +
- ' <colgroup>\n' +
- ' <col style="width: 20%">\n' +
- ' <col style="width: 20%">\n' +
- ' <col style="width: 10%">\n' +
- ' <col style="width: 10%">\n' +
- ' <col style="width: 20%">\n' +
- ' <col style="width: 10%">\n' +
- ' </colgroup>\n' +
- ' <thead>\n' +
- ' <tr>\n' +
- ' <td>具体流程 <input type="hidden" value="0" name="infoId"> </td>\n' +
- ' <td>备注</td>\n' +
- ' <td>开始时间</td>\n' +
- ' <td>截止时间</td>\n' +
- ' <td>执行人</td>\n' +
- ' <td class="operateAdd">\n' +
- ' <a href="javascript:;" onclick="utils.add(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_start_date" onclick="utils.bindDate(this)"></td>\n' +
- ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
- ' <td><input type="text" class="form-control" name="flow_name"></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();
- },
- 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 stepId = step_title_obj.data('id');
- var stepData = {step_title: step_title, 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_start_date = $(this).find("[name=flow_start_date]").val();
- var flow_done_date = $(this).find("[name=flow_done_date]").val();
- var duty_man = $(this).find("[name=duty_man]").val();
- if (!flow_name) {
- errMsg += '具体流程不能为空<br>';
- }
- var temp = {
- flow_name: flow_name,
- flow_remark: flow_remark,
- flow_start_date: flow_start_date,
- flow_done_date: flow_done_date,
- duty_man: duty_man
- };
- flowData.children.push(temp);
- });
- stepData.children.push(flowData);
- });
- flowAll.push(stepData);
- });
- if (errMsg !== '') {
- layer.alert(errMsg, {icon: 5});
- return;
- }
- var ajaxConfig = {
- url: '/admin/bqTraffic/optimizationProcessSave/{{$siteId}}',
- type: 'post',
- data: {
- dataList: flowAll
- }
- };
- tips.ajax(ajaxConfig);
- },
- bindDate: function (that) {
- var routeTime = {
- type: 'date',
- elem: that
- };
- laydate.render(routeTime);
- },
- };
- </script>
- @endsection
|