Compare commits

..

No commits in common. "e18ccf03d5e0f5f98e001c4aad6e558db97fcaa5" and "762710ad476a8761405ab92f750e8a477935527b" have entirely different histories.

2 changed files with 107 additions and 193 deletions

View File

@ -1,52 +0,0 @@
<template>
<div class="detail-container">
<el-card shadow="hover">
<el-descriptions title="基础信息" :column="3">
<el-descriptions-item label="服务站名称">{{
basicData.mc
}}</el-descriptions-item>
<el-descriptions-item label="服务站经度">{{
basicData.jd
}}</el-descriptions-item>
<el-descriptions-item label="服务站纬度">{{
basicData.wd
}}</el-descriptions-item>
<el-descriptions-item label="设备数">{{}}</el-descriptions-item>
<el-descriptions-item label="物资数">{{}}</el-descriptions-item>
<el-descriptions-item label="人员数">{{}}</el-descriptions-item>
<el-descriptions-item label="创建日期">{{}}</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card shadow="hover">
<el-descriptions title="配置信息" :column="3"> </el-descriptions>
<el-tabs v-model="activeTab" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="人员信息" name="people">人员信息</el-tab-pane>
<el-tab-pane label="物资信息" name="second">物资信息</el-tab-pane>
<el-tab-pane label="设备信息" name="third">设备信息</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script setup>
import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue";
const props = defineProps({
basicData: {
type: Object,
default: () => ({}),
},
});
const activeTab = ref("people");
const handleClick = (tab, event) => {
console.log("tab", tab, "event", event);
};
</script>
<style>
.detail-container {
display: flex;
flex-direction: column;
gap: 30px;
}
</style>

View File

@ -1,7 +1,6 @@
import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue"; import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue";
import { request } from "@/utils/request"; import { request } from "@/utils/request";
import { useRoute, useRouter } from 'vue-router' import { useRoute } from 'vue-router'
import DetailDrawer from "./detailDrawer.vue";
const tableData = ref([]); // 表格数据 const tableData = ref([]); // 表格数据
const filterData = reactive({ const filterData = reactive({
@ -78,160 +77,130 @@ const getTableData = async (filterData) => {
} }
}; };
// 获取养护站详情
const getYhzDetail = async (row) => {
try {
console.log('row',toRaw(row));
const res = await request({
url: `/snow-ops-platform/yhz/getById?id=${row.id}`,
method: "GET",
});
if (res.code === "00000") {
if (drawerType.value === "detail"){
drawer.title = '详情'
drawer.props = {
basicData: res.data,
};
drawer.onCancel = () => {
drawerType.value = '';
drawerVisible.value = false;
};
drawer.onConfirm = () => {
drawerType.value = '';
drawerVisible.value = false;
};
drawer.content = DetailDrawer;
drawerVisible.value = true;
}
}
} catch (error) {
} const columns = [
}; {
export default () => { prop: "mc",
label: "服务站名称",
const router = useRouter(); },
const handleClickSb = (row) => { {
router.push({ prop: "sbsl",
path: `/yhzsb/${encodeURIComponent(JSON.stringify(row))}`, label: "设备数量",
}); render: (row) => () =>
}; h(
const handleClickWz = (row) => { ElButton,
router.push({ {
path: `/yhzwz/${encodeURIComponent(JSON.stringify(row))}`, link: true,
}); type: "primary",
}; onClick: () => handleClickSb(row),
},
const columns = [ () => row.sbsl
{ ),
prop: "mc", },
label: "服务站名称", {
}, prop: "wzsl",
{ label: "物资数量",
prop: "sbsl", render: (row) => () =>
label: "设备数量", h(
render: (row) => () => ElButton,
{
link: true,
type: "primary",
onClick: () => handleClickWz(row),
},
() => row.wzsl
),
},
{
prop: "rysl",
label: "人员数量",
},
{
prop: "qxmc",
label: "区县名称",
},
{
label: "操作",
fixed: "right",
width: 150,
render: (row) => () =>
h("div", { class: "action-btns" }, [
h( h(
ElButton, ElButton,
{ {
link: true,
type: "primary", type: "primary",
onClick: () => handleClickSb(row), link: true,
onClick: async () => {
},
}, },
() => row.sbsl () => "详情"
), ),
},
{
prop: "wzsl",
label: "物资数量",
render: (row) => () =>
h( h(
ElButton, ElButton,
{ {
type: "success",
link: true, link: true,
type: "primary", style: "margin-left: 10px;",
onClick: () => handleClickWz(row), onClick: async () => {
},
() => row.wzsl
),
},
{
prop: "rysl",
label: "人员数量",
},
{
prop: "qxmc",
label: "区县名称",
},
{
label: "操作",
fixed: "right",
width: 150,
render: (row) => () =>
h("div", { class: "action-btns" }, [
h(
ElButton,
{
type: "primary",
link: true,
onClick: async () => {
drawerType.value = "detail";
await getYhzDetail(row);
},
},
() => "详情"
),
h(
ElButton,
{
type: "success",
link: true,
style: "margin-left: 10px;",
onClick: async () => {
},
}, },
() => "编辑" },
), () => "编辑"
h( ),
ElButton, h(
{ ElButton,
type: "danger", {
link: true, type: "danger",
style: "margin-left: 10px;", link: true,
onClick: async () => { style: "margin-left: 10px;",
try { onClick: async () => {
await ElMessageBox.confirm("确定要删除该站点吗?", "删除确认", { try {
confirmButtonText: "确定", await ElMessageBox.confirm("确定要删除该站点吗?", "删除确认", {
cancelButtonText: "取消", confirmButtonText: "确定",
type: "warning", cancelButtonText: "取消",
}); type: "warning",
const res = await request({ });
url: `/snow-ops-platform/yhz/delete`, const res = await request({
method: "POST", url: `/snow-ops-platform/yhz/delete`,
data: { method: "POST",
id: row.id, data: {
}, id: row.id,
}); },
if (res.code === "00000") { });
ElMessage.success("删除成功"); if (res.code === "00000") {
getTableData(); ElMessage.success("删除成功");
} getTableData();
} catch (error) {
if (error instanceof Error) {
ElMessage.error(error.message || "删除失败");
}
} }
}, } catch (error) {
if (error instanceof Error) {
ElMessage.error(error.message || "删除失败");
}
}
}, },
() => "删除" },
), () => "删除"
]), ),
}, ]),
]; },
];
const router = useRoute();
const handleClickSb = (row) => {
router.push({
path: `/yhzsb/${encodeURIComponent(JSON.stringify(row))}`,
});
};
const handleClickWz = (row) => {
router.push({
path: `/yhzwz/${encodeURIComponent(JSON.stringify(row))}`,
});
};
export default () => {
// 监听过滤条件变化 // 监听过滤条件变化
watch( watch(
[() => filterData], [() => filterData],
@ -244,15 +213,12 @@ export default () => {
onMounted(async () => { onMounted(async () => {
await getTableData() await getTableData()
}); });
return { return {
tableData, tableData,
filterData, filterData,
zdlxOptions, zdlxOptions,
pagination, pagination,
columns, columns,
handleClickSb,
handleClickWz,
modelVisible, modelVisible,
model, model,