Parcourir la source

添加客户编号校验/修改使用客户数据的相关接口

lph il y a 1 an
Parent
commit
81ea6013a1

+ 8 - 0
zkqy-ui/src/api/system/customer.js

@@ -16,6 +16,14 @@ export function getCustomer(id) {
     method: 'get'
   })
 }
+// 校验客户编号
+export function checkCustomerNo(data) {
+  return request({
+    url: '/system/customer/checkCustomerNo',
+    method: 'get',
+    params: data,
+  })
+}
 
 // 新增客户
 export function addCustomer(data) {

+ 36 - 17
zkqy-ui/src/views/orderMange/approve.vue

@@ -815,9 +815,13 @@ import { inputDisableComplete } from "@/utils/other";
 import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
 import { checkRole } from "@/utils/permission";
 import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
-import { queryDropDownBoxData } from "@/api/dragform/form";
+import {
+  queryDropDownBoxData,
+  getSaleOrderProductionList,
+} from "@/api/dragform/form";
 import { v4 as uuidv4 } from "uuid";
 import { mapState } from "vuex";
+import { listCustomer } from "@/api/system/customer";
 
 export default {
   name: "listInfo",
@@ -1500,23 +1504,38 @@ export default {
     // 获取下拉框数据
     async getDropDownData() {
       try {
-        let payLoad = [
-          {
-            basicMap: {
-              tableName: "production",
-            },
-          },
-          {
-            basicMap: {
-              tableName: "customer",
-            },
-          },
-        ];
-        let res = await queryDropDownBoxData(payLoad);
+        // let payLoad = [
+        //   {
+        //     basicMap: {
+        //       tableName: "production",
+        //     },
+        //   },
+        //   {
+        //     basicMap: {
+        //       tableName: "customer",
+        //     },
+        //   },
+        // ];
+        // let res = await queryDropDownBoxData(payLoad);
+
+        // 新的获取客户选项数据的接口
+        let res = await listCustomer({ isEnablePaging: false });
         if (res.code == 200) {
-          let { production, customer } = res.data.resultMap;
-          this.productionOptions = production || [];
-          this.customerOptions = customer || [];
+          // let { customer } = res.data.resultMap;
+          // this.allProductionOptions = production || [];
+          // this.productionOptions =
+          //   this.allProductionOptions.slice(0, 100) || [];
+          this.customerOptions = res.rows || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+        let proRes = await getSaleOrderProductionList();
+        if (proRes.code == 200) {
+          console.log(proRes.data);
+          // let { production, customer } = proRes.data.resultMap;
+          this.allProductionOptions = proRes.data || [];
+          this.productionOptions =
+            this.allProductionOptions.slice(0, 500) || [];
         } else {
           throw Error("获取下拉框数据失败");
         }

+ 43 - 23
zkqy-ui/src/views/orderMange/customerMange/index.vue

@@ -8,10 +8,10 @@
       v-show="showSearch"
       label-width="68px"
     >
-      <el-form-item label="客户名称" prop="customName">
+      <el-form-item label="超级查询" prop="queryParam">
         <el-input
-          v-model="queryParams.customName"
-          placeholder="请输入客户名称"
+          v-model="queryParams.queryParam"
+          placeholder=""
           clearable
           @keyup.enter.native="handleQuery"
         />
@@ -38,11 +38,11 @@
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          v-hasPermi="['system:customer:add']"
+          v-hasPermi="['huaxian:xsglkhgl:INSERT']"
           >新增</el-button
         >
       </el-col>
-      <el-col :span="1.5">
+      <!-- <el-col :span="1.5">
         <el-button
           type="success"
           plain
@@ -53,7 +53,7 @@
           v-hasPermi="['system:customer:edit']"
           >修改</el-button
         >
-      </el-col>
+      </el-col> -->
       <el-col :span="1.5">
         <el-button
           type="danger"
@@ -62,7 +62,7 @@
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['system:customer:remove']"
+          v-hasPermi="['huaxian:xsglkhgl:DELETE']"
           >删除</el-button
         >
       </el-col>
@@ -73,7 +73,7 @@
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          v-hasPermi="['system:customer:export']"
+          v-hasPermi="['huaxian:xsglkhgl:EXPORT']"
           >导出</el-button
         >
       </el-col>
@@ -89,7 +89,7 @@
       @selection-change="handleSelectionChange"
     >
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="主键" align="center" prop="id" />
+      <!-- <el-table-column label="主键" align="center" prop="id" /> -->
       <el-table-column label="客户编号" align="center" prop="customNo" />
       <el-table-column label="客户名称" align="center" prop="customName" />
       <el-table-column
@@ -136,7 +136,7 @@
                   type="text"
                   icon="el-icon-edit"
                   @click="handleUpdate(scope.row)"
-                  v-hasPermi="['system:customer:edit']"
+                  v-hasPermi="['huaxian:xsglkhgl:UPDATE']"
                   >修改</el-button
                 >
               </el-dropdown-item>
@@ -146,7 +146,7 @@
                   type="text"
                   icon="el-icon-delete"
                   @click="handleDelete(scope.row)"
-                  v-hasPermi="['system:customer:remove']"
+                  v-hasPermi="['huaxian:xsglkhgl:DELETE']"
                   >删除</el-button
                 >
               </el-dropdown-item>
@@ -331,6 +331,7 @@ import {
   delCustomer,
   addCustomer,
   updateCustomer,
+  checkCustomerNo,
 } from "@/api/system/customer";
 
 export default {
@@ -360,18 +361,7 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        customNo: null,
-        customName: null,
-        customPhoneNumber: null,
-        customLandine: null,
-        customMail: null,
-        customType: null,
-        customGrade: null,
-        customAddress: null,
-        customCountryType: null,
-        customDistrict: null,
-        salesman: null,
-        contactPerson: null,
+        queryParam: "",
       },
       // 表单参数
       form: {},
@@ -382,6 +372,10 @@ export default {
         ],
         customNo: [
           { required: true, message: "客户编号不能为空", trigger: "blur" },
+          {
+            validator: this.checkCustomerNoHandler,
+            trigger: "blur",
+          },
         ],
         customPhoneNumber: [
           { required: true, message: "手机号不能为空", trigger: "blur" },
@@ -393,6 +387,32 @@ export default {
     this.getList();
   },
   methods: {
+    // 校验客户编码
+    async checkCustomerNoHandler(rule, value, callback) {
+      try {
+        console.log(value);
+        let payload = {
+          customerNo: value,
+        };
+        if (this.form.id) {
+          payload.id = this.form.id;
+        }
+        console.log(payload);
+        let res = await checkCustomerNo(payload);
+        if (res.code == 200) {
+          if (res.data) {
+            callback();
+          } else {
+            callback(new Error("客户编号已存在!"));
+          }
+        } else {
+          callback(new Error(res.msg));
+        }
+      } catch (error) {
+        console.log(error);
+        callback(new Error("校验失败,请稍后再试"));
+      }
+    },
     // 根据字典value获取字典label
     getDictLabel(value, dict) {
       return (

+ 18 - 17
zkqy-ui/src/views/orderMange/financeApprove.vue

@@ -337,9 +337,13 @@ import { inputDisableComplete } from "@/utils/other";
 import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
 import { checkRole } from "@/utils/permission";
 import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
-import { queryDropDownBoxData } from "@/api/dragform/form";
+import {
+  queryDropDownBoxData,
+  getSaleOrderProductionList,
+} from "@/api/dragform/form";
 import { v4 as uuidv4 } from "uuid";
 import { mapState } from "vuex";
+import { listCustomer } from "@/api/system/customer";
 
 export default {
   name: "listInfo",
@@ -995,23 +999,20 @@ export default {
     // 获取下拉框数据
     async getDropDownData() {
       try {
-        let payLoad = [
-          {
-            basicMap: {
-              tableName: "production",
-            },
-          },
-          {
-            basicMap: {
-              tableName: "customer",
-            },
-          },
-        ];
-        let res = await queryDropDownBoxData(payLoad);
+        // 新的获取客户选项数据的接口
+        let res = await listCustomer({ isEnablePaging: false });
         if (res.code == 200) {
-          let { production, customer } = res.data.resultMap;
-          this.productionOptions = production || [];
-          this.customerOptions = customer || [];
+          this.customerOptions = res.rows || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+        let proRes = await getSaleOrderProductionList();
+        if (proRes.code == 200) {
+          console.log(proRes.data);
+          // let { production, customer } = proRes.data.resultMap;
+          this.allProductionOptions = proRes.data || [];
+          this.productionOptions =
+            this.allProductionOptions.slice(0, 500) || [];
         } else {
           throw Error("获取下拉框数据失败");
         }

+ 19 - 15
zkqy-ui/src/views/orderMange/index.vue

@@ -778,6 +778,7 @@ import moment from "moment";
 import Deliver from "@/views/orderMange/components/dialogForm/Deliver.vue";
 import OutBound from "@/views/orderMange/components/dialogForm/OutBound.vue";
 import outBoundPrint from "@/utils/print/outBoundPrint";
+import { listCustomer } from "@/api/system/customer";
 export default {
   name: "listInfo",
   dicts: ["payment_method", "direction_of_twist"],
@@ -1239,25 +1240,28 @@ export default {
     // 获取下拉框数据
     async getDropDownData() {
       try {
-        let payLoad = [
-          {
-            basicMap: {
-              tableName: "production",
-            },
-          },
-          {
-            basicMap: {
-              tableName: "customer",
-            },
-          },
-        ];
-        let res = await queryDropDownBoxData(payLoad);
+        // let payLoad = [
+        //   {
+        //     basicMap: {
+        //       tableName: "production",
+        //     },
+        //   },
+        //   {
+        //     basicMap: {
+        //       tableName: "customer",
+        //     },
+        //   },
+        // ];
+        // let res = await queryDropDownBoxData(payLoad);
+
+        // 新的获取客户选项数据的接口
+        let res = await listCustomer({ isEnablePaging: false });
         if (res.code == 200) {
-          let { customer } = res.data.resultMap;
+          // let { customer } = res.data.resultMap;
           // this.allProductionOptions = production || [];
           // this.productionOptions =
           //   this.allProductionOptions.slice(0, 100) || [];
-          this.customerOptions = customer || [];
+          this.customerOptions = res.rows || [];
         } else {
           throw Error("获取下拉框数据失败");
         }