维修填报

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