소스 검색

Merge branch 'purchaseDev' of http://172.16.100.139/new-business/drp-web into purchaseDev

黄梓星 2 년 전
부모
커밋
bfeb1e2365

+ 1 - 0
src/api/business/purchase/purchase-order.js

@@ -11,6 +11,7 @@ const list = (data, page) => {
   });
 }
 
+
 // 采购订单详情
 const details = (id, params) => {
   return request({

+ 6 - 6
src/components/popover-select/components/ALLOCATION_PARAM.js

@@ -1,12 +1,12 @@
 // 货位
 export default [
   // 树
-  {
-    key: "id",
-    title: "ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "编码",

+ 6 - 6
src/components/popover-select/components/BALATYPE_PARAM.js

@@ -1,11 +1,11 @@
 // 结算方式
 export default [
-  {
-    key: "id",
-    title: "结算方式ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "结算方式ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "编码",

+ 6 - 6
src/components/popover-select/components/CUSTOMERDEPT_PARAM.js

@@ -1,11 +1,11 @@
 // 客户部门
 export default [
-  {
-    key: "id",
-    title: "客户部门ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "客户部门ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "客户部门编码",

+ 6 - 6
src/components/popover-select/components/CUSTOMER_PARAM.js

@@ -1,11 +1,11 @@
 // 收货客户
 export default [
-  {
-    key: "id",
-    title: "收货客户ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "收货客户ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "收货客户编码",

+ 6 - 6
src/components/popover-select/components/OPERATING_PARAM.js

@@ -1,11 +1,11 @@
 // 经营性项目
 export default [
-  {
-    key: "id",
-    title: "经营性项目ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "经营性项目ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "经营性项目编码",

+ 6 - 6
src/components/popover-select/components/PROJECT_PARAM.js

@@ -1,11 +1,11 @@
 // 在建工程项目
 export default [
-  {
-    key: "id",
-    title: "在建工程项目ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "在建工程项目ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "在建工程项目编码",

+ 6 - 6
src/components/popover-select/components/RETREASON_PARAM.js

@@ -1,11 +1,11 @@
 // 退换原因
 export default [
-  {
-    key: "id",
-    title: "退换原因ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "退换原因ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "退换原因编码",

+ 6 - 6
src/components/popover-select/components/SUPPLIERCONTACTS_PARAM.js

@@ -1,11 +1,11 @@
 // 供应商联系人
 export default [
-  {
-    key: "id",
-    title: "ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "编码",

+ 6 - 6
src/components/popover-select/components/TAX_RATE_PARAM.js

@@ -1,10 +1,10 @@
 export default [
-  {
-    key: "id",
-    title: "ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "编码",

+ 6 - 6
src/components/popover-select/components/UNIT_PARAM.js

@@ -1,12 +1,12 @@
 // 货位
 export default [
   // 树
-  {
-    key: "id",
-    title: "ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "编码",

+ 6 - 6
src/components/popover-select/components/WAREHOUSE_PARAM.js

@@ -1,11 +1,11 @@
 // 收货仓库
 export default [
-  {
-    key: "id",
-    title: "仓库ID",
-    type: "Input",
-    search: true,
-  },
+  // {
+  //   key: "id",
+  //   title: "仓库ID",
+  //   type: "Input",
+  //   search: true,
+  // },
   {
     key: "code",
     title: "仓库编码",

+ 1 - 1
src/utils/init/index.js

@@ -33,4 +33,4 @@ export const initRules = (prop) => {
   return rules;
 };
 
-export const initPage = () => ({ pageNum: 1, pageSize: 10, total: 0,isAsc:"desc" });
+export const initPage = () => ({ pageNum: 1, pageSize: 10, total: 0, });

+ 56 - 14
src/views/purchase/purchase-order/add/column.js

@@ -64,6 +64,7 @@ export const Columns = [
     },
     queryParams: () => ({}),
     isShow:true,
+    require: true,
   },
   {
     key: "finalTypeName",
@@ -82,10 +83,10 @@ export const Columns = [
     key: "buyerName",
     title: "采购员",
     inputType: "PopoverSelect",
-    valueKey: "id",
+    valueKey: "code",
     referName: "CONTACTS_PARAM",
     dataMapping: {
-      buyer: 'id',
+      buyer: 'code',
       buyerName: 'name'
     },
     queryParams: () => ({}),
@@ -163,6 +164,7 @@ export const Columns = [
       pkOrg: params.puOrg,
     }),
     isShow:true,
+    require: true,
   },
   {
     key: "goodsAllocationName",
@@ -175,6 +177,7 @@ export const Columns = [
       goodsAllocationName: 'name'
     },
      isShow:true,
+     require: true,
     queryParams: (params) => ({
       stordocId: params.warehouse,
     }),
@@ -188,14 +191,12 @@ export const Columns = [
     title: "订单使用返利金额", 
     inputType: "Input",
     isShow:true, 
-    require: true,
   },
   { 
     key: "deductionMoney", 
     title: "订单抵扣余款金额", 
     inputType: "Input",
     isShow:true, 
-    require: true,
   },
   { 
     key: "goodsWarehouseName",
@@ -203,6 +204,7 @@ export const Columns = [
     inputType: "Input",
     isShow:true,
     disabled:true,
+    require: true,
   },
   { 
     key: "address",
@@ -275,10 +277,10 @@ export const Columns = [
     key: "agentName",
     title: "代理人",
     inputType: "PopoverSelect",
-    valueKey: "id",
+    valueKey: "code",
     referName: "CONTACTS_PARAM",
     dataMapping: {
-      agent: 'id',
+      agent: 'code',
       agentName: 'name'
     },
      isShow:true,
@@ -777,14 +779,54 @@ export const TabColumns = [
         width: 120,
         require: true,
       },
-      { key: "stroageQty", title: "累计到货主数量", inputType: "Input", width: 120 },
-      { key: "stockQty", title: "累计入库主数量", inputType: "Input", width: 120 },
-      { key: "invoiceQty", title: "累计开票主数量", inputType: "Input", width: 120 },
-      { key: "rollbackQty", title: "累计退货主数量", inputType: "Input", width: 120 },
-      { key: "backStockQty", title: "累计退库主数量", inputType: "Input", width: 120 },
-      { key: "floatQty", title: "未到货数量", inputType: "Input", width: 120 },
-      { key: "createByName", title: "创建人名称", inputType: "Input", width: 120 },
-      { key: "updateByName", title: "更新人名称", inputType: "Input", width: 120 },
+      { 
+        key: "stroageQty", 
+        title: "累计到货主数量", 
+        inputType: "Input", 
+        width: 120 
+      },
+      { 
+        key: "stockQty", 
+        title: "累计入库主数量", 
+        inputType: "Input", 
+        width: 120 
+      },
+      { 
+        key: "invoiceQty", 
+        title: "累计开票主数量", 
+        inputType: "Input", 
+        width: 120 
+      },
+      { 
+        key: "rollbackQty", 
+        title: "累计退货主数量", 
+        inputType: "Input", 
+        width: 120 
+      },
+      { 
+        key: "backStockQty", 
+        title: "累计退库主数量", 
+        inputType: "Input", 
+        width: 120 
+      },
+      { 
+        key: "floatQty", 
+        title: "未到货数量", 
+        inputType: "Input", 
+        width: 120 
+      },
+      { 
+        key: "createByName", 
+        title: "创建人名称", 
+        inputType: "Input", 
+        width: 120 
+      },
+      { 
+        key: "updateByName", 
+        title: "更新人名称", 
+        inputType: "Input", 
+        width: 120 
+      },
     ]
   },
 ];

+ 35 - 19
src/views/purchase/purchase-order/add/index.vue

@@ -37,9 +37,7 @@ export default {
         puOrderItemList: [],
         puOrderExecuteList: [],
       },
-
       tabColumns: NewTabColumns,
-
       tabName: "puOrderItemList",
     };
   },
@@ -224,11 +222,8 @@ export default {
         puOrderExecuteList: [],
       };
     },
-    // 保存
-    async handleSava() {
-      // orderAddForm
-      console.log(this.params, "params");
-
+    // 判断保存条件
+    judgeSaveCondition(cb){
       this.$refs['orderAddForm'].validate(async (valid) => {
         if (valid) {
 
@@ -237,7 +232,30 @@ export default {
             this.$message.error('请填写订单行!');
             return false;
           }
-          try {
+
+          // puOrderItemList
+         let isPrice =  this.params.puOrderItemList.filter(item => !item.whetherCompleteInquiry);
+
+         if(isPrice.length){
+
+            this.$message.error('询价失败!');
+            return false
+
+         }
+         console.log(isPrice,'isPrice');
+          cb();
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 保存
+     handleSava() {
+     console.log(this.params,'this.params---------');
+      this.judgeSaveCondition(async()=>{
+        try {
+            this.loading = true;
             const { code, msg } = await orderApi.create(this.params);
             if (code === 200) {
               this.handleCancel();
@@ -245,13 +263,9 @@ export default {
           } catch (err) {
             //
           } finally {
-            // this.setVisible(false);
+            this.loading = false;
           }
-        } else {
-          console.log('error submit!!');
-          return false;
-        }
-      });
+      })
     },
     // 保存并新增
     async handleSubmit() {
@@ -284,7 +298,7 @@ export default {
       });
     },
     // 子表参照改变之后
-    handleReferChange(val, type, source) {
+    handleReferChange(val, source, type) {
       console.log(val, "val");
       console.log(source, "source");
       console.log(type, "type");
@@ -380,9 +394,11 @@ export default {
           <h3>新增</h3>
           <div style="text-align: right">
             <el-button size="mini" @click="handleCancel">取消</el-button>
-            <el-button size="mini" type="danger" @click="handleSava"
-              >保存</el-button
-            >
+            <el-button 
+              size="mini" 
+              type="danger"
+              @click="handleSava"
+            >保存</el-button>
             <!-- <el-button size="mini" type="info" @click="handleSubmit">
               保存并新增
             </el-button> -->
@@ -537,7 +553,7 @@ export default {
                   <el-form-item 
                     label-width="0" 
                     :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
-                    :rules="{ required: cColumn.require, message: `${cColumn.title}不能为空`, trigger: 'change' }"
+                    :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }"
                   >
                     <el-tag v-if="cColumn.key === 'index'" >
                       {{ scope.$index + 1 }}

+ 28 - 10
src/views/purchase/purchase-order/edit/index.vue

@@ -159,16 +159,38 @@ export default {
         puOrderExecuteList: [],
       }
     },
-    // 保存
-    async handleSava() {
+    // 判断保存条件
+    judgeSaveCondition(cb){
       this.$refs['orderEditForm'].validate(async (valid) => {
         if (valid) {
+
           if(!this.params['puOrderItemList'].length || !this.params['puOrderExecuteList'].length){
 
             this.$message.error('请填写订单行!');
             return false;
           }
-          try {
+
+          let isPrice =  this.params.puOrderItemList.filter(item => !item.whetherCompleteInquiry);
+
+         if(isPrice.length){
+
+            this.$message.error('询价失败!');
+            return false
+
+         }
+         console.log(isPrice,'isPrice');
+          cb();
+
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 保存
+     handleSava() {
+      this.judgeSaveCondition(async()=>{
+        try {
             this.loading = true;
             const { code, msg } = await (this.handleIsRevise(this.params.status) ?
               orderApi.revision(this.params)
@@ -182,16 +204,12 @@ export default {
           } finally {
             this.loading = false;
           }
-        } else {
-          console.log('error submit!!');
-          return false;
-        }
-      });
+      })
     },
     beforeOpen() {
     },
     // 子表参照改变之后
-    handleReferChange(val,  type,source) {
+    handleReferChange(val, source, type) {
       console.log(val, 'val');
       console.log(source, 'source');
       console.log(type, 'type');
@@ -428,7 +446,7 @@ export default {
                   <el-form-item 
                     label-width="0" 
                     :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
-                    :rules="{ required: cColumn.require, message: `${cColumn.title}不能为空`, trigger: 'change' }"
+                    :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }"
                   >
 
                   <span v-if="!cColumn.inputType">

+ 5 - 6
src/views/purchase/purchase-order/index.vue

@@ -50,14 +50,13 @@ export default {
     this.fetchList(this.params, this.page);
   },
   methods: {
-    async fetchList(params, page) {
+    async fetchList(data, params) {
       try {
         this.loading = true;
-        // const { pageNum, pageSize } = page;
-        console.log(
-          page,'page'
-        );
-        const { code, msg, rows, total } = await orderApi.list(params, page);
+        params['isAsc'] = 'desc';
+        params['orderByColumn'] = 'updateTime';
+        
+        const { code, msg, rows, total } = await orderApi.list(data, params);
         if (code === 200) {
           this.page.total = total;
           this.tableData = rows;