This commit is contained in:
2023-09-11 16:02:09 +08:00
parent 4ae00c1faf
commit 77f849d5da
6 changed files with 198 additions and 121 deletions

View File

@@ -21,36 +21,50 @@
</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>
<th>要求</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{e.indexId}}</td>
<td>
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</td>
<td>{{e.maint_item_code}}</td>
<td>{{e.item_level}}</td>
<td>{{e.contents}}</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>
<th>保养内容</th>
<th>要求</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{e.maint_item_code}}</td>
<td>{{e.maint_item_name}}</td>
<td>{{['日常', '一级', '二级'][Number(e.item_level) - 1]}}</td>
<td>{{e.contents}}</td>
<td>{{e.requirement}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !dataList.every(item=>item.isfinish === '1')}" :disabled="disabled" @tap="_upkeepconfirm">确认</button>
<button class="submit-button" :class="{'btn-disabled': !active}" :disabled="disabled" @tap="toSure">确认</button>
<button class="submit-button" @tap="toCancle">取消</button>
</view>
</view>
@@ -67,36 +81,41 @@
},
data() {
return {
options: [{text: '否', value: '0'}, {text: '是', value: '1'}],
index: '',
val1: this.$store.getters.publicObj !== '' ? this.$store.getters.publicObj.device_code : '',
val2: this.$store.getters.publicObj !== '' ? this.$store.getters.publicObj.maint_code : '',
val3: this.$store.getters.publicObj !== '' ? this.$store.getters.publicObj.maint_id : '',
options: [{text: '否', value: '0'}, {text: '是', value: '1'}],
dataList: [],
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._upkeepgetDtl()
},
methods: {
selectChange (e) {
this.index = e
/** 选择器 */
selectChange($event, el) {
el.isfinish = $event
},
/** grid查询 */
async _upkeepgetDtl () {
let res = await upkeepgetDtl(this.val1, this.val2, this.$store.getters.publicObj.maint_id)
let res = await upkeepgetDtl(this.val1, this.val2, this.val3)
this.dataList = [...res.data]
},
/** 确认 */
async _upkeepconfirm () {
async toSure () {
this.disabled = true
if (!this.val1 || !this.val2 || !this.dataList.length) {
this.disabled = false
return
}
if (this.dataList.every(item=>item.isfinish === '1')) {
// console.log('true')
} else {
if (!this.active) {
this.disabled = false
return
}
@@ -107,6 +126,7 @@
title: res.message,
icon: 'none'
})
this.goIn()
} catch (e) {
this.disabled = false
}