From 3d5fd12b8c0189206c87885515324209fe11dcbc Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期五, 04 八月 2023 16:47:40 +0800
Subject: [PATCH] #报价单界面审核功能

---
 src/main/webapp/static/js/priQuote/priQuote.js                      |   81 +++++++++++
 src/main/webapp/views/priQuote/priQuote_more.html                   |  218 +++++++++++++++++++++++++++++++
 src/main/java/com/zy/crm/manager/controller/PriQuoteController.java |   18 ++
 src/main/webapp/static/js/common.js                                 |    1 
 src/main/webapp/views/priQuote/priQuote.html                        |   60 ++++++++
 5 files changed, 376 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java b/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java
index 1de6b71..ff6b604 100644
--- a/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java
+++ b/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java
@@ -67,16 +67,34 @@
     }
 
     private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
+        Long deptId = getDeptId();
+        boolean signUserId = false;
+        boolean signDeptId = false;
+        for (Map.Entry<String, Object> entry : map.entrySet()){
+            if (entry.getKey().equals("dept_id")){
+                signDeptId = true;
+            }
+        }
         for (Map.Entry<String, Object> entry : map.entrySet()){
             String val = String.valueOf(entry.getValue());
             if (val.contains(RANGE_TIME_LINK)){
                 String[] dates = val.split(RANGE_TIME_LINK);
                 wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                 wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
+            } else if (entry.getKey().equals("dept_id")){
+                if (!val.equals("19")){
+                    wrapper.eq(entry.getKey(), val);
+                }
+            } else if (entry.getKey().equals("user_id") && !signDeptId){
+                signUserId = true;
+                wrapper.eq(entry.getKey(), val);
             } else {
                 wrapper.like(entry.getKey(), val);
             }
         }
+        if (!signUserId && !signDeptId){
+            wrapper.eq("user_id", getUserId());
+        }
     }
 
     @RequestMapping(value = "/priQuote/add/auth")
diff --git a/src/main/webapp/static/js/common.js b/src/main/webapp/static/js/common.js
index cffd7ac..a6bd673 100644
--- a/src/main/webapp/static/js/common.js
+++ b/src/main/webapp/static/js/common.js
@@ -222,3 +222,4 @@
 var cstmrByMore;
 var orderByMore;
 var planByMore;
+var priQuoteByMore;
diff --git a/src/main/webapp/static/js/priQuote/priQuote.js b/src/main/webapp/static/js/priQuote/priQuote.js
index 61c4c26..fbd3755 100644
--- a/src/main/webapp/static/js/priQuote/priQuote.js
+++ b/src/main/webapp/static/js/priQuote/priQuote.js
@@ -4,13 +4,75 @@
     base: baseUrl + "/static/layui/lay/modules/"
 }).extend({
     cascader: 'cascader/cascader',
-}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'tree', 'dropdown'], function(){
+}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'tree', 'dropdown','layer','upload', 'cascader'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
     var layDate = layui.laydate;
     var form = layui.form;
     admin = layui.admin;
+    var tree = layui.tree;
+    var element = layui.element;
+    var upload = layui.upload;
+    var xmSelect = layui.xmSelect;
+    var cascader = layui.cascader;
+    var dropdown = layui.dropdown;
+
+    $('#organization').html(localStorage.getItem('nickname') + ' <i class="layui-icon">&#xe61a;</i>');
+
+    // 閮ㄩ棬浜哄憳 绛涢��
+    dropdown.render({
+        elem: '#organization'
+        ,content: ['<div id="organizationTree" style="height: calc(100vh - 525px);border: none"></div>'].join('')
+        ,style: 'width: 370px; height: 350px; padding: 0 15px; box-shadow: 1px 1px 30px rgb(0 0 0 / 12%);'
+        ,ready: function(){
+            loadTree();
+        }
+    });
+
+    // 鏍戝舰鍥�
+    var organizationTree;
+    window.loadTree = function(condition){
+        var loadIndex = layer.load(2);
+        $.ajax({
+            url: baseUrl+"/dept/user/tree/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                'condition': condition
+            },
+            method: 'POST',
+            success: function (res) {
+                layer.close(loadIndex);
+                if (res.code === 200){
+                    organizationTree = tree.render({
+                        elem: '#organizationTree',
+                        id: 'organizationTree',
+                        onlyIconControl: true,
+                        data: res.data,
+                        click: function (obj) {
+                            treeCond = {
+                                key: obj.data.key,
+                                val: obj.data.id
+                            }
+                            $('#organization').html(obj.data.title + ' <i class="layui-icon">&#xe61a;</i>');
+                            $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click');
+                            $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click');
+                            clearFormVal($('#search-box'));
+                            tableIns.reload({
+                                where: {[obj.data.key]: obj.data.id},
+                                page: {curr: 1}
+                            });
+                        }
+                    });
+                    treeData = res.data;
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg)
+                }
+            }
+        })
+    }
 
     // 鏁版嵁娓叉煋
     tableIns = table.render({
@@ -25,7 +87,7 @@
         cols: [[
             {type: 'checkbox', fixed: 'left'}
             ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
-            ,{field: 'templateName', align: 'center',title: '妯℃澘鍚�'}
+            ,{field: 'templateName', align: 'center',title: '妯℃澘鍚�', width: 220, style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
             ,{field: 'orderNum', align: 'center',title: '鎶ヤ环棰勭畻鍗曞彿'}
             ,{field: 'inOrderNum', align: 'center',title: '鎶ヤ环缂栧彿'}
             ,{field: 'itemId$', align: 'center',title: '椤圭洰鍚�'}
@@ -86,7 +148,22 @@
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
     table.on('toolbar(priQuote)', function (obj) {
         var checkStatus = table.checkStatus(obj.config.id);
+        console.log(checkStatus)
         switch(obj.event) {
+            case 'more':
+                top.priQuoteByMore = obj.data.id;
+                console.log(top.priQuoteByMore)
+
+                admin.popupRight({
+                    type: 1,
+                    window: "top",
+                    area: "1250px",
+                    url: "priQuote_more.html",
+                    end: function () {
+                        // $(".layui-laypage-btn")[0].click();
+                    }
+                })
+                break;
             case 'addBlank':
                 showEditModel();
                 break;
diff --git a/src/main/webapp/views/priQuote/priQuote.html b/src/main/webapp/views/priQuote/priQuote.html
index 9953e64..9d3c6f1 100644
--- a/src/main/webapp/views/priQuote/priQuote.html
+++ b/src/main/webapp/views/priQuote/priQuote.html
@@ -9,6 +9,54 @@
     <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
     <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all">
     <link rel="stylesheet" href="../../static/css/cool.css" media="all">
+    <link rel="stylesheet" href="../../static/css/tree.css" media="all">
+    <link rel="stylesheet" href="../../static/layui/lay/modules/formDesigner/coolForm.css" />
+    <style>
+        .nav-box {
+            position: absolute;
+            top: 1px;
+            left: 5px;
+        }
+        .nav-box-item {
+            display: inline-block;
+            vertical-align: middle;
+            margin-right: 5px;
+        }
+
+        .layui-dropdown.layui-border-box.layui-panel.layui-anim.layui-anim-downbit,.layui-dropdown.layui-border-box.layui-panel.layui-anim.layui-anim-downbit * {
+            box-sizing:inherit;
+        }
+
+        .layui-menu li {
+            width: inherit;
+        }
+        .layui-tree-icon {
+            height: 16px;
+            line-height: 15px;
+            width: 15px;
+            text-align: center;
+            border: 1px solid #c0c4cc;
+        }
+
+        .site-dropdown-demo,
+        .site-dropdown-demo .layui-menu{background: #32363F;border-color: #484e58;}
+        .site-dropdown-demo .layui-menu li{color: #a1a8b8;}
+        .site-dropdown-demo .layui-menu li:hover{background-color: #32363F;}
+        .layui-menu-body-title>.layui-icon {
+            position: relative;
+            margin-right: 5px;
+        }
+
+        .layui-form-radio {
+            display: block;
+        }
+        .layui-unselect.layui-form-radio {
+            display: inline-block;
+        }
+        .layui-form-radio:hover *, .layui-form-radioed, .layui-form-radioed>i {
+            color: #2d8cf0;
+        }
+    </style>
 </head>
 <body>
 
@@ -16,6 +64,16 @@
     <div class="layui-card">
         <div class="layui-card-body">
             <div id="search-box" class="layui-form toolbar" style="display: flex;justify-content: flex-end;position: relative">
+                <div class="nav-box">
+                    <div class="nav-box-item">
+                        <i class="layui-icon" style="color: #1890ff;font-weight: bold">&#xe613;</i>
+                    </div>
+                    <div class="nav-box-item">
+                        <button id="organization" style="border: none;padding-right: 35px;" class="layui-btn layui-btn-primary icon-btn">
+                            鏈煡
+                        </button>
+                    </div>
+                </div>
                 <div class="layui-form-item">
                     <div class="layui-inline">
                         <div class="layui-input-inline">
@@ -48,9 +106,11 @@
 </script>
 
 <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
+<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
 <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
 <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
 <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/layui/lay/modules/cascader/citys-data.js" charset="utf-8"></script>
 <script type="text/javascript" src="../../static/js/priQuote/priQuote.js" charset="utf-8"></script>
 <!-- 琛ㄥ崟寮圭獥 -->
 <script type="text/html" id="editDialog">
diff --git a/src/main/webapp/views/priQuote/priQuote_more.html b/src/main/webapp/views/priQuote/priQuote_more.html
new file mode 100644
index 0000000..43ba31d
--- /dev/null
+++ b/src/main/webapp/views/priQuote/priQuote_more.html
@@ -0,0 +1,218 @@
+<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
+<style>
+    #formAdvForm {
+        background-color: #f3f3f3;
+    }
+    #formAdvForm .layui-form-item {
+        margin-top: 20px;
+        margin-bottom: 0;
+    }
+
+    #formAdvForm .layui-form-item .layui-inline {
+        margin-bottom: 25px;
+        margin-right: 0;
+    }
+
+    .form-group-bottom {
+        position: fixed;
+        left: 0;
+        right: 0;
+        bottom: 0;
+        padding: 10px 20px;
+        background-color: #fff;
+        box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, .05);
+    }
+
+    .card-body-item {
+        display: inline-block;
+        border-right: 1px solid #e0e0e0;
+        width: 250px;
+        padding: 0 30px 0 10px;
+    }
+    .header-desc {
+        overflow:hidden;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        -o-text-overflow:ellipsis;
+    }
+
+</style>
+<!-- 姝f枃寮�濮� -->
+<form class="layui-form" id="formAdvForm" lay-filter="formAdvForm" style="height: 100%">
+    <div class="layui-fluid" style="padding-bottom: 75px;height: 100%; overflow: scroll;box-sizing: border-box">
+        <!-- 鏍囬 -->
+        <div class="layui-card">
+            <div class="layui-card-header" style="padding-top: 5px; padding-bottom: 5px">
+                <div>
+                    <i class="layui-icon" style="font-size: 20px;color: #1890ff;font-weight: bold">&#xe656;</i>
+                    <span id="form-name" style="margin: 0 6px;font-size: 18px;font-weight: bold;letter-spacing: 1px"></span>
+                    <span style="opacity: .5;font-size: small;margin-left: 5px">鍞墠瑙勫垝鐢宠鍗�</span>
+                </div>
+            </div>
+            <div class="layui-card-body" style="padding: 30px 20px">
+
+                <div class="layui-tab layui-steps">
+                    <ul class="layui-tab-title" id="stepBox">
+                    </ul>
+                </div>
+
+            </div>
+        </div>
+        <div class="layui-row">
+            <!-- 鏁版嵁 -->
+            <div class="layui-col-md9">
+                <div class="layui-card">
+                    <div class="layui-card-header">
+                        鍩烘湰淇℃伅
+                    </div>
+                    <div class="layui-card-body">
+
+                    </div>
+                </div>
+            </div>
+            <!-- 鍔ㄦ�� -->
+            <div class="layui-col-md3" style="width: 24%;margin-left: 1%">
+                <!-- 鏃堕棿绾� -->
+                <div class="layui-card">
+                    <div class="layui-card-header">
+                        <span>鍞墠瑙勫垝娓呭崟</span>
+                    </div>
+                    <div class="layui-card-body">
+                        <ul class="layui-timeline" id="timelineBox">
+                        </ul>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group-bottom text-right">
+        <button class="layui-btn" lay-filter="refresh" lay-submit><i class="layui-icon">&#xe666;</i>&emsp;鍒锋柊&emsp;</button>
+    </div>
+
+</form>
+
+<script type="text/html" id="followerTabOperate">
+    <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="del">鍒犻櫎</a>
+</script>
+
+<!-- 璺熻繘浜� -->
+<script type="text/html" id="followerEditDialog">
+    <form id="followerEditForm" lay-filter="followerEditForm" class="layui-form model-form">
+        <input name="experimentId" type="hidden"/>
+        <div class="layui-form-item" style="float: left;clear: none;margin-right: 20px">
+            <label class="layui-form-label">閫夋嫨鎴愬憳</label>
+            <div class="layui-input-block">
+                <div id="followersBox" name="followersBox">
+                </div>
+            </div>
+        </div>
+        <div class="layui-form-item text-right" style="float: left;clear: none">
+            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">鍙栨秷</button>
+            <button class="layui-btn" lay-filter="followerSubmit" lay-submit>淇濆瓨</button>
+        </div>
+    </form>
+</script>
+
+<script type="text/template" id="stepTpl">
+    {{#each list}}
+    <li id="step-{{step}}" style="pointer-events: none">
+        <i class="layui-icon layui-icon-ok">{{step}}</i>
+        <span class="layui-steps-title">{{title}}</span>
+        {{# if username}}
+        <span class="layui-steps-content">{{username}}</span>
+        {{ else }}
+        <span class="layui-steps-content">&nbsp;</span>
+        {{/if}}
+    </li>
+    {{/each}}
+</script>
+
+<script type="text/template" id="timelineTpl">
+    {{#each list}}
+    <li class="layui-timeline-item">
+        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
+        <div class="layui-timeline-content layui-text">
+            <h4 class="layui-timeline-title" style="display: inline;margin-right: 10px;">{{title}}</h4>
+            <span>{{time}}</span>
+            <p>
+                {{msg}}
+            </p>
+        </div>
+    </li>
+    {{/each}}
+</script>
+
+<script>
+    var priQuoteId = top.priQuoteByMore;
+    $('.layui-layer-close').hide();
+    layui.config({
+        base: baseUrl + "/static/layui/lay/modules/"
+    }).extend({
+        notice: 'notice/notice',
+        steps: 'steps/steps',
+    }).use(['form', 'table', 'laydate', 'notice', 'xmSelect', 'steps'], function () {
+        var $ = layui.jquery;
+        var form = layui.form;
+        var table = layui.table;
+        var laydate = layui.laydate;
+        var notice = layui.notice;
+        var xmSelect = layui.xmSelect;
+        var steps = layui.steps;
+
+        form.render('select');
+
+        init();
+        function init(){
+            notice.msg('姝e湪杞藉叆鏁版嵁......', {icon: 4, position: "topRight"});
+            $.ajax({
+                url: baseUrl + "/priQuote/" + priQuoteId + "/auth",
+                headers: {'token': localStorage.getItem('token')},
+                method: 'GET',
+                success: function (res) {
+                    notice.destroy();
+                    if (res.code === 200) {
+                        let priQuote = res.data;
+                        top.priQuoteByMore = null;
+                        $("#form-name").html(priQuote.name);
+                        // 杩涘害姝ラ鍥�
+                        let template0 = Handlebars.compile($('#stepTpl').html());
+                        $('#stepBox').html(template0({list: JSON.parse(priQuote.settleMsg)}));
+                        $('#step-' + Number(priQuote.step)).addClass("layui-this");
+
+                        let template1 = Handlebars.compile($('#timelineTpl').html());
+                        $('#timelineBox').html(template1({list: JSON.parse(priQuote.settleMsg)}));
+                        // 琛ュ厖html
+                        $('#customizeBox').html(priQuote.formHtml);
+                        // 璁惧鏄庣粏
+                        form.val('formAdvForm', priQuote);
+                        top.convertDisabled($('#formAdvForm :input'), true);
+                        // 璺熻繘浜�
+                        initFollowers(priQuote.id);
+                        layDateRender();
+                    } else if (res.code === 403) {
+                        top.location.href = baseUrl + "/";
+                    } else {
+                        layer.msg(res.msg, {icon: 2})
+                    }
+                }
+            })
+        }
+
+        /* 娓叉煋laydate */
+        function layDateRender() {
+            laydate.render({
+                elem: '#endTime',
+                type: 'datetime'
+            });
+        }
+        layDateRender();
+
+        /* 鐩戝惉琛ㄥ崟鎻愪氦 */
+        form.on('submit(refresh)', function (data) {
+            init();
+            return false;
+        });
+
+    })
+</script>

--
Gitblit v1.9.1