瀏覽代碼

工单技术附件

曹鹤洋 1 年之前
父節點
當前提交
6bd414492a

+ 25 - 9
src/api/yunyin/yunying.js

@@ -808,15 +808,7 @@ export const getOrderProcessRight = (params) => {
     })
 }
 
-//02-产品管理-技术资料附件
-export const getExcelInfo = (params) => {
-    return service({
-        url:'/mes_server/work_order/getExcelInfo',
-        method: 'get',
-        params
-    })
-}
-//获取工单附件资料列表
+//获取产品附件资料列表
 export const getAnnexTable = (params) => {
     return service({
         url:'/mes_server/work_order/getAnnexTable',
@@ -839,4 +831,28 @@ export const annexDel= (params) => {
         method: 'get',
         params
     })
+}
+//获取工单附件资料列表
+export const getGdAnnexTable = (params) => {
+    return service({
+        url:'/mes_server/work_order/getGdAnnexTable',
+        method: 'get',
+        params
+    })
+}
+//工单附件新增
+export const gdAnnexAdd = (formData) => {
+    return service({
+        url:'/mes_server/work_order/gdAnnexAdd',
+        method: 'post',
+		data: formData
+    })
+}
+//工单附件删除
+export const gdAnnexDel= (params) => {
+    return service({
+        url:'/mes_server/work_order/gdAnnexDel',
+        method: 'get',
+        params
+    })
 }

+ 2 - 1
src/view/yunyin/chanpinziliao/chanpinziliao.vue

@@ -1594,7 +1594,6 @@ import {
   getProductYbMaterialList,
   getProductYbInfo,
   addProductYbInfo,
-  getExcelInfo,
   getAnnexTable,
   annexAdd,
   annexDel,
@@ -3357,6 +3356,7 @@ const uploadExcel = (event) =>{
 }
 
 const yulan = (event) =>{
+	if(!jsfjformdata.value.附件内容) return
 	$.getScript('/luckysheet/plugins/js/plugin.js', () => {
 			$script('/luckysheet/luckysheet.umd.js', () => {
 			luckyexcelVisible.value = true
@@ -3486,6 +3486,7 @@ const jsfjenterDialog = () => {
 
 //技术资料excel展示
 const ExcelShow = (row) =>{
+	if(!row.附件内容) return
 	$.getScript('/luckysheet/plugins/js/plugin.js', () => {
 		$script('/luckysheet/luckysheet.umd.js', () => {
 					console.log(row.附件内容)

+ 298 - 6
src/view/yunyin/shengchanguanli/gongdanziliao.vue

@@ -9,6 +9,7 @@
               <el-input v-model="searchInfo"  placeholder="搜索工单编号、产品代号" style="width: 180px;"></el-input>
               <el-button type="primary" icon="search" @click="onSubmit" title="搜索"  ></el-button>
               <el-button type="primary" icon="edit"   @click="ontlssclick"       class="bt" title="按工序投料反馈,试算某产量的投料">U8投料试算</el-button>
+              <el-button type="primary" class="bt" icon="edit"  @click="jsfjClick">技术附件</el-button>
               <el-button type="primary" icon="edit"   @click="onyycpzlclick"     class="bt" title="重新引用 产品资料!">引用产品资料</el-button>
               <el-button type="primary" icon="edit"   @click="oneditgxclhsclick" class="bt" title="工序产量核算">工序产量核算</el-button>
               <el-button type="primary" icon="edit"   @click="oneditgylctzclick" class="bt" title="根据实际生产需要,对工艺流程做调整">工艺流程调整</el-button>
@@ -542,7 +543,32 @@
                   <el-table-column align="left" label="建档时间" prop="建档时间"  width="160"/>
                   <el-table-column align="left" label="更新时间" prop="更新时间"  width="160"/>
                 </el-table>
-              </el-tab-pane>
+              </el-tab-pane>
+			  <el-tab-pane label="技术资料附件" @click="showTable('技术资料附件')" name="fourth">
+			  	<el-table ref="multipleTable"
+					  :row-style="{ height: '20px' }"
+					  :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
+					  :header-cell-style="{ padding: '0px' }"
+					  :show-overflow-tooltip="true"
+					  :cell-class-name="planUsageCellClass"
+					  highlight-current-row="true"
+					  @row-dblclick="ExcelShow"
+					  style="width: 100%;height: 36vh" border tooltip-effect="dark" :data="jstableData" row-key="ID" @selection-change="handleSelectionChange">
+
+			        <!--              <el-table-column type="selection" width="55" />-->
+			        <el-table-column align="left"  label="备注" prop="附件备注" width="120" />
+			        <el-table-column align="left"  label="文件类型" prop="附件类型" width="120"/>
+			        <el-table-column align="left"  label="关联编号" prop="关联编号"  width="360"/>
+			        <el-table-column align="left"  label="建档用户" prop="sys_id" width="120"/>
+			        <el-table-column align="left"  label="建档日期" prop="sys_rq" width="160" />
+			        <el-table-column align="left"  label="更新日期" prop="mod_rq" width="160" />
+			  				<el-table-column fixed="right" label="操作" width="100">
+			  				    <template v-slot="{ row }">
+			  				      <button @click="jsfj_del(row)">删除</button>
+			  				    </template>
+			  				  </el-table-column>
+			      </el-table>
+			    </el-tab-pane>
             </el-tabs>
 
             <!-- 修改工单资料 -->
@@ -1159,6 +1185,44 @@
                 </div>
               </template>
             </el-dialog>
+		<!-- 技术附件 -->
+          <el-dialog v-model="jsfjdialogFormVisible" :before-close="jsfjcloseDialog" :title="产品技术附件资料" style="margin-top: 40px" height="500px" width="800px" destroy-on-close>
+			  <el-form :model="jsfjformdata" label-position="right" ref="elFormRef" :rules="rule" label-width="75px">
+				<el-row :gutter="24">
+					<el-col :span="6">
+					  <el-form-item label="关联编号:" prop="address" class="mab">
+						<el-input v-model="jsfjformdata.关联编号"  id="关联编号" />
+					  </el-form-item>
+					</el-col>
+				</el-row>
+				<el-row :gutter="24">
+					<el-col :span="24">
+					  <el-form-item label="附件备注:" prop="address" class="mab">
+						<el-input v-model="jsfjformdata.附件备注"  id="附件备注" />
+					  </el-form-item>
+					</el-col>
+				</el-row>
+				<el-row :gutter="24">
+					<el-col :span="6"></el-col>
+					<el-col :span="12">
+						<input style="font-size:16px;" type="file" @change="uploadExcel" >
+					</el-col>
+					<el-col :span="6">
+						<el-button @click="yulan">预览</el-button>
+					</el-col>
+				</el-row>
+			  </el-form>
+			  <template #footer>
+				<div class="dialog-footer">
+				  <el-button @click="jsfjcloseDialog">取 消</el-button>
+				  <el-button type="primary"  @click="jsfjenterDialog">确 定</el-button>
+				</div>
+			  </template>
+			</el-dialog>
+
+<el-dialog v-model="luckyexcelVisible" :before-close="luckyexcelCloseDialog" width="100%" top="0vh">
+  <div id="luckyexcel" style="width: 100%;height: 90vh;"></div>
+</el-dialog>
 
           </el-main>
         </layout-content>
@@ -1191,6 +1255,9 @@ export default {
 </script>
 <script setup>
 // 全量引入格式化工具 请按需保留
+import $script from 'scriptjs'
+import $ from 'jquery';
+import LuckyExcel from 'luckyexcel';
 import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { ref, reactive, computed } from 'vue'
@@ -1202,7 +1269,10 @@ import {
   ProductInformation, TestCoefficient, capacityList,getOrderProcessRight,
   DataCorrection, U8Trial, ProcessFlow, AccountingParameter,setProductStatus,
   getProduct, getProductGy, ProductInformationEdit, workOrderListDetail, editProduct, getOrderProcessCount, StatusEdit,
-  PrintDetailDel, ProcessDetailDel
+  PrintDetailDel, ProcessDetailDel,
+  getGdAnnexTable,
+  gdAnnexAdd,
+  gdAnnexDel,
 } from "@/api/yunyin/yunying";
 import PrintPage from './components/print.vue'
 import AddGongYi from './components/addGongYi.vue'
@@ -2637,7 +2707,8 @@ const handleNodeClick = async (node) => {
   searchInfo.value = '';
   gytableData.value = [];
   yjtableData.value = [];
-  bomtableData.value = [];
+  bomtableData.value = [];
+  jstableData.value = [];
   _Gd_khdh.value = node.label.substring(0, 4);
   _WorkList_page();
 };
@@ -2698,7 +2769,9 @@ const yjtableData = ref([])
 //工艺资料
 const gytableData = ref([])
 //BOM资料
-const bomtableData = ref([])
+const bomtableData = ref([])
+//技术资料附件【暂时为空】
+const jstableData = reactive([])
 //全局调用工单编号
 const _Gd_gdbh = ref(null)
 //全局调用产品代号
@@ -2713,7 +2786,9 @@ const tableRowClick = async (row) => {
   const workOrderListDetail_data = await workOrderListDetail({Gd_gdbh:_Gd_gdbh.value});
   yjtableData.value = workOrderListDetail_data.data.printList;
   gytableData.value = workOrderListDetail_data.data.processList;
-  bomtableData.value = workOrderListDetail_data.data.BOM;
+  bomtableData.value = workOrderListDetail_data.data.BOM;
+  jstableData.splice(0, jstableData.length, ...workOrderListDetail_data.data.jsData);
+  // jstableData.value = workOrderListDetail_data.data.jsData;
   let tmp = yjtableData.value.map(item => item.印件号)
   tmp = tmp.sort((a,b)=>b-a)
   yjzuidahaoma.value = Number(tmp[0]) + 1
@@ -3298,7 +3373,224 @@ const delgd_delclick = async () => {
   gytableData.value = workOrderListDetail_data.data.processList;
   bomtableData.value = workOrderListDetail_data.data.BOM;
 }
-
+
+//点击技术附件按钮
+const jsfjClick = () => {
+	if(_Gd_gdbh.value == null){
+	  cgugdlist.value = false;
+	  ElMessage({type: 'warning',message: '请选择具体的工单后,再操作此功能'})
+	}else{
+	  initJsfjformdata();
+	  jsfjformdata.value.关联编号 = _Gd_gdbh.value
+	  jsfjdialogFormVisible.value = true
+	}
+}
+//技术附件弹窗
+const jsfjdialogFormVisible = ref(false)
+const jsfjformdata = ref({
+	sys_id: '[272/超级用户]',
+	附件备注: '',
+	附件内容: '',
+	附件类型: '',
+	关联编号: '',
+});
+//技术附件弹窗取消
+const initJsfjformdata = () => {
+  jsfjformdata.value = {
+	sys_id: '[272/超级用户]',
+	附件备注: '',
+	附件内容: '',
+	附件类型: '',
+	关联编号: '',
+  }
+}
+//技术附件弹窗取消
+const jsfjcloseDialog = () => {
+  jsfjdialogFormVisible.value = false
+}
+const uploadExcel = (event) =>{
+	const files = event.target.files;
+	let suffixArr = name.split("."), suffix = suffixArr[suffixArr.length-1];
+	// if(suffix!="xlsx"){
+	// 	alert("Currently only supports the import of xlsx files");
+	// 	return;
+	// }
+	jsfjformdata.value.附件内容 = files[0]
+	jsfjformdata.value.附件类型 = 'XLSX'
+}
+
+const yulan = (event) =>{
+	if(!jsfjformdata.value.附件内容) return
+	$.getScript('/luckysheet/plugins/js/plugin.js', () => {
+			$script('/luckysheet/luckysheet.umd.js', () => {
+			luckyexcelVisible.value = true
+			LuckyExcel.transformExcelToLucky(jsfjformdata.value.附件内容, function(exportJson, luckysheetfile){
+				if(exportJson.sheets==null || exportJson.sheets.length==0){
+					alert("Failed to read the content of the excel file, currently does not support xls files!");
+					return;
+				}
+				if(luckyExcel) luckyExcel.destroy();
+				luckysheet.create({
+					container: 'luckyexcel', //容器的ID
+					data: exportJson.sheets,
+					title: exportJson.info.name, // 工作簿名称
+					lang: "zh", // 设定表格语言 国际化设置,允许设置表格的语言,支持中文("zh")和英文("en")
+					showtoolbar: false, // 是否显示工具栏
+					showinfobar: false, // 是否显示顶部信息栏
+					allowEdit: false, // 是否允许前台编辑
+					enableAddRow: false, // 允许增加行
+					enableAddCol: false, // 允许增加列
+					userInfo: false, // 右上角的用户信息展示样式
+					showRowBar: false, // 是否显示行号区域
+					showColumnBar: false, // 是否显示列号区域
+					sheetFormulaBar: false, // 是否显示公式栏
+					enableAddBackTop: false,//返回头部按钮
+				});
+				luckyExcel = luckysheet;
+			})
+		})
+		})
+		$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/css/pluginsCss.css'));
+		$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/plugins.css'));
+		$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/css/luckysheet.css'));
+		$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/assets/iconfont/iconfont.css'));
+	
+}
+const jsfj_del = (row) =>{
+	ElMessageBox.confirm('确定要删除吗?', '提示', {
+	    confirmButtonText: '确定',
+	    cancelButtonText: '取消',
+	    type: 'warning'
+	}).then(() => {
+		gdAnnexDel({'UniqId':row.UniqId,'gdbh':_Gd_gdbh.value}).then(response => {
+			 if(response.code==0){
+				 ElMessage({
+				   type: 'success',
+				   message: '删除成功',
+				 })
+				 
+				 let row = {
+					 '工单编号':_Gd_gdbh.value,
+					 '产品代号':_Gd_cpdh.value,
+					 '产品名称':_Gd_cpmc.value,
+				 }
+				 tableRowClick (row)
+			  }
+		   })
+	})
+	
+}
+
+//技术附件弹窗确定
+const jsfjenterDialog = () => {
+	if(jsfjformdata.value.附件备注==''){
+		ElMessage({
+			type: 'error',
+			message: '请填写附件备注'
+		});
+		return;
+	}
+	if(jsfjformdata.value.附件内容==''){
+		ElMessage({
+			type: 'error',
+			message: '请上传文件'
+		});
+		return;
+	}
+	if(jsfjformdata.value.关联编号==''){
+		ElMessage({
+			type: 'error',
+			message: '请填写关联编号'
+		});
+		return;
+	}
+	
+	let fr = new FileReader();
+	fr.readAsDataURL(jsfjformdata.value.附件内容);
+	fr.onload = function () {
+	  const restoredData = new FormData();
+	  restoredData.append('sys_id', jsfjformdata.value.sys_id);
+	  restoredData.append('附件备注', jsfjformdata.value.附件备注);
+	  restoredData.append('附件内容', fr.result);
+	  restoredData.append('附件类型', jsfjformdata.value.附件类型);
+	  restoredData.append('关联编号', jsfjformdata.value.关联编号);
+			
+	   gdAnnexAdd(restoredData).then(response => {
+		 if(response.code==0){
+			 ElMessage({
+			   type: 'success',
+			   message: '新增成功',
+			 })
+			 jsfjdialogFormVisible.value = false
+			 let row = {
+				 '工单编号':_Gd_gdbh.value,
+				 '产品代号':_Gd_cpdh.value,
+				 '产品名称':_Gd_cpmc.value,
+			 }
+			 tableRowClick (row)
+		 }
+	   })
+	}
+}
+
+//技术资料excel展示
+const ExcelShow = (row) =>{
+	if(!row.附件内容) return
+	$.getScript('/luckysheet/plugins/js/plugin.js', () => {
+		$script('/luckysheet/luckysheet.umd.js', () => {
+					function dataURLtoBlob(dataUrl) {
+					    const byteString = atob(dataUrl.split(',')[1]);
+					    const ab = new ArrayBuffer(byteString.length);
+					    const ia = new Uint8Array(ab);
+					
+					    for (let i = 0; i < byteString.length; i++) {
+					        ia[i] = byteString.charCodeAt(i);
+					    }
+					
+					    return new Blob([ab], { type: 'application/octet-stream' });
+					}
+					
+					const blob = dataURLtoBlob(row.附件内容);
+					luckyexcelVisible.value = true
+					LuckyExcel.transformExcelToLucky(blob, function(exportJson, luckysheetfile){
+						if(exportJson.sheets==null || exportJson.sheets.length==0){
+							alert("Failed to read the content of the excel file, currently does not support xls files!");
+							return;
+						}
+						if(luckyExcel) luckyExcel.destroy();
+						luckysheet.create({
+							container: 'luckyexcel', //容器的ID
+							data: exportJson.sheets,
+							title: exportJson.info.name, // 工作簿名称
+							lang: "zh", // 设定表格语言 国际化设置,允许设置表格的语言,支持中文("zh")和英文("en")
+							showtoolbar: false, // 是否显示工具栏
+							showinfobar: false, // 是否显示顶部信息栏
+							allowEdit: false, // 是否允许前台编辑
+							enableAddRow: false, // 允许增加行
+							enableAddCol: false, // 允许增加列
+							userInfo: false, // 右上角的用户信息展示样式
+							showRowBar: false, // 是否显示行号区域
+							showColumnBar: false, // 是否显示列号区域
+							sheetFormulaBar: false, // 是否显示公式栏
+							enableAddBackTop: false,//返回头部按钮
+						});
+						luckyExcel = luckysheet;
+					})
+		})
+	})
+	$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/css/pluginsCss.css'));
+	$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/plugins.css'));
+	$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/css/luckysheet.css'));
+	$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/assets/iconfont/iconfont.css'));
+	
+}
+
+let luckyExcel = null
+
+const luckyexcelVisible = ref(false)
+const luckyexcelCloseDialog = () => {
+  luckyexcelVisible.value = false
+}
 </script>
 <style scoped>
 /* 在样式表中使用媒体查询 */