App物资管理
This commit is contained in:
parent
c07d7912a9
commit
94edd0d0f6
@ -17,7 +17,7 @@ const routes = [
|
||||
component: () => import('../views/Equipment/EquipmentManagement.vue')
|
||||
},
|
||||
{
|
||||
path: '/materialManage',
|
||||
path: '/materialManage/:data',
|
||||
name: 'MaterialManage',
|
||||
component: () => import('../views//Material/MaterialManagement.vue')
|
||||
},
|
||||
@ -31,6 +31,13 @@ const routes = [
|
||||
name: 'EquipDetail',
|
||||
component: () => import('../views//Equipment/EquipmentDetails.vue')
|
||||
},
|
||||
{
|
||||
path: '/materialDetail/:yhzDetail/:data',
|
||||
name: 'MaterialDetail',
|
||||
component: () => import('../views//Material/MaterialDetails.vue')
|
||||
},
|
||||
{
|
||||
}
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
|
||||
@ -13,7 +13,8 @@
|
||||
style="font-size: 18px; font-weight: bold; line-height: inherit"
|
||||
>
|
||||
<template #value>
|
||||
<span :class="[
|
||||
<span
|
||||
:class="[
|
||||
'status-tag',
|
||||
`status-` +
|
||||
(equipmentDetailInfo.sbzt === '完好'
|
||||
@ -21,9 +22,9 @@
|
||||
: equipmentDetailInfo.sbzt === '损坏'
|
||||
? 'warning'
|
||||
: 'danger'),
|
||||
]">{{
|
||||
equipmentDetailInfo.sbzt
|
||||
}}</span>
|
||||
]"
|
||||
>{{ equipmentDetailInfo.sbzt }}</span
|
||||
>
|
||||
</template>
|
||||
</van-cell>
|
||||
<van-cell :title="'设备名称: ' + equipmentDetailInfo.sbmc"> </van-cell>
|
||||
@ -34,20 +35,27 @@
|
||||
<van-cell :title="'设备位置: ' + equipmentDetailInfo.sbwz"> </van-cell>
|
||||
<van-cell :title="'设备经纬度: '">
|
||||
<template #label>
|
||||
<span>设备经度: {{ equipmentDetailInfo.jd }}<br />设备纬度: {{ equipmentDetailInfo.wd }}</span>
|
||||
<span
|
||||
>设备经度: {{ equipmentDetailInfo.jd }}<br />设备纬度:
|
||||
{{ equipmentDetailInfo.wd }}</span
|
||||
>
|
||||
</template>
|
||||
</van-cell>
|
||||
<van-cell :title="'设备管理人员: '+ equipmentDetailInfo.glry"> </van-cell>
|
||||
<van-cell :title="'操作员: '+ equipmentDetailInfo.czy"> </van-cell>
|
||||
<van-cell :title="'购置日期: '+ equipmentDetailInfo.gzrq"> </van-cell>
|
||||
<van-cell :title="'购买费用(万元): '+ equipmentDetailInfo.gmfy"> </van-cell>
|
||||
<van-cell :title="'应急设备: '+ equipmentDetailInfo.sfyjsb"> </van-cell>
|
||||
<van-cell :title="'纳入市级补助范围: ' + equipmentDetailInfo.sfnrsjbz"> </van-cell>
|
||||
<van-cell
|
||||
:title="'辐射范围: '+ equipmentDetailInfo.fsfw"
|
||||
>
|
||||
<van-cell :title="'设备管理人员: ' + equipmentDetailInfo.glry">
|
||||
</van-cell>
|
||||
<van-cell :title="'操作员: ' + equipmentDetailInfo.czy">
|
||||
</van-cell>
|
||||
<van-cell :title="'购置日期: ' + equipmentDetailInfo.gzrq">
|
||||
</van-cell>
|
||||
<van-cell :title="'购买费用(万元): ' + equipmentDetailInfo.gmfy">
|
||||
</van-cell>
|
||||
<van-cell :title="'应急设备: ' + equipmentDetailInfo.sfyjsb">
|
||||
</van-cell>
|
||||
<van-cell :title="'纳入市级补助范围: ' + equipmentDetailInfo.sfnrsjbz">
|
||||
</van-cell>
|
||||
<van-cell :title="'辐射范围: ' + equipmentDetailInfo.fsfw"> </van-cell>
|
||||
<van-cell :title="'所属服务站: ' + equipmentDetailInfo.sbwz">
|
||||
</van-cell>
|
||||
<van-cell :title="'所属服务站: '+ equipmentDetailInfo.sbwz"> </van-cell>
|
||||
</van-cell-group>
|
||||
</div>
|
||||
|
||||
@ -79,8 +87,11 @@
|
||||
>
|
||||
<van-tabbar-item
|
||||
><template #default>
|
||||
<van-button type="primary" style="width: 80px; border-radius: 10px"
|
||||
@click="onEditPopupOpen">
|
||||
<van-button
|
||||
type="primary"
|
||||
style="width: 80px; border-radius: 10px"
|
||||
@click="onEditPopupOpen"
|
||||
>
|
||||
编辑
|
||||
</van-button>
|
||||
</template></van-tabbar-item
|
||||
@ -103,9 +114,56 @@
|
||||
position="bottom"
|
||||
closeable
|
||||
close-on-click-overlay
|
||||
:style="{ height: '20%' }"
|
||||
:style="{ height: '30%' }"
|
||||
@close="onRemarkPopupClose"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0 16px;
|
||||
"
|
||||
>
|
||||
<h1
|
||||
style="
|
||||
margin: 0 0 12px 0;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
"
|
||||
>
|
||||
备注信息
|
||||
</h1>
|
||||
<van-field
|
||||
v-model="equipmentDetailInfo.remark"
|
||||
placeholder="请输入备注"
|
||||
style="
|
||||
width: 100%;
|
||||
margin-bottom: 16px;
|
||||
border-radius: 8px;
|
||||
background: #f7f8fa;
|
||||
"
|
||||
/>
|
||||
<div style="display: flex; gap: 20px; width: 100%">
|
||||
<van-button
|
||||
type="default"
|
||||
style="flex: 1; border-radius: 8px"
|
||||
@click="onRemarkPopupClose"
|
||||
>
|
||||
取消
|
||||
</van-button>
|
||||
<van-button
|
||||
type="primary"
|
||||
style="flex: 1; border-radius: 8px"
|
||||
@click="onRemarkConfirm"
|
||||
>
|
||||
确认
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</van-popup>
|
||||
<van-popup
|
||||
:show="showDeletePopup"
|
||||
@ -160,17 +218,64 @@
|
||||
position="bottom"
|
||||
closeable
|
||||
close-on-click-overlay
|
||||
:style="{ height: '20%' }"
|
||||
:style="{ height: '30%' }"
|
||||
@close="onBrokenPopupClose"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0 16px;
|
||||
"
|
||||
>
|
||||
<h1
|
||||
style="
|
||||
margin: 0 0 12px 0;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
"
|
||||
>
|
||||
损坏上报
|
||||
</h1>
|
||||
<van-field
|
||||
v-model="brokenReason"
|
||||
placeholder="请填写损坏原因"
|
||||
style="
|
||||
width: 100%;
|
||||
margin-bottom: 16px;
|
||||
border-radius: 8px;
|
||||
background: #f7f8fa;
|
||||
"
|
||||
/>
|
||||
<div style="display: flex; gap: 20px; width: 100%">
|
||||
<van-button
|
||||
type="default"
|
||||
style="flex: 1; border-radius: 8px"
|
||||
@click="onBrokenPopupClose"
|
||||
>
|
||||
取消
|
||||
</van-button>
|
||||
<van-button
|
||||
type="primary"
|
||||
style="flex: 1; border-radius: 8px"
|
||||
@click="onBrokenConfirm"
|
||||
>
|
||||
确认
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</van-popup>
|
||||
<van-popup
|
||||
:show="show报废Popup"
|
||||
:show="showScrapPopup"
|
||||
position="bottom"
|
||||
closeable
|
||||
close-on-click-overlay
|
||||
:style="{ height: '30%' }"
|
||||
@close="on报废PopupClose"
|
||||
@close="onScrapPopupClose"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
@ -208,14 +313,14 @@
|
||||
<van-button
|
||||
type="default"
|
||||
style="flex: 1; border-radius: 8px"
|
||||
@click="on报废PopupClose"
|
||||
@click="onScrapPopupClose"
|
||||
>
|
||||
取消
|
||||
</van-button>
|
||||
<van-button
|
||||
type="primary"
|
||||
style="flex: 1; border-radius: 8px"
|
||||
@click="on报废Confirm"
|
||||
@click="onScrapConfirm"
|
||||
>
|
||||
确认
|
||||
</van-button>
|
||||
@ -223,8 +328,6 @@
|
||||
</div>
|
||||
</van-popup>
|
||||
|
||||
|
||||
|
||||
<van-popup
|
||||
:show="showEditPopup"
|
||||
position="bottom"
|
||||
@ -501,7 +604,6 @@
|
||||
@cancel="showSubsidyPicker = false"
|
||||
/>
|
||||
</van-popup>
|
||||
|
||||
</van-form>
|
||||
<div
|
||||
style="
|
||||
@ -530,8 +632,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import "vant/es/toast/style";
|
||||
import "vant/es/popup/style";
|
||||
import "vant/es/toast/style";
|
||||
import "vant/es/popup/style";
|
||||
import { ref, onMounted, toRaw, reactive } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { showToast, showLoadingToast } from "vant";
|
||||
@ -547,7 +649,7 @@ const onSelect = (action) => {
|
||||
showDeletePopup.value = true;
|
||||
}
|
||||
if (action.text === "报废") {
|
||||
show报废Popup.value = true;
|
||||
showScrapPopup.value = true;
|
||||
}
|
||||
};
|
||||
const equipmentInfo = ref({});
|
||||
@ -555,21 +657,20 @@ const equipmentDetailInfo = ref({});
|
||||
|
||||
// 获取设备详情
|
||||
const getEquipmentDetailInfo = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yjsb/getById?rid=${equipmentInfo.value.rid}`,
|
||||
method: "GET",
|
||||
});
|
||||
if (res.code && res.code === '00000') {
|
||||
equipmentDetailInfo.value = res.data;
|
||||
console.log('设备详情',toRaw(equipmentDetailInfo.value))
|
||||
}
|
||||
else{
|
||||
throw new Error(res.data.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({ type: "error", message: error.message });
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yjsb/getById?rid=${equipmentInfo.value.rid}`,
|
||||
method: "GET",
|
||||
});
|
||||
if (res.code && res.code === "00000") {
|
||||
equipmentDetailInfo.value = res.data;
|
||||
console.log("设备详情", toRaw(equipmentDetailInfo.value));
|
||||
} else {
|
||||
throw new Error(res.data.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({ type: "error", message: error.message });
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
@ -585,23 +686,81 @@ const onClickLeft = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const show报废Popup = ref(false);
|
||||
const scrapReason = ref(''); // 报废原因
|
||||
const on报废PopupClose = () => {
|
||||
show报废Popup.value = false;
|
||||
scrapReason.value = '';
|
||||
const showScrapPopup = ref(false);
|
||||
const scrapReason = ref(""); // 报废原因
|
||||
const onScrapPopupClose = () => {
|
||||
showScrapPopup.value = false;
|
||||
scrapReason.value = "";
|
||||
};
|
||||
const on报废Confirm = () => {
|
||||
show报废Popup.value = false;
|
||||
scrapReason.value = '';
|
||||
const onScrapConfirm = async () => {
|
||||
try {
|
||||
console.log("equipmentDetailInfo", toRaw(equipmentDetailInfo.value));
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yjsb/update`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...equipmentDetailInfo.value,
|
||||
sbzt: "报废",
|
||||
remark: scrapReason.value,
|
||||
},
|
||||
});
|
||||
if (res.code && res.code === "00000") {
|
||||
showToast({ type: "success", message: "操作成功" });
|
||||
router.push({
|
||||
name: "EquipManage",
|
||||
params: {
|
||||
data: encodeURIComponent(JSON.stringify(equipmentInfo.value)),
|
||||
},
|
||||
});
|
||||
} else {
|
||||
throw new Error(res.data.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({ type: "error", message: "操作失败" });
|
||||
console.log("error", error);
|
||||
}
|
||||
showScrapPopup.value = false;
|
||||
scrapReason.value = "";
|
||||
};
|
||||
|
||||
const showBrokenPopup = ref(false);
|
||||
const onBrokenPopupOpen = () => {
|
||||
showBrokenPopup.value = true;
|
||||
};
|
||||
// 损坏相关状态
|
||||
const brokenReason = ref(""); // 损坏原因
|
||||
const onBrokenConfirm = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yjsb/update`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...equipmentDetailInfo.value,
|
||||
sbzt: "损坏", // 修改状态为损坏
|
||||
remark: brokenReason.value,
|
||||
},
|
||||
});
|
||||
if (res.code && res.code === "00000") {
|
||||
showToast({ type: "success", message: "损坏上报成功" });
|
||||
router.push({
|
||||
name: "EquipManage",
|
||||
params: {
|
||||
data: encodeURIComponent(JSON.stringify(equipmentInfo.value)),
|
||||
},
|
||||
});
|
||||
} else {
|
||||
throw new Error(res.data.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({ type: "error", message: "操作失败" });
|
||||
console.log("error", error);
|
||||
}
|
||||
showBrokenPopup.value = false;
|
||||
brokenReason.value = "";
|
||||
};
|
||||
const onBrokenPopupClose = () => {
|
||||
showBrokenPopup.value = false;
|
||||
brokenReason.value = "";
|
||||
};
|
||||
|
||||
const showDeletePopup = ref(false);
|
||||
@ -619,22 +778,23 @@ const onDeleteConfirm = async () => {
|
||||
url: `/snow-ops-platform/yjsb/delete`,
|
||||
method: "POST",
|
||||
data: {
|
||||
rid : equipmentDetailInfo.value.rid
|
||||
}
|
||||
rid: equipmentDetailInfo.value.rid,
|
||||
},
|
||||
});
|
||||
if (res.code && res.code === '00000') {
|
||||
if (res.code && res.code === "00000") {
|
||||
showToast({ type: "success", message: "删除成功" });
|
||||
router.push({
|
||||
name: "EquipManage",
|
||||
params: { data: encodeURIComponent(JSON.stringify(equipmentInfo.value)) },
|
||||
params: {
|
||||
data: encodeURIComponent(JSON.stringify(equipmentInfo.value)),
|
||||
},
|
||||
});
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
throw new Error(res.data.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({ type: "error", message: "删除失败" });
|
||||
console.log('error',error)
|
||||
console.log("error", error);
|
||||
}
|
||||
showDeletePopup.value = false;
|
||||
};
|
||||
@ -643,23 +803,54 @@ const showRemarkPopup = ref(false);
|
||||
const onRemarkPopupOpen = () => {
|
||||
showRemarkPopup.value = true;
|
||||
};
|
||||
const onRemarkConfirm = async () => {
|
||||
try {
|
||||
showLoadingToast({
|
||||
message: "提交中...",
|
||||
forbidClick: true,
|
||||
loadingType: "spinner",
|
||||
});
|
||||
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yjsb/update",
|
||||
method: "POST",
|
||||
data: {
|
||||
...equipmentDetailInfo.value,
|
||||
|
||||
remark: equipmentDetailInfo.value.remark,
|
||||
},
|
||||
});
|
||||
if (res.code && res.code === "00000") {
|
||||
showToast({ type: "success", message: "备注更新成功" });
|
||||
getEquipmentDetailInfo();
|
||||
showRemarkPopup.value = false;
|
||||
} else {
|
||||
throw new Error(res.data.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({ type: "error", message: error.message || "备注更新失败" });
|
||||
} finally {
|
||||
showRemarkPopup.value = false;
|
||||
}
|
||||
};
|
||||
const onRemarkPopupClose = () => {
|
||||
getEquipmentDetailInfo();
|
||||
showRemarkPopup.value = false;
|
||||
};
|
||||
|
||||
const showEditPopup = ref(false)
|
||||
const showEditPopup = ref(false);
|
||||
// 编辑表单
|
||||
const editForm = reactive({})
|
||||
const editForm = reactive({});
|
||||
// 打开编辑弹窗
|
||||
const onEditPopupOpen = () => {
|
||||
Object.assign(editForm, equipmentDetailInfo.value);
|
||||
|
||||
showEditPopup.value = true
|
||||
}
|
||||
showEditPopup.value = true;
|
||||
};
|
||||
// 关闭编辑弹窗
|
||||
const onEditPopupClose = () => {
|
||||
showEditPopup.value = false
|
||||
}
|
||||
showEditPopup.value = false;
|
||||
};
|
||||
|
||||
const showCategoryPicker = ref(false);
|
||||
const showTypePicker = ref(false);
|
||||
@ -798,26 +989,26 @@ const onSubsidyConfirm = (value) => {
|
||||
// 提交修改
|
||||
const onEditSubmit = async () => {
|
||||
try {
|
||||
showLoadingToast({ message: '提交中...', forbidClick: true })
|
||||
showLoadingToast({ message: "提交中...", forbidClick: true });
|
||||
// console.log('editForm',toRaw(editForm))
|
||||
|
||||
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjsb/update',
|
||||
method: 'POST',
|
||||
data: editForm
|
||||
})
|
||||
if (res.code && res.code === '00000') {
|
||||
showToast({ type: 'success', message: '修改成功' })
|
||||
getEquipmentDetailInfo() // 刷新详情数据
|
||||
showEditPopup.value = false
|
||||
}else{
|
||||
throw new Error(res.message)
|
||||
url: "/snow-ops-platform/yjsb/update",
|
||||
method: "POST",
|
||||
data: editForm,
|
||||
});
|
||||
if (res.code && res.code === "00000") {
|
||||
showToast({ type: "success", message: "修改成功" });
|
||||
getEquipmentDetailInfo(); // 刷新详情数据
|
||||
showEditPopup.value = false;
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({ type: 'fail', message: error.message || '修改失败' })
|
||||
console.log('error',error)
|
||||
showToast({ type: "fail", message: error.message || "修改失败" });
|
||||
console.log("error", error);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -853,7 +1044,7 @@ const onEditSubmit = async () => {
|
||||
.status-danger {
|
||||
background-color: #ee0a24;
|
||||
}
|
||||
.device-form{
|
||||
.device-form {
|
||||
padding: 16px 16px 80px 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -16,7 +16,14 @@
|
||||
params: { data: encodeURIComponent(JSON.stringify(detailData)) },
|
||||
}"
|
||||
/>
|
||||
<van-grid-item icon="setting-o" text="物资管理" to="/MaterialManage" />
|
||||
<van-grid-item
|
||||
icon="setting-o"
|
||||
text="物资管理"
|
||||
:to="{
|
||||
name: 'MaterialManage',
|
||||
params: { data: encodeURIComponent(JSON.stringify(detailData)) },
|
||||
}"
|
||||
/>
|
||||
<van-grid-item icon="setting-o" text="人员管理" to="/StaffManage" />
|
||||
<van-grid-item icon="setting-o" text="冰雪灾害" to="/IceHail" />
|
||||
</van-grid>
|
||||
@ -30,8 +37,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import 'vant/es/toast/style';
|
||||
import 'vant/es/popup/style';
|
||||
import "vant/es/toast/style";
|
||||
import "vant/es/popup/style";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { showToast } from "vant";
|
||||
|
||||
84
packages/mobile/src/views/Material/MaterialDetails.vue
Normal file
84
packages/mobile/src/views/Material/MaterialDetails.vue
Normal file
@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<van-nav-bar title="物资管理" fixed left-arrow @click-left="onClickLeft" />
|
||||
|
||||
<van-cell-group>
|
||||
<van-cell title="当前站点" :value="''" />
|
||||
</van-cell-group>
|
||||
|
||||
<div class="content">
|
||||
<van-cell-group>
|
||||
<van-cell
|
||||
title="设备信息"
|
||||
style="font-size: 18px; font-weight: bold; line-height: inherit"
|
||||
>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import "vant/es/toast/style";
|
||||
import "vant/es/popup/style";
|
||||
import { ref, onMounted, toRaw, reactive } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { showToast, showLoadingToast } from "vant";
|
||||
import { request } from "../../../../shared/utils/request";
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const yhzDetail = ref({});
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
console.log('@@@@',decodeURIComponent(route.params.data));
|
||||
yhzDetail.value = JSON.parse(decodeURIComponent(route.params.yhzDetail));
|
||||
console.log('yhzDetail',toRaw(yhzDetail.value));
|
||||
|
||||
});
|
||||
|
||||
const onClickLeft = () => {
|
||||
router.push({
|
||||
name: "MaterialManage",
|
||||
params: { data: encodeURIComponent(JSON.stringify(yhzDetail)) },
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.home {
|
||||
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.grid {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
display: inline-block;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
}
|
||||
.status-good {
|
||||
background-color: #07c160;
|
||||
}
|
||||
.status-warning {
|
||||
background-color: #ff976a;
|
||||
}
|
||||
.status-danger {
|
||||
background-color: #ee0a24;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,127 +1,183 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<van-nav-bar title="物资管理" fixed left-arrow @click-left="onClickLeft">
|
||||
</van-nav-bar>
|
||||
<van-search
|
||||
shape="round"
|
||||
:value="searchValue"
|
||||
:show-action="false"
|
||||
placeholder="请输入物资名称"
|
||||
/>
|
||||
<div class="home">
|
||||
<van-nav-bar title="物资管理" fixed left-arrow @click-left="onClickLeft">
|
||||
</van-nav-bar>
|
||||
<van-search
|
||||
shape="round"
|
||||
v-model="searchValue"
|
||||
:show-action="false"
|
||||
placeholder="请输入物资名称"
|
||||
/>
|
||||
<van-cell-group>
|
||||
<van-cell title="当前站点" :value="yhzDetail.mc" />
|
||||
</van-cell-group>
|
||||
|
||||
<div class="content">
|
||||
<van-cell-group>
|
||||
<van-cell title="当前站点" value="李家坝仓库" />
|
||||
<van-cell
|
||||
v-for="(item, index) in materialList"
|
||||
:key="index"
|
||||
:title="item.wzmc"
|
||||
is-link
|
||||
:label="`余量:${item.sl} (${item.dw})`"
|
||||
:to="{
|
||||
name: 'MaterialDetail',
|
||||
params: {
|
||||
yhzDetail: encodeURIComponent(JSON.stringify(yhzDetail.value)),
|
||||
data: encodeURIComponent(JSON.stringify(item)),
|
||||
},
|
||||
}"
|
||||
>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
|
||||
<div class="content">
|
||||
<van-cell-group>
|
||||
<van-cell
|
||||
title="融雪剂"
|
||||
is-link
|
||||
label="余量:2吨"
|
||||
>
|
||||
</van-cell>
|
||||
<van-cell title="警示标志杆(柱、牌)" is-link label="余量:131个">
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</div>
|
||||
|
||||
<van-button
|
||||
type="primary"
|
||||
class="add-btn"
|
||||
icon="plus"
|
||||
@click="handleAdd"
|
||||
>
|
||||
添加物资
|
||||
</van-button>
|
||||
|
||||
<!-- 弹出层 -->
|
||||
<van-popup
|
||||
:show="showPopup"
|
||||
position="bottom"
|
||||
closeable
|
||||
close-on-click-overlay
|
||||
:style="{ height: '80%' }"
|
||||
@close="onPopupClose"
|
||||
>
|
||||
<div class="popup-content">
|
||||
<h3>添加新物资</h3>
|
||||
</div>
|
||||
</van-popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<van-button type="primary" class="add-btn" icon="plus" @click="handleAdd">
|
||||
添加物资
|
||||
</van-button>
|
||||
|
||||
<!-- 弹出层 -->
|
||||
<van-popup
|
||||
:show="showPopup"
|
||||
position="bottom"
|
||||
closeable
|
||||
close-on-click-overlay
|
||||
:style="{ height: '80%' }"
|
||||
@close="onPopupClose"
|
||||
>
|
||||
<div class="popup-content">
|
||||
<h3>添加新物资</h3>
|
||||
</div>
|
||||
</van-popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { showToast } from "vant";
|
||||
|
||||
const router = useRouter();
|
||||
const searchValue = ref(""); // 搜索框输入值
|
||||
const showPopup = ref(false); // 控制弹出层显示隐藏
|
||||
|
||||
const onClickLeft = () => {
|
||||
router.push("/");
|
||||
};
|
||||
|
||||
const handleAdd = () => {
|
||||
showPopup.value = true;
|
||||
};
|
||||
|
||||
const onPopupClose = () => {
|
||||
showPopup.value = false;
|
||||
};
|
||||
</script>
|
||||
import "vant/es/toast/style";
|
||||
import "vant/es/popup/style";
|
||||
import { ref, onMounted, reactive, toRaw, watch } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { showToast, showLoadingToast } from "vant";
|
||||
import { request } from "../../../../shared/utils/request";
|
||||
import { pa } from "element-plus/es/locales.mjs";
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const searchValue = ref(""); // 搜索框输入值
|
||||
const showPopup = ref(false); // 控制弹出层显示隐藏
|
||||
const yhzDetail = ref({}); // 养护站详情数据
|
||||
const materialList = ref([]); // 物资列表数据
|
||||
|
||||
// 根据养护站rid获取物资列表
|
||||
const getMaterialList = async (wzmc) => {
|
||||
try {
|
||||
const yhzid = yhzDetail.value.id;
|
||||
if (!yhzid) {
|
||||
return;
|
||||
}
|
||||
const data = {
|
||||
yhzid,
|
||||
wzmc,
|
||||
paageNum: 1,
|
||||
paageSize: 9999,
|
||||
};
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yjwz/list",
|
||||
method: "GET",
|
||||
params: data,
|
||||
});
|
||||
if (res.code && res.code === "00000") {
|
||||
materialList.value = res.data.records;
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({
|
||||
type: "error",
|
||||
message: error.message || "获取物资列表失败",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
yhzDetail.value = JSON.parse(decodeURIComponent(route.params.data));
|
||||
getMaterialList();
|
||||
console.log("yhzDetail", toRaw(yhzDetail.value));
|
||||
});
|
||||
|
||||
watch(
|
||||
() => searchValue.value,
|
||||
(newVal, oldVal) => {
|
||||
if (newVal !== oldVal) {
|
||||
getMaterialList(newVal);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const onClickLeft = () => {
|
||||
router.push("/");
|
||||
};
|
||||
|
||||
const handleAdd = () => {
|
||||
showPopup.value = true;
|
||||
};
|
||||
|
||||
const onPopupClose = () => {
|
||||
showPopup.value = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.home {
|
||||
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.content .van-cell-group .van-cell {
|
||||
margin-bottom: 10px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
left: 16px;
|
||||
right: 16px;
|
||||
width: calc(100% - 32px);
|
||||
margin: 0 auto;
|
||||
border-radius: 24px;
|
||||
font-size: 16px;
|
||||
height: 44px;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.grid {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
display: inline-block;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
}
|
||||
.status-good {
|
||||
background-color: #07c160;
|
||||
}
|
||||
.status-warning {
|
||||
background-color: #ff976a;
|
||||
}
|
||||
.status-danger {
|
||||
background-color: #ee0a24;
|
||||
}
|
||||
</style>
|
||||
.home {
|
||||
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px 16px 80px 16px;
|
||||
}
|
||||
|
||||
.content .van-cell-group .van-cell {
|
||||
margin-bottom: 10px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
left: 16px;
|
||||
right: 16px;
|
||||
width: calc(100% - 32px);
|
||||
margin: 0 auto;
|
||||
border-radius: 24px;
|
||||
font-size: 16px;
|
||||
height: 44px;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.grid {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
display: inline-block;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
}
|
||||
.status-good {
|
||||
background-color: #07c160;
|
||||
}
|
||||
.status-warning {
|
||||
background-color: #ff976a;
|
||||
}
|
||||
.status-danger {
|
||||
background-color: #ee0a24;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -5,7 +5,7 @@ import Components from 'unplugin-vue-components/vite'
|
||||
import { VantResolver } from 'unplugin-vue-components/resolvers'
|
||||
|
||||
export default defineConfig({
|
||||
base: '/bxztapp/',
|
||||
// base: '/bxztapp/',
|
||||
plugins: [
|
||||
vue(),
|
||||
Components({
|
||||
@ -26,6 +26,7 @@ export default defineConfig({
|
||||
'/snow-ops-platform': {
|
||||
target: 'http://8.137.54.85:8661/',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/snow-ops-platform/, ''),
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
@ -6,7 +6,7 @@ import vue from '@vitejs/plugin-vue'
|
||||
import { resolve } from 'path'
|
||||
|
||||
export default defineConfig({
|
||||
base: '/bxztpc/',
|
||||
// base: '/bxztpc/',
|
||||
plugins: [
|
||||
vue(),
|
||||
AutoImport({
|
||||
@ -30,6 +30,7 @@ export default defineConfig({
|
||||
'/snow-ops-platform': {
|
||||
target: 'http://8.137.54.85:8661/',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/snow-ops-platform/, '')
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user