Bläddra i källkod

新增产品资料,部分功能优化

Lexie 1 år sedan
förälder
incheckning
42da025494

+ 8 - 0
src/api/yunyin/yunying.js

@@ -295,6 +295,14 @@ export const ProcessDel = (params) => {
         params
     })
 }
+//3.16新增产品基本资
+export const addProduct = (data) => {
+    return service({
+        url: '/mes_server/Product/addProduct',
+        method: 'post',
+        data
+    })
+}
 /** 生产管理 工单资料管理*/
 // 1.工单资料菜单列表
 export const DataList = (params) => {

+ 99 - 17
src/view/yunyin/chanpinziliao/chanpinziliao.vue

@@ -17,11 +17,11 @@
               <el-button type="primary" class="bt" icon="edit"  @click="fjfpxsClick" >质检废品系数</el-button>
               <el-button type="primary" class="bt" icon="edit"  @click="pccstzClick" >排产参数调整</el-button>
               <el-button type="primary" class="bt" icon="edit"  @click="hscstzClick" >核算参数调整</el-button>
-              <el-button type="primary" class="bt" icon="edit"  @click="addcpyj_onclick" >新增印件资料</el-button>
-              <el-button type="primary" class="bt" icon="edit"  @click="addcpgy_onclick" >新增工艺资料</el-button>
-              <el-button type="primary" class="bt" icon="edit"  @click="addyb_onclick" >新增印版资料</el-button>
-			  <el-button type="primary" class="bt" icon="edit"  @click="DELonclick" >删除印版资料</el-button>
-			  <el-button type="primary" icon="edit"   @click="delgd_delclick"  :disabled="yjSelection === '' && gySelection === ''"  class="bt" title="选择批量删除(印件资料或工艺资料)"  >删除</el-button>
+			  <el-button type="primary" class="bt" icon="edit"  @click="addcp_onclick" >新增产品资料</el-button>
+              <el-button type="primary" class="bt" icon="edit"  @click="addcpyj_onclick" v-if="addyj=== true">新增印件资料</el-button>
+              <el-button type="primary" class="bt" icon="edit"  @click="addcpgy_onclick" v-if="addgy=== true">新增工艺资料</el-button>
+              <el-button type="primary" class="bt" icon="edit"  @click="addyb_onclick" v-if="addyb=== true">新增印版资料</el-button>
+			  <el-button type="primary" icon="edit"   @click="delgd_delclick" v-if="delall=== true" :disabled="yjSelection === '' && gySelection === ''"  class="bt" title="选择批量删除(印件资料或工艺资料)"  >删除</el-button>
 <!--              <el-button type="primary" class="bt" icon="Download" @click="cpexportToExcel" disabled>导出产品资料</el-button>-->
 <!--              <el-button type="primary" class="bt" icon="Download" @click="gyexportToExcel" disabled>导出工艺流程</el-button>-->
             </el-form-item>
@@ -765,16 +765,40 @@
               </el-table>
             </el-tab-pane>
           </el-tabs>
+		  
+		  
+		  <el-dialog
+		    v-model="huanxingVisible"
+		    title="选择客户代号"
+		    destroy-on-close
+		    width="145vh"
+		    style="height: 78vh;"
+		    :before-close="closehuanxingVisible"
+		  >
+		    <div style="display: flex;">
+		      <div style="flex: 0.1;">
+		        <el-aside width="50vh" style="margin: 0;">
+		          <div class="JKWTree-tree" style="height: 50vh; border-right: 1px solid #ebeef5;">
+		            <el-tree :data="treeData" node-key="label" @node-click="treeDataClick" @node-expand="handleNodeExpand">
+		              <template #default="{ node, data }">
+		                {{ node.label }}
+		              </template>
+		            </el-tree>
+		          </div>
+		        </el-aside>
+		      </div>	    
+		    </div>
+		  </el-dialog>
 
           <!-- 修改产品产品基本资料表格弹窗 -->
-          <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="'修改产品基本资料'" height="80%" width="60%" destroy-on-close>
+          <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type === 'create' ? '新增产品资料' : '修改产品资料'" height="80%" width="60%" destroy-on-close>
             <el-row>
               <el-scrollbar>
                 <el-form :model="formDataTest" label-position="right" ref="elFormRef" :rules="rule" label-width="80px">
                   <el-row>
                     <el-col :span="24">
                       <el-form-item label="客户编号:" prop="address" class="mab">
-                        <el-input v-model="formDataTest['客户编号']"  id="id1" placeholder="" @keydown="ent($event, '', 'id1', 'id2')" style="width: 150px;" />
+                        <el-input v-model="formDataTest['客户编号']"  id="id1" placeholder=""  @blur="getCustominfo()"  @keydown="ent($event, '', 'id1', 'id2')" style="width: 150px;" />
                       </el-form-item>
                     </el-col>
                     <el-col :span="24">
@@ -1082,12 +1106,12 @@
           <el-dialog v-model="searchZhiModel" :before-close="() => searchZhiModel = false">
             <el-form>
               <div>
-                <el-form-item label="关键字:"  class="mab" prop="keyOrder">
+                <!-- <el-form-item label="关键字:"  class="mab" prop="keyOrder">
                   <el-space>
                     <el-input v-model="zhi_keyword" style="width: 100%;"/>
                     <el-button @click="searchZhiHandle(zhi_keyword)">刷新</el-button>
                   </el-space>
-                </el-form-item>
+                </el-form-item> -->
                 <div style="border:1px solid #eee; width:100%; height: 400px; overflow-y: auto">
                   <el-tree :data="getProductZhiListdata" :props="{children: 'children',label: 'label', value: '物料代码'}" @node-click="selectZhiNode" />
                 </div>
@@ -1614,7 +1638,8 @@ import {
   annexDel,
   getLossCode,
   PrintlDel,
-  ProcessDel
+  ProcessDel,
+  addProduct
 } from '@/api/yunyin/yunying'
 defineOptions({   name: 'Company'})
 import { useUserStore } from '@/pinia/modules/user'
@@ -2487,6 +2512,8 @@ const handleNodeClick = async (node) => {
   searchInfo.value = '';
   _getProduct()
 };
+
+
 //印件资料
 const yjtableData = reactive([])
 //工艺资料
@@ -2500,6 +2527,10 @@ const _product_code = ref(null)
 //全局调用产品名称
 const _kehu_code = ref(null)
 const _UniqID = ref(null)
+const addgy = ref(false)
+const addyb = ref(false)
+const addyj = ref(false)
+const delall = ref(false)
 //点击表格行 下方表格获取数据
 const tableRowClick = async (row) => {
   _UniqID.value = row.UniqID;
@@ -2522,14 +2553,25 @@ const tableRowClick = async (row) => {
   }
   // console.log(yjzuidahaoma.value)
   // yjzuidahaoma.value = yjtableData.length+1
+  addgy.value=true
+  addyb.value=true
+  addyj.value=true
+  delall.value=true
 };
 const yjSelection = ref('')
 const gySelection = ref('')
 // 印件资料多选、工艺资料多选
 const selectionChange = (selection, type) => {
   const ids = selection.map(item => {
-    return type === '印件资料' ? item.Uniqid: item.UniqId
+	  if(type === '印件资料'){
+		return type === '印件资料' ? item.UniqId: item.UniqId  
+	  }
+	  if(type === '工艺资料'){
+	  return type === '工艺资料' ? item.UniqID: item.UniqID  
+	  }
+    
   })
+  console.log(ids)
   if (type === '印件资料') {
     yjSelection.value = ids.join(',')
   }
@@ -2539,9 +2581,11 @@ const selectionChange = (selection, type) => {
 }
 // ===========删除印件资料、工艺资料 ===========
 const delgd_delclick = async () => {
+  console.log(yjSelection.value)
+  console.log(gySelection.value)
+	  
   if (yjSelection.value !== '') {
-    try {
-		
+    try {	
       const res1 = await PrintlDel({UniqId: yjSelection.value})
       res1.code === 0 && ElMessage.success('印件资料删除成功')
     } catch(err) {
@@ -2549,8 +2593,7 @@ const delgd_delclick = async () => {
     }
   }
   if (gySelection.value !== ''){
-    try {
-		
+    try {		
       const res2 = await ProcessDel({UniqId: gySelection.value})
       res2.code === 0 && ElMessage.success('工艺资料删除成功')
     } catch(err) {
@@ -2559,8 +2602,8 @@ const delgd_delclick = async () => {
   }
 
   const getProductData_data = await getProductData({product_code:_Gd_gdbh.value});
-  yjtableData.value = getProductData_data.data.yjData;
-  gytableData.value = getProductData_data.data.gyData;
+  yjtableData.splice(0, yjtableData.length, ...getProductData_data.data.yjData);
+  gytableData.splice(0, gytableData.length, ...getProductData_data.data.gyData);
 }
 //搜索查询
 const searchInfo = ref('')
@@ -2613,13 +2656,36 @@ const handleSizeChange = (val) => {
 let formDataTest = reactive({})
 //弹窗
 const dialogFormVisible = ref(false)
+const huanxingVisible = ref(false)
+
 //双击修改弹窗
 const dbclickId = ref()
+const type = ref('')
 const updateCompanyFunc = async (row, cols) => {
+   type.value = 'update';
   dbclickId.value = row.UniqID
   formDataTest = Object.assign(formDataTest,row);
   dialogFormVisible.value = true;
 };
+//点击新增产品资料按钮
+const addcp_onclick = () => {
+	type.value = 'create'
+	dialogFormVisible.value = true;
+}
+
+//客户编号失去焦点事件
+const getCustominfo = () => {
+ 	huanxingVisible.value=true
+}
+const treeDataClick = async (node) => {
+  if(node.label === '印刷产品' || node.label === '糊盒产品'){
+    tableData.splice(0);
+    return false;
+  }
+  formDataTest['客户编号']=node.客户编号
+  formDataTest['客户名称']=node.客户名称
+  huanxingVisible.value=false
+};
 //关闭修改弹窗
 const closeDialog = () => {
   dialogFormVisible.value = false
@@ -2638,6 +2704,18 @@ const enterDialog = async () => {
     '成品规格': formDataTest['成品规格'],
     '产品备注': formDataTest['产品备注'],
   };
+  console.log(type.value)
+  if(type.value =='create'){
+  const addProduct = await addProduct(formattedData);
+  if (addProduct.code === 0) {
+    ElMessage({type: 'success',message: '更新成功'})
+  } else {
+    ElMessage({ type: 'error',message: '更新失败'})
+  }
+  formDataTest=[]
+  dialogFormVisible.value = false;
+  _getProduct();
+  }else{
   const editProductedit = await editProduct(formattedData);
   if (editProductedit.code === 0) {
     const row = tableData.find(item => item.UniqID === dbclickId.value)
@@ -2648,7 +2726,11 @@ const enterDialog = async () => {
   } else {
     ElMessage({ type: 'error',message: '更新失败'})
   }
+  formDataTest=[]
   dialogFormVisible.value = false;
+  _getProduct();
+  }
+
 }
 
 //=========修改印件资料========

+ 53 - 25
src/view/yunyin/shengchanguanli/shebeiyunxing.vue

@@ -3388,7 +3388,6 @@ function gytableDatadoubleClick(row, column, event) {
  console.log(row)
  type2.value="update"
  MachineChanliang(row.UniqId)
- 
 }
 const uid=ref()
 function getUid(row, column, event) {
@@ -3421,7 +3420,6 @@ const MachineChanliang = async(value) => {
 	     			 formdata3.value.starttime = date + " 20:30:00"; // 设置为 20:30:00
 	     })
 	 }
-
 	 console.log(formdata3.value)
    }
  }
@@ -3785,32 +3783,61 @@ if(selected.value==='难度调整系数'){
  //核算调整弹窗确定
  const hesuanenterDialog = async () => {
  if(selected.value==='难度调整系数'){
-	const id=ref('')
-	// console.log(multipleSelection.value.length)
-	// console.log(multipleSelection.value[0])
-	for(let i=0;i<multipleSelection.value.length;i++){
-		id.value+=multipleSelection.value[i].UniqId+','
-		console.log(multipleSelection.value[i].UniqId)
-	}
-	const res = await CoefficientEdit({id:id.value,工价系数:hesuanValue.缩放系数 })
-	console.log(res)
-	if(res.code===0){
-		ElMessage({
-		  type: 'success',
-		  message: '成功'
-		})
-		multipleSelection.value='' 
-		multipleTable.clearSelection();
-		console.log(multipleSelection.value)
-		hesuanVisible.value=false
-	}else{
+	try{
+		const id=ref('')
+		// console.log(multipleSelection.value[0])
+		for(let i=0;i<multipleSelection.value.length;i++){
+			id.value+=multipleSelection.value[i].UniqId+','
+			console.log(multipleSelection.value[i].UniqId)
+		}
+		const res = await CoefficientEdit({id:id.value,工价系数:hesuanValue.缩放系数 })
+		console.log(res)
+		if(res.code===0){
+			ElMessage({
+			  type: 'success',
+			  message: '成功'
+			})
+			multipleSelection.value='' 
+			multipleTable.clearSelection();
+			console.log(multipleSelection.value)
+		    hesuanVisible.value=false
+		    FacilitychanLiang()
+		}else{
+			ElMessage({
+			  type: 'error',
+			  message: '失败'
+			})
+		}	
+	}catch(e){
 		ElMessage({
 		  type: 'error',
-		  message: '失败'
+		  message: '请确认是否已选择要修改的内容'
 		})
-	}	
+	}
+	
  }else if(selected.value=== '凹印版距'){
-	 console.log('凹印版距')
+	 const id=ref('')
+	 	  // console.log(multipleSelection.value.length)
+	 	  // console.log(multipleSelection.value[0])
+	 	  for(let i=0;i<multipleSelection.value.length;i++){
+	 	  	id.value+=multipleSelection.value[i].UniqId+','
+	 	  	console.log(multipleSelection.value[i].UniqId)
+	 	  }
+	 	  const res = await PrintingModeDataEdit({id:id.value,plate:hesuanValue.产品板距,mode:hesuanValue.印刷方式 })
+	 	  console.log(res)
+	 	  if(res.code===0){
+	 	  	ElMessage({
+	 	  	  type: 'success',
+	 	  	  message: '成功'
+	 	  	})
+	 	  	hesuanVisible.value=false
+	 		FacilitychanLiang()
+	 	  }else{
+	 	  	ElMessage({
+	 	  	  type: 'error',
+	 	  	  message: '失败'
+	 	  	})
+	 }
  }else if(selected.value=== '色度数'){
 	  const id=ref('')
 	  // console.log(multipleSelection.value.length)
@@ -3819,7 +3846,7 @@ if(selected.value==='难度调整系数'){
 	  	id.value+=multipleSelection.value[i].UniqId+','
 	  	console.log(multipleSelection.value[i].UniqId)
 	  }
-	  const res = await CoefficientEdit({id:id.value,工价系数:hesuanValue.缩放系数 })
+	  const res = await ChromaDataEdit({id:id.value,ms:hesuanValue.色度数 })
 	  console.log(res)
 	  if(res.code===0){
 	  	ElMessage({
@@ -3827,6 +3854,7 @@ if(selected.value==='难度调整系数'){
 	  	  message: '成功'
 	  	})
 	  	hesuanVisible.value=false
+		FacilitychanLiang()
 	  }else{
 	  	ElMessage({
 	  	  type: 'error',