|
@@ -1,56 +1,109 @@
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { computed, ref } from "vue";
|
|
import { computed, ref } from "vue";
|
|
import type { TabsPaneContext } from "element-plus";
|
|
import type { TabsPaneContext } from "element-plus";
|
|
|
|
+import { instrumentConfigPage, globalDataPage } from "@/api/config";
|
|
|
|
|
|
const activeName = ref("仪器配置");
|
|
const activeName = ref("仪器配置");
|
|
|
|
|
|
|
|
+import ConfigAdd from "./components/ConfigAdd.vue";
|
|
|
|
+import { fa } from "element-plus/es/locale";
|
|
|
|
+import { dataTool } from "echarts";
|
|
|
|
+
|
|
const handleClick = (tab: TabsPaneContext, event: Event) => {
|
|
const handleClick = (tab: TabsPaneContext, event: Event) => {
|
|
// console.log(tab, event);
|
|
// console.log(tab, event);
|
|
};
|
|
};
|
|
|
|
|
|
-interface User {
|
|
|
|
- date: string;
|
|
|
|
- name: string;
|
|
|
|
- address: string;
|
|
|
|
-}
|
|
|
|
|
|
+//
|
|
|
|
|
|
-const search = ref("");
|
|
|
|
-const filterTableData = computed(() =>
|
|
|
|
- tableData.filter(
|
|
|
|
- (data) =>
|
|
|
|
- !search.value ||
|
|
|
|
- data.name.toLowerCase().includes(search.value.toLowerCase())
|
|
|
|
- )
|
|
|
|
-);
|
|
|
|
-const handleEdit = (index: number, row: User) => {
|
|
|
|
|
|
+const handleDelete = (index: number, row: any) => {
|
|
console.log(index, row);
|
|
console.log(index, row);
|
|
};
|
|
};
|
|
-const handleDelete = (index: number, row: User) => {
|
|
|
|
- console.log(index, row);
|
|
|
|
|
|
+//配置列表请求参数
|
|
|
|
+const configParams = ref({
|
|
|
|
+ orders: [
|
|
|
|
+ {
|
|
|
|
+ column: "",
|
|
|
|
+ isAsc: true,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ pageNo: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+});
|
|
|
|
+//分页
|
|
|
|
+const configHandleChange = (currentPage: number, pageSize: number) => {
|
|
|
|
+ console.log(currentPage);
|
|
|
|
+ configParams.value.pageNo = currentPage;
|
|
|
|
+ getInstrumentConfig();
|
|
|
|
+ // console.log(pageSize);
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+//测试仪器配置数组
|
|
|
|
+const instrumentConfigList = ref([]);
|
|
|
|
+//数据total
|
|
|
|
+const instrumentConfigTotal = ref(1);
|
|
|
|
+//请求数据
|
|
|
|
+const getInstrumentConfig = () => {
|
|
|
|
+ instrumentConfigPage(configParams.value).then((res) => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ instrumentConfigList.value = res.data.records;
|
|
|
|
+ instrumentConfigTotal.value = res.data.totalCount;
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+//全局列表请求参数
|
|
|
|
+const globalParams = ref({
|
|
|
|
+ orders: [
|
|
|
|
+ {
|
|
|
|
+ column: "",
|
|
|
|
+ isAsc: true,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ pageNo: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+});
|
|
|
|
+//分页
|
|
|
|
+const globalHandleChange = (currentPage: number, pageSize: number) => {
|
|
|
|
+ console.log(currentPage);
|
|
|
|
+ globalParams.value.pageNo = currentPage;
|
|
|
|
+ getglobalData();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+//测试仪器配置数组
|
|
|
|
+const globalDataList = ref([]);
|
|
|
|
+//数据total
|
|
|
|
+const globalDataTotal = ref(1);
|
|
|
|
+//请求数据
|
|
|
|
+const getglobalData = () => {
|
|
|
|
+ globalDataPage(globalParams.value).then((res) => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ globalDataList.value = res.data.records;
|
|
|
|
+ globalDataTotal.value = res.data.totalCount;
|
|
|
|
+ });
|
|
};
|
|
};
|
|
|
|
|
|
-const tableData: User[] = [
|
|
|
|
- {
|
|
|
|
- date: "2016-05-03",
|
|
|
|
- name: "Tom",
|
|
|
|
- address: "No. 189, Grove St, Los Angeles",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- date: "2016-05-02",
|
|
|
|
- name: "John",
|
|
|
|
- address: "No. 189, Grove St, Los Angeles",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- date: "2016-05-04",
|
|
|
|
- name: "Morgan",
|
|
|
|
- address: "No. 189, Grove St, Los Angeles",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- date: "2016-05-01",
|
|
|
|
- name: "Jessy",
|
|
|
|
- address: "No. 189, Grove St, Los Angeles",
|
|
|
|
- },
|
|
|
|
-];
|
|
|
|
|
|
+onMounted?.(() => {
|
|
|
|
+ getInstrumentConfig();
|
|
|
|
+ getglobalData();
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+//仪器配置弹框数据
|
|
|
|
+const configAdd = ref({
|
|
|
|
+ show: false,
|
|
|
|
+ type: "add", //add新增,edit修改
|
|
|
|
+ data: {},
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+const handleEdit = (index: number, row: any) => {
|
|
|
|
+ // console.log(index, row);
|
|
|
|
+ // console.log(row);
|
|
|
|
+ showConfigAdd("edit", row);
|
|
|
|
+};
|
|
|
|
+const showConfigAdd = (type: string, data: any) => {
|
|
|
|
+ console.log("1");
|
|
|
|
+ configAdd.value.show = true;
|
|
|
|
+ configAdd.value.type = type;
|
|
|
|
+ configAdd.value.data = data;
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -58,40 +111,84 @@ const tableData: User[] = [
|
|
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
|
|
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
|
|
<el-tab-pane label="仪器配置" name="仪器配置">
|
|
<el-tab-pane label="仪器配置" name="仪器配置">
|
|
<div class="global-config-pane">
|
|
<div class="global-config-pane">
|
|
- <el-button type="primary">
|
|
|
|
- <span class="add">+</span>
|
|
|
|
- 新增
|
|
|
|
- </el-button>
|
|
|
|
|
|
+ <div class="btns">
|
|
|
|
+ <el-button type="primary">
|
|
|
|
+ <span class="add">+</span>
|
|
|
|
+ 新增
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<div>
|
|
<div>
|
|
- <el-table :data="filterTableData" style="width: 100%">
|
|
|
|
- <el-table-column label="序号" type="index" />
|
|
|
|
- <!-- <el-table-column label="Date" prop="date" /> -->
|
|
|
|
- <el-table-column label="所需仪器类型" prop="date" />
|
|
|
|
- <el-table-column label="名称" prop="name" />
|
|
|
|
- <el-table-column label="仪器地址" prop="name" />
|
|
|
|
- <el-table-column label="操作" prop="操作">
|
|
|
|
|
|
+ <el-table :data="instrumentConfigList" style="width: 100%">
|
|
|
|
+ <el-table-column label="序号" type="index" width="80" />
|
|
|
|
+ <el-table-column label="所需仪器类型" prop="instrumentType" />
|
|
|
|
+ <el-table-column label="名称" prop="configName" />
|
|
|
|
+ <el-table-column label="仪器地址" prop="configIp" />
|
|
|
|
+ <el-table-column label="操作" prop="操作" fixed="right">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-button
|
|
<el-button
|
|
|
|
+ text
|
|
size="small"
|
|
size="small"
|
|
- @click="handleEdit(scope.$index, scope.row)"
|
|
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="handleDelete(scope.$index, scope.row)"
|
|
>
|
|
>
|
|
- Edit
|
|
|
|
|
|
+ 删除
|
|
</el-button>
|
|
</el-button>
|
|
<el-button
|
|
<el-button
|
|
|
|
+ text
|
|
size="small"
|
|
size="small"
|
|
- type="danger"
|
|
|
|
- @click="handleDelete(scope.$index, scope.row)"
|
|
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="handleEdit(scope.$index, scope.row)"
|
|
>
|
|
>
|
|
- Delete
|
|
|
|
|
|
+ 修改
|
|
</el-button>
|
|
</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
|
|
+ <el-pagination
|
|
|
|
+ class="content-pag"
|
|
|
|
+ background
|
|
|
|
+ layout="prev, pager, next"
|
|
|
|
+ :page-size="10"
|
|
|
|
+ :total="instrumentConfigTotal"
|
|
|
|
+ @change="configHandleChange"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ <el-tab-pane label="全局数据" name="全局数据">
|
|
|
|
+ <div class="global-config-pane">
|
|
|
|
+ <div class="btns">
|
|
|
|
+ <el-button type="primary" @click="">
|
|
|
|
+ <span class="add">+</span>
|
|
|
|
+ 新增
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div>
|
|
|
|
+ <el-table :data="globalDataList" style="width: 100%">
|
|
|
|
+ <el-table-column label="序号" type="index" width="80" />
|
|
|
|
+ <el-table-column label="所需仪器类型" prop="instrumentType" />
|
|
|
|
+ <el-table-column label="名称" prop="configName" />
|
|
|
|
+ <el-table-column label="仪器地址" prop="configIp" />
|
|
|
|
+ <el-table-column label="操作" prop="操作" fixed="right">
|
|
|
|
+ <template #default="scope"> </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <el-pagination
|
|
|
|
+ class="content-pag"
|
|
|
|
+ background
|
|
|
|
+ layout="prev, pager, next"
|
|
|
|
+ :page-size="10"
|
|
|
|
+ :total="globalDataTotal"
|
|
|
|
+ @change="globalHandleChange"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
- <el-tab-pane label="全局数据" name="全局数据"> <div></div> </el-tab-pane>
|
|
|
|
</el-tabs>
|
|
</el-tabs>
|
|
|
|
+
|
|
|
|
+ <ConfigAdd :options="configAdd"></ConfigAdd>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -105,6 +202,10 @@ const tableData: User[] = [
|
|
}
|
|
}
|
|
.global-config-pane {
|
|
.global-config-pane {
|
|
padding: 0 20px;
|
|
padding: 0 20px;
|
|
|
|
+ .btns {
|
|
|
|
+ text-align: right;
|
|
|
|
+ margin-bottom: 12px;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
.add {
|
|
.add {
|
|
width: 12px;
|
|
width: 12px;
|
|
@@ -117,5 +218,11 @@ const tableData: User[] = [
|
|
margin-right: 10px;
|
|
margin-right: 10px;
|
|
vertical-align: middle;
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
|
|
+ .content-pag {
|
|
|
|
+ float: right;
|
|
|
|
+ margin-right: 20px;
|
|
|
|
+ margin-top: 20px;
|
|
|
|
+ padding-bottom: 30px;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|