Commit 9c66bda5 by zhuxiaomei

地点和货架

parent b2ebe949
......@@ -42,7 +42,8 @@
"parser": "babel-eslint"
},
"globals": {
"BMap": true
"BMap": true,
"AMap": true
},
"rules": {}
},
......
......@@ -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>
/**
* 抽样计划表相关
*/
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),
}
......@@ -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),
}
/**
* 双随机抽样货架表相关
*/
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),
}
......@@ -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'
<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.placeName}}</div>
<div>货架名称:{{item.name}}</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>
......
<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.placeName}}</div>
<div>地点:{{item.name}}</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()
}
},
}
}
......
<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()
......
<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>
......@@ -43,6 +43,7 @@ html, body, #app, .main-content-con {
height: 100%;
}
//主要内容 不包括navbar searchbar
.layout-cont {
width: 100%;
height: calc(100% - 50px);
......
......@@ -13,7 +13,7 @@ module.exports = {
},
configureWebpack: {
externals: {
'BAmp': 'BMap'
'BMap': 'BMap'
}
},
css: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment