Commit 43ee4ecc authored by liuyangyang's avatar liuyangyang

设备页面联调

parent 301b1793
...@@ -94,10 +94,10 @@ ...@@ -94,10 +94,10 @@
row.deviceName row.deviceName
}}</span> }}</span>
</template> --> </template> -->
<!-- <template #operation="{ row }"> <template #operation="{ row }">
<span class="view-btn" @click="handleView(row)">详情</span> <span class="view-btn" @click="handleView(row)">详情</span>
<span class="edit-btn" @click="handleEdit(row)">编辑</span> <span class="edit-btn" @click="handleEdit(row)">编辑</span>
</template> --> </template>
</common-table> </common-table>
</div> </div>
</div> </div>
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
import { ref, onMounted, onBeforeUnmount, computed, reactive } from "vue"; import { ref, onMounted, onBeforeUnmount, computed, reactive } from "vue";
import CommonTable from "@/components/commonTable/index.vue"; import CommonTable from "@/components/commonTable/index.vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { getDataFun, postDataJSON } from "@/request/method.js";
const router = useRouter(); const router = useRouter();
const formInline = ref({ const formInline = ref({
...@@ -225,7 +226,32 @@ const openRound = () => { ...@@ -225,7 +226,32 @@ const openRound = () => {
router.push({ path: "/management/suspend-management" }); router.push({ path: "/management/suspend-management" });
}; };
onMounted(async () => {}); const getAlarmList = () => {
const url = "/alarm/getAlarmListPage";
console.log(formInline.value.date);
const params = {
eventName: formInline.value.eventName,
name: formInline.value.name,
dusterName: formInline.value.dusterName,
deviceType: formInline.value.deviceType,
suspendFlag: formInline.value.suspendFlag,
startTime: formInline.value.date[0] || "",
endTime: formInline.value.date[1] || "",
pageNo: currentPage.value,
pageSize: pageSize.value,
};
return getDataFun(url, params).then((res) => {
if (res && res.data) {
tableData.list = res.data.records || [];
} else {
return [];
}
});
};
onMounted(async () => {
getAlarmList();
});
onBeforeUnmount(() => {}); onBeforeUnmount(() => {});
</script> </script>
......
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
<script setup> <script setup>
import { ref, onMounted, onBeforeUnmount, computed, reactive } from "vue"; import { ref, onMounted, onBeforeUnmount, computed, reactive } from "vue";
import CommonTable from "@/components/commonTable/index.vue"; import CommonTable from "@/components/commonTable/index.vue";
import { getToken, removeToken, setToken } from "@/utils/auth";
import chartLine from "./components/chart-line.vue"; import chartLine from "./components/chart-line.vue";
import { getDataFun, postDataJSON } from "@/request/method.js"; import { getDataFun, postDataJSON } from "@/request/method.js";
...@@ -205,10 +206,11 @@ const getAllDustList = () => { ...@@ -205,10 +206,11 @@ const getAllDustList = () => {
endTime: formInline.value.date[1] || "", endTime: formInline.value.date[1] || "",
pageNo: currentPage.value, pageNo: currentPage.value,
pageSize: pageSize.value, pageSize: pageSize.value,
customerId: getToken('customerId'),
}; };
return getDataFun(url, params).then((res) => { return getDataFun(url, params).then((res) => {
if (res && res.data) { if (res && res.data) {
tableData.list = res.data.records; tableData.list = res.data.records || [];
} else { } else {
return []; return [];
} }
...@@ -228,7 +230,7 @@ const getIndex = (index) => { ...@@ -228,7 +230,7 @@ const getIndex = (index) => {
const handlePaginationChange = (pagination) => { const handlePaginationChange = (pagination) => {
currentPage.value = pagination.currentPage; currentPage.value = pagination.currentPage;
pageSize.value = pagination.pageSize; pageSize.value = pagination.pageSize;
console.log("分页变化", pagination); getAllDustList();
}; };
const onSubmit = () => { const onSubmit = () => {
......
...@@ -49,7 +49,6 @@ watch( ...@@ -49,7 +49,6 @@ watch(
); );
onMounted(() => { onMounted(() => {
initChart();
window.addEventListener("resize", () => { window.addEventListener("resize", () => {
chartInstance?.resize(); chartInstance?.resize();
}); });
......
...@@ -4,38 +4,38 @@ ...@@ -4,38 +4,38 @@
<div class="search"> <div class="search">
<el-form :inline="true" :model="formInline" class="demo-form-inline"> <el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="项目名称"> <el-form-item label="项目名称">
<el-select v-model="formInline.name" style="width: 200px"> <el-select v-model="formInline.projectId" style="width: 200px">
<el-option <el-option
v-for="i in nameList.list" v-for="i in nameList.list"
:key="i" :key="i"
:label="`${i.label}`" :label="`${i.name}`"
:value="i.value" :value="i.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备类别"> <el-form-item label="设备类别">
<el-select v-model="formInline.type" style="width: 200px"> <el-select v-model="formInline.deviceType" style="width: 200px">
<el-option <el-option
v-for="i in typeList.list" v-for="i in typeList.list"
:key="i" :key="i"
:label="`${i.label}`" :label="`${i.desc}`"
:value="i.value" :value="i.code"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="原因分类"> <el-form-item label="原因分类">
<el-select v-model="formInline.reason" style="width: 200px"> <el-select v-model="formInline.reasonCategory" style="width: 200px">
<el-option <el-option
v-for="i in reasonList.list" v-for="i in reasonList.list"
:key="i" :key="i"
:label="`${i.label}`" :label="`${i.value}`"
:value="i.value" :value="i.key"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="default" class="default-btn" @click="onSubmit" <el-button type="default" class="default-btn" @click="onRest"
>重置</el-button >重置</el-button
> >
<el-button type="primary" class="search-btn" @click="onSubmit" <el-button type="primary" class="search-btn" @click="onSubmit"
...@@ -79,18 +79,16 @@ ...@@ -79,18 +79,16 @@
<script setup> <script setup>
import { ref, onMounted, onBeforeUnmount, computed, reactive } from "vue"; import { ref, onMounted, onBeforeUnmount, computed, reactive } from "vue";
import CommonTable from "@/components/commonTable/index.vue"; import CommonTable from "@/components/commonTable/index.vue";
import { getDataFun, postDataJSON } from "@/request/method.js";
const formInline = ref({ const formInline = ref({
eventName: "", projectId: "",
deviceName: "", deviceType: "",
position: "", reasonCategory: "",
type: "",
date: "",
warnType: "3",
}); });
const currentPage = ref(1); const currentPage = ref(1);
const pageSize = ref(10); const pageSize = ref(20);
const tableColumns = ref([ const tableColumns = ref([
{ {
...@@ -99,62 +97,62 @@ const tableColumns = ref([ ...@@ -99,62 +97,62 @@ const tableColumns = ref([
width: "5%", width: "5%",
}, },
{ {
prop: "deviceName", prop: "projectName",
label: "项目名称", label: "项目名称",
width: "7%", width: "7%",
}, },
{ {
prop: "compart", prop: "deviceNo",
label: "设备编号", label: "设备编号",
width: "7%", width: "7%",
}, },
{ {
prop: "position", prop: "deviceType",
label: "设备类型", label: "设备类型",
width: "7%", width: "7%",
}, },
{ {
prop: "changeDateRemind", prop: "deviceName",
label: "设备名称", label: "设备名称",
width: "7%", width: "7%",
}, },
{ {
prop: "changeDate", prop: "signalNo",
label: "设备信号编号", label: "设备信号编号",
width: "7%", width: "7%",
}, },
{ {
prop: "changePeo", prop: "location",
label: "设备所在位置", label: "设备所在位置",
width: "7%", width: "7%",
}, },
{ {
prop: "ownerdeviceName", prop: "suspendStartTime",
label: "挂起开始时间", label: "挂起开始时间",
width: "7%", width: "7%",
}, },
{ {
prop: "ownerdeviceName", prop: "suspendEndTime",
label: "结束时间", label: "结束时间",
width: "7%", width: "7%",
}, },
{ {
prop: "ownerdeviceName", prop: "reasonCategory",
label: "原因分类", label: "原因分类",
width: "7%", width: "7%",
}, },
{ {
prop: "ownerdeviceName", prop: "reasonDesc",
label: "原因描述", label: "原因描述",
width: "7%", width: "7%",
}, },
{ {
prop: "ownerdeviceName", prop: "createTime",
label: "创建时间", label: "创建时间",
width: "7%", width: "7%",
}, },
{ {
prop: "ownerdeviceName", prop: "createUser",
label: "创建人", label: "创建人",
width: "7%", width: "7%",
}, },
...@@ -184,61 +182,39 @@ const tableData = reactive({ ...@@ -184,61 +182,39 @@ const tableData = reactive({
const nameList = reactive({ const nameList = reactive({
list: [], list: [],
}); });
const getNameList = () => { const getNameList = () => {
nameList.list = [ const url = "/alarm/getProjectEnumList";
{ return getDataFun(url, "").then((res) => {
label: "1#除尘器", if (res && res.data) {
value: "11111", nameList.list = res.data || [];
}, }
{ });
label: "2#除尘器",
value: "22222",
},
{
label: "3#除尘器",
value: "333333",
},
];
}; };
const typeList = reactive({ const typeList = reactive({
list: [], list: [],
}); });
const getTypeList = () => { const getTypeList = () => {
typeList.list = [ const url = "/alarm/getDeviceType";
{ return getDataFun(url, "").then((res) => {
label: "1#除尘器", if (res && res.data) {
value: "11111", typeList.list = res.data || [];
}, }
{ });
label: "2#除尘器",
value: "22222",
},
{
label: "3#除尘器",
value: "333333",
},
];
}; };
const reasonList = reactive({ const reasonList = reactive({
list: [], list: [],
}); });
const getReasonList = () => { const getReasonList = () => {
reasonList.list = [ const url = "/alarm/reasonCategoryEnumList";
{ return getDataFun(url, "").then((res) => {
label: "1#除尘器", if (res && res.data) {
value: "11111", reasonList.list = res.data || [];
}, }
{ });
label: "2#除尘器",
value: "22222",
},
{
label: "3#除尘器",
value: "333333",
},
];
}; };
const getIndex = (index) => { const getIndex = (index) => {
...@@ -248,17 +224,46 @@ const getIndex = (index) => { ...@@ -248,17 +224,46 @@ const getIndex = (index) => {
const handlePaginationChange = (pagination) => { const handlePaginationChange = (pagination) => {
currentPage.value = pagination.currentPage; currentPage.value = pagination.currentPage;
pageSize.value = pagination.pageSize; pageSize.value = pagination.pageSize;
console.log("分页变化", pagination); getManagementList();
}; };
const onSubmit = () => { const onSubmit = () => {
console.log("submit!", formInline.value); getManagementList();
};
const onRest = () => {
formInline.value = {
deviceType: "",
reasonCategory: "",
projectId: "",
};
currentPage.value = 1;
pageSize.value = 20;
getManagementList();
};
const getManagementList = () => {
const url = "/alarm/getSuspendDeviceListPage";
const params = {
deviceType: formInline.value.deviceType,
reasonCategory: formInline.value.reasonCategory,
projectId: formInline.value.projectId,
pageNo: currentPage.value,
pageSize: pageSize.value,
};
tableData.list = [];
return getDataFun(url, params).then((res) => {
if (res && res.data) {
tableData.list = res.data.list || [];
}
});
}; };
onMounted(async () => { onMounted(async () => {
getNameList(); getNameList();
getTypeList(); getTypeList();
getReasonList(); getReasonList();
getManagementList();
}); });
onBeforeUnmount(() => {}); onBeforeUnmount(() => {});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment