维修填报

This commit is contained in:
2023-09-11 14:22:10 +08:00
parent fb52628b28
commit 2a3448f0ec

View File

@@ -21,34 +21,46 @@
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>序号</th>
<th>是否完成</th>
<th>维修项目编号</th>
<th>维修项目名称</th>
<th>要求</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.repair_id === pkId}">
<td>{{e.indexId}}</td>
<td>
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</td>
<td>{{e.repair_item_code}}</td>
<td>{{e.repair_item_name}}</td>
<td>{{e.requirement}}</td>
</tr>
</tbody>
</table>
<view class="grid_new">
<view class="grid_l">
<table>
<thead>
<tr>
<th>是否完成</th>
</tr>
</thead>
<tbody>
<tr v-for="(el, i) in dataList" :key="i">
<td>
<uni-data-select v-model="el.isfinish" :localdata="options" @change="selectChange($event, el)"></uni-data-select>
</td>
</tr>
</tbody>
</table>
</view>
<view class="grid_r">
<table>
<thead>
<tr>
<th>维修项目编号</th>
<th>维修项目名称</th>
<th>要求</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{e.repair_item_code}}</td>
<td>{{e.repair_item_name}}</td>
<td>{{e.requirement}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': dataList.length === 0}" :disabled="disabled" @tap="dataList.length === 0">确认</button>
<button class="submit-button" :class="{'btn-disabled': !active}" :disabled="disabled" @tap="toSure">确认</button>
<button class="submit-button" @tap="toCancle">取消</button>
</view>
</view>
@@ -57,7 +69,7 @@
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {coolIOQuery, confirmInstor, statusList} from '@/utils/getData2.js'
import {deviceRepairGetDtl, deviceRepairConfirm} from '@/utils/getData2.js'
export default {
components: {
NavBar,
@@ -65,56 +77,62 @@
},
data() {
return {
val1: '',
val2: '',
val3: '',
val1: this.$store.getters.publicObj !== '' ? this.$store.getters.publicObj.device_code : '',
val2: this.$store.getters.publicObj !== '' ? this.$store.getters.publicObj.repair_code : '',
val3: this.$store.getters.publicObj !== '' ? this.$store.getters.publicObj.repair_id : '',
options: [{text: '否', value: '0'}, {text: '是', value: '1'}],
dataList: [],
pkId: '',
pkObj: {},
disabled: false
};
},
computed: {
active () {
let t = false
let arr = this.dataList.filter(el => el.isfinish === '1')
if (this.dataList.length > 0 && this.dataList.length === arr.length) {
t = true
}
return t
}
},
created () {
this._deviceRepairGetDtl()
},
methods: {
/** 下拉框查询 */
async _statusList () {
let res = await statusList()
this.options = [...res.data]
/** 选择器 */
selectChange($event, el) {
el.isfinish = $event
},
/** grid查询 */
async _deviceRepairGetDtl () {
let res = await deviceRepairGetDtl(this.val1, this.val2, this.val3)
this.dataList = [...res.data]
},
/** 确认 */
async _confirmInstor () {
async toSure () {
this.disabled = true
if (!this.val1 || !this.pkId || !this.index) {
if (!this.active) {
this.disabled = false
return
}
try {
let res = await confirmInstor(this.pkObj, this.val1, this.index)
let res = await deviceRepairConfirm(this.val1, this.val2, this.dataList)
this.disabled = false
this.pkId = ''
this.pkObj = {}
this.searchList()
uni.showToast({
title: res.message,
icon: 'none'
})
this.goIn()
} catch (e) {
this.disabled = false
}
},
toCheck (e) {
this.pkId = this.pkId === e.repair_id ? '' : e.repair_id
this.pkObj = this.pkId === e.repair_id ? e : {}
},
toCancle () {
this.$store.dispatch('setPublicObj', '')
this.goIn()
},
goIn () {
uni.redirectTo({
url: '/pages/device/RepairWork'
})
this.$store.dispatch('setPublicObj', '')
uni.navigateBack()
}
}
}