Browse Source

工单核验单数量计算,键盘事件/包装计件单据定额代号回车事件/员工日工资加班费核查关联工资核算侧边栏宽度调整

曹鹤洋 1 year ago
parent
commit
a09753d987

+ 8 - 0
src/api/mes_api_gty/workOrderVerification.js

@@ -146,3 +146,11 @@ export const add = (data) => {
     data
   })
 }
+// 10删除
+export const del = (params) => {
+  return service({
+    url: '/mes_server/work_order_verification/del',
+    method: 'get',
+    params
+  })
+}

+ 1 - 1
src/view/job/related/related.vue

@@ -3,7 +3,7 @@
 		<!-- 左侧树形结构 -->
 		<el-container>
 
-			<layout-sider :resize-directions="['right']" :width="220" style="margin-right: 10px;">
+			<layout-sider :resize-directions="['right']" :width="180" style="margin-right: 10px;">
 				<div class="JKWTree-tree" style="height: 70vh;">
 					<h3>关联工资核算</h3>
 					<el-tree :data="treeData" highlight-current @node-click="handleNodeClick" />

+ 3 - 3
src/view/performance/06-packingDocuments/index.vue

@@ -1059,9 +1059,9 @@ const SelectClickBz = (row, column, event) => {
 	const _index = ref(null)
 	// 定额代号回车事件
 	const getDedhsubmit = async (index, row) => {
-		// const tree = this.$refs.dedhTree;
-		// console.log(tree);
-		console.log(index)
+		if(detailData.table[index].sczl_dedh == '030002002'){
+			return
+		}
 		_index.value = index
 		dedhsearchModel.value = true;
 		const getPieceWorks = await getDedh();

+ 193 - 207
src/view/performance/09-workOrderVerification/index.vue

@@ -16,35 +16,22 @@
 				<el-main>
 					<div class="gva-table-box">
 						<!-- 按钮区域 -->
-						<div class="gva-btn-list">
-							<el-row :span="6">
-								<el-input v-model="searchInfo" placeholder="输入工单编号" />
-							</el-row>
-							<el-button type="primary" :icon="Search" class="bt" @click="handleSearch">搜索
-							</el-button>
-							<el-button type="primary" icon="copy-document" class="bt"
-								@click="dialogMrhjtj = true">每日核检统计
-							</el-button>
-							<el-button type="primary" icon="copy-document" class="bt" @click="showGdzjfptj">工单质检废品统计
-							</el-button>
-							<el-button type="primary" class="bt" icon="plus" @click="handleShowAdd">新增
-							</el-button>
-							<div style="margin-left: auto;">
-								<!-- <el-button
-                  type="primary"
-                  :icon="Download"
-				  class="bt"
-                  @click="exportExcel"
-                >导出到Excel</el-button> -->
-							</div>
-						</div>
+						<el-form>
+							<el-form-item>
+								<el-input v-model="searchInfo" placeholder="输入工单编号"  style="width: 180px;"/>
+								<el-button type="primary" :icon="Search" class="bt" @click="handleSearch"></el-button>
+								<el-button type="primary" class="bt" icon="plus" @click="handleShowAdd">新增</el-button>
+								<el-button type="primary" icon="copy-document" class="bt"@click="dialogMrhjtj = true">每日核检统计</el-button>
+								<el-button type="primary" icon="copy-document" class="bt" @click="showGdzjfptj">工单质检废品统计</el-button>
+								<el-button type="primary" icon="delete" class="bt" @click="handleDelete">删除</el-button>
+							</el-form-item>
+						</el-form>
 						<!-- 数据展示 -->
 						<el-table ref="table" style="width: 100%" :data="tableData" row-key="ID" highlight-current-row
 							border show-overflow-tooltip :row-style="{ height: '20px' }"
 							:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
 							:header-cell-style="{ padding: '0px' }" @row-click="handleSelectChange"
 							@row-dblclick="doubleClick">
-							<el-table-column type="selection" width="55" />
 							<!-- 循环渲染表格列 -->
 							<el-table-column v-for="column in tableColumns" :key="column.prop" :prop="column.prop"
 								:label="column.label" :width="column.width" sortable />
@@ -159,24 +146,24 @@
 											<el-input v-model="row.fp_sl" @keydown="ent1($event)"  @blur="handleFpslEnter($index, row)" />
 										</template>
 									</el-table-column>
-									<el-table-column label="工序及责任机长" width="500">
+									<el-table-column label="工序及责任机长" >
 										<template #default="{ row }">
-											<el-input v-model="row.fp_gxmc" @keydown="ent1($event)" />
+											<el-input v-model="row.fp_gxmc" @keydown="ent1($event)" readonly/>
 										</template>
 									</el-table-column>
 									<el-table-column label="" width="100">
 										<template #default="{ row }">
-											<el-input v-model="row.fp_bz" @keydown="ent1($event)" />
+											<el-input v-model="row.fp_bz" @keydown="ent1($event)" readonly/>
 										</template>
 									</el-table-column>
 									<el-table-column label="" width="100">
 										<template #default="{ row }">
-											<el-input v-model="row.fp_bh" @keydown="ent1($event)" />
+											<el-input v-model="row.fp_bh" @keydown="ent1($event)" readonly/>
 										</template>
 									</el-table-column>
 									<el-table-column label="" width="100">
 										<template #default="{ row }">
-											<el-input v-model="row.fp_name" @keydown="ent1($event)" />
+											<el-input v-model="row.fp_name" @keydown="ent1($event)" readonly/>
 										</template>
 									</el-table-column>
 								</el-table>
@@ -193,9 +180,19 @@
 					</el-dialog>
 
 					<!-- 废品类别弹出选项框 -->
-					<el-dialog v-model="dialogSelectVisible1" title="选择" destroy-on-close width="600px">
-						<el-tree :data="selecTreeData" :props="defaultProps" highlight-current
-							@node-click="handleFplbClick" />
+					<el-dialog v-model="dialogSelectVisible1" id="tableFplb" @keydown="ent($event)"  @opened="focusFirstNode">
+						<el-form>
+							<div>
+								<el-form-item label="废品类别 :" class="mab" prop="keyOrder"></el-form-item>
+								<div style="border:1px solid #eee; width:100%; height: 400px; overflow-y: auto">
+									<el-tree :data="selecTreeData" ref="table_fplb"
+										:props="{ children: 'children',label: 'label'}"
+										node-key="id" @node-click="handleFplbClick">
+									</el-tree>
+								</div>
+							</div>
+						</el-form>
+						
 					</el-dialog>
 
 					<!-- 弹出选项框 数量 -->
@@ -258,7 +255,8 @@
 
 	// 全量引入格式化工具 请按需保留
 	import {
-		ElMessage
+		ElMessage,
+		ElMessageBox,
 	} from 'element-plus'
 	import {
 		Search,
@@ -279,7 +277,8 @@
 		getYjInfo,
 		getWastInfo,
 		updateData,
-		add
+		add,
+		del
 	} from '@/api/mes_api_gty/workOrderVerification'
 	import Meirihejiantongji from '@/view/performance/09-workOrderVerification/componets/meirihejiantongji.vue'
 	import Gongdanzhijianfeipintongji from '@/view/performance/09-workOrderVerification/componets/gongdanzhijianfeipintongji.vue'
@@ -327,131 +326,32 @@
 	const elSearchFormRef = ref()
 
 	// =========== 表格控制部分 ===========
-	const tableColumns = [{
-			label: '工单编号',
-			prop: 'qczl_gdbh',
-			width: '120'
-		},
-		{
-			label: '印件号',
-			prop: 'qczl_yjno',
-			width: '100'
-		},
-		{
-			label: '印件名称',
-			prop: 'Gd_cpmc',
-			width: '400'
-		},
-		{
-			label: '日期',
-			prop: 'qczl_rq',
-			width: '100'
-		},
-		{
-			label: '流程单号',
-			prop: 'qczl_num',
-			width: '120'
-		},
-		{
-			label: '流程单备注',
-			prop: 'qczl_NumDesc',
-			width: '120'
-		},
-		{
-			label: '总废品',
-			prop: 'qczl_fp',
-			width: '100'
-		},
-		{
-			label: '废品1',
-			prop: 'sl_lb1',
-			width: '250'
-		},
-		{
-			label: '废品2',
-			prop: 'sl_lb2',
-			width: '250'
-		},
-		{
-			label: '废品3',
-			prop: 'sl_lb3',
-			width: '250'
-		},
-		{
-			label: '废品4',
-			prop: 'sl_lb4',
-			width: '250'
-		},
-		{
-			label: '废品5',
-			prop: 'sl_lb5',
-			width: '250'
-		},
-		{
-			label: '废品6',
-			prop: 'sl_lb6',
-			width: '250'
-		},
-		{
-			label: '废品7',
-			prop: 'sl_lb7',
-			width: '250'
-		},
-		{
-			label: '废品8',
-			prop: 'sl_lb8',
-			width: '250'
-		},
-		{
-			label: '废品9',
-			prop: 'sl_lb9',
-			width: '250'
-		},
-		{
-			label: '废品10',
-			prop: 'sl_lb10',
-			width: '250'
-		},
-		{
-			label: '废品11',
-			prop: 'sl_lb11',
-			width: '250'
-		},
-		{
-			label: '废品12',
-			prop: 'sl_lb12',
-			width: '250'
-		},
-		{
-			label: '废品13',
-			prop: 'sl_lb13',
-			width: '250'
-		},
-		{
-			label: '废品14',
-			prop: 'sl_lb14',
-			width: '250'
-		},
-		{
-			label: '废品15',
-			prop: 'sl_lb15',
-			width: '250'
-		},
-		{
-			label: '废品16',
-			prop: 'sl_lb16',
-			width: '250'
-		},
-		{
-			label: '废品17',
-			prop: 'sl_lb17',
-			width: '250'
-		},
-		{
-			label: '创建用户',
-			prop: 'sys_id',
-			width: '200'
-		}
+	const tableColumns = [
+		{label: '工单编号',		prop: 'qczl_gdbh',		width: '120'},
+		{label: '印件号',		prop: 'qczl_yjno',		width: '100'},
+		{label: '印件名称',		prop: 'Gd_cpmc',		width: '400'},
+		{label: '日期',			prop: 'qczl_rq',		width: '100'},
+		{label: '流程单号',		prop: 'qczl_num',		width: '120'},
+		{label: '流程单备注',	prop: 'qczl_NumDesc',	width: '120'},
+		{label: '总废品',		prop: 'qczl_fp',		width: '100'},
+		{label: '废品1',		prop: 'sl_lb1',			width: '250'},
+		{label: '废品2',		prop: 'sl_lb2',			width: '250'},
+		{label: '废品3',		prop: 'sl_lb3',			width: '250'},
+		{label: '废品4',		prop: 'sl_lb4',			width: '250'},
+		{label: '废品5',		prop: 'sl_lb5',			width: '250'},
+		{label: '废品6',		prop: 'sl_lb6',			width: '250'},
+		{label: '废品7',		prop: 'sl_lb7',			width: '250'},
+		{label: '废品8',		prop: 'sl_lb8',			width: '250'},
+		{label: '废品9',		prop: 'sl_lb9',			width: '250'},
+		{label: '废品10',		prop: 'sl_lb10',		width: '250'},
+		{label: '废品11',		prop: 'sl_lb11',		width: '250'},
+		{label: '废品12',		prop: 'sl_lb12',		width: '250'},
+		{label: '废品13',		prop: 'sl_lb13',		width: '250'},
+		{label: '废品14',		prop: 'sl_lb14',		width: '250'},
+		{label: '废品15',		prop: 'sl_lb15',		width: '250'},
+		{label: '废品16',		prop: 'sl_lb16',		width: '250'},
+		{label: '废品17',		prop: 'sl_lb17',		width: '250'},
+		{label: '创建用户',		prop: 'sys_id',			width: '200'},
 	]
 	const tableData = reactive([])
 	const total = ref(0)
@@ -600,8 +500,6 @@
 			width: '100'
 		},
 	]
-	let selecTreeData = []
-
 	// 行为控制标记(弹窗内部需要增还是改)
 	const type = ref('')
 
@@ -650,18 +548,18 @@
 					delete detailData[`fp_name${i}`]
 				}
 				detailData.table = table
-				try {
-					const res = await getOrderInfo({
-						order: detailData.qczl_gdbh
-					})
-					if (res.code === 0) {
-						detailData.Gd_cpmc = res.data.Gd_cpmc
-						// dialogFormVisible.value = true	
+				getOrderInfo({ order: detailData.qczl_gdbh }).then(resposne => {
+					if (resposne.code === 0) {
+						//循环resposne.data当子项yj_Yjno的值等于obj中的qczl_yjno的值时设置detailData.Gd_cpmc的值为res.data[i].Gd_cpmc
+						for (let i = 0; i < resposne.data.length; i++) {
+							if (resposne.data[i].yj_Yjno == detailData.qczl_yjno) {
+								detailData.yj_yjmc = resposne.data[i].yj_yjmc
+								detailData.Gd_cpmc = resposne.data[i].Gd_cpmc
+							}
+						}
 						showDialog()
 					}
-				} catch (e) {
-					console.log(e)
-				}
+				})
 			}
 		} catch (e) {
 			console.log(e)
@@ -751,56 +649,79 @@
 		})
 	}
 
+	const selecTreeData = ref([])
+	const table_fplb = ref()
 	// 废品类别回车
-	const handleFplbEnter = async (index, row) => {
-		if(dialogSelectVisible2.value){
-			return
-		}
-		let res
-		try {
-			res = await getWastInfo({ search: row.fp_lb })
-			if (res.code !== 0) {
-				return
-			}
-		} catch (e) {
-			console.log(e)
+	const handleFplbEnter =  async(index, row) => {
+		//上个弹窗还未关闭或者值为空
+		if(dialogSelectVisible2.value || !row.fp_lb){
 			return
 		}
-
-		const obj = res.data
-		const treeData = []
-		for (const category in obj) {
-			if (Object.prototype.hasOwnProperty.call(obj, category)) {
+		let flag = true
+	
+		//查询废品类别
+		const res = await getWastInfo()
+			if (res.code == 0) {
+				const obj = res.data
 				const children = []
-
-				for (const subCategory in obj[category]) {
-					if (Object.prototype.hasOwnProperty.call(obj[category], subCategory)) {
-						const subChildren = obj[category][subCategory].map(item => {
-							return {
-								label: item
+				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++
 					}
 				}
-
-				treeData.push({
-					label: category,
-					children: children
-				})
+				if(!flag){ 
+					return 
+				}
+				//渲染数据
+				selecTreeData.value = children
+				selectIndex = index
+				dialogSelectVisible1.value = true
+				// nextTick(() => {
+				// 	// 手动设置选中节点,如果默认选中不生效,可以使用此方法
+				// 	if (table_fplb.value) {
+				// 		const tree = table_fplb.value?.$el; // 访问组件实例的 $el
+				// 		if (tree) {
+				// 			const node = tree.querySelector('[data-key="0"]');
+				// 			if (node) {
+				// 				node.scrollIntoView();
+				// 				node.focus(); // 尝试聚焦
+				// 				console.log(document.activeElement === node); // 输出检查
+				// 			}
+				// 		}
+						
+				// 	}
+				// });
+				
 			}
-		}
-		selecTreeData = treeData
-		selectIndex = index
-		dialogSelectVisible1.value = true
+		
 	}
 
 	const handleFplbClick = (node, check) => {
-		if (!node.children) {
+		console.log(node, check)
+		if (node.children && node.children.length > 0) {
+			console.log(11);
+		} else {
 			detailData.table[selectIndex].fp_lb = node.label
 			dialogSelectVisible1.value = false
 		}
@@ -812,7 +733,7 @@
 		if(dialogSelectVisible1.value){
 			return
 		}
-		if (row.fp_sl === '0') {
+		if (row.fp_sl == '0' || row.fp_sl == '') {
 			detailData.table[index].fp_gxmc = ''
 			detailData.table[index].fp_bz = ''
 			detailData.table[index].fp_bh = ''
@@ -820,9 +741,19 @@
 			return
 		}
 
+		//计算总数
+		let total = 0;
+		detailData.table.forEach((item, index) => {
+			if(item.fp_sl != 0 || item.fp_sl != ''){
+				total += parseInt(item.fp_sl);
+			}
+		});
+		detailData.qczl_fp = total
+
 		const params = {
 			type: row.fp_lb,
 			order: detailData.qczl_gdbh,
+			yjno: detailData.qczl_yjno,
 		}
 		let res
 		try {
@@ -1110,7 +1041,6 @@
 	const handleShowAdd = async () => {
 		type.value = '新增'
 		if (currentRow.value == undefined) {
-			console.log('123')
 			// 循环13行数据
 			const table = []
 			for (let i = 1; i <= 13; i++) {
@@ -1139,7 +1069,6 @@
 					if (Object.prototype.hasOwnProperty.call(obj, 'qczl_rq') && typeof obj['qczl_rq'] === 'string') {
 						obj['qczl_rq'] = obj['qczl_rq'].split(' ')[0]
 					}
-					obj['total_liucheng'] = ''
 					obj['qczl_num'] = '0'
 					obj['qczl_NumDesc1'] = '0'
 					obj['qczl_NumDesc2'] = '0'
@@ -1203,6 +1132,23 @@
 		// }, 0)
 	}
 
+	//
+	const ent = (event) => {
+		if(document.activeElement.id=='tableFplb'){
+			if (table_fplb.value) {
+				const tree = table_fplb.value?.$el; // 访问组件实例的 $el
+				if (tree) {
+					const node = tree.querySelector('[data-key="0"]');
+					if (node) {
+						node.scrollIntoView();
+						node.focus(); // 尝试聚焦}
+					}
+				}
+				
+			}
+		}
+			
+	}
  const ent1 = (event) => {
    const inputs = document.getElementsByTagName('input');
    const currentIndex = Array.from(inputs).indexOf(event.target);
@@ -1319,6 +1265,43 @@
 	//       break
 	//   }
 	// }
+
+	// 删除
+	const handleDelete = () => {
+		if (currentRow.value == undefined) {
+			ElMessage({
+				type: 'warning',
+				message: '未选中记录',
+			})
+			return
+		}
+		ElMessageBox.confirm(
+				`确认删除这条数据么?`,
+				'警告', {
+					confirmButtonText: '确认',
+					cancelButtonText: '取消',
+					type: 'warning',
+				}
+			).then(() => {
+				del({'UniqId': currentRow.value}).then(res => {
+					if (res.code === 0) {
+						ElMessage({
+							type: 'success',
+							message: '删除成功',
+						})
+						currentRow.value = undefined
+						getSideData()
+						getTableData()
+					}
+				})
+				
+			}).catch(() => {
+				ElMessage({
+					type: 'info',
+					message: '取消删除',
+				})
+			})
+	}
 </script>
 
 <style scoped>
@@ -1327,7 +1310,7 @@
 	}
 
 	.JKWTree-tree {
-		width: 300px;
+		width: 100%;
 		background-color: #fff;
 		padding: 10px;
 		margin-right: 20px;
@@ -1353,4 +1336,7 @@
 	:deep(.el-table__body tr.current-row)>td {
 		background: #ff80ff !important;
 	}
+	.mab {
+		margin-bottom: 5px;
+	}
 </style>

+ 1 - 1
src/view/performance/14-overTimePayVerification/index.vue

@@ -19,7 +19,7 @@
 	  
 	  <layout-sider
 	    :resize-directions="['right']"
-	    :width="220"
+	    :width="180"
 	    style="margin-right: 10px;"
 	  >
 	    <div

+ 6 - 6
src/view/performance/yuangongrigongzi.vue

@@ -3,7 +3,7 @@
     <!-- 左侧树形结构 -->
     <el-container>
       <!-- <el-aside width="250px">
-        <div class="JKWTree-tree">
+        <div class="JKWTree-tree-rgz">
           <h3>包装工序产量维护</h3>
           <el-tree :data="treeData" :props="defaultProps" highlight-current="true"
             @node-click="handleNodeClick"></el-tree>
@@ -12,11 +12,11 @@
 	  
 	  <layout-sider
 	    :resize-directions="['right']"
-	    :width="220"
+	    :width="180"
 	    style="margin-right: 10px;"
 	  >
 	    <div
-	      class="JKWTree-tree"
+	      class="JKWTree-tree-rgz"
 	      style="height: 70vh;"
 	    >
 	      <h3>员工日工资查询</h3>
@@ -892,14 +892,14 @@ onMounted(async () => {
   display: flex;
 }
 
-.JKWTree-tree {
-  width: 300px;
+.JKWTree-tree-rgz {
+  width: 150px;
   background-color: #fff;
   padding: 10px;
   margin-right: 20px;
 }
 
-.JKWTree-tree h3 {
+.JKWTree-tree-rgz h3 {
   font-size: 15px;
   font-weight: 700;
   margin: 10px 0;