From ba942dfd8f7ef221a1a2d59c57874b0cbdca3e3b Mon Sep 17 00:00:00 2001 From: bb_pan Date: Fri, 4 Jul 2025 15:11:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ma/base.js | 8 +++ src/api/materialsStation/index.js | 36 +++++++++++ src/store/modules/user.js | 3 +- src/views/home/equipment-supply/index.vue | 63 ++++++++++++++++++- src/views/material/ma/type/index.vue | 12 +++- .../materialStation/authorize/index.vue | 5 +- 6 files changed, 117 insertions(+), 10 deletions(-) diff --git a/src/api/ma/base.js b/src/api/ma/base.js index ec3d9358..d6f936f9 100644 --- a/src/api/ma/base.js +++ b/src/api/ma/base.js @@ -86,6 +86,14 @@ export function updateMaType(data) { data: data, }) } +// 配件类型管理--一级修改 +export function updatePartType(data) { + return request({ + url: '/material/wh_house_info', + method: 'put', + data: data, + }) +} // 物资类型管理--新增 export function addMaType(data) { diff --git a/src/api/materialsStation/index.js b/src/api/materialsStation/index.js index 36ad3c76..6175ac3c 100644 --- a/src/api/materialsStation/index.js +++ b/src/api/materialsStation/index.js @@ -586,3 +586,39 @@ export function getDetailsByTypeId(query) { params: query }) } + +// 根据用户名查询用户信息 +export function getUserInfoByUserNameApi(data) { + return request({ + url: '/material/app/iwsTeamUser/selectUserInfoByUserName', + method: 'get', + params: data + }) +} + +// 根据身份证号查询用户信息 +export function getUserInfoByIdCardApi(data) { + return request({ + url: '/material/app/iwsTeamUser/selectProjectTeamInfoByIdCard', + method: 'get', + params: data + }) +} + +// 更新班组工程信息 +export function updateTeamProjectApi(data) { + return request({ + url: '/material/app/iwsTeamUser/updateTeamProject', + method: 'post', + data + }) +} + +// 获取工程ids +export function getProjectInfoApi(data) { + return request({ + url: '/material/select/getProjectInfo', + method: 'post', + data + }) +} \ No newline at end of file diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 9366176c..bc6953dc 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -130,8 +130,9 @@ const user = { commit('SET_AVATAR', avatar) // 存取用户的userId - sessionStorage.setItem('userId', res.user.userId) + sessionStorage.setItem('userId', res.user?.userId) sessionStorage.setItem('deptName', res.user?.dept?.deptName) + sessionStorage.setItem('userName', res.user?.userName) return res }) .catch(error => Promise.reject(error)) diff --git a/src/views/home/equipment-supply/index.vue b/src/views/home/equipment-supply/index.vue index ec5cec32..a32ee065 100644 --- a/src/views/home/equipment-supply/index.vue +++ b/src/views/home/equipment-supply/index.vue @@ -143,6 +143,12 @@ import { getBarAndLineDataApi } from '@/api/home/equipment-supply.js' import { getListProject, getListUnite } from '@/api/lease/apply' +import { + getProjectInfoApi, + getUserInfoByUserNameApi, + getUserInfoByIdCardApi, + updateTeamProjectApi +} from '@/api/materialsStation' export default { components: { CardModel, @@ -285,7 +291,9 @@ export default { barY1: [], lineY1: [], barY2: [], - lineY2: [] + lineY2: [], + idCard: '', + projectIds: [] } }, methods: { @@ -449,13 +457,62 @@ export default { } return [formatDate(lastMonth), formatDate(today)] - } + }, + // start + // 获取用户信息 + async getUserInfoByUserName() { + try { + const userName = sessionStorage.getItem('userName') + console.log('🚀 ~ getUserInfoByUserName ~ userName:', userName) + const res = await getUserInfoByUserNameApi({ userName }) + this.idCard = res?.data?.idCard + sessionStorage.setItem('idCard', res?.data?.idCard) + } catch (error) { + console.log('🚀 ~ getUserInfoByUserName ~ error:', error) + } + }, + async projectInfoList() { + try { + const res = await getProjectInfoApi({ unitId: null, isApp: true }) + console.log('🚀 ~ projectInfoList ~ res:', res) + if (res.data && res.data.length > 0) { + this.projectIds = res.data.map(item => item.proId) + } else { + this.projectIds = [] + } + } catch (error) { + console.log('🚀 ~ projectInfoList ~ error:', error) + } + }, + async getUserInfoByIdCard() { + const params = { + idCard: this.idCard, + projectIds: this.projectIds + } + console.log('🚀 ~ getUserInfoByIdCard ~ params:', params) + try { + const res = await getUserInfoByIdCardApi(params) + console.log('🚀 ~ getUserInfoByIdCard ~ res:', res) + if (res.code === 200 && res.data && res.data.length > 0) { + const params = { + teamList: res.data + } + const res2 = await updateTeamProjectApi(params) + console.log('🚀 ~ getUserInfoByIdCard ~ res2:', res2) + } + } catch (error) { + console.log('🚀 ~ getUserInfoByIdCard ~ error:', error) + } + }, + // end }, - created() { + async created() { this.queryDate = this.getDefaultDateRange() this.getCompanyAndProjectFun() this.getCardListFun() this.getPie_1DataFun() + await Promise.all([this.getUserInfoByUserName(), this.projectInfoList()]) + this.getUserInfoByIdCard() } } diff --git a/src/views/material/ma/type/index.vue b/src/views/material/ma/type/index.vue index ed88858c..8e7f71cb 100644 --- a/src/views/material/ma/type/index.vue +++ b/src/views/material/ma/type/index.vue @@ -61,7 +61,7 @@ size="mini" icon="el-icon-delete" style="color: #f56c6c" - v-if="data.id !== 0" + v-if="data.id !== 0 && data.level !== 0" @click.stop="() => removeTreeNode(data)" > @@ -715,7 +715,8 @@ import { delMaType, addMaType, updateMaType, - getUserTypeList + getUserTypeList, + updatePartType } from "@/api/ma/base"; import { getKeeperIds} from "@/api/ma/typeConfigKeeper"; import { getRepairIds } from "@/api/ma/typeConfigRepair"; @@ -1350,7 +1351,12 @@ export default { this.getTreeData(); } } else { - const res = await updateMaType(editParams); + let res = null + if (this.levelTemp == 0) { + res = await updatePartType(editParams); + } else { + res = await updateMaType(editParams); + } if (res.code === 200) { this.$message.success("修改成功!"); this.addTitleVisible = false; diff --git a/src/views/material/materialStation/authorize/index.vue b/src/views/material/materialStation/authorize/index.vue index 40e9dafe..bc0942b3 100644 --- a/src/views/material/materialStation/authorize/index.vue +++ b/src/views/material/materialStation/authorize/index.vue @@ -128,7 +128,6 @@ :on-success="handleSuccess" :on-error="handleError" :on-remove="handleFileRemove" - :before-upload="beforeUpload" accept=".pdf" :disabled="isEditMode" > @@ -402,8 +401,8 @@ export default { }, created() { this.getList() - this.supplierInfoList() - this.equipmentType() + // this.supplierInfoList() + // this.equipmentType() }, watch: { // 监听弹框显示状态