zck 1 год назад
Родитель
Сommit
71f15d92f3

+ 21 - 0
src/api/mes/job.js

@@ -379,4 +379,25 @@ export const GXReghtList = (params) => {
     method: 'get',
     params
   })
+}
+
+/*
+	生产中心各类统计报表
+*/
+//生产中心各类统计报表->左侧菜单
+export const GetYear = (params) => {
+  return service({
+    url: '/mes_server/decision/GetYear',
+    method: 'get',
+    params
+  })
+}
+
+//生产中心各类统计报表->工序产出率月统计报表
+export const ProcessOutputRate = (params) => {
+  return service({
+    url: '/mes_server/decision/ProcessOutputRate',
+    method: 'get',
+    params
+  })
 }

+ 552 - 0
src/view/DecisionSupport/productioncents/index.vue

@@ -0,0 +1,552 @@
+<template>
+    <div>
+      <layout>
+        <layout-header>
+          <div class="">
+            <!--          按钮部分-->
+              <el-form-item>
+                <el-button type="primary" icon="Download" @click="ExportSummaryToExcel" style="margin: 5px">导出到Excel(汇总)</el-button>
+			          <!-- <el-button type="primary" icon="Download" @click="ExportDetailsToExcel" class="bt"  >导出到Excel(明细)</el-button> -->
+                <!-- <el-button disabled type="primary" icon="Download" @click="exportToExcel2" style="margin: 5px;float: right;">导出到Excel(色张汇总)</el-button> -->
+			          <!-- <el-button type="primary" icon="edit"   @click="gd_gxclhconClick"  class="bt" >月度色度数核查</el-button> -->
+              </el-form-item>
+          </div>
+        </layout-header>
+  
+  
+        <layout>
+          <!--    左侧树侧形结构-->
+          <layout-sider :resize-directions="['right']" :width="190" style="margin-right: 10px;">
+          <div class="JKWTree-tree" style="height: 200px">
+            <h3>年份</h3>
+            <el-tree :data="treeData" class="treecolor"   @node-click="handleNodeClick"></el-tree>
+          </div>
+        </layout-sider>
+  
+          <!-- 右侧区域 -->
+          <layout-content >
+            
+          <el-main>
+        <el-tabs v-model="activeName" @tab-click="handleClick">
+            <div ref="chart" style="width: 100%; height: 35vh;margin-left: -100px;"></div>
+        </el-tabs>
+            <div class="gva-table-box">
+              <!-- 表格数据 -->
+              <el-table ref="multipleTable" style="width: 100%;height: 38vh"  tooltip-effect="dark"
+                        :row-style="{ height: '20px' }"  :header-cell-style="{ padding: '0px' }"
+                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
+                        :data="tableData"  border row-key="ID"
+                        size="small" id="Summarytable"
+                        highlight-current-row="true" @row-dblclick="updateCompanyFunc"
+                        @row-click="tableRowClick" :show-overflow-tooltip="true"
+                        @selection-change="handleSelectionChange">
+                <el-table-column   align="center" label="工序类型" prop="工序类型"  width="120" />
+                <el-table-column   align="left" label="平均合格率" prop="平均值"  width="120"/>
+                <el-table-column    align="center" label="01月" prop="01月" width="100"/>
+                <el-table-column    align="left" label="02月" prop="02月" width="100" />
+                <el-table-column    align="left" label="03月" prop="03月" width="100" />
+                <el-table-column    align="left" label="04月" prop="04月" width="100"  />
+                <el-table-column    align="left" label="05月" prop="05月" width="100" />
+                <el-table-column    align="left" label="06月" prop="06月" width="100" />
+                <el-table-column    align="left" label="07月" prop="07月" width="100" />
+                <el-table-column    align="left" label="08月" prop="08月" width="100" />
+                <el-table-column    align="left" label="09月" prop="09月" width="100" />
+                <el-table-column    align="left" label="10月" prop="10月" width="100" />
+                <el-table-column    align="left" label="11月" prop="11月" width="100" />
+                <el-table-column    align="left" label="12月" prop="12月" width="100" />
+              </el-table>
+  
+              <!-- 分页 -->
+              <div class="gva-pagination">
+                <el-pagination layout="total" :current-page="page" :page-size="pageSize"
+                 :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
+  <!--              <el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize" :page-sizes="[10, 30, 50, 100]"-->
+  <!--                             :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />-->
+              </div>
+            </div>
+  
+            <!-- 弹窗 -->
+  
+  
+          </el-main>
+        </layout-content>
+        </layout>
+      </layout>
+      	<!-- 工单打印 -->
+	<PrintPage ref="printPageRef" />
+    </div>
+  </template>
+  <script>
+  export default {
+    data() {
+      return {
+        activeName: 'first',
+      };
+    },
+    methods: {
+      
+    }
+  };
+  
+  </script>
+  <script setup>
+  // 全量引入格式化工具 请按需保留
+  import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
+  import * as echarts from 'echarts';
+  import * as XLSX from 'xlsx';
+  import FileSaver from 'file-saver';
+  import {ref, reactive,watchEffect} from 'vue';
+  import {GetYear,ProcessOutputRate} from '@/api/mes/job'
+  import {getCustom, getDepartment, getProductData,getStaffInfo, getStaffList, ygjbzledit,clockUpdate} from '@/api/yunyin/yunying';
+  import {ElMessage} from "element-plus";
+  defineOptions({name: 'Company'})
+
+
+//=========工单打印===========
+const printPageRef = ref()
+const cp_gdprintonClick = () => {
+  printPageRef.value.open(_Gd_gdbh.value)
+}
+
+
+  // =========== 导出Excel表格 ===========
+  const exportToExcel = () => {
+    console.log('点击了导出按钮')
+  }
+  const ExportSummaryToExcel = ()=>{
+  const el = document.getElementById('Summarytable');
+  // 文件名
+  const filename = '导出到EXCEL(汇总).xlsx';
+  const wb = XLSX.utils.table_to_book(el, { raw: true });
+  const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
+  try {
+    FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
+  } catch (e) {
+    console.log(e);
+  }
+  return wbout;
+}
+
+const ExportDetailsToExcel = ()=>{
+  const el = document.getElementById('Detailstable');
+  // 文件名
+  const filename = '导出到EXCEL(明细).xlsx';
+  const wb = XLSX.utils.table_to_book(el, { raw: true });
+  const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
+  try {
+    FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
+  } catch (e) {
+    console.log(e);
+  }
+  return wbout;
+}
+  
+  
+  //=========工序产量核查===========
+
+
+  // 工序产量核查按钮
+const gd_gxclhconClick = async () => {
+  // if(_Gd_gdbh.value === '' || _Gd_gdbh.value === null){
+  //   ElMessage({type: 'warning',message: '请选择具体的工单,在进行操作'})
+  //   return false;
+  // }
+  // gxclhcformData['gdbh'] = _Gd_gdbh.value;
+  // gxclhcformData['yjno'] = 1;
+  // gd_gxclhclist.value = true;
+  // const response = await PrintDetailList ({workOrder:_Gd_gdbh.value});
+  // console.log(response)
+  // gdwhformData.yjno = response.data[0].no
+  // inputCpmc.value = response.data[0].name
+  // if (response.code === 0) {
+	//   const noFields = response.data.map(item => item.no);
+	//   gdwhformData.yinjian = noFields
+	// } else {
+	//   console.error('查询失败:', response.msg);
+	// }
+  // _getOrderProcessCount();
+};
+  // =========== 获取左侧树侧形结构 ===========
+  
+  const AttendanceVisible=ref(false)
+  const _department_code = ref(null)
+// 树形控件的数据
+const treeData = ref([]);
+const getDepartmentdata = async () => {
+  try {
+    const data = await GetYear();
+    console.log(data);
+
+    // 将 data.data 转换为 el-tree 所需的结构,并从大到小排序
+    treeData.value = data.data
+      .map(year => ({
+        label: year.toString(), // 将年份转换为字符串
+        children: [] // 可以留空,或者根据需求添加子节点
+      }))
+      .sort((a, b) => b.label - a.label); // 从大到小排序
+
+    console.log(treeData.value); // 打印转换后的数据
+  } catch (error) {
+    console.error(error);
+  }
+};
+getDepartmentdata();
+  
+  //点击左侧树形 获取右侧table列表
+  const tableData = reactive([]);
+// 点击树节点时的处理函数
+const handleNodeClick = async (data) => {
+  // 获取数据
+  const ProcessOutputRatedata = await ProcessOutputRate({ year: data.label });
+  tableData.splice(0, tableData.length, ...ProcessOutputRatedata.data);
+  console.log(ProcessOutputRatedata);
+
+  // 初始化柱状图
+  if (!mCharts && chart.value) {
+    mCharts = echarts.init(chart.value);
+    console.log('ECharts 实例初始化成功');
+  }
+
+  // 设置默认的柱状图配置
+  const defaultOption = {
+    xAxis: {
+      type: 'category',
+      data: [],
+    },
+    yAxis: {
+      type: 'value',
+    },
+    series: [
+      {
+        name: '合格率',
+        type: 'bar',
+        data: [], // 初始数据为空
+        barWidth: '40%',
+        barCategoryGap: '10%',
+      },
+    ],
+  };
+
+  // 设置默认配置项
+  if (mCharts) {
+    mCharts.setOption(defaultOption);
+  }
+};
+
+
+// 图表容器引用
+const chart = ref(null);
+
+// ECharts 实例
+let mCharts = null;
+const tableRowClick = async (row) => {
+  // 如果点击的行数据存在
+  console.log(row)
+  if (row) {
+    // 初始化 ECharts 实例(如果未初始化)
+    if (!mCharts && chart.value) {
+      mCharts = echarts.init(chart.value);
+    }
+
+    const monthlyData = [
+  row['01月'], row['02月'], row['03月'], row['04月'],
+  row['05月'], row['06月'], row['07月'], row['08月'],
+  row['09月'], row['10月'], row['11月'], row['12月']
+].map(value => {
+  // 去掉百分号并转换为数字,如果是空字符串则返回 0
+  return value ? parseFloat(value.replace('%', '')) : 0;
+});
+
+    // 动态生成配置项
+    const option = {
+      xAxis: {
+        type: 'category',
+        data: ['01月', '02月', '03月', '04月', '05月', '06月', '07月', '08月', '09月', '10月', '11月', '12月'], // x 轴显示月份
+      },
+      yAxis: {
+        type: 'value',
+      },
+      series: [
+        {
+          name: '合格率',
+          type: 'bar',
+          data: monthlyData, // 使用提取的每月数据
+          barWidth: '40%', // 柱子宽度为柱状图区域的 40%
+          barCategoryGap: '10%', // 柱子之间的间距为柱状图区域的 10%
+        },
+      ],
+    };
+
+    // 设置配置项并渲染图表
+    if (mCharts) {
+      mCharts.setOption(option);
+    }
+  }
+};
+  
+  // 搜索
+  const searchInfo = ref('')
+  //点击【查询】按钮
+  const onSubmit = () => {
+    _department_code.value = '';
+    if(searchInfo.value === ''){
+      tableData.length = 0;
+    }else{
+      _getStaffList();
+    }
+  };
+  
+  //获取右侧表格列表
+  const _getStaffList = async ()=>{
+    // let params = {}
+    // params.search = searchInfo.value;
+    // params.department_code = _department_code.value;
+    // params.mes_online = _u8.value;
+    // params.u8_online = _mes.value ;
+    // params.limit = 200;
+    // params.page = 1;
+    // // console.log(params)
+    //   try {
+    //   const WorkListdata = await getStaffList(params);
+    //   // console.log(WorkListdata)
+    //   tableData.splice(0,tableData.length,...WorkListdata.data.list);
+    //   total.value = WorkListdata.data.total;
+    // } catch (error) {
+    //   console.error(error);
+    // }
+  }
+  
+  // 分页相关的响应式变量
+  const page = ref(1)
+  const total = ref(0)
+  const pageSize = ref(10)
+  // 分页
+  const handleCurrentChange = (val) => {
+    page.value = val;
+    _getStaffList();
+  };
+  
+  // 修改页面容量 点击多少条/页
+  const handleSizeChange = (val) => {
+    page.value = 50;//默认显示
+    pageSize.value = val;
+    _getStaffList();
+  };
+  
+  // 弹窗控制标记
+  const dialogFormVisible = ref(false)
+  //修改
+  const formDataTest = ref({})
+  
+  const updateCompanyFunc = async (row) => {
+    let code = row['员工编号'];
+    const getStaffInfo_data = await getStaffInfo({code:code});
+    formDataTest.value = getStaffInfo_data.data;
+    dialogFormVisible.value = true;
+  };
+  const Attendancevalue = ref({})
+  //考勤建立弹窗确定
+   const AttendanceDialog = async () => {
+    _clockUpdate()
+   }
+   //设置法定天数
+   const _clockUpdate = async ()=>{
+     const formattedData = {
+      month:Attendancevalue.value['month'],
+      number:Attendancevalue.value['day'],
+      typeA:Attendancevalue.value['typeA'],
+      typeB:Attendancevalue.value['typeB'],
+      typeC:Attendancevalue.value['typeC'],
+      sys_id:'[1010/郑梅芳]'
+     };
+     console.log(formattedData)
+     const response = await clockUpdate(formattedData);
+     if (response.code === 0) {
+            ElMessage({
+              type: 'success',
+              message: '成功'
+            })
+           AttendanceVisible.value=false
+      }else{
+            ElMessage({
+              type: 'error',
+              message: '失败'
+            })
+      }
+   }
+   //获取小时数
+   const getdays = () => {
+       console.log(Attendancevalue.value['day'])
+       if(Attendancevalue.value['day']!=''){
+          Attendancevalue.value['typeA']=Attendancevalue.value['day']*7.5
+          Attendancevalue.value['typeB']=Attendancevalue.value['day']*8
+          Attendancevalue.value['typeC']=Attendancevalue.value['day']*8
+      }else{
+          ElMessage({
+            type: 'error',
+            message: '请输入法定天数'
+          })
+      }
+   }
+  // 修改关闭弹窗
+  const closeDialog = () => {dialogFormVisible.value = false,AttendanceVisible.value=false}
+  
+  // 弹窗确定
+  const enterDialog = async () => {
+      console.log(formDataTest.value['出生日期'])
+      if(formDataTest.value['出生日期'] === '' || formDataTest.value['出生日期'] === null){
+          ElMessage({
+            type: 'error',
+            message: '出生日期不能为空'
+          })
+          return false;
+      }
+      if(formDataTest.value['身份证号'] === '' || formDataTest.value['身份证号'] === null){
+          ElMessage({
+            type: 'error',
+            message: '身份证号不能为空'
+          })
+          return false;
+      }
+    _ygjbzledit();
+  }
+  //修改员工资料
+  const _ygjbzledit = async ()=>{
+    const formattedData = {
+      '员工编号': formDataTest.value['员工编号'],
+      '员工姓名': formDataTest.value['员工姓名'],
+      '性别': formDataTest.value['性别'],
+      '出生日期': formDataTest.value['出生日期'],
+      '身份证号': formDataTest.value['身份证号'],
+      '职称职务': formDataTest.value['职称职务'],
+      '所在部门': formDataTest.value['所在部门'],
+      '聘用日期': formDataTest.value['聘用日期'],
+      '转正日期': formDataTest.value['转正日期'],
+      '扣减司龄': formDataTest.value['扣减司龄'] ? formDataTest.value['扣减司龄'] : '0',
+      '人员类别': formDataTest.value['人员类别'],
+      '人员性质': formDataTest.value['人员性质'],
+      '班次类型': formDataTest.value['班次类型'],
+      '薪酬核算分组': formDataTest.value['薪酬核算分组'],
+      '工资表类别': formDataTest.value['工资表类别'],
+      'U8在职': formDataTest.value['U8在职'],
+      '在职状态': formDataTest.value['在职状态'],
+      '部门编码': formDataTest.value['部门编码'],
+    };
+    try {
+      const ygjbzledit_eddt = await ygjbzledit(formattedData);
+      if (ygjbzledit_eddt .code === 0) {
+        dialogFormVisible.value = false;
+        ElMessage({type: 'success',message: '更新成功'})
+      } else {
+        console.log(ygjbzledit_eddt);
+        ElMessage({ type: 'error',message: '更新失败'})
+      }
+    } catch (error) {
+      console.error(error);
+    }
+  }
+  
+  </script>
+  
+  <style scoped>
+  .form-container {
+    display: flex;
+    flex-wrap: wrap;
+  }
+  
+  .form-column {
+    /*flex: 1;*/
+    margin-right: 15px; /* 调整列之间的间距 */
+  }
+  
+  /* 左侧输入框宽度调整 */
+  .form-column .el-form-item .el-input {
+    width: 150px; /* 调整左侧输入框的宽度 */
+  }
+  
+  /* 媒体查询,根据需要调整断点 */
+  @media screen and (max-width: 768px) {
+    .form-column {
+      flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
+      margin-right: 0;
+    }
+  }
+  /*:deep(.el-table td .cell) {*/
+  /*  line-height: 30px !important;*/
+  /*}*/
+  .JKWTree-container {
+    display: flex;
+  }
+  .JKWTree-tree {
+    /*width: 300px;*/
+    background-color: #fff;
+    padding: 10px;
+    margin-right: 20px;
+  }
+  .JKWTree-tree h3 {
+    font-size: 15px;
+    font-weight: 700;
+    margin: 10px 0;
+  }
+  .JKWTree-content {
+    flex: 1;
+  }
+  /* 图片上传 */
+  .upload-box {
+    width: 200px;
+    height: 200px;
+    border: 2px dashed #e2e2e2;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    position: relative;
+    cursor: pointer;
+  }
+  .uploaded-image {
+    width: 100%;
+    height: 100%;
+    object-fit: cover;
+  }
+  .upload-icon {
+    font-size: 40px;
+    color: #c0c4cc;
+  }
+  .file-input {
+    display: none;
+  }
+  .el-table .warning-row {
+    background: oldlace;
+  }
+  
+  /* 选中某行时的背景色 */
+  :deep(.el-table__body tr.current-row) > td {
+    background: #ff80ff !important;
+  }
+  </style>
+  <style scoped>
+  :deep(.el-table td .cell) {
+    line-height: 20px !important;
+  }
+  :deep(.el-tabs__header){
+    margin-bottom: 0;
+  }
+  .search{
+    margin-left: 0px !important;
+    margin-right: 10px !important;
+  }
+  .bt{
+    margin-left: 2px !important;
+    padding: 3px !important;
+    font-size: 12px;
+  }
+  .el-tabs__header{
+    margin: 0px !important;
+  }
+  .gva-table-box{
+    padding: 0px !important;
+  }
+  .mab{
+    margin-bottom: 5px;
+  }
+  </style>
+  

+ 11 - 4
src/view/performance/12-orderAccounting/index.vue

@@ -16,7 +16,7 @@
               <el-button type="primary" icon="edit" class="bt" @click="dialogKhszclick">考核设置</el-button>
               <el-button type="primary" icon="edit" class="bt"@click=" () => { dialogXzgdtl = true; }">修正工单投料</el-button>
               <el-button type="primary" icon="edit" class="bt"@click=" () => { dialogGxclhc = true;}">工序产量核查</el-button>
-              <el-button type="primary"icon="edit"class="bt"@click="() => {dialogGdzjfptj = true;}">工单质检废品统计</el-button>
+              <el-button type="primary" icon="edit"class="bt"@click="() => {dialogGdzjfptj = true;}">工单质检废品统计</el-button>
               <el-button type="primary" icon="edit" class="bt"@click="() => {dialogHjfpfb = true;}">核检废品分布</el-button>
               <el-button type="primary" icon="edit" class="bt"@click="handleGddy">工单打印</el-button>
               <el-button type="primary" icon="edit" class="bt" @click="pd_lcdlistonClick">流程单查询</el-button>
@@ -709,15 +709,17 @@ const onchange_ygdy = async () => {
   selectedDate.setMonth(selectedDate.getMonth() + 1);
   // 格式化为 YYYY-MM
   const formattedDate = selectedDate.toISOString().slice(0, 7);
-  
+
   const EmployeeDataCollectdata = await EmployeeDataCollect({ date: formattedDate });
   console.log(EmployeeDataCollectdata);
+
   if (EmployeeDataCollectdata.data.length === 0) {
     ElMessage({
       type: 'warning',
       message: '该月暂无数据',
     });
   }
+
   // 清空 cjsjetableData
   cjsjetableData.splice(0, cjsjetableData.length);
 
@@ -725,7 +727,12 @@ const onchange_ygdy = async () => {
   if (EmployeeDataCollectdata.data) {
     for (const key in EmployeeDataCollectdata.data) {
       if (Array.isArray(EmployeeDataCollectdata.data[key])) {
-        cjsjetableData.push(...EmployeeDataCollectdata.data[key]);
+        // 对每个数组中的 je 字段进行处理
+        const processedData = EmployeeDataCollectdata.data[key].map(item => ({
+          ...item,
+          je: parseFloat(parseFloat(item.je).toFixed(2)) // 四舍五入并保留两位小数
+        }));
+        cjsjetableData.push(...processedData);
       }
     }
   }
@@ -798,7 +805,7 @@ const onclick_ygdy = async () => {
                     'szbm': value.cj,
                     'ygbh': value.bh,
                     'ygxm': value.xm,
-                    'cjsje': value.je
+                    'cjsje': parseFloat(value.je).toFixed(2) // 保留两位小数
                 });
             });
         } else {