From def80005702fd12eb17a6e53554d56624c15b04c Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 03 十一月 2026 17:18:59 +0800
Subject: [PATCH] 部分改动

---
 src/views/projectManagement/Management/index.vue |  462 +++++----------------------------------------------------
 1 files changed, 46 insertions(+), 416 deletions(-)

diff --git a/src/views/projectManagement/Management/index.vue b/src/views/projectManagement/Management/index.vue
index f1e1161..f98ebcb 100644
--- a/src/views/projectManagement/Management/index.vue
+++ b/src/views/projectManagement/Management/index.vue
@@ -1,428 +1,58 @@
 <template>
   <div class="app-container">
-    <SearchPanel
-      v-model="queryParams"
-      :schema="searchSchema"
-      @search="handleQuery"
-      @reset="resetQuery"
-    >
-      <template #billStatus="{ item }">
-        <el-select v-model="queryParams[item.prop]" placeholder="璇烽�夋嫨鍗曟嵁鐘舵��" clearable style="width: 100%">
-          <el-option v-for="dict in bill_status" :key="dict.value" :label="dict.label" :value="dict.value" />
-        </el-select>
-      </template>
-      <template #auditStatus="{ item }">
-        <el-select v-model="queryParams[item.prop]" placeholder="璇烽�夋嫨璁″垝鐘舵��" clearable style="width: 100%">
-          <el-option v-for="dict in project_management" :key="dict.value" :label="dict.label" :value="dict.value" />
-        </el-select>
-      </template>
-      <template #projectStage="{ item }">
-        <el-select v-model="queryParams[item.prop]" placeholder="璇烽�夋嫨瀹℃牳鐘舵��" clearable style="width: 100%">
-          <el-option v-for="dict in plan_status" :key="dict.value" :label="dict.label" :value="dict.value" />
-        </el-select>
-      </template>
-    </SearchPanel>
-
-    <div class="table-container">
-      <div class="table-actions">
-        <el-button style="background-color: #002FA7; color: #fff" @click="handleAdd">鏂板</el-button>
-        <!-- <el-dropdown split-button type="default" @command="handleGenerateBill" style="margin-left: 10px;">
-          鐢熸垚鍗曟嵁
-          <template #dropdown>
-            <el-dropdown-menu>
-              <el-dropdown-item command="1">鐢熸垚鍗曟嵁1</el-dropdown-item>
-              <el-dropdown-item command="2">鐢熸垚鍗曟嵁2</el-dropdown-item>
-            </el-dropdown-menu>
+    <el-card shadow="never" class="search-card">
+      <el-form :inline="true" :model="query">
+        <el-form-item label="椤圭洰鍚嶇О/缂栧彿"><el-input v-model="query.keyword" clearable /></el-form-item>
+        <el-form-item label="瀹㈡埛鍚嶇О"><el-input v-model="query.customerName" clearable /></el-form-item>
+        <el-form-item label="椤圭洰鏉ユ簮"><el-select v-model="query.source" clearable style="width:150px"><el-option label="鎵嬪姩鍒涘缓" value="鎵嬪姩鍒涘缓" /><el-option label="涓氬姟鐢熸垚" value="涓氬姟鐢熸垚" /></el-select></el-form-item>
+        <el-form-item><el-button type="primary" @click="search">鏌ヨ</el-button><el-button @click="reset">閲嶇疆</el-button></el-form-item>
+      </el-form>
+    </el-card>
+    <el-card shadow="never">
+      <div class="actions"><el-button type="primary" @click="add">鎵嬪姩鍒涘缓椤圭洰</el-button></div>
+      <el-table :data="rows" v-loading="loading" border>
+        <el-table-column prop="no" label="椤圭洰缂栧彿" width="170" />
+        <el-table-column prop="title" label="椤圭洰鍚嶇О" min-width="180" />
+        <el-table-column prop="clientName" label="瀹㈡埛鍚嶇О" min-width="160" />
+        <el-table-column prop="source" label="椤圭洰鏉ユ簮" width="110" />
+        <el-table-column prop="projectClassification" label="椤圭洰鍒嗙被" width="140" />
+        <el-table-column prop="projectLeaderName" label="椤圭洰璐熻矗浜�" width="120" />
+        <el-table-column prop="currentPhase" label="褰撳墠闃舵" width="110"><template #default="{row}"><el-tag :type="row.currentPhase==='宸插畬鎴�'?'success':row.currentPhase==='鏈紑濮�'?'info':'warning'">{{ row.currentPhase || '鏈紑濮�' }}</el-tag></template></el-table-column>
+        <el-table-column prop="planStartTime" label="棰勮寮�濮�" width="120" />
+        <el-table-column prop="planEndTime" label="棰勮缁撴潫" width="120" />
+        <el-table-column label="鎿嶄綔" width="270" fixed="right" align="center">
+          <template #default="{row}">
+            <el-button v-if="row.currentPhase==='鏈紑濮�'" link type="success" @click="start(row)">寮�濮嬮」鐩�</el-button>
+            <el-button v-if="row.currentPhase==='鏈紑濮�'" link type="primary" @click="edit(row)">缂栬緫</el-button>
+            <el-button v-else link type="primary" @click="adjustExecutors(row)">璋冩暣鎵ц浜�</el-button>
+            <el-button link type="primary" @click="detail(row)">璇︽儏</el-button>
+            <el-button link type="danger" @click="remove(row)">鍒犻櫎</el-button>
           </template>
-        </el-dropdown> -->
-        <el-button :loading="submitLoading" @click="handleSubmit">鎻愪氦</el-button>
-        <el-button :loading="auditLoading" @click="handleAudit">瀹℃牳</el-button>
-        <!-- <el-button :loading="reverseAuditLoading" @click="handleReverseAudit">鍙嶅鏍�</el-button> -->
-        <el-button :loading="deleteLoading" @click="handleDelete">鍒犻櫎</el-button>
-      </div>
-
-      <PIMTable
-        :column="columns"
-        :tableData="tableData"
-        :page="pagination"
-        :tableLoading="loading"
-        :isSelection="true"
-        @selection-change="handleSelectionChange"
-        @pagination="handlePagination"
-      >
-        <template #auditStatus="{ row }">
-          <dict-tag :options="project_management" :value="row.auditStatus" />
-        </template>
-        <template #projectStage="{ row }">
-          <dict-tag :options="plan_status" :value="row.projectStage" />
-        </template>
-        <template #action="{ row }">
-          <el-button link type="primary" @click="handleEdit(row)">缂栬緫</el-button>
-          <el-button link type="primary" :loading="progressBtnLoadingId===row.id" @click="handleProgressReport(row)">杩涘害姹囨姤</el-button>
-          <el-button link type="primary" @click="handleDetail(row)">璇︽儏</el-button>
-        </template>
-      </PIMTable>
-    </div>
-
-    <FormDia ref="formDiaRef" @completed="getList" />
-    <ProgressReportDialog
-      v-model="progressReportVisible"
-      :project-id="progressProjectId"
-      :project-info="progressProjectInfo"
-      :plan-nodes="progressPlanNodes"
-      :default-plan-node-id="progressDefaultPlanNodeId"
-      @submitted="handleProgressSubmitted"
-    />
+        </el-table-column>
+      </el-table>
+      <pagination v-show="total>0" :total="total" v-model:page="query.pageNum" v-model:limit="query.pageSize" @pagination="load" />
+    </el-card>
+    <FormDia ref="formRef" @completed="completed" />
   </div>
 </template>
 
 <script setup name="ProjectManagement">
-import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
+import { onMounted, reactive, ref } from 'vue'
 import { useRouter } from 'vue-router'
-import SearchPanel from '@/components/SearchPanel/index.vue'
-import PIMTable from '@/components/PIMTable/PIMTable.vue'
-import FormDia from './components/formDia.vue'
-import ProgressReportDialog from '@/components/ProjectManagement/ProgressReportDialog.vue'
-import {
-  listProject,
-  delProject,
-  submitProject,
-  auditProject,
-  reverseAuditProject,
-  getProject,
-  saveStage
-} from '@/api/projectManagement/project'
-import { listPlan } from '@/api/projectManagement/projectType'
 import { ElMessage, ElMessageBox } from 'element-plus'
-import useUserStore from '@/store/modules/user'
+import { listProject, delProject } from '@/api/projectManagement/project'
+import FormDia from './components/formDia.vue'
 
-const { proxy } = getCurrentInstance()
-const { bill_status, project_management, plan_status } = proxy.useDict('bill_status', 'project_management', 'plan_status')
-const router = useRouter()
-const userStore = useUserStore()
-
-const loading = ref(false)
-const ids = ref([])
-const tableData = ref([])
-const formDiaRef = ref()
-const progressReportVisible = ref(false)
-const progressProjectId = ref(undefined)
-const progressProjectInfo = ref({})
-const progressPlanNodes = ref([])
-const progressDefaultPlanNodeId = ref(undefined)
-const progressBtnLoadingId = ref(null)
-const submitLoading = ref(false)
-const auditLoading = ref(false)
-const reverseAuditLoading = ref(false)
-const deleteLoading = ref(false)
-
-const data = reactive({
-  queryParams: {
-    projectNameOrCode: undefined,
-    customerName: undefined,
-    billStatus: undefined,
-    projectStage: undefined,
-    auditStatus: undefined,
-    salesperson: undefined,
-    pageNum: 1,
-    pageSize: 10
-  },
-  pagination: {
-    current: 1,
-    size: 10,
-    total: 0,
-    layout: 'total, sizes, prev, pager, next, jumper'
-  }
-})
-
-const { queryParams, pagination } = toRefs(data)
-
-const searchSchema = [
-  { prop: 'projectNameOrCode', label: '椤圭洰鍚嶇О/缂栧彿', type: 'input', placeholder: '璇疯緭鍏ラ」鐩悕绉�/缂栧彿' },
-  { prop: 'customerName', label: '瀹㈡埛鍚嶇О', type: 'input', placeholder: '璇疯緭鍏ュ鎴峰悕绉�' },
-  { prop: 'billStatus', label: '鍗曟嵁鐘舵��', slot: 'billStatus' },
-  { prop: 'projectStage', label: '璁″垝鐘舵��', slot: 'projectStage' },
-  { prop: 'auditStatus', label: '瀹℃牳鐘舵��', slot: 'auditStatus' },
-  { prop: 'salesperson', label: '涓氬姟浜哄憳', type: 'input', placeholder: '璇疯緭鍏ヤ笟鍔′汉鍛�' }
-]
-
-const columns = [
-  { label: '鍗曟嵁缂栧彿', prop: 'billNo', align: 'center', width: '150' },
-  { label: '椤圭洰鍚嶇О', prop: 'projectName', align: 'center' },
-  { label: '瀹℃牳鐘舵��', prop: 'auditStatus', align: 'center', dataType: 'slot', slot: 'auditStatus' },
-  { label: '瀹㈡埛鍚嶇О', prop: 'customerName', align: 'center' },
-  { label: '绔嬮」鏃ユ湡', prop: 'setupDate', align: 'center', width: '120' },
-  { label: '椤圭洰鏉ユ簮', prop: 'projectSource', align: 'center' },
-  { label: '椤圭洰鍒嗙被', prop: 'projectClassification', align: 'center' },
-  { label: '鎿嶄綔', prop: 'action', align: 'center', width: '250', dataType: 'slot', slot: 'action', fixed: 'right' }
-]
-
-function getList() {
-  loading.value = true
-  const params = {
-    noOrName: queryParams.value.projectNameOrCode,
-    clientName: queryParams.value.customerName,
-    salesmanName: queryParams.value.salesperson,
-    reviewStatus: queryParams.value.auditStatus,
-    stage: queryParams.value.projectStage,
-    current: queryParams.value.pageNum,
-    size: queryParams.value.pageSize
-  }
-  listProject(params)
-    .then(response => {
-      const records = response?.data?.records || response?.rows || response?.records || []
-      const billFilter = queryParams.value.billStatus
-      const filtered = billFilter === undefined || billFilter === null || billFilter === ''
-        ? records
-        : records.filter(r => String(r.billStatus ?? r.status) === String(billFilter))
-      tableData.value = filtered.map(r => ({
-        id: r.id,
-        billNo: r.no ?? r.billNo,
-        projectName: r.title ?? r.projectName,
-        billStatus: r.billStatus ?? r.status,
-        auditStatus: r.reviewStatus ?? r.auditStatus,
-        projectStage: r.stage ?? r.projectStage,
-        customerName: r.clientName ?? r.customerName,
-        parentProject: r.parentTitle ?? r.parentName ?? r.parentProject,
-        setupDate: r.establishTime ?? r.setupDate,
-        projectType: r.planName ?? r.projectType,
-        projectSource: r.source ?? r.projectSource,
-        projectClassification: r.projectClassification,
-        raw: r
-      }))
-      pagination.value.total = response?.total || response?.data?.total || 0
-    })
-    .finally(() => {
-      loading.value = false
-    })
-}
-
-function handleQuery() {
-  queryParams.value.pageNum = 1
-  pagination.value.current = 1
-  getList()
-}
-
-function resetQuery() {
-  queryParams.value = {
-    projectNameOrCode: undefined,
-    customerName: undefined,
-    billStatus: undefined,
-    projectStage: undefined,
-    auditStatus: undefined,
-    salesperson: undefined,
-    pageNum: 1,
-    pageSize: 10
-  }
-  handleQuery()
-}
-
-function handleSelectionChange(selection) {
-  ids.value = selection.map(item => item.id)
-}
-
-function handlePagination({ page, limit }) {
-  queryParams.value.pageNum = page
-  queryParams.value.pageSize = limit
-  pagination.value.current = page
-  pagination.value.size = limit
-  getList()
-}
-
-function handleAdd() {
-  formDiaRef.value?.openDialog({ operationType: 'add' })
-}
-
-async function handleDelete() {
-  const delIds = ids.value
-  if (delIds.length === 0) {
-    ElMessage.warning('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁椤�')
-    return
-  }
-  try {
-    await ElMessageBox.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」?', '璀﹀憡', {
-      confirmButtonText: '纭畾',
-      cancelButtonText: '鍙栨秷',
-      type: 'warning'
-    })
-    deleteLoading.value = true
-    await delProject(delIds)
-    getList()
-    ElMessage.success('鍒犻櫎鎴愬姛')
-  } catch {} finally {
-    deleteLoading.value = false
-  }
-}
-
-async function handleSubmit() {
-  const submitIds = ids.value
-  if (submitIds.length === 0) {
-    ElMessage.warning('璇烽�夋嫨瑕佹彁浜ょ殑鏁版嵁椤�')
-    return
-  }
-  try {
-    await ElMessageBox.confirm('鏄惁纭鎻愪氦鎵�閫夋暟鎹」?', '鎻愮ず', {
-      confirmButtonText: '纭畾',
-      cancelButtonText: '鍙栨秷',
-      type: 'warning'
-    })
-    submitLoading.value = true
-    await Promise.all(submitIds.map(id => submitProject({ id })))
-    getList()
-    ElMessage.success('鎻愪氦鎴愬姛')
-  } catch {} finally {
-    submitLoading.value = false
-  }
-}
-
-async function handleAudit() {
-  const auditIds = ids.value
-  if (auditIds.length === 0) {
-    ElMessage.warning('璇烽�夋嫨瑕佸鏍哥殑鏁版嵁椤�')
-    return
-  }
-  try {
-    await ElMessageBox.confirm('鏄惁纭瀹℃牳鎵�閫夋暟鎹」?', '鎻愮ず', {
-      confirmButtonText: '纭畾',
-      cancelButtonText: '鍙栨秷',
-      type: 'warning'
-    })
-    auditLoading.value = true
-    await Promise.all(auditIds.map(id => auditProject({ id })))
-    getList()
-    ElMessage.success('瀹℃牳鎴愬姛')
-  } catch {} finally {
-    auditLoading.value = false
-  }
-}
-
-async function handleReverseAudit() {
-  const reverseAuditIds = ids.value
-  if (reverseAuditIds.length === 0) {
-    ElMessage.warning('璇烽�夋嫨瑕佸弽瀹℃牳鐨勬暟鎹」')
-    return
-  }
-  try {
-    await ElMessageBox.confirm('鏄惁纭鍙嶅鏍告墍閫夋暟鎹」?', '鎻愮ず', {
-      confirmButtonText: '纭畾',
-      cancelButtonText: '鍙栨秷',
-      type: 'warning'
-    })
-    reverseAuditLoading.value = true
-    await Promise.all(reverseAuditIds.map(id => reverseAuditProject({ id })))
-    getList()
-    ElMessage.success('鍙嶅鏍告垚鍔�')
-  } catch {} finally {
-    reverseAuditLoading.value = false
-  }
-}
-
-function handleGenerateBill(command) {
-  ElMessage.info(`鐢熸垚鍗曟嵁: ${command}`)
-}
-
-function computeDefaultPlanNodeId(stageVal, nodes) {
-  const list = Array.isArray(nodes) ? nodes : []
-  if (list.length === 0) return undefined
-  const direct = list.find(n => String(n.id) === String(stageVal))
-  if (direct?.id) return direct.id
-  const sorted = [...list].sort((a, b) => Number(a.sort ?? 0) - Number(b.sort ?? 0))
-  const idx = Number(stageVal)
-  if (Number.isFinite(idx)) {
-    const byIndex = sorted[idx - 1] || sorted[idx] || sorted[0]
-    if (byIndex?.id) return byIndex.id
-  }
-  return sorted[0]?.id
-}
-
-async function handleProgressReport(row) {
-  if (!row?.id) return
-  try {
-    progressBtnLoadingId.value = row.id
-    const res = await getProject(row.id)
-    const detail = res?.data?.data ?? res?.data ?? res
-    const info = detail?.info || {}
-    progressProjectId.value = info.id
-    progressProjectInfo.value = info
-
-    const planId = info.projectManagementPlanId
-    if (planId) {
-      const planRes = await listPlan({ current: 1, size: 999 })
-      const records = planRes?.data?.records || planRes?.records || planRes?.rows || []
-      const plan = (records || []).find(p => String(p.id) === String(planId)) || {}
-      progressPlanNodes.value = Array.isArray(plan?.planNodeList) ? plan.planNodeList : []
-    } else {
-      progressPlanNodes.value = []
-    }
-
-    progressDefaultPlanNodeId.value = computeDefaultPlanNodeId(info.stage, progressPlanNodes.value)
-    progressReportVisible.value = true
-  } catch (e) {
-    ElMessage.error('鑾峰彇椤圭洰璇︽儏澶辫触')
-  } finally {
-    progressBtnLoadingId.value = null
-  }
-}
-
-async function handleProgressSubmitted(payload) {
-  try {
-    const nodes = Array.isArray(progressPlanNodes.value) ? progressPlanNodes.value : []
-    const node = nodes.find(n => String(n.id) === String(payload.planNodeId)) || {}
-    const description = payload.remark
-      ? `${payload.reportDate || ''} ${payload.remark}`.trim()
-      : `${payload.reportDate || ''} 杩涘害姹囨姤`.trim()
-    const req = {
-      id: null,
-      projectManagementPlanNodeId: payload.planNodeId,
-      projectManagementInfoId: progressProjectId.value,
-      description,
-      actualLeaderId: userStore.id || progressProjectInfo.value?.managerId,
-      actualLeaderName: userStore.nickName || progressProjectInfo.value?.managerName,
-      estimatedDuration: Number(node.estimatedDuration ?? 0) || 0,
-      planStartTime: payload.planStartTime || progressProjectInfo.value?.planStartTime,
-      planEndTime: payload.planEndTime || progressProjectInfo.value?.planEndTime,
-      actualStartTime: payload.actualStartTime || null,
-      actualEndTime: payload.actualEndTime || null,
-      progress: Number(payload.totalProgress ?? payload.completionProgress ?? 0) || 0,
-      storageBlobDTOs: Array.isArray(payload.storageBlobDTOs) ? payload.storageBlobDTOs : []
-    }
-    const res = await saveStage(req)
-    if (res?.code === 200) {
-      ElMessage.success('鎻愪氦鎴愬姛')
-      getList()
-      return
-    }
-    ElMessage.error(res?.msg || '鎻愪氦澶辫触')
-  } catch (e) {
-    ElMessage.error('鎻愪氦澶辫触')
-  }
-}
-
-function handleDetail(row) {
-  if (!row?.id) return
-  router.push(`/projectManagement/Management/detail/${row.id}`)
-}
-
-function handleEdit(row) {
-  formDiaRef.value?.openDialog({ operationType: 'edit', row })
-}
-
-onMounted(() => {
-  getList()
-})
+const router=useRouter(); const loading=ref(false); const rows=ref([]); const total=ref(0); const formRef=ref()
+const query=reactive({ keyword:'',customerName:'',source:'',pageNum:1,pageSize:10 })
+async function load(){ loading.value=true; try{ const res=await listProject({ noOrName:query.keyword,clientName:query.customerName,current:query.pageNum,size:query.pageSize }); const data=res?.data?.records||res?.rows||[]; rows.value=(data||[]).filter(r=>!query.source||r.source===query.source); total.value=res?.data?.total||res?.total||0 }finally{loading.value=false} }
+function search(){query.pageNum=1;load()} function reset(){Object.assign(query,{keyword:'',customerName:'',source:'',pageNum:1,pageSize:10});load()}
+function add(){formRef.value?.openDialog({operationType:'add'})} function edit(row){formRef.value?.openDialog({operationType:'edit',row})} function start(row){formRef.value?.openDialog({operationType:'edit',row,startProject:true})}
+function adjustExecutors(row){formRef.value?.openDialog({operationType:'edit',row,personnelOnly:true})}
+function detail(row){router.push(`/projectManagement/Management/detail/${row.id}`)}
+function completed(result){ load(); if(result?.startProject&&result?.id) router.push(`/projectManagement/Management/detail/${result.id}`) }
+async function remove(row){ await ElMessageBox.confirm(`纭鍒犻櫎椤圭洰鈥�${row.title}鈥濆悧锛焋,'鎻愮ず',{type:'warning'}); await delProject(row.id); ElMessage.success('鍒犻櫎鎴愬姛');load() }
+onMounted(load)
 </script>
 
-<style scoped lang="scss">
-.app-container {
-  padding: 20px;
-}
-.table-container {
-  background-color: #fff;
-  padding: 20px;
-  border-radius: 4px;
-}
-.table-actions {
-  text-align: right;
-	margin-bottom: 10px;
-}
-</style>
+<style scoped>.app-container{padding:20px}.search-card{margin-bottom:16px}.actions{margin-bottom:14px;text-align:right}</style>

--
Gitblit v1.9.3