Compare commits

..

2 Commits

12 changed files with 1094 additions and 481 deletions

View File

@ -14,22 +14,22 @@ const routes = [
{
path: '/equipManage/:data',
name: 'EquipManage',
component: () => import('../views/EquipmentManagement.vue')
component: () => import('../views/Equipment/EquipmentManagement.vue')
},
{
path: '/materialManage',
name: 'MaterialManage',
component: () => import('../views/MaterialManagement.vue')
component: () => import('../views//Material/MaterialManagement.vue')
},
{
path: '/staffManage',
name: 'StaffManage',
component: () => import('../views/StaffManagement.vue')
component: () => import('../views//Staff/StaffManagement.vue')
},
{
path: '/equipDetail/:data',
name: 'EquipDetail',
component: () => import('../views/EquipmentDetails.vue')
component: () => import('../views//Equipment/EquipmentDetails.vue')
},
]

View File

@ -0,0 +1,860 @@
<template>
<div class="home">
<van-nav-bar title="设备管理" fixed left-arrow @click-left="onClickLeft" />
<van-cell-group>
<van-cell title="当前站点" :value="equipmentInfo.sbwz" />
</van-cell-group>
<div class="content">
<van-cell-group>
<van-cell
title="设备信息"
style="font-size: 18px; font-weight: bold; line-height: inherit"
>
<template #value>
<span :class="[
'status-tag',
`status-` +
(equipmentDetailInfo.sbzt === '完好'
? 'good'
: equipmentDetailInfo.sbzt === '损坏'
? 'warning'
: 'danger'),
]">{{
equipmentDetailInfo.sbzt
}}</span>
</template>
</van-cell>
<van-cell :title="'设备名称: ' + equipmentDetailInfo.sbmc"> </van-cell>
<van-cell :title="'设备大类: ' + equipmentDetailInfo.sbdl"> </van-cell>
<van-cell :title="'设备类型: ' + equipmentDetailInfo.sblx"> </van-cell>
<van-cell :title="'设备编号: ' + equipmentDetailInfo.sbbh"> </van-cell>
<van-cell :title="'设备型号: ' + equipmentDetailInfo.sbxh"> </van-cell>
<van-cell :title="'设备位置: ' + equipmentDetailInfo.sbwz"> </van-cell>
<van-cell :title="'设备经纬度: '">
<template #label>
<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>
<van-cell :title="'所属服务站: '+ equipmentDetailInfo.sbwz"> </van-cell>
</van-cell-group>
</div>
<van-tabbar>
<van-tabbar-item>
<van-popover
placement="top-start"
:show="showPopover"
:actions="actions"
@select="onSelect"
>
<template #reference>
<van-button type="primary" style="width: 80px; border-radius: 10px">
更多
</van-button>
</template>
</van-popover>
</van-tabbar-item>
<van-tabbar-item
><template #default>
<van-button
type="warning"
style="width: 80px; border-radius: 10px"
@click="onBrokenPopupOpen"
>
损坏
</van-button>
</template></van-tabbar-item
>
<van-tabbar-item
><template #default>
<van-button type="primary" style="width: 80px; border-radius: 10px"
@click="onEditPopupOpen">
编辑
</van-button>
</template></van-tabbar-item
>
<van-tabbar-item
><template #default>
<van-button
type="primary"
style="width: 80px; border-radius: 10px"
@click="onRemarkPopupOpen"
>
备注
</van-button>
</template></van-tabbar-item
>
</van-tabbar>
<van-popup
:show="showRemarkPopup"
position="bottom"
closeable
close-on-click-overlay
:style="{ height: '20%' }"
@close="onRemarkPopupClose"
>
</van-popup>
<van-popup
:show="showDeletePopup"
position="bottom"
closeable
close-on-click-overlay
:style="{ height: '20%' }"
@close="onDeletePopupClose"
>
<div
style="
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 0 16px;
"
>
<h1
style="
margin: 0 0 20px 0;
font-size: 18px;
color: #333;
text-align: center;
"
>
确认删除
</h1>
<div style="display: flex; gap: 20px; width: 100%">
<van-button
type="default"
style="flex: 1; border-radius: 8px"
@click="onDeletePopupClose"
>
取消
</van-button>
<van-button
type="primary"
style="flex: 1; border-radius: 8px"
@click="onDeleteConfirm"
>
确认
</van-button>
</div>
</div>
</van-popup>
<van-popup
:show="showBrokenPopup"
position="bottom"
closeable
close-on-click-overlay
:style="{ height: '20%' }"
@close="onBrokenPopupClose"
>
</van-popup>
<van-popup
:show="show报废Popup"
position="bottom"
closeable
close-on-click-overlay
:style="{ height: '30%' }"
@close="on报废PopupClose"
>
<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="scrapReason"
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="on报废PopupClose"
>
取消
</van-button>
<van-button
type="primary"
style="flex: 1; border-radius: 8px"
@click="on报废Confirm"
>
确认
</van-button>
</div>
</div>
</van-popup>
<van-popup
:show="showEditPopup"
position="bottom"
closeable
close-on-click-overlay
:style="{ height: '80%' }"
@close="onEditPopupClose"
>
<van-form class="device-form" label-align="left" colon>
<h3>编辑设备信息</h3>
<!-- 设备名称 -->
<van-field
v-model="editForm.sbmc"
label="设备名称"
placeholder="请输入设备名称"
:rules="[{ required: true, message: '请填写设备名称' }]"
/>
<!-- 设备大类 -->
<van-field
v-model="editForm.sbdl"
is-link
arrow-direction="down"
label="设备大类"
placeholder="请选择设备大类"
@click="showCategoryPicker = true"
ref="categoryField"
/>
<!-- 设备类型 -->
<van-field
v-model="editForm.sblx"
is-link
arrow-direction="down"
label="设备类型"
placeholder="请选择设备类型"
@click="showTypePicker = true"
ref="typeField"
/>
<!-- 设备编号 -->
<van-field
v-model="editForm.sbbh"
label="设备编号"
placeholder="请输入设备编号"
:rules="[{ required: true, message: '请填写设备编号' }]"
/>
<!-- 设备型号 -->
<van-field
v-model="editForm.sbxh"
label="设备型号"
placeholder="请输入设备型号"
:rules="[{ required: true, message: '请填写设备型号' }]"
/>
<!-- 经纬度 -->
<van-field
v-model="editForm.jd"
label="设备经度"
placeholder="请输入经度"
type="number"
/>
<van-field
v-model="editForm.wd"
label="设备纬度"
placeholder="请输入纬度"
type="number"
/>
<!-- 管理人员 -->
<van-field
v-model="editForm.glry"
is-link
arrow-direction="down"
readonly
label="管理人员"
placeholder="请选择设备管理人员"
@click="showAdminPicker = true"
/>
<!-- 操作员 -->
<van-field
v-model="editForm.czy"
is-link
arrow-direction="down"
readonly
label="操作员"
placeholder="请选择操作员"
@click="showOperatorPicker = true"
/>
<!-- 购买费用 -->
<van-field
v-model="editForm.gmfy"
type="number"
label="购买费用(万元)"
placeholder="请输入购买费用"
/>
<!-- 购置日期 -->
<van-field
v-model="editForm.gzrq"
is-link
arrow-direction="down"
readonly
label="购置日期"
placeholder="请选择日期"
@click="showTimePicker = true"
/>
<!-- 设备状态 -->
<van-field
v-model="editForm.sbzt"
is-link
arrow-direction="down"
readonly
label="设备状态"
placeholder="请选择设备状态"
@click="showStatusPicker = true"
/>
<!-- 生产厂家 -->
<van-field
v-model="editForm.sccj"
label="生产厂家"
placeholder="请输入生产厂家"
/>
<!-- 是否应急设备 -->
<van-field
v-model="editForm.sfyjsb"
is-link
arrow-direction="down"
readonly
label="是否应急设备"
placeholder="请选择"
@click="showEmergencyPicker = true"
/>
<!-- 是否纳入市级补助范围 -->
<van-field
v-model="editForm.sfnrsjbz"
is-link
arrow-direction="down"
readonly
label="是否纳入市级补助范围"
placeholder="请选择"
@click="showSubsidyPicker = true"
/>
<!-- 辐射范围 -->
<van-field
v-model="editForm.fsfw"
label="辐射范围"
placeholder="请输入辐射范围"
/>
<!-- 选择器弹窗 -->
<!-- 设备大类弹窗 -->
<van-popup
:show="showCategoryPicker"
round
position="bottom"
close-on-click-overlay
@close="showCategoryPicker = false"
>
<van-picker
title="选择设备大类"
:columns="categoryOptions"
@confirm="onCategoryConfirm"
@cancel="showCategoryPicker = false"
/>
</van-popup>
<!-- 设备类型弹窗 -->
<van-popup
:show="showTypePicker"
round
position="bottom"
close-on-click-overlay
@close="showTypePicker = false"
>
<van-picker
title="选择设备类型"
:columns="typeOptions"
@confirm="onTypeConfirm"
@cancel="showTypePicker = false"
/>
</van-popup>
<!-- 设备管理员弹窗 -->
<van-popup
:show="showAdminPicker"
round
position="bottom"
close-on-click-overlay
@close="showAdminPicker = false"
>
<van-picker
title="选择设备管理员"
:columns="adminOptions"
@confirm="onAdminConfirm"
@cancel="showAdminPicker = false"
/>
</van-popup>
<!-- 操作员弹窗 -->
<van-popup
:show="showOperatorPicker"
round
position="bottom"
close-on-click-overlay
@close="showOperatorPicker = false"
>
<van-picker
title="选择操作员"
:columns="operatorOptions"
@confirm="operatorConfirm"
@cancel="showOperatorPicker = false"
/>
</van-popup>
<!-- 购置日期弹窗 -->
<van-popup
:show="showTimePicker"
round
position="bottom"
close-on-click-overlay
@close="showTimePicker = false"
>
<van-date-picker
v-model="currentDate"
title="选择购置日期"
@confirm="onDateConfirm"
@cancel="showTimePicker = false"
/>
</van-popup>
<!-- 设备状态弹窗 -->
<van-popup
:show="showStatusPicker"
round
position="bottom"
close-on-click-overlay
@close="showStatusPicker = false"
>
<van-picker
title="选择设备状态"
:columns="statusOptions"
@confirm="onStatusConfirm"
@cancel="showStatusPicker = false"
/>
</van-popup>
<!-- 是否应急设备弹窗 -->
<van-popup
:show="showEmergencyPicker"
round
position="bottom"
close-on-click-overlay
@close="showEmergencyPicker = false"
>
<van-picker
title="是否应急设备"
:columns="emergencyOptions"
@confirm="onEmergencyConfirm"
@cancel="showEmergencyPicker = false"
/>
</van-popup>
<!-- 是否纳入市级补助范围弹窗 -->
<van-popup
:show="showSubsidyPicker"
round
position="bottom"
close-on-click-overlay
@close="showSubsidyPicker = false"
>
<van-picker
title="是否纳入市级补助"
:columns="subsidyOptions"
@confirm="onSubsidyConfirm"
@cancel="showSubsidyPicker = false"
/>
</van-popup>
</van-form>
<div
style="
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 16px;
background: white;
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
z-index: 100;
"
>
<van-button
round
block
type="primary"
native-type="submit"
@click="onEditSubmit"
>
保存
</van-button>
</div>
</van-popup>
</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 showPopover = ref(false);
const actions = [{ text: "删除" }, { text: "报废" }];
const onSelect = (action) => {
if (action.text === "删除") {
showDeletePopup.value = true;
}
if (action.text === "报废") {
show报废Popup.value = true;
}
};
const equipmentInfo = ref({});
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 });
}
};
onMounted(() => {
equipmentInfo.value = JSON.parse(decodeURIComponent(route.params.data));
console.log("equipmentInfo", toRaw(equipmentInfo.value));
getEquipmentDetailInfo();
});
const onClickLeft = () => {
router.push({
name: "EquipManage",
params: { data: encodeURIComponent(JSON.stringify(equipmentInfo.value)) },
});
};
const show报废Popup = ref(false);
const scrapReason = ref(''); //
const on报废PopupClose = () => {
show报废Popup.value = false;
scrapReason.value = '';
};
const on报废Confirm = () => {
show报废Popup.value = false;
scrapReason.value = '';
};
const showBrokenPopup = ref(false);
const onBrokenPopupOpen = () => {
showBrokenPopup.value = true;
};
const onBrokenPopupClose = () => {
showBrokenPopup.value = false;
};
const showDeletePopup = ref(false);
const onDeletePopupClose = () => {
showDeletePopup.value = false;
};
const onDeleteConfirm = async () => {
try {
showLoadingToast({
message: "删除中...",
forbidClick: true,
loadingType: "spinner",
});
const res = await request({
url: `/snow-ops-platform/yjsb/delete`,
method: "POST",
data: {
rid : equipmentDetailInfo.value.rid
}
});
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)
}
showDeletePopup.value = false;
};
const showRemarkPopup = ref(false);
const onRemarkPopupOpen = () => {
showRemarkPopup.value = true;
};
const onRemarkPopupClose = () => {
showRemarkPopup.value = false;
};
const showEditPopup = ref(false)
//
const editForm = reactive({})
//
const onEditPopupOpen = () => {
Object.assign(editForm, equipmentDetailInfo.value);
showEditPopup.value = true
}
//
const onEditPopupClose = () => {
showEditPopup.value = false
}
const showCategoryPicker = ref(false);
const showTypePicker = ref(false);
const categoryField = ref(null);
const typeField = ref(null);
const categoryOptions = [
{ text: "自定义", value: "自定义" },
{ text: "大中修工程设备", value: "大中修工程设备" },
{ text: "小修保养设备", value: "小修保养设备" },
{ text: "交通工具", value: "交通工具" },
];
const typeOptions = [
{ text: "自定义", value: "自定义" },
{ text: "装载机", value: "装载机" },
{ text: "路面修补设备", value: "路面修补设备" },
{ text: "清扫车", value: "清扫车" },
{ text: "压路机", value: "压路机" },
{ text: "洒水车", value: "洒水车" },
{ text: "挖掘机", value: "挖掘机" },
{ text: "运输货车", value: "运输货车" },
{ text: "灌缝设备", value: "灌缝设备" },
{ text: "应急抢险车", value: "应急抢险车" },
{ text: "应急巡查车", value: "应急巡查车" },
{ text: "高空作业车", value: "高空作业车" },
{ text: "除雪设备", value: "除雪设备" },
{ text: "照明设备", value: "照明设备" },
{ text: "护栏维修设备", value: "护栏维修设备" },
{ text: "标线设备", value: "标线设备" },
{ text: "绿化修剪设备", value: "绿化修剪设备" },
{ text: "桥梁维护设备", value: "桥梁维护设备" },
{ text: "发电机", value: "发电机" },
{ text: "沥青洒布车", value: "沥青洒布车" },
{ text: "拖车", value: "拖车" },
{ text: "摊铺机", value: "摊铺机" },
{ text: "抽水设备", value: "抽水设备" },
{ text: "沥青拌和站", value: "沥青拌和站" },
{ text: "水泥拌和机", value: "水泥拌和机" },
{ text: "平地机", value: "平地机" },
{ text: "除雾设备", value: "除雾设备" },
{ text: "无人机", value: "无人机" },
{ text: "推土机", value: "推土机" },
{ text: "稀浆封层设备", value: "稀浆封层设备" },
];
const onCategoryConfirm = (value) => {
if (value.selectedValues[0] === "自定义") {
showCategoryPicker.value = false;
categoryField.value.focus();
} else {
editForm.sbdl = value.selectedValues[0];
showCategoryPicker.value = false;
}
};
const onTypeConfirm = (value) => {
if (value.selectedValues[0] === "自定义") {
showTypePicker.value = false;
typeField.value.focus();
} else {
editForm.sblx = value.selectedValues[0];
showTypePicker.value = false;
}
};
//
const showAdminPicker = ref(false);
const adminOptions = [
{ text: "管理员1", value: "管理员1" },
{ text: "管理员2", value: "管理员2" },
{ text: "管理员3", value: "管理员3" },
];
const onAdminConfirm = (value) => {
editForm.glry = value.selectedValues[0];
showAdminPicker.value = false;
};
//
const showOperatorPicker = ref(false);
const operatorOptions = [
{ text: "操作员1", value: "操作员1" },
{ text: "操作员2", value: "操作员2" },
{ text: "操作员3", value: "操作员3" },
];
const operatorConfirm = (value) => {
editForm.czy = value.selectedValues[0];
showOperatorPicker.value = false;
};
//
const showTimePicker = ref(false);
const currentDate = ref([
new Date().getFullYear(),
new Date().getMonth() + 1,
new Date().getDate(),
]);
const onDateConfirm = ({ selectedValues }) => {
editForm.gzrq = selectedValues.join("-");
showTimePicker.value = false;
};
//
const showStatusPicker = ref(false);
const statusOptions = [
{ text: "完好", value: "完好" },
{ text: "损坏", value: "损坏" },
{ text: "报废", value: "报废" },
];
const onStatusConfirm = (value) => {
editForm.sbzt = value.selectedValues[0];
showStatusPicker.value = false;
};
//
const showEmergencyPicker = ref(false);
const emergencyOptions = [
{ text: "是", value: "是" },
{ text: "否", value: "否" },
];
const onEmergencyConfirm = (value) => {
editForm.sfyjsb = value.selectedValues[0];
showEmergencyPicker.value = false;
};
//
const showSubsidyPicker = ref(false);
const subsidyOptions = [
{ text: "是", value: "是" },
{ text: "否", value: "否" },
];
const onSubsidyConfirm = (value) => {
editForm.sfnrsjbz = value.selectedValues[0];
showSubsidyPicker.value = false;
};
//
const onEditSubmit = async () => {
try {
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)
}
} catch (error) {
showToast({ type: 'fail', message: error.message || '修改失败' })
console.log('error',error)
}
}
</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;
}
.device-form{
padding: 16px 16px 80px 16px;
}
</style>

View File

@ -65,8 +65,8 @@
<!-- 表单部分 -->
<van-form
class="device-form"
@submit="handleSubmit"
style="padding-bottom: 80px"
label-align="left"
colon
>
<h3>设备信息</h3>
@ -87,10 +87,10 @@
v-model="form.sbdl"
is-link
arrow-direction="down"
readonly
label="设备大类"
placeholder="请选择设备大类"
@click="showCategoryPicker = true"
ref="categoryField"
/>
<!-- 设备类型 -->
@ -98,10 +98,18 @@
v-model="form.sblx"
is-link
arrow-direction="down"
readonly
label="设备类型"
placeholder="请选择设备类型"
@click="showTypePicker = true"
ref="typeField"
/>
<!-- 设备编号 -->
<van-field
v-model="form.sbbh"
label="设备编号"
placeholder="请输入设备编号"
:rules="[{ required: true, message: '请填写设备编号' }]"
/>
<!-- 设备型号 -->
@ -117,7 +125,6 @@
v-model="form.jd"
label="设备经度"
placeholder="请输入设备经度"
:rules="[{ required: true, message: '请填写设备经度' }]"
/>
<!-- 设备纬度 -->
@ -125,7 +132,6 @@
v-model="form.wd"
label="设备纬度"
placeholder="请输入设备纬度"
:rules="[{ required: true, message: '请填写设备纬度' }]"
/>
<!-- 设备管理员 -->
@ -150,6 +156,14 @@
@click="showOperatorPicker = true"
/>
<!-- 购买费用 -->
<van-field
v-model="form.gmfy"
type="number"
label="购买费用(万元)"
placeholder="请输入购买费用"
/>
<!-- 购置日期 -->
<van-field
v-model="form.gzrq"
@ -201,6 +215,13 @@
@click="showSubsidyPicker = true"
/>
<!-- 辐射范围 -->
<van-field
v-model="form.fsfw"
label="辐射范围"
placeholder="请输入辐射范围"
/>
<!-- 选择器弹窗 -->
<!-- 设备大类弹窗 -->
<van-popup
@ -341,7 +362,13 @@
z-index: 100;
"
>
<van-button round block type="primary" native-type="submit">
<van-button
round
block
type="primary"
native-type="submit"
@click="handleSubmit"
>
保存
</van-button>
</div>
@ -349,11 +376,14 @@
</div>
</template>
<script setup>
<script setup>
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 } from "vant";
import { request } from "../../../shared/utils/request";
import { showToast, showLoadingToast } from "vant";
import { request } from "../../../../shared/utils/request";
const router = useRouter();
const route = useRoute();
@ -390,6 +420,8 @@ const form = reactive({ ...INIT_FORM }); // 表单
onMounted(() => {
detailData.value = JSON.parse(decodeURIComponent(route.params.data));
getEquipmentList();
form.yhzid = detailData.value.id || detailData.value.yhzid;
form.qxmc = detailData.value.qxmc;
});
watch(
@ -404,6 +436,10 @@ watch(
//
const getEquipmentList = async (sbmc) => {
try {
const yhzid = detailData.value.id || detailData.value.yhzid;
if (!yhzid) {
return;
}
const data = {
yhzid: detailData.value.id || detailData.value.yhzid,
sbmc: sbmc,
@ -411,7 +447,7 @@ const getEquipmentList = async (sbmc) => {
pageSize: 9999,
};
const res = await request({
url: "/api/yjsb/list",
url: "/snow-ops-platform/yjsb/list",
method: "get",
params: data,
});
@ -422,7 +458,10 @@ const getEquipmentList = async (sbmc) => {
}
} catch (error) {
console.log(error);
showToast(error.message || "获取设备列表失败");
showToast({
type: "error",
message: error.message || "获取设备列表失败",
});
}
};
@ -443,25 +482,67 @@ const onPopupClose = () => {
const showCategoryPicker = ref(false);
const showTypePicker = ref(false);
const categoryField = ref(null);
const typeField = ref(null);
const categoryOptions = [
{ text: "分类1", value: "分类1" },
{ text: "分类2", value: "分类2" },
{ text: "分类3", value: "分类3" },
{ text: "自定义", value: "自定义" },
{ text: "大中修工程设备", value: "大中修工程设备" },
{ text: "小修保养设备", value: "小修保养设备" },
{ text: "交通工具", value: "交通工具" },
];
const typeOptions = [
{ text: "分类1", value: "分类1" },
{ text: "分类2", value: "分类2" },
{ text: "分类3", value: "分类3" },
{ text: "自定义", value: "自定义" },
{ text: "装载机", value: "装载机" },
{ text: "路面修补设备", value: "路面修补设备" },
{ text: "清扫车", value: "清扫车" },
{ text: "压路机", value: "压路机" },
{ text: "洒水车", value: "洒水车" },
{ text: "挖掘机", value: "挖掘机" },
{ text: "运输货车", value: "运输货车" },
{ text: "灌缝设备", value: "灌缝设备" },
{ text: "应急抢险车", value: "应急抢险车" },
{ text: "应急巡查车", value: "应急巡查车" },
{ text: "高空作业车", value: "高空作业车" },
{ text: "除雪设备", value: "除雪设备" },
{ text: "照明设备", value: "照明设备" },
{ text: "护栏维修设备", value: "护栏维修设备" },
{ text: "标线设备", value: "标线设备" },
{ text: "绿化修剪设备", value: "绿化修剪设备" },
{ text: "桥梁维护设备", value: "桥梁维护设备" },
{ text: "发电机", value: "发电机" },
{ text: "沥青洒布车", value: "沥青洒布车" },
{ text: "拖车", value: "拖车" },
{ text: "摊铺机", value: "摊铺机" },
{ text: "抽水设备", value: "抽水设备" },
{ text: "沥青拌和站", value: "沥青拌和站" },
{ text: "水泥拌和机", value: "水泥拌和机" },
{ text: "平地机", value: "平地机" },
{ text: "除雾设备", value: "除雾设备" },
{ text: "无人机", value: "无人机" },
{ text: "推土机", value: "推土机" },
{ text: "稀浆封层设备", value: "稀浆封层设备" },
];
const onCategoryConfirm = (value) => {
form.value.category = value.selectedValues[0];
if (value.selectedValues[0] === "自定义") {
showCategoryPicker.value = false;
categoryField.value.focus();
} else {
form.sbdl = value.selectedValues[0];
showCategoryPicker.value = false;
}
};
const onTypeConfirm = (value) => {
form.value.type = value.selectedValues[0];
if (value.selectedValues[0] === "自定义") {
showTypePicker.value = false;
typeField.value.focus();
} else {
form.sblx = value.selectedValues[0];
showTypePicker.value = false;
}
};
//
const showAdminPicker = ref(false);
const adminOptions = [
@ -470,9 +551,10 @@ const adminOptions = [
{ text: "管理员3", value: "管理员3" },
];
const onAdminConfirm = (value) => {
form.value.admin = value.selectedValues[0];
form.glry = value.selectedValues[0];
showAdminPicker.value = false;
};
//
const showOperatorPicker = ref(false);
const operatorOptions = [
@ -481,7 +563,7 @@ const operatorOptions = [
{ text: "操作员3", value: "操作员3" },
];
const operatorConfirm = (value) => {
form.value.operator = value.selectedValues[0];
form.czy = value.selectedValues[0];
showOperatorPicker.value = false;
};
@ -492,9 +574,8 @@ const currentDate = ref([
new Date().getMonth() + 1,
new Date().getDate(),
]);
//
const onDateConfirm = ({ selectedValues }) => {
form.value.time = selectedValues.join("-");
form.gzrq = selectedValues.join("-");
showTimePicker.value = false;
};
@ -503,7 +584,7 @@ const showStatusPicker = ref(false);
const statusOptions = [
{ text: "完好", value: "完好" },
{ text: "损坏", value: "损坏" },
{ text: "故障", value: "故障" },
{ text: "报废", value: "报废" },
];
const onStatusConfirm = (value) => {
form.sbzt = value.selectedValues[0];
@ -520,6 +601,7 @@ const onEmergencyConfirm = (value) => {
form.sfyjsb = value.selectedValues[0];
showEmergencyPicker.value = false;
};
//
const showSubsidyPicker = ref(false);
const subsidyOptions = [
@ -531,13 +613,54 @@ const onSubsidyConfirm = (value) => {
showSubsidyPicker.value = false;
};
const handleSubmit = () => {
showToast("提交成功");
showPopup.value = false;
const handleSubmit = async () => {
try {
showLoadingToast({
message: "正在保存",
forbidClick: true,
loadingType: "spinner",
});
console.log("form", toRaw(form));
const res = await request({
url: "/snow-ops-platform/yjsb/add",
method: "post",
data: toRaw(form),
});
if (res.code && res.code === "00000") {
showToast({
type: "success",
message: "新增成功",
});
//
const keepData = {
yhzid: form.yhzid,
qxmc: form.qxmc,
};
//
Object.keys(INIT_FORM).forEach((key) => {
if (!["yhzid", "qxmc"].includes(key)) {
form[key] = INIT_FORM[key];
}
});
//
Object.assign(form, keepData);
onPopupClose();
getEquipmentList(searchValue.value);
} else {
throw new Error(res.message);
}
} catch (error) {
console.log(error);
showToast({
type: "error",
message: error.message || "新增失败",
});
}
};
</script>
<style scoped>
<style scoped>
.home {
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
}
@ -590,7 +713,6 @@ const handleSubmit = () => {
}
.device-form {
padding: 16px;
padding: 16px 16px 80px 16px;
}
</style>

View File

@ -1,351 +0,0 @@
<template>
<div class="home">
<van-nav-bar title="设备管理" fixed left-arrow @click-left="onClickLeft" />
<van-cell-group>
<van-cell title="当前站点" :value="equipmentInfo.sbwz" />
</van-cell-group>
<div class="content">
<van-cell-group>
<van-cell
title="设备信息"
style="font-size: 18px; font-weight: bold; line-height: inherit"
>
<template #value>
<span :class="[
'status-tag',
`status-` +
(equipmentDetailInfo.sbzt === '完好'
? 'good'
: equipmentDetailInfo.sbzt === '损坏'
? 'warning'
: 'danger'),
]">{{
equipmentDetailInfo.sbzt
}}</span>
</template>
</van-cell>
<van-cell :title="'设备名称: ' + equipmentDetailInfo.sbmc"> </van-cell>
<van-cell :title="'设备大类: ' + equipmentDetailInfo.sbdl"> </van-cell>
<van-cell :title="'设备类型: ' + equipmentDetailInfo.sblx"> </van-cell>
<van-cell :title="'设备编号: ' + equipmentDetailInfo.sbbh"> </van-cell>
<van-cell :title="'设备型号: ' + equipmentDetailInfo.sbxh"> </van-cell>
<van-cell :title="'设备位置: ' + equipmentDetailInfo.sbwz"> </van-cell>
<van-cell :title="'设备经纬度: '">
<template #label>
<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>
<van-cell :title="'所属服务站: '+ equipmentDetailInfo.sbwz"> </van-cell>
</van-cell-group>
</div>
<van-tabbar>
<van-tabbar-item>
<van-popover
placement="top-start"
:show="showPopover"
:actions="actions"
@select="onSelect"
>
<template #reference>
<van-button type="primary" style="width: 80px; border-radius: 10px">
更多
</van-button>
</template>
</van-popover>
</van-tabbar-item>
<van-tabbar-item
><template #default>
<van-button
type="warning"
style="width: 80px; border-radius: 10px"
@click="onBrokenPopupOpen"
>
损坏
</van-button>
</template></van-tabbar-item
>
<van-tabbar-item
><template #default>
<van-button type="primary" style="width: 80px; border-radius: 10px">
编辑
</van-button>
</template></van-tabbar-item
>
<van-tabbar-item
><template #default>
<van-button
type="primary"
style="width: 80px; border-radius: 10px"
@click="onRemarkPopupOpen"
>
备注
</van-button>
</template></van-tabbar-item
>
</van-tabbar>
<van-popup
:show="showRemarkPopup"
position="bottom"
closeable
close-on-click-overlay
:style="{ height: '20%' }"
@close="onRemarkPopupClose"
>
</van-popup>
<van-popup
:show="showDeletePopup"
position="bottom"
closeable
close-on-click-overlay
:style="{ height: '20%' }"
@close="onDeletePopupClose"
>
<div
style="
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 0 16px;
"
>
<h1
style="
margin: 0 0 20px 0;
font-size: 18px;
color: #333;
text-align: center;
"
>
确认删除
</h1>
<div style="display: flex; gap: 20px; width: 100%">
<van-button
type="default"
style="flex: 1; border-radius: 8px"
@click="onDeletePopupClose"
>
取消
</van-button>
<van-button
type="primary"
style="flex: 1; border-radius: 8px"
@click="onDeleteConfirm"
>
确认
</van-button>
</div>
</div>
</van-popup>
<van-popup
:show="showBrokenPopup"
position="bottom"
closeable
close-on-click-overlay
:style="{ height: '20%' }"
@close="onBrokenPopupClose"
>
</van-popup>
<van-popup
:show="show报废Popup"
position="bottom"
closeable
close-on-click-overlay
:style="{ height: '30%' }"
@close="on报废PopupClose"
>
<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="scrapReason"
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="on报废PopupClose"
>
取消
</van-button>
<van-button
type="primary"
style="flex: 1; border-radius: 8px"
@click="on报废Confirm"
>
确认
</van-button>
</div>
</div>
</van-popup>
</div>
</template>
<script setup>
import { ref, onMounted, toRaw } from "vue";
import { useRouter, useRoute } from "vue-router";
import { showToast } from "vant";
import { request } from "../../../shared/utils/request";
const router = useRouter();
const route = useRoute();
const showPopover = ref(false);
const actions = [{ text: "删除" }, { text: "报废" }];
const onSelect = (action) => {
if (action.text === "删除") {
showDeletePopup.value = true;
}
if (action.text === "报废") {
show报废Popup.value = true;
}
};
const equipmentInfo = ref({});
const equipmentDetailInfo = ref({});
//
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(() => {
equipmentInfo.value = JSON.parse(decodeURIComponent(route.params.data));
console.log("equipmentInfo", toRaw(equipmentInfo.value));
getEquipmentDetailInfo();
});
const onClickLeft = () => {
router.push({
name: "EquipManage",
params: { data: encodeURIComponent(JSON.stringify(equipmentInfo.value)) },
});
};
const show报废Popup = ref(false);
const scrapReason = ref(''); //
const on报废PopupClose = () => {
show报废Popup.value = false;
scrapReason.value = '';
};
const on报废Confirm = () => {
show报废Popup.value = false;
scrapReason.value = '';
};
const showBrokenPopup = ref(false);
const onBrokenPopupOpen = () => {
showBrokenPopup.value = true;
};
const onBrokenPopupClose = () => {
showBrokenPopup.value = false;
};
const showDeletePopup = ref(false);
const onDeletePopupClose = () => {
showDeletePopup.value = false;
};
const onDeleteConfirm = () => {
showDeletePopup.value = false;
};
const showRemarkPopup = ref(false);
const onRemarkPopupOpen = () => {
showRemarkPopup.value = true;
};
const onRemarkPopupClose = () => {
showRemarkPopup.value = false;
};
</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>

View File

@ -30,6 +30,8 @@
</template>
<script setup>
import 'vant/es/toast/style';
import 'vant/es/popup/style';
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { showToast } from "vant";
@ -43,7 +45,7 @@ const detailData = ref({});
const getYHZDetail = async () => {
try {
const res = await request({
url: `/api/yhz/${53}`, // id53
url: `/snow-ops-platform/yhz/getById?id=${53}`, // id53
method: "GET",
});
if (res.code && res.code === "00000") {

View File

@ -23,7 +23,7 @@ export default defineConfig({
host: '0.0.0.0',
open: true,
proxy: {
'/api': {
'/snow-ops-platform': {
target: 'http://8.137.54.85:8661/',
changeOrigin: true,
},

View File

@ -96,7 +96,7 @@ const filterNode = (value, node) => {
const getTreeData = async () => {
try {
const res = await request({
url: '/api/yhz/listAreaGroup',
url: '/snow-ops-platform/yhz/listAreaGroup',
method: 'GET'
})
if (res.code === '00000') {
@ -106,7 +106,7 @@ const getTreeData = async () => {
type: 'area',
children: sites.map(site => ({
id: site.id,
name: site.mc,
name: `${site.mc}(${site.sbsl})`,
type: 'site'
})),
rawName: areaName // 原始名称
@ -155,7 +155,7 @@ const getyhzsbList = async (qxmc, yhzid, filterData) => {
pageSize: pagination.pageSize,
}
const res = await request({
url: '/api/yjsb/list',
url: '/snow-ops-platform/yjsb/list',
method: 'GET',
params: data,
})
@ -253,8 +253,11 @@ const columns = [
type: "warning",
});
const res = await request({
url: `/api/yjsb/${row.rid}`,
method: 'DELETE',
url: `/snow-ops-platform/yjsb/delete`,
method: 'POST',
data: {
rid: row.rid,
}
});
if (res.code === '00000') {
ElMessage.success('删除成功');
@ -280,8 +283,8 @@ const handleEdit = async () => {
await dialogRef?.value?.dynamicComponentRef?.formRef.validate();
console.log('form', toRaw(form))
const res = await request({
url: '/api/yjsb',
method: 'PUT',
url: '/snow-ops-platform/yjsb/update',
method: 'POST',
data: toRaw(form),
});
if (res.code === '00000') {
@ -302,7 +305,7 @@ const handleEdit = async () => {
const getDetailData = async (row) => {
try {
const res = await request({
url: `/api/yjsb/${row.rid}`,
url: `/snow-ops-platform/yjsb/getById?rid=${row.rid}`,
method: 'GET',
});
if (!res || res.code !== '00000') {
@ -371,7 +374,7 @@ const openAddEquipmentModel = () => {
try {
console.log('form', toRaw(form))
const res = await request({
url: '/api/yjsb',
url: '/snow-ops-platform/yjsb/add',
method: 'POST',
data: toRaw(form),
});

View File

@ -84,7 +84,7 @@ const filterNode = (value, node) => {
const getTreeData = async () => {
try {
const res = await request({
url: '/api/yhz/listAreaGroup',
url: '/snow-ops-platform/yhz/listAreaGroup',
method: 'GET'
})
if (res.code === '00000') {
@ -94,7 +94,7 @@ const getTreeData = async () => {
type: 'area',
children: sites.map(site => ({
id: site.id,
name: site.mc,
name: `${site.mc}(${site.wzsl})`,
type: 'site'
})),
rawName: areaName // 原始名称
@ -140,7 +140,7 @@ const getyhzwzList = async (qxmc, yhzid, filterData) => {
pageSize: pagination.pageSize,
}
const res = await request({
url: '/api/yjwz/list',
url: '/snow-ops-platform/yjwz/list',
method: 'GET',
params: data,
})
@ -242,8 +242,11 @@ const columns = [
type: "warning",
});
const res = await request({
url: `/api/yjwz/${row.rid}`,
method: 'DELETE',
url: `/snow-ops-platform/yjwz/delete`,
method: 'POST',
data: {
rid: row.rid,
}
});
if (res.code === '00000') {
ElMessage.success('删除成功');
@ -269,8 +272,8 @@ const handleEdit = async () => {
await dialogRef?.value?.dynamicComponentRef?.formRef.validate();
console.log('form', toRaw(form))
const res = await request({
url: '/api/yjwz',
method: 'PUT',
url: '/snow-ops-platform/yjwz/update',
method: 'POST',
data: toRaw(form),
});
if (res.code === '00000') {
@ -291,7 +294,7 @@ const handleEdit = async () => {
const getDetailData = async (row) => {
try {
const res = await request({
url: `/api/yjwz/${row.rid}`,
url: `/snow-ops-platform/yjwz/getById?rid=${row.rid}`,
method: 'GET',
});
if (!res || res.code !== '00000') {
@ -359,7 +362,7 @@ const openAddModel = () => {
try {
console.log('form', toRaw(form))
const res = await request({
url: '/api/yjwz',
url: '/snow-ops-platform/yjwz/add',
method: 'POST',
data: toRaw(form),
});

View File

@ -278,8 +278,8 @@ const handleEditConfirm = async () => {
try {
await editFormRef.value.validate();
const res = await request({
url: `/api/yhz`,
method: "PUT",
url: `/api/yhz/update`,
method: "POST",
data: toRaw(editForm),
});
if (res.code === "00000") {
@ -316,7 +316,7 @@ const handleAddConfirm = async () => {
try {
await editFormRef.value.validate();
const res = await request({
url: "/api/yhz",
url: "/api/yhz/add",
method: "POST",
data: toRaw(editForm),
});
@ -355,17 +355,23 @@ const handleSearch = () => {
const getDetailData = async (row) => {
try {
const res = await request({
url: `/api/yhz/${row.id}`,
url: `/snow-ops-platform/yhz/getById?id=${row.id}`,
method: "GET",
});
if (res.code === "00000") {
detailData.value = res.data;
return res.code;
} else {
detailData.value = {};
throw new Error(res.message);
}
} catch (error) {
ElMessage({
message: error.message,
type: "error",
});
console.log(error.message);
return -1;
}
};
@ -373,7 +379,7 @@ const getDetailData = async (row) => {
const getTableData = async () => {
try {
const res = await request({
url: "/api/yhz/list",
url: "/snow-ops-platform/yhz/list",
method: "GET",
params: {
...params,
@ -395,63 +401,26 @@ onMounted(() => {
getTableData();
});
const columns = [
{
prop: "mc",
label: "服务站名称",
},
{
prop: "sbsl",
label: "设备数量",
},
{
prop: "wzsl",
label: "物资数量",
},
{
prop: "rysl",
label: "人员数量",
},
{
prop: "qxmc",
label: "区县名称",
},
{
prop: "zdlx",
label: "站点类型",
},
{
prop: "lxbm",
label: "路线编码",
// minWidth: 160,
},
{
prop: "lczh",
label: "里程桩号",
},
{
prop: "xzdj",
label: "行政等级",
},
{
prop: "yjtll",
label: "机动车月交通流量",
},
{
prop: "jsdj",
label: "技术等级",
},
{
prop: "mc",
label: "服务保障点具体名称",
},
{
prop: "ssdw",
label: "产权隶属单位",
},
{
prop: "jd",
label: "经度",
},
{
prop: "wd",
label: "纬度",
},
{
prop: "cdzgs",
label: "充电桩根数",
},
{
prop: "sfdwkf",
label: "是否对外开放",
},
{
prop: "sfdwkfrc",
label: "对外开放的是否有如厕功能",
},
{
label: "操作",
fixed: "right",
@ -464,8 +433,10 @@ const columns = [
type: "primary",
link: true,
onClick: async () => {
await getDetailData(row);
const res = await getDetailData(row);
if (res === "00000") {
dialogVisible.value = true;
}
},
},
() => "详情"
@ -477,9 +448,11 @@ const columns = [
link: true,
style: "margin-left: 10px;",
onClick: async () => {
await getDetailData(row);
const res = await getDetailData(row);
if (res === "00000") {
isEdit.value = true;
openEditDialog(row);
}
},
},
() => "编辑"
@ -497,12 +470,13 @@ const columns = [
cancelButtonText: "取消",
type: "warning",
});
const res = await request({
url: `/api/yhz/${row.id}`,
method: "DELETE",
url: `/snow-ops-platform/yhz/delete`,
method: "POST",
data: {
id: row.id,
}
});
if (res.code === "00000") {
ElMessage.success("删除成功");
getTableData();

View File

@ -27,7 +27,7 @@ export default defineConfig({
open: true,
cors: true,
proxy: {
'/api': {
'/snow-ops-platform': {
target: 'http://8.137.54.85:8661/',
changeOrigin: true,
},