111 lines
2.6 KiB
Vue
111 lines
2.6 KiB
Vue
<template>
|
|
<view class="zd_container">
|
|
<nav-bar :title="title"></nav-bar>
|
|
<view class="zd_content">
|
|
<view class="zd_wrapper">
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-5">
|
|
<span class="filter_label">起点</span>
|
|
</view>
|
|
<view class="zd-col-19 filter_select">
|
|
<zxz-uni-data-select v-model="index1" filterable :localdata="options1"></zxz-uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row">
|
|
<view class="zd-col-5">
|
|
<span class="filter_label">终点</span>
|
|
</view>
|
|
<view class="zd-col-19 filter_select">
|
|
<zxz-uni-data-select v-model="index2" filterable :localdata="options2"></zxz-uni-data-select>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submit-bar">
|
|
<button class="zd-col-7 button-default" @tap="clearUp">清空</button>
|
|
<button class="zd-col-15 button-primary" :class="{'button-info': !index1 || !index2}" :disabled="disabled" @tap="toSure1">开始</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import {getWastePointList, startMoveWasteFoilv2} from '@/utils/getData2.js'
|
|
export default {
|
|
components: {
|
|
NavBar
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
index1: '',
|
|
options1: [],
|
|
index2: '',
|
|
options2: [],
|
|
disabled: false
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
this._getWastePointList(1)
|
|
this._getWastePointList(2)
|
|
},
|
|
methods: {
|
|
async _getWastePointList (type) {
|
|
let res = await getWastePointList(type)
|
|
if (res) {
|
|
res.map(el => {
|
|
this.$set(el, 'text', el.point_code)
|
|
this.$set(el, 'value', el.point_code)
|
|
})
|
|
if (type === 1) {
|
|
this.options1 = [...res]
|
|
}
|
|
if (type === 2) {
|
|
this.options2 = [...res]
|
|
}
|
|
}
|
|
},
|
|
async toSure1 () {
|
|
this.disabled = true
|
|
if (!this.index1 || !this.index2) {
|
|
this.disabled = false
|
|
return
|
|
}
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '是否确定漏斗复位',
|
|
confirmColor: '#ff6a00',
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
this._startMoveWasteFoilv2()
|
|
} else if (res.cancel) {
|
|
this.disabled = false
|
|
}
|
|
}
|
|
})
|
|
},
|
|
async _startMoveWasteFoilv2 () {
|
|
try {
|
|
let res = await startMoveWasteFoilv2(this.index2, this.index1)
|
|
this.clearUp()
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
},
|
|
clearUp () {
|
|
this.index1 = ''
|
|
this.index2 = ''
|
|
this.disabled = false
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="stylus">
|
|
</style>
|