qa-prevention-xgf-app/pages/eight_assignments/confined_space/gas/list.vue

121 lines
3.5 KiB
Vue
Raw Normal View History

2024-07-11 18:04:46 +08:00
<template>
<view class="content">
<u-list v-if="list.length > 0">
<u-list-item v-for="(item, index) in list" :key="index">
<view class="flex-between main-title">
<text>分析时间{{ item.ANALYZE_TIME }}</text>
</view>
<view class="flex-between main-title">
<text>分析地点{{ item.ANALYZE_PLACE }}</text>
</view>
<view class="flex-between main-title" v-if="GAS_NAME1 && item.DATA1">
<text>{{ GAS_NAME1 }}{{ item.DATA1 }}</text>
</view>
<view class="flex-between main-title" v-if="GAS_NAME2 && item.DATA2">
<text>{{ GAS_NAME2 }}{{ item.DATA2 }}</text>
</view>
<view class="flex-between main-title" v-if="GAS_NAME3 && item.DATA3">
<text>{{ GAS_NAME3 }}{{ item.DATA3 }}</text>
</view>
<view class="flex-between main-title" v-if="GAS_NAME4 && item.DATA4">
<text>{{ GAS_NAME4 }}{{ item.DATA4 }}</text>
</view>
<view class="flex-between main-title">
<text>含氧量{{ item.OXYGEN_CONTENT }}</text>
</view>
<view class="flex-between main-title">
<text>分析人{{ item.ANALYZE_USER_NAME }}</text>
</view>
<view class="flex-between mt-10 subtitle">
<view></view>
<view class="flex-between">
<u-button type="error" text="删除" size="mini" class="bth-mini"
@click="fnDelete(item)"/>
</view>
</view>
</u-list-item>
</u-list>
<empty v-else></empty>
</view>
</template>
<script>
import {getConfinedSpaceGasInfo, setConfinedSpaceGasDelete} from "@/api";
export default {
data() {
return {
GAS_NAME1: '',
GAS_NAME2: '',
GAS_NAME3: '',
GAS_NAME4: '',
EW_RU_TASK_ID: '',
EW_RU_JOB_ID: '',
list: []
}
},
onLoad(query) {
this.GAS_NAME1 = query.GAS_NAME1;
this.GAS_NAME2 = query.GAS_NAME2;
this.GAS_NAME3 = query.GAS_NAME3;
this.GAS_NAME4 = query.GAS_NAME4;
this.EW_RU_TASK_ID = query.EW_RU_TASK_ID;
this.EW_RU_JOB_ID = query.EW_RU_JOB_ID;
},
onNavigationBarButtonTap(e) {
if (e.index === 0) {
uni.$u.route({
url: '/pages/eight_assignments/confined_space/gas/add',
params: {
GAS_NAME1: this.GAS_NAME1,
GAS_NAME2: this.GAS_NAME2,
GAS_NAME3: this.GAS_NAME3,
GAS_NAME4: this.GAS_NAME4,
EW_RU_TASK_ID: this.EW_RU_TASK_ID,
EW_RU_JOB_ID: this.EW_RU_JOB_ID,
}
})
}
},
onShow() {
this.resetList()
},
methods: {
async getData() {
let resData = await getConfinedSpaceGasInfo({
EW_RU_JOB_ID: this.EW_RU_JOB_ID,
EW_RU_TASK_ID: this.EW_RU_TASK_ID,
postMethod: 'application/json',
});
this.list = [...this.list, ...resData.data.main];
},
resetList() {
this.list = []
this.getData()
},
fnDelete(item) {
uni.showModal({
title: '提示',
content: '确定要删除这条记录?',
success: async res => {
if (res.confirm) {
await setConfinedSpaceGasDelete({
data: item,
EW_RU_JOB_ID: this.EW_RU_JOB_ID,
EW_RU_TASK_ID: this.EW_RU_TASK_ID,
postMethod: 'application/json',
})
uni.$u.toast('删除成功')
this.resetList()
}
}
})
}
},
}
</script>
<style scoped lang="scss">
</style>