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
a4fb04dd
Commit
a4fb04dd
authored
Jul 05, 2024
by
刘_震
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据编码找到对应的一级,二级分类名称以及前端代码
parent
528ea3fb
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1517 additions
and
614 deletions
+1517
-614
ruoyi-ui/README.md
ruoyi-ui/README.md
+1
-1
ruoyi-ui/src/Wages/convers.js
ruoyi-ui/src/Wages/convers.js
+189
-106
ruoyi-ui/src/api/conversion/index.js
ruoyi-ui/src/api/conversion/index.js
+71
-16
ruoyi-ui/src/conversion/LinxiMine.js
ruoyi-ui/src/conversion/LinxiMine.js
+7
-7
ruoyi-ui/src/conversion/MoneyMine.js
ruoyi-ui/src/conversion/MoneyMine.js
+0
-11
ruoyi-ui/src/conversion/TangshanMin.js
ruoyi-ui/src/conversion/TangshanMin.js
+0
-18
ruoyi-ui/src/conversion/YunFei.js
ruoyi-ui/src/conversion/YunFei.js
+0
-25
ruoyi-ui/src/conversion/ZhongRun.js
ruoyi-ui/src/conversion/ZhongRun.js
+0
-1
ruoyi-ui/src/conversion/conversion.js
ruoyi-ui/src/conversion/conversion.js
+103
-58
ruoyi-ui/src/conversion/hongMine.js
ruoyi-ui/src/conversion/hongMine.js
+0
-2
ruoyi-ui/src/conversion/lvMine.js
ruoyi-ui/src/conversion/lvMine.js
+1
-1
ruoyi-ui/src/utils/tzc.js
ruoyi-ui/src/utils/tzc.js
+134
-208
ruoyi-ui/src/views/system/Wages/TangshanWages.vue
ruoyi-ui/src/views/system/Wages/TangshanWages.vue
+10
-3
ruoyi-ui/src/views/system/supplies/salarySummary/index.vue
ruoyi-ui/src/views/system/supplies/salarySummary/index.vue
+773
-144
ruoyi-ui/src/views/system/supplies/salarySummaryintermediateTabl/index.vue
...s/system/supplies/salarySummaryintermediateTabl/index.vue
+12
-11
ruoyi-ui/vue.config.js
ruoyi-ui/vue.config.js
+11
-2
ruoyi-wages/src/main/java/com/ruoyi/system/controller/AsiccSuppliesController.java
.../com/ruoyi/system/controller/AsiccSuppliesController.java
+35
-0
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/AsiccSuppliesMapper.java
...ain/java/com/ruoyi/system/mapper/AsiccSuppliesMapper.java
+20
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/AsiccDAO.java
.../main/java/com/ruoyi/system/model/wages/dao/AsiccDAO.java
+23
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/vo/AsiccVo.java
...rc/main/java/com/ruoyi/system/model/wages/vo/AsiccVo.java
+17
-0
ruoyi-wages/src/main/java/com/ruoyi/system/service/AsiccSuppliesService.java
...n/java/com/ruoyi/system/service/AsiccSuppliesService.java
+16
-0
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/AsiccSuppliesServiceImpl.java
...m/ruoyi/system/service/impl/AsiccSuppliesServiceImpl.java
+57
-0
ruoyi-wages/src/main/resources/mapper/system/AsiccSuppliesMapper.xml
.../src/main/resources/mapper/system/AsiccSuppliesMapper.xml
+37
-0
No files found.
ruoyi-ui/README.md
View file @
a4fb04dd
## 开发
1
## 开发
```
bash
# 克隆项目
...
...
ruoyi-ui/src/Wages/convers.js
View file @
a4fb04dd
...
...
@@ -5,8 +5,14 @@ import {
listMyluckyexcel
,
getyy
,
}
from
"
@/api/ruoyi-myLuckyexcel/myluckyexcel
"
;
import
{
transformJson
,
tzcCreateData
,
gettransformJson
}
from
"
@/utils/tzc
"
import
{
conversionSave
,
surface
,
getRecentFormulas
}
from
"
@/api/conversion/index
"
;
import
{
conversionSave
,
surface
,
getRecentFormulas
,
importLxWagesExcel
,
lxSummary
}
from
"
@/api/conversion/index
"
;
// import luckysheet from 'luckysheet'
import
LuckyExcel
from
"
luckyexcel
"
;
//导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!
...
...
@@ -17,13 +23,17 @@ import { TableColumn } from "element-ui";
import
{
watch
}
from
"
vue
"
;
import
{
machGzdata
}
from
"
@/Wages/conversTsk.js
"
;
import
{
machLxGzdata
}
from
"
@/Wages/conversLxk.js
"
;
import
{
data
}
from
"
jquery
"
;
import
{
transformJson
,
tzcCreateData
,
newGettransformJson
}
from
"
@/utils/tzc
"
// import { config } from "vue/types/umd";
var
fileName
=
"
新建XLSX工作表
"
;
//定义表名
var
rule
=
[];
var
tempId
;
var
uuid1
;
var
modify
=
false
;
var
that
;
export
default
{
name
:
"
Mymodule
"
,
data
()
{
...
...
@@ -41,18 +51,20 @@ export default {
luckysheetDatas
:
""
,
depss
:
[],
fileList
:
[],
VoucherForm
:
''
,
VoucherForm
:
""
,
dialogTableVisible
:
false
,
all
:
''
,
all
:
""
,
jsonhead
:
[],
sum
:
[],
// 查询参数
queryParams
:
{
status
:
0
,
},
mineId
:
''
,
//矿ID
};
},
created
()
{
that
=
this
;
//刷新页面时进行的操作
this
.
getList
();
},
...
...
@@ -156,7 +168,6 @@ export default {
//工资数据后台导入成功后,数据展示到前台
loadTableData
(
evt
)
{
this
.
sum
.
push
(
evt
);
if
(
modify
)
{
this
.
$confirm
(
"
再次导入将会清空表内数据,是否继续操作?
"
,
...
...
@@ -189,8 +200,8 @@ export default {
modify
=
false
;
this
.
open
(
this
.
sum
);
})
.
then
(
async
()
=>
{
})
.
catch
(()
=>
{
});
.
then
(
async
()
=>
{})
.
catch
(()
=>
{});
})
.
catch
(()
=>
{
// 用户点击了取消按钮
...
...
@@ -205,7 +216,7 @@ export default {
LuckyExcel
(
evt
,
(
exportJson
)
=>
{
//获取导入表格所有数据exportJson
this
.
open
(
exportJson
)
.
then
(
async
()
=>
{
})
.
then
(
async
()
=>
{})
.
catch
((
error
)
=>
{
this
.
$message
({
message
:
error
.
message
,
...
...
@@ -221,8 +232,25 @@ export default {
},
async
handleFileChange
(
evt
)
{
if
(
this
.
value
.
includes
(
'
凭证
'
))
{
this
.
loadTableData
(
evt
)
if
(
this
.
value
.
includes
(
"
凭证
"
))
{
this
.
loadTableData
(
evt
);
}
else
if
(
this
.
value
.
includes
(
"
林西
"
))
{
//组装后台接口数据
var
param
=
new
FormData
();
param
.
append
(
"
file
"
,
evt
);
param
.
append
(
"
date
"
,
this
.
wageMonth
);
param
.
append
(
"
mineId
"
,
this
.
mineId
);
param
.
append
(
"
identification
"
,
"
0
"
);
//林西矿工资基础数据导入
importLxWagesExcel
(
param
).
then
((
res
)
=>
{
//导入成功
if
(
res
.
code
==
200
)
{
this
.
loadTableData
(
evt
);
}
else
{
this
.
$message
.
error
(
"
后台数据导入失败!
"
);
}
});
}
else
{
//组装后台接口数据
var
param
=
new
FormData
();
...
...
@@ -240,10 +268,17 @@ export default {
}
//前台加载数据
},
handleOptionChange
(
value
)
{
handleOptionChange
(
value
,
mine_id
)
{
that
.
mineId
=
mine_id
.
id
let
lod
=
this
.
$loading
({
lock
:
true
,
text
:
"
加载中
"
,
background
:
"
rgba(0, 0, 0, 0.7)
"
,
});
//根据选中的下拉选项值获取相应的信息
getSuppliesTemplate
(
this
.
selectedOption
)
.
then
((
response
)
=>
{
lod
.
close
();
modify
=
false
;
tempId
=
this
.
selectedOption
;
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
...
...
@@ -252,8 +287,6 @@ export default {
var
json_data
=
JSON
.
parse
(
sysSupplies
[
0
].
templateContent
);
this
.
jsondata
=
json_data
;
roleList
(
value
).
then
((
response
)
=>
{
this
.
luckyrule
=
response
.
rows
;
});
...
...
@@ -271,40 +304,60 @@ export default {
status
:
"
1
"
,
//激活状态
});
this
.
value
=
fileName
;
if
(
!
fileName
.
includes
(
'
凭证
'
))
{
let
head
=
this
.
jsondata
[
0
].
celldata
.
filter
(
item
=>
item
.
r
&&
item
.
r
==
2
&&
item
.
c
>
0
)
head
.
forEach
(
item
=>
{
if
(
!
fileName
.
includes
(
"
凭证
"
))
{
var
excel_r
=
0
;
//读取行
var
excel_c
=
0
;
//读取起始列
if
(
fileName
.
includes
(
"
唐山
"
))
{
excel_r
=
2
;
}
else
if
(
fileName
.
includes
(
"
林西
"
)){
excel_r
=
3
;
}
let
head
=
this
.
jsondata
[
0
].
celldata
.
filter
(
(
item
)
=>
item
.
r
&&
item
.
r
==
excel_r
&&
item
.
c
>
excel_c
);
this
.
jsonhead
=
[];
head
.
forEach
((
item
)
=>
{
let
funct
=
{
label
:
item
.
v
.
v
+
'
=
'
,
label
:
item
.
v
.
v
+
"
=
"
,
c
:
item
.
c
,
value
:
''
}
this
.
jsonhead
.
push
(
funct
)
value
:
""
,
}
;
this
.
jsonhead
.
push
(
funct
)
;
});
//获取最新的公式
getRecentFormulas
().
then
((
response
)
=>
{
getRecentFormulas
(
that
.
mineId
).
then
((
response
)
=>
{
if
(
response
.
code
==
200
)
{
var
data
=
response
.
data
;
if
(
data
)
{
var
json
=
JSON
.
parse
(
data
);
json
.
forEach
(
item
=>
{
json
.
forEach
(
(
item
)
=>
{
if
(
item
.
value
)
{
this
.
jsonhead
.
forEach
(
head
=>
{
if
(
item
.
label
==
head
.
label
)
{
head
.
value
=
item
.
value
;
this
.
jsonhead
.
forEach
(
(
head
)
=>
{
if
(
item
.
label
==
head
.
label
)
{
head
.
value
=
item
.
value
;
}
}
}
);
);
}
});
}
}
});
}
})
.
catch
(()
=>
{
lod
.
close
();
// 处理错误逻辑,这里是一个空的错误处理函数
this
.
$message
.
error
(
"
查询失败,发生未知错误!
"
);
});
...
...
@@ -312,73 +365,53 @@ export default {
initData
()
{
try
{
// 将 this.jsonhead 转换为 JSON 字符串
const
postData
=
this
.
jsonhead
.
filter
(
item
=>
item
.
value
.
trim
()
!=
''
);
var
jsonString
=
JSON
.
stringify
(
this
.
jsonhead
);
const
postData
=
this
.
jsonhead
.
filter
(
(
item
)
=>
item
.
value
.
trim
()
!=
""
);
// 使用 localStorage 存储
//localStorage.setItem('myData', jsonString);
this
.
dialogTableVisible
=
false
this
.
dialogTableVisible
=
false
;
const
CompositeTable
=
this
.
jsondata
;
var
putJson
=
{
date
:
this
.
wageMonth
,
data
:
postData
}
surface
(
putJson
).
then
((
response
)
=>
{
if
(
response
.
code
==
200
)
{
var
data
=
response
.
data
;
let
myCompositeTable
=
machGzdata
(
data
,
CompositeTable
);
CompositeTable
[
0
].
data
=
luckysheet
.
transToData
(
myCompositeTable
[
0
].
celldata
);
CompositeTable
[
0
].
calcChain
=
[];
let
as
=
CompositeTable
[
0
].
celldata
.
filter
((
item
)
=>
item
.
v
.
f
);
as
.
forEach
((
item
)
=>
{
let
sum
=
{
index
:
CompositeTable
[
0
].
index
,
r
:
item
.
r
,
c
:
item
.
c
,
};
CompositeTable
[
0
].
calcChain
.
push
(
sum
);
});
CompositeTable
[
0
].
celldata
[
0
].
status
=
1
;
luckysheet
.
create
({
forceCalculation
:
true
,
container
:
"
luckysheet
"
,
title
:
fileName
,
data
:
CompositeTable
,
showinfobar
:
false
,
lang
:
"
zh
"
,
});
}
else
{
}
});
let
obj
=
{
yearMonth
:
this
.
wageMonth
,
jsonData
:
JSON
.
stringify
(
CompositeTable
),
value
:
jsonString
data
:
postData
,
};
modify
=
true
;
this
.
showMask
=
false
;
conversionSave
(
obj
).
then
((
response
)
=>
{
});
//林西矿
if
(
this
.
selectedOption
==
1280
)
{
//林西矿工资汇总
lxSummary
(
putJson
).
then
((
response
)
=>
{
if
(
response
.
code
==
200
)
{
var
data
=
response
.
data
;
let
myCompositeTable
=
machLxGzdata
(
data
,
CompositeTable
);
this
.
setLuckysheetData
(
CompositeTable
,
myCompositeTable
);
}
else
{
}
});
}
else
{
//唐山工资汇总
surface
(
putJson
).
then
((
response
)
=>
{
if
(
response
.
code
==
200
)
{
var
data
=
response
.
data
;
let
myCompositeTable
=
machGzdata
(
data
,
CompositeTable
);
this
.
setLuckysheetData
(
CompositeTable
,
myCompositeTable
);
}
else
{
}
});
}
}
catch
{
this
.
open4
();
modify
=
true
;
...
...
@@ -386,6 +419,48 @@ export default {
}
},
//工资数据后台汇总完后,回显到前台
setLuckysheetData
(
CompositeTable
,
myCompositeTable
){
CompositeTable
[
0
].
data
=
luckysheet
.
transToData
(
myCompositeTable
[
0
].
celldata
);
CompositeTable
[
0
].
calcChain
=
[];
let
as
=
CompositeTable
[
0
].
celldata
.
filter
(
(
item
)
=>
item
.
v
.
f
);
as
.
forEach
((
item
)
=>
{
let
sum
=
{
index
:
CompositeTable
[
0
].
index
,
r
:
item
.
r
,
c
:
item
.
c
,
};
CompositeTable
[
0
].
calcChain
.
push
(
sum
);
});
CompositeTable
[
0
].
celldata
[
0
].
status
=
1
;
luckysheet
.
create
({
forceCalculation
:
true
,
container
:
"
luckysheet
"
,
title
:
fileName
,
data
:
CompositeTable
,
showinfobar
:
false
,
lang
:
"
zh
"
,
});
var
jsonString
=
JSON
.
stringify
(
this
.
jsonhead
);
let
obj
=
{
yearMonth
:
this
.
wageMonth
,
jsonData
:
JSON
.
stringify
(
CompositeTable
),
value
:
jsonString
,
mineId
:
that
.
mineId
};
modify
=
true
;
that
.
showMask
=
false
;
conversionSave
(
obj
).
then
((
response
)
=>
{});
},
//转换方法
zhuan
()
{
const
promises
=
this
.
sum
.
map
((
item
)
=>
{
...
...
@@ -404,8 +479,8 @@ export default {
if
(
this
.
value
.
includes
(
"
凭证
"
))
{
this
.
VoucherForms
(
sum
);
}
else
{
this
.
all
=
sum
this
.
dialogTableVisible
=
true
this
.
all
=
sum
;
this
.
dialogTableVisible
=
true
;
}
});
// .catch(error => {
...
...
@@ -413,23 +488,33 @@ export default {
// // 处理错误情况
// });
},
async
VoucherForms
(
sum
)
{
//公式窗口关闭回调
handleClose
(){
that
.
dialogTableVisible
=
false
;
that
.
showMask
=
false
;
},
async
VoucherForms
(
sum
)
{
// try {
let
objks
=
await
gettransformJson
(
sum
)
let
createData
=
tzcCreateData
(
this
.
luckysheetDatas
[
0
],
transformJson
(
objks
.
data
),
luckysheet
,
this
.
phone
,
this
.
wageMonth
)
let
objks
=
await
newGettransformJson
(
sum
,
that
.
mineId
)
let
createData
=
tzcCreateData
(
this
.
luckysheetDatas
[
0
],
transformJson
(
objks
.
data
),
luckysheet
,
this
.
phone
,
this
.
wageMonth
);
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
fileName
,
// Excel 文件名
allowEdit
:
false
,
//作用:是否允许前台编辑
data
:
createData
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
"
zh
"
,
});
modify
=
true
;
this
.
showMask
=
false
;
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
fileName
,
// Excel 文件名
allowEdit
:
false
,
//作用:是否允许前台编辑
data
:
createData
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
"
zh
"
,
})
modify
=
true
;
this
.
showMask
=
false
;
// } catch {
// modify = true;
// this.showMask = false;
...
...
@@ -444,7 +529,6 @@ export default {
},
};
// debounce函数定义
function
debounce
(
func
,
delay
)
{
let
timer
;
...
...
@@ -457,4 +541,3 @@ function debounce(func, delay) {
},
delay
);
};
}
ruoyi-ui/src/api/conversion/index.js
View file @
a4fb04dd
// 工资汇总
import
request
from
'
@/utils/request
'
import
request
from
"
@/utils/request
"
;
// 新增
export
function
conversionSave
(
data
)
{
return
request
({
url
:
'
/conversion/save
'
,
method
:
'
post
'
,
data
:
data
})
return
request
({
url
:
"
/conversion/save
"
,
method
:
"
post
"
,
data
:
data
,
});
}
// 工资汇总列表
export
function
conversionGetWagesData
(
query
)
{
return
request
({
url
:
'
/conversion/getWagesData
'
,
method
:
'
get
'
,
params
:
query
})
return
request
({
url
:
"
/conversion/getWagesData
"
,
method
:
"
post
"
,
data
:
query
,
});
}
// 修改
export
function
conversionUpdate
(
data
)
{
return
request
({
url
:
'
/conversion/update
'
,
method
:
'
post
'
,
data
})
return
request
({
url
:
"
/conversion/update
"
,
method
:
"
post
"
,
data
});
}
export
function
getWagesDataById
(
id
)
{
return
request
({
url
:
`/conversion/getWagesDataById/
${
id
}
`
,
method
:
'
get
'
})
return
request
({
url
:
`/conversion/getWagesDataById/
${
id
}
`
,
method
:
"
get
"
,
});
}
//唐山矿工资转换
export
function
surface
(
data
)
{
return
request
({
url
:
'
/wages/calculate/surface
'
,
method
:
'
post
'
,
data
:
data
})
return
request
({
url
:
"
/wages/calculate/surface
"
,
method
:
"
post
"
,
data
:
data
,
});
}
//获取最近的公式
export
function
getRecentFormulas
(
id
)
{
return
request
({
url
:
'
/conversion/recentFormulas
'
,
method
:
'
get
'
})
export
function
getRecentFormulas
(
mineId
)
{
return
request
({
url
:
`/conversion/recentFormulas/
${
mineId
}
`
,
method
:
"
get
"
});
}
//=======林西矿接口
//
export
function
importLxWagesExcel
(
data
)
{
return
request
({
url
:
"
/wages/lxWages
"
,
method
:
"
post
"
,
headers
:
{
"
Content-Type
"
:
"
multipart/form-data
"
,
},
data
:
data
,
});
}
//林西矿工资汇总
export
function
lxSummary
(
data
)
{
return
request
({
url
:
"
/wages/lxSummary
"
,
method
:
"
post
"
,
data
:
data
,
});
}
//对照表接口
export
function
compilationExcel
(
data
)
{
return
request
({
url
:
"
/wages/compilation/excel
"
,
method
:
"
post
"
,
headers
:
{
"
Content-Type
"
:
"
multipart/form-data
"
,
},
data
:
data
,
});
}
//对照表列表查询
export
function
getWagesCompilationList
()
{
return
request
({
url
:
"
/wages/compilation/list
"
,
method
:
"
get
"
});
}
ruoyi-ui/src/conversion/LinxiMine.js
View file @
a4fb04dd
...
...
@@ -32,19 +32,19 @@ export function Linxi(names, Department, money, code, duplicateData, CompositeTa
}
});
});
// 删除指定分类
const
filteredClassifications
=
[
"
研发费用
"
,
"
基金
"
,
"
安全费用
"
];
money
=
money
.
filter
(
item
=>
!
filteredClassifications
.
includes
(
item
.
classify
));
// // 删除指定分类
// const filteredClassifications = ["研发费用", "基金", "安全费用"];
// money = money.filter(item => !filteredClassifications.includes(item.classify));
// // 提取特定属性值相同的数据
// const Electromechanical = "机电制造分公司";
// money = money.filter(item => item.remark !== Electromechanical);
// 替换属性值
money
.
forEach
(
item
=>
{
if
(
item
.
head
===
"
坑木
"
)
item
.
head
=
"
木材
"
;
if
(
!
item
.
remark
)
item
.
v
.
name
=
"
基本生产-原煤
"
;
});
// 提取特定属性值相同的数据
const
Electromechanical
=
"
机电制造分公司
"
;
money
=
money
.
filter
(
item
=>
item
.
remark
!==
Electromechanical
);
// // 对比替换导入表和模板的列数
codess
.
forEach
(
code
=>
{
let
codeLength
=
String
(
code
.
code
).
length
;
...
...
ruoyi-ui/src/conversion/MoneyMine.js
View file @
a4fb04dd
...
...
@@ -312,17 +312,6 @@ export function MoneyMine(money, DepartmentColumns, name, materianame, c, Compos
Fusion
.
v
.
m
=
item
.
v
.
v
CompositeTable
[
0
][
"
celldata
"
].
push
(
Fusion
)
})
// 替换金额所在列和行相同的模板表中的数据
//金额所在列和行,去模板表中查找,如果行列一致则替换
// for (let i = 0; i < duplicateData.length; i++) {
// // // 对比 c 和 r 是否与 CompositeTable[0]["celldata"] 中相应对象相同
// for (let k = 0; k < CompositeTable[0]["celldata"].length; k++) {
// if (duplicateData[i].r === CompositeTable[0]["celldata"][k].r && duplicateData[i].c === CompositeTable[0]["celldata"][k].c) {
// // 如果相同,则进行替换
// CompositeTable[0]["celldata"][k] = duplicateData[i];
// }
// }
// }
let
duplic
=
{
duplicateData
:
duplicateData
,
CompositeTable
:
CompositeTable
...
...
ruoyi-ui/src/conversion/TangshanMin.js
View file @
a4fb04dd
...
...
@@ -31,21 +31,6 @@ export function Tangshan(money, c, name, CompositeTable, headRow, researchs) {
}
return
null
;
}
// money.forEach(obj => {
// researchs.forEach(item => {
// if (obj.r == item.r) {
// obj.research = item.v.v
// }
// })
// research.forEach(item => {
// if (obj.research == item.old) {
// if (item.new) {
// obj.research = item.new
// }
// }
// })
// })
let
targetValue
=
"
器材大类
"
;
let
resultObject
=
findValueInArray
(
c
,
targetValue
);
let
material
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
==
resultObject
.
c
&&
obj
.
r
>
headRow
)
...
...
@@ -64,9 +49,6 @@ export function Tangshan(money, c, name, CompositeTable, headRow, researchs) {
money
[
i
].
v
.
material
=
material
[
i
].
v
.
v
;
}
}
// money = money.filter(obj => obj.v.name == "基本生产" || obj.v.name == "制造费用" || obj.v.name.includes('洗煤') || obj.v.name == "其他业务成本" || obj.v.name == "其他费用" || obj.v.name == "管理费用" || obj.v.name == "销售费用")
//对费用来源列和材料分类列进行处理
money
.
forEach
(
obj
=>
{
if
(
!
obj
.
v
.
material
)
{
...
...
ruoyi-ui/src/conversion/YunFei.js
View file @
a4fb04dd
...
...
@@ -97,31 +97,6 @@ export function YunFei(money, Department, code, name, codess, newArrayhong) {
}
};
});
// console.log(duplicateData)
// duplicateData.forEach(item => {
// const Fusion = {
// "r": '',
// "c": '',
// "v": {
// "ct": {
// "fa": "@",
// "t": "s"
// },
// "fs": 8,
// "ff": "微软雅黑",
// "tb": 2,
// "v": "",
// "qp": 1,
// "m": ""
// }
// };
// Fusion.r=item.r
// Fusion.c=item.c
// Fusion.v.v=item.v.v
// Fusion.v.m=item.v.v
// newArrayhong[0]["celldata"].push(Fusion)
// })
// 替换原始数据中的重复单元格数据
//金额所在列和行,去模板表中查找,如果行列一致则替换
for
(
let
i
=
0
;
i
<
duplicateData
.
length
;
i
++
)
{
// // 对比 c 和 r 是否与 newArrayhong[0]["celldata"] 中相应对象相同
...
...
ruoyi-ui/src/conversion/ZhongRun.js
View file @
a4fb04dd
...
...
@@ -183,7 +183,6 @@ export function ZhongRun(Department, money, materianame, name, CompositeTable, q
})
Secondcoloumn
.
forEach
(
item
=>
{
CompositeTable
[
0
].
celldata
.
forEach
(
obj
=>
{
if
(
obj
.
v
&&
obj
.
v
.
v
&&
obj
.
v
.
v
.
includes
(
item
.
materianame
))
{
item
.
r
=
obj
.
r
}
...
...
ruoyi-ui/src/conversion/conversion.js
View file @
a4fb04dd
...
...
@@ -33,6 +33,7 @@ import LuckyExcel from "luckyexcel";
import
{
exportExcel
}
from
"
../../public/exportExcel
"
;
import
{
v4
as
uuidv4
}
from
"
uuid
"
;
import
{
min
}
from
"
moment/moment
"
;
import
{
setXRow
,
setXColumn
}
from
'
@/utils/tzc
'
var
fileName
=
"
新建XLSX工作表
"
;
//定义表名
var
rule
=
[];
...
...
@@ -132,6 +133,7 @@ export default {
// this.list()
},
methods
:
{
delect
()
{
this
.
mine
=
""
;
this
.
selectname
=
""
;
...
...
@@ -153,15 +155,7 @@ export default {
//const json_data = response.data;
this
.
jsondata
=
JSON
.
parse
(
sysSupplies
[
0
].
templateContent
);
});
// //单侯煤矿需要的东西
// getSuppliesTemplate(1264).then(response => {
// const sysSupplies = response.rows;
// this.newArray = JSON.parse(sysSupplies[0].templateContent);
// })
// getSuppliesTemplate(1268).then(response => {
// const sysSupplies = response.rows;
// this.newArrayhong = JSON.parse(sysSupplies[0].templateContent);
// })
},
//手机号
open
(
evt
)
{
...
...
@@ -477,6 +471,7 @@ export default {
},
//转换方法
transformPromises
()
{
// try {
let
result
=
this
.
result
this
.
dialogTableVisible
=
false
...
...
@@ -502,8 +497,9 @@ export default {
let
cjson
=
JSON
.
stringify
(
c
);
let
config
=
cc
.
sheets
[
0
].
config
;
//表头所在行
let
headRow
=
this
.
cleaning
[
0
].
HeaderRow
-
2
;
let
headROWs
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
r
==
headRow
)
//部门所在列及所有部门的数据
let
DepartmentColumns
=
this
.
cleaning
[
0
].
DepartmentColumn
-
1
;
let
Department
=
c
...
...
@@ -559,6 +555,7 @@ export default {
let
names
=
this
.
cleaning
[
0
].
sourceColoumn
?
this
.
cleaning
[
0
].
sourceColoumn
-
1
:
null
;
let
name
=
names
?
c
.
flat
()
...
...
@@ -569,6 +566,7 @@ export default {
obj
.
r
>
headRow
)
:
null
;
//材料名称所在列
let
materias
=
this
.
cleaning
[
0
].
NameColumn
-
1
;
let
materianame
=
c
...
...
@@ -748,28 +746,30 @@ export default {
item
.
v
&&
((
typeof
item
.
v
.
v
===
"
string
"
&&
item
.
v
.
v
.
includes
(
"
其他材料
"
))
||
(
typeof
item
.
v
.
m
===
"
string
"
&&
item
.
v
.
m
.
includes
(
"
材料
"
)))
(
typeof
item
.
v
.
v
===
"
string
"
&&
item
.
v
.
v
.
includes
(
"
生产
材料
"
)))
)[
0
].
r
;
let
material
=
CompositeTable
[
0
][
"
celldata
"
]
.
flat
()
.
filter
((
obj
)
=>
obj
.
r
&&
obj
.
r
===
matchedItems
);
console
.
log
(
material
)
duplicateData
.
forEach
((
obj
)
=>
{
obj
.
v
.
material
=
''
material
.
forEach
((
cell
)
=>
{
if
(
obj
.
c
===
cell
.
c
)
{
obj
.
v
.
material
=
cell
.
v
.
v
;
}
});
});
console
.
log
(
duplicateData
,
'
2222222222
'
)
var
cellList
=
[];
var
newHistoryContent
=
JSON
.
parse
(
this
.
ImportTables
.
historyContent
);
let
maxC
=
Math
.
max
(...
newHistoryContent
[
0
].
celldata
.
map
(
item
=>
item
.
c
));
let
maxC
=
headROWs
.
length
-
1
duplicateData
.
forEach
((
item
)
=>
{
//新加字段内容拼接
var
newName
=
item
.
v
.
name
+
"
-
"
+
item
.
v
.
material
;
item
.
index
.
forEach
((
i
)
=>
{
var
cell26
=
{
r
:
i
,
...
...
@@ -796,21 +796,21 @@ export default {
newHistoryContent
[
0
].
data
=
luckysheet
.
transToData
(
newHistoryContent
[
0
][
"
celldata
"
]
);
if
(
!
this
.
value
.
includes
(
"
凭证
"
))
{
if
(
!
this
.
value
.
includes
(
"
凭证
"
)
||
this
.
mining
==
"
011706
"
)
{
luckysheet
.
create
({
forceCalculation
:
true
,
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
fileName
,
// Excel 文件名
data
:
CompositeTable
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
"
zh
"
,
// allowEdit: false
});
//
luckysheet.refreshFormula(); //渲染公式
luckysheet
.
refreshFormula
();
//渲染公式
modify
=
true
;
this
.
showMask
=
false
;
}
if
(
this
.
mining
==
'
011706
'
)
{
duplicateData
=
workbookCreateAfter
(
CompositeTable
,
this
.
mining
)
}
this
.
ImportTables
.
historyContent
=
JSON
.
stringify
(
newHistoryContent
)
this
.
generate
.
historyContent
=
JSON
.
stringify
(
CompositeTable
);
...
...
@@ -838,33 +838,8 @@ export default {
//类别名称
let
names
=
this
.
cleaning
[
0
].
sourceColoumn
?
this
.
cleaning
[
0
].
sourceColoumn
-
1
:
null
;
let
name
=
names
?
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
names
&&
obj
.
r
>
headRow
)
:
null
;
//最大行数
let
maxC
=
Math
.
max
(...
c
.
map
(
item
=>
item
.
c
));
//研发和安全
// if (this.mining == '010101') {
// let newArray=c.filter(item=>item.v &&item.v.v);
// let research = [];
// let researchs = c.flat().filter(obj => obj.c && obj.c == maxC && obj.r > headRow)
// researchs.forEach(item => {
// if (item.v.v) {
// let newArray = {
// old: item.v.v,
// new: ''
// }
// research.push(newArray)
// }
// })
// //去重
// this.research = research.reduce((acc, curr) => {
// if (acc.findIndex(item => item.old === curr.old) === -1) {
// acc.push(curr);
// }
// return acc;
// }, []);
// this.dialogTableVisible = true
// }else{
this
.
transformPromises
()
// }
});
},
//成本表往凭证但转
...
...
@@ -894,7 +869,6 @@ export default {
item
.
v
=
Number
(
item
.
v
).
toFixed
(
2
);
});
sum
=
sum
.
filter
((
item
)
=>
item
.
v
!==
"
0.00
"
);
const
VoucherForm
=
JSON
.
parse
(
this
.
VoucherForm
);
const
filteredData
=
VoucherForm
[
0
].
celldata
.
filter
(
(
obj
)
=>
obj
.
r
===
5
...
...
@@ -1036,7 +1010,7 @@ export default {
{}
)
);
if
(
sum
.
length
==
1
)
{
if
(
sum
.
length
==
1
)
{
filteredArr
.
pop
();
}
this
.
ImportTables
.
historyRole
=
filteredArr
.
map
((
item
)
=>
{
...
...
@@ -1094,6 +1068,7 @@ export default {
}
}
}
let
isArray
=
[];
for
(
let
i
=
0
;
i
<
filteredArr
.
length
;
i
++
)
{
let
newRow1
=
{
...
...
@@ -1153,7 +1128,6 @@ export default {
isArray
.
push
(
newRow1
,
newRow2
);
}
const
newRows
=
[];
for
(
let
i
=
0
;
i
<
filteredArr
.
length
;
i
++
)
{
const
codeValue
=
filteredArr
[
i
]?.
accountingCode
;
if
(
codeValue
)
{
...
...
@@ -1266,7 +1240,10 @@ export default {
};
isArray
.
push
(
newRow
,
newRow1
);
}
VoucherForm
[
0
].
celldata
.
push
(...
isArray
);
if
(
this
.
value
.
includes
(
"
凭证
"
))
{
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
...
...
@@ -1280,6 +1257,7 @@ export default {
modify
=
true
;
this
.
showMask
=
false
;
}
console
.
log
(
list
,
'
11111111111
'
)
addInsert
(
list
).
then
((
response
)
=>
{
if
(
response
.
code
==
200
)
{
this
.
$message
({
...
...
@@ -1289,26 +1267,93 @@ export default {
}
});
if
(
this
.
mining
!==
"
011701
"
)
{
this
.
list
();
this
.
historyContent
=
[];
this
.
duplicateData
=
[];
}
VoucherForm
[
0
].
celldata
=
[];
});
},
handleExport
:
debounce
(
function
()
{
// handleExport
let
mineId
=
JSON
.
stringify
(
this
.
mining
)
datahistoryContentCopy
({
mineId
}).
then
(
res
=>
{
})
exportExcel
(
luckysheet
.
getAllSheets
(),
fileName
);
},
500
),
},
};
// 配置项111
handleExport
:
debounce
(
function
()
{
// handleExport
let
mineId
=
JSON
.
stringify
(
this
.
mining
)
function
getss
(
data
)
{
let
setXColumnObj
=
setXColumn
(
data
,
2
,
''
,
0
,
9
)
let
arrkses
=
Object
.
keys
(
setXColumnObj
)
let
arr
=
[]
for
(
let
rowIndex
=
3
;
rowIndex
<
34
;
rowIndex
++
)
{
let
obj
=
{}
arrkses
.
forEach
(
item
=>
{
let
cell
=
data
[
rowIndex
][
setXColumnObj
[
item
]];
if
(
!
item
.
includes
(
'
分配金额
'
)
&&
[
'
安全费用
'
]
&&
[
'
内投工程材料
'
]
&&
[
'
研发支出
'
])
{
// 去除
if
(
!
[
'
分配金额
'
,
'
安全费用
'
,
'
内投工程材料
'
,
'
研发支出
'
].
find
((
key
)
=>
item
.
includes
(
key
)))
{
obj
[
item
]
=
cell
&&
cell
.
v
||
''
}
}
})
datahistoryContentCopy
({
mineId
}).
then
(
res
=>
{
if
(
!
/^
\d
/
.
test
(
obj
[
'
费用列支
'
]))
{
arr
.
push
(
obj
)
}
}
return
arr
}
function
workbookCreateAfter
(
operate
,
mining
)
{
let
gets
=
getss
(
operate
[
0
].
data
)
let
neearray
=
[]
gets
.
forEach
(
item
=>
{
let
value
=
Object
.
values
(
item
)
// 找到括号内的内容
let
start
=
value
[
0
].
indexOf
(
'
(
'
);
let
end
=
value
[
0
].
indexOf
(
'
)
'
);
let
obj
=
''
let
contentBeforeParentheses
=
''
if
(
start
!==
-
1
&&
end
!==
-
1
)
{
let
contentWithinParentheses
=
value
[
0
].
substring
(
start
+
1
,
end
);
obj
=
contentWithinParentheses
.
split
(
'
,
'
);
obj
=
obj
.
map
(
newitem
=>
newitem
.
trim
());
}
let
parenthesesIndex
=
value
[
0
].
indexOf
(
'
(
'
);
if
(
parenthesesIndex
!==
-
1
)
{
contentBeforeParentheses
=
value
[
0
].
substring
(
0
,
parenthesesIndex
).
trim
();
}
let
key
=
Object
.
keys
(
item
)
value
.
forEach
((
items
,
index
)
=>
{
if
(
items
&&
index
!=
0
)
{
let
funs
=
{
v
:
{
v
:
items
,
name
:
key
[
index
]
+
'
-
'
,
material
:
contentBeforeParentheses
,
},
mining
:
mining
,
r
:
''
}
funs
.
v
.
material
=
funs
.
v
.
material
.
includes
(
'
净化车间
'
)
?
'
净化车间
'
:
funs
.
v
.
material
if
(
index
==
1
)
{
funs
.
r
=
obj
[
0
]
}
else
{
funs
.
r
=
obj
[
1
]
?
obj
[
1
]
:
obj
[
0
]
}
neearray
.
push
(
funs
)
}
})
exportExcel
(
luckysheet
.
getAllSheets
(),
fileName
);
},
500
),
},
};
// 配置项111
})
return
neearray
}
// debounce函数定义
function
debounce
(
func
,
delay
)
{
let
timer
;
return
function
()
{
...
...
ruoyi-ui/src/conversion/hongMine.js
View file @
a4fb04dd
...
...
@@ -14,7 +14,6 @@ export function hongMine(money, Department, code, name, codess, newArrayhong) {
for
(
let
i
=
0
;
i
<
money
.
length
;
i
++
)
{
//编码列
if
(
money
[
i
].
r
==
code
[
i
].
r
)
{
money
[
i
].
code
=
code
[
i
].
v
.
v
;
}
...
...
@@ -27,7 +26,6 @@ export function hongMine(money, Department, code, name, codess, newArrayhong) {
money
[
i
].
v
.
name
=
name
[
i
].
v
.
v
;
}
}
console
.
log
(
money
)
money
=
money
.
filter
(
obj
=>
obj
.
v
.
name
==
'
成本费用
'
)
//如果部门里包含洗煤,就给他放到洗煤里
money
.
forEach
((
item
)
=>
{
...
...
ruoyi-ui/src/conversion/lvMine.js
View file @
a4fb04dd
...
...
@@ -189,7 +189,7 @@ export function lvMine(CompositeTable,cjson,codess,code) {
}
}
}
duplicateData
=
duplicateData
.
filter
(
item
=>
!
item
.
v
.
name
.
includes
(
'
研发费用
'
)
&&!
item
.
v
.
name
.
includes
(
'
安全费用
'
)
&&!
item
.
v
.
name
.
includes
(
'
维简及井巷费
'
));
//
duplicateData = duplicateData.filter(item => !item.v.name.includes('研发费用')&&!item.v.name.includes('安全费用')&&!item.v.name.includes('维简及井巷费'));
let
duplic
=
{
duplicateData
:
duplicateData
,
CompositeTable
:
CompositeTable
...
...
ruoyi-ui/src/utils/tzc.js
View file @
a4fb04dd
...
...
@@ -13,42 +13,58 @@
import
{
v4
as
uuidv4
}
from
"
uuid
"
;
import
{
getyy
}
from
"
@/api/ruoyi-myLuckyexcel/myluckyexcel
"
export
function
transitionJson1
(
data
,
setting
=
{})
{
let
arr
=
[]
data
.
forEach
((
rows
,
rowIndex
)
=>
{
let
sr
=
!
setting
.
startRow
||
setting
.
startRow
<=
rowIndex
;
let
er
=
!
setting
.
endRow
||
setting
.
endRow
>=
rowIndex
;
let
obj
=
{};
if
(
sr
&&
er
&&
rows
)
{
rows
.
forEach
((
item
,
index
)
=>
{
let
sc
=
!
setting
.
startColumn
||
setting
.
startColumn
<=
index
;
let
ec
=
!
setting
.
endColumn
||
setting
.
endColumn
>=
index
;
if
(
sc
&&
ec
&&
item
)
{
let
key1
=
data
[
setting
.
titleR
||
setting
.
startRow
||
0
][
index
]
key1
=
key1
&&
key1
.
v
||
index
;
if
(
item
.
v
||
item
.
v
===
0
)
{
if
(
Object
.
keys
(
obj
).
includes
(
key1
)
&&
setting
.
cover
!==
'
覆盖
'
)
{
obj
[
`
${
key1
}${
index
}
`
]
=
item
.
v
}
else
{
obj
[
key1
]
=
item
.
v
}
}
import
{
getMineProofConfig
,
kNameID
}
from
"
@/utils/MineProofConfig
"
export
class
CreateNewCellData
{
constructor
(
cellData
){
this
.
data
=
cellData
;
this
.
lasti
=
0
;
// 缓存 值对应的 行和列
this
.
cacheV
=
{}
// 缓存 行和列 值对应的
this
.
cacheRC
=
{}
}
buildcache
(
fn
,...
args
){
if
(
this
.
lasti
>=
this
.
data
.
length
){
return
fn
(...
args
)}
for
(
this
.
lasti
;
this
.
lasti
<
this
.
data
.
length
;
this
.
lasti
++
){
let
cell
=
this
.
data
[
this
.
lasti
];
if
(
cell
&&
cell
.
v
&&
cell
.
v
.
v
){
let
cacheKey
=
String
(
cell
.
v
.
v
).
replaceAll
(
'
'
,
''
);
let
obj
=
{
r
:
cell
.
r
,
c
:
cell
.
c
,
v
:
cell
.
v
.
v
}
this
.
cacheRC
[
`
${
cell
.
r
}
,
${
cell
.
c
}
`
]
=
cell
.
v
.
v
;
if
(
this
.
cacheV
[
cacheKey
]){
this
.
cacheV
[
cacheKey
].
push
(
obj
)
}
else
{
this
.
cacheV
[
cacheKey
]
=
[
obj
]}
if
(
fn
(...
args
)){
return
fn
(...
args
)
}
}
)
}
}
if
(
Object
.
keys
(
obj
).
length
)
{
arr
.
push
(
obj
)
console
.
log
(
'
没有找到
'
,
fn
,...
args
)
}
getCellV
(
v
,
n
=
0
){
v
=
String
(
v
).
replaceAll
(
'
'
,
''
);
if
([
'
undefined
'
,
'
null
'
,
''
].
includes
(
v
)){
return
;}
let
fn
=
(
v
,
n
)
=>
this
.
cacheV
[
v
]
&&
this
.
cacheV
[
v
][
n
]
if
(
fn
(
v
,
n
)){
return
fn
(
v
,
n
)}
else
{
return
this
.
buildcache
(
fn
,
v
,
n
)
}
})
return
arr
}
// key 值 (r,c)
getCellRC
(
key
){
let
fn
=
(
key
)
=>
this
.
cacheRC
[
key
]
if
(
fn
(
key
)){
return
fn
(
key
)
}
else
if
(
this
.
buildcache
(
fn
,
key
)){
return
this
.
buildcache
(
fn
,
key
)
}
}
}
// 获取项目行
export
function
setXRow
(
arr
,
c
=
0
,
chong
=
'
--干部
'
)
{
let
obj
=
{}
arr
.
forEach
((
item
,
rowIndex
)
=>
{
// rowIndex 代表第几行
if
(
item
[
c
]
&&
item
[
c
].
v
)
{
if
(
item
&&
item
[
c
]
&&
item
[
c
].
v
)
{
if
(
obj
[
item
[
c
].
v
])
{
obj
[
item
[
c
].
v
+
chong
]
=
rowIndex
}
else
{
...
...
@@ -59,10 +75,10 @@ export function setXRow(arr, c = 0, chong = '--干部') {
return
obj
;
}
// 获取列 r是低几行
export
function
setXColumn
(
arr
,
r
=
0
,
chong
=
'
--干部
'
)
{
export
function
setXColumn
(
arr
,
r
=
0
,
chong
=
'
--干部
'
,
sc
=
0
,
se
=
9999
)
{
let
obj
=
{}
arr
[
r
].
forEach
((
item
,
column
)
=>
{
if
(
item
.
v
)
{
if
(
item
&&
item
.
v
&&
column
>=
sc
&&
column
<=
se
)
{
if
(
obj
[
item
.
v
])
{
obj
[
item
.
v
+
chong
]
=
column
}
else
{
...
...
@@ -81,175 +97,84 @@ export function transformJson(json) {
})
return
obj
}
export
function
gettransformJson
(
sum
)
{
let
variableMappings
=
{
"
班中餐
"
:
'
schoolLunchValue
'
,
"
基本养老保险
"
:
'
basicPensionValue
'
,
"
补充养老保险
"
:
'
supPensionValue
'
,
"
提取包干
"
:
'
lumpSumWithdrawalValue
'
,
"
工伤保险
"
:
'
workInjuryInsuranceValue
'
,
"
补充医疗保险
"
:
'
supMedicalValue
'
,
"
基本医疗保险
"
:
'
basicMedicalValue
'
,
"
计提工会经费
"
:
'
unionFundsValue
'
,
"
住房公积金
"
:
'
housingFundValue
'
,
"
提职工教育经费
"
:
'
employeeEducationFundsValue
'
,
"
失业保险
"
:
'
unemploymentInsuranceValue
'
};
let
obj
=
{};
sum
.
forEach
(
item
=>
{
Object
.
keys
(
variableMappings
).
forEach
(
key
=>
{
if
(
item
.
name
.
includes
(
key
))
{
obj
[
variableMappings
[
key
]]
=
item
}
})
});
let
schoolLunchValues
=
[]
function
name
()
{
let
names
=
[
{
name
:
'
独生子女补贴
'
,
value
:
'
提取一孩补贴
'
},
{
name
:
'
班中餐
'
,
value
:
'
提取班中餐
'
},
{
name
:
'
金额
'
,
value
:
'
提取基本养老保险
'
},
{
name
:
'
金额
'
,
value
:
'
提取补充养老保险
'
},
{
name
:
'
金额
'
,
value
:
'
提取包干工资
'
},
{
name
:
'
金额
'
,
value
:
'
提取工伤保险
'
},
{
name
:
'
金额
'
,
value
:
'
提取补充医疗保险
'
},
{
name
:
'
金额
'
,
value
:
'
提取基本医疗保险
'
},
{
name
:
'
金额
'
,
value
:
'
提取工会经费
'
},
{
name
:
'
金额
'
,
value
:
'
提取住房公积金
'
},
{
name
:
'
金额
'
,
value
:
'
提取职工教育经费
'
},
{
name
:
'
金额
'
,
value
:
'
提取失业保险
'
},
]
let
sums
=
[
obj
.
schoolLunchValue
.
celldata
,
obj
.
schoolLunchValue
.
celldata
,
obj
.
basicPensionValue
.
celldata
,
obj
.
supPensionValue
.
celldata
,
obj
.
lumpSumWithdrawalValue
.
celldata
,
obj
.
workInjuryInsuranceValue
.
celldata
,
obj
.
supMedicalValue
.
celldata
,
obj
.
basicMedicalValue
.
celldata
,
obj
.
unionFundsValue
.
celldata
,
obj
.
housingFundValue
.
celldata
,
obj
.
employeeEducationFundsValue
.
celldata
,
obj
.
unemploymentInsuranceValue
.
celldata
,
]
let
i
=
0
names
.
forEach
(
item
=>
{
if
(
i
<
2
)
{
//结束行
let
end
=
sums
[
i
].
filter
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
&&
obj
.
v
.
v
===
'
合计
'
)[
2
]
ex
(
sums
[
i
],
item
,
end
,
i
)
}
else
{
let
end
=
sums
[
i
].
find
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
&&
obj
.
v
.
v
.
replace
&&
(
obj
.
v
.
v
.
replace
(
/
\s
+/g
,
''
)
===
'
合计
'
))
ex
(
sums
[
i
],
item
,
end
,
i
)
}
i
++
;
})
}
function
ex
(
newarray
,
Begins
,
end
)
{
// ?/项目//
let
head
=
newarray
.
find
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
&&
(
obj
.
v
.
v
.
replace
&&
obj
.
v
.
v
.
replace
(
/
\s
+/g
,
''
)
===
'
项目
'
))
let
heads
=
newarray
.
filter
(
obj
=>
obj
.
c
===
head
.
c
)
//开始行
let
Begin
=
newarray
.
find
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
&&
(
obj
.
v
.
v
===
Begins
.
name
||
obj
.
v
.
v
===
'
工会经费
'
||
obj
.
v
.
v
===
'
职工教育经费
'
))
newarray
.
forEach
(
item
=>
{
if
(
item
.
r
>
Begin
.
r
+
1
&&
item
.
r
<
end
.
r
&&
item
.
c
===
Begin
.
c
&&
item
.
v
.
v
&&
item
.
v
.
v
>
0
)
{
let
Funct
=
{
classary
:
Begins
.
value
,
money
:
item
.
v
.
m
||
item
.
v
.
v
,
name
:
''
export
function
getyyData
(
sum
,
kid
=
''
){
console
.
log
(
kNameID
[
kid
],
2222
)
let
conFigList
=
getMineProofConfig
(
kNameID
[
kid
]
||
'
tsk
'
)
let
allAll
=
[]
let
err
=
[]
conFigList
.
forEach
(
cong
=>
{
let
sheets
=
sum
.
find
(
item
=>
item
.
name
.
includes
(
cong
.
sheetsName
))
if
(
!
sheets
||
!
cong
.
sheetsName
){
err
.
push
(
cong
)
return
;
}
let
cellData
=
sheets
&&
sheets
.
celldata
||
[];
let
newCellData
=
new
CreateNewCellData
(
cellData
)
let
data
=
sheets
&&
sheets
.
data
||
luckysheet
.
transToData
(
cellData
)
let
columnCell
=
newCellData
.
getCellV
(
cong
.
oldColumnName
);
//获取列单元格
let
endList
=
newCellData
.
getCellV
(
'
合计
'
,
cong
.
jishuhang
||
0
);
//获取 “v是合计的” 单元格数组
let
itemCellColumn
=
newCellData
.
getCellV
(
cong
.
itemName
||
'
项目
'
);
if
(
!
columnCell
||
!
endList
||
!
itemCellColumn
){
console
.
error
(
cong
.
oldColumnName
,
newCellData
,
columnCell
,
endList
);
return
}
//获取项目的单元格的列数
let
itemCellColumnIndex
=
itemCellColumn
.
c
;
// 取那一列的数
let
columnIndex
=
columnCell
.
c
;
// 开始行是那一行
let
startRowIndex
=
columnCell
.
r
;
// 结束行是那一行
let
endRowIndex
=
endList
.
r
;
for
(
let
currentRowIndex
in
data
){
if
(
currentRowIndex
>=
endRowIndex
){
break
;}
let
rowList
=
data
[
currentRowIndex
];
if
(
currentRowIndex
>
startRowIndex
){
let
name
=
rowList
[
itemCellColumnIndex
]
&&
rowList
[
itemCellColumnIndex
].
v
let
money
=
rowList
[
columnIndex
]
&&
rowList
[
columnIndex
].
m
||
rowList
[
columnIndex
].
v
let
isFilterStartsWith
=
cong
.
isFilterStartsWith
!==
false
&&
/^
\d
/
.
test
(
name
&&
name
.
replace
&&
name
.
replace
(
/
\s
+/g
,
''
))
if
(
Number
(
money
)
>
0
&&
!
isFilterStartsWith
){
allAll
.
push
({
classary
:
cong
.
classary
,
money
,
name
,
})
}
heads
.
forEach
(
headItem
=>
{
if
(
item
.
r
===
headItem
.
r
)
{
Funct
.
name
=
heads
[
heads
.
indexOf
(
headItem
)].
v
.
v
;
}
});
schoolLunchValues
.
push
(
Funct
)
}
})
}
name
(
obj
)
let
vouchers
=
{
//借方
borrow
:
schoolLunchValues
.
map
(
item
=>
({
...
item
,
is_debit
:
0
,
mining
:
'
010101
'
})),
//贷方
loan
:
schoolLunchValues
.
map
(
item
=>
({
...
item
,
is_debit
:
1
,
mining
:
'
010101
'
}))
}
vouchers
.
loan
=
vouchers
.
loan
.
filter
(
item
=>
{
return
!
item
.
name
.
includes
(
'
(
'
)
||
!
item
.
name
.
includes
(
'
(
'
)
})
vouchers
.
borrow
=
vouchers
.
borrow
.
filter
(
item
=>
{
return
!
item
.
name
.
includes
(
'
研发
'
)
})
vouchers
=
{
//借方
borrow
:
vouchers
.
borrow
.
map
(
item
=>
({
...
item
})),
//贷方
loan
:
vouchers
.
loan
.
map
(
item
=>
({
...
item
})),
//借方待分析
analyzedBorrow
:
vouchers
.
borrow
.
map
(
item
=>
({
...
item
})),
//贷方待分析
analyzedloan
:
vouchers
.
loan
.
map
(
item
=>
({
...
item
}))
}
vouchers
.
analyzedBorrow
.
forEach
(
item
=>
{
item
.
classary
=
item
.
classary
.
replace
(
'
提取
'
,
'
待分析
'
);
})
vouchers
.
analyzedloan
.
forEach
(
item
=>
{
item
.
classary
=
item
.
classary
.
replace
(
'
提取
'
,
'
待分析
'
);
}
})
let
objJson
=
{
//提取借方
borrow
:
vouchers
.
borrow
.
map
(
item
=>
({
...
item
})),
//提取贷方
loan
:
vouchers
.
loan
.
map
(
item
=>
({
...
item
})),
//待分析贷方
analyzedLoan
:
vouchers
.
loan
.
map
(
item
=>
({
...
item
})),
//待分析借方
analyzedBorrow
:
vouchers
.
borrow
.
map
(
item
=>
({
...
item
}))
if
(
err
.
length
){
console
.
log
(
err
)
}
return
allAll
}
// 生成凭证第二步调取后端数据
export
function
newGettransformJson
(
sum
,
kid
)
{
let
schoolLunchValues
=
getyyData
(
sum
,
kid
)
let
borrow
=
[];
//借方
let
analyzedBorrow
=
[];
//借方待分析
let
loan
=
[];
//贷方
let
analyzedLoan
=
[];
//贷方待分析
schoolLunchValues
.
forEach
(
item
=>
{
if
(
!
item
.
name
.
includes
(
'
研发
'
)){
let
obj
=
{
...
item
,
is_debit
:
0
,
mining
:
'
010101
'
}
borrow
.
push
(
obj
)
let
analyzedBorrowObj
=
{...
obj
}
analyzedBorrowObj
.
classary
=
analyzedBorrowObj
.
classary
.
replace
(
'
提取
'
,
'
待分析
'
);
analyzedBorrow
.
push
(
analyzedBorrowObj
)
}
if
(
!
item
.
name
.
includes
(
'
(
'
)
||
!
item
.
name
.
includes
(
'
(
'
)){
let
obj1
=
{
...
item
,
is_debit
:
1
,
mining
:
'
010101
'
}
loan
.
push
(
obj1
);
let
analyzedLoanObj
=
{...
obj1
}
analyzedLoanObj
.
classary
=
analyzedLoanObj
.
classary
.
replace
(
'
提取
'
,
'
待分析
'
);
analyzedLoan
.
push
(
analyzedLoanObj
)
}
})
let
objJson
=
{
borrow
,
loan
,
analyzedLoan
,
analyzedBorrow
}
return
getyy
(
JSON
.
stringify
(
objJson
))
}
// 生成凭证第三步生成凭证luckysheet.create.Data的数据
export
function
tzcCreateData
(
old
,
json
,
luckysheet
,
mobile
,
ywrq
)
{
return
Object
.
entries
(
json
).
map
(([
key
,
json
],
index
)
=>
{
let
obj
=
JSON
.
parse
(
JSON
.
stringify
(
old
));
...
...
@@ -271,16 +196,17 @@ export function tzcCreateData(old, json, luckysheet, mobile, ywrq) {
// "account_code": "2211005",
// "mining": "010101"
toData
[
rowIndex
+
8
]
=
[];
toData
[
rowIndex
+
8
][
columnObj
[
'
*制单人
'
]]
=
vule
(
mobile
);
toData
[
rowIndex
+
8
][
columnObj
[
'
*会计主体
'
]]
=
vule
(
item
.
mining
);
toData
[
rowIndex
+
8
][
columnObj
[
'
*核算账簿
'
]]
=
vule
(
item
.
mining
);
toData
[
rowIndex
+
8
][
columnObj
[
'
*分录摘要
'
]]
=
vule
(
item
.
classary
);
toData
[
rowIndex
+
8
][
columnObj
[
'
*凭证类型
'
]]
=
vule
(
item
.
classary
);
toData
[
rowIndex
+
8
][
columnObj
[
'
*单据日期
'
]]
=
vule
(
ywrq
)
toData
[
rowIndex
+
8
][
columnObj
[
item
.
is_debit
===
0
?
'
本币借方金额
'
:
'
本币贷方金额
'
]]
=
vule
(
item
.
money
);
toData
[
rowIndex
+
8
][
columnObj
[
item
.
is_debit
===
0
?
'
原币借方金额
'
:
'
原币贷方金额
'
]]
=
vule
(
item
.
money
);
toData
[
rowIndex
+
8
][
columnObj
[
'
*科目编码
'
]]
=
vule
(
item
.
account_code
||
''
);
toData
[
rowIndex
+
9
]
=
[];
toData
[
rowIndex
+
9
][
columnObj
[
'
制单人
'
]]
=
vule
(
mobile
);
toData
[
rowIndex
+
9
][
columnObj
[
'
*制单人
'
]]
=
vule
(
mobile
);
toData
[
rowIndex
+
9
][
columnObj
[
'
*会计主体
'
]]
=
vule
(
item
.
mining
);
toData
[
rowIndex
+
9
][
columnObj
[
'
*核算账簿
'
]]
=
vule
(
item
.
mining
);
toData
[
rowIndex
+
9
][
columnObj
[
'
*分录摘要
'
]]
=
vule
(
item
.
classary
);
toData
[
rowIndex
+
9
][
columnObj
[
'
*凭证类型
'
]]
=
'
转
'
;
toData
[
rowIndex
+
9
][
columnObj
[
'
*单据日期
'
]]
=
vule
(
ywrq
)
toData
[
rowIndex
+
9
][
columnObj
[
item
.
is_debit
===
0
?
'
本币借方金额
'
:
'
本币贷方金额
'
]]
=
vule
(
item
.
money
);
toData
[
rowIndex
+
9
][
columnObj
[
item
.
is_debit
===
0
?
'
原币借方金额
'
:
'
原币贷方金额
'
]]
=
vule
(
item
.
money
);
toData
[
rowIndex
+
9
][
columnObj
[
'
*科目编码
'
]]
=
vule
(
item
.
account_code
||
''
);
[
'
auxiliary_item_a
'
,
'
auxiliary_item_b
'
].
forEach
(
itemKey
=>
{
if
(
item
[
itemKey
])
{
let
[
key
,
value
]
=
item
[
itemKey
].
split
(
'
:
'
)
...
...
@@ -288,15 +214,15 @@ export function tzcCreateData(old, json, luckysheet, mobile, ywrq) {
key
=
'
物料基本分类--干部
'
}
value
=
value
&&
value
.
split
(
'
/
'
)
&&
value
.
split
(
'
/
'
)[
0
]
toData
[
rowIndex
+
8
][
columnObj
[
key
]]
=
vule
(
value
);
toData
[
rowIndex
+
9
][
columnObj
[
key
]]
=
vule
(
value
);
}
})
// 还要修改的
toData
[
rowIndex
+
8
][
columnObj
[
'
*币种
'
]]
=
vule
(
'
CNY
'
);
toData
[
rowIndex
+
8
][
columnObj
[
'
本币汇率类型
'
]]
=
vule
(
'
E001
'
);
toData
[
rowIndex
+
8
][
columnObj
[
'
*本币汇率
'
]]
=
vule
(
'
1.00000000
'
,
'
red
'
);
toData
[
rowIndex
+
8
][
columnObj
[
'
*手工码
'
]]
=
vule
(
uuid
);
toData
[
rowIndex
+
8
][
columnObj
[
'
*业务日期
'
]]
=
vule
(
new
Date
().
getFullYear
()
+
'
-
'
+
(
new
Date
().
getMonth
()
+
1
)
+
'
-
'
+
new
Date
().
getDate
());
toData
[
rowIndex
+
9
][
columnObj
[
'
*币种
'
]]
=
vule
(
'
CNY
'
);
toData
[
rowIndex
+
9
][
columnObj
[
'
本币汇率类型
'
]]
=
vule
(
'
E001
'
);
toData
[
rowIndex
+
9
][
columnObj
[
'
*本币汇率
'
]]
=
vule
(
'
1.00000000
'
,
'
red
'
);
toData
[
rowIndex
+
9
][
columnObj
[
'
*手工码
'
]]
=
vule
(
uuid
);
toData
[
rowIndex
+
9
][
columnObj
[
'
*业务日期
'
]]
=
vule
(
new
Date
().
getFullYear
()
+
'
-
'
+
(
new
Date
().
getMonth
()
+
1
)
+
'
-
'
+
new
Date
().
getDate
());
})
obj
.
celldata
=
luckysheet
.
transToCellData
(
toData
)
return
obj
;
...
...
ruoyi-ui/src/views/system/Wages/TangshanWages.vue
View file @
a4fb04dd
...
...
@@ -3,8 +3,11 @@
<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"
filterable
placeholder=
"请选择您要查看的模板"
@
change=
"handleOptionChange"
>
<el-option
v-for=
"item in depss"
:key=
"item.id"
:label=
"item.templateName"
:value=
"item.id"
@
change=
"handleOptionChange($event,
{
name: '唐山矿',
id: '010101'
})">
<el-option
v-for=
"item in depss.filter(item => [1270,1248].includes(item.id))"
:key=
"item.id"
:label=
"item.templateName"
:value=
"item.id"
:disabled=
"item.disabled"
>
</el-option>
</el-select>
...
...
@@ -28,12 +31,16 @@
</el-col>
</el-row>
<el-dialog
title=
"取数规则"
:visible.sync=
"dialogTableVisible"
:close-on-click-modal=
"false"
:show-close=
"false"
>
<el-form
label-width=
"120px"
>
<el-form
label-width=
"120px"
>
<el-form-item
v-for=
"(item, index) in jsonhead"
:key=
"index"
:label=
"`$
{item.label}`">
<el-input
v-model=
"item.value"
></el-input>
</el-form-item>
</el-form>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"handleClose()"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"initData()"
>
确 定
</el-button>
</span>
</el-dialog>
...
...
ruoyi-ui/src/views/system/supplies/salarySummary/index.vue
View file @
a4fb04dd
<
template
>
<!-- 页面 工资汇总调研-->
<div
class=
"app-container"
>
<el-form
ref=
"queryForm"
size=
"small"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"模板"
prop=
"name"
>
<el-select
v-model=
"form.template"
ref=
"mySelect"
size=
"mini"
filterable
placeholder=
"请选择您要查看的模板"
@
change=
"changeTemplate"
>
<el-option
v-for=
"item in templateList"
:key=
"item.id"
:label=
"item.templateName"
:value=
"item.id"
:disabled=
"item.disabled"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"时间"
prop=
"wageMonth"
>
<el-date-picker
v-model=
"form.wageMonth"
value-format=
"yyyy-MM"
type=
"month"
placeholder=
"选择月"
></el-date-picker>
</el-form-item>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-upload2"
size=
"mini"
@
click=
"handleExport"
>
导出
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-upload
type=
"file"
name=
"file"
ref=
"upload"
:headers=
"
{ 'Content-Type': 'multipart/form-data' }"
:before-upload="handleFileChange" action='' accept='.xlsx' :limit="3" multiple
:show-file-list="false" >
<el-button
plain
size=
"mini"
icon=
"el-icon-download"
type=
"primary"
>
导入
</el-button>
</el-upload>
</el-col>
</el-row>
<!-- luckysheet容器 -->
<div
id=
"luckysheet"
style=
"margin: 0px; padding: 0px; position: absolute; width: 100%; height:80vh; z-index: 0"
>
</div>
</div>
</
template
>
<div
class=
"box"
>
<div
style=
"display: flex;padding-bottom:20px;align-items: center;justify-content: space-between;width: 100%"
>
<div>
材料分解预算
</div>
<div
style=
"display: flex"
>
<el-button
size=
"mini"
@
click=
"setTs"
>
唐山电费汇总表放数据
</el-button>
<el-button
size=
"mini"
@
click=
"jxdfxt"
>
解析电费系统
</el-button>
<el-button
size=
"mini"
@
click=
"lxdlcrpz"
>
林西电力生凭证
</el-button>
<el-button
size=
"mini"
@
click=
"tsdlcrpz"
>
唐山电力生凭证
</el-button>
<el-button
size=
"mini"
@
click=
"crpz"
>
生凭证
</el-button>
<el-button
size=
"mini"
style=
"margin-right: 10px"
@
click=
"handleExport"
>
导出
</el-button>
<el-upload
type=
"file"
:action=
"uploadAction"
:before-upload=
"uploadFile"
:show-file-list=
"false"
>
<el-button
size=
"mini"
>
导入
</el-button>
</el-upload>
</div>
<
style
></
style
>
</div>
<div
style=
"flex:1;"
v-loading=
"loading"
>
<div
id=
"luckysheet"
style=
"height: 100%"
></div>
</div>
</div>
</
template
>
<
script
>
import
{
listSuppliesTemplate
}
from
"
@/api/ruoyi-myLuckyexcel/myluckyexcel
"
import
{
exportExcel
}
from
"
../../../../../public/exportExcel
"
import
LuckyExcel
from
"
luckyexcel
"
import
{
transitionJson
,
transitionJson1
}
from
"
@/utils/tzc
"
import
LuckyExcel
from
"
luckyexcel
"
;
import
{
exportExcel
}
from
"
/public/exportExcel
"
;
import
{
debounce
}
from
'
@/utils
'
import
{
department
,
getSuppliesTemplate
,
getyy
}
from
'
@/api/ruoyi-myLuckyexcel/myluckyexcel
'
import
{
getyyData
,
transformJson
,
tzcCreateData
}
from
'
@/utils/tzc
'
import
{
TSdL
}
from
'
@/mock
'
export
default
{
name
:
"
salarySummary
"
,
data
()
{
return
{
form
:{
template
:
''
,
wageMonth
:
''
,
},
templateList
:[],
file
:
null
}
},
mounted
()
{
// 获取模版列表
listSuppliesTemplate
({
status
:
0
,
}).
then
((
response
)
=>
{
response
.
rows
.
forEach
((
row
)
=>
{
if
(
row
.
templateName
.
includes
(
"
六矿
"
))
{
row
.
disabled
=
true
;
name
:
'
index
'
,
data
()
{
return
{
uploadAction
:
process
.
env
.
VUE_APP_BASE_API
+
'
/activiti/definition/upload
'
,
loading
:
false
,
luckysheetTitle
:
'
材料分解预算
'
,
classification
:
[],
codeRule
:
[
{
"
oneLevel
"
:
"
木材
"
,
"
codeStartsWithS
"
:
[
"
15
"
,
"
16
"
]
},
{
"
oneLevel
"
:
"
支护用品
"
,
"
twoLevel
"
:
"
支撑钢
"
,
"
codeStartsWithS
"
:
[
"
0150
"
]
},
{
"
oneLevel
"
:
"
支护用品
"
,
"
twoLevel
"
:
"
卡缆
"
,
"
codeStartsWithS
"
:
[
"
110601
"
,
"
110602
"
]
},
{
"
oneLevel
"
:
"
支护用品
"
,
"
twoLevel
"
:
"
锚杆
"
,
"
codeStartsWithS
"
:
[
"
1107
"
]
},
{
"
oneLevel
"
:
"
支护用品
"
,
"
twoLevel
"
:
"
金属网
"
,
"
codeStartsWithS
"
:
[
"
1111
"
]
},
{
"
codeStartsWithS
"
:
[
"
0101
"
,
"
0102
"
,
"
0103
"
,
"
0104
"
,
"
0151
"
,
"
0152
"
,
"
0153
"
,
"
0120
"
,
"
0121
"
,
"
0122
"
,
"
0124
"
,
"
0140
"
,
"
0141
"
,
"
0142
"
,
"
1108
"
,
"
1110
"
,
"
1112
"
,
"
1115
"
,
"
0105
"
,
"
0108
"
,
"
0109
"
,
"
0110
"
,
"
0111
"
,
"
0113
"
,
"
0114
"
,
"
0115
"
,
"
0116
"
,
"
0117
"
,
"
0120
"
,
"
0121
"
,
"
0122
"
,
"
0126
"
,
"
1101
"
,
"
1102
"
,
"
1105
"
,
"
1106
"
,
"
1113
"
],
"
oneLevel
"
:
"
支护用品
"
,
"
twoLevel
"
:
"
其他
"
},
{
"
codeStartsWithS
"
:
[
"
619701
"
],
"
oneLevel
"
:
"
火工用品
"
,
"
twoLevel
"
:
"
雷管
"
},
{
"
codeStartsWithS
"
:
[
"
619702
"
],
"
oneLevel
"
:
"
火工用品
"
,
"
twoLevel
"
:
"
火药
"
},
{
"
codeStartsWithS
"
:
[
"
6199
"
],
"
oneLevel
"
:
"
火工用品
"
,
"
twoLevel
"
:
"
其他
"
},
{
"
codeStartsWithS
"
:
[
"
0130
"
,
"
0132
"
,
"
0133
"
,
"
0134
"
],
"
oneLevel
"
:
"
大型材料
"
,
"
twoLevel
"
:
"
钢铁管
"
},
{
"
codeStartsWithS
"
:
[
"
0154
"
],
"
oneLevel
"
:
"
大型材料
"
,
"
twoLevel
"
:
"
钢轨
"
},
{
"
codeStartsWithS
"
:
[
"
0202
"
],
"
oneLevel
"
:
"
大型材料
"
,
"
twoLevel
"
:
"
钢丝绳
"
},
{
"
codeStartsWithS
"
:
[
"
40
"
],
"
oneLevel
"
:
"
大型材料
"
,
"
twoLevel
"
:
"
电缆
"
},
{
"
codeStartsWithS
"
:
[
"
6001
"
],
"
oneLevel
"
:
"
大型材料
"
,
"
twoLevel
"
:
"
皮带
"
},
{
"
codeStartsWithS
"
:
[
"
0201
"
,
"
0203
"
,
"
0208
"
,
"
0210
"
,
"
6004
"
,
"
204
"
,
"
6002
"
,
"
6005
"
,
"
6006
"
,
"
6009
"
,
"
6011
"
,
"
6012
"
,
"
6013
"
,
"
6014
"
,
"
6030
"
,
"
6032
"
,
"
6033
"
,
"
6034
"
,
"
6036
"
,
"
6045
"
,
"
6046
"
,
"
6099
"
,
"
0204
"
],
"
oneLevel
"
:
"
大型材料
"
,
"
twoLevel
"
:
"
其他
"
},
{
"
codeStartsWithS
"
:
[
"
3101
"
],
"
oneLevel
"
:
"
配件
"
,
"
twoLevel
"
:
"
综机配件
"
},
{
"
codeStartsWithS
"
:
[
"
3114
"
],
"
oneLevel
"
:
"
配件
"
,
"
twoLevel
"
:
"
掘进机配件
"
},
{
"
codeStartsWithS
"
:
[],
"
oneLevel
"
:
"
配件
"
,
"
twoLevel
"
:
"
溜槽
"
},
{
"
codeStartsWithS
"
:
[
"
310301
"
,
"
310302
"
],
"
oneLevel
"
:
"
配件
"
,
"
twoLevel
"
:
"
大链
"
},
{
"
codeStartsWithS
"
:
[
"
3103
"
,
"
3107
"
,
"
3116
"
,
"
3120
"
,
"
3150
"
,
"
3175
"
,
"
3177
"
,
"
3179
"
,
"
3183
"
,
"
3185
"
,
"
3187
"
,
"
3189
"
,
"
3191
"
,
"
3193
"
,
"
3195
"
,
"
3197
"
,
"
3198
"
,
"
3199
"
],
"
oneLevel
"
:
"
配件
"
,
"
twoLevel
"
:
"
其他配件
"
},
{
"
codeStartsWithS
"
:
[
"
420128
"
],
"
oneLevel
"
:
"
专用工具
"
,
"
twoLevel
"
:
"
矿灯
"
},
{
"
codeStartsWithS
"
:
[
"
5136
"
],
"
oneLevel
"
:
"
专用工具
"
,
"
twoLevel
"
:
"
7.5KV及以下水泵
"
},
{
"
codeStartsWithS
"
:
[
"
5112
"
,
"
903003
"
],
"
oneLevel
"
:
"
专用工具
"
,
"
twoLevel
"
:
"
矿车
"
},
{
"
codeStartsWithS
"
:
[],
"
oneLevel
"
:
"
专用工具
"
,
"
twoLevel
"
:
"
综合保护器
"
},
{
"
codeStartsWithS
"
:
[
"
5104
"
,
"
5105
"
,
"
5106
"
,
"
5109
"
,
"
5110
"
,
"
5111
"
,
"
5115
"
,
"
5120
"
,
"
5122
"
,
"
5124
"
,
"
5126
"
,
"
5128
"
,
"
5130
"
,
"
5199
"
],
"
oneLevel
"
:
"
专用工具
"
,
"
twoLevel
"
:
"
其他
"
},
{
"
codeStartsWithS
"
:
[],
"
oneLevel
"
:
"
自用煤
"
},
{
"
codeStartsWithS
"
:
[
"
62
"
],
"
oneLevel
"
:
"
劳保用品
"
},
{
"
codeStartsWithS
"
:
[
"
6301
"
],
"
oneLevel
"
:
"
建工材料
"
,
"
twoLevel
"
:
"
水泥
"
},
{
"
codeStartsWithS
"
:
[
"
6302
"
,
"
6303
"
,
"
6305
"
,
"
6306
"
,
"
6309
"
,
"
6310
"
,
"
6311
"
,
"
6312
"
,
"
6313
"
,
"
6314
"
],
"
oneLevel
"
:
"
建工材料
"
,
"
twoLevel
"
:
"
其他
"
},
{
"
codeStartsWithS
"
:
[
"
610101
"
],
"
oneLevel
"
:
"
油脂及乳化液
"
,
"
twoLevel
"
:
"
汽油
"
},
{
"
codeStartsWithS
"
:
[
"
610102
"
],
"
oneLevel
"
:
"
油脂及乳化液
"
,
"
twoLevel
"
:
"
柴油
"
},
{
"
codeStartsWithS
"
:
[
"
6102
"
],
"
oneLevel
"
:
"
油脂及乳化液
"
,
"
twoLevel
"
:
"
润滑油
"
},
{
"
codeStartsWithS
"
:
[
"
610635
"
],
"
oneLevel
"
:
"
油脂及乳化液
"
,
"
twoLevel
"
:
"
乳化液
"
},
{
"
codeStartsWithS
"
:
[
"
6106
"
],
"
oneLevel
"
:
"
油脂及乳化液
"
,
"
twoLevel
"
:
"
液压油
"
},
{
"
codeStartsWithS
"
:
[
"
6103
"
,
"
6110
"
,
"
6111
"
,
"
6101
"
,
"
6102
"
,
"
6106
"
,
"
6115
"
,
"
6120
"
,
"
6122
"
,
"
6124
"
,
"
6132
"
],
"
oneLevel
"
:
"
油脂及乳化液
"
,
"
twoLevel
"
:
"
其他
"
},
]
}
});
this
.
templateList
=
response
.
rows
;
});
let
options
=
{
container
:
"
luckysheet
"
,
//luckysheet为容器id
lang
:
"
zh
"
,
data
:
[
{
name
:
"
sheet1
"
,
//工作表名称
index
:
0
,
//工作表索引
status
:
1
,
//激活状态
celldata
:
[],
//初始化使用的单元格数据
},
],
};
luckysheet
.
create
(
options
);
},
methods
:
{
handleSuccess
(
evt
){
console
.
log
(
evt
,
'
Success
'
)
},
// 导入
handleFileChange
(
evt
)
{
let
self
=
this
this
.
file
=
evt
;
LuckyExcel
.
transformExcelToLucky
(
self
.
file
,
(
lucksheetfile
)
=>
{
setTimeout
(()
=>
{
luckysheet
.
create
({
container
:
'
luckysheet
'
,
// luckysheet is the container id
data
:
lucksheetfile
.
sheets
,
title
:
lucksheetfile
.
info
.
name
,
userInfo
:
lucksheetfile
.
info
.
name
.
creator
});
})
methods
:
{
// 给唐山汇总表放数据
setDataV
(...
arg
)
{
let
getValue
=
(
arr
,
keys
)
=>
{
let
shu
=
arr
[
0
];
let
key
=
''
if
(
keys
.
length
===
1
)
{
key
=
keys
[
0
]
}
else
{
let
flag
=
keys
.
slice
(
0
,
keys
.
length
-
1
).
some
((
item
)
=>
shu
[
item
])
if
(
!
flag
&&
shu
[
keys
[
keys
.
length
-
1
]])
{
key
=
keys
[
keys
.
length
-
1
];
}
}
if
(
key
&&
shu
[
key
])
{
return
shu
[
key
]
}
else
{
return
null
}
}
let
CConfig
=
{
'
加收管理费
'
:
[
'
电费-基本
'
],
'
照明电量
'
:
[
"
电量-峰
"
,
"
电量-平
"
,
"
电量-尖
"
,
"
电量-谷
"
,
'
电量-合计
'
],
//前四个有就不填,都没有填电量-合计
'
电光电费
'
:
[
"
电费-峰
"
,
"
电费-平
"
,
"
电费-尖
"
,
"
电费-谷
"
,
'
电费-合计
'
],
'
峰段电量
'
:
[
'
电量-峰
'
],
'
峰段金额
'
:
[
'
电费-峰
'
],
'
平段电量
'
:
[
'
电量-平
'
],
'
平段金额
'
:
[
'
电费-平
'
],
'
谷段电量
'
:
[
'
电量-谷
'
],
'
谷段金额
'
:
[
'
电费-谷
'
],
}
let
itemConfig
=
{
'
基本生产,原煤
'
:
[
'
原煤生产
'
],
'
基本生产,洗煤
'
:
[
'
洗煤厂(高压)
'
],
'
制造费用,原煤
'
:
[
'
矿井水净化
'
,
'
地面维修
'
,
'
联合建筑
'
,
'
厂区服务
'
,
'
供水供暖
'
],
//todo 缺少
'
管理用电
'
:
[
'
综合办
'
,
'
工会楼
'
,
'
小车房
'
,
'
绿化保洁
'
],
'
其他业务成本,住宿
'
:
[
'
住宿餐饮(集体宿舍)
'
],
'
其他业务成本,餐饮
'
:
[
'
住宿餐饮(东门食堂)
'
,
'
住宿餐饮(风井食堂)
'
],
'
其他业务成本,厂区服务,集团大院
'
:
[
'
集团公司大院
'
],
}
let
[
itemName
,
CName
,
data
]
=
arg
;
if
(
!
CConfig
[
CName
])
{
return
null
}
let
lastName
=
itemName
.
split
(
'
,
'
)
lastName
=
lastName
[
lastName
.
length
-
1
]
// 特殊处理的 情况
if
(
itemConfig
[
itemName
])
{
let
sum
=
0
itemConfig
[
itemName
].
forEach
((
item
)
=>
{
let
funV
=
null
;
if
(
data
[
item
])
{
funV
=
getValue
(
data
[
item
],
CConfig
[
CName
])
}
else
{
let
obj
=
Object
.
entries
(
data
).
find
(([
key
])
=>
{
if
(
key
.
includes
(
item
))
{
return
true
}
})
if
(
obj
)
{
funV
=
getValue
(
obj
[
1
],
CConfig
[
CName
])
}
}
if
(
funV
)
{
sum
=
Number
(
sum
)
+
Number
(
funV
)
}
})
if
(
sum
>
0
)
{
return
sum
}
else
{
return
null
}
}
else
if
(
data
[
itemName
]
||
data
[
lastName
])
{
return
getValue
(
data
[
itemName
]
||
data
[
lastName
],
CConfig
[
CName
])
}
else
{
return
null
}
},
setTs
()
{
//第一步先处理后端返回的数据
let
newData
=
{};
TSdL
.
data
.
forEach
((
item
)
=>
{
item
.
details
.
forEach
(
el
=>
{
let
obj
=
{}
Object
.
entries
(
el
).
forEach
(([
K
,
V
])
=>
{
if
(
V
)
{
if
(
K
.
startsWith
(
'
a
'
))
{
obj
[
item
.
datas
[
K
]
&&
item
.
datas
[
K
].
replace
(
'
,
'
,
'
-
'
).
replace
(
'
,
'
,
'
-
'
)]
=
V
;
}
else
{
obj
[
K
]
=
V
;
}
}
})
if
(
obj
[
'
类别
'
])
{
if
(
newData
[
obj
[
'
类别
'
]])
{
newData
[
obj
[
'
类别
'
]].
push
(
obj
)
}
else
{
newData
[
obj
[
'
类别
'
]]
=
[
obj
]
}
}
});
})
console
.
log
(
newData
)
let
self
=
this
;
let
luckyData
=
luckysheet
.
getAllSheets
();
let
data
=
luckyData
[
0
].
data
for
(
let
i
=
2
;
i
<
data
.
length
;
i
++
)
{
let
itemName
=
data
[
i
][
0
]
&&
data
[
i
][
0
].
v
&&
data
[
i
][
0
].
v
.
replaceAll
(
/
\s
+/g
,
""
);
let
row
=
data
[
i
];
row
.
forEach
((
item
,
index
)
=>
{
let
cName
=
data
[
1
]
&&
data
[
1
][
index
]
&&
data
[
1
][
index
].
v
;
if
(
cName
&&
itemName
)
{
let
v
=
self
.
setDataV
(
itemName
,
cName
,
newData
)
if
(
v
)
{
data
[
i
][
index
].
bg
=
'
red
'
v
=
Number
(
Number
(
v
).
toFixed
(
2
))
data
[
i
][
index
].
v
=
data
[
i
][
index
].
v
||
''
+
`(
${
v
}
)`
data
[
i
][
index
].
m
=
data
[
i
][
index
].
m
||
''
+
`(
${
v
}
)`
}
}
})
}
luckysheet
.
destroy
();
luckyData
[
0
].
celldata
=
luckysheet
.
transToCellData
(
data
);
delete
luckyData
[
0
].
data
;
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
lang
:
'
zh
'
,
data
:
luckyData
// Excel 数据
});
},
handleExport
:
debounce
(
function
()
{
let
vm
=
this
;
exportExcel
(
luckysheet
.
getAllSheets
(),
vm
.
luckysheetTitle
);
},
500
),
uploadFile
(
file
)
{
let
vm
=
this
;
vm
.
loading
=
true
;
LuckyExcel
.
transformExcelToLucky
(
file
,
function
(
exportJson
)
{
vm
.
createluckysheet1
(
exportJson
)
// vm.createPZ(exportJson)
});
},
createluckysheet1
(
exportJson
)
{
let
vm
=
this
;
vm
.
loading
=
false
;
exportJson
.
sheets
.
forEach
(
sheet
=>
{
let
transToData
=
luckysheet
.
transToData
(
sheet
.
celldata
);
// 一级类别列
let
firstIndex
=
transToData
[
1
].
findIndex
((
item
,
index
)
=>
item
===
null
&&
index
>
0
);
// 二级类别列
let
twoIndex
=
firstIndex
+
1
;
// 部门分类
let
depClass
=
twoIndex
+
1
;
// 编码列
let
codeIndex
=
transToData
[
1
].
findIndex
((
item
)
=>
!!
(
item
&&
item
.
v
&&
item
.
v
.
includes
&&
item
.
v
.
includes
(
'
编码
'
)));
let
depIndex
=
transToData
[
1
].
findIndex
((
item
)
=>
!!
(
item
&&
item
.
v
&&
item
.
v
.
includes
&&
item
.
v
.
includes
(
'
部门
'
)));
let
setCell
=
(
v
)
=>
{
return
{
ct
:
{
fa
:
'
@
'
,
t
:
'
s
'
},
m
:
v
,
qp
:
1
,
tb
:
1
,
v
:
v
}
}
transToData
[
1
][
firstIndex
]
=
setCell
(
'
一级类别
'
);
transToData
[
1
][
twoIndex
]
=
setCell
(
'
二级类别
'
);
transToData
[
1
][
depClass
]
=
setCell
(
'
部门分类
'
);
for
(
let
i
=
2
;
i
<
transToData
.
length
;
i
++
)
{
let
row
=
transToData
[
i
];
// 设置部门分类
row
[
depIndex
]
&&
row
[
depIndex
].
v
&&
(
row
[
depClass
]
=
setCell
(
vm
.
classification
[
row
[
depIndex
].
v
.
replaceAll
(
'
'
,
''
)]))
//设置一二级分类
if
(
row
[
codeIndex
]
&&
row
[
codeIndex
].
v
)
{
let
getName
=
(
code
)
=>
vm
.
codeRule
.
find
(
item
=>
!!
item
.
codeStartsWithS
.
find
(
codeStart
=>
code
.
startsWith
(
codeStart
)))
let
name
=
getName
(
String
(
row
[
codeIndex
].
v
))
if
(
name
)
{
name
.
oneLevel
&&
(
row
[
firstIndex
]
=
setCell
(
name
.
oneLevel
));
name
.
twoLevel
&&
(
row
[
twoIndex
]
=
setCell
(
name
.
twoLevel
));
}
else
{
row
[
firstIndex
]
=
setCell
(
'
其他材料
'
)
}
}
}
sheet
.
celldata
=
luckysheet
.
transToCellData
(
transToData
);
})
// let obj = {}
// let setting = {
// '本月手工分配工资表': {
// startRow:2
// }
// }
// lucksheetfile.sheets[2]
// lucksheetfile.sheets.map(el => {
// let data = luckysheet.transToData(el.celldata)
// obj[el.name] = transitionJson1(data,setting[el.name])
// })
let
data
=
luckysheet
.
transToData
(
lucksheetfile
.
sheets
[
1
].
celldata
)
console
.
log
(
lucksheetfile
.
sheets
[
1
].
celldata
)
console
.
log
(
data
)
console
.
log
(
transitionJson1
(
data
))
// let newObj = {}
// Object.keys(obj).forEach(key => {
// obj[key].forEach(el => {
// if(!newObj[key]){
// newObj[key] = {}
// }
// newObj[key][el['单位名称']] = el
// })
// })
// console.log(newObj)
});
// LuckyExcel.transformExcelToLucky(evt,
// function(exportJson, luckysheetfile){
// console.log(exportJson)
// console.log(luckysheetfile)
// },
// function(error){
// // handle error if any thrown
// })
//前台加载数据
vm
.
luckysheetTitle
=
exportJson
.
info
.
name
;
vm
.
createluckysheet
(
exportJson
.
sheets
)
},
createluckysheet
(
data
)
{
let
vm
=
this
;
luckysheet
.
destroy
();
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
lang
:
'
zh
'
,
title
:
vm
.
luckysheetTitle
,
// Excel 文件名
data
,
// Excel 数据
});
},
async
crpz
()
{
// 第一步取数
let
data
=
getyyData
(
luckysheet
.
getAllSheets
(),
'
011704
'
)
// 第二步调后端
let
borrow
=
JSON
.
parse
(
JSON
.
stringify
(
data
)).
filter
(
item
=>
{
item
.
is_debit
=
0
;
item
.
mining
=
'
011704
'
if
(
!
item
.
classary
.
includes
(
'
计提
'
)
||
!
item
.
name
.
includes
(
'
研发
'
))
{
return
true
}
})
let
loan
=
JSON
.
parse
(
JSON
.
stringify
(
data
)).
filter
(
item
=>
{
item
.
is_debit
=
1
;
item
.
mining
=
'
011704
'
if
(
!
item
.
name
.
includes
(
'
(
'
)
||
!
item
.
name
.
includes
(
'
(
'
))
{
return
true
}
})
let
objJson
=
{
borrow
,
loan
}
let
res
=
await
getyy
(
JSON
.
stringify
(
objJson
))
// 第三步 生成凭证
let
template
=
await
getSuppliesTemplate
(
1248
)
let
createData
=
tzcCreateData
(
JSON
.
parse
(
template
.
rows
[
0
].
templateContent
)[
0
],
transformJson
(
res
.
data
),
luckysheet
,
13112312312
,
'
2024-06
'
);
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
'
凭证
'
,
// Excel 文件名
allowEdit
:
false
,
//作用:是否允许前台编辑
data
:
createData
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
"
zh
"
,
});
},
async
tsdlcrpz
()
{
// 第一步取数
let
data
=
getyyData
(
luckysheet
.
getAllSheets
(),
'
010101
'
)
let
objJson
=
{
borrow
:
data
.
map
(
item
=>
{
return
{
...
item
,
is_debit
:
0
,
mining
:
'
010101
'
}
})
}
// 第二步调接口处理res
let
res
=
await
getyy
(
JSON
.
stringify
(
objJson
))
let
loan
=
[{
is_debit
:
1
,
money
:
0
,
name
:
'
其他贷方金额
'
,
account_code
:
'
2241005
'
,
classary
:
"
转电力分配
"
,
mining
:
"
010101
"
}]
res
.
data
.
borrow
.
forEach
(
item
=>
{
if
(
item
.
account_code
)
{
loan
[
0
].
money
=
(
Number
(
item
.
money
)
+
Number
(
loan
[
0
].
money
)).
toFixed
(
2
);
}
})
res
.
data
.
loan
=
loan
;
// 第三步 生成凭证
let
template
=
await
getSuppliesTemplate
(
1248
)
let
createData
=
tzcCreateData
(
JSON
.
parse
(
template
.
rows
[
0
].
templateContent
)[
0
],
transformJson
(
res
.
data
),
luckysheet
,
13112312312
,
'
2024-06
'
);
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
'
凭证
'
,
// Excel 文件名
allowEdit
:
false
,
//作用:是否允许前台编辑
data
:
createData
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
"
zh
"
,
});
},
// 林西电力生成凭证
lxdlcrpz
()
{
let
data
=
getyyData
(
luckysheet
.
getAllSheets
(),
'
011704
'
)
let
newdata
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
newdata
.
forEach
((
item
,
i
)
=>
{
item
.
name
=
item
.
name
.
replace
(
/
\s
+/g
,
''
)
if
(
!
(
/^
\d
/
.
test
(
item
.
name
)))
{
item
.
fj
=
/^
\d
/
.
test
(
newdata
[
i
-
1
].
name
)
?
newdata
[
i
-
1
].
name
:
newdata
[
i
-
1
].
fj
}
})
console
.
log
(
newdata
)
console
.
log
(
data
)
},
jxdfxt
()
{
let
data
=
luckysheet
.
getAllSheets
().
find
(
item
=>
{
return
[
'
填写数据
'
].
includes
(
item
.
name
)
})
let
arr
=
[]
data
.
data
.
forEach
(
row
=>
{
let
obj
=
{}
row
.
forEach
((
ceil
,
i
)
=>
{
if
(
ceil
&&
ceil
.
v
)
{
obj
[
i
]
=
ceil
.
v
}
else
if
(
ceil
&&
ceil
.
ct
&&
ceil
.
ct
.
s
)
{
obj
[
i
]
=
ceil
.
ct
.
s
.
map
(
item
=>
item
.
v
).
join
(
''
)
}
})
if
(
Object
.
keys
(
obj
).
length
)
{
arr
.
push
(
obj
)
}
})
let
yiKey
=
{};
let
erKey
=
{};
let
newaasss
=
[]
let
shuju
=
[]
let
sj
=
(
old
,
yi
,
er
)
=>
{
if
(
!
old
[
1
])
{
old
[
1
]
=
newaasss
[
newaasss
.
length
-
1
][
'
原始数据
'
][
1
]
}
newaasss
.
push
({
'
原始数据
'
:
old
,
'
第一级数据
'
:
yi
,
'
第二级数据
'
:
er
})
let
obj
=
{}
Object
.
entries
(
old
).
forEach
(([
key
,
value
])
=>
{
let
yikey
=
yi
[
key
];
let
erkey
=
er
[
key
];
if
(
yikey
&&
erkey
)
{
let
objkey
=
`
${
yikey
}
-
${
erkey
}
`
objkey
=
objkey
.
replaceAll
(
'
"
'
,
''
).
replace
(
/
[\r\n]
/g
,
""
).
replaceAll
(
"
"
,
''
)
obj
[
objkey
]
=
value
;
}
else
if
(
yikey
&&
!
erkey
)
{
yikey
=
yikey
.
replaceAll
(
'
"
'
,
''
).
replaceAll
(
"
↵
"
,
''
).
replaceAll
(
"
"
,
''
)
obj
[
yikey
]
=
value
;
}
else
if
(
erkey
&&
!
yikey
)
{
let
xy
=
''
for
(
let
i
=
key
;
i
>
0
;
i
--
)
{
if
(
yi
[
i
])
{
xy
=
`
${
yi
[
i
]}
`
break
;
}
}
let
objkey
=
''
if
(
xy
)
{
objkey
=
`
${
xy
}
-
${
erkey
}
`
}
else
{
objkey
=
erkey
}
objkey
=
objkey
.
replaceAll
(
'
"
'
,
''
).
replace
(
/
[\r\n]
/g
,
""
).
replaceAll
(
"
"
,
''
)
obj
[
objkey
]
=
value
;
}
})
if
(
Object
.
keys
(
obj
).
length
)
{
shuju
.
push
(
obj
)
}
}
for
(
let
rowi
=
3
;
rowi
<
arr
.
length
;
rowi
++
)
{
let
RowObj
=
arr
[
rowi
];
if
(
RowObj
[
1
]
&&
RowObj
[
1
]
!==
'
项目
'
)
{
if
(
!
arr
[
rowi
-
2
][
0
]
||
arr
[
rowi
-
2
][
0
]
===
'
序号
'
)
{
yiKey
=
arr
[
rowi
-
2
];
}
erKey
=
arr
[
rowi
-
1
];
}
if
(
RowObj
[
0
]
!==
'
序号
'
&&
(
RowObj
[
0
]
||
RowObj
[
2
]))
{
sj
(
RowObj
,
yiKey
,
erKey
)
}
}
let
obj
=
{}
shuju
.
forEach
(
item
=>
{
Object
.
keys
(
item
).
forEach
(
key
=>
{
obj
[
key
]
=
null
})
});
let
zui
=
shuju
.
map
(
item
=>
{
return
Object
.
assign
(
JSON
.
parse
(
JSON
.
stringify
(
obj
)),
item
)
})
let
transformedJSON
=
{};
Object
.
keys
(
obj
).
forEach
((
key
,
index
)
=>
{
transformedJSON
[
key
]
=
`a
${
index
+
1
}
`
;
});
let
transformed
=
zui
.
map
(
el
=>
{
return
Object
.
fromEntries
(
Object
.
entries
(
el
).
map
(([
key
,
value
])
=>
{
return
[
transformedJSON
[
key
],
value
];
}))
})
console
.
log
(
transformedJSON
)
console
.
log
(
transformed
)
}
},
mounted
()
{
this
.
createluckysheet
([{}])
this
.
loading
=
true
;
department
(
'
011704
'
).
then
(
res
=>
{
this
.
loading
=
false
;
if
(
Array
.
isArray
(
res
))
{
this
.
classification
=
Object
.
fromEntries
(
res
.
map
(
item
=>
[
item
.
name
,
item
.
nameType
]))
}
}).
catch
(()
=>
{
this
.
loading
=
false
;
})
},
// 导出
handleExport
:
debounce
(
function
()
{
// handleExport
exportExcel
(
luckysheet
.
getAllSheets
(),
'
新建XLSX工作表
'
);
},
500
),
// 切换模版
changeTemplate
(){},
}
}
function
debounce
(
func
,
delay
)
{
let
timer
;
return
function
()
{
const
context
=
this
;
const
args
=
arguments
;
clearTimeout
(
timer
);
timer
=
setTimeout
(
function
()
{
func
.
apply
(
context
,
args
);
},
delay
);
};
}
</
script
>
<
style
scoped
>
.box
{
box-sizing
:
border-box
;
padding
:
20px
;
position
:
absolute
;
width
:
100%
;
height
:
100%
;
left
:
0
;
top
:
0
;
display
:
flex
;
flex-direction
:
column
;
}
</
style
>
ruoyi-ui/src/views/system/supplies/salarySummaryintermediateTabl/index.vue
View file @
a4fb04dd
<!--todo 中间工资汇总-->
<
template
>
<div
class=
"app-container"
:class=
"
{'app-container1':views.luckysheet}" v-loading="views.loading">
<template
v-if=
"!views.luckysheet"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
:inline=
"true"
label-width=
"68px"
@
submit
.
native
.
prevent
>
<el-form-item
label=
"标题"
prop=
"historyName"
>
<el-input
v-model=
"queryParams.historyName"
placeholder=
"请输入标题"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
<el-form-item
label=
"年月"
prop=
"wageMonth"
>
<el-date-picker
v-model=
"queryParams.wageMonth"
size=
"mini"
value-format=
"yyyy-MM"
type=
"month"
placeholder=
"选择月"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
...
...
@@ -71,10 +71,10 @@
</
style
>
<
script
>
import
{
exportExcel
}
from
"
../../../../..
/public/exportExcel
"
import
{
exportExcel
}
from
"
/public/exportExcel
"
import
{
debounce
}
from
'
@/utils
'
import
{
conversionGetWagesData
,
conversionUpdate
,
getWagesDataById
}
from
"
@/api/conversion
"
import
{
transformJson
,
tzcCreateData
,
gettransformJson
}
from
"
@/utils/tzc
"
import
{
transformJson
,
tzcCreateData
,
newGettransformJson
}
from
"
@/utils/tzc
"
import
{
getSuppliesTemplate
}
from
"
@/api/ruoyi-myLuckyexcel/myluckyexcel
"
export
default
{
...
...
@@ -86,7 +86,7 @@ export default {
total
:
0
,
pageNum
:
1
,
pageSize
:
10
,
historyName
:
null
,
wageMonth
:
null
,
},
views
:
{
//编辑还是查看 look 查看
...
...
@@ -128,7 +128,7 @@ export default {
let
template
=
await
getSuppliesTemplate
(
1248
)
let
optionsData
=
JSON
.
parse
(
template
.
rows
[
0
].
templateContent
);
// 获取数据
let
objks
=
await
g
ettransformJson
(
luckysheet
.
getAllSheets
())
let
objks
=
await
newG
ettransformJson
(
luckysheet
.
getAllSheets
())
this
.
views
.
loading
=
false
;
//value 手机号
//this.currentRow.yearMonth 年月
...
...
@@ -142,7 +142,6 @@ export default {
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
"
zh
"
,
})
},
// 修改保存
save
()
{
...
...
@@ -227,7 +226,9 @@ export default {
// 列表查询
async
getList
()
{
this
.
views
.
loading
=
true
let
asyncConversionGetWagesData
=
await
conversionGetWagesData
(
this
.
queryParams
)
let
obj
=
{...
this
.
queryParams
};
delete
obj
.
total
;
let
asyncConversionGetWagesData
=
await
conversionGetWagesData
(
obj
)
this
.
views
.
loading
=
false
this
.
historydataList
=
asyncConversionGetWagesData
?.
rows
||
0
this
.
queryParams
.
total
=
asyncConversionGetWagesData
?.
total
||
0
...
...
ruoyi-ui/vue.config.js
View file @
a4fb04dd
...
...
@@ -33,10 +33,19 @@ module.exports = {
proxy
:
{
// detail: https://cli.vuejs.org/config/#devserver-proxy
[
process
.
env
.
VUE_APP_BASE_API
]:
{
target
:
`http://192.168.0.61:8080`
,
// target: `http://192.168.0.192:8080`,
// target: `http://192.168.0.61:8080`,
// target: `http://192.168.111.228:8080`,
// target: `http://192.168.3.247:8080`,
// target: `http://192.168.3.241:8080`,
// target: `http://192.168.0.99:8080`,
//target: `http://192.168.3.247:8080`,
// target: `http://localhost:5001`,
//
target: `http://192.168.111.226:8080`,
target
:
`http://192.168.111.226:8080`
,
changeOrigin
:
true
,
pathRewrite
:
{
...
...
ruoyi-wages/src/main/java/com/ruoyi/system/controller/AsiccSuppliesController.java
0 → 100644
View file @
a4fb04dd
package
com.ruoyi.system.controller
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.model.wages.dao.AsiccDAO
;
import
com.ruoyi.system.model.wages.vo.AsiccVo
;
import
com.ruoyi.system.service.AsiccSuppliesService
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author haiwe
* @date 2024/7/5
*/
@RestController
@RequestMapping
(
"/asicc"
)
@RequiredArgsConstructor
public
class
AsiccSuppliesController
{
private
final
AsiccSuppliesService
asiccSuppliesService
;
@PostMapping
(
"/data"
)
public
AjaxResult
getData
(
@RequestBody
AsiccDAO
asiccDAO
){
Map
<
String
,
Object
>
voList
=
asiccSuppliesService
.
getData
(
asiccDAO
);
if
(!
voList
.
isEmpty
())
{
return
AjaxResult
.
success
(
voList
);
}
else
{
return
AjaxResult
.
error
();
}
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/AsiccSuppliesMapper.java
0 → 100644
View file @
a4fb04dd
package
com.ruoyi.system.mapper
;
import
com.ruoyi.system.domain.ActSupplies
;
import
com.ruoyi.system.domain.ActSuppliesImportCleaningAcc
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author haiwe
* @date 2024/7/5
*/
public
interface
AsiccSuppliesMapper
{
List
<
ActSuppliesImportCleaningAcc
>
selectByCodeAndMineId
(
@Param
(
"mineId"
)
String
mineId
,
@Param
(
"code"
)
String
code
);
ActSupplies
selectByCodes
(
@Param
(
"codes"
)
String
codes
);
ActSupplies
selectByOneLevel
(
@Param
(
"oneLevel"
)
String
oneLevel
);
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/dao/AsiccDAO.java
0 → 100644
View file @
a4fb04dd
package
com.ruoyi.system.model.wages.dao
;
import
com.ruoyi.system.domain.ActSuppliesImportCleaningAcc
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author haiwe
* @date 2024/7/5
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
AsiccDAO
{
private
String
mineId
;
private
List
<
String
>
codes
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/wages/vo/AsiccVo.java
0 → 100644
View file @
a4fb04dd
package
com.ruoyi.system.model.wages.vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author haiwe
* @date 2024/7/5
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
AsiccVo
{
private
String
oneLevel
;
private
String
twoLevel
;
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/AsiccSuppliesService.java
0 → 100644
View file @
a4fb04dd
package
com.ruoyi.system.service
;
import
com.ruoyi.system.model.wages.dao.AsiccDAO
;
import
com.ruoyi.system.model.wages.vo.AsiccVo
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author haiwe
* @date 2024/7/5
*/
public
interface
AsiccSuppliesService
{
Map
<
String
,
Object
>
getData
(
AsiccDAO
asiccDAO
);
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/AsiccSuppliesServiceImpl.java
0 → 100644
View file @
a4fb04dd
package
com.ruoyi.system.service.impl
;
import
com.ruoyi.system.domain.ActSupplies
;
import
com.ruoyi.system.domain.ActSuppliesImportCleaningAcc
;
import
com.ruoyi.system.mapper.AsiccSuppliesMapper
;
import
com.ruoyi.system.model.wages.dao.AsiccDAO
;
import
com.ruoyi.system.model.wages.vo.AsiccVo
;
import
com.ruoyi.system.service.AsiccSuppliesService
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
/**
* @author haiwe
* @date 2024/7/5
*/
@Service
@RequiredArgsConstructor
public
class
AsiccSuppliesServiceImpl
implements
AsiccSuppliesService
{
private
final
AsiccSuppliesMapper
asiccSuppliesMapper
;
@Override
public
Map
<
String
,
Object
>
getData
(
AsiccDAO
asiccDAO
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
String
>
codesList
=
asiccDAO
.
getCodes
();
String
mineId
=
asiccDAO
.
getMineId
();
for
(
String
code
:
codesList
)
{
List
<
String
>
voList
=
new
ArrayList
<>();
List
<
ActSuppliesImportCleaningAcc
>
accList
=
asiccSuppliesMapper
.
selectByCodeAndMineId
(
mineId
,
code
);
accList
.
forEach
(
acc
->
{
String
codes
=
acc
.
getCategories
();
ActSupplies
supplies
=
asiccSuppliesMapper
.
selectByCodes
(
codes
);
Long
level
=
supplies
.
getLevel
();
if
(
level
==
1
)
{
String
suppliesName
=
supplies
.
getSuppliesName
();
voList
.
add
(
suppliesName
);
voList
.
add
(
null
);
map
.
put
(
code
,
voList
);
}
else
if
(
level
==
2
){
//此时为二级分类名称
String
twoSupplies
=
supplies
.
getSuppliesName
();
//获取对应的一级分类
String
oneLevel
=
supplies
.
getOneLevel
();
ActSupplies
suppliesInfo
=
asiccSuppliesMapper
.
selectByOneLevel
(
oneLevel
);
String
oneSupplies
=
suppliesInfo
.
getSuppliesName
();
voList
.
add
(
oneSupplies
);
voList
.
add
(
twoSupplies
);
map
.
put
(
code
,
voList
);
}
});
}
return
map
;
}
}
ruoyi-wages/src/main/resources/mapper/system/AsiccSuppliesMapper.xml
0 → 100644
View file @
a4fb04dd
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.system.mapper.AsiccSuppliesMapper"
>
<resultMap
type=
"com.ruoyi.system.domain.ActSupplies"
id=
"ActSuppliesResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"oneLevel"
column=
"one_level"
/>
<result
property=
"twoLevel"
column=
"two_level"
/>
<result
property=
"threeLevel"
column=
"three_level"
/>
<result
property=
"codes"
column=
"codes"
/>
<result
property=
"suppliesName"
column=
"supplies_name"
/>
<result
property=
"level"
column=
"level"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<select
id=
"selectByCodeAndMineId"
resultType=
"com.ruoyi.system.domain.ActSuppliesImportCleaningAcc"
>
select distinct(categories)
from act_supplies_import_cleaning_copy1
where ssk_id = #{mineId} and code_column = #{code}
</select>
<select
id=
"selectByCodes"
resultMap=
"ActSuppliesResult"
>
select one_level, two_level, three_level, codes, supplies_name, level, status
from act_supplies
where codes = #{codes}
</select>
<select
id=
"selectByOneLevel"
resultMap=
"ActSuppliesResult"
>
select one_level, two_level, three_level, codes, supplies_name, level, status
from act_supplies
where one_level = #{oneLevel} and level = 1
</select>
</mapper>
\ No newline at end of file
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