Browse Source

fix:采购单对账新建尺寸

snow 2 years ago
parent
commit
846ee7f389

+ 2 - 0
src/components/BasicForm/src/basic-form.vue

@@ -34,12 +34,14 @@ defineExpose({
         v-if="!formGroup.length"
         :form-items="formItems"
         :col-layout="colLayout"
+        :contact="contact"
         v-model:form-data="formData"
       />
 
       <GroupForm
         v-else
         :form-group="formGroup"
+        :contact="contact"
         v-model:form-data="formData"
         :col-layout="colLayout"
       />

+ 60 - 0
src/components/BasicForm/src/configs/config.ts

@@ -0,0 +1,60 @@
+import { isqzf, isqz, iszf, isz, isMobile } from "/@/utils/validate";
+
+const basic = {
+  required: true,
+  message: "联系方式格式不正确"
+};
+
+export const CONTACT_OPTIONS = [
+  {
+    value: "0",
+    label: "区-固-分",
+    rule: {
+      ...basic,
+      validator(_, value) {
+        console.log(111);
+        return isqzf(value);
+      }
+    }
+  },
+  {
+    value: "1",
+    label: "区-固",
+    rule: {
+      ...basic,
+      validator(_, value) {
+        return isqz(value);
+      }
+    }
+  },
+  {
+    value: "2",
+    label: "固-分",
+    rule: {
+      ...basic,
+      validator(_, value) {
+        return iszf(value);
+      }
+    }
+  },
+  {
+    value: "3",
+    label: "固",
+    rule: {
+      ...basic,
+      validator(_, value) {
+        return isz(value);
+      }
+    }
+  },
+  {
+    value: "4",
+    label: "手机号",
+    rule: {
+      ...basic,
+      validator(_, value) {
+        return isMobile(value);
+      }
+    }
+  }
+];

+ 32 - 1
src/components/BasicForm/src/form-items.vue

@@ -1,11 +1,24 @@
 <script setup lang="ts">
+import { ref, onMounted } from "vue";
 import { useVModel } from "@vueuse/core";
 import { basicFormProps } from "./types";
 import { INPUT_MAX_LENGTH } from "/@/utils/global";
 
+import { CONTACT_OPTIONS } from "./configs/config";
+
+const contact = ref("0");
+
 const props = defineProps(basicFormProps);
 
 const formData = useVModel(props, "formData");
+
+onMounted(() => {
+  if (!props.contact) return;
+
+  const data = formData.value[props.contact];
+  contact.value =
+    CONTACT_OPTIONS.find(c => c.rule.validator("", data))?.value || "4";
+});
 </script>
 
 <template>
@@ -14,7 +27,9 @@ const formData = useVModel(props, "formData");
       <el-form-item
         :label="item.label"
         :prop="item.field"
-        :rules="item.rules"
+        :rules="
+          item.type !== 'contact' ? item.rules : CONTACT_OPTIONS[contact].rule
+        "
         :label-width="item.labelWidth"
         :style="itemStyle"
       >
@@ -81,6 +96,22 @@ const formData = useVModel(props, "formData");
           />
         </template>
 
+        <!-- 联系方式 -->
+        <template v-if="item.type === 'contact'">
+          <el-input v-model="formData[item.field]">
+            <template #prepend>
+              <el-select style="width: 115px" v-model="contact">
+                <el-option
+                  v-for="c in CONTACT_OPTIONS"
+                  :key="c.value"
+                  :label="c.label"
+                  :value="c.value"
+                />
+              </el-select>
+            </template>
+          </el-input>
+        </template>
+
         <template v-if="item.type === 'range'">
           <div flex gap-2 w-full>
             <el-input

+ 1 - 0
src/components/BasicForm/src/group-form.vue

@@ -17,6 +17,7 @@ const formData = useVModel(props, "formData");
       :form-items="item.formItems!"
       :form-data="formData"
       :col-layout="colLayout"
+      :contact="contact"
     />
   </template>
 </template>

+ 5 - 1
src/components/BasicForm/src/types.ts

@@ -9,7 +9,8 @@ export type FormItemType =
   | "img_preview"
   | "img_upload"
   | "date_picker"
-  | "range";
+  | "range"
+  | "contact";
 
 export type FormItem = {
   field: string;
@@ -60,5 +61,8 @@ export const basicFormProps = {
   formData: {
     type: Object,
     required: true
+  },
+  contact: {
+    type: String
   }
 } as const;

+ 1 - 0
src/components/PageModal/src/types.ts

@@ -15,6 +15,7 @@ export interface ModalConfig {
   colLayout?: any;
   itemStyle?: Record<string, string>;
   labelWidth?: string;
+  contact?: string;
 }
 
 export const modalProps = {

+ 3 - 0
src/components/RemoteSelect/src/remote-select.tsx

@@ -55,6 +55,9 @@ const RemoteSelect = defineComponent({
         filterable
         clearable
         remote
+        style={{
+          wdith: props.width ? props.width + "px" : ""
+        }}
         onChange={val => {
           emit(
             "itemChange",

+ 3 - 0
src/components/RemoteSelect/src/types.ts

@@ -20,5 +20,8 @@ export const RemoteSelectProps = {
   },
   isRoot: {
     type: Boolean
+  },
+  width: {
+    type: String
   }
 };

+ 0 - 1
src/utils/validate.ts

@@ -170,7 +170,6 @@ const setF = (arr: any) => {
 };
 
 // 纳税人识别号
-
 const isLicense = (s: string) => {
   return /[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}/.test(s);
 };

+ 108 - 0
src/views/InvoiceSales/invoiceApply/config/content.config.ts

@@ -0,0 +1,108 @@
+import { ContentConfig } from "/@/components/PageContent";
+import { httpList } from "/@/api/InvoiceSales/invoiceApply";
+import dayjs from "dayjs";
+
+const columns = [
+  {
+    type: "selection",
+    width: 55,
+    hide: ({ checkList }) => !checkList.includes("勾选列")
+  },
+  {
+    label: "序号",
+    type: "index",
+    width: 70,
+    hide: ({ checkList }) => !checkList.includes("序号列")
+  },
+  {
+    label: "发票申请编号",
+    prop: "invNo",
+    width: 160
+  },
+  {
+    label: "企业客户",
+    prop: "customerName",
+    width: 160
+  },
+  {
+    label: "企业客户编码",
+    prop: "inv_in",
+    width: 160
+  },
+  {
+    label: "业务企业编号",
+    prop: "inv_out"
+  },
+
+  {
+    label: "发票额度",
+    prop: "inv_value",
+    width: 110
+  },
+  //   {
+  //     label: "状态",
+  //     prop: "status",
+  //     minWidth: 80,
+  //     cellRenderer: ({ row, props }) => (
+  //       <el-tag
+  //         size={ props.size }
+  //         type={
+  //           (statusList.find(item => item.value == row.status + "") || {})
+  //       .type || "info"
+  //   }
+  //         effect = "plain"
+  //   >
+  //   {(statusList.find(item => item.value == row.status + "") || {})
+  //     .label || "--"}
+  // < /el-tag>
+  //     )
+  //   },
+  // {
+  //   label: "发票类型",
+  //     prop: "inv_type",
+  //       minWidth: 80,
+  //         cellRenderer: ({ row, props }) => (
+  //           <el-tag
+  //           size = { props.size }
+  //   type = {
+  //             (inv_type_list.find(item => item.value == row.inv_type + "") || {})
+  //     .type || "info"
+  // }
+  // effect = "plain"
+  //   >
+  //   {(inv_type_list.find(item => item.value == row.inv_type + "") || {})
+  //     .label || "--"}
+  // </el-tag>
+  //       )
+  //     },
+  {
+    label: "申请人",
+    prop: "apply_name",
+    width: 80
+  },
+  {
+    label: "创建时间",
+    width: 145,
+    prop: "addtime",
+    formatter: ({ addtime }) =>
+      addtime ? dayjs(addtime).format("YYYY-MM-DD HH:mm:ss") : ""
+  },
+  {
+    label: "操作",
+    fixed: "right",
+    width: 55,
+    slot: "operation"
+  }
+];
+
+const contentConfig: ContentConfig = {
+  title: "发票申请管理",
+  columns,
+  powers: [],
+  apis: {
+    httpList,
+    httpAdd: true
+  }
+};
+
+export default contentConfig;

+ 25 - 86
src/views/InvoiceSales/invoiceApply/index.vue

@@ -1,22 +1,20 @@
 <script setup lang="ts">
-import { useColumns } from "./columns";
-import { httpList } from "/@/api/InvoiceSales/invoiceApply";
-import { reactive, ref, onMounted } from "vue";
-import { TableProBar } from "/@/components/ReTable";
+import { reactive, ref } from "vue";
 import { type PaginationProps } from "@pureadmin/table";
 import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
-import { useNav } from "/@/layout/hooks/nav";
 import { statusList, inv_type_list } from "./status";
 import { useRouter } from "vue-router";
-import { responseHandle } from "/@/utils/responseHandle";
 import IntervalTime from "/@/components/IntervalTime";
-import { useUserStoreHook } from "/@/store/modules/user";
 import NoAuth from "/@/components/NoAuth/NoAuth.vue";
-const { logout } = useNav();
+import contentConfig from "./config/content.config";
+import { PageContent } from "/@/components/PageContent";
+import { httpList } from "/@/api/InvoiceSales/invoiceApply";
+import { useResponseHandle, usePermission } from "/@/hooks";
+
 defineOptions({
   name: "invoiceApply"
 });
-const powers = ref([]);
+
 const initform = {
   customer: "", //客户公司
   inv_out: "", //业务企业公司
@@ -33,9 +31,10 @@ const initform = {
 const form = reactive({ ...initform });
 
 const { push } = useRouter();
+const pageContentRef = ref<InstanceType<typeof PageContent>>(null);
+const responseHandle = useResponseHandle();
 const dataList = ref([]);
 const loading = ref(false);
-const { columns } = useColumns();
 
 const pagination = reactive<PaginationProps>({
   total: 0,
@@ -44,24 +43,6 @@ const pagination = reactive<PaginationProps>({
   background: true
 });
 
-async function handleCurrentChange(val: number) {
-  form.page = val;
-  await onSearch();
-}
-
-async function handleSizeChange(val: number) {
-  form.size = val;
-  form.page = 1;
-  await onSearch();
-}
-
-function handleSelectionChange(val) {
-  console.log("handleSelectionChange", val);
-}
-function timeChange(start, end) {
-  console.log(start);
-  console.log(end);
-}
 async function onSearch() {
   if (loading.value) return;
   loading.value = true;
@@ -69,7 +50,6 @@ async function onSearch() {
   responseHandle({
     code,
     message,
-    logout,
     handler: () => {
       const { list, count } = data;
       dataList.value = list ?? [];
@@ -83,35 +63,35 @@ async function onSearch() {
 }
 async function resetSearch() {
   form.page = 1;
-  await onSearch();
+  // await onSearch();
+  // pageContentRef.getP
 }
 //新建/详情页面
-function editItem(id) {
+const toDetail = (id?: string) => {
   push({
     path: "/InvoiceSales/invoiceApplyDetail",
     query: {
       ...(id ? { id } : {})
     }
   });
-}
+};
+
 async function resetForm() {
   Object.keys(form).forEach(key => {
     form[key] = initform[key];
   });
   await onSearch();
 }
-
-onMounted(() => {
-  powers.value = useUserStoreHook().getMenuActions("invoiceApply");
-  if (powers.value.some(i => i == "001")) {
-    onSearch();
-  }
+const { permission, contentConfigRef } = usePermission({
+  pageName: "invoiceApply",
+  contentConfig,
+  callback: powers => (contentConfig.powers = powers)
 });
 </script>
 
 <template>
   <div class="main">
-    <div v-if="powers.some(i => i == '001')">
+    <div v-if="permission.list">
       <div class="bg-white p-4">
         <el-row :gutter="10" class="pb-4">
           <el-col :span="5">
@@ -148,7 +128,6 @@ onMounted(() => {
             <IntervalTime
               v-model:startValue="form.start"
               v-model:endValue="form.end"
-              @timeChange="timeChange"
           /></el-col>
           <el-col :span="4">
             <el-input
@@ -198,52 +177,12 @@ onMounted(() => {
         </el-row>
       </div>
 
-      <TableProBar
-        title="发票申请管理"
-        :loading="loading"
-        :dataList="dataList"
-        @refresh="onSearch"
-      >
-        <template #buttons>
-          <el-button
-            type="primary"
-            :icon="useRenderIcon('add')"
-            @click="editItem('')"
-            v-if="powers.some(i => i === '002')"
-          >
-            新增发票申请
-          </el-button>
-        </template>
-        <template v-slot="{ size, checkList }">
-          <PureTable
-            border
-            align="left"
-            showOverflowTooltip
-            table-layout="auto"
-            :size="size"
-            :data="dataList"
-            :columns="columns"
-            :checkList="checkList"
-            :pagination="pagination"
-            :paginationSmall="size === 'small' ? true : false"
-            :header-cell-style="{ background: '#fafafa', color: '#606266' }"
-            @selection-change="handleSelectionChange"
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-          >
-            <template #operation="{ row }">
-              <el-button
-                class="reset-margin"
-                link
-                type="primary"
-                :size="size"
-                @click="editItem(row.invNo)"
-                :icon="useRenderIcon('eye-view')"
-              />
-            </template>
-          </PureTable>
-        </template>
-      </TableProBar>
+      <PageContent
+        ref="pageContentRef"
+        :content-config="contentConfigRef"
+        @preview-btn-click="({ invNo }) => toDetail(invNo)"
+        @create-btn-click="() => toDetail()"
+      />
     </div>
     <NoAuth v-else />
   </div>

+ 1 - 0
src/views/InvoiceSales/redInk/components/open-dialog.vue

@@ -3,6 +3,7 @@ import { ref, reactive } from "vue";
 import { ElMessage } from "element-plus";
 import { REMARK_MAX_LENGTH } from "/@/utils/global";
 import { httpOpenInvoice } from "/@/api/InvoiceSales/redInk";
+import { useAsync } from "/@/hooks";
 
 const visible = ref(false);
 const { run, loading } = useAsync();

+ 2 - 2
src/views/login/index.vue

@@ -165,13 +165,13 @@ watch(imgCode, value => {
             <el-form-item>
               <div class="w-full h-20px flex justify-between items-center">
                 <el-checkbox v-model="checked">记住密码</el-checkbox>
-                <el-button
+                <!-- <el-button
                   link
                   type="primary"
                   @click="useUserStoreHook().SET_CURRENTPAGE(4)"
                 >
                   忘记密码?
-                </el-button>
+                </el-button> -->
               </div>
               <el-button
                 class="w-full mt-4"

+ 0 - 10
src/views/parameter/clients/config/content.config.ts

@@ -27,20 +27,10 @@ const columns = [
     label: "归属集团",
     prop: "parent"
   },
-  {
-    label: "联系人",
-    prop: "contactor"
-  },
   {
     label: "创建时间",
     prop: "createTime",
     formatter: ({ addtime }) => dayjs(addtime).format("YYYY-MM-DD HH:mm:ss")
-  },
-  {
-    label: "操作",
-    fixed: "right",
-    width: 80,
-    slot: "operation"
   }
 ];
 

+ 23 - 21
src/views/parameter/invoiceheader/config/modal.config.ts

@@ -1,9 +1,11 @@
 import { ModalConfig } from "/@/components/PageModal/src/types";
+import { isLicense } from "/@/utils/validate";
 
 const modalConfig: ModalConfig = {
   title: "企业客户发票",
   colLayout: { span: 24 },
   itemStyle: {},
+  contact: "invoice_mobile",
   formItems: [
     {
       field: "invoice_title",
@@ -15,24 +17,6 @@ const modalConfig: ModalConfig = {
         { required: true, trigger: "change", message: "请输入发票抬头名称" }
       ]
     },
-    {
-      field: "invoice_mobile",
-      type: "input",
-      label: "企业联系方式",
-      labelWidth: "120px",
-      placeholder: "企业联系方式",
-      rules: [
-        { required: true, trigger: "change", message: "请输入企业联系方式" }
-      ]
-    },
-    {
-      field: "invoice_people",
-      type: "input",
-      labelWidth: "120px",
-      label: "法人",
-      placeholder: "法人",
-      rules: [{ required: true, trigger: "change", message: "请输入法人" }]
-    },
     {
       field: "invoice_addr",
       type: "input",
@@ -47,9 +31,17 @@ const modalConfig: ModalConfig = {
       field: "invoice_code",
       type: "input",
       labelWidth: "120px",
-      label: "发票编号",
-      placeholder: "发票编号",
-      rules: [{ required: true, trigger: "change", message: "请输入发票编号" }]
+      label: "纳税识别号",
+      placeholder: "纳税识别号",
+      rules: [
+        {
+          validator(_, value) {
+            return isLicense(value);
+          },
+          required: true,
+          message: "纳税人识别号格式不正确"
+        }
+      ]
     },
     {
       field: "invoice_bank",
@@ -68,6 +60,16 @@ const modalConfig: ModalConfig = {
       label: "银行账户",
       placeholder: "银行账户",
       rules: [{ required: true, trigger: "change", message: "请输入银行账户" }]
+    },
+    {
+      field: "invoice_mobile",
+      type: "contact",
+      label: "企业联系方式",
+      labelWidth: "120px",
+      placeholder: "企业联系方式",
+      rules: [
+        { required: true, trigger: "change", message: "请输入企业联系方式" }
+      ]
     }
   ]
 };

+ 2 - 1
src/views/purchase/orderRecord/components/create-statement/add-order-modal.vue

@@ -90,6 +90,7 @@ defineExpose({
     title="选择采购商品"
     center
     destroy-on-close
+    width="1054x"
     @open="handleSearch"
   >
     <div flex justify-between>
@@ -131,7 +132,7 @@ defineExpose({
       @selection-change="handleSelection"
     >
       <el-table-column type="selection" width="55" reserve-selection />
-      <el-table-column label="采购单编号" prop="sequenceNo" width="180" />
+      <el-table-column label="采购单编号" prop="sequenceNo" />
       <el-table-column label="采购单信息">
         <el-table-column
           label="供货商"

+ 7 - 0
src/views/purchase/orderRecord/components/create-statement/index.vue

@@ -115,6 +115,7 @@ watchEffect(() => {
         <RemoteSelect
           v-model:value="formData.supplierNo"
           :api="httpSupplierList"
+          width="300px"
           placeholder="请选择供应商"
           response-label-prop="name"
           response-val-prop="code"
@@ -142,3 +143,9 @@ watchEffect(() => {
     @save-btn-click="handleSavePurchaseOrder"
   />
 </template>
+
+<style lang="scss" scoped>
+:deep(.el-select) {
+  width: 500px;
+}
+</style>