134 lines
2.9 KiB
Vue
134 lines
2.9 KiB
Vue
|
|
<template>
|
|||
|
|
<view>
|
|||
|
|
<uni-easyinput suffixIcon="scan" placeholder="请输入设备编码" @iconClick="scanBar" v-model="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.equipmentCode}}</view>
|
|||
|
|
<!-- <view>
|
|||
|
|
<u-button type="primary" size="mini" @click="detail(item)" style="float: right;">查看任务</u-button>
|
|||
|
|
</view> -->
|
|||
|
|
</view>
|
|||
|
|
<view class="content">
|
|||
|
|
<view class="desc">
|
|||
|
|
<view class="text-content">
|
|||
|
|
<view>设备名称 : {{item.equipmentTitle}}</view>
|
|||
|
|
<view>设备所属单位 : {{item.belongDept}}</view>
|
|||
|
|
<view>数量 : {{item.amount}}</view>
|
|||
|
|
<view>开机状态:
|
|||
|
|
<u-switch v-model="item.openStatus" activeColor="#5AC725" :inactiveValue="'0'"
|
|||
|
|
:activeValue="'1'" style="display: inline-flex;"
|
|||
|
|
@change="switchChange(item)"></u-switch>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
import {
|
|||
|
|
listEquipment,
|
|||
|
|
updateEquipment
|
|||
|
|
} from "@/api/tpm/index.js";
|
|||
|
|
|
|||
|
|
export default {
|
|||
|
|
mounted() {
|
|||
|
|
this.getList()
|
|||
|
|
},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
list: {},
|
|||
|
|
equipmentCode: null,
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
getList() {
|
|||
|
|
listEquipment().then(response => {
|
|||
|
|
this.list = response.rows.map(item => {
|
|||
|
|
if (item.openStatus == null) item.openStatus = '0'
|
|||
|
|
return item
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
reset() {
|
|||
|
|
this.equipmentCode = null;
|
|||
|
|
this.getList();
|
|||
|
|
},
|
|||
|
|
scanBarCode() {
|
|||
|
|
if (this.equipmentCode) {
|
|||
|
|
let obj = {
|
|||
|
|
equipmentCode: this.equipmentCode
|
|||
|
|
}
|
|||
|
|
listEquipment(obj).then(response => {
|
|||
|
|
this.list = response.rows;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
scanBar() {
|
|||
|
|
const _this = this;
|
|||
|
|
uni.scanCode({
|
|||
|
|
scanType: ['qrCode', 'barCode'],
|
|||
|
|
success: function(res) {
|
|||
|
|
_this.equipmentCode = res.result;
|
|||
|
|
_this.scanBarCode();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
detail() {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
switchChange(item) {
|
|||
|
|
updateEquipment(item).then((response) => {
|
|||
|
|
this.$modal.msgSuccess("开关状态修改成功!");
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style>
|
|||
|
|
// 搜索框
|
|||
|
|
.search-bar {
|
|||
|
|
width: 100%;
|
|||
|
|
height: 100rpx;
|
|||
|
|
margin-top: 2%;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.search-bar-box {
|
|||
|
|
display: flex;
|
|||
|
|
margin: 0 auto;
|
|||
|
|
width: 620rpx;
|
|||
|
|
height: 74rpx;
|
|||
|
|
border: 5rpx solid #00a8cc;
|
|||
|
|
border-radius: 50rpx;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.search-text {
|
|||
|
|
width: 100%;
|
|||
|
|
margin-top: 10rpx;
|
|||
|
|
margin-left: 20rpx;
|
|||
|
|
font-size: 30rpx;
|
|||
|
|
color: #7f7f81;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.search-btn {
|
|||
|
|
background-color: #00a8cc;
|
|||
|
|
/* Green */
|
|||
|
|
color: white;
|
|||
|
|
text-align: center;
|
|||
|
|
display: inline-block;
|
|||
|
|
font-size: 35rpx;
|
|||
|
|
width: 240rpx;
|
|||
|
|
height: 70rpx;
|
|||
|
|
line-height: 65rpx;
|
|||
|
|
border-radius: 30rpx;
|
|||
|
|
letter-spacing: 3rpx;
|
|||
|
|
}
|
|||
|
|
</style>
|