Browse Source

09 10新增优化

Lexie 1 year ago
parent
commit
56a12164ea

+ 1 - 0
src/api/mes/job.js

@@ -130,6 +130,7 @@ export const getRewardTabByGd = (params) => {
   })
 }
 
+
 export const getDocumentData = (params) => {
   return service({
     url: '/mes_server/process_document/getData',

+ 2 - 0
src/view/job/rewards/rewards.vue

@@ -1002,7 +1002,9 @@ const handleCurrentChange = (val) => {
 const detailData = reactive({})
 const handleDoubleClick = async(row) => {
   const { UniqId } = row
+  console.log(UniqId)
   const res = await getRewardDetail({ UniqId })
+  console.log(res)
   if (res.code === 0) {
     console.log(res)
     Object.assign(detailData, res.data[0])

+ 41 - 17
src/view/job/sampling/sampling.vue

@@ -208,7 +208,7 @@
           <el-dialog
             v-model="dialogFormVisible"
             :before-close="closeDialog"
-            :title="type==='create'?'添加':'修改'"
+            :title="type"
             destroy-on-close
             width="800"
           >
@@ -228,6 +228,7 @@
                 <el-input
                   v-model="detailData.Sczl_bh"
                   :clearable="true"
+				  @keyup.enter="handleGetYg"
                 />
               </el-form-item>
               <el-form-item prop="image">
@@ -250,11 +251,17 @@
                 label="班组:"
                 prop="address"
               >
-                <el-input
+                <!-- <el-input
                   v-model="detailData.sczl_bzdh"
                   :clearable="true"
                   placeholder="请输入班组"
-                />
+                /> -->
+				<el-select v-model="detailData.sczl_bzdh" placeholder="" style="width: 70px"
+				           
+				>
+				  <el-option label="A班" value="A班"></el-option>
+				  <el-option label="B班" value="B班"></el-option>
+				</el-select>
               </el-form-item>
               <el-form-item
                 label="日期:"
@@ -461,6 +468,7 @@
 <script setup>
 import { getSpotList, getSpotTab, getSpotLocal, getSpotInfo, updateSpotData,add } from '@/api/mes/job'
 import { createCompany, deleteCompany, deleteCompanyByIds, findCompany, updateCompany } from '@/api/company'
+import{getYg}from '@/api/mes_api_gty/myapi'
 // 全量引入格式化工具 请按需保留
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { reactive, ref } from 'vue'
@@ -503,6 +511,16 @@ const formData = ref({
   image: '',
   name: '',
 })
+const handleGetYg = async() => {
+  try {
+    const res = await getYg({ sczl_bh: detailData.Sczl_bh })
+    if (res.code === 0) {
+      detailData.name = res.data.ygxm
+    }
+  } catch (e) {
+    console.log(e)
+  }
+}
 
 // 验证规则
 const rule = reactive({
@@ -539,7 +557,7 @@ const params = {
   search: '',
   type: '',
 }
-
+const minUniqId = ref('')
 // 获取表格数据
 const getTableData = async() => {
   const { date, sys_id } = params
@@ -548,6 +566,7 @@ const getTableData = async() => {
   if (res.code === 0) {
     tableData.splice(0, tableData.length, ...res.data.rows)
     total.value = res.data.total
+	minUniqId.value= Math.min(...tableData.map(row => row.UniqId));
   }
 }
 
@@ -600,20 +619,25 @@ const handlerSearch = () => {
 }
 // 新增数据
 const handleShowAdd = async () => {
-  
-    type.value='add'
-	console.log(currentRow.value)
-   const res = await getSpotInfo({ UniqId:currentRow.value })
-   if (res.code === 0) {
-     Object.assign(detailData, res.data[0])
-     detailData.UniqId = currentRow.value
-     dialogFormVisible.value = true
-   }
+  type.value = '新增';
+  console.log(currentRow.value);
+
+  const res = await getSpotInfo({ UniqId: minUniqId.value });
+
+  if (res.code === 0) {
+	  let sczl_rq = new Date();
+	  sczl_rq.setDate(sczl_rq.getDate() - 0); // 今天的前N天的日期,N自定义
+	  res.data[0].Sczl_rq = `${sczl_rq.getFullYear()}-${sczl_rq.getMonth() + 1}-${sczl_rq.getDate()}`;
+    Object.assign(detailData, res.data[0]);
+    detailData.UniqId = currentRow.value;
+    dialogFormVisible.value = true
+  }
+};
 	// type.value='add'
  //    Object.assign(detailData);
 	// dialogFormVisible.value = true
   
-};
+// };
 // ============== 详情展示 ===============
 const detailData = reactive({})
 
@@ -621,7 +645,7 @@ const detailData = reactive({})
 const getDetailData = async(row) => {
   console.log(row.UniqId)
   const { UniqId } = row
-  type.value='update'
+  type.value='查改'
   const res = await getSpotInfo({ UniqId })
   if (res.code === 0) {
     Object.assign(detailData, res.data[0])
@@ -638,9 +662,9 @@ const handleSelectChange = (row, column, event) => {
 const enterDialog = async() => {
   // const obj = { ...detailData }
    console.log(type.value)
-   if (type.value === 'update') {
+   if (type.value === '查改') {
   	   updateDetailData()
-  	 } else if (type.value === 'add') {
+  	 } else if (type.value === '新增') {
   	   addDetailData()
   	 }else {
 		 console.log(type)

+ 87 - 17
src/view/performance/09-workOrderVerification/index.vue

@@ -106,7 +106,7 @@
           <el-dialog
             v-model="dialogFormVisible"
             :before-close="closeDialog"
-            :title="type === 'create' ? '添加' : '修改'"
+            :title="type"
             destroy-on-close
             width="70%"
             style="position: fixed; top: 35%; left: 50%; transform: translate(-50%, -50%);"
@@ -191,6 +191,7 @@
                 <el-input
                   v-model="detailData.qczl_gxmc"
                   style="width: 200px;"
+				  @keyup.enter.native="getgxsubmit"
                 />
               </el-form-item>
               <el-form-item
@@ -301,8 +302,7 @@
                   >
                     <template #default="{ row }">
                       <el-input
-                        v-model="row.fp_gxmc"
-                        readonly
+                        v-model="row.fp_gxmc"                       
                       />
                     </template>
                   </el-table-column>
@@ -323,8 +323,7 @@
                   >
                     <template #default="{ row }">
                       <el-input
-                        v-model="row.fp_bh"
-                        readonly
+                        v-model="row.fp_bh"                       
                       />
                     </template>
                   </el-table-column>
@@ -339,7 +338,6 @@
                       />
                     </template>
                   </el-table-column>
-
                 </el-table>
 
               </el-scrollbar>
@@ -398,6 +396,39 @@
               />
             </el-table>
           </el-dialog>
+		  
+		  <el-dialog
+		    v-model="GetjtbhVisible"
+		    title="选择"
+		    destroy-on-close
+		    width="600px"
+		  			>
+		    <el-table
+		      tooltip-effect="dark"
+		      :data="JTBHselectData"
+		      row-key="ID"
+		      highlight-current-row="true"
+		      border
+		      style="width:100%"
+		      @row-dblclick="JTBHSelectClick"
+		    >
+		      <el-table-column
+		        prop="gxh"
+		        label="工序号"
+		        width="70"
+		      />
+			  <el-table-column
+				prop="gxmc"
+				label="工序名称"
+				width="150"
+			  />
+			  <el-table-column
+				prop="addGxmc"
+				label="工序名称"
+				width="150"
+			  />
+		    </el-table>
+		  </el-dialog>
 
           <!-- 废品日统计 -->
           <Meirihejiantongji
@@ -440,7 +471,7 @@ import {
 import { ElMessage } from 'element-plus'
 import { Search, Refresh, Download } from '@element-plus/icons-vue'
 import { ref, reactive } from 'vue'
-import { getSide, getTable, getOneWorkOrder, getOrderInfo, getGxAndLeader, getWastInfo, updateData, add } from '@/api/mes_api_gty/workOrderVerification'
+import { getSide, getTable, getOneWorkOrder, getOrderInfo, getGxAndLeader, getYjInfo,getWastInfo, updateData, add } from '@/api/mes_api_gty/workOrderVerification'
 import Meirihejiantongji from '@/view/performance/09-workOrderVerification/componets/meirihejiantongji.vue'
 import Gongdanzhijianfeipintongji from '@/view/performance/09-workOrderVerification/componets/gongdanzhijianfeipintongji.vue'
 import Shebeizhuangtai from '@/view/performance/09-workOrderVerification/componets/shebeizhuangtai.vue'
@@ -506,11 +537,11 @@ const tableColumns = [
   { label: '创建用户', prop: 'sys_id', width: '200' }
 ]
 const tableData = reactive([])
-
+const GetjtbhVisible = ref(false)
 const total = ref(0)
 const page = ref(1)
 const limit = ref(10)
-
+const JTBHselectData = reactive([])
 const searchInfo = ref('')
 const params = {
   date: '',
@@ -519,17 +550,53 @@ const params = {
   page: page.value.toString(),
   limit: limit.value.toString(),
 }
-
+//获取工序
+const getgxsubmit = () => {
+	 GetJtbh()
+}
+const GetJtbh = async () => {
+  try {
+    const response = await getYjInfo({ order: '2312185', yj_no: '1' });
+    if (response.code === 0) {
+      const data = response.data;
+      if (data) {
+        const tableData = data.gx_data.map(item => ({
+          gxh: item.Gy0_gxh,
+          gxmc: item.Gy0_gxmc+'-'+item.Add_gxmc,
+          // addGxmc: item.Add_gxmc
+        }));
+        console.log(tableData);
+        JTBHselectData.splice(0, JTBHselectData.length, ...tableData);
+        GetjtbhVisible.value = true;
+        // Now you can use the tableData to populate your table
+      } else {
+        console.log('No data found');
+      }
+    } else {
+      console.log('Error: ', response.msg);
+    }
+  } catch (error) {
+    console.error('Error fetching data: ', error);
+  }
+};
+const JTBHSelectClick = (row, column, event) => {
+  const { gxh, gxmc } = row
+  detailData.qczl_gxmc=gxh+'-'+gxmc
+  detailData.qczl_gxh=gxh
+  GetjtbhVisible.value = false
+}
 // 批量删除控制标记
 const deleteVisible = ref(false)
 const multipleSelection = ref([])
-
+const minUniqId = ref('')
 const getTableData = async() => {
   const response = await getTable(params)
   if (response.code === 0) {
     total.value = response.data.total
     // Object.assign(tableData, response.data.rows)
+	 
     tableData.splice(0, tableData.length, ...response.data.rows)
+	minUniqId.value= Math.min(...tableData.map(row => row.UniqId));
   }
 }
 
@@ -568,7 +635,8 @@ const handleCurrentChange = () => {
 const detailData = reactive({})
 const selectData = reactive([])
 const selectColumns = [
-  { label: '', prop: 'sczl_gxmc', width: '600' },
+  { label: '', prop: 'sczl_gxmc', width: '500' },
+  { label: '', prop: 'sczl_jtbh', width: '100' },
   { label: '', prop: 'sczl_bzdh', width: '100' },
   { label: '', prop: 'name', width: '100' },
 ]
@@ -729,7 +797,7 @@ const handleFpslEnter = async(index, row) => {
 
 // 双击表格操作
 function doubleClick(row, column, event) {
-  type.value = 'update'
+  type.value = '查改'
   getDetailData(row.UniqId)
 }
 
@@ -746,9 +814,9 @@ const handleSelectClick = (row, column, event) => {
 
 // 弹窗确定
 const enterDialog = async() => {
-  if (type.value === 'update') {
+  if (type.value === '查改') {
 	  updateDetailData()
-  } else if (type.value === 'add') {
+  } else if (type.value === '新增') {
 	  addDetailData()
   }
 }
@@ -904,8 +972,10 @@ const handleSelectChange = (row, column, event) => {
 
 // 新增数据
 const handleShowAdd = async() => {
-  type.value = 'add'
-  getDetailData(currentRow.value)
+  type.value = '新增'
+  // console.log()
+  getDetailData(minUniqId.value)
+  
   // type.value='add'
   //    Object.assign(detailData);
   // dialogFormVisible.value = true

+ 5 - 4
src/view/performance/Manualdocuments.vue

@@ -695,6 +695,7 @@ const handleCurrentChange = (val) => {
    default:
      break
  }
+ console.log(params.type)
 }
 
 const getTableData = async() => {
@@ -713,8 +714,7 @@ const getTableData = async() => {
   
   const response = await getDateList({
     date: params.date, sys_id: params.sys_id,
-    page: page.value.toString(), limit: limit.value.toString(),
-	
+    page: page.value.toString(), limit: limit.value.toString(),	
   })
   if (response.code === 0) {
 	  console.log(response)
@@ -726,6 +726,7 @@ const getTableData = async() => {
       };
     });
     tableData.splice(0, tableData.length, ...processedData);
+	console.log(tableData)
   }
 }
 
@@ -734,9 +735,9 @@ const handleNodeClick = (node,check) => {
    if (node.params) {
     params.date = node.params.date.replace(/\./g, '-');
     params.sys_id = node.params.sys_id;
+    params.type = 'getTableData'
     total.value = node.params.total;
-	   params.type = 'getTableData'
-	    page.value = 1
+    page.value = 1
     getTableData();
   }
 }