|
|
@@ -28,7 +28,8 @@
|
|
|
<el-button type="primary" class="bt" icon="" @click="oncopy">组员复制</el-button>
|
|
|
<el-button type="primary" class="bt" icon="edit" @click="onrelevancy">关联工资设置</el-button>
|
|
|
<div style="margin-left: auto;">
|
|
|
- <el-button type="primary" class="bt" icon="download" @click="exportExcel">导出到Excel</el-button>
|
|
|
+ <el-button type="primary" class="bt" icon="download" @click="exportExcel">导出到Excel(汇总)</el-button>
|
|
|
+ <el-button type="primary" class="bt" icon="download" @click="exportExcel2">导出到Excel(明细)</el-button>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -42,18 +43,15 @@
|
|
|
:show-overflow-tooltip="true" @row-click="ontable"
|
|
|
@selection-change="handleSelectionChange" @row-dblclick="doubleClick">
|
|
|
<!-- <el-table-column type="selection" width="55" /> -->
|
|
|
- <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="150"/>
|
|
|
- <el-table-column align="left" sortable label="所在部门" prop="所在部门" width="150"/>
|
|
|
- <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="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
|
|
|
+ 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">
|
|
|
@@ -75,18 +73,15 @@
|
|
|
@selection-change="handleSelectionChange"
|
|
|
:show-overflow-tooltip="true" @row-dblclick="doubleClick">
|
|
|
<el-table-column type="selection" width="55" />
|
|
|
- <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="150"/>
|
|
|
- <el-table-column align="left" sortable label="所在部门" prop="所在部门" width="150"/>
|
|
|
- <el-table-column align="left" sortable label="被关联员工" prop="被关联员工" width="120"/>
|
|
|
- <el-table-column align="left" sortable label="被关联姓名" prop="被关联姓名" width="120"/>
|
|
|
- <el-table-column align="left" sortable label="权重" prop="权重" width="77"/>
|
|
|
- <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
|
|
|
+ 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">
|
|
|
@@ -346,14 +341,41 @@ import { Search, Refresh, Download } from '@element-plus/icons-vue'
|
|
|
import { ref, reactive, onMounted, onBeforeMount, nextTick } from 'vue'
|
|
|
import { getPackingSideTable, getPackingTable } from '@/api/mes_api_gty/myapi'
|
|
|
import { Value } from 'sass'
|
|
|
-import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
|
|
|
+import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-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: '员工编号', 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: '135' },
|
|
|
+ { label: '关联定额补差', prop: '关联定额补差', width: '130' },
|
|
|
+ { label: '关联计时工资', prop: '关联计时工资', width: '130' },
|
|
|
+ { label: '关联工资合计', prop: '关联工资合计', width: '130' },
|
|
|
+]
|
|
|
+const tableCols2 = [
|
|
|
+ { label: '日期', prop: '日期', width: '105' },
|
|
|
+ { label: '员工编号', prop: '员工编号', width: '105' },
|
|
|
+ { label: '员工姓名', prop: '员工姓名', width: '150' },
|
|
|
+ { label: '所在部门', prop: '所在部门', width: '150' },
|
|
|
+ { label: '被关联员工', prop: '被关联员工', width: '125' },
|
|
|
+ { label: '被关联姓名', prop: '被关联姓名', width: '125' },
|
|
|
+ { label: '权重', prop: '权重', width: '105' },
|
|
|
+ { label: '计件工资', prop: '计件工资', width: '105' },
|
|
|
+ { label: '加班工资', prop: '加班工资', width: '105' },
|
|
|
+ { label: '定额补差', prop: '定额补差', width: '105' },
|
|
|
+ { label: '计时工资', prop: '计时工资', width: '105' },
|
|
|
+]
|
|
|
// 侧边栏数据请求
|
|
|
const treeData = reactive([]);
|
|
|
|
|
|
@@ -969,9 +991,42 @@ function doubleClick(row, column, event) {
|
|
|
}
|
|
|
|
|
|
// 导出excel
|
|
|
-function exportExcel() {
|
|
|
- console.log('导出到excel');
|
|
|
+function exportExcel() {
|
|
|
+ if(tableData.length<1){
|
|
|
+ ElMessage({
|
|
|
+ type: 'error',
|
|
|
+ message: '请确认上方表格内是否存在内容'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ exportExcelFile(tableData,tableCols1)
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+function exportExcel2() {
|
|
|
+
|
|
|
+ if(tableData2.length<1){
|
|
|
+ ElMessage({
|
|
|
+ type: 'error',
|
|
|
+ message: '请确认下方表格内是否存在内容'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ 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');
|
|
|
+};
|
|
|
|
|
|
// 生命周期钩子
|
|
|
onMounted(async () => {
|