Sfoglia il codice sorgente

SAI开项管理 - 在总数据页面新增趋势分析,主要包含四个班组当年提交的SAI数量,个人提交数量数据分析图(饼图、柱状)
SAI开项管理 - 在总数据页面添加各班组当年至今的提交数量,个人提交排名前六的人名和提交数

wangggziwen 4 mesi fa
parent
commit
dd232cd5f1

+ 22 - 0
master/src/main/java/com/ruoyi/project/production/controller/TSaiApplyController.java

@@ -31,6 +31,7 @@ import com.ruoyi.project.production.controller.vo.SaiApplyQueryVO;
 import com.ruoyi.project.production.domain.TSaiApply;
 import com.ruoyi.project.production.domain.TSaiApproveFile;
 import com.ruoyi.project.production.domain.TSaiCategory;
+import com.ruoyi.project.production.mapper.TSaiApplyMapper;
 import com.ruoyi.project.production.service.ITSaiApplyService;
 import com.ruoyi.project.production.service.ITSaiApproveFileService;
 import com.ruoyi.project.production.service.ITSaiCategoryService;
@@ -79,6 +80,9 @@ public class TSaiApplyController extends BaseController
     @Autowired
     private ITSaiApplyService tSaiApplyService;
 
+    @Autowired
+    private TSaiApplyMapper tSaiApplyMapper;
+
     @Autowired
     private RuntimeService runtimeService;
 
@@ -109,6 +113,24 @@ public class TSaiApplyController extends BaseController
     @Autowired
     private ITSaiCategoryService tSaiCategoryService;
 
+    //四个班组当年提交的SAI数量(图)
+    @PreAuthorize("@ss.hasPermi('production:apply:list')")
+    @GetMapping("/teamAnalysis")
+    public AjaxResult teamAnalysis()
+    {
+        List<TSaiApply> list = tSaiApplyMapper.selectTeamAnalysis();
+        return AjaxResult.success(list);
+    }
+
+    //个人提交数量数据分析图(图)
+    @PreAuthorize("@ss.hasPermi('production:apply:list')")
+    @GetMapping("/personalAnalysis")
+    public AjaxResult personalAnalysis()
+    {
+        List<TSaiApply> list = tSaiApplyMapper.selectPersonalAnalysis();
+        return AjaxResult.success(list);
+    }
+
     /**
      * 查询SAI开项管理列表
      */

+ 20 - 0
master/src/main/java/com/ruoyi/project/production/domain/TSaiApply.java

@@ -49,6 +49,10 @@ public class TSaiApply extends BaseEntity
     @Excel(name = "登记人班组")
     private String applicantTeam;
 
+    private String teamCount;
+
+    private String applicantCount;
+
     /** 登记人 */
     @Excel(name = "登记人")
     private String applicant;
@@ -150,6 +154,22 @@ public class TSaiApply extends BaseEntity
     /** 备注(执行阶段) */
     private String remarksExecute;
 
+    public String getApplicantCount() {
+        return applicantCount;
+    }
+
+    public void setApplicantCount(String applicantCount) {
+        this.applicantCount = applicantCount;
+    }
+
+    public String getTeamCount() {
+        return teamCount;
+    }
+
+    public void setTeamCount(String teamCount) {
+        this.teamCount = teamCount;
+    }
+
     public String getApplyStatusString() {
         return applyStatusString;
     }

+ 4 - 0
master/src/main/java/com/ruoyi/project/production/mapper/TSaiApplyMapper.java

@@ -13,6 +13,10 @@ import com.ruoyi.project.production.domain.TSaiApply;
  */
 public interface TSaiApplyMapper 
 {
+    public List<TSaiApply> selectTeamAnalysis();
+
+    public List<TSaiApply> selectPersonalAnalysis();
+
     /**
      * 查询SAI开项管理
      * 

+ 15 - 0
master/src/main/resources/mybatis/production/TSaiApplyMapper.xml

@@ -44,8 +44,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="remarksAssess"    column="remarks_assess"    />
         <result property="remarksExecute"    column="remarks_execute"    />
         <result property="workArea"    column="work_area"    />
+        <result property="teamCount"    column="team_count"    />
+        <result property="applicantName"    column="applicant_name"    />
+        <result property="applicantCount"    column="applicant_count"    />
     </resultMap>
 
+    <select id="selectTeamAnalysis" resultMap="TSaiApplyResult">
+        select d.DICT_LABEL as applicant_team, b.act as team_count
+        from (select a.APPLICANT_TEAM at, count(a.APPLICANT_TEAM) act from T_SAI_APPLY a group by a.APPLICANT_TEAM order by a.APPLICANT_TEAM) b
+        left join SYS_DICT_DATA d on d.DICT_VALUE=b.at where d.DICT_TYPE='TEAM_DIVIDE' and d.DICT_LABEL &lt;&gt; 'W'
+    </select>
+
+    <select id="selectPersonalAnalysis" resultMap="TSaiApplyResult">
+        select NICK_NAME as applicant_name, b.act as applicant_count
+        from (select a.APPLICANT at, count(a.APPLICANT) act from T_SAI_APPLY a group by a.APPLICANT order by a.APPLICANT) b
+        left join SYS_USER d on d.USER_ID=b.at order by b.act desc
+    </select>
+
     <sql id="selectTSaiApplyVo">
         select d.sai_apply_id, d.del_flag, d.create_by, d.create_time, d.update_by, d.update_time, d.dept_id, d.apply_status, d.ap_no, d.process_id,
         d.applicant, d.assessor, d.executor, d.inspectors, d.applicant_dept, d.applicant_team, d.description,

+ 14 - 0
ui/src/api/production/apply.js

@@ -35,6 +35,20 @@ export function listApply(query) {
   })
 }
 
+export function getPersonalAnalysis() {
+  return request({
+    url: '/production/apply/personalAnalysis',
+    method: 'get'
+  })
+}
+
+export function getTeamAnalysis() {
+  return request({
+    url: '/production/apply/teamAnalysis',
+    method: 'get'
+  })
+}
+
 // 查询SAI开项管理详细
 export function getApply(saiApplyId) {
   return request({

+ 174 - 2
ui/src/views/production/apply/all/index.vue

@@ -157,6 +157,13 @@
           @click="handleAddSai"
           v-hasPermi="['production:sai:add']"
         >统计至SAI检查台账</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          size="mini"
+          @click="handleAnalysis"
+          v-hasPermi="['production:sai:list']"
+        >趋势分析</el-button>
       </el-col>
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
@@ -734,11 +741,62 @@
         </el-carousel>
       </div>
     </el-dialog>
+    <!-- 趋势分析对话框 -->
+    <el-dialog  :close-on-click-modal="false" @close="disposeChart" title="趋势分析" :visible.sync="analysisOpen" width="80%" append-to-body>
+      <el-row>
+        <el-col :span="12">
+          <h3 style="text-align: center; margin-bottom: 15px;">四个班组当年提交的SAI数量</h3>
+          <div id="chart1" style="width:100%; height: 400px; display: inline-block;"></div>
+        </el-col>
+        <el-col :span="12">
+          <h3 style="text-align: center; margin-bottom: 15px;">个人提交数量数据分析图</h3>
+          <div id="chart2" style="width:100%; height: 400px; display: inline-block;"></div>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="12" style="padding-left: 20px; padding-right: 20px;">
+          <h3 style="text-align: center; margin-bottom: 15px;">各班组当年至今的提交数量</h3>
+          <el-table
+            :data="tableList1"
+            style="width: 100%"
+            border>
+            <el-table-column
+              prop="name"
+              label="班组">
+            </el-table-column>
+            <el-table-column
+              prop="value"
+              label="提交数量">
+            </el-table-column>
+          </el-table>
+        </el-col>
+        <el-col :span="12" style="padding-left: 20px; padding-right: 20px;">
+          <h3 style="text-align: center; margin-bottom: 15px;">个人提交排名前六的人名和提交数</h3>
+          <el-table
+            :data="tableList2"
+            style="width: 100%"
+            border>
+            <el-table-column
+              prop="index"
+              label="排名">
+            </el-table-column>
+            <el-table-column
+              prop="name"
+              label="人名">
+            </el-table-column>
+            <el-table-column
+              prop="value"
+              label="提交数">
+            </el-table-column>
+          </el-table>
+        </el-col>
+      </el-row>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { saveAndSubmitApply, submitApply, listApply, getApply, delApply, addApply, updateApply, exportApply, importTemplate} from "@/api/production/apply";
+import { saveAndSubmitApply, submitApply, listApply, getApply, delApply, addApply, updateApply, exportApply, importTemplate, getTeamAnalysis, getPersonalAnalysis } from "@/api/production/apply";
 import { addSai } from "@/api/production/sai";
 import { treeselect, listDept } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
@@ -801,6 +859,15 @@ export default {
       }
     };
     return {
+      // 趋势图y轴数值
+      valueList1: [],
+      valueList2: [],
+      // 趋势图x轴日期
+      dateList1: [],
+      dateList2: [],
+      // 趋势图
+      chart1: null,
+      chart2: null,
       submitDisabled: false,
       applyDateRange: [],
       estimateFinishDateRange: [],
@@ -810,8 +877,10 @@ export default {
       fileList: [],
       // 统计至SAI检查台账的数据
       saiList: [],
-      // 是显示用统计至SAI检查台账对话框
+      // 是显示用统计至SAI检查台账对话框
       saiOpen: false,
+      // 是否显示趋势分析对话框
+      analysisOpen: false,
       // 是否禁用开项编号输入框
       recordNoDisabled: true,
       // 当前登录员工
@@ -1015,6 +1084,8 @@ export default {
       applicantTeamDisabled: false,
       workAreaList: [],
       applyStatusString: [],
+      tableList1: [],
+      tableList2: [],
     };
   },
   watch: {
@@ -1056,6 +1127,106 @@ export default {
     this.getWorkAreaList();
   },
   methods: {
+    /** 绘制趋势图 */
+    draw() {
+
+    },
+    /** 销毁趋势图 */
+    disposeChart() {
+      this.echarts.dispose(this.chart1);
+      this.echarts.dispose(this.chart2);
+    },
+    handleAnalysis() {
+      this.analysisOpen = true;
+      let teamPieList = [];
+      let personalPieList = [];
+      this.tableList1 = [];
+      this.tableList2 = [];
+      getTeamAnalysis().then(response => {
+        let data = response.data;
+        for (let i = 0; i < data.length; i++) {
+          let applicantTeam = data[i].applicantTeam;
+          let teamCount = data[i].teamCount;
+          teamPieList.push({ value: teamCount, name: applicantTeam + '班'});
+          this.tableList1.push({ value: teamCount, name: applicantTeam + '班'});
+        }
+        this.chart1 = this.echarts.init(document.getElementById("chart1"));
+        let option1 = {
+          // title: {
+          //   text: '四个班组当年提交的SAI数量',
+          //   left: 'center',
+          //   top: '10%'
+          // },
+          tooltip: {
+            trigger: 'item'
+          },
+          legend: {
+            show: false
+          },
+          series: [
+            {
+              type: 'pie',
+              radius: '50%',
+              data: teamPieList,
+              emphasis: {
+                itemStyle: {
+                  shadowBlur: 10,
+                  shadowOffsetX: 0,
+                  shadowColor: 'rgba(0, 0, 0, 0.5)'
+                }
+              },
+              label: {
+                show: false
+              }
+            }
+          ]
+        };
+        this.chart1.setOption(option1);
+      });
+      getPersonalAnalysis().then(response => {
+        let data = response.data;
+        for (let i = 0; i < data.length; i++) {
+          let applicantName = data[i].applicantName;
+          let applicantCount = data[i].applicantCount;
+          personalPieList.push({ value: applicantCount, name: applicantName });
+          if (i < 6) {
+            this.tableList2.push({ index: i + 1, value: applicantCount, name: applicantName });
+          }
+        }
+        this.chart2 = this.echarts.init(document.getElementById("chart2"));
+        let option2 = {
+          // title: {
+          //   text: '个人提交数量数据分析图',
+          //   left: 'center',
+          //   top: '10%'
+          // },
+          tooltip: {
+            trigger: 'item'
+          },
+          legend: {
+            show: false
+          },
+          series: [
+            {
+              type: 'pie',
+              radius: '50%',
+              data: personalPieList,
+              emphasis: {
+                itemStyle: {
+                  shadowBlur: 10,
+                  shadowOffsetX: 0,
+                  shadowColor: 'rgba(0, 0, 0, 0.5)'
+                }
+              },
+              label: {
+                show: false
+              }
+            }
+          ]
+        };
+        this.chart2.setOption(option2);
+      });
+    },
     getWorkAreaList() {
       selectDevice().then(response => {
         let data = response.data;
@@ -1487,6 +1658,7 @@ export default {
       this.saiOpen = false;
       this.open = false;
       this.open2 = false;
+      this.analysisOpen = false;
       this.reset();
     },
     // 表单重置