diff --git a/src/api/ManageApi/index.js b/src/api/ManageApi/index.js index 596a9a5..b4ef9b7 100644 --- a/src/api/ManageApi/index.js +++ b/src/api/ManageApi/index.js @@ -15,6 +15,30 @@ export function getBasicInformationById(id) { method: 'get' }); } +// 企业端提交填报 +export function fillBasicInformation(data) { + return request({ + url: '/gysl/basicInformation/fill', + method: 'post', + data: data + }) +} +// 政务端审核通过 +export function auditBasicInformation(data) { + return request({ + url: '/gysl/basicInformation/audit', + method: 'post', + data: data + }) +} +// 基本信息删除数据 +export function deleteBasicInformation(idList) { + return request({ + url: '/gysl/basicInformation/delete', + method: 'delete', + params: { idList } + }) +} // 企业--基本信息==修改 export function updateBasicInformation(data) { @@ -391,21 +415,22 @@ export function deletexmtl(idList) { }) } //修改数据 -export function updatexmtll(data) { +export function editxmtl(data) { return request({ - url:'/gysl/projectLegend/edit', - method:'put', - data + url: '/gysl/projectLegend/edit', + method: 'put', + data: data }) } -//分页查询所有数据(根据xmid) -export function getxmtlPageByxmid(params) { +//根据项目ID查询数据// 修正后的API定义 +export function getxmtlPageByxmId(params) { return request({ - url:'/gysl/projectLegend/page', - method:'get', - params + url: '/gysl/projectLegend/page', + method: 'get', + params // 注意这里改为params,GET请求会自动拼接到URL }) } + //通过主键查询单条数据 export function getxmtlById(id) { return request({ diff --git a/src/views/components/ProjectDetails/Basic.vue b/src/views/components/ProjectDetails/Basic.vue index 6ac8c86..6cb639f 100644 --- a/src/views/components/ProjectDetails/Basic.vue +++ b/src/views/components/ProjectDetails/Basic.vue @@ -7,7 +7,7 @@ 基本信息
- 编辑 @@ -215,6 +215,10 @@ export default { basicInfo: { type: Object, required: true + }, + action:{ + type: String, + required: true } }, data() { @@ -233,6 +237,7 @@ export default { sgdw: '', sjdw: '', ztze: 0, + id: 0, ssgnq: 0, begainTime: '', endtime: '', @@ -321,38 +326,36 @@ export default { }, // 保存表单 saveForm() { - const formData = this.prepareFormData(this.form); - // 触发事件,将数据传递给父组件 - this.$emit('update-data', formData); - this.dialogVisible = false; + if (this.validateForm()) { + const formData = this.prepareFormData(this.form); + // 触发事件,将数据传递给父组件 + this.$emit('update-data', formData); + this.dialogVisible = false; + } + }, + // 手动验证表单 + validateForm() { + for (const field in this.rules) { + const rules = this.rules[field]; + const value = this.form[field]; + for (const rule of rules) { + if (rule.required && !value) { + this.$message.error(rule.message); + return false; + } + } + } + return true; }, // 准备表单数据 - prepareFormData() { - const [startDate, endDate] = this.formatDateRange(this.form.begainTime); + prepareFormData(formData) { + // 处理日期范围,拆分成 begainTime 和 endTime + const [begainTime, endTime] = this.formatDateRange(formData.begainTime); + return { - id: this.id, - name: this.form.name, - xmfrdwxz: this.form.xmfrdwxz, - nature: parseInt(this.form.nature), - sgdw: this.form.sgdw, - sjdw: this.form.sjdw, - ztze: parseFloat(this.form.ztze), - ssgnq: parseInt(this.form.ssgnq), - begainTime: startDate, - endTime: endDate, - xzfl: parseInt(this.form.xzfl), - jsdd: this.form.jsdd, - prioritize: this.form.prioritize, - jsms: parseInt(this.form.jsms), - label: this.form.label, - projectLeader: this.form.projectLeader, - phone: this.form.phone, - issuingTime: this.form.issuingTime, - acceptanceTime: this.form.acceptanceTime, - unitIntroduction: this.form.unitIntroduction, - jsjd: this.form.jsjd, - introduction: this.form.introduction, - fj: this.form.fj, + ...formData, // 其他字段保持不变 + begainTime, // 单独的开始日期(字符串) + endTime, // 单独的结束日期(字符串) createBy: '', createId: 0, createTime: '', @@ -363,10 +366,20 @@ export default { }, // 格式化日期范围 formatDateRange(dateRange) { - if (!dateRange || dateRange.length !== 2) return ['', '']; - const startDate = dateRange[0].toISOString().split('T')[0]; - const endDate = dateRange[1].toISOString().split('T')[0]; - return [startDate, endDate]; + if (!dateRange || dateRange.length !== 2) return ['', '']; // 防止空值报错 + + // 格式化日期,确保返回 YYYY-MM-DD 格式 + const formatDate = (date) => { + if (!date) return ''; + // 如果是 Date 对象,直接格式化;如果是字符串,先转成 Date 再格式化 + const d = date instanceof Date ? date : new Date(date); + return d.toISOString().split('T')[0]; // 取 YYYY-MM-DD 部分 + }; + + return [ + formatDate(dateRange[0]), // 开始日期 + formatDate(dateRange[1]) // 结束日期 + ]; }, // 处理附件上传成功 handleAttachmentSuccess(response, file) { @@ -412,12 +425,12 @@ export default { height: auto; display: flex; justify-content: space-between; - padding: .7rem 0; - padding: .5rem; + padding:.5rem; border-bottom: 1px solid #E5E5E5; } .topleft { + height: 2rem; width: 8rem; display: flex; gap: 0.4rem; diff --git a/src/views/components/ProjectDetails/Buildings.vue b/src/views/components/ProjectDetails/Buildings.vue index 160f72b..81181d1 100644 --- a/src/views/components/ProjectDetails/Buildings.vue +++ b/src/views/components/ProjectDetails/Buildings.vue @@ -35,8 +35,7 @@
-
+
{{ building.name }} @@ -88,7 +87,7 @@ - {{ getTextForBoolean(selectedBuilding.sfydzk) }} + {{ getTextForBoolean(selectedBuilding.sfydzk )}} @@ -205,7 +204,10 @@
+ diff --git a/src/views/components/ProjectDetails/Others.vue b/src/views/components/ProjectDetails/Others.vue index 31f730d..4969cb4 100644 --- a/src/views/components/ProjectDetails/Others.vue +++ b/src/views/components/ProjectDetails/Others.vue @@ -7,18 +7,20 @@ 其他信息
- 新增 新增 - + {{ isEditMode ? '保存' : '编辑' }} + 导出 - {{ item.zdinfor }} + +
- + @@ -64,11 +71,14 @@ \ No newline at end of file diff --git a/src/views/components/ProjectDetails/buildings2.vue b/src/views/components/ProjectDetails/buildings2.vue new file mode 100644 index 0000000..f13d6cd --- /dev/null +++ b/src/views/components/ProjectDetails/buildings2.vue @@ -0,0 +1,444 @@ + + + + \ No newline at end of file diff --git a/src/views/components/qiyexinxi/qiyexinxi.vue b/src/views/components/qiyexinxi/qiyexinxi.vue index da85c3b..0ee27e2 100644 --- a/src/views/components/qiyexinxi/qiyexinxi.vue +++ b/src/views/components/qiyexinxi/qiyexinxi.vue @@ -91,14 +91,15 @@ @@ -137,6 +138,17 @@ export default { '待填报': '#FFBF6B', '待审核': '#7693D8' }, + //状态文本映射 + statusMap: { + 1: '待填报', + 2: '待审核', + 3: '审核通过' + }, + // xzflMap:{ + // 1:'已建', + // 2:'再建', + // 3:'拟建' + // }, // 查询参数 queryParams: { pageNum: 1, @@ -220,25 +232,11 @@ export default { ); }, - /** 删除按钮操作 */ - handleDelete(row) { - const ids = row.id || this.ids; - this.$modal - .confirm('是否确认删除项目id为"' + ids + '"的数据项?') - .then(() => { - return delBasicInformation(ids); - }) - .then(() => { - this.getList(); - this.$modal.msgSuccess("删除成功"); - }) - .catch(() => { }); - }, /** 详情按钮操作 */ - getInfo(row) { + getInfo(row, type) { this.$store.commit("SET_CRUMBS", this.$route.meta.title + "详情"); const id = row.id || this.ids[0]; - this.$router.push({ path: `/manage-info/${id}` }); + this.$router.push({ path: `/manage-info/${id}`, query: { action: type } }); }, /** 重置按钮操作 */ resetQuery() { diff --git a/src/views/components/zhengwuxinxi/zhengwuxinxi.vue b/src/views/components/zhengwuxinxi/zhengwuxinxi.vue index 73cbb36..00f38a4 100644 --- a/src/views/components/zhengwuxinxi/zhengwuxinxi.vue +++ b/src/views/components/zhengwuxinxi/zhengwuxinxi.vue @@ -1,308 +1,318 @@ - - - - \ No newline at end of file +} + \ No newline at end of file diff --git a/src/views/manage-info/index.vue b/src/views/manage-info/index.vue index ae0c81a..44d703b 100644 --- a/src/views/manage-info/index.vue +++ b/src/views/manage-info/index.vue @@ -24,7 +24,8 @@
- +
@@ -34,7 +35,8 @@
- +
@@ -43,7 +45,7 @@
- +
@@ -52,11 +54,12 @@
- +
+
@@ -64,11 +67,11 @@
- +
- +
@@ -76,8 +79,9 @@
@@ -99,9 +103,10 @@ import Programme from '@/views/components/ProjectDetails/Programme.vue'; import Projectgift from '@/views/components/ProjectDetails/Projectgift.vue'; import Projectpicture from '@/views/components/ProjectDetails/Projectpicture.vue'; import Projectpicturetwo from '@/views/components/ProjectDetails/Projectpicturetwo.vue'; +import Projectpicturetwo22 from '@/views/components/ProjectDetails/Projectpicturetwo22.vue'; import Others from '@/views/components/ProjectDetails/Others.vue'; -import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数 -import { getBasicInformationById } from '@/api/ManageApi/index'; +import { checkPermi, checkRole } from "@/utils/permission"; +import { getBasicInformationById, fillBasicInformation, auditBasicInformation } from '@/api/ManageApi/index'; export default { components: { @@ -117,6 +122,7 @@ export default { Projectgift, Projectpicture, Projectpicturetwo, + Projectpicturetwo22, Others, }, data() { @@ -137,19 +143,84 @@ export default { { id: 'others', label: '其他信息' } ], projectId: null, - isContainerVisible: true, // 控制 containerbody 的显示状态 - isSubmitted: false, // 控制提交审核按钮的状态和文本内容 - basicInformation: {}, - planInformation: {}, + isContainerVisible: true, + isSubmitted: false, + basicInformation: { + acceptanceTime: "", + begainTime: "", + endTime: "", + fj: "", + introduction: "", + issuingTime: "", + jsdd: "", + jsjd: "", + jsms: 0, + label: "", + latitude: "", + longitude: "", + name: "", + nature: 0, + id: 0, + phone: "", + prioritize: "", + projectLeader: "", + sgdw: "", + sjdw: "", + ssgnq: 0, + status: 0, + tyshxydm: "", + unitIntroduction: "", + xmfrdwxz: "", + xzfl: 0, + zjzmj: 0, + ztze: 0, + zydmj: 0 + }, + planInformation: { + bzcjzmj: 0, + dsjzmj: 0, + dxjzmj: 0, + fhdj: "", + fjdctcw: 0, + ghwj: "", + jdctcw: 0, + jrjljzmj: 0, + jzds: 0, + jzmd: 0, + ldl: 0, + id: 0, + rjl: 0, + xmId: 0, + zgjzcs: 0, + zgjzgd: 0, + zjzmj: 0, + zydmj: 0 + }, projectOtherInfos: [], wysmxInformations: [], - qyrzInformation: {}, + qyrzInformation: { + gycfpjwyf: 0, + gycfpjzj: 0, + kzczmj: 0, + params: {}, + remark: "", + rysl: 0, + id: 0, + rzl: 0, + rzqyhylx: "", + rzqys: 0, + xmId: 0, + yczmj: 0 + }, + // buildingInformation: [], + projectRemarks: [] }; }, created() { // 从路由参数中获取 projectId this.projectId = Number(this.$route.params.id); this.loadData(); + this.action = this.$route.query.action; }, methods: { checkPermi, @@ -160,10 +231,11 @@ export default { const data = response.data; this.basicInformation = data.basicInformation; this.planInformation = data.planInformation; - this.buildingInformation = data.buildingInformation; + // this.buildingInformation = data.buildingInformation; this.projectOtherInfos = data.projectOtherInfos; this.wysmxInformations = data.wysmxResponses; this.qyrzInformation = data.qyrzInformation; + this.projectRemarks = data.projectRemarks console.log(data); }); }, @@ -186,11 +258,9 @@ export default { // 处理来自子组件的数据更新 handleDataUpdate(dataKey, updatedData) { if (dataKey === 'projectOtherInfos' || dataKey === 'wysmxInformations') { - // 确保 updatedData 是数组 if (Array.isArray(updatedData)) { this[dataKey] = updatedData; } else { - // 如果 updatedData 不是数组,则将其添加到相应的数组中 this[dataKey].push(updatedData); } } else { @@ -198,24 +268,93 @@ export default { } console.log(`接收到 ${dataKey} 更新:`, updatedData); }, - //提交数据 + // 提交数据 submitAll() { + const submitData = this.prepareSubmitData(); + + // 打印更详细的结构(方便调试) + console.log('提交的数据结构:', JSON.stringify(submitData, null, 2)); + + // 调用 fillBasicInformation 并处理结果 + fillBasicInformation(submitData) + .then(response => { + console.log('提交成功:', response); + this.$message.success('数据提交成功'); + this.isContainerVisible = false; + this.isSubmitted = true; + }) + .catch(error => { + console.error('提交失败:', error); + this.$message.error('数据提交失败'); + }); + }, + + // 审核通过的提交数据 + aduitAll() { + const submitData = this.prepareSubmitData(); + + // 打印更详细的结构(方便调试) + console.log('提交的数据结构:', JSON.stringify(submitData, null, 2)); + + auditBasicInformation(submitData) + .then(response => { + console.log('提交成功:', response); + this.$message.success('审核通过'); + this.isContainerVisible = false; + this.isSubmitted = true; + }) + .catch(error => { + console.error('提交失败:', error); + this.$message.error('数据提交失败'); + }); + }, + + // 准备提交的数据 + prepareSubmitData() { const submitData = { basicInformation: this.basicInformation, planInformation: this.planInformation, projectOtherInfos: this.projectOtherInfos, - wysmxInformations: this.wysmxInformations, qyrzInformation: this.qyrzInformation - // 其他数据... }; - console.log('提交的数据:', submitData); - this.$message.success('数据已打印到控制台'); - // 隐藏 containerbody - this.isContainerVisible = false; - // 设置按钮为已提交状态 - this.isSubmitted = true; - } + // 处理 wysmxInformations 数据,使其符合后端期望的格式 + const formattedWysmxInformations = []; + this.wysmxInformations.forEach(item => { + item.list.forEach(listItem => { + formattedWysmxInformations.push({ + createBy: "", + createId: 0, + createTime: this.formatDate(new Date()), // 设置当前时间 + id: 0, // 设置为 0 让数据库自动生成 + updateBy: "", + updateId: 0, + updateTime: this.formatDate(new Date()), // 设置当前时间 + xmId: item.xmId, + ysmc: item.ysmc, + zdinfor: listItem.zdinfor, + zdname: listItem.zdname + }); + }); + }); + + // 将处理后的数据添加到 submitData 中 + submitData.wysmxInformations = formattedWysmxInformations; + + return submitData; + }, + + // 日期格式化方法 + formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + }, + } };