dy 1 год назад
Родитель
Сommit
75e20cf1e5
2 измененных файлов с 23 добавлено и 3 удалено
  1. 12 0
      src/api/order/index.ts
  2. 11 3
      src/views/plan/order/index.vue

+ 12 - 0
src/api/order/index.ts

@@ -40,6 +40,18 @@ export function getScanCode(tableType: String): AxiosPromise<any> {
   });
 }
 /**
+ * 生成测试数据
+ *
+ * @param userId
+ */
+export function getTestCode(): AxiosPromise<any> {
+  return request({
+    url: "/api/v1/plan/order/testCode",
+    method: "get",
+  });
+}
+
+/**
  * 扫码导入提交
  *
  *

+ 11 - 3
src/views/plan/order/index.vue

@@ -19,6 +19,7 @@
     >
       <template #menu-left="{ size }">
         <el-button type="primary" @click="scan">扫码导入</el-button>
+        <el-button type="primary" @click="test">测试数据</el-button>
       </template>
       <template #menu-right="{}">
         <el-dropdown split-button v-hasPerm="['plan:order:import']"
@@ -224,6 +225,7 @@ import {
   getExpandAlias,
   scanImport,
   getScanCode,
+  getTestCode,
 } from "@/api/order";
 import { ref } from "vue";
 import _ from "lodash-es";
@@ -567,17 +569,23 @@ option.value = {
 };
 function useScanCode() {
   const scanCodeArray = ref([]);
+  const test = async () => {
+    const { data, code } = await getTestCode();
+    let data1 = [];
+    data1.push(JSON.stringify(data[0]));
+    scanCodeArray.value = data1;
+    dialog3.visible = true;
+  };
   const handleScanCode = async (id: string) => {
     const { data, code } = await getScanCode(id);
     let data1 = [];
     data1.push(data[0]);
-    data1.push(data[0]);
     scanCodeArray.value = data1;
     dialog3.visible = true;
   };
-  return { scanCodeArray, handleScanCode };
+  return { scanCodeArray, handleScanCode, test };
 }
-const { scanCodeArray, handleScanCode } = useScanCode();
+const { scanCodeArray, handleScanCode, test } = useScanCode();
 //扫码板块
 
 function useScan() {