gaosp
2024-01-14 0d626ae57149d5ed40a32bd8b808ca6069aa6d5e
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-14 16:13:57
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/maintenance/index.vue
-->
<template>
    <div class="maintenance">
        <div class="nav">设备保养/{{navName}}</div>
        <List ref="list" url="/maintain/pageQuery">
            <template slot="search">
                <div class="item">
                    <span>统一编号</span>
                    <el-input class="item-value" v-model="queryInfo.uuid"></el-input>
                </div>
                <div class="item">
                    <span>设备名称</span>
                    <el-select class="item-value" v-model="queryInfo.machineName" placeholder="请选择">
                        <el-option v-for="item in machineList" :key="item.id" :label="item.name" :value="item.id">
                        </el-option>
                    </el-select>
                </div>
                <!-- <div class="item">
                    <span>设备型号</span>
                    <el-input class="item-value" v-model="queryInfo.type"></el-input>
                </div>
                <div class="item">
                    <span>设备规格</span>
                    <el-input class="item-value" v-model="queryInfo.specification"></el-input>
                </div> -->
                <div class="item">
                    <span>使用部门</span>
                    <el-select class="item-value" v-model="queryInfo.department">
                        <el-option v-for="item in departmentlist" :key="item.value" :label="item.label" :value="item.value">
                        </el-option>
                    </el-select>
                </div>
                <!-- <div class="item">
                    <span>安装位置</span>
                    <el-input class="item-value" v-model="queryInfo.location"></el-input>
                </div> -->
                <div class="item">
                    <span>计划开始日期</span>
                    <el-date-picker class="item-value" v-model="queryInfo.planStartDate" align="right" type="date" placeholder="选择日期">
                    </el-date-picker>
                </div>
                <div class="item">
                    <span>计划完成日期</span>
                    <el-date-picker class="item-value" v-model="queryInfo.planFinishDate" align="right" type="date" placeholder="选择日期">
                    </el-date-picker>
                </div>
                <div class="item">
                    <el-button type="primary" size="small" @click="query">查询</el-button>
                </div>
                <div class="item">
                    <el-button type="primary" size="small" @click="reset">重置</el-button>
                </div>
            </template>
            <template slot="table-tool">
                <el-button type="primary" size="mini" @click="addDevice(1)">添加</el-button>
            </template>
            <template slot="columns">
                <!-- <el-table-column
                type="selection"
                align="center"
                width="55">
            </el-table-column> -->
                <!-- <el-table-column align="center" label="统一编号" prop="uuid">
                </el-table-column> -->
                <el-table-column align="center" label="设备名称" width="150" :show-overflow-tooltip="true" prop="machineName">
                </el-table-column>
                <el-table-column align="center" label="设备型号" prop="type">
                </el-table-column>
                <el-table-column align="center" label="设备规格" prop="specification">
                </el-table-column>
                <el-table-column align="center" label="使用单位" prop="department">
                </el-table-column>
                <el-table-column align="center" label="保养者" prop="userName">
                </el-table-column>
                <el-table-column align="center" label="保养周期" prop="period">
                </el-table-column>
                <el-table-column align="center" label="保养类型" prop="style">
                    <template slot-scope="scope">
                        <span>{{ scope.row.style === "1" ? "日常保养" : scope.row.style === "2" ? "一级保养" :
                            scope.row.style === "3" ? "二级保养" : "三级保养" }}</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" width="110" label="是否合格" prop="isQualified">
                    <template slot-scope="scope">
                        <span>{{ scope.row.isQualified === "1" ? "合格" : "不合格" }}</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" width="120" :show-overflow-tooltip="true" label="计划开始时间">
                    <template slot-scope="scope">
                        <span v-if="scope.row.startDateFrom">{{ scope.row.startDateFrom + '~' + scope.row.startDateTo }}</span>
                        <span v-else></span>
                    </template>
                </el-table-column>
                <el-table-column align="center" width="120" :show-overflow-tooltip="true" label="计划完成时间">
                    <template slot-scope="scope">
                        <span v-if="scope.row.completeDateFrom">{{ scope.row.completeDateFrom + '~'
                            + scope.row.completeDateTo }}</span>
                        <span v-else></span>
                    </template>
                </el-table-column>
                <el-table-column align="center" width="150" :show-overflow-tooltip="true" label="保养内容与存在问题" prop="detail">
                </el-table-column>
                <el-table-column align="center" label="操作" prop="editor">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="addDevice(2, scope.row, $event)">编辑</el-button>
                        <el-button size="mini" type="text" @click="deleteHandle(2, scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </template>
        </List>
        <DailyMAddD ref="dailyMAddD" @reflash="submitForm" :style="navName" :departmentlist="departmentlist" :machineList="machineList" :userList="userList"></DailyMAddD>
    </div>
</template>
<script>
import List from '../list/index.vue'
import { getUseDpts,getRequest } from '@/api/Api'
import { userList } from '@/api/MdcApi'
import DailyMAddD from './dailyMAdd.vue'
export default {
    components: {
        List,
        DailyMAddD
    },
    computed: {
        navName () {
            let names = ['日常保养','一级','二级','三级']
            return names[this.$route.params.style-1]
        }
    },
    data() {
        return {
            departmentlist: [],
            userList: [],
            machineList: [],
            queryInfo: {
                uuid: '',
                machineName: '',
                type: '',
                specification: '',
                department: '',
                location: '',
                planStartDate: '',
                planFinishDate: '',
            },
            
        }
    },
    mounted() {
        this.init()
        this.query()
    },
    methods: {
        init () {
            // 查询使用部门
            getUseDpts().then(res => {
                this.departmentlist = res.data.map(item => {
                    return {
                        value: item.id,
                        label: item.name
                    }
                })
            })
            getRequest('machineList', {
            }).then(res => {
                this.machineList = res.data.list
                console.log(res)
            })
            getRequest('userList', {
            }).then(res => {
                this.userList = res.data.list
            })
        },
        query() {
            this.$refs.list.pageQuery(this.queryInfo)
        },
        reset() {
            Object.keys(this.queryInfo).forEach(key => {
                this.queryInfo[key] = ''
            })
        },
        addDevice(n, row, event) {
            if (n === 1) {
                this.$nextTick(() => {
                    this.$refs.dailyMAddD.init(n)
                })
            } else {
                this.$nextTick(() => {
                    this.$refs.dailyMAddD.init(n, row)
                })
            }
        },
        deleteHandle() {
 
        },
        submitForm() {
 
        }
    },
}
</script>
<style lang="scss">
.maintenance {
    .item-value {
        .el-input__inner {
            background: transparent;
            border-radius: 2px;
            border: 1px solid #435F9E;
        }
    }
 
    .el-button--mini {
        background: transparent;
    }
 
    .el-button--primary {
        background-color: transparent;
    }
}
</style>
<style lang="scss" scoped>
.maintenance {
    width: 100%;
    height: 100%;
    overflow: hidden;
    color: #FFF;
    display: flex;
    flex-direction: column;
 
    .nav {
        padding: 10px 30px;
        font-size: 14px;
    }
 
    .item {
        margin-top: 20px;
        margin-left: 50px;
        display: flex;
        align-items: center;
 
        span {
            width: 120px;
            font-size: 16px;
            font-family: PingFangSC, PingFang SC;
            color: #C6DCE0;
            text-align: right;
            padding-right: 20px;
        }
 
        .item-value {
            width: 200px;
            border: 1px solid #435F9E;
        }
 
        .btn {
            line-height: 1.5;
            width: 100px;
            text-align: center;
            font-size: 16px;
            cursor: pointer;
        }
 
        .reset {
            background: #AAB6BA;
            color: #FFF;
        }
 
        .query {
            background: #5DD1FC;
            color: #FFF;
        }
    }
}
</style>