瀏覽代碼

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

002201 2 年之前
父節點
當前提交
fd09954bc9

+ 24 - 12
src/api/business/purchase/purchase-order.js

@@ -4,9 +4,10 @@ import axios from "axios";
 // 采购订单修订列表
 const list = (data, page) => {
   return request({
-    url: `/pu/order/list?pageSize=${page.pageSize}&pageNum=${page.pageNum}`,
+    url: `/pu/order/list`,
     method: "post",
     data,
+    params:page,
   });
 }
 
@@ -99,17 +100,28 @@ const toNc = (data) => {
   });
 }
 // 付款协议  https://sy.derom.com/apiproxy/service/ssoRegServlet?userCode=000156&busiCenter=001
-const payRequest = (userCode) => {
-
-  return new Promise(resolve => {
-    // 当前 Promise 的状态由传入的 Promise 去决定
-    axios.get(`/sy-derom/apiproxy/service/ssoRegServlet?userCode=${userCode}&busiCenter=001`)
-    .then(res =>{
-      if(res.status == 200){
-        resolve(res.data)
-      }
-    })
-  })
+const payRequest = () => {
+
+  return request({
+    url: `/pu/order/paymentRequest`,
+    method: "get",
+    // params,
+  });
+
+  // return new Promise(resolve => {
+
+
+  //   // 当前 Promise 的状态由传入的 Promise 去决定
+  //   // axios.get(`${process.env.NODE_ENV == "development" ? '/sy-derom' : ''}/apiproxy/service/ssoRegServlet?userCode=${userCode}&busiCenter=001`)
+  //   let url =`${process.env.VUE_APP_BASE_API}/pu/order/paymentRequest`;
+    
+  //   axios.get(url)
+  //   .then(res =>{
+  //     if(res.status == 200){
+  //       resolve(res.data)
+  //     }
+  //   })
+  // })
   
 }
 

+ 8 - 0
src/components/popover-select/components/MATERIAL_PARAM.js

@@ -37,4 +37,12 @@ export default [
       return prop.materialMedcine.registrationNo;
     },
   },
+  {
+    key: "isDrug",
+    title: "物料药品属性",
+    type: "ComputedInput",
+    computed: (prop) => {
+      return prop.materialMedcine.isDrug == '0' ? 'Y' : 'N';
+    },
+  },
 ];

+ 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 });
+export const initPage = () => ({ pageNum: 1, pageSize: 10, total: 0,isAsc:"desc" });

+ 2 - 1
src/views/material/requisition/add.vue

@@ -1014,7 +1014,8 @@ export default {
         this.isStock = false
       } else {
         // 联动效期管理
-        this.basicForm.expiryDateManagerment = '2'
+        this.basicForm.expiryDateManagerment = '2';
+        this.basicForm.serialNoManager = '2';
         this.expCt(val)
         this.isStock = true
       }

+ 11 - 1
src/views/purchase/DemandSummary/add.vue

@@ -103,7 +103,7 @@
         <el-table-column show-overflow-tooltip label="处理确认时间" align="center" prop="affirmerTime" width="150"/>
         <!-- <el-table-column show-overflow-tooltip label="转请购时间" align="center" prop="code"/>
         <el-table-column show-overflow-tooltip label="转请购人员" align="center" prop="code"/> -->
-        <el-table-column show-overflow-tooltip label="价格类型" align="center" prop="priceType" width="150"/>
+        <el-table-column show-overflow-tooltip label="价格类型" align="center" prop="priceType" width="150" :formatter="priceClass"/>
       </el-table>
     </el-card>
 
@@ -126,6 +126,16 @@ export default {
   },
   data() {
     return{
+      priceClass(row) {
+        switch (row.priceType) {
+          case 'order':
+            return '订货价'
+          case 'consignment':
+            return '寄售价'
+          case 'adjusted':
+            return '调货价'
+        }
+      },
       // 不能直接改变props传来的值
       sonPageStu: this.pageStu,
       sonDisable: this.disable,

+ 17 - 5
src/views/purchase/DemandSummary/index.vue

@@ -285,6 +285,7 @@
           :key="isUpdate"
         >
           <el-table-column type="selection" width="60" />
+          <!-- <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo"/> -->
           <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" width="120px" :formatter="hangStatus"/>
           <el-table-column show-overflow-tooltip label="一级品类" align="center" prop="materialClassifyOneName" width="120px"/>
           <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="180px"/>
@@ -346,8 +347,7 @@
           <el-table-column show-overflow-tooltip label="有效期单位" align="center" prop="validityPeriodUnit" width="100px"/>
           <el-table-column show-overflow-tooltip label="业务类型" align="center" prop="businessType" :formatter="formatterBusinessType"/>
           <el-table-column show-overflow-tooltip label="安全库存量" align="center" prop="safetyStock" width="100px"/>
-          <el-table-column show-overflow-tooltip label="单据来源" align="center" prop="billSource"/>
-          <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo"/>
+          <el-table-column show-overflow-tooltip label="单据来源" align="center" prop="billSource" :formatter="formatterSource"/>
           <el-table-column show-overflow-tooltip label="注册人" align="center" prop="registrant"/>
           <!-- <el-table-column label="可用量" align="center" prop="qty"/> -->
           <el-table-column show-overflow-tooltip label="总需与终采差异" align="center" prop="buyDiscrepancy" width="120px"/>
@@ -416,11 +416,11 @@ export default {
           case '0':
             return '需补货'
           case '1':
-            return '待采购确认'
+            return '待计划确认'
           case '2':
-            return '采购已确认'
+            return '计划已确认'
           case '3':
-            return '采购已审核'
+            return '计划已审核'
           case '4':
             return '行关闭'
           case '5':
@@ -445,6 +445,18 @@ export default {
             return '合作部门需求'
         }
       },
+      formatterSource(row) {
+        switch (row.billSource) {
+          case '1':
+            return '手工导入'
+          case '2':
+            return '按客户计算'
+          case '3':
+            return '按仓库计算'
+          case '4':
+            return '手工新增'
+        }
+      },
       isUpdate: false,
       expanded: false,
       // 页面配置

+ 18 - 6
src/views/purchase/PurchaseDemandList/add.vue

@@ -42,7 +42,7 @@
 
          <el-col :span="1.5">
             <el-form-item label="需求客户" prop="customer" :rules="{ required: true, message: '请选择需求客户', trigger: 'blur' }">
-              <el-select clearable size="small" v-model="basicForm.customer" :disabled="sonDisable" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
+              <el-select clearable size="small" v-model="basicForm.customer" :disabled="sonDisable" @clear="cleanCustomer" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
                 <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -278,6 +278,7 @@
                   clearable
                   type="datetime"
                   size="small"
+                  format="yyyy-MM-dd"
                   value-format="yyyy-MM-dd HH:mm:ss"
                   placeholder="选择日期">
                 </el-date-picker>
@@ -586,11 +587,11 @@ export default {
         case '0':
           return '需补货'
         case '1':
-          return '待采购确认'
+          return '待计划确认'
         case '2':
-          return '采购已确认'
+          return '计划已确认'
         case '3':
-          return '采购已审核'
+          return '计划已审核'
         case '4':
           return '行关闭'
         case '5':
@@ -850,12 +851,12 @@ export default {
       this.$refs.refer.init(this.referCondition)
     },
     selectionsToInput(selection) {
-      if(this.referCondition.type == 'ORG_PARAM') {
+      if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '选择组织') {
         this.orgOptions = selection
         this.basicForm.org = selection[0].id
         this.basicForm.orgName = selection[0].name
       }
-      if(this.referCondition.type == 'CUSTOMER_PARAM') {
+      if(this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
         this.customerOptions = selection
         this.basicForm.customer = selection[0].id
         this.basicForm.customerName = selection[0].name
@@ -1018,6 +1019,17 @@ export default {
         this.basicForm.puDemandItemList[index].additionalSupplier = null
       }
     },
+    // 清除需求客户将明细行内也清空
+    cleanCustomer() {
+      this.basicForm.customer = ''
+      this.basicForm.customerName = ''
+      if (this.basicForm.puDemandItemList.length !== 0) {
+        this.basicForm.puDemandItemList.forEach(item => {
+          item.demandCustomerName = ''
+          item.demandCustomer = ''
+        })
+      }
+    },
   }
 }
 </script>

+ 7 - 23
src/views/purchase/PurchaseDemandList/index.vue

@@ -94,30 +94,15 @@
             </el-form-item>
           </el-col>
           <el-col :span="1.5">
-            <el-form-item label="审批结束日期">
-              <el-date-picker
-                v-model="queryParams.approverFinishTime"
-                type="date"
-                clearable
-                value-format="yyyy-MM-dd"
+            <el-form-item label="备注">
+              <el-input
+                v-model.trim="queryParams.remark"
                 size="small"
+                clearable
                 style="width: 200px"
-              >
-              </el-date-picker>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="10">
-          <el-col :span="1.5">
-            <el-form-item label="备注">
-            <el-input
-              v-model.trim="queryParams.remark"
-              size="small"
-              clearable
-              style="width: 200px"
-            />
-            </el-form-item>
-          </el-col>
+              />
+              </el-form-item>
+            </el-col>
         </el-row>
         </div>
       </CollapseTransition>
@@ -283,7 +268,6 @@ export default {
         billType: '',
         demandDept: '',
         demandDate: '',
-        approverFinishTime: '',
         remark: '',
         pageNum: 1,
         pageSize: 5

+ 88 - 38
src/views/purchase/purchase-order/add/column.js

@@ -19,6 +19,7 @@ export const Columns = [
     inputType: "Select",
     referName: "sys_order_type", // 字典名
     isShow:true,
+    require: true,
   },
   { key: "oaDemandNo", title: "OA需求单号", inputType: "Input",  isShow:true,},
   {
@@ -34,7 +35,8 @@ export const Columns = [
     title: "订单日期",
     inputType: "DatePicker",
     valueFormat: "yyyy-MM-dd",
-    width: 200, isShow:true,
+    width: 200, 
+    isShow:true,
   },
   {
     key: "supplierName",
@@ -77,19 +79,6 @@ export const Columns = [
     isShow:true,
   },
   {
-    key: "currencyName",
-    title: "币种",
-    inputType: "PopoverSelect",
-    valueKey: "id",
-    referName: "CURRENCY_PARAM",
-    dataMapping: {
-      currency: 'id',
-      currencyName: 'name'
-    },
-    queryParams: () => ({}),
-    isShow:true,
-  },
-  {
     key: "buyerName",
     title: "采购员",
     inputType: "PopoverSelect",
@@ -122,7 +111,6 @@ export const Columns = [
     title: "收货客户",
     inputType: "PopoverSelect",
     width: 200,
-    require: true,
     valueKey: "id",
     referName: "CUSTOMER_PARAM",
     dataMapping: {
@@ -165,7 +153,6 @@ export const Columns = [
     key: "warehouseName",
     title: "WMS入库仓库", 
     inputType: "PopoverSelect",
-    require: true,
     valueKey: "id",
     referName: "WAREHOUSE_PARAM",
     dataMapping: {
@@ -181,7 +168,6 @@ export const Columns = [
     key: "goodsAllocationName",
     title: "货位",
     inputType: "PopoverSelect",
-    require: true,
     valueKey: "id",
     referName: "ALLOCATION_PARAM",
     dataMapping: {
@@ -197,8 +183,20 @@ export const Columns = [
   { key: "isSendSrm", title: "是否同步SRM", inputType: "Checkbox",isShow:true, },
   { key: "isInvoice", title: "发票标识", inputType: "Checkbox", isShow:true,},
   { key: "supplierOrderNo", title: "供应商订单号", inputType: "Input",isShow:true, },
-  { key: "rebateMoney", title: "订单使用返利金额", inputType: "Input",isShow:true, },
-  { key: "deductionMoney", title: "订单抵扣余款金额", inputType: "Input",isShow:true, },
+  { 
+    key: "rebateMoney", 
+    title: "订单使用返利金额", 
+    inputType: "Input",
+    isShow:true, 
+    require: true,
+  },
+  { 
+    key: "deductionMoney", 
+    title: "订单抵扣余款金额", 
+    inputType: "Input",
+    isShow:true, 
+    require: true,
+  },
   { 
     key: "goodsWarehouseName",
     title: "收货仓库",
@@ -212,6 +210,7 @@ export const Columns = [
     inputType: "PopoverSelect",
     valueKey: "address",
     referName: "ADDRESS_PARAM",
+    require: true,
     isShow:true,
     dataMapping: {
       // address: 'address',
@@ -257,7 +256,6 @@ export const Columns = [
     key: "supplierContactsName",
     title: "供应商业务联系人",
     inputType: "PopoverSelect",
-    require: true,
     valueKey: "id",
     referName: "SUPPLIERCONTACTS_PARAM",
     dataMapping: {
@@ -315,14 +313,12 @@ export const Columns = [
       pkOrg: params.puOrg,
       supplierId:params.supplier
     }),
-    require: true,
   },
   { key: "isDeliver", title: "是否发货", inputType: "Checkbox",  isShow:true,},
   {
     key: "retReasonName",
     title: "退换原因",
     inputType: "PopoverSelect",
-    require: true,
     valueKey: "id",
     referName: "RETREASON_PARAM",
     dataMapping: {
@@ -336,7 +332,6 @@ export const Columns = [
     key: "processTypeName",
     title: "处理方式",
     inputType: "PopoverSelect",
-    require: true,
     valueKey: "id",
     referName: "PROCESSTYPE_PARAM",
     dataMapping: {
@@ -351,7 +346,6 @@ export const Columns = [
     key: "projectNowName",
     title: "在建工程项目",
     inputType: "PopoverSelect",
-    require: true,
     valueKey: "id",
     referName: "PROJECT_PARAM",
     dataMapping: {
@@ -365,7 +359,6 @@ export const Columns = [
     key: "operatingItemsName",
     title: "经营性项目",
     inputType: "PopoverSelect",
-    require: true,
     valueKey: "id",
     referName: "OPERATING_PARAM",
     dataMapping: {
@@ -406,6 +399,12 @@ export const Columns = [
     span: 24,
     isShow:true,
   },
+  { 
+    key: "remark",
+    title: "备注",
+    inputType: "Textarea",
+    isShow:true,
+   },
 
 ];
 
@@ -416,7 +415,13 @@ export const TabColumns = [
     title: '物料信息',
     key: 'puOrderItemList',
     tableColumns: [
-      { key: "rowNo", title: "行号", inputType: "Input", disabled:true},
+      { 
+        key: "rowNo", 
+        title: "行号", 
+        inputType: "Input", 
+        disabled:true,
+        require:false,
+      },
       // { key: "orderId", title: "采购订单ID", inputType: "Input", width: 180 },
       // {key: "material",title: "物料",inputType: "Input",   },
       {
@@ -424,6 +429,7 @@ export const TabColumns = [
         title: "物料",
         inputType: "PopoverSelect",
         width: 180,
+        require: true,
         valueKey: "id",
         referName: "MATERIAL_PARAM",
         dataMapping: {
@@ -435,8 +441,10 @@ export const TabColumns = [
           specification:'specification',
           model:'model',
           isMedcine:'isMedicineValue',
-          manufacturer:'manufacturerIdName',
-          unit:'unitIdName',
+          manufacturer:'manufacturerId',
+          manufacturerName:'manufacturerIdName',
+          unit:'unitId',
+          unitName:'unitIdName',
           // tax:'materialRateName',
           storageCondition:'storageCondition',
           carriageCondition:'transportationCondition',
@@ -444,6 +452,8 @@ export const TabColumns = [
           materialClassifyTwoName:'twoClass',
           materialClassifyThreeName:'threeClass',
           materialClassifyFourName:'fourClass',
+          registration:'registrationNo',
+          isDrug:'isDrug',
         },
         queryParams: () => ({}),
       },
@@ -451,6 +461,7 @@ export const TabColumns = [
         key: "materialCode",
         title: "物料编码",
         inputType: "Input",
+        require: true,
         width: 180,
         disabled:true,
         readonly:true,
@@ -495,7 +506,7 @@ export const TabColumns = [
         readonly:true,
         },
       { // manufacturerId  manufacturerIdName
-        key: "manufacturer",
+        key: "manufacturerName",
         title: "生产厂家代理人",
         inputType: "Input",
         width: 180,
@@ -509,7 +520,7 @@ export const TabColumns = [
          disabled:true,
       },
       { //unitId  unitIdName
-        key: "unit", 
+        key: "unitName", 
         title: "单位", 
         inputType: "Input",
         disabled:true,
@@ -520,9 +531,29 @@ export const TabColumns = [
         title: "数量",
         inputType: "InputNumber",
         controlsPosition: "right",
-        width: 120
+        width: 120,
+        require: true,
+      },
+      {
+        key: "currencyName",
+        title: "币种",
+        inputType: "PopoverSelect",
+        valueKey: "id",
+        referName: "CURRENCY_PARAM",
+        dataMapping: {
+          currency: 'id',
+          currencyName: 'name'
+        },
+        queryParams: () => ({}),
+        width: 180,
       },
-      { key: "taxPrice", title: "含税单价", inputType: "Input", },
+      { 
+        key: "taxPrice", 
+        title: "含税单价", 
+        inputType: "Input",
+        require: true,
+        width: 120,
+       },
       { key: "money", title: "价税合计", inputType: "Input", },
       { //materialRate  materialRateName
         key: "tax", 
@@ -593,7 +624,8 @@ export const TabColumns = [
         key: "registration",
          title: "注册证号", 
          inputType: "Input", 
-         width: 180 
+         width: 180 ,
+         disabled:true,
         },
 
       { //storageCondition storageConditionName
@@ -624,7 +656,13 @@ export const TabColumns = [
       { key: "discountRule", title: "折扣规则编码", inputType: "Input", width: 180 },
       { key: "reservedQty", title: "预留数量", inputType: "Input", },
       { key: "reservedPeriod", title: "预留周期", inputType: "Input", },
-      { key: "taxDeductClassify", title: "扣税类别", inputType: "Input", },
+      { 
+        key: "taxDeductClassify", 
+        title: "扣税类别", 
+        inputType: "Select",
+        referName: "tax_deduction_category", // 字典名
+        width: 180,
+       },
       { key: "exchangeRate", title: "折本汇率", inputType: "Input", },
       { key: "source", title: "上游单据号", inputType: "Input", width: 180 },
       { key: "sourceId", title: "上游单据ID", inputType: "Input", width: 180 },
@@ -684,10 +722,17 @@ export const TabColumns = [
     key: 'puOrderExecuteList',
     tableColumns: [
       // { key: "orderId", title: "采购订单ID", inputType: "Input", width: 180 },
-      { key: "rowno", title: "行号", inputType: "Input", disabled:true},
+      { 
+        key: "rowno", 
+        title: "行号", 
+        inputType: "Input", 
+        disabled:true,
+        require:false,
+      },
       {
         key: "materialName",
         title: "物料",
+        require: true,
         inputType: "PopoverSelect",
         valueKey: "id",
         referName: "MATERIAL_PARAM",
@@ -700,8 +745,10 @@ export const TabColumns = [
           specification:'specification',
           model:'model',
           isMedcine:'isMedicineValue',
-          manufacturer:'manufacturerIdName',
-          unit:'unitIdName',
+          manufacturer:'manufacturerId',
+          manufacturerName:'manufacturerIdName',
+          unit:'unitId',
+          unitName:'unitIdName',
           // tax:'materialRateName',
           storageCondition:'storageCondition',
           carriageCondition:'transportationCondition',
@@ -709,6 +756,8 @@ export const TabColumns = [
           materialClassifyTwoName:'twoClass',
           materialClassifyThreeName:'threeClass',
           materialClassifyFourName:'fourClass',
+          registration:'registrationNo',
+          isDrug:'isDrug',
         },
         queryParams: () => ({}),
         width: 180
@@ -725,7 +774,8 @@ export const TabColumns = [
         title: "数量",
         inputType: "InputNumber",
         controlsPosition: "right",
-        width: 120
+        width: 120,
+        require: true,
       },
       { key: "stroageQty", title: "累计到货主数量", inputType: "Input", width: 120 },
       { key: "stockQty", title: "累计入库主数量", inputType: "Input", width: 120 },

+ 130 - 88
src/views/purchase/purchase-order/add/index.vue

@@ -101,6 +101,7 @@ export default {
       this.params.puDept = deptId;
       this.params.puDeptName = deptName;
       this.params.billDate = new Date().Format('yyyy-MM-dd');
+      this.addTableRow();
     },
     setVisible(prop) {
       this.visible = prop;
@@ -141,21 +142,38 @@ export default {
     // 增行
     addTableRow(prop) {
       for (const key in this.params) {
-        if (Array.isArray(this.params[key])) {
+
+        // if (Array.isArray(this.params[key])) {
+        if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
+
           const arr = this.tabColumns.find(
+
             (element) => element.key === key
+
           ).tableColumns;
 
           let rowData = initParams(arr, "key", "value");
+         
 
           "rowno" in rowData &&
             (rowData["rowno"] = this.params[key].length + 1);
-          "rowNo" in rowData &&
-            (rowData["rowNo"] = this.params[key].length + 1);
+
+            // 物料
+            if("rowNo" in rowData){
+
+              rowData["rowNo"] = this.params[key].length + 1;
+              // 扣税类别
+              rowData["taxDeductClassify"] = '1';
+              // 价格类型
+              rowData["priceType"] = 'order';
+              // 币种
+              rowData["currency"] = '1002Z0100000000001K1';
+              rowData["currencyName"] = '人民币';
+            }
+          
 
           // 是否完成询价,新增明细行需默认明细为false
           rowData["whetherCompleteInquiry"] = false;
-
           this.params[key].push(rowData);
         }
       }
@@ -211,23 +229,29 @@ export default {
       // orderAddForm
       console.log(this.params, "params");
 
-      // this.$refs['orderAddForm'].validate(async (valid) => {
-      //   if (valid) {
-      try {
-        const { code, msg } = await orderApi.create(this.params);
-        if (code === 200) {
-          this.handleCancel();
+      this.$refs['orderAddForm'].validate(async (valid) => {
+        if (valid) {
+
+          if(!this.params['puOrderItemList'].length || !this.params['puOrderExecuteList'].length){
+
+            this.$message.error('请填写订单行!');
+            return false;
+          }
+          try {
+            const { code, msg } = await orderApi.create(this.params);
+            if (code === 200) {
+              this.handleCancel();
+            }
+          } catch (err) {
+            //
+          } finally {
+            // this.setVisible(false);
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
         }
-      } catch (err) {
-        //
-      } finally {
-        // this.setVisible(false);
-      }
-      // } else {
-      //   console.log('error submit!!');
-      //   return false;
-      // }
-      // });
+      });
     },
     // 保存并新增
     async handleSubmit() {
@@ -270,9 +294,17 @@ export default {
         this.handleGetPrice();
       }
 
-      if(type == "MATERIAL_PARAM"){
-        source.isDrug = val.materialMedcine.isDrug  == '0' ? 'Y' : 'N';
-        // return source;
+      // if(type == "MATERIAL_PARAM"){
+      //   source.isDrug = val.materialMedcine.isDrug  == '0' ? 'Y' : 'N';
+      // }
+    },
+
+    // 子表下拉框改变
+    handleSelectChange(type,row){
+      console.log(type,'type');
+
+      if(type == 'priceType' && row.material && row.qty && row.qty != ""){
+        this.handleGetPrice();
       }
     },
 
@@ -463,6 +495,7 @@ export default {
               <el-checkbox
                 v-if="column.inputType === 'Checkbox'"
                 v-model="params[column.key]"
+                :disabled="column.disabled"
                 true-label="Y"
                 false-label="N"
               ></el-checkbox>
@@ -496,76 +529,84 @@ export default {
               <el-table-column
                 v-for="(cColumn, cIndex) in column.tableColumns"
                 :key="cIndex"
-                :prop="cColumn.key"
+                
                 :label="cColumn.title"
                 :width="cColumn.width || 80"
               >
                 <template slot-scope="scope">
-                  <el-tag v-if="cColumn.key === 'index'">
-                    {{ scope.$index + 1 }}
-                  </el-tag>
-                  <el-input
-                    v-if="cColumn.inputType === 'Input'"
-                    v-model="scope.row[cColumn.key]"
-                    :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable"
-                    :disabled="cColumn.disabled"
-                    size="mini"
-                    style="width: 100%"
-                  ></el-input>
-
-                  <!--  -->
-                  <dr-popover-select
-                    v-if="cColumn.inputType === 'PopoverSelect'"
-                    v-model="scope.row[cColumn.key]"
-                    :source.sync="scope.row"
-                    :title="cColumn.title"
-                    :value-key="cColumn.valueKey"
-                    :type="cColumn.referName"
-                    :multiple="cColumn.multiple"
-                    :placeholder="cColumn.placeholder"
-                    :data-mapping="cColumn.dataMapping"
-                    :query-params="cColumn.queryParams"
-                    @change="handleReferChange"
-                    size="mini"
-                  >
-                  </dr-popover-select>
-
-                  <el-input-number
-                    v-if="cColumn.inputType === 'InputNumber'"
-                    v-model="scope.row[cColumn.key]"
-                    :controls-position="cColumn.controlsPosition"
-                    :placeholder="cColumn.placeholder"
-                    @change="handleInputChange(scope.row, cColumn.key)"
-                    :clearable="cColumn.clearable"
-                    :disabled="cColumn.disabled"
-                    size="mini"
-                    style="width: 100%"
-                  ></el-input-number>
-
-                  <el-select
-                    v-if="cColumn.inputType === 'Select'"
-                    v-model="scope.row[cColumn.key]"
-                    size="mini"
-                    :disabled="cColumn.disabled"
-                    :clearable="cColumn.clearable"
-                    :placeholder="cColumn.placeholder"
-                    style="width: 100%"
+                  <el-form-item 
+                    label-width="0" 
+                    :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
+                    :rules="{ required: cColumn.require, message: `${cColumn.title}不能为空`, trigger: 'change' }"
                   >
-                    <el-option
-                      v-for="item in dict.type[cColumn.referName]"
-                      :key="item.value"
-                      :label="item.label"
-                      :value="item.value"
-                    ></el-option>
-                  </el-select>
-
-                  <el-checkbox
-                    v-if="cColumn.inputType === 'Checkbox'"
-                    v-model="scope.row[cColumn.key]"
-                    true-label="Y"
-                    false-label="N"
-                  ></el-checkbox>
+                    <el-tag v-if="cColumn.key === 'index'" >
+                      {{ scope.$index + 1 }}
+                    </el-tag>
+                    <el-input
+                      v-if="cColumn.inputType === 'Input'"
+                      v-model="scope.row[cColumn.key]"
+                      :placeholder="cColumn.placeholder"
+                      :clearable="cColumn.clearable"
+                      :disabled="cColumn.disabled"
+                      size="mini"
+                      style="width: 100%"
+                    ></el-input>
+
+                    <!--  -->
+                    <dr-popover-select
+                      v-if="cColumn.inputType === 'PopoverSelect'"
+                      v-model="scope.row[cColumn.key]"
+                      :source.sync="scope.row"
+                      :title="cColumn.title"
+                      :value-key="cColumn.valueKey"
+                      :type="cColumn.referName"
+                      :multiple="cColumn.multiple"
+                      :placeholder="cColumn.placeholder"
+                      :data-mapping="cColumn.dataMapping"
+                      :query-params="cColumn.queryParams"
+                      @change="handleReferChange"
+                      size="mini"
+                    >
+                    </dr-popover-select>
+
+                    <el-input-number
+                      v-if="cColumn.inputType === 'InputNumber'"
+                      v-model="scope.row[cColumn.key]"
+                      :controls-position="cColumn.controlsPosition"
+                      :placeholder="cColumn.placeholder"
+                      @change="handleInputChange(scope.row, cColumn.key)"
+                      :clearable="cColumn.clearable"
+                      :disabled="cColumn.disabled"
+                      size="mini"
+                      style="width: 100%"
+                    ></el-input-number>
+
+                    <el-select
+                      v-if="cColumn.inputType === 'Select'"
+                      v-model="scope.row[cColumn.key]"
+                      size="mini"
+                      :disabled="cColumn.disabled"
+                      :clearable="cColumn.clearable"
+                      :placeholder="cColumn.placeholder"
+                      style="width: 100%"
+                      @change="handleSelectChange(cColumn.key,scope.row)"
+                    >
+                      <el-option
+                        v-for="item in dict.type[cColumn.referName]"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value"
+                      ></el-option>
+                    </el-select>
+
+                    <el-checkbox
+                      v-if="cColumn.inputType === 'Checkbox'"
+                      v-model="scope.row[cColumn.key]"
+                      :disabled="cColumn.disabled"
+                      true-label="Y"
+                      false-label="N"
+                    ></el-checkbox>
+                  </el-form-item>
                 </template>
               </el-table-column>
 
@@ -594,3 +635,4 @@ export default {
     </el-form>
   </el-drawer>
 </template>
+

+ 19 - 7
src/views/purchase/purchase-order/column.js

@@ -27,9 +27,15 @@ export const TableColumns = [
   // { key: "supplier", title: "供应商" },
   { key: "supplierName", title: "供应商", inputType: "Input" },
   { key: "paymentAgreementName", title: "付款协议" },
+  {
+    key: "source",
+    title: "订单来源",  
+    inputType: "Select",
+    referName: "order_source", // 字典名
+    width:80,
+  },
   // { key: "paymentAgreement", title: "付款协议" },
-  // { key: "currency", title: "币种" },
-  { key: "currencyName", title: "币种" },
+  
   // { key: "buyer", title: "采购员" },ut
   { key: "buyerName", title: "采购员" },
   // { key: "puDept", title: "采购部门" },
@@ -130,7 +136,7 @@ export const TableColumns = [
   { key: "projectNowName", title: "在建工程项目" },
   { key: "operatingItemsName", title: "经营性项目" },
   { key: "isArrivalReson", title: "到货超期原因" },
-  { key: "midOrderNo", title: "中台采购订单号" }
+  { key: "midOrderNo", title: "中台采购订单号" },
 ];
 
 export const TabColumns = [
@@ -150,14 +156,20 @@ export const TabColumns = [
       {
         key: "isMedcine",
         title: "医药物料",
-        width: 180,
         inputType: 'Checkbox',
         width:80,
       },
-      { key: "manufacturer", title: "生产厂家代理人", width: 180 },
-      { key: "isDrug", title: "物料药品属性", width: 180 },
-      { key: "unit", title: "单位", width: 180 },
+      { key: "manufacturerName", title: "生产厂家代理人", width: 180 },
+      { 
+        key: "isDrug", 
+        title: "物料药品属性",
+        inputType: 'Checkbox',
+        width:80, 
+      },
+      { key: "unitName", title: "单位", width: 180 },
       { key: "qty", title: "数量" },
+      // { key: "currency", title: "币种" },
+      // { key: "currencyName", title: "币种" },
       { key: "taxPrice", title: "含税单价" },
       { key: "money", title: "价税合计" },
       { key: "tax", title: "税率" },

+ 59 - 26
src/views/purchase/purchase-order/edit/index.vue

@@ -101,11 +101,12 @@ export default {
 
       for (const key in this.params) {
 
-        if (Array.isArray(this.params[key])) {
+        // if (Array.isArray(this.params[key])) {
+        if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
 
           const arr = this.tabColumns.find(
 
-            (element) => element.key === key
+            (element) => element['key'] === key
 
           ).tableColumns;
 
@@ -114,9 +115,19 @@ export default {
 
           "rowno" in rowData &&
             (rowData["rowno"] = this.params[key].length + 1);
-          "rowNo" in rowData &&
-            (rowData["rowNo"] = this.params[key].length + 1);
-
+           // 物料
+           if("rowNo" in rowData){
+
+              rowData["rowNo"] = this.params[key].length + 1;
+              // 扣税类别
+              rowData["taxDeductClassify"] = '1';
+              // 价格类型
+              rowData["priceType"] = 'order';
+              // 币种
+              rowData["currency"] = '1002Z0100000000001K1';
+              rowData["currencyName"] = '人民币';
+
+            }
           // 是否完成询价,新增明细行需默认明细为false
           rowData['whetherCompleteInquiry'] = false;
 
@@ -150,28 +161,32 @@ export default {
     },
     // 保存
     async handleSava() {
-      // this.$refs['orderEditForm'].validate(async (valid) => {
-      //   if (valid) {
-      try {
-        this.loading = true;
-        const { code, msg } = await (this.handleIsRevise(this.params.status) ?
-          orderApi.revision(this.params)
-          : orderApi.edit(this.params)
-        )
-        if (code === 200) {
-          this.handleCancel();
+      this.$refs['orderEditForm'].validate(async (valid) => {
+        if (valid) {
+          if(!this.params['puOrderItemList'].length || !this.params['puOrderExecuteList'].length){
+
+            this.$message.error('请填写订单行!');
+            return false;
+          }
+          try {
+            this.loading = true;
+            const { code, msg } = await (this.handleIsRevise(this.params.status) ?
+              orderApi.revision(this.params)
+              : orderApi.edit(this.params)
+            )
+            if (code === 200) {
+              this.handleCancel();
+            }
+          } catch (err) {
+            //
+          } finally {
+            this.loading = false;
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
         }
-      } catch (err) {
-        //
-      } finally {
-        this.loading = false;
-      }
-
-      //   } else {
-      //     console.log('error submit!!');
-      //     return false;
-      //   }
-      // });
+      });
     },
     beforeOpen() {
     },
@@ -192,6 +207,15 @@ export default {
         // return source;
       }
     },
+
+     // 子表下拉框改变
+     handleSelectChange(type,row){
+      console.log(type,'type');
+
+      if(type == 'priceType' && row.material && row.qty && row.qty != ""){
+        this.handleGetPrice();
+      }
+    },
     // 子表inputNumber
     handleInputChange(row, type) {
       console.log(type, 'type');
@@ -401,6 +425,12 @@ export default {
                 >
                 <template slot-scope="scope">
 
+                  <el-form-item 
+                    label-width="0" 
+                    :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
+                    :rules="{ required: cColumn.require, message: `${cColumn.title}不能为空`, trigger: 'change' }"
+                  >
+
                   <span v-if="!cColumn.inputType">
                     {{ scope.row[cColumn.key] }}
                   </span>
@@ -435,6 +465,7 @@ export default {
                     :clearable="cColumn.clearable" 
                     :placeholder="cColumn.placeholder"
                     style="width: 100%"
+                    @change="handleSelectChange(cColumn.key,scope.row)"
                   >
                     <el-option 
                       v-for="item in dict.type[cColumn.referName]" 
@@ -461,6 +492,8 @@ export default {
                     :size="size" 
                     style="width: 100%"
                   ></el-input-number>
+
+                </el-form-item>
                 </template>
               </el-table-column>
 

+ 2 - 2
src/views/purchase/purchase-order/edit/initColumn.js

@@ -36,7 +36,7 @@ export const forbidden = (isEdit) => {
 
       if (item.key == 'buyerName' || item.key == 'puDeptName' || item.key == 'deductionMoney' ||
         item.key == 'supplierContactsName' || item.key == 'agentName' || item.key == 'isInvoice' ||
-        item.key == 'rebateMoney') {
+        item.key == 'rebateMoney' || t.key == 'remark') {
         item.disabled = false;
         item.readonly = false;
       } else {
@@ -52,7 +52,7 @@ export const forbidden = (isEdit) => {
         if (t.key == 'unit' || t.key == 'qty' ||
           t.key == 'place' || t.key == 'arrivalDatePlan' || t.key == 'storageCondition' ||
           t.key == 'carriageCondition' || t.key == 'customerName' || t.key == 'isBatchLock' ||
-          t.key == 'isReplenishment' || t.key == 'originalQty' || t.key == 'originalMoney'
+          t.key == 'isReplenishment' || t.key == 'originalQty' || t.key == 'originalMoney' 
         ) {
 
           t.disabled = false;

+ 55 - 30
src/views/purchase/purchase-order/index.vue

@@ -48,13 +48,15 @@ export default {
   },
   created() {
     this.fetchList(this.params, this.page);
-    console.log("Vue", this);
   },
   methods: {
     async fetchList(params, page) {
       try {
         this.loading = true;
         // const { pageNum, pageSize } = page;
+        console.log(
+          page,'page'
+        );
         const { code, msg, rows, total } = await orderApi.list(params, page);
         if (code === 200) {
           this.page.total = total;
@@ -96,7 +98,6 @@ export default {
     },
     // 重置操作
     handleResetList() {
-
       this.page = initPage();
       this.params = initParams(SearchColumns);
       this.fetchList(this.params, this.page);
@@ -217,21 +218,35 @@ export default {
     },
     //  整单退回
     handleAllSendBack() {
-      let data = {
-        id: this.checkedList[0].id,
-        documentIds: [],
-        baskCause: ''
-      }
-      console.log(data);
-      try {
-        this.loading = true;
-        let { code, msg } = orderApi.documentsReturn(data);
 
-      } catch (error) {
-
-      } finally {
-        this.loading = false;
-      }
+      this.$prompt('请输入退回原因', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          inputPattern: /\s*\S+?/,
+          inputErrorMessage: '退回原因不能为空'
+        }).then(({ value }) => {
+          let data = {
+            id: this.checkedList[0].id,
+            documentIds: [],
+            baskCause: value,
+          };
+          console.log(data);
+          try {
+
+            let { code, msg } = orderApi.documentsReturn(data);
+
+            if (code == 200) {
+
+              this.fetchList(this.params, this.page);
+
+            }
+          } catch (error) {
+          } finally {
+          }
+        }).catch(() => {    
+        });
+      
+      
     },
     // 判断是否满足整单关闭
     judgeIsAllClose() {
@@ -252,8 +267,6 @@ export default {
       // 未审批状态下整单关闭
       try {
 
-        this.loading = true;
-
         let puOrderIds = this.checkedList.map(order => {
 
           return order.id;
@@ -271,24 +284,23 @@ export default {
       } catch (error) {
 
       } finally {
-        this.loading = false;
       }
     },
     // 付款协议
     async handlePaymentRequest(){
       // name:工号
       try {
-        let {name} = this.$store.state.user;
+        // let {name} = this.$store.state.user;
 
-        await orderApi.payRequest(name).then(res=>{
+        let {code,msg} = await orderApi.payRequest();
 
-          if(res){
+        if(code == 200){
+          msg.replace(/\/n/g,'');
+          let url = `uclient://start/http://172.16.100.2:8081?ssoKey=${msg}&uiloader=nc.uap.lfw.applet.PortalUILoader&nodeId=40040407`
 
-            let url = `uclient://start/http://172.16.100.2:8081?ssoKey=${res}&uiloader=nc.uap.lfw.applet.PortalUILoader&nodeId=40040407`
+          window.location.href = url;
 
-            window.location.href = url;
-          }
-        });
+        }
 
       } catch (error) {
         
@@ -302,7 +314,7 @@ export default {
       console.log(this.checkedList, 'this.checkedList');
 
     },
-  },
+  }
 };
 </script>
 
@@ -347,7 +359,7 @@ export default {
                   :value-key="column.valueKey"
                   :placeholder="column.placeholder"
                   :data-mapping="column.dataMapping"
-                  :query-params="column.queryParams(params)"
+                  :query-params="column.queryParams"
                 ></dr-popover-select>
                 <!-- @keyup.enter.native="useQuery(params, page)" -->
 
@@ -479,9 +491,22 @@ export default {
       <el-table-column fixed="right" label="操作" width="120">
         <template slot-scope="scope">
           <!-- <el-button @click.stop="handleOpenSeeDrawer(scope.row)" type="text" size="small">查看</el-button> -->
-          <el-button type="text" size="small" @click.stop="handleOpenEditDrawer(scope.row)"
+          <el-button 
+            v-if="scope.row.status == '2'"
+            type="text" 
+            size="small" 
+            @click.stop="handleOpenEditDrawer(scope.row)"
+            v-hasPermi="['material:order:edit']">
+           修订
+          </el-button>
+          <el-button 
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            type="text" 
+            size="small" 
+            @click.stop="handleOpenEditDrawer(scope.row)"
             v-hasPermi="['material:order:edit']">
-            {{ scope.row.status == '2' ? '修订' : '编辑' }}</el-button>
+           编辑
+          </el-button>
           <!-- 0=自由态,1=审批中,2=已审核,3=已驳回 4=提交中-->
           <el-button 
             v-if="(scope.row.status == '0' || scope.row.status == '3') && scope.row.source == '3'" 

+ 11 - 1
src/views/purchase/purchase-order/see/index.vue

@@ -47,6 +47,9 @@ export default {
   methods: {
     setVisible(prop) {
       this.visible = prop;
+      if(!this.visible){
+        this.$refs['orderSeeForm'].clearValidate();
+      }
     },
 
     //查询详情
@@ -122,7 +125,14 @@ export default {
     size="100%" 
     :with-header="false" :visible.sync="visible" @open="beforeOpen"
     @close="$emit('close')">
-    <el-form size="mini" label-position="right" label-width="140px" :model="params" :rules="rules">
+    <el-form 
+      size="mini" 
+      label-position="right" 
+      label-width="140px" 
+      :model="params" 
+      :rules="rules"
+      ref="orderSeeForm" 
+    >
       <el-card :body-style="{
         padding: '20px',
         display: 'flex',

+ 15 - 5
src/views/purchase/transferOrder/add.vue

@@ -158,7 +158,7 @@
          </el-col>
         <el-col :span="1.5">
             <el-form-item label="调入仓库">
-              <el-select clearable size="small" v-model="basicForm.storageWarehouse" :disabled="sonDisable" @focus="chooseRefer('WAREHOUSE_PARAM', true, '调入仓库', basicForm.storageInventory, 'N', 'N')" style="width: 200px">
+              <el-select clearable size="small" v-model="basicForm.storageWarehouse" :disabled="sonDisable" @focus="chooseRefer('WAREHOUSE_PARAM', true, '调入仓库', basicForm.storageInventoryOrg, 'N', 'N')" style="width: 200px">
                 <el-option v-for="item in ruHouseOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -279,7 +279,7 @@
           <el-table-column show-overflow-tooltip label="调入部门" align="center" prop="storageDeptName" width="230px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.storageDeptName" @focus="chooseMxBM(scope.$index, 'DEPT_PARAM', true, '调入部门', basicForm.storageInventoryOrg)"">
+                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.storageDeptName" @focus="chooseMxBM(scope.$index, 'DEPT_PARAM', true, '调入部门', basicForm.storageInventoryOrg)">
                   <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMxBM(scope.$index, 'DEPT_PARAM', true, '调入部门', basicForm.storageInventoryOrg)"></el-button>
                 </el-input>
               </el-form-item>
@@ -621,6 +621,7 @@ export default {
       sonDisable: this.disable,
       basicForm: {
         deliveryInventoryOrg: '',
+        deliveryInventoryOrgCode: '',
         deliveryInventoryOrgName: '',
         billType: '',
         code: '',
@@ -644,6 +645,7 @@ export default {
         customer: '',
         customerName: '',
         deliveryWarehouse: '',
+        deliveryWarehouseCode: '',
         deliveryWarehouseName: '',
         storageWarehouse: '',
         storageWarehouseName: '',
@@ -808,6 +810,9 @@ export default {
         if (type == 'WAREHOUSE_PARAM' && title == '调出仓库') {
           this.chuHouseOptions = res.rows
         }
+        if (type == 'UNIT_PARAM') {
+          this.materialInfo[this.tableIndex].unitCode = res.rows[0].code
+        }
       })
     },
     addLine() {
@@ -823,6 +828,7 @@ export default {
         originPlaceName: null,
         model: null,
         unit: null,
+        unitCode: null,
         unitName: null,
         deliveryWarehouseName: null,
         qty: null,
@@ -875,6 +881,7 @@ export default {
       if (this.referCondition.title == '调出库存组织') {
         this.chuOrgOptions = selection
         this.basicForm.deliveryInventoryOrg = selection[0].id
+        this.basicForm.deliveryInventoryOrgCode = selection[0].code
         this.basicForm.deliveryInventoryOrgName = selection[0].name
       }
       if (this.referCondition.title == '调入库存组织') {
@@ -913,6 +920,7 @@ export default {
       if (this.referCondition.title == '调出仓库') {
         this.chuHouseOptions = selection
         this.basicForm.deliveryWarehouse = selection[0].id
+        this.basicForm.deliveryWarehouseCode = selection[0].code
         this.basicForm.deliveryWarehouseName = selection[0].name
       }
       if (this.referCondition.title == '调出货位') {
@@ -960,14 +968,16 @@ export default {
       this.materialInfo[this.tableIndex].manufacturer = selection[0].manufacturerIdName
       this.materialInfo[this.tableIndex].marketingApprovalPersonal = selection[0].registrant
       this.materialInfo[this.tableIndex].production = selection[0].productionPermit
+      // 根据物料单位id查询单位code
+      this.reBackRefer('UNIT_PARAM', selection[0].unitId)
     },
     // 明细行选择批次号
     chooseBatch(index) {
       this.tableIndex = index
-      this.referConditionMx.orgCode = this.basicForm.deliveryInventoryOrg
+      this.referConditionMx.orgCode = this.basicForm.deliveryInventoryOrgCode
       this.referConditionMx.materialCode = this.materialInfo[this.tableIndex].material
-      this.referConditionMx.unitCode = this.materialInfo[this.tableIndex].unit
-      this.referConditionMx.warehouseCode = this.basicForm.deliveryWarehouse
+      this.referConditionMx.unitCode = this.materialInfo[this.tableIndex].unitCode
+      this.referConditionMx.warehouseCode = this.basicForm.deliveryWarehouseCode
       this.$refs.batchRefer.init(this.referConditionMx)
     },
     selectBatch(selection) {