2026-04-07 17:56:06 +08:00
|
|
|
import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue";
|
|
|
|
|
import { request } from "@/utils/request";
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
2026-04-09 10:23:54 +08:00
|
|
|
import ExamineDialog from "./examineDialog.vue";
|
2026-04-09 16:12:48 +08:00
|
|
|
import RejectDialog from './rejectDialog.vue';
|
|
|
|
|
import { ElLoading } from 'element-plus'
|
2026-04-07 17:56:06 +08:00
|
|
|
|
|
|
|
|
const tableData = ref([]); // 表格数据
|
|
|
|
|
const modelVisible = ref(false); // 弹窗状态
|
|
|
|
|
const drawerVisible = ref(false); // 抽屉状态
|
|
|
|
|
// 弹窗内容
|
|
|
|
|
const model = reactive({
|
|
|
|
|
title: '',
|
|
|
|
|
content: null,
|
|
|
|
|
props: {},
|
|
|
|
|
onCancel: null,
|
|
|
|
|
onConfirm: null,
|
|
|
|
|
width: '',
|
2026-04-08 15:47:57 +08:00
|
|
|
footerPosition: null,
|
|
|
|
|
onCancelType: null,
|
|
|
|
|
onConfirmName: null,
|
|
|
|
|
onCancelName: null,
|
|
|
|
|
tagContent: null,
|
|
|
|
|
tagType: null,
|
2026-04-07 17:56:06 +08:00
|
|
|
});
|
|
|
|
|
const form = reactive({
|
|
|
|
|
});
|
|
|
|
|
// 抽屉内容
|
|
|
|
|
const drawer = reactive({
|
|
|
|
|
title: '',
|
|
|
|
|
content: null,
|
|
|
|
|
props: {},
|
|
|
|
|
onCancel: null,
|
|
|
|
|
onConfirm: null,
|
|
|
|
|
direction: 'rtl',
|
|
|
|
|
size: '50%'
|
|
|
|
|
});
|
|
|
|
|
const dialogRef = ref(null); // 弹窗实例
|
|
|
|
|
const drawerRef = ref(null); // 抽屉实例
|
|
|
|
|
|
2026-04-09 16:12:48 +08:00
|
|
|
// 第二个弹窗
|
|
|
|
|
const model2 = reactive({
|
|
|
|
|
title: '',
|
|
|
|
|
content: null,
|
|
|
|
|
props: {},
|
|
|
|
|
onCancel: null,
|
|
|
|
|
onConfirm: null,
|
|
|
|
|
width: '',
|
|
|
|
|
footerPosition: null,
|
|
|
|
|
onCancelType: null,
|
|
|
|
|
onConfirmName: null,
|
|
|
|
|
onCancelName: null,
|
|
|
|
|
tagContent: null,
|
|
|
|
|
tagType: null,
|
|
|
|
|
});
|
|
|
|
|
const modelVisible2 = ref(false);
|
|
|
|
|
const dialogRef2 = ref(null);
|
|
|
|
|
|
|
|
|
|
|
2026-04-07 17:56:06 +08:00
|
|
|
|
|
|
|
|
// 过滤条件
|
|
|
|
|
const filterData = reactive({
|
|
|
|
|
})
|
|
|
|
|
// 分页
|
|
|
|
|
const pagination = reactive({
|
|
|
|
|
current: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
total: 0,
|
|
|
|
|
pageSizes: [10, 20, 50],
|
|
|
|
|
layout: "prev, pager, next, jumper",
|
|
|
|
|
onChange: (page, pageSize) => {
|
|
|
|
|
pagination.current = page;
|
|
|
|
|
pagination.pageSize = pageSize;
|
|
|
|
|
getTableData(filterData);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2026-04-09 10:23:54 +08:00
|
|
|
// 获取项目列表
|
2026-04-09 16:12:48 +08:00
|
|
|
const getTableData = async (filterData = {}) => {
|
2026-04-07 17:56:06 +08:00
|
|
|
try {
|
2026-04-09 16:12:48 +08:00
|
|
|
// 过滤空字符串属性
|
|
|
|
|
const filteredParams = {};
|
|
|
|
|
Object.keys(filterData).forEach(key => {
|
|
|
|
|
if (filterData[key] !== '' && filterData[key] != null) {
|
|
|
|
|
filteredParams[key] = filterData[key];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2026-04-07 17:56:06 +08:00
|
|
|
const res = await request({
|
2026-04-09 10:23:54 +08:00
|
|
|
url: '/snow-ops-platform/recovery/list',
|
2026-04-07 17:56:06 +08:00
|
|
|
method: "GET",
|
|
|
|
|
params: {
|
2026-04-09 16:12:48 +08:00
|
|
|
...filteredParams,
|
|
|
|
|
submitTimeStart: filteredParams?.submitTimeStart ? filteredParams.submitTimeStart + `-01-01 00:00:00` : null,
|
2026-04-09 10:23:54 +08:00
|
|
|
pageNum: pagination.current,
|
|
|
|
|
pageSize: pagination.pageSize,
|
2026-04-07 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
})
|
2026-04-09 16:12:48 +08:00
|
|
|
if (res.code === '00000') {
|
|
|
|
|
tableData.value = res.data.records
|
|
|
|
|
}
|
2026-04-07 17:56:06 +08:00
|
|
|
} catch (error) {
|
2026-04-09 10:23:54 +08:00
|
|
|
console.error('获取项目列表失败:', error);
|
2026-04-07 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2026-04-09 16:12:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// 驳回项目
|
|
|
|
|
const rejectProject = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const loading = ElLoading.service({
|
|
|
|
|
lock: true,
|
|
|
|
|
text: '操作中',
|
|
|
|
|
background: 'rgba(0, 0, 0, 0.7)',
|
2026-04-07 17:56:06 +08:00
|
|
|
})
|
2026-04-09 16:12:48 +08:00
|
|
|
const res = await request({
|
|
|
|
|
url: '/snow-ops-platform/recovery/approve',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data: {
|
|
|
|
|
id: form.id,
|
|
|
|
|
approveLevel: 1,
|
|
|
|
|
isPass: false,
|
|
|
|
|
rejectReason: form.rejectReason,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
loading.close();
|
|
|
|
|
if (res.code === '00000') {
|
|
|
|
|
ElMessage.success('操作成功');
|
|
|
|
|
modelVisible.value = false;
|
|
|
|
|
modelVisible2.value = false;
|
|
|
|
|
getTableData(filterData);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
ElMessage.error('操作失败');
|
|
|
|
|
console.error('驳回项目失败:', error);
|
|
|
|
|
}
|
2026-04-07 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-04-09 10:23:54 +08:00
|
|
|
|
|
|
|
|
|
2026-04-07 17:56:06 +08:00
|
|
|
export default () => {
|
|
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
2026-04-09 16:12:48 +08:00
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
|
prop: "districtName",
|
|
|
|
|
label: "区县",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "routeNo",
|
|
|
|
|
label: "路线编码",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "disasterType",
|
|
|
|
|
label: "灾害类型",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "startStakeNo",
|
|
|
|
|
label: "起点桩号",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "endStakeNo",
|
|
|
|
|
label: "止点桩号",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "implementMileage",
|
|
|
|
|
label: "实施里程(公里)",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "technicalGrade",
|
|
|
|
|
label: "技术等级",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "totalInvestment",
|
|
|
|
|
label: "总投资金额(万元)",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "estimatedCost",
|
|
|
|
|
label: "投资估算(万元)",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "startTime",
|
|
|
|
|
label: "开工或预计开工时间",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "endTime",
|
|
|
|
|
label: "完工或预计完工时间",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "approvalStatus",
|
|
|
|
|
label: "审批状态",
|
|
|
|
|
formatter: (row) => {
|
|
|
|
|
const statusMap = {
|
|
|
|
|
0: '待审批',
|
|
|
|
|
1: '审批通过',
|
|
|
|
|
2: '审批驳回'
|
|
|
|
|
};
|
|
|
|
|
return statusMap[row.approvalStatus] || '未知状态';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: "updateTime",
|
|
|
|
|
label: "更新日期",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "操作",
|
|
|
|
|
fixed: "right",
|
|
|
|
|
width: 150,
|
|
|
|
|
render: (row) => () =>
|
|
|
|
|
h("div", { class: "action-btns" }, [
|
|
|
|
|
h(
|
|
|
|
|
ElButton,
|
|
|
|
|
{
|
|
|
|
|
type: "primary",
|
|
|
|
|
link: true,
|
|
|
|
|
onClick: async () => {
|
|
|
|
|
openExamineDialog(row);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
() => "审批"
|
|
|
|
|
),
|
|
|
|
|
h(
|
|
|
|
|
ElButton,
|
|
|
|
|
{
|
|
|
|
|
type: "primary",
|
|
|
|
|
link: true,
|
|
|
|
|
style: "margin-left: 10px;",
|
|
|
|
|
onClick: async () => {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
() => "详情"
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
// 打开审批弹窗
|
|
|
|
|
const openExamineDialog = async (row) => {
|
|
|
|
|
model.title = '项目审批';
|
|
|
|
|
Object.assign(form, row);
|
|
|
|
|
model.props = {
|
|
|
|
|
form: form,
|
|
|
|
|
};
|
|
|
|
|
model.content = ExamineDialog;
|
|
|
|
|
model.onCancel = () => {
|
|
|
|
|
model2.title = '驳回原因';
|
|
|
|
|
model2.props = {
|
|
|
|
|
form: form,
|
|
|
|
|
}
|
|
|
|
|
model2.content = RejectDialog;
|
|
|
|
|
model2.onCancel = () => {
|
|
|
|
|
modelVisible2.value = false;
|
|
|
|
|
}
|
|
|
|
|
model2.onConfirm = async () => {
|
|
|
|
|
await dialogRef2?.value?.dynamicComponentRef?.formRef.validate().then(async () => {
|
|
|
|
|
await rejectProject()
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
ElMessage.error('请处理表单中的错误项');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
model2.width = '30%'
|
|
|
|
|
model2.footerPosition = 'center'
|
|
|
|
|
model2.onConfirmName = '确定'
|
|
|
|
|
model2.onCancelName = '取消'
|
|
|
|
|
modelVisible2.value = true;
|
|
|
|
|
};
|
|
|
|
|
model.onConfirm = async () => {
|
|
|
|
|
await dialogRef?.value?.dynamicComponentRef?.formRef.validate().then(() => {
|
|
|
|
|
if (form.projectExpenseType === '自费重修') {
|
|
|
|
|
router.push({
|
|
|
|
|
name: 'projectAdd',
|
|
|
|
|
params: {
|
|
|
|
|
data: encodeURIComponent(JSON.stringify(form))
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
modelVisible.value = false;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
ElMessage.error('请处理表单中的错误项');
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
model.width = "50%"
|
|
|
|
|
model.footerPosition = 'flex-end'
|
|
|
|
|
model.onCancelType = 'danger'
|
|
|
|
|
model.onConfirmName = '审批通过'
|
|
|
|
|
model.onCancelName = '审批驳回'
|
|
|
|
|
// model.tagType = 'warning'
|
|
|
|
|
// model.tagContent = '测试'
|
|
|
|
|
modelVisible.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:23:54 +08:00
|
|
|
onMounted(() => {
|
|
|
|
|
getTableData();
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(filterData, (val) => {
|
|
|
|
|
getTableData(filterData);
|
|
|
|
|
}, { deep: true })
|
2026-04-07 17:56:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
tableData,
|
|
|
|
|
filterData,
|
|
|
|
|
pagination,
|
|
|
|
|
columns,
|
|
|
|
|
|
|
|
|
|
modelVisible,
|
|
|
|
|
model,
|
|
|
|
|
drawerVisible,
|
|
|
|
|
drawer,
|
|
|
|
|
dialogRef,
|
|
|
|
|
drawerRef,
|
2026-04-09 10:23:54 +08:00
|
|
|
openExamineDialog,
|
2026-04-09 16:12:48 +08:00
|
|
|
|
|
|
|
|
model2,
|
|
|
|
|
modelVisible2,
|
|
|
|
|
dialogRef2,
|
2026-04-07 17:56:06 +08:00
|
|
|
}
|
|
|
|
|
}
|