Commit 995daaaa by zhuxiaomei

直接添加抽样单

parent 44710735
<template> <template>
<customer-navBar-layout> <customer-navBar-layout>
<template #navBar> <template #navBar>
<van-nav-bar v-if="showCheck" <van-nav-bar v-if="showCheck"
:title="$route.meta.title" :title="$route.meta.title"
right-text="取消" right-text="取消"
left-arrow left-arrow
@click-left="_back" @click-left="_back"
@click-right="_hideCheck"> @click-right="_hideCheck">
</van-nav-bar> </van-nav-bar>
<van-nav-bar <van-nav-bar
v-else v-else
:title="$route.meta.title" :title="$route.meta.title"
right-text="添加" right-text="添加"
left-arrow left-arrow
@click-left="_back" @click-left="_back"
@click-right="_add" @click-right="_add"
></van-nav-bar> ></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.samplingNum" label="抽样单编号" placeholder="请输入抽样单编号"></van-field>
<van-field v-model="formObj.placeName" label="地点" placeholder="请输入地点"></van-field>
<van-field v-model="formObj.shelfName" label="货架" placeholder="请输入货架"></van-field>
</template> </template>
<template #content> </search-bar>
<search-bar label="抽样单编号" ref="searchBar" <div class="layout-cont-sh" :class="{'layout-cont-sh-btn':showCheck}">
highSearch @search="_search" @high-search="_highSearch" <!--下拉刷新 https://vant-contrib.gitee.io/vant/#/zh-CN/pull-refresh-->
@clear-high="_clearHigh"> <van-pull-refresh v-model="refreshing" @refresh="_refresh">
<template #highSearch> <!--上拉加载 https://vant-contrib.gitee.io/vant/#/zh-CN/list-->
<van-field v-model="formObj.samplingNum" label="抽样单编号" placeholder="请输入抽样单编号"></van-field> <van-list
<van-field v-model="formObj.placeName" label="地点" placeholder="请输入地点"></van-field> v-model="loading"
<van-field v-model="formObj.shelfName" label="货架" placeholder="请输入货架"></van-field> :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.samplingNum }}</div>
</div>
<div @click.stop="_goFile(item.id)">
<img src="../../assets/file-nav.png" style="width: 20px">
</div>
</div>
<div>抽样日期:{{ item.samplingDate ? $dateformat(item.samplingDate, 'yyyy-mm-dd') : '' }}</div>
<div>生产者名称:{{ item.proName }}</div>
<div>样品名称:{{ item.sampleName }}</div>
<div>被抽样单位名称:{{ item.testedName }}</div>
<div>地点:{{ item.placeName }}</div>
<div>货架:{{ item.shelfName }}</div>
</div>
<template #right>
<van-button square type="info" text="编辑" class="swipe-cell-btn"
@click="_edit(item)"></van-button>
<van-button square type="primary" text="打印" class="swipe-cell-btn"
@click="_print(item)"></van-button>
<van-button square type="danger" text="删除" class="swipe-cell-btn"
@click="_del([item.id])"></van-button>
</template> </template>
</search-bar> </van-swipe-cell>
<div class="layout-cont-sh" :class="{'layout-cont-sh-btn':showCheck}"> </van-checkbox-group>
<!--下拉刷新 https://vant-contrib.gitee.io/vant/#/zh-CN/pull-refresh--> </van-list>
<van-pull-refresh v-model="refreshing" @refresh="_refresh"> </van-pull-refresh>
<!--上拉加载 https://vant-contrib.gitee.io/vant/#/zh-CN/list--> </div>
<van-list <div class="bottom-btn" v-if="showCheck">
v-model="loading" <van-button square block @click="_checkAll">{{ checkAll ? '取消全选' : '全选' }}</van-button>
:finished="finished" <van-button square block type="danger" @click="_del(checkListValue)">删除</van-button>
finished-text="没有更多了" </div>
@load="_load"> </template>
<van-checkbox-group v-model="checkListValue" ref="checkboxGroup"> <SelectShelves ref="shelvesSelect" @on-select="_shelvesResult"></SelectShelves>
<van-swipe-cell v-for="item in resultList" :key="item.id"> </customer-navBar-layout>
<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.samplingNum}}</div>
</div>
<div @click.stop="_goFile(item.id)">
<img src="../../assets/file-nav.png" style="width: 20px">
</div>
</div>
<div>抽样日期:{{item.samplingDate?$dateformat(item.samplingDate,'yyyy-mm-dd'):''}}</div>
<div>生产者名称:{{item.proName}}</div>
<div>样品名称:{{item.sampleName}}</div>
<div>被抽样单位名称:{{item.testedName}}</div>
<div>地点:{{item.placeName}}</div>
<div>货架:{{item.shelfName}}</div>
</div>
<template #right>
<van-button square type="info" text="编辑" class="swipe-cell-btn"
@click="_edit(item)"></van-button>
<van-button square type="primary" text="打印" class="swipe-cell-btn"
@click="_print(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" v-if="showCheck">
<van-button square block @click="_checkAll">{{checkAll?'取消全选':'全选'}}</van-button>
<van-button square block type="danger" @click="_del(checkListValue)">删除</van-button>
</div>
</template>
<SelectShelves ref="shelvesSelect" @on-select="_shelvesResult"></SelectShelves>
</customer-navBar-layout>
</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
}, },
data() { data() {
return { return {
formObj: { formObj: {
samplingNum: '', samplingNum: '',
placeName: '', placeName: '',
shelfName: '', shelfName: '',
}, },
key: '', key: '',
showPopup: true, showPopup: true,
showCheck: false, showCheck: false,
checkListValue: [], checkListValue: [],
resultList: [], resultList: [],
page: 1, page: 1,
rows: 10, rows: 10,
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: {
checkListValue: function (oldVal, newVal) { checkListValue: function (oldVal, newVal) {
console.log(oldVal, newVal) console.log(oldVal, newVal)
} }
}, },
computed: { computed: {
checkAll: function () { checkAll: function () {
if (this.resultList.length) { if (this.resultList.length) {
return this.checkListValue.length === this.resultList.length; return this.checkListValue.length === this.resultList.length;
} else { } else {
return false return false
} }
} }
}, },
mounted() { mounted() {
this._getData() this._getData()
}, },
methods: { methods: {
//简单查询 清空高级查询条件 赋值简单查询数据 //简单查询 清空高级查询条件 赋值简单查询数据
_search(value) { _search(value) {
this.key = value this.key = value
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
this._refresh() this._refresh()
}, },
//高级搜索 清空key 查询 //高级搜索 清空key 查询
_highSearch() { _highSearch() {
this.key = '' this.key = ''
this.$refs.searchBar._hideHighSearch() this.$refs.searchBar._hideHighSearch()
this._refresh() this._refresh()
}, },
_clearHigh() { _clearHigh() {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
}, },
_searchParams() { _searchParams() {
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) {
return this.$serializeForm(data) data.planId = this.planId
}, }
_getData: async function () { return this.$serializeForm(data)
let result = await samplingSummary.page(this._searchParams()) },
this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records] _getData: async function () {
this.refreshing = false let result = await samplingSummary.page(this._searchParams())
this.loading = false this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records]
if (this.resultList.length === result.total) { this.refreshing = false
this.finished = true this.loading = false
} if (this.resultList.length === result.total) {
}, this.finished = true
_refresh() { }
this.page = 1; },
this._getData() _refresh() {
}, this.page = 1;
_load() { this._getData()
this.page = this.page + 1; },
this._getData() _load() {
}, this.page = this.page + 1;
_back() { this._getData()
this.$router.go(-1) },
}, _back() {
_add() { this.$router.go(-1)
this.$refs.shelvesSelect._open(this.planId) },
}, _add() {
_shelvesResult({testedType, shelfId}) { if (this.planId) {
if (testedType === 1) { this.$refs.shelvesSelect._open(this.planId)
this.$router.push({ } else {
path: '/sampling_list/sampling_list_add_net', this.$router.push({
query: {testedType, shelfId, title: '抽样单添加-网络'} path: '/sampling_list/sampling_list_add',
}) query: {title: '抽样单添加'}
} else if (testedType === 0) { })
this.$router.push({ }
path: '/sampling_list/sampling_list_add', },
query: {testedType, shelfId, title: '抽样单添加'} _shelvesResult({testedType, shelfId}) {
}) if (testedType === 1) {
} else { this.$router.push({
this.$router.push({ path: '/sampling_list/sampling_list_add_net',
path: '/sampling_list/sampling_list_add_agriculture', query: {testedType, shelfId, title: '抽样单添加-网络'}
query: {testedType, shelfId, title: '抽样单添加-农场品'} })
}) } else if (testedType === 0) {
} this.$router.push({
}, path: '/sampling_list/sampling_list_add',
_longtapHandler() { query: {testedType, shelfId, title: '抽样单添加'}
this.showCheck = true })
}, } else {
_hideCheck() { this.$router.push({
this.showCheck = false path: '/sampling_list/sampling_list_add_agriculture',
this.checkListValue = [] query: {testedType, shelfId, title: '抽样单添加-农场品'}
}, })
_checkAll() { }
if (this.checkAll) { },
this.$refs.checkboxGroup.toggleAll(); _longtapHandler() {
} else { this.showCheck = true
this.$refs.checkboxGroup.toggleAll(true); },
} _hideCheck() {
}, this.showCheck = false
_tapItem(item) { this.checkListValue = []
if (this.showCheck) { },
if (this.checkListValue.indexOf(item.id) === -1) { _checkAll() {
this.checkListValue.push(item.id); if (this.checkAll) {
} else { this.$refs.checkboxGroup.toggleAll();
this.checkListValue.splice(this.checkListValue.indexOf(item.id), 1); } else {
} this.$refs.checkboxGroup.toggleAll(true);
} else { }
if (item.testedType === 1) { },
this.$router.push({path: '/sampling_list/sampling_list_detail_net', query: {id: item.id}}) _tapItem(item) {
} else if (item.testedType === 0) { if (this.showCheck) {
this.$router.push({path: '/sampling_list/sampling_list_detail', query: {id: item.id}}) if (this.checkListValue.indexOf(item.id) === -1) {
} else { this.checkListValue.push(item.id);
this.$router.push({ } else {
path: '/sampling_list/sampling_list_detail_agriculture', this.checkListValue.splice(this.checkListValue.indexOf(item.id), 1);
query: {id: item.id}
})
}
}
},
_edit(item) {
if (item.testedType === 1) {
this.$router.push({
path: '/sampling_list/sampling_list_add_net',
query: {id: item.id, title: '抽样单编辑-网络'}
})
} else if (item.testedType === 0) {
this.$router.push({
path: '/sampling_list/sampling_list_add',
query: {id: item.id, title: '抽样单编辑-非网络'}
})
} else {
this.$router.push({
path: '/sampling_list/sampling_list_add_agriculture',
query: {id: item.id, title: '抽样单编辑-农场品'}
})
}
},
_print(item) {
//调用第三放程序打开指定文件(必须是本地路径)
this.$toast.loading({
message: '加载中...',
forbidClick: true,
});
var dtask = plus.downloader.createDownload(
this.$global.baseURL + '/drs/v1/sampling_summary/export_sampling_gk?id=' + item.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();
},
_del(ids) {
if (ids.length === 0) {
this.$toast('请至少选择一条数据!')
} else {
this._delOk(ids)
}
},
_delOk: async function (ids) {
let result = await samplingSummary.deleteByIds(ids)
if (result) {
this.$toast('操作成功!')
this._refresh()
}
},
_goFile(id) {
this.$router.push({path: '/sampling_list/file', query: {summaryId: id}})
}
} }
} else {
if (item.testedType === 1) {
this.$router.push({path: '/sampling_list/sampling_list_detail_net', query: {id: item.id}})
} else if (item.testedType === 0) {
this.$router.push({path: '/sampling_list/sampling_list_detail', query: {id: item.id}})
} else {
this.$router.push({
path: '/sampling_list/sampling_list_detail_agriculture',
query: {id: item.id}
})
}
}
},
_edit(item) {
if (item.testedType === 1) {
this.$router.push({
path: '/sampling_list/sampling_list_add_net',
query: {id: item.id, title: '抽样单编辑-网络'}
})
} else if (item.testedType === 0) {
this.$router.push({
path: '/sampling_list/sampling_list_add',
query: {id: item.id, title: '抽样单编辑-非网络'}
})
} else {
this.$router.push({
path: '/sampling_list/sampling_list_add_agriculture',
query: {id: item.id, title: '抽样单编辑-农场品'}
})
}
},
_print(item) {
//调用第三放程序打开指定文件(必须是本地路径)
this.$toast.loading({
message: '加载中...',
forbidClick: true,
});
var dtask = plus.downloader.createDownload(
this.$global.baseURL + '/drs/v1/sampling_summary/export_sampling_gk?id=' + item.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();
},
_del(ids) {
if (ids.length === 0) {
this.$toast('请至少选择一条数据!')
} else {
this._delOk(ids)
}
},
_delOk: async function (ids) {
let result = await samplingSummary.deleteByIds(ids)
if (result) {
this.$toast('操作成功!')
this._refresh()
}
},
_goFile(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>
<search-bar label="计划名称" <template #navBar>
ref="searchBar" <van-nav-bar
highSearch :title="$route.meta.title"
@search="_search" right-text="查看所有抽样单"
@high-search="_highSearch" left-arrow
@clear-high="_clearHigh"> @click-left="_back"
<template #highSearch> @click-right="_viewListAll"
<van-field v-model="formObj.name" label="计划名称" placeholder="请输入计划名称" clearable></van-field> ></van-nav-bar>
<datetime-field label="计划开始日期" v-model="formObj.planDateBegin" ></datetime-field> </template>
<datetime-field label="计划结束日期" v-model="formObj.planDateEnd"></datetime-field> <template #content>
<van-field v-model="formObj.uname" label="登记人" placeholder="请输入登记人" clearable></van-field> <search-bar label="计划名称"
<datetime-field label="登记开始日期" v-model="formObj.ctimeBegin"></datetime-field> ref="searchBar"
<datetime-field label="登记结束日期" v-model="formObj.ctimeEnd"></datetime-field> highSearch
</template> @search="_search"
</search-bar> @high-search="_highSearch"
<div class="layout-cont-sh"> @clear-high="_clearHigh">
<!--下拉刷新 https://vant-contrib.gitee.io/vant/#/zh-CN/pull-refresh--> <template #highSearch>
<van-pull-refresh v-model="refreshing" @refresh="_refresh"> <van-field v-model="formObj.name" label="计划名称" placeholder="请输入计划名称" clearable></van-field>
<!--上拉加载 https://vant-contrib.gitee.io/vant/#/zh-CN/list--> <datetime-field label="计划开始日期" v-model="formObj.planDateBegin"></datetime-field>
<van-list <datetime-field label="计划结束日期" v-model="formObj.planDateEnd"></datetime-field>
v-model="loading" <van-field v-model="formObj.uname" label="登记人" placeholder="请输入登记人" clearable></van-field>
:finished="finished" <datetime-field label="登记开始日期" v-model="formObj.ctimeBegin"></datetime-field>
finished-text="没有更多了" <datetime-field label="登记结束日期" v-model="formObj.ctimeEnd"></datetime-field>
@load="_load"> </template>
<div class="result-item" v-for="item in resultList" :key="item.name" @click="_goto(item.id)"> </search-bar>
<div>计划名称:{{item.name}}</div> <div class="layout-cont-sh">
<div>抽样进度:{{item.summaryCount+'/'+item.samplingQuantity}}</div> <!--下拉刷新 https://vant-contrib.gitee.io/vant/#/zh-CN/pull-refresh-->
<div>状态:{{item.progress}}</div> <van-pull-refresh v-model="refreshing" @refresh="_refresh">
</div> <!--上拉加载 https://vant-contrib.gitee.io/vant/#/zh-CN/list-->
</van-list> <van-list
</van-pull-refresh> v-model="loading"
</div> :finished="finished"
</div> finished-text="没有更多了"
@load="_load">
<div class="result-item" v-for="item in resultList" :key="item.name" @click="_goto(item.id)">
<div>计划名称:{{ item.name }}</div>
<div>抽样进度:{{ item.summaryCount + '/' + item.samplingQuantity }}</div>
<div>状态:{{ item.progress }}</div>
</div>
</van-list>
</van-pull-refresh>
</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 {
formObj: { formObj: {
name: '', name: '',
planDateBegin: '', planDateBegin: '',
planDateEnd: '', planDateEnd: '',
uname: '', uname: '',
ctimeBegin: '', ctimeBegin: '',
ctimeEnd: '', ctimeEnd: '',
flag: 1 flag: 1
}, },
key: '', key: '',
resultList: [], resultList: [],
page: 1, page: 1,
rows: 10, rows: 10,
refreshing: false,//刷新中... refreshing: false,//刷新中...
loading: false,//加载中... loading: false,//加载中...
finished: false,//没有更多数据 finished: false,//没有更多数据
}
},
mounted() {
this._getData()
},
methods: {
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this.formObj = this.$resetFields(this.formObj)
this.formObj.flag = 1
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 = 1
},
_searchParams() {
let data = {
page: this.page,
rows: this.rows,
...this.formObj
};
if (this.key) {
data.name = this.key
}
return this.$serializeForm(data)
},
_getData: async function () {
let result = await samplingPlan.pageApp(this._searchParams())
this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records]
this.refreshing = false
this.loading = false
if (this.resultList.length === result.total) {
this.finished = true
}
},
_refresh() {
this.page = 1;
this._getData()
},
_load() {
this.page = this.page + 1;
this._getData()
},
_goto(id) {
this.$router.push({path:'/sampling_list/sampling_list',query:{planId:id}})
},
}
} }
},
mounted() {
this._getData()
},
methods: {
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this.formObj = this.$resetFields(this.formObj)
this.formObj.flag = 1
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 = 1
},
_searchParams() {
let data = {
page: this.page,
rows: this.rows,
...this.formObj
};
if (this.key) {
data.name = this.key
}
return this.$serializeForm(data)
},
_getData: async function () {
let result = await samplingPlan.pageApp(this._searchParams())
this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records]
this.refreshing = false
this.loading = false
if (this.resultList.length === result.total) {
this.finished = true
}
},
_refresh() {
this.page = 1;
this._getData()
},
_load() {
this.page = this.page + 1;
this._getData()
},
_goto(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