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

feat(orderManage): 优化充电订单详情页编辑功能

- 新增备注字段的自定义表单项及编辑弹窗中的输入组件
- 编辑表单项细化,包含充电订单号、状态及备注,完善界面交互
- 编辑操作时获取表单数据,自动为备注为空项赋默认值“手动结束”
- 保持状态字段的占位符及样式一致,提升用户体验
SheepHy пре 1 дан
родитељ
комит
ac1781e18b
1 измењених фајлова са 43 додато и 2 уклоњено
  1. 43 2
      src/views/orderManage/charge-order-info/index.vue

+ 43 - 2
src/views/orderManage/charge-order-info/index.vue

@@ -101,6 +101,13 @@
       <template #maspStatus="scope">
         <Dict v-model="scope.formData[scope.prop]" code="masp_status" v-bind="scope.attrs" />
       </template>
+      <template #remark="scope">
+        <el-input
+          v-model="scope.formData[scope.prop]"
+          type="textarea"
+          v-bind="scope.attrs"
+        />
+      </template>
     </page-modal>
   </div>
 </template>
@@ -424,14 +431,48 @@ const editModalConfig: IModalConfig<ChargeOrderInfoForm> = reactive({
   formAction(data: any) {
     return ChargeOrderInfoAPI.update(data.id as string, data);
   },
-  formItems: addModalConfig.formItems, // 复用新增的表单项
+  formItems: [
+    {
+      type: "custom",
+      label: "充电订单号",
+      prop: "chargeOrderNo",
+      slotName: "chargeOrderNo",
+    },
+    {
+      type: "custom",
+      label: "状态",
+      prop: "status",
+      slotName: "status",
+      attrs: {
+        placeholder: "状态",
+        style: { width: "100%" },
+      },
+    },
+    {
+      type: "custom",
+      label: "备注",
+      prop: "remark",
+      slotName: "remark",
+      attrs: {
+        placeholder: "请输入备注",
+        rows: 4,
+        clearable: true,
+        style: { width: "100%" },
+      },
+    },
+  ],
 });
 
 // 处理操作按钮点击
 const handleOperateClick = (data: IObject) => {
   if (data.name === "edit") {
     handleEditClick(data.row, async () => {
-      return await ChargeOrderInfoAPI.getFormData(data.row.id);
+      const formData = await ChargeOrderInfoAPI.getFormData(data.row.id);
+      // 如果备注字段为空,自动设置默认值为"手动结束"
+      if (formData && !formData.remark) {
+        formData.remark = "手动结束";
+      }
+      return formData;
     });
   }
 };