Lexie 1 year ago
parent
commit
ba22ff647d

+ 8 - 0
src/api/jixiaoguanli/jitairibaobiao.js

@@ -65,6 +65,14 @@ export const getproductionCount = (data) => {
     data
   })
 }
+//导出
+export const Export = (data) => {
+  return service({
+    url:'/mes_server/machine_production_report/export',
+    method: 'get',
+    data
+  })
+}
 //机台生产日报表维护附加
 //新增
 export const reportadd = (data) => {

+ 33 - 32
src/pinia/modules/user.js

@@ -41,7 +41,37 @@ export const useUserStore = defineStore('user', () => {
       ...value
     }
   }
-  
+ let MAC=ref()
+ const GetAddr = () => {
+ var xmlhttp = null;
+ var res;
+ if (window.XMLHttpRequest) {
+   xmlhttp = new XMLHttpRequest();
+ } else if (window.ActiveXObject) {
+   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ // 设置回调函数
+ xmlhttp.onreadystatechange = function () {
+   if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+ 	res = eval("(" + xmlhttp.response + ")");
+ 	let result = "";
+ 	for (let i = 0; i < res.macAddress.length; i++) {
+ 	  if (i % 2 === 0 && i !== 0) {
+ 		result += "-"; // 根据实际需求修改分隔符
+ 	  }
+ 	  result += res.macAddress[i];
+ 	}
+ 	MAC=result
+ 	// console.log(result);
+   // 68-ED-A4-26-5F-37
+   }
+ };
+ // 打开一个连接
+ xmlhttp.open("get", "http://127.0.0.1:8090/init");
+ // 发送请求
+ xmlhttp.send();
+ };
+ GetAddr()  
   
   /* 获取用户信息*/
   const GetUserInfo = async() => {
@@ -112,6 +142,7 @@ export const useUserStore = defineStore('user', () => {
         })
 		// A4-B1-C1-D4-74-02
         // const response = await getMachineMac({ addr:'68-ED-A4-26-5F-37'});
+		console.log(MAC)
 		const response = await getMachineMac({ addr:MAC});
         console.log(response)
         if(response.data===null){
@@ -141,37 +172,7 @@ export const useUserStore = defineStore('user', () => {
     loadingInstance.value.close()
   }
   
-let MAC=ref()
-const GetAddr = () => {
-var xmlhttp = null;
-var res;
-if (window.XMLHttpRequest) {
-  xmlhttp = new XMLHttpRequest();
-} else if (window.ActiveXObject) {
-  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
-}
-// 设置回调函数
-xmlhttp.onreadystatechange = function () {
-  if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
-	res = eval("(" + xmlhttp.response + ")");
-	let result = "";
-	for (let i = 0; i < res.macAddress.length; i++) {
-	  if (i % 2 === 0 && i !== 0) {
-		result += "-"; // 根据实际需求修改分隔符
-	  }
-	  result += res.macAddress[i];
-	}
-	MAC=result
-	// console.log(result);
-  // 68-ED-A4-26-5F-37
-  }
-};
-// 打开一个连接
-xmlhttp.open("get", "http://127.0.0.1:8090/init");
-// 发送请求
-xmlhttp.send();
-};
-GetAddr()  
+ 
 
   
 const GetMachineMac = async (addr) => {

+ 32 - 29
src/view/performance/12-orderAccounting/index.vue

@@ -95,13 +95,13 @@
               >流程单查询
               </el-button>
 
-             <!-- <el-button
+             <el-button
                 type="primary"
                 icon="edit"
                 class="bt"
                 @click="testExcel"
               >导出测试
-              </el-button> -->
+              </el-button>
 
             </el-form-item>
           </el-form>
@@ -336,6 +336,7 @@
 
 <script>
 import service from '@/utils/request'
+import { writeXLSX } from 'xlsx'
 // 5.1流程单查询-工单工序生产进程菜单栏
 export const getOrderProcessLeft = (params) => {
   return service({
@@ -566,33 +567,35 @@ const pd_lcd_handleNodeClick = async(node) => {
   processList.value = getOrderProcessRight_list.data
 }
 //导出
-// const testExcel = () => {
-//   const data = [
-//   {
-//       '第一列': '111',
-//       '第二列': '222',
-//       '第三列': '333',
-//       '第四列': '444',
-//     },
-//     {
-//       '第一列': '111',
-//       '第二列': '222',
-//       '第三列': '333',
-//     },
-//     {
-//       '第一列': '111',
-//       '第二列': '222',
-//       '第三列': '333',
-//     },
-//     {
-//       '第一列': '111',
-//       '第二列': '222',
-//       '第三列': '333',
-//     },
-
-//   ]
-//   exportExcelFile(data);
-// }
+const testExcel = () => {
+  const data = [
+  {
+      '第一列': '111',
+      '第二列': '222',
+      '第三列': '333',
+      '第四列': '444',
+    },
+    {
+      '第一列': '111',
+      '第二列': '222',
+      '第三列': '333',
+    },
+    {
+      '第一列': '111',
+      '第二列': '222',
+      '第三列': '333',
+    },
+    {
+      '第一列': '111',
+      '第二列': '222',
+      '第三列': '333',
+    },
+
+  ]
+  
+  exportExcelFile(data);
+}
+
 </script>
 
 <style scoped>

+ 232 - 10
src/view/performance/14-overTimePayVerification/index.vue

@@ -53,18 +53,29 @@
                 @click="onSearch"
               >搜索
               </el-button>
+			  <el-button
+			    type="primary"
+			    @click="onAttendance"
+			  >考勤建立
+			  </el-button>
               <!-- <el-button
                 type="primary"
                 :icon="Refresh"
               >重置
               </el-button> -->
               <div style="margin-left: auto;">
-                <!-- <el-button
+                <el-button
                   type="primary"
                   :icon="Download"
                   @click="exportExcel"
-                >导出到Excel
-                </el-button> -->
+                >导出到Excel(汇总)
+                </el-button>
+				<el-button
+				  type="primary"
+				  :icon="Download"
+				  @click="exportExcel2"
+				>导出到Excel(明细)
+				</el-button>
               </div>
             </div>
             <!-- 上半数据展示 -->
@@ -97,10 +108,9 @@
                 :width="column.width"
                 show-overflow-tooltip="true"
 				sortable
-              />
-
-              // 下半数据展示
+              />            
             </el-table>
+			 
             <br>
             <el-table
               ref="tab2"
@@ -138,8 +148,138 @@
     </el-container>
 
   </div>
+  
+  <el-dialog v-model="AttendanceVisible" title="考勤建立" destroy-on-close width="800px" >
+    <el-row :gutter="24">
+      <el-col :span="7">
+        <el-form-item label="年月份" prop="id" style="margin-top=0px; margin-bottom: 1px;">
+        	<el-input v-model="Attendancevalue['month']"  style="margin-top=0px; margin-bottom: 1px;" id="年月份" @keydown="handleKeyDown($event, '法定天数', 'C类', '法定天数')" placeholder="" />
+        </el-form-item>
+      </el-col>
+  		
+    	<el-col :span="7" style="margin-top=0px; margin-bottom: 1px;">
+    	<el-form-item label="法定天数" prop="id" style="margin-top=0px; margin-bottom: 1px;">
+    		<el-input v-model="Attendancevalue['day']"  style="margin-top=0px; margin-bottom: 1px;" @blur="getdays()" id="法定天数" @keydown="handleKeyDown($event, '法定天数', '年月份', 'A类')" placeholder="" />
+    	</el-form-item>
+    	</el-col>
+    </el-row>
+  			
+  			
+  			
+  			
+  			<el-row :gutter="24">
+  			  
+  					
+  				<el-col :span="7" style="margin-top=0px; margin-bottom: 1px;">
+  				<el-form-item label="A类(双休版)" prop="id" style="margin-top=0px; margin-bottom: 1px;">
+  					<el-input v-model="Attendancevalue['typeA']" id="A类" @keydown="handleKeyDown($event, 'A类', '法定天数', 'B类')" style="margin-top=0px; margin-bottom: 1px;"  placeholder="" />
+  				</el-form-item>
+  				</el-col>
+  			</el-row>
+  			
+  			
+  			<el-row :gutter="24">
+  			  
+  					
+  				<el-col :span="7" style="margin-top=0px; margin-bottom: 1px;">
+  				<el-form-item label="B类(7.5小时班)" prop="id" style="margin-top=0px; margin-bottom: 1px;">
+  					<el-input v-model="Attendancevalue['typeB']" id="B类" @keydown="handleKeyDown($event, 'B类', 'A类', 'C类')" style="margin-top=0px; margin-bottom: 1px;"  placeholder="" />
+  				</el-form-item>
+  				</el-col>
+  			</el-row>
+  			
+  			
+  			<el-row :gutter="24">
+  			  
+  					
+  				<el-col :span="7" style="margin-top=0px; margin-bottom: 1px;">
+  				<el-form-item label="C类(11小时班)" prop="id" style="margin-top=0px; margin-bottom: 1px;">
+  					<el-input v-model="Attendancevalue['typeC']" id="C类" @keydown="handleKeyDown($event, 'C类', 'B类', '年月份')" style="margin-top=0px; margin-bottom: 1px;"  placeholder="" />
+  				</el-form-item>
+  				</el-col>
+  			</el-row>
+  			
+  			
+  			<template #footer>
+  			  <div class="dialog-footer">
+  			    <el-button @click="closeAttendanceDialog">取 消</el-button>
+  			    <el-button type="primary" @click="AttendanceDialog">确 定</el-button>
+  			  </div>
+  			</template>
+  </el-dialog>
+  
+  
 </template>
-
+<script>
+export default {
+  data() {
+    return {
+      dialogFormVisible: false,
+      formDataTest: {
+        imageUrl: '' // 添加一个字段来保存上传的图片路径
+      },
+      rule: {} // 初始化rule对象
+    };
+  },
+  methods: {
+    handleKeyDown(event, currentId, prevId, nextId) {
+      const currentElement = document.getElementById(currentId);
+      const isEmpty = currentElement.value === '';
+      const atStart = currentElement.selectionStart === 0;
+      const atEnd = currentElement.selectionStart === currentElement.value.length;
+      switch (event.keyCode) {
+        case 13: // Enter
+        case 40: // 向下箭头
+          if (nextId) {
+            document.getElementById(nextId).focus();
+          }
+          break;
+        case 38: // 向上箭头
+          if (prevId) {
+            document.getElementById(prevId).focus();
+          }
+          break;
+        case 8: // 删除键
+          if (prevId && (isEmpty || atStart)) {
+            document.getElementById(prevId).focus();
+          }
+          break;
+        case 37: // 向左箭头
+          if (prevId && atStart) {
+            document.getElementById(prevId).focus();
+          }
+          break;
+        case 39: // 向右箭头
+          if (nextId && atEnd) {
+            document.getElementById(nextId).focus();
+          }
+          break;
+        default:
+          break;
+      }
+    },
+    closeDialog() {
+      // 关闭对话框的逻辑
+      this.dialogFormVisible = false;
+	  
+    },
+    enterDialog() {
+      // 确定按钮的逻辑
+      // 在这里可以执行提交表单的逻辑
+    },
+    handleFileUpload(event) {
+      // 处理文件上传逻辑
+      const file = event.target.files[0];
+      console.log(file)
+      // 模拟上传并保存文件路径
+      // 在实际应用中,您需要将文件上传到服务器并保存路径
+      this.formDataTest.imageUrl = URL.createObjectURL(file);
+      // 手动触发Vue的更新
+      this.$forceUpdate();
+    }
+  }
+};
+</script>
 <script setup>
 
 // 全量引入格式化工具 请按需保留
@@ -148,12 +288,15 @@ import { reactive, ref } from 'vue'
 import { getDownData, getSide, getUpData } from '@/api/mes_api_gty/overTimePayVerification'
 import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
 import { useUserStore } from '@/pinia/modules/user'
+import {clockUpdate} from '@/api/yunyin/yunying'
+import {ElMessage} from "element-plus";
+import * as XLSX from "xlsx";
 const userStore = useUserStore() 
 const sys_id='['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
 defineOptions({
   name: '06PackingDocuments',
 })
-
+const Attendancevalue = ref({})
 // 侧边栏数据请求
 const treeData = reactive([])
 const getSideData = async() => {
@@ -320,9 +463,88 @@ const onSearch = () => {
 
 // 导出excel
 function exportExcel() {
-  console.log('导出到excel')
+ exportExcelFile(tableData1,tableCols1)
 }
-
+function exportExcel2() {
+ exportExcelFile(tableData2,tableCols2)
+}
+const exportExcelFile = (tableData, tableCols) => {
+  const data = tableData.map(row => {
+    const rowData = {};
+    tableCols.forEach(column => {
+      rowData[column.label] = row[column.prop];
+    });
+    return rowData;
+  });
+
+  const worksheet = XLSX.utils.json_to_sheet(data);
+  const workbook = XLSX.utils.book_new();
+  XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
+  XLSX.writeFile(workbook, 'exported_table.xlsx');
+};
+//点击【考勤建立】按钮
+const AttendanceVisible=ref(false)
+const onAttendance = () => {
+	Attendancevalue.value['day']=22
+	const currentDate = new Date();
+	// 获取当前年份和月份
+	const year = currentDate.getFullYear();
+	const month = currentDate.getMonth() + 1;
+	// 如果月份小于 10,补零
+	const formattedMonth = month < 10 ? '0' + month : month;
+	console.log(year)
+	console.log(month)
+	
+	Attendancevalue.value['month']=year.toString() + formattedMonth.toString();
+	Attendancevalue.value['day']=22
+  AttendanceVisible.value=true
+};
+ //获取小时数
+ 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 AttendanceDialog = async () => {
+   _clockUpdate()
+  }
+  const closeAttendanceDialog = async () => {
+   AttendanceVisible.value=false
+  }
+  //设置法定天数
+  const _clockUpdate = async ()=>{
+    const formattedData = {
+     month:'202403',
+ 	number:Attendancevalue.value['day'],
+ 	typeA:Attendancevalue.value['typeA'],
+ 	typeB:Attendancevalue.value['typeB'],
+ 	typeC:Attendancevalue.value['typeC'],
+ 	sys_id:sys_id
+    };
+    console.log(formattedData)
+    const response = await clockUpdate(formattedData); 
+    if (response.code === 0) {
+     	  ElMessage({
+     	    type: 'success',
+     	    message: '成功'
+     	  })
+ 		 AttendanceVisible.value=false 
+     }else{
+    	   ElMessage({
+    	     type: 'error',
+    	     message: '失败'
+    	   })
+     }
+  }
 </script>
 
 <style scoped>

+ 16 - 2
src/view/performance/Dayreports.vue

@@ -468,7 +468,8 @@ import {
   getYg,
   productionadd,
   reportGetJtbh,
-  dedhGetRate
+  dedhGetRate,
+  Export,
 } from '@/api/jixiaoguanli/jitairibaobiao'
 
 // 全量引入格式化工具 请按需保留
@@ -478,6 +479,7 @@ import { Search, Refresh, Download } from '@element-plus/icons-vue'
 import { ref, reactive, nextTick, onMounted, onBeforeMount } from 'vue'
 import { getPackingSideTable, getPackingTable } from '@/api/mes_api_gty/myapi'
 import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
+import { exportExcelFile } from '@/utils/excel'
 import { useUserStore } from '@/pinia/modules/user'
 const userStore = useUserStore() 
 const sys_id='['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
@@ -1963,7 +1965,19 @@ const GetInfo = async (value) => {
 
 // 导出excel
 function exportExcel() {
-  console.log('导出到excel');
+    Execelport()
+	
+    // exportExcelFile(data);
+}
+const Execelport = async (value) => {
+  const response = await Export({file_name:'111',date:'2024-01-13',sys_id:'[1002/郑小丽]',
+  fields:['sczl_gdbh','Gd_cpmc','jyno_gxmc',
+  'sczl_rq','sczl_jtbh','sczl_bzdh','sczl_num','sczl_cl','sczl_ms',
+   'sczl_zcfp','sczl_zccp','sczl_来料异常','sczl_装版工时','sczl_保养工时','sczl_打样工时',
+    'sczl_异常停机工时','sczl_设备运行工时','sczl_bh1','sczl_bh1_name','sczl_bh2','sczl_bh2_name',
+	'sczl_bh3','sczl_bh3_name','sczl_bh4','sczl_bh4_name','sczl_bh5','sczl_bh5_name','sczl_bh6','sczl_bh6_name',
+	'拆片联拼系数','拆片条小盒系数','sczl_工价系数','日定额','千件工价','补产标准']});
+  console.log(response)
 }
 
 // 生命周期钩子

+ 6 - 3
src/view/performance/chejianbaogong.vue

@@ -324,7 +324,8 @@
           <el-dialog v-model="detailShow"
 		   fullscreen
 		   style="font-size: 50px;font-weight: bold;" lock-scroll :before-close="closeDetailShow" title="机台班组维护" destroy-on-close>
-            <el-table ref="multipleTable"
+            <div>
+			<el-table ref="multipleTable"
                         :row-style="{ height: '20px' }"
                         :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                         :header-cell-style="{ padding: '0px' }"
@@ -348,10 +349,11 @@
               <el-table-column align="left" label="特殊组员" prop="9" width="200"/>
               <el-table-column align="left" label="UNIQID" prop="ID" width="75"/>
             </el-table>
+			</div>
 
 
 
-
+            <div style="margin-top:100px;">
 			<el-row :gutter="20">
 			 <el-col :span="10">
 			   <el-form-item label="机台编号" prop="id">
@@ -576,6 +578,7 @@
 <!--				 <el-button style="margin-bottom: 1vh;" @click="delBz" >删除当前班组</el-button>-->
 			</div>
 			</div>
+			</div>
           </el-dialog>
 
 
@@ -4726,7 +4729,7 @@ const bzryplanUsageCellClass = ({row, column, rowIndex, columnIndex}) =>{
      background-color:white}
 	 .bt {
 	   height: 5vh;
-	   width: 14vh;
+	   width: 7%;
 	   font-size:2vh;
 	 }
 	  .gva-table-box{

+ 82 - 38
src/view/performance/yuangongrigongzi.vue

@@ -42,7 +42,8 @@
 			  <el-button type="primary" :icon="Search">查改</el-button>
 			  <el-button type="primary" @click="handlePrint">员工计件明细</el-button>
               <div style="margin-left: auto;">
-                <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel</el-button>
+                <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel(汇总)</el-button>
+				<el-button type="primary" :icon="Download" @click="exportExcel2">导出到Excel(明细)</el-button>
               </div>
             </div>
             <!-- 数据展示 -->
@@ -53,14 +54,15 @@
 			   :header-cell-style="{ padding: '0px' }" 
 			   @row-click="ontable" @row-dblclick="doubleClick">
               <el-table-column type="selection" width="40" />
-			  <el-table-column align="left" sortable label="员工编号" prop="bh" width="105"/>
-              <el-table-column align="left" sortable label="员工姓名" prop="员工姓名" width="105"/>
-              <el-table-column align="left" sortable label="日期" prop="sczl_rq" width="105"/>
-              <el-table-column align="left" sortable label="计件工资" prop="计件工资" width="105"/>
-              <el-table-column align="left" sortable label="加班工资" prop="加班工资" width="105"/>
-			  <el-table-column align="left" sortable label="计时时数" prop="计时时数" width="105"/>
-              <el-table-column align="left" sortable label="计时工资" prop="计时工资" width="105"/>
-              <el-table-column align="left" sortable label="日工资合计" prop="日工资合计" width="120"/>
+			  <el-table-column
+			    v-for="column in tableCols1"
+			    :key="column.prop"
+			    :prop="column.prop"
+			    :label="column.label"
+			    :width="column.width"
+			    show-overflow-tooltip="true"
+			  				sortable
+			  />  
             </el-table>
             <!-- 分页 -->
             <!-- <div class="gva-pagination">
@@ -73,7 +75,7 @@
 		  
 		  <div class="gva-table-box">
 		    <!-- 数据展示 -->
-		    <el-table ref="multipleTable" style="width: 100%;height: 40vh;" tooltip-effect="dark" :data="tableData2" row-key="ID"
+		    <el-table ref="multipleTable2" style="width: 100%;height: 40vh;" tooltip-effect="dark" :data="tableData2" row-key="ID"
 		      highlight-current-row="true" border 
 			  :row-style="{ height: '20px' }"
 			  :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
@@ -82,28 +84,15 @@
 			  :show-overflow-tooltip="true" 
 			  @row-dblclick="doubleClick">
 		      <el-table-column type="selection" width="40" />
-		  	  <el-table-column align="left" sortable label="日期" prop="sczl_rq" width="105"/>
-		      <el-table-column align="left" sortable label="工单编号" prop="sczl_gdbh" width="105"/>
-		      <el-table-column align="left" sortable label="产品名称" prop="Gd_cpmc" width="120"/>
-		      <el-table-column align="left" sortable label="印件及工序" prop="sczl_type" width="120"/>
-		      <el-table-column align="left" sortable label="机台编号" prop="sczl_jtbh" width="105"/>
-		      <el-table-column align="left" sortable label="班组车头产量" prop="班组车头产量" width="135"/>
-		      <el-table-column align="left" sortable label="班组换算产量" prop="班组换算产量" width="135"/>
-			  <el-table-column align="left" sortable label="工序难度系数" prop="工序难度系数" width="135"/>
-			  <el-table-column align="left" sortable label="个人计件工资" prop="个人计件工资" width="135"/>
-			  <el-table-column align="left" sortable label="个人加班工资" prop="个人加班工资" width="135"/>
-			  <el-table-column align="left" sortable label="装版工时" prop="装版工时" width="105"/>
-			  <el-table-column align="left" sortable label="保养工时" prop="保养工时" width="105"/>
-			  <el-table-column align="left" sortable label="打样工时" prop="打样工时" width="105"/>
-			  <el-table-column align="left" sortable label="异常停机工时" prop="异常停机工时" width="135"/>
-			  <el-table-column align="left" sortable label="车头产量占用机时" prop="车头产量占用机时" width="165"/>
-			  <el-table-column align="left" sortable label="日定额" prop="日定额" width="91"/>
-			  <el-table-column align="left" sortable label="达标定额" prop="达标定额" width="105"/>
-			  <el-table-column align="left" sortable label="千件工价" prop="千件工价" width="105"/>
-			  <el-table-column align="left" sortable label="补产标准" prop="补产标准" width="105"/>
-			  <el-table-column align="left" sortable label="员工编号" prop="bh" width="105"/>
-			  <el-table-column align="left" sortable label="姓名" prop="xm" width="105"/>
-			  <el-table-column align="left" sortable label="比例" prop="Rate" width="78"/>
+		  	  <el-table-column
+		  	    v-for="column in tableCols2"
+		  	    :key="column.prop"
+		  	    :prop="column.prop"
+		  	    :label="column.label"
+		  	    :width="column.width"
+		  	    show-overflow-tooltip="true"
+		  	  				sortable
+		  	  />
 		    </el-table>
 		    <!-- 分页 -->
 		    <!-- <div class="gva-pagination">
@@ -366,16 +355,52 @@ import { ref, reactive, onMounted, onBeforeMount } from 'vue'
 import { getPackingSideTable, getPackingTable } from '@/api/mes_api_gty/myapi'
 import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
 import Ygjjmx from './printYgjjmx.vue'
+import * as XLSX from "xlsx";
 import { useUserStore } from '@/pinia/modules/user'
 const userStore = useUserStore() 
 const sys_id='['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
 defineOptions({
   name: '06-packingDocuments'
 })
-
+const tableCols1 = [
+  { label: '员工编号', prop: 'bh', width: '105' },
+  { label: '员工姓名', prop: '员工姓名', width: '105' },
+  { label: '日期', prop: 'sczl_rq', width: '120' },
+  { label: '计件工资', prop: '计件工资', width: '105' },
+  { label: '加班工资', prop: '加班工资', width: '105' },
+  { label: '计时时数', prop: '计时时数', width: '105' },
+  { label: '计时工资', prop: '计时工资', width: '135' },
+  { label: '日工资合计', prop: '日工资合计', width: '135' },
+]
+const tableCols2 = [
+  { label: '日期', prop: 'sczl_rq', width: '105' },
+  { label: '工单编号', prop: 'sczl_gdbh', width: '105' },
+  { label: '产品名称', prop: 'Gd_cpmc', width: '120' },
+  { label: '印件及工序', prop: 'sczl_type', width: '105' },
+  { label: '机台编号', prop: 'sczl_jtbh', width: '105' },
+  { label: '班组车头产量', prop: '班组车头产量', width: '105' },
+  { label: '班组换算产量', prop: '班组换算产量', width: '135' },
+  { label: '工序难度系数', prop: '工序难度系数', width: '135' },
+  { label: '个人计件工资', prop: '个人计件工资', width: '105' },
+  { label: '个人加班工资', prop: '个人加班工资', width: '105' },
+  { label: '装版工时', prop: '装版工时', width: '120' },
+  { label: '保养工时', prop: '保养工时', width: '105' },
+  { label: '打样工时', prop: '打样工时', width: '105' },
+  { label: '异常停机工时', prop: '异常停机工时', width: '105' },
+  { label: '车头产量占用机时', prop: '车头产量占用机时', width: '135' },
+  { label: '日定额', prop: '日定额', width: '135' },
+  { label: '达标定额', prop: '达标定额', width: '105' },
+  { label: '千件工价', prop: '千件工价', width: '105' },
+  { label: '补产标准', prop: '补产标准', width: '120' },
+  { label: '员工编号', prop: 'bh', width: '105' },
+  { label: '姓名', prop: 'xm', width: '105' },
+  { label: '比例', prop: 'Rate', width: '105' },
+  { label: '班组换算产量', prop: '班组换算产量', width: '135' },
+  { label: '工序难度系数', prop: '工序难度系数', width: '135' },
+]
 // 侧边栏数据请求
 const treeData = reactive([]);
-
+const multipleTable=ref()
 const getTabdata = async () => {
     //接口调用函数
     const response  = await dailygetTab();
@@ -730,11 +755,30 @@ function doubleClick(row, column, event) {
   // dialogFormVisible.value = true
 }
 
-// 导出excel
-function exportExcel() {
-  console.log('导出到excel');
-}
+// 导出excel
+
+function exportExcel() {
 
+ exportExcelFile(tableData,tableCols1)
+};
+function exportExcel2() {
+
+ exportExcelFile(tableData2,tableCols2)
+};
+const exportExcelFile = (tableData, tableCols) => {
+  const data = tableData.map(row => {
+    const rowData = {};
+    tableCols.forEach(column => {
+      rowData[column.label] = row[column.prop];
+    });
+    return rowData;
+  });
+
+  const worksheet = XLSX.utils.json_to_sheet(data);
+  const workbook = XLSX.utils.book_new();
+  XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
+  XLSX.writeFile(workbook, 'exported_table.xlsx');
+};
 const currentRow = ref()
 const dialogYgjjmx = ref(false)
 function handlePrint() {

+ 1 - 1
src/view/yunyin/renliziyuan/renyuanjibenziliao.vue

@@ -8,7 +8,7 @@
             <el-form-item>
               <el-input v-model="searchInfo" placeholder="搜索员工编号或员工姓名" clearable style="width: 200px;margin: 5px"></el-input>
               <el-button type="primary" icon="search" @click="onSubmit" style="margin: 5px">查询</el-button>
-			  <el-button type="primary"  @click="onAttendance" style="margin: 5px">考勤建立</el-button>
+			  <!-- <el-button type="primary"  @click="onAttendance" style="margin: 5px">考勤建立</el-button> -->
               <el-button disabled type="primary" icon="Download" @click="exportToExcel" style="margin: 5px;float: right;">导出到Excel</el-button>
               <el-dialog v-model="dialogexportToExcel" disabled title="员工基本资料导出" width="50%">
               </el-dialog>