明树Git Lab

Commit c5950ad7 authored by zhanghan's avatar zhanghan

信息化建设 投资档案管理 开发完毕

parent ddba0094
Pipeline #106919 passed with stage
in 18 seconds
......@@ -261,6 +261,20 @@ const routes = [
title: "日常信息",
component: () => import("@/views/everydayPage/everydayAdd.vue"),
},
{
path: "/informationConstruction",
name: "informationConstruction",
title: "信息化建设",
component: () =>
import("@/views/everydayPage/informationConstruction.vue"),
},
{
path: "/informationConstructionAdd",
name: "informationConstructionAdd",
title: "信息化建设",
component: () =>
import("@/views/everydayPage/informationConstructionAdd.vue"),
},
{
path: "/vscouncil",
name: "vscouncil",
......
<template>
<div class="manage-container">
<div class="manage-wrap">
<div class="manage-header">
<div class="header-left"></div>
<div class="header-right">
<el-button type="primary" @click="informationConstructionAdd"
>新增</el-button
>
</div>
</div>
<div class="manage-content" v-loading="loading">
<common-table
:autoHeight="true"
:maxRows="10"
:data="tableData"
:columns="tableColumns"
:total="total"
:current-page="currentPage"
:page-size="pageSize"
:index="true"
:indexLabel="'序号'"
title=""
:border="true"
@size-change="handleSizeChange"
@current-page-change="handleCurrentPageChange"
>
<template #operations="{ row, index }">
<el-button
link
type="primary"
size="small"
@click="previewStatement(row)"
>查看</el-button
>
<el-button
link
type="primary"
size="small"
@click="editStatement(row)"
>编辑</el-button
>
<el-button
link
type="danger"
size="small"
@click="deleteStatement(row)"
>删除</el-button
>
</template>
</common-table>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, getCurrentInstance } from "vue";
import { useRouter } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus";
import CommonTable from "@/components/common/commonTable.vue";
const router = useRouter();
const { proxy } = getCurrentInstance();
let tableData = ref([]);
let tableColumns = ref([
{
prop: "issueTitle",
label: "问题标题",
showOverflowTooltip: true,
},
{
prop: "issueDescription",
label: "问题描述",
showOverflowTooltip: true,
},
{
prop: "fjscLen",
label: "附件上传",
showOverflowTooltip: true,
},
{
prop: "operations",
label: "操作",
width: 170,
slot: "operations",
fixed: "right",
align: "center",
},
]);
let loading = ref(false);
let total = ref(0);
let currentPage = ref(1);
let pageSize = ref(10);
// 获取列表数据
const getStatementData = () => {
loading.value = true;
proxy.$post({
url: "/api/project/getXxhjsList",
data: {
page: currentPage.value,
pagesize: pageSize.value,
},
callback: (data) => {
tableData.value = data.rows.map((it) => {
return {
...it,
fjscLen: it.fjsc?.length + "个",
};
});
total.value = data.count;
loading.value = false;
},
});
};
// 分页
const handleSizeChange = (size) => {
pageSize.value = size;
currentPage.value = 1;
getStatementData();
};
const handleCurrentPageChange = (page) => {
currentPage.value = page;
getStatementData();
};
const informationConstructionAdd = () => {
router.push("/informationConstructionAdd");
};
const editStatement = (item) => {
router.push({
name: "informationConstructionAdd",
query: {
id: item.id,
},
});
};
const previewStatement = (item) => {
router.push({
name: "informationConstructionAdd",
query: {
isPreview: true,
id: item.id,
},
});
};
const deleteStatement = (item) => {
ElMessageBox.confirm("确认删除该项?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
proxy.$post({
url: "/api/project/deleteXxhjs",
data: {
id: item.id,
},
callback: (data) => {
ElMessage.success("删除成功");
getStatementData();
},
});
})
.catch(() => {});
};
onMounted(() => {
getStatementData();
});
</script>
<style scoped lang="less">
@import "@/styles/verticalManages.less";
</style>
<template>
<div class="add-project-container">
<div class="add-project-content" v-loading="loading">
<div class="add-project-header">
<div class="header-left"></div>
<div class="header-right">
<el-button type="default" @click="backClick">返回</el-button>
<template v-if="!loading && !isPreview">
<el-button type="primary" @click="saveClick">保存</el-button>
</template>
</div>
</div>
<div class="tabs-content">
<div class="project-tab-content">
<div class="tab-content">
<el-form :model="formData" :label-width="200" :disabled="isPreview">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="问题标题">
<el-input
v-model="formData.issueTitle"
placeholder="请输入问题标题"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="文件类别">
<CommonSelector
v-model="formData.issueCategory"
dictName="xxhwtlb"
>
</CommonSelector>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="问题描述">
<el-input
v-model="formData.issueDescription"
placeholder="请输入问题描述"
show-word-limit
type="textarea"
rows="3"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label-width="0" label="">
<FileUploader v-model="formData.fjsc" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { reactive, ref, onMounted, getCurrentInstance } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessage } from "element-plus";
import FileUploader from "../../components/FileUploader/index.vue";
// 路由&全局实例
const router = useRouter();
const route = useRoute();
const { proxy } = getCurrentInstance();
// ========== 核心状态 ==========
const loading = ref(false); // 加载状态
const isPreview = ref(!!route.query.isPreview); // 是否预览模式
const rcCgqyglId = ref(route.query.id || ""); // 当前编辑记录ID
const options = ref({}); // 下拉/单选全局配置项(文件层级/类别)
// ========== 表单核心数据(删除无用数组,仅保留页面绑定的字段) ==========
const formData = reactive({
wjmc: "", // 文件名称
bbsj: "", // 颁布时间
wjcj: "", // 文件层级
wjlb: "", // 文件类别
fjsc: [], // 附件上传
});
// ========== 接口请求 ==========
// 获取单条记录详情(编辑/预览时用)
const getJsqtzjcDetail = () => {
loading.value = true;
proxy.$post({
url: "/api/project/getXxhjs",
data: { id: rcCgqyglId.value },
callback: (data) => {
loading.value = false;
Object.assign(formData, data);
// 确保附件数组有默认值,避免渲染报错
formData.fjsc = data.fjsc || [];
},
error: () => (loading.value = false),
});
};
// ========== 页面操作方法 ==========
// 返回上一页
const backClick = () => {
router.back(-1);
};
// 保存/提交表单(新增/编辑统一处理)
const saveClick = () => {
loading.value = true;
const url = rcCgqyglId.value
? "/api/project/updateXxhjs"
: "/api/project/createXxhjs";
proxy.$post({
url: url,
data: { ...formData },
callback: () => {
loading.value = false;
ElMessage.success(rcCgqyglId.value ? "编辑成功" : "新增成功");
router.back(-1);
},
error: () => {
loading.value = false;
},
});
};
// ========== 页面初始化 ==========
onMounted(() => {
// 从sessionStorage获取全局配置项(文件层级/类别)
try {
options.value = JSON.parse(sessionStorage.getItem("resourceData")) || {};
} catch (e) {
options.value = {};
console.warn("解析resourceData失败:", e);
}
// 编辑/预览模式,加载详情数据
if (rcCgqyglId.value) {
getJsqtzjcDetail();
}
});
</script>
<style scoped lang="less">
@import "@/styles/verticalManages.less";
.add-project-container {
padding: 20px;
background: #f5f7fa;
min-height: calc(100vh - 60px);
}
.add-project-content {
background: #fff;
border-radius: 4px;
padding: 20px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.04);
}
.add-project-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 1px solid #ebeef5;
}
// 保留核心样式,删除无用的表格/折叠面板样式(页面未使用)
:deep(.el-form-item__label) {
font-weight: 500;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment