Commit 9154d9bd by zhuxiaomei

抽样任务 管理人员 管理地点

parent 6e0f4db3
...@@ -46,10 +46,13 @@ ...@@ -46,10 +46,13 @@
}, },
"globals": { "globals": {
"BMap": true, "BMap": true,
"AMap": true,
"plus": true, "plus": true,
"mui": true "mui": true
}, },
"rules": {} "rules": {
"no-debugger": "off"
}
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
......
...@@ -8,9 +8,13 @@ ...@@ -8,9 +8,13 @@
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
/> />
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" href="https://cache.amap.com/lbs/static/main1119.css"/>
<title>双随机抽样</title> <title>双随机抽样</title>
<script src="<%= BASE_URL %>js/mui.min.js"></script> <script src="<%= BASE_URL %>js/mui.min.js"></script>
<script src="<%= BASE_URL %>js/back.js"></script> <script src="<%= BASE_URL %>js/back.js"></script>
<script src="https://webapi.amap.com/maps?v=1.4.15&key=33d56f06483ab332151b14e85bbb8405&plugin=AMap.MouseTool,AMap.PlaceSearch,AMap.DistrictSearch"></script>
</head> </head>
<body> <body>
<!--<noscript>--> <!--<noscript>-->
...@@ -49,6 +53,5 @@ ...@@ -49,6 +53,5 @@
oHead.appendChild(fastclick); oHead.appendChild(fastclick);
} }
</script> </script>
<script src="https://webapi.amap.com/maps?v=1.4.15&key=33d56f06483ab332151b14e85bbb8405"></script>
</html> </html>
/**
* 双随机抽样人员表相关
*/
import http from '../http'
export default {
page: data => http.post('/drs/v1/sampler/page', data).then(res => res),
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* 抽样计划表相关 * 抽样计划表相关
*/ */
import http from '../http' import http from '../http'
import httpJson from '../httpJson'
export default { export default {
page: data => http.post('/drs/v1/sampling_place/page', data).then(res => res), page: data => http.post('/drs/v1/sampling_place/page', data).then(res => res),
...@@ -9,5 +10,5 @@ export default { ...@@ -9,5 +10,5 @@ export default {
edit: data => http.put('/drs/v1/sampling_place/' + data.id, data.obj).then(res => res), edit: data => http.put('/drs/v1/sampling_place/' + data.id, data.obj).then(res => res),
listPlaces: data => http.post('/drs/v1/sampling_place/list_places', data).then(res => res), listPlaces: data => http.post('/drs/v1/sampling_place/list_places', data).then(res => res),
addMulti: data => http.put('/drs/v1/sampling_place/update_multi_selected', data).then(res => res), addMulti: data => http.put('/drs/v1/sampling_place/update_multi_selected', data).then(res => res),
savePlaces:data=>httpJson.post('/drs/v1/sampling_place/savePlaces',JSON.stringify(data)).then(res=>res),
} }
/**
* 双随机抽样计划附件表相关
*/
import http from '../http'
export default {
page: data => http.post('/drs/v1/sampling_plan_attachment/page', data).then(res => res),
list: data => http.post('/drs/v1/sampling_plan_attachment/list', data).then(res => res),
add: data => http.post('/drs/v1/sampling_plan_attachment/', data).then(res => res),
edit: data => http.put('/drs/v1/sampling_plan_attachment/' + data.id, data.obj).then(res => res),
deleteByIds: data => http.delete('/drs/v1/sampling_plan_attachment/?ids=' + data.id).then(res => res),
getById: id => http.get('/drs/v1/sampling_plan_attachment/' + id).then(res => res),
//计划下的附件是图片的附件id集合
getImgById: id => http.post('/drs/v1/sampling_plan_attachment/list_picture_by_plan_id?planId=' + id).then(res => res)
}
...@@ -11,4 +11,19 @@ export default { ...@@ -11,4 +11,19 @@ export default {
getById: id => http.get('/drs/v1/sampling_plan/' + id).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), savePlace:data=>http.post('/drs/v1/sampling_plan/save_place_random', data).then(res=>res),
add:data=>http.post('/drs/v1/sampling_plan/', data).then(res=>res),
edit:data=>http.put('/drs/v1/sampling_plan/' + data.id, data.obj).then(res=>res),
deleteByIds:ids=>http.delete('/drs/v1/sampling_plan/?ids=' + ids).then(res=>res),
generatePlace:data=>http.post('/drs/v1/sampling_plan/generate_place_random', data).then(res=>res),
generateSampler:data=>http.post('/drs/v1/sampling_plan/generate_sampler_random', data).then(res=>res),
saveSamplerRandom:data=>http.post('/drs/v1/sampling_plan/save_sampler_random', data).then(res=>res),
submit:data=>http.post('/drs/v1/sampling_plan/submit_plan', data).then(res=>res),
planApprove:data=>http.post('/drs/v1/sampling_plan/plan_approve', data).then(res=>res),
samplerPage:data=>http.post('/drs/v1/sampling_plan/search_plan_sampler', data).then(res=>res),
saveSampler:data=>http.post('/drs/v1/sampling_plan/save_plan_sampler', data).then(res=>res),
deletePlanSampler:data=>http.post('/drs/v1/sampling_plan/delete_plan_sampler', data).then(res=>res),
} }
...@@ -30,11 +30,13 @@ export {default as foodClassifyInfo} from './food/food-classify-info' ...@@ -30,11 +30,13 @@ export {default as foodClassifyInfo} from './food/food-classify-info'
/** /**
* drs * drs
*/ */
export {default as sampler} from './drs/sampler'
export {default as samplingPlan} from './drs/sampling-plan' export {default as samplingPlan} from './drs/sampling-plan'
export {default as samplingPlace} from './drs/sampling-place' export {default as samplingPlace} from './drs/sampling-place'
export {default as samplingShelf} from './drs/sampling-shelf' export {default as samplingShelf} from './drs/sampling-shelf'
export {default as samplingSummary} from './drs/sampling-summary' export {default as samplingSummary} from './drs/sampling-summary'
export {default as samplingSummaryAttachment} from './drs/sampling-summary-attachment' export {default as samplingSummaryAttachment} from './drs/sampling-summary-attachment'
export {default as samplingPlanAttachment} from './drs/sampling-plan-attachment'
export {default as attendanceRecord} from './drs/attendance_record' export {default as attendanceRecord} from './drs/attendance_record'
export {default as samplingSample} from './drs/sampling-sample' export {default as samplingSample} from './drs/sampling-sample'
export {default as netTested} from './drs/net-tested' export {default as netTested} from './drs/net-tested'
......
...@@ -2,15 +2,45 @@ ...@@ -2,15 +2,45 @@
<div> <div>
<!--https://youzan.github.io/vant/#/zh-CN/grid--> <!--https://youzan.github.io/vant/#/zh-CN/grid-->
<div class="layout-cont home-cont"> <div class="layout-cont home-cont">
<van-grid :gutter="10" :column-num="3" :icon-size="40"> <!--todo 首页布局 颜色-->
<!--1、icon参数引入使用,否则不显示--> <div style="background: cornflowerblue;" class="box-c" @click="_goto('/sampling_plan/sampling_plan')">
<van-grid-item v-for="item in menuList" :key="item.title" :icon="item.img" <div>抽样计划执行双随机</div>
:text="item.title" @click="_goto(item)"></van-grid-item> <div>3</div>
<!--2、require使用 详见:https://youzan.github.io/vant/#/zh-CN/image#chang-jian-wen-ti--> </div>
<!--<van-grid-item v-for="item in menuList" :key="item.title" :icon="require('../assets/index/1.png')"--> <div style="display: flex" class="box-c">
<!--:text="item.title" ></van-grid-item>--> <div style="width:50%;background: #FC81FF" @click="_goto('/sampling_task/sampling_task')">
<!--3、使用该组件的icon插槽 详见:https://youzan.github.io/vant/#/zh-CN/grid#api--> <div>我的任务</div>
</van-grid> <div>4</div>
</div>
<div style="width:50%;background:coral;margin-left: 30px"
@click="_goto('/sampling_list/sampling_task')">
<div>抽样信息录入</div>
<div>4</div>
</div>
</div>
<div style="display: flex" class="box-c">
<div style="width:50%;background: brown">
<!--todo 消息-->
<div>消息</div>
<div>4</div>
</div>
<div style="width:50%;background: #576b95;margin-left: 30px"
@click="_goto('/history_sampling/sampling_list')">
<div>历史任务</div>
</div>
</div>
<div class="box-c">
<div style="background: #646566;height: 100%;">双随机实现流程</div>
</div>
<!--<van-grid :gutter="10" :column-num="3" :icon-size="40">-->
<!--&lt;!&ndash;1、icon参数引入使用,否则不显示&ndash;&gt;-->
<!--<van-grid-item v-for="item in menuList" :key="item.title" :icon="item.img"-->
<!--:text="item.title" @click="_goto(item)"></van-grid-item>-->
<!--&lt;!&ndash;2、require使用 详见:https://youzan.github.io/vant/#/zh-CN/image#chang-jian-wen-ti&ndash;&gt;-->
<!--&lt;!&ndash;<van-grid-item v-for="item in menuList" :key="item.title" :icon="require('../assets/index/1.png')"&ndash;&gt;-->
<!--&lt;!&ndash;:text="item.title" ></van-grid-item>&ndash;&gt;-->
<!--&lt;!&ndash;3、使用该组件的icon插槽 详见:https://youzan.github.io/vant/#/zh-CN/grid#api&ndash;&gt;-->
<!--</van-grid>-->
</div> </div>
<FooterBar></FooterBar> <FooterBar></FooterBar>
</div> </div>
...@@ -37,13 +67,25 @@ ...@@ -37,13 +67,25 @@
} }
}, },
methods: { methods: {
_goto(item) { _goto(uri) {
this.$router.push(item.uri) this.$router.push(uri)
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.home-cont {
padding: 20px 30px;
color: #ffffff;
}
.home-cont > div {
width: 100%;
height: 25%;
}
.box-c + .box-c {
padding-top: 30px;
}
</style> </style>
<template>
<div>
<!--https://youzan.github.io/vant/#/zh-CN/grid-->
<div class="layout-cont home-cont">
<van-grid :gutter="10" :column-num="3" :icon-size="40">
<!--1、icon参数引入使用,否则不显示-->
<van-grid-item v-for="item in menuList" :key="item.title" :icon="item.img"
:text="item.title" @click="_goto(item)"></van-grid-item>
<!--2、require使用 详见:https://youzan.github.io/vant/#/zh-CN/image#chang-jian-wen-ti-->
<!--<van-grid-item v-for="item in menuList" :key="item.title" :icon="require('../assets/index/1.png')"-->
<!--:text="item.title" ></van-grid-item>-->
<!--3、使用该组件的icon插槽 详见:https://youzan.github.io/vant/#/zh-CN/grid#api-->
</van-grid>
</div>
<FooterBar></FooterBar>
</div>
</template>
<script>
import indexImg10 from '../assets/index/10.png'
import indexImg1 from '../assets/index/1.png'
import indexImg11 from '../assets/index/11.png'
import FooterBar from '@/components/FooterBar.vue'
export default {
name: "Home",
components: {
FooterBar
},
data() {
return {
menuList: [
{img: indexImg10, title: '抽样任务', uri: '/sampling_task/sampling_task'},
{img: indexImg1, title: '抽样单管理', uri: '/sampling_list/sampling_task'},
{img: indexImg11, title: '历史抽样单', uri: '/history_sampling/sampling_list'},
],
}
},
methods: {
_goto(item) {
this.$router.push(item.uri)
}
}
}
</script>
<style scoped>
</style>
<template> <template>
<div class="main-content-con"> <div class="main-content-con">
<!--https://youzan.github.io/vant/#/zh-CN/nav-bar--> <!--https://youzan.github.io/vant/#/zh-CN/nav-bar-->
<van-nav-bar :title="$route.meta.title" <van-nav-bar :title="title"
:left-arrow="$route.meta.leftArrow!==false" :left-arrow="$route.meta.leftArrow!==false"
v-if="$route.meta.hideNavBar!==true" v-if="$route.meta.hideNavBar!==true"
@click-left="_back"></van-nav-bar> @click-left="_back"></van-nav-bar>
...@@ -16,6 +16,19 @@ ...@@ -16,6 +16,19 @@
export default { export default {
name: "Index", name: "Index",
components: {}, components: {},
computed: {
title: {
get() {
let title = ''
if (this.$route.meta.customerNavBarTitle !== true) {
title = this.$route.meta.title
} else {
title = this.$route.query.title
}
return title
}
}
},
mounted() { mounted() {
this._login() this._login()
}, },
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
></van-field> ></van-field>
</div> </div>
<div class="field-input"> <div class="field-input">
<!--todo form表单回车提交-->
<van-field <van-field
v-model="formObj.password" v-model="formObj.password"
:left-icon="require('../assets/psd.png')" :left-icon="require('../assets/psd.png')"
......
...@@ -14,27 +14,31 @@ ...@@ -14,27 +14,31 @@
</template> </template>
</search-bar> </search-bar>
<div class="layout-cont-sh"> <div class="layout-cont-sh">
<van-list <!--下拉刷新 https://vant-contrib.gitee.io/vant/#/zh-CN/pull-refresh-->
v-model="loading" <van-pull-refresh v-model="refreshing" @refresh="_refresh">
:finished="finished" <!--上拉加载 https://vant-contrib.gitee.io/vant/#/zh-CN/list-->
finished-text="没有更多了" <van-list
@load="onLoad"> v-model="loading"
<van-swipe-cell v-for="item in resultList" :key="item.name"> :finished="finished"
<div class="result-item" @click="_goto(item)"> finished-text="没有更多了"
<div>抽样单编号:{{item.samplingNum}}</div> @load="_load">
<div>抽样日期:{{item.samplingDate?$dateformat(item.samplingDate,'yyyy-mm-dd'):''}}</div> <van-swipe-cell v-for="item in resultList" :key="item.name">
<div>任务名称:{{item.taskName}}</div> <div class="result-item" @click="_goto(item)">
<div>任务编号:{{item.taskNum}}</div> <div>抽样单编号:{{item.samplingNum}}</div>
<div>生产者名称:{{item.proName}}</div> <div>抽样日期:{{item.samplingDate?$dateformat(item.samplingDate,'yyyy-mm-dd'):''}}</div>
<div>样品名称:{{item.sampleName}}</div> <div>任务名称:{{item.taskName}}</div>
<div>被抽样单位名称:{{item.testedName}}</div> <div>任务编号:{{item.taskNum}}</div>
</div> <div>生产者名称:{{item.proName}}</div>
<template #right> <div>样品名称:{{item.sampleName}}</div>
<van-button square type="primary" text="打印" class="swipe-cell-btn" <div>被抽样单位名称:{{item.testedName}}</div>
@click="_print(item)"></van-button> </div>
</template> <template #right>
</van-swipe-cell> <van-button square type="primary" text="打印" class="swipe-cell-btn"
</van-list> @click="_print(item)"></van-button>
</template>
</van-swipe-cell>
</van-list>
</van-pull-refresh>
</div> </div>
</div> </div>
</template> </template>
...@@ -53,7 +57,7 @@ ...@@ -53,7 +57,7 @@
taskName: '', taskName: '',
testedName: '', testedName: '',
isHistory: 1, isHistory: 1,
isSelf:1 isSelf: 1
}, },
key: '', key: '',
resultList: [], resultList: [],
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
@click-left="_back" @click-left="_back"
@click-right="_add" @click-right="_add"
></van-nav-bar> ></van-nav-bar>
<!--todo 批量打印、删除-->
</template> </template>
<template #content> <template #content>
<search-bar label="抽样单编号" ref="searchBar" <search-bar label="抽样单编号" ref="searchBar"
...@@ -147,7 +146,7 @@ ...@@ -147,7 +146,7 @@
page: this.page, page: this.page,
rows: this.rows, rows: this.rows,
planId: this.planId, planId: this.planId,
...this.formObj//todo 简单查询的关键字 ...this.formObj
}; };
if (this.key) { if (this.key) {
data.samplingNum = this.key data.samplingNum = this.key
......
<template>
<customer-navBar-layout>
<template #navBar>
<van-nav-bar v-if="showCheck"
:title="$route.meta.title"
right-text="取消"
left-arrow
@click-left="_back"
@click-right="_hideCheck">
</van-nav-bar>
<van-nav-bar
v-else
:title="$route.meta.title"
right-text="添加"
left-arrow
@click-left="_back"
@click-right="_add"
></van-nav-bar>
</template>
<template #content>
<search-bar label="计划名称" ref="searchBar"
highSearch @search="_search" @high-search="_highSearch"
@clear-high="_clearHigh">
<template #highSearch>
<van-field v-model="formObj.name" label="计划名称" placeholder="请输入计划名称"></van-field>
<datetime-field label="计划开始日期" v-model="formObj.planDateBegin"></datetime-field>
<datetime-field label="计划结束日期" v-model="formObj.planDateEnd"></datetime-field>
<van-field v-model="formObj.uname" label="登记人" placeholder="请输入登记人"></van-field>
<datetime-field label="登记开始日期" v-model="formObj.ctimeBegin"></datetime-field>
<datetime-field label="登记结束日期" v-model="formObj.ctimeEnd"></datetime-field>
<!--todo 状态查询-->
</template>
</search-bar>
<div class="layout-cont-sh" :class="{'layout-cont-sh-btn':showCheck}">
<!--下拉刷新 https://vant-contrib.gitee.io/vant/#/zh-CN/pull-refresh-->
<van-pull-refresh v-model="refreshing" @refresh="_refresh">
<!--上拉加载 https://vant-contrib.gitee.io/vant/#/zh-CN/list-->
<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.id">
<div class="result-item" @click="_tapItem(item)" v-touch:longtap="_longtapHandler">
<div style="width: 100%;display: flex;justify-content: space-between;border-bottom: 1px solid #eeeeee">
<div style="display: flex">
<div style="margin-right: 20px" v-if="showCheck">
<van-checkbox :name="item.id" shape="square"></van-checkbox>
</div>
<div>计划名称:{{item.name}}</div>
</div>
<div @click.stop="_goFile(item.id)">
<img src="../../assets/file-nav.png" style="width: 20px">
</div>
</div>
<div>状态:{{item.progress}}</div>
<div>计划日期:{{$dateformat(item.planDate,'yyyy-mm-dd')}}</div>
<div>任务下达单位:{{item.issuingUnit}}</div>
<div>任务来源:{{item.taskSource}}</div>
<div style="width: 100%">抽样人员:{{item.samplerNames}}</div>
<div style="width: 100%">抽样地点:{{item.placeNames}}</div>
<div>抽样进度:{{item.completionRatio}}</div>
<div>产品:{{item.product}}</div>
</div>
<template #right v-if="item.progress==='草稿'||item.progress==='审批驳回'">
<van-button square type="info" text="编辑" class="swipe-cell-btn"
@click="_edit(item)"></van-button>
<!--todo 管理人-->
<van-button square type="primary" text="管理人员" class="swipe-cell-btn"
@click="_peopleManage(item)"></van-button>
<!--todo 管理地点-->
<van-button square type="warning" text="管理地点" class="swipe-cell-btn"
@click="_locManage(item)"></van-button>
<van-button square type="danger" text="删除" class="swipe-cell-btn"
@click="_del([item.id])"></van-button>
</template>
</van-swipe-cell>
</van-checkbox-group>
</van-list>
</van-pull-refresh>
</div>
<div class="bottom-btn bottom-btn-five" v-if="showCheck">
<van-button square @click="_checkAll">{{checkAll?'取消全选':'全选'}}</van-button>
<van-button square type="danger" @click="_del(checkListValue)">删除</van-button>
<van-button square type="info" @click="_submit(checkListValue)">提交</van-button>
<!--生成人-->
<van-button square type="primary" @click="_createSampler(checkListValue)">生成抽样人员</van-button>
<!--生成地点-->
<van-button square type="warning" @click="_createLoc(checkListValue)">生成抽样地点</van-button>
</div>
</template>
</customer-navBar-layout>
</template>
<script>
import {samplingPlan} from '../../api'
export default {
name: "SamplingPlan",
components: {},
data() {
return {
formObj: {
name: '',
planDateBegin: '',
planDateEnd: '',
uname: '',
ctimeBegin: '',
ctimeEnd: '',
progress: '',
flag: 0
},
key: '',
showPopup: true,
showCheck: false,
checkListValue: [],
resultList: [],
page: 1,
rows: 10,
refreshing: false,//刷新中...
loading: false,//加载中...
finished: false,//没有更多数据
planId: this.$route.query.planId
}
},
watch: {
checkListValue: function (oldVal, newVal) {
console.log(oldVal, newVal)
}
},
computed: {
checkAll: function () {
if (this.resultList.length) {
return this.checkListValue.length === this.resultList.length;
} else {
return false
}
}
},
mounted() {
this._getData()
},
methods: {
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this.formObj = this.$resetFields(this.formObj)
this.formObj.flag = 0
this._refresh()
},
//高级搜索 清空key 查询
_highSearch() {
this.key = ''
if (this._valParams()) {
this.$refs.searchBar._hideHighSearch()
this._refresh()
}
},
_valParams() {
if (this.formObj.planDateBegin === '' && this.formObj.planDateEnd !== '') {
this.$toast('请选择计划开始日期!')
return false
} else if (this.formObj.planDateBegin !== '' && this.formObj.planDateEnd === '') {
this.$toast('请选择计划结束日期!')
return false
} else if (this.formObj.planDateBegin !== '' && this.formObj.planDateEnd !== '' && (new Date(this.formObj.planDateBegin) > new Date(this.formObj.planDateEnd))) {
this.$toast('计划开始日期不能大于计划结束日期!')
return false
}
if (this.formObj.ctimeBegin === '' && this.formObj.ctimeEnd !== '') {
this.$toast('请选择登记开始日期!')
return false
} else if (this.formObj.ctimeBegin !== '' && this.formObj.ctimeEnd === '') {
this.$toast('请选择登记结束日期!')
return false
} else if (this.formObj.ctimeBegin !== '' && this.formObj.ctimeEnd !== '' && (new Date(this.formObj.ctimeBegin) > new Date(this.formObj.ctimeEnd))) {
this.$toast('登记开始日期不能大于登记结束日期!')
return false
}
return true
},
_clearHigh() {
this.formObj = this.$resetFields(this.formObj)
this.formObj.flag = 0
},
_searchParams() {
let data = {
page: this.page,
rows: this.rows,
planId: this.planId,
...this.formObj
};
if (this.key) {
data.name = this.key
}
return this.$serializeForm(data)
},
_getData: async function () {
let result = await samplingPlan.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
}
},
_refresh() {
this.page = 1;
this._getData()
},
_load() {
this.page = this.page + 1;
this._getData()
},
_back() {
this.$router.go(-1)
},
_add() {
this.$router.push({path: '/sampling_plan/sampling_plan_add', query: {title: '抽样计划添加'}})
},
_longtapHandler() {
this.showCheck = true
},
_hideCheck() {
this.showCheck = false
this.checkListValue = []
},
_checkAll() {
if (this.checkAll) {
this.$refs.checkboxGroup.toggleAll();
} else {
this.$refs.checkboxGroup.toggleAll(true);
}
},
_tapItem(item) {
if (this.showCheck) {
if (this.checkListValue.indexOf(item.id) === -1) {
this.checkListValue.push(item.id);
} else {
this.checkListValue.splice(this.checkListValue.indexOf(item.id), 1);
}
} else {
// if (item.testedType === 1) {
// this.$router.push({path: '/sampling_plan/sampling_plan_detail_net', query: {id: item.id}})
// } else if (item.testedType === 0) {
// this.$router.push({path: '/sampling_plan/sampling_plan_detail', query: {id: item.id}})
// } else {
// this.$router.push({
// path: '/sampling_plan/sampling_plan_detail_agriculture',
// query: {id: item.id}
// })
// }
}
},
_edit(item) {
this.$router.push({path: '/sampling_plan/sampling_plan_add', query: {id: item.id, title: '抽样计划编辑'}})
},
_peopleManage(item) {
this.$router.push({path: '/sampling_plan/sampler_checked', query: {planId: item.id}})
},
_locManage(item) {
this.$router.push({path: '/sampling_plan/loc_checked', query: {planId: item.id}})
},
_del(ids) {
if (ids.length === 0) {
this.$toast('请至少选择一条数据!')
} else {
this._delOk(ids)
}
},
_delOk: async function (ids) {
let result = await samplingPlan.deleteByIds(ids)
if (result) {
this.$toast('操作成功!')
this._refresh()
}
},
_submit() {
if (this.checkListValue.length === 0) {
this.$toast('请至少选择一条数据!')
} else {
// this._delOk(ids)
// todo 提交
}
},
_createSampler() {
if (this.checkListValue.length === 0) {
this.$toast('请至少选择一条数据!')
} else {
this.$router.push({path: '/sampling_plan/create_sampler', query: {ids: this.checkListValue}})
}
},
_createLoc() {
if (this.checkListValue.length === 0) {
this.$toast('请至少选择一条数据!')
} else {
this.$router.push({path: '/sampling_plan/create_loc', query: {ids: this.checkListValue}})
}
},
_goFile(id) {
this.$router.push({path: '/sampling_plan/file', query: {planId: id}})
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<van-form @submit="onSubmit">
<van-field
v-model="formObj.name"
name="name"
label="计划名称"
placeholder="计划名称"
:rules="[{ required: true, message: '请填写计划名称'}]"
></van-field>
<van-field
v-model="formObj.planDate"
name="monitorDate"
label="计划日期"
placeholder="计划日期"
@click="_selectDate('formObj.planDate')"
></van-field>
<van-field
v-model="formObj.issuingUnit"
name="issuingUnit"
label="任务下达单位"
placeholder="任务下达单位"
></van-field>
<van-field
v-model="formObj.taskSource"
name="taskSource"
label="任务来源"
placeholder="任务来源"
></van-field>
<van-field
type="textarea"
v-model="formObj.product"
name="product"
label="产品"
placeholder="产品"
></van-field>
<van-field
v-model="formObj.standard"
name="standard"
label="抽查依据标准"
placeholder="抽查依据标准"
></van-field>
<van-field
v-model="formObj.finishDate"
name="finishDate"
label="完成时间"
placeholder="完成时间"
@click="_selectDate('formObj.finishDate')"
></van-field>
<van-field
type="number"
v-model="formObj.samplingQuantity"
name="samplingQuantity"
label="抽样数量"
placeholder="抽样数量"
></van-field>
<van-field
type="number"
v-model="formObj.testCost"
name="testCost"
label="检测费用"
placeholder="检测费用"
></van-field>
<van-field
v-model="formObj.announcementNo"
name="announcementNo"
label="公告号"
placeholder="公告号"
></van-field>
<van-field
v-model="formObj.announcementDate"
name="announcementDate"
label="公告日期"
placeholder="公告日期"
@click="_selectDate('formObj.announcementDate')"
></van-field>
<van-field
type="textarea"
v-model="formObj.remark"
name="remark"
label="备注"
placeholder="备注"
></van-field>
<div style="margin: 16px;">
<van-button round block type="info" native-type="submit">
保存
</van-button>
</div>
</van-form>
<van-popup v-model="showDatePicker" position="bottom"
:safe-area-inset-bottom="true"
:close-on-popstate="true">
<van-datetime-picker
type="date"
v-model="currentDate"
@confirm="_dateConfirm"
@cancel="showDatePicker = false"
></van-datetime-picker>
</van-popup>
</div>
</template>
<script>
import {samplingPlan} from '../../api'
export default {
name: "SamplingPlanAdd",
data() {
return {
showDatePicker: false,
currentDate: new Date(),
selectDateType: '',
id: '',
formObj: {
name: '',
planDate: '',
issuingUnit: '',
taskSource: '',
product: '',
standard: '',
finishDate: '',
samplingQuantity: '',
testCost: 0,
announcementNo: '',
announcementDate: '',
remark: ''
}
}
},
mounted() {
this._open()
},
methods: {
_open() {
if (this.$route.query.id) {//编辑
this.id = this.$route.query.id
this._getData()
} else {
this.id = ''
}
},
_getData: async function () {
let result = await samplingPlan.getById(this.id)
if (result) {
for (let key in this.formObj) {
if (result[key]) {
if (key === 'planDate'||key === 'finishDate'||key === 'announcementDate') {
this.formObj[key] = this.$dateformat(result[key], 'yyyy-mm-dd')
} else {
this.formObj[key] = result[key]
}
}
}
}
},
onSubmit(res) {
if (this.id) {
this._editSave(res)
} else {
this._addSave(res)
}
},
_editSave: async function (res) {
res.type = 0
let result = await samplingPlan.edit({id: this.id, obj: res})
if (result) {
this.$toast('编辑成功!')
this.$router.go(-1)
}
},
_addSave: async function (res) {
res.type = 0
let result = await samplingPlan.add(res)
if (result) {
this.$toast('添加成功!')
this.$router.go(-1)
}
},
_selectDate(type) {
this.selectDateType = type
this.showDatePicker = true
},
_dateConfirm(date) {
switch (this.selectDateType) {
case 'formObj.planDate':
this.formObj.planDate = this.$dateformat(date, 'yyyy-mm-dd')
break
case 'formObj.finishDate':
this.formObj.finishDate = this.$dateformat(date, 'yyyy-mm-dd')
break
case 'formObj.announcementDate':
this.formObj.announcementDate = this.$dateformat(date, 'yyyy-mm-dd')
break
}
this.showDatePicker = false
},
}
}
</script>
<style scoped>
</style>
<template>
<div>
<div class="layout-cont-btn" >
<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="_download(item)">
<div>附件名称:{{item.fileName +'.'+item.type }}</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 bottom-btn-two" >
<!--<van-button type="info" block @click="_goto('/sampling_list/file_upload')">添加附件</van-button>-->
<van-button type="info" square @click="_goto('/sampling_list/file_upload')">添加附件</van-button>
<van-button type="primary" square @click="_uploadImg">添加图片</van-button>
</div>
<van-image-preview v-model="showImg" :images="imgList">
<!--<template #:index>第{{ index }}页</template>-->
</van-image-preview>
</div>
</template>
<script>
import {samplingPlanAttachment} from '../../../api'
export default {
data() {
return {
resultList: [],
page: 1,
rows: 20,
planId: '',
imgList: [''],
loading: false,//加载中...
finished: false,//没有更多数据
refreshing: false,//刷新中...
//文件id
fileId: '',
//上传图片路径:
action: '',
showImg: false
}
},
mounted() {
this.planId = this.$route.query.planId;
this.action = this.$global.baseURL + '/drs/v1/sampling_plan_attachment/' + this.planId;
this._getData();
},
methods: {
_refresh() {
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 samplingPlanAttachment.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()
},
//路由跳转
_goto(next) {
let data = {planId: this.planId};
this.$router.push({path: next, query: data})
},
_del: async function (id) {
let result = await samplingPlanAttachment.deleteByIds({id: id})
if (result) {
this.$toast('删除成功!')
this._refresh()
}
},
//下载附件
_download(data) {
if (data.type.toLowerCase() === 'jpg' || data.type.toLowerCase() === 'png') {
this.showImg = true
//预览图片
this.imgList[0] = this.$global.baseURL + '/drs/v1/sampling_plan_attachment/view?id=' + '&objectKey=' + data.objectKey;
console.log(this.imgList[0])
} else {
//下载文件
this.$router.push({
path: '/sampling_list/file_download',
query: {fileName: data.fileName, id: data.id, ctime: data.ctime}
})
}
},
/****************************************上传图片*************************************************/
_uploadImg() {
plus.nativeUI.actionSheet({
title: "选择图片",
cancel: "取消",
buttons: [{title: "拍照"}, {title: "相册"}]
}, (e) => {
let index = e.index;
switch (index) {
case 1:
//拍照上传
this._camera();
break;
case 2:
//从相册选择上传
this._pickPhoto();
break
}
});
},
//拍照上传
_camera() {
plus.camera.getCamera().captureImage((e) => {
plus.io.resolveLocalFileSystemURL(e, (entry) => {
var url = entry.toLocalURL();
var name = url.substr(e.lastIndexOf('/') + 1);
//压缩
plus.zip.compressImage({
src: url,
dst: '_doc/' + name,
overwrite: true,
quality: 30,
}, (zip) => {
let files = [{key: 'imgUpload', path: zip.target}];
this._submitImg(files);
}, (error) => {
console.log('压缩失败', error)
});
}, (e) => {
console.log("读取拍照文件错误:" + e.message);
});
}, (s) => {
console.log("error" + s);
}, {});
},
//从相册选择上传
_pickPhoto() {
//多选
plus.gallery.pick((e) => {
let files = [];
let url = '';
let name = '';
for (let i in e.files) {
url = e.files[i];
name = url.substr(url.lastIndexOf('/') + 1);
//压缩取得缩略图
plus.zip.compressImage({
src: url,
dst: '_doc/' + name,
overwrite: true,
quality: 30,
}, (zip) => {
files = [{key: 'imgUpload' + i, path: zip.target}];
this._submitImg(files);
}, (error) => {
console.log('压缩失败', error)
});
}
}, (e) => {
console.log('打开相册失败', e)
}, {filter: 'image', multiple: true, system: false});
},
//上传
_submitImg(files) {
// let action =this.$global.baseURL + '/env/v1/sample_attachment/' + '1299251712557694978';
var task = plus.uploader.createUpload(this.action,
{method: "POST"},
(t, status) => { //上传完成
console.log(JSON.stringify(t), JSON.stringify(status))
this._getData();
}
);
//单图片上传
let imgData = files[0];
task.addFile(imgData.path, {key: imgData.key});
task.setRequestHeader('accessToken', localStorage.getItem('accessToken'));
task.start();
},
/****************************************上传图片*************************************************/
}
}
</script>
<template>
<div>
<div style="margin:100px auto 10px auto;text-align: center">
<img src="../../../assets/file-down.png" height="100">
<p style="margin:10px auto">{{fileName}}</p>
<p style="color:#aaa;"> {{ctime}}</p>
</div>
<div class="bottom-btn" style="padding: 20px">
<van-button block type="info" @click="_view">预览</van-button>
</div>
</div>
</template>
<script>
export default {
data() {
return {
fileName: '',
id: '',
ctime: '',
}
},
mounted() {
this._getQuery();
},
methods: {
_getQuery() {
this.fileName = this.$route.query.fileName;
this.id = this.$route.query.id;
this.ctime = this.$dateformat(this.$route.query.ctime,'yyyy/mm/dd');
},
//下载
_ok() {
this.$toast.loading({
message: '下载中...',
forbidClick: true,
});
var dtask = plus.downloader.createDownload(
this.$global.baseURL + '/drs/v1/sampling_plan_attachment/down?id=' + this.id,
{}, (d, status) => {
// 下载完成
if (status == 200) {
this.$toast.clear();
this.$toast.success({message: '下载到' + d.filename, duration: 4000});
this.$router.go(-1);
} else {
this.$toast.clear();
this.$toast.error('下载失败');
}
});
dtask.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
dtask.setRequestHeader('accessToken', localStorage.getItem('accessToken'));
dtask.start();
},
//下载并预览文档
_view() {
//调用第三放程序打开指定文件(必须是本地路径)
this.$toast.loading({
message: '加载中...',
forbidClick: true,
});
var dtask = plus.downloader.createDownload(
this.$global.baseURL + '/drs/v1/sampling_plan_attachment/down?id=' + this.id, {}, (d, status) => {
if (status == 200) {
plus.runtime.openFile(d.filename);//cn.wps.moffice_eng-----wps的包名
}
this.$toast.clear();
});
dtask.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
dtask.setRequestHeader('accessToken', localStorage.getItem('accessToken'));
dtask.start();
},
}
}
</script>
<template>
<div>
<div style="margin:100px auto 10px auto;text-align: center">
<div>
<Upload
multiple
:action="action"
:on-success="_handelsuccess"
:before-upload="_beupload"
:data="dataObj"
:headers="headers"
:with-credentials="true"
:show-upload-list="false"
>
<img src="../../../assets/file-add.png" height="100">
</Upload>
</div>
<p style="margin:10px auto">请选择附件上传</p>
</div>
</div>
</template>
<script>
export default {
data() {
return {
planId: '',
action: '',
dataObj: {
file: '',
},
headers: '',
}
},
mounted() {
this._getQuery();
},
methods: {
_getQuery() {
this.planId = this.$route.query.planId;
this.action = this.$global.baseURL + '/drs/v1/sampling_plan_attachment/' + this.planId;
this.headers = {'accessToken': localStorage.getItem('accessToken')};
},
//web
_beupload(file) {
this.dataObj.file = file.name;
this.$toast.loading({
message: '加载中...',
forbidClick: true,
});
},
_handelsuccess(response) { //上传成功
this.$toast.clear();
if (response.success) {
this.$toast('上传成功');
this.$router.go(-1);
} else {
this.$toast('上传失败');
}
},
}
}
</script>
<template>
<div></div>
</template>
<script>
export default {
name: "CreateLoc"
}
</script>
<style scoped>
</style>
<template>
<div>
<search-bar label="地点名称" @search="_search"></search-bar>
<div class="layout-cont-s layout-cont-s-btn" >
<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">
<div>地点:{{item.name}}</div>
<div style="width: 100%">地址:{{item.address}}</div>
<div>经度:{{item.longitude}}</div>
<div>纬度:{{item.latitude}}</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>
</div>
</div>
</template>
<script>
import {samplingPlace} from '../../../api'
export default {
data() {
return {
resultList: [],
page: 1,
rows: 10,
refreshing: false,//刷新中...
loading: false,//加载中...
finished: false,//没有更多数据
planId: ''
}
},
mounted() {
this.planId = this.$route.query.planId
this._getData()
},
methods: {
_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()
},
_add() {
this.$router.push({path: '/sampling_plan/select_loc', query: {planId: this.planId}})
},
_del: async function (id) {
let result = await samplingPlace.deleteByIds({ids: [id]})
if (result) {
this.$toast('操作成功!')
this._refresh()
}
},
}
}
</script>
<style scoped>
</style>
<template>
<div>
<div style="display: flex">
<van-field name="checkboxGroup" label="省市区">
<template #input>
<select id='province' @change='_locSearch'></select>
</template>
</van-field>
<van-field name="checkboxGroup" label="地级市">
<template #input>
<select id='city' @change='_locSearch'></select>
</template>
</van-field>
<van-field name="checkboxGroup" label="区县">
<template #input>
<select id='district' @change='_locSearch'></select>
</template>
</van-field>
</div>
<div style="display: flex;">
<div style="width:50%;">
<van-field
v-model="formObj.key"
label="关键字"
placeholder="关键字"
></van-field>
</div>
<div style="width:50%;display: flex;background: #ffffff">
<van-button type="primary" block style="margin:0 20px" @click="_areaSearch">搜索</van-button>
<van-button type="danger" block style="margin:0 20px" @click="_clear">清空</van-button>
</div>
</div>
<div class="layout-cont-s" style="height: calc(100% - 150px);margin-bottom: 10px">
<van-checkbox-group v-model="checkListValue" ref="checkboxGroup">
<div class="result-item" v-for="(item,index) in resultList" :key="index" @click="_tapItem(item)">
<div>
<van-checkbox :name="item" shape="square">名称:{{item.name}}</van-checkbox>
</div>
<div>地址:{{item.address}}</div>
<div>经度:{{item.longitude}}</div>
<div>纬度:{{item.latitude}}</div>
</div>
</van-checkbox-group>
</div>
<div id='areaContainer' style="width: 100%;height: 50%;margin-top: 100px" v-show="false"></div>
<div id="areaPanel" v-show="false"></div>
<div class="bottom-btn">
<van-button type="info" block @click="_add">添加</van-button>
</div>
</div>
</template>
<script>
import {samplingPlace} from '../../../api'
let that = {}
export default {
data() {
return {
map: {},
district: {},
placeSearch: {},
polygons: [],
adcode: '',
provinceSelect: {},
citySelect: {},
districtSelect: {},
completeData: {},
formObj: {
key: ''
},
isSearch: false,
planId: '',
resultList: [],
checkListValue: []
}
},
mounted() {
this.planId = this.$route.query.planId
this._open()
},
methods: {
_tapItem(item) {
if (this.checkListValue.indexOf(item) === -1) {
this.checkListValue.push(item);
} else {
this.checkListValue.splice(this.checkListValue.indexOf(item), 1);
}
},
_add() {
console.log(this.checkListValue, 'this.checkListValue')
if (this.checkListValue.length === 0) {
this.$toast('请至少选择一条数据!')
} else {
this._addOk()
}
},
_addOk: async function () {
let data = {
places: this.checkListValue.map(item => {
return {
name: item.name,
address: item.address,
latitude: item.latitude,
longitude: item.longitude
}
}),
planId: this.planId
}
console.log(data, ';data')
let result = await samplingPlace.savePlaces(data)
if (result) {
this.$toast('操作成功')
this.$router.go(-1)
}
},
_open() {
that = this
this.isSearch = false
this.map = new AMap.Map('areaContainer', {
zoom: 14
});
this.provinceSelect = document.getElementById('province');
this.citySelect = document.getElementById('city');
this.districtSelect = document.getElementById('district');
//行政区划查询
let opts = {
subdistrict: 1, //返回下一级行政区
showbiz: false //最后一级返回街道信息
};
this.district = new AMap.DistrictSearch(opts);//注意:需要使用插件同步下发功能才能这样直接使用
this.district.search('中国', function (status, result) {
if (status === 'complete') {
that.completeData = result.districtList[0]
that._getData(result.districtList[0]);
}
});
},
_areaSearch() {
this._clearSearch()
this.$nextTick(function () {
if (!this.adcode) {
this.$toast('请输入关键字!')
return
}
if (this.formObj.key) {
//构造地点查询类
this.placeSearch = new AMap.PlaceSearch({
pageSize: 50, // 单页显示结果条数
pageIndex: 1, // 页码
city: that.adcode, // 兴趣点城市
citylimit: true, //是否强制限制在设置的城市内搜索
map: that.map, // 展现结果的地图实例
panel: "areaPanel", // 结果列表将在此容器中进行展示。
// showCover: false,
autoFitView: true // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
});
this.placeSearch.search(that.formObj.key, function (status, result) {
that.isSearch = true
that.resultList = result.poiList.pois.map(item => {
return {
name: item.name,
address: item.address,
latitude: item.location.lat,
longitude: item.location.lng
}
})
console.log(result, 'result')
});
} else {
this.$toast('请输入关键字!')
}
})
},
_clearSearch() {
if (this.isSearch) {
this.placeSearch.clear()
}
},
_clear() {
this.map.clearMap();
//行政区划的去空
for (let i = 0, l = this.polygons.length; i < l; i++) {
this.polygons[i].setMap(null);
}
this._clearSearch()
this.formObj.key = ''
this.adcode = ''
this.provinceSelect.innerHTML = '';
this.citySelect.innerHTML = '';
this.districtSelect.innerHTML = '';
this._getData(this.completeData)
},
_getData(data, level) {
this.map.clearMap();
let bounds = data.boundaries;
if (bounds) {
for (let i = 0, l = bounds.length; i < l; i++) {
let polygon = new AMap.Polygon({
map: that.map,
strokeWeight: 1,
strokeColor: '#0091ea',
fillColor: '#80d8ff',
fillOpacity: 0.2,
path: bounds[i]
});
that.polygons.push(polygon);
}
// this.map.setFitView();//地图自适应 app端报错
}
//清空下一级别的下拉列表
if (level === 'province') {
this.citySelect.innerHTML = '';
this.districtSelect.innerHTML = '';
} else if (level === 'city') {
this.districtSelect.innerHTML = '';
}
if (level !== 'district') {
//获取全国的省份list[] {adcode,level:'province',name:'山东省'}
let subList = data.districtList;
if (subList) {
let contentSub = new Option('--请选择--');
//获取下拉项的等级 province
let curlevel = subList[0].level;
//获取id 为curlevel的元素select
let curList = document.querySelector('#' + curlevel);
//添加一项option
curList.add(contentSub);
//遍历省份添加option到select下
for (let i = 0, l = subList.length; i < l; i++) {
contentSub = new Option(subList[i].name);
contentSub.setAttribute("value", subList[i].level);
contentSub.center = subList[i].center;
contentSub.adcode = subList[i].adcode;
contentSub.cityCode = subList[i].cityCode;
curList.add(contentSub);
}
}
}
},
_locSearch(obj) {
debugger
//清除地图上所有覆盖物
for (let i = 0, l = this.polygons.length; i < l; i++) {
this.polygons[i].setMap(null);
}
let option = obj.srcElement[obj.srcElement.options.selectedIndex];
that.adcode = option.adcode
//如果没有选择 则清空下级下拉
if (option.adcode) {
this.district.setLevel(option.value); //行政区级别
this.district.setExtensions('all');
//行政区查询
//按照adcode进行查询可以保证数据返回的唯一性
this.district.search(option.adcode, function (status, result) {
if (status === 'complete') {
that._getData(result.districtList[0], obj.srcElement.id);
}
});
} else {
//省份未选择时 清空市区
if (obj.srcElement.id === 'province') {
this.citySelect.innerHTML = '';
this.districtSelect.innerHTML = '';
}
//市未选择时 清空区
if (obj.srcElement.id === 'city') {
this.districtSelect.innerHTML = '';
}
//市 区未选择时的处理
let option1 = document.querySelector('#province')[document.querySelector('#province').options.selectedIndex]
let option2 = document.querySelector('#city')[document.querySelector('#city').options.selectedIndex]
let option3 = document.querySelector('#district')[document.querySelector('#district').options.selectedIndex]
let id = ''
if (option3 && option3.adcode) {
that.adcode = option3.adcode
this.district.setLevel(option3.value); //行政区级别
id = 'district'
} else if (option2 && option2.adcode) {
that.adcode = option2.adcode
this.district.setLevel(option2.value); //行政区级别
id = 'city'
} else {
that.adcode = option1.adcode
this.district.setLevel(option1.value); //行政区级别
id = 'province'
}
this.district.setExtensions('all');
//行政区查询
//按照adcode进行查询可以保证数据返回的唯一性
this.district.search(that.adcode, function (status, result) {
if (status === 'complete') {
that._getData(result.districtList[0], id);
}
});
}
},
}
}
</script>
<style scoped lang="less">
#areaPanel {
position: fixed;
background-color: white;
max-height: 90%;
overflow-y: auto;
top: 10px;
right: 10px;
width: 280px;
}
select {
position: relative;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
margin-bottom: 0;
display: inline-block;
height: 32px;
padding: .375rem 1.75rem .375rem .75rem;
line-height: 1.5;
color: #495057;
vertical-align: middle;
background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center;
background-size: 8px 10px;
border: 1px solid #ced4da;
border-radius: 4px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none
}
select:not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0
}
select:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0
}
select:focus {
border-color: #80bdff;
outline: 0;
box-shadow: 0 0 0 .1rem rgba(128, 189, 255, .1)
}
select:focus::-ms-value {
color: #495057;
background-color: #fff
}
</style>
<template>
<div></div>
</template>
<script>
export default {
name: "CreateSampler"
}
</script>
<style scoped>
</style>
<template>
<div>
<search-bar label="姓名" @search="_search"></search-bar>
<div class="layout-cont-s layout-cont-s-btn" >
<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">
<div>姓名:{{item.name}}</div>
<div>电话:{{item.tel}}</div>
<div>所属部门:{{item.department}}</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>
</div>
</div>
</template>
<script>
import {samplingPlan} from '../../../api'
export default {
data() {
return {
resultList: [],
page: 1,
rows: 10,
refreshing: false,//刷新中...
loading: false,//加载中...
finished: false,//没有更多数据
planId: ''
}
},
mounted() {
this.planId = this.$route.query.planId
this._getData()
},
methods: {
_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 samplingPlan.samplerPage(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.$router.push({path: '/sampling_plan/select_sampler',query:{planId:this.planId}})
},
_del: async function (id) {
let result = await samplingPlan.deletePlanSampler({samplerId: id, planId: this.planId})
if (result) {
this.$toast('操作成功!')
this._refresh()
}
},
}
}
</script>
<style scoped>
</style>
<template>
<div>
<search-bar label="姓名" @search="_search"></search-bar>
<div class="layout-cont-s layout-cont-s-btn" >
<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.tel}}</div>
<div>所属部门:{{item.department}}</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>
</div>
</template>
<script>
import {sampler, samplingPlan} from '../../../api'
export default {
data() {
return {
resultList: [],
page: 1,
rows: 10,
refreshing: false,//刷新中...
loading: false,//加载中...
finished: false,//没有更多数据
checkListValue: [],
planId: ''
}
},
mounted() {
this.planId = this.$route.query.planId
this._getData()
},
methods: {
_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,
status: 1
};
return this.$serializeForm(data)
},
_getData: async function () {
let result = await sampler.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,
samplerIds: this.checkListValue.join(',')
}
let result = await samplingPlan.saveSampler(data)
if (result) {
this.$toast('操作成功')
this.$router.go(-1)
}
},
}
}
</script>
<style scoped>
</style>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</template> </template>
<template #content> <template #content>
<search-bar label="地点" @search="_search"></search-bar> <search-bar label="地点" @search="_search"></search-bar>
<div class="layout-cont-s layout-cont-s-btn" style="margin-top: 54px"> <div class="layout-cont-s layout-cont-s-btn" >
<van-pull-refresh v-model="refreshing" @refresh="_refresh"> <van-pull-refresh v-model="refreshing" @refresh="_refresh">
<van-list <van-list
v-model="loading" v-model="loading"
......
...@@ -2,6 +2,7 @@ import Index from '@/page/Index' ...@@ -2,6 +2,7 @@ import Index from '@/page/Index'
import Home from '@/page/Home' import Home from '@/page/Home'
import Login from '@/page/Login' import Login from '@/page/Login'
import ForgetPwd from '@/page/ForgetPwd' import ForgetPwd from '@/page/ForgetPwd'
import SamplingPlanRoutes from './sampling-plan-routes'
import SamplingTaskRoutes from './sampling-task-routes' import SamplingTaskRoutes from './sampling-task-routes'
import SamplingListRoutes from './sampling-list-routes' import SamplingListRoutes from './sampling-list-routes'
import HistorySamplingRoutes from './history-sampling-routes' import HistorySamplingRoutes from './history-sampling-routes'
...@@ -44,6 +45,11 @@ export default [ ...@@ -44,6 +45,11 @@ export default [
mata: {title: '个人中心'} mata: {title: '个人中心'}
}, },
{ {
path: '/sampling_plan',
component: Index,
children: SamplingPlanRoutes,
mata: {title: '抽样计划'}
}, {
path: '/sampling_task', path: '/sampling_task',
component: Index, component: Index,
children: SamplingTaskRoutes, children: SamplingTaskRoutes,
......
import SamplingPlan from '@/page/sampling-plan/SamplingPlan.vue'
import SamplingPlanAdd from '@/page/sampling-plan/SamplingPlanAdd.vue'
import SamplerChecked from '@/page/sampling-plan/sampler/SamplerChecked.vue'
import SelectSampler from '@/page/sampling-plan/sampler/SelectSampler.vue'
import CreateSampler from '@/page/sampling-plan/sampler/CreateSampler.vue'
import LocChecked from '@/page/sampling-plan/loc/LocChecked.vue'
import SelectLoc from '@/page/sampling-plan/loc/SelectLoc.vue'
import CreateLoc from '@/page/sampling-plan/loc/CreateLoc.vue'
import File from '@/page/sampling-plan/file/File.vue'
import FileDownLoad from '@/page/sampling-plan/file/FileDownLoad.vue'
import FileUpload from '@/page/sampling-plan/file/FileUpload.vue'
export default [
{path: 'sampling_plan', component: SamplingPlan, meta: {title: '抽样计划', hideNavBar: true}},
//todo 自定义标题
{path: 'sampling_plan_add', component: SamplingPlanAdd, meta: {customerNavBarTitle: true}},
{path: 'sampler_checked', component: SamplerChecked, meta: {title: '管理抽样人员'}},
{path: 'select_sampler', component: SelectSampler, meta: {title: '选择抽样人员'}},
{path: 'create_sampler', component: CreateSampler, meta: {title: '生成抽样人员'}},
{path: 'loc_checked', component: LocChecked, meta: {title: '管理抽样地点'}},
{path: 'select_loc', component: SelectLoc, meta: {title: '选择抽样地点'}},
{path: 'create_loc', component: CreateLoc, meta: {title: '生成抽样地点'}},
{path: 'file', component: File, meta: {title: '附件'}},
{path: 'file_upload', component: FileUpload, meta: {title: '添加附件'}},
{path: 'file_download', component: FileDownLoad, meta: {title: '预览附件'}},
]
...@@ -66,6 +66,7 @@ html, body, #app, .main-content-con { ...@@ -66,6 +66,7 @@ html, body, #app, .main-content-con {
.layout-cont-s-btn { .layout-cont-s-btn {
width: 100%; width: 100%;
height: calc(100% - 54px - 44px); height: calc(100% - 54px - 44px);
margin-top: 54px;
overflow: auto; overflow: auto;
} }
...@@ -96,6 +97,11 @@ html, body, #app, .main-content-con { ...@@ -96,6 +97,11 @@ html, body, #app, .main-content-con {
width: 50% width: 50%
} }
} }
.bottom-btn-five {
> button {
width: 20%
}
}
.personal-cont { .personal-cont {
.personal-top-img { .personal-top-img {
......
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