Browse Source

对账添加按销售单查找

xiaodai2017 1 year ago
parent
commit
4464071e6b

+ 45 - 17
src/components/ReconciliationForm/src/cpns/batch-mode.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { ref, unref } from "vue";
+import { ref, unref, watch } from "vue";
 import { ElTable } from "element-plus";
 import { useAsync } from "/@/hooks/core/useAsync";
 import { httpBatch } from "/@/api/purchase/orderRecord";
@@ -11,13 +11,14 @@ import {
   cg_order_source_options,
   cg_order_type_options
 } from "/@/utils/status";
-
 const emit = defineEmits(["selection"]);
 const props = defineProps<{
   supplierNo?: string;
   companyNo?: string;
+  type: string;
 }>();
-
+const searchType = ref(props.type);
+const placeholder = ref(setPlaceholder(searchType.value));
 const tableRef = ref<InstanceType<typeof ElTable>>(null);
 const sourceText = ref("");
 
@@ -43,26 +44,35 @@ function replaceTextWrapAndSpace(text = "") {
 
 function handleEnter() {
   const text = replaceTextWrapAndSpace(sourceText.value);
+  /* 统一替换字符 **/
+  const parserText = text
+    .replace(/[,。;、; .]/g, ",")
+    .replace(/(^,*)|(,*$)/g, "");
+  const cgdNoArr = parserText.split(",");
   /* 去掉回车和空格 **/
-  if (text.length === 0) {
+  if (parserText.length === 0 || cgdNoArr.length === 0) {
     ElMessage.warning("不能解析空文本");
     sourceText.value = text;
     return;
   }
-
-  /* 统一替换字符 **/
-  const parserText = text.replace(/[,。;、; .]/g, ",");
-  const cgdNoArr = parserText.split(",");
-  sourceText.value = "";
-
   run(
-    httpBatch({
-      size: 100,
-      cgdNoArr,
-      companyNo: props.companyNo,
-      supplierNo: props.supplierNo
-    })
+    httpBatch(
+      searchType.value == "2"
+        ? {
+            size: 100,
+            cgdNoArr,
+            companyNo: props.companyNo,
+            supplierNo: props.supplierNo
+          }
+        : {
+            size: 100,
+            qrdNoArr: cgdNoArr,
+            companyNo: props.companyNo,
+            supplierNo: props.supplierNo
+          }
+    )
   );
+  sourceText.value = "";
 }
 
 function onSubmit() {
@@ -76,6 +86,24 @@ function onSubmit() {
   // }
   emit("selection", unref(tableData));
 }
+function setPlaceholder(type) {
+  return `输入${
+    type === "2" ? "采购单" : "销售单"
+  }编码(小于100条),系统支持的分割符为逗号(,)、句号(.)、分号(;)、顿号(、),回车后开始解析。`;
+}
+watch(
+  () => props.type,
+  type => {
+    searchType.value = type;
+    placeholder.value = setPlaceholder(type);
+    tableData.value = [];
+    loading.value = false;
+    sourceText.value = "";
+  },
+  {
+    immediate: true
+  }
+);
 </script>
 
 <template>
@@ -83,7 +111,7 @@ function onSubmit() {
     :rows="4"
     v-model="sourceText"
     style="margin-bottom: 10px"
-    placeholder="输入采购单编码(小于100条),系统支持的分割符为逗号(,)、句号(.)、分号(;)、顿号(、),回车后开始解析。"
+    :placeholder="placeholder"
     type="textarea"
     @keydown.enter="handleEnter"
   />

+ 8 - 7
src/components/ReconciliationForm/src/cpns/purchase-modal.vue

@@ -11,7 +11,7 @@ defineProps<{
 const emit = defineEmits(["pushOrder"]);
 
 const visible = ref(false);
-const isBatch = ref(false);
+const isBatch = ref("1");
 
 //派发保存x
 function handlePushOrder(orders) {
@@ -34,13 +34,13 @@ defineExpose({
     destroy-on-close
     width="1040px"
   >
-    <el-switch
-      active-text="批量查找"
-      inactive-text="勾选查找"
-      v-model="isBatch"
-    />
+    <el-radio-group v-model="isBatch">
+      <el-radio label="1">勾选查找</el-radio>
+      <el-radio label="2">批量查找(采购单号)</el-radio>
+      <el-radio label="3">批量查找(销售单号)</el-radio>
+    </el-radio-group>
 
-    <template v-if="!isBatch">
+    <template v-if="isBatch === '1'">
       <single-mode
         :company-no="companyNo"
         :supplier-no="supplierNo"
@@ -52,6 +52,7 @@ defineExpose({
       <batch-mode
         :company-no="companyNo"
         :supplier-no="supplierNo"
+        :type="isBatch"
         @selection="handlePushOrder"
       />
     </template>

+ 2 - 1
src/layout/components/navbar.vue

@@ -137,7 +137,8 @@ async function onSwitchAccountMode() {
       <!-- 采销系统入口 -->
       <el-tooltip placement="bottom" content="登录工单管理系统">
         <p class="bell-icon shake" @click="openPurchaseSystem(2)">
-          <IconifyIconOffline icon="Management" />
+          工单
+          <!-- <IconifyIconOffline icon="Management" /> -->
         </p>
       </el-tooltip>
       <el-tooltip placement="bottom" content="登录采销平台">