yangys
2024-03-05 a33533511f0109aaffd6b0c5e31080c20c34a48a
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-03-05 16:04:32
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/ledger/index.vue
-->
<template>
    <div class="maintenance">
        <Nav name="台账"></Nav>
        <List ref="list" url="/account/pageQuery">
            <template slot="search">
                <div class="item">
                    <span>统一编号</span>
                    <el-input class="item-value" v-model="queryInfo.uuid" clearable></el-input>
                </div>
                <div class="item">
                    <span>设备规格</span>
                    <el-input class="item-value" v-model="queryInfo.specification"  clearable></el-input>
                </div>
                <div class="item">
                    <span>设备型号</span>
                    <el-input class="item-value" v-model="queryInfo.type" clearable></el-input>
                </div>
                <div class="item">
                    <span>加工类型</span>
                    <el-select class="item-value" v-model="queryInfo.category" placeholder="" clearable>
                        <el-option v-for="item in deviceType" :key="item.value" :label="item.label" :value="item.value">
                        </el-option>
                    </el-select>
                </div>
                <div class="item">
                    <span>账务属性</span>
                    <el-select class="item-value" v-model="queryInfo.accountingAttribute" placeholder="" clearable>
                        <el-option v-for="item in financePro" :key="item.value" :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </div>
                <div class="item">
                    <span>使用部门</span>
                    <el-select class="item-value" v-model="queryInfo.department" clearable>
                        <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-select class="item-value" v-model="queryInfo.manageType" clearable>
                        <el-option value="A">A</el-option>
                        <el-option value="B">B</el-option>
                        <el-option value="C">C</el-option>
                    </el-select>
                </div>
                <div class="item">
                    <span>投产日期</span>
                    <el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="queryInfo.date"
                        range-separator="至" clearable type="daterange" start-placeholder="开始日期" end-placeholder="结束日期" clearable>
                    </el-date-picker>
                    <!-- <el-date-picker class="item-value" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                        v-model="queryInfo.productionDate" type="date" clearable placeholder="选择日期" clearable></el-date-picker> -->
                </div>
                <div class="item">
                    <span>生产厂家</span>
                    <el-input class="item-value" v-model="queryInfo.manufacturer" clearable></el-input>
                </div>
                <div class="item">
                    <span>设备类型</span>
                    <el-select class="item-value" v-model="queryInfo.deviceTypeId" placeholder=""  clearable>
                        <el-option v-for="item in deviceTypeIds" :key="item.id" :label="item.name"
                            :value="item.id">
                        </el-option>
                    </el-select>
                </div>
                <div class="item" style="flex: 1 1 auto;justify-content: flex-end;">
                    <el-button type="primary" style="width: 150px;" size="small" @click="query">查询</el-button>
                    <el-button type="ghost" style="width: 150px;" size="small" @click="reset">重置</el-button>
                </div>
                
            </template>
 
            <template slot="table-tool">
                <el-button type="primary" size="mini" @click="add">新增设备台账</el-button>
            </template>
            <template slot="columns">
                <!-- <el-table-column type="selection" align="center" width="55">
                </el-table-column> -->
                <el-table-column label="统一编号" align="center" prop="uuid">
                </el-table-column>
                <el-table-column label="设备名称" align="center" prop="machineName">
                </el-table-column>
                <el-table-column label="设备规格" align="center" prop="specification">
                </el-table-column>
                <el-table-column label="设备型号" align="center" prop="category">
                </el-table-column>
                <!-- <el-table-column
                label="设备管理分类"
                align="center"
                prop="managType">
            </el-table-column>
            <el-table-column
                label="班次"
                align="center"
                prop="classes">
            </el-table-column> -->
                <el-table-column label="使用部门" align="center" prop="departmentName">
                </el-table-column>
                <el-table-column label="设备类型" align="center" prop="category">
                </el-table-column>
                <el-table-column label="设备状态" align="center" prop="state">
                    <template slot-scope="scope">
                        <span v-if="scope.row.state == 'STOP'">关机状态</span>
                        <span v-else-if="scope.row.state == 'RUN'">运行状态</span>
                        <span v-else-if="scope.row.state == 'IDLE'">空闲状态</span>
                        <span v-else-if="scope.row.state == 'ALARM'">报警状态</span>
                    </template>
                </el-table-column>
                <el-table-column label="账务属性" align="center" prop="accountingAttribute">
                </el-table-column>
                <el-table-column label="生产厂家" align="center" prop="manufacturer">
                </el-table-column>
                <el-table-column label="投产日期" align="center" prop="productionDate">
                </el-table-column>
                <el-table-column label="国别" align="center" prop="country">
                </el-table-column>
                <el-table-column width="110" align="center" label="设备原值(元)" prop="originalValue">
                </el-table-column>
                <el-table-column width="110" align="center" label="设备重量(kg)" prop="weight">
                </el-table-column>
                <el-table-column width="110" align="center" label="电气复杂系数" prop="elecCompFactor">
                </el-table-column>
                <el-table-column width="110" align="center" label="机械复杂系数" prop="mechCompFactor">
                </el-table-column>
                <el-table-column width="120" align="center" label="设备净现值(元)" prop="presentValue">
                </el-table-column>
                <el-table-column label="备注" align="center" prop="remark">
                </el-table-column>
                <el-table-column width="220" fixed="right" align="center" label="操作">
                    <template slot-scope="scope">
                        <a class="table-action table-edit"  @click="addOrUpdateHandle(scope.row)">编辑</a>
                        <a class="table-action table-del"  @click="del(scope.row)">删除</a>
                        <!-- <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)">编辑</el-button>
                        <el-button type="text" size="small" @click="del(scope.row)">删除</el-button> -->
                    </template>
                </el-table-column>
            </template>
        </List>
        <manage-add-update v-if="addOrUpdateVisible" :addVisible="addOrUpdateVisible" @close="close" @confirm="confirm"
            :deviceType="deviceType" :departmentlist="departmentlist" :isselectlist="isselectlist"
            :deviceStatus="deviceStatus" :financePro="financePro" :deviceTypeIds="deviceTypeIds" :row="row"></manage-add-update>
    </div>
</template>
<script>
import ManageAddUpdate from './Manage-add-update'
import { getUseDpts, getRequest } from '@/api/Api'
import List from '../list/index.vue'
import Nav from '@/components/nav'
export default {
    components: {
        Nav,
        List,
        ManageAddUpdate
    },
    data() {
        return {
            // 加工类型
            deviceType: [
                { value: '立加', label: '立加' },
                { value: '卧加', label: '卧加' },
                { value: '立卧转换', label: '立卧转换' },
                { value: '五轴', label: '五轴' },
                { value: '数控车', label: '数控车' },
                { value: '复合加工', label: '复合加工' },
                { value: '数控磨', label: '数控磨' },
                { value: '齿加工', label: '齿加工' },
                { value: '电工加', label: '电工加' }
            ],
            isselectlist: [
                {
                    label: '是',
                    value: '1'
                },
                {
                    label: '否',
                    value: '0'
                }
            ],
            // 设备状态
            deviceStatus: [
                { value: 'STOP', label: '关机' },
                { value: 'RUN', label: '运行' },
                { value: 'IDLE', label: '空闲' },
                { value: 'ALARM', label: '报警' }
            ],
            deviceTypeIds: [],
            // 账务属性
            financePro: [
                { value: '帐内', label: '帐内' },
                { value: '帐外', label: '帐外' }
            ],
            departmentlist: [],
            queryInfo: {
                date: [],
                uuid: '',
                specification: '',
                type: '',
                category: '',
                accountingAttribute: '',
                department: '',
                manageType: '',
                // productionDate: '',
                manufacturer: '',
                deviceTypeId: '',
                productionDateBegin: '',
                productionDateEnd: '',
            },
            options: [{}],
            row: {},
            addOrUpdateVisible: false
        }
    },
    mounted() {
        this.query()
        this.init()
    },
    methods: {
        init() {
            // 查询使用部门
            getUseDpts().then(res => {
                this.departmentlist = res.data.map(item => {
                    return {
                        value: item.id,
                        label: item.name
                    }
                })
            })
            
            getRequest('deviceTypeList').then(res => {
                this.deviceTypeIds = res.data || []
            })
        },
        query() {
            try {
                this.queryInfo.productionDateBegin = this.queryInfo.date[0] || ''
                this.queryInfo.productionDateEnd = this.queryInfo.date[1] || ''
            } catch (error) {
                console.log(error)
            }
            
            this.$refs.list.pageQuery(this.queryInfo)
        },
        reset() {
            Object.keys(this.queryInfo).forEach(key => {
                this.queryInfo[key] = ''
            })
            this.queryInfo.date  = []
            this.queryInfo.productionDateBegin = ''
            this.queryInfo.productionDateEnd = ''
        },
        add() {
            this.row = {}
            this.addOrUpdateVisible = true
        },
        close() {
            this.addOrUpdateVisible = false
        },
        confirm() {
            this.query()
            this.close()
        },
        addOrUpdateHandle(row) {
            this.row = row
            this.addOrUpdateVisible = true
        },
        del(row) {
            this.$confirm('确定要永久删除此项?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                getRequest('accountDel', { ids: [row.id] }).then(res => {
                    this.query()
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    })
                    this.submitForm()
                },() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    })
                })
            })
        }
    },
}
</script>
<style lang="scss">
.maintenance {
    .item-value {
        .el-input__inner {
            background: transparent;
            border-radius: 2px;
            border: 1px solid #435F9E;
        }
    }
}
</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>