Commit 245e4887 authored by jiaxu.yan's avatar jiaxu.yan

feat: 提交完善页面组件

parent 1933e8b9
...@@ -15,14 +15,17 @@ ...@@ -15,14 +15,17 @@
:prop="item.prop" :prop="item.prop"
:items="item.componentProps" :items="item.componentProps"
></component> ></component>
<!-- <el-input v-model="queryPrarms" placeholder="请选择" /> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
<div class="btn-list"> <div class="btn-list">
<div> <div style="margin-top: 5px;">
<slot name="btns"></slot> <slot name="button">
</slot>
</div> </div>
<div style="margin-right: -10px"> <div style="margin-right: -10px">
<el-button type="primary" class="add-search-btn" @click="handleSearch" <el-button type="primary" class="add-search-btn" @click="handleSearch"
...@@ -42,7 +45,7 @@ ...@@ -42,7 +45,7 @@
:header-cell-class-name="tableHeaderClass" :header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass" :row-class-name="tableBodyClass"
> >
<el-table-column label="序号" align="center" width="100" /> <!-- <el-table-column label="序号" align="center" width="100" /> -->
<el-table-column <el-table-column
v-for="(column, key) in props.columns" v-for="(column, key) in props.columns"
:key="key" :key="key"
...@@ -52,6 +55,37 @@ ...@@ -52,6 +55,37 @@
:align="column.align" :align="column.align"
> >
</el-table-column> </el-table-column>
<el-table-column label="操作" width="300">
<template #default="scope">
<template
v-for="(action, index) in actions"
:key="`${index}-${action.label}`"
>
<el-popconfirm
v-if="action.popConfirm"
v-bind="action.popConfirm"
>
<template #reference>
<el-button text size="mini" v-bind="action">{{
action.label
}}</el-button>
</template>
</el-popconfirm>
<el-button
v-else
text
size="mini"
v-bind="action"
@click="action.onClick(scope.row)"
>{{ action.label }}</el-button
>
<el-divider
direction="vertical"
v-if="index < actions.length - 1"
/>
</template>
</template>
</el-table-column>
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination <el-pagination
...@@ -74,6 +108,14 @@ ...@@ -74,6 +108,14 @@
import { defineProps, reactive, watch, ref } from "vue"; import { defineProps, reactive, watch, ref } from "vue";
import mitter from "@/utils/mitter"; import mitter from "@/utils/mitter";
import components from "@/components/FormComponents/index"; // 将所有组件引入 import components from "@/components/FormComponents/index"; // 将所有组件引入
import {
View,
Delete,
Edit,
Message,
Search,
Star,
} from "@element-plus/icons-vue";
import http from "@/api/http"; import http from "@/api/http";
const emit = defineEmits(["DataChange"]); const emit = defineEmits(["DataChange"]);
const props = defineProps({ const props = defineProps({
...@@ -93,13 +135,17 @@ const props = defineProps({ ...@@ -93,13 +135,17 @@ const props = defineProps({
type: Array, type: Array,
default: [], default: [],
}, },
actions: {
type: Array,
default: [],
},
}); });
const PagePrarms = reactive({ const PagePrarms = reactive({
page: 1, page: 1,
limit: 10, limit: 10,
}); });
const loading = ref(false); const loading = ref(false);
const data = reactive([]); let data = ref([]);
const total = ref(0); const total = ref(0);
const searchForm = reactive({}); const searchForm = reactive({});
const getData = () => { const getData = () => {
...@@ -110,8 +156,8 @@ const getData = () => { ...@@ -110,8 +156,8 @@ const getData = () => {
http http
.post(props.api, params) .post(props.api, params)
.then((res) => { .then((res) => {
console.log(res); if (res.success) {
if (res.data !== null) { data.value = res.data;
} }
}) })
.catch(function (error) { .catch(function (error) {
...@@ -226,7 +272,7 @@ defineExpose({ formData: props.formData }); ...@@ -226,7 +272,7 @@ defineExpose({ formData: props.formData });
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.pagination{ .pagination {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 10px; margin-top: 10px;
......
...@@ -404,8 +404,8 @@ const routes = [ ...@@ -404,8 +404,8 @@ const routes = [
{ {
path: "/Scheduling/EnergyManage", path: "/Scheduling/EnergyManage",
name: "EnergyManagePage", name: "EnergyManagePage",
// component: () => import("@/views/SmartNumbers/PipeTemperature.vue"), component: () => import("@/views/SmartNumbers/PipeTemperature.vue"),
component: () => import("@/views/SchedulingPage/EnergyManagePage.vue"), // component: () => import("@/views/SchedulingPage/EnergyManagePage.vue"),
meta: { meta: {
title: "能源消耗", title: "能源消耗",
}, },
......
...@@ -3,18 +3,13 @@ ...@@ -3,18 +3,13 @@
api="/api/Scheduling/WeatherCondition/Get" api="/api/Scheduling/WeatherCondition/Get"
:schemas="schemas" :schemas="schemas"
:columns="columns" :columns="columns"
:actions="actions"
:formData="formData" :formData="formData"
@DataChange="formDataChange" @DataChange="formDataChange"
> >
<template v-slot:bnts> <template v-slot:button>
<el-row> <el-button type="primary">添加</el-button>
<el-col :span="1.5"> <el-button type="primary">导入</el-button>
<el-button type="primary" class="add-search-btn" @click="handleSearch"
>查询</el-button
>
</el-col>
<el-col :span="1.5"></el-col>
</el-row>
</template> </template>
</PageData> </PageData>
</template> </template>
...@@ -23,11 +18,36 @@ import { ref } from "vue"; ...@@ -23,11 +18,36 @@ import { ref } from "vue";
import PageData from "@/components/PageData.vue"; import PageData from "@/components/PageData.vue";
import { columns, schemas } from "./formSchems"; import { columns, schemas } from "./formSchems";
const formData = ref({ const formData = ref({
name: "", name: undefined,
code: "", code: undefined,
date: "", date: undefined,
}); });
const formDataChange = (val) => { const formDataChange = (val) => {
formData.value = val; formData.value = val;
}; };
const actions = [
{
label: "详情",
icon: "View",
onClick: (record) => {
console.log(record);
},
},
{
label: "编辑",
icon: "Edit",
onClick: () => {},
},
{
label: "删除",
type: "danger",
icon: "Delete",
popConfirm: {
title: "是否确认删除",
confirm: () => {
tableRef.value?.remove(record);
},
},
},
];
</script> </script>
...@@ -2,13 +2,37 @@ import { ref } from "vue"; ...@@ -2,13 +2,37 @@ import { ref } from "vue";
export const columns = ref([ export const columns = ref([
{ {
label: "设备名称", label: "设备名称",
prop: "name", prop: "phenomenonName",
align: "center", align: "center",
width: "200", width: "200",
}, },
{ {
label: "设备名称", label: "设备名称",
prop: "name", prop: "phenomenonType",
align: "center",
width: "200",
},
{
label: "设备名称",
prop: "phenomenonName",
align: "center",
width: "200",
},
{
label: "设备名称",
prop: "phenomenonName",
align: "center",
width: "200",
},
{
label: "设备名称",
prop: "phenomenonType",
align: "center",
width: "200",
},
{
label: "设备名称",
prop: "phenomenonType",
align: "center", align: "center",
width: "200", width: "200",
}, },
......
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