Просмотр исходного кода

设备制程排序、日产量上报、设置机台状态、大废品奖惩excel优化

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

+ 1 - 1
src/view/DecisionSupport/outputsum/index.vue

@@ -138,8 +138,8 @@ import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { ref, reactive, computed, nextTick, watch,onMounted } from 'vue'
 import {OutputSstatisticsMenu,MachineProductDetail,MachineProduction} from "@/api/DecisionSupport/decision.js"
-defineOptions({name: 'Company'})
 import { useUserStore } from '@/pinia/modules/user'
+defineOptions({name: 'Company'})
 const userStore = useUserStore()
 const _username = ref('')
 _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName

+ 52 - 16
src/view/job/rewards/rewards.vue

@@ -20,10 +20,11 @@
 								<el-button type="primary" icon="refresh" @click="onReset" class="bt">切换显示方式</el-button>
 								<el-button type="primary" icon="plus" @click="onAdd" class="bt">新增</el-button>
 								<el-button type="primary" icon="delete" @click="onDel" class="bt">删除</el-button>
+								<el-button type="primary" class="bt" icon="download" @click="jcToExcel" >导出到Excel</el-button>
 							</el-form-item>
 						</el-form>
-						<el-table ref="multipleTable" style="width: 100%" border tooltip-effect="dark" :data="tableData"
-							row-key="ID" :show-overflow-tooltip="true" highlight-current-row
+						<el-table ref="multipleTable" style="width: 100%;height: 74vh" border tooltip-effect="dark" :data="tableData"
+							row-key="ID" :show-overflow-tooltip="true" highlight-current-row id="Exceltable"
 							:row-style="{ height: '20px' }" :cell-style="{ padding: '0px' }"
 							:header-row-style="{ height: '20px' }" :header-cell-style="{ padding: '0px' }"
 							@selection-change="handleSelectionChange" @row-dblclick="handleDoubleClick"
@@ -394,6 +395,11 @@
 </template>
 
 <script setup>
+import $script from 'scriptjs'
+import $ from 'jquery';
+import * as XLSX from 'xlsx'
+import FileSaver from 'file-saver'
+import LuckyExcel from 'luckyexcel';
 	import {
 		getRewardDetail,
 		getRewardList,
@@ -450,17 +456,31 @@
 	const displayMod = ref('')
 	// 侧边栏
 	const RewardTab = async () => {
-		const getRewardTabs = await getRewardTab()
-		if (getRewardTabs.code === 0) {
-			treeData.value = getRewardTabs.data.map((item) => ({
-				label: `${item.date.replace(/-/g, '.')}【单据数: ${item.counts}张】`,
-				params: {
-					date: item.date.replace(/\./g, '-'),
-				}
-			}))
-			displayMod.value = 'date'
-		}
-	}
+		try {
+        const getRewardTabs = await getRewardTab();
+        if (getRewardTabs.code === 0) {
+          // 格式化数据为树形结构
+          const formattedTreeData = [];
+          for (const month in getRewardTabs.data) {
+            if (getRewardTabs.data.hasOwnProperty(month)) {
+              formattedTreeData.push({
+                label: month,
+                children: getRewardTabs.data[month].map(item => ({
+                  label: item.date.replace(/\./g, '-'),
+                  counts: item.counts,
+                })),
+              });
+            }
+          }
+          treeData.value = formattedTreeData;
+        } else {
+          ElMessage.error('获取奖励标签数据失败: ' + getRewardTabs.msg);
+        }
+      } catch (error) {
+        console.error('加载奖励标签数据时发生错误:', error);
+        ElMessage.error('加载数据失败,请稍后再试。');
+      }
+    };
 	RewardTab()
 
 	const RewardTabByGd = async () => {
@@ -478,9 +498,9 @@
 
 	const handleNodeClick = (node, check) => {
 		// 存放当前节点的nodeId
-		// console.log(node, check)
-		if (node.params) {
-			params.date = node.params.date
+		console.log(node.label)
+		if (node.label) {
+			params.date = node.label
 			getTableData()
 		}
 	}
@@ -1071,6 +1091,22 @@
 		//   }
 		// })
 	}
+
+  //导出到Excel按钮
+  const jcToExcel = ()=>{
+  const el = document.getElementById('Exceltable'); 
+  // 文件名
+  const filename = '工序大废品.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 SubmitDailyProduction = async () => {
 

+ 44 - 54
src/view/performance/09-workOrderVerification/index.vue

@@ -179,13 +179,14 @@
 					</el-dialog>
 
 					<!-- 废品类别弹出 -->
-					<el-dialog v-model="dialogSelectVisible1" id="tableFplb" @keydown="ent($event)"  @opened="focusFirstNode">
+					<el-dialog v-model="dialogSelectVisible1" id="tableFplb" @keydown="ent($event)"  >
 						<el-form>
 								<el-form-item label="废品类别" class="mab" prop="keyOrder"></el-form-item>
 								<div style="border:1px solid #eee; width:100%; height: 500px; overflow-y: auto">
-									<el-tree :data="selecTreeData" ref="table_fplb"
-										@keydown="handleTreeKeydown"
+									<el-tree :data="selecTreeData" ref="table_fplb" 
+										@keydown="handleTreeKeydown" 
 										:props="{ children: 'children',label: 'label'}"
+										:default-expanded-keys="[1]"
 										node-key="id" @node-click="handleFplbClick">
 									</el-tree>
 								</div>
@@ -738,58 +739,45 @@ const gd_lcdCancel = async () => {
 
 
 
-	//tree中data数据
+//tree中data数据
+const refTree = ref(null)
 	const selecTreeData = ref([])
 	const table_fplb = ref()
-
-	// 废品类别回车弹出分类页面
-	const handleFplbEnter =  async(index, row) => {
-
-		//上个弹窗还未关闭或者值为空
-		if(dialogSelectVisible2.value || !row.fp_lb){
-			return
-		}
-		//打开弹窗
-		dialogSelectVisible1.value = true
-
-		let flag = true
-		//查询废品类别接口
-		const res = await getWastInfo()
-			if (res.code == 0) {
-				const obj = res.data
-				const children = []
-				let i = 0
-				for (const subCategory in obj.废品分类) {
-					if (flag && Object.prototype.hasOwnProperty.call(obj.废品分类, subCategory)) {
-						let j = 0
-						const subChildren = []
-						obj.废品分类[subCategory].map(item => {
-							if(item==row.fp_lb){
-								flag = false
-								return
-							}
-							subChildren.push({ 
-								id: i+'-'+j,
-								label: item, 
-								children: []
-							})
-							j++
-						})
-						children.push({
-							id: i,
-							label: subCategory,
-							children: subChildren
-						})
-						i++
-					}
-				}
-				if(!flag){return}
-				//渲染数据
-				selecTreeData.value = children
-				selectIndex = index
-			}
-	}
-
+	const handleFplbEnter = async (index, row) => {
+  if (dialogSelectVisible1.value || !row.fp_lb) {
+    return;
+  }
+  dialogSelectVisible1.value = true;
+  const res = await getWastInfo();
+  if (res.code === 0) {
+    const obj = res.data;
+    const children = processTreeData(obj.废品分类, row.fp_lb);
+    selecTreeData.value = children;
+  }
+};
+ 
+const processTreeData = (categories, prefix) => {
+  const result = [];
+  for (const categoryKey in categories) {
+    if (Object.prototype.hasOwnProperty.call(categories, categoryKey) && categoryKey.startsWith(prefix)) {
+      const items = categories[categoryKey];
+      const categoryNode = {
+        id: categoryKey, 
+        label: categoryKey,
+        children: []
+      };
+      for (const item of items) {
+        categoryNode.children.push({
+          id: `${categoryKey}-${items.indexOf(item)}`,
+          label: item, 
+          children: [] 
+        });
+      }
+      result.push(categoryNode);
+    }
+  }
+  return result;
+};
 	const handleFplbClick = (node, check) => {
 		console.log(node, check)
 		if (node.children && node.children.length > 0) {
@@ -1237,8 +1225,10 @@ const gd_lcdCancel = async () => {
 		if(document.activeElement.id=='tableFplb'){
 			if (table_fplb.value) {
 				const tree = table_fplb.value?.$el; // 访问组件实例的 $el
+				console.log(111,tree)
 				if (tree) {
-					const node = tree.querySelector('[data-key="0"]');
+					const node = tree.querySelector('[data-key]');
+					console.log(222,node)
 					if (node) {
 						node.scrollIntoView();
 						node.focus(); // 尝试聚焦}

+ 6 - 0
src/view/performance/Packagingoutput.vue

@@ -798,6 +798,12 @@ function onAdd() {
 	// }
 	initFormData()
 	dialogFormVisible.value = true
+	setTimeout(() => {
+		const inputElement = document.getElementById('日期');
+			if (inputElement) {
+				inputElement.focus();		
+			}
+		}, 100);
 	// Productionadd()
 }
 

+ 20 - 2
src/view/performance/chejianbaogong.vue

@@ -2098,7 +2098,7 @@
 		<Shebeizhuangtai
 		  v-if="dialogSbyxgl"
 		  v-model="dialogSbyxgl"
-		  title="【01.30 08:30】【JY01#--海德堡对开八色平版胶印机(JY08-01)】【2311116-->钻石(荷花)盒包装纸】【01--胶印】"
+		  :title="titleinfo"
 		  :formData="formData"
 		/>
 
@@ -2341,6 +2341,8 @@ const remodelDetail = async (val) => {
 const handleNodeClick = (nodeData,node) => {
 }
 
+let titleinfo=ref()
+
 const classbz=ref([])
 const FacilityProduction = async (addr) => {
   if(JTMC === '' || JTMC === null){
@@ -2363,6 +2365,14 @@ const FacilityProduction = async (addr) => {
       formData.value.定额代号=response.data.定额代号
       formData.value.addr=addr
       BZMC.value=response.data.班组编号
+
+
+	  let time = new Date();
+	  time.setDate(time.getDate() - 0); // 今天的前N天的日期,N自定义
+	  titleinfo = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`;
+	  titleinfo+='【'+JTMC+response.data.工单编号+response.data.产品名称+'】'+response.data.工序名称
+
+
       // 填充sczl_bh和sczl_name字段
       let sczl_bhkey=''
       let sczl_namekey=''
@@ -3767,7 +3777,15 @@ const ReportInfo = async () => {
 	  日期:getTimelistss.data.date,
 	  下机时间:getTimelistss.data.hours,
 	  上机时间:formData.value.上机时间,
+	  制程废品:0,
+	  制程次品:0,
+	  前工序废:0,
+	  来料异常:0,
 	  装版总时长:0,
+	  打样总工时:0,
+	  通电工时:0,
+	  主电表:0,
+	  辅电表:0,
 	  定额代号:formData.value.定额代号,
 	  sczl_jtbh: JTMC.split("#")[0],
 	  sczl_bzdh: classInfo.sczl_bzdh,
@@ -4949,7 +4967,7 @@ const fpsum2 = ref();
 //自动计算分配系数和
 function updateTotal() {
   // 直接指定要累加的属性名  
-  const relevantKeys = ['percentage1', 'percentage2', 'percentage3', 'percentage4', 'percentage5', 'percentage6', 'percentage7', 'percentage8'];  
+  const relevantKeys = ['percentage1', 'percentage2', 'percentage3', 'percentage4', 'percentage5', 'percentage6', 'percentage7'];  
   const values = relevantKeys.map(key => parseFloat(formDatas.value[key], 10) || 0); // 使用 || 0 来处理可能的 NaN 或 undefined/null  
   fpsum.value = values.reduce((sum, value) => sum + value, 0); 
 //   const relevantKeys2 = ['组员1', '组员2','组员3','组员4','组员5','组员6','组员7','组员8','组员9','组员10',];  

+ 1 - 1
src/view/yunyin/shengchanguanli/gongdanshengchan.vue

@@ -1297,7 +1297,7 @@ const paichengColumns = ref(
     [
       { label: '优先次序', prop: '优先次序', width: '105' },
       { label: '工单编号', prop: '工单编号', width: '100' },
-      // { label: '印件名称', prop: '印件名称', width: '200' },
+      { label: '印件名称', prop: '印件名称', width: '440' },
       { label: '接货数', prop: '计划接货数', width: '90' },
       { label: '已完成', prop: '已完成', width: '90' },
       { label: '小时产能', prop: '小时产能', width: '100' },