Commit b2ebe949 by zhuxiaomei

添加数值绑定

parent 5977ce38
...@@ -8,13 +8,13 @@ ...@@ -8,13 +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">
<title><%= htmlWebpackPlugin.options.title %></title> <title>双随机抽样</title>
</head> </head>
<body> <body>
<noscript> <!--<noscript>-->
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. <!--<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.-->
Please enable it to continue.</strong> <!--Please enable it to continue.</strong>-->
</noscript> <!--</noscript>-->
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>
......
...@@ -5,6 +5,7 @@ import http from '../http' ...@@ -5,6 +5,7 @@ import http from '../http'
export default { export default {
page: data => http.post('/drs/v1/sampling_plan/page', data).then(res => res), page: data => http.post('/drs/v1/sampling_plan/page', data).then(res => res),
pageApp: data => http.post('/drs/v1/sampling_plan/page_app', data).then(res => res),
getById: id => http.get('/drs/v1/sampling_plan/' + id).then(res => res), getById: id => http.get('/drs/v1/sampling_plan/' + id).then(res => res),
} }
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<!--https://youzan.github.io/vant/#/zh-CN/form#biao-dan-xiang-lei-xing---shi-jian-xuan-ze-qi--> <!--https://youzan.github.io/vant/#/zh-CN/form#biao-dan-xiang-lei-xing---shi-jian-xuan-ze-qi-->
<van-field <van-field
readonly readonly
clickable
v-model="dateValue" v-model="dateValue"
:label="label" :label="label"
:placeholder="'点击选择'+label" :placeholder="'点击选择'+label"
...@@ -29,12 +28,14 @@ ...@@ -29,12 +28,14 @@
label: String, label: String,
value: {type: String, default: ''}, //默认值 value: {type: String, default: ''}, //默认值
type: {type: String, default: 'date'}, type: {type: String, default: 'date'},
format: {type: String, default: 'yyyy-mm-dd'} format: {type: String, default: 'yyyy-mm-dd'},
// startDate: String
}, },
data() { data() {
return { return {
showPicker: false, showPicker: false,
currentDate: new Date() currentDate: new Date(),
// minDate:this.startDate?new Date(this.startDate):new Date()
} }
}, },
computed: { computed: {
...@@ -45,8 +46,7 @@ ...@@ -45,8 +46,7 @@
set(val) { set(val) {
this.$emit('input', val) this.$emit('input', val)
} }
} },
}, },
watch: { watch: {
showPicker: function (newVal) { showPicker: function (newVal) {
......
...@@ -45,10 +45,12 @@ ...@@ -45,10 +45,12 @@
this.$emit('search', this.searchValue) this.$emit('search', this.searchValue)
}, },
onHighSearch() { onHighSearch() {
this.showHighSearch = false
this.searchValue = '' this.searchValue = ''
this.$emit('high-search') this.$emit('high-search')
}, },
_hideHighSearch(){
this.showHighSearch = false
},
onReset() { onReset() {
this.$emit('clear-high') this.$emit('clear-high')
} }
......
<template> <template>
<div> <div>
<search-bar label="计划名称" <search-bar label="计划名称"
ref="searchBar"
highSearch highSearch
@search="_search" @search="_search"
@high-search="_highSearch" @high-search="_highSearch"
@clear-high="_clearHigh"> @clear-high="_clearHigh">
<template #highSearch> <template #highSearch>
<van-field v-model="formObj.name" label="计划名称" placeholder="请输入计划名称"></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="请输入登记人"></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>
<datetime-field label="登记结束日期" v-model="formObj.ctimeEnd"></datetime-field> <datetime-field label="登记结束日期" v-model="formObj.ctimeEnd"></datetime-field>
</template> </template>
...@@ -23,11 +24,11 @@ ...@@ -23,11 +24,11 @@
:finished="finished" :finished="finished"
finished-text="没有更多了" finished-text="没有更多了"
@load="_load"> @load="_load">
<div class="result-item" v-for="item in resultList" :key="item.name" @click="_goto(item)"> <div class="result-item" v-for="item in resultList" :key="item.name" @click="_goto(item)">
<div>计划名称:{{item.name}}</div> <div>计划名称:{{item.name}}</div>
<div>抽样进度:{{item.completionRatio}}</div> <div>抽样进度:{{item.completionRatio}}</div>
<div>状态:{{item.progress}}</div> <div>状态:{{item.progress}}</div>
</div> </div>
</van-list> </van-list>
</van-pull-refresh> </van-pull-refresh>
</div> </div>
...@@ -48,7 +49,7 @@ ...@@ -48,7 +49,7 @@
uname: '', uname: '',
ctimeBegin: '', ctimeBegin: '',
ctimeEnd: '', ctimeEnd: '',
flag: 0 flag: 1
}, },
key: '', key: '',
resultList: [], resultList: [],
...@@ -59,25 +60,48 @@ ...@@ -59,25 +60,48 @@
finished: false,//没有更多数据 finished: false,//没有更多数据
} }
}, },
mounted() {
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.formObj.flag = 0 this.formObj.flag = 1
this._refresh() this._refresh()
}, },
//高级搜索 清空key 查询 //高级搜索 清空key 查询
_highSearch() { _highSearch() {
this.key = '' this.key = ''
this._refresh() 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() { _clearHigh() {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
this.formObj.flag = 0 this.formObj.flag = 1
}, },
_searchParams() { _searchParams() {
let data = { let data = {
...@@ -91,7 +115,7 @@ ...@@ -91,7 +115,7 @@
return this.$serializeForm(data) return this.$serializeForm(data)
}, },
_getData: async function () { _getData: async function () {
let result = await samplingPlan.page(this._searchParams()) let result = await samplingPlan.pageApp(this._searchParams())
this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records] this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records]
this.refreshing = false this.refreshing = false
this.loading = false this.loading = false
...@@ -101,7 +125,7 @@ ...@@ -101,7 +125,7 @@
}, },
_refresh() { _refresh() {
this.page = 1; this.page = 1;
this._getData() // this._getData()
}, },
_load() { _load() {
this.page = this.page + 1; this.page = this.page + 1;
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
@high-search="_highSearch" @high-search="_highSearch"
@clear-high="_clearHigh"> @clear-high="_clearHigh">
<template #highSearch> <template #highSearch>
<van-field v-model="formObj.name" label="计划名称" placeholder="请输入计划名称"></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="请输入登记人"></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>
<datetime-field label="登记结束日期" v-model="formObj.ctimeEnd"></datetime-field> <datetime-field label="登记结束日期" v-model="formObj.ctimeEnd"></datetime-field>
</template> </template>
...@@ -81,7 +81,33 @@ ...@@ -81,7 +81,33 @@
//高级搜索 清空key 查询 //高级搜索 清空key 查询
_highSearch() { _highSearch() {
this.key = '' this.key = ''
this._refresh() 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() { _clearHigh() {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
...@@ -99,7 +125,7 @@ ...@@ -99,7 +125,7 @@
return this.$serializeForm(data) return this.$serializeForm(data)
}, },
_getData: async function () { _getData: async function () {
let result = await samplingPlan.page(this._searchParams()) let result = await samplingPlan.pageApp(this._searchParams())
this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records] this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records]
this.refreshing = false this.refreshing = false
this.loading = false this.loading = false
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
} }
.list-table-box { .list-table-box {
.van-checkbox { .van-checkbox ,.van-radio{
padding: 5px; padding: 5px;
} }
} }
......
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