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

+ 86 - 27
src/view/performance/09-workOrderVerification/index.vue

@@ -15,6 +15,7 @@
 
 			<el-container>
 				<el-main>
+
 					<div class="gva-table-box">
 						<!-- 按钮区域 -->
 						<el-form>
@@ -27,13 +28,17 @@
 								<el-button type="primary" icon="edit"   @click="gdlcdcxconlick"    class="bt" title="流程单查询">流程单查询</el-button>
 								<el-button type="primary" icon="edit"   @click="scpconClick"    class="bt" title="工单生产批次信息查询">工单生产批次信息查询</el-button>
 								<el-button type="primary" icon="delete" class="bt" @click="handleDelete">删除</el-button>
+								<div style="margin-left: auto;">			
+							<el-button type="primary" class="bt" icon="Download" @click="exportExcel">导出到Excel</el-button>
+						</div>
 							</el-form-item>
 						</el-form>
+
 						<!-- 数据展示 -->
 						<el-table ref="table" style="width: 100%;height: 62vh;" :data="tableData" row-key="ID" 
 							@row-click="handleSelectChange"
 							highlight-current-row="true"
-							border  
+							border   id="table"
 							:row-style="{ height: '20px' }"  :header-cell-style="{ padding: '0px' }"
 							:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
 							:show-overflow-tooltip="true"
@@ -460,6 +465,8 @@
 <script setup>
 	// 全量引入格式化工具 请按需保留
 	import {createCompany,deleteCompany,deleteCompanyByIds,updateCompany,findCompany,getCompanyList} from '@/api/company'
+	import * as XLSX from 'xlsx'
+	import FileSaver from 'file-saver'
 	import {ElMessage,ElMessageBox,} from 'element-plus'
 	import {Search,Refresh,Download} from '@element-plus/icons-vue'
 	import {ref,reactive,nextTick} from 'vue'
@@ -772,13 +779,13 @@ const Enterkeysearch = (event) => {
 const _StaGetOrderList = async (node) => {
   const StaGetOrderListdata = await StaGetOrderList({search:searchInfolcd.value});
   console.log(StaGetOrderListdata)
-	if (StaGetOrderListdata.data === null) {
-	  ElMessage({
-		type: 'warning',
-		message: '未搜索具体查询条件',
-		customClass: 'custom-message', // 添加自定义类名
-		duration: 3000 // 可选:设置消息显示的持续时间(单位:毫秒)
-	  });
+	if (StaGetOrderListdata.data === null) {
+	  ElMessage({
+		type: 'warning',
+		message: '未搜索具体查询条件',
+		customClass: 'custom-message', // 添加自定义类名
+		duration: 3000 // 可选:设置消息显示的持续时间(单位:毫秒)
+	  });
 	}
   tableDatalcd.splice(0,tableDatalcd.length,...StaGetOrderListdata.data);//表格数据
 };
@@ -800,22 +807,22 @@ const _GetorderDetail = ref(null)
 */
 const popdialog = ref(false);
 const currentRows = ref('');
-// 获取当前行数据
-const tableRowClicklcd = (row) => {
-  currentRows.value = row; // 保存当前选中行
-};
-
-// 按钮点击逻辑
+// 获取当前行数据
+const tableRowClicklcd = (row) => {
+  currentRows.value = row; // 保存当前选中行
+};
+
+// 按钮点击逻辑
 const onstatsuclick  = async () => {
-	console.log(currentRows)
-  if (!currentRows.value) {
-	ElMessage({
-	  type: "warning",
-	  message: "请先点击选择一行数据",
-	});
-	return;
-  }
-  await updateCompanyFunclcd(currentRows.value);
+	console.log(currentRows)
+  if (!currentRows.value) {
+	ElMessage({
+	  type: "warning",
+	  message: "请先点击选择一行数据",
+	});
+	return;
+  }
+  await updateCompanyFunclcd(currentRows.value);
 };
 //双击
 const updateCompanyFunclcd = async (row) => {
@@ -1402,10 +1409,7 @@ const ontuicclicks = async () => {
 		dialogFormVisible.value = false
 	}
 
-	// 导出excel
-	function exportExcel() {
-		console.log('导出到excel')
-	}
+
 
 	const dialogMrhjtj = ref(false)
 	const dialogGdzjfptj = ref(false)
@@ -2138,6 +2142,22 @@ const handleDelete = () => {
 			})
 		})
 }
+
+// 导出
+const exportExcel = ()=>{
+  const el = document.getElementById('table');
+  // 文件名
+  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;
+}
+
 </script>
 
 <style>
@@ -2229,4 +2249,43 @@ const handleDelete = () => {
   font-size: 20px;
   border-color: #f5c6cb;
 }
+
+/* 保证水平滚动条一直显示 */
+:deep(.el-scrollbar__wrap) {
+  overflow-x: scroll; /* 确保水平滚动条始终显示 */
+}
+
+/* 水平滚动条的样式 */
+:deep(.el-scrollbar__bar.is-horizontal) {
+  height: 8px; /* 设置滚动条的高度,更细 */
+  background-color: transparent; /* 背景透明 */
+}
+
+/* 水平滚动条滑块的样式 */
+:deep(.el-scrollbar__thumb.is-horizontal) {
+  background-color: rgba(0, 0, 0, 0.8); /* 滑块颜色,浅灰色 */
+  border-radius: 2px; /* 圆角效果 */
+}
+
+/* 保证垂直滚动条也始终显示 */
+:deep(.el-scrollbar__wrap) {
+  overflow-y: scroll; /* 确保垂直滚动条始终显示 */
+}
+
+/* 垂直滚动条的样式 */
+:deep(.el-scrollbar__bar.is-vertical) {
+  width: 8px; /* 设置滚动条的宽度,更细 */
+  background-color: transparent; /* 背景透明 */
+}
+
+/* 垂直滚动条滑块的样式 */
+:deep(.el-scrollbar__thumb.is-vertical) {
+  background-color: rgba(0, 0, 0, 0.8); /* 滑块颜色,浅灰色 */
+  border-radius: 2px; /* 圆角效果 */
+}
+
+/* 鼠标悬停时滚动条滑块的样式 */
+:deep(.el-scrollbar__thumb:hover) {
+  background-color: rgba(0, 0, 0, 1); /* 鼠标悬停时滑块颜色稍深 */
+}
 </style>

+ 46 - 12
src/view/performance/12-orderAccounting/componets/gxclhc.vue

@@ -24,11 +24,12 @@
         :cell-style="{ padding: '0px' }"
         :header-row-style="{ height: '20px' }"
         :header-cell-style="{ padding: '0px' }"
+        :cell-class-name="gxclhcCellClass">
       >
         <el-table-column
           label="印件及工序名称"
           width="250"
-          prop="Gy0_yjno"
+          prop="concatenatedData"
         />
 
         <el-table-column
@@ -46,18 +47,18 @@
         <el-table-column
           label="折算车头产量"
           width="120"
-          prop=""
+          prop="折算车头产量"
         />
 
         <el-table-column
           label="实际上报产量"
           width="120"
-          prop="Gy0_ls"
+          prop="sczl_cl"
         />
         <el-table-column
           label="制程废品"
           width="120"
-          prop=""
+          prop="sczl_zcfp"
         />
         <el-table-column
           label="制程废品率"
@@ -140,21 +141,54 @@ const handleGetTable = async() => {
     cpmc.value = ret['data'][0]['Gd_cpmc']
     // console.log(ret['data'])
   }
-  const res = await getOrderProcessCount({ order: input.value,yjno:jjcp_yjno.value })
-  console.log(res)
-  if (res['code'] === 0) {
-    const { data } = res
-    tableData.value = data.map(item => ({
+  const getOrderProcessCount_list = await getOrderProcessCount({ order: input.value,yjno:jjcp_yjno.value })
+  const concatenatedData = getOrderProcessCount_list.data.map(item => {
+    // 优化后的代码,使用模板字符串连接字段值并在单个数字前添加零
+    const formattedYjno = item.Gy0_yjno.length === 1 ? `0${item.Gy0_yjno}` : item.Gy0_yjno;
+    const formattedGxh = item.Gy0_gxh.length === 1 ? `0${item.Gy0_gxh}` : item.Gy0_gxh;
+    const concatenatedValue = `${formattedYjno}-${formattedGxh} ${item.Gy0_gxmc} 【${item.Add_gxmc} 】`;
+    return {
       ...item,
-      Gy0_yjno: `${item['Gy0_yjno']}-${item['Gy0_gxh']} ${item['Gy0_gxmc']} ${item['Add_gxmc']}`,
-    }))
-  }
+      concatenatedData: concatenatedValue, // 使用新属性名
+    };
+  });
+  tableData.value = concatenatedData;
 }
 handleGetTable()
+
+//工序产量核查
+const gxclhcCellClass = ({row, column, rowIndex, columnIndex}) =>{
+  if (column.label === '实际上报产量' ||column.label === '制程废品'  || column.label === '制程废品率' ||
+      column.label === '来料异常' || column.label === '流程单数' || column.label === '当前设备') {
+    return 'lan-plan-usage-lows';
+  }
+  if (column.label === '折算车头产量') {
+    return 'gxclhc—color-column-red';
+  }
+  // 如果不是 'PD_WG' 列,返回空字符串或其他样式类
+  if (column.label === '工序状态'){
+    if(row['PD_WG'] === '完工'){
+      return 'lan-plan-usage-lowshui';
+    }else{
+      return 'pczccolor-column-lan';
+    }
+  }
+}
 </script>
 
 <style scoped>
 :deep(.cpmc .el-input__inner) {
   color: red !important;
 }
+/*工序产量核查*/
+:deep(.gxclhc—color-column-red div) {
+  color: red !important;
+}
+:deep(.lan-plan-usage-lows div) {
+  color: blue !important;
+  font-weight: bold;
+}
+:deep(.lan-plan-usage-lowshui div) {
+  color: #8c939d !important;
+}
 </style>

+ 14 - 2
src/view/performance/12-orderAccounting/componets/hjfpfb.vue

@@ -98,7 +98,7 @@
             :data="tableData"
             row-key="ID"
             highlight-current-row
-            border
+            border id="table"
             show-overflow-tooltip
             :row-style="{ height: '20px' }"
             :cell-style="{ padding: '0px' }"
@@ -146,7 +146,8 @@ export const getWasteDistribution = (params) => {
 <script setup>
 import * as echarts from 'echarts'
 import { nextTick, onMounted, onUnmounted, ref, shallowRef, defineProps, defineEmits } from 'vue'
-
+import * as XLSX from 'xlsx'
+import FileSaver from 'file-saver'
 const props = defineProps(['modelValue', 'val','jjcp_yjno'])
 const emits = defineEmits(['update:modelValue'])
 const form = ref({
@@ -164,6 +165,17 @@ const tableData = ref([])
 const isLoading = ref(false)
 
 const handleExcel = () => {
+  const el = document.getElementById('table');
+  // 文件名
+  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 handleSearch = async() => {