Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
patzn-cloud-web-h5app-drs
Overview
Overview
Details
Activity
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
zhuxiaomei
patzn-cloud-web-h5app-drs
Commits
9c66bda5
Commit
9c66bda5
authored
Oct 30, 2020
by
zhuxiaomei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地点和货架
parent
b2ebe949
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
335 additions
and
57 deletions
+335
-57
package.json
package.json
+2
-1
index.html
public/index.html
+2
-0
sampling-place.js
src/api/drs/sampling-place.js
+11
-0
sampling-plan.js
src/api/drs/sampling-plan.js
+3
-0
sampling-shelf.js
src/api/drs/sampling-shelf.js
+12
-0
index.js
src/api/index.js
+2
-0
GoodsShelves.vue
src/page/sampling-task/GoodsShelves.vue
+75
-24
SamplingLocation.vue
src/page/sampling-task/SamplingLocation.vue
+79
-23
SamplingTask.vue
src/page/sampling-task/SamplingTask.vue
+20
-8
SelectLocation.vue
src/page/sampling-task/components/SelectLocation.vue
+127
-0
main.less
src/styles/main.less
+1
-0
vue.config.js
vue.config.js
+1
-1
No files found.
package.json
View file @
9c66bda5
...
...
@@ -42,7 +42,8 @@
"parser"
:
"babel-eslint"
},
"globals"
:
{
"BMap"
:
true
"BMap"
:
true
,
"AMap"
:
true
},
"rules"
:
{}
},
...
...
public/index.html
View file @
9c66bda5
...
...
@@ -17,5 +17,7 @@
<!--</noscript>-->
<div
id=
"app"
></div>
<!-- built files will be auto injected -->
<script
src=
"https://webapi.amap.com/maps?v=1.4.15&key=33d56f06483ab332151b14e85bbb8405"
></script>
</body>
</html>
src/api/drs/sampling-place.js
0 → 100644
View file @
9c66bda5
/**
* 抽样计划表相关
*/
import
http
from
'../http'
export
default
{
page
:
data
=>
http
.
post
(
'/drs/v1/sampling_place/page'
,
data
).
then
(
res
=>
res
),
pageApp
:
data
=>
http
.
post
(
'/drs/v1/sampling_place/page_app'
,
data
).
then
(
res
=>
res
),
edit
:
data
=>
http
.
put
(
'/drs/v1/sampling_place/'
+
data
.
id
,
data
.
obj
).
then
(
res
=>
res
),
}
src/api/drs/sampling-plan.js
View file @
9c66bda5
...
...
@@ -6,6 +6,9 @@ import http from '../http'
export
default
{
page
:
data
=>
http
.
post
(
'/drs/v1/sampling_plan/page'
,
data
).
then
(
res
=>
res
),
pageApp
:
data
=>
http
.
post
(
'/drs/v1/sampling_plan/page_app'
,
data
).
then
(
res
=>
res
),
acceptFinish
:
data
=>
http
.
post
(
'/drs/v1/sampling_plan/accept_or_finish_task'
,
data
).
then
(
res
=>
res
),
getById
:
id
=>
http
.
get
(
'/drs/v1/sampling_plan/'
+
id
).
then
(
res
=>
res
),
savePlace
:
data
=>
http
.
post
(
'/drs/v1/sampling_plan/save_place_random'
,
data
).
then
(
res
=>
res
),
}
src/api/drs/sampling-shelf.js
0 → 100644
View file @
9c66bda5
/**
* 双随机抽样货架表相关
*/
import
http
from
'../../api/http'
export
default
{
page
:
data
=>
http
.
post
(
'/drs/v1/sampling_shelf/page'
,
data
).
then
(
res
=>
res
),
add
:
data
=>
http
.
post
(
'/drs/v1/sampling_shelf/'
,
data
).
then
(
res
=>
res
),
edit
:
data
=>
http
.
put
(
'/drs/v1/sampling_shelf/'
+
data
.
id
,
data
.
obj
).
then
(
res
=>
res
),
deleteByIds
:
ids
=>
http
.
delete
(
'/drs/v1/sampling_shelf/?ids='
+
ids
).
then
(
res
=>
res
),
getById
:
id
=>
http
.
get
(
'/drs/v1/sampling_shelf/'
+
id
).
then
(
res
=>
res
),
}
src/api/index.js
View file @
9c66bda5
...
...
@@ -27,3 +27,5 @@ export {default as message} from './message/message'
* drs
*/
export
{
default
as
samplingPlan
}
from
'./drs/sampling-plan'
export
{
default
as
samplingPlace
}
from
'./drs/sampling-place'
export
{
default
as
samplingShelf
}
from
'./drs/sampling-shelf'
src/page/sampling-task/GoodsShelves.vue
View file @
9c66bda5
<
template
>
<div>
<div
class=
"layout-cont-btn"
>
<!--下拉刷新 https://vant-contrib.gitee.io/vant/#/zh-CN/pull-refresh-->
<van-pull-refresh
v-model=
"refreshing"
@
refresh=
"_request"
>
<van-pull-refresh
v-model=
"refreshing"
@
refresh=
"_refresh"
>
<van-list
v-model=
"loading"
:finished=
"finished"
finished-text=
"没有更多了"
@
load=
"_load"
>
<van-swipe-cell
v-for=
"item in resultList"
:key=
"item.name"
>
<div
class=
"result-item"
@
click=
"_goto(item)"
>
<div>
货架名称:
{{
item
.
placeN
ame
}}
</div>
<div>
货架名称:
{{
item
.
n
ame
}}
</div>
</div>
<template
#
right
>
<van-button
square
type=
"danger"
text=
"删除"
class=
"swipe-cell-btn"
@
click=
"_del(item.id)"
></van-button>
</
template
>
</van-swipe-cell>
</van-list>
</van-pull-refresh>
</div>
<div
class=
"bottom-btn"
>
<van-button
type=
"info"
block
@
click=
"
_add
"
>
添加货架
</van-button>
<van-button
type=
"info"
block
@
click=
"
showAdd=true
"
>
添加货架
</van-button>
</div>
<van-popup
v-model=
"showAdd"
round
>
<div
style=
"margin: 20px auto 30px;text-align: center"
>
添加货架
</div>
<van-field
v-model=
"name"
label=
"货架"
placeholder=
"请输入货架"
></van-field>
<div
style=
"text-align: center;margin: 20px"
>
<van-button
type=
"info"
@
click=
"_add"
>
保存
</van-button>
</div>
</van-popup>
</div>
</template>
<
script
>
import
{
samplingShelf
}
from
'../../api'
export
default
{
name
:
"GoodsShelves"
,
data
()
{
return
{
resultList
:
[{
placeItem
:
2322
}],
locId
:
this
.
$route
.
locId
,
refreshing
:
false
showAdd
:
false
,
resultList
:
[],
page
:
1
,
rows
:
10
,
refreshing
:
false
,
//刷新中...
loading
:
false
,
//加载中...
finished
:
false
,
//没有更多数据
placeId
:
this
.
$route
.
query
.
placeId
,
name
:
''
,
//货架名
}
},
mounted
()
{
this
.
_
request
()
this
.
_
getData
()
},
methods
:
{
_request
:
async
function
()
{
// let result = await samplingPlan.getShelves(this.locId)
// if (result) {
// this.resultList = result.records
// this.refreshing = false
//
// }
},
_del
:
async
function
()
{
// let reuslt = await samplingPlan.delShelves(id)
// if (reuslt) {
// this.$toast('操作成功!')
// }
},
_add
(){
_refresh
()
{
this
.
page
=
1
this
.
_getData
()
},
_searchParams
()
{
let
data
=
{
page
:
this
.
page
,
rows
:
this
.
rows
,
placeId
:
this
.
placeId
};
return
this
.
$serializeForm
(
data
)
},
_getData
:
async
function
()
{
let
result
=
await
samplingShelf
.
page
(
this
.
_searchParams
())
this
.
resultList
=
[...(
this
.
page
===
1
?
[]
:
this
.
resultList
),
...
result
.
records
]
this
.
refreshing
=
false
this
.
loading
=
false
if
(
this
.
resultList
.
length
===
result
.
total
)
{
this
.
finished
=
true
}
},
_load
()
{
this
.
page
=
this
.
page
+
1
;
this
.
_getData
()
},
_del
:
async
function
(
id
)
{
let
result
=
await
samplingShelf
.
deleteByIds
([
id
])
if
(
result
)
{
this
.
$toast
(
'操作成功!'
)
this
.
_refresh
()
}
},
_add
()
{
if
(
this
.
name
===
''
)
{
this
.
$toast
(
'请输入货架'
)
}
else
{
this
.
_addOk
()
}
},
_addOk
:
async
function
()
{
let
result
=
await
samplingShelf
.
add
({
name
:
this
.
name
,
placeId
:
this
.
placeId
})
if
(
result
)
{
this
.
$toast
(
'操作成功!'
)
this
.
showAdd
=
false
this
.
name
=
''
this
.
_refresh
()
}
},
}
}
</
script
>
...
...
src/page/sampling-task/SamplingLocation.vue
View file @
9c66bda5
<
template
>
<div>
<div
class=
"layout-cont-btn"
>
<van-pull-refresh
v-model=
"refreshing"
@
refresh=
"_request"
>
<van-pull-refresh
v-model=
"refreshing"
@
refresh=
"_refresh"
>
<van-list
v-model=
"loading"
:finished=
"finished"
finished-text=
"没有更多了"
@
load=
"_load"
>
<van-swipe-cell
v-for=
"item in resultList"
:key=
"item.name"
>
<div
class=
"result-item"
@
click=
"_goto(item)"
>
<div>
地点:
{{
item
.
placeN
ame
}}
</div>
<div>
地点:
{{
item
.
n
ame
}}
</div>
<div>
地址:
{{
item
.
address
}}
</div>
<div>
打卡时间:
{{
item
.
attendanceTime
}}
</div>
<div>
打卡地点:
{{
item
.
attendanceAddress
}}
</div>
...
...
@@ -12,56 +17,100 @@
<template
#
right
>
<van-button
square
type=
"info"
text=
"打卡"
class=
"swipe-cell-btn"
@
click=
"_getWebLoc"
></van-button>
<van-button
square
type=
"danger"
text=
"删除"
class=
"swipe-cell-btn"
></van-button>
<van-button
square
type=
"danger"
text=
"删除"
class=
"swipe-cell-btn"
@
click=
"_delLoc(id)"
></van-button>
</
template
>
</van-swipe-cell>
</van-list>
</van-pull-refresh>
<div
id=
'container'
v-show=
"false"
></div>
</div>
<div
class=
"bottom-btn"
>
<van-button
type=
"info"
block
@
click=
"_add"
>
添加地点
</van-button>
</div>
<van-popup
v-model=
"showAllLoc"
>
<SelectLocation
@
cancel=
"showAllLoc=false"
@
refresh=
"_refresh"
ref=
"allLoc"
></SelectLocation>
</van-popup>
</div>
</template>
<
script
>
import
BaiduMap
from
"../../lib/map.js"
;
import
BaiduMap
from
'../../lib/map'
import
{
samplingPlace
}
from
'../../api'
import
SelectLocation
from
'./components/SelectLocation'
export
default
{
name
:
"SamplingLocation"
,
components
:
{
SelectLocation
},
data
()
{
return
{
resultList
:
[{
placeName
:
'21'
}],
refreshing
:
false
,
planId
:
this
.
$route
.
planId
showAllLoc
:
false
,
resultList
:
[],
page
:
1
,
rows
:
10
,
refreshing
:
false
,
//刷新中...
loading
:
false
,
//加载中...
finished
:
false
,
//没有更多数据
planId
:
this
.
$route
.
query
.
planId
}
},
mounted
()
{
this
.
_
request
()
this
.
_
getData
()
},
methods
:
{
_request
:
async
function
()
{
// let result = await samplingPlan.getLoc(this.planId)
// if(result){
// this.resultList = result.records
// this.refreshing =false
// }
_refresh
()
{
this
.
showAllLoc
=
false
this
.
page
=
1
this
.
_getData
()
},
_searchParams
()
{
let
data
=
{
page
:
this
.
page
,
rows
:
this
.
rows
,
planId
:
this
.
planId
};
return
this
.
$serializeForm
(
data
)
},
_getData
:
async
function
()
{
let
result
=
await
samplingPlace
.
pageApp
(
this
.
_searchParams
())
this
.
resultList
=
[...(
this
.
page
===
1
?
[]
:
this
.
resultList
),
...
result
.
records
]
this
.
refreshing
=
false
this
.
loading
=
false
if
(
this
.
resultList
.
length
===
result
.
total
)
{
this
.
finished
=
true
}
},
_load
()
{
this
.
page
=
this
.
page
+
1
;
this
.
_getData
()
},
_add
()
{
this
.
showAllLoc
=
true
this
.
$nextTick
(
function
()
{
this
.
$refs
.
allLoc
.
_open
(
this
.
planId
)
})
},
//获取位置(web)
_getWebLoc
()
{
let
that
=
this
that
.
$nextTick
(()
=>
{
BaiduMap
.
init
().
then
(
BMap
=>
{
let
geolocation
=
new
BMap
.
Geolocation
()
var
geolocation
=
new
BMap
.
Geolocation
()
geolocation
.
getCurrentPosition
(
function
(
r
)
{
if
(
this
.
getStatus
()
===
'BMAP_STATUS_SUCCESS'
)
{
that
.
longitude
=
that
.
$changeToDFM
(
r
.
point
.
lng
,
'E'
);
that
.
latitude
=
that
.
$changeToDFM
(
r
.
point
.
lat
,
'N'
);
that
.
_action
();
}
else
{
alert
(
'获取不到位置信息'
)
}
console
.
log
(
r
)
// if (this.getStatus() == BMAP_STATUS_SUCCESS) {
// that.latitude = that.$changeToDFM(r.point.lat, 'N')
// that.longitude = that.$changeToDFM(r.point.lng, 'E')
// console.log(r)
// } else {
// alert('获取不到位置信息')
// }
},
{
enableHighAccuracy
:
true
})
})
})
...
...
@@ -74,7 +123,14 @@
// + '&latitude=' + encodeURIComponent(this.latitude);
},
_goto
(
data
)
{
this
.
$router
.
push
({
path
:
'/sampling_task/goods_shelves'
,
query
:
{
id
:
data
.
id
}})
this
.
$router
.
push
({
path
:
'/sampling_task/goods_shelves'
,
query
:
{
placeId
:
data
.
id
}})
},
_delLoc
:
async
function
(
id
)
{
let
result
=
await
samplingPlace
.
edit
({
id
:
id
,
obj
:
{
planId
:
this
.
planId
,
selected
:
0
}})
if
(
result
)
{
this
.
$toast
(
'操作成功!'
)
this
.
_refresh
()
}
},
}
}
...
...
src/page/sampling-task/SamplingTask.vue
View file @
9c66bda5
<
template
>
<div>
<search-bar
label=
"计划名称"
ref=
"searchBar"
highSearch
@
search=
"_search"
@
high-search=
"_highSearch"
...
...
@@ -26,13 +27,13 @@
<van-swipe-cell
v-for=
"item in resultList"
:key=
"item.name"
>
<div
class=
"result-item"
@
click=
"_goto(item)"
>
<div>
计划名称:{{item.name}}
</div>
<div>
抽样进度:{{item.
completionRatio
}}
</div>
<div>
抽样进度:{{item.
summaryCount+'/'+item.samplingQuantity
}}
</div>
<div>
状态:{{item.progress}}
</div>
</div>
<
template
#
right
>
<van-button
square
type=
"info"
text=
"认领"
class=
"swipe-cell-btn"
v-if=
"item.progress==='审批通过'"
@
click=
"_receive(item.id)"
></van-button>
<van-button
square
type=
"danger"
text=
"结束"
class=
"swipe-cell-btn"
@
click=
"_finish(item
.id
)"
<van-button
square
type=
"danger"
text=
"结束"
class=
"swipe-cell-btn"
@
click=
"_finish(item)"
v-else
></van-button>
</
template
>
</van-swipe-cell>
...
...
@@ -145,22 +146,33 @@
if
(
item
.
progress
===
'审批通过'
)
{
this
.
$router
.
push
({
path
:
'/sampling_task/sampling_task_detail'
,
query
:
{
planId
:
item
.
id
}})
}
else
{
this
.
$router
.
push
(
'/sampling_task/sampling_location'
)
this
.
$router
.
push
(
{
path
:
'/sampling_task/sampling_location'
,
query
:
{
planId
:
item
.
id
}}
)
}
},
_finish
(
id
)
{
//todo
this
.
_finishOk
(
id
)
_finish
(
item
)
{
if
(
item
.
summaryCount
===
0
)
{
this
.
$dialog
.
confirm
({
title
:
'提示'
,
message
:
'您还未添加抽样单,是否继续?'
,
}).
then
(()
=>
{
this
.
_finishOk
(
item
.
id
)
}).
catch
(()
=>
{
// on cancel
});
}
else
{
this
.
_finishOk
(
item
.
id
)
}
},
_finishOk
:
async
function
(
id
)
{
let
result
=
await
samplingPlan
.
finish
(
id
)
let
result
=
await
samplingPlan
.
acceptFinish
({
planId
:
id
,
type
:
2
}
)
if
(
result
)
{
this
.
$toast
(
'操作成功!'
);
this
.
_refresh
()
}
},
_receive
:
async
function
(
id
)
{
let
result
=
await
samplingPlan
.
receive
(
id
)
let
result
=
await
samplingPlan
.
acceptFinish
({
planId
:
id
,
type
:
1
}
)
if
(
result
)
{
this
.
$toast
(
'操作成功!'
);
this
.
_refresh
()
...
...
src/page/sampling-task/components/SelectLocation.vue
0 → 100644
View file @
9c66bda5
<
template
>
<customer-navBar-layout
style=
"width: 100vw;height:100vh"
>
<template
#
navBar
>
<van-nav-bar
title=
"选择地点"
left-arrow
@
click-left=
"_cancel"
></van-nav-bar>
</
template
>
<
template
#
content
>
<search-bar
label=
"地点"
@
search=
"_search"
></search-bar>
<div
class=
"layout-cont-s layout-cont-s-btn"
style=
"margin-top: 54px"
>
<van-pull-refresh
v-model=
"refreshing"
@
refresh=
"_refresh"
>
<van-list
v-model=
"loading"
:finished=
"finished"
finished-text=
"没有更多了"
@
load=
"_load"
>
<van-checkbox-group
v-model=
"checkListValue"
ref=
"checkboxGroup"
>
<van-swipe-cell
v-for=
"item in resultList"
:key=
"item.name"
>
<div
class=
"result-item"
@
click=
"_tapItem(item)"
>
<van-checkbox
:name=
"item.id"
shape=
"square"
></van-checkbox>
<div>
地点:
{{
item
.
name
}}
</div>
<div>
地址:
{{
item
.
address
}}
</div>
<div>
经度:
{{
item
.
attendanceTime
}}
</div>
<div>
纬度:
{{
item
.
attendanceAddress
}}
</div>
</div>
</van-swipe-cell>
</van-checkbox-group>
</van-list>
</van-pull-refresh>
</div>
<div
class=
"bottom-btn"
>
<van-button
type=
"info"
block
@
click=
"_add"
>
添加地点
</van-button>
</div>
</
template
>
</customer-navBar-layout>
</template>
<
script
>
import
{
samplingPlan
,
samplingPlace
}
from
'../../../api'
export
default
{
name
:
"SelectLocation"
,
data
()
{
return
{
resultList
:
[],
page
:
1
,
rows
:
10
,
refreshing
:
false
,
//刷新中...
loading
:
false
,
//加载中...
finished
:
false
,
//没有更多数据
checkListValue
:
[],
planId
:
''
}
},
methods
:
{
_open
(
planId
)
{
this
.
planId
=
planId
this
.
checkListValue
=
[]
this
.
_refresh
()
},
_search
(
value
)
{
this
.
key
=
value
this
.
_refresh
()
},
_refresh
()
{
this
.
page
=
1
this
.
_getData
()
},
_searchParams
()
{
let
data
=
{
page
:
this
.
page
,
rows
:
this
.
rows
,
name
:
this
.
key
,
planId
:
this
.
planId
};
return
this
.
$serializeForm
(
data
)
},
_getData
:
async
function
()
{
let
result
=
await
samplingPlace
.
page
(
this
.
_searchParams
())
this
.
resultList
=
[...(
this
.
page
===
1
?
[]
:
this
.
resultList
),
...
result
.
records
]
this
.
refreshing
=
false
this
.
loading
=
false
if
(
this
.
resultList
.
length
===
result
.
total
)
{
this
.
finished
=
true
}
},
_load
()
{
this
.
page
=
this
.
page
+
1
;
this
.
_getData
()
},
_tapItem
(
item
)
{
if
(
this
.
checkListValue
.
indexOf
(
item
.
id
)
===
-
1
)
{
this
.
checkListValue
.
push
(
item
.
id
);
}
else
{
this
.
checkListValue
.
splice
(
this
.
checkListValue
.
indexOf
(
item
.
id
),
1
);
}
},
_add
()
{
if
(
this
.
checkListValue
.
length
===
0
)
{
this
.
$toast
(
'请至少选择一条数据!'
)
}
else
{
this
.
_addOk
()
}
},
_addOk
:
async
function
()
{
let
data
=
{
planId
:
this
.
planId
,
placeIds
:
this
.
checkListValue
.
join
(
','
)
}
let
result
=
await
samplingPlan
.
savePlace
(
data
)
if
(
result
)
{
this
.
$toast
(
'操作成功'
)
this
.
$emit
(
'refresh'
)
}
},
_cancel
()
{
this
.
$emit
(
'cancel'
)
}
}
}
</
script
>
<
style
scoped
>
</
style
>
src/styles/main.less
View file @
9c66bda5
...
...
@@ -43,6 +43,7 @@ html, body, #app, .main-content-con {
height: 100%;
}
//主要内容 不包括navbar searchbar
.layout-cont {
width: 100%;
height: calc(100% - 50px);
...
...
vue.config.js
View file @
9c66bda5
...
...
@@ -13,7 +13,7 @@ module.exports = {
},
configureWebpack
:
{
externals
:
{
'B
Am
p'
:
'BMap'
'B
Ma
p'
:
'BMap'
}
},
css
:
{
...
...
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