<template>
|
<view>
|
<view class="tabs" id="tabs">
|
<view :class="tabs == 0 ? 'on':''" @tap="switchTab(0)">待维修</view>
|
<view :class="tabs == 1 ? 'on':''" @tap="switchTab(1)">已维修</view>
|
<view :class="tabs == 2 ? 'on':''" @tap="switchTab(2)">全部任务</view>
|
</view>
|
|
<!-- 设备维修任务列表列表 -->
|
<view class="list" v-for="(item,index) in reportBillsDisplay" :key="index">
|
<uni-card :title="item.故障登记单号" :extra="`日期: ${dayjs(item.设备故障日期).format('YYYY-MM-DD')}`" style="margin: 10px;">
|
<view class="card-detail">
|
<view class="detail" v-for="(field, index) in CommonUtils.emptyValueFilter(item, HFieldList)" :key="index">
|
<text>{{field.ColmCols}}:</text>{{item[field.ColmCols]}}
|
</view>
|
</view>
|
</uni-card>
|
</view>
|
<view class="over" v-if="reportBillsDisplay.length == 0">暂无数据</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
getUserInfo
|
} from '../../../utils/auth';
|
import {
|
CommonUtils
|
} from '../../../utils/common';
|
import dayjs from 'dayjs';
|
export default {
|
// 设备维修任务 模块
|
name: 'Sb_EquipRepairTaskReport',
|
data() {
|
return {
|
dayjs,
|
CommonUtils,
|
tabs: 0,
|
reportBillsDisplay: [],
|
reportBillsAwaitRepair: [], // 待维修
|
reportBillsRepaired: [], // 已维修
|
reportBillsAll: [], // 全部任务
|
HFieldList: [], // 字段列表
|
};
|
},
|
methods: {
|
switchTab(tabIndex) {
|
this.tabs = tabIndex
|
switch (tabIndex) {
|
case 0:
|
this.reportBillsDisplay = this.reportBillsAwaitRepair;
|
break;
|
case 1:
|
this.reportBillsDisplay = this.reportBillsRepaired;
|
break;
|
case 2:
|
this.reportBillsDisplay = this.reportBillsAll;
|
break;
|
}
|
},
|
async getRepairList() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: 'Sb_EquipRepairTaskReport/RepairList',
|
data: {
|
user: getUserInfo()["Czymc"]
|
}
|
})
|
|
let {
|
count,
|
data,
|
Message,
|
list
|
} = res.data
|
if (count == 1) {
|
console.log('data: ', data);
|
|
this.reportBillsAwaitRepair = data.h_p_Sb_EquipRepairTaskReport
|
this.reportBillsRepaired = data.h_p_Sb_EquipRepairTaskReport1
|
this.reportBillsAll = data.h_p_Sb_EquipRepairTaskReport2
|
|
let fieldList = CommonUtils.fieldListFilterRole({
|
ExcludeKeys: ['故障登记单号', '设备故障日期'],
|
FieldList: list
|
})
|
|
if (fieldList.status == false) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取表单结构失败: ${fieldList.Message}`
|
})
|
}
|
|
this.HFieldList = fieldList.data
|
|
this.switchTab(0)
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取维修单异常: ${Message}`
|
})
|
}
|
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取维修单异常: ${err}`
|
})
|
}
|
}
|
},
|
onLoad() {
|
this.getRepairList()
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import "@/pages/MJGL/style/MJBillStyle.scss"
|
</style>
|