Browse Source

机台日报表拆片定额代号固定 包装计件新增保存和跳转优化

zck 1 year ago
parent
commit
914a11d0b3

+ 62 - 15
src/view/performance/06-packingDocuments/index.vue

@@ -124,14 +124,20 @@
 										</template>
 									</el-table-column>
 									
-									<el-table-column label="核算标准">
-										<template #default="{ row }">
-											<el-select v-model="row.hsbz" placeholder="请选择">
-												<el-option label="1000" value="1000"></el-option>
-												<el-option label="2500" value="2500"></el-option>
-											</el-select>
-										</template>
-									</el-table-column>
+									<el-table-column label="核算标准" width="90">
+									<template #default="{ row, rowIndex }">
+									<div class="dropdown-wrapper" @mouseenter="hoveredIndex = rowIndex" >
+										<select
+										v-model="row.hsbz"
+										class="custom-select"
+										>
+										<option value="1000" >1000</option>
+										<option value="2500" >2500</option>
+										<!-- 可以添加更多选项 -->
+										</select>
+									</div>
+									</template>
+								</el-table-column>
 
 									<el-table-column label="包装产量" width="100">
 										<template #default="{ row }">
@@ -709,12 +715,20 @@ const SelectClickBz = (row, column, event) => {
 				gdbh: row.sczl_gdbh
 			})
 			if (response.code === 0) {
-				const {
-					Gd_cpmc,
-					Gy0_gxmc,
-					jyGx
-				} = response.data[0]
-				if (response.data.length === 1) {
+				if (response.data.length === 0) {
+					ElMessage({
+						type: 'error',
+						message: row.sczl_gdbh+'工单未发现印件、工艺数据,请先维护工单基础数据',
+					})
+					detailData.table[index].Gd_cpmc = ''
+					detailData.table[index].sczl_yjGx = ''
+					detailData.table[index].sczl_gxmc = ''
+				}else if (response.data.length === 1) {
+					const {
+						Gd_cpmc,
+						Gy0_gxmc,
+						jyGx
+					} = response.data[0]
 					detailData.table[index].Gd_cpmc = Gd_cpmc
 					detailData.table[index].sczl_yjGx = jyGx
 					detailData.table[index].sczl_gxmc = Gy0_gxmc
@@ -1061,6 +1075,19 @@ const SelectClickBz = (row, column, event) => {
 	// 弹窗确定
 	const enterDialog = () => {
 		if (type.value === '查改') {
+			for(let i = 0; i < detailData.table.length; i++) {
+				if (detailData.table[i].sczl_gdbh ) {
+					if(detailData.table[i].sczl_yjGx === '' || detailData.table[i].sczl_gxmc === '' || detailData.table[i].Gd_cpmc === ''){
+						ElMessage({
+						type: 'warning',
+						message: detailData.table[i].sczl_gdbh + '工单未填写印件工序、工序名称或印件名称,无法保存'
+					})
+					return;
+					}
+				}
+			}
+			console.log(detailData.table[0].sczl_gdbh)
+			return;
 			updateDetailData()
 		} else if (type.value === '新增') {
 			addDetailData()
@@ -1145,7 +1172,7 @@ const SelectClickBz = (row, column, event) => {
 		// console.log(formElements);
     const index = Array.from(formElements).indexOf(event.target);
     const key = event.key;
-	// console.log(detailData);
+	console.log(index);
 	const currentInputValue = formElements[index].value;
     event.preventDefault();
     switch (index) {
@@ -1226,10 +1253,28 @@ const SelectClickBz = (row, column, event) => {
 		const index2 = Array.from(formElements).indexOf(event.target)
 			if (row.sczl_dedh != '' & event.key === "ArrowLeft"){
 				event.stopPropagation();
+				console.log(11244)
 				formElements[index2-2].focus();
 				formElements[index2-2].select();
 			}
+			if(row.sczl_gdbh === '' && event.key === "Enter" ){
+				event.stopPropagation();
+				console.log(55644)
+			formElements[index2+11].focus();
+			formElements[index2+11].select();
+			row.sczl_yjGx = ""
+			row.sczl_gxmc = ""
+			row.Gd_cpmc = ""
+			row.hsbz = ""
+			row.sczl_cl = ""
+			row.sczl_返工产量 = ""
+			row.sczl_PgCl = ""
+			row.sczl_计产系数 = ""
+			row.sczl_Jtbh1 = ""
+			row.sczl_dedh = ""
+		}
 	}
+
 </script>
 
 <style scoped>
@@ -1259,6 +1304,7 @@ const SelectClickBz = (row, column, event) => {
 		flex: 1;
 	}
 
+
 	:deep(.el-table__body .warning-row) {
 		background: #FFFF80 !important;
 	}
@@ -1280,6 +1326,7 @@ const SelectClickBz = (row, column, event) => {
 	:deep(.el-tabs__header) {
 		margin-bottom: 0;
 	}
+	
 
 	.search {
 		margin-left: 0px !important;

+ 24 - 18
src/view/performance/09-workOrderVerification/componets/gongdanzhijianfeipintongji.vue

@@ -48,7 +48,8 @@
             :prop="column.prop"
             :label="column.label"
             :width="column.width"
-			:sortable= "column.sortable"
+			      :sortable= "column.sortable"
+            :formatter="column.prop === '订单数量' ? formatOrderQuantity : null"
           />
         </el-table>
 
@@ -83,23 +84,23 @@ const props = defineProps(['modelValue', 'val'])
 const emits = defineEmits(['update:modelValue'])
 
 const tableColumns = reactive([
-  { label: '工单编号',sortable: 'sortable', prop: 'gdbh', width: '150' },
-  { label: '产品代号',sortable: 'sortable', prop: 'product_code', width: '150' },
-  { label: '产品名称',sortable: 'sortable', prop: 'product_name', width: '150' },
-  { label: '订单数量',sortable: 'sortable', prop: '订单数量', width: '150' },
-  { label: '实际投料',sortable: 'sortable', prop: 'aaa', width: '150' },
-  { label: '计量单位',sortable: 'sortable', prop: '计量单位', width: '150' },
-  { label: '交货日期',sortable: 'sortable', prop: '交货日期', width: '150' },
-  { label: '入仓数量',sortable: 'sortable', prop: 'jjcp_sl', width: '150' },
-  { label: '入仓日期',sortable: 'sortable', prop: 'jjcp_sj', width: '150' },
-  { label: '印件号',sortable: 'sortable', prop: 'qczl_yjno', width: '150' },
-  { label: '联数',sortable: 'sortable', prop: 'yj_ls', width: '150' },
-  { label: '工序号',sortable: 'sortable', prop: 'fp_gxh', width: '150' },
-  { label: '流程单号', sortable: 'sortable',prop: 'qczl_num', width: '150' },
-  { label: '员工编号',sortable: 'sortable', prop: 'fp_bh', width: '150' },
-  { label: '员工姓名',sortable: 'sortable', prop: 'fp_name', width: '150' },
-  { label: '废品类别',sortable: 'sortable', prop: 'fp_lb', width: '150' },
-  { label: '数量',sortable: 'sortable', prop: 'fp_sl', width: '150' },
+  { label: '工单编号',sortable: 'sortable', prop: 'gdbh', width: '110' },
+  { label: '产品代号', prop: 'product_code', width: '110' },
+  { label: '产品名称', prop: 'product_name', width: '190' },
+  { label: '订单数量',sortable: 'sortable', prop: '订单数量', width: '110' },
+  { label: '实际投料',sortable: 'sortable', prop: 'aaa', width: '110' },
+  { label: '计量单位', prop: '计量单位', width: '90' },
+  { label: '交货日期',sortable: 'sortable', prop: '交货日期', width: '110' },
+  { label: '入仓数量',sortable: 'sortable', prop: 'jjcp_sl', width: '110' },
+  { label: '入仓日期',sortable: 'sortable', prop: 'jjcp_sj', width: '110' },
+  { label: '印件号',sortable: 'sortable', prop: 'qczl_yjno', width: '100' },
+  { label: '联数', prop: 'yj_ls', width: '55' },
+  { label: '工序号',sortable: 'sortable', prop: 'fp_gxh', width: '100' },
+  { label: '流程单号', sortable: 'sortable',prop: 'qczl_num', width: '110' },
+  { label: '员工编号',sortable: 'sortable', prop: 'fp_bh', width: '110' },
+  { label: '员工姓名', prop: 'fp_name', width: '90' },
+  { label: '废品类别',sortable: 'sortable', prop: 'fp_lb', width: '110' },
+  { label: '数量',sortable: 'sortable', prop: 'fp_sl', width: '80' },
 ])
 const tableData = ref([])
 const input = ref(props.val)
@@ -107,6 +108,11 @@ const inputCpmc = ref('')
 const isLoading = ref(false)
 console.log(input.value)
 
+//保留小数点后两位
+function formatOrderQuantity(row, column, cellValue) {
+  return parseFloat(cellValue).toFixed(2);
+}
+
 const handleExcel = () => {
   const el = document.getElementById('tab');
   // 文件名

+ 13 - 5
src/view/performance/Dayreports.vue

@@ -728,9 +728,9 @@
                       v-model="formData.sczl_dedh"
                       id="定额代号"
                       @keydown="
-                        ent1($event, '拆片条小盒系数', '定额代号', '工价系数')
+                        ent1($event, '拆片条小盒系数', '定额代号', '工价系数');
+                        
                       "
-                      @blur="getDedhsubmit()"
                       :clearable="true"
                       style="width: 200px"
                     />
@@ -1577,7 +1577,7 @@ const handleNodeClick = (node, check) => {
 };
 
 //新增键盘事件
-const ent1 = (event,id) => {
+const ent1 = (event,id,id2) => {
   const inputs = document.getElementsByTagName("input");
   const currentIndex = Array.from(inputs).indexOf(event.target);
   // console.log(inputs)
@@ -1587,7 +1587,7 @@ const ent1 = (event,id) => {
 	  getYJMCsubmit()
   }
   if(event.keyCode === 13 && id ==='工序名称'){
-  	  console.log("回车工序名称")
+  	  console.log(formData.value.sczl_gxmc)
 	  //调用工序选择方法
   	  getGXsubmit()
   }
@@ -1600,6 +1600,14 @@ const ent1 = (event,id) => {
   	  console.log("回车机器")
   	  //调用工序选择方法
   	  getJtbhsubmit()
+  }
+    if(event.keyCode === 13 && id2 ==='定额代号'){
+  	  console.log("定额代号")
+      if(formData.value.sczl_gxmc.includes('拆片')){
+        formData.value.sczl_dedh = "030001001"
+      }else{
+        getDedhsubmit()
+      }
   }
   if (event.keyCode === 13 || event.keyCode === 40) {
     // Enter 或向下箭头
@@ -3248,7 +3256,7 @@ const GetInfo = async (value) => {
             console.error('Table element not found!');
             return;
         }
-    const filename = '工序大废品.xlsx';
+    const filename = '机台日报表.xlsx';
     const wb = XLSX.utils.table_to_book(el, { raw: true });
     const ws = wb.Sheets[wb.SheetNames[0]]; // 获取第一个工作表