刘磊
2025-04-19 2f18780a16a68f7fc67dd3bca61b8d0aed7c8e1a
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
<template>
    <view>
        <view>
            <u-table font-size="25">
                <u-tr>
                    <u-td>
                        <xfl-select :list="UserArray" :initValue="this.$UserTool.UserInfo.userName" :clearable="false"
                            :disabled="true">
                        </xfl-select>
                    </u-td>
                    <u-td width="25%">现在时间:</u-td>
                    <u-td width="25%">{{date}}</u-td>
                </u-tr>
            </u-table>
        </view>
 
        <view style="padding: 20rpx 0rpx">
            <u-table>
                <u-tr>
                    <u-td width="30%">操作方式</u-td>
                    <u-td>
                        <xfl-select :list="OperationList" :initValue="'请选择'" :clearable="false" @change="OperationChange">
                        </xfl-select>
                    </u-td>
                </u-tr>
                <u-tr>
                    <u-td width="30%">车轴条码</u-td>
                    <u-td>
                        <u-input v-model="cztm" :border="true" placeholder="车轴条码" />
                    </u-td>
                </u-tr>
                <u-tr>
                    <u-td width="30%">压装机号</u-td>
                    <u-td>
                        <xfl-select :list="MachineArray" :initValue="'请选择'" :clearable="false" @change="MachineChange">
                        </xfl-select>
                    </u-td>
                </u-tr>
            </u-table>
        </view>
        <view style="padding: 0rpx 0rpx">
            <u-table>
                <u-tr>
                    <u-td>
                        <u-button type="primary" @click="SaveInfomation">确认</u-button>
                    </u-td>
                </u-tr>
            </u-table>
        </view>
    </view>
</template>
 
<script>
    var _this;
    var _user;
    export default {
        data() {
            return {
                date: '',
                CurrentUser: '', //当前用户
                cztm: '',
                machine: '',
                operateType:'',
                OperationList: [{
                    label: '1',
                    value: '绑定'
                }, {
                    label: '2',
                    value: '解绑'
                }, ],
                
                MachineArray: [{
                    label: '1000',
                    value: '1号压装位'
                }, {
                    label: '2000',
                    value: '2号压装位'
                }, ],
            }
        },
        methods: {
            UserChange(value) {
 
            },
            setTimer() {
                if (this.timer == null) {
                    this.timer = setInterval(() => {
                        this.date = this.$DateTool.getDate();
                    }, 1000)
                }
            },
            MachineChange(value) {
                this.machine = value.orignItem.label;
            },
            OperationChange(value) {
                this.operateType = value.orignItem.label;
            },
            SaveInfomation() {
                if (_this.cztm.length == 0) {
                    uni.showToast({
                        title: "请扫描车轴条码!",
                        duration: 5000
                    });
                    return;
                }
                uni.showModal({
                    title: '提示',
                    content: '是否确认保存?',
                    success: function(res) {
                        if (res.confirm) {
                            let data = {
                                MainData: {
                                    operateType:_this.operateType,
                                    cztm: _this.cztm,
                                    machine: _this.machine,
                                },
                            };
                            _this.$AjaxRequest.Params('post', 'Dt_CacheInfo/AddCacheInfoByAPP',
                                data, _user.token);
                            _this.$AjaxRequest.Request().then(function(result) {
                                if (result.data.status) {
                                    uni.showToast({
                                        title: "操作成功!",
                                        duration: 5000
                                    });
                                    _this.cztm = "";
                                } else {
                                    uni.showToast({
                                        icon: 'none',
                                        title: "请求错误:" + result.data.message,
                                        duration: 5000
                                    });
                                }
                            }).catch(function(err) {
                                uni.showToast({
                                    icon: 'none',
                                    title: "请求后台异常,错误信息." + err.errMsg,
                                    duration: 5000
                                });
                            });
                        } else if (res.cancel) {}
                    }
                });
            },
        },
        created: function() {
            // 每次进入界面时,先清除之前的所有定时器,然后启动新的定时器
            clearInterval(this.timer)
            this.timer = null;
            this.setTimer();
            _user = this.$UserTool.UserInfo;
            this.CurrentUser = _user.userName;
            this.UserArray = [this.$UserTool.AllUserInfo];
        },
        destroyed: function() {
            // 每次离开当前界面时,清除定时器
            clearInterval(this.timer);
            this.timer = null;
        },
        mounted() {
            _this = this;
            //_this.queryOrder();
        },
 
 
    }
</script>
 
<style scoped lang="scss">
    .tdHeight {
        height: 80rpx;
    }
 
    .loopView {
        height: 160px;
        background-color: #f0f0f0;
        margin-top: 10px;
    }
 
    .loopItem {
        margin-top: 5px;
        margin-left: 15px;
 
    }
 
    .deleteBtn {
        margin-top: 25px;
        margin-left: 10px;
        width: 120px;
        background-color: orangered;
    }
</style>