liuhairui hai 1 ano
pai
achega
1f807ffdc9

+ 29 - 13
src/view/yunyin/shengchanguanli/components/addGongYi.vue

@@ -128,7 +128,7 @@
           :props="{children: 'children',label: 'label', value: 'value'}"
           style="border: 1px solid #ececec; padding: 10px;height: 400px;overflow: auto;"
           node-key="value"
-          :default-expanded-keys="['编号']"
+          :default-expanded-keys="form['车间名称']"
       >
       </el-tree>
     </el-dialog>
@@ -137,7 +137,8 @@
 
 <script setup>
 import {ref, reactive} from 'vue'
-import {gdzl_MachineList, PrintDetailList, WastageList,getDepartName, capacityList} from "@/api/yunyin/yunying";
+import {gdzl_MachineList, PrintDetailList, WastageList,getDepartName, capacityList,
+} from "@/api/yunyin/yunying";
 
 const form = reactive({})
 const visible = ref(false)
@@ -158,7 +159,7 @@ const cjList = ref([
 const gdzl_MachineList_address = ref()
 
 //新增工艺资料弹窗 键盘 input框跳转
-const add_gyzlent = (event,id1,id2,id3) => {
+const add_gyzlent = async (event,id1,id2,id3) => {
   if (id2==='印件编号' && event.key==='Tab' || id2 === '印件编号' && event.key=== 'Enter') {
     const node = yjList.value.find(item => item.no ===form['yjno'])
     if (! node) {
@@ -170,9 +171,9 @@ const add_gyzlent = (event,id1,id2,id3) => {
     document.getElementById(id3).focus()
     cjdisplay.value = true
   }
-  if (id2 === '工序损耗' && event.key==='Tab' || id2 === '工序损耗' && event.key=== 'Enter') {
-    if(form['车间名称']){
-      gxshList();
+  if (id2 === '工序损耗' && event.key==='Tab' || id2 === '工序损耗' && event.key=== 'Enter' && form['车间名称']) {
+    await getGxshList();
+    if (gxshList.value[0].children.length > 1) {
       gxshdisplay.value = true
     }
   }
@@ -218,14 +219,29 @@ const open = async (gdbh, gxlist) => {
 }
 
 //工序损耗列表
-const gxshList = async ()=>{
+const gxshList = ref([])
+const getGxshList = async ()=>{
   const WastageList_data = await WastageList({search: form['车间名称']})
-  console.log(WastageList_data)
+  gxshList.value = [{
+    label: form['车间名称'],
+    value: form['车间名称'],
+    children: []
+  }]
+  if (WastageList_data.data.length === 0) return
+  if (WastageList_data.data.length > 1) {
+    gxshList.value[0].children = WastageList_data.data.map(item => {
+      return { label: `${item.编号} - ${item.名称}`, label2: item.名称, UniqId: item.UniqId, value: item.编号 }
+    })
+  } else {
+    form['shdh'] = WastageList_data.data[0].编号;
+    form['工序损耗名称'] = WastageList_data.data[0].名称;
+  }
 }
 //点击工序损耗列表数据
 const gxshselectHandle = async (node)=>{
-  console.log(node)
-  console.log(1232131)
+  form['shdh'] = node.value
+  form['工序损耗名称'] = node.label2
+  gxshdisplay.value = false
 }
 const selectHandle = async (node)=>{
   if (node.children && node.children.length> 0) return
@@ -255,10 +271,10 @@ const selectHandle = async (node)=>{
   //通过车间名称查询机台
   const MachineList_jitai = await gdzl_MachineList({address:form['车间名称']});
   gdzl_MachineList_address.value = MachineList_jitai.data;
+  form['shdh'] = ''
+  form['工序损耗名称'] = ''
   //通过车间名称查询工序损耗
-  const WastageList_data = await WastageList({search:form['车间名称']});
-  console.log(WastageList_data.data)
-
+  await getGxshList()
   cjdisplay.value = false
 }
 

+ 27 - 9
src/view/yunyin/shengchanguanli/gongdanziliao.vue

@@ -931,8 +931,8 @@
                 </div>
               </template>
             </el-dialog>
-			
-			
+
+
 			<!-- 新增印件资料 -->
 			          <el-dialog v-model="add_gdyjdialogFormVisible" :before-close="add_gdyjcloseDialog" :title="'新增印件资料'" height="500px" width="800px" destroy-on-close>
 			            <el-row>
@@ -996,7 +996,7 @@
 			                        </el-row>
 			                      </el-form-item>
 			                    </el-col>
-			
+
 			                  </el-row>
 			                  <el-row>
 			                    <el-col :span="8">
@@ -1845,7 +1845,7 @@ const add_gdcloseDialog = () => {
 //获取客户代号,客户名称
 const khdhModal = ref(false)
 const cpdhModal = ref(false)
-const khdhDataList = ref()
+const khdhDataList = ref([])
 const cpdhDataList = ref()
 const khdh_keyword = ref('')
 const cpdh_keyword = ref('')
@@ -1918,8 +1918,17 @@ const selectGongDanNode = (node, type) => {
 //新增工单资料弹窗 键盘 input框跳转
 const add_gdzlent = async (event,id1,id2,id3) => {
   if (id2 === '客户代号' && event.key==='Tab' || id2 === '客户代号' && event.key=== 'Enter') {
-    await _gClientList()
-    khdhModal.value = true
+    await _gClientList(add_gdscgdformData['客户代号'])
+    if (khdhDataList.value != null) {
+      const row = khdhDataList.value.find(item => item.客户编号 === add_gdscgdformData['客户代号'])
+      if (row) {
+        add_gdscgdformData['客户名称'] = row.客户名称
+      } else {
+        khdhModal.value = true
+      }
+    } else {
+      khdhModal.value = true
+    }
   }
   if (id2 === '产品代号' && event.key==='Tab' || id2 === '产品代号' && event.key=== 'Enter') {
     await _ProductCodeList()
@@ -2803,7 +2812,7 @@ const tableRowClick = async (row) => {
 const type = ref('')
 
 //=========表格列表修改========
-let scgdformData = ref([])
+let scgdformData = ref({})
 //双击修改
 const updateCompanyFunc = async(row) => {
   // if(row['status'] === '*'){
@@ -3150,8 +3159,17 @@ const planUsageCellClass = ({row, column, rowIndex, columnIndex}) =>{
 //修改工单资料弹窗 键盘 input框跳转
 const gdzlent =async (event,id1,id2,id3) => {
   if (id2 === '客户代号' && event.key==='Tab') {
-    await _gClientList()
-    khdhModal.value = true
+    await _gClientList(scgdformData.value['客户代号'])
+    if (khdhDataList.value != null) {
+      const row = khdhDataList.value.find(item => item.客户编号 === scgdformData.value['客户代号'])
+      if (row) {
+        scgdformData.value['客户名称'] = row.客户名称
+      } else {
+        khdhModal.value = true
+      }
+    } else {
+      khdhModal.value= true
+    }
   }
   if (id2 === '产品代号' && event.key==='Tab') {
     await _ProductCodeList()