Commit b2ebe949 by zhuxiaomei

添加数值绑定

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