snow 2 years ago
parent
commit
ec53736a26

+ 133 - 69
src/components/ReconciliationForm/src/cpns/purchase-modal.vue

@@ -4,7 +4,8 @@ import { reactive, ref, unref } from "vue";
 import { useAsync } from "/@/hooks/core/useAsync";
 import { httpCgdList } from "/@/api/purchase/orderRecord";
 import { selectOptions as _selectOptions } from "../_options";
-import { INPUT_MAX_LENGTH } from "/@/utils/global";
+import { useDebounceFn } from "@vueuse/core";
+
 
 import {
   send_status_list,
@@ -14,14 +15,13 @@ import {
 
 const emit = defineEmits(["pushOrder"]);
 
-const props = defineProps<{
-  supplierNo?: string;
-  companyNo?: string;
-}>();
+const state = ref({
+  supplierNo: "",
+  companyNo: ""
+});
 
 const visible = ref(false);
 const selection = ref<Array<any>>([]);
-const selectOptions = ref(_selectOptions);
 const tableRef = ref<InstanceType<typeof ElTable>>(null);
 
 const {
@@ -33,8 +33,13 @@ const {
   success: _data => (pagination.total = _data.count)
 });
 
-const formData = ref<Record<string, string>>({
-  codeType: "sequenceNo",
+const formData = ref<Record<string, any>>({
+  timer: [],
+  sequenceNo: "",
+  cxCode: "",
+  goodNo: "",
+  goodName: "",
+  cgder: "",
   sendstatus: "",
   cgdsource: "",
   cgdtype: "",
@@ -49,13 +54,14 @@ const pagination = reactive({
 
 async function handleSearch() {
   loading.value = true;
-  const { companyNo, supplierNo } = props;
+  const { companyNo, supplierNo } = state.value;
   const { currentPage: page, pageSize: size } = pagination;
-  const { codeType, code: keyword, ...restParams } = formData.value;
+  const { timer, ...restParams } = formData.value;
 
   const searchParams = {
     ...restParams,
-    [codeType]: keyword,
+    start: timer[0],
+    end: timer[1],
     status: "0",
     supplierNo,
     companyNo,
@@ -69,7 +75,18 @@ async function handleSearch() {
 //重置搜索
 function handleReset() {
   pagination.currentPage = 1;
-  formData.value = {};
+  formData.value = {
+    timer: [],
+    sequenceNo: "",
+    goodNo: "",
+    goodName: "",
+    cgder: "",
+    cxCode: "",
+    sendstatus: "",
+    cgdsource: "",
+    cgdtype: "",
+    code: ""
+  };
   handleSearch();
 }
 
@@ -90,7 +107,10 @@ const handleSizeChange = () => {
 };
 
 defineExpose({
-  onDisplay: () => (visible.value = true)
+  onDisplay: (_state: any) => {
+    visible.value = true;
+    state.value = _state;
+  }
 });
 </script>
 
@@ -103,63 +123,103 @@ defineExpose({
     width="1040px"
     @open="handleSearch"
   >
-    <div flex justify-between>
-      <div flex mb-2 gap-2 w-full>
-        <div flex mb-2 gap-2>
-          <el-input
-            v-model="formData.code"
-            placeholder="关键字"
-            class="input-with-select"
-            :maxlength="INPUT_MAX_LENGTH"
-            style="width: 340px"
-            clearable
-          >
-            <template #prepend>
-              <ElSelect
-                v-model="formData.codeType"
-                placeholder="关键字类型"
-                style="width: 130px"
-              >
-                <ElOption
-                  v-for="(si, sii) in selectOptions"
-                  :key="'si' + si.value + sii"
-                  :label="si.label"
-                  :value="si.value"
-                />
-              </ElSelect>
-            </template>
-          </el-input>
+    <ElRow :gutter="5" mb-1>
+      <ElCol :span="6">
+        <ElDatePicker
+          size="small"
+          type="daterange"
+          v-model="formData.timer"
+          start-placeholder="开始时间"
+          end-placeholder="结束时间"
+          value-format="YYYY-MM-DD"
+          style="width: 100%"
+        />
+      </ElCol>
 
-          <ElSelect
-            placeholder="发货状态"
-            v-model="formData.sendstatus"
-            clearable
-            w-200px
-          >
-            <ElOption
-              v-for="status in send_status_list"
-              :key="status.value"
-              :label="status.label"
-              :value="status.value"
-            />
-          </ElSelect>
+      <ElCol :span="6">
+        <ElInput
+          size="small"
+          placeholder="采购单编号"
+          v-model="formData.sequenceNo"
+        />
+      </ElCol>
 
-          <ElSelect
-            v-model="formData.cgdsource"
-            placeholder="订单来源"
-            clearable
-          >
-            <ElOption
-              v-for="c in cg_order_source_options"
-              :key="c.value"
-              :label="c.label"
-              :value="c.value"
-            />
-          </ElSelect>
+      <ElCol :span="6">
+        <ElInput
+          size="small"
+          placeholder="采购主单编号"
+          v-model="formData.cxCode"
+        />
+      </ElCol>
+
+      <ElCol :span="6">
+        <ElInput
+          size="small"
+          placeholder="商品编号"
+          v-model="formData.goodNo"
+        />
+      </ElCol>
+    </ElRow>
+
+    <ElRow :gutter="5" mb-2>
+      <ElCol :span="6">
+        <ElInput
+          size="small"
+          placeholder="商品名称"
+          v-model="formData.goodName"
+        />
+      </ElCol>
 
+      <ElCol :span="6">
+        <ElInput
+          size="small"
+          placeholder="采购员名称"
+          v-model="formData.cgder"
+        />
+      </ElCol>
+
+      <ElCol :span="6">
+        <ElSelect
+          placeholder="发货状态"
+          v-model="formData.sendstatus"
+          size="small"
+          clearable
+          w-full
+        >
+          <ElOption
+            v-for="status in send_status_list"
+            :key="status.value"
+            :label="status.label"
+            :value="status.value"
+          />
+        </ElSelect>
+      </ElCol>
+
+      <ElCol :span="6">
+        <ElSelect
+          v-model="formData.cgdsource"
+          size="small"
+          placeholder="订单来源"
+          clearable
+          w-full
+        >
+          <ElOption
+            v-for="c in cg_order_source_options"
+            :key="c.value"
+            :label="c.label"
+            :value="c.value"
+          />
+        </ElSelect>
+      </ElCol>
+    </ElRow>
+
+    <ElRow mb-2>
+      <div w-full flex justify-between>
+        <ElCol :span="6">
           <ElSelect
             v-model="formData.cgdtype"
-            w-200px
+            size="small"
+            w-full
             placeholder="商品来源"
             clearable
           >
@@ -170,12 +230,16 @@ defineExpose({
               :value="c.value"
             />
           </ElSelect>
+        </ElCol>
 
-          <ElButton @click="handleSearch" type="primary">搜索</ElButton>
-          <ElButton @click="handleReset">重置</ElButton>
-        </div>
+        <ElCol :span="3">
+          <ElButton size="small" @click="handleSearch" type="primary"
+            >搜索</ElButton
+          >
+          <ElButton size="small" @click="handleReset">重置</ElButton>
+        </ElCol>
       </div>
-    </div>
+    </ElRow>
 
     <ElTable
       ref="tableRef"

+ 4 - 13
src/components/ReconciliationForm/src/cpns/purchase-table.vue

@@ -1,11 +1,10 @@
 <script setup lang="ts">
-import { ref, computed } from "vue";
+import { computed } from "vue";
 import { ElMessage } from "element-plus";
 import { CG_ORDER_SOURCE_OPTIONS } from "/@/config/status";
-import PurchaseModal from "./purchase-modal.vue";
 import { cg_order_type_options } from "/@/utils/status";
 
-const emit = defineEmits(["push", "delete", "choose"]);
+const emit = defineEmits(["delete", "choose", "display-modal"]);
 
 const props = defineProps<{
   companyNo?: string;
@@ -15,8 +14,6 @@ const props = defineProps<{
   isPurchPay?: boolean;
 }>();
 
-const PurchaseModalRef = ref<InstanceType<typeof PurchaseModal> | null>(null);
-
 const sendOptions = [
   {
     value: "1",
@@ -45,7 +42,8 @@ function handleAddPurchase() {
   if (!supplierNo || !companyNo) {
     return ElMessage.warning("请选择供应商和业务公司");
   }
-  PurchaseModalRef.value.onDisplay();
+  emit("display-modal", { supplierNo, companyNo });
+  // PurchaseModalRef.value.onDisplay();
 }
 </script>
 
@@ -176,12 +174,5 @@ function handleAddPurchase() {
         </template>
       </ElTableColumn>
     </ElTable>
-
-    <PurchaseModal
-      ref="PurchaseModalRef"
-      :companyNo="companyNo"
-      :supplierNo="supplierNo"
-      @pushOrder="orders => emit('push', orders)"
-    />
   </div>
 </template>

+ 14 - 7
src/components/ReconciliationForm/src/index.vue

@@ -6,13 +6,13 @@ import RemoteSelect from "/@/components/RemoteSelect";
 import PurchaseTable from "./cpns/purchase-table.vue";
 import { useAsync } from "/@/hooks/core/useAsync";
 import { ElForm, ElMessageBox } from "element-plus";
-import { rules } from "./_options";
 import { httpGetAllCompany } from "/@/api/user";
+import PurchaseModal from "./cpns/purchase-modal.vue";
+import { rules } from "./_options";
 
 import { useCompany } from "/@/hooks/core/useCompany";
 
 const emit = defineEmits(["create", "choose"]);
-
 // 北京普润心堂商贸有限公司
 // 北京百辰荣达国际科贸有限公司
 const _disabledCompanys = ["QS2206011447553544", "QS2203150147013805"];
@@ -37,6 +37,8 @@ const formData = ref({
 const formRef = ref<InstanceType<typeof ElForm>>(null);
 const purchaseOrders = ref<Record<string, any>[]>([]);
 
+const PurchaseModalRef = ref<InstanceType<typeof PurchaseModal> | null>(null);
+
 const {
   data,
   loading: _loading,
@@ -51,17 +53,18 @@ const {
 //追加采购单并去重
 function uniquePurchaseOrders(list?: any[]) {
   if (!list) return;
-
   for (let i = 0; i < list.length; i++) {
     const current = list[i];
-
     if (formData.value.cids.includes(current.id)) continue;
-
     purchaseOrders.value.push(current);
     formData.value.cids.push(current.id);
   }
 }
 
+function handleDisplayModal({ supplierNo, companyNo }) {
+  PurchaseModalRef.value.onDisplay({ supplierNo, companyNo });
+}
+
 function handleDeletePurchaseOrders(index: number) {
   purchaseOrders.value.splice(index, 1);
   formData.value.cids.splice(index, 1);
@@ -72,7 +75,6 @@ function handleGetItem(item) {
 }
 
 function handleCreate() {
-  props.isPurch;
   const { companyItem, companyNo } = formData.value;
 
   if (!props.isPurch && companyNo && _disabledCompanys.includes(companyNo)) {
@@ -209,7 +211,7 @@ defineExpose({
           :readonly="readonly"
           :purchaseOrders="purchaseOrders"
           @delete="handleDeletePurchaseOrders"
-          @push="uniquePurchaseOrders"
+          @display-modal="handleDisplayModal"
         />
       </ElFormItem>
 
@@ -232,5 +234,10 @@ defineExpose({
       @delete="handleDeletePurchaseOrders"
       @push="uniquePurchaseOrders"
     />
+
+    <PurchaseModal
+      ref="PurchaseModalRef"
+      @pushOrder="orders => uniquePurchaseOrders(orders)"
+    />
   </div>
 </template>

+ 14 - 16
src/views/InvoiceSales/invoiceApply/config/configs.ts

@@ -126,8 +126,20 @@ export const ADD_EDIT_FORM_RULES = {
   email: [
     {
       required: true,
-      message: "请输入电子邮箱",
-      trigger: "change"
+      trigger: "change",
+      validator(_, value, callback) {
+        if (!value && this.required) {
+          callback(new Error("请输入电子邮箱"));
+          return;
+        }
+
+        if (!isEmail(value) && value) {
+          callback(new Error("电子邮箱格式不正确"));
+          return;
+        }
+
+        callback();
+      }
     }
   ],
   id_number: [
@@ -148,20 +160,6 @@ export const ADD_EDIT_FORM_RULES = {
       message: "真实姓名格式不正确"
     }
   ]
-  // exam_remark: [
-  //   {
-  //     required: true,
-  //     message: "请输入申请备注",
-  //     trigger: "blur"
-  //   }
-  // ]
-  // remark: [
-  //   {
-  //     required: true,
-  //     message: "请输入开票备注",
-  //     trigger: "blur"
-  //   }
-  // ]
 };
 
 export const requriedEmail = (_, value, callback: any) => {

+ 1 - 1
src/views/InvoiceSales/invoiceApply/config/content.config.ts

@@ -106,7 +106,7 @@ const columns = [
   {
     label: "操作",
     fixed: "right",
-    width: 80,
+    width: 140,
     slot: "operation"
   }
 ];

+ 10 - 4
src/views/InvoiceSales/invoiceApply/index.vue

@@ -17,9 +17,6 @@ import { usePermission } from "/@/hooks/core/usePermission";
 
 const PageName = "invoiceApply";
 
-//   { code: "026", name: "导出发票申请信息" },
-//   { code: "027", name: "下载发票信息导入模板" },
-//   { code: "028", name: "批量导入财务开票结果(发票申请)" },
 const { hasPermissionWithCode } = usePermission(PageName);
 const loading = ref(false);
 
@@ -148,11 +145,20 @@ function onDownloadTemplate() {
             <ElButton
               text
               type="primary"
-              style="margin-left: 0px"
+              style="margin-left: 0px; padding-right: 0px"
               :icon="useRenderIcon('refresh-right')"
             />
           </template>
         </ElPopconfirm>
+
+        <ElTooltip content="修改发票信息" placement="top">
+          <ElButton
+            text
+            :icon="useRenderIcon('edit')"
+            style="margin-left: 0px"
+            type="primary"
+          />
+        </ElTooltip>
       </template>
     </PageContainer>