Browse Source

执法端-计划

dev-V1.0.1
庄锐波 5 months ago
parent
commit
b211b86f77
  1. 17
      zdxt-web-client/zdxt-efcode-enforcement-app/src/router/enforcement-app/enf-main-router.js
  2. 46
      zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/my/plan/cp_plan_edit.vue
  3. 62
      zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/my/plan/cp_plan_list.vue
  4. 5
      zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/my/plan/cp_plan_mine.vue
  5. 28
      zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/my/plan/cp_plan_other.vue

17
zdxt-web-client/zdxt-efcode-enforcement-app/src/router/enforcement-app/enf-main-router.js

@ -134,14 +134,29 @@ const routes = [
isKeepAlive: true,
},
},
// 执法端-计划列表
// 执法端-计划列表(嵌套路由:我的计划 / 其他计划)
{
path: "/enforcement/plan",
name: "cpPlanList",
component: () => import("@/views/enforcement/my/plan/cp_plan_list.vue"),
redirect: "/enforcement/plan/mine",
meta: {
isKeepAlive: false,
},
children: [
{
path: "mine",
name: "cpPlanMine",
component: () => import("@/views/enforcement/my/plan/cp_plan_mine.vue"),
meta: { isKeepAlive: false },
},
{
path: "other",
name: "cpPlanOther",
component: () => import("@/views/enforcement/my/plan/cp_plan_other.vue"),
meta: { isKeepAlive: false },
},
],
},
// pdf预览
{

46
zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/my/plan/cp_plan_edit.vue

@ -40,14 +40,15 @@
placeholder="请选择时间"
required
readonly
is-link
@click="showDatePicker = true"
:is-link="!isPrefillMode"
:disabled="isPrefillMode"
@click="!isPrefillMode && (showDatePicker = true)"
/>
<!-- 执行时段 -->
<van-field name="planTime" label="执行时段" required>
<van-field name="planTime" label="执行时段" required :disabled="isPrefillMode">
<template #input>
<van-radio-group v-model="form.planTime" direction="horizontal">
<van-radio-group v-model="form.planTime" direction="horizontal" :disabled="isPrefillMode">
<van-radio :name="1">上午</van-radio>
<van-radio :name="2">下午</van-radio>
<van-radio :name="3">其他</van-radio>
@ -83,8 +84,9 @@
placeholder="请选择企业"
required
readonly
is-link
@click="onOpenEnterprisePicker"
:is-link="!isPrefillMode"
:disabled="isPrefillMode"
@click="!isPrefillMode && onOpenEnterprisePicker()"
/>
<!-- 执法人员 -->
@ -114,9 +116,9 @@
</van-field>
<!-- 是否公开 -->
<van-field name="isPublic" label="是否公开" required>
<van-field name="isPublic" label="是否公开" required :disabled="isPrefillMode">
<template #input>
<van-radio-group v-model="form.isPublic" direction="horizontal">
<van-radio-group v-model="form.isPublic" direction="horizontal" :disabled="isPrefillMode">
<van-radio :name="1">是</van-radio>
<van-radio :name="0">否</van-radio>
</van-radio-group>
@ -124,9 +126,9 @@
</van-field>
<!-- 参与联合 -->
<van-field name="isUnion" label="参与联合" required>
<van-field name="isUnion" label="参与联合" required :disabled="isPrefillMode">
<template #input>
<van-radio-group v-model="form.isUnion" direction="horizontal">
<van-radio-group v-model="form.isUnion" direction="horizontal" :disabled="isPrefillMode">
<van-radio :name="1">是</van-radio>
<van-radio :name="0">否</van-radio>
</van-radio-group>
@ -256,6 +258,8 @@ const route = useRoute();
const {useCommon} = $globalStore;
const isEdit = computed(() => !!route.query.id);
// 是否为预填模式(从其他计划页面点击"添加计划"跳转过来)
const isPrefillMode = computed(() => !isEdit.value && !!route.query.prefillPlanDate);
const showNotice = ref(true);
const submitting = ref(false);
const showDatePicker = ref(false);
@ -359,8 +363,7 @@ const datePickerValue = ref([
// 日期显示文本
const planDateDisplay = computed(() => {
if (!form.value.planDate) return '';
const timeText = { 1: '上午', 2: '下午', 3: '其他' };
return form.value.planDate + ' ' + (timeText[form.value.planTime] || '');
return form.value.planDate;
});
// 如果是编辑模式,加载详情
@ -424,6 +427,12 @@ const applyPrefillParams = () => {
if (q.prefillEnterpriseNumber) {
form.value.enterpriseNumber = q.prefillEnterpriseNumber;
}
if (q.prefillIsPublic != null) {
form.value.isPublic = Number(q.prefillIsPublic);
}
if (q.prefillIsUnion != null) {
form.value.isUnion = Number(q.prefillIsUnion);
}
};
// 拉取最多人员数设置
@ -764,8 +773,17 @@ const doSubmit = () => {
(res) => {
submitting.value = false;
if (res.code === 200) {
showSuccessToast(isEdit.value ? '修改成功' : '提交成功');
setTimeout(() => router.back(), 800);
// 预填模式且带有目标计划ID,提交成功后跳回其他计划页并自动触发预约
const targetPlanId = route.query.prefillTargetPlanId;
if (isPrefillMode.value && targetPlanId) {
showSuccessToast('计划提交成功');
setTimeout(() => {
router.replace({ path: '/enforcement/plan/other', query: { autoReserveId: targetPlanId } });
}, 600);
} else {
showSuccessToast(isEdit.value ? '修改成功' : '提交成功');
setTimeout(() => router.back(), 800);
}
} else {
showToast(res.msg || '操作失败');
}

62
zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/my/plan/cp_plan_list.vue

@ -7,7 +7,7 @@
@click-left="onBack"
/>
<!-- Tab 切换 -->
<!-- Tab 切换(通过路由切换) -->
<van-tabs
v-model:active="activeTab"
title-active-color="#111"
@ -16,15 +16,17 @@
line-width="36px"
line-height="2px"
:border="false"
@change="onTabChange"
>
<van-tab title="我的计划" name="mine">
<cp-plan-mine @edit="onEdit" />
</van-tab>
<van-tab title="其他计划" name="other">
<cp-plan-other />
</van-tab>
<van-tab title="我的计划" name="mine" />
<van-tab title="其他计划" name="other" />
</van-tabs>
<!-- 子路由出口 -->
<div class="plan-content">
<router-view />
</div>
<!-- 悬浮新增按钮(仅我的计划Tab显示) -->
<div v-if="activeTab === 'mine'" class="add-btn" @click="onAdd">
<van-icon name="plus" size="22" color="#fff" />
@ -33,12 +35,27 @@
</template>
<script setup name="cpPlanList">
import { useRouter } from 'vue-router';
import CpPlanMine from './cp_plan_mine.vue';
import CpPlanOther from './cp_plan_other.vue';
import { useRouter, useRoute } from 'vue-router';
const router = useRouter();
const activeTab = ref('mine');
const route = useRoute();
// 根据当前路由计算激活的Tab
const activeTab = computed({
get() {
if (route.path.includes('/enforcement/plan/other')) return 'other';
return 'mine';
},
set() {}
});
// Tab切换时路由导航
const onTabChange = (name) => {
const targetPath = name === 'other' ? '/enforcement/plan/other' : '/enforcement/plan/mine';
if (route.path !== targetPath) {
router.replace(targetPath);
}
};
const onBack = () => {
router.back();
@ -47,10 +64,6 @@ const onBack = () => {
const onAdd = () => {
router.push({ path: '/enforcement/plan/edit' });
};
const onEdit = (item) => {
router.push({ path: '/enforcement/plan/edit', query: { id: item.id } });
};
</script>
<style lang="less" scoped>
@ -79,17 +92,13 @@ const onEdit = (item) => {
}
:deep(.van-tabs) {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
flex-shrink: 0;
}
:deep(.van-tabs__wrap) {
height: 54px;
background: #fff;
border-bottom: 1px solid #e4edf7;
flex-shrink: 0;
}
:deep(.van-tab) {
@ -100,16 +109,13 @@ const onEdit = (item) => {
font-weight: 600;
}
:deep(.van-tabs__content),
:deep(.van-tabs__track),
:deep(.van-tab__panel-wrapper),
:deep(.van-tab__panel) {
flex: 1;
min-height: 0;
height: 100%;
:deep(.van-tabs__content) {
display: none;
}
:deep(.van-tabs__content) {
.plan-content {
flex: 1;
min-height: 0;
overflow: hidden;
}

5
zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/my/plan/cp_plan_mine.vue

@ -208,9 +208,10 @@
<script setup name="cpPlanMine">
import { showConfirmDialog, showToast } from 'vant';
import { useRouter } from 'vue-router';
import { getPlanList, deletePlan } from '@/api/enforcement/plan';
const emit = defineEmits(['edit']);
const router = useRouter();
// 状态过滤
const filterStatus = ref(null);
@ -408,7 +409,7 @@ const fetchList = () => {
// 编辑
const onEditPlan = (item) => {
emit('edit', item);
router.push({ path: '/enforcement/plan/edit', query: { id: item.id } });
};
// 删除

28
zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/my/plan/cp_plan_other.vue

@ -134,10 +134,11 @@
<script setup name="cpPlanOther">
import { showSuccessToast, showDialog } from 'vant';
import { useRouter } from 'vue-router';
import { useRouter, useRoute } from 'vue-router';
import { getOtherPlanList, checkCanReserve, doReservePlan } from '@/api/enforcement/plan';
const router = useRouter();
const route = useRoute();
// 搜索相关
const searchForm = ref({
@ -260,6 +261,8 @@ const fetchList = () => {
} else {
pageNum.value++;
}
// 检查是否需要自动触发预约(从新增计划页提交后跳回)
checkAutoReserve();
} else {
finished.value = true;
}
@ -272,6 +275,26 @@ const fetchList = () => {
);
};
// 自动预约:从编辑页提交计划后跳回并带上 autoReserveId,自动触发预约流程
let autoReserveHandled = false;
const checkAutoReserve = () => {
if (autoReserveHandled) return;
const autoReserveId = route.query.autoReserveId;
if (!autoReserveId) return;
autoReserveHandled = true;
// 清除 URL 上的参数,防止刷新重复触发
router.replace({ path: route.path, query: {} });
// 从列表中找到对应的计划项
const targetItem = planList.value.find(item => String(item.id) === String(autoReserveId));
if (targetItem) {
// 直接触发预约流程(包含 checkCanReserve + 弹窗)
nextTick(() => onReservePlan(targetItem));
} else {
// 列表中未找到,直接用 id 发起预约校验
nextTick(() => onReservePlan({ id: autoReserveId }));
}
};
// 预约操作
const showReservePopup = ref(false);
const reserveMessage = ref('');
@ -318,6 +341,9 @@ const showCannotReserveDialog = (item, code, msg) => {
prefillEnterpriseName: item.enterpriseName || '',
prefillEnterpriseId: item.enterpriseId || '',
prefillEnterpriseNumber: item.enterpriseNumber || '',
prefillIsPublic: item.isPublic != null ? String(item.isPublic) : '1',
prefillIsUnion: item.isUnion != null ? String(item.isUnion) : '1',
prefillTargetPlanId: item.id || '',
}
});
}).catch(() => {});

Loading…
Cancel
Save