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
acae3d48
Commit
acae3d48
authored
1 year ago
by
位宇华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui 代码提交
parent
3b91e088
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
4471 additions
and
3852 deletions
+4471
-3852
ruoyi-ui/package.json
ruoyi-ui/package.json
+8
-7
ruoyi-ui/public/exportExcel.js
ruoyi-ui/public/exportExcel.js
+310
-310
ruoyi-ui/public/index.html
ruoyi-ui/public/index.html
+0
-7
ruoyi-ui/public/luckysheet.esm.js
ruoyi-ui/public/luckysheet.esm.js
+2
-2
ruoyi-ui/src/api/Actsupplies/cleaning_rule.js
ruoyi-ui/src/api/Actsupplies/cleaning_rule.js
+7
-6
ruoyi-ui/src/api/ruoyi-myLuckyexcel/myluckyexcel.js
ruoyi-ui/src/api/ruoyi-myLuckyexcel/myluckyexcel.js
+104
-104
ruoyi-ui/src/api/system/historydata.js
ruoyi-ui/src/api/system/historydata.js
+44
-47
ruoyi-ui/src/components/PanThumb/index.vue
ruoyi-ui/src/components/PanThumb/index.vue
+1
-1
ruoyi-ui/src/store/index.js
ruoyi-ui/src/store/index.js
+3
-1
ruoyi-ui/src/store/modules/userInfo.js
ruoyi-ui/src/store/modules/userInfo.js
+23
-0
ruoyi-ui/src/utils/request.js
ruoyi-ui/src/utils/request.js
+1
-1
ruoyi-ui/src/views/ActSuppliesConvert/convert/index.vue
ruoyi-ui/src/views/ActSuppliesConvert/convert/index.vue
+1
-27
ruoyi-ui/src/views/ActSuppliesConvert/convert/indexConvert.vue
...-ui/src/views/ActSuppliesConvert/convert/indexConvert.vue
+0
-1
ruoyi-ui/src/views/activiti/definition/index.vue
ruoyi-ui/src/views/activiti/definition/index.vue
+0
-17
ruoyi-ui/src/views/example/demo/demoForm.vue
ruoyi-ui/src/views/example/demo/demoForm.vue
+0
-1
ruoyi-ui/src/views/index.vue
ruoyi-ui/src/views/index.vue
+9
-72
ruoyi-ui/src/views/login.vue
ruoyi-ui/src/views/login.vue
+2
-2
ruoyi-ui/src/views/system/ActClassification/index.vue
ruoyi-ui/src/views/system/ActClassification/index.vue
+244
-255
ruoyi-ui/src/views/system/ActSuppliesDetails/ActSuppliesDetails/index.vue
...ws/system/ActSuppliesDetails/ActSuppliesDetails/index.vue
+1
-1
ruoyi-ui/src/views/system/Actsupplies/Actsupplies/index.vue
ruoyi-ui/src/views/system/Actsupplies/Actsupplies/index.vue
+1
-1
ruoyi-ui/src/views/system/historydata/index.vue
ruoyi-ui/src/views/system/historydata/index.vue
+18
-26
ruoyi-ui/src/views/system/supplies/index.vue
ruoyi-ui/src/views/system/supplies/index.vue
+989
-1141
ruoyi-ui/src/views/system/supplies/index_template.vue
ruoyi-ui/src/views/system/supplies/index_template.vue
+4
-2
ruoyi-ui/src/views/system/supplies/index_vue.vue
ruoyi-ui/src/views/system/supplies/index_vue.vue
+1632
-860
ruoyi-ui/src/views/system/supplies/indexupload.vue
ruoyi-ui/src/views/system/supplies/indexupload.vue
+1
-0
ruoyi-ui/src/views/system/supplies/viewuploads2.vue
ruoyi-ui/src/views/system/supplies/viewuploads2.vue
+365
-0
ruoyi-ui/src/views/system/suppliesrole/index.vue
ruoyi-ui/src/views/system/suppliesrole/index.vue
+243
-58
ruoyi-ui/src/views/system/suppliesroledetail/index(1).vue
ruoyi-ui/src/views/system/suppliesroledetail/index(1).vue
+0
-551
ruoyi-ui/src/views/system/suppliesroledetail/index.vue
ruoyi-ui/src/views/system/suppliesroledetail/index.vue
+456
-348
ruoyi-ui/vue.config.js
ruoyi-ui/vue.config.js
+2
-3
No files found.
ruoyi-ui/package.json
View file @
acae3d48
...
...
@@ -61,6 +61,7 @@
"jsencrypt"
:
"3.0.0-rc.1"
,
"lint-staged"
:
"10.5.3"
,
"luckyexcel"
:
"^1.0.1"
,
"moment"
:
"^2.30.1"
,
"nprogress"
:
"0.2.0"
,
"quill"
:
"1.3.7"
,
"runjs"
:
"4.4.2"
,
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/public/exportExcel.js
View file @
acae3d48
This diff is collapsed.
Click to expand it.
ruoyi-ui/public/index.html
View file @
acae3d48
...
...
@@ -17,13 +17,6 @@
<script
src=
"/expendPlugins/chart/chartmix.umd.min.js"
></script>
<!--<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/assets/iconfont/iconfont.css' />
<script src="./luckysheet/plugins/js/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js"></script>-->
<title><
%=
webpackConfig
.
name
%
></title>
<style>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/public/luckysheet.esm.js
View file @
acae3d48
This source diff could not be displayed because it is too large. You can
view the blob
instead.
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/api/Actsupplies/cleaning_rule.js
View file @
acae3d48
...
...
@@ -8,8 +8,7 @@ export function selectActSuppliesHistorydata(tylkStatus) {
})
}
// 查询通用凭证单表数据
//查询通用凭证单表数据
export
function
selectActSuppliesHistorydataAcc
(
tylkStatus
)
{
return
request
({
url
:
'
/system/cleaningrule/queryAllAcc/
'
+
tylkStatus
,
...
...
@@ -50,6 +49,8 @@ export function selectActSuppliesHistorydataAcc(tylkStatus) {
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/api/ruoyi-myLuckyexcel/myluckyexcel.js
View file @
acae3d48
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/api/system/historydata.js
View file @
acae3d48
...
...
@@ -56,7 +56,7 @@ export function exportHistorydata(query) {
// 新增 历史数据
export
function
addInsert
(
data
)
{
return
request
({
url
:
'
/system/historydata/addInser
t
'
,
url
:
'
/system/historydata/addInsertAccoun
t
'
,
method
:
'
post
'
,
data
:
data
})
...
...
@@ -71,50 +71,47 @@ export function addInsert1(data) {
})
}
//
数据清洗 历史数据
export
function
addInsert
2
(
data
)
{
//
清洗通用凭证单
export
function
addInsert
Account1
(
data
)
{
return
request
({
url
:
'
/system/historydata/addInsert2
'
,
url
:
'
/system/historydata/addInsertAccount1
'
,
method
:
'
post
'
,
data
:
data
})
}
//清洗通用凭证单
// 数据清洗 历史数据
export
function
addInsertConvert1
(
data
)
{
export
function
addInsertAccount2
(
data
)
{
console
.
log
(
data
,
'
我发送的数据
'
)
return
request
({
url
:
'
/system/historydata/addInsertConvert1
'
,
url
:
'
/system/historydata/addInsertAccount2
'
,
method
:
'
post
'
,
data
:
data
})
}
// 数据清洗 历史数据
export
function
addInsert
Convert
2
(
data
)
{
export
function
addInsert2
(
data
)
{
return
request
({
url
:
'
/system/historydata/addInsertConv
ert2
'
,
url
:
'
/system/historydata/addIns
ert2
'
,
method
:
'
post
'
,
data
:
data
})
}
//清洗通用凭证单
export
function
addInsertAccount1
(
data
)
{
// 数据清洗 历史数据
export
function
addInsertConvert1
(
data
)
{
return
request
({
url
:
'
/system/historydata/addInsertAccoun
t1
'
,
url
:
'
/system/historydata/addInsertConver
t1
'
,
method
:
'
post
'
,
data
:
data
})
}
//清洗通用凭证单
export
function
addInsertAccount2
(
data
)
{
// 数据清洗 历史数据
export
function
addInsertConvert2
(
data
)
{
return
request
({
url
:
'
/system/historydata/addInsertAccoun
t2
'
,
url
:
'
/system/historydata/addInsertConver
t2
'
,
method
:
'
post
'
,
data
:
data
})
}
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/components/PanThumb/index.vue
View file @
acae3d48
...
...
@@ -5,7 +5,7 @@
<slot
/>
</div>
</div>
<!--
eslint-disable-next-line -->
eslint-disable-next-line -->
<div
:style=
"
{backgroundImage: `url(${image})`}" class="pan-thumb">
</div>
</div>
</
template
>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/store/index.js
View file @
acae3d48
...
...
@@ -6,6 +6,7 @@ import tagsView from './modules/tagsView'
import
permission
from
'
./modules/permission
'
import
settings
from
'
./modules/settings
'
import
getters
from
'
./getters
'
import
userInfo
from
'
./modules/userInfo
'
Vue
.
use
(
Vuex
)
...
...
@@ -15,7 +16,8 @@ const store = new Vuex.Store({
user
,
tagsView
,
permission
,
settings
settings
,
userInfo
},
getters
})
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/store/modules/userInfo.js
0 → 100644
View file @
acae3d48
const
state
=
{
nickName
:
null
}
const
mutations
=
{
SET_NICKNAME
(
state
,
nickname
)
{
state
.
nickName
=
nickname
}
}
const
actions
=
{
setNickName
({
commit
},
nickname
)
{
commit
(
'
SET_NICKNAME
'
,
nickname
)
}
}
export
default
{
namespaced
:
true
,
state
,
mutations
,
actions
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/utils/request.js
View file @
acae3d48
...
...
@@ -10,7 +10,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL
:
process
.
env
.
VUE_APP_BASE_API
,
// 超时
timeout
:
1000000000
timeout
:
1000000000
0000
})
// request拦截器
service
.
interceptors
.
request
.
use
(
config
=>
{
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/ActSuppliesConvert/convert/index.vue
View file @
acae3d48
...
...
@@ -111,30 +111,6 @@
@
pagination=
"getList"
/>
<!-- <!– 添加或修改通用规则对话框 –>-->
<!-- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>-->
<!-- <el-form ref="form" :model="form" :rules="rules" label-width="80px">-->
<!-- <el-form-item label="模板id" prop="tempId">-->
<!-- <el-input v-model="form.tempId" placeholder="请输入模板id" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="规则名称" prop="name">-->
<!-- <el-input v-model="form.name" placeholder="请输入规则名称" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="规则内容">-->
<!-- <editor v-model="form.content" :min-height="192"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="状态">-->
<!-- <el-radio-group v-model="form.status">-->
<!-- <el-radio label="1">请选择字典生成</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <div slot="footer" class="dialog-footer">-->
<!-- <el-button type="primary" @click="submitForm">确 定</el-button>-->
<!-- <el-button @click="cancel">取 消</el-button>-->
<!-- </div>-->
<!-- </el-dialog>-->
<el-dialog
:title=
"title"
:visible.sync=
"open"
width=
"1300px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"所属模板"
prop=
"roleId"
>
...
...
@@ -159,10 +135,9 @@
</el-col>
</el-row>
<!-- 生成输入框 -->
<div
v-for=
"index in instea"
:key=
"index"
v-if=
""
>
<div
v-for=
"index in instea"
:key=
"index"
>
<el-form-item
label=
"导入表行/列/单元格选择"
prop=
"detailMH"
class=
"form-item-inline"
>
<!-- <el-input-number size="medium" v-model="ZE[index-1]" :min="1" :step="1">1</el-input-number>-->
<el-select
v-model=
"ZE[index-1]"
filterable
placeholder=
"请选择运算方法"
>
<el-option
v-for=
"option in optionsOne"
...
...
@@ -183,7 +158,6 @@
</el-form-item>
<el-form-item
label=
"模板表行/列/单元格选择"
prop=
"detailMH"
class=
"form-item-inline"
>
<!-- <el-input-number size="medium" v-model="ZT[index-1]" :min="1" :step="1">1</el-input-number>-->
<el-select
v-model=
"ZT[index-1]"
filterable
placeholder=
"请选择运算方法"
>
<el-option
v-for=
"option in optionsOne"
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/ActSuppliesConvert/convert/indexConvert.vue
View file @
acae3d48
...
...
@@ -4,7 +4,6 @@
<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>
-->
<el-option
v-for=
"item in depss"
:key=
"item.id"
:label=
"item.templateName"
:value=
"item.id"
>
</el-option>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/activiti/definition/index.vue
View file @
acae3d48
...
...
@@ -59,23 +59,6 @@
<el-table-column
label=
"流程描述"
align=
"center"
prop=
"description"
width=
"150"
/>
<el-table-column
label=
"所属分类"
align=
"center"
prop=
"category"
width=
"120"
/>
<el-table-column
label=
"部署时间"
align=
"center"
prop=
"deploymentTime"
width=
"100"
/>
<!--
<el-table-column
label=
"流程定义"
align=
"center"
prop=
"resourceName"
width=
"120"
>
<template
slot-scope=
"scope"
>
<a
:href=
"baseURL + '/activiti/definition/readResource?pdid=' + scope.row.id + '&resourceName=' + scope.row.resourceName "
target=
"_blank"
style=
"color: #409EFF;"
>
{{
scope
.
row
.
resourceName
.
substring
(
scope
.
row
.
resourceName
.
lastIndexOf
(
'
/
'
)
+
1
)
}}
</a>
</
template
>
</el-table-column>
<el-table-column
label=
"流程图"
align=
"center"
prop=
"diagramResourceName"
width=
"120"
>
<
template
slot-scope=
"scope"
>
<img
style=
"width: 100px;"
:src=
"baseURL + '/activiti/definition/readResource?pdid=' + scope.row.id + '&resourceName=' + scope.row.diagramResourceName"
/>
</
template
>
</el-table-column>
-->
<el-table-column
label=
"状态"
align=
"center"
prop=
"suspendStateName"
width=
"90"
/>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<template
slot-scope=
"scope"
>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/example/demo/demoForm.vue
View file @
acae3d48
...
...
@@ -24,7 +24,6 @@
:readonly=
"taskName!=='调整申请'"
>
</el-date-picker>
</el-form-item>
<!--
<el-form-item
label=
"流程实例ID"
prop=
"instanceId"
>
<el-input
v-model=
"form.instanceId"
readonly
/>
</el-form-item>
-->
<el-form-item
label=
"备注"
prop=
"remark"
>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/index.vue
View file @
acae3d48
...
...
@@ -16,6 +16,7 @@
</
template
>
<
script
>
import
{
getInfo
}
from
"
@/api/login
"
;
...
...
@@ -28,14 +29,18 @@ export default {
return
{
}
},
mounted
()
{
},
methods
:
{
}
}
</
script
>
<
style
scoped
>
.container
{
.container
{
display
:
flex
;
flex-direction
:
column
;
height
:
calc
(
100vh
-
84px
);
...
...
@@ -44,7 +49,7 @@ export default {
background-size
:
cover
;
}
.main-footer
{
.main-footer
{
position
:
absolute
;
left
:
0
;
bottom
:
0
;
...
...
@@ -58,78 +63,10 @@ export default {
padding
:
15px
;
}
.main-footer
.split
{
.main-footer
.split
{
padding
:
0
10px
;
font-size
:
12px
;
}
</
style
>
<!--<template>-->
<!-- <div class="container">-->
<!-- <div class="index">-->
<!-- </div>-->
<!-- <div class="input" style="position: absolute; bottom: 0;">-->
<!-- 开发中心-->
<!-- </div>-->
<!-- </div>-->
<!--<!– 开滦(集团)财务共享中心&河北天翼科贸发展有限公司–>-->
<!--</template>-->
<!--<script>-->
<!--export default {-->
<!-- name: 'Index',-->
<!-- components: {-->
<!-- },-->
<!-- data() {-->
<!-- return {-->
<!-- }-->
<!-- },-->
<!-- methods: {-->
<!-- }-->
<!--}-->
<!--</script>-->
<!--<style rel="stylesheet/scss" lang="scss">-->
<!-- .index {-->
<!-- display: flex;-->
<!-- justify-content: center;-->
<!-- align-items: center;-->
<!-- flex: 9;-->
<!-- height: 90vh;-->
<!-- background-image: url("../assets/images/login-background2.jpg");-->
<!-- background-position: center;-->
<!-- background-size: cover;-->
<!-- }-->
<!-- .title {-->
<!-- margin: 0px auto 30px auto;-->
<!-- text-align: center;-->
<!-- color: #707070;-->
<!-- }-->
<!-- .input{-->
<!-- flex: 1;-->
<!-- font-size: 30px;-->
<!-- color: #1b1b19;-->
<!-- }-->
<!-- .container {-->
<!-- display: flex;-->
<!-- flex-direction: column;-->
<!-- height: 100vh;-->
<!-- }-->
<!--</style>-->
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/login.vue
View file @
acae3d48
...
...
@@ -7,7 +7,7 @@
<el-form
ref=
"loginForm"
:model=
"loginForm"
:rules=
"loginRules"
class=
"login-form"
>
<h3
class=
"title"
>
开滦采集转换系统
</h3>
<el-form-item
prop=
"username"
>
<el-input
v-model=
"loginForm.username"
type=
"text"
auto-complete=
"off"
placeholder=
"账号"
>
<el-input
v-model=
"loginForm.username"
type=
"
b
text"
auto-complete=
"off"
placeholder=
"账号"
>
<svg-icon
slot=
"prefix"
icon-class=
"user"
class=
"el-input__icon input-icon"
/>
</el-input>
</el-form-item>
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/ActClassification/index.vue
View file @
acae3d48
...
...
@@ -88,7 +88,8 @@
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"所属矿"
prop=
"belongs"
>
<el-select
v-model=
"form.sskId"
filterable
placeholder=
"请输入所属矿"
style=
"width:380px"
@
change=
"fetchOptions"
>
<el-select
v-model=
"form.sskId"
filterable
placeholder=
"请输入所属矿"
style=
"width:380px"
@
change=
"fetchOptions"
>
<el-option
v-for=
"option in miningValue"
:key=
"option.name"
:label=
"option.name"
:value=
"option.id"
></el-option>
</el-select>
...
...
@@ -100,7 +101,7 @@
<el-option
v-for=
"items in types"
:key=
"items.id"
:label=
"items.name"
:value=
"items.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"名称"
prop=
"pid"
>
<el-form-item
label=
"名称"
prop=
"pid"
>
<el-input
v-model=
"form.name"
placeholder=
"请输入名称"
maxlength=
"36"
/>
</el-form-item>
<el-form-item
label=
"所属费用来源"
prop=
"source"
v-if=
"typeid === 1"
>
...
...
@@ -127,9 +128,9 @@
</template>
<
script
>
import
{
listActClassification
,
savePid
,
toggleEnable
,
toggleDisable
,
getActClassification
,
delActClassification
,
addActClassification
,
updateActClassification
,
exportActClassification
}
from
"
@/api/ActClassification/ActClassification
"
;
import
{
listActClassification
,
savePid
,
toggleEnable
,
toggleDisable
,
getActClassification
,
delActClassification
,
addActClassification
,
updateActClassification
,
exportActClassification
}
from
"
@/api/ActClassification/ActClassification
"
;
export
default
{
export
default
{
name
:
"
ActClassification
"
,
components
:
{
},
...
...
@@ -138,7 +139,7 @@
miningValue
:
[
{
name
:
'
东欢坨矿
'
,
id
:
1
id
:
'
010102
'
},
{
name
:
'
范矿
'
,
...
...
@@ -146,31 +147,19 @@
},
{
name
:
'
林西矿
'
,
id
:
3
id
:
'
011704
'
},
{
name
:
'
吕矿
'
,
id
:
4
},
{
name
:
'
钱家营矿
'
,
id
:
5
},
{
name
:
'
唐山矿
'
,
id
:
6
},
{
name
:
'
宏丰公司矿业
'
,
id
:
7
},
{
name
:
'
云飞公司矿业
'
,
id
:
8
id
:
'
010101
'
},
{
name
:
'
单侯煤矿
'
,
id
:
9
id
:
'
011204
'
},
],
types
:
[
...
...
@@ -266,7 +255,7 @@
},
/** 查询上级关联关系*/
fetchOptions
(
)
{
fetchOptions
(
value
)
{
savePid
(
this
.
form
.
sskId
).
then
(
response
=>
{
this
.
options
=
response
.
rows
;
});
...
...
@@ -381,5 +370,5 @@
})
}
}
};
};
</
script
>
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/ActSuppliesDetails/ActSuppliesDetails/index.vue
View file @
acae3d48
...
...
@@ -493,7 +493,7 @@ export default {
this
.
fetchOptions
();
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"
新增物料
分类
"
;
this
.
title
=
"
新增物料
"
;
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/Actsupplies/Actsupplies/index.vue
View file @
acae3d48
...
...
@@ -492,7 +492,7 @@ export default {
handleAdd
()
{
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"
新增
物料
分类
"
;
this
.
title
=
"
新增
二级
分类
"
;
},
/** 修改按钮操作 */
async
handleUpdate
(
row
)
{
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/historydata/index.vue
View file @
acae3d48
...
...
@@ -80,13 +80,13 @@
@
click=
"handleDetails(scope.row)"
v-hasPermi=
"['system:historydata']"
>
详情
</el-button>
<!--
<el-button
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['system:historydata:remove']"
>
删除
</el-button>
-->
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -166,13 +166,11 @@ export default {
roleId
:
null
,
historyName
:
null
,
historyContent
:
null
,
historyRole
:
null
,
identifyingCode
:
null
,
status
:
null
,
},
// 表单参数
form
:
{},
formContent
:{},
};
},
...
...
@@ -210,7 +208,6 @@ export default {
exportUuid
:
null
,
roleId
:
null
,
historyName
:
null
,
historyRole
:
null
,
historyContent
:
null
,
identifyingCode
:
null
,
status
:
0
,
...
...
@@ -273,14 +270,12 @@ export default {
},
handleDetails
(
row
)
{
getHistorydata
(
row
.
id
).
then
(
response
=>
{
this
.
formContent
=
response
.
data
;
this
.
positionValue
=
'
absolute
'
;
luckysheet
.
destroy
();
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
this
.
formContent
.
historyName
,
// Excel 文件名
data
:
JSON
.
parse
(
this
.
formContent
.
historyContent
),
// Excel 数据
title
:
row
.
historyName
,
// Excel 文件名
data
:
JSON
.
parse
(
row
.
historyContent
),
// Excel 数据
showtoolbar
:
false
,
//是否第二列显示工具栏
showinfobar
:
true
,
//是否显示顶部名称栏
showsheetbar
:
false
,
//是否显示底部表格名称区域
...
...
@@ -290,9 +285,6 @@ export default {
functionButton
:
'
<button id="exportButton" class="btn btn-primary" style=" padding:3px 6px; font-size: 16px;width: 100px;height: 27px; margin-right: 85px;" onclick="handleReturnButtonClick()">返回</button>
'
,
});
});
},
/**详情返回按钮 */
...
...
@@ -301,7 +293,7 @@ export default {
luckysheet
.
destroy
();
},
/** 删除按钮操作 */
/*
handleDelete(row) {
handleDelete
(
row
)
{
const
ids
=
row
.
id
||
this
.
ids
;
this
.
$confirm
(
'
是否确认删除 历史数据编号为"
'
+
ids
+
'
"的数据项?
'
,
"
警告
"
,
{
confirmButtonText
:
"
确定
"
,
...
...
@@ -313,7 +305,7 @@ export default {
this
.
getList
();
this
.
msgSuccess
(
"
删除成功
"
);
})
},
*/
},
/** 导出按钮操作 */
handleExport
()
{
const
queryParams
=
this
.
queryParams
;
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/supplies/index.vue
View file @
acae3d48
...
...
@@ -54,25 +54,25 @@
<
script
>
import
{
selectActSuppliesHistorydata
}
from
"
@/api/Actsupplies/cleaning_rule
"
;
import
{
getSuppliesTemplate
,
listSuppliesTemplate
,
roleList
,
materialConvert
,
roleListid
,
materialList
}
from
"
@/api/ruoyi-myLuckyexcel/myluckyexcel
"
;
import
{
addInsert
,
addInsert1
,
addInsert2
}
from
"
@/api/system/historydata
"
/*import luckysheet from 'luckysheet'*/
import
LuckyExcel
from
'
luckyexcel
'
//导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!
/*import {materialList} from "@/api/ruoyi-myLuckyexcel/myluckyexcel";*/
import
{
exportExcel
}
from
'
../../../../public/exportExcel
'
;
import
{
v4
as
uuidv4
}
from
'
uuid
'
;
import
{
listSuppliesexpense
}
from
"
../../../api/ActClassification/ActClassification
"
;
var
fileName
=
"
新建XLSX工作表
"
;
//定义表名
var
rule
=
[];
var
tempId
;
var
roleId
;
var
uuid1
;
var
trueORfalse
=
false
;
var
modify
=
false
;
export
default
{
import
{
selectActSuppliesHistorydata
}
from
"
@/api/Actsupplies/cleaning_rule
"
;
import
{
getSuppliesTemplate
,
listSuppliesTemplate
,
roleList
,
materialConvert
,
materialListPZ
,
roleListid
,
materialList
}
from
"
@/api/ruoyi-myLuckyexcel/myluckyexcel
"
;
import
{
addInsert
,
addInsert1
,
addInsert2
}
from
"
@/api/system/historydata
"
/*import luckysheet from 'luckysheet'*/
import
LuckyExcel
from
'
luckyexcel
'
//导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!
/*import {materialList} from "@/api/ruoyi-myLuckyexcel/myluckyexcel";*/
import
{
exportExcel
}
from
'
../../../../public/exportExcel
'
;
import
{
v4
as
uuidv4
}
from
'
uuid
'
;
import
{
listSuppliesexpense
}
from
"
../../../api/ActClassification/ActClassification
"
;
var
fileName
=
"
新建XLSX工作表
"
;
//定义表名
var
rule
=
[];
var
tempId
;
var
roleId
;
var
uuid1
;
var
trueORfalse
=
false
;
var
modify
=
false
;
export
default
{
name
:
"
Mymodule
"
,
data
()
{
return
{
...
...
@@ -114,7 +114,9 @@
id
:
9
},
],
showMask
:
false
,
showMask
:
false
,
//选中的表的数据
selected
:
''
,
uuid
:
''
,
//弹出页面的表名
from_name
:
""
,
...
...
@@ -143,7 +145,7 @@
hDate
:
null
,
mining
:
""
},
historyRole
:
[],
historyRole
:
[],
dfrom
:
{},
imp
:
{},
ssd
:
{},
...
...
@@ -163,14 +165,18 @@
this
.
init
();
fileName
=
"
新建XLSX工作表
"
;
this
.
list
()
},
methods
:
{
list
()
{
materialListPZ
().
then
(
response
=>
{
})},
/** 判断是否选择时间*/
rulesdate
()
{
const
minvalue
=
this
.
miningValue
.
find
(
obj
=>
obj
.
id
===
this
.
mining
)
const
Luckysheetlabel
=
this
.
luckyrule
.
find
(
obj
=>
obj
.
id
===
this
.
selectedRule
);
if
(
this
.
date
==
''
||
this
.
date
==
null
)
{
this
.
disableNextButton
=
true
;
this
.
$message
.
error
(
'
请选择时间日期!
'
);
...
...
@@ -211,24 +217,24 @@
},
/** 下拉选和页面luckysheet绑定 */
handleOptionChange
()
{
this
.
selectedRule
=
''
;
this
.
selectedRule
=
''
;
this
.
disableNextButton
=
this
.
selectedRule
===
''
;
//根据选中的下拉选项值获取相应的信息
getSuppliesTemplate
(
this
.
selectedOption
).
then
(
response
=>
{
//如果为六矿汇总表,导出时隐藏前两列
if
(
this
.
selectedOption
===
7
||
this
.
selectedOption
===
10
)
{
trueORfalse
=
true
;
}
else
{
trueORfalse
=
false
;
if
(
this
.
selectedOption
===
7
||
this
.
selectedOption
===
10
)
{
trueORfalse
=
true
;
}
else
{
trueORfalse
=
false
;
}
modify
=
false
;
tempId
=
this
.
selectedOption
;
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
modify
=
false
;
tempId
=
this
.
selectedOption
;
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
const
sysSupplies
=
response
.
rows
;
this
.
luckysheetData
=
sysSupplies
[
0
].
templateContent
;
//将接收到的json存到json_data中
//const json_data = response.data;
console
.
log
(
sysSupplies
)
var
json_data
=
JSON
.
parse
(
sysSupplies
[
0
].
templateContent
);
roleList
(
this
.
selectedOption
).
then
(
response
=>
{
this
.
luckyrule
=
response
.
rows
;
...
...
@@ -241,7 +247,7 @@
title
:
fileName
,
// Excel 文件名
data
:
json_data
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
'
zh
'
,
lang
:
'
zh
'
,
});
}).
catch
(()
=>
{
// 处理错误逻辑,这里是一个空的错误处理函数
...
...
@@ -249,20 +255,20 @@
});
},
/** 规则下拉选 调佣后端的方法*/
handleRuleChange
()
{
if
(
this
.
selectedOption
===
''
)
{
this
.
selectedRule
=
''
;
handleRuleChange
()
{
if
(
this
.
selectedOption
===
''
)
{
this
.
selectedRule
=
''
;
this
.
$message
.
warning
(
"
选择规则前请先选择模板!
"
);
return
;
// 如果按钮被禁用,提前返回,避免执行下一步操作
return
;
// 如果按钮被禁用,提前返回,避免执行下一步操作
}
this
.
disableNextButton
=
this
.
selectedRule
===
''
;
roleListid
(
this
.
selectedRule
).
then
(
response
=>
{
roleId
=
this
.
selectedRule
;
rule
=
response
.
rows
;
roleId
=
this
.
selectedRule
;
rule
=
response
.
rows
;
});
if
(
tempId
===
7
||
tempId
===
10
)
{
if
(
tempId
===
7
||
tempId
===
10
)
{
getSuppliesTemplate
(
tempId
).
then
(
response
=>
{
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
// 通过遍历this.luckyrule找到对应的iem.roleName
for
(
let
i
=
0
;
i
<
this
.
luckyrule
.
length
;
i
++
)
{
if
(
this
.
luckyrule
[
i
].
id
===
this
.
selectedRule
)
{
...
...
@@ -306,6 +312,9 @@
//刷新luckysheet表格
this
.
init
();
},
/** Luckyexcel文档 */
init
()
{
let
options
=
{
...
...
@@ -342,24 +351,7 @@
"
authority
"
:
{},
//工作表保护
},
},
/*{
"name": "Sheet2",
"color": "",
"index": 1,
"status": 0,
"order": 1,
"celldata": [],
"config": {}
},
{
"name": "Sheet3",
"color": "",
"index": 2,
"status": 0,
"order": 2,
"celldata": [],
"config": {},
}*/
]
}
...
...
@@ -373,6 +365,9 @@
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
}).
then
(
async
()
=>
{
// 确认继续后刷新页面返回模板
getSuppliesTemplate
(
7
).
then
(
response
=>
{
const
sysSupplies
=
response
.
rows
;
...
...
@@ -388,6 +383,9 @@
});
modify
=
false
;
}).
then
(
async
()
=>
{
this
.
showMask
=
true
;
//将导入数据替换保存
LuckyExcel
.
transformExcelToLucky
(
evt
,
exportJson
=>
{
...
...
@@ -417,9 +415,9 @@
this
.
$message
({
type
:
'
info
'
,
message
:
'
操作已取消
'
});
});
}
else
{
this
.
showMask
=
true
;
LuckyExcel
.
transformExcelToLucky
(
evt
,
exportJson
=>
{
//获取导入表格所有数据exportJson
this
.
summary
(
exportJson
)
.
then
(
async
()
=>
{
this
.
submit
(
exportJson
);
...
...
@@ -441,46 +439,46 @@
},
/** 物料转换汇总到页面*/
summary
(
exportJson
)
{
summary
(
exportJson
)
{
// 记录开始时间
const
startTime
=
new
Date
().
getTime
();
let
sysRulez
;
let
sysRules
;
let
sysConver
;
let
value
=
[];
let
value
=
[];
let
data
;
//获取规则 sysRulez是物料转换 sysRules是数据汇总规则
for
(
let
i
=
0
;
i
<
rule
.
length
;
i
++
){
if
(
rule
[
i
].
convertStatus
==
1
){
for
(
let
i
=
0
;
i
<
rule
.
length
;
i
++
)
{
if
(
rule
[
i
].
convertStatus
==
1
)
{
sysRulez
=
JSON
.
parse
(
rule
[
i
].
detailContent
);
}
if
(
rule
[
i
].
convertStatus
==
2
)
{
if
(
parseInt
(
rule
[
i
].
detailYS
)
===
1
)
{
if
(
rule
[
i
].
convertStatus
==
2
)
{
if
(
parseInt
(
rule
[
i
].
detailYS
)
===
1
)
{
sysConver
=
JSON
.
parse
(
rule
[
i
].
detailContent
)
}
else
{
}
else
{
sysRules
=
JSON
.
parse
(
rule
[
i
].
detailContent
);
}
}
if
(
rule
[
i
].
convertStatus
==
6
)
{
if
(
rule
[
i
].
convertStatus
==
6
)
{
this
.
historyRole
=
rule
[
i
].
detailContent
;
}
}
try
{
//获取物料转换的sheet表
data
=
window
.
luckysheet
.
transToData
(
exportJson
.
sheets
[
sysRulez
[
0
].
se
].
celldata
);
data
=
window
.
luckysheet
.
transToData
(
exportJson
.
sheets
[
sysRulez
[
0
].
se
].
celldata
);
}
catch
(
err
){
throw
new
Error
(
"
导入失败,所选文件或规则有误
"
);
catch
(
err
)
{
//throw new Error("导入失败,导入文件与模板规则不匹");
this
.
showMask
=
false
;
this
.
$message
.
error
(
"
导入失败,导入文件与模板规则不匹
"
);
return
;
}
//获取物料转换中导入表的列,用来获取物料名
let
key_i
=
parseInt
(
sysRulez
[
0
].
ce
);
let
key_i
=
parseInt
(
sysRulez
[
0
].
ce
);
//获取物料转换的数据
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
){
//value.push(data[sysRules[i].re][sysRules[i].ce].m);
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
value
.
push
(
sysRules
[
i
].
ce
);
}
return
new
Promise
((
resolve
,
reject
)
=>
{
const
asyncTasks
=
[];
switch
(
tempId
)
{
...
...
@@ -492,7 +490,7 @@
departmentMap
.
set
(
'
风选煤
'
,
'
洗煤厂
'
);
departmentMap
.
set
(
'
制造费用
'
,
[
'
机电检修中心
'
,
'
地测科
'
,
'
设备管理科
'
,
'
旧品利用中心
'
,
'
机修加工中心
'
,
'
网络安全与信息通讯中心
'
,
'
保卫科
'
,
'
煤质管理科
'
,
'
迁建科
'
,
'
综合服务中心
'
]);
departmentMap
.
set
(
'
管理费用
'
,
[
'
财务部
'
,
'
综合办公室
'
,
'
纪委监察科
'
,
'
工会
'
,
'
团委
'
,
'
安全管理部
'
,
'
经营管理部
'
,
'
党委组织部(人力资源部)
'
,
'
党委宣传部
'
,
'
生产技术部
'
,
'
机电运输部
'
,
'
科协
'
,
'
节能环保法律办公室
'
,
'
党委组织部
'
,
'
人力资源部
'
]);
try
{
try
{
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
let
n
=
parseInt
(
sysRules
[
0
].
ce
)
+
2
;
if
(
data
[
i
][
key_i
]
!=
null
&&
data
[
i
][
n
]
!=
null
)
{
...
...
@@ -504,18 +502,14 @@
departments
.
push
(
null
);
}
}
}
catch
(
err
){
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件与模板规则不匹
"
);
}
for
(
let
key
of
departmentMap
.
keys
())
{
let
map
=
new
Map
();
let
smallMat
=
[];
try
{
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
key_i
]
!=
null
&&
departments
[
i
-
1
]
===
key
)
{
let
num
=
data
[
i
][
key_i
].
m
;
smallMat
.
push
(
num
);
...
...
@@ -523,32 +517,28 @@
smallMat
.
push
(
null
);
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件与模板规则不匹
"
);
}
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
materialConvert
(
smallMat
)
.
then
(
response
=>
{
let
array
=
response
.
rows
;
//luckysheet.setCellValue(12, 1, {bg:"#FF0000"})
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
let
values
=
[];
if
(
data
[
i
][
13
]
!=
null
&&
departments
[
i
-
1
]
===
key
&&
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
try
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
values
.
push
(
a
);
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件不匹
"
);
}
}
//插入多个value的值
let
index
=
smallMat
.
indexOf
(
data
[
i
][
key_i
].
m
);
...
...
@@ -565,7 +555,6 @@
}
}
//循环得到汇总结果
if
(
map
.
size
===
0
)
{
throw
new
Error
(
"
导入失败,导入文件错误
"
);
}
...
...
@@ -585,7 +574,7 @@
"
t
"
:
"
n
"
}
});
}
else
{
}
else
{
warn
++
;
}
});
...
...
@@ -595,8 +584,9 @@
throw
new
Error
(
"
导入文件与所选模板规则不匹配
"
);
}
else
if
(
warn
>
0
)
{
this
.
$message
({
message
:
"
还有
"
+
warn
/
sysRules
.
length
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
message
:
"
还有
"
+
warn
/
sysRules
.
length
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
}
resolve
(
response
.
rows
);
innerResolve
();
// 标记当前异步任务完成
...
...
@@ -615,7 +605,7 @@
let
exps
=
[];
let
map
=
new
Map
();
let
smallMat
=
[];
try
{
try
{
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
key_i
]
!=
null
)
{
let
num
=
data
[
i
][
key_i
].
m
;
...
...
@@ -630,36 +620,32 @@
exps
.
push
(
null
);
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件与模板规则不匹
"
);
}
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
const
allNull1
=
deps
.
every
(
item
=>
item
===
null
);
const
allNull2
=
exps
.
every
(
item
=>
item
===
null
);
if
(
allNull
||
allNull1
||
allNull2
)
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
const
allNull1
=
deps
.
every
(
item
=>
item
===
null
);
const
allNull2
=
exps
.
every
(
item
=>
item
===
null
);
if
(
allNull
||
allNull1
||
allNull2
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
materialConvert
(
smallMat
)
.
then
(
response
=>
{
let
array
=
response
.
rows
;
//luckysheet.setCellValue(12, 1, {bg:"#FF0000"})
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
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
values
.
push
(
a
);
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件不匹
"
);
}
}
//插入多个value的值
let
key
=
exps
[
k
]
+
'
/
'
+
deps
[
k
]
+
'
/
'
+
array
[
k
];
...
...
@@ -673,7 +659,6 @@
map
.
set
(
key
,
values
);
}
}
}
//循环得到汇总结果
...
...
@@ -683,38 +668,38 @@
//循环得到汇总结果
let
cells
;
let
rowws
;
let
con
=
0
;
let
warn
=
0
;
let
con
=
0
;
let
warn
=
0
;
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
map
.
forEach
((
value
,
key
)
=>
{
const
suffixArr
=
key
.
split
(
'
/
'
),
mat
=
suffixArr
[
2
],
depp
=
suffixArr
[
1
],
expp
=
suffixArr
[
0
];
let
searchResult
=
luckysheet
.
find
(
expp
);
if
(
searchResult
.
length
!==
0
)
{
if
(
searchResult
.
length
!==
0
)
{
rowws
=
searchResult
[
0
].
row
;
for
(
let
i
=
1
;
i
<
10000000000000000000000000
;
i
++
)
{
let
n
=
rowws
+
i
;
let
gg
=
luckysheet
.
getCellValue
(
n
,
0
);
if
(
gg
!==
null
)
{
if
(
gg
!==
null
)
{
con
=
rowws
+
i
;
break
;
}
}
searchResult
=
luckysheet
.
find
(
depp
);
if
(
searchResult
.
length
!==
0
)
{
searchResult
=
luckysheet
.
find
(
depp
);
if
(
searchResult
.
length
!==
0
)
{
let
k
=
0
;
let
k
=
0
;
let
r
;
for
(
let
i
=
0
;
i
<
searchResult
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
searchResult
.
length
;
i
++
)
{
r
=
searchResult
[
i
].
row
;
if
(
r
<
con
&&
r
>=
rowws
)
{
k
=
1
;
if
(
r
<
con
&&
r
>=
rowws
)
{
k
=
1
;
break
;
}
}
if
(
k
===
1
)
{
if
(
k
===
1
)
{
let
matResult
=
luckysheet
.
find
(
mat
);
if
(
matResult
.
length
!==
0
&&
mat
!=
null
)
{
cells
=
matResult
[
0
].
column
;
...
...
@@ -725,15 +710,15 @@
"
t
"
:
"
n
"
}
});
}
else
{
}
else
{
warn
++
;
}
}
else
{
}
else
{
warn
++
;
}
}
}
else
{
}
else
{
warn
++
;
}
});
...
...
@@ -741,8 +726,9 @@
throw
new
Error
(
"
导入文件与所选模板规则不匹配
"
);
}
else
if
(
warn
>
0
)
{
this
.
$message
({
message
:
"
还有
"
+
warn
/
sysRules
.
length
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
message
:
"
还有
"
+
warn
/
sysRules
.
length
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
}
resolve
(
response
.
rows
);
innerResolve
();
// 标记当前异步任务完成
...
...
@@ -760,7 +746,7 @@
case
1
:
{
let
map
=
new
Map
();
let
smallMat
=
[];
try
{
try
{
for
(
let
i
=
parseInt
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
key_i
]
!=
null
)
{
let
num
=
data
[
i
][
key_i
].
m
;
...
...
@@ -777,14 +763,14 @@
smallMat
.
push
(
null
);
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件与模板规则不匹
"
);
}
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
materialConvert
(
smallMat
)
...
...
@@ -796,13 +782,13 @@
let
values
=
[];
if
(
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
try
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
if
(
isNaN
(
a
))
{
a
=
0
;
}
values
.
push
(
a
);
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件不匹
"
);
}
}
...
...
@@ -828,12 +814,12 @@
//循环得到汇总结果
let
row
;
let
con
;
let
warn
=
0
;
let
warn
=
0
;
map
.
forEach
((
value
,
key
)
=>
{
map
.
forEach
((
value
,
key
)
=>
{
let
searchResult
;
searchResult
=
luckysheet
.
find
(
key
);
if
(
searchResult
==
undefined
||
searchResult
.
length
===
0
||
key
===
null
)
{
searchResult
=
luckysheet
.
find
(
key
);
if
(
searchResult
==
undefined
||
searchResult
.
length
===
0
||
key
===
null
)
{
warn
++
;
}
})
...
...
@@ -865,7 +851,7 @@
}
});
break
;
}
else
{
}
else
{
}
}
}
...
...
@@ -881,13 +867,13 @@
let
values2
=
[];
if
(
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value2
.
length
;
j
++
)
{
try
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value2
[
j
]].
v
);
if
(
isNaN
(
a
))
{
a
=
0
;
}
values2
.
push
(
a
);
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件不匹
"
);
}
}
...
...
@@ -912,8 +898,8 @@
map2
.
forEach
((
value
,
key
)
=>
{
let
searchResult
;
searchResult
=
luckysheet
.
find
(
key
);
if
(
searchResult
!==
undefined
&&
searchResult
.
length
!==
0
||
key
!==
null
)
{
searchResult
=
luckysheet
.
find
(
key
);
if
(
searchResult
!==
undefined
&&
searchResult
.
length
!==
0
||
key
!==
null
)
{
for
(
let
i
=
0
;
i
<
value
.
length
;
i
++
)
{
luckysheet
.
setCellValue
(
searchResult
[
0
].
row
,
sysConver
[
i
].
ct
,
value
[
i
]);
luckysheet
.
setCellValue
(
searchResult
[
0
].
row
,
sysConver
[
i
].
ct
,
{
...
...
@@ -923,16 +909,17 @@
}
});
}
}
else
{
}
else
{
warn
++
;
}
})
if
(
warn
===
map
.
size
+
map2
.
size
)
{
if
(
warn
===
map
.
size
+
map2
.
size
)
{
throw
new
Error
(
"
导入文件与所选模板规则不匹配
"
);
}
else
if
(
warn
>
0
)
{
this
.
$message
({
message
:
"
还有
"
+
warn
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
message
:
"
还有
"
+
warn
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
}
resolve
(
response
.
rows
);
innerResolve
();
// 标记当前异步任务完成
...
...
@@ -946,10 +933,10 @@
break
;
case
3
:
case
4
:
case
5
:
{
case
5
:
{
let
map
=
new
Map
();
let
smallMat
=
[];
try
{
try
{
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
key_i
]
!=
null
)
{
let
num
=
data
[
i
][
key_i
].
m
;
...
...
@@ -958,13 +945,13 @@
smallMat
.
push
(
null
);
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件与模板规则不匹
"
);
}
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
materialConvert
(
smallMat
)
...
...
@@ -975,10 +962,10 @@
let
index
;
if
(
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
try
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
values
.
push
(
a
);
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件不匹
"
);
}
...
...
@@ -1008,8 +995,8 @@
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
map
.
forEach
((
value
,
key
)
=>
{
let
searchResult
;
searchResult
=
luckysheet
.
find
(
key
);
if
(
searchResult
!==
undefined
&&
searchResult
.
length
!==
0
&&
key
!=
null
)
{
searchResult
=
luckysheet
.
find
(
key
);
if
(
searchResult
!==
undefined
&&
searchResult
.
length
!==
0
&&
key
!=
null
)
{
rowws
=
searchResult
[
0
].
row
;
luckysheet
.
setCellValue
(
rowws
,
sysRules
[
i
].
ct
,
value
[
i
]);
luckysheet
.
setCellValue
(
rowws
,
sysRules
[
i
].
ct
,
{
...
...
@@ -1027,8 +1014,9 @@
throw
new
Error
(
"
导入文件与所选模板规则不匹配
"
);
}
else
if
(
warn
>
0
)
{
this
.
$message
({
message
:
"
还有
"
+
warn
/
sysRules
.
length
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
message
:
"
还有
"
+
warn
/
sysRules
.
length
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
}
resolve
(
response
.
rows
);
innerResolve
();
// 标记当前异步任务完成
...
...
@@ -1040,11 +1028,12 @@
}));
}
break
;
case
7
:
{
case
7
:
{
let
map
=
new
Map
();
let
smallMat
=
[];
let
newsmallMat
=
[];
let
p
=
0
;
let
newsmallMat
=
[];
let
p
=
0
;
let
deps
=
[];
try
{
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
...
...
@@ -1052,7 +1041,7 @@
let
num
=
data
[
i
][
key_i
].
m
;
let
dep
=
data
[
i
][
sysRulez
[
1
].
ce
].
m
;
smallMat
.
push
(
num
);
newsmallMat
.
push
({
'
index
'
:
p
,
'
code
'
:
num
});
newsmallMat
.
push
({
'
index
'
:
p
,
'
code
'
:
num
});
p
++
;
deps
.
push
(
dep
);
}
else
{
...
...
@@ -1060,13 +1049,13 @@
deps
.
push
(
null
);
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
"
导入失败,导入文件与模板规则不匹
"
);
}
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
function
sortArray
(
array
)
{
...
...
@@ -1075,51 +1064,19 @@
}
materialList
().
then
(
response
=>
{
/*let SixMateriel=[];
let MaterielCode=[];
let NewMarterielCode=[];
let SixList=[];
let newSmasll =newsmallMat;
let m=0
SixMateriel=response.rows.slice(92,246);
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--;
}
}
}
}
for (let k = 0; k < newSmasll.length; k++) {
SixList[newSmasll[k].index]='11';
m++;
}
this.NewSixList=SixList*/
let
SixMateriel
=
[];
let
MaterielCode
=
[];
let
NewMarterielCode
=
[];
let
SixList
=
[];
let
newSmasll
=
smallMat
;
SixMateriel
=
response
.
rows
;
NewMarterielCode
=
sortArray
(
SixMateriel
)
let
SixMateriel
=
[];
let
MaterielCode
=
[];
let
NewMarterielCode
=
[];
let
SixList
=
[];
let
newSmasll
=
smallMat
;
SixMateriel
=
response
.
rows
;
NewMarterielCode
=
sortArray
(
SixMateriel
)
try
{
// //转化编码
let
p
=
0
;
for
(
var
i
=
0
;
i
<
newSmasll
.
length
;
i
++
)
{
let
p
=
0
;
for
(
var
i
=
0
;
i
<
newSmasll
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
NewMarterielCode
.
length
;
j
++
)
{
if
(
newSmasll
[
i
]
!==
null
)
{
if
(
newSmasll
[
i
]
!==
null
)
{
if
(
NewMarterielCode
[
j
]
&&
NewMarterielCode
[
j
].
code
&&
newSmasll
[
i
].
slice
(
0
,
NewMarterielCode
[
j
].
code
.
length
)
==
NewMarterielCode
[
j
].
code
)
{
SixList
[
i
]
=
NewMarterielCode
[
j
].
codes
;
p
++
;
...
...
@@ -1133,10 +1090,10 @@
}
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
//throw new Error("导入失败,转换编码运行错误,请检查对应规则");
}
var
warn1
=
0
,
warn2
=
0
;
var
warn1
=
0
,
warn2
=
0
;
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
,
k
=
0
;
i
<
data
.
length
;
i
++
,
k
++
)
{
let
values
=
[];
if
(
data
[
i
][
key_i
]
!=
null
)
{
...
...
@@ -1152,12 +1109,12 @@
innerReject
(
error
);
// 异步请求出错
}
}
if
(
SixList
[
k
]
==
undefined
)
{
if
(
SixList
[
k
]
==
undefined
)
{
warn1
++
;
//如果为空,统计为undefined
}
else
{
if
(
deps
[
k
]
==
undefined
)
{
}
else
{
if
(
deps
[
k
]
==
undefined
)
{
warn2
++
;
}
else
{
}
else
{
let
key
=
SixList
[
k
]
+
'
/
'
+
deps
[
k
];
if
(
map
.
has
(
key
))
{
let
oldValues
=
map
.
get
(
key
);
...
...
@@ -1201,16 +1158,16 @@
let
rowws
;
const
suffixArr
=
key
.
split
(
'
/
'
),
mat
=
suffixArr
[
0
],
depp
=
suffixArr
[
1
];
//返回当前工作表第1列数据
let
cown
=
luckysheet
.
getcellvalue
(
null
,
0
);
for
(
let
i
=
0
;
i
<
cown
.
length
;
i
++
)
{
if
(
cown
[
i
]
==
null
)
{
let
cown
=
luckysheet
.
getcellvalue
(
null
,
0
);
for
(
let
i
=
0
;
i
<
cown
.
length
;
i
++
)
{
if
(
cown
[
i
]
==
null
)
{
continue
;
}
if
(
cown
[
i
].
v
==
undefined
)
{
if
(
cown
[
i
].
v
==
undefined
)
{
continue
;
}
if
(
cown
[
i
].
v
==
mat
)
{
rowws
=
i
;
if
(
cown
[
i
].
v
==
mat
)
{
rowws
=
i
;
break
;
}
}
...
...
@@ -1232,36 +1189,22 @@
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
{
}
else
{
warn
++
;
}
});
if
(
warn
===
map
.
size
)
{
throw
new
Error
(
"
导入文件与所选模板规则不匹配
"
);
}
else
if
(
warn
>
0
)
{
}
else
if
(
warn
>
0
)
{
this
.
$message
({
message
:
"
还有
"
+
warn
+
"
条大类没匹配到,请仔细检查导入表
"
,
type
:
"
warning
"
...
...
@@ -1287,11 +1230,6 @@
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
=>
{
//必须加,不能删除
...
...
@@ -1301,12 +1239,12 @@
}
break
;
//物料转换六矿转换
default
:
default
:
{
let
map
=
new
Map
();
let
smallMat
=
[];
let
newsmallMat
=
[];
let
p
=
0
;
let
newsmallMat
=
[];
let
p
=
0
;
let
deps
=
[];
let
units
=
[];
let
expenses
=
[];
...
...
@@ -1319,7 +1257,7 @@
let
unit
=
data
[
i
][
sysRulez
[
2
].
ce
].
m
;
let
expense
=
data
[
i
][
sysRulez
[
3
].
ce
].
m
;
smallMat
.
push
(
num
);
newsmallMat
.
push
({
'
index
'
:
p
,
'
code
'
:
num
});
newsmallMat
.
push
({
'
index
'
:
p
,
'
code
'
:
num
});
p
++
;
deps
.
push
(
dep
);
units
.
push
(
unit
);
...
...
@@ -1331,23 +1269,24 @@
expenses
.
push
(
null
);
}
}
}
catch
(
err
){
throw
new
Error
(
"
导入失败,导入文件与模板规则不匹
"
);
}
catch
(
err
)
{
//throw new Error("导入失败,导入文件与模板规则不匹");
}
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
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
}
listSuppliesexpense
(
this
.
mining
).
then
(
response
=>
{
//const startTime1 = new Date().getTime();
listSuppliesexpense
(
this
.
mining
).
then
(
response
=>
{
if
(
response
.
length
>
0
)
{
let
matchedIndices
=
new
Array
(
expenses
.
length
).
fill
(
false
);
let
p
=
0
;
let
p
=
0
;
for
(
let
j
=
0
;
j
<
response
.
length
;
j
++
)
{
for
(
let
i
=
0
;
i
<
expenses
.
length
;
i
++
)
{
if
(
!
matchedIndices
[
i
]
&&
expenses
[
i
]
!==
null
)
{
...
...
@@ -1359,61 +1298,23 @@
}
}
}
/*// 记录结束时间
const endTime1 = new Date().getTime();
// 计算执行时间(以毫秒为单位)
const executionTime1 = endTime1 - startTime1;
// 输出执行时间
console.log(`费用转换执行时间:${executionTime1} 毫秒`);
console.log(p);*/
}
})
materialList
().
then
(
response
=>
{
const
startTime
=
new
Date
().
getTime
();
/*let SixMateriel=[];
let MaterielCode=[];
let NewMarterielCode=[];
let SixList=[];
let newSmasll =newsmallMat;
let m=0
SixMateriel=response.rows.slice(92,246);
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--;
}
}
}
}
for (let k = 0; k < newSmasll.length; k++) {
SixList[newSmasll[k].index]='11';
m++;
}
this.NewSixList=SixList*/
let
SixMateriel
=
[];
let
MaterielCode
=
[];
let
NewMarterielCode
=
[];
let
SixList
=
[];
let
newSmasll
=
smallMat
;
SixMateriel
=
response
.
rows
;
NewMarterielCode
=
sortArray
(
SixMateriel
)
let
SixMateriel
=
[];
let
MaterielCode
=
[];
let
NewMarterielCode
=
[];
let
SixList
=
[];
let
newSmasll
=
smallMat
;
SixMateriel
=
response
.
rows
;
NewMarterielCode
=
sortArray
(
SixMateriel
)
const
startTime1
=
new
Date
().
getTime
();
try
{
// //转化编码
let
p
=
0
;
for
(
var
i
=
0
;
i
<
newSmasll
.
length
;
i
++
)
{
let
p
=
0
;
for
(
var
i
=
0
;
i
<
newSmasll
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
NewMarterielCode
.
length
;
j
++
)
{
if
(
newSmasll
[
i
]
!==
null
)
{
if
(
newSmasll
[
i
]
!==
null
)
{
if
(
NewMarterielCode
[
j
]
&&
NewMarterielCode
[
j
].
code
&&
newSmasll
[
i
].
slice
(
0
,
NewMarterielCode
[
j
].
code
.
length
)
==
NewMarterielCode
[
j
].
code
)
{
SixList
[
i
]
=
NewMarterielCode
[
j
].
codes
;
p
++
;
...
...
@@ -1427,21 +1328,21 @@
}
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
//throw new Error("导入失败,转换编码运行错误,请检查对应规则");
}
const
endTime1
=
new
Date
().
getTime
();
var
warn1
=
0
,
warn2
=
0
;
var
warn1
=
0
,
warn2
=
0
;
const
startTime2
=
new
Date
().
getTime
();
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
,
k
=
0
;
i
<
data
.
length
;
i
++
,
k
++
)
{
let
values
=
[];
if
(
data
[
i
][
key_i
]
&&
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
try
{
if
(
data
[
i
][
value
[
j
]]
&&
data
[
i
][
value
[
j
]]
!=
null
)
{
if
(
data
[
i
][
value
[
j
]]
&&
data
[
i
][
value
[
j
]]
!=
null
)
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
values
.
push
(
a
);
//values['10','20.69']
}
else
{
}
else
{
warn1
++
;
}
}
catch
(
err
)
{
...
...
@@ -1453,20 +1354,17 @@
}
}
if
(
SixList
[
k
]
==
undefined
)
{
if
(
SixList
[
k
]
==
undefined
)
{
// warn1++; //如果为空,统计为undefined
}
else
{
if
(
deps
[
k
]
==
undefined
)
{
}
else
{
if
(
deps
[
k
]
==
undefined
)
{
warn2
++
;
}
else
{
let
key
=
SixList
[
k
]
+
'
/
'
+
deps
[
k
]
+
'
/
'
+
units
[
k
]
+
'
/
'
+
expenses
[
k
];
}
else
{
let
key
=
SixList
[
k
]
+
'
/
'
+
deps
[
k
]
+
'
/
'
+
units
[
k
]
+
'
/
'
+
expenses
[
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));
}*/
let
money
=
values
[
0
]
*
values
[
1
];
let
money
=
values
[
0
]
*
values
[
1
];
values
[
0
]
=
parseFloat
(
parseFloat
(
values
[
0
]
+
oldValues
[
0
]).
toFixed
(
2
));
values
[
1
]
=
parseFloat
(
parseFloat
(
money
+
oldValues
[
1
]).
toFixed
(
2
));
...
...
@@ -1483,10 +1381,6 @@
if
(
map
.
size
===
0
)
{
throw
new
Error
(
"
导入失败,导入文件错误
"
);
}
//返回单元格第二行的数据
//let celn=luckysheet.getcellvalue(1);
//返回当前工作表第1列数据
//let cown=luckysheet.getcellvalue(null,0);
let
config
;
let
bord
=
{
"
rangeType
"
:
"
range
"
,
...
...
@@ -1502,18 +1396,18 @@
const
startTime3
=
new
Date
().
getTime
();
map
.
forEach
((
value
,
key
)
=>
{
let
rowws
;
const
suffixArr
=
key
.
split
(
'
/
'
),
mat
=
suffixArr
[
0
],
depp
=
suffixArr
[
1
],
unitt
=
suffixArr
[
2
],
expensee
=
suffixArr
[
3
];
const
suffixArr
=
key
.
split
(
'
/
'
),
mat
=
suffixArr
[
0
],
depp
=
suffixArr
[
1
],
unitt
=
suffixArr
[
2
],
expensee
=
suffixArr
[
3
];
//返回当前工作表第1列数据
let
cown
=
luckysheet
.
getcellvalue
(
null
,
0
);
for
(
let
i
=
0
;
i
<
cown
.
length
;
i
++
)
{
if
(
cown
[
i
]
==
null
)
{
let
cown
=
luckysheet
.
getcellvalue
(
null
,
0
);
for
(
let
i
=
0
;
i
<
cown
.
length
;
i
++
)
{
if
(
cown
[
i
]
==
null
)
{
continue
;
}
if
(
cown
[
i
].
v
==
undefined
)
{
if
(
cown
[
i
].
v
==
undefined
)
{
continue
;
}
if
(
cown
[
i
].
v
==
mat
)
{
rowws
=
i
;
if
(
cown
[
i
].
v
==
mat
)
{
rowws
=
i
;
break
;
}
}
...
...
@@ -1539,16 +1433,9 @@
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRulez
[
3
].
ct
,
expensee
);
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
+
1
,
parseInt
(
sysRules
[
0
].
ct
)
+
1
,
Math
.
abs
(
value
[
1
]
/
value
[
0
])
);
//修改单价样式
/*luckysheet.setCellValue(rowws+g,parseInt(sysRules[0].ct)+1,{
"ct": {
...
...
@@ -1558,18 +1445,18 @@
});*/
config
=
luckysheet
.
getConfig
(
0
);
bord
.
range
[
0
].
row
=
[
rowws
+
1
,
rowws
+
1
];
bord
.
range
[
0
].
column
=
[
0
,
parseInt
(
sysRules
[
sysRules
.
length
-
1
].
ct
)
+
1
];
bord
.
range
[
0
].
column
=
[
0
,
parseInt
(
sysRules
[
sysRules
.
length
-
1
].
ct
)
+
1
];
config
.
borderInfo
.
push
(
bord
);
luckysheet
.
setConfig
(
config
);
modify
=
true
;
}
else
{
}
else
{
warn
++
;
}
});
const
endTime3
=
new
Date
().
getTime
();
if
(
warn
===
map
.
size
)
{
throw
new
Error
(
"
导入文件与所选模板规则不匹配
"
);
}
else
if
(
warn
>
0
)
{
}
else
if
(
warn
>
0
)
{
this
.
$message
({
message
:
"
还有
"
+
warn
+
"
条大类没匹配到,请仔细检查导入表
"
,
type
:
"
warning
"
...
...
@@ -1581,7 +1468,7 @@
message
:
"
有
"
+
warn1
+
"
条数据的编码不存在和
"
+
warn2
+
"
条数据的部门不存在,请仔细检查导入表
"
,
type
:
"
warning
"
});
}
else
{
}
else
{
this
.
$message
({
message
:
"
有
"
+
warn1
+
"
条数据的编码不存在,请仔细检查导入表
"
,
type
:
"
warning
"
...
...
@@ -1599,7 +1486,7 @@
const
executionTime
=
endTime
-
startTime
;
const
executionTime1
=
endTime1
-
startTime1
;
const
executionTime2
=
endTime2
-
startTime2
;
const
executionTime3
=
endTime3
-
startTime3
;
const
executionTime3
=
endTime3
-
startTime3
;
// 输出执行时间
console
.
log
(
`代码执行时间:
${
executionTime
}
毫秒`
);
console
.
log
(
`转换编码执行时间:
${
executionTime1
}
毫秒`
);
...
...
@@ -1607,11 +1494,6 @@
console
.
log
(
`页面渲染执行时间:
${
executionTime3
}
毫秒`
);
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
=>
{
//必须加,不能删除
...
...
@@ -1647,7 +1529,6 @@
this
.
from
.
templateId
=
this
.
dfrom
.
templateId
=
tempId
;
this
.
from
.
importUuid
=
this
.
dfrom
.
importUuid
=
uuid1
;
this
.
from
.
roleId
=
this
.
dfrom
.
roleId
=
roleId
;
this
.
dfrom
.
historyName
=
name
+
'
(导入文件)
'
;
this
.
dfrom
.
historyContent
=
str
;
this
.
dfrom
.
identifyingCode
=
0
;
...
...
@@ -1668,40 +1549,8 @@
this
.
from
.
tylkStatus
=
1
;
this
.
from
.
mining
=
this
.
mining
list
.
push
(
this
.
from
);
/*let data = contents.sheets[0].celldata
let newArray = []
outerLoop: for (let row = 0; row < data.length; row++) {
if (data[row].v.v !== null && 'v' in data[row]) {
if (typeof data[row].v.v === 'number') {
newArray = newArray.filter(item => item.row !== data[row].r); // 删除row相等的数据
break outerLoop; // 停止整个循环
} else {
newArray.push({ "row": data[row].r, "column": data[row].c, "value": data[row].v.v, "desc": `a${newArray.length + 1}` });
}
}
}
for (let i = 0; i < newArray.length; i++) {
if (newArray[i].row > 1) {
const currentRow = newArray[i].row;
const column = newArray[i].column;
const value = newArray[i].value;
let j = i - 1;
while (j >= 0 && newArray[j].row === currentRow - 1) {
if (newArray[j].column === column) {
newArray[j].value += value;
newArray.splice(i, 1);
i--;
break;
}
j--;
}
}
}
let updatedArray = JSON.stringify(newArray.map(obj => ({ value: obj.value, desc: obj.desc })));*/
addInsert
(
list
).
then
(
response
=>
{
if
(
response
.
code
==
200
){
addInsert
(
list
).
then
(
response
=>
{
if
(
response
.
code
==
200
)
{
this
.
$message
({
message
:
'
保存成功
'
,
type
:
'
success
'
})
...
...
@@ -1761,15 +1610,14 @@
addInsert2
(
list1
).
then
(
response
=>
{
});
});
},
500
),
// 设置延迟时间,单位为毫秒
}
// 配置项111
};
// debounce函数定义
function
debounce
(
func
,
delay
)
{
};
// debounce函数定义
function
debounce
(
func
,
delay
)
{
let
timer
;
return
function
()
{
const
context
=
this
;
...
...
@@ -1779,8 +1627,8 @@
func
.
apply
(
context
,
args
);
},
delay
);
};
}
function
getKeyByValue
(
map
,
value
)
{
}
function
getKeyByValue
(
map
,
value
)
{
for
(
let
[
key
,
val
]
of
map
)
{
if
(
val
===
value
)
{
return
key
;
...
...
@@ -1789,15 +1637,15 @@
return
key
;
}
}
}
function
generateUUID
()
{
}
function
generateUUID
()
{
let
array
=
new
Uint32Array
(
4
);
window
.
crypto
.
getRandomValues
(
array
);
return
array
.
join
(
"
-
"
);
}
}
</
script
>
<
style
>
.mask
{
.mask
{
position
:
fixed
;
top
:
0
;
left
:
0
;
...
...
@@ -1807,9 +1655,9 @@
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
}
.loading-spinner
{
.loading-spinner
{
/* 添加你的加载动画样式 */
width
:
40px
;
height
:
40px
;
...
...
@@ -1817,9 +1665,9 @@
border
:
4px
solid
#f3f3f3
;
border-top
:
4px
solid
#3498db
;
animation
:
spin
1s
linear
infinite
;
}
}
@keyframes
spin
{
@keyframes
spin
{
0
%
{
transform
:
rotate
(
0deg
);
}
...
...
@@ -1827,5 +1675,5 @@
100
%
{
transform
:
rotate
(
360deg
);
}
}
}
</
style
>
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/supplies/index_template.vue
View file @
acae3d48
...
...
@@ -330,6 +330,7 @@ export default {
name
:
"
SuppliesTemplate
"
,
data
()
{
return
{
uploading
:
''
,
selectedOption
:
''
,
positionValue
:
'
static
'
,
fileList
:
[{
...
...
@@ -444,9 +445,9 @@ export default {
/**上传事件 */
async
beforeUpload
(
file
)
{
console
.
log
(
file
)
//存在重复
findName
(
file
.
name
).
then
(
result
=>
{
console
.
log
(
result
.
data
)
if
(
result
.
data
===
"
存在重复
"
)
{
this
.
fileListName
=
[];
...
...
@@ -462,6 +463,7 @@ export default {
}
this
.
uploading
=
true
;
await
LuckyExcel
.
transformExcelToLucky
(
file
,
(
exportJson
,
lucksheetfile
)
=>
{
console
.
log
(
exportJson
,
lucksheetfile
)
this
.
form
.
templateName
=
file
.
name
;
this
.
form
.
templateContent
=
JSON
.
stringify
(
exportJson
.
sheets
);
});
...
...
@@ -555,7 +557,7 @@ export default {
if
(
row
.
status
===
1
)
{
this
.
title
=
"
修改导入规则
"
;
this
.
selectedOption
=
''
;
this
.
forms
=
''
;
this
.
forms
=
{}
;
this
.
instea
=
''
;
const
id
=
row
.
id
||
this
.
ids
listSuppliesrole
(
id
).
then
(
response
=>
{
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/supplies/index_vue.vue
View file @
acae3d48
...
...
@@ -9,6 +9,13 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"清洗规则"
prop=
"roleid"
>
<el-select
v-model=
"selectedRule"
ref=
"mySelect"
size=
"mini"
@
change=
"handleRuleChange"
filterable
placeholder=
"请选择您要查看的规则"
>
<el-option
v-for=
"iem in luckyrule"
:key=
"iem.id"
:label=
"iem.roleName"
:value=
"iem.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"时间"
prop=
"date"
>
<el-date-picker
@
change=
"handledateChange"
v-model=
"date"
type=
"month"
placeholder=
"选择月"
>
</el-date-picker>
...
...
@@ -37,7 +44,21 @@
<el-button
:plain=
"true"
style=
"display: none;"
@
click=
"open4"
>
错误
</el-button>
</el-col>
<el-button
plain
size=
"mini"
type=
"primary"
@
click=
"dialogTableVisible = true"
>
查看
</el-button>
</el-row>
<el-dialog
title=
"详细信息"
:visible.sync=
"dialogTableVisible"
>
<el-table
:data=
"detail"
>
<el-table-column
property=
"v.name"
label=
"行"
></el-table-column>
<el-table-column
property=
"v.material"
label=
"列"
></el-table-column>
<el-table-column
property=
"v.v"
label=
"金额"
></el-table-column>
<el-table-column
label=
"合并的行"
>
<template
slot-scope=
"scope"
>
{{
scope
.
row
.
index
.
map
(
index
=>
index
+
1
).
join
(
'
,
'
)
}}
</
template
>
</el-table-column>
</el-table>
</el-dialog>
<!-- luckysheet容器 -->
<div
id=
"luckysheet"
style=
"margin: 0px; padding: 0px; position: absolute; width: 100%; height:80vh; z-index: 0"
>
</div>
...
...
@@ -50,28 +71,38 @@
<
script
>
import
{
selectActSuppliesHistorydata
}
from
"
@/api/Actsupplies/cleaning_rule
"
;
import
{
getSuppliesTemplate
,
listSuppliesTemplate
,
roleList
,
materialConvert
,
materialListPZ
,
accountingcode
,
department
,
roleListid
,
materialList
}
from
"
@/api/ruoyi-myLuckyexcel/myluckyexcel
"
;
import
{
addInsert
,
addInsert1
,
addInsert2
,
addInsertAccount1
,
addInsertAccount2
}
from
"
@/api/system/historydata
"
/*import luckysheet from 'luckysheet'*/
import
LuckyExcel
from
'
luckyexcel
'
//导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!
/*import {materialList} from "@/api/ruoyi-myLuckyexcel/myluckyexcel";*/
import
{
exportExcel
}
from
'
../../../../public/exportExcel
'
;
import
{
v4
as
uuidv4
}
from
'
uuid
'
;
import
{
getInfo
}
from
"
@/api/login
"
;
import
{
listSuppliesexpense
}
from
"
../../../api/ActClassification/ActClassification
"
;
var
fileName
=
"
新建XLSX工作表
"
;
//定义表名
var
rule
=
[];
var
tempId
;
var
roleId
;
var
uuid1
;
var
trueORfalse
=
false
;
var
modify
=
false
;
export
default
{
import
{
selectActSuppliesHistorydata
,
selectActSuppliesHistorydataAcc
}
from
"
@/api/Actsupplies/cleaning_rule
"
;
import
{
getSuppliesTemplate
,
listSuppliesTemplate
,
roleList
,
materialConvert
,
materialListPZ
,
accountingcode
,
department
,
roleListid
,
materialList
}
from
"
@/api/ruoyi-myLuckyexcel/myluckyexcel
"
;
import
{
addInsert
,
addInsert1
,
addInsert2
,
addInsertAccount1
,
addInsertAccount2
}
from
"
@/api/system/historydata
"
/*import luckysheet from 'luckysheet'*/
import
LuckyExcel
from
'
luckyexcel
'
//导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!
/*import {materialList} from "@/api/ruoyi-myLuckyexcel/myluckyexcel";*/
import
{
exportExcel
}
from
'
../../../../public/exportExcel
'
;
import
{
v4
as
uuidv4
}
from
'
uuid
'
;
import
{
getInfo
}
from
"
@/api/login
"
;
import
{
listSuppliesexpense
}
from
"
../../../api/ActClassification/ActClassification
"
;
var
fileName
=
"
新建XLSX工作表
"
;
//定义表名
var
rule
=
[];
var
tempId
;
var
roleId
;
var
uuid1
;
var
trueORfalse
=
false
;
var
modify
=
false
;
export
default
{
name
:
"
Mymodule
"
,
data
()
{
return
{
//详细信息
dialogTableVisible
:
false
,
//清洗规则名字
selectname
:
''
,
//详情页
detail
:
[],
//kuang
mine
:
''
,
num
:
1
,
nums
:
1
,
value
:
''
,
VoucherForm
:
''
,
miningValue
:
[
...
...
@@ -85,8 +116,19 @@
name
:
'
唐山矿
'
,
id
:
'
010101
'
},
{
name
:
'
东欢坨矿
'
,
id
:
'
010102
'
},
{
name
:
'
单侯矿
'
,
id
:
'
011204
'
}
],
Cleaningrole
:
''
,
phone
:
''
,
classify
:
''
,
userName
:
''
,
//选择的矿区
select
:
''
,
...
...
@@ -96,16 +138,20 @@
jsondata
:
''
,
//编码数据
codess
:
''
,
luckyrule
:
[],
showMask
:
false
,
//选中的表的数据
selected
:
''
,
uuid
:
''
,
//弹出页面的表名
from_name
:
""
,
//单侯煤矿的成本表
newArray
:
''
,
//往后台穿的导入表的东西
ImportTables
:
{},
//往后台传生成表的数据
generate
:
{},
cleaning
:
''
,
// 是否显示弹出层
dialogVisible
:
false
,
selectedOption
:
''
,
...
...
@@ -151,9 +197,6 @@
this
.
init
();
fileName
=
"
新建XLSX工作表
"
;
this
.
list
()
},
computed
:
{
},
methods
:
{
//查询材料编码
...
...
@@ -161,6 +204,9 @@
materialListPZ
().
then
(
response
=>
{
this
.
codess
=
response
.
rows
})
//查用户名称
getInfo
().
then
(
response
=>
{
...
...
@@ -180,19 +226,51 @@
//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
);
})
},
//手机号
open
(
evt
)
{
this
.
$prompt
(
'
请输入用友系统的用户名
'
,
'
提示
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
inputPattern
:
/^
(?:\+?
86
)?
1
[
3-9
]\d{9}
$/
,
inputErrorMessage
:
'
手机号格式不正确
'
}).
then
(({
value
})
=>
{
this
.
$message
({
type
:
'
success
'
,
message
:
'
你的用户名是:
'
+
value
});
this
.
phone
=
value
this
.
zhuan
(
evt
)
}).
catch
(()
=>
{
this
.
$message
({
type
:
'
info
'
,
message
:
'
取消输入
'
});
this
.
showMask
=
false
});
},
/** 判断是否选择时间*/
rulesdate
()
{
const
minvalue
=
this
.
miningValue
.
find
(
obj
=>
obj
.
id
===
this
.
mining
)
const
Luckysheetlabel
=
this
.
luckyrule
.
find
(
obj
=>
obj
.
id
===
this
.
selectedRule
);
if
(
this
.
date
==
''
||
this
.
date
==
null
)
{
this
.
disableNextButton
=
true
;
this
.
$message
.
error
(
'
请选择时间日期!
'
);
}
else
if
(
this
.
mining
==
''
||
this
.
mining
==
null
)
{
this
.
disableNextButton
=
true
;
this
.
$message
.
error
(
'
请选择所属矿区!
'
);
}
else
if
(
this
.
cleaning
==
''
)
{
this
.
disableNextButton
=
true
;
this
.
$message
.
error
(
'
请选则清洗规则!
'
);
}
},
handledateChange
(
value
)
{
...
...
@@ -214,9 +292,14 @@
}
},
handleminingChange
(
value
)
{
this
.
select
=
value
department
(
value
).
then
(
response
=>
{
this
.
classify
=
response
})
const
selectedItem
=
this
.
miningValue
.
find
(
item
=>
item
.
id
===
value
);
if
(
selectedItem
)
{
this
.
mine
=
selectedItem
.
name
}
this
.
select
=
value
if
(
this
.
date
==
''
||
this
.
date
==
null
||
this
.
date
==
undefined
)
{
this
.
disableNextButton
=
true
;
}
else
{
...
...
@@ -255,7 +338,8 @@
//将接收到的json存到json_data中
//const json_data = response.data;
var
json_data
=
JSON
.
parse
(
sysSupplies
[
0
].
templateContent
);
roleList
(
this
.
selectedOption
).
then
(
response
=>
{
roleList
(
value
).
then
(
response
=>
{
this
.
luckyrule
=
response
.
rows
;
});
let
suffixArr
=
sysSupplies
[
0
].
templateName
.
split
(
'
.
'
);
fileName
=
suffixArr
[
0
];
...
...
@@ -276,7 +360,12 @@
this
.
$message
.
error
(
'
找不到部门名称或者结算金额和材料编码列,请改为正确名称
'
);
},
/** 规则下拉选 调佣后端的方法*/
handleRuleChange
()
{
handleRuleChange
(
value
)
{
const
selectedItem
=
this
.
luckyrule
.
find
(
item
=>
item
.
id
===
value
);
if
(
selectedItem
)
{
this
.
selectname
=
selectedItem
.
roleName
}
if
(
this
.
selectedOption
===
''
)
{
this
.
selectedRule
=
''
;
this
.
$message
.
warning
(
"
选择规则前请先选择模板!
"
);
...
...
@@ -287,17 +376,26 @@
roleListid
(
this
.
selectedRule
).
then
(
response
=>
{
roleId
=
this
.
selectedRule
;
rule
=
response
.
rows
;
//清洗规则
this
.
cleaning
=
JSON
.
parse
(
response
.
rows
[
0
].
detailContent
)
this
.
ImportTables
.
convenRole
=
response
.
rows
[
0
].
detailContent
});
if
(
tempId
===
7
||
tempId
===
10
)
{
getSuppliesTemplate
(
tempId
).
then
(
response
=>
{
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
// 通过遍历this.luckyrule找到对应的iem.roleName
for
(
let
i
=
0
;
i
<
this
.
luckyrule
.
length
;
i
++
)
{
if
(
this
.
luckyrule
[
i
].
id
===
this
.
selectedRule
)
{
let
name
=
this
.
luckyrule
[
i
].
roleName
;
fileName
=
name
.
slice
(
0
,
-
2
);
break
;
}
}
modify
=
false
;
const
sysSupplies
=
response
.
rows
;
this
.
luckysheetData
=
sysSupplies
[
0
].
templateContent
;
let
json_data
=
JSON
.
parse
(
sysSupplies
[
0
].
templateContent
);
//luckysheet.destroy()
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
fileName
,
// Excel 文件名
...
...
@@ -320,6 +418,8 @@
fileName
=
"
新建XLSX工作表
"
;
this
.
selectedOption
=
''
;
this
.
disableNextButton
=
''
;
this
.
luckyrule
=
[];
this
.
selectedRule
=
''
;
trueORfalse
=
false
;
modify
=
false
;
...
...
@@ -395,7 +495,7 @@
lang
:
'
zh
'
,
});
modify
=
false
;
this
.
zhua
n
(
evt
)
this
.
ope
n
(
evt
)
}).
then
(
async
()
=>
{
...
...
@@ -407,11 +507,11 @@
this
.
$message
({
type
:
'
info
'
,
message
:
'
操作已取消
'
});
});
}
else
{
this
.
zhua
n
(
evt
)
this
.
ope
n
(
evt
)
this
.
showMask
=
true
;
LuckyExcel
(
evt
,
exportJson
=>
{
//获取导入表格所有数据exportJson
this
.
zhua
n
(
exportJson
)
this
.
ope
n
(
exportJson
)
// this.summary(exportJson)
.
then
(
async
()
=>
{
...
...
@@ -433,9 +533,8 @@
}
},
//转换方法 cc是导入表数据
// 唐山矿转入方法
zhuan
(
file
)
{
let
cc
=
''
;
const
transformPromise
=
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -443,52 +542,70 @@
resolve
(
lucksheetfile
);
});
});
transformPromise
.
then
((
result
)
=>
{
let
resultJSON
=
JSON
.
stringify
(
result
.
sheets
)
cc
=
result
;
this
.
ImportTables
.
historyName
=
result
.
info
.
name
+
'
(导入表名)
'
let
codess
=
this
.
codess
let
he
=
this
.
jsondata
let
classify
=
{
"
基本生产-原煤
"
:
"
一掘区,二掘区,综一区,综二区,巷修区,皮带区,开运区,准备区,钻探区,开拓区
"
,
"
基本生产-洗煤
"
:
"
洗煤厂
"
,
"
制造费用-原煤
"
:
"
机电科,机电设备中心,井运区,救护队,通风区,煤类管理科,物资管理科,通讯管理科,地质测量科,迁建管理科
"
,
"
管理费用-
"
:
"
经营管理部
"
,
"
销售费用-
"
:
"
煤类产品管理检测科
"
,
"
其他业务成本-厂区服务
"
:
"
后勤服务一科,后勤二科理部
"
,
"
其他应付款-
"
:
"
金属厂
"
let
classify
=
{}
this
.
classify
.
forEach
(
item
=>
{
if
(
item
.
nameType
)
{
if
(
classify
[
item
.
nameType
])
{
classify
[
item
.
nameType
]
+=
`,
${
item
.
name
}
`
;
}
else
{
classify
[
item
.
nameType
]
=
item
.
name
;
}
}
});
let
c
=
cc
.
sheets
[
0
].
celldata
//部门名称所在列
let
DepartmentColumns
=
c
.
flat
().
filter
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
===
"
部门名称
"
)[
0
]?.
c
;
//结算金额所在列
let
ExpenseColumn
=
c
.
flat
().
filter
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
===
"
结算金额
"
)[
0
]?.
c
;
//材料编码
let
code
=
c
.
flat
().
filter
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
===
"
材料编码
"
)[
0
]?.
c
if
(
code
&&
ExpenseColumn
&&
DepartmentColumns
)
{
let
Colums
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
DepartmentColumns
)
let
Column
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
ExpenseColumn
)
let
codecolumn
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
code
)
//表头所在行
let
headRow
=
this
.
cleaning
[
0
].
HeaderRow
-
1
//部门名称列
let
DepartmentColumns
=
this
.
cleaning
[
0
].
DepartmentColumn
-
1
let
Department
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
DepartmentColumns
&&
obj
.
r
>
headRow
)
//编码所在列
let
codecolumn
=
this
.
cleaning
[
0
].
CodeColumn
-
1
let
code
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
codecolumn
&&
obj
.
r
>
headRow
)
//林西的类别名称
let
names
=
c
.
flat
().
filter
(
obj
=>
obj
.
v
&&
(
obj
.
v
.
v
===
"
类别名称
"
||
obj
.
v
.
v
===
"
收发类别
"
))[
0
]?.
c
;
let
name
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
names
&&
obj
.
r
>
headRow
)
//数量所在列
let
numbercolumn
=
this
.
cleaning
[
0
].
NumberColumn
-
1
let
number
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
numbercolumn
&&
obj
.
r
>
headRow
)
//单价所在列
let
MoneyColumn
=
this
.
cleaning
[
0
].
MoneyColumn
-
1
let
moneys
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
MoneyColumn
&&
obj
.
r
>
headRow
)
//算总额
let
money
=
[]
number
.
forEach
((
n
,
index
)
=>
{
if
(
n
.
r
===
moneys
[
index
].
r
)
{
moneys
[
index
].
v
.
v
=
(
moneys
[
index
].
v
.
v
*
n
.
v
.
v
).
toFixed
(
2
)
money
.
push
(
moneys
[
index
])
}
})
// 唐山矿转换方法
//没任何规则
if
(
this
.
mine
.
includes
(
'
唐山
'
)
&&
this
.
selectname
.
includes
(
'
唐山
'
))
{
if
(
code
&&
money
&&
Department
)
{
let
aa
=
[]
//把这三个数组push到aa里
aa
.
unshift
(
Column
);
aa
.
unshift
(
code
column
);
aa
.
unshift
(
Colums
);
aa
.
unshift
(
money
);
aa
.
unshift
(
code
);
aa
.
unshift
(
Department
);
//跟材料表的数据对比 如果编码一样 则把导入表的列数换成模板的列数
for
(
let
i
=
0
;
i
<
codess
.
length
;
i
++
)
{
let
codeLength
=
String
(
c
odess
[
i
]
.
code
).
length
;
let
codeToCompare
=
String
(
c
odess
[
i
]
.
code
).
substring
(
0
,
codeLength
);
for
(
let
ii
=
0
;
ii
<
aa
[
1
].
length
;
ii
++
)
{
let
columnIdString
=
String
(
aa
[
1
][
ii
]
.
v
.
v
);
codess
.
forEach
(
c
=>
{
let
codeLength
=
String
(
c
.
code
).
length
;
let
codeToCompare
=
String
(
c
.
code
).
substring
(
0
,
codeLength
);
aa
[
1
].
forEach
(
column
=>
{
let
columnIdString
=
String
(
column
.
v
.
v
);
let
idToMatch
=
columnIdString
.
substring
(
0
,
codeLength
);
if
(
idToMatch
===
codeToCompare
)
{
aa
[
1
][
ii
].
ccc
=
codess
[
i
].
oneLevel
*
1
}
column
.
ccc
=
c
.
oneLevel
*
1
;
}
}
});
});
//按照部门划分,去找到他所在科室分类
aa
=
aa
.
map
(
subArr
=>
{
...
...
@@ -502,55 +619,48 @@
obj
.
whether
=
true
return
obj
;
}
else
{
obj
.
whether
=
false
}
}
obj
.
whether
=
false
return
obj
;
});
});
for
(
let
i
=
0
;
i
<
aa
[
2
].
length
;
i
++
)
{
aa
[
2
].
forEach
((
item
,
i
)
=>
{
if
(
'
name
'
in
aa
[
0
][
i
].
v
)
{
aa
[
2
][
i
].
v
.
name
=
aa
[
0
][
i
].
v
.
name
}
item
.
v
.
name
=
aa
[
0
][
i
].
v
.
name
;
}
});
//直接luck表格初始化 替换数据
//找到所在的行数,按照 -的前后去找,前面是标题,后面是标题后的小分类,如选煤,洗煤等
he
[
0
].
data
=
luckysheet
.
transToData
(
he
[
0
][
"
celldata
"
])
for
(
let
i
=
0
;
i
<
aa
[
0
].
length
;
i
++
)
{
if
(
aa
[
0
][
i
].
v
.
m
!==
undefined
)
{
let
index
=
aa
[
0
][
i
].
v
.
m
.
indexOf
(
"
-
"
);
aa
[
0
].
forEach
((
item
)
=>
{
if
(
item
.
v
.
m
!==
undefined
)
{
let
index
=
item
.
v
.
m
.
indexOf
(
"
-
"
);
if
(
index
!==
-
1
)
{
let
substrBeforeDash
=
aa
[
0
][
i
].
v
.
m
.
slice
(
0
,
index
);
let
DepartColumns
=
he
[
0
][
"
celldata
"
].
flat
().
filter
(
obj
=>
{
if
(
obj
.
v
&&
obj
.
v
.
v
&&
typeof
obj
.
v
.
v
===
'
string
'
)
{
return
obj
.
v
.
v
.
includes
(
aa
[
0
][
i
].
v
.
m
.
slice
(
0
,
index
));
}
return
false
;
})[
0
];
let
substrBeforeDash
=
item
.
v
.
m
.
slice
(
0
,
index
);
let
DepartColumns
=
he
[
0
][
"
celldata
"
].
flat
().
find
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
&&
typeof
obj
.
v
.
v
===
'
string
'
&&
obj
.
v
.
v
.
includes
(
item
.
v
.
m
.
slice
(
0
,
index
))
);
if
(
DepartColumns
&&
DepartColumns
.
r
)
{
let
index
=
aa
[
0
][
i
]
.
v
.
m
.
indexOf
(
"
-
"
)
let
index
=
item
.
v
.
m
.
indexOf
(
"
-
"
)
if
(
index
!==
-
1
)
{
let
substrAfterDash
=
aa
[
0
][
i
].
v
.
m
.
slice
(
index
+
1
);
// 获取 "-" 后半段的值
let
substrAfterDash
=
item
.
v
.
m
.
slice
(
index
+
1
);
switch
(
substrAfterDash
)
{
case
''
:
aa
[
0
][
i
]
.
r
=
DepartColumns
.
r
;
item
.
r
=
DepartColumns
.
r
;
break
;
case
'
原煤
'
:
aa
[
0
][
i
]
.
r
=
DepartColumns
.
r
+
1
;
item
.
r
=
DepartColumns
.
r
+
1
;
break
;
case
'
洗煤
'
:
aa
[
0
][
i
]
.
r
=
DepartColumns
.
r
+
2
;
item
.
r
=
DepartColumns
.
r
+
2
;
break
;
case
'
选煤
'
:
aa
[
0
][
i
]
.
r
=
DepartColumns
.
r
+
3
;
item
.
r
=
DepartColumns
.
r
+
3
;
break
;
case
'
厂区服务
'
:
aa
[
0
][
i
]
.
r
=
DepartColumns
.
r
+
1
;
item
.
r
=
DepartColumns
.
r
+
1
;
break
;
default
:
// 默认情况
...
...
@@ -559,49 +669,61 @@
}
}
}
}
}
);
//把原来分类找不到的放到其他数据类型中,最后一列其他列中
for
(
let
i
=
0
;
i
<
aa
[
1
].
length
;
i
++
)
{
if
(
aa
[
1
][
i
]
.
ccc
&&
aa
[
0
][
i
].
r
<
8
)
{
aa
[
1
][
i
].
c
=
aa
[
1
][
i
].
ccc
delete
aa
[
1
][
i
]
.
ccc
;
aa
[
1
].
forEach
((
item
,
i
)
=>
{
if
(
item
.
ccc
&&
aa
[
0
][
i
].
r
<
8
)
{
item
.
c
=
item
.
ccc
;
delete
item
.
ccc
;
}
else
{
aa
[
1
][
i
].
c
=
10
}
item
.
c
=
10
;
}
});
//金额列和行是原先导入表的行列 要替换掉模板表的行列
for
(
let
i
=
0
;
i
<
aa
[
0
].
length
;
i
++
)
{
if
(
aa
[
0
][
i
]
.
whether
)
{
aa
[
2
][
i
].
r
=
aa
[
0
][
i
].
r
aa
[
2
][
i
].
c
=
aa
[
1
][
i
].
c
aa
[
2
][
i
].
v
.
v
=
Number
(
aa
[
2
][
i
].
v
.
v
)
aa
[
0
].
forEach
((
item
,
i
)
=>
{
if
(
item
.
whether
)
{
aa
[
2
][
i
].
r
=
item
.
r
;
aa
[
2
][
i
].
c
=
aa
[
1
][
i
].
c
;
aa
[
2
][
i
].
v
.
v
=
Number
(
aa
[
2
][
i
].
v
.
v
)
;
}
else
{
aa
[
2
][
i
].
r
=
''
aa
[
2
][
i
].
c
=
''
}
aa
[
2
][
i
].
r
=
''
;
aa
[
2
][
i
].
c
=
''
;
}
});
//同一个单元格的数据 金额相加。
let
seen
=
new
Map
();
let
i
=
-
1
let
duplicateData
=
[];
let
seen
=
new
Map
();
// 根据行列信息合并重复数据并记录索引
for
(
let
obj
of
aa
[
2
])
{
i
+=
1
;
let
key
=
obj
.
r
+
'
,
'
+
obj
.
c
;
if
(
seen
.
has
(
key
))
{
let
existingObj
=
seen
.
get
(
key
);
existingObj
.
v
.
v
+=
obj
.
v
.
v
;
existingObj
.
v
.
m
=
(
parseInt
(
existingObj
.
v
.
m
)
+
parseInt
(
obj
.
v
.
m
)).
toString
();
existingObj
.
index
.
push
(
aa
[
1
][
i
].
r
);
}
else
{
obj
.
index
=
[
aa
[
1
][
i
].
r
];
seen
.
set
(
key
,
obj
);
}
}
// 将合并后的数据放入 duplicateData 数组
for
(
let
obj
of
seen
.
values
())
{
if
(
obj
.
v
.
v
>
0
||
parseInt
(
obj
.
v
.
m
)
>
0
)
{
duplicateData
.
push
(
obj
);
}
}
duplicateData
=
duplicateData
.
map
(
item
=>
{
return
{
...
item
,
v
:
{
...
item
.
v
,
v
:
isNaN
(
item
.
v
.
v
)
?
item
.
v
.
v
:
Number
(
item
.
v
.
v
).
toFixed
(
2
)
}
};
});
// 替换金额所在列和行相同的模板表中的数据
//金额所在列和行,去模板表中查找,如果行列一致则替换
for
(
let
i
=
0
;
i
<
duplicateData
.
length
;
i
++
)
{
// // 对比 c 和 r 是否与 he[0]["celldata"] 中相应对象相同
...
...
@@ -627,29 +749,8 @@
}
//this.from 往后台村的数据
this
.
ImportTables
.
historyName
=
result
.
info
.
name
+
'
(导入表名)
'
this
.
ImportTables
.
identifyingCode
=
0
;
this
.
ImportTables
.
date
=
this
.
date
this
.
ImportTables
.
exportUuid
=
1
;
this
.
ImportTables
.
historyContent
=
resultJSON
this
.
ImportTables
.
mining
=
this
.
select
this
.
ImportTables
.
tylkStatus
=
3
this
.
ImportTables
.
templateId
=
1257
this
.
generate
.
templateId
=
1257
this
.
generate
.
tylkStatus
=
3
this
.
generate
.
historyContent
=
JSON
.
stringify
(
he
)
this
.
generate
.
exportUuid
=
1
;
this
.
generate
.
identifyingCode
=
1
;
this
.
generate
.
date
=
this
.
date
this
.
generate
.
mining
=
this
.
select
let
list
=
[
this
.
ImportTables
,
this
.
generate
]
addInsert
(
list
).
then
(
response
=>
{
if
(
response
.
code
==
200
)
{
this
.
$message
({
message
:
'
保存成功
'
,
type
:
'
success
'
})
}
});
//往后台传科目编码相关的东西
duplicateData
.
forEach
(
obj
=>
{
he
[
0
].
celldata
.
forEach
(
cell
=>
{
...
...
@@ -664,171 +765,845 @@
this
.
open4
()
this
.
showMask
=
false
;
}
}
//林西矿转换方法
//机电制造费用现在是筛选出来了,。没有放到里面,如果想放进去也可以放进去,但是具体划分就不明细了
if
(
this
.
mine
.
includes
(
'
林西
'
)
&&
this
.
selectname
.
includes
(
'
林西
'
)
&&
name
)
{
//类别名称,部门名称,不含税金额,存货编码
if
(
name
&&
Department
&&
money
&&
code
)
{
let
nameColums
=
name
nameColums
=
nameColums
.
flat
().
filter
(
obj
=>
obj
.
v
.
hasOwnProperty
(
'
v
'
));
let
name1
=
Department
// code 编码 name1部门名称 money金额 name1 部门名称
// 清空属性
money
.
forEach
(
entry
=>
{
entry
.
department
=
''
;
entry
.
remark
=
''
;
entry
.
classify
=
''
;
entry
.
code
=
''
;
});
},
// 合并数组
let
aa
=
[...
name1
,
...
nameColums
,
...
code
];
//成本表往凭证但转
Vouchers
(
duplicateData
)
{
duplicateData
.
forEach
(
item
=>
{
item
.
v
.
v
=
Number
(
item
.
v
.
v
.
toFixed
(
2
));
item
.
v
.
m
=
parseFloat
(
item
.
v
.
m
).
toFixed
(
2
);
});
let
sum
=
[{
code
:
'
2241005
'
,
material
:
'
其他材料
'
,
v
:
0
},
{
code
:
'
1403002
'
,
material
:
"
火工品
"
,
v
:
0
,
// 匹配赋值
money
.
forEach
(
m
=>
{
aa
.
forEach
(
a
=>
{
if
(
m
.
r
===
a
.
r
)
{
if
(
a
.
c
===
DepartmentColumns
)
m
.
remark
=
a
.
v
.
v
||
a
.
v
.
m
;
if
(
a
.
c
===
names
)
m
.
classify
=
a
.
v
.
v
||
a
.
v
.
m
;
if
(
a
.
c
===
codecolumn
)
m
.
code
=
a
.
v
.
v
||
a
.
v
.
m
;
m
.
cc
=
''
;
}
];
});
});
for
(
let
i
=
0
;
i
<
duplicateData
.
length
;
i
++
)
{
if
(
duplicateData
[
i
].
v
.
material
===
"
火工品
"
)
{
sum
[
1
].
v
+=
duplicateData
[
i
].
v
.
v
;
}
else
{
sum
[
0
].
v
+=
duplicateData
[
i
].
v
.
v
;
}
}
var
VoucherForm
=
JSON
.
parse
(
this
.
VoucherForm
)
//表头所有数据
let
filteredData
=
VoucherForm
[
0
].
celldata
.
filter
(
obj
=>
obj
.
r
===
5
);
//我所需要的数据
let
need
=
[
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*手工码
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*会计主体
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*核算账簿
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*单据日期
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*凭证类型
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*制单人
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*分录摘要
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*币种
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
本币汇率类型
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*本币汇率
"
)[
0
].
c
,
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
*业务日期
"
)[
0
].
c
,
]
let
loan
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
原币贷方金额
"
)[
0
].
c
let
loan1
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
本币贷方金额
"
)[
0
].
c
let
money
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
原币借方金额
"
)[
0
].
c
let
money1
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
本币借方金额
"
)[
0
].
c
let
foundObjects
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
物料基本分类
"
);
let
Classification
;
let
oldClassification
;
if
(
foundObjects
.
length
>=
2
)
{
oldClassification
=
foundObjects
[
0
].
c
Classification
=
foundObjects
[
1
].
c
;
}
else
{
// 处理找不到两个满足条件的对象的情况
// 删除指定分类
const
filteredClassifications
=
[
"
研发费用
"
,
"
基金
"
,
"
安全费用
"
];
money
=
money
.
filter
(
item
=>
!
filteredClassifications
.
includes
(
item
.
classify
));
// 替换属性值
money
.
forEach
(
item
=>
{
if
(
item
.
head
===
"
坑木
"
)
item
.
head
=
"
木材
"
;
if
(
!
item
.
remark
)
item
.
v
.
name
=
"
基本生产-原煤
"
;
});
// 提取特定属性值相同的数据
const
Electromechanical
=
"
机电制造分公司
"
;
const
filteredMoney
=
money
.
filter
(
item
=>
{
if
(
item
.
remark
===
Electromechanical
)
{
money
.
splice
(
money
.
indexOf
(
item
),
1
);
return
true
;
}
//往后台传部门之类的 回收到编码
duplicateData
.
forEach
((
obj
)
=>
{
obj
.
mining
=
this
.
select
;
return
false
;
});
const
newData
=
duplicateData
.
map
(
obj
=>
{
const
[
name
,
department
]
=
obj
.
v
.
name
.
split
(
"
-
"
);
return
{
r
:
obj
.
r
,
c
:
obj
.
c
,
name
,
department
,
material
:
obj
.
v
.
material
,
mining
:
obj
.
mining
};
console
.
log
(
filteredMoney
)
// 对比替换导入表和模板的列数
codess
.
forEach
(
code
=>
{
let
codeLength
=
String
(
code
.
code
).
length
;
money
.
forEach
(
m
=>
{
let
columnIdString
=
String
(
m
.
code
);
let
idToMatch
=
columnIdString
.
substring
(
0
,
codeLength
);
if
(
idToMatch
===
String
(
code
.
code
).
substring
(
0
,
codeLength
))
{
m
.
cc
=
code
.
oneLevel
*
1
;
}
});
//模板
let
Fusion
=
{
"
r
"
:
''
,
"
c
"
:
''
,
"
v
"
:
{
"
ct
"
:
{
"
fa
"
:
"
@
"
,
"
t
"
:
"
s
"
},
"
fs
"
:
8
,
"
ff
"
:
"
微软雅黑
"
,
"
tb
"
:
2
,
"
v
"
:
""
,
"
qp
"
:
1
,
"
m
"
:
""
});
// 设置属性值
money
.
forEach
(
item
=>
{
item
.
c
=
item
.
cc
?
item
.
cc
*
1
:
10
;
});
money
=
money
.
map
(
obj
=>
{
let
v
=
obj
.
remark
;
for
(
let
key
in
classify
)
{
if
(
classify
[
key
].
includes
(
v
))
{
obj
.
v
.
name
=
key
;
obj
.
whether
=
true
;
return
obj
;
}
}
const
currentDate
=
new
Date
();
// 获取年份、月份和日期
const
year
=
currentDate
.
getFullYear
();
// 获取当前的年份
const
month
=
currentDate
.
getMonth
()
+
1
;
// 获取当前的月份,记得要加 1
const
day
=
currentDate
.
getDate
();
// 获取当前的日期
obj
.
v
.
name
=
"
基本生产-原煤
"
;
return
obj
;
});
//将年份、月份和日期拼接成 YYYY-MM-DD 的格式
const
formattedDate
=
`
${
year
}
-
${
month
}
-
${
day
}
`
;
let
isArray
=
[]
function
generateUniqueShortUuid
()
{
return
uuidv4
().
substring
(
0
,
8
);
money
.
forEach
(
item
=>
{
if
(
item
.
department
&&
item
.
v
.
name
)
{
let
originalString
=
item
.
v
.
name
;
let
parts
=
originalString
.
split
(
"
-
"
);
let
replacedString
=
parts
[
0
]
+
"
-
"
+
item
.
department
;
item
.
v
.
name
=
replacedString
;
}
});
let
data1
=
[
generateUniqueShortUuid
(),
this
.
select
,
this
.
select
,
this
.
date
,
'
转
'
,
'
熊亚维
'
,
'
转本月材料分配
'
,
'
CNY
'
,
'
E001
'
,
'
1.00000000
'
,
formattedDate
,
'
1
'
]
let
filteredArr
;
money
.
forEach
(
item
=>
{
if
(
item
.
v
.
name
!==
undefined
)
{
let
index
=
item
.
v
.
name
.
indexOf
(
"
-
"
);
if
(
index
!==
-
1
)
{
let
substrBeforeDash
=
item
.
v
.
name
.
slice
(
0
,
index
);
let
DepartColumns
=
he
[
0
][
"
celldata
"
].
flat
().
filter
(
obj
=>
{
if
(
obj
.
v
&&
obj
.
v
.
v
&&
typeof
obj
.
v
.
v
===
'
string
'
)
{
return
obj
.
v
.
v
.
includes
(
item
.
v
.
name
.
slice
(
0
,
index
));
}
return
false
;
})[
0
];
accountingcode
(
newData
).
then
(
response
=>
{
filteredArr
=
response
.
rows
.
map
(
obj
=>
Object
.
entries
(
obj
)
.
filter
(([
key
,
value
])
=>
value
!==
null
)
.
reduce
((
acc
,
[
key
,
value
])
=>
({
...
acc
,
[
key
]:
value
}),
{})
);
for
(
let
i
=
0
;
i
<
sum
.
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
filteredArr
.
length
;
j
++
)
{
if
(
sum
[
i
].
code
===
filteredArr
[
j
].
accountingCode
)
{
sum
[
i
].
index
=
j
;
if
(
DepartColumns
&&
DepartColumns
.
r
)
{
let
index
=
item
.
v
.
name
.
indexOf
(
"
-
"
);
if
(
index
!==
-
1
)
{
let
substrAfterDash
=
item
.
v
.
name
.
slice
(
index
+
1
);
switch
(
substrAfterDash
)
{
case
''
:
item
.
r
=
DepartColumns
.
r
;
break
;
case
'
原煤
'
:
item
.
r
=
DepartColumns
.
r
+
1
;
break
;
case
'
洗煤
'
:
item
.
r
=
DepartColumns
.
r
+
2
;
break
;
case
'
选煤
'
:
item
.
r
=
DepartColumns
.
r
+
3
;
break
;
case
'
厂区服务
'
:
item
.
r
=
DepartColumns
.
r
+
1
;
break
;
case
'
加工修理
'
:
item
.
r
=
DepartColumns
.
r
+
4
;
break
;
default
:
// 默认情况
}
}
}
for
(
let
i
=
0
;
i
<
filteredArr
.
length
;
i
++
)
{
let
newRow1
=
{
"
r
"
:
8
+
i
,
"
c
"
:
money
,
"
v
"
:
{
"
ct
"
:
Fusion
.
v
.
ct
,
"
bg
"
:
Fusion
.
v
.
bg
,
"
fs
"
:
Fusion
.
v
.
fs
,
"
ff
"
:
Fusion
.
v
.
ff
,
"
ht
"
:
Fusion
.
v
.
ht
,
"
vt
"
:
Fusion
.
v
.
vt
,
"
tb
"
:
Fusion
.
v
.
tb
,
"
v
"
:
duplicateData
[
i
]?.
v
.
v
,
"
qp
"
:
Fusion
.
v
.
qp
,
"
m
"
:
duplicateData
[
i
]?.
v
.
m
}
};
let
newRow2
=
{
"
r
"
:
8
+
i
,
"
c
"
:
money1
,
"
v
"
:
{
"
ct
"
:
Fusion
.
v
.
ct
,
"
bg
"
:
Fusion
.
v
.
bg
,
"
fs
"
:
Fusion
.
v
.
fs
,
"
ff
"
:
Fusion
.
v
.
ff
,
"
ht
"
:
Fusion
.
v
.
ht
,
"
vt
"
:
Fusion
.
v
.
vt
,
"
tb
"
:
Fusion
.
v
.
tb
,
"
v
"
:
duplicateData
[
i
]?.
v
.
v
,
"
qp
"
:
Fusion
.
v
.
qp
,
"
m
"
:
duplicateData
[
i
]?.
v
.
m
}
});
};
money
.
forEach
(
item
=>
{
if
(
item
.
r
>
8
&&
item
.
c
<
10
)
{
item
.
c
=
10
;
}
});
// 同一个单元格,金额相加
let
seen
=
new
Map
();
let
duplicateData
=
[];
for
(
let
l
=
0
;
l
<
need
.
length
;
l
++
)
{
let
needIndex
=
l
%
need
.
length
;
let
newRow3
=
{
money
.
forEach
((
obj
,
i
)
=>
{
let
key
=
obj
.
r
+
'
,
'
+
obj
.
c
;
if
(
seen
.
has
(
key
))
{
let
existingObj
=
seen
.
get
(
key
);
existingObj
.
v
.
v
=
Number
(
existingObj
.
v
.
v
)
+
Number
(
obj
.
v
.
v
);
existingObj
.
v
.
m
=
existingObj
.
v
.
v
.
toString
();
existingObj
.
index
.
push
(
i
);
}
else
{
obj
.
index
=
[
i
];
seen
.
set
(
key
,
obj
);
}
});
seen
.
forEach
(
obj
=>
{
if
(
obj
.
v
.
v
>
0
||
parseInt
(
obj
.
v
.
m
)
>
0
)
{
duplicateData
.
push
(
obj
);
}
});
duplicateData
=
duplicateData
.
map
(
item
=>
{
return
{
...
item
,
v
:
{
...
item
.
v
,
v
:
isNaN
(
item
.
v
.
v
)
?
item
.
v
.
v
:
Number
(
item
.
v
.
v
).
toFixed
(
2
)
}
};
});
//金额所在列和行,去模板表中查找,如果行列一致则替换
for
(
let
i
=
0
;
i
<
duplicateData
.
length
;
i
++
)
{
// // 对比 c 和 r 是否与 he[0]["celldata"] 中相应对象相同
for
(
let
ii
=
0
;
ii
<
he
[
0
][
"
celldata
"
].
length
;
ii
++
)
{
if
(
duplicateData
[
i
].
r
===
he
[
0
][
"
celldata
"
][
ii
].
r
&&
duplicateData
[
i
].
c
===
he
[
0
][
"
celldata
"
][
ii
].
c
)
{
// 如果相同,则进行替换
he
[
0
][
"
celldata
"
][
ii
]
=
duplicateData
[
i
];
}
}
}
he
[
0
].
data
=
luckysheet
.
transToData
(
he
[
0
][
"
celldata
"
])
if
(
this
.
value
===
1257
)
{
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
fileName
,
// Excel 文件名
data
:
he
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
'
zh
'
,
});
modify
=
true
this
.
showMask
=
false
;
}
//this.from 往后台村的数据
this
.
ImportTables
.
historyContent
=
resultJSON
this
.
generate
.
historyContent
=
JSON
.
stringify
(
he
)
//往后台传科目编码相关的东西
duplicateData
.
forEach
(
obj
=>
{
he
[
0
].
celldata
.
forEach
(
cell
=>
{
if
(
obj
.
c
===
cell
.
c
&&
cell
.
r
===
3
)
{
obj
.
v
.
material
=
cell
.
v
.
v
;
}
});
});
this
.
middle
=
he
this
.
Vouchers
(
duplicateData
)
}
else
{
this
.
open4
()
this
.
showMask
=
false
;
}
}
//东欢坨矿转换方法
//如果部门为旧品和设备 并且他们的材料为支护用品和大型材料就把他们放到基本生产里
if
(
this
.
mine
.
includes
(
'
东欢坨
'
)
&&
this
.
selectname
.
includes
(
'
东欢坨
'
))
{
//材料编码,金额,部门
if
(
code
&&
money
&&
Department
)
{
//code 编码 ,,money金额,remark 部门
let
remark
=
Department
remark
.
forEach
((
item
)
=>
{
if
(
item
.
v
.
v
.
includes
(
"
单项卡
"
))
{
item
.
v
.
v
=
item
.
v
.
v
.
replace
(
/单项卡/g
,
''
);
}
});
money
.
forEach
((
item
)
=>
{
item
.
remark
=
''
;
item
.
code
=
''
;
item
.
cc
=
''
;
item
.
v
.
name
=
''
;
});
for
(
let
i
=
0
;
i
<
money
.
length
;
i
++
)
{
if
(
money
[
i
].
r
==
code
[
i
].
r
)
{
money
[
i
].
code
=
code
[
i
].
v
.
v
;
}
if
(
money
[
i
].
r
==
remark
[
i
].
r
)
{
money
[
i
].
remark
=
remark
[
i
].
v
.
v
;
}
}
codess
.
forEach
((
codeItem
)
=>
{
let
codeLength
=
String
(
codeItem
.
code
).
length
;
let
codeToCompare
=
String
(
codeItem
.
code
).
substring
(
0
,
codeLength
);
money
.
forEach
((
moneyItem
)
=>
{
let
columnIdString
=
String
(
moneyItem
.
code
);
let
idToMatch
=
columnIdString
.
substring
(
0
,
codeLength
);
if
(
idToMatch
===
codeToCompare
)
{
moneyItem
.
cc
=
codeItem
.
oneLevel
*
1
;
}
});
});
money
=
money
.
map
((
item
)
=>
{
let
v
=
item
.
remark
;
for
(
let
key
in
classify
)
{
if
(
classify
[
key
].
includes
(
v
))
{
item
.
v
.
name
=
key
;
return
item
;
}
}
item
.
v
.
name
=
"
基本生产-原煤
"
;
return
item
;
});
//东欢坨矿的规则 如果部门为旧品和设备 并且他们的材料为支护用品和大型材料就把他们放到基本生产里
money
.
forEach
((
item
)
=>
{
if
(
item
.
remark
==
"
旧品利用中心
"
||
item
.
remark
==
"
设备管理科
"
)
{
if
(
item
.
cc
==
3
||
item
.
cc
==
2
)
{
item
.
v
.
name
=
"
基本生产-原煤
"
;
}
}
});
money
.
forEach
((
item
)
=>
{
item
.
c
=
item
.
cc
?
item
.
cc
*
1
:
10
;
});
money
.
forEach
((
item
)
=>
{
if
(
item
.
department
&&
item
.
v
.
name
)
{
let
originalString
=
item
.
v
.
name
;
let
parts
=
originalString
.
split
(
"
-
"
);
let
replacedString
=
parts
[
0
]
+
"
-
"
+
item
.
department
;
item
.
v
.
name
=
replacedString
;
}
});
money
.
forEach
((
item
)
=>
{
if
(
item
.
v
.
name
!==
undefined
)
{
let
index
=
item
.
v
.
name
.
indexOf
(
"
-
"
);
if
(
index
!==
-
1
)
{
let
substrBeforeDash
=
item
.
v
.
name
.
slice
(
0
,
index
);
let
DepartColumns
=
he
[
0
][
"
celldata
"
].
flat
().
find
((
obj
)
=>
{
if
(
obj
.
v
&&
obj
.
v
.
v
&&
typeof
obj
.
v
.
v
===
'
string
'
)
{
return
obj
.
v
.
v
.
includes
(
item
.
v
.
name
.
slice
(
0
,
index
));
}
return
false
;
});
if
(
DepartColumns
&&
DepartColumns
.
r
)
{
let
index
=
item
.
v
.
name
.
indexOf
(
"
-
"
);
if
(
index
!==
-
1
)
{
let
substrAfterDash
=
item
.
v
.
name
.
slice
(
index
+
1
);
switch
(
substrAfterDash
)
{
case
''
:
item
.
r
=
DepartColumns
.
r
;
break
;
case
'
原煤
'
:
item
.
r
=
DepartColumns
.
r
+
1
;
break
;
case
'
洗煤
'
:
item
.
r
=
DepartColumns
.
r
+
2
;
break
;
case
'
选煤
'
:
item
.
r
=
DepartColumns
.
r
+
3
;
break
;
case
'
厂区服务
'
:
item
.
r
=
DepartColumns
.
r
+
1
;
break
;
default
:
// 默认情况
}
}
}
}
}
});
// 更新金额列
for
(
let
item
of
money
)
{
if
(
item
.
r
>
8
&&
item
.
c
<
10
)
{
item
.
c
=
10
;
}
}
// 合并重复单元格数据
let
cellMap
=
new
Map
();
for
(
let
i
=
0
;
i
<
money
.
length
;
i
++
)
{
let
key
=
money
[
i
].
r
+
'
,
'
+
money
[
i
].
c
;
if
(
cellMap
.
has
(
key
))
{
let
existingItem
=
cellMap
.
get
(
key
);
existingItem
.
v
.
v
=
Number
(
existingItem
.
v
.
v
)
+
Number
(
money
[
i
].
v
.
v
);
existingItem
.
v
.
m
=
existingItem
.
v
.
v
.
toString
();
existingItem
.
index
.
push
(
i
);
}
else
{
money
[
i
].
index
=
[
i
];
cellMap
.
set
(
key
,
money
[
i
]);
}
}
let
duplicateData
=
Array
.
from
(
cellMap
.
values
()).
filter
(
item
=>
item
.
v
.
v
>
0
||
parseInt
(
item
.
v
.
m
)
>
0
);
duplicateData
=
duplicateData
.
map
(
item
=>
{
return
{
...
item
,
v
:
{
...
item
.
v
,
v
:
isNaN
(
item
.
v
.
v
)
?
item
.
v
.
v
:
Number
(
item
.
v
.
v
).
toFixed
(
2
)
}
};
});
// 替换原始数据中的重复单元格数据
//金额所在列和行,去模板表中查找,如果行列一致则替换
for
(
let
i
=
0
;
i
<
duplicateData
.
length
;
i
++
)
{
// // 对比 c 和 r 是否与 he[0]["celldata"] 中相应对象相同
for
(
let
ii
=
0
;
ii
<
he
[
0
][
"
celldata
"
].
length
;
ii
++
)
{
if
(
duplicateData
[
i
].
r
===
he
[
0
][
"
celldata
"
][
ii
].
r
&&
duplicateData
[
i
].
c
===
he
[
0
][
"
celldata
"
][
ii
].
c
)
{
// 如果相同,则进行替换
he
[
0
][
"
celldata
"
][
ii
]
=
duplicateData
[
i
];
}
}
}
he
[
0
].
data
=
luckysheet
.
transToData
(
he
[
0
][
"
celldata
"
])
if
(
this
.
value
!==
1248
)
{
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
fileName
,
// Excel 文件名
data
:
he
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
'
zh
'
,
});
modify
=
true
this
.
showMask
=
false
;
}
//this.from 往后台村的数据
this
.
ImportTables
.
historyContent
=
resultJSON
this
.
generate
.
historyContent
=
JSON
.
stringify
(
he
)
//往后台传科目编码相关的东西
duplicateData
.
forEach
(
obj
=>
{
he
[
0
].
celldata
.
forEach
(
cell
=>
{
if
(
obj
.
c
===
cell
.
c
&&
cell
.
r
===
3
)
{
obj
.
v
.
material
=
cell
.
v
.
v
;
}
});
});
this
.
middle
=
he
this
.
Vouchers
(
duplicateData
)
}
else
{
this
.
open4
()
this
.
showMask
=
false
}
}
//单侯矿转换方法&& this.selectname.includes('单侯')
//特定规则 制造费用可能放也可能不放,制造费用后期可能会晒出来
if
(
this
.
mine
.
includes
(
'
单侯
'
))
{
//部门名称所在列
let
DepartmentColumn
=
c
.
flat
().
filter
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
===
"
创建部门
"
)[
0
]?.
c
;
//结算金额所在列
let
ExpenseColumn
=
c
.
flat
().
filter
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
===
"
实际金额
"
)[
0
]?.
c
;
//材料编码
let
codeColumn
=
c
.
flat
().
filter
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
===
"
材料编码
"
)[
0
]?.
c
let
headRows
=
this
.
newArray
[
0
].
celldata
.
flat
().
filter
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
===
"
火工品
"
)[
0
]?.
r
//费用来源
let
fylyColumn
=
c
.
flat
().
filter
(
obj
=>
obj
.
v
&&
obj
.
v
.
v
===
"
费用来源
"
)[
0
]?.
c
if
(
DepartmentColumn
&&
ExpenseColumn
&&
codeColumn
&&
fylyColumn
)
{
let
code
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
codeColumn
&&
obj
.
r
>
0
)
let
headRow
=
this
.
newArray
[
0
].
celldata
.
flat
().
filter
(
obj
=>
obj
.
r
&&
obj
.
r
===
headRows
&&
obj
.
c
>
0
)
let
money
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
ExpenseColumn
&&
obj
.
r
>
0
)
let
remark
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
DepartmentColumn
&&
obj
.
r
>
0
)
let
fyly
=
c
.
flat
().
filter
(
obj
=>
obj
.
c
&&
obj
.
c
===
fylyColumn
&&
obj
.
r
>
0
)
// 清空money数组中的属性
money
.
forEach
(
item
=>
{
item
.
remark
=
''
;
item
.
code
=
''
;
item
.
cc
=
''
;
item
.
fyly
=
''
;
item
.
rr
=
''
;
});
// 更新money数组中的属性
money
=
money
.
filter
(
item
=>
{
let
matchingCode
=
code
.
find
(
c
=>
c
.
r
===
item
.
r
);
if
(
matchingCode
)
{
item
.
code
=
matchingCode
.
v
.
v
;
}
let
matchingRemark
=
remark
.
find
(
r
=>
r
.
r
===
item
.
r
);
if
(
matchingRemark
)
{
item
.
remark
=
matchingRemark
.
v
.
v
;
}
let
matchingFyly
=
fyly
.
find
(
f
=>
f
.
r
===
item
.
r
);
if
(
matchingFyly
)
{
item
.
fyly
=
matchingFyly
.
v
.
v
;
}
return
(
matchingCode
&&
matchingRemark
&&
matchingFyly
);
});
money
.
forEach
((
item
)
=>
{
if
(
item
.
remark
.
startsWith
(
'
物管科
'
))
{
item
.
remark
=
'
物管科
'
;
}
if
(
item
.
remark
.
endsWith
(
'
储运科
'
))
{
item
.
remark
=
'
储运科
'
;
}
if
(
item
.
remark
.
includes
(
'
生活
'
))
{
item
.
remark
=
'
生活科
'
}
});
money
=
money
.
map
(
obj
=>
{
let
v
=
obj
.
remark
;
for
(
let
key
in
classify
)
{
if
(
classify
[
key
].
includes
(
v
))
{
obj
.
v
.
name
=
key
;
obj
.
whether
=
true
;
return
obj
;
}
}
return
obj
;
});
for
(
let
i
=
0
;
i
<
codess
.
length
;
i
++
)
{
let
codeLength
=
String
(
codess
[
i
].
code
).
length
;
let
codeToCompare
=
String
(
codess
[
i
].
code
).
substring
(
0
,
codeLength
);
for
(
let
ii
=
0
;
ii
<
money
.
length
;
ii
++
)
{
let
columnIdString
=
String
(
money
[
ii
].
code
);
let
idToMatch
=
columnIdString
.
substring
(
0
,
codeLength
);
if
(
idToMatch
===
codeToCompare
)
{
money
[
ii
].
cc
=
codess
[
i
].
oneLevel
*
1
}
}
}
let
synthesis
=
this
.
newArray
let
head
=
synthesis
[
0
].
celldata
.
flat
().
filter
(
obj
=>
obj
.
c
==
0
&&
obj
.
r
>
4
)
head
.
forEach
(
itemA
=>
{
let
targetRemark
=
itemA
.
v
.
v
;
// 需要匹配的目标值,这里是 a 属性中的 v.v
money
.
forEach
(
itemB
=>
{
if
(
itemB
.
remark
.
includes
(
targetRemark
))
{
// 使用 include 方法进行模糊匹配
itemB
.
rr
=
itemA
.
r
;
// 如果匹配到,则将 a 属性中的 r 的值赋给 b 属性中的 rr
}
});
});
for
(
let
i
=
0
;
i
<
money
.
length
;
i
++
)
{
if
(
money
[
i
].
rr
)
{
money
[
i
].
r
=
money
[
i
].
rr
}
if
(
money
[
i
].
cc
)
{
money
[
i
].
c
=
money
[
i
].
cc
*
1
}
if
(
!
money
[
i
].
cc
)
{
money
[
i
].
c
=
10
}
}
let
seen
=
new
Map
();
let
duplicateData
=
[];
let
i
=
-
1
for
(
let
obj
of
money
)
{
let
key
=
obj
.
r
+
'
,
'
+
obj
.
c
;
i
+=
1
if
(
seen
.
has
(
key
))
{
let
existingObj
=
seen
.
get
(
key
);
existingObj
.
v
.
v
=
Number
(
existingObj
.
v
.
v
)
+
Number
(
obj
.
v
.
v
);
existingObj
.
v
.
m
=
existingObj
.
v
.
v
.
toString
();
existingObj
.
index
.
push
(
i
)
}
else
{
obj
.
index
=
[
i
]
seen
.
set
(
key
,
obj
);
}
}
for
(
let
obj
of
seen
.
values
())
{
if
(
obj
.
v
.
v
>
0
||
parseInt
(
obj
.
v
.
m
)
>
0
)
{
duplicateData
.
push
(
obj
);
}
}
for
(
let
i
=
0
;
i
<
duplicateData
.
length
;
i
++
)
{
// // 对比 c 和 r 是否与 he[0]["celldata"] 中相应对象相同
for
(
let
ii
=
0
;
ii
<
synthesis
[
0
][
"
celldata
"
].
length
;
ii
++
)
{
if
(
duplicateData
[
i
].
r
===
synthesis
[
0
][
"
celldata
"
][
ii
].
r
&&
duplicateData
[
i
].
c
===
synthesis
[
0
][
"
celldata
"
][
ii
].
c
)
{
// 如果相同,则进行替换
synthesis
[
0
][
"
celldata
"
][
ii
]
=
duplicateData
[
i
];
}
}
}
synthesis
[
0
].
data
=
luckysheet
.
transToData
(
synthesis
[
0
][
"
celldata
"
])
if
(
this
.
value
!==
1248
)
{
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
fileName
,
// Excel 文件名
data
:
synthesis
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
'
zh
'
,
});
modify
=
true
this
.
showMask
=
false
;
}
duplicateData
.
forEach
(
item
=>
{
const
matchedHeadRow
=
headRow
.
find
(
headItem
=>
headItem
.
c
===
item
.
c
);
if
(
matchedHeadRow
)
{
item
.
v
.
material
=
matchedHeadRow
.
v
.
v
;
}
});
for
(
let
i
=
0
;
i
<
duplicateData
.
length
;
i
++
)
{
if
(
duplicateData
[
i
].
r
>
4
&&
duplicateData
[
i
].
r
<
16
)
{
//管理费用
duplicateData
[
i
].
r
=
6
duplicateData
[
i
].
c
=
12
}
if
(
duplicateData
[
i
].
r
>
16
&&
duplicateData
[
i
].
r
<
27
)
{
//制造费用
duplicateData
[
i
].
r
=
7
duplicateData
[
i
].
c
=
10
}
if
(
duplicateData
[
i
].
r
>
28
&&
duplicateData
[
i
].
r
<
43
)
{
//基本费用
duplicateData
[
i
].
r
=
8
}
if
(
duplicateData
[
i
].
r
>
43
&&
duplicateData
[
i
].
r
<
46
)
{
//销售费用
duplicateData
[
i
].
r
=
9
duplicateData
[
i
].
c
=
10
}
if
(
duplicateData
[
i
].
r
>
46
&&
duplicateData
[
i
].
r
<
48
)
{
//其他业务
duplicateData
[
i
].
r
=
10
duplicateData
[
i
].
c
=
10
}
if
(
duplicateData
[
i
].
r
>
49
&&
duplicateData
[
i
].
r
<
51
)
{
//安全费用
duplicateData
[
i
].
r
=
11
duplicateData
[
i
].
c
=
10
}
}
let
seens
=
new
Map
();
let
duplicateDatas
=
[];
for
(
let
obj
of
duplicateData
)
{
let
key
=
obj
.
r
+
'
,
'
+
obj
.
c
;
if
(
seens
.
has
(
key
))
{
let
existingObj
=
seens
.
get
(
key
);
existingObj
.
v
.
v
=
Number
(
existingObj
.
v
.
v
)
+
Number
(
obj
.
v
.
v
);
existingObj
.
v
.
m
=
existingObj
.
v
.
v
.
toString
();
}
else
{
seens
.
set
(
key
,
obj
);
}
}
for
(
let
obj
of
seens
.
values
())
{
if
(
obj
.
v
.
v
>
0
||
parseInt
(
obj
.
v
.
m
)
>
0
)
{
duplicateDatas
.
push
(
obj
);
}
}
this
.
Vouchers
(
duplicateDatas
)
}
else
{
this
.
open4
()
this
.
showMask
=
false
;
}
}
});
},
//成本表往凭证但转
Vouchers
(
duplicateData
)
{
this
.
detail
=
duplicateData
.
map
(
item
=>
{
if
(
typeof
item
.
v
.
v
===
'
number
'
)
{
item
.
v
.
v
=
Number
(
item
.
v
.
v
.
toFixed
(
2
));
// 如果是数字,则进行处理
}
if
(
typeof
item
.
v
.
m
===
'
number
'
)
{
item
.
v
.
m
=
parseFloat
(
item
.
v
.
m
).
toFixed
(
2
);
// 如果是数字,则进行处理
}
return
item
;
});
let
sum
=
[{
code
:
'
2241005
'
,
material
:
'
其他材料
'
,
v
:
0
},
{
code
:
'
1403002
'
,
material
:
"
火工品
"
,
v
:
0
,
}];
for
(
let
i
=
0
;
i
<
duplicateData
.
length
;
i
++
)
{
if
(
duplicateData
[
i
].
v
.
material
===
"
火工品
"
)
{
sum
[
1
].
v
+=
Number
(
duplicateData
[
i
].
v
.
v
);
}
else
{
sum
[
0
].
v
+=
Number
(
duplicateData
[
i
].
v
.
v
);
}
}
sum
.
forEach
(
item
=>
{
item
.
v
=
Number
(
item
.
v
).
toFixed
(
2
);
});
const
VoucherForm
=
JSON
.
parse
(
this
.
VoucherForm
);
const
filteredData
=
VoucherForm
[
0
].
celldata
.
filter
(
obj
=>
obj
.
r
===
5
);
const
needKeys
=
[
"
*手工码
"
,
"
*会计主体
"
,
"
*核算账簿
"
,
"
*单据日期
"
,
"
*凭证类型
"
,
"
*制单人
"
,
"
*分录摘要
"
,
"
*币种
"
,
"
本币汇率类型
"
,
"
*本币汇率
"
,
"
*业务日期
"
,
"
凭证单摘要
"
,
];
// 根据需要的关键词获取对应的单元格
const
need
=
needKeys
.
map
(
key
=>
filteredData
.
find
(
obj
=>
obj
.
v
.
v
===
key
).
c
);
const
loan
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
原币贷方金额
"
)[
0
].
c
;
const
loan1
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
本币贷方金额
"
)[
0
].
c
;
const
money
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
原币借方金额
"
)[
0
].
c
;
const
money1
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
本币借方金额
"
)[
0
].
c
;
// 根据特定条件筛选单元格
const
foundObjects
=
filteredData
.
filter
(
obj
=>
obj
.
v
.
v
===
"
物料基本分类
"
);
let
Classification
;
let
oldClassification
;
if
(
foundObjects
.
length
>=
2
)
{
oldClassification
=
foundObjects
[
0
].
c
;
Classification
=
foundObjects
[
1
].
c
;
}
else
{
// 处理找不到两个满足条件的对象的情况
}
// 遍历duplicateData数组,为每个对象添加mining属性并赋值为this.select
duplicateData
.
forEach
(
obj
=>
{
obj
.
mining
=
this
.
select
;
});
// 生成标准模板
const
Fusion
=
{
"
r
"
:
''
,
"
c
"
:
''
,
"
v
"
:
{
"
ct
"
:
{
"
fa
"
:
"
@
"
,
"
t
"
:
"
s
"
},
"
fs
"
:
8
,
"
ff
"
:
"
微软雅黑
"
,
"
tb
"
:
2
,
"
v
"
:
""
,
"
qp
"
:
1
,
"
m
"
:
""
}
};
// 获取当前日期并格式化为 YYYY-MM-DD 的字符串
const
currentDate
=
new
Date
();
const
year
=
currentDate
.
getFullYear
();
// 获取当前年份
const
month
=
(
currentDate
.
getMonth
()
+
1
).
toString
().
padStart
(
2
,
'
0
'
);
// 获取当前月份,记得要加 1
const
day
=
currentDate
.
getDate
();
// 获取当前日期
const
formattedDate
=
`
${
year
}
-
${
month
}
-
${
day
}
`
;
// 生成唯一标识符uuid
function
generateUniqueShortUuid
()
{
return
uuidv4
().
replace
(
/-/g
,
''
).
substring
(
0
,
12
);
}
const
uuid
=
generateUniqueShortUuid
();
// 创建data1数组
const
data1
=
[
uuid
,
this
.
select
,
this
.
select
,
this
.
date
,
'
转
'
,
this
.
phone
,
'
转本月材料分配
'
,
'
CNY
'
,
'
E001
'
,
'
1.00000000
'
,
formattedDate
,
uuid
];
const
newData
=
duplicateData
.
map
(
obj
=>
{
const
[
name
,
department
]
=
obj
.
v
.
name
.
split
(
"
-
"
);
return
{
r
:
obj
.
r
,
c
:
obj
.
c
,
//金额
money
:
obj
.
v
.
v
,
name
,
indexRow
:
obj
.
index
,
department
,
material
:
obj
.
v
.
material
,
mining
:
obj
.
mining
,
//uuid
accountuuid
:
data1
[
0
],
accountdate
:
this
.
date
,
};
});
this
.
ImportTables
.
exportUuid
=
data1
[
0
]
this
.
generate
.
exportUuid
=
data1
[
0
]
this
.
ImportTables
.
identifyingCode
=
0
;
this
.
ImportTables
.
date
=
this
.
date
// this.ImportTables.exportUuid = 1;
this
.
ImportTables
.
mining
=
this
.
select
this
.
ImportTables
.
tylkStatus
=
3
this
.
ImportTables
.
templateId
=
this
.
value
this
.
generate
.
templateId
=
this
.
value
this
.
generate
.
tylkStatus
=
3
// this.generate.exportUuid = 1;
this
.
generate
.
identifyingCode
=
1
;
this
.
generate
.
date
=
this
.
date
this
.
generate
.
mining
=
this
.
select
let
list
=
[
this
.
ImportTables
,
this
.
generate
]
let
filteredArr
;
accountingcode
(
newData
).
then
(
response
=>
{
console
.
log
(
newData
)
//合并起来的每行的值转换成一行一个编码 知道哪行合并了起来
filteredArr
=
response
.
rows
.
map
(
obj
=>
Object
.
entries
(
obj
)
.
filter
(([
key
,
value
])
=>
value
!==
null
)
.
reduce
((
acc
,
[
key
,
value
])
=>
({
...
acc
,
[
key
]:
value
}),
{})
);
this
.
ImportTables
.
historyRole
=
filteredArr
.
map
(
item
=>
{
let
extractedItem
=
{};
if
(
item
.
accountingCode
)
{
extractedItem
.
accountingCode
=
item
.
accountingCode
;
}
if
(
Array
.
isArray
(
item
.
indexRow
))
{
extractedItem
.
indexRow
=
item
.
indexRow
.
join
(
'
,
'
);
}
return
extractedItem
;
});
let
historyContent
=
[];
for
(
let
i
=
0
;
i
<
this
.
ImportTables
.
historyRole
.
length
;
i
++
)
{
if
(
this
.
ImportTables
.
historyRole
[
i
].
indexRow
&&
this
.
ImportTables
.
historyRole
[
i
].
accountingCode
)
{
const
indexRowArray
=
this
.
ImportTables
.
historyRole
[
i
].
indexRow
.
split
(
'
,
'
);
for
(
let
j
=
0
;
j
<
indexRowArray
.
length
;
j
++
)
{
let
historyRole
=
{
value
:
this
.
ImportTables
.
historyRole
[
i
].
accountingCode
,
key
:
String
(
indexRowArray
[
j
])
};
historyContent
.
push
(
historyRole
);
}
}
}
this
.
ImportTables
.
historyRole
=
JSON
.
stringify
(
historyContent
)
for
(
let
i
=
0
;
i
<
sum
.
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
filteredArr
.
length
;
j
++
)
{
if
(
sum
[
i
].
code
===
filteredArr
[
j
].
accountingCode
)
{
sum
[
i
].
index
=
j
;
break
;
}
}
}
let
isArray
=
[]
for
(
let
i
=
0
;
i
<
filteredArr
.
length
;
i
++
)
{
let
newRow1
=
{
"
r
"
:
8
+
i
,
"
c
"
:
money
,
"
v
"
:
{
"
ct
"
:
Fusion
.
v
.
ct
,
"
bg
"
:
Fusion
.
v
.
bg
,
"
fs
"
:
Fusion
.
v
.
fs
,
"
ff
"
:
Fusion
.
v
.
ff
,
"
ht
"
:
Fusion
.
v
.
ht
,
"
vt
"
:
Fusion
.
v
.
vt
,
"
tb
"
:
Fusion
.
v
.
tb
,
"
v
"
:
duplicateData
[
i
]?.
v
.
v
,
"
qp
"
:
Fusion
.
v
.
qp
,
"
m
"
:
duplicateData
[
i
]?.
v
.
m
}
};
let
newRow2
=
{
"
r
"
:
8
+
i
,
"
c
"
:
money1
,
"
v
"
:
{
"
ct
"
:
Fusion
.
v
.
ct
,
"
bg
"
:
Fusion
.
v
.
bg
,
"
fs
"
:
Fusion
.
v
.
fs
,
"
ff
"
:
Fusion
.
v
.
ff
,
"
ht
"
:
Fusion
.
v
.
ht
,
"
vt
"
:
Fusion
.
v
.
vt
,
"
tb
"
:
Fusion
.
v
.
tb
,
"
v
"
:
duplicateData
[
i
]?.
v
.
v
,
"
qp
"
:
Fusion
.
v
.
qp
,
"
m
"
:
duplicateData
[
i
]?.
v
.
m
}
};
for
(
let
l
=
0
;
l
<
need
.
length
;
l
++
)
{
let
needIndex
=
l
%
need
.
length
;
let
newRow3
=
{
"
r
"
:
8
+
i
,
"
c
"
:
need
[
l
],
"
v
"
:
{
...
...
@@ -886,7 +1661,7 @@
}
});
});
cons
t
cleanedData
=
result
.
filter
(
entry
=>
{
le
t
cleanedData
=
result
.
filter
(
entry
=>
{
return
Object
.
values
(
entry
).
every
(
value
=>
value
!==
"
null
"
&&
value
!==
null
);
});
let
name
=
[]
...
...
@@ -902,6 +1677,7 @@
}
}
}
cleanedData
=
cleanedData
.
filter
(
obj
=>
Object
.
keys
(
obj
)[
0
]
!==
""
);
for
(
let
i
=
0
;
i
<
name
.
length
;
i
++
)
{
const
newRow
=
{
"
r
"
:
8
+
cleanedData
[
i
].
row
,
...
...
@@ -966,17 +1742,22 @@
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
'
zh
'
,
});
modify
=
true
this
.
showMask
=
false
;
}
// addInsert(list).then(response => {
// if (response.code == 200) {
// this.$message({
// message: '保存成功', type: 'success'
// })
// }
// });
VoucherForm
[
0
].
celldata
=
[]
})
},
/** 保存导入文件和生成文件 */
submit
(
contents
)
{
const
name
=
contents
.
info
.
name
;
...
...
@@ -1001,9 +1782,6 @@
let
datastr
=
fullYear
+
month
;
this
.
dfrom
.
date
=
datastr
this
.
dfrom
.
mining
=
this
.
mining
this
.
dfrom
.
accountingcode
this
.
dfrom
.
indexRow
this
.
from
.
status
=
this
.
dfrom
.
status
=
0
;
list
.
push
(
this
.
dfrom
);
this
.
from
.
historyName
=
fileName
+
'
(生成文件)
'
;
...
...
@@ -1028,44 +1806,38 @@
exportExcel
(
luckysheet
.
getAllSheets
(),
fileName
,
trueORfalse
,
this
.
value
);
// 清洗数据
selectActSuppliesHistorydata
(
3
).
then
(
response
=>
{
selectActSuppliesHistorydataAcc
(
3
).
then
(
response
=>
{
var
data
=
response
.
data
;
let
list
=
[];
let
list1
=
[];
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
identifyingCode
==
1
)
{
let
imp
=
{}
imp
.
exportUuid
=
data
[
i
].
exportUuid
let
parse
=
JSON
.
parse
(
data
[
i
].
historyContent
);
let
transToCellData
=
window
.
luckysheet
.
transToData
(
parse
[
0
].
celldata
);
this
.
imp
.
hId
=
data
[
i
].
id
;
this
.
imp
.
createBy
=
data
[
i
].
createBy
;
this
.
imp
.
hDate
=
data
[
i
].
date
;
this
.
imp
.
mining
=
data
[
i
].
mining
;
this
.
imp
.
actOperation2
=
transToCellData
;
list
.
push
(
this
.
imp
);
imp
.
hId
=
data
[
i
].
id
;
imp
.
createBy
=
data
[
i
].
createBy
;
imp
.
hDate
=
data
[
i
].
date
;
imp
.
mining
=
data
[
i
].
mining
;
imp
.
actOperation2
=
transToCellData
;
list
.
push
(
imp
);
}
else
{
let
ssd
=
{}
ssd
.
exportUuid
=
data
[
i
].
exportUuid
let
parse
=
JSON
.
parse
(
data
[
i
].
historyContent
);
let
transToCellData
=
window
.
luckysheet
.
transToData
(
parse
[
0
].
celldata
);
this
.
ssd
.
hId
=
data
[
i
].
id
;
this
.
ssd
.
createBy
=
data
[
i
].
createBy
;
this
.
ssd
.
hDate
=
data
[
i
].
date
;
this
.
ssd
.
mining
=
data
[
i
].
mining
;
this
.
ssd
.
actOperation2
=
transToCellData
;
list1
.
push
(
this
.
ssd
);
ssd
.
hId
=
data
[
i
].
id
;
ssd
.
createBy
=
data
[
i
].
createBy
;
ssd
.
hDate
=
data
[
i
].
date
;
ssd
.
mining
=
data
[
i
].
mining
;
ssd
.
actOperation2
=
transToCellData
;
ssd
.
convenRole
=
data
[
i
].
convenRole
ssd
.
historyRole
=
data
[
i
].
historyRole
list1
.
push
(
ssd
);
}
}
addInsertAccount1
(
list
).
then
(
response
=>
{
});
...
...
@@ -1078,12 +1850,12 @@
},
500
),
// 设置延迟时间,单位为毫秒
}
// 配置项111
};
};
// debounce函数定义
function
debounce
(
func
,
delay
)
{
// debounce函数定义
function
debounce
(
func
,
delay
)
{
let
timer
;
return
function
()
{
const
context
=
this
;
...
...
@@ -1093,8 +1865,8 @@
func
.
apply
(
context
,
args
);
},
delay
);
};
}
function
getKeyByValue
(
map
,
value
)
{
}
function
getKeyByValue
(
map
,
value
)
{
for
(
let
[
key
,
val
]
of
map
)
{
if
(
val
===
value
)
{
return
key
;
...
...
@@ -1103,15 +1875,15 @@
return
key
;
}
}
}
function
generateUUID
()
{
}
function
generateUUID
()
{
let
array
=
new
Uint32Array
(
4
);
window
.
crypto
.
getRandomValues
(
array
);
return
array
.
join
(
"
-
"
);
}
}
</
script
>
<
style
>
.mask
{
.mask
{
position
:
fixed
;
top
:
0
;
left
:
0
;
...
...
@@ -1121,9 +1893,9 @@
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
}
.loading-spinner
{
.loading-spinner
{
/* 添加你的加载动画样式 */
width
:
40px
;
height
:
40px
;
...
...
@@ -1131,9 +1903,9 @@
border
:
4px
solid
#f3f3f3
;
border-top
:
4px
solid
#3498db
;
animation
:
spin
1s
linear
infinite
;
}
}
@keyframes
spin
{
@keyframes
spin
{
0
%
{
transform
:
rotate
(
0deg
);
}
...
...
@@ -1141,5 +1913,5 @@
100
%
{
transform
:
rotate
(
360deg
);
}
}
}
</
style
>
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/supplies/indexupload.vue
View file @
acae3d48
...
...
@@ -230,6 +230,7 @@ export default {
data
:
exportJson
.
sheets
,
userInfo
:
exportJson
.
info
.
name
.
creator
})
console
.
log
(
exportJson
.
sheets
,
'
2222222222222
'
)
data1
=
exportJson
.
sheets
[
0
];
name1
=
exportJson
.
sheets
[
0
].
name
;
let
suffixArr
=
exportJson
.
info
.
name
.
split
(
'
.
'
);
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/supplies/viewuploads2.vue
0 → 100644
View file @
acae3d48
<
template
>
<div
class=
"container"
>
<div
class=
"left-table"
>
<h2>
左边表格
</h2>
<input
type=
"file"
@
change=
"uploadFile(1)"
/>
<table>
<thead>
<tr>
<th>
序号
</th>
<th>
文件名
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
<tr
v-for=
"(file, index) in leftTableData"
:class=
"
{ dragged: index === draggedIndex }"
:key="index"
draggable
@dragstart="dragStart(index)"
@dragover="dragOver(index)"
@drop="drop(index)"
@dragend="dragEnd"
>
<td>
{{
index
+
1
}}
</td>
<td>
{{
file
.
name
}}
</td>
<td>
<button
@
click=
"moveUp(index)"
>
上移
</button>
<button
@
click=
"moveDown(index)"
>
下移
</button>
<button
@
click=
"duplicate(index)"
>
复制
</button>
<button
@
click=
"deleteItem(index)"
>
删除
</button>
</td>
</tr>
</tbody>
</table>
<div
v-if=
"draggedIndex !== -1"
class=
"drag-overlay"
></div>
</div>
<div
class=
"comparison"
>
<button
@
click=
"compareFiles"
>
比较
</button>
<h2>
比较结果:
</h2>
<ul>
<li
v-for=
"(result, index) in comparedFiles"
:key=
"index"
>
{{
result
===
"
对
"
?
"
✓
"
:
"
✗
"
}}
</li>
</ul>
<div
v-if=
"showAnimation"
class=
"line"
></div>
</div>
<div
class=
"right-table"
>
<h2>
右边表格
</h2>
<input
type=
"file"
@
change=
"uploadFile(2)"
/>
<table>
<thead>
<tr>
<th>
序号
</th>
<th>
文件名
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
<tr
v-for=
"(file, index) in rightTableData"
:key=
"index"
:class=
"
{ dragged2: index === draggedIndex }"
draggable
@dragstart="dragStart2(index)"
@dragover="dragOver2(index)"
@drop="drop2(index)"
@dragend="dragEnd2"
>
<td>
{{
index
+
1
}}
</td>
<td>
{{
file
.
name
}}
</td>
<td>
<button
@
click=
"moveUp2(index)"
>
上移
</button>
<button
@
click=
"moveDown2(index)"
>
下移
</button>
<button
@
click=
"duplicate2(index)"
>
复制
</button>
<button
@
click=
"deleteItem2(index)"
>
删除
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
"
viewuploads
"
,
data
()
{
return
{
leftTableData
:
[],
rightTableData
:
[],
comparedFiles
:
[],
draggedIndex
:
null
,
draggedIndex2
:
null
,
showAnimation
:
false
,
draggedIndex3
:
-
1
,
draggedIndex6
:
-
1
,
};
},
methods
:
{
dragStart
(
index
)
{
this
.
draggedIndex3
=
index
;
},
dragEnd
()
{
this
.
draggedIndex
=
-
1
;
},
dragStart2
(
index
)
{
this
.
draggedIndex6
=
index
;
},
dragEnd2
()
{
this
.
draggedIndex
=
-
1
;
},
compareFiles
()
{},
// 调用dragstart事件并触发
dragStart
(
index
)
{
this
.
draggedIndex
=
index
;
},
// 调用dragOver事件并触发
dragOver
(
index
)
{
event
.
preventDefault
();
},
// 调用drop事件并触发
drop
(
index
)
{
const
draggedItem
=
this
.
leftTableData
[
this
.
draggedIndex
];
if
(
index
===
this
.
draggedIndex
)
{
return
;
}
this
.
leftTableData
.
splice
(
this
.
draggedIndex
,
1
);
this
.
leftTableData
.
splice
(
index
,
0
,
draggedItem
);
},
// 上移
moveUp
(
index
)
{
if
(
index
>
0
)
{
const
temp
=
this
.
leftTableData
[
index
];
this
.
leftTableData
.
splice
(
index
,
1
);
this
.
leftTableData
.
splice
(
index
-
1
,
0
,
temp
);
}
},
// 下移
moveDown
(
index
)
{
if
(
index
<
this
.
leftTableData
.
length
-
1
)
{
const
temp
=
this
.
leftTableData
[
index
];
this
.
leftTableData
.
splice
(
index
,
1
);
this
.
leftTableData
.
splice
(
index
+
1
,
0
,
temp
);
}
},
// 复制
duplicate
(
index
)
{
const
item
=
Object
.
assign
({},
this
.
leftTableData
[
index
]);
this
.
leftTableData
.
splice
(
index
+
1
,
0
,
item
);
},
// 删除
deleteItem
(
index
)
{
this
.
leftTableData
.
splice
(
index
,
1
);
},
// 调用dragstart事件并触发
dragStart2
(
index
)
{
this
.
draggedIndex2
=
index
;
},
// 调用dragOver事件并触发
dragOver2
(
index
)
{
event
.
preventDefault
();
},
// 调用drop事件并触发
drop2
(
index
)
{
const
draggedItem2
=
this
.
rightTableData
[
this
.
draggedIndex2
];
if
(
index
===
this
.
draggedIndex2
)
{
return
;
}
this
.
rightTableData
.
splice
(
this
.
draggedIndex2
,
1
);
this
.
rightTableData
.
splice
(
index
,
0
,
draggedItem2
);
},
// 上移
moveUp2
(
index
)
{
if
(
index
>
0
)
{
const
temp
=
this
.
rightTableData
[
index
];
this
.
rightTableData
.
splice
(
index
,
1
);
this
.
rightTableData
.
splice
(
index
-
1
,
0
,
temp
);
}
},
// 下移
moveDown2
(
index
)
{
if
(
index
<
this
.
rightTableData
.
length
-
1
)
{
const
temp
=
this
.
rightTableData
[
index
];
this
.
rightTableData
.
splice
(
index
,
1
);
this
.
rightTableData
.
splice
(
index
+
1
,
0
,
temp
);
}
},
// 复制
duplicate2
(
index
)
{
const
file
=
Object
.
assign
({},
this
.
rightTableData
[
index
]);
this
.
rightTableData
.
splice
(
index
+
1
,
0
,
file
);
},
// 删除
deleteItem2
(
index
)
{
this
.
rightTableData
.
splice
(
index
,
1
);
},
uploadFile
(
table
)
{
const
fileInput
=
event
.
target
;
const
files
=
fileInput
.
files
;
const
tableData
=
table
===
1
?
this
.
leftTableData
:
this
.
rightTableData
;
debugger
// 将上传的文件添加到对应的表格数据中
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
)
{
tableData
.
push
(
files
[
i
]);
}
// 按序号排序
tableData
.
sort
((
a
,
b
)
=>
a
.
name
.
localeCompare
(
b
.
name
));
// 比较左右表格的文件名
if
(
this
.
leftTableData
.
length
>
0
&&
this
.
rightTableData
.
length
>
0
)
{
this
.
comparedFiles
=
this
.
compareFiles
();
}
else
{
this
.
clearComparison
();
}
},
compareFiles
()
{
this
.
showAnimation
=
true
;
setTimeout
(()
=>
{
this
.
showAnimation
=
false
;
},
2800
);
setTimeout
(()
=>
{
this
.
comparedFiles
=
[];
const
minLength
=
Math
.
min
(
this
.
leftTableData
.
length
,
this
.
rightTableData
.
length
);
for
(
let
i
=
0
;
i
<
minLength
;
i
++
)
{
const
leftFileName
=
this
.
leftTableData
[
i
].
name
;
const
rightFileName
=
this
.
rightTableData
[
i
].
name
;
if
(
leftFileName
===
rightFileName
)
{
this
.
comparedFiles
.
push
(
"
对
"
);
}
else
{
this
.
comparedFiles
.
push
(
"
错
"
);
}
}
},
3000
);
},
clearComparison
()
{
this
.
comparedFiles
=
[];
},
},
};
</
script
>
<
style
>
tr
.dragged
{
opacity
:
0.5
;
}
tr
.dragged2
{
opacity
:
0.5
;
}
/* .drag-overlay
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
pointer-events: none;
} */
.line
{
width
:
100%
;
height
:
1px
;
background-color
:
red
;
animation
:
lineAnimation
3s
linear
;
position
:
relative
;
top
:
15px
;
}
@keyframes
lineAnimation
{
0
%
{
width
:
0
;
}
100
%
{
width
:
100%
;
}
}
.container
{
display
:
flex
;
justify-content
:
space-between
;
margin
:
100px
;
}
.left-table
,
.right-table
{
width
:
45%
;
}
.comparison
{
width
:
20%
;
position
:
relative
;
margin-left
:
100px
;
}
table
{
width
:
100%
;
border-collapse
:
collapse
;
margin-top
:
20px
;
}
th
,
td
{
border
:
1px
solid
#ccc
;
padding
:
8px
;
}
h2
{
font-size
:
18px
;
margin-bottom
:
10px
;
}
input
[
type
=
"file"
]
{
margin-bottom
:
10px
;
}
ul
{
list-style
:
none
;
padding-left
:
0
;
}
li
{
margin-bottom
:
5px
;
}
.comparison
>
ul
{
margin-top
:
85px
;
position
:
relative
;
}
.comparison
>
ul
>
li
{
margin-top
:
20px
;
}
.animation
{
width
:
100px
;
height
:
100px
;
background-color
:
red
;
transition
:
opacity
0.3s
ease-in-out
;
}
.animation-enter-active
,
.animation-leave-active
{
opacity
:
0
;
}
tr
.dragged
{
opacity
:
0.5
;
}
tr
.drag-over
{
background-color
:
#e5e5e5
;
}
</
style
>
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/suppliesrole/index.vue
View file @
acae3d48
...
...
@@ -104,9 +104,6 @@
<el-form-item
label=
"规则名称"
prop=
"roleName"
>
<el-input
v-model=
"form.roleName"
placeholder=
"请输入规则名称"
maxlength=
"36"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
...
@@ -116,7 +113,7 @@
</el-dialog>
<!-- 添加或修改规则详情对话框 -->
<el-dialog
:title=
"title"
:visible.sync=
"optionDetail"
width=
"1300px"
append-to-body
>
<el-dialog
@
close=
"Dialog"
:title=
"title"
:visible.sync=
"optionDetail"
width=
"1300px"
append-to-body
>
<el-form
ref=
"forms"
:model=
"forms"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"规则详情"
prop=
"roleId"
>
<el-select
v-model=
"selectedOption"
filterable
placeholder=
"请选择关联项"
...
...
@@ -137,7 +134,7 @@
<el-row>
<el-col
:span=
"8"
>
<el-form-item
label=
"转换类型"
prop=
"detailYS"
>
<el-radio-group
v-model=
"forms.detailYS"
>
<el-radio-group
v-model=
"forms.detailYS"
@
change=
"radiovalue"
>
<el-radio
label=
"1"
>
单元格转换
</el-radio>
<el-radio
label=
"2"
>
行转换
</el-radio>
<el-radio
label=
"3"
>
列转换
</el-radio>
...
...
@@ -145,23 +142,34 @@
</el-form-item>
</el-col>
<el-col
:span=
"16"
>
<el-form-item
v-if=
"forms.detailYS !== null"
>
<el-button
type=
"primary"
:disabled=
"isDisable"
@
click=
"addInputs"
>
添加规则
</el-button>
<el-form-item
v-if=
"optionid"
>
<el-button
type=
"primary"
:disabled=
"isDisable || isDelete"
@
click=
"addInputs"
>
添加规则
</el-button>
</el-form-item>
</el-col>
</el-row>
<!-- 生成输入框 -->
<div
v-for=
"index in instea"
:key=
"index"
>
<span
v-if=
"isTitle && index == 1"
style=
"color:red;"
>
<b>
物料编码
</b>
</span>
<span
v-if=
"isTitle && index == 2"
style=
"color:red;"
>
<b>
部门名称
</b>
</span>
<span
v-if=
"isTitle && index == 3"
style=
"color:red;"
>
<b>
计量单位
</b>
</span>
<span
v-if=
"isTitle && index == 4"
style=
"color:red;"
>
<b>
费用来源
</b>
</span>
<span
v-if=
"isTittle && index == 1"
style=
"color:red;"
>
<b>
数量
</b>
</span>
<span
v-if=
"isTittle && index == 2"
style=
"color:red;"
>
<b>
金额
</b>
</span>
<span
v-if=
"isTittle && index == 1"
style=
"position: absolute; left:632px;top:342px; z-index: 2;color: red;"
>
<b>
数量
</b>
</span>
<span
v-if=
"isTittle && index == 2"
style=
"position: absolute; left:632px;top:444px; z-index: 2;color: red;"
>
<b>
单价
</b>
</span>
<el-form-item
label=
"表头所在行"
prop=
"cleanIng"
class=
"form-item-inline"
v-if=
"optionid === 6"
>
<el-input-number
size=
"medium"
v-model=
"cleanIng.HeaderRow"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"模板表行坐标"
prop=
"detailMH"
class=
"form-item-inline"
v-else
>
<el-input-number
size=
"medium"
v-model=
"detailMH[index - 1]"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"物料名称所在列"
prop=
"cleanIng"
class=
"form-item-inline"
v-if=
"optionid === 6"
>
<el-input-number
size=
"medium"
v-model=
"cleanIng.NameColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
...
...
@@ -197,16 +205,59 @@
<el-input-number
size=
"medium"
v-model=
"cleanIng.MoneyColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"计量单位所在列"
prop=
"cleanIng"
class=
"form-item-inline"
v-if=
"optionid === 6"
>
<el-input-number
size=
"medium"
v-model=
"cleanIng.unit"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<br>
<el-form-item
label=
"是否需要转换"
prop=
"cleanIng"
class=
"form-item-inline"
v-if=
"optionid === 6"
>
<el-select
v-model=
"cleanIng.conversion"
placeholder=
"请选择"
@
change=
"ConversionChange"
>
<el-option
v-for=
"item in conversion"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-form-item
label=
"费用渠道所在列"
prop=
"cleanIng"
class=
"form-item-inline"
v-if=
"ConversionValue === 0"
>
<el-input-number
size=
"medium"
v-model=
"cleanIng.expenses"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"费用备用所在列"
prop=
"cleanIng"
class=
"form-item-inline"
v-if=
"ConversionValue === 1"
>
<el-input-number
size=
"medium"
v-model=
"cleanIng.spare"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
</el-form-item>
<el-form-item
label=
"日期所在列"
prop=
"cleanIng"
class=
"form-item-inline"
v-if=
"optionid === 6"
>
<el-input-number
size=
"medium"
v-model=
"cleanIng.DateColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
<el-select
v-model=
"datevalue"
placeholder=
"请选择日期所在列"
@
change=
"dateChange"
label=
"日期所在列"
>
<el-option
v-for=
"item in date"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-input-number
style=
"margin-left: 5vw;"
v-if=
"datevalue == 1"
size=
"medium"
v-model=
"cleanIng.DateColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
style=
"display: inline-block;"
>
<el-form-item
style=
"display: inline-block;"
v-if=
"!isDelete"
>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"small"
@
click=
"removeInputs(index)"
>
删除
</el-button>
</el-form-item>
</div>
<el-form-item
style=
"display: inline-block;"
v-if=
"isDelete"
>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"small"
@
click=
"removeInputs"
>
删除
</el-button>
</el-form-item>
<div
v-if=
"optionid !== 6 && instea >= 1"
style=
"color: red; margin-left: 2.5vw;"
>
为防止后面步骤出错,导入表和模板表的行列坐标必须为表头所在单元格的行列
</div>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm2"
>
确 定
</el-button>
...
...
@@ -236,12 +287,33 @@ export default {
},
data
()
{
return
{
date
:
[{
value
:
0
,
label
:
'
无
'
},
{
value
:
1
,
label
:
'
有
'
}],
datevalue
:
0
,
conversion
:
[{
value
:
0
,
label
:
'
不需要
'
},
{
value
:
1
,
label
:
'
需要
'
}],
ConversionValue
:
''
,
selectedOption
:
''
,
// 遮罩层
loading
:
true
,
// 选中数组
ids
:
[],
name
:
[],
radiitemValue
:
{
radio
:
'
0
'
,
conver
:
'
0
'
},
tempIds
:
[],
// 非单个禁用
single
:
true
,
...
...
@@ -275,7 +347,7 @@ export default {
},
// 表单参数
form
:
{},
optionid
:
''
,
optionid
:
''
,
forms
:
{},
formdeta
:
{},
formtemp
:
{},
...
...
@@ -283,7 +355,19 @@ export default {
detailML
:
[],
detailYH
:
[],
detailYL
:
[],
cleanIng
:{},
cleanIng
:
{
HeaderRow
:
''
,
NameColumn
:
''
,
CodeColumn
:
''
,
DepartmentColumn
:
''
,
NumberColumn
:
''
,
MoneyColumn
:
''
,
DateColumn
:
''
,
unit
:
''
,
expenses
:
''
,
conversion
:
''
,
spare
:
''
},
instea
:
0
,
// 表单校验
rules
:
{
...
...
@@ -297,8 +381,17 @@ export default {
};
},
computed
:
{
isDisable
(){
return
this
.
instea
===
1
&&
this
.
optionid
===
6
isDisable
()
{
return
(
this
.
instea
>=
1
&&
this
.
optionid
==
6
)
||
(
this
.
radiitemValue
.
radio
==
2
&&
this
.
radiitemValue
.
conver
==
3
&&
this
.
instea
>=
4
)
},
isDelete
()
{
return
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
1
&&
this
.
instea
>=
4
)
||
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
2
&&
this
.
instea
>=
2
)
},
isTitle
()
{
return
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
1
},
isTittle
()
{
return
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
2
}
},
created
()
{
...
...
@@ -306,7 +399,44 @@ export default {
this
.
getnameid
();
},
methods
:
{
handleRadioChange
()
{
empty
()
{
this
.
optionid
=
''
this
.
datevalue
=
0
this
.
radiitemValue
.
radio
=
0
this
.
radiitemValue
.
conver
=
0
this
.
detailMH
=
[]
this
.
detailML
=
[]
this
.
detailYH
=
[]
this
.
detailYL
=
[]
},
Dialog
()
{
this
.
empty
()
},
radiovalue
(
value
)
{
this
.
radiitemValue
.
radio
=
Number
(
value
)
this
.
detailMH
=
[]
this
.
detailML
=
[]
this
.
detailYH
=
[]
this
.
detailYL
=
[]
this
.
instea
=
0
},
ConversionChange
(
value
)
{
this
.
ConversionValue
=
value
if
(
value
===
0
)
{
this
.
cleanIng
.
spare
=
''
}
else
{
this
.
cleanIng
.
expenses
=
''
}
},
dateChange
()
{
this
.
cleanIng
.
DateColumn
=
''
},
handleRadioChange
(
value
)
{
this
.
radiitemValue
.
conver
=
value
this
.
optionid
=
this
.
forms
.
convertStatus
this
.
detailMH
=
[]
this
.
detailML
=
[]
...
...
@@ -320,30 +450,74 @@ export default {
DepartmentColumn
:
''
,
NumberColumn
:
''
,
MoneyColumn
:
''
,
DateColumn
:
''
DateColumn
:
''
,
unit
:
''
,
expenses
:
''
,
conversion
:
''
,
spare
:
''
}
},
removeInputs
(
index
)
{
if
(
this
.
isDelete
)
{
this
.
instea
=
0
this
.
detailMH
=
[]
this
.
detailML
=
[]
this
.
detailYH
=
[]
this
.
detailYL
=
[]
}
else
{
this
.
detailMH
.
splice
(
index
-
1
,
1
);
this
.
detailML
.
splice
(
index
-
1
,
1
);
this
.
detailYH
.
splice
(
index
-
1
,
1
);
this
.
detailYL
.
splice
(
index
-
1
,
1
);
this
.
instea
=
this
.
instea
-
1
;
}
},
addInputs
()
{
if
((
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
1
)
||
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
2
))
{
if
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
1
)
{
let
i
=
4
-
this
.
instea
this
.
instea
+=
i
if
(
this
.
detailMH
&&
this
.
detailML
&&
this
.
detailYH
&&
this
.
detailYL
)
{
[
this
.
detailMH
,
this
.
detailML
,
this
.
detailYH
,
this
.
detailYL
].
forEach
(
arr
=>
{
while
(
arr
.
length
<
4
)
arr
.
push
(
1
);
});
}
}
if
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
2
)
{
let
i
=
2
-
this
.
instea
this
.
instea
+=
i
if
(
this
.
detailMH
&&
this
.
detailML
&&
this
.
detailYH
&&
this
.
detailYL
)
{
[
this
.
detailMH
,
this
.
detailML
,
this
.
detailYH
,
this
.
detailYL
].
forEach
(
arr
=>
{
while
(
arr
.
length
<
2
)
arr
.
push
(
1
);
});
}
}
}
else
{
this
.
instea
+=
1
;
this
.
detailMH
[
this
.
instea
-
1
]
=
1
;
this
.
detailML
[
this
.
instea
-
1
]
=
1
;
this
.
detailYH
[
this
.
instea
-
1
]
=
1
;
this
.
detailYL
[
this
.
instea
-
1
]
=
1
;
this
.
detailMH
.
push
(
1
)
this
.
detailML
.
push
(
1
)
this
.
detailYH
.
push
(
1
)
this
.
detailYL
.
push
(
1
)
}
},
/**启用 */
toggleEnable
(
suppliesRole
)
{
console
.
log
(
'
你点击了【
'
+
suppliesRole
.
s
+
'
】的开关控件,当前开关值:
'
+
suppliesRole
.
status
);
...
...
@@ -403,6 +577,7 @@ export default {
// 取消按钮
cancel
()
{
this
.
optionid
=
''
this
.
open
=
false
;
this
.
optionDetail
=
false
;
this
.
reset
();
...
...
@@ -452,6 +627,7 @@ export default {
this
.
reset
();
const
id
=
row
.
id
||
this
.
ids
getSuppliesrole
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
title
=
"
修改导入规则
"
;
...
...
@@ -482,12 +658,21 @@ export default {
handleOptionChange
(
selectedOption
)
{
getSuppliesroledetail
(
selectedOption
).
then
(
response
=>
{
this
.
forms
=
response
.
data
;
this
.
radiitemValue
.
conver
=
this
.
forms
.
convertStatus
this
.
radiitemValue
.
radio
=
this
.
forms
.
detailYS
const
detailContent
=
response
.
data
.
detailContent
;
const
parse
=
JSON
.
parse
(
detailContent
);
this
.
optionid
=
response
.
data
.
convertStatus
if
(
response
.
data
.
convertStatus
===
6
)
{
this
.
instea
=
parse
.
length
this
.
cleanIng
=
parse
[
0
]
this
.
optionid
=
response
.
data
.
convertStatus
this
.
instea
=
parse
.
length
if
(
response
.
data
.
convertStatus
===
6
)
{
this
.
cleanIng
=
parse
[
0
]
if
(
this
.
cleanIng
.
DateColumn
!==
''
)
{
this
.
datevalue
=
1
}
else
{
this
.
datevalue
=
0
}
}
else
{
this
.
detailMH
=
parse
.
map
(
obj
=>
parseInt
(
obj
.
rt
)
+
1
);
this
.
detailML
=
parse
.
map
(
obj
=>
parseInt
(
obj
.
ct
)
+
1
);
...
...
@@ -526,7 +711,7 @@ export default {
submitForm2
()
{
this
.
form
.
cleanIng
=
JSON
.
stringify
(
this
.
cleanIng
);
this
.
form
s
.
cleanIng
=
JSON
.
stringify
(
this
.
cleanIng
);
this
.
forms
.
detailMH
=
this
.
detailMH
;
this
.
forms
.
detailML
=
this
.
detailML
;
this
.
forms
.
detailYH
=
this
.
detailYH
;
...
...
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/suppliesroledetail/index(1).vue
deleted
100644 → 0
View file @
3b91e088
<
template
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
:inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"上级规则"
prop=
"roleId"
>
<el-select
v-model=
"queryParams.roleId"
filterable
clearable
placeholder=
"请选择关联项"
>
<el-option
v-for=
"option in options1"
:key=
"option.roleName"
:label=
"option.roleName"
:value=
"option.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"规则名称"
prop=
"detailName"
>
<el-input
v-model=
"queryParams.detailName"
placeholder=
"请输入规则名称"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
maxlength=
"15"
/>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
placeholder=
"请选择状态"
>
<el-option
label=
"启用"
:value=
"0"
></el-option>
<el-option
label=
"禁用"
:value=
"1"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"运算规则"
prop=
"convertStatus"
>
<el-select
v-model=
"queryParams.convertStatus"
clearable
filterable
placeholder=
"请运算规则"
>
<el-option
v-for=
"option in options2"
:key=
"option.operationName"
:label=
"option.operationName"
:value=
"option.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
v-hasPermi=
"['system:suppliesroledetail:add']"
>
新增
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
plain
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleDelete"
v-hasPermi=
"['system:suppliesroledetail:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
size=
"mini"
@
click=
"handleExport"
v-hasPermi=
"['system:suppliesroledetail:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"suppliesroledetailList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
type=
"index"
width=
"80"
align=
"center"
label=
"序号"
:index=
"indexMethod"
/>
<el-table-column
label=
"上级规则"
align=
"center"
prop=
"roleName"
/>
<el-table-column
label=
"规则名称"
align=
"center"
prop=
"detailName"
/>
<el-table-column
label=
"规则内容"
align=
"center"
prop=
"detailContent"
/>
<el-table-column
label=
"运算规则"
align=
"center"
>
<template
slot-scope=
"scope"
>
<div>
<template
v-if=
"scope.row.convertStatus === 0"
>
无
</
template
>
<
template
v-if=
"scope.row.convertStatus === 1"
>
物料转换
</
template
>
<
template
v-if=
"scope.row.convertStatus === 2"
>
加法运算
</
template
>
<
template
v-if=
"scope.row.convertStatus === 3"
>
减法运算
</
template
>
<
template
v-if=
"scope.row.convertStatus === 4"
>
乘法运算
</
template
>
<
template
v-if=
"scope.row.convertStatus === 5"
>
除法运算
</
template
>
<
template
v-if=
"scope.row.convertStatus === 6"
>
清洗规则
</
template
>
</div>
</template>
</el-table-column>
<el-table-column
label=
"状态"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<div>
<template
v-if=
"scope.row.status === 0"
>
<span
style=
"color: #0cc030;"
>
已发布
</span>
</
template
>
<
template
v-else-if=
"scope.row.status === 1"
>
<span
style=
"color: #0077ff;"
>
未发布
</span>
</
template
>
<
template
v-else-if=
"scope.row.status === 2"
>
<span
style=
"color: #ff0000;"
>
未发布
</span>
</
template
>
</div>
</template>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleUpdate(scope.row)"
v-hasPermi=
"['system:suppliesroledetail:edit']"
:style=
"
{ display: scope.row.status === 1 ? '' : 'none' }">修改
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['system:suppliesroledetail:remove']"
:style=
"
{ display: scope.row.status === 1 ? '' : 'none' }">删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<pagination
v-show=
"total > 0"
:total=
"total"
:page.sync=
"queryParams.pageNum"
:limit.sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<!-- 添加或修改规则详情对话框 -->
<el-dialog
:title=
"title"
:visible.sync=
"open"
width=
"1300px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"上级规则"
prop=
"roleId"
>
<el-select
v-model=
"form.roleId"
filterable
placeholder=
"请选择关联项"
>
<el-option
v-for=
"option in options3"
:key=
"option.roleName"
:label=
"option.roleName"
:value=
"option.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"规则名称"
prop=
"detailName"
>
<el-input
v-model=
"form.detailName"
placeholder=
"请输入规则名称"
maxlength=
"36"
show-word-limit
/>
</el-form-item>
<el-form-item
label=
"运算方法"
prop=
"convertStatus"
>
<el-select
v-model=
"form.convertStatus"
filterable
placeholder=
"请选择运算方法"
@
change=
"handleRadioChange"
>
<el-option
v-for=
"option in options2"
:key=
"option.operationName"
:label=
"option.operationName"
:value=
"option.id"
></el-option>
</el-select>
</el-form-item>
<el-row>
<el-col
:span=
"8"
>
<el-form-item
label=
"转换类型"
prop=
"detailYS"
>
<el-radio-group
v-model=
"form.detailYS"
>
<el-radio
label=
"1"
>
单元格转换
</el-radio>
<el-radio
label=
"2"
>
行转换
</el-radio>
<el-radio
label=
"3"
>
列转换
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col
:span=
"16"
>
<el-form-item
v-if=
"form.detailYS !== null"
>
<el-button
type=
"primary"
:disabled=
"isDisable"
@
click=
"addInputs"
>
添加规则
</el-button>
</el-form-item>
</el-col>
</el-row>
<div
v-for=
"index in instea"
:key=
'index'
>
<el-form-item
label=
"表头所在行"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.HeaderRow"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"模板表行坐标"
prop=
"detailMH"
class=
"form-item-inline"
v-else
>
<el-input-number
size=
"medium"
v-model=
"detailMH[index - 1]"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"物料名称所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.NameColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"模板表列坐标"
prop=
"detailML"
class=
"form-item-inline"
v-else
>
<el-input-number
size=
"medium"
v-model=
"detailML[index - 1]"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"物料编码所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.CodeColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"导入表行坐标"
prop=
"detailYH"
class=
"form-item-inline"
v-else
>
<el-input-number
size=
"medium"
v-model=
"detailYH[index - 1]"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"部门所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.DepartmentColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"导入表列坐标"
prop=
"detailYL"
class=
"form-item-inline"
v-else
>
<el-input-number
size=
"medium"
v-model=
"detailYL[index - 1]"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"数量所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.NumberColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"金额所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.MoneyColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"日期所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6 "
>
<el-select
v-model=
"datevalue"
placeholder=
"请选择日期所在列"
@
change=
"dateChange"
label=
"日期所在列"
>
<el-option
v-for=
"item in date"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-input-number
style=
"margin-left: 5vw;"
v-if=
"datevalue == 1"
size=
"medium"
v-model=
"CleanIng.DateColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
style=
"display: inline-block;"
>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"small"
@
click=
"removeInputs(index)"
>
删除
</el-button>
</el-form-item>
</div>
<div
v-if=
"options2id !== 6 && instea >= 1"
style=
"color: red; margin-left: 2.5vw;"
>
为防止后面步骤出错,导入表和模板表的行列坐标必须为表头所在单元格的行列
</div>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</el-dialog>
</div>
</template>
<
style
>
.form-item-inline
{
display
:
inline-block
;
margin-right
:
20px
;
}
</
style
>
<
script
>
import
{
listSuppliesroledetail
,
getSuppliesroledetail
,
delSuppliesroledetail
,
addSuppliesroledetail
,
updateSuppliesroledetail
,
exportSuppliesroledetail
,
saveSid
,
toggleEnable
,
toggleDisable
,
saveOperation
,
saveSidsta
,
}
from
"
@/api/system/suppliesroledetail
"
;
import
Editor
from
'
@/components/Editor
'
;
export
default
{
name
:
"
Suppliesroledetail
"
,
components
:
{
Editor
,
},
data
()
{
return
{
date
:
[{
value
:
0
,
label
:
'
无
'
},
{
value
:
1
,
label
:
'
有
'
}],
datevalue
:
0
,
// 遮罩层
loading
:
true
,
//下拉选中的数值
options2id
:
''
,
// 选中数组
ids
:
[],
name
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 规则详情表格数据
suppliesroledetailList
:
[],
options1
:
[],
//上级ID
options3
:
[],
options2
:
[{
id
:
0
,
operationName
:
"
无
"
},
{
id
:
1
,
operationName
:
"
物料转换
"
},
{
id
:
2
,
operationName
:
"
加法运算
"
},
{
id
:
3
,
operationName
:
"
减法运算
"
},
{
id
:
4
,
operationName
:
"
乘法运算
"
},
{
id
:
5
,
operationName
:
"
除法运算
"
},
{
id
:
6
,
operationName
:
'
清洗规则
'
}],
//上级ID
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
inputCount
:
0
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
roleId
:
null
,
detailName
:
null
,
detailContent
:
null
,
status
:
null
,
converStatus
:
null
,
},
// 表单参数
form
:
{
},
CleanIng
:
{
HeaderRow
:
''
,
NameColumn
:
''
,
CodeColumn
:
''
,
DepartmentColumn
:
''
,
NumberColumn
:
''
,
MoneyColumn
:
''
,
DateColumn
:
''
},
detailMH
:
[],
detailML
:
[],
detailYH
:
[],
detailYL
:
[],
instea
:
0
,
showTemplate
:
false
,
// 控制单元格的显示与隐藏
showImport
:
false
,
// 控制行转换的显示与隐藏
showLie
:
false
,
// 控制列转换的显示与隐藏
// 表单校验
rules
:
{
roleId
:
[
{
required
:
true
,
message
:
'
关联id不能为空
'
,
trigger
:
'
change
'
},
],
convertStatus
:
[
{
required
:
true
,
message
:
'
运算规则不能为空
'
,
trigger
:
'
change
'
},
],
detailName
:
[
{
required
:
true
,
message
:
'
规则名称不能为空
'
,
trigger
:
'
change
'
},
]
}
};
},
watch
:
{
options2id
(
newValue
)
{
if
(
newValue
>=
0
&&
this
.
detailMH
.
length
>=
1
)
{
this
.
instea
=
1
}
}
},
computed
:
{
isDisable
()
{
return
this
.
instea
>=
1
&&
this
.
options2id
==
6
;
},
},
created
()
{
this
.
getList
();
this
.
getnameid
();
},
methods
:
{
dateChange
()
{
this
.
CleanIng
.
DateColumn
=
''
},
handleRadioChange
()
{
this
.
options2id
=
this
.
form
.
convertStatus
this
.
detailMH
=
[]
this
.
detailML
=
[]
this
.
detailYH
=
[]
this
.
detailYL
=
[]
this
.
instea
=
0
this
.
CleanIng
=
{
HeaderRow
:
''
,
NameColumn
:
''
,
CodeColumn
:
''
,
DepartmentColumn
:
''
,
NumberColumn
:
''
,
MoneyColumn
:
''
,
DateColumn
:
''
}
},
removeInputs
(
index
)
{
this
.
detailMH
.
splice
(
index
-
1
,
1
);
this
.
detailML
.
splice
(
index
-
1
,
1
);
this
.
detailYH
.
splice
(
index
-
1
,
1
);
this
.
detailYL
.
splice
(
index
-
1
,
1
);
this
.
instea
=
this
.
instea
-
1
;
},
addInputs
()
{
this
.
instea
+=
1
;
this
.
detailMH
.
push
(
1
)
this
.
detailML
.
push
(
1
)
this
.
detailYH
.
push
(
1
)
this
.
detailYL
.
push
(
1
)
},
toggleEnable
(
suppliesRoleDetail
)
{
console
.
log
(
'
你点击了【
'
+
suppliesRoleDetail
.
s
+
'
】的开关控件,当前开关值:
'
+
suppliesRoleDetail
.
status
);
let
enableText
=
[
'
启用
'
,
'
禁用
'
];
if
(
suppliesRoleDetail
.
status
===
0
)
{
toggleEnable
(
suppliesRoleDetail
.
id
).
then
((
response
)
=>
{
if
(
response
.
code
===
200
)
{
let
message
=
'
操作成功,已经将【
'
+
suppliesRoleDetail
.
roleName
+
'
】的状态改为【
'
+
enableText
[
suppliesRoleDetail
.
status
]
+
'
】 !
'
;
this
.
$message
({
message
:
message
,
type
:
'
success
'
});
}
else
{
this
.
$message
.
error
(
response
.
message
);
}
});
}
else
{
toggleDisable
(
suppliesRoleDetail
.
id
).
then
((
response
)
=>
{
if
(
response
.
code
===
200
)
{
let
message
=
'
操作成功,已经将【
'
+
suppliesRoleDetail
.
roleName
+
'
】的状态改为【
'
+
enableText
[
suppliesRoleDetail
.
status
]
+
'
】 !
'
;
this
.
$message
({
message
:
message
,
type
:
'
error
'
});
}
else
{
this
.
$message
.
error
(
response
.
message
);
}
});
}
},
/**显示序号*/
indexMethod
(
index
)
{
return
index
+
1
;
},
/**获取关联表内容*/
getnameid
()
{
//上级规则
saveSid
().
then
(
response
=>
{
this
.
options1
=
response
.
rows
;
})
},
/** 查询规则详情列表 */
getList
()
{
this
.
indexMethod
(
0
);
this
.
loading
=
true
;
listSuppliesroledetail
(
this
.
queryParams
).
then
(
response
=>
{
this
.
suppliesroledetailList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
});
},
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
},
// 表单重置
reset
()
{
this
.
form
=
{
id
:
null
,
roleId
:
null
,
detailName
:
null
,
detailYS
:
null
,
detailContent
:
null
,
status
:
0
,
convertStatus
:
null
,
createBy
:
null
,
createTime
:
null
,
updateBy
:
null
,
updateTime
:
null
,
cleanIng
:
null
};
this
.
resetForm
(
"
form
"
);
},
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
;
this
.
getList
();
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"
queryForm
"
);
this
.
handleQuery
();
},
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
name
=
selection
.
map
(
item
=>
item
.
detailName
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
},
/** 新增按钮操作 */
handleAdd
()
{
//上级规则
saveSidsta
().
then
(
response
=>
{
this
.
options3
=
response
.
rows
;
})
this
.
instea
=
0
;
this
.
getnameid
();
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"
添加规则详情
"
;
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
getnameid
();
const
ids
=
this
.
options1
.
map
(
option
=>
option
.
id
);
if
(
ids
.
findIndex
(
item
=>
item
===
row
.
roleId
)
!==
-
1
)
{
this
.
reset
();
const
id
=
row
.
id
||
this
.
ids
getSuppliesroledetail
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
options2id
=
response
.
data
.
convertStatus
const
detailContent
=
response
.
data
.
detailContent
;
const
parse
=
JSON
.
parse
(
detailContent
);
console
.
log
(
response
.
data
)
if
(
this
.
options2id
===
6
)
{
this
.
instea
=
1
this
.
CleanIng
=
parse
[
0
]
if
(
this
.
CleanIng
.
DateColumn
!==
''
)
{
this
.
datevalue
=
1
}
else
{
this
.
datevalue
=
0
}
}
else
{
this
.
detailMH
=
parse
.
map
(
obj
=>
parseInt
(
obj
.
rt
)
+
1
);
this
.
detailML
=
parse
.
map
(
obj
=>
parseInt
(
obj
.
ct
)
+
1
);
this
.
detailYH
=
parse
.
map
(
obj
=>
parseInt
(
obj
.
re
)
+
1
);
this
.
detailYL
=
parse
.
map
(
obj
=>
parseInt
(
obj
.
ce
)
+
1
);
this
.
instea
=
this
.
detailMH
.
length
;
}
this
.
open
=
true
;
this
.
title
=
"
修改规则详情
"
;
});
}
else
{
this
.
msgError
(
"
上级规则已发布,无法修改
"
)
}
},
/** 提交按钮 */
submitForm
()
{
this
.
form
.
cleanIng
=
JSON
.
stringify
(
this
.
CleanIng
);
this
.
form
.
detailMH
=
this
.
detailMH
;
this
.
form
.
detailML
=
this
.
detailML
;
this
.
form
.
detailYH
=
this
.
detailYH
;
this
.
form
.
detailYL
=
this
.
detailYL
;
this
.
form
.
status
=
1
;
this
.
$refs
[
"
form
"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
form
.
id
!=
null
)
{
console
.
log
(
JSON
.
parse
(
this
.
form
.
cleanIng
),
'
2222222222
'
)
updateSuppliesroledetail
(
this
.
form
).
then
(
response
=>
{
this
.
msgSuccess
(
"
修改成功
"
);
this
.
open
=
false
;
this
.
getList
();
});
}
else
{
addSuppliesroledetail
(
this
.
form
).
then
(
response
=>
{
this
.
msgSuccess
(
"
新增成功
"
);
this
.
open
=
false
;
this
.
getList
();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
ids
=
row
.
id
||
this
.
ids
;
const
name
=
row
.
detailName
||
this
.
name
;
this
.
$confirm
(
'
是否确认删除规则详情编号为"
'
+
name
+
'
"的数据项?
'
,
"
警告
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
}).
then
(
function
()
{
return
delSuppliesroledetail
(
ids
);
}).
then
(()
=>
{
this
.
getList
();
this
.
msgSuccess
(
"
删除成功
"
);
})
},
/** 导出按钮操作 */
handleExport
()
{
const
queryParams
=
this
.
queryParams
;
this
.
$confirm
(
'
是否确认导出所有规则详情数据项?
'
,
"
警告
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
}).
then
(
function
()
{
return
exportSuppliesroledetail
(
queryParams
);
}).
then
(
response
=>
{
this
.
download
(
response
.
msg
);
})
}
}
};
</
script
>
This diff is collapsed.
Click to expand it.
ruoyi-ui/src/views/system/suppliesroledetail/index.vue
View file @
acae3d48
...
...
@@ -105,7 +105,7 @@
<pagination
v-show=
"total > 0"
:total=
"total"
:page.sync=
"queryParams.pageNum"
:limit.sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<!-- 添加或修改规则详情对话框 -->
<el-dialog
:title=
"title"
:visible.sync=
"open"
width=
"1300px"
append-to-body
>
<el-dialog
:title=
"title"
:visible.sync=
"open"
width=
"1300px"
append-to-body
@
close=
"Dialog"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"上级规则"
prop=
"roleId"
>
<el-select
v-model=
"form.roleId"
filterable
placeholder=
"请选择关联项"
>
...
...
@@ -125,7 +125,7 @@
<el-row>
<el-col
:span=
"8"
>
<el-form-item
label=
"转换类型"
prop=
"detailYS"
>
<el-radio-group
v-model=
"form.detailYS"
>
<el-radio-group
v-model=
"form.detailYS"
@
change=
"radiovalue"
>
<el-radio
label=
"1"
>
单元格转换
</el-radio>
<el-radio
label=
"2"
>
行转换
</el-radio>
<el-radio
label=
"3"
>
列转换
</el-radio>
...
...
@@ -134,11 +134,22 @@
</el-col>
<el-col
:span=
"16"
>
<el-form-item
v-if=
"form.detailYS !== null"
>
<el-button
type=
"primary"
:disabled=
"isDisable"
@
click=
"addInputs"
>
添加规则
</el-button>
<el-button
type=
"primary"
:disabled=
"isDisable
|| isDelete
"
@
click=
"addInputs"
>
添加规则
</el-button>
</el-form-item>
</el-col>
</el-row>
<div
v-for=
"index in instea"
:key=
'index'
>
<span
v-if=
"isTitle && index == 1"
style=
"color:red;"
>
<b>
物料编码
</b>
</span>
<span
v-if=
"isTitle && index == 2"
style=
"color:red;"
>
<b>
部门名称
</b>
</span>
<span
v-if=
"isTitle && index == 3"
style=
"color:red;"
>
<b>
计量单位
</b>
</span>
<span
v-if=
"isTitle && index == 4"
style=
"color:red;"
>
<b>
费用来源
</b>
</span>
<span
v-if=
"isTittle && index == 1"
style=
"color:red;"
>
<b>
数量
</b>
</span>
<span
v-if=
"isTittle && index == 2"
style=
"color:red;"
>
<b>
金额
</b>
</span>
<span
v-if=
"isTittle && index == 1"
style=
"position: absolute; left:632px;top:342px; z-index: 2;color: red;"
>
<b>
数量
</b>
</span>
<span
v-if=
"isTittle && index == 2"
style=
"position: absolute; left:632px;top:444px; z-index: 2;color: red;"
>
<b>
单价
</b>
</span>
<el-form-item
label=
"表头所在行"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.HeaderRow"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
...
...
@@ -154,6 +165,8 @@
<el-form-item
label=
"物料编码所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.CodeColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"导入表行坐标"
prop=
"detailYH"
class=
"form-item-inline"
v-else
>
<el-input-number
size=
"medium"
v-model=
"detailYH[index - 1]"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
...
...
@@ -168,29 +181,30 @@
<el-input-number
size=
"medium"
v-model=
"CleanIng.NumberColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"
金额
所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-form-item
label=
"
单价
所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.MoneyColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
label=
"日期所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6 "
>
<el-select
v-model=
"datevalue"
placeholder=
"请选择日期所在列"
@
change=
"dateChange"
label=
"日期所在列"
>
<el-form-item
label=
"日期所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-select
v-model=
"datevalue"
placeholder=
"请选择日期所在列"
@
change=
"dateChange"
label=
"日期所在列"
>
<el-option
v-for=
"item in date"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-input-number
style=
"margin-left: 5vw;"
v-if=
"datevalue == 1"
size=
"medium"
v-model=
"CleanIng.DateColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
<el-input-number
style=
"margin-left: 5vw;"
v-if=
"datevalue == 1"
size=
"medium"
v-model=
"CleanIng.DateColumn"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<el-form-item
style=
"display: inline-block;"
>
<el-form-item
label=
"计量单位所在列"
prop=
"CleanIng"
class=
"form-item-inline"
v-if=
"options2id === 6"
>
<el-input-number
size=
"medium"
v-model=
"CleanIng.unit"
:min=
"1"
:step=
"1"
>
1
</el-input-number>
</el-form-item>
<br>
<el-form-item
style=
"display: inline-block;"
v-if=
"!isDelete"
>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"small"
@
click=
"removeInputs(index)"
>
删除
</el-button>
</el-form-item>
</div>
<el-form-item
style=
"display: inline-block;"
v-if=
"isDelete"
>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"small"
@
click=
"removeInputs"
>
删除
</el-button>
</el-form-item>
<div
v-if=
"options2id !== 6 && instea >= 1"
style=
"color: red; margin-left: 2.5vw;"
>
为防止后面步骤出错,导入表和模板表的行列坐标必须为表头所在单元格的行列
</div>
</el-form>
...
...
@@ -202,14 +216,14 @@
</div>
</template>
<
style
>
.form-item-inline
{
.form-item-inline
{
display
:
inline-block
;
margin-right
:
20px
;
}
}
</
style
>
<
script
>
import
{
import
{
listSuppliesroledetail
,
getSuppliesroledetail
,
delSuppliesroledetail
,
...
...
@@ -221,10 +235,10 @@
toggleDisable
,
saveOperation
,
saveSidsta
,
}
from
"
@/api/system/suppliesroledetail
"
;
import
Editor
from
'
@/components/Editor
'
;
}
from
"
@/api/system/suppliesroledetail
"
;
import
Editor
from
'
@/components/Editor
'
;
export
default
{
export
default
{
name
:
"
Suppliesroledetail
"
,
components
:
{
Editor
,
...
...
@@ -238,6 +252,7 @@
value
:
1
,
label
:
'
有
'
}],
ConversionValue
:
''
,
datevalue
:
0
,
// 遮罩层
loading
:
true
,
...
...
@@ -246,6 +261,10 @@
// 选中数组
ids
:
[],
name
:
[],
radiitemValue
:
{
radio
:
''
,
conver
:
''
},
// 非单个禁用
single
:
true
,
// 非多个禁用
...
...
@@ -284,7 +303,11 @@
DepartmentColumn
:
''
,
NumberColumn
:
''
,
MoneyColumn
:
''
,
DateColumn
:
''
DateColumn
:
''
,
unit
:
''
,
expenses
:
''
,
conversion
:
''
,
spare
:
''
},
detailMH
:
[],
detailML
:
[],
...
...
@@ -309,26 +332,64 @@
};
},
watch
:
{
options2id
(
newValue
)
{
if
(
newValue
>=
0
&&
this
.
detailMH
.
length
>=
1
)
{
this
.
instea
=
1
open
()
{
if
(
this
.
open
===
false
)
{
this
.
radiitemValue
.
radio
=
0
this
.
radiitemValue
.
conver
=
0
}
}
},
computed
:
{
isDisable
()
{
return
this
.
instea
>=
1
&&
this
.
options2id
==
6
;
return
(
this
.
instea
>=
1
&&
this
.
options2id
==
6
)
||
(
this
.
radiitemValue
.
radio
==
2
&&
this
.
radiitemValue
.
conver
==
3
&&
this
.
instea
>=
4
)
},
isDelete
()
{
return
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
1
&&
this
.
instea
>=
4
)
||
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
2
&&
this
.
instea
>=
2
)
},
isTitle
()
{
return
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
1
},
isTittle
()
{
return
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
2
}
},
created
()
{
this
.
getList
();
this
.
getnameid
();
},
methods
:
{
empty
()
{
this
.
optionid
=
''
this
.
datevalue
=
0
this
.
radiitemValue
.
radio
=
0
this
.
radiitemValue
.
conver
=
0
this
.
detailMH
=
[]
this
.
detailML
=
[]
this
.
detailYH
=
[]
this
.
detailYL
=
[]
},
Dialog
()
{
this
.
empty
()
},
radiovalue
(
value
)
{
this
.
detailMH
=
[]
this
.
detailML
=
[]
this
.
detailYH
=
[]
this
.
detailYL
=
[]
this
.
instea
=
0
this
.
radiitemValue
.
radio
=
Number
(
value
)
},
dateChange
()
{
this
.
CleanIng
.
DateColumn
=
''
},
handleRadioChange
()
{
handleRadioChange
(
value
)
{
this
.
radiitemValue
.
conver
=
value
this
.
options2id
=
this
.
form
.
convertStatus
this
.
detailMH
=
[]
this
.
detailML
=
[]
...
...
@@ -342,22 +403,67 @@
DepartmentColumn
:
''
,
NumberColumn
:
''
,
MoneyColumn
:
''
,
DateColumn
:
''
DateColumn
:
''
,
unit
:
''
,
expenses
:
''
,
conversion
:
''
,
spare
:
''
}
},
removeInputs
(
index
)
{
if
(
this
.
isDelete
)
{
this
.
instea
=
0
this
.
detailMH
=
[]
this
.
detailML
=
[]
this
.
detailYH
=
[]
this
.
detailYL
=
[]
}
else
{
this
.
detailMH
.
splice
(
index
-
1
,
1
);
this
.
detailML
.
splice
(
index
-
1
,
1
);
this
.
detailYH
.
splice
(
index
-
1
,
1
);
this
.
detailYL
.
splice
(
index
-
1
,
1
);
this
.
instea
=
this
.
instea
-
1
;
}
},
addInputs
()
{
if
((
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
1
)
||
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
2
))
{
if
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
1
)
{
let
i
=
4
-
this
.
instea
this
.
instea
+=
i
if
(
this
.
detailMH
&&
this
.
detailML
&&
this
.
detailYH
&&
this
.
detailYL
)
{
[
this
.
detailMH
,
this
.
detailML
,
this
.
detailYH
,
this
.
detailYL
].
forEach
(
arr
=>
{
while
(
arr
.
length
<
4
)
arr
.
push
(
1
);
});
}
}
if
(
this
.
radiitemValue
.
radio
==
3
&&
this
.
radiitemValue
.
conver
==
2
)
{
let
i
=
2
-
this
.
instea
this
.
instea
+=
i
if
(
this
.
detailMH
&&
this
.
detailML
&&
this
.
detailYH
&&
this
.
detailYL
)
{
[
this
.
detailMH
,
this
.
detailML
,
this
.
detailYH
,
this
.
detailYL
].
forEach
(
arr
=>
{
while
(
arr
.
length
<
2
)
arr
.
push
(
1
);
});
}
}
}
else
{
this
.
instea
+=
1
;
this
.
detailMH
.
push
(
1
)
this
.
detailML
.
push
(
1
)
this
.
detailYH
.
push
(
1
)
this
.
detailYL
.
push
(
1
)
}
},
toggleEnable
(
suppliesRoleDetail
)
{
console
.
log
(
'
你点击了【
'
+
suppliesRoleDetail
.
s
+
'
】的开关控件,当前开关值:
'
+
suppliesRoleDetail
.
status
);
...
...
@@ -405,6 +511,7 @@
},
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
},
...
...
@@ -464,12 +571,13 @@
const
id
=
row
.
id
||
this
.
ids
getSuppliesroledetail
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
radiitemValue
.
conver
=
this
.
form
.
convertStatus
this
.
radiitemValue
.
radio
=
this
.
form
.
detailYS
this
.
options2id
=
response
.
data
.
convertStatus
const
detailContent
=
response
.
data
.
detailContent
;
const
parse
=
JSON
.
parse
(
detailContent
);
console
.
log
(
response
.
data
)
this
.
instea
=
parse
.
length
if
(
this
.
options2id
===
6
)
{
this
.
instea
=
1
this
.
CleanIng
=
parse
[
0
]
if
(
this
.
CleanIng
.
DateColumn
!==
''
)
{
this
.
datevalue
=
1
...
...
@@ -501,7 +609,7 @@
this
.
$refs
[
"
form
"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
form
.
id
!=
null
)
{
console
.
log
(
JSON
.
parse
(
this
.
form
.
cleanIng
),
'
2222222222
'
)
console
.
log
(
JSON
.
parse
(
this
.
form
.
cleanIng
),
'
2222222222
'
)
updateSuppliesroledetail
(
this
.
form
).
then
(
response
=>
{
this
.
msgSuccess
(
"
修改成功
"
);
this
.
open
=
false
;
...
...
@@ -547,5 +655,5 @@
})
}
}
};
};
</
script
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ruoyi-ui/vue.config.js
View file @
acae3d48
...
...
@@ -21,7 +21,6 @@ module.exports = {
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
outputDir
:
'
dist
'
,
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir
:
'
static
'
,
// 是否开启eslint保存检测,有效值:ture | false | 'error'
lintOnSave
:
false
,
//process.env.NODE_ENV === 'development'
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
...
...
@@ -34,9 +33,9 @@ module.exports = {
proxy
:
{
// detail: https://cli.vuejs.org/config/#devserver-proxy
[
process
.
env
.
VUE_APP_BASE_API
]:
{
// target: `http://192.168.10.105:5001
`,
target
:
`http://192.168.0.111:8080
`
,
// target: `http://localhost:5001`,
target
:
`http://localhost:8080`
,
//
target: `http://localhost:8080`,
changeOrigin
:
true
,
pathRewrite
:
{
...
...
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