This commit is contained in:
2023-03-30 16:14:01 +08:00
parent 68257c3175
commit 4529bd6476
4 changed files with 126 additions and 74 deletions

View File

@@ -4,15 +4,21 @@
<view class="search-confirm-wrap">
<view class="search-wrap">
<view class="search-item">
<label class="search-label">缓存线</label>
<label class="search-label">生产区域</label>
<view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
<view class="search-item">
<label class="search-label">缓存线</label>
<view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
</view>
</view>
</view>
<view class="confirm-button-wrap">
<button class="confirm-button" :disabled="disabled" @tap="toSure()">暂停</button>
<button class="confirm-button" :disabled="disabled" @tap="toSure()">启动</button>
<button class="confirm-button" :disabled="disabled" @tap="toSure('1')">暂停</button>
<button class="confirm-button" :disabled="disabled" @tap="toSure('2')">启动</button>
</view>
</view>
</view>
@@ -21,7 +27,7 @@
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {cacheLineExcepOpt} from '@/utils/getData1.js'
import {getCacheLine, cacheLineExcepOpt} from '@/utils/getData1.js'
export default {
components: {
NavBar,
@@ -29,35 +35,52 @@
},
data() {
return {
options1: [],
index1: '',
options1: [{text: 'A1', value: 'A1'}, {text: 'A2', value: 'A2'}],
index1: 'A1',
options2: [],
index2: '',
disabled: false
};
},
created() {
this._getCacheLine('A1')
},
methods: {
/** 选择器1 */
selectChange1(e) {
this.index1 = e
if (this.index1) {
this._getCacheLine(e)
}
this.index2 = ''
},
/** 选择器2 */
selectChange2(e) {
this.index2 = e
},
async _getCacheLine (id) {
let res = await getCacheLine(id)
this.options2 = [...res]
},
async toSure (type) {
this.disabled = true
if (!this.index1) {
uni.showToast({
title: '请选择',
icon: 'none'
})
this.disabled = false
return
}
if (!this.index2) {
uni.showToast({
title: '请选择',
icon: 'none'
})
this.disabled = false
return
}
try {
let res = await _cacheLineExcepOpt()
this.disabled = false
uni.showToast({
title: res.message,
icon: 'none'
})
let res = await cacheLineExcepOpt(this.index2, type)
this.disabled = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
this.disabled = false
}
}
}