zck 1 year ago
parent
commit
c95163faef

+ 10 - 0
src/api/jixiaoguanli/jitairibaobiao.js

@@ -412,6 +412,16 @@ export const  productionDedh= (params) => {
     params
   })
 }
+
+//获取检品机定额代号
+export const  JPproductionDedh= (params) => {
+  return service({
+    url:'	/mes_server/machine_production_report/JPgetDedh',
+    method: 'get',
+    params
+  })
+}
+
 //修改
 export const  productionedit= (params) => {
   return service({

+ 10 - 2
src/view/performance/12-orderAccounting/index.vue

@@ -365,7 +365,6 @@ watch(currentRow, (value, oldValue, onCleanup) => {
 const cjsriqi = ref ('')
 // 显示上方表格
 const handleNodeClick = async(node) => {
-  // console.log(node.date)
   cjsriqi.value = node.date
   console.log(cjsriqi.value)
   if (!node.children) {
@@ -381,7 +380,16 @@ const handleNodeClick = async(node) => {
     }))
     // console.log(tableData1.value )
   } else {
-    // console.log(node.date, node.code)
+    const { date, code } = node
+    const res = await getTable({ date, code:'', limit: 9999, page: 1 })
+    tableData1.value = res.data.data.map((item) => ({
+      ...item,
+      csgd:
+        parseFloat(item['target_rate']) - parseFloat(item['real_rate']) > 0
+          ? '√'
+          : '',
+      date: date,
+    }))
   }
 }
 

+ 74 - 67
src/view/performance/Dayreports.vue

@@ -1039,6 +1039,7 @@ import {
   productionYjmc,
   productionGx,
   productionDedh,
+  JPproductionDedh,
   productionedit,
   productiondel,
   getYg,
@@ -1908,73 +1909,79 @@ const table_fplb = ref(null); // el-tree 的 ref
 const defaultExpandedKey = ref(null); // 默认展开的节点 key
 const selectIndex = ref(0); // 当前选中的索引
 
-const getDedhsubmit = async () => {
-  try {
-    const response = await productionDedh({
-      sczl_jtbh: formData.value.sczl_jtbh, // 请求参数
-    });
-
-    if (response.code === 0) {
-      const data = response.data;
-
-      // 处理单条记录的情况,直接赋值
-      if (!Array.isArray(data) && !data.bh_mc) {
-        formData.value.sczl_dedh = data.sys_bh;
-        return;
-      }
-
-      // 定义递归函数,用于构造树形结构
-      const buildTree = (node) => {
-        const treeNode = {
-          id: node.sys_bh,
-          label: node.sys_bh + (node.sys_mc ? `【${node.sys_mc}】` : ""), // 显示内容
-          children: [],
-          key: node.Key_ || node.sys_bh, // 保留 key 属性,用于操作
-        };
-
-        // 如果有子节点,递归处理
-        if (node.bh_mc && Array.isArray(node.bh_mc)) {
-          treeNode.children = node.bh_mc.map((childNode) => buildTree(childNode));
-        }
-
-        return treeNode;
-      };
-
-      // 处理数组数据结构,生成树形结构并展示弹窗
-      if (Array.isArray(data)) {
-        GetDedhtreeData.splice(
-          0,
-          GetDedhtreeData.length,
-          ...data.map((item) => ({
-            id: item.sys_bh,
-            label: item.sys_bh,
-            children: [],
-            key: item.sys_bh,
-          }))
-        );
-        GetDedhVisible.value = true; // 展示弹窗
-      }
-
-      // 处理嵌套的树形结构数据
-      if (!Array.isArray(data) && data.bh_mc) {
-        GetDedhtreeData.splice(0, GetDedhtreeData.length, buildTree(data));
-        GetDedhVisible.value = true; // 展示弹窗
-      }
-
-      // 使用 nextTick 确保树形组件渲染完成后执行操作
-      nextTick(() => {
-        const tree = table_fplb.value; // 获取树形组件实例
-        if (tree) {
-          const firstNode = tree.getNode(0); // 获取树形的第一个节点
-          if (firstNode) {
-            firstNode.el.focus(); // 聚焦到第一个节点
-          }
-        }
-      });
-    }
-  } catch (error) {
-    console.error("获取数据失败:", error);
-  }
+const getDedhsubmit = async () => {
+  try {
+    let res = reactive([]);
+    if (formData.value.sczl_jtbh.includes('JP')){
+      const response = await JPproductionDedh({sczl_jtbh: formData.value.sczl_jtbh, });// 请求参数
+      res = response
+    }else {
+      const response = await productionDedh({sczl_jtbh: formData.value.sczl_jtbh,});	//请求参数
+      res = response
+    }
+console.log(res)
+
+    if (res.code === 0) {
+      const data = res.data;
+
+      // 处理单条记录的情况,直接赋值
+      if (!Array.isArray(data) && !data.bh_mc) {
+        formData.value.sczl_dedh = data.sys_bh;
+        return;
+      }
+
+      // 定义递归函数,用于构造树形结构
+      const buildTree = (node) => {
+        const treeNode = {
+          id: node.sys_bh,
+          label: node.sys_bh + (node.sys_mc ? `【${node.sys_mc}】` : ""), // 显示内容
+          children: [],
+          key: node.Key_ || node.sys_bh, // 保留 key 属性,用于操作
+        };
+
+        // 如果有子节点,递归处理
+        if (node.bh_mc && Array.isArray(node.bh_mc)) {
+          treeNode.children = node.bh_mc.map((childNode) => buildTree(childNode));
+        }
+
+        return treeNode;
+      };
+
+      // 处理数组数据结构,生成树形结构并展示弹窗
+      if (Array.isArray(data)) {
+        GetDedhtreeData.splice(
+          0,
+          GetDedhtreeData.length,
+          ...data.map((item) => ({
+            id: item.sys_bh,
+            label: item.sys_bh,
+            children: [],
+            key: item.sys_bh,
+          }))
+        );
+        GetDedhVisible.value = true; // 展示弹窗
+      }
+
+      // 处理嵌套的树形结构数据
+      if (!Array.isArray(data) && data.bh_mc) {
+        GetDedhtreeData.splice(0, GetDedhtreeData.length, buildTree(data));
+        GetDedhVisible.value = true; // 展示弹窗
+      }
+
+      // 使用 nextTick 确保树形组件渲染完成后执行操作
+      nextTick(() => {
+        const tree = table_fplb.value; // 获取树形组件实例
+        if (tree) {
+          const firstNode = tree.getNode(0); // 获取树形的第一个节点
+          if (firstNode) {
+            firstNode.el.focus(); // 聚焦到第一个节点
+          }
+        }
+      });
+    }
+  } catch (error) {
+    console.error("获取数据失败:", error);
+  }
 };	
 
 //键盘事件

+ 3 - 2
src/view/yunyin/shengchanguanli/shebeiyunxing.vue

@@ -2451,6 +2451,7 @@ import {
    dailysearch,
    dailygetGzByYgbh,
    productionDedh,
+   JPproductionDedh,
    YieldTeamEdit,
    getTimelist,
    JPmachineDetail,
@@ -6898,7 +6899,7 @@ const GetDedhVisible = ref(false);
 const table_fplb = ref(null); // el-tree 的 ref
 const getDedhsubmit = async () => {
 try {
-    const response = await productionDedh({
+    const response = await JPproductionDedh({
       sczl_jtbh: JPformdata['机器'], // 请求参数
     });
 
@@ -7073,7 +7074,7 @@ const table_fplbedit = ref(null); // el-tree 的 ref
 	
 const getDedhsubmitedit = async () => {
 	try {
-    const response = await productionDedh({
+    const response = await JPproductionDedh({
       sczl_jtbh: JPformdataedit['机器'], // 请求参数
     });