Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zghywpc-vue
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李苏
zghywpc-vue
Commits
ccc1fcd7
Commit
ccc1fcd7
authored
Jan 08, 2025
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
a632c8be
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
230 additions
and
6 deletions
+230
-6
index.vue
src/views/fmegl/fmekpigl/biao/index.vue
+2
-2
dialog.vue
src/views/fmegl/fmekpigl/biao/kpiImportButton/dialog.vue
+1
-1
index.vue
src/views/jyfkgl/ywsjlr/index.vue
+4
-3
dialog.vue
src/views/jyfkgl/ywsjlr/kpiImportButton/dialog.vue
+159
-0
index.vue
src/views/jyfkgl/ywsjlr/kpiImportButton/index.vue
+64
-0
No files found.
src/views/fmegl/fmekpigl/biao/index.vue
View file @
ccc1fcd7
...
...
@@ -3,7 +3,7 @@
* @Author: lisu lisu@gavelinfo.com
* @Date: 2024-09-19 10:55:27
* @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2025-01-08 1
5:50:43
* @LastEditTime: 2025-01-08 1
7:16:41
* @FilePath: /zghywpc-vue/src/views/fmegl/fmekpigl/biao/index.vue
-->
<
template
>
...
...
@@ -14,7 +14,7 @@
<
template
#
toolbar=
"ctx"
>
<!-- 嵌入默认页面工具栏的插槽 ctx.pagePage来操作默认页面 -->
<!--
<el-button
@
click=
"demo(ctx.basePage)"
size=
'mini'
type=
"primary"
>
示例按钮
</el-button>
-->
<
Kpi
ImportButton
@
success=
"()=>
{ctx.basePage.refresh()}" :url="'fme/ufmekpi/import'" />
<ImportButton
@
success=
"()=>
{ctx.basePage.refresh()}" :url="'fme/ufmekpi/import'" />
</
template
>
</BasePage>
...
...
src/views/fmegl/fmekpigl/biao/kpiImportButton/dialog.vue
View file @
ccc1fcd7
...
...
@@ -24,7 +24,7 @@
</DefaultDialog>
</
template
>
<
script
>
/* element 不支持formData格式 该组件在上传前钩子被该写,非原生请求方法请==注意 */
import
request
from
'common/src/utils/request'
...
...
src/views/jyfkgl/ywsjlr/index.vue
View file @
ccc1fcd7
...
...
@@ -3,7 +3,7 @@
* @Author: lisu lisu@gavelinfo.com
* @Date: 2024-09-19 10:55:27
* @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2025-01-0
3 18:00:32
* @LastEditTime: 2025-01-0
8 17:15:33
* @FilePath: /zghywpc-vue/src/views/jyfkgl/ywsjlr/index.vue
-->
<
template
>
...
...
@@ -14,7 +14,7 @@
<
template
#
toolbar=
"ctx"
>
<!-- 嵌入默认页面工具栏的插槽 ctx.pagePage来操作默认页面 -->
<!--
<el-button
@
click=
"demo(ctx.basePage)"
size=
'mini'
type=
"primary"
>
示例按钮
</el-button>
-->
<ImportButton
@
success=
"()=>
{ctx.basePage.refresh()}" :url="'yhlywpc/uywxx/import'" />
<
Kpi
ImportButton
@
success=
"()=>
{ctx.basePage.refresh()}" :url="'yhlywpc/uywxx/import'" />
</
template
>
</BasePage>
...
...
@@ -22,6 +22,7 @@
<
script
>
import
Edit
from
'./edit.vue'
import
KpiImportButton
from
'./kpiImportButton'
export
default
{
name
:
'ywsjgl'
,
data
()
{
...
...
@@ -220,7 +221,7 @@
// demo(ctx){}
},
components
:
{
Edit
Edit
,
KpiImportButton
}
}
...
...
src/views/jyfkgl/ywsjlr/kpiImportButton/dialog.vue
0 → 100644
View file @
ccc1fcd7
<
template
>
<DefaultDialog
:app=
'app'
>
<div
v-loading=
'loading'
slot=
"form"
style=
"display: flex;padding: 20px;padding-bottom: 40px;"
>
<el-upload
:accept=
"'.xls,.xlsx,.csv'"
:before-upload=
"BeforeUnloadEvent"
:headers=
"
{
'Content-Type': 'multipart/form-data'
}" :on-exceed='exceed' :limit='1' class="upload-demo" ref="upload" :action="action()" :on-preview="handlePreview"
:on-remove="handleRemove" :file-list="fileList" :on-success='success' :on-error='error'
:auto-upload="false">
<el-button
slot=
"trigger"
size=
"small"
type=
"primary"
>
选择文件
</el-button>
<div
class=
"flex"
style=
"margin-top: 10px;"
>
<span
style=
"line-height: 30px;width: 45px;font-size: 12px;"
>
日期:
</span>
<el-date-picker
type=
"date"
v-model=
"date"
/>
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
>
如没有模板文件请点击
<span
@
click=
"toDownload"
style=
"color: cornflowerblue;cursor: pointer;"
>
模板下载
</span>
。
</div>
</el-upload>
</div>
<div
slot=
"reFooter"
class=
"refooter"
>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"app.showDialog=false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"submitUpload"
>
导 入
</el-button>
</span>
</div>
</DefaultDialog>
</
template
>
<
script
>
import
request
from
'common/src/utils/request'
import
{
importTemp
}
from
'./api.js'
const
baseurl
=
process
.
env
.
VUE_APP_BASE_API
export
default
{
props
:
{
app
:
{
type
:
Object
,
default
:
()
=>
{
return
{}
}
}
},
async
mounted
()
{
},
data
()
{
return
{
date
:
new
Date
().
getTime
(),
fileList
:
[],
loading
:
false
,
}
},
methods
:
{
readExcelFile
(
file
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
reader
=
new
FileReader
();
reader
.
onload
=
(
e
)
=>
{
const
data
=
new
Uint8Array
(
e
.
target
.
result
);
const
workbook
=
XLSX
.
read
(
data
,
{
type
:
'array'
});
const
worksheet
=
workbook
.
Sheets
[
workbook
.
SheetNames
[
0
]];
const
jsonData
=
XLSX
.
utils
.
sheet_to_json
(
worksheet
,
{
header
:
1
});
resolve
(
jsonData
);
};
reader
.
onerror
=
(
e
)
=>
{
reject
(
e
);
};
reader
.
readAsArrayBuffer
(
file
);
})},
BeforeUnloadEvent
(
file
)
{
this
.
loading
=
true
/* 拦截默认上传事件 */
let
formData
=
new
FormData
();
formData
.
append
(
'file'
,
file
)
formData
.
append
(
'date'
,
this
.
date
)
importTemp
(
formData
,
this
.
app
.
url
).
then
(
res
=>
{
if
(
res
.
success
)
{
this
.
$success
(
'上传成功'
)
this
.
app
.
showDialog
=
false
this
.
$emit
(
'success'
)
}
}).
finally
(
res
=>
{
this
.
loading
=
false
})
return
false
},
action
()
{
/* 作废 */
let
baseUrl
=
request
.
defaults
.
baseURL
let
url
=
this
.
app
.
url
if
(
url
[
0
]
===
'/'
)
{
url
=
url
.
substring
(
1
);
}
rconsole
.
log
(
baseUrl
+
url
)
return
baseUrl
+
'/'
+
url
},
success
()
{
/* 作废 */
// this.$success('上传成功')
// this.app.showDialog = false
// this.$emit('success')
},
error
()
{
this
.
$error
(
'上传失败'
)
},
exceed
()
{
this
.
$warning
(
'只能选择一个文件!'
)
},
submitUpload
()
{
if
(
this
.
$refs
.
upload
.
uploadFiles
.
length
==
0
)
{
this
.
$warning
(
'请选择一条数据!'
)
}
else
{
this
.
$refs
.
upload
.
submit
();
}
},
handleRemove
(
file
,
fileList
)
{
},
handlePreview
(
file
)
{
rconsole
.
log
(
file
);
this
.
readExcelFile
(
file
.
raw
).
then
((
data
)
=>
{
// 在这里处理读取到的Excel数据
}).
catch
((
error
)
=>
{
console
.
error
(
error
);
});
},
toDownload
()
{
/* let url=this.app.url+"/template/download"
this.$cDownload(url, {
}) */
/* 新版下载 */
let
url
=
this
.
app
.
url
+
"/template/download"
let
userToken
=
null
this
.
$post
(
'/userToken'
,{}).
then
(
res
=>
{
userToken
=
res
.
data
.
userToken
let
a
=
document
.
createElement
(
'a'
)
a
.
style
.
display
=
'none'
;
a
.
target
=
'_blank'
a
.
href
=
`
${
baseurl
}
/
${
url
}
?userToken=
${
userToken
}
`
document
.
body
.
appendChild
(
a
)
a
.
click
()
document
.
body
.
removeChild
(
a
)
})
}
}
}
</
script
>
<
style
scoped
>
</
style
>
src/views/jyfkgl/ywsjlr/kpiImportButton/index.vue
0 → 100644
View file @
ccc1fcd7
<
template
>
<div
style=
"display: inline-block;margin-right: 0px;"
class=
""
>
<el-button
@
click=
"dr"
size=
"mini"
type=
"primary"
>
{{
name
}}
</el-button>
<Dialog
@
success=
'success'
v-if=
'showDialog'
:app=
'this'
/>
</div>
</
template
>
<
script
>
import
{
importTemp
}
from
'./api.js'
import
Dialog
from
'./dialog.vue'
export
default
{
props
:
{
name
:
{
type
:
String
,
default
:
'导入'
},
url
:
{
type
:
String
,
default
:
''
},
params
:
{
type
:
Object
,
default
:
()
=>
{
return
{}
}
},
exportName
:
{
type
:
String
,
default
:
'模板.xlsx'
}
},
components
:
{
Dialog
},
data
()
{
return
{
DialogWidth
:
'35vw'
,
showDialog
:
false
,
DialogTitle
:
'导入'
}
},
methods
:
{
success
(){
this
.
$emit
(
'success'
)
},
dr
()
{
if
(
this
.
url
){
this
.
showDialog
=
true
}
else
{
throw
Error
(
'no url'
)
}
},
}
}
</
script
>
<
style
>
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment