App端 设备管理 详情接口对接

This commit is contained in:
huangchenhao 2025-11-04 17:29:45 +08:00
parent 967ce1208a
commit 3b0aefb486
5 changed files with 152 additions and 68 deletions

View File

@ -12,7 +12,7 @@ const routes = [
component: () => import('../views/User.vue') component: () => import('../views/User.vue')
}, },
{ {
path: '/equipManage', path: '/equipManage/:data',
name: 'EquipManage', name: 'EquipManage',
component: () => import('../views/EquipmentManagement.vue') component: () => import('../views/EquipmentManagement.vue')
}, },

View File

@ -3,7 +3,7 @@
<van-nav-bar title="设备管理" fixed left-arrow @click-left="onClickLeft" /> <van-nav-bar title="设备管理" fixed left-arrow @click-left="onClickLeft" />
<van-cell-group> <van-cell-group>
<van-cell title="当前站点" value="李家坝仓库" /> <van-cell title="当前站点" :value="equipmentInfo.sbwz" />
</van-cell-group> </van-cell-group>
<div class="content"> <div class="content">
@ -13,38 +13,41 @@
style="font-size: 18px; font-weight: bold; line-height: inherit" style="font-size: 18px; font-weight: bold; line-height: inherit"
> >
<template #value> <template #value>
<span :class="['status-tag', equipmentInfo.statusClass]">{{ <span :class="[
equipmentInfo.status 'status-tag',
`status-` +
(equipmentDetailInfo.sbzt === '完好'
? 'good'
: equipmentDetailInfo.sbzt === '损坏'
? 'warning'
: 'danger'),
]">{{
equipmentDetailInfo.sbzt
}}</span> }}</span>
</template> </template>
</van-cell> </van-cell>
<van-cell :title="'设备名称: ' + equipmentInfo.title"> </van-cell> <van-cell :title="'设备名称: ' + equipmentDetailInfo.sbmc"> </van-cell>
<van-cell :title="'设备大类: 小修保养设备'"> </van-cell> <van-cell :title="'设备大类: ' + equipmentDetailInfo.sbdl"> </van-cell>
<van-cell :title="equipmentInfo.label"> </van-cell> <van-cell :title="'设备类型: ' + equipmentDetailInfo.sblx"> </van-cell>
<van-cell :title="'设备编号: 002'"> </van-cell> <van-cell :title="'设备编号: ' + equipmentDetailInfo.sbbh"> </van-cell>
<van-cell :title="'设备型号: E32、PS2600、专业版1949'"> </van-cell> <van-cell :title="'设备型号: ' + equipmentDetailInfo.sbxh"> </van-cell>
<van-cell :title="'设备位置: 丰都'"> </van-cell> <van-cell :title="'设备位置: ' + equipmentDetailInfo.sbwz"> </van-cell>
<van-cell :title="'设备经纬度: '"> <van-cell :title="'设备经纬度: '">
<template #label> <template #label>
<span>设备经度: 108.41763025<br />设备纬度: 31.89751472</span> <span>设备经度: {{ equipmentDetailInfo.jd }}<br />设备纬度: {{ equipmentDetailInfo.wd }}</span>
</template> </template>
</van-cell> </van-cell>
<van-cell :title="'设备管理人员 张三四'"> </van-cell> <van-cell :title="'设备管理人员 '+ equipmentDetailInfo.glry"> </van-cell>
<van-cell :title="'操作员: 李思思'"> </van-cell> <van-cell :title="'操作员: '+ equipmentDetailInfo.czy"> </van-cell>
<van-cell :title="'购置日期: 2025/10/10'"> </van-cell> <van-cell :title="'购置日期: '+ equipmentDetailInfo.gzrq"> </van-cell>
<van-cell :title="'购买费用(万元): 29'"> </van-cell> <van-cell :title="'购买费用(万元): '+ equipmentDetailInfo.gmfy"> </van-cell>
<van-cell :title="'应急设备: '"> </van-cell> <van-cell :title="'应急设备: '+ equipmentDetailInfo.sfyjsb"> </van-cell>
<van-cell :title="'纳入市级补助范围: '"> </van-cell> <van-cell :title="'纳入市级补助范围: ' + equipmentDetailInfo.sfnrsjbz"> </van-cell>
<van-cell <van-cell
:title="'辐射范围: G212兰州-龙邦 K1292+460至K1302+250 S544歌石路K44+0至K67+800'" :title="'辐射范围: '+ equipmentDetailInfo.fsfw"
> >
</van-cell> </van-cell>
<van-cell :title="'上传人: 张三三'"> </van-cell> <van-cell :title="'所属服务站: '+ equipmentDetailInfo.sbwz"> </van-cell>
<van-cell :title="'上传时间: 2025/10/10 10:00:00'"> </van-cell>
<van-cell :title="'生产商: 富士重工业株式会社群马制作所'"> </van-cell>
<van-cell :title="'所属服务站: 李家坝仓库'"> </van-cell>
<van-cell :title="'损坏原因: 坏了'"> </van-cell>
<van-cell :title="'报废原因: 发动机报废'"> </van-cell>
</van-cell-group> </van-cell-group>
</div> </div>
@ -222,9 +225,10 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted, toRaw } from "vue";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { showToast } from "vant"; import { showToast } from "vant";
import { request } from "../../../shared/utils/request";
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
@ -239,19 +243,39 @@ const onSelect = (action) => {
show报废Popup.value = true; show报废Popup.value = true;
} }
}; };
const equipmentInfo = ref({ const equipmentInfo = ref({});
title: "", const equipmentDetailInfo = ref({});
label: "",
status: "", //
statusClass: "", const getEquipmentDetailInfo = async () => {
try {
const res = await request({
url: `/api/yjsb/${equipmentInfo.value.rid}`,
method: "GET",
}); });
if (res.code && res.code === '00000') {
equipmentDetailInfo.value = res.data;
console.log('equipmentDetailInfo',toRaw(equipmentDetailInfo.value));
}
else{
throw new Error(res.data.message);
}
} catch (error) {
showToast({ type: "error", message: error.message });
}
};
onMounted(() => { onMounted(() => {
equipmentInfo.value = JSON.parse(decodeURIComponent(route.params.data)); equipmentInfo.value = JSON.parse(decodeURIComponent(route.params.data));
console.log("equipmentInfo", equipmentInfo.value); console.log("equipmentInfo", toRaw(equipmentInfo.value));
getEquipmentDetailInfo();
}); });
const onClickLeft = () => { const onClickLeft = () => {
router.push("/EquipManage"); router.push({
name: "EquipManage",
params: { data: encodeURIComponent(JSON.stringify(equipmentInfo.value)) },
});
}; };
const show报废Popup = ref(false); const show报废Popup = ref(false);

View File

@ -4,12 +4,12 @@
</van-nav-bar> </van-nav-bar>
<van-search <van-search
shape="round" shape="round"
:value="searchValue" v-model="searchValue"
:show-action="false" :show-action="false"
placeholder="请输入设备名称" placeholder="请输入设备名称"
/> />
<van-cell-group> <van-cell-group>
<van-cell title="当前站点" value="李家坝仓库" /> <van-cell title="当前站点" :value="detailData.mc || detailData.sbwz" />
</van-cell-group> </van-cell-group>
<van-notice-bar mode="link">20台设备待确认</van-notice-bar> <van-notice-bar mode="link">20台设备待确认</van-notice-bar>
@ -18,18 +18,27 @@
<van-cell <van-cell
v-for="(item, index) in equipmentList" v-for="(item, index) in equipmentList"
:key="index" :key="index"
:title="item.title" :title="item.sbmc"
is-link is-link
:label="item.label" :label="`设备类型: ` + item.sblx"
:to="{ :to="{
name: 'EquipDetail', name: 'EquipDetail',
params: { data: encodeURIComponent(JSON.stringify(item)) }, params: { data: encodeURIComponent(JSON.stringify(item)) },
}" }"
> >
<template #value> <template #value>
<span :class="['status-tag', item.statusClass]">{{ <span
item.status :class="[
}}</span> 'status-tag',
`status-` +
(item.sbzt === '完好'
? 'good'
: item.sbzt === '损坏'
? 'warning'
: 'danger'),
]"
>{{ item.sbzt }}</span
>
</template> </template>
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
@ -240,32 +249,57 @@
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { ref, onMounted, reactive, toRaw, watch } from "vue";
import { useRouter } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { showToast } from "vant"; import { showToast } from "vant";
import { request } from "../../../shared/utils/request";
const router = useRouter(); const router = useRouter();
const route = useRoute();
const detailData = ref({}); //
const searchValue = ref(""); // const searchValue = ref(""); //
const equipmentList = ref([ const equipmentList = ref([]);
{
title: "高枝锯、绿篱机、油锯", //
label: "设备类型: 绿化修剪设备", onMounted(() => {
status: "完好", detailData.value = JSON.parse(decodeURIComponent(route.params.data));
statusClass: "status-good", getEquipmentList();
}, });
{
title: "撒布机三台", watch(
label: "设备类型:除雪设备", () => searchValue.value,
status: "损坏", (newVal, oldVal) => {
statusClass: "status-warning", if (newVal !== oldVal) {
}, getEquipmentList(newVal);
{ }
title: "撒布机三台", }
label: "设备类型:除雪设备", );
status: "报废",
statusClass: "status-danger", //
}, const getEquipmentList = async (sbmc) => {
]); try {
const data = {
yhzid: detailData.value.id || detailData.value.yhzid,
sbmc: sbmc,
pageNum: 1,
pageSize: 9999,
};
const res = await request({
url: "/api/yjsb/list",
method: "get",
params: data,
});
if (res.code && res.code === "00000") {
equipmentList.value = res.data.records;
} else {
throw new Error(res.message);
}
} catch (error) {
console.log(error);
showToast(error.message || "获取设备列表失败");
}
};
const showPopup = ref(false); // const showPopup = ref(false); //
const onClickLeft = () => { const onClickLeft = () => {

View File

@ -3,12 +3,19 @@
<van-nav-bar title="愉快政" fixed left-arrow /> <van-nav-bar title="愉快政" fixed left-arrow />
<van-cell-group> <van-cell-group>
<van-cell title="当前站点" value="李家坝仓库" /> <van-cell title="当前站点" :value="detailData.mc" />
</van-cell-group> </van-cell-group>
<div class="content"> <div class="content">
<van-grid :gutter="10" :column-num="3" class="grid"> <van-grid :gutter="10" :column-num="3" class="grid">
<van-grid-item icon="setting-o" text="设备管理" to="/EquipManage" /> <van-grid-item
icon="setting-o"
text="设备管理"
:to="{
name: 'EquipManage',
params: { data: encodeURIComponent(JSON.stringify(detailData)) },
}"
/>
<van-grid-item icon="setting-o" text="物资管理" to="/MaterialManage" /> <van-grid-item icon="setting-o" text="物资管理" to="/MaterialManage" />
<van-grid-item icon="setting-o" text="人员管理" to="/StaffManage" /> <van-grid-item icon="setting-o" text="人员管理" to="/StaffManage" />
<van-grid-item icon="setting-o" text="冰雪灾害" to="/IceHail" /> <van-grid-item icon="setting-o" text="冰雪灾害" to="/IceHail" />
@ -23,13 +30,14 @@
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { ref, onMounted } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { showToast } from "vant"; import { showToast } from "vant";
import { request } from "../../../shared/utils/request"; import { request } from "../../../shared/utils/request";
const router = useRouter(); const router = useRouter();
const active = ref(0); const active = ref(0);
const detailData = ref({});
// //
const getYHZDetail = async () => { const getYHZDetail = async () => {
@ -38,11 +46,23 @@ const getYHZDetail = async () => {
url: `/api/yhz/${53}`, // id53 url: `/api/yhz/${53}`, // id53
method: "GET", method: "GET",
}); });
if (res.code && res.code === "00000") {
detailData.value = res.data;
} else {
throw new Error(res.message);
}
} catch (error) { } catch (error) {
showToast({
message: error.message,
type: "error",
});
} }
}; };
onMounted(() => {
getYHZDetail();
});
const goToUser = () => { const goToUser = () => {
router.push("/user"); router.push("/user");
}; };

View File

@ -5,7 +5,7 @@ import Components from 'unplugin-vue-components/vite'
import { VantResolver } from 'unplugin-vue-components/resolvers' import { VantResolver } from 'unplugin-vue-components/resolvers'
export default defineConfig({ export default defineConfig({
base: '/app/', // base: '/app/',
plugins: [ plugins: [
vue(), vue(),
Components({ Components({
@ -21,7 +21,13 @@ export default defineConfig({
server: { server: {
port: 8080, port: 8080,
host: '0.0.0.0', host: '0.0.0.0',
open: true open: true,
proxy: {
'/api': {
target: 'http://8.137.54.85:8661/',
changeOrigin: true,
},
}
}, },
build: { build: {
outDir: 'dist', outDir: 'dist',