Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
klck
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
位宇华
klck
Commits
8d23f5db
Commit
8d23f5db
authored
1 year ago
by
lenovo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据清洗功能完善(重新导入删除旧数据)
parent
558c2d26
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
457 additions
and
126 deletions
+457
-126
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesHistorydataMapper.java
...com/ruoyi/system/mapper/ActSuppliesHistorydataMapper.java
+1
-1
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesHistorydataServiceImpl.java
...ystem/service/impl/ActSuppliesHistorydataServiceImpl.java
+18
-2
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesHistorydataMapper.xml
.../resources/mapper/system/ActSuppliesHistorydataMapper.xml
+2
-2
ruoyi-ui/src/views/system/supplies/index.vue
ruoyi-ui/src/views/system/supplies/index.vue
+436
-121
No files found.
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesHistorydataMapper.java
View file @
8d23f5db
...
...
@@ -61,7 +61,7 @@ public interface ActSuppliesHistorydataMapper
Long
[]
selectActSuppliesRole
(
Long
templateId
);
L
ong
selectActSuppliesHistorydatauuid
(
String
exportUuid
);
L
ist
<
ActSuppliesHistorydata
>
selectActSuppliesHistorydatauuid
(
String
exportUuid
);
void
insertActSuppliesHistorydatas
(
ActSuppliesHistorydata
actSuppliesHistorydata1
);
...
...
This diff is collapsed.
Click to expand it.
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesHistorydataServiceImpl.java
View file @
8d23f5db
...
...
@@ -8,6 +8,7 @@ import java.util.List;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.system.mapper.ActSuppliesCleaningRuleMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.system.mapper.ActSuppliesHistorydataMapper
;
...
...
@@ -26,6 +27,9 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
@Autowired
private
ActSuppliesHistorydataMapper
actSuppliesHistorydataMapper
;
@Autowired
private
ActSuppliesCleaningRuleMapper
actSuppliesCleaningRuleMapper
;
/**
* 查询 历史数据
*
...
...
@@ -112,14 +116,26 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
SysUser
user
=
SecurityUtils
.
getLoginUser
().
getUser
();
ActSuppliesHistorydata
actSuppliesHistorydata1
=
new
ActSuppliesHistorydata
();
L
ong
s
=
actSuppliesHistorydataMapper
.
selectActSuppliesHistorydatauuid
(
actSuppliesHistorydata
.
get
(
0
).
getImportUuid
());
L
ist
<
ActSuppliesHistorydata
>
s
=
actSuppliesHistorydataMapper
.
selectActSuppliesHistorydatauuid
(
actSuppliesHistorydata
.
get
(
0
).
getImportUuid
());
if
(
s
>
0
){
if
(
s
.
size
()>
0
){
if
(
s
.
get
(
0
).
getCleanStatus
()>
0
){
for
(
int
j
=
0
;
j
<
s
.
size
();
j
++){
if
(
s
.
get
(
j
).
getIdentifyingCode
()==
0
){
actSuppliesCleaningRuleMapper
.
deleteActSuppliesImportTable
(
s
.
get
(
j
).
getId
());
}
else
if
(
s
.
get
(
j
).
getIdentifyingCode
()==
1
){
actSuppliesCleaningRuleMapper
.
deleteActSuppliesSixMinesSummaryTable
(
s
.
get
(
j
).
getId
());
}
}
}
for
(
int
i
=
0
;
i
<
actSuppliesHistorydata
.
size
();
i
++)
{
actSuppliesHistorydata
.
get
(
i
).
setCreateBy
(
user
.
getUserName
());
actSuppliesHistorydata
.
get
(
i
).
setCreateTime
(
DateUtils
.
getNowDate
());
actSuppliesHistorydataMapper
.
updateActSuppliesHistorydatas
(
actSuppliesHistorydata
.
get
(
i
));
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesHistorydataMapper.xml
View file @
8d23f5db
...
...
@@ -118,8 +118,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectActSuppliesHistorydatauuid"
parameterType=
"String"
result
Type=
"Long
"
>
select
count(*)
from act_supplies_historydata where import_uuid = #{importUuid}
<select
id=
"selectActSuppliesHistorydatauuid"
parameterType=
"String"
result
Map=
"ActSuppliesHistorydataResult
"
>
select
id, import_uuid, template_id, export_uuid, role_id, history_name, identifying_code,clean_status ,status, create_by, date, create_time, ssk_id
from act_supplies_historydata where import_uuid = #{importUuid}
</select>
<select
id=
"selectActSuppliesRole"
parameterType=
"Long"
resultType=
"Long"
>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/supplies/index.vue
View file @
8d23f5db
<
template
>
<div
class=
"app-container"
>
<el-form
ref=
"queryForm"
size=
"small"
:inline=
"true"
:rules=
"rules"
label-width=
"68px"
>
<el-form
ref=
"queryForm"
size=
"small"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"模板"
prop=
"name"
>
<el-select
v-model=
"selectedOption"
ref=
"mySelect"
size=
"mini"
@
change=
"handleOptionChange"
filterable
placeholder=
"请选择您要查看的模板"
>
<!--
<el-option
label=
"自设的模板名"
value=
"使用空白模板"
></el-option>
-->
...
...
@@ -456,10 +456,12 @@ export default {
});
});
try
{
const
exportJson
=
await
cons
;
await
this
.
summary
(
exportJson
);
//
this.submit(exportJson);
this
.
submit
(
exportJson
);
}
catch
(
Error
)
{
this
.
$message
({
message
:
Error
.
message
,
...
...
@@ -480,6 +482,7 @@ export default {
//this.$message({type: 'info', message: '操作已取消'});
});
}
else
{
let
exx
;
this
.
showMask
=
true
;
const
cons
=
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -488,8 +491,10 @@ export default {
resolve
(
exx
);
});
});
try
{
const
exportJson
=
await
cons
;
await
this
.
summary
(
exportJson
);
this
.
submit
(
exportJson
);
...
...
@@ -501,12 +506,16 @@ export default {
}
finally
{
// 导入完成后关闭遮罩层
this
.
showMask
=
false
;}
this
.
showMask
=
false
;
}
}
},
/** 物料转换汇总到页面*/
summary
(
exportJson
){
// 记录开始时间
const
startTime
=
new
Date
();
let
sysRulez
;
let
sysRules
;
let
sysConver
;
...
...
@@ -1003,23 +1012,23 @@ export default {
}
break
;
case
7
:
{
let
map
=
new
Map
();
let
smallMat
=
[];
let
deps
=
[];
let
t
=
0
;
try
{
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
sysRulez
[
1
].
ce
]
!=
null
&&
data
[
i
][
key_i
]
!=
null
)
{
let
num
=
data
[
i
][
key_i
].
m
;
let
dep
=
data
[
i
][
sysRulez
[
1
].
ce
].
m
;
smallMat
.
push
(
num
);
deps
.
push
(
dep
);
smallMat
.
push
({
index
:
t
,
code
:
num
});
deps
.
push
(
dep
);
t
++
;
}
else
{
smallMat
.
push
(
null
);
deps
.
push
(
null
);
}
}
//console.log("smallMat="+smallMat);
}
catch
(
err
){
throw
new
Error
(
"
导入失败,导入文件与模板规则不匹
"
);
}
...
...
@@ -1029,110 +1038,413 @@ export default {
if
(
allNull
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
//一部分报表的数据
//console.log('----->',smallMat);
materialList
().
then
(
response
=>
{
//六矿物料编码数据
// console.log(response.rows,'ymy');
let
array
=
response
.
rows
.
slice
(
92
,
246
);
//有code的数据
// console.log(array,"
<-------->
"
);
//六矿六位编码
let newSix = [];
for (let i = 0; i < array.length; i++) {
if(array[i].code.length==6){
newSix.push(array[i]);
}
}
// console.log('6666666666666',newSix);
//六矿四位编码
let newFour = [];
for (let u = 0; u < array.length; u++) {
if(array[u].code.length==4){
newFour.push(array[u]);
}
}
// console.log('444444444444444',newFour);
//六矿二位编码
let newTwo = [];
for (let l = 0; l < array.length; l++) {
if(array[l].code.length==2){
newTwo.push(array[l]);
}
}
// console.log('22222222222222',newTwo);
//转换六位
let a = [];
for (let h = 0; h < smallMat.length; h++) {
for (let s = 0; s < newSix.length; s++) {
if(smallMat[h].code.slice(0,6) == newSix[s].code){
smallMat[h].code = newSix[s].codes;
a.push(smallMat[h]);
}
}
}
//console.log('ssssssssss',a);
//删除方法
const result = smallMat.filter(item => item.code.length <= 4).map(item =>({index:item.index,code:item.code}) );
let i = 0;
while (i < smallMat.length) {
if (smallMat[i].code.length <= 4) {
smallMat[i] = smallMat[smallMat.length - 1];
smallMat.length--;
} else {
i++;
}
}
//console.log(smallMat);
//转换四位
let b = [];
for (let h = 0; h < smallMat.length; h++) {
for (let s = 0; s < newFour.length; s++) {
if(smallMat[h].code.slice(0,4) == newFour[s].code){
smallMat[h].code = newFour[s].codes;
b.push(smallMat[h]);
}
}
}
//console.log('fffffffffffff',b);
//console.log('原数组',smallMat);
let uniqueB = [...new Set(b.map(obj => obj.index))].map(index => b.find(obj => obj.index === index));
// 622
//console.log('fffffffffffff', uniqueB);
//删除方法
const re = smallMat.filter(item => item.code.length <= 4).map(item =>({index:item.index,code:item.code}) );
let ii = 0;
while (ii < smallMat.length) {
if (smallMat[ii].code.length == 4) {
smallMat[ii] = smallMat[smallMat.length - 1];
smallMat.length--;
} else {
ii++;
}
}
//console.log(smallMat);
//转换二位
let c = [];
for (let h = 0; h < smallMat.length; h++) {
for (let s = 0; s < newTwo.length; s++) {
if(smallMat[h].code.slice(0,2) == newTwo[s].code){
smallMat[h].code = newTwo[s].codes;
c.push(smallMat[h]);
}
}
}
//console.log('tttttttttt',c);
//删除方法
const sult = smallMat.filter(item => item.code.length <= 4).map(item =>({index:item.index,code:item.code}) );
let iii = 0;
while (iii < smallMat.length) {
if (smallMat[iii].code.length <= 4) {
smallMat[iii] = smallMat[smallMat.length - 1];
smallMat.length--;
} else {
iii++;
}
}
//console.log(smallMat);
//转换其他
for (let other = 0; other < smallMat.length; other++) {
if( smallMat[other].code.length == '10'){
smallMat[other].code = 11;
}
}
//console.log(smallMat);
//合并
let newSmallMat = [...a,...uniqueB,...c,...smallMat];
//console.log(newSmallMat);
//索引排序
function newSort(arr){
arr.sort((a,b) => a.index - b.index)
return arr;
}
let newSortArray = newSort(newSmallMat);
//console.log(newSortArray);
for (let i = parseFloat(sysRulez[0].re) + 1, k = 0; i < data.length; i++, k++) {
let values = [];
if (data[i][key_i] != null) {
for (let j = 0; j < value.length; j++) {
try{
let a = parseFloat(data[i][value[j]].v);
values.push(a);
}catch (err){
this.$message({
message:
"
导入失败
,
导入文件不匹
"
,
type:
"
error
"
});
innerReject(error); // 异步请求出错
}
materialConvert
(
smallMat
)
.
then
(
response
=>
{
let
array
=
response
.
rows
;
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
,
k
=
0
;
i
<
data
.
length
;
i
++
,
k
++
)
{
let
values
=
[];
if
(
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
values
.
push
(
a
);
}
catch
(
err
){
this
.
$message
({
message
:
"
导入失败,导入文件不匹
"
,
type
:
"
error
"
});
innerReject
(
error
);
// 异步请求出错
}
//插入多个value的值
//此方法只适用于一对一唯一值
/*let index = smallMat.indexOf(data[i][key_i].m);
let key = array[index];*/
let key = newSortArray[k].code + '/' + deps[k];
if (map.has(key)) {
let oldValues = map.get(key);
for (let i = 0; i < values.length; i++) {
values[i] = parseFloat(parseFloat(values[i] + oldValues[i]).toFixed(2));
}
map.set(key, values);
} else {
map.set(key, values);
}
}
}
//插入多个value的值
//此方法只适用于一对一唯一值
/*let index = smallMat.indexOf(data[i][key_i].m);
let key = array[index];*/
let
key
=
array
[
k
]
+
'
/
'
+
deps
[
k
];
if
(
map
.
has
(
key
))
{
let
oldValues
=
map
.
get
(
key
);
for
(
let
i
=
0
;
i
<
values
.
length
;
i
++
)
{
values
[
i
]
=
parseFloat
(
parseFloat
(
values
[
i
]
+
oldValues
[
i
]).
toFixed
(
2
));
}
map
.
set
(
key
,
values
);
}
else
{
map
.
set
(
key
,
values
);
//循环得到汇总结果
console.log(map);
if (map.size === 0) {
throw new Error(
"
导入失败
,
导入文件错误
"
);
}
}
//返回单元格第二行的数据
//let celn=luckysheet.getcellvalue(1);
//返回当前工作表第1列数据
//let cown=luckysheet.getcellvalue(null,0);
let rowws;
let config;
let bord = {
"
rangeType
"
:
"
range
"
,
"
borderType
"
:
"
border
-
all
"
,
"
style
"
:
"
1
"
,
"
color
"
:
"
#
000000
"
,
"
range
"
: [{
"
row
"
: [0, 0],
"
column
"
: [0, 0]
}]
}
let warn=0;
map.forEach((value, key) => {
const suffixArr = key.split('/'), mat = suffixArr[0], depp = suffixArr[1];
//console.log(mat);console.log(depp);
let searchResult = luckysheet.find(mat);
if (searchResult.length != 0 && key != null) {
rowws = searchResult[0].row;
luckysheet.insertRow(rowws + 1);
let vll1=luckysheet.getCellValue(rowws,sysRulez[0].ct);
luckysheet.setCellValue(rowws+1, sysRulez[0].ct, {
"
ct
"
: {
"
fa
"
:
"
@
"
,
"
t
"
:
"
n
"
}
});
luckysheet.setCellValue(rowws + 1, sysRulez[0].ct, vll1);
let vll2=luckysheet.getCellValue(rowws,parseInt(sysRulez[0].ct)+1);
luckysheet.setCellValue(rowws + 1, parseInt(sysRulez[0].ct)+1, vll2);
//输出部门数量金额
}
//循环得到汇总结果
if
(
map
.
size
===
0
)
{
throw
new
Error
(
"
导入失败,导入文件错误
"
);
luckysheet.setCellValue(rowws + 1, sysRulez[1].ct, depp);
for (let i = 0; i < sysRules.length; i++) {
luckysheet.setCellValue(rowws + 1, sysRules[i].ct, value[i]);
//修改单元格样式
/*luckysheet.setCellValue(rowws+g, sysRules[i].ct, {
"
ct
"
: {
"
fa
"
:
"
General
"
,
"
t
"
:
"
n
"
}
});*/
}
//输出单价
luckysheet.setCellValue(rowws + 1, parseInt(sysRules[0].ct) + 1, value[1] / value[0]);
//修改单价样式
/*luckysheet.setCellValue(rowws+g,parseInt(sysRules[0].ct)+1,{
"
ct
"
: {
"
fa
"
:
"
0.0000
"
,
"
t
"
:
"
n
"
}
});*/
config = luckysheet.getConfig(0);
bord.range[0].row = [rowws + 1, rowws + 1];
bord.range[0].column = [0, parseInt(sysRules[sysRules.length - 1].ct)];
config.borderInfo.push(bord);
luckysheet.setConfig(config);
modify=true;
} else{
warn++;
}
});
if (warn === map.size) {
throw new Error(
"
导入文件与所选模板规则不匹配
"
);
} else if (warn > 0) {
this.$message({
message:
"
还有
"
+warn+
"
条大类未能匹配到
"
,
type:
"
warning
"
});
}
const endTime = new Date();
// 计算执行时间(以毫秒为单位)
const executionTime = endTime - startTime;
// 输出执行时间
console.log(`代码执行时间:${executionTime} 毫秒`);
resolve(response.rows);
innerResolve(); // 标记当前异步任务完成
/*let find1 = luckysheet.find(
"
合计
"
);
let number = parseInt(find1[0].row)-1;
luckysheet.setCellValue(find1[0].row, sysRules[sysRules.length-1].ct,
"
=
SUM
(
F2
:
F
"
+number+
"
)
"
)*/
}).catch(Error => {
console.log(
"
这里是单个异步请求出错处
"
);
//必须加,不能删除
innerReject(Error); // 异步请求出错
});
}));
}
break;
case 8: {
let map = new Map();
let smallMat = [];
let newsmallMat=[];
let p=0;
let deps = [];
try {
for (let i = parseFloat(sysRulez[0].re) + 1; i < data.length; i++) {
if (data[i][sysRulez[1].ce] != null && data[i][key_i] != null) {
let num = data[i][key_i].m;
let dep = data[i][sysRulez[1].ce].m;
smallMat.push(num);
newsmallMat.push({'index':p,'code':num});
p++;
deps.push(dep);
} else {
smallMat.push(null);
deps.push(null);
}
//返回单元格第二行的数据
//let celn=luckysheet.getcellvalue(1);
//返回当前工作表第1列数据
//let cown=luckysheet.getcellvalue(null,0);
let
rowws
;
let
config
;
let
bord
=
{
"
rangeType
"
:
"
range
"
,
"
borderType
"
:
"
border-all
"
,
"
style
"
:
"
1
"
,
"
color
"
:
"
#000000
"
,
"
range
"
:
[{
"
row
"
:
[
0
,
0
],
"
column
"
:
[
0
,
0
]
}]
}
let
warn
=
0
;
map
.
forEach
((
value
,
key
)
=>
{
const
suffixArr
=
key
.
split
(
'
/
'
),
mat
=
suffixArr
[
0
],
depp
=
suffixArr
[
1
];
let
searchResult
=
luckysheet
.
find
(
mat
);
if
(
searchResult
.
length
!=
0
&&
key
!=
null
)
{
rowws
=
searchResult
[
0
].
row
;
luckysheet
.
insertRow
(
rowws
+
1
);
let
vll1
=
luckysheet
.
getCellValue
(
rowws
,
sysRulez
[
0
].
ct
);
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRulez
[
0
].
ct
,
{
"
ct
"
:
{
"
fa
"
:
"
@
"
,
"
t
"
:
"
n
"
}catch(err){
throw new Error(
"
导入失败
,
导入文件与模板规则不匹
"
);
}
asyncTasks.push(
new Promise((innerResolve, innerReject) => {
const allNull = smallMat.every(item =>item===null);
if (allNull ) {
throw new Error(
"
导入失败
,
导入文件错误
,
所选文件与模板规则不匹
"
);
}
function sortArray(array) {
array.sort((a, b) => b.code.length - a.code.length)
return array
}
materialList().then(response => {
let SixMateriel=[];
let MaterielCode=[];
let NewMarterielCode=[];
let SixList=[];
let newSmasll =newsmallMat;
let m=0
SixMateriel=response.rows
for(var i=0;i<SixMateriel.length;i++){
if(SixMateriel[i].code!==null){
MaterielCode.push(SixMateriel[i])
}
}
NewMarterielCode= sortArray(MaterielCode)
for (let i = 0; i < NewMarterielCode.length; i++) {
for (let j = 0; j < newSmasll.length; j++) {
if(newSmasll[j] !== null){
m++
if (NewMarterielCode[i].code==newSmasll[j].code.slice(0,NewMarterielCode[i].code.length)) {
SixList[newSmasll[j].index]=NewMarterielCode[i].codes;
newSmasll.splice(j,1);
j--;
}
}
}
}
//console.log(newSmasll)
for (let k = 0; k < newSmasll.length; k++) {
SixList[newSmasll[k].index]='11';
m++;
}
//console.log(m)
//console.log(SixList,'1231231231231')
this.NewSixList=SixList
for (let i = parseFloat(sysRulez[0].re) + 1, k = 0; i < data.length; i++, k++) {
let values = [];
if (data[i][key_i] != null) {
for (let j = 0; j < value.length; j++) {
try{
let a = parseFloat(data[i][value[j]].v);
values.push(a);
}catch (err){
this.$message({
message:
"
导入失败
,
导入文件不匹
"
,
type:
"
error
"
});
innerReject(error); // 异步请求出错
}
}
//console.log(SixList)
let key = SixList[k] + '/' + deps[k];
if (map.has(key)) {
let oldValues = map.get(key);
for (let i = 0; i < values.length; i++) {
values[i] = parseFloat(parseFloat(values[i] + oldValues[i]).toFixed(2));
}
map.set(key, values);
} else {
map.set(key, values);
}
}
});
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRulez
[
0
].
ct
,
vll1
);
let
vll2
=
luckysheet
.
getCellValue
(
rowws
,
parseInt
(
sysRulez
[
0
].
ct
)
+
1
);
luckysheet
.
setCellValue
(
rowws
+
1
,
parseInt
(
sysRulez
[
0
].
ct
)
+
1
,
vll2
);
//输出部门数量金额
}
console.log(map);
//循环得到汇总结果
if (map.size === 0) {
throw new Error(
"
导入失败
,
导入文件错误
"
);
}
//返回单元格第二行的数据
//let celn=luckysheet.getcellvalue(1);
//返回当前工作表第1列数据
//let cown=luckysheet.getcellvalue(null,0);
let rowws;
let config;
let bord = {
"
rangeType
"
:
"
range
"
,
"
borderType
"
:
"
border
-
all
"
,
"
style
"
:
"
1
"
,
"
color
"
:
"
#
000000
"
,
"
range
"
: [{
"
row
"
: [0, 0],
"
column
"
: [0, 0]
}]
}
let warn=0;
map.forEach((value, key) => {
const suffixArr = key.split('/'), mat = suffixArr[0], depp = suffixArr[1];
let searchResult = luckysheet.find(mat);
if (searchResult.length != 0 && key != null) {
rowws = searchResult[0].row;
luckysheet.insertRow(rowws + 1);
let vll1=luckysheet.getCellValue(rowws,sysRulez[0].ct);
luckysheet.setCellValue(rowws+1, sysRulez[0].ct, {
"
ct
"
: {
"
fa
"
:
"
@
"
,
"
t
"
:
"
n
"
}
});
luckysheet.setCellValue(rowws + 1, sysRulez[0].ct, vll1);
let vll2=luckysheet.getCellValue(rowws,parseInt(sysRulez[0].ct)+1);
luckysheet.setCellValue(rowws + 1, parseInt(sysRulez[0].ct)+1, vll2);
//输出部门数量金额
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRulez
[
1
].
ct
,
depp
);
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRules
[
i
].
ct
,
value
[
i
]);
//修改单元格样式
/*luckysheet.setCellValue(rowws+g, sysRules[i].ct, {
"ct": {
"fa": "General",
"t": "n"
luckysheet.setCellValue(rowws + 1, sysRulez[1].ct, depp);
for (let i = 0; i < sysRules.length; i++) {
luckysheet.setCellValue(rowws + 1, sysRules[i].ct, value[i]);
//
}
});*/
}
//输出单价
luckysheet
.
setCellValue
(
rowws
+
1
,
parseInt
(
sysRules
[
0
].
ct
)
+
1
,
value
[
1
]
/
value
[
0
]);
//修改单价样式
/*luckysheet.setCellValue(rowws+g,parseInt(sysRules[0].ct)+1,{
"ct": {
"fa": "0.0000",
"t": "n"
}
});*/
//输出单价
luckysheet.setCellValue(rowws + 1, parseInt(sysRules[0].ct) + 1, value[1] / value[0]);
config = luckysheet.getConfig(0);
bord.range[0].row = [rowws + 1, rowws + 1];
bord.range[0].column = [0, parseInt(sysRules[sysRules.length - 1].ct)];
...
...
@@ -1143,28 +1455,33 @@ export default {
warn++;
}
});
if
(
warn
===
map
.
size
)
{
throw
new
Error
(
"
导入文件与所选模板规则不匹配
"
);
}
else
if
(
warn
>
0
)
{
this
.
$message
({
message
:
"
还有
"
+
warn
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
}
resolve
(
response
.
rows
);
innerResolve
();
// 标记当前异步任务完成
/*let find1 = luckysheet.find("合计");
let number = parseInt(find1[0].row)-1;
luckysheet.setCellValue(find1[0].row, sysRules[sysRules.length-1].ct, "=SUM(F2:F"+number+")")*/
}).
catch
(
Error
=>
{
//必须加,不能删除
innerReject
(
Error
);
// 异步请求出错
});
}));
}
break
;
if (warn === map.size) {
throw new Error(
"
导入文件与所选模板规则不匹配
"
);
} else if (warn > 0) {
this.$message({
message:
"
还有
"
+warn+
"
条大类未能匹配到
"
,
type:
"
warning
"
});
}
// 记录结束时间
const endTime = new Date();
// 计算执行时间(以毫秒为单位)
const executionTime = endTime - startTime;
// 输出执行时间
console.log('endTime'+endTime)
console.log('endTime'+startTime)
console.log(`代码执行时间:${executionTime} 毫秒`);
resolve(response.rows);
innerResolve(); // 标记当前异步任务完成
}).catch(Error => {
//必须加,不能删除
innerReject(Error); // 异步请求出错
});
}));
}
break;
default :
{
let map = new Map();
...
...
@@ -1186,7 +1503,7 @@ export default {
const allNull = smallMat.every(item =>item===null);
if (allNull ) {
throw new Error(
"
导入失败
,
导入文件错误
,
所选文件与模板规则不匹
"
);
}
}
materialConvert(smallMat)
.then(response => {
let array = response.rows;
...
...
@@ -1314,7 +1631,6 @@ export default {
}
});
},
/** 导出设置 */
handleExport: debounce(function() {
...
...
@@ -1327,6 +1643,7 @@ export default {
var data = response.data;
for (let i = 0; i < data.length; i++) {
debugger
if(data[i].identifyingCode == 1){
/*生成表*/
let jsonDataa = JSON.parse(data[i].historyContent);
...
...
@@ -1450,7 +1767,6 @@ export default {
}
}
let b5 ;
if(datab[w][4] != null){
b5= datab[w][4].v;
...
...
@@ -1459,7 +1775,6 @@ export default {
}
}
let b6 ;
if(datab[w][5] != null){
b6= datab[w][5].v;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment