Houjie
2025-04-18 77cc3af3cea60471fb2d45ab5da10c4673a6f559
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<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 class="flex">
                <button class="flex-sub  cu-btn bg-blue margin-sm  padding-sm lg" hover-class="is-hover"
                    @click="getSera()">点检</button>
                <button class="flex-sub  cu-btn bg-blue margin-sm  padding-sm lg" hover-class="is-hover"
                    @click="resetTask">保养</button>
                <button class="flex-sub  cu-btn bg-blue margin-sm  padding-sm lg" hover-class="is-hover"
                    @click="resetTask">维修</button>
                <button class="flex-sub  cu-btn bg-blue margin-sm  padding-sm lg" hover-class="is-hover"
                    @click="resetTask">周养</button>
            </view>
        </view>
    </view>
</template>
 
<script>
    import {
        stringify
    } from "querystring";
    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) {
            const decodedEquipmentId = decodeURIComponent(options.equipmentId);
            this.id = decodedEquipmentId;
            // const data = options.query;
            // this.id = JSON.parse(data).equipmentId;
            // console.log(data)
            // this.id = options.equipmentId;
            // console.log(options)
            console.log(this.id)
            if (!this.id) {
                uni.showModal({
                    title: '提示',
                    content: "错误不存在",
                    showCancel: false
                });
            } else {
                this.upCallback();
            }
 
        },
        onShow() {
            // 从路由参数中获取equipmentId
            const equipmentIdFromRoute = this.$router.query.equipmentId;
            if (equipmentIdFromRoute) {
                // 如果存在,更新this.id
                this.id = equipmentIdFromRoute;
                // 重新获取设备详情数据
                this.upCallback();
            }
        },
        watch: {
            // 监听$route变化
            $route(to, from) {
                // 更新equipmentId参数
                this.id = to.query.equipmentId;
                console.log('更新后的equipmentId:', this.equipmentId);
            }
        },
        created() {},
        methods: {
            getSera() {
                console.log('getSera 方法被调用');
                uni.navigateTo({
                    url: '/pages/TaskManager/TaskManagerList'
                });
            },
        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(() => {
                //联网失败, 结束加载
            })
        },
 
        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>