浏览代码

1.列表查询新增排序参数
2.币种从主表移动到子表(物料信息)中,并默认为人民币
3.新增、编辑页面表单校验开启

002390 2 年之前
父节点
当前提交
541e50981f

+ 2 - 1
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,
   });
 }
 

+ 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" });

+ 66 - 31
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: {
@@ -416,7 +409,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 +423,7 @@ export const TabColumns = [
         title: "物料",
         inputType: "PopoverSelect",
         width: 180,
+        require: true,
         valueKey: "id",
         referName: "MATERIAL_PARAM",
         dataMapping: {
@@ -451,6 +451,7 @@ export const TabColumns = [
         key: "materialCode",
         title: "物料编码",
         inputType: "Input",
+        require: true,
         width: 180,
         disabled:true,
         readonly:true,
@@ -520,9 +521,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", 
@@ -624,7 +645,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 +711,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",
@@ -725,7 +759,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 },

+ 121 - 86
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,39 @@ 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;
-
+          console.log(rowData,'rowData');
           this.params[key].push(rowData);
         }
       }
@@ -211,23 +230,23 @@ 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) {
+          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() {
@@ -272,7 +291,15 @@ export default {
 
       if(type == "MATERIAL_PARAM"){
         source.isDrug = val.materialMedcine.isDrug  == '0' ? 'Y' : 'N';
-        // return source;
+      }
+    },
+
+    // 子表下拉框改变
+    handleSelectChange(type,row){
+      console.log(type,'type');
+
+      if(type == 'priceType' && row.material && row.qty && row.qty != ""){
+        this.handleGetPrice();
       }
     },
 
@@ -496,76 +523,83 @@ 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"
+                  <el-form-item 
+                    label-width="0" 
+                    :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
+                    :rules="{ required: cColumn.require, message: `${cColumn.title}不能为空`, trigger: 'change' }"
                   >
-                  </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-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]"
+                      true-label="Y"
+                      false-label="N"
+                    ></el-checkbox>
+                  </el-form-item>
                 </template>
               </el-table-column>
 
@@ -594,3 +628,4 @@ export default {
     </el-form>
   </el-drawer>
 </template>
+

+ 3 - 2
src/views/purchase/purchase-order/column.js

@@ -28,8 +28,7 @@ export const TableColumns = [
   { key: "supplierName", title: "供应商", inputType: "Input" },
   { key: "paymentAgreementName", title: "付款协议" },
   // { key: "paymentAgreement", title: "付款协议" },
-  // { key: "currency", title: "币种" },
-  { key: "currencyName", title: "币种" },
+  
   // { key: "buyer", title: "采购员" },ut
   { key: "buyerName", title: "采购员" },
   // { key: "puDept", title: "采购部门" },
@@ -158,6 +157,8 @@ export const TabColumns = [
       { key: "isDrug", title: "物料药品属性", width: 180 },
       { key: "unit", title: "单位", width: 180 },
       { key: "qty", title: "数量" },
+      // { key: "currency", title: "币种" },
+      { key: "currencyName", title: "币种" },
       { key: "taxPrice", title: "含税单价" },
       { key: "money", title: "价税合计" },
       { key: "tax", title: "税率" },

+ 55 - 27
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,27 @@ 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) {
+          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 +202,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 +420,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 +460,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 +487,8 @@ export default {
                     :size="size" 
                     style="width: 100%"
                   ></el-input-number>
+
+                </el-form-item>
                 </template>
               </el-table-column>
 

+ 18 - 4
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);
@@ -479,9 +480,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'"