124 lines
3.3 KiB
Vue
124 lines
3.3 KiB
Vue
<template>
|
|
<view class="zd_container">
|
|
<nav-bar title="设备报修"></nav-bar>
|
|
<view class="zd_content">
|
|
<view class="zd_wrapper">
|
|
<view class="filter_item">
|
|
<view class="filter_label_wraper">
|
|
<span class="filter_label">设备</span>
|
|
</view>
|
|
<view class="filter_input_wraper">
|
|
<input type="text" class="filter_input filter_input_disabled pointer" v-model="val1" @tap="getMater">
|
|
</view>
|
|
</view>
|
|
<view class="filter_item">
|
|
<view class="filter_label">故障类型</view>
|
|
<view class="filter_input_wraper">
|
|
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="filter_item">
|
|
<view class="filter_label">故障等级</view>
|
|
<view class="filter_input_wraper">
|
|
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="filter_item">
|
|
<view class="filter_label_wraper">
|
|
<span class="filter_label">故障描述</span>
|
|
</view>
|
|
<view class="filter_input_wraper">
|
|
<textarea class="filter_textarea" v-model="val2"></textarea>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="submit-bar">
|
|
<button class="submit-button" :disabled="disabled" @tap="toSure">报修</button>
|
|
<button class="submit-button" @tap="toCancle">清空</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import {devicefaultclass, devicerepairrequest} from '@/utils/getData2.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox
|
|
},
|
|
data() {
|
|
return {
|
|
val1: '',
|
|
val2: '',
|
|
options1: [],
|
|
index1: '',
|
|
options2: [{value: '01', text: '紧急'}, {value: '02', text: '一般'}, {value: '03', text: '不紧急'},],
|
|
index2: '',
|
|
disabled: false
|
|
};
|
|
},
|
|
onShow() {
|
|
if (this.$store.getters.publicObj) {
|
|
this.val1 = this.$store.getters.publicObj.device_name
|
|
this._devicefaultclass(this.$store.getters.publicObj.material_type_id)
|
|
}
|
|
},
|
|
destroyed () {
|
|
this.$store.dispatch('setPublicObj', '')
|
|
},
|
|
methods: {
|
|
getMater () {
|
|
uni.navigateTo({
|
|
url: '/pages/device/DeviceList'
|
|
})
|
|
},
|
|
/** 选择器1 */
|
|
selectChange1(e) {
|
|
this.index1 = e
|
|
},
|
|
/** 选择器2 */
|
|
selectChange2(e) {
|
|
this.index2 = e
|
|
},
|
|
/** 故障类型下拉框查询 */
|
|
async _devicefaultclass (e) {
|
|
let res = await devicefaultclass(e)
|
|
res.data.map(el => {
|
|
this.$set(el, 'value', el.device_faultclass_id)
|
|
this.$set(el, 'text', el.device_faultclass_name)
|
|
})
|
|
this.options1 = [...res.data]
|
|
},
|
|
/** 确认 */
|
|
async toSure () {
|
|
this.disabled = true
|
|
try {
|
|
let res = await devicerepairrequest(this.$store.getters.publicObj.device_code, this.$store.getters.publicObj.devicerecord_id, this.$store.getters.publicObj.material_type_id, this.index1, this.index2, this.val2)
|
|
this.disabled = false
|
|
this.toCancle()
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
},
|
|
toCancle () {
|
|
this.val1 = ''
|
|
this.val2 = ''
|
|
this.index1 = ''
|
|
this.options1 = []
|
|
this.index2 = ''
|
|
this.$store.dispatch('setPublicObj', '')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="stylus">
|
|
</style>
|