Commit a53f803d authored by tao's avatar tao

质量模块修复bug

parent c4e149ef
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @since: 2019-11-08 15:00:48 * @since: 2019-11-08 15:00:48
* @Author: jawnwa22 * @Author: jawnwa22
* @LastEditors: Tao * @LastEditors: Tao
* @LastEditTime: 2020-08-28 11:02:10 * @LastEditTime: 2021-01-29 13:50:21
--> -->
<template> <template>
<div class="tapwater" v-loading="this.$store.state.isShow" <div class="tapwater" v-loading="this.$store.state.isShow"
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
stripe stripe
ref="multipleTable" ref="multipleTable"
border border
:header-cell-style="[{background:(($store.state.color=='grey')?'#D9DBDE':'#5a6c98')},{color:(($store.state.color=='grey')?'#000':'#fff')}, {'border-left':'1px solid #cccccc',height:'50px',padding:'0'}]" :header-cell-style="{background:($store.state.color=='grey')?'#D9DBDE':'#5a6c98',color:($store.state.color=='grey')?'#000':'#fff','border-left':'1px solid #cccccc',height:'50px',padding:'0'}"
@row-click="handleRowChange1" @row-click="handleRowChange1"
@cell-mouse-leave="leave" @cell-mouse-leave="leave"
@cell-dblclick="twoclick" @cell-dblclick="twoclick"
...@@ -243,7 +243,7 @@ export default { ...@@ -243,7 +243,7 @@ export default {
//表格导入 //表格导入
var that = this; var that = this;
const files = e.target.files; const files = e.target.files;
console.log(files);
if (files.length <= 0) { if (files.length <= 0) {
//如果没有文件名 //如果没有文件名
return false; return false;
...@@ -251,20 +251,43 @@ export default { ...@@ -251,20 +251,43 @@ export default {
this.$Message.error('上传格式不正确,请上传xls或者xlsx格式'); this.$Message.error('上传格式不正确,请上传xls或者xlsx格式');
return false; return false;
} }
const fileReader = new FileReader(); const fileReader = new FileReader();
fileReader.onload = ev => { fileReader.onload = ev => {
try { try {
const data = ev.target.result; const data = ev.target.result;
const workbook = XLSX.read(data, { const workbook = XLSX.read(data, {
type: 'binary' type: 'binary'
}); });
console.log(workbook)
const wsname = workbook.SheetNames[0]; //取第一张表 const wsname = workbook.SheetNames[0]; //取第一张表
const ws = XLSX.utils.sheet_to_json( const ws = XLSX.utils.sheet_to_json(
workbook.Sheets[wsname] workbook.Sheets[wsname]
); //生成json表格内容 ); //生成json表格内容
console.log(workbook); let timearr = []
let b = 0; console.log(ws)
ws.forEach((item)=>{
timearr.push(item.记录时间)
})
console.log("sj",timearr)
// this.$axios({
// method:'POST',
// url:'/api/QualityManage/verificationtime',
// data:timearr
// }).then(res=>{
// console.log(res)
// if(res.data.code!==0){
// this.tipchange1 = true;
// this.pdyd3 = true;
// this.w = res.data.msg;
// }else{
let b = 0;
for (b in workbook.Strings) { for (b in workbook.Strings) {
if (!workbook.Strings[0].t == '序号') { if (!workbook.Strings[0].t == '序号') {
return false; return false;
...@@ -290,6 +313,9 @@ export default { ...@@ -290,6 +313,9 @@ export default {
// ws[a].array = null; // ws[a].array = null;
// } // }
} }
let a1 = parseInt(this.data.PrSampleNumber); let a1 = parseInt(this.data.PrSampleNumber);
console.log("this",this.data) console.log("this",this.data)
if (ws.length % this.data.PrSampleNumber !== 0) { if (ws.length % this.data.PrSampleNumber !== 0) {
...@@ -297,7 +323,8 @@ export default { ...@@ -297,7 +323,8 @@ export default {
this.pdyd3 = true; this.pdyd3 = true;
this.ccc = true; this.ccc = true;
this.w = `导入的样本总数不是样本容量的整数倍,请修改样本表重新导入`; this.w = `导入的样本总数不是样本容量的整数倍,请修改样本表重新导入`;
} else { }else {
let a3 = 0; let a3 = 0;
for(a3 = 0;a3<ws.length;a3++){ for(a3 = 0;a3<ws.length;a3++){
let a4 = a3+1; let a4 = a3+1;
...@@ -410,7 +437,11 @@ export default { ...@@ -410,7 +437,11 @@ export default {
that.outputs.push(sheetData); that.outputs.push(sheetData);
} }
this.$refs.upload.value = ''; this.$refs.upload.value = '';
// }
// })
} catch (e) { } catch (e) {
console.log(e)
return false; return false;
} }
}; };
...@@ -587,6 +618,7 @@ export default { ...@@ -587,6 +618,7 @@ export default {
url:'/api/QualityManage/samplefromlist', url:'/api/QualityManage/samplefromlist',
data:this.wanttable, data:this.wanttable,
}).then(res1 =>{ }).then(res1 =>{
console.log("网页",res1)
if (res1.data.code == 0) { if (res1.data.code == 0) {
let aa = JSON.stringify(res1.data.data); let aa = JSON.stringify(res1.data.data);
let bb = JSON.stringify(this.data); let bb = JSON.stringify(this.data);
...@@ -623,6 +655,7 @@ export default { ...@@ -623,6 +655,7 @@ export default {
url:'/api/QualityManage/samplefromlist', url:'/api/QualityManage/samplefromlist',
data:this.wanttable, data:this.wanttable,
}).then(res1 =>{ }).then(res1 =>{
console.log("网页",res1)
if (res1.data.code == 0) { if (res1.data.code == 0) {
let aa = JSON.stringify(res1.data.data); let aa = JSON.stringify(res1.data.data);
let bb = JSON.stringify(this.data); let bb = JSON.stringify(this.data);
...@@ -928,7 +961,9 @@ export default { ...@@ -928,7 +961,9 @@ export default {
event.currentTarget.style.cursor = 'move'; event.currentTarget.style.cursor = 'move';
}, },
exportTable() { exportTable() {
var s = JSON.stringify(this.tabledata1)
require.ensure([], () => { require.ensure([], () => {
const { const {
export_json_to_excel export_json_to_excel
} = require('../../vendor/Export2Excel'); } = require('../../vendor/Export2Excel');
...@@ -1715,6 +1750,7 @@ export default { ...@@ -1715,6 +1750,7 @@ export default {
} }
this.json2excel(this.excelDatas, '质量管理', true, 'xlsx'); this.json2excel(this.excelDatas, '质量管理', true, 'xlsx');
this.tabledata1 = JSON.parse(s)
}); });
}, },
json2excel(tableJson, filenames, autowidth, bookTypes) { json2excel(tableJson, filenames, autowidth, bookTypes) {
...@@ -2012,7 +2048,8 @@ export default { ...@@ -2012,7 +2048,8 @@ export default {
} }
}else{ }else{
if(this.$store.state.a.data.length !== 0){ if(this.$store.state.a.data){
if(this.$store.state.a.data.length !== 0){
this.value1 = this.$store.state.a.starttime; this.value1 = this.$store.state.a.starttime;
this.value2 = this.$store.state.a.endtime; this.value2 = this.$store.state.a.endtime;
this.Number1 = this.$store.state.a.num; this.Number1 = this.$store.state.a.num;
...@@ -2082,6 +2119,8 @@ export default { ...@@ -2082,6 +2119,8 @@ export default {
} }
}); });
} }
}
} }
}, },
...@@ -2464,4 +2503,4 @@ img { ...@@ -2464,4 +2503,4 @@ img {
font-size: 15px; font-size: 15px;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment