Преглед изворни кода

feat(pl): add copy entry on transport plan list and view dialog

Co-authored-by: Cursor <cursoragent@cursor.com>
zlwu пре 3 месеци
родитељ
комит
e1f31dc10f
1 измењених фајлова са 26 додато и 0 уклоњено
  1. 26 0
      web-admin/src/views/pl/plan/index.vue

+ 26 - 0
web-admin/src/views/pl/plan/index.vue

@@ -98,6 +98,13 @@
           <el-button class="btn-main" type="primary" @click="handleAdd">
             <el-icon><Plus /></el-icon>新增计划
           </el-button>
+          <el-button
+            class="btn-ghost"
+            :disabled="!selectedPlan"
+            @click="handleToolbarCopy"
+          >
+            <el-icon><CopyDocument /></el-icon>复制
+          </el-button>
           <el-button
             class="btn-ghost"
             :disabled="!selectedPlan || !canArrangeTransport(selectedPlan)"
@@ -370,6 +377,7 @@
     <PlPlanFormDialog
       v-model:visible="formDialogVisible"
       :plan-id="editingPlanId"
+      :copy-from-plan-id="copyFromPlanId"
       @success="handlePlanMutationSuccess"
     />
 
@@ -387,6 +395,9 @@
         >
           <el-icon><Edit /></el-icon>编辑
         </el-button>
+        <el-button class="btn-ghost" @click="handleCopy(viewingPlan)">
+          <el-icon><CopyDocument /></el-icon>复制
+        </el-button>
         <el-button
           v-if="canArrangeTransport(viewingPlan)"
           class="btn-ghost"
@@ -478,6 +489,7 @@ import {
   ArrowDown,
   Bell,
   CircleClose,
+  CopyDocument,
   Delete,
   Edit,
   Plus,
@@ -525,6 +537,7 @@ const deleteLoading = ref(false)
 const waitNoticeLoading = ref(false)
 const formDialogVisible = ref(false)
 const editingPlanId = ref('')
+const copyFromPlanId = ref('')
 const viewVisible = ref(false)
 const viewPlanId = ref('')
 const viewDialogRef = ref<InstanceType<typeof PlPlanViewDialog>>()
@@ -741,6 +754,7 @@ function handleSizeChange() {
 
 function handleAdd() {
   editingPlanId.value = ''
+  copyFromPlanId.value = ''
   formDialogVisible.value = true
 }
 
@@ -756,9 +770,21 @@ function handleView(row: Plan) {
 
 function handleEdit(row: Plan) {
   editingPlanId.value = row.id
+  copyFromPlanId.value = ''
+  formDialogVisible.value = true
+}
+
+function handleCopy(row: Plan) {
+  editingPlanId.value = ''
+  copyFromPlanId.value = row.id
   formDialogVisible.value = true
 }
 
+function handleToolbarCopy() {
+  if (!selectedPlan.value) return
+  handleCopy(selectedPlan.value)
+}
+
 function canEditPlan(row: Plan) {
   return row.archiveStatus !== 'archived' && row.followStatus !== 'cancelled'
 }