liuhairui 1 год назад
Родитель
Сommit
8543fd18e8
1 измененных файлов с 78 добавлено и 92 удалено
  1. 78 92
      src/view/performance/chukubaogong.vue

+ 78 - 92
src/view/performance/chukubaogong.vue

@@ -7,7 +7,7 @@
 			<el-row :gutter="24" style="margin-bottom: 20px;">
 				<el-input v-model="add_searchInfo" placeholder="扫描订单编号获取订单信息"  @keyup.enter="add_onSubmit"id="searchInput" style="width: 230px;margin: 5px;height: 50px;"></el-input>
 				  <el-button type="primary" icon="search" @click="add_onSubmit" style="margin: 5px;height: 50px;">查询</el-button>
-				  <!-- <el-button type="primary" icon="" @click="Restore_onSubmit" style="margin: 5px;height: 50px;">恢复未出库</el-button> -->
+				  <el-button type="primary" icon="" @click="Restore_onSubmit" style="margin: 5px;height: 50px;">恢复未出库</el-button>
 			</el-row>
 		</div>
       </layout-header>
@@ -15,7 +15,7 @@
         <layout-content >
           <div class="gva-table-box">
            <el-table ref="multipleTable" style="width: 100%;height: 55vh" tooltip-effect="dark"
-                      :row-style="{ height: '20px' }"  :header-cell-style="{ padding: '0px' }"
+                      :row-style="{ height: '40px' }"  :header-cell-style="{ padding: '0px' }"
                       :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                       :data="add_tableData"  border row-key="ID"
                       size="small"  
@@ -23,7 +23,7 @@
                       highlight-current-row="true"  @row-dblclick="add_updateCompanyFunc"
                       @row-click="add_tableRowClick" :show-overflow-tooltip="true"
                       @selection-change="handleSelectionChange">
-			        <el-table-column type="selection" width="80" />
+			        <!-- <el-table-column type="selection" width="80" /> -->
               <el-table-column  sortable  align="left" label="订单编号" prop="订单编号" width="140" />
               <el-table-column  sortable  align="left" label="订单子编号" prop="子订单编号" width="200"/>
               <el-table-column  sortable  align="left" label="生产款号" prop="款号" width="200"/>
@@ -59,12 +59,16 @@ const seconds = String(today.getSeconds()).padStart(2, '0');
 const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
 const currentDates = `${year}-${month}-${day}`;
 
-
-const add_searchInfo = ref('')
-const add_tableData = reactive([])
-
-//searcs = ref(1) 第一次扫代表查数据
+const add_searchInfo = ref('')//搜索
+const add_tableData = reactive([])//表格
+const _orderid = ref('')//订单自编号
 const searcs = ref('')
+
+//表格行点击
+const add_tableRowClick = async (row)=>{
+	console.log(row)
+	_orderid.value = row.子订单编号
+}
 //点击【查询】按钮
 const add_onSubmit = async ()=>{
   if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
@@ -73,42 +77,25 @@ const add_onSubmit = async ()=>{
       ElMessage({type: 'warning',message: '搜索内容不能为空' })
   }else{
 	  if (add_searchInfo.value.includes('-')) {
+		  //默认为空 第一次代表查询,如果搜索有值代表需要出库
 	     if(searcs.value === ''){
-	     		  console.log("查询")
-	     		  const order = add_searchInfo.value;
-	     		  const getSpotLists = await getSpotList({order:order,code:'出库'});
-	     		  console.log(getSpotLists)
-	     		  add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);//表格数据
-	     		  searcs.value = 1;
+			  console.log("查询子订单编号数据")
+			  const order = add_searchInfo.value;
+			  const getSpotLists = await getSpotList({order:order,code:'出库'});
+			  console.log(getSpotLists)
+			  add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
+			  searcs.value = 1;
 	     }else{
-	     		  const order =add_searchInfo.value;
-	     		    console.log('出库')
-	     		    let params = {}
-	     		    params.order_id = add_searchInfo.value;
-	     		    params.code_ck_rq = currentDates;
-	     			console.log(params)
-	     		    const ck_gettab = await getSpotTab(params);
-	     		  if (ck_gettab.code === 0) {
-	     		   searcs.value = '';
-	     		  	ElMessage({type: 'success',message: '出库成功'});
-	     			add_searchInfo.value = ''
-	     		  	const getSpotLists = await getSpotList({order:order,code:'出库'});
-	     		  	console.log(getSpotLists)
-	     		  	add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);//表格数据
-	     		  	
-	     		  }
+			 add_Dialog();
 	     }
 	  } else {
-	      console.log("查询")
+	      console.log("查询订单编号数据")
 	      const order = add_searchInfo.value;
 	      const getSpotLists = await getSpotList({order:order,code:'出库'});
 	      console.log(getSpotLists)
-	      add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);//表格数据
+	      add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
 	      searcs.value = '';
 	  }
-
-	  
-	  
     setTimeout(() => {
         const inputElement = document.querySelector('#searchInput');
         if (inputElement) {
@@ -118,15 +105,26 @@ const add_onSubmit = async ()=>{
   }
 };
 
+//恢复未出库按钮
 const Restore_onSubmit = async ()=>{
-	if(add_searchInfo.value === '' || add_searchInfo.value === null){
-		ElMessage({type: 'warning',message: '请扫描恢复的子订单' })
+	if(_orderid.value === '' || _orderid.value === null){
+		ElMessage({type: 'warning',message: '请点击选择恢复的子订单' })
 	}else{
-		// add_searchInfo.value
+		let params = {}
+		params.order_id = _orderid.value;
+		params.code_ck_rq = currentDates;
+		params.code = '恢复';
+		const ck_gettab = await getSpotTab(params);
+		if (ck_gettab.code === 0) {
+		searcs.value = '';
+		add_searchInfo.value = ''
+		ElMessage({type: 'success',message: '恢复成功'});
+		const getSpotLists = await getSpotList({order:_orderid.value,code:'出库'});
+		add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
+		}
 	}
 }
 
-
 //复选框选择
 const ckSelection = ref('')
 const handleSelectionChange = (selection, type) => {
@@ -139,24 +137,46 @@ const handleSelectionChange = (selection, type) => {
 
 //确认出库按钮
 const add_Dialog = async ()=>{
-  if(ckSelection.value === ''){
-    ElMessage({type: 'warning',message: '请勾选出库订单后,再操作此功能'})
-  }else{
-    //复选框中子订单编号去重
-    let params = {}
-    params.order_id = ckSelection.value;
-    params.code_ck_rq = currentDates;
-    console.log(params)
-    const ck_gettab = await getSpotTab(params);
-    if (ck_gettab.code === 0) {
-      ElMessage({type: 'success',message: '出库成功'});
-        // const getSpotToLists = await getSpotToList();
-        // add_tableData.splice(0,add_tableData.length,...getSpotToLists.data.data);//表格数据
-        add_searchInfo.value = ''
-    } else {
-      ElMessage({ type: 'error',message: '出库失败'})
-    }
-  }
+	console.log(add_tableData[0]['子订单编号'])
+	if (add_tableData[0]['子订单编号'] === add_searchInfo.value) {
+		let params = {}
+		params.order_id = add_tableData[0]['子订单编号'];
+		params.code_ck_rq = currentDates;
+		const ck_gettab = await getSpotTab(params);
+	  if (ck_gettab.code === 0) {
+	   searcs.value = '';
+		ElMessage({type: 'success',message: '出库成功'});
+		add_searchInfo.value = ''
+		const getSpotLists = await getSpotList({order:add_tableData[0]['子订单编号'],code:'出库'});
+		console.log(getSpotLists)
+		add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
+	  }
+	} else {
+		const order = add_searchInfo.value;
+		const getSpotLists = await getSpotList({order:order,code:'出库'});
+		add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
+		// if(ckSelection.value === ''){
+		// if(_orderid.value === ''){
+		//   ElMessage({type: 'warning',message: '请勾选出库订单后,再操作此功能'})
+		// }else{
+		  //复选框中子订单编号去重
+		 //  let params = {}
+		 //  // params.order_id = ckSelection.value;//复选框数据
+			// params.order_id = _orderid.value;//表格行点击数据
+		 //    params.code_ck_rq = currentDates;//日期
+			// //调用出库修改接口
+		 //  const ck_gettab = await getSpotTab(params);
+		 //  if (ck_gettab.code === 0) {
+			// 	  add_searchInfo.value = ''
+			// 	  ElMessage({type: 'success',message: '出库成功'});
+			// 	  //调用查询出库数据
+			// 	  const getSpotLists = await getSpotList({order:_orderid.value,code:'出库'});
+			// 	  add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
+		 //  } else {
+		 //    ElMessage({ type: 'error',message: '出库失败'})
+		 //  }
+		// }
+	}
 }
 
 // =========== 分页 ===========
@@ -188,29 +208,25 @@ const tableDataCellClass = ({row, column, rowIndex, columnIndex}) =>{
 }
 </script>
 <style scoped>
-
+/* 根据出库状态文字颜色 */
 :deep(.status-plan-usage-low div) {
   color: #8c939d  !important;
 }
 :deep(.statusy-plan-usage-low div) {
   color: blue !important;
 }
-	
 .form-container {
   display: flex;
   flex-wrap: wrap;
 }
-
 .form-column {
   /*flex: 1;*/
   margin-right: 15px; /* 调整列之间的间距 */
 }
-
 /* 左侧输入框宽度调整 */
 .form-column .el-form-item .el-input {
   width: 150px; /* 调整左侧输入框的宽度 */
 }
-
 /* 媒体查询,根据需要调整断点 */
 @media screen and (max-width: 768px) {
   .form-column {
@@ -218,9 +234,6 @@ const tableDataCellClass = ({row, column, rowIndex, columnIndex}) =>{
     margin-right: 0;
   }
 }
-/*:deep(.el-table td .cell) {*/
-/*  line-height: 30px !important;*/
-/*}*/
 .JKWTree-container {
   display: flex;
 }
@@ -238,32 +251,6 @@ const tableDataCellClass = ({row, column, rowIndex, columnIndex}) =>{
 .JKWTree-content {
   flex: 1;
 }
-/* 图片上传 */
-.upload-box {
-  width: 200px;
-  height: 200px;
-  border: 2px dashed #e2e2e2;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  position: relative;
-  cursor: pointer;
-}
-.uploaded-image {
-  width: 100%;
-  height: 100%;
-  object-fit: cover;
-}
-.upload-icon {
-  font-size: 40px;
-  color: #c0c4cc;
-}
-.file-input {
-  display: none;
-}
-.el-table .warning-row {
-  background: oldlace;
-}
 /* 表格复选框大小调整 */
 :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
     width: 45px; /* 复选框宽度 */
@@ -276,7 +263,6 @@ const tableDataCellClass = ({row, column, rowIndex, columnIndex}) =>{
     width: 5px; /* 调整对勾宽度 */
     height: 9px; /* 调整对勾高度 */
 }
-
 /* 选中某行时的背景色 */
 :deep(.el-table__body tr.current-row) > td {
   background: #ff80ff !important;