Commit 995daaaa by zhuxiaomei

直接添加抽样单

parent 44710735
...@@ -39,23 +39,24 @@ ...@@ -39,23 +39,24 @@
<van-checkbox-group v-model="checkListValue" ref="checkboxGroup"> <van-checkbox-group v-model="checkListValue" ref="checkboxGroup">
<van-swipe-cell v-for="item in resultList" :key="item.id"> <van-swipe-cell v-for="item in resultList" :key="item.id">
<div class="result-item" @click="_tapItem(item)" v-touch:longtap="_longtapHandler"> <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="width: 100%;display: flex;justify-content: space-between;border-bottom: 1px solid #eeeeee">
<div style="display: flex"> <div style="display: flex">
<div style="margin-right: 20px" v-if="showCheck"> <div style="margin-right: 20px" v-if="showCheck">
<van-checkbox :name="item.id" shape="square"></van-checkbox> <van-checkbox :name="item.id" shape="square"></van-checkbox>
</div> </div>
<div>抽样单编号:{{item.samplingNum}}</div> <div>抽样单编号:{{ item.samplingNum }}</div>
</div> </div>
<div @click.stop="_goFile(item.id)"> <div @click.stop="_goFile(item.id)">
<img src="../../assets/file-nav.png" style="width: 20px"> <img src="../../assets/file-nav.png" style="width: 20px">
</div> </div>
</div> </div>
<div>抽样日期:{{item.samplingDate?$dateformat(item.samplingDate,'yyyy-mm-dd'):''}}</div> <div>抽样日期:{{ item.samplingDate ? $dateformat(item.samplingDate, 'yyyy-mm-dd') : '' }}</div>
<div>生产者名称:{{item.proName}}</div> <div>生产者名称:{{ item.proName }}</div>
<div>样品名称:{{item.sampleName}}</div> <div>样品名称:{{ item.sampleName }}</div>
<div>被抽样单位名称:{{item.testedName}}</div> <div>被抽样单位名称:{{ item.testedName }}</div>
<div>地点:{{item.placeName}}</div> <div>地点:{{ item.placeName }}</div>
<div>货架:{{item.shelfName}}</div> <div>货架:{{ item.shelfName }}</div>
</div> </div>
<template #right> <template #right>
<van-button square type="info" text="编辑" class="swipe-cell-btn" <van-button square type="info" text="编辑" class="swipe-cell-btn"
...@@ -71,7 +72,7 @@ ...@@ -71,7 +72,7 @@
</van-pull-refresh> </van-pull-refresh>
</div> </div>
<div class="bottom-btn" v-if="showCheck"> <div class="bottom-btn" v-if="showCheck">
<van-button square block @click="_checkAll">{{checkAll?'取消全选':'全选'}}</van-button> <van-button square block @click="_checkAll">{{ checkAll ? '取消全选' : '全选' }}</van-button>
<van-button square block type="danger" @click="_del(checkListValue)">删除</van-button> <van-button square block type="danger" @click="_del(checkListValue)">删除</van-button>
</div> </div>
</template> </template>
...@@ -80,10 +81,10 @@ ...@@ -80,10 +81,10 @@
</template> </template>
<script> <script>
import SelectShelves from './components/SelectShelves' import SelectShelves from './components/SelectShelves'
import {samplingSummary} from '../../api' import {samplingSummary} from '../../api'
export default { export default {
name: "SamplingList", name: "SamplingList",
components: { components: {
SelectShelves SelectShelves
...@@ -105,7 +106,7 @@ ...@@ -105,7 +106,7 @@
refreshing: false,//刷新中... refreshing: false,//刷新中...
loading: false,//加载中... loading: false,//加载中...
finished: false,//没有更多数据 finished: false,//没有更多数据
planId: this.$route.query.planId planId: this.$route.query.planId ? this.$route.query.planId : ''
} }
}, },
watch: { watch: {
...@@ -145,12 +146,14 @@ ...@@ -145,12 +146,14 @@
let data = { let data = {
page: this.page, page: this.page,
rows: this.rows, rows: this.rows,
planId: this.planId,
...this.formObj ...this.formObj
}; };
if (this.key) { if (this.key) {
data.samplingNum = this.key data.samplingNum = this.key
} }
if (this.planId) {
data.planId = this.planId
}
return this.$serializeForm(data) return this.$serializeForm(data)
}, },
_getData: async function () { _getData: async function () {
...@@ -174,7 +177,14 @@ ...@@ -174,7 +177,14 @@
this.$router.go(-1) this.$router.go(-1)
}, },
_add() { _add() {
if (this.planId) {
this.$refs.shelvesSelect._open(this.planId) this.$refs.shelvesSelect._open(this.planId)
} else {
this.$router.push({
path: '/sampling_list/sampling_list_add',
query: {title: '抽样单添加'}
})
}
}, },
_shelvesResult({testedType, shelfId}) { _shelvesResult({testedType, shelfId}) {
if (testedType === 1) { if (testedType === 1) {
...@@ -281,7 +291,7 @@ ...@@ -281,7 +291,7 @@
this.$router.push({path: '/sampling_list/file', query: {summaryId: id}}) this.$router.push({path: '/sampling_list/file', query: {summaryId: id}})
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
......
...@@ -875,8 +875,8 @@ export default { ...@@ -875,8 +875,8 @@ export default {
id: '', id: '',
testedType: this.$route.query.testedType, testedType: this.$route.query.testedType?this.$route.query.testedType:'',
shelfId: this.$route.query.shelfId shelfId: this.$route.query.shelfId?this.$route.query.shelfId:''
} }
}, },
watch: { watch: {
...@@ -1054,8 +1054,8 @@ export default { ...@@ -1054,8 +1054,8 @@ export default {
} }
} }
} }
this.testedType = result.testedType this.testedType = result.testedType?result.testedType:''
this.shelfId = result.shelfId this.shelfId = result.shelfId?result.shelfId:''
}, },
_valParams() { _valParams() {
if (this.formObj.samplingNum === '') { if (this.formObj.samplingNum === '') {
......
<template> <template>
<div> <customer-navBar-layout>
<template #navBar>
<van-nav-bar
:title="$route.meta.title"
right-text="查看所有抽样单"
left-arrow
@click-left="_back"
@click-right="_viewListAll"
></van-nav-bar>
</template>
<template #content>
<search-bar label="计划名称" <search-bar label="计划名称"
ref="searchBar" ref="searchBar"
highSearch highSearch
...@@ -8,7 +18,7 @@ ...@@ -8,7 +18,7 @@
@clear-high="_clearHigh"> @clear-high="_clearHigh">
<template #highSearch> <template #highSearch>
<van-field v-model="formObj.name" label="计划名称" placeholder="请输入计划名称" clearable></van-field> <van-field v-model="formObj.name" label="计划名称" placeholder="请输入计划名称" clearable></van-field>
<datetime-field label="计划开始日期" v-model="formObj.planDateBegin" ></datetime-field> <datetime-field label="计划开始日期" v-model="formObj.planDateBegin"></datetime-field>
<datetime-field label="计划结束日期" v-model="formObj.planDateEnd"></datetime-field> <datetime-field label="计划结束日期" v-model="formObj.planDateEnd"></datetime-field>
<van-field v-model="formObj.uname" label="登记人" placeholder="请输入登记人" clearable></van-field> <van-field v-model="formObj.uname" label="登记人" placeholder="请输入登记人" clearable></van-field>
<datetime-field label="登记开始日期" v-model="formObj.ctimeBegin"></datetime-field> <datetime-field label="登记开始日期" v-model="formObj.ctimeBegin"></datetime-field>
...@@ -25,20 +35,21 @@ ...@@ -25,20 +35,21 @@
finished-text="没有更多了" finished-text="没有更多了"
@load="_load"> @load="_load">
<div class="result-item" v-for="item in resultList" :key="item.name" @click="_goto(item.id)"> <div class="result-item" v-for="item in resultList" :key="item.name" @click="_goto(item.id)">
<div>计划名称:{{item.name}}</div> <div>计划名称:{{ item.name }}</div>
<div>抽样进度:{{item.summaryCount+'/'+item.samplingQuantity}}</div> <div>抽样进度:{{ item.summaryCount + '/' + item.samplingQuantity }}</div>
<div>状态:{{item.progress}}</div> <div>状态:{{ item.progress }}</div>
</div> </div>
</van-list> </van-list>
</van-pull-refresh> </van-pull-refresh>
</div> </div>
</div> </template>
</customer-navBar-layout>
</template> </template>
<script> <script>
import {samplingPlan} from '../../api' import {samplingPlan} from '../../api'
export default { export default {
components: {}, components: {},
data() { data() {
return { return {
...@@ -86,7 +97,7 @@ ...@@ -86,7 +97,7 @@
} else if (this.formObj.planDateBegin !== '' && this.formObj.planDateEnd === '') { } else if (this.formObj.planDateBegin !== '' && this.formObj.planDateEnd === '') {
this.$toast('请选择计划结束日期!') this.$toast('请选择计划结束日期!')
return false return false
} else if (this.formObj.planDateBegin !== '' && this.formObj.planDateEnd !== '' && (new Date(this.formObj.planDateBegin) > new Date(this.formObj.planDateEnd))){ } else if (this.formObj.planDateBegin !== '' && this.formObj.planDateEnd !== '' && (new Date(this.formObj.planDateBegin) > new Date(this.formObj.planDateEnd))) {
this.$toast('计划开始日期不能大于计划结束日期!') this.$toast('计划开始日期不能大于计划结束日期!')
return false return false
} }
...@@ -96,7 +107,7 @@ ...@@ -96,7 +107,7 @@
} else if (this.formObj.ctimeBegin !== '' && this.formObj.ctimeEnd === '') { } else if (this.formObj.ctimeBegin !== '' && this.formObj.ctimeEnd === '') {
this.$toast('请选择登记结束日期!') this.$toast('请选择登记结束日期!')
return false return false
} else if (this.formObj.ctimeBegin !== '' && this.formObj.ctimeEnd !== '' && (new Date(this.formObj.ctimeBegin) > new Date(this.formObj.ctimeEnd))){ } else if (this.formObj.ctimeBegin !== '' && this.formObj.ctimeEnd !== '' && (new Date(this.formObj.ctimeBegin) > new Date(this.formObj.ctimeEnd))) {
this.$toast('登记开始日期不能大于登记结束日期!') this.$toast('登记开始日期不能大于登记结束日期!')
return false return false
} }
...@@ -135,10 +146,17 @@ ...@@ -135,10 +146,17 @@
this._getData() this._getData()
}, },
_goto(id) { _goto(id) {
this.$router.push({path:'/sampling_list/sampling_list',query:{planId:id}}) this.$router.push({path: '/sampling_list/sampling_list', query: {planId: id}})
},
_back() {
this.$router.go(-1)
},
_viewListAll() {
this.$router.push({path: '/sampling_list/sampling_list'})
}, },
} }
} }
</script> </script>
<style scoped> <style scoped>
......
...@@ -12,7 +12,7 @@ import SamplingListAddAgriculture from '@/page/sampling-list/SamplingListAddAgri ...@@ -12,7 +12,7 @@ import SamplingListAddAgriculture from '@/page/sampling-list/SamplingListAddAgri
import SamplingListDetailAgriculture from '@/page/sampling-list/SamplingListDetailAgriculture.vue' import SamplingListDetailAgriculture from '@/page/sampling-list/SamplingListDetailAgriculture.vue'
export default [ export default [
{path: 'sampling_task', component: SamplingTask, meta: {title: '抽样任务'}}, {path: 'sampling_task', component: SamplingTask, meta: {title: '抽样任务', hideNavBar: true}},
{path: 'sampling_list', component: SamplingList, meta: {title: '抽样单', hideNavBar: true}}, {path: 'sampling_list', component: SamplingList, meta: {title: '抽样单', hideNavBar: true}},
{path: 'sampling_list_add', component: SamplingListAdd, meta: {customerNavBarTitle: true}}, {path: 'sampling_list_add', component: SamplingListAdd, meta: {customerNavBarTitle: true}},
{path: 'sampling_list_add_agriculture', component: SamplingListAddAgriculture, meta: {customerNavBarTitle: true}}, {path: 'sampling_list_add_agriculture', component: SamplingListAddAgriculture, meta: {customerNavBarTitle: true}},
......
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