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>
<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>
</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