From 20a349e47b8e06af95d9716a526bf67f79ed9482 Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Mon, 10 Feb 2025 15:46:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E6=B7=BB=E5=8A=A0=E6=80=BB?= =?UTF-8?q?=E7=9B=91=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/pro/proList.js | 13 ++ src/api/tool/select.js | 13 ++ .../pro/projectManagement/proList/addPro.vue | 148 ++++++++++++++++-- 3 files changed, 164 insertions(+), 10 deletions(-) diff --git a/src/api/pro/proList.js b/src/api/pro/proList.js index 7eeb9dc..28cd34f 100644 --- a/src/api/pro/proList.js +++ b/src/api/pro/proList.js @@ -81,6 +81,19 @@ export function addSupervisoryUnit(data) { data: data }) } + +/** + * 新增监理单位 + * @param data + * @returns {*} + */ +export function addSupervisoryUnitUser(data) { + return request({ + url: '/project/pro/addSupervisoryUnitUser', + method: 'post', + data: data + }) +} /** * 新增承包商单位 * @param data diff --git a/src/api/tool/select.js b/src/api/tool/select.js index 2c9413b..9856145 100644 --- a/src/api/tool/select.js +++ b/src/api/tool/select.js @@ -155,6 +155,19 @@ export function selectSupervisionUnit(query) { }) } +/** + * 查询监理单位人员 + * @param query + * @returns {*} + */ +export function selectSupervisionUnitUser(query) { + return request({ + url: '/system/select/selectSupervisionUnitUser', + method: 'post', + data: query + }) +} + /** * 查询文件信息 * @param query diff --git a/src/views/pro/projectManagement/proList/addPro.vue b/src/views/pro/projectManagement/proList/addPro.vue index 7a1ad47..78e9cb8 100644 --- a/src/views/pro/projectManagement/proList/addPro.vue +++ b/src/views/pro/projectManagement/proList/addPro.vue @@ -65,6 +65,21 @@ + + + + + + 创建监理单位 + + + + - - 创建监理单位 + + 添加总监

工程地址配置

@@ -197,6 +212,34 @@ :style="{width: '100%'}" > + + + + + + + + + + + + + + + + + + + + + + + + + @@ -294,7 +337,7 @@ import { selectProAddress, selectCons, selectMaterial, - selectSupervisionUnit, getProLeaderOption + selectSupervisionUnit, getProLeaderOption, selectSupervisionUnitUser, } from '@/api/tool/select' import { addSupervisoryUnit, @@ -304,7 +347,7 @@ import { selectProInfoDetails, checkIsExistUnitName, checkIsExistConsName, - checkIsExistProName + checkIsExistProName, addSupervisoryUnitUser, } from '@/api/pro/proList' import numberUtils from '@/utils/validate' @@ -317,6 +360,8 @@ export default { loading: false, // 是否显示创建监理单位弹出层 supervisorFormOpen: false, + + supervisorUserFormOpen: false, // 是否显示创建承包商单位弹出层 consFormOpen: false, // 是否显示创建工程地址弹出层 @@ -438,6 +483,8 @@ export default { ], formData: { proId: undefined, + + jlId:undefined, //工程名称 proName: undefined, //工程负责人 @@ -453,8 +500,12 @@ export default { endDate: null, //监理单位 supervisorUnit: undefined, + + supervisorUnitUser: undefined, //监理单位id supervisorUnitId: undefined, + //人员id + supervisorUnitUserId: undefined, //工程地址 proAddress: [ { @@ -520,6 +571,7 @@ export default { proTypeOptions: [], //监理单位下拉选 supervisorUnitOptions: [], + supervisorUnitUserOptions: [], //承包商下拉选 consOptions: [], //材料选项 @@ -543,6 +595,16 @@ export default { // 重置监理单位字段的值,确保不触发错误提示 this.formData.supervisorUnit = '' } + }, + 'formData.supervisorUnitId'(newVal) { + this.formData.jlId=newVal; + this.formData.supervisorUnitUserId=''; + this.formData.supervisorUnitUser=''; + this.supervisorUnitOptions=[]; + + this.getSupervisionUnit(newVal) + + }, open: { handler(newVal, oldVal) { @@ -563,7 +625,8 @@ export default { this.getCons() this.getMaterial() this.getProLeaderOption() - this.getSupervisionUnit() + + this.selectSupervisionUnitUser() if (proId !== '0') { this.getData(proId) } @@ -683,14 +746,24 @@ export default { this.materialOptions = response.data }) }, - //获取监理单位选项 - getSupervisionUnit() { - const params = {} + //获取监理单位人员 + getSupervisionUnit(key) { + const params = { + 'key':key + } selectSupervisionUnit(params).then(response => { console.log(response) this.supervisorUnitOptions = response.data }) }, + //获取监理单位 + selectSupervisionUnitUser() { + const params = {} + selectSupervisionUnitUser(params).then(response => { + console.log(response) + this.supervisorUnitUserOptions = response.data + }) + }, //提交工程表单 async submitForm() { this.$refs['elForm'].validate(async valid => { @@ -810,6 +883,8 @@ export default { // 如果单位名称已存在,可以做出相应的提示或处理 return } + console.log(this.formData) + this.unitForm.jlId=this.formData.jlId; // TODO 提交表单 addSupervisoryUnit(this.unitForm).then(response => { if (response.code === 200) { @@ -831,6 +906,40 @@ export default { } }) }, + + //提交监理表单 + async submitUnitUserForm() { + this.$refs['unitForm'].validate(async valid => { + if (!valid) { + return false + } else { + // 前端验证通过,再进行唯一性检查 + const isExist = await this.checkIsExistUnitName() + if (isExist === false) { + // 如果单位名称已存在,可以做出相应的提示或处理 + return + } + // TODO 提交表单 + addSupervisoryUnitUser(this.unitForm).then(response => { + if (response.code === 200) { + this.$message({ + message: '新建成功', + type: 'success' + }) + this.selectSupervisionUnitUser() + this.formData.supervisorUnit = this.unitForm.unitName + this.unitResetForm() + this.supervisorFormOpen = false + } else { + this.$message({ + message: response.msg, + type: 'error' + }) + } + }) + } + }) + }, //提交承包商表单 async submitConsForm() { this.$refs['consForm'].validate(async valid => { @@ -881,6 +990,7 @@ export default { unitResetForm() { this.unitForm = { unitName: undefined, + jlId:undefined, unitAddress: undefined, corporateName: undefined, corporatePhone: undefined, @@ -906,6 +1016,10 @@ export default { this.unitResetForm() this.supervisorFormOpen = false }, + unitUserCancel() { + this.unitResetForm() + this.supervisorUserFormOpen = false + }, //承包商单位表单重置 consCancel() { this.consResetForm() @@ -916,6 +1030,11 @@ export default { this.unitResetForm() this.supervisorFormOpen = true }, + createUnitUser() { + //创建监理单位 + this.unitResetForm() + this.supervisorUserFormOpen = true + }, addCons() { //创建监理单位 this.consResetForm() @@ -991,12 +1110,21 @@ export default { }, //更改监理单位名称值 changeSupervisorUnit() { - this.supervisorUnitOptions.forEach(item => { + this.supervisorUnitUserOptions.forEach(item => { if (item.value === this.formData.supervisorUnitId) { this.formData.supervisorUnit = item.label } }) }, + //更改监理单位名称值 + changeSupervisorUnitUser() { + this.supervisorUnitOptions.forEach(item => { + if (item.value === this.formData.supervisorUnitUserId) { + this.formData.supervisorUnitUser = item.label + } + }) + }, + //更改承包商名称值 changeCons(e, index) { if (e === undefined || e === '') {