fix: 增加临边防护设备管理列表设备状态字段
This commit is contained in:
parent
42d4678306
commit
8253545ec6
@ -36,6 +36,12 @@
|
||||
label="设备编号"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column prop="online" label="设备状态" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.online === 0">离线</span>
|
||||
<span v-if="scope.row.online === 1">在线</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="location"
|
||||
label="安装位置"
|
||||
@ -63,7 +69,7 @@
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.online == 0 ? '离线' : '在线'
|
||||
scope.row.online == 0 ? "离线" : "在线"
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
@ -223,27 +229,27 @@ import {
|
||||
deleteFrontierApi,
|
||||
editeFrontierApi,
|
||||
getFrontierPageApi,
|
||||
getProjectTeamListApi,//查询所有班组列表
|
||||
getProjectTeamListApi, //查询所有班组列表
|
||||
} from "@/assets/js/api/edgeProtection";
|
||||
export default {
|
||||
mounted() {
|
||||
this.getTeamList()
|
||||
this.getList()
|
||||
this.getTeamList();
|
||||
this.getList();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
COMPANY: COMPANY,
|
||||
isAdding: true,
|
||||
searchFormInput: {
|
||||
devName: '',
|
||||
devName: "",
|
||||
},
|
||||
addEditForm: {
|
||||
devName: '',
|
||||
devSn: '',
|
||||
location: '',
|
||||
dutyTeamInfoId: '',
|
||||
image: '',
|
||||
remark: '',
|
||||
devName: "",
|
||||
devSn: "",
|
||||
location: "",
|
||||
dutyTeamInfoId: "",
|
||||
image: "",
|
||||
remark: "",
|
||||
},
|
||||
diaLogShow: false,
|
||||
pageTotal: 0,
|
||||
@ -256,94 +262,92 @@ export default {
|
||||
devName: [
|
||||
{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: 'blur'
|
||||
message: "必填",
|
||||
trigger: "blur",
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: 'change'
|
||||
}
|
||||
message: "必填",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
devSn: [
|
||||
{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: 'blur'
|
||||
message: "必填",
|
||||
trigger: "blur",
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: 'change'
|
||||
}
|
||||
message: "必填",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
location: [
|
||||
{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: 'blur'
|
||||
message: "必填",
|
||||
trigger: "blur",
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: 'change'
|
||||
}
|
||||
message: "必填",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
|
||||
dutyTeamInfoId: [
|
||||
{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: 'blur'
|
||||
message: "必填",
|
||||
trigger: "blur",
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: 'change'
|
||||
}
|
||||
message: "必填",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
|
||||
},
|
||||
options: [],
|
||||
List: [],
|
||||
title: '',
|
||||
status: '',
|
||||
|
||||
}
|
||||
title: "",
|
||||
status: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
//查看详情
|
||||
deilBtn(val) {
|
||||
this.isAdding = false
|
||||
console.log('查看详情', val);
|
||||
this.title = '设备详情'
|
||||
this.diaLogShow = true
|
||||
this.addEditForm = JSON.parse(JSON.stringify(val))
|
||||
this.fileList = val.image
|
||||
this.status = val.status
|
||||
this.isAdding = false;
|
||||
console.log("查看详情", val);
|
||||
this.title = "设备详情";
|
||||
this.diaLogShow = true;
|
||||
this.addEditForm = JSON.parse(JSON.stringify(val));
|
||||
this.fileList = val.image;
|
||||
this.status = val.status;
|
||||
},
|
||||
//获取责任班组
|
||||
getTeamList() {
|
||||
getProjectTeamListApi({
|
||||
projectSn: this.$store.state.projectSn
|
||||
projectSn: this.$store.state.projectSn,
|
||||
}).then((res) => {
|
||||
if (res.success) {
|
||||
console.log('获取责任班组', res);
|
||||
this.options = res.result
|
||||
console.log("获取责任班组", res);
|
||||
this.options = res.result;
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
add() {
|
||||
this.diaLogShow = true
|
||||
this.title = '新增设备'
|
||||
this.fileList = []
|
||||
this.isAdding = true
|
||||
this.diaLogShow = true;
|
||||
this.title = "新增设备";
|
||||
this.fileList = [];
|
||||
this.isAdding = true;
|
||||
},
|
||||
edit(obj) {
|
||||
this.diaLogShow = true
|
||||
this.addEditForm = JSON.parse(JSON.stringify(obj))
|
||||
this.fileList = obj.image
|
||||
this.title = '编辑设备'
|
||||
this.diaLogShow = true;
|
||||
this.addEditForm = JSON.parse(JSON.stringify(obj));
|
||||
this.fileList = obj.image;
|
||||
this.title = "编辑设备";
|
||||
},
|
||||
deleteDev(obj) {
|
||||
this.$confirm("此操作将永久删除, 是否继续?", "提示", {
|
||||
@ -354,118 +358,116 @@ export default {
|
||||
.then(() => {
|
||||
deleteFrontierApi({ id: obj.id }).then((result) => {
|
||||
if (result.success) {
|
||||
this.$message.success(result.message)
|
||||
this.getList()
|
||||
this.$message.success(result.message);
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
.catch(() => { })
|
||||
.catch(() => {});
|
||||
},
|
||||
submit() {
|
||||
this.processTheFile()
|
||||
let params = JSON.parse(JSON.stringify(this.addEditForm))
|
||||
params.projectSn = this.$store.state.projectSn
|
||||
this.processTheFile();
|
||||
let params = JSON.parse(JSON.stringify(this.addEditForm));
|
||||
params.projectSn = this.$store.state.projectSn;
|
||||
this.$refs.addEditForm.validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.title == '新增设备') {
|
||||
if (this.title == "新增设备") {
|
||||
addFrontierApi(params).then((result) => {
|
||||
if (result.success) {
|
||||
this.$message.success(result.message)
|
||||
this.getList()
|
||||
this.$message.success(result.message);
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
} else if (this.title == '编辑设备') {
|
||||
console.log('编辑信息', this.addEditForm)
|
||||
});
|
||||
} else if (this.title == "编辑设备") {
|
||||
console.log("编辑信息", this.addEditForm);
|
||||
editeFrontierApi(params).then((result) => {
|
||||
if (result.success) {
|
||||
this.$message.success(result.message)
|
||||
this.getList()
|
||||
this.$message.success(result.message);
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
this.diaLogShow = false
|
||||
this.diaLogShow = false;
|
||||
} else {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.searchFormInput = {}
|
||||
this.getList()
|
||||
this.searchFormInput = {};
|
||||
this.getList();
|
||||
},
|
||||
getList() {
|
||||
getFrontierPageApi({
|
||||
projectSn: this.$store.state.projectSn,
|
||||
pageSize: this.searchForm.pageSize,
|
||||
pageNo: this.searchForm.pageNo,
|
||||
devName: this.searchFormInput.devName
|
||||
devName: this.searchFormInput.devName,
|
||||
}).then((result) => {
|
||||
if (result.success) {
|
||||
console.log('查询设备管理分页列表', result)
|
||||
this.List = result.result.records
|
||||
this.pageTotal = result.result.total
|
||||
console.log("查询设备管理分页列表", result);
|
||||
this.List = result.result.records;
|
||||
this.pageTotal = result.result.total;
|
||||
result.result.records.map((item) => {
|
||||
if (item.image != null) {
|
||||
item.image = JSON.parse(item.image)
|
||||
item.image = JSON.parse(item.image);
|
||||
if (
|
||||
item.image.length !== 0 &&
|
||||
!item.image[0].url.includes(this.$store.state.FILEURL)
|
||||
) {
|
||||
item.image[0].url =
|
||||
this.$store.state.FILEURL + item.image[0].url
|
||||
this.$store.state.FILEURL + item.image[0].url;
|
||||
}
|
||||
} else {
|
||||
item.image = []
|
||||
item.image = [];
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
console.log('run', this.List)
|
||||
console.log("run", this.List);
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
close() {
|
||||
this.addEditForm = {}
|
||||
this.fileList = []
|
||||
this.addEditForm = {};
|
||||
this.fileList = [];
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addEditForm.clearValidate()
|
||||
})
|
||||
this.$refs.addEditForm.clearValidate();
|
||||
});
|
||||
},
|
||||
processTheFile() {
|
||||
//处理el上传的文件格式(结构)
|
||||
this.addEditForm.image = []
|
||||
this.addEditForm.image = [];
|
||||
this.fileList.map((item) => {
|
||||
if (!item.response) {
|
||||
this.addEditForm.image.push(item)
|
||||
this.addEditForm.image.push(item);
|
||||
// console.log('符合的结构', item)
|
||||
} else if (item.response) {
|
||||
// console.log('不符合的结构', item)
|
||||
this.addEditForm.image.push({
|
||||
name: item.response.data[0].filename,
|
||||
url: item.response.data[0].imageUrl
|
||||
})
|
||||
url: item.response.data[0].imageUrl,
|
||||
});
|
||||
}
|
||||
})
|
||||
this.addEditForm.image = JSON.stringify(this.addEditForm.image)
|
||||
|
||||
});
|
||||
this.addEditForm.image = JSON.stringify(this.addEditForm.image);
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.fileList = fileList
|
||||
this.fileList = fileList;
|
||||
},
|
||||
handleRemove(response, fileList) {
|
||||
this.fileList = fileList
|
||||
this.fileList = fileList;
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.searchForm.pageSize = val
|
||||
this.getList()
|
||||
this.searchForm.pageSize = val;
|
||||
this.getList();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.searchForm.pageNo = val
|
||||
this.getList()
|
||||
this.searchForm.pageNo = val;
|
||||
this.getList();
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tables {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user