|
@ -15,28 +15,31 @@ |
|
|
/> |
|
|
/> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</div> |
|
|
</div> |
|
|
<!-- @keyup.enter.native="crud.toQuery" --> |
|
|
|
|
|
<div class="form_item"> |
|
|
<div class="form_item"> |
|
|
<span>设备ID:</span> |
|
|
<span>设备ID:</span> |
|
|
<el-input |
|
|
<el-input |
|
|
v-model="query.device_id" |
|
|
|
|
|
|
|
|
v-model="queryInfo.device_id" |
|
|
clearable |
|
|
clearable |
|
|
size="small" |
|
|
size="small" |
|
|
placeholder="请输入设备ID" |
|
|
placeholder="请输入设备ID" |
|
|
style="width: 200px" |
|
|
style="width: 200px" |
|
|
class="filter-item" |
|
|
class="filter-item" |
|
|
@keyup.enter.native='queryDevice(query.device_id)' |
|
|
|
|
|
|
|
|
@clear="getDevice" |
|
|
|
|
|
@blur="queryDevice(queryInfo.device_id)" |
|
|
|
|
|
@keyup.enter.native='queryDevice(queryInfo.device_id)' |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form_item"> |
|
|
<div class="form_item"> |
|
|
<span>设备名称:</span> |
|
|
<span>设备名称:</span> |
|
|
<el-input |
|
|
<el-input |
|
|
v-model="query.name" |
|
|
|
|
|
|
|
|
v-model="queryInfo.device_name" |
|
|
clearable |
|
|
clearable |
|
|
size="small" |
|
|
size="small" |
|
|
placeholder="请输入设备名称" |
|
|
placeholder="请输入设备名称" |
|
|
style="width: 200px" |
|
|
style="width: 200px" |
|
|
class="filter-item" |
|
|
class="filter-item" |
|
|
|
|
|
@blur="getDevice" |
|
|
|
|
|
@keyup.enter.native="getDevice" |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</el-col> |
|
|
</el-col> |
|
@ -45,7 +48,7 @@ |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
</div> |
|
|
</div> |
|
|
<!-- table --> |
|
|
|
|
|
|
|
|
<!-- table :data="deviceList"--> |
|
|
<el-row :gutter="15"> |
|
|
<el-row :gutter="15"> |
|
|
<el-col> |
|
|
<el-col> |
|
|
<el-table |
|
|
<el-table |
|
@ -59,7 +62,7 @@ |
|
|
<el-table-column prop="device_name" label="设备名称" align="center" /> |
|
|
<el-table-column prop="device_name" label="设备名称" align="center" /> |
|
|
<el-table-column label="设备方向" align="center" > |
|
|
<el-table-column label="设备方向" align="center" > |
|
|
<template slot-scope="{row}"> |
|
|
<template slot-scope="{row}"> |
|
|
<div>{{row.device_direction ? '竖屏' : '横屏' }}</div> |
|
|
|
|
|
|
|
|
<div>{{row.device_direction==1? '竖屏' : '横屏' }}</div> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column prop="organ_name" label="所属机构" align="center"/> > |
|
|
<el-table-column prop="organ_name" label="所属机构" align="center"/> > |
|
@ -74,7 +77,11 @@ |
|
|
<el-button type="text" size="small" @click="handleClick(scope.row)">查看</el-button> |
|
|
<el-button type="text" size="small" @click="handleClick(scope.row)">查看</el-button> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column prop="create_time" label="创建时间" align="center" width="160" /> |
|
|
|
|
|
|
|
|
<el-table-column prop="create_time" label="创建时间" align="center" width="160" > |
|
|
|
|
|
<template slot-scope="{row}"> |
|
|
|
|
|
<div>{{ row.create_time | parseTime}}</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
<el-table-column fixed="right" label="操作" align="center" width="120"> |
|
|
<el-table-column fixed="right" label="操作" align="center" width="120"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-button |
|
|
<el-button |
|
@ -189,35 +196,39 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { ReqDeviceEdit } from '@/api/device/deviceList.js' |
|
|
|
|
|
import {mapState} from 'vuex' |
|
|
|
|
|
|
|
|
import { ReqDeviceEdit ,ReqDeviceList,ReqQueryDevice} from '@/api/device/deviceList.js' |
|
|
import {parseTime} from '@/utils/index.js' |
|
|
import {parseTime} from '@/utils/index.js' |
|
|
export default { |
|
|
export default { |
|
|
name: 'Device', |
|
|
name: 'Device', |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
|
|
|
queryInfo:{ |
|
|
|
|
|
device_id:'', |
|
|
|
|
|
device_name:'', |
|
|
|
|
|
is_state:'', |
|
|
page:'1', |
|
|
page:'1', |
|
|
size:'3', |
|
|
|
|
|
|
|
|
size:'3' |
|
|
|
|
|
}, |
|
|
// device_id:'', |
|
|
// device_id:'', |
|
|
dialogTitle: '', |
|
|
dialogTitle: '', |
|
|
// 编辑的对话框 |
|
|
// 编辑的对话框 |
|
|
addFromVisible: false, |
|
|
addFromVisible: false, |
|
|
contentVisible: false, |
|
|
contentVisible: false, |
|
|
recordVisible: false, |
|
|
recordVisible: false, |
|
|
|
|
|
|
|
|
|
|
|
// 设备列表的数据 |
|
|
|
|
|
deviceList:[], |
|
|
stateData: [{ key: '0', name: '全部' }, { key: '1', name: '在线' }, { key: '2', name: '离线' }], |
|
|
stateData: [{ key: '0', name: '全部' }, { key: '1', name: '在线' }, { key: '2', name: '离线' }], |
|
|
deviceData: [{ key: '0', name: '竖屏' }, { key: '1', name: '横屏' }], |
|
|
|
|
|
|
|
|
deviceData: [{ key: '1', name: '竖屏' }, { key: '2', name: '横屏' }], |
|
|
query:{ |
|
|
query:{ |
|
|
state:null, |
|
|
state:null, |
|
|
name:null, |
|
|
|
|
|
device_id:'', |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
// 收集表单数据 |
|
|
form: { |
|
|
form: { |
|
|
account: null, |
|
|
account: null, |
|
|
name: null, |
|
|
name: null, |
|
|
orientation: null, |
|
|
orientation: null, |
|
|
device_id:'', |
|
|
device_id:'', |
|
|
orga_id:'' |
|
|
|
|
|
|
|
|
orga_id:'1310000' |
|
|
}, |
|
|
}, |
|
|
rules: { |
|
|
rules: { |
|
|
name: [{ required: true, message: '请输入设备名称', trigger: 'blur' }, { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }], |
|
|
name: [{ required: true, message: '请输入设备名称', trigger: 'blur' }, { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }], |
|
@ -225,39 +236,42 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
filters: { |
|
|
|
|
|
parseTime(time, cFormat) { |
|
|
|
|
|
return parseTime(time, cFormat) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
watch: {}, |
|
|
watch: {}, |
|
|
mounted(){ |
|
|
mounted(){ |
|
|
this.getDevice() |
|
|
this.getDevice() |
|
|
}, |
|
|
}, |
|
|
computed:{ |
|
|
|
|
|
...mapState({ |
|
|
|
|
|
deviceList:(state)=>state.device.deviceList |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
// 获取设备列表的数据 |
|
|
// 获取设备列表的数据 |
|
|
getDevice(){ |
|
|
getDevice(){ |
|
|
const{page,size}=this |
|
|
|
|
|
this.$store.dispatch('getDeviceList',{page,size}) |
|
|
|
|
|
|
|
|
const params = this.queryInfo |
|
|
|
|
|
ReqDeviceList(params).then(res => { |
|
|
|
|
|
if(res.code==200) { |
|
|
|
|
|
this.deviceList=res.data.content |
|
|
|
|
|
}else{ |
|
|
|
|
|
return this.$message.error('获取设备列表失败!') |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
// 编辑 |
|
|
// 编辑 |
|
|
editFormData(row) { |
|
|
editFormData(row) { |
|
|
this.addFromVisible = true |
|
|
this.addFromVisible = true |
|
|
this.form.account = row.device_account |
|
|
this.form.account = row.device_account |
|
|
this.form.name=row.device_name |
|
|
this.form.name=row.device_name |
|
|
this.form.orientation=row.device_direction ? '竖屏' : '横屏' |
|
|
|
|
|
|
|
|
this.form.orientation=row.device_direction==1?'竖屏':'横屏' |
|
|
this.form.device_id=row.device_id |
|
|
this.form.device_id=row.device_id |
|
|
// console.log(id) |
|
|
|
|
|
// ReqDeviceEdit(params).then(res => { |
|
|
|
|
|
// console.log(res) |
|
|
|
|
|
// }) |
|
|
|
|
|
}, |
|
|
}, |
|
|
recordData(index, row) { |
|
|
recordData(index, row) { |
|
|
this.recordVisible = true |
|
|
this.recordVisible = true |
|
|
}, |
|
|
}, |
|
|
// 查看 |
|
|
// 查看 |
|
|
handleClick(row) { |
|
|
handleClick(row) { |
|
|
console.log(row) |
|
|
|
|
|
|
|
|
// console.log(row) |
|
|
this.contentVisible = true |
|
|
this.contentVisible = true |
|
|
}, |
|
|
}, |
|
|
// 修改设备信息并提交 |
|
|
// 修改设备信息并提交 |
|
@ -267,13 +281,19 @@ export default { |
|
|
const params = { |
|
|
const params = { |
|
|
account:this.form.account, |
|
|
account:this.form.account, |
|
|
device_name:this.form.name, |
|
|
device_name:this.form.name, |
|
|
device_direction:this.form.orientation, |
|
|
|
|
|
device_id:this.form.device_id |
|
|
|
|
|
|
|
|
device_direction:0, |
|
|
|
|
|
device_id:this.form.device_id, |
|
|
|
|
|
orga_id:'13000' |
|
|
} |
|
|
} |
|
|
// console.log(account,device_name,device_direction) |
|
|
|
|
|
console.log(params) |
|
|
|
|
|
ReqDeviceEdit(params).then(res => { |
|
|
ReqDeviceEdit(params).then(res => { |
|
|
console.log(res) |
|
|
|
|
|
|
|
|
if(res.code==200) { |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
type: "success", |
|
|
|
|
|
message: '修改设备成功' |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
this.addFromVisible=false |
|
|
|
|
|
this.getDevice() |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
console.log('error submit!!') |
|
|
console.log('error submit!!') |
|
@ -288,8 +308,11 @@ export default { |
|
|
} |
|
|
} |
|
|
ReqQueryDevice(params).then(res=>{ |
|
|
ReqQueryDevice(params).then(res=>{ |
|
|
console.log(res) |
|
|
console.log(res) |
|
|
}) |
|
|
|
|
|
|
|
|
if(res.code==200) { |
|
|
|
|
|
this.getDevice() |
|
|
} |
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|