133 lines
3.3 KiB
Vue
133 lines
3.3 KiB
Vue
<template>
|
|
<view>
|
|
<view>
|
|
<uni-easyinput suffixIcon="scan" placeholder="请输入设备编码" @iconClick="scanBar"
|
|
v-model="queryParams.equipmentCode" type="text" @confirm="scanBarCode" />
|
|
<button type="primary" size="mini" @click="reset"
|
|
style="margin-top: 5px;text-align: center;display: block;width: 30%;">重置</button>
|
|
<view class="cu-card article ">
|
|
<view class="cu-item shadow borderBottom" v-for="(item,index) in list" :key="index">
|
|
<view class="title">
|
|
<view class="text-cut">任务名 : {{item.taskName}}</view>
|
|
<view>
|
|
<button type="primary" size="mini" @click="detail(item)" style="float: right;">查看明细</button>
|
|
</view>
|
|
<view>
|
|
<button type="success" size="mini"
|
|
style="float: right;margin-right: 10px;background-color: #5AC725;color: #fff;"
|
|
@click="handleFinish(item)">完成</button>
|
|
</view>
|
|
</view>
|
|
<view class="content">
|
|
<view class="desc">
|
|
<view class="text-content">
|
|
<view>明细号 : {{item.taskItemCode}}</view>
|
|
<view>明细名 : {{item.taskItemName}}</view>
|
|
<view>状态 : <uni-tag :text="tagText(item.status)" type="primary"
|
|
v-if="item.status"></uni-tag></view>
|
|
<view>设备编码 : {{item.equipmentCode}}</view>
|
|
<view>时间 : {{item.createTime}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
listMaintainTaskItem,
|
|
getMaintainTaskItem
|
|
} from "@/api/tpm/index.js";
|
|
import {
|
|
listTaskItem,
|
|
getTaskItem,
|
|
delTaskItem,
|
|
addTaskItem,
|
|
updateTaskItem,
|
|
finishMaintainTaskItem
|
|
} from "@/api/tpm/maintainTaskItem";
|
|
import {
|
|
getDicts
|
|
} from "@/api/system/dict/dictData.js";
|
|
export default {
|
|
mounted() {
|
|
this.getList()
|
|
getDicts("tpm_task_status").then(res => {
|
|
this.taskStatusOptions = res.data.map(dict => {
|
|
return {
|
|
text: dict.dictLabel,
|
|
value: dict.dictValue,
|
|
diasble: false
|
|
}
|
|
});
|
|
})
|
|
|
|
|
|
},
|
|
data() {
|
|
return {
|
|
list: {},
|
|
queryParams: {
|
|
equipmentCode: null,
|
|
},
|
|
formData: {},
|
|
taskStatusOptions: [],
|
|
rightOptions: [{
|
|
text: '删除',
|
|
style: {
|
|
backgroundColor: '#ff2a17'
|
|
}
|
|
}, ],
|
|
}
|
|
},
|
|
methods: {
|
|
tagText(status) {
|
|
let obj = this.taskStatusOptions.find(item => item.value == status)
|
|
if (obj !== undefined) {
|
|
return this.taskStatusOptions.find(item => item.value == status).text
|
|
}
|
|
},
|
|
handleFinish(item) {
|
|
finishMaintainTaskItem([item.id]).then((response) => {
|
|
this.$modal.msgSuccess("完成成功!");
|
|
this.getList()
|
|
});
|
|
},
|
|
getList() {
|
|
listMaintainTaskItem(this.queryParams).then(response => {
|
|
this.list = response.rows;
|
|
});
|
|
},
|
|
reset() {
|
|
this.queryParams.equipmentCode = null;
|
|
this.getList();
|
|
},
|
|
scanBarCode() {
|
|
if (this.queryParams.equipmentCode) {
|
|
this.getList();
|
|
}
|
|
},
|
|
scanBar() {
|
|
const _this = this;
|
|
uni.scanCode({
|
|
scanType: ['qrCode', 'barCode'],
|
|
success: function(res) {
|
|
_this.queryParams.equipmentCode = res.result;
|
|
_this.scanBarCode();
|
|
}
|
|
});
|
|
},
|
|
detail(item) {
|
|
getMaintainTaskItem(item.id).then(async res => {
|
|
this.$tab.navigateTo('/pages/tpm/maintainTaskItem?formData=' + JSON.stringify(res.data));
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style> |