Compare commits
No commits in common. "c07d7912a933926320a5d4adb89cb4550023ce74" and "44b950fbdcb0f7abba00c49e309fd5baccbc4910" have entirely different histories.
c07d7912a9
...
44b950fbdc
@ -14,22 +14,22 @@ const routes = [
|
||||
{
|
||||
path: '/equipManage/:data',
|
||||
name: 'EquipManage',
|
||||
component: () => import('../views/Equipment/EquipmentManagement.vue')
|
||||
component: () => import('../views/EquipmentManagement.vue')
|
||||
},
|
||||
{
|
||||
path: '/materialManage',
|
||||
name: 'MaterialManage',
|
||||
component: () => import('../views//Material/MaterialManagement.vue')
|
||||
component: () => import('../views/MaterialManagement.vue')
|
||||
},
|
||||
{
|
||||
path: '/staffManage',
|
||||
name: 'StaffManage',
|
||||
component: () => import('../views//Staff/StaffManagement.vue')
|
||||
component: () => import('../views/StaffManagement.vue')
|
||||
},
|
||||
{
|
||||
path: '/equipDetail/:data',
|
||||
name: 'EquipDetail',
|
||||
component: () => import('../views//Equipment/EquipmentDetails.vue')
|
||||
component: () => import('../views/EquipmentDetails.vue')
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@ -1,860 +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"
|
||||
@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>
|
||||
|
||||
351
packages/mobile/src/views/EquipmentDetails.vue
Normal file
351
packages/mobile/src/views/EquipmentDetails.vue
Normal file
@ -0,0 +1,351 @@
|
||||
<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>
|
||||
|
||||
@ -65,8 +65,8 @@
|
||||
<!-- 表单部分 -->
|
||||
<van-form
|
||||
class="device-form"
|
||||
label-align="left"
|
||||
colon
|
||||
@submit="handleSubmit"
|
||||
style="padding-bottom: 80px"
|
||||
>
|
||||
<h3>设备信息</h3>
|
||||
|
||||
@ -87,10 +87,10 @@
|
||||
v-model="form.sbdl"
|
||||
is-link
|
||||
arrow-direction="down"
|
||||
readonly
|
||||
label="设备大类"
|
||||
placeholder="请选择设备大类"
|
||||
@click="showCategoryPicker = true"
|
||||
ref="categoryField"
|
||||
/>
|
||||
|
||||
<!-- 设备类型 -->
|
||||
@ -98,18 +98,10 @@
|
||||
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: '请填写设备编号' }]"
|
||||
/>
|
||||
|
||||
<!-- 设备型号 -->
|
||||
@ -125,6 +117,7 @@
|
||||
v-model="form.jd"
|
||||
label="设备经度"
|
||||
placeholder="请输入设备经度"
|
||||
:rules="[{ required: true, message: '请填写设备经度' }]"
|
||||
/>
|
||||
|
||||
<!-- 设备纬度 -->
|
||||
@ -132,6 +125,7 @@
|
||||
v-model="form.wd"
|
||||
label="设备纬度"
|
||||
placeholder="请输入设备纬度"
|
||||
:rules="[{ required: true, message: '请填写设备纬度' }]"
|
||||
/>
|
||||
|
||||
<!-- 设备管理员 -->
|
||||
@ -156,14 +150,6 @@
|
||||
@click="showOperatorPicker = true"
|
||||
/>
|
||||
|
||||
<!-- 购买费用 -->
|
||||
<van-field
|
||||
v-model="form.gmfy"
|
||||
type="number"
|
||||
label="购买费用(万元)"
|
||||
placeholder="请输入购买费用"
|
||||
/>
|
||||
|
||||
<!-- 购置日期 -->
|
||||
<van-field
|
||||
v-model="form.gzrq"
|
||||
@ -215,13 +201,6 @@
|
||||
@click="showSubsidyPicker = true"
|
||||
/>
|
||||
|
||||
<!-- 辐射范围 -->
|
||||
<van-field
|
||||
v-model="form.fsfw"
|
||||
label="辐射范围"
|
||||
placeholder="请输入辐射范围"
|
||||
/>
|
||||
|
||||
<!-- 选择器弹窗 -->
|
||||
<!-- 设备大类弹窗 -->
|
||||
<van-popup
|
||||
@ -362,13 +341,7 @@
|
||||
z-index: 100;
|
||||
"
|
||||
>
|
||||
<van-button
|
||||
round
|
||||
block
|
||||
type="primary"
|
||||
native-type="submit"
|
||||
@click="handleSubmit"
|
||||
>
|
||||
<van-button round block type="primary" native-type="submit">
|
||||
保存
|
||||
</van-button>
|
||||
</div>
|
||||
@ -376,14 +349,11 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import "vant/es/toast/style";
|
||||
import "vant/es/popup/style";
|
||||
<script setup>
|
||||
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 { showToast } from "vant";
|
||||
import { request } from "../../../shared/utils/request";
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
@ -420,8 +390,6 @@ 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(
|
||||
@ -436,10 +404,6 @@ 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,
|
||||
@ -447,7 +411,7 @@ const getEquipmentList = async (sbmc) => {
|
||||
pageSize: 9999,
|
||||
};
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yjsb/list",
|
||||
url: "/api/yjsb/list",
|
||||
method: "get",
|
||||
params: data,
|
||||
});
|
||||
@ -458,10 +422,7 @@ const getEquipmentList = async (sbmc) => {
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
showToast({
|
||||
type: "error",
|
||||
message: error.message || "获取设备列表失败",
|
||||
});
|
||||
showToast(error.message || "获取设备列表失败");
|
||||
}
|
||||
};
|
||||
|
||||
@ -482,67 +443,25 @@ const onPopupClose = () => {
|
||||
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: "交通工具" },
|
||||
{ text: "分类1", value: "分类1" },
|
||||
{ text: "分类2", value: "分类2" },
|
||||
{ text: "分类3", value: "分类3" },
|
||||
];
|
||||
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: "稀浆封层设备" },
|
||||
{ text: "分类1", value: "分类1" },
|
||||
{ text: "分类2", value: "分类2" },
|
||||
{ text: "分类3", value: "分类3" },
|
||||
];
|
||||
|
||||
const onCategoryConfirm = (value) => {
|
||||
if (value.selectedValues[0] === "自定义") {
|
||||
showCategoryPicker.value = false;
|
||||
categoryField.value.focus();
|
||||
} else {
|
||||
form.sbdl = value.selectedValues[0];
|
||||
showCategoryPicker.value = false;
|
||||
}
|
||||
form.value.category = value.selectedValues[0];
|
||||
showCategoryPicker.value = false;
|
||||
};
|
||||
const onTypeConfirm = (value) => {
|
||||
if (value.selectedValues[0] === "自定义") {
|
||||
showTypePicker.value = false;
|
||||
typeField.value.focus();
|
||||
} else {
|
||||
form.sblx = value.selectedValues[0];
|
||||
showTypePicker.value = false;
|
||||
}
|
||||
form.value.type = value.selectedValues[0];
|
||||
showTypePicker.value = false;
|
||||
};
|
||||
|
||||
// 设备管理员
|
||||
const showAdminPicker = ref(false);
|
||||
const adminOptions = [
|
||||
@ -551,10 +470,9 @@ const adminOptions = [
|
||||
{ text: "管理员3", value: "管理员3" },
|
||||
];
|
||||
const onAdminConfirm = (value) => {
|
||||
form.glry = value.selectedValues[0];
|
||||
form.value.admin = value.selectedValues[0];
|
||||
showAdminPicker.value = false;
|
||||
};
|
||||
|
||||
// 操作员
|
||||
const showOperatorPicker = ref(false);
|
||||
const operatorOptions = [
|
||||
@ -563,7 +481,7 @@ const operatorOptions = [
|
||||
{ text: "操作员3", value: "操作员3" },
|
||||
];
|
||||
const operatorConfirm = (value) => {
|
||||
form.czy = value.selectedValues[0];
|
||||
form.value.operator = value.selectedValues[0];
|
||||
showOperatorPicker.value = false;
|
||||
};
|
||||
|
||||
@ -574,8 +492,9 @@ const currentDate = ref([
|
||||
new Date().getMonth() + 1,
|
||||
new Date().getDate(),
|
||||
]);
|
||||
// 添加日期确认处理
|
||||
const onDateConfirm = ({ selectedValues }) => {
|
||||
form.gzrq = selectedValues.join("-");
|
||||
form.value.time = selectedValues.join("-");
|
||||
showTimePicker.value = false;
|
||||
};
|
||||
|
||||
@ -584,7 +503,7 @@ const showStatusPicker = ref(false);
|
||||
const statusOptions = [
|
||||
{ text: "完好", value: "完好" },
|
||||
{ text: "损坏", value: "损坏" },
|
||||
{ text: "报废", value: "报废" },
|
||||
{ text: "故障", value: "故障" },
|
||||
];
|
||||
const onStatusConfirm = (value) => {
|
||||
form.sbzt = value.selectedValues[0];
|
||||
@ -601,7 +520,6 @@ const onEmergencyConfirm = (value) => {
|
||||
form.sfyjsb = value.selectedValues[0];
|
||||
showEmergencyPicker.value = false;
|
||||
};
|
||||
|
||||
// 是否纳入市级补助相关
|
||||
const showSubsidyPicker = ref(false);
|
||||
const subsidyOptions = [
|
||||
@ -613,54 +531,13 @@ const onSubsidyConfirm = (value) => {
|
||||
showSubsidyPicker.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 || "新增失败",
|
||||
});
|
||||
}
|
||||
const handleSubmit = () => {
|
||||
showToast("提交成功");
|
||||
showPopup.value = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped>
|
||||
.home {
|
||||
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||
}
|
||||
@ -713,6 +590,7 @@ const handleSubmit = async () => {
|
||||
}
|
||||
|
||||
.device-form {
|
||||
padding: 16px 16px 80px 16px;
|
||||
padding: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
</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";
|
||||
@ -45,7 +43,7 @@ const detailData = ref({});
|
||||
const getYHZDetail = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yhz/getById?id=${53}`, // 假设获取的是id为53的养护站的详情
|
||||
url: `/api/yhz/${53}`, // 假设获取的是id为53的养护站的详情
|
||||
method: "GET",
|
||||
});
|
||||
if (res.code && res.code === "00000") {
|
||||
|
||||
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
host: '0.0.0.0',
|
||||
open: true,
|
||||
proxy: {
|
||||
'/snow-ops-platform': {
|
||||
'/api': {
|
||||
target: 'http://8.137.54.85:8661/',
|
||||
changeOrigin: true,
|
||||
},
|
||||
|
||||
@ -96,7 +96,7 @@ const filterNode = (value, node) => {
|
||||
const getTreeData = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yhz/listAreaGroup',
|
||||
url: '/api/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}(${site.sbsl})`,
|
||||
name: site.mc,
|
||||
type: 'site'
|
||||
})),
|
||||
rawName: areaName // 原始名称
|
||||
@ -155,7 +155,7 @@ const getyhzsbList = async (qxmc, yhzid, filterData) => {
|
||||
pageSize: pagination.pageSize,
|
||||
}
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjsb/list',
|
||||
url: '/api/yjsb/list',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
@ -253,11 +253,8 @@ const columns = [
|
||||
type: "warning",
|
||||
});
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yjsb/delete`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
rid: row.rid,
|
||||
}
|
||||
url: `/api/yjsb/${row.rid}`,
|
||||
method: 'DELETE',
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
ElMessage.success('删除成功');
|
||||
@ -283,8 +280,8 @@ const handleEdit = async () => {
|
||||
await dialogRef?.value?.dynamicComponentRef?.formRef.validate();
|
||||
console.log('form', toRaw(form))
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjsb/update',
|
||||
method: 'POST',
|
||||
url: '/api/yjsb',
|
||||
method: 'PUT',
|
||||
data: toRaw(form),
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
@ -305,7 +302,7 @@ const handleEdit = async () => {
|
||||
const getDetailData = async (row) => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yjsb/getById?rid=${row.rid}`,
|
||||
url: `/api/yjsb/${row.rid}`,
|
||||
method: 'GET',
|
||||
});
|
||||
if (!res || res.code !== '00000') {
|
||||
@ -374,7 +371,7 @@ const openAddEquipmentModel = () => {
|
||||
try {
|
||||
console.log('form', toRaw(form))
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjsb/add',
|
||||
url: '/api/yjsb',
|
||||
method: 'POST',
|
||||
data: toRaw(form),
|
||||
});
|
||||
|
||||
@ -84,7 +84,7 @@ const filterNode = (value, node) => {
|
||||
const getTreeData = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yhz/listAreaGroup',
|
||||
url: '/api/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}(${site.wzsl})`,
|
||||
name: site.mc,
|
||||
type: 'site'
|
||||
})),
|
||||
rawName: areaName // 原始名称
|
||||
@ -140,7 +140,7 @@ const getyhzwzList = async (qxmc, yhzid, filterData) => {
|
||||
pageSize: pagination.pageSize,
|
||||
}
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjwz/list',
|
||||
url: '/api/yjwz/list',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
@ -242,11 +242,8 @@ const columns = [
|
||||
type: "warning",
|
||||
});
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yjwz/delete`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
rid: row.rid,
|
||||
}
|
||||
url: `/api/yjwz/${row.rid}`,
|
||||
method: 'DELETE',
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
ElMessage.success('删除成功');
|
||||
@ -272,8 +269,8 @@ const handleEdit = async () => {
|
||||
await dialogRef?.value?.dynamicComponentRef?.formRef.validate();
|
||||
console.log('form', toRaw(form))
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjwz/update',
|
||||
method: 'POST',
|
||||
url: '/api/yjwz',
|
||||
method: 'PUT',
|
||||
data: toRaw(form),
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
@ -294,7 +291,7 @@ const handleEdit = async () => {
|
||||
const getDetailData = async (row) => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yjwz/getById?rid=${row.rid}`,
|
||||
url: `/api/yjwz/${row.rid}`,
|
||||
method: 'GET',
|
||||
});
|
||||
if (!res || res.code !== '00000') {
|
||||
@ -362,7 +359,7 @@ const openAddModel = () => {
|
||||
try {
|
||||
console.log('form', toRaw(form))
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjwz/add',
|
||||
url: '/api/yjwz',
|
||||
method: 'POST',
|
||||
data: toRaw(form),
|
||||
});
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="站点类型:" prop="zdlx">
|
||||
<el-select
|
||||
disabled
|
||||
disabled
|
||||
v-model="detailData.zdlx"
|
||||
placeholder="请选择站点类型"
|
||||
:options="zdlxOptions"
|
||||
@ -70,7 +70,7 @@
|
||||
<el-input disabled v-model="detailData.yjtll" />
|
||||
</el-form-item>
|
||||
<el-form-item label="技术等级:" prop="jsdj">
|
||||
<el-input disabled v-model="detailData.jsdj" />
|
||||
<el-input disabled v-model="detailData.jsdj" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:" prop="bz">
|
||||
<el-input disabled v-model="detailData.bz" type="textarea" />
|
||||
@ -278,8 +278,8 @@ const handleEditConfirm = async () => {
|
||||
try {
|
||||
await editFormRef.value.validate();
|
||||
const res = await request({
|
||||
url: `/api/yhz/update`,
|
||||
method: "POST",
|
||||
url: `/api/yhz`,
|
||||
method: "PUT",
|
||||
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/add",
|
||||
url: "/api/yhz",
|
||||
method: "POST",
|
||||
data: toRaw(editForm),
|
||||
});
|
||||
@ -355,23 +355,17 @@ const handleSearch = () => {
|
||||
const getDetailData = async (row) => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yhz/getById?id=${row.id}`,
|
||||
url: `/api/yhz/${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;
|
||||
}
|
||||
};
|
||||
|
||||
@ -379,7 +373,7 @@ const getDetailData = async (row) => {
|
||||
const getTableData = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/yhz/list",
|
||||
url: "/api/yhz/list",
|
||||
method: "GET",
|
||||
params: {
|
||||
...params,
|
||||
@ -401,26 +395,63 @@ 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",
|
||||
@ -433,10 +464,8 @@ const columns = [
|
||||
type: "primary",
|
||||
link: true,
|
||||
onClick: async () => {
|
||||
const res = await getDetailData(row);
|
||||
if (res === "00000") {
|
||||
dialogVisible.value = true;
|
||||
}
|
||||
await getDetailData(row);
|
||||
dialogVisible.value = true;
|
||||
},
|
||||
},
|
||||
() => "详情"
|
||||
@ -448,11 +477,9 @@ const columns = [
|
||||
link: true,
|
||||
style: "margin-left: 10px;",
|
||||
onClick: async () => {
|
||||
const res = await getDetailData(row);
|
||||
if (res === "00000") {
|
||||
isEdit.value = true;
|
||||
openEditDialog(row);
|
||||
}
|
||||
await getDetailData(row);
|
||||
isEdit.value = true;
|
||||
openEditDialog(row);
|
||||
},
|
||||
},
|
||||
() => "编辑"
|
||||
@ -470,13 +497,12 @@ const columns = [
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
});
|
||||
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yhz/delete`,
|
||||
method: "POST",
|
||||
data: {
|
||||
id: row.id,
|
||||
}
|
||||
url: `/api/yhz/${row.id}`,
|
||||
method: "DELETE",
|
||||
});
|
||||
|
||||
if (res.code === "00000") {
|
||||
ElMessage.success("删除成功");
|
||||
getTableData();
|
||||
|
||||
@ -27,7 +27,7 @@ export default defineConfig({
|
||||
open: true,
|
||||
cors: true,
|
||||
proxy: {
|
||||
'/snow-ops-platform': {
|
||||
'/api': {
|
||||
target: 'http://8.137.54.85:8661/',
|
||||
changeOrigin: true,
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user