liuhairui 1 năm trước cách đây
mục cha
commit
565a97ca58
1 tập tin đã thay đổi với 129 bổ sung156 xóa
  1. 129 156
      src/view/performance/Packagingoutput.vue

+ 129 - 156
src/view/performance/Packagingoutput.vue

@@ -2,41 +2,28 @@
   <div>
     <!-- 左侧树形结构 -->
     <el-container>
-	  
-	  <layout-sider
-	     :resize-directions="['right']"
-	     :width="220"
-	     style="margin-right: 10px;"
-	   >
-	     <div
-	       class="JKWTree-tree"
-	       style="height: 70vh;"
-	     >
+	  <layout-sider :resize-directions="['right']" :width="220" style="margin-right: 10px;" >
+	     <div class="JKWTree-tree" style="height: 70vh;">
 	       <h3>包装工序产量维护</h3>
-	       <el-tree
-	         :data="treeData"
-	         highlight-current
-	         @node-click="handleNodeClick"
-	       />
+	       <el-tree :data="treeData" highlight-current @node-click="handleNodeClick"/>
 	     </div>
 	   </layout-sider>
-
-      <el-container>
+    <el-container>
+		  
         <el-main>
           <!-- 按钮区域 -->
           <div class="gva-table-box">
             <el-form-item>
-              <el-input v-model="positionvalue"  placeholder="输入工单编号或产品名称" style="width: 180px;" />
+              <el-input v-model="positionvalue" @keydown="keydown_onSearch($event)" placeholder="输入工单编号或产品名称" style="width: 180px;" />
               <el-button type="primary" class="search" icon="search" @click="onSearch"></el-button>
               <el-button type="primary" class="bt" icon="plus" @click="onAdd">新增</el-button>
-              <!-- <el-button type="primary" class="bt" icon="search" @click="positioningVisible">定位</el-button> -->
 			  <el-button type="primary" class="bt" icon="delete" @click="Del">删除</el-button>
               <div style="margin-left: auto;">
                 <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel</el-button>
               </div>
             </el-form-item>
             <!-- 数据展示 -->
-            <el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
+            <el-table ref="multipleTable" style="width: 100%;height: 70vh;" tooltip-effect="dark" :data="tableData" row-key="ID"
               highlight-current-row="true"   border @selection-change="handleSelectionChange" 
 			  :row-style="{ height: '20px' }"  :header-cell-style="{ padding: '0px' }"
 			  :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
@@ -50,8 +37,7 @@
 				  :label="column.label"
 				  :width="column.width"
 				  sortable
-				  show-overflow-tooltip="true"
-				/>
+				  show-overflow-tooltip="true"/>
             </el-table>
             <!-- 分页 -->
             <div class="gva-pagination">
@@ -116,7 +102,7 @@
           </el-dialog>
 
 
-<el-dialog v-model="dialogSelectVisible" title="选择"
+			<el-dialog v-model="dialogSelectVisible" title="选择"
 			  destroy-on-close width="800px" >
 			  <el-table tooltip-effect="dark" :data="selectData" row-key="ID"
 			    highlight-current-row="true" border style="width:100%"
@@ -127,19 +113,14 @@
 			  </el-table>
 			</el-dialog>
 			
-			<el-dialog v-model="getGxMcshow" 
-				:before-close="closegetGxMcshow" title="选择" 
-				destroy-on-close  width="600px" 
-				>
+			<el-dialog v-model="getGxMcshow"  :before-close="closegetGxMcshow" title="工序选择"  destroy-on-close  width="630px" >
 				<el-table tooltip-effect="dark" :data="selectData"
 					row-key="ID" highlight-current-row="true"
 					border style="width:100%"
-					@row-dblclick="handleSelectClick"
-					>
-					<el-table-column prop="jyGx" label="" width="100" />
-					<el-table-column prop="Gd_cpmc" label="" width="460" />
+					@row-dblclick="handleSelectClick">
+					<el-table-column prop="jyGx" label="印件工序" width="100" />
+					<el-table-column prop="Gd_cpmc" label="印件名称"/>
 			   </el-table>
-		
 			<template #footer>
 			  <div class="dialog-footer">
 			    <el-button @click="closegetGxMcshow">取 消</el-button>
@@ -150,22 +131,10 @@
         </el-main>
       </el-container>
     </el-container>
-
   </div>
 </template>
-
 <script setup>
-import {
-  getList,
-  getTab,
-  locate,
-  getInfo,
-  getGxMc,
-  edit,
-  del,
-  packagingAdd
-} from '@/api/jixiaoguanli/jitairibaobiao'
-
+import {getList,getTab,locate,getInfo,getGxMc,edit,del,packagingAdd} from '@/api/jixiaoguanli/jitairibaobiao'
 // 全量引入格式化工具 请按需保留
 import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
 import { ElMessage, ElMessageBox, LAST_KEYS } from 'element-plus'
@@ -176,79 +145,75 @@ import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/w
 import { useUserStore } from '@/pinia/modules/user'
 const userStore = useUserStore() 
 const sys_id='['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
-defineOptions({
-  name: '06-packingDocuments'
-})
+defineOptions({name: '06-packingDocuments'})
 
 // 侧边栏数据请求
 const treeData = reactive([]);
 
 const getTabdata = async () => {
-    //接口调用函数
-    const response  = await getTab();
+	//接口调用函数
+	const response  = await getTab();
 	const transformedData = response.data.map(item => ({
-	      label: `${item.date.replace(/-/g, '.')}【单据数: ${item.counts}张】`,
-	      children: item.sys.map(sysItem => ({
-	        label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
-	        params: {
-	          date: item.date.replace(/\./g, '-'),
-	          sys_id: sysItem.sys_id,
-	          total: sysItem.count,
-	        },
-	      })),
-	    }));
-	    treeData.splice(0, treeData.length, ...transformedData);
-	}
-	
-
+	  label: `${item.date.replace(/-/g, '.')}【单据数: ${item.counts}张】`,
+	  children: item.sys.map(sysItem => ({
+		label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
+		params: {
+		  date: item.date.replace(/\./g, '-'),
+		  sys_id: sysItem.sys_id,
+		  total: sysItem.count,
+		},
+	  })),
+	}));
+	treeData.splice(0, treeData.length, ...transformedData);
+}
 getTabdata();
 
 // 自动化生成的字典(可能为空)以及字段
 const formData = ref({
-		  sczl_rq: '',
-          sczl_gdbh1: '',
-          sczl_gdbh2: '',
-          sczl_gdbh3: '',
-          sczl_gdbh4: '',
-          sczl_gdbh5: '',
-          sczl_gdbh6: '',
-          sczl_yjGx1: '',
-          sczl_yjGx2: '',
-          sczl_yjGx3: '',
-          sczl_yjGx4: '',
-          sczl_yjGx5: '',
-          sczl_yjGx6: '',
-		  sczl_gxmc1: '',
-		  sczl_gxmc2: '',
-		  sczl_gxmc3: '',
-		  sczl_gxmc4: '',
-		  sczl_gxmc5: '',
-		  sczl_gxmc6: '',
-		  Gd_cpmc1: '',
-		  Gd_cpmc2: '',
-		  Gd_cpmc3: '',
-		  Gd_cpmc4: '',
-		  Gd_cpmc5: '',
-		  Gd_cpmc6: '',
-          sczl_cl1: '0.00',
-          sczl_cl2: '0.00',
-          sczl_cl3: '0.00',
-          sczl_cl4: '0.00',
-          sczl_cl5: '0.00',
-          sczl_cl6: '0.00',
-          sczl_PgCl1:'0',
-          sczl_PgCl2: '0',
-          sczl_PgCl3: '0',
-          sczl_PgCl4: '0',
-          sczl_PgCl5: '0',
-          sczl_PgCl6: '0',
-		  sczl_clAdd1: '0',
-		  sczl_clAdd2: '0',
-		  sczl_clAdd3: '0',
-		  sczl_clAdd4: '0',
-		  sczl_clAdd5: '0',
-		  sczl_clAdd6: '0',
-		  UniqId:'000',
+  sczl_rq: '',
+  sczl_gdbh1: '',
+  sczl_gdbh2: '',
+  sczl_gdbh3: '',
+  sczl_gdbh4: '',
+  sczl_gdbh5: '',
+  sczl_gdbh6: '',
+  sczl_yjGx1: '',
+  sczl_yjGx2: '',
+  sczl_yjGx3: '',
+  sczl_yjGx4: '',
+  sczl_yjGx5: '',
+  sczl_yjGx6: '',
+  sczl_gxmc1: '',
+  sczl_gxmc2: '',
+  sczl_gxmc3: '',
+  sczl_gxmc4: '',
+  sczl_gxmc5: '',
+  sczl_gxmc6: '',
+  Gd_cpmc1: '',
+  Gd_cpmc2: '',
+  Gd_cpmc3: '',
+  Gd_cpmc4: '',
+  Gd_cpmc5: '',
+  Gd_cpmc6: '',
+  sczl_cl1: '0.00',
+  sczl_cl2: '0.00',
+  sczl_cl3: '0.00',
+  sczl_cl4: '0.00',
+  sczl_cl5: '0.00',
+  sczl_cl6: '0.00',
+  sczl_PgCl1:'0',
+  sczl_PgCl2: '0',
+  sczl_PgCl3: '0',
+  sczl_PgCl4: '0',
+  sczl_PgCl5: '0',
+  sczl_PgCl6: '0',
+  sczl_clAdd1: '0',
+  sczl_clAdd2: '0',
+  sczl_clAdd3: '0',
+  sczl_clAdd4: '0',
+  sczl_clAdd5: '0',
+  sczl_clAdd6: '0',
+  UniqId:'000',
 })
 const initFormData = () => {
 	formData.value = {
@@ -299,19 +264,14 @@ const initFormData = () => {
 	}
 }
 
-// 验证规则
-const rule = reactive({
-})
 
 const elFormRef = ref()
 const elSearchFormRef = ref()
-
 // =========== 表格控制部分 ===========
 const tableData = reactive([])
 const GxMctableData = reactive([])
-
 const tableColumns = [
-  { label: '创建用户', prop: 'sys_id', width: '120' },
+  { label: '创建用户', prop: 'sys_id', width: '200' },
   { label: '日期', prop: 'sczl_rq', width: '100' },
   { label: '包装产量', prop: 'sczl_cl', width: '105' },
   { label: '包装数量', prop: 'sczl_PgCl', width: '105' },
@@ -320,17 +280,27 @@ const tableColumns = [
   { label: 'UNIQID', prop: 'UniqId', width: '120' },
 ]
 
-const total=ref(0)
-const inputname=ref(0)
-const page = ref(1)
-const limit = ref(10)
-const searchInfo = ref('')
-const params = {
+// 总条数
+const total = ref(0);
+// 当前页码
+const page = ref(1);
+// 每页条数
+const limit = ref(50);
+// 搜索关键字
+const searchInfo = ref('');
+// 查询参数
+const params = ref({
+  // type: 'getTableData', // 默认查询类型
   type: '',
   date: '',
   sys_id: '',
   gdbh: '',
-}
+  limit: limit.value, // 每页条数
+  page: page.value, // 当前页码
+});
+
+const inputname=ref(0)
+
 const locatevalue={
 	gdbh:'',
 	cpmc:'',
@@ -343,28 +313,27 @@ let GxMcvalue=ref()
 
 // 分页设置
 const handleSizeChange = (val) => {
+	params.page = val;
  switch (params.type) {
    case 'getTableData':
      getTableData()
      break
    case 'getLocateTable':
-     GetmachineLocate()
+     Getlocate()
      break
    default:
      break
  }
 }
-
-
-
 // 页面跳转
 const handleCurrentChange = (val) => {
+	params.page = val;
  switch (params.type) {
    case 'getTableData':
      getTableData()
      break
    case 'getLocateTable':
-     GetmachineLocate()
+     Getlocate()
      break
    default:
      break
@@ -373,7 +342,7 @@ const handleCurrentChange = (val) => {
 
 // 查询
 const getTableData = async () => {
-		
+	console.log(params)
   const response = await getList(params);
   if (response.code === 0) {
     tableData.splice(0, tableData.length, ...response.data.rows);
@@ -390,7 +359,6 @@ const handleNodeClick = (node, check) => {
   }
 }
 const Getlocate = async () => {
-
   const response = await locate({
     gdbh: params.gdbh,
     page: page.value.toString(), limit: limit.value.toString(),
@@ -400,17 +368,15 @@ const Getlocate = async () => {
     tableData.splice(0, tableData.length, ...response.data.rows)
   }
 }
-
+//确定
 const enterpositioning = async () => {
- locatevalue.gdbh=positionvalue.value;
-
+ locatevalue.gdbh = positionvalue.value;
  Getlocate()
  closepositioningVisible()
 }
 
 let sczl_rqValue=ref()
 const getpickInfo = async (value) => {
-	
   const response = await getInfo({UniqId:value});
   if (response.code === 0) {
   	formData.value=response.data;
@@ -693,10 +659,7 @@ const GxMcdel = () => {
 	).then(async() => {
 		const response = await del({UniqId:lastCellValue});
 		if (response.code === 0) {
-			ElMessage({
-			  type: 'success',
-			  message: '删除成功',
-			})
+			ElMessage({type: 'success',message: '删除成功',})
 			//刷新侧边栏
 			getTabdata()
 			getTableData()
@@ -705,13 +668,25 @@ const GxMcdel = () => {
   
 }
 
-// 搜索
-function onSearch() {
+//搜索按钮
+const onSearch = async (event) => {
   params.gdbh = positionvalue.value
   params.type = 'getLocateTable'
   page.value = 1
   Getlocate()
 }
+//回车搜索
+const keydown_onSearch = async (event) => {
+	const inputs = document.getElementsByTagName("input");
+	const currentIndex = Array.from(inputs).indexOf(event.target);
+	if(event.keyCode === 13){
+	 params.gdbh = positionvalue.value
+	 params.type = 'getLocateTable'
+	 page.value = 1
+	 Getlocate()
+	}
+}
+
 // ============== 表格控制部分结束 ===============
 
 // 获取需要的字典 可能为空 按需保留
@@ -782,37 +757,31 @@ const updateCompanyFunc = async (row) => {
   }
 }
 
-// 弹窗控制标记
-const positioningVisibleshow = ref(false)
 
-const positioningVisible = () => {
-    type.value = 'create'
-    positioningVisibleshow.value = true
-}
 
-const ADD=ref('0')
 //新增
-function onAdd() {
+const ADD=ref('0')
+const onAdd = async () => {
 	ADD.value='新增'
 	type.value = 'create'
-	// if(typeof(lastCellValue)=='number'){
-	// 	getpickInfo(lastCellValue)
-	// }
 	initFormData()
 	dialogFormVisible.value = true
 	setTimeout(() => {
-		const inputElement = document.getElementById('日期');
-			if (inputElement) {
-				inputElement.focus();		
-			}
-		}, 100);
-	// Productionadd()
+	const inputElement = document.getElementById('日期');
+		if (inputElement) {
+			inputElement.focus();		
+		}
+	}, 100);
 }
 
 const Del = () => {
    GxMcdel()
 }
 
+/*
+	新增弹窗控制标记
+*/
+const positioningVisibleshow = ref(false)
 const closepositioningVisible = () => {
   positioningVisibleshow.value = false
   formData.value = {
@@ -821,7 +790,7 @@ const closepositioningVisible = () => {
     name: '',
   }
 }
-
+// 新增工单弹窗取消
 const closegetGxMcshow = () => {
   getGxMcshow.value = false
 }
@@ -968,4 +937,8 @@ onMounted(async () => {
 .mab{
   margin-bottom: 5px;
 }
+/* tree组件背景高亮 */
+:deep(.el-tree-node:focus > .el-tree-node__content){
+	background: #ff80ff !important;
+}
 </style>