<template>
|
<view class="container">
|
<cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask">
|
<block slot="backText">返回</block>
|
<!-- <cu-custom :bgColor="NavBarColor" backRouterName="index">
|
<block slot="right">
|
<view @tap="$debounce(BackPage)">
|
<view class="cuIcon-back back">返回</view>
|
</view>
|
</block> -->
|
<block slot="content">设备详情</block>
|
</cu-custom>
|
<view class="container">
|
|
|
<uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext">
|
<uni-group top="1">
|
|
<uni-forms-item name="num" label="设备图片:">
|
<image style="height: 100px; width: 300px;"
|
:src="formData.equipmentImagel?formData.equipmentImage:'/static/zhanwei.png'"></image>
|
</uni-forms-item>
|
<uni-forms-item required name="num" label="设备编号:">
|
<uni-easyinput v-model="formData.equipmentCode" :disabled="true" />
|
</uni-forms-item>
|
|
<uni-forms-item name="remark" label="设备名称:">
|
<uni-easyinput v-model="formData.equipmentName" :disabled="true" />
|
</uni-forms-item>
|
<uni-forms-item name="remark" label="设备型号:">
|
<uni-easyinput v-model="formData.equipmentModel" :disabled="true" />
|
</uni-forms-item>
|
<uni-forms-item name="outNum" label="设备规格:">
|
<uni-easyinput v-model="formData.equipmentSpecification" :disabled="true" />
|
</uni-forms-item>
|
<view class="text-gray margin-bottom-lg">—————————— 基本信息 ——————————</view>
|
<uni-forms-item name="taskCode" label="设备分类:">
|
<uni-easyinput :disabled="true" v-model="formData.equipmentCategory" />
|
</uni-forms-item>
|
<uni-forms-item name="endLocation" label="出厂日期:">
|
<uni-easyinput :disabled="true" v-model="formData.leaveFactoryDate" />
|
|
</uni-forms-item>
|
<uni-forms-item name="endLocation" label="验收日期:">
|
<uni-easyinput :disabled="true" v-model="formData.acceptanceCheckDate" />
|
|
</uni-forms-item>
|
|
<uni-forms-item name="endLocation" label="安装位置:">
|
<uni-easyinput :disabled="true" v-model="formData.installationPosition" />
|
</uni-forms-item>
|
<uni-forms-item name="endLocation" label="资产状态:">
|
<uni-easyinput :disabled="true" v-model="formData.assetStatus" />
|
</uni-forms-item>
|
<uni-forms-item name="endLocation" label="设备管理员:">
|
<uni-easyinput :disabled="true" v-model="formData.equipmentManager" />
|
</uni-forms-item>
|
|
</uni-group>
|
</uni-forms>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
export default {
|
mixins: [MescrollMixin], // 使用mixin
|
data() {
|
return {
|
|
formData: {},
|
NavBarColor: this.NavBarColor,
|
url: {
|
stallList: "/eam/equipment/queryById"
|
},
|
id: '',
|
upOption: {
|
page: {
|
num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
|
size: 10 // 每页数据的数量
|
},
|
noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
empty: {
|
tip: '~ 暂无数据 ~', // 提示
|
},
|
loading: '',
|
text: '全部',
|
isShowNoMore: false,
|
textNoMore: '我是有底线的 >_<'
|
},
|
styles: {
|
color: '#2979FF',
|
borderColor: '#2979FF'
|
},
|
msg1Count: 0,
|
msg2Count: 0,
|
msg1Title: ""
|
}
|
},
|
computed: {
|
top() {
|
return this.CustomBar * 2 + 160
|
},
|
style() {
|
var StatusBar = this.StatusBar;
|
var CustomBar = this.CustomBar;
|
var CustomBar = this.CustomBar;
|
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
|
return style
|
},
|
},
|
|
onLoad(options) {
|
console.log(options)
|
// 先尝试用正常方式获取
|
let equipmentId = options.equipmentId;
|
if (!equipmentId) {
|
// 手动解析URL参数
|
const url = window.location.href;
|
console.log(url);
|
const index = url.indexOf('?');
|
if (index > -1) {
|
const query = url.substring(index + 1);
|
const pairs = query.split('&');
|
pairs.forEach(pair => {
|
const [key, value] = pair.split('=');
|
if (key === 'equipmentId') {
|
equipmentId = decodeURIComponent(value);
|
}
|
});
|
}
|
}
|
},
|
// if (equipmentId) {
|
// this.upCallback();
|
// } else {
|
// console.log('无法获取设备ID');
|
// }
|
// },
|
// onLoad(options) {
|
|
|
// this.id = options.equipmentId || '';
|
// if (!this.id) {
|
// uni.showModal({
|
// title: '提示',
|
// content: "错误不存在",
|
// showCancel: false
|
// });
|
// } else {
|
// this.upCallback();
|
// }
|
// },
|
created() {
|
// this.upCallback();
|
},
|
methods: {
|
BackPage() {
|
// 重写返回按钮逻辑,返回到首页
|
uni.switchTab({
|
url: '/pages/index/index' // 这里是首页的路径,根据实际情况修改
|
});
|
|
|
},
|
upCallback() {
|
console.log("id", this.id)
|
this.$http.get(this.url.stallList, {
|
params: {
|
pageNo: 999,
|
pageSize: 1,
|
order: 'asc',
|
column: 'createTime',
|
id: this.id
|
},
|
|
}).then(res => {
|
this.announcement1 = res.data.result
|
console.log("url", res)
|
//设置列表数据
|
if (res.data.success) {
|
console.log("res", res.data.result.equipmentCode)
|
this.formData = this.announcement1
|
}
|
}).catch(() => {
|
//联网失败, 结束加载
|
})
|
},
|
|
|
|
/* 检索 */
|
getSera(res) {
|
this.msgList = [];
|
if (keyword == 0) {
|
this.$http.get(this.url.stallList, {
|
params: {
|
pageNo: 1,
|
pageSize: 999,
|
order: "desc",
|
column: "createTime",
|
equipmentCode: res
|
}
|
}).then(res => {
|
//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
|
|
this.announcement1 = res.data.result.records
|
this.mescroll.endSuccess(this.announcement1.length);
|
console.log("url", res)
|
//设置列表数据
|
if (res.data.success) {
|
console.log("res", res.data)
|
this.msg1Count = res.data.result.total
|
this.msg1Title = "通知(" + res.data.result.total + ")";
|
for (let annItem of this.announcement1) {
|
this.msgList.push(annItem)
|
}
|
}
|
if (page.num == 1) {
|
this.msgList = []; //如果是第一页需手动制空列表
|
this.msgList = this.msgList.concat(this.announcement1); //追加新数据
|
}
|
|
}).catch(() => {
|
//联网失败, 结束加载
|
this.mescroll.endErr();
|
})
|
}
|
},
|
|
mescrollInit(mescroll) {
|
console.log('mescrollInit')
|
this.mescroll = mescroll;
|
},
|
},
|
|
}
|
</script>
|
|
<style>
|
.is-hover {
|
color: rgba(255, 255, 255, 0.6);
|
background-color: #55aaff;
|
border-color: #55aaff;
|
}
|
|
|
|
.content {
|
margin-top: 5px;
|
}
|
|
.content scroll-view {
|
scrollIndicator: "none"
|
}
|
|
.popupView {
|
margin-top: 85px;
|
height: auto;
|
}
|
</style>
|