Browse Source

包装工序新增优化, 技术资料附件展示

曹鹤洋 1 year ago
parent
commit
f0e5c2a9aa

+ 2 - 0
package.json

@@ -21,6 +21,7 @@
         "echarts": "^5.4.3",
         "element-plus": "^2.4.4",
         "highlight.js": "^11.8.0",
+        "luckyexcel": "^1.0.1",
         "marked": "4.3.0",
         "mitt": "^3.0.1",
         "nprogress": "^0.2.0",
@@ -28,6 +29,7 @@
         "pinia": "^2.1.4",
         "qs": "^6.11.2",
         "screenfull": "^6.0.2",
+        "scriptjs": "^2.5.9",
         "spark-md5": "^3.0.2",
         "splitpanes": "^3.1.5",
         "tailwindcss": "^3.3.3",

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

@@ -806,4 +806,13 @@ export const getOrderProcessRight = (params) => {
         method: 'get',
         params
     })
+}
+
+//02-产品管理-技术资料附件
+export const getExcelInfo = (params) => {
+    return service({
+        url:'/mes_server/work_order/getExcelInfo',
+        method: 'get',
+        params
+    })
 }

+ 18 - 1
src/view/performance/Packagingoutput.vue

@@ -221,6 +221,12 @@ const formData = ref({
           sczl_yjGx4: '',
           sczl_yjGx5: '',
           sczl_yjGx6: '',
+		  sczl_gxmc1: '',
+		  sczl_gxmc2: '',
+		  sczl_gxmc3: '',
+		  sczl_gxmc4: '',
+		  sczl_gxmc5: '',
+		  sczl_gxmc6: '',
 		  Gd_cpmc1: '',
 		  Gd_cpmc2: '',
 		  Gd_cpmc3: '',
@@ -262,6 +268,12 @@ const initFormData = () => {
 		sczl_yjGx4: '',
 		sczl_yjGx5: '',
 		sczl_yjGx6: '',
+		sczl_gxmc1: '',
+		sczl_gxmc2: '',
+		sczl_gxmc3: '',
+		sczl_gxmc4: '',
+		sczl_gxmc5: '',
+		sczl_gxmc6: '',
 		Gd_cpmc1: '',
 		Gd_cpmc2: '',
 		Gd_cpmc3: '',
@@ -366,7 +378,6 @@ const handleCurrentChange = (val) => {
 const getTableData = async () => {
 		
   const response = await getList(params);
-  console.log(response.data.rows)
   if (response.code === 0) {
     tableData.splice(0, tableData.length, ...response.data.rows);
   }
@@ -604,6 +615,12 @@ const updateDetailData = async() => {
 		 sczl_yjGx4: formData.value.sczl_yjGx4,
 		 sczl_yjGx5: formData.value.sczl_yjGx5,
 		 sczl_yjGx6: formData.value.sczl_yjGx6,
+		 sczl_gxmc1: formData.value.sczl_gxmc1,
+		 sczl_gxmc2: formData.value.sczl_gxmc2,
+		 sczl_gxmc3: formData.value.sczl_gxmc3,
+		 sczl_gxmc4: formData.value.sczl_gxmc4,
+		 sczl_gxmc5: formData.value.sczl_gxmc5,
+		 sczl_gxmc6: formData.value.sczl_yjGx6,
 		 sczl_cl1: formData.value.sczl_cl1,
 		 sczl_cl2: formData.value.sczl_cl2,
 		 sczl_cl3: formData.value.sczl_cl3,

+ 91 - 22
src/view/yunyin/chanpinziliao/chanpinziliao.vue

@@ -699,25 +699,10 @@
             </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"
-                        highlight-current-row="true"
-                        style="width: 100%;height: 40vh" 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="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="建档用户" width="120"/>
-                <el-table-column align="left"  label="建档日期" prop="建档日期" width="160" />
-                <el-table-column align="left"  label="更新日期" prop="更新日期" width="160" />
-              </el-table>
-            </el-tab-pane>
-
+              <div id="luckyexcel" style="width: 100%;height: 40vh;"></div>
+            </el-tab-pane>
+			<el-button type="primary" class="bt"  @click="ExcelShow()" >Excel</el-button>
+			
           </el-tabs>
 
           <!-- 修改产品产品基本资料表格弹窗 -->
@@ -1471,14 +1456,20 @@ export default {
 </script>
 <script setup>
 // 全量引入格式化工具 请按需保留
+import $script from 'scriptjs'
+import $ from 'jquery';
+import LuckyExcel from 'luckyexcel';
 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 } from 'vue'
+import { ref, reactive, nextTick, } from 'vue'
 import {
   DataList,editGyName, editGyNo, editProduct,editProductYjInfo,getProductGyInfo,
   getCustom,getDepartment,getProduct,editGy,getProductData,getProductYjInfo,
-  getProductGy,editGyWaste,editGyMs,getStaffList,setProductStatus,getProductYjList,getProductZzList,addProductYjInfo,getDepartName,getProcess,getProcessLoss,addProductGyInfo} from "@/api/yunyin/yunying";
+  getProductGy,editGyWaste,editGyMs,getStaffList,setProductStatus,getProductYjList,
+  getProductZzList,addProductYjInfo,getDepartName,getProcess,getProcessLoss,
+  addProductGyInfo,getExcelInfo
+  } from "@/api/yunyin/yunying";
 defineOptions({   name: 'Company'})
 
 // =========== 导出Excel表格 ===========
@@ -2179,7 +2170,8 @@ const tableRowClick = async (row) => {
   const res = await getProductData({product_code:_product_code.value});
   yjtableData.splice(0, yjtableData.length, ...res.data.yjData);
   gytableData.splice(0, gytableData.length, ...res.data.gyData);
-  ybtableData.splice(0, ybtableData.length, ...res.data.ybData);
+  ybtableData.splice(0, ybtableData.length, ...res.data.ybData);
+  ExcelShow()
   if(yjtableData.length==0)
   {
 	   yjzuidahaoma.value = 1
@@ -2841,6 +2833,83 @@ const tableDataCellClass = ({row, column, rowIndex, columnIndex}) =>{
   if (column.property === 'gyData' || column.property === 'yjData') {
     return 'plan-usage-low';
   }
+}
+
+//技术资料excel展示
+const ExcelShow = () =>{
+	$.getScript('/luckysheet/plugins/js/plugin.js', () => {
+		$script('/luckysheet/luckysheet.umd.js', () => {
+			fetch('/luckysheet/黄金叶(软大金圆)(二维码版).xlsx')
+			    .then(response => response.blob())
+			    .then(blob => {
+					
+			      const file = new File([blob], 'filename.xlsx', { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
+			      createROLuckyExcel(file);
+			    });
+		})
+	})
+	$('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
+/**
+ * 只读版luckyExcel 创建
+ */
+const createROLuckyExcel = (files) => {
+	LuckyExcel.transformExcelToLucky(files, function (exportJson, luckysheetfile) {
+		console.log("transformExcelToLucky", files, exportJson)
+		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();
+			nextTick(() => {
+				$(function () {
+					luckysheet.create({
+						container: 'luckyexcel', //容器的ID
+						data: exportJson.sheets,
+						title: exportJson.info.name, // 工作簿名称
+						lang: "zh", // 设定表格语言 国际化设置,允许设置表格的语言,支持中文("zh")和英文("en")
+						// allowCopy: false, // 是否允许拷贝
+						showtoolbar: false, // 是否显示工具栏
+						showinfobar: false, // 是否显示顶部信息栏
+						// showsheetbar: false, // 是否显示底部sheet页按钮
+						// showstatisticBar: false, // 是否显示底部计数栏
+						// sheetBottomConfig: false, // sheet页下方的添加行按钮和回到顶部按钮配置
+						allowEdit: false, // 是否允许前台编辑
+						enableAddRow: false, // 允许增加行
+						enableAddCol: false, // 允许增加列
+						userInfo: false, // 右上角的用户信息展示样式
+						showRowBar: false, // 是否显示行号区域
+						showColumnBar: false, // 是否显示列号区域
+						sheetFormulaBar: false, // 是否显示公式栏
+						enableAddBackTop: false,//返回头部按钮
+						// rowHeaderWidth: 0,//纵坐标
+						// columnHeaderHeight: 0,//横坐标
+						// showstatisticBarConfig: {
+						// count:false,
+						// view:false,
+						// zoom:false,
+						// },
+						// showsheetbarConfig: {
+						// add: false, //新增sheet
+						// menu: false, //sheet管理菜单
+						// sheet: false, //sheet页显示
+						// },
+						// hook: {
+						// cellMousedown:this.cellMousedown,//绑定鼠标事件
+						// },
+						// forceCalculation: true,//强制计算公式
+					});
+					luckyExcel = luckysheet;
+				});
+			});
+		
+	})
 }
 </script>
 <style scoped>