瀏覽代碼

1.获取字典逻辑修改。2.出库修改。

jiaxiaoqiang 1 年之前
父節點
當前提交
7f745ead66
共有 2 個文件被更改,包括 22 次插入13 次删除
  1. 4 1
      src/plugins/permission.ts
  2. 18 12
      src/views/storage-out/index.vue

+ 4 - 1
src/plugins/permission.ts

@@ -18,7 +18,10 @@ export function setupPermission() {
       } else {
         const dictStore = useDictionaryStore();
         dictStore.checkAllData();
-        if (JSON.stringify(dictStore.dicts.value) === "{}") {
+        if (
+          !dictStore.dicts.value ||
+          JSON.stringify(dictStore.dicts.value) === "{}"
+        ) {
           const res = await getUserDicts(dictStore.types);
           if (res.data) {
             dictStore.dicts.value = res?.data ?? [];

+ 18 - 12
src/views/storage-out/index.vue

@@ -259,9 +259,14 @@ const materialList = ref<any[]>([]);
 
 const boxInputValue = ref("");
 const enterBoxInput = () => {
-  currentBox.value = currentBox.value.trim();
-  getBoxDetailByLabel(currentBox.value).then((res: any) => {
-    toSendBoxInfo.value = res.data;
+  boxInputValue.value = boxInputValue.value.trim();
+  getBoxDetailByLabel(boxInputValue.value).then((res: any) => {
+    toSendBoxInfo.value = {
+      vehicleName: res.data.name,
+      vehicleCode: res.data.code,
+      vehicleId: res.data.id,
+    };
+    boxInputValue.value = "";
   });
 };
 
@@ -335,22 +340,23 @@ const createTask = () => {
   const params = {
     circulationDetail: [...materialList.value],
     // coordinate: "",
-    houseNo: outingBox.value.houseNo,
+    // houseNo: outingBox.value.houseNo,
     // locationNo: "",
     stationId: currentDestination.value.id,
     targetType: currentDestination.value.targetType,
-    vehicleCode: outingBox.value.vehicleCode,
-    vehicleId: outingBox.value.vehicleId,
-    vehicleName: outingBox.value.vehicleName,
+    vehicleCode: toSendBoxInfo.value.vehicleCode,
+    vehicleId: toSendBoxInfo.value.vehicleId,
+    vehicleName: toSendBoxInfo.value.vehicleName,
   };
 
   addMaterialFlow(params).then((res: any) => {
     ElMessage.success(res.msg ?? "派发成功");
-    // currentBox.value = {};
-    // currentBoxIndex.value = -1;
-    // boxSearch.value = "";
-    // outingBox.value = {};
-    // outingMaterials.value = [];
+    currentBox.value = {};
+    currentBoxIndex.value = -1;
+    boxSearch.value = "";
+    outingBox.value = {};
+    outingMaterials.value = [];
+    toSendBoxInfo.value = {};
     materialList.value = [];
     currentDestination.value = {};
     currentDestinationIndex.value = -1;