Commit a53f803d authored by tao's avatar tao

质量模块修复bug

parent c4e149ef
......@@ -3,7 +3,7 @@
* @since: 2019-11-08 15:00:48
* @Author: jawnwa22
* @LastEditors: Tao
* @LastEditTime: 2020-08-28 11:02:10
* @LastEditTime: 2021-01-29 13:50:21
-->
<template>
<div class="tapwater" v-loading="this.$store.state.isShow"
......@@ -68,7 +68,7 @@
stripe
ref="multipleTable"
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"
@cell-mouse-leave="leave"
@cell-dblclick="twoclick"
......@@ -243,7 +243,7 @@ export default {
//表格导入
var that = this;
const files = e.target.files;
console.log(files);
if (files.length <= 0) {
//如果没有文件名
return false;
......@@ -251,20 +251,43 @@ export default {
this.$Message.error('上传格式不正确,请上传xls或者xlsx格式');
return false;
}
const fileReader = new FileReader();
fileReader.onload = ev => {
try {
const data = ev.target.result;
const workbook = XLSX.read(data, {
type: 'binary'
});
console.log(workbook)
const wsname = workbook.SheetNames[0]; //取第一张表
const ws = XLSX.utils.sheet_to_json(
workbook.Sheets[wsname]
); //生成json表格内容
console.log(workbook);
let b = 0;
let timearr = []
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) {
if (!workbook.Strings[0].t == '序号') {
return false;
......@@ -290,6 +313,9 @@ export default {
// ws[a].array = null;
// }
}
let a1 = parseInt(this.data.PrSampleNumber);
console.log("this",this.data)
if (ws.length % this.data.PrSampleNumber !== 0) {
......@@ -297,7 +323,8 @@ export default {
this.pdyd3 = true;
this.ccc = true;
this.w = `导入的样本总数不是样本容量的整数倍,请修改样本表重新导入`;
} else {
}else {
let a3 = 0;
for(a3 = 0;a3<ws.length;a3++){
let a4 = a3+1;
......@@ -410,7 +437,11 @@ export default {
that.outputs.push(sheetData);
}
this.$refs.upload.value = '';
// }
// })
} catch (e) {
console.log(e)
return false;
}
};
......@@ -587,6 +618,7 @@ export default {
url:'/api/QualityManage/samplefromlist',
data:this.wanttable,
}).then(res1 =>{
console.log("网页",res1)
if (res1.data.code == 0) {
let aa = JSON.stringify(res1.data.data);
let bb = JSON.stringify(this.data);
......@@ -623,6 +655,7 @@ export default {
url:'/api/QualityManage/samplefromlist',
data:this.wanttable,
}).then(res1 =>{
console.log("网页",res1)
if (res1.data.code == 0) {
let aa = JSON.stringify(res1.data.data);
let bb = JSON.stringify(this.data);
......@@ -928,7 +961,9 @@ export default {
event.currentTarget.style.cursor = 'move';
},
exportTable() {
var s = JSON.stringify(this.tabledata1)
require.ensure([], () => {
const {
export_json_to_excel
} = require('../../vendor/Export2Excel');
......@@ -1715,6 +1750,7 @@ export default {
}
this.json2excel(this.excelDatas, '质量管理', true, 'xlsx');
this.tabledata1 = JSON.parse(s)
});
},
json2excel(tableJson, filenames, autowidth, bookTypes) {
......@@ -2012,7 +2048,8 @@ export default {
}
}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.value2 = this.$store.state.a.endtime;
this.Number1 = this.$store.state.a.num;
......@@ -2082,6 +2119,8 @@ export default {
}
});
}
}
}
},
......@@ -2464,4 +2503,4 @@ img {
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