Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
GaoQuYingJiH5-ASD
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
xinzhedeai
GaoQuYingJiH5-ASD
Commits
1243bdfa
Commit
1243bdfa
authored
May 14, 2024
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
爱山东 危险作业备案
parent
606f723d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
401 additions
and
0 deletions
+401
-0
dw-list-detail.html
views/dw-list-detail.html
+111
-0
dw-list-detail.js
views/dw-list-detail.js
+188
-0
dw-list.html
views/dw-list.html
+49
-0
dw-list.js
views/dw-list.js
+53
-0
No files found.
views/dw-list-detail.html
0 → 100644
View file @
1243bdfa
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, viewprot-fit:cover"
>
<title>
危险作业备案-详情
</title>
<!-- <script src="https://cdn.bootcdn.net/ajax/libs/pdf.js/2.0.193/pdf.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/pdf.js/2.0.193/pdf.worker.min.js"></script> -->
<script
type=
"text/javascript"
src=
"../js/includeHead.js"
></script>
<style>
html
,
body
{
background-color
:
#fff
;
}
.pd-01rem
{
padding-bottom
:
0.1rem
;
}
/* 表单相关 */
.formValue
{
float
:
right
;
}
.formSubmitBtnWrapper
{
display
:
flex
;
justify-content
:
center
;
margin-top
:
0.2rem
;
margin-bottom
:
0.2rem
;
}
.formSubmitBtnWrapper
.van-button
{
width
:
4rem
;
}
/**
* 框架样式覆盖修改
*/
.van-cell__value
{
overflow
:
unset
;
}
.van-cell
:after
{
border-bottom
:
none
;}
.van-radio-group--horizontal
{
float
:
right
;}
</style>
</head>
<body>
<div
id=
"app"
>
<div
class=
"content"
>
<van-cell-group>
<van-field
v-model=
"form.name"
:disabled=
"disabled"
label=
"危险作业"
placeholder=
""
/>
</van-cell-group>
<van-cell-group
:class=
"{'disable-van-cell': disabled}"
>
<van-cell
is-link
@
click=
"showPopup('showPopup4hdInspectDate')"
>
作业时间
<span
class=
"formValue"
>
{{form.workTime}}
</span></van-cell>
<van-popup
v-model=
"showPopup4hdInspectDate"
position=
"bottom"
:style=
"{ height: '30%' }"
>
<van-datetime-picker
v-model=
"hdInspectDateModel"
type=
"date"
title=
"选择年月日"
@
confirm=
"confirm4hdInspectDate"
@
cancel=
"showPopup4hdInspectDate=false"
/>
</van-cell-group>
<van-cell-group>
<van-field
v-model=
"form.workNumber"
:disabled=
"disabled"
label=
"作业人数"
placeholder=
""
/>
</van-cell-group>
<van-cell-group>
<van-field
v-model=
"form.mainPlace"
:disabled=
"disabled"
label=
"主要场所"
placeholder=
""
/>
</van-cell-group>
<van-cell-group>
<van-field
v-model=
"form.reportPer"
:disabled=
"disabled"
label=
"报告人"
placeholder=
""
/>
</van-cell-group>
<van-cell-group>
<van-field
v-model=
"form.perTel"
:disabled=
"disabled"
label=
"联系方式"
placeholder=
""
/>
</van-cell-group>
<van-cell-group
:class=
"{'disable-van-cell': disabled}"
>
<van-cell
is-link
@
click=
"showPopup('showPopup4hdRectificationDate')"
>
报告时间
<span
class=
"formValue"
>
{{form.uploadDate}}
</span></van-cell>
<van-popup
v-model=
"showPopup4hdRectificationDate"
position=
"bottom"
:style=
"{ height: '30%' }"
>
<van-datetime-picker
v-model=
"hdRectificationDateModel"
type=
"date"
title=
"选择年月日"
@
confirm=
"confirm4hdRectificationDate"
@
cancel=
"showPopup4hdRectificationDate=false"
/>
</van-popup>
</van-cell-group>
<van-cell-group>
<van-field
v-model=
"form.remark"
:disabled=
"disabled"
label=
"备注"
placeholder=
""
/>
</van-cell-group>
<van-cell-group
:class=
"{'disable-van-cell': true}"
>
<van-cell>
文件预览:
<div
style=
"width: 6.5rem;"
>
<van-image
v-show=
"form.filePathList[0].indexOf('.png')>-1 || form.filePathList[0].indexOf('.jpg')>-1 || || form.filePathList[0].indexOf('.jpeg')>-1"
width=
"100"
height=
"100"
:src=
"previewUrl+'/' + form.filePathList[0]"
/>
<div
id=
"pdfViewer"
></div>
<!-- <a v-show="form.filePathList[0].indexOf('.pdf')>-1" :href="previewUrl+'/' + form.filePathList[0]" target="_blank" style="text-decoration: underline; color:#4c4cc2; "
>{{ form.filePathList[0] }}
</a> -->
<span
@
click=
"previewFile"
>
{{ form.filePathList[0] }}
</span>
<span
v-show=
"form.filePathList[0] && !disabled"
style=
"font-weight: bold; cursor: pointer;"
@
click=
"form.filePathList=[];fileList=[]"
>
删除
</span>
</div></van-cell>
</van-cell-group>
<van-cell-group
:class=
"{'disable-van-cell': disabled}"
>
<van-cell>
文件:
<div
style=
"width: 2.5rem;"
>
<van-uploader
v-model=
"fileList"
accept=
".jpg,.jpeg,.png,.pdf"
:preview-image=
"false"
:before-upload=
"beforeUpload"
:after-read=
"afterRead"
:max-count=
"1"
:deletable=
"!disabled"
:preview-full-image=
"false"
>
<van-button
size=
"mini"
icon=
"plus"
type=
"primary"
>
上传文件
</van-button>
</van-uploader>
</div></van-cell>
</van-cell-group>
<div
class=
"formSubmitBtnWrapper"
v-if=
"!disabled"
><van-button
type=
"info"
size=
"small"
@
click=
"submit"
>
提交
</van-button></div>
</div>
</div>
</body>
</html>
\ No newline at end of file
views/dw-list-detail.js
0 → 100644
View file @
1243bdfa
/**
* author: dabao
*/
var
VUE
=
null
window
.
addEventListener
(
"
load
"
,
function
()
{
VUE
=
new
Vue
({
el
:
'
#app
'
,
data
()
{
return
{
previewUrl
:
axios
.
defaults
.
baseURL
,
form
:
{
id
:
''
,
companyId
:
''
,
name
:
""
,
workTime
:
""
,
workNumber
:
''
,
mainPlace
:
''
,
reportPer
:
''
,
perTel
:
''
,
remark
:
''
,
uploadDate
:
""
,
filePathList
:
[]
},
// 企业id
companyId
:
localStorage
.
getItem
(
'
companyId
'
),
disabled
:
false
,
// 检查日期的模态框
hdInspectDateModel
:
''
,
// 时间的临时model值
showPopup4hdInspectDate
:
false
,
// 整改日期模态框
hdRectificationDateModel
:
''
,
showPopup4hdRectificationDate
:
false
,
fileList
:
[],
}
},
mounted
()
{
console
.
log
(
'
************
'
)
// if (gemhoUtil.getParameter('type') === 'detail') {
// this.disabled = false
// this.detail()
// } else if (gemhoUtil.getParameter('type') === 'edit') {
// this.detail()
// } else { // 新增
// this.disabled = true
// this.resetData()
// }
},
methods
:
{
previewFile
(){
// // PDF.js启动代码
// var pdfjsLib = window['pdfjs-dist/build/pdf'];
// // PDF文件路径
// var pdfUrl = this.previewFile + '/' + this.form.filePathList[0];
// // 获取渲染PDF的容器
// var container = document.getElementById('pdf-viewer');
// // 异步加载PDF文件
// pdfjsLib.getDocument(pdfUrl).promise.then(function(pdf) {
// pdf.getPage(1).then(function(page) {
// var canvas = document.createElement('canvas');
// container.appendChild(canvas);
// var viewport = page.getViewport({ scale: 1 });
// canvas.height = viewport.height;
// canvas.width = viewport.width;
// page.render({
// canvasContext: canvas.getContext('2d'),
// viewport: viewport
// });
// });
// });
},
beforeUpload
(
file
)
{
console
.
log
(
'
beforeUpload
'
,
file
)
// 在文件上传之前的处理逻辑,例如校验文件大小、文件类型等
return
true
;
// 返回 true 继续上传,返回 false 中止上传
},
afterRead
(
file
)
{
console
.
log
(
'
afterRead
'
,
file
)
// 文件读取完成后的处理逻辑
const
formData
=
new
FormData
();
formData
.
append
(
'
file
'
,
file
.
file
);
// 通过FormData构建要上传的文件数据
formData
.
append
(
'
modelName
'
,
'
dangerjob
'
);
// 发送HTTP POST请求
fetch
(
this
.
previewUrl
+
'
/api/common/upload
'
,
{
method
:
'
POST
'
,
body
:
formData
})
.
then
(
response
=>
{
if
(
response
.
ok
)
{
return
response
.
json
();
}
throw
new
Error
(
'
Network response was not ok.
'
);
})
.
then
(
data
=>
{
console
.
log
(
data
);
// 处理后端返回的数据
// 可根据后端返回的数据做进一步处理,如显示上传成功信息等
this
.
form
.
filePathList
=
data
.
body
?
[
data
.
body
]
:
[]
})
.
catch
(
error
=>
{
console
.
error
(
'
There has been a problem with your fetch operation:
'
,
error
);
});
},
resetData
()
{
// 使用 Object.assign 来重写 this.$data,以达到重置 data 的目的
Object
.
assign
(
this
.
$data
,
this
.
$options
.
data
.
call
(
this
));
},
showPopup
(
popupType
)
{
if
(
!
this
.
disabled
)
{
this
[
popupType
]
=
true
}
},
detail
()
{
http
.
get
(
'
/api/dangerJobReport/page
'
,
{
page
:
0
,
// 每次请求增加下一页
size
:
1
,
// companyId: gemhoUtil.getParameter('companyId'),
id
:
gemhoUtil
.
getParameter
(
'
dwId
'
),
sort
:
'
id,asc
'
,
}).
then
((
res
)
=>
{
console
.
log
(
'
响应结果
'
,
res
.
content
)
this
.
form
=
res
.
content
[
0
]
})
},
submit
()
{
if
(
!
this
.
form
.
name
)
{
vant
.
Dialog
.
alert
({
message
:
'
请输入危险作业备案名称
'
,
})
return
;
}
if
(
!
this
.
form
.
workTime
)
{
vant
.
Dialog
.
alert
({
message
:
'
请选择作业时间
'
,
})
return
;
}
// let formData = new FormData()
// for (const key of Object.keys(this.form)) {
// formData.append(key, this.form[key]);
// }
this
.
form
.
companyId
=
this
.
companyId
var
url
=
"
/api/dangerJobReport/create
"
http
.
post
(
url
,
this
.
form
).
then
((
res
)
=>
{
console
.
log
(
'
添加结果
'
,
res
)
vant
.
Toast
({
message
:
'
操作成功
'
,
})
if
(
!
this
.
form
.
id
)
{
// 添加时则
location
.
reload
()
}
})
},
formatDate
(
date
,
type
)
{
var
ymd
=
`
${
date
.
getFullYear
()
+
1
}
-
${((
date
.
getMonth
()
+
1
)
>
9
?
''
:
'
0
'
)
+
(
date
.
getMonth
()
+
1
)}
-
${(
date
.
getDate
()
>
9
?
''
:
'
0
'
)
+
date
.
getDate
()}
`
;
if
(
type
===
'
YYYY-MM-DD HH:MM:SS
'
)
{
return
ymd
+
'
00:00:00
'
;
}
return
ymd
},
confirm4hdInspectDate
(
value
)
{
console
.
log
(
'
value
'
,
value
)
this
.
form
.
workTime
=
this
.
formatDate
(
new
Date
(
value
))
this
.
showPopup4hdInspectDate
=
false
},
confirm4hdRectificationDate
(
value
)
{
console
.
log
(
'
value
'
,
value
)
this
.
form
.
uploadDate
=
this
.
formatDate
(
new
Date
(
value
))
this
.
showPopup4hdRectificationDate
=
false
},
},
});
});
\ No newline at end of file
views/dw-list.html
0 → 100644
View file @
1243bdfa
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, viewprot-fit:cover"
>
<title>
危险作业备案-列表
</title>
<script
type=
"text/javascript"
src=
"../js/includeHead.js"
></script>
<style>
/**
* 框架样式覆盖修改
*/
.van-cell__value
{
overflow
:
unset
;
}
.van-cell
:after
{
border-bottom
:
none
;}
</style>
</head>
<body>
<div
id=
"app"
>
<div
class=
"searchfuntionBtnWrapper"
>
<van-button
type=
"info"
size=
"small"
@
click=
"add"
>
新增
</van-button>
</div>
<div
class=
"content"
v-cloak
>
<van-list
v-model:loading=
"loading"
:offset=
"10"
:finished=
"finished"
finished-text=
"没有更多了"
@
load=
"getList"
>
<van-cell
v-for=
"(item, index) in list"
:key=
"item"
>
<div
class=
"list-item-wrapper"
>
<p
class=
""
>
危险作业:{{item.name}}
</p>
<p
class=
""
>
作业人数:{{item.workNumber}}
</p>
<p
class=
""
>
作业时间:{{item.workTime}}
</p>
<p
class=
""
>
主要场所:{{item.mainPlace}}
</p>
<div
class=
"list-function-btn-wrapper pd-01rem"
>
<van-button
type=
"info"
size=
"mini"
@
click=
"detail(item)"
>
查看
</van-button>
<van-button
type=
"info"
size=
"mini"
@
click=
"edit(item)"
>
编辑
</van-button>
</div>
</div>
</van-cell>
</van-list>
</div>
</div>
</body>
</html>
\ No newline at end of file
views/dw-list.js
0 → 100644
View file @
1243bdfa
/**
* author: dabao
*/
var
VUE
=
null
window
.
addEventListener
(
"
load
"
,
function
()
{
VUE
=
new
Vue
({
el
:
'
#app
'
,
data
()
{
return
{
value
:
''
,
list
:
[],
loading
:
false
,
finished
:
false
,
page
:
0
,
size
:
10
,
total
:
0
}
},
mounted
()
{
this
.
getList
()
},
methods
:
{
add
(){
gemhoUtil
.
navigatePage
(
'
./dw-list-detail.html?type=add
'
)
},
detail
(
item
){
gemhoUtil
.
navigatePage
(
'
./dw-list-detail.html?dwId=
'
+
item
.
id
+
'
&type=detail
'
)
},
edit
(
item
){
gemhoUtil
.
navigatePage
(
'
./dw-list-detail.html?dwId=
'
+
item
.
id
+
'
&type=edit
'
)
},
getList
(){
http
.
get
(
'
/api/dangerJobReport/page
'
,{
page
:
this
.
page
++
,
// 每次请求增加下一页
size
:
this
.
size
,
// companyId: gemhoUtil.getParameter('companyId'),
county
:
localStorage
.
getItem
(
'
appCounty
'
),
sort
:
'
id,desc
'
,
}).
then
((
res
)
=>
{
this
.
loading
=
false
;
// 加载状态结束
this
.
list
.
push
(...
res
.
content
);
this
.
total
=
res
.
totalElements
if
(
this
.
page
*
this
.
size
>=
this
.
total
){
this
.
finished
=
true
;
// 下滑不在刷新数据
}
})
}
},
});
});
\ 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