Browse Source

发车时间可修改

zhangafei 3 days ago
parent
commit
5b9b85aa29

+ 38 - 0
src/views/billet/shippingBill/index.vue

@@ -138,6 +138,15 @@
         />
         <div v-else>{{ record.destination }}</div>
       </template>
+      <template #outTime="{ record }">
+        <a-date-picker
+          style="padding: 4px 2px"
+          show-time
+          placeholder="选择发车时间"
+          v-model:value="record.outTimeDate"
+          @ok="(v) => onOkOutTime(v, record)"
+        />
+      </template>
     </BasicTable>
     <!-- 表单区域 -->
     <!-- 编辑 -->
@@ -195,6 +204,7 @@
   import rodLine from './components/hotCharging/rodLine.vue';
   import stack from './components/hotCharging/stack.vue';
   import { useMessage } from '/@/hooks/web/useMessage';
+  import dayjs from 'dayjs';
 
   const { createConfirm } = useMessage();
 
@@ -391,6 +401,7 @@
             ...item,
             licensePlateOrg: item.licensePlate,
             destinationId: item.typeConfigId === '1024' ? undefined : item.typeConfigId,
+            outTimeDate: item.outTime ? dayjs(item.outTime) : '',
           };
         });
       },
@@ -556,6 +567,33 @@
     });
   }
 
+  // 修改发车时间
+  const onOkOutTime = (v, record) => {
+    console.log(v, record);
+    createConfirm({
+      iconType: 'warning',
+      title: '确认修改',
+      width: '460px',
+      content: () => {
+        return h('div', { style: { fontSize: '16px' } }, [
+          h('span', null, `是否将发车时间修改为`),
+          h('span', { style: { fontSize: '18px', color: '#d48806' } }, `${v.format('YYYY-MM-DD HH:mm:ss')}`),
+          h('span', null, `?`),
+        ]);
+      },
+      okText: '确认',
+      cancelText: '取消',
+      onOk: () => {
+        return edit({ id: record.id, btype: record.btype, licensePlate: record.licensePlate, outTime: v.format('YYYY-MM-DD HH:mm:ss') }).then(() => {
+          handleSuccess();
+        });
+      },
+      onCancel: () => {
+        record.outTimeDate = dayjs(record.outTime);
+      },
+    });
+  };
+
   // 修改车号
   function handleLicensePlateChange(v, record) {
     if (!v) return;

+ 2 - 1
src/views/billet/shippingBill/shippingBill.data.ts

@@ -64,8 +64,9 @@ export const columns: BasicColumn[] = computed(() => [
   {
     title: '发车时间',
     align: 'center',
-    width: 160,
+    width: 170,
     dataIndex: 'outTime',
+    slots: { customRender: 'outTime' },
   },
   {
     title: '目的地',