|
@@ -1,121 +1,67 @@
|
|
|
<template>
|
|
|
<el-dialog :visible.sync="visible" :title="title" :close-on-click-modal="false" :close-on-press-escape="false">
|
|
|
- <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="'120px'">
|
|
|
- <el-form-item label="设备SN" prop="sn">
|
|
|
- <el-input :maxlength="20" style="width: 400px;" show-word-limit v-model="dataForm.sn" placeholder="请输入设备SN或IMEI"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="处置类型" prop="eventType">
|
|
|
- <el-select v-model="dataForm.eventType" style="width: 400px;">
|
|
|
- <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="设备新SN" prop="newsn" v-if="dataForm.eventType === 1">
|
|
|
- <el-input :maxlength="20" style="width: 400px;" show-word-limit v-model="dataForm.newsn" placeholder="请输入设备新的SN"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="处置说明" prop="remarks">
|
|
|
- <el-input :maxlength="200" style="width: 400px;" type="textarea" show-word-limit v-model="dataForm.remarks" placeholder="请输入处置说明"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <template slot="footer">
|
|
|
- <el-button type="primary" @click="dataFormSubmitHandle()">确认</el-button>
|
|
|
- <el-button @click="visible = false">取消</el-button>
|
|
|
- </template>
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="detail"
|
|
|
+ element-loading-text="Loading"
|
|
|
+ :cell-style="{'text-align':'center'}"
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ >
|
|
|
+ <el-table-column>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.sn || '-' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.handleTime || '-' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import debounce from 'lodash/debounce'
|
|
|
-import { addHandle } from '@/api/device/handle'
|
|
|
+import { handleDetail } from '@/api/device/handle'
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
/**是否显示弹窗 */
|
|
|
visible: false,
|
|
|
/**弹窗标题 */
|
|
|
- title: '新增处置',
|
|
|
- //处置类型
|
|
|
- options: [
|
|
|
- {label: '报废', value: 1},
|
|
|
- {label: '丢失', value: 2},
|
|
|
- {label: '更换', value: 3},
|
|
|
- {label: '梯次退役', value: 4}
|
|
|
- ],
|
|
|
+ title: '历史SN查看',
|
|
|
+
|
|
|
/**提交表单对象 */
|
|
|
dataForm: {
|
|
|
- id: '',
|
|
|
- remarks: '',
|
|
|
sn: '',
|
|
|
- eventType: null,
|
|
|
- newsn: ''
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- dataRule () {
|
|
|
- return {
|
|
|
- sn: [
|
|
|
- { required: true, message: '设备SN不能为空', trigger: 'blur' },
|
|
|
- ],
|
|
|
- remarks: [
|
|
|
- { required: true, message: '处置说明不能为空', trigger: 'blur' },
|
|
|
- ],
|
|
|
- newsn: [
|
|
|
- { required: true, message: '设备新SN不能为空', trigger: 'blur' },
|
|
|
- ],
|
|
|
- eventType: [
|
|
|
- { required: true, message: '处置类型不能为空', trigger: 'change' },
|
|
|
- ]
|
|
|
- }
|
|
|
+ },
|
|
|
+ detail: [],
|
|
|
+ loading: false
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
init () {
|
|
|
this.visible = true
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs['dataForm'].resetFields()
|
|
|
+ // this.$refs['dataForm'].resetFields()
|
|
|
})
|
|
|
+ this.getInfo()
|
|
|
},
|
|
|
// 获取信息
|
|
|
getInfo () {
|
|
|
- this.$http.get('/tbCollectManagment/tbcollectmanagment/' + this.dataForm.id).then(({ data: res }) => {
|
|
|
- if (res.code !== 0) {
|
|
|
- return this.$message.error(res.msg)
|
|
|
- }
|
|
|
- this.dataForm = {
|
|
|
- ...this.dataForm,
|
|
|
- ...res.data
|
|
|
+ handleDetail(this.dataForm).then(res => {
|
|
|
+ this.loading = true
|
|
|
+ if(res.code === 200) {
|
|
|
+ this.detail = res.data
|
|
|
+ this.loading = false
|
|
|
+ } else {
|
|
|
+ return this.$message.error(res.message)
|
|
|
}
|
|
|
- }).catch(() => {})
|
|
|
- },
|
|
|
- // 表单提交
|
|
|
- dataFormSubmitHandle: debounce(function () {
|
|
|
- this.$refs['dataForm'].validate((valid) => {
|
|
|
- if (!valid) {
|
|
|
- return false
|
|
|
- }
|
|
|
- this.$confirm('确认后无法撤回,请谨慎操作, 是否继续?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- addHandle(this.dataForm).then(res => {
|
|
|
- debugger
|
|
|
- if (res.code !== 200) {
|
|
|
- return this.$message.error(res.msg)
|
|
|
- }
|
|
|
- this.$message({
|
|
|
- message: '操作成功',
|
|
|
- type: 'success',
|
|
|
- duration: 1000,
|
|
|
- onClose: () => {
|
|
|
- this.visible = false
|
|
|
- this.$emit('refreshDataList')
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(() => {})
|
|
|
- })
|
|
|
})
|
|
|
- }, 1000, { 'leading': true, 'trailing': false })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|