fix: 增加临边防护设备管理列表设备状态字段

This commit is contained in:
Vce 2024-03-27 10:35:18 +08:00
parent 42d4678306
commit 8253545ec6

View File

@ -36,6 +36,12 @@
label="设备编号" label="设备编号"
align="center" align="center"
></el-table-column> ></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 <el-table-column
prop="location" prop="location"
label="安装位置" label="安装位置"
@ -63,7 +69,7 @@
align="center" align="center"
> >
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.online == 0 ? '离线' : '在线' scope.row.online == 0 ? "离线" : "在线"
}}</template> }}</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
@ -227,23 +233,23 @@ import {
} from "@/assets/js/api/edgeProtection"; } from "@/assets/js/api/edgeProtection";
export default { export default {
mounted() { mounted() {
this.getTeamList() this.getTeamList();
this.getList() this.getList();
}, },
data() { data() {
return { return {
COMPANY: COMPANY, COMPANY: COMPANY,
isAdding: true, isAdding: true,
searchFormInput: { searchFormInput: {
devName: '', devName: "",
}, },
addEditForm: { addEditForm: {
devName: '', devName: "",
devSn: '', devSn: "",
location: '', location: "",
dutyTeamInfoId: '', dutyTeamInfoId: "",
image: '', image: "",
remark: '', remark: "",
}, },
diaLogShow: false, diaLogShow: false,
pageTotal: 0, pageTotal: 0,
@ -256,94 +262,92 @@ export default {
devName: [ devName: [
{ {
required: true, required: true,
message: '必填', message: "必填",
trigger: 'blur' trigger: "blur",
}, },
{ {
required: true, required: true,
message: '必填', message: "必填",
trigger: 'change' trigger: "change",
} },
], ],
devSn: [ devSn: [
{ {
required: true, required: true,
message: '必填', message: "必填",
trigger: 'blur' trigger: "blur",
}, },
{ {
required: true, required: true,
message: '必填', message: "必填",
trigger: 'change' trigger: "change",
} },
], ],
location: [ location: [
{ {
required: true, required: true,
message: '必填', message: "必填",
trigger: 'blur' trigger: "blur",
}, },
{ {
required: true, required: true,
message: '必填', message: "必填",
trigger: 'change' trigger: "change",
} },
], ],
dutyTeamInfoId: [ dutyTeamInfoId: [
{ {
required: true, required: true,
message: '必填', message: "必填",
trigger: 'blur' trigger: "blur",
}, },
{ {
required: true, required: true,
message: '必填', message: "必填",
trigger: 'change' trigger: "change",
} },
], ],
}, },
options: [], options: [],
List: [], List: [],
title: '', title: "",
status: '', status: "",
};
}
}, },
methods: { methods: {
// //
deilBtn(val) { deilBtn(val) {
this.isAdding = false this.isAdding = false;
console.log('查看详情', val); console.log("查看详情", val);
this.title = '设备详情' this.title = "设备详情";
this.diaLogShow = true this.diaLogShow = true;
this.addEditForm = JSON.parse(JSON.stringify(val)) this.addEditForm = JSON.parse(JSON.stringify(val));
this.fileList = val.image this.fileList = val.image;
this.status = val.status this.status = val.status;
}, },
// //
getTeamList() { getTeamList() {
getProjectTeamListApi({ getProjectTeamListApi({
projectSn: this.$store.state.projectSn projectSn: this.$store.state.projectSn,
}).then((res) => { }).then((res) => {
if (res.success) { if (res.success) {
console.log('获取责任班组', res); console.log("获取责任班组", res);
this.options = res.result this.options = res.result;
} }
}) });
}, },
add() { add() {
this.diaLogShow = true this.diaLogShow = true;
this.title = '新增设备' this.title = "新增设备";
this.fileList = [] this.fileList = [];
this.isAdding = true this.isAdding = true;
}, },
edit(obj) { edit(obj) {
this.diaLogShow = true this.diaLogShow = true;
this.addEditForm = JSON.parse(JSON.stringify(obj)) this.addEditForm = JSON.parse(JSON.stringify(obj));
this.fileList = obj.image this.fileList = obj.image;
this.title = '编辑设备' this.title = "编辑设备";
}, },
deleteDev(obj) { deleteDev(obj) {
this.$confirm("此操作将永久删除, 是否继续?", "提示", { this.$confirm("此操作将永久删除, 是否继续?", "提示", {
@ -354,118 +358,116 @@ export default {
.then(() => { .then(() => {
deleteFrontierApi({ id: obj.id }).then((result) => { deleteFrontierApi({ id: obj.id }).then((result) => {
if (result.success) { if (result.success) {
this.$message.success(result.message) this.$message.success(result.message);
this.getList() this.getList();
} }
});
}) })
}) .catch(() => {});
.catch(() => { })
}, },
submit() { submit() {
this.processTheFile() this.processTheFile();
let params = JSON.parse(JSON.stringify(this.addEditForm)) let params = JSON.parse(JSON.stringify(this.addEditForm));
params.projectSn = this.$store.state.projectSn params.projectSn = this.$store.state.projectSn;
this.$refs.addEditForm.validate((valid) => { this.$refs.addEditForm.validate((valid) => {
if (valid) { if (valid) {
if (this.title == '新增设备') { if (this.title == "新增设备") {
addFrontierApi(params).then((result) => { addFrontierApi(params).then((result) => {
if (result.success) { if (result.success) {
this.$message.success(result.message) this.$message.success(result.message);
this.getList() this.getList();
} }
}) });
} else if (this.title == '编辑设备') { } else if (this.title == "编辑设备") {
console.log('编辑信息', this.addEditForm) console.log("编辑信息", this.addEditForm);
editeFrontierApi(params).then((result) => { editeFrontierApi(params).then((result) => {
if (result.success) { if (result.success) {
this.$message.success(result.message) this.$message.success(result.message);
this.getList() this.getList();
} }
}) });
} }
this.diaLogShow = false this.diaLogShow = false;
} else { } else {
return false return false;
} }
}) });
}, },
refresh() { refresh() {
this.searchFormInput = {} this.searchFormInput = {};
this.getList() this.getList();
}, },
getList() { getList() {
getFrontierPageApi({ getFrontierPageApi({
projectSn: this.$store.state.projectSn, projectSn: this.$store.state.projectSn,
pageSize: this.searchForm.pageSize, pageSize: this.searchForm.pageSize,
pageNo: this.searchForm.pageNo, pageNo: this.searchForm.pageNo,
devName: this.searchFormInput.devName devName: this.searchFormInput.devName,
}).then((result) => { }).then((result) => {
if (result.success) { if (result.success) {
console.log('查询设备管理分页列表', result) console.log("查询设备管理分页列表", result);
this.List = result.result.records this.List = result.result.records;
this.pageTotal = result.result.total this.pageTotal = result.result.total;
result.result.records.map((item) => { result.result.records.map((item) => {
if (item.image != null) { if (item.image != null) {
item.image = JSON.parse(item.image) item.image = JSON.parse(item.image);
if ( if (
item.image.length !== 0 && item.image.length !== 0 &&
!item.image[0].url.includes(this.$store.state.FILEURL) !item.image[0].url.includes(this.$store.state.FILEURL)
) { ) {
item.image[0].url = item.image[0].url =
this.$store.state.FILEURL + item.image[0].url this.$store.state.FILEURL + item.image[0].url;
} }
} else { } else {
item.image = [] item.image = [];
} }
});
}) console.log("run", this.List);
console.log('run', this.List)
} }
}) });
}, },
close() { close() {
this.addEditForm = {} this.addEditForm = {};
this.fileList = [] this.fileList = [];
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addEditForm.clearValidate() this.$refs.addEditForm.clearValidate();
}) });
}, },
processTheFile() { processTheFile() {
//el() //el()
this.addEditForm.image = [] this.addEditForm.image = [];
this.fileList.map((item) => { this.fileList.map((item) => {
if (!item.response) { if (!item.response) {
this.addEditForm.image.push(item) this.addEditForm.image.push(item);
// console.log('', item) // console.log('', item)
} else if (item.response) { } else if (item.response) {
// console.log('', item) // console.log('', item)
this.addEditForm.image.push({ this.addEditForm.image.push({
name: item.response.data[0].filename, 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) { handleSuccess(response, file, fileList) {
this.fileList = fileList this.fileList = fileList;
}, },
handleRemove(response, fileList) { handleRemove(response, fileList) {
this.fileList = fileList this.fileList = fileList;
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.searchForm.pageSize = val this.searchForm.pageSize = val;
this.getList() this.getList();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.searchForm.pageNo = val this.searchForm.pageNo = val;
this.getList() this.getList();
}, },
} },
} };
</script> </script>
<style lang="less"> <style lang="less">
.tables { .tables {