From affbba0568f48d558ad84fb5247c135d7be96bde Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期五, 11 八月 2023 16:23:14 +0800
Subject: [PATCH] #报价单审核机制

---
 src/main/webapp/static/js/priQuote/priQuote.js                      |   34 +++++++++--------
 src/main/webapp/views/priQuote/priQuote_more.html                   |    4 +-
 src/main/resources/mapper/PriQuoteMapper.xml                        |    3 +
 src/main/java/com/zy/crm/manager/controller/PriQuoteController.java |   32 +++++++++++++--
 src/main/java/com/zy/crm/manager/entity/PriQuote.java               |   37 ++++++++++++++++++
 5 files changed, 87 insertions(+), 23 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 05c9a65..f261d0b 100644
--- a/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java
+++ b/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java
@@ -1,5 +1,6 @@
 package com.zy.crm.manager.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -11,15 +12,15 @@
 import com.core.common.DateUtils;
 import com.core.common.R;
 import com.core.domain.KeyValueVo;
+import com.zy.crm.common.model.SettleDto;
 import com.zy.crm.common.web.BaseController;
-import com.zy.crm.manager.entity.Item;
-import com.zy.crm.manager.entity.Plan;
-import com.zy.crm.manager.entity.PriQuote;
-import com.zy.crm.manager.entity.PriQuoteBudget;
+import com.zy.crm.manager.entity.*;
 import com.zy.crm.manager.service.ItemService;
 import com.zy.crm.manager.service.PlanService;
 import com.zy.crm.manager.service.PriQuoteBudgetService;
 import com.zy.crm.manager.service.PriQuoteService;
+import com.zy.crm.system.entity.User;
+import com.zy.crm.system.service.UserService;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,12 +43,27 @@
     private PlanService planService;
 
     @Autowired
+    private UserService userService;
+
+    @Autowired
     private PriQuoteBudgetService priQuoteBudgetService;
 
     @RequestMapping(value = "/priQuote/{id}/auth")
     @ManagerAuth
     public R get(@PathVariable("id") String id) {
-        return R.ok(priQuoteService.selectById(String.valueOf(id)));
+        PriQuote priQuote = priQuoteService.selectById(String.valueOf(id));
+        assert priQuote != null;
+        JSONObject resultObj = JSON.parseObject(JSON.toJSONString(priQuote));
+        if (!Cools.isEmpty(priQuote.getForm())) {
+            JSONObject formObj = JSON.parseObject(priQuote.getForm());
+            formObj.forEach(resultObj::putIfAbsent);
+        }
+
+        // 姝ラ鏉$浉鍏�
+        resultObj.put("step", priQuote.getSettle() == 5 ? 0 : priQuote.getSettle() + 1);
+
+        return R.ok().add(resultObj);
+//        return R.ok(priQuoteService.selectById(String.valueOf(id)));
     }
 
     @RequestMapping(value = "/priQuote/list/auth")
@@ -127,6 +143,12 @@
 
         //璁剧疆椤圭洰娴佺▼
         plan.setStep(5);
+
+        priQuote.setForm(JSON.toJSONString(map));     // 鑷畾涔夎〃鍗曞唴瀹�
+        priQuote.setSettle(1);  // 1.寮�濮�
+        User manager = userService.getDeptManager(getHostId(), getUser().getDeptId());        // 鑾峰彇閮ㄩ棬棰嗗
+        priQuote.setSettleMsg(JSON.toJSONString(SettleDto.init(plan, manager)));
+
         planService.updateById(plan);
 
         priQuoteService.insert(priQuote);
diff --git a/src/main/java/com/zy/crm/manager/entity/PriQuote.java b/src/main/java/com/zy/crm/manager/entity/PriQuote.java
index 964d462..51de661 100644
--- a/src/main/java/com/zy/crm/manager/entity/PriQuote.java
+++ b/src/main/java/com/zy/crm/manager/entity/PriQuote.java
@@ -86,6 +86,25 @@
     @TableField("member_id")
     private Long memberId;
 
+    /**
+     * 琛ㄥ崟鍐呭
+     */
+    @ApiModelProperty(value= "琛ㄥ崟鍐呭")
+    private String form;
+
+    /**
+     * 杩涘害 1: 寮�濮�  2: 缁勯暱瀹℃牳  3: 鍞墠缁勯暱瀹℃牳  4: 瑙勫垝鍛樺鏍�  5: 瀹℃壒閫氳繃
+     */
+    @ApiModelProperty(value= "杩涘害 1: 寮�濮�  2: 缁勯暱瀹℃牳  3: 鍞墠瀹℃牳  4: 瑙勫垝鍛樺鏍�  5: 瀹℃壒閫氳繃  ")
+    private Integer settle;
+
+    /**
+     * 瀹℃牳杩涘害
+     */
+    @ApiModelProperty(value= "瀹℃牳杩涘害")
+    @TableField("settle_msg")
+    private String settleMsg;
+
     public PriQuote() {}
 
     public PriQuote(String title,String sheetData,Date createTime,String filepath) {
@@ -95,6 +114,24 @@
         this.filepath = filepath;
     }
 
+    public String getSettle$(){
+        if (null == this.settle){ return null; }
+        switch (this.settle){
+            case 1:
+                return "绛夊緟缁勯暱瀹℃牳";
+            case 2:
+                return "绛夊緟鍞墠鍒嗛厤瑙勫垝鍛�";
+            case 3:
+                return "绛夊緟瑙勫垝鍛樻彁浜�";
+            case 4:
+                return "瑙勫垝鍛樺凡鎻愪氦";
+            case 5:
+                return "瀹℃壒閫氳繃";
+            default:
+                return String.valueOf(this.settle);
+        }
+    }
+
     public String getCreateTime$(){
         if (Cools.isEmpty(this.createTime)){
             return "";
diff --git a/src/main/resources/mapper/PriQuoteMapper.xml b/src/main/resources/mapper/PriQuoteMapper.xml
index f163057..c96e760 100644
--- a/src/main/resources/mapper/PriQuoteMapper.xml
+++ b/src/main/resources/mapper/PriQuoteMapper.xml
@@ -9,6 +9,9 @@
         <result column="sheet_data" property="sheetData" />
         <result column="create_time" property="createTime" />
         <result column="dept_id" property="deptId" />
+        <result column="form" property="form" />
+        <result column="settle" property="settle" />
+        <result column="settle_msg" property="settleMsg" />
 
     </resultMap>
 
diff --git a/src/main/webapp/static/js/priQuote/priQuote.js b/src/main/webapp/static/js/priQuote/priQuote.js
index 1b0e9ea..4f0ea29 100644
--- a/src/main/webapp/static/js/priQuote/priQuote.js
+++ b/src/main/webapp/static/js/priQuote/priQuote.js
@@ -3,8 +3,9 @@
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
 }).extend({
+    steps: 'steps/steps',
     cascader: 'cascader/cascader',
-}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'tree', 'dropdown','layer','upload', 'cascader'], function(){
+}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'steps', 'tree', 'dropdown','layer','upload', 'cascader'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
@@ -12,6 +13,7 @@
     var form = layui.form;
     admin = layui.admin;
     var tree = layui.tree;
+    var steps = layui.steps;
     var element = layui.element;
     var upload = layui.upload;
     var xmSelect = layui.xmSelect;
@@ -117,7 +119,7 @@
             if (res.code === 403) {
                 top.location.href = baseUrl+"/";
             }
-            pageCurr=curr;
+            pageCurr=curr;pageCount=count;
             limit();
         }
     });
@@ -150,20 +152,6 @@
         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;
@@ -250,6 +238,20 @@
     table.on('tool(priQuote)', function(obj){
         var data = obj.data;
         switch (obj.event) {
+            case 'more':
+                top.priQuoteByMore = 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 "quote":
                 layer.open({
                     type: 2,
diff --git a/src/main/webapp/views/priQuote/priQuote_more.html b/src/main/webapp/views/priQuote/priQuote_more.html
index 43ba31d..525467d 100644
--- a/src/main/webapp/views/priQuote/priQuote_more.html
+++ b/src/main/webapp/views/priQuote/priQuote_more.html
@@ -46,7 +46,7 @@
                 <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>
+                    <span style="opacity: .5;font-size: small;margin-left: 5px">鎶ヤ环鍗�</span>
                 </div>
             </div>
             <div class="layui-card-body" style="padding: 30px 20px">
@@ -75,7 +75,7 @@
                 <!-- 鏃堕棿绾� -->
                 <div class="layui-card">
                     <div class="layui-card-header">
-                        <span>鍞墠瑙勫垝娓呭崟</span>
+                        <span>鎶ヤ环鍗�</span>
                     </div>
                     <div class="layui-card-body">
                         <ul class="layui-timeline" id="timelineBox">

--
Gitblit v1.9.1