zck 9 months ago
parent
commit
6207f2bfce

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

@@ -681,7 +681,24 @@ export const getPPCode = (params) => {
   }) 
 }
 
-//印版管理->印版资料删除
+//印版管理->印版领用下方工单领用详情
+export const getPPReceive = (params) => {
+  return service({
+    url: '/mes_server/Printing_Plate/PrintDetailReceive',
+    method: 'get',
+    params
+  }) 
+}
+
+//印版管理->印版领用记录删除
+export const getPPDelete = (params) => {
+  return service({
+    url: '/mes_server/Printing_Plate/PrintReceiveDelete',
+    method: 'get',
+    params
+  }) 
+}
+
 
 //电化铝领用记录->左侧菜单
 export const getAETab = (params) => {

+ 157 - 11
src/view/managements/hardversionlibrary.vue

@@ -9,8 +9,8 @@
                 <el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px"></el-input>
                 <el-button type="primary" class="bt" icon="search" @click="on_search">查询</el-button>
                 <el-button type="primary" class="bt" icon="edit" @click="onADD">添加</el-button>
-                <el-button type="primary" class="bt" icon="delete" @click="on_delete">删除</el-button>
-                <el-button type="primary" class="bt" icon="download" @click="ToExcel" >导出到Excel</el-button>
+                <el-button type="primary" class="bt" icon="delete" :disabled="!selectedIds" @click="on_delete">删除</el-button>
+                <el-button type="primary" class="bt" icon="download"  @click="ToExcel" >导出到Excel</el-button>
               </el-form-item>
             </el-form>
   
@@ -39,10 +39,11 @@
                         :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                         :data="wltableData"  border row-key="ID"
                         size="small" v-if="!showKH"
-                        :cell-class-name="gxbgCellClass"
+                        :cell-class-name="gxbgCellClass" id="wltable"
                         highlight-current-row="true" @row-dblclick="updateCompanyFunc"
                         @row-click="tableRowClick" :show-overflow-tooltip="true"
-                        @selection-change="handleSelectionChange">
+                        >
+               
                <el-table-column  sortable align="center" label="存货编码" prop="存货编码"  width="120" />
                <el-table-column  sortable align="center" label="物料名称" prop="物料名称"  width="120" />
                <el-table-column   align="center" label="印版名称" prop="印版名称"  width="200" />
@@ -70,12 +71,13 @@
               <el-table ref="multipleTable" style="width: 100%;height: 45vh" tooltip-effect="dark"
                         :row-style="{ height: '25px' }"  :header-cell-style="{ padding: '0px' }"
                         :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
-                        :data="mxtableData"  border row-key="ID"
+                        :data="wlmxtableData"  border row-key="ID"
                         size="small" v-if="!showKH"
                         :cell-class-name="gxbgCellClass"
                         highlight-current-row="true" @row-dblclick="updateCompanyFunc2"
-                        @row-click="tableRowClick" :show-overflow-tooltip="true"
-                        @selection-change="handleSelectionChange">
+                        @row-click="tableRowClick2" :show-overflow-tooltip="true"
+                        @selection-change="wlmxSelectionChange">
+               <el-table-column type="selection" width="30" />
                <el-table-column  sortable align="center" label="领用机台" prop="领用机台"  width="120" />
                <el-table-column  sortable align="center" label="领用日期" prop="领用日期"  width="120" />
                <el-table-column  sortable align="center" label="退还日期" prop="退还日期"  width="200" />
@@ -102,7 +104,7 @@
                         size="small" v-if="showKH"
                         :cell-class-name="gxbgCellClass"
                         highlight-current-row="true" 
-                        @row-click="tableRowClick" :show-overflow-tooltip="true"
+                        @row-click="tableRowClick3" :show-overflow-tooltip="true"
                         @selection-change="handleSelectionChange">
                <el-table-column  sortable align="center" label="产品编号" prop="产品编号"  width="120" />
                <el-table-column  sortable align="center" label="产品名称" prop="产品名称"  width="120" />
@@ -155,7 +157,7 @@
                 <el-row :gutter="20">
                 <el-col :span="18">
                     <el-form-item label="印版备注">
-                    <el-input v-model="Plate.印版备注" readonly  />
+                    <el-input v-model="Plate.印版备注"   />
                     </el-form-item>
                 </el-col>
                 </el-row>
@@ -288,8 +290,8 @@
   import dayjs, { Dayjs } from 'dayjs';
   import { exportExcelFile } from '@/utils/excel'
   import { useUserStore } from '@/pinia/modules/user'
-  import {ElMessage} from "element-plus";
-  import {getPPTab,getPPList,getPPEdit,getPPDetail,getPPCode,} from "@/api/mes/job.js"
+  import {ElMessage,ElMessageBox} from "element-plus";
+  import {getPPTab,getPPList,getPPEdit,getPPDetail,getPPCode,getPPReceive,getPPDelete} from "@/api/mes/job.js"
   const userStore = useUserStore()
   const sys_id='['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
   defineOptions({name: 'Company'})
@@ -336,14 +338,35 @@ const transformData = (data) => {
   
   const showKH = ref(false)
   const wltableData = ref([])
+  const nodecode = ref('')
   const handleNodeClick = async (node) => {
     console.log(node) 
     if(!node.children){
+      nodecode.value = node.label.split(' ')[0]
       showKH.value = node.code === '客户产品印版库'?true:false;
       const res = await getPPList({code:node.label.split(' ')[0]})
       wltableData.value = res.data
     }
   }
+
+  const searchInfo = ref('')
+  const on_search = async () => {
+    const res = await getPPList({code:nodecode.value,search:searchInfo.value})
+    if (res.code === 0) {
+      wltableData.value = res.data 
+    }else{
+      ElMessage.error('未搜索到数据') 
+    }
+  }
+
+  const wlmxtableData = ref([])
+  const tableRowClick = async (row) => {
+    console.log(row)
+    const res = await getPPReceive({ code: row.存货编码,batch:row.供方批号})
+    if (res.code === 0) {
+      wlmxtableData.value = res.data 
+    }
+  }
   
     //新增
   const Plate = reactive({ 
@@ -566,7 +589,130 @@ const dhlcloseDialog = async () => {
   console.log('关闭')
   dialogPlateVisible.value = false
 }
+
+
+const selectedIds = ref('')
+
+// 维修表格选择变化
+const wlmxSelectionChange = (selection) => {
+  console.log('维修表格选择变化:', selection)
+  selectedIds.value = selection.map(item => item.UniqID).join(',')
+  console.log('选中的ID:', selectedIds.value)
+}
+
+// 删除操作
+const on_delete = async () => {
+  if (!selectedIds.value.length) {
+    ElMessage.warning('请先选择要删除的记录')
+    return
+  }
+
+  try {
+    await ElMessageBox.confirm('确定要删除选中的记录吗?', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    })
+    
+    // 调用删除API,假设是批量删除接口
+    const res = await getPPDelete({ id: selectedIds.value,})
+    
+    if (res.code === 0) {
+      ElMessage.success('删除成功')
+      // 删除成功后刷新表格数据
+      // 清空选中
+      selectedIds.value = []
+    } else {
+      ElMessage.error(res.msg || '删除失败')
+    }
+  } catch (error) {
+    if (error !== 'cancel') {
+      console.error('删除失败:', error)
+      ElMessage.error('删除操作已取消')
+    }
+  }
+}
+
+
+const ToExcel = () => {
+  if(showKH.value === false){
+    console.log('导出版材')
+    const el = document.getElementById('wltable');
+  const filename = '版材库导出.xlsx';
   
+  // 1. 获取原始表格数据
+  const wb = XLSX.utils.table_to_book(el, { raw: true });
+  const ws = wb.Sheets[wb.SheetNames[0]];
+
+  // 2. 定义需要转换为数字的列(基于原始列字母)
+  const originalNumberColumns = {
+    'G': 0,
+    'H': 0,
+    'I': 0, 
+  };
+
+  // 3. 创建新工作表(左移后的数据)
+  const newWs = {};
+  const range = XLSX.utils.decode_range(ws['!ref']);
+
+  // 调整列范围(删除A列)
+  range.s.c = 0;  // 从A列开始(原B列)
+  range.e.c -= 1; // 结束列减1
+  newWs['!ref'] = XLSX.utils.encode_range(range);
+
+  // 复制其他工作表属性(排除A列)
+  if (ws['!cols']) newWs['!cols'] = ws['!cols'].slice(1);
+  if (ws['!rows']) newWs['!rows'] = ws['!rows'];
+  if (ws['!merges']) newWs['!merges'] = ws['!merges'];
+
+  // 4. 左移所有列数据(A列→删除,B列→A列,C列→B列...)
+  Object.keys(ws).forEach(address => {
+    if (!address.startsWith('!')) {
+      const col = address.charAt(0);
+      const row = address.slice(1);
+
+      if (col !== 'A') { // 跳过A列
+        // 计算新列字母(左移一列)
+        const newCol = String.fromCharCode(col.charCodeAt(0) - 1);
+        const newAddress = newCol + row;
+        
+        // 复制单元格数据
+        newWs[newAddress] = { ...ws[address] };
+      }
+    }
+  });
+
+  // 5. 转换数字格式(基于左移后的列字母)
+  Object.keys(newWs).forEach(address => {
+    const col = address.charAt(0);
+    const originalCol = String.fromCharCode(col.charCodeAt(0));
+
+    if (originalNumberColumns[originalCol] !== undefined) {
+      const cell = newWs[address];
+      const num = parseFloat(cell.v);
+      
+      if (!isNaN(num)) {
+        cell.t = 'n';
+        cell.v = num;
+        cell.z = originalNumberColumns[originalCol] === 0 
+          ? '0' 
+          : `0.${'0'.repeat(originalNumberColumns[originalCol])}`;
+      }
+    }
+  });
+
+  // 6. 更新工作簿并导出
+  wb.Sheets[wb.SheetNames[0]] = newWs;
+  const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
+
+  try {
+    FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
+  } catch (e) {
+    console.error('导出失败:', e);
+  }
+  return wbout;
+  }
+}
   
   </script>
   

+ 7 - 53
src/view/yunyin/chanpinziliao/chanpinziliao.vue

@@ -74,13 +74,6 @@
             <el-form-item label="目标产品代号:" prop="process" class="mab">
               <el-input v-model="cpgyfzformData['mubprocess']" id="mubprocess" @keydown="add_cpgyfzent($event, 'gongyifa', 'mubprocess', 'mubprocessName')"   style="width: 160px;"/>
               <el-input disabled v-model="cpgyfzformData['mubprocessName']" id="mubprocessName" @keydown="add_cpgyfzent($event, 'mubprocess', 'mubprocessName', 'fzgyzl')"  style="width: 360px;"/>
-              <div v-if="yjOptions.length > 0" class="yj-checkbox-group">
-                <el-checkbox-group v-model="selectedYjList" @change="handleYjChange">
-                  <el-checkbox v-for="option in yjOptions" :key="option" :label="option">
-                    {{ option }}
-                  </el-checkbox>
-                </el-checkbox-group>
-              </div>
             </el-form-item>
 <!--            cpgyfzformData.fzgyzl === true-->
             <el-form-item label="" class="mab" >
@@ -1563,7 +1556,7 @@ export default {
 import { ElMessage, ElMessageBox } from 'element-plus'
 //拖拽 import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
 import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
-import { ref, reactive, nextTick,watch } from 'vue'
+import { ref, reactive, nextTick, } from 'vue'
 import {
   DataList,
   ProductDetailData,
@@ -1610,8 +1603,8 @@ import {
   gdzl_MachineList,
   ProductYgSort
 } from '@/api/yunyin/yunying'
-import { useUserStore } from '@/pinia/modules/user'
 defineOptions({   name: 'Company'})
+import { useUserStore } from '@/pinia/modules/user'
 const userStore = useUserStore()
 const _username = ref('')
 _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
@@ -1946,13 +1939,6 @@ const cpgyfzclick = async () => {
 };
 //取消
 const cpgyfzhandleCancel = async () => {
-  cpgyfzformData['fzgyzl'] = true;
-  cpgyfzformData['xzgyzl'] = false;
-  cpgyfzformData['fzybzl'] = false;
-  cpgyfzformData['fzyjzl'] = false;
-  cpgyfzformData['xzgyzl'] = false;
-  cpgyfzformData['to_pro'] = '';
-  selectedYjList.value = [yjOptions.value[0]];
   cpgyfzlist.value = false;
 };
 //确定
@@ -1992,19 +1978,18 @@ const cpgyfzhandleConfirm = async () => {
     clickedlist.value = true;
     return false;
   }
-    if (cpgyfzformData['fzgyzl'] === true && cpgyfzformData['fzybzl'] === false && cpgyfzformData['fzyjzl'] === false) {
+    // 其他验证逻辑(如目标工艺方案是否为空等)
     if (cpgyfzformData['to_pro'] === '') {
       ElMessage({ type: 'warning', message: '目标工艺方案不能为空' });
       clickedlist.value = true;
       return false;
     }
-  }
 
   // 检查是否选择了复制印件资料
   if (cpgyfzformData['fzyjzl'] === true) {
     console.log('判断印件号是否重复')
     // 获取两个印件号的数组
-    const sourceYjNos = selectYJNO.value.split(',').filter(Boolean); 
+    const sourceYjNos = _yjno.value.split(',').filter(Boolean); 
     const targetYjNos = copy_yjno.value.split(',').filter(Boolean); 
     console.log('原印件号:', sourceYjNos);
     console.log('目标印件号:', targetYjNos);
@@ -2103,9 +2088,7 @@ const proceedWithCopy = async () => {
   cpgyfzformData['xzgyzl'] = false;
   cpgyfzformData['fzybzl'] = false;
   cpgyfzformData['fzyjzl'] = false;
-  cpgyfzformData['xzgyzl'] = false;
   cpgyfzformData['to_pro'] = '';
-  selectedYjList.value = [yjOptions.value[0]];
   cpgyfzlist.value = false;
 };
 
@@ -2151,8 +2134,6 @@ const _ProductCodeList = async (v = '')=>{
   }
 }
 const copy_yjno = ref('')//保存目标印件号
-const yjOptions = ref([]); // 可选项 ["1", "2", "3", "4", "5"]
-const selectedYjList = ref([]); // 当前选中的值,如 ["1", "3"]
 const add_cpgyfzent = async (event,id1,id2,id3) => {
   if (id2 === 'mubprocess' &&  event.key==='Tab' || id2 === 'mubprocess' && event.key=== 'Enter') {
     // cpgyfz_keyword.value = '';
@@ -2197,10 +2178,6 @@ const add_cpgyfzent = async (event,id1,id2,id3) => {
   }
 }
 
-
-
-
-
 // =========== 工艺方案更名 ===========
 const gygmlist = ref(false);
 const _gygmstacode = ref(null);
@@ -2663,7 +2640,8 @@ const tableRowClick = async (row) => {
   console.log(_product_code.value + "--->下方表格获取数据")
   console.log(res)
   console.log(res.data.gyData)
-  _yjno.value = res.data.yjData.map(item => item.yj_yjno).join(',');
+  const yjNos = res.data.yjData.map(item => item.yj_yjno).join(',');
+  _yjno.value = yjNos;
   console.log(_yjno.value)
   const processedData = res.data.gyData.map(item => {
     return {
@@ -2691,30 +2669,6 @@ const tableRowClick = async (row) => {
   addyj.value=true
   delall.value=true
 };
-
-
-watch(_yjno, (newVal) => {
-  if (newVal) {
-    yjOptions.value = newVal.split(',').filter(item => item.trim());
-    // 默认选中第一个(可选)
-    if (yjOptions.value.length > 0) {
-      selectedYjList.value = [yjOptions.value[0]]; // 默认选中第一个
-      handleYjChange(selectedYjList.value);
-    }
-  } else {
-    yjOptions.value = [];
-    selectedYjList.value = [];
-  }
-});
-
-// 处理 Checkbox 选择变化
-const selectYJNO = ref('')
-const handleYjChange = (selectedValues) => {
-  // 拼接成字符串
-  selectYJNO.value = selectedValues.join(',');
-  console.log(selectYJNO.value)
-};
-
 const yjSelection = ref('')
 const gySelection = ref('')
 // 印件资料多选、工艺资料多选
@@ -4383,4 +4337,4 @@ const rowClassStyle = ({row,rowIndex}) =>{
 .mab{
   margin-bottom: 5px;
 }
-</style>
+</style>