|
|
@@ -0,0 +1,179 @@
|
|
|
+<template>
|
|
|
+ <scTable ref="xGridTable" batchDel :apiObj="$API.elevator.record" :formConfig="formConfig" :paramsColums="paramsColums" :toolbarConfig="toolbarConfig" :columns="columns" v-bind="props.options">
|
|
|
+ <template #action="{ row }">
|
|
|
+ <el-button type="primary" link @click="table_edit(row)">
|
|
|
+ <template #icon><sc-iconify icon="ant-design:edit-outlined"></sc-iconify></template>修改
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" link @click="table_del(row)">
|
|
|
+ <template #icon><sc-iconify icon="ant-design:delete-outlined"></sc-iconify></template>删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </scTable>
|
|
|
+
|
|
|
+ <record-detail v-if="dialog" ref="recordRef" :projectId="props.isTemp ? 1 : TOOL.data.get('PROJECT_ID')" @success="refreshTable" @closed="dialog = false"></record-detail>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import moment from "moment";
|
|
|
+import XEUtils from "xe-utils";
|
|
|
+import API from "@/api";
|
|
|
+import TOOL from "@/utils/tool";
|
|
|
+import { mapFormItemSelect, mapFormItemDatePicker } from "@/components/scTable/helper";
|
|
|
+import { dataSource, objectToArray } from "@/utils/basicDic";
|
|
|
+import { elevatorDic } from "@/views/dataMock/elevator/main";
|
|
|
+import recordDetail from "./detail";
|
|
|
+
|
|
|
+const formatFea = row => XEUtils.toStringJSON(XEUtils.get(row, "features", "{}"));
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ options: { type: Object, default: () => {} },
|
|
|
+ isTemp: { type: Boolean, default: false },
|
|
|
+ hideHandler: { type: Boolean, default: false }
|
|
|
+})
|
|
|
+const visible = computed(() => !props.isTemp);
|
|
|
+
|
|
|
+const proConfig = reactive({
|
|
|
+ span: 5,
|
|
|
+ visible,
|
|
|
+ storageKey: "PROJECT",
|
|
|
+ resetValue: TOOL.data.get("PROJECT_ID"),
|
|
|
+ optionProps: { label: "projectName", value: "fpiId" },
|
|
|
+ events: {
|
|
|
+ change: data => XEUtils.assign(formConfig.data, { ...data, mountedId: null })
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const mountedConfig = reactive({
|
|
|
+ visible,
|
|
|
+ api: {
|
|
|
+ key: "elevator.mounted",
|
|
|
+ query: {
|
|
|
+ projectId: computed(() => formConfig.data.projectId),
|
|
|
+ projectIdNot: 1
|
|
|
+ }
|
|
|
+ },
|
|
|
+ slot: {
|
|
|
+ style: { float: "right", paddingLeft: "6px", color: "#8492a6" }
|
|
|
+ },
|
|
|
+ optionProps: { label: "mountedName", value: "id", slot: ({ data }) => XEUtils.get(XEUtils.find(TOOL.data.get("PROJECT"), item => item.fpiId === data.projectId), "projectName") },
|
|
|
+ events: {
|
|
|
+ change: data => XEUtils.assign(formConfig.data, data)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const datetimerangeConfig = reactive({
|
|
|
+ span: 7,
|
|
|
+ resetValue: () => [moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"), moment().format("YYYY-MM-DD HH:mm:ss")],
|
|
|
+ props: {
|
|
|
+ type: "datetimerange",
|
|
|
+ startPlaceholder: "开始时间",
|
|
|
+ endPlaceholder: "结束时间",
|
|
|
+ format: "YYYY-MM-DD HH:mm"
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const toolbarConfig = reactive({
|
|
|
+ enabled: true,
|
|
|
+ print: false
|
|
|
+})
|
|
|
+
|
|
|
+const formConfig = reactive({
|
|
|
+ data: {
|
|
|
+ projectId: TOOL.data.get("PROJECT_ID"),
|
|
|
+ projectIdNot: 1,
|
|
|
+ createTime: [moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"), moment().format("YYYY-MM-DD HH:mm:ss")]
|
|
|
+ },
|
|
|
+ items: [
|
|
|
+ mapFormItemSelect("projectId", "所属项目", proConfig),
|
|
|
+ mapFormItemSelect("mountedId", "设备安装点", mountedConfig),
|
|
|
+ mapFormItemDatePicker("createTime", "监测时间", datetimerangeConfig)
|
|
|
+ ]
|
|
|
+})
|
|
|
+
|
|
|
+const paramsColums = reactive([
|
|
|
+ { column: "projectId", field: visible.value ? "" : "projectIdNot" },
|
|
|
+ visible.value ? { column: "projectIdNot" } : {},
|
|
|
+ { column: "mountedId" },
|
|
|
+ { column: "createTimeBegin", field: "createTime[0]" },
|
|
|
+ { column: "createTimeEnd", field: "createTime[1]" }
|
|
|
+])
|
|
|
+
|
|
|
+const columns = reactive([
|
|
|
+ { visible: !props.hideHandler, type: "checkbox", fixed: "left", width: 40 },
|
|
|
+ { type: "seq", fixed: "left", width: 60 },
|
|
|
+ { visible, type: "html", field: "projectName", title: "项目名称", minWidth: 160, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(XEUtils.find(TOOL.data.get("PROJECT"), item => item.fpiId == row.projectId), "projectName") },
|
|
|
+ { visible, type: "html", field: "groundName", title: "工地场区", minWidth: 160, sortable: true },
|
|
|
+ { visible, type: "html", field: "mountedName", title: "设备安装点", minWidth: 160, sortable: true },
|
|
|
+ { type: "html", field: "createTime", title: "监测时间", minWidth: 160, sortable: true },
|
|
|
+ { type: "html", field: "frontDoorStatus", title: "前门锁闭状态", minWidth: 120, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.isOpen, XEUtils.get(formatFea(row), "frontDoorStatus")) },
|
|
|
+ { type: "html", field: "backDoorStatus", title: "后门锁闭状态", minWidth: 120, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.isOpen, XEUtils.get(formatFea(row), "backDoorStatus")) },
|
|
|
+ { type: "html", field: "driverStatus", title: "驾驶员认证状态", minWidth: 130, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.isCert, XEUtils.get(formatFea(row), "driverStatus")) },
|
|
|
+ { type: "html", field: "frontStatus", title: "前门状态", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.isNormal, XEUtils.get(formatFea(row), "frontStatus")) },
|
|
|
+ { type: "html", field: "backStatus", title: "后门状态", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.isNormal, XEUtils.get(formatFea(row), "backStatus")) },
|
|
|
+ { type: "html", field: "height", title: "高度(m)", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.divide(XEUtils.get(formatFea(row), "height"), 10) },
|
|
|
+ { type: "html", field: "heightLimit", title: "限位系统状态", minWidth: 120, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.binary, XEUtils.get(formatFea(row), "heightLimit")) },
|
|
|
+ { type: "html", field: "lockStatus", title: "门锁异常指示", minWidth: 120, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.isNormal, XEUtils.get(formatFea(row), "lockStatus")) },
|
|
|
+ { type: "html", field: "overspeed", title: "超速状态", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.binary, XEUtils.get(formatFea(row), "overspeed")) },
|
|
|
+ { type: "html", field: "personCount", title: "人数", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(formatFea(row), "personCount") },
|
|
|
+ { type: "html", field: "personStatus", title: "人数状态", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.binary, XEUtils.get(formatFea(row), "personStatus")) },
|
|
|
+ { type: "html", field: "speed", title: "速度(m/s)", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.divide(XEUtils.get(formatFea(row), "speed"), 10) },
|
|
|
+ { type: "html", field: "status", title: "移动状态", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.move, XEUtils.get(formatFea(row), "status")) },
|
|
|
+ { type: "html", field: "tilt1", title: "倾角x(°)", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.divide(XEUtils.get(formatFea(row), "tilt1"), 100) },
|
|
|
+ { type: "html", field: "tilt1Rate", title: "倾角x百分比", minWidth: 120, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(formatFea(row), "tilt1Rate") },
|
|
|
+ { type: "html", field: "tilt2", title: "倾角y(°)", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.divide(XEUtils.get(formatFea(row), "tilt2"), 100) },
|
|
|
+ { type: "html", field: "tilt2Rate", title: "倾角y百分比", minWidth: 120, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(formatFea(row), "tilt2Rate") },
|
|
|
+ { type: "html", field: "tiltStatus", title: "倾角状态", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.binary, XEUtils.get(formatFea(row), "tiltStatus")) },
|
|
|
+ { type: "html", field: "weight", title: "载重(kg)", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(formatFea(row), "weight") },
|
|
|
+ { type: "html", field: "weightRate", title: "载重百分比", minWidth: 100, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(formatFea(row), "weightRate") },
|
|
|
+ { type: "html", field: "weightStatus", title: "重量系统状态", minWidth: 120, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(elevatorDic.binary, XEUtils.get(formatFea(row), "weightStatus")) },
|
|
|
+ { visible, type: "html", field: "dataSource", title: "数据来源", fixed: "right", minWidth: 100, sortable: true, formatter: ({ cellValue }) => XEUtils.get(dataSource, cellValue, cellValue) },
|
|
|
+ { visible: !props.hideHandler, title: "操作", fixed: "right", width: 140, align: "center", slots: { default: "action" } }
|
|
|
+])
|
|
|
+
|
|
|
+const imageToolbar = reactive({
|
|
|
+ print: false,
|
|
|
+ download: true
|
|
|
+})
|
|
|
+
|
|
|
+// 显示隐藏 筛选表单
|
|
|
+const xGridTable = ref();
|
|
|
+const toggleFormEnabled = () => xGridTable.value.toggleFormEnabled();
|
|
|
+const getTableTotal = () => xGridTable.value.getTableData().tableData.length;
|
|
|
+
|
|
|
+const refreshTable = () => {
|
|
|
+ xGridTable.value.reloadColumn(columns);
|
|
|
+ xGridTable.value.searchData();
|
|
|
+}
|
|
|
+
|
|
|
+const recordRef = ref();
|
|
|
+const dialog = ref(false);
|
|
|
+
|
|
|
+const table_add = () => {
|
|
|
+ dialog.value = true;
|
|
|
+ nextTick(() => recordRef.value?.open());
|
|
|
+}
|
|
|
+
|
|
|
+const table_edit = row => {
|
|
|
+ dialog.value = true;
|
|
|
+ nextTick(() => recordRef.value?.setData(row));
|
|
|
+}
|
|
|
+
|
|
|
+const table_del = ({ id }) => {
|
|
|
+ ElMessageBox.confirm("是否确认删除该监控记录?", "删除警告", {
|
|
|
+ type: "warning",
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消"
|
|
|
+ }).then(() => {
|
|
|
+ API.elevator.record.del({ id }).then(() => {
|
|
|
+ ElMessage.success("操作成功");
|
|
|
+ refreshTable();
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+defineExpose({
|
|
|
+ table_add,
|
|
|
+ refreshTable,
|
|
|
+ getTableTotal
|
|
|
+})
|
|
|
+</script>
|