yanghao před 1 týdnem
rodič
revize
3d3229c5c5

+ 1 - 1
.env.local

@@ -4,7 +4,7 @@ NODE_ENV=development
 VITE_DEV=true
 
 # 请求路径  http://192.168.188.60:48080  https://iot.deepoil.cc:5443  http://172.26.0.56:48080  http://192.168.188.198:48080
-VITE_BASE_URL='http://192.168.188.60:48080'
+VITE_BASE_URL='https://iot.deepoil.cc:5443'
 
 # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务
 VITE_UPLOAD_TYPE=server

+ 0 - 1
src/api/pms/iotprojecttaskplan/index.ts

@@ -34,7 +34,6 @@ export interface IotProjectTaskPlanTeamProjectBiz {
 
 export interface IotProjectTaskPlanCreateData {
   deptId: number
-  companyId: number
   startTime: number
   business: string
   workloadUnit: string

+ 5 - 33
src/views/pms/plan-work/fill.vue

@@ -1,11 +1,11 @@
 <script lang="ts" setup>
 import {
   IotProjectTaskPlanApi,
+  IotProjectTaskPlanUpdateData,
   type IotProjectTaskPlanCreateData,
   type IotProjectTaskPlanPageParams,
   type IotProjectTaskPlanPageVO,
-  type IotProjectTaskPlanTeamProjectBiz,
-  type IotProjectTaskPlanUpdateData
+  type IotProjectTaskPlanTeamProjectBiz
 } from '@/api/pms/iotprojecttaskplan'
 import * as DeptApi from '@/api/system/dept'
 import { useUserStore } from '@/store/modules/user'
@@ -53,7 +53,6 @@ interface DeptOption {
 interface CreatePlanForm {
   id?: number
   deptId?: number
-  companyId?: number
   startTime?: number | string
   business: string
   workloadUnit: string
@@ -97,7 +96,6 @@ const formMode = ref<FormMode>('create')
 const deptOptionsLoading = ref(false)
 const businessOptionsLoading = ref(false)
 const deptOptions = ref<DeptOption[]>([])
-const flatDeptOptions = ref<DeptOption[]>([])
 const createFormRef = ref<FormInstance>()
 
 const isReadonly = computed(() => formMode.value === 'view')
@@ -113,7 +111,6 @@ const dialogDescription = computed(() =>
 const createInitialForm = (): CreatePlanForm => ({
   id: undefined,
   deptId: undefined,
-  companyId: undefined,
   startTime: dayjs().startOf('month').valueOf(),
   business: '',
   workloadUnit: '',
@@ -134,31 +131,17 @@ const loadDeptOptions = async () => {
   deptOptionsLoading.value = true
   try {
     const data = (await DeptApi.specifiedSimpleDepts(deptId)) as DeptOption[]
-    flatDeptOptions.value = data.map((dept) => ({
+    const selectableDeptOptions = data.map((dept) => ({
       ...dept,
       type: String(dept.type || ''),
       disabled: String(dept.type || '') !== '3'
     }))
-    deptOptions.value = handleTree(flatDeptOptions.value)
+    deptOptions.value = handleTree(selectableDeptOptions)
   } finally {
     deptOptionsLoading.value = false
   }
 }
 
-const findCompanyId = (selectedDeptId: number) => {
-  const deptMap = new Map(flatDeptOptions.value.map((dept) => [dept.id, dept]))
-  const visitedIds = new Set<number>()
-  let currentDept = deptMap.get(selectedDeptId)
-
-  while (currentDept && !visitedIds.has(currentDept.id)) {
-    visitedIds.add(currentDept.id)
-    if (String(currentDept.type) === '1') return currentDept.id
-    currentDept = currentDept.parentId ? deptMap.get(currentDept.parentId) : undefined
-  }
-
-  return undefined
-}
-
 const loadTeamProjectBizOptions = async (selectedDeptId?: number) => {
   teamProjectBizOptions.value = []
   if (!selectedDeptId) return
@@ -173,7 +156,6 @@ const loadTeamProjectBizOptions = async (selectedDeptId?: number) => {
 }
 
 const handleDeptChange = async (selectedDeptId?: number) => {
-  createFormData.value.companyId = selectedDeptId ? findCompanyId(selectedDeptId) : undefined
   createFormData.value.business = ''
   createFormData.value.workloadUnit = ''
   createFormData.value.planWorkload = undefined
@@ -209,7 +191,6 @@ const handleOpenForm = async (mode: FormMode, id?: number) => {
       createFormData.value = {
         id: data.id,
         deptId: data.deptId,
-        companyId: data.companyId || findCompanyId(data.deptId),
         startTime: normalizeStartTime(data.startTime),
         business,
         workloadUnit: data.workloadUnit || businessOption?.unit || config?.unit || '',
@@ -242,7 +223,6 @@ const submitCreate = async () => {
 
   const {
     deptId: formDeptId,
-    companyId,
     startTime,
     business,
     workloadUnit,
@@ -250,21 +230,13 @@ const submitCreate = async () => {
   } = createFormData.value
   const config = getBusinessPlanConfig(business)
 
-  if (
-    !formDeptId ||
-    !companyId ||
-    !startTime ||
-    !workloadUnit ||
-    planWorkload === undefined ||
-    !config
-  ) {
+  if (!formDeptId || !startTime || !workloadUnit || planWorkload === undefined || !config) {
     message.error('表单数据不完整或项目业务未配置计划工作量字段')
     return
   }
 
   const data: IotProjectTaskPlanCreateData = {
     deptId: formDeptId,
-    companyId,
     startTime: dayjs(Number(startTime)).startOf('month').valueOf(),
     business,
     workloadUnit