Ver código fonte

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

002201 2 anos atrás
pai
commit
c342859564
25 arquivos alterados com 1033 adições e 698 exclusões
  1. 26 15
      src/api/business/purchase/purchase-order.js
  2. 8 0
      src/api/purchase/DemandSummary.js
  3. 24 0
      src/components/input-dialog/components/ALLOCATION_PARAM.js
  4. 21 0
      src/components/input-dialog/components/BALATYPE_PARAM.js
  5. 22 0
      src/components/input-dialog/components/CUSTOMERDEPT_PARAM.js
  6. 21 0
      src/components/input-dialog/components/CUSTOMER_PARAM.js
  7. 21 0
      src/components/input-dialog/components/OPERATING_PARAM.js
  8. 21 0
      src/components/input-dialog/components/PROCESSTYPE_PARAM.js
  9. 21 0
      src/components/input-dialog/components/PROJECT_PARAM.js
  10. 21 0
      src/components/input-dialog/components/RETREASON_PARAM.js
  11. 21 0
      src/components/input-dialog/components/SUPPLIERCONTACTS_PARAM.js
  12. 29 0
      src/components/input-dialog/components/WAREHOUSE_PARAM.js
  13. 58 8
      src/views/purchase/DemandSummary/add.vue
  14. 37 6
      src/views/purchase/DemandSummary/index.vue
  15. 2 1
      src/views/purchase/MaterialClassDivision/index.vue
  16. 15 6
      src/views/purchase/PurchaseDemandList/add.vue
  17. 2 1
      src/views/purchase/PurchaseDemandList/index.vue
  18. 1 0
      src/views/purchase/apply/edit/index.vue
  19. 2 1
      src/views/purchase/deliveryAddress/index.vue
  20. 199 79
      src/views/purchase/purchase-order/add/column.js
  21. 89 213
      src/views/purchase/purchase-order/add/index.vue
  22. 3 3
      src/views/purchase/purchase-order/column.js
  23. 266 0
      src/views/purchase/purchase-order/edit/index.vue
  24. 89 144
      src/views/purchase/purchase-order/index.vue
  25. 14 221
      src/views/purchase/purchase-order/see/index.vue

+ 26 - 15
src/api/business/purchase/purchase-order.js

@@ -1,7 +1,7 @@
 import request from "@/utils/request";
 
 // 采购订单修订列表
-const orderList = (data) => {
+const list = (data) => {
   return request({
     url: `/pu/order/list`,
     method: "post",
@@ -10,7 +10,7 @@ const orderList = (data) => {
 }
 
 // 采购订单详情
-const orderDetails = (id, params) => {
+const details = (id, params) => {
   return request({
     url: `/pu/order/${id}`,
     method: "get",
@@ -19,26 +19,37 @@ const orderDetails = (id, params) => {
 }
 
 // 采购订单修订创建
-const orderCreate = (data) => {
+const create = (data) => {
   return request({
-    url: `/pu/order/create`,
+    url: `/pu/order`,
     method: "post",
     data,
   });
 }
 
-// // 参照查询
-// const referQuery = (data) => {
-//   return request({
-//     url: `/refer/query`,
-//     method: "post",
-//     data,
-//   });
-// }
+// 采购订单编辑
+const edit = (data) => {
+  return request({
+    url: `/pu/order/item`,
+    method: "put",
+    data,
+  });
+}
+
+// 采购订单删除
+const remove = (data) => {
+  return request({
+    url: `/pu/order/${data}`,
+    method: "delete",
+  });
+}
+
 
 export default {
-  orderList,
-  orderDetails,
-  orderCreate,
+  list,
+  details,
+  create,
+  edit,
+  remove,
 
 }

+ 8 - 0
src/api/purchase/DemandSummary.js

@@ -59,4 +59,12 @@ export function shutDownSummary(id) {
     url: `/pu/demand/item/summary/shutDown/${id}`,
     method: 'get',
   })
+}
+// 采购需求明细行编辑
+export function editSummaryMx(data) {
+  return request({
+    url: `/pu/demand/item/summary/detail/edit`,
+    method: 'post',
+    data: data
+  })
 }

+ 24 - 0
src/components/input-dialog/components/ALLOCATION_PARAM.js

@@ -0,0 +1,24 @@
+// 货位
+export default [
+  // 树
+  // {
+  //   key: "warehouse",
+  //   title: "仓库ID",
+  //   type: "Input",
+  //   search: true,
+  // },
+  // {
+  //   key: "warehouse_name",
+  //   title: "仓库名称",
+  //   type: "Input",
+  //   search: true,
+  // },
+  // {
+  //   key: "",
+  //   title: "备注",
+  // },
+  // {
+  //   key: "",
+  //   title: "助记码",
+  // },
+];

+ 21 - 0
src/components/input-dialog/components/BALATYPE_PARAM.js

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

+ 22 - 0
src/components/input-dialog/components/CUSTOMERDEPT_PARAM.js

@@ -0,0 +1,22 @@
+// 客户部门
+export default [
+  {
+    key: "id",
+    title: "客户部门ID",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "code",
+    title: "客户部门编码",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "name",
+    title: "客户部门名称",
+    type: "Input",
+    search: true,
+  },
+];
+

+ 21 - 0
src/components/input-dialog/components/CUSTOMER_PARAM.js

@@ -0,0 +1,21 @@
+// 收货客户
+export default [
+  {
+    key: "id",
+    title: "收货客户ID",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "code",
+    title: "收货客户编码",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "name",
+    title: "收货客户名称",
+    type: "Input",
+    search: true,
+  },
+];

+ 21 - 0
src/components/input-dialog/components/OPERATING_PARAM.js

@@ -0,0 +1,21 @@
+// 经营性项目
+export default [
+  {
+    key: "id",
+    title: "经营性项目ID",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "code",
+    title: "经营性项目编码",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "name",
+    title: "经营性项目名称",
+    type: "Input",
+    search: true,
+  },
+];

+ 21 - 0
src/components/input-dialog/components/PROCESSTYPE_PARAM.js

@@ -0,0 +1,21 @@
+// 处理方式
+export default [
+  // {
+  //   key: "id",
+  //   title: "ID",
+  //   type: "Input",
+  //   search: true,
+  // },
+  {
+    key: "code",
+    title: "编码",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "name",
+    title: "处理方式",
+    type: "Input",
+    search: true,
+  },
+];

+ 21 - 0
src/components/input-dialog/components/PROJECT_PARAM.js

@@ -0,0 +1,21 @@
+// 在建工程项目
+export default [
+  {
+    key: "id",
+    title: "在建工程项目ID",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "code",
+    title: "在建工程项目编码",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "name",
+    title: "在建工程项目名称",
+    type: "Input",
+    search: true,
+  },
+];

+ 21 - 0
src/components/input-dialog/components/RETREASON_PARAM.js

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

+ 21 - 0
src/components/input-dialog/components/SUPPLIERCONTACTS_PARAM.js

@@ -0,0 +1,21 @@
+// 供应商联系人
+export default [
+  {
+    key: "id",
+    title: " 供应商联系人ID",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "code",
+    title: " 供应商联系人编码",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "name",
+    title: " 供应商联系人名称",
+    type: "Input",
+    search: true,
+  },
+];

+ 29 - 0
src/components/input-dialog/components/WAREHOUSE_PARAM.js

@@ -0,0 +1,29 @@
+// 收货仓库
+export default [
+  {
+    key: "id",
+    title: "仓库ID",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "code",
+    title: "仓库编码",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "name",
+    title: "仓库名称",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "",
+    title: "备注",
+  },
+  {
+    key: "",
+    title: "助记码",
+  },
+];

+ 58 - 8
src/views/purchase/DemandSummary/add.vue

@@ -3,8 +3,8 @@
     <el-card>
       <span>采购需求汇总详情</span>
       <div class="btn_grooup">
-        <el-button type="primary" size="small">编辑</el-button>
-        <el-button type="primary" size="small">确定</el-button>
+        <el-button type="primary" size="small" @click="editLine">编辑</el-button>
+        <el-button type="success" size="small" v-if="!lineDisable" @click="saveLine">保存</el-button>
         <el-button type="primary" size="small" @click="closeLine">行关闭</el-button>
         <el-button type="primary" size="small">重取批量</el-button>
       </div>
@@ -31,13 +31,36 @@
         <el-table-column label="需求客户" align="center" prop="customerName"/>
         <el-table-column label="最小订货量" align="center" prop="minOrderQty"/>
         <el-table-column label="最小包装量" align="center" prop="minPackage"/>
+        <el-table-column label="最小批量" align="center" prop="minBatch"/>
         <el-table-column label="修改人" align="center" prop="updateByName"/>
         <el-table-column label="修改原因" align="center" prop="updateCause"/>
         <el-table-column label="业务备注" align="center" prop="remark"/>
         <el-table-column label="有效期" align="center" prop="expiry"/>
         <el-table-column label="要求交货日期" align="center" prop="deliveryDate"/>
-        <el-table-column label="紧急标识" align="center" prop="isUrgency"/>
-        <el-table-column label="补单标识" align="center" prop="isReplenishment"/>
+        <el-table-column label="紧急标识" align="center" prop="isUrgency">
+          <template slot-scope="scope">
+            <el-switch
+              v-model="scope.row.isUrgency"
+              :disabled="lineDisable"
+              active-value="Y"
+              inactive-value="N"
+              active-color="#13ce66"
+              inactive-color="#a1a3a9">
+            </el-switch>
+          </template>
+        </el-table-column>
+        <el-table-column label="补单标识" align="center" prop="isReplenishment">
+          <template slot-scope="scope">
+            <el-switch
+              v-model="scope.row.isReplenishment"
+              :disabled="lineDisable"
+              active-value="Y"
+              inactive-value="N"
+              active-color="#13ce66"
+              inactive-color="#a1a3a9">
+            </el-switch>
+          </template>
+        </el-table-column>
         <el-table-column label="需求单单号" align="center" prop="code"/>
         <el-table-column label="供应仓库" align="center" prop="lastWarehouseName"/>
         <el-table-column label="供应货位" align="center" prop="lastAllocationName"/>
@@ -56,10 +79,20 @@
         <el-table-column label="采购员编码" align="center" prop="buyer"/>
         <el-table-column label="采购组织" align="center" prop="orgName"/>
         <el-table-column label="有效期单位" align="center" prop="expiryUnit"/>
-        <el-table-column label="最小批量" align="center" prop="minBatch"/>
         <el-table-column label="业务部门" align="center" prop="businessDeptName"/>
         <el-table-column label="需求部门" align="center" prop="demandDeptName"/>
-        <el-table-column label="批号锁定标识" align="center" prop="isBatchLock"/>
+        <el-table-column label="批号锁定标识" align="center" prop="isBatchLock">
+          <template slot-scope="scope">
+            <el-switch
+              v-model="scope.row.isBatchLock"
+              :disabled="lineDisable"
+              active-value="Y"
+              inactive-value="N"
+              active-color="#13ce66"
+              inactive-color="#a1a3a9">
+            </el-switch>
+          </template>
+        </el-table-column>
         <el-table-column label="采购需求单审批人" align="center" prop="approveName"/>
         <el-table-column label="需求单审批时间" align="center" prop="approverFinishTime"/>
         <el-table-column label="需求单提交时间" align="center" prop="createTime"/>
@@ -83,7 +116,7 @@
 </template>
 
 <script>
-import {getSummaryDetail, shutDownSummary } from '@/api/purchase/DemandSummary.js'
+import {getSummaryDetail, shutDownSummary, editSummaryMx } from '@/api/purchase/DemandSummary.js'
 export default {
   name: 'checkDemandSummary',
   props: ['pageStu','row', 'disable'],
@@ -93,8 +126,12 @@ export default {
   },
   data() {
     return{
+      // 不能直接改变props传来的值
+      sonPageStu: this.pageStu,
+      sonDisable: this.disable,
       tableList: [],
-      ids: []
+      ids: [],
+      lineDisable: true,
     }
   },
   created() {
@@ -127,6 +164,19 @@ export default {
         }
       })
     },
+    editLine() {
+      console.log('sonList`````', this.tableList)
+      this.lineDisable = false
+    },
+    saveLine() {
+      editSummaryMx(this.tableList).then(res => {
+        if (res.code === 200) {
+          this.$modal.msgSuccess("保存成功");
+          this.lineDisable = true
+          this.getDetails(this.row)
+        }
+      })
+    },
     // 行关闭
     closeLine() {
       if (this.ids.length == 0) {

+ 37 - 6
src/views/purchase/DemandSummary/index.vue

@@ -240,7 +240,7 @@
       <el-card>
         <div class="btn_grooup">
           <el-button type="primary" size="small" @click="editList">编辑</el-button>
-          <el-button type="primary" size="small" @click="saveList">保存</el-button>
+          <el-button type="success" size="small" v-if="!lineDisable" @click="saveList">保存</el-button>
           <el-button type="primary" size="small" @click="confirms">确认</el-button>
           <el-button type="primary" size="small" @click="cancels">取消</el-button>
           <el-button type="primary" size="small" @click="audits">审核</el-button>
@@ -264,6 +264,7 @@
           show-summary
           max-height="480"
           @selection-change="handleSelectionChange"
+          :key="isUpdate"
         >
           <el-table-column type="selection" width="55" />
           <el-table-column label="一级品类" align="center" prop="materialClassifyOneName" width="120px"/>
@@ -307,14 +308,18 @@
           <el-table-column label="三级品类" align="center" prop="materialClassifyThreeName" width="150px"/>
           <el-table-column label="四级品类" align="center" prop="materialClassifyFourName" width="150px"/>
           <el-table-column label="单据状态" align="center" prop="status"/>
-          <el-table-column label="采购员" align="center" prop="buyerName" width="120px">
+          <el-table-column label="采购员" align="center" prop="buyerName" width="150px">
             <template slot-scope="scope">
-                <el-input :disabled="lineDisable" v-model="scope.row.buyerName"/>
+                <el-input :disabled="lineDisable" size="small" v-model="scope.row.buyerName">
+                  <el-button size="small" :disabled="lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'CONTACTS_PARAM', true, '采购员')"></el-button>
+                </el-input>
             </template>
           </el-table-column>
           <el-table-column label="默认采购组织" align="center" prop="purchaseOrgName" width="280px">
             <template slot-scope="scope">
-                <el-input :disabled="lineDisable" v-model="scope.row.purchaseOrgName"/>
+                <el-input :disabled="lineDisable" size="small" v-model="scope.row.purchaseOrgName">
+                  <el-button size="small" :disabled="lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'ORG_PARAM', true, '默认采购组织')"></el-button>
+                </el-input>
             </template>
           </el-table-column>
           <el-table-column label="有效期" align="center" prop="validityPeriod"/>
@@ -386,6 +391,7 @@ export default {
   },
   data() {
     return {
+      isUpdate: false,
       expanded: false,
       // 页面配置
       isList: true,
@@ -415,7 +421,7 @@ export default {
         auditTime: '',
         yesTime: '',
         pageNum: 1,
-        pageSize: 10
+        pageSize: 5
       },
       personOptions: [],
       classOptions: [],
@@ -442,6 +448,13 @@ export default {
       lineDisable: true,
       ids: [],
       allSelection: [],
+      // 子表index
+      tableIndex: null,
+      referConditionMx: {
+        type: '',
+        isPage: true,
+        title: ''
+      }
     }
   },
   created() {
@@ -477,7 +490,7 @@ export default {
         auditTime: '',
         yesTime: '',
         pageNum: 1,
-        pageSize: 10
+        pageSize: 5
       }
       this.getList(this.queryParams)
     },
@@ -615,6 +628,16 @@ export default {
         this.orgOptions = selection
         this.queryParams.purchaseOrg = selection[0].id
       }
+      if (this.referConditionMx.title == '采购员') {
+        console.log('选择进了吗',this.tableList)
+        this.tableList[this.tableIndex].buyer = selection[0].code
+        this.tableList[this.tableIndex].buyerName = selection[0].name
+      }
+      if (this.referConditionMx.title == '默认采购组织') {
+        console.log('选择进了吗',this.tableList)
+        this.tableList[this.tableIndex].purchaseOrg = selection[0].id
+        this.tableList[this.tableIndex].purchaseOrgName = selection[0].name
+      }
     },
     // 搜索区树形选择
     chooseTreeRefer(type, isPage, title) {
@@ -634,6 +657,14 @@ export default {
     selectMaterial(selection) {
       this.queryParams.materialCode = selection[0].id
       this.queryParams.names = selection[0].name
+    },
+        // 明细行选择业务部门参照带出业务部门数据
+    chooseSon(index, type, isPage, title) {
+      this.tableIndex = index
+      this.referConditionMx.type = type
+      this.referConditionMx.isPage = isPage
+      this.referConditionMx.title = title
+      this.$refs.refer.init(this.referConditionMx)
     }
   }
 }

+ 2 - 1
src/views/purchase/MaterialClassDivision/index.vue

@@ -223,7 +223,7 @@
         <el-table 
           :data="tableList" 
           fit
-          max-height="680"
+          max-height="480"
           @selection-change="handleSelectionChange"
         >
           <el-table-column type="selection" width="55" />
@@ -385,6 +385,7 @@ export default {
   height: calc(100vh - 84px);
   padding: 12px;
   box-sizing: border-box;
+  overflow-y: scroll;
 }
 .btn_grooup {
   margin-bottom: 10px;

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

@@ -85,7 +85,7 @@
             <el-form-item label="需求日期">
               <el-date-picker
                 v-model="basicForm.demandDate"
-                :disabled="sonDisable"
+                disabled
                 type="date"
                 value-format="yyyy-MM-dd"
                 size="small"
@@ -97,7 +97,7 @@
 
           <el-col :span="1.5">
             <el-form-item label="单据来源">
-              <el-select v-model="basicForm.source" :disabled="sonDisable" size="small" style="width: 200px">
+              <el-select v-model="basicForm.source" disabled size="small" style="width: 200px">
                 <el-option v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
                 </el-option>
               </el-select>
@@ -314,9 +314,9 @@
                 <el-date-picker
                   v-model="scope.row.deliveryDate"
                   :readonly="sonDisable"
-                  type="date"
+                  type="datetime"
                   size="small"
-                  value-format="yyyy-MM-dd"
+                  value-format="yyyy-MM-dd HH:mm:ss"
                   placeholder="选择日期">
                 </el-date-picker>
               </el-form-item>
@@ -574,15 +574,17 @@ export default {
       basicForm: {
         code: '',
         org: '',
+        orgName: '',
         demandBusinessType: '1',
         status: '0',
         customer: '',
         customerName: '',
+        customerCode: '',
         customerPrincipal: '',
         demandPersonal: '',
         demandDept: '',
         demandDate: '',
-        source: '',
+        source: '1',
         warehouse: '',
         goodsAllocation: '',
         billType: '',
@@ -699,9 +701,11 @@ export default {
         materialClassifyFour: null,
         materialClassifyFourName: null,
         materialCode: null,
+        materialId: null,
         materialName: null,
         specification: null,
         unit: null,
+        unitName: null,
         manufacturerName: null,
         registrant: null,
         puPeriod: null,
@@ -862,10 +866,13 @@ export default {
       if(this.referCondition.type == 'ORG_PARAM') {
         this.orgOptions = selection
         this.basicForm.org = selection[0].id
+        this.basicForm.orgName = selection[0].name
       }
       if(this.referCondition.type == 'CUSTOMER_PARAM') {
         this.customerOptions = selection
         this.basicForm.customer = selection[0].id
+        this.basicForm.customerName = selection[0].name
+        this.basicForm.customerCode = selection[0].code
       }
       if(this.referCondition.type == 'CONTACTS_PARAM') {
         this.personOptions = selection
@@ -930,6 +937,7 @@ export default {
       this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].businessDepartment
       this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].businessDepartmentName
       this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
+      this.basicForm.puDemandItemList[this.tableIndex].materialId = selection[0].id
       this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
       this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
       this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
@@ -937,7 +945,8 @@ export default {
       this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFourName = selection[0].fourClass
       this.basicForm.puDemandItemList[this.tableIndex].specification = selection[0].specification
       this.basicForm.puDemandItemList[this.tableIndex].model = selection[0].model
-      this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitIdName
+      this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitId
+      this.basicForm.puDemandItemList[this.tableIndex].unitName = selection[0].unitIdName
       this.basicForm.puDemandItemList[this.tableIndex].registrant = selection[0].registrant
       this.basicForm.puDemandItemList[this.tableIndex].manufacturerName = selection[0].manufacturerIdName
       this.basicForm.puDemandItemList[this.tableIndex].puPeriod = selection[0].deliveryPeriod

+ 2 - 1
src/views/purchase/PurchaseDemandList/index.vue

@@ -322,7 +322,7 @@ export default {
         demandDate: '',
         remark: '',
         pageNum: 1,
-        pageSize: 10
+        pageSize: 5
       }
       this.getList(this.queryParams)
     },
@@ -500,6 +500,7 @@ export default {
   height: calc(100vh - 84px);
   padding: 12px;
   box-sizing: border-box;
+  overflow-y: scroll;
 }
 .btn_grooup {
   margin-bottom: 10px;

+ 1 - 0
src/views/purchase/apply/edit/index.vue

@@ -136,6 +136,7 @@ export default {
         // this.setVisible(false);
       }
     },
+    beforeOpen(){},
   },
   created() {
     console.log("ADD CREATED");

+ 2 - 1
src/views/purchase/deliveryAddress/index.vue

@@ -184,7 +184,7 @@
         <el-table 
           :data="tableList" 
           fit
-          max-height="680"
+          max-height="480"
           @selection-change="handleSelectionChange"
         >
           <el-table-column type="selection" width="55" />
@@ -346,6 +346,7 @@ export default {
   height: calc(100vh - 84px);
   padding: 12px;
   box-sizing: border-box;
+  overflow-y: scroll;
 }
 .btn_grooup {
   margin-bottom: 10px;

+ 199 - 79
src/views/purchase/purchase-order/add/column.js

@@ -1,23 +1,24 @@
 export const Columns = [
-  // { key: "id", title: "主键",type: "Input", },
   {
-    key: "puOrg",
+    key: "puOrgName",
     title: "采购组织",
     type: "InputDialog",
     config: {
-      componentName: "Organization",
-      dataMapping: { puOrg: "deptName" },
+      componentName: "ORG_PARAM",
+      dataMapping: {
+        puOrg: "code",
+        puOrgName: "name",
+      },
     },
     require: true,
   },
-  // { key: "puOrgName", title: "采购组织名称", },
   {
-    key: "billType",
+    key: "billTypeName",
     title: "订单类型",
     type: "Select",
     require: true,
     config: {
-      optionsName: "", // 字典名
+      optionsName: "sys_order_type", // 字典名
     },
   },
   // { key: "billTypeName", title: "订单类型名称", },
@@ -30,70 +31,94 @@ export const Columns = [
     config: { type: "date" },
   },
   {
-    key: "supplier",
+    key: "supplierName",
     title: "供应商",
     type: "InputDialog",
     config: {
-      componentName: "Supplier",
-      dataMapping: { supplier: "name" },
+      componentName: "SUPPLIER_PARAM",
+      dataMapping: {
+        supplier: "code",
+        supplierName: "name",
+      },
     },
     require: true,
   },
-  // { key: "supplierName", title: "供应商名称", },
   {
-    key: "paymentAgreement",
+    key: "paymentAgreementName",
     title: "付款协议",
     type: "InputDialog",
     config: {
-      componentName: "PaymentPlan",
+      componentName: "PAYAGREEMENT_PARAM",
+      dataMapping: {
+        paymentAgreement: "code",
+        paymentAgreementName: "name",
+      },
+    },
+  },
+  {
+    key: "finalTypeName",
+    title: "结算方式",
+    type: "InputDialog",
+    config: {
+      componentName: "BALATYPE_PARAM",
       dataMapping: {
-        buyer: "userName",
-        puDept: "deptName",
+        finalType: "code",
+        finalTypeName: "name",
       },
     },
   },
-  { key: "finalType", title: "结算方式", type: "Input", },
   {
-    key: "currency",
+    key: "currencyName",
     title: "币种",
     type: "InputDialog",
     config: {
-      componentName: "Currency",
+      componentName: "CURRENCY_PARAM",
       dataMapping: {
-        currency: "name",
+        currency: "code",
+        currencyName: "name",
       },
     },
   },
-  // { key: "currencyName", title: "币种名称", },
   {
-    key: "buyer",
+    key: "buyerName",
     title: "采购员",
     type: "InputDialog",
     config: {
-      componentName: "User",
+      componentName: "ORG_PARAM",
       dataMapping: {
-        buyer: "userName",
-        puDept: "deptName",
+        buyer: "userId",
+        buyerName: "userName",
+        puDept: "deptId",
+        puDeptName: "deptName",
       },
     },
     require: true,
   },
-  // { key: "buyerName", title: "采购员名称", },
   {
-    key: "puDept",
+    key: "puDeptName",
     title: "采购部门",
     type: "InputDialog",
-    config: { componentName: "Department" },
+    config: {
+      componentName: "DEPT_PARAM",
+      dataMapping: {
+        puDept: "code",
+        puDeptName: "name",
+      },
+    },
     require: true,
   },
-  // { key: "puDeptName", title: "采购部门名称", },
-  // { key: "customer", title: "收货客户", type: "Input", },
   {
     key: "customerName",
-    title: "收货客户名称",
+    title: "收货客户",
     type: "InputDialog",
-    config: { componentName: "Customer" },
     width: 200,
+    config: {
+      componentName: "CUSTOMER_PARAM",
+      dataMapping: {
+        customer: "code",
+        customerName: "name",
+      },
+    },
   },
   {
     key: "qty",
@@ -110,26 +135,45 @@ export const Columns = [
   { key: "money", title: "价税合计", type: "Input", },
   { key: "originalMoney", title: "原始总金额", type: "Input", },
   { key: "notaxMoney", title: "无税金额", type: "Input", },
-  { key: "status", title: "单据状态", type: "Input", },
-  { key: "freezeCause", title: "冻结原因", type: "Input", },
-  { key: "isBack", title: "退货", type: "Input", type: "Input", },
+  {
+    key: "status",
+    title: "单据状态",
+    type: "Select",
+    require: true,
+    config: {
+      optionsName: "sys_status", // 字典名
+    },
+
+  },
+  { key: "freezeCause", title: "冻结原因", type: "Checkbox", },
+  { key: "isBack", title: "退货", type: "Input", type: "Checkbox", },
   { key: "isMarketing", title: "已协同生成销售订单", type: "Checkbox", },
   { key: "isMarketingSource", title: "由销售订单协同生成", type: "Checkbox", },
   {
-    key: "warehouse",
+    key: "warehouseName",
     title: "WMS入库仓库", // 收货仓库
     type: "InputDialog",
-    config: { componentName: "Warehouse" },
+    config: {
+      componentName: "WAREHOUSE_PARAM",
+      dataMapping: {
+        warehouse: "code",
+        warehouseName: "name",
+      }
+    },
   },
-  // { key: "warehouseName", title: "WMS入库仓库名称", },
   {
-    key: "goodsAllocation",
+    key: "goodsAllocationName",
     title: "货位",
     type: "InputDialog",
-    config: { componentName: "Allocation" },
+    config: {
+      componentName: "ALLOCATION_PARAM",
+      dataMapping: {
+        goodsAllocation: "code",
+        goodsAllocationName: "name",
+      }
+    },
     width: 200,
   },
-  // { key: "goodsAllocationName", title: "货位名称", },
   { key: "isSendSrm", title: "是否同步SRM", type: "Checkbox", },
   { key: "isInvoice", title: "发票标识", type: "Input", },
   { key: "supplierOrderNo", title: "供应商订单号", type: "Input", },
@@ -137,16 +181,32 @@ export const Columns = [
   { key: "deductionMoney", title: "订单抵扣余款金额", type: "Input", },
   { key: "address", title: "收货地址", type: "Input", },
   { key: "contacts", title: "收货联系人", type: "Input", },
-  { key: "customerDept", title: "客户部门", type: "Input", },
-  // { key: "customerDeptName", title: "客户部门名称", },
   {
-    key: "supplierContacts",
+    key: "customerDeptName",
+    title: "客户部门",
+    type: "InputDialog",
+    width: 200,
+    config: {
+      componentName: "CUSTOMERDEPT_PARAM",
+      dataMapping: {
+        customerDept: "code",
+        customerDeptName: "name",
+      },
+    },
+  },
+  {
+    key: "supplierContactsName",
     title: "供应商业务联系人",
     type: "InputDialog",
-    config: { componentName: "" },
+    config: {
+      componentName: "SUPPLIERCONTACTS_PARAM",
+      dataMapping: {
+        supplierContacts: "code",
+        supplierContactsName: "name",
+      },
+    },
     width: 200,
   },
-  // { key: "supplierContactsName", title: "供应商业务联系人名称", },
   { key: "isUrgency", title: "紧急程度", type: "Input", },
   { key: "isSendWms", title: "已同步WMS", type: "Checkbox", },
   // { key: "agent", title: "代理人", type: "Input", }, // 建议删除
@@ -156,50 +216,69 @@ export const Columns = [
   { key: "applyPaymentMoney", title: "累计付款申请金额", type: "Input", },
   { key: "paymentMoney", title: "累计付款金额", type: "Input", },
   { key: "invoiceMoney", title: "发票金额", type: "Input", },
-  {
-    key: "supplierPersonal",
-    title: "供应商业务员",
-    type: "InputDialog",
-    config: { componentName: "" },
-    width: 200,
-  },
-  // { key: "supplierPersonalName", title: "供应商业务员名称", },
+  // {
+  //   key: "supplierPersonal",
+  //   title: "供应商业务员",
+  //   type: "Input",
+  //   // type: "InputDialog",
+  // },
+  { key: "supplierPersonalName", title: "供应商业务员名称", type: "Input", },
   { key: "isDeliver", title: "是否发货", type: "Input", },
   {
     key: "retReason",
     title: "退换原因",
     type: "InputDialog",
-    config: { componentName: "" },
+    config: {
+      componentName: "RETREASON_PARAM",
+      dataMapping: {
+        retReason: "code",
+        // retReasonName: "name",
+      },
+    },
   },
   {
     key: "processType",
     title: "处理方式",
     type: "InputDialog",
-    config: { componentName: "" },
+    config: {
+      componentName: "PROCESSTYPE_PARAM",
+      dataMapping: {
+        processType: "code",
+        // processTypeName: "name",
+      },
+    },
   },
   { key: "isEnd", title: "整单关闭标识", type: "Input", },
   {
     key: "projectNow",
     title: "在建工程项目",
     type: "InputDialog",
-    config: { componentName: "" },
+    config: {
+      componentName: "PROJECT_PARAM",
+      dataMapping: {
+        projectNow: "code",
+        // processTypeName: "name",
+      },
+    },
   },
   {
     key: "operatingItems",
     title: "经营性项目",
-    type: "Input",
     type: "InputDialog",
-    config: { componentName: "" },
+    config: {
+      componentName: "OPERATING_PARAM",
+      dataMapping: {
+        operatingItems: "code",
+        // processTypeName: "name",
+      },
+    },
   },
   { key: "isArrivalReson", title: "到货超期原因", type: "Input", },
   { key: "midOrderNo", title: "中台采购订单号", type: "Input", },
   { key: "marketingCode", title: "销售订单号", type: "Input", },
   { key: "isArrival", title: "到货超期", type: "Input", },
-  // { key: "tenantId", title: "租户号", },
-  // { key: "revision", title: "乐观锁", },
   { key: "createByName", title: "创建人名称", type: "Input", },
   { key: "updateByName", title: "更新人名称", type: "Input", },
-  // { key: "delFlag", title: "删除标记", },
   { key: "flowId", title: "OA流程ID", type: "Input", },
   { key: "approver", title: "审批人", type: "Input", },
   {
@@ -222,15 +301,21 @@ export const TabColumns = [
       // { key: "id", title: "主键" },
       { key: "rowNo", title: "行号", type: "Input", },
       { key: "orderId", title: "采购订单ID", type: "Input", },
-      // { key: "material", title: "物料", type: "Input", },
+      // {key: "material",title: "物料",type: "Input",   },
+      { key: "materialName", title: "物料名称", type: "Input", },
       {
-        key: "materialName",
-        title: "物料名称",
+        key: "materialCode",
+        title: "物料编码",
         type: "InputDialog",
-        config: { componentName: "" },
-        width: 200,
+        config: {
+          componentName: "MATERIAL_PARAM",
+          dataMapping: {
+            material: "id",
+            materialName: "name",
+            materialCode: "code",
+          },
+        },
       },
-      { key: "materialCode", title: "物料编码", type: "Input", },
       { key: "materialClassify", title: "物料分类", type: "Input", },
       { key: "materialManufacturersCode", title: "厂家物料编码", type: "Input", },
       { key: "specification", title: "规格", type: "Input", },
@@ -254,10 +339,16 @@ export const TabColumns = [
       { key: "isPayment", title: "付款关闭", type: "Input", },
       { key: "isGift", title: "赠品", type: "Input", },
       {
-        key: "warehouse",
+        key: "warehouseName",
         title: "收货仓库", //WMS入库仓库
         type: "InputDialog",
-        config: { componentName: "Warehouse" },
+        config: {
+          componentName: "WAREHOUSE_PARAM",
+          dataMapping: {
+            warehouse: "code",
+            warehouseName: "name",
+          }
+        },
         width: 200,
       },
       { key: "place", title: "收货地点", type: "Input", },
@@ -267,8 +358,24 @@ export const TabColumns = [
       { key: "efficacyLoseDate", title: "有效期至/失效日期", type: "Input", },
       { key: "approvalNumber", title: "批准文号", type: "Input", },
       { key: "registration", title: "注册证号", type: "Input", },
-      { key: "storageCondition", title: "存储条件", type: "Input", },
-      { key: "carriageCondition", title: "运输条件", type: "Input", },
+
+      {
+        key: "storageCondition",
+        title: "存储条件",
+        type: "Select",
+        config: {
+          optionsName: "sys_storage_condition",
+        },
+      },
+      {
+        key: "carriageCondition",
+        title: "运输条件",
+        type: "Select",
+        config: {
+          optionsName: "sys_conditions_carriage",
+        },
+      },
+
       { key: "isBatchLock", title: "批号锁定标识", type: "Input", },
       { key: "isReplenishment", title: "补单标识", type: "Input", },
       { key: "isUrgency", title: "紧急标识", type: "Input", },
@@ -284,13 +391,17 @@ export const TabColumns = [
       { key: "sourceId", title: "上游单据ID", type: "Input", },
       { key: "demandCode", title: "采购需求单号", type: "Input", },
       { key: "arrivalDatePlan", title: "计划到货日期", type: "Input", },
-      { key: "priceType", title: "价格类型", type: "Input", },
+      {
+        key: "priceType",
+        title: "价格类型",
+        type: "Select",
+        config: {
+          optionsName: "sys_price_type",
+        },
+      },
       { key: "isDistributionPrice", title: "配送价", type: "Input", },
-      // { key: "tenantId", title: "租户号",type: "Input", },
-      // { key: "revision", title: "乐观锁",type: "Input", },
       { key: "createByName", title: "创建人名称", type: "Input", },
       { key: "updateByName", title: "更新人名称", type: "Input", },
-      // { key: "delFlag", title: "删除标记",type: "Input", },
       // { key: "materialClassifyOne", title: "物料一级分类",type: "Input", },
       { key: "materialClassifyOneName", title: "物料一级分类名称", type: "Input", },
       // { key: "materialClassifyTwo", title: "物料二级分类",type: "Input", },
@@ -309,7 +420,19 @@ export const TabColumns = [
       // { key: "id", title: "主键",type: "Input", },
       { key: "orderId", title: "采购订单ID", type: "Input", },
       { key: "rowno", title: "行号", type: "Input", },
-      { key: "material", title: "物料", type: "Input", },
+      {
+        key: "materialName",
+        title: "物料",
+        type: "InputDialog",
+        config: {
+          componentName: "MATERIAL_PARAM",
+          dataMapping: {
+            material: "id",
+            materialName: "name",
+            // materialCode: "code",
+          },
+        },
+      },
       // { key: "materialName", title: "物料名称", type: "Input", },
       { key: "specification", title: "规格", type: "Input", },
       { key: "qty", title: "数量", type: "Input", },
@@ -319,11 +442,8 @@ export const TabColumns = [
       { key: "rollbackQty", title: "累计退货主数量", type: "Checkbox", },
       { key: "backStockQty", title: "累计退库主数量", type: "Input", },
       { key: "floatQty", title: "未到货数量", type: "Input", },
-      // { key: "tenantId", title: "租户号",type: "Input", },
-      // { key: "revision", title: "乐观锁",type: "Input", },
       { key: "createByName", title: "创建人名称", type: "Input", },
       { key: "updateByName", title: "更新人名称", type: "Input", },
-      // { key: "delFlag", title: "删除标记" }
     ]
   },
 ];

+ 89 - 213
src/views/purchase/purchase-order/add/index.vue

@@ -3,13 +3,6 @@ import orderApi from "@/api/business/purchase/purchase-order";
 import { arr2obj } from "@/utils/data-transform";
 import { initColumns, initDicts, initRules, initParams } from "@/utils/init";
 import { Columns, TabColumns } from "./column";
-// import {
-//   initDicts,
-//   initRules,
-//   initParams,
-//   initComponents,
-// } from "@/utils/init";
-// import { initColumns, initTabColumns } from "./column";
 
 const NewColumns = initColumns(Columns);
 const NewTabColumns = TabColumns.map((element) => ({
@@ -77,8 +70,25 @@ export default {
       this.params = initParams(this.columns, "key", "value");
     },
     // 保存
-    handleSava() {
-      this.setVisible(false);
+    async handleSava() {
+      // this.setVisible(false);
+      console.log(this.params, 'params');
+      try {
+        const { code, msg } = await orderApi.create(this.params);
+        if (code === 200) {
+          this.$notify.success({ title: msg });
+          this.setVisible(false);
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        // this.setVisible(false);
+      }
+ 
+
+
     },
     // 保存并新增
     async handleSubmit() {
@@ -87,7 +97,7 @@ export default {
         const createByName = this.params.buyerName;
         const updateById = this.$store.state.user.id;
         const updateByName = this.$store.state.user.name;
-        const { code, msg } = await add({
+        const { code, msg } = await orderApi.create({
           createById,
           createByName,
           updateById,
@@ -110,160 +120,72 @@ export default {
   created() {
     console.log("ADD CREATED");
   },
-  mounted() {},
-  destroyed() {},
+  mounted() { },
+  destroyed() { },
 };
 </script>
 <template>
-  <el-drawer
-    direction="btt"
-    size="100%"
-    :with-header="false"
-    :visible.sync="visible"
-    @open="beforeOpen"
-    @close="$emit('close')"
-  >
-    <el-form
-      size="mini"
-      label-position="right"
-      label-width="135px"
-      :model="params"
-      :rules="rules"
-    >
-      <el-card
-        :body-style="{
-          padding: '20px',
-          display: 'flex',
-          'flex-wrap': 'wrap',
-        }"
-        style="margin: 10px"
-      >
-        <div
-          slot="header"
-          style="
+  <el-drawer direction="btt" size="100%" :with-header="false" :visible.sync="visible" @open="beforeOpen"
+    @close="$emit('close')">
+    <el-form size="mini" label-position="right" label-width="135px" :model="params" :rules="rules">
+      <el-card :body-style="{
+        padding: '20px',
+        display: 'flex',
+        'flex-wrap': 'wrap',
+      }" style="margin: 10px">
+        <div slot="header" style="
             display: flex;
             justify-content: space-between;
             align-items: center;
-          "
-        >
+          ">
           <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>
           </div>
         </div>
         <el-row>
-          <el-col
-            v-for="(column, index) in columns"
-            :key="index"
-            :span="column.span || 6"
-          >
+          <el-col v-for="(column, index) in columns" :key="index" :span="column.span || 6">
             <el-form-item :prop="column.key" :label="column.title">
-              <el-input
-                v-if="column.type === 'Input'"
-                v-model="params[column.key]"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                style="width: 100%"
-              ></el-input>
-              <dr-input-dialog
-                v-if="column.type === 'InputDialog'"
-                v-model="params[column.key]"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                :readonly="column.readonly"
-                :title="column.title"
-                :type="column.config.componentName"
-                :data-mapping="column.config.dataMapping"
-                :source.sync="params"
-              >
+              <el-input v-if="column.type === 'Input'" v-model="params[column.key]" :placeholder="column.placeholder"
+                :clearable="column.clearable" :disabled="column.disabled" style="width: 100%"></el-input>
+              <dr-input-dialog v-if="column.type === 'InputDialog'" v-model="params[column.key]"
+                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
+                :readonly="column.readonly" :title="column.title" :type="column.config.componentName"
+                :data-mapping="column.config.dataMapping" :source.sync="params">
               </dr-input-dialog>
-              <el-input
-                v-if="column.type === 'Textarea'"
-                v-model="params[column.key]"
-                type="textarea"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                style="width: 100%"
-              ></el-input>
-              <el-input-number
-                v-if="column.type === 'InputNumber'"
-                v-model="params[column.key]"
-                :controls-position="column.config.controlsPosition"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                style="width: 100%"
-              ></el-input-number>
-              <el-select
-                v-if="column.type === 'Select'"
-                v-model="params[column.key]"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in dict.type[column.config.optionsName]"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
+              <el-input v-if="column.type === 'Textarea'" v-model="params[column.key]" type="textarea"
+                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
+                style="width: 100%"></el-input>
+              <el-input-number v-if="column.type === 'InputNumber'" v-model="params[column.key]"
+                :controls-position="column.config.controlsPosition" :placeholder="column.placeholder"
+                :clearable="column.clearable" :disabled="column.disabled" style="width: 100%"></el-input-number>
+              <el-select v-if="column.type === 'Select'" v-model="params[column.key]" :placeholder="column.placeholder"
+                :clearable="column.clearable" :disabled="column.disabled" style="width: 100%">
+                <el-option v-for="item in dict.type[column.config.optionsName]" :key="item.value" :label="item.label"
+                  :value="item.value">
                 </el-option>
               </el-select>
-              <el-select
-                v-if="column.type === 'TagSelect'"
-                v-model="params[column.key]"
-                multiple
-                clearable
-                collapse-tags
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                style="width: 100%"
-              >
+              <el-select v-if="column.type === 'TagSelect'" v-model="params[column.key]" multiple clearable collapse-tags
+                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
+                style="width: 100%">
                 <template #prefix>
-                  <el-icon
-                    class="el-icon-view"
-                    style="cursor: pointer"
-                    @click.stop="$message.info(234)"
-                  ></el-icon>
+                  <el-icon class="el-icon-view" style="cursor: pointer" @click.stop="$message.info(234)"></el-icon>
                 </template>
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
+                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                 </el-option>
               </el-select>
-              <el-date-picker
-                v-if="column.type === 'DatePicker'"
-                v-model="params[column.key]"
-                :type="column.config.type"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                :picker-options="column.pickerOptions"
-                style="width: 100%"
-              >
+              <el-date-picker v-if="column.type === 'DatePicker'" v-model="params[column.key]" :type="column.config.type"
+                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
+                :picker-options="column.pickerOptions" style="width: 100%">
               </el-date-picker>
-              <el-upload
-                v-if="column.type === 'Upload'"
-                :file-list="params[column.key]"
-                :disabled="column.disabled"
-                drag
-                action="https://jsonplaceholder.typicode.com/posts/"
-                multiple
-              >
+              <el-checkbox v-else-if="column.type === 'Checkbox'" v-model="params[column.key]" true-label="Y"
+                false-label="N"></el-checkbox>
+              <el-upload v-if="column.type === 'Upload'" :file-list="params[column.key]" :disabled="column.disabled" drag
+                action="https://jsonplaceholder.typicode.com/posts/" multiple>
                 <i class="el-icon-upload"></i>
                 <div class="el-upload__text">
                   将文件拖到此处,或<em>点击上传</em>
@@ -276,76 +198,36 @@ export default {
           </el-col>
         </el-row>
       </el-card>
-      <el-card
-        :body-style="{
-          padding: '20px',
-          display: 'flex',
-          'flex-wrap': 'wrap',
-          position: 'relative',
-        }"
-        style="margin: 10px"
-      >
+      <el-card :body-style="{
+        padding: '20px',
+        display: 'flex',
+        'flex-wrap': 'wrap',
+        position: 'relative',
+      }" style="margin: 10px">
         <el-tabs v-model="tabName" style="width: 100%">
-          <el-tab-pane
-            v-for="(column, index) in tabColumns"
-            :key="index"
-            :label="column.title"
-            :name="column.key"
-          >
+          <el-tab-pane v-for="(column, index) in tabColumns" :key="index" :label="column.title" :name="column.key">
             <el-table :data="params[column.key]" style="width: 100%">
-              <el-table-column
-                v-for="(cColumn, cIndex) in column.tableColumns"
-                :key="cIndex"
-                :prop="cColumn.key"
-                :label="cColumn.title"
-                :width="cColumn.width"
-              >
+              <el-table-column v-for="(cColumn, cIndex) in column.tableColumns" :key="cIndex" :prop="cColumn.key"
+                :label="cColumn.title" :width="cColumn.width">
                 <template slot-scope="scope">
                   <el-tag v-if="cColumn.key === 'index'">
                     {{ scope.$index + 1 }}
                   </el-tag>
-                  <el-input
-                    v-if="cColumn.type === 'Input'"
-                    v-model="scope.row[cColumn.key]"
-                    :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable"
-                    :disabled="cColumn.disabled"
-                    size="mini"
-                    style="width: 100%"
-                  ></el-input>
-                  <dr-input-dialog
-                    v-if="cColumn.type === 'InputDialog'"
-                    v-model="scope.row[cColumn.key]"
-                    :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable"
-                    :disabled="cColumn.disabled"
-                    :readonly="cColumn.readonly"
-                    :title="cColumn.title"
-                    :type="cColumn.config.componentName"
-                    :data-mapping="cColumn.config.dataMapping"
-                    :source.sync="scope.row"
-                    size="mini"
-                  >
+                  <el-input v-if="cColumn.type === 'Input'" v-model="scope.row[cColumn.key]"
+                    :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
+                    size="mini" style="width: 100%"></el-input>
+                  <dr-input-dialog v-if="cColumn.type === 'InputDialog'" v-model="scope.row[cColumn.key]"
+                    :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
+                    :readonly="cColumn.readonly" :title="cColumn.title" :type="cColumn.config.componentName"
+                    :data-mapping="cColumn.config.dataMapping" :source.sync="scope.row" size="mini">
                   </dr-input-dialog>
-                  <el-input-number
-                    v-if="cColumn.type === 'InputNumber'"
-                    v-model="scope.row[cColumn.key]"
-                    :controls-position="cColumn.config.controlsPosition"
-                    :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable"
-                    :disabled="cColumn.disabled"
-                    size="mini"
-                    style="width: 100%"
-                  ></el-input-number>
-                  <el-input
-                    v-if="column.type === 'InputDialog'"
-                    v-model="params[column.key]"
-                    :placeholder="column.placeholder"
-                    :clearable="column.clearable"
-                    :disabled="column.disabled"
-                    :readonly="column.readonly"
-                    style="width: 100%; cursor: pointer"
-                  >
+                  <el-input-number v-if="cColumn.type === 'InputNumber'" v-model="scope.row[cColumn.key]"
+                    :controls-position="cColumn.config.controlsPosition" :placeholder="cColumn.placeholder"
+                    :clearable="cColumn.clearable" :disabled="cColumn.disabled" size="mini"
+                    style="width: 100%"></el-input-number>
+                  <el-input v-if="column.type === 'InputDialog'" v-model="params[column.key]"
+                    :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
+                    :readonly="column.readonly" style="width: 100%; cursor: pointer">
                     <template #suffix>
                       <el-icon class="el-icon-thumb"></el-icon>
                     </template>
@@ -354,13 +236,9 @@ export default {
               </el-table-column>
               <el-table-column fixed="right" label="操作" width="120">
                 <template slot-scope="scope">
-                  <el-button
-                    @click.native.prevent="
-                      delTableRow(params[tabName], scope.$index)
-                    "
-                    type="text"
-                    size="small"
-                  >
+                  <el-button @click.native.prevent="
+                    delTableRow(params[tabName], scope.$index)
+                    " type="text" size="small">
                     删行
                   </el-button>
                 </template>
@@ -369,9 +247,7 @@ export default {
           </el-tab-pane>
         </el-tabs>
         <el-row style="position: absolute; top: 20px; right: 20px">
-          <el-button size="mini" @click="addTableRow(params[tabName])"
-            >增行</el-button
-          >
+          <el-button size="mini" @click="addTableRow(params[tabName])">增行</el-button>
         </el-row>
       </el-card>
     </el-form>

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

@@ -1,12 +1,12 @@
 export const TableColumns = [
    // { key: "id", title: "主键" },
       // { key: "puOrg", title: "采购组织" },
-      { key: "puOrgName", title: "采购组织名称" },
+      { key: "puOrgName", title: "采购组织名称",search: true, type: "Input"  },
       { key: "billType", title: "订单类型" },
-      { key: "code", title: "订单编号" },
+      { key: "code", title: "订单编号",search: true, type: "Input"  },
       { key: "billDate", title: "订单日期" },
       // { key: "supplier", title: "供应商" },
-      { key: "supplierName", title: "供应商名称" },
+      { key: "supplierName", title: "供应商名称",search: true, type: "Input" },
       { key: "paymentAgreement", title: "付款协议" },
       // { key: "currency", title: "币种" },
       { key: "currencyName", title: "币种名称" },

+ 266 - 0
src/views/purchase/purchase-order/edit/index.vue

@@ -0,0 +1,266 @@
+<script>
+import { Columns, TabColumns } from "../add/column";
+import orderApi from "@/api/business/purchase/purchase-order";
+import { initColumns, initDicts, initRules, initParams } from "@/utils/init";
+
+const NewColumns = initColumns(Columns);
+const NewTabColumns = TabColumns.map((element) => ({
+  ...element,
+  tableColumns: initColumns(element.tableColumns),
+}));
+
+export default {
+  name: "EditPurchaseContractDrawer",
+  dicts: initDicts(NewColumns),
+  components: {
+    DrInputDialog: () => import("@/views/input-dialog/index.vue"),
+  },
+  data() {
+    return {
+      size: "mini",
+      visible: false,
+      loading: false,
+      columns: NewColumns,
+      rules: initRules(NewColumns),
+      params: {
+        ...initParams(NewColumns),
+        contractItemList: [],
+        contractClauseList: [],
+        contractExpenseList: [],
+        contractAgreementList: [],
+        contractApplyOrgList: [],
+      },
+
+      tabColumns: NewTabColumns,
+      tabName: "contractItemList",
+    };
+  },
+  computed: {},
+  watch: {
+    "params.contractType": function (newProp) {
+      this.tabColumns = NewTabColumns.filter((element) =>
+        newProp === "1" ? element.key !== "contractItemList" : element
+      );
+      this.tabName = this.tabColumns[0].key;
+    },
+    tabName: function (newProp) {
+      const { id } = this.params;
+      this.fetchTable(id, newProp);
+    },
+  },
+  methods: {
+    setVisible(prop) {
+      this.visible = prop;
+    },
+    // 查询详细
+    async fetchItem(prop) {
+      try {
+        this.loading = true;
+        const { code, msg, data } = await orderApi.details(prop);
+        if (code === 200) {
+          this.params = data;
+          this.$notify.success({ title: msg });
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 查询详情关联TABLE
+    async fetchTable(prop, name) {
+      try {
+        this.loading = true;
+        const { code, msg, rows } = await itemTableList({ id: prop }, name);
+        if (code === 200) {
+          this.params[name] = rows;
+          this.$notify.success({ title: msg });
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 新增行
+    addTableRow(prop) {
+      const arr = this.tabColumns.find(
+        (element) => element.key === this.tabName
+      ).tableColumns;
+      prop.push(initParams(arr, "key", "value"));
+    },
+    // 删除行
+    delTableRow(prop, index) {
+      prop.splice(index, 1);
+    },
+    // 取消
+    handleCancel() {
+      this.setVisible(false);
+      this.params = initParams(this.columns, "key", "value");
+    },
+    // 保存
+    handleSava() {
+      this.setVisible(false);
+    },
+    // 保存并新增
+    async handleSubmit() {
+      try {
+        const createById = this.params.buyer;
+        const createByName = this.params.buyerName;
+        const updateById = this.$store.state.user.id;
+        const updateByName = this.$store.state.user.name;
+        const { code, msg } = await edit({
+          createById,
+          createByName,
+          updateById,
+          updateByName,
+          ...this.params,
+        });
+        if (code === 200) {
+          this.$notify.success({ title: msg });
+          this.setVisible(false);
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        // this.setVisible(false);
+      }
+    },
+    beforeOpen() { },
+  },
+  created() {
+    console.log("ADD CREATED");
+  },
+  mounted() { },
+  destroyed() { },
+};
+</script>
+<template>
+  <el-drawer direction="btt" size="100%" :with-header="false" :visible.sync="visible" @open="beforeOpen"
+    @close="$emit('close')">
+    <el-form v-loading="loading" :size="size" label-position="right" label-width="135px" :model="params" :rules="rules">
+      <el-card :body-style="{
+        padding: '20px',
+        display: 'flex',
+        'flex-wrap': 'wrap',
+      }" style="margin: 10px">
+        <div slot="header" style="
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+          ">
+          <h3>编辑</h3>
+          <div style="text-align: right">
+            <el-button :size="size" @click="handleCancel">取 消</el-button>
+            <el-button :size="size" type="danger" @click="handleSava">更 新</el-button>
+          </div>
+        </div>
+        <el-row>
+          <el-col v-for="(column, index) in columns" :key="index" :span="column.span || 6">
+            <el-form-item :prop="column.key" :label="column.title">
+              <el-input v-if="column.type === 'Input'" v-model="params[column.key]" :placeholder="column.placeholder"
+                :clearable="column.clearable" :disabled="column.disabled" style="width: 100%"></el-input>
+              <dr-input-dialog v-if="column.type === 'InputDialog'" v-model="params[column.key]"
+                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
+                :readonly="column.readonly" :title="column.title" :type="column.config.componentName"
+                :data-mapping="column.config.dataMapping" :source.sync="params">
+              </dr-input-dialog>
+              <el-input v-if="column.type === 'Textarea'" v-model="params[column.key]" type="textarea"
+                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
+                style="width: 100%"></el-input>
+              <el-input-number v-if="column.type === 'InputNumber'" v-model="params[column.key]"
+                :controls-position="column.config.controlsPosition" :placeholder="column.placeholder"
+                :clearable="column.clearable" :disabled="column.disabled" style="width: 100%"></el-input-number>
+              <el-select v-if="column.type === 'Select'" v-model="params[column.key]" :placeholder="column.placeholder"
+                :clearable="column.clearable" :disabled="column.disabled" style="width: 100%">
+                <el-option v-for="item in dict.type[column.config.optionsName]" :key="item.value" :label="item.label"
+                  :value="item.value">
+                </el-option>
+              </el-select>
+              <el-select v-if="column.type === 'TagSelect'" v-model="params[column.key]" multiple clearable collapse-tags
+                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
+                style="width: 100%">
+                <template #prefix>
+                  <el-icon class="el-icon-view" style="cursor: pointer" @click.stop="$message.info(234)"></el-icon>
+                </template>
+                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+                </el-option>
+              </el-select>
+              <el-date-picker v-if="column.type === 'DatePicker'" v-model="params[column.key]" :type="column.config.type"
+                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
+                :picker-options="column.pickerOptions" style="width: 100%">
+              </el-date-picker>
+              <el-checkbox v-else-if="column.type === 'Checkbox'" v-model="params[column.key]" true-label="Y" false-label="N"></el-checkbox>
+              <el-upload v-if="column.type === 'Upload'" :file-list="params[column.key]" :disabled="column.disabled" drag
+                action="https://sy.derom.com/document-center/fastdfs/upload" multiple>
+                <i class="el-icon-upload"></i>
+                <div class="el-upload__text">
+                  将文件拖到此处,或<em>点击上传</em>
+                </div>
+                <!-- <div class="el-upload__tip" slot="tip">
+                  只能上传jpg/png文件,且不超过500kb
+                </div> -->
+              </el-upload>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-card>
+      <el-card :body-style="{
+        padding: '20px',
+        display: 'flex',
+        'flex-wrap': 'wrap',
+        position: 'relative',
+      }" style="margin: 10px">
+        <el-tabs v-model="tabName" style="width: 100%">
+          <el-tab-pane v-for="(column, index) in tabColumns" :key="index" :label="column.title" :name="column.key">
+            <el-table :data="params[column.key]" style="width: 100%">
+              <el-table-column label="序号">
+                <template slot-scope="scope">
+                  {{ scope.$index + 1 }}
+                </template>
+              </el-table-column>
+              <el-table-column v-for="(cColumn, cIndex) in column.tableColumns" :key="cIndex" :prop="cColumn.key"
+                :label="cColumn.title" :width="cColumn.width">
+                <template slot-scope="scope">
+                  <span v-if="!cColumn.type">
+                    {{ scope.row[cColumn.key] }}</span>
+                  <el-input v-if="cColumn.type === 'Input'" v-model="scope.row[cColumn.key]"
+                    :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
+                    :size="size" style="width: 100%"></el-input>
+                  <dr-input-dialog v-if="cColumn.type === 'InputDialog'" v-model="scope.row[cColumn.key]"
+                    :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
+                    :readonly="cColumn.readonly" :title="cColumn.title" :type="cColumn.config.componentName"
+                    :data-mapping="cColumn.config.dataMapping" :source.sync="scope.row" :size="size">
+                  </dr-input-dialog>
+                  <el-checkbox v-else-if="column.type === 'Checkbox'" v-model="params[column.key]" true-label="Y" false-label="N"></el-checkbox>
+                  <el-input-number v-if="cColumn.type === 'InputNumber'" v-model="scope.row[cColumn.key]"
+                    :controls-position="cColumn.config.controlsPosition" :placeholder="cColumn.placeholder"
+                    :clearable="cColumn.clearable" :disabled="cColumn.disabled" :size="size"
+                    style="width: 100%"></el-input-number>
+                </template>
+              </el-table-column>
+              <el-table-column fixed="right" label="操作" width="120">
+                <template slot-scope="scope">
+                  <el-button @click.native.prevent="
+                    delTableRow(params[tabName], scope.$index)
+                    " type="text" size="small">
+                    删行
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-tab-pane>
+        </el-tabs>
+        <el-row style="position: absolute; top: 20px; right: 20px">
+          <el-button :size="size" @click="addTableRow(params[tabName])">增行</el-button>
+        </el-row>
+      </el-card>
+    </el-form>
+  </el-drawer>
+</template>

+ 89 - 144
src/views/purchase/purchase-order/index.vue

@@ -3,116 +3,20 @@
 import { TableColumns, SearchColumns } from "./column";
 import orderApi from "@/api/business/purchase/purchase-order";
 import { initPage, initLayout, initPageSizes, initParams } from "@/utils/init";
-import AddPurchaseOrderDrawer from "./add/index.vue";
-import SeePurchaseOrderDrawer from "./see/index.vue";
-// import DirectSourcingTable from "./direct-sourcing.vue";
 export default {
   name: "PuchaseTask",
   components: {
-    AddPurchaseOrderDrawer,
-    SeePurchaseOrderDrawer,
-    // DirectSourcingTable,
+    AddDrawer: () => import('./add/index.vue'),
+    SeeDrawer: () => import('./see/index.vue'),
+    EditDrawer: () => import('./edit/index.vue'),
   },
   data() {
-    const arr2Obj = function (data, keyName, valueName) {
-      return Object.fromEntries(
-        data.map((item) => [item[keyName], item[valueName]])
-      );
-    };
-    // const searchColumns = [
-    //   { key: "puOrg", title: "采购组织", type: "Input" },
-    //   { key: "billDate", title: "订单日期", type: "DatePicker" },
-    //   { key: "code", title: "订单编号", type: "Input" },
-    //   { key: "status", title: "单据状态", type: "Input" },
-    //   { key: "buyerName", title: "采购员", type: "Input" },
-    //   { key: "supplierName", title: "供应商名称", type: "Input" },
 
-    // ];
-    // const initSearchColumns = () => searchColumns;
-    // const initSearchParams = () => arr2Obj(initSearchColumns(), "key", "value");
-    // const tableColumns = [
-    //   // { key: "id", title: "主键" },
-    //   // { key: "puOrg", title: "采购组织" },
-    //   { key: "puOrgName", title: "采购组织名称" },
-    //   { key: "billType", title: "订单类型" },
-    //   { key: "code", title: "订单编号" },
-    //   { key: "billDate", title: "订单日期" },
-    //   // { key: "supplier", title: "供应商" },
-    //   { key: "supplierName", title: "供应商名称" },
-    //   { key: "paymentAgreement", title: "付款协议" },
-    //   // { key: "currency", title: "币种" },
-    //   { key: "currencyName", title: "币种名称" },
-    //   // { key: "buyer", title: "采购员" },
-    //   { key: "buyerName", title: "采购员" },
-    //   // { key: "puDept", title: "采购部门" },
-    //   { key: "puDeptName", title: "采购部门名称" },
-    //   // { key: "customer", title: "收货客户" },
-    //   { key: "customerName", title: "收货客户名称" },
-    //   { key: "isDeliver", title: "是否发货" },
-    //   { key: "isArrival", title: "到货超期" },
-    //   { key: "isBack", title: "退货" },
-    //   // { key: "freezeCause", title: "冻结原因" },
-    //   { key: "qty", title: "总数量" },
-    //   { key: "money", title: "总数量" },
-    //   { key: "isMarketing", title: "已协同生成销售订单" },
-    //   { key: "isMarketingSource", title: "由销售订单协同生成" },
-    //   // { key: "personal", title: "人员" },
-    //   { key: "personalName", title: "人员名称" },
-    //   // { key: "isSendSrm", title: "是否同步SRM" },
-    //   { key: "isInvoice", title: "发票标识" },
-    //   { key: "rebateMoney", title: "订单使用返利金额" },
-    //   { key: "deductionMoney", title: "订单抵扣余款金额" },
-    //   // { key: "warehouse", title: "WMS入库仓库" },
-    //   { key: "warehouseName", title: "收货仓库" }, //WMS入库仓库名称
-    //   // { key: "goodsAllocation", title: "货位" },
-    //   { key: "goodsAllocationName", title: "货位名称" },
-    //   // { key: "customerDept", title: "客户部门" },
-    //   { key: "customerDeptName", title: "客户部门名称" },
-    //   // { key: "supplierContacts", title: "供应商业务联系人" },
-    //   { key: "supplierContactsName", title: "供应商业务联系人名称" },
-    //   { key: "isUrgency", title: "紧急程度" },
-    //   // { key: "agent", title: "代理人" }, // 建议删除
-    //   { key: "agentName", title: "代理人名称" },
-    //   { key: "isClose", title: "最终关闭" },
-    //   { key: "applyPaymentMoney", title: "累计付款申请金额" },
-    //   { key: "paymentMoney", title: "累计付款金额" },
-    //   { key: "invoiceMoney", title: "发票金额" },
-    //   // { key: "supplierPersonal", title: "供应商业务员" },
-    //   { key: "supplierPersonalName", title: "供应商业务员名称" },
-    //   { key: "marketingCode", title: "销售订单号" },
-    //   // { key: "tenantId", title: "租户号" },
-    //   // { key: "revision", title: "乐观锁" },
-    //   { key: "createByName", title: "创建人名称" },
-    //   { key: "updateByName", title: "更新人名称" },
-    //   // { key: "delFlag", title: "删除标记" },
-    //   { key: "flowId", title: "OA流程ID" },
-    //   { key: "approver", title: "审批人" },
-    //   { key: "approverFinishTime", title: "审批时间" },
-    //   { key: "approveTime", title: "提交时间" },
-    //   { key: "createTime", title: "制单日期/创建时间" },
-    //   { key: "remark", title: "备注" },
-    //   { key: "updateTime", title: "最后修改时间" },
-    //   { key: "status", title: "单据状态" },
-    //   { key: "oaDemandNo", title: "OA需求单号" },
-    //   { key: "address", title: "收货地址" },
-    //   { key: "contacts", title: "收获联系人" },
-    //   { key: "isSendWms", title: "已同步WMS" },
-    //   { key: "retReason", title: "退换原因" },
-    //   { key: "closeTime", title: "最终关闭日期" },
-    //   { key: "processType", title: "处理方式" },
-    //   { key: "isEnd", title: "整单关闭标识" },
-    //   { key: "projectNow", title: "在建工程项目" },
-    //   { key: "operatingItems", title: "经营性项目" },
-    //   { key: "isArrivalReson", title: "到货超期原因" },
-    //   { key: "midOrderNo", title: "中台采购订单号" }
-    // ];
-    // const initTableColumns = () => tableColumns;
     const tabColumns = [
       {
         title: '物料信息',
         key: 'first',
         tableColumns: [
-          // { key: "id", title: "主键" },
           { key: "rowNo", title: "行号" },
           { key: "orderId", title: "采购订单ID" },
           { key: "material", title: "物料" },
@@ -219,29 +123,19 @@ export default {
       params: initParams(SearchColumns),
 
       tableColumns: TableColumns,
-      // searchColumns: initSearchColumns(),
-      // searchParams: {
-      //   isAsc: "desc",
-      //   reasonable: "",
-      //   orderByColumn: "",
-      //   ...initSearchParams(),
-      // },
-      // tableColumns: initTableColumns(),
-      tableData: [{ puOrgName: 1 }],
+      tableData: [],
       tabColumns: initTabColumns(),
       tabName: "first",
       tabTableDatas: {
         first: [],
         second: [],
       },
-      // page: { pageNum: 1, pageSize: 25 },
-      // total: 0,
-      // pageSizes: [25, 50, 100],
-      detailsData: {}
+      checkedData: {}
     };
   },
   computed: {
     showSearchColumns() {
+      console.log(this.searchColumns, 'this.searchColumns');
       return this.isSimpleSearch
         ? this.searchColumns.slice(0, 4)
         : this.searchColumns;
@@ -256,19 +150,21 @@ export default {
   //     },
   //   },
   created() {
-    this.fetchTaskList();
+    this.fetchList(this.params, this.page);
     console.log("Vue", this);
   },
   methods: {
-    async fetchTaskList() {
-      this.loading = true;
+    async fetchList(params, page) {
       try {
-        const { code, msg, rows, total } = await orderApi.orderList({
-          ...this.page,
-          ...this.searchParams,
+        this.loading = true;
+        const { pageNum, pageSize } = page;
+        const { code, msg, rows, total } = await orderApi.list({
+          pageNum,
+          pageSize,
+          ...params,
         });
         if (code === 200) {
-          this.total = total;
+          this.page.total = total;
           this.tableData = rows;
           this.$notify.success({ title: msg });
         } else {
@@ -286,30 +182,57 @@ export default {
         title: this.isSimpleSearch ? "Simple Search" : "All Search",
       });
     },
-    handleSizeChange() { },
-    handleCurrentChange() { },
+    // 页大小变
+    handleSizeChange(prop) {
+      this.page.pageSize = prop;
+      this.fetchList(this.params, this.page);
+    },
+    // 当前页变
+    handleCurrentChange(prop) {
+      this.page.pageNum = prop;
+      this.fetchList(this.params, this.page);
+    },
+    // 刷新操作
+    handleRefreshList() {
+      this.fetchList(this.params, this.page);
+    },
+    // 查询操作
+    handleQueryList() {
+      this.fetchList(this.params, this.page);
+    },
+    // 重置操作
+    handleResetList() {
+      this.page = initPage();
+      this.params = initParams();
+      this.fetchList(this.params, this.page);
+    },
     handleTabClick() { },
+    // 新增
     handleOpenAddDrawer() {
       const { setVisible } = this.$refs.addDrawerFef;
       setVisible(true);
-      setTimeout(() => {
-        this.$notify.info("Open Add Drawer");
-      }, 250);
     },
-    handleOpenSeeDrawer() {
-      const { setVisible } = this.$refs.seeDrawerFef;
-      setVisible(true);
-      setTimeout(() => {
-        this.$notify.info("Open See Drawer");
-      }, 250);
+    // 查看
+    async handleOpenSeeDrawer(row) {
+      const { id } = row;
+      const { setVisible, fetchItem } = this.$refs.seeDrawerFef;
+      await setVisible(true);
+      await fetchItem(id);
+    },
+    // 编辑、修订
+    async handleOpenEditDrawer(row) {
+      const { id } = row;
+      const { setVisible, fetchItem } = this.$refs.editDrawerFef;
+      await setVisible(true);
+      await fetchItem(id);
     },
     // 获取子表信息
     async handleDetailsData(row) {
       console.log(row, '获取详情信息');
       try {
-        const { code, msg, data } = await orderApi.orderDetails(row.id);
+        const { code, msg, data } = await orderApi.details(row.id);
         if (code === 200) {
-          this.detailsData = data;
+          this.checkedData = data;
           // 物料信息:puOrderItemList   执行结果:puOrderExecuteList
           this.tabTableDatas.first = data.puOrderItemList;
           this.tabTableDatas.second = data.puOrderExecuteList;
@@ -323,29 +246,50 @@ export default {
         // this.loading = false;
       }
     },
+    // 删除操作
+    async handleDeleteList(prop) {
+      try {
+        this.loading = true;
+        const { id } = prop;
+        console.log(id, 'id');
+        const { code, msg } = await orderApi.remove(id);
+        if (code === 200) {
+          this.$notify.success({ title: msg });
+          this.fetchList(this.params, this.page);
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        this.loading = false;
+      }
+    },
+
   },
 };
 </script>
 
 <template>
   <el-card v-loading="loading" style="width: calc(100% - 24px); height: 100%; margin: 10px" :body-style="{ padding: 0 }">
-    <AddPurchaseOrderDrawer ref="addDrawerFef"></AddPurchaseOrderDrawer>
-    <SeePurchaseOrderDrawer ref="seeDrawerFef"></SeePurchaseOrderDrawer>
+    <SeeDrawer ref="seeDrawerFef"></SeeDrawer>
+    <AddDrawer ref="addDrawerFef" @close="handleResetList"></AddDrawer>
+    <EditDrawer ref="editDrawerFef" @close="handleResetList"></EditDrawer>
 
-    <el-form size="mini" label-position="right" label-width="85px" :model="params" style="padding: 20px 0 0 0">
+    <el-form size="mini" label-position="right" label-width="100px" :model="params" style="padding: 20px 0 0 0">
       <el-row :gutter="24">
         <el-col :span="20">
           <el-row :gutter="20">
             <el-col v-for="column in showSearchColumns" :key="column.title" :xl="6" :lg="6" :md="8" :sm="12" :xs="24">
               <el-form-item :prop="column.key" :label="column.title">
-                <el-input v-model="searchParams[column.key]" :placeholder="column.placeholder"></el-input>
+                <el-input v-model="params[column.key]" :placeholder="column.placeholder"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
         </el-col>
-        <el-col :span="3" :offset="1" style="text-align: right; padding-right: 40px">
-          <el-button type="primary" size="mini">搜索</el-button>
-          <el-button size="mini">重置</el-button>
+        <el-col :span="4" style="text-align: right; padding-right: 40px">
+          <el-button type="primary" size="mini" @click="handleQueryList">搜索</el-button>
+          <el-button size="mini" @click="handleResetList">重置</el-button>
         </el-col>
       </el-row>
     </el-form>
@@ -366,7 +310,7 @@ export default {
         </el-button-group>
 
         <el-button-group style="margin-left: 10px">
-          <el-button size="mini">修订</el-button>
+          <!-- <el-button size="mini" :disabled="checkedData.status != '2'">修订</el-button> -->
           <el-button size="mini">退回</el-button>
         </el-button-group>
 
@@ -387,14 +331,15 @@ export default {
       </el-table-column>
       <el-table-column fixed="right" label="操作" width="120">
         <template slot-scope="scope">
-          <el-button @click="handleOpenSeeDrawer(scope.row)" type="text" size="small">查看</el-button>
-          <el-button type="text" size="small" @click="handleOpenAddDrawer(scope.row)">编辑</el-button>
-          <el-button type="text" size="small">删除</el-button>
+          <el-button @click.stop="handleOpenSeeDrawer(scope.row)" type="text" size="small">查看</el-button>
+          <el-button type="text" size="small" @click.stop="handleOpenEditDrawer(scope.row)">
+            {{ scope.row.status == '2' ? '修订' : '编辑' }}</el-button>
+          <el-button type="text" size="small" @click.stop="handleDeleteList(scope.row)">删除</el-button>
         </template>
       </el-table-column>
 
     </el-table>
-    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :total="total"
+    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :total="page.total"
       :page-sizes="pageSizes" :page-size="page.pageSize" :current-page="page.pageNum" hide-on-single-page
       :layout="layout">
     </el-pagination>

+ 14 - 221
src/views/purchase/purchase-order/see/index.vue

@@ -7,6 +7,7 @@ import {
   initParams,
 } from "@/utils/init";
 import { Columns, TabColumns } from "../add/column";
+import orderApi from "@/api/business/purchase/purchase-order";
 
 const NewColumns = initColumns(Columns, { disabled: true, readonly: true });
 const NewTabColumns = TabColumns.map((element) => ({
@@ -19,214 +20,6 @@ export default {
   name: "SeePurchaseContractDrawer",
   dicts: initDicts(NewColumns),
   data() {
-    // const arr2Obj = function (data, keyName, valueName) {
-    //   return Object.fromEntries(
-    //     data.map((item) => [item[keyName], item[valueName]])
-    //   );
-    // };
-    // const columns = [
-    //   // { key: "id", title: "主键" },
-    //   { key: "puOrg", title: "采购组织" },
-    //   { key: "puOrgName", title: "采购组织名称" },
-    //   { key: "billType", title: "订单类型" },
-    //   { key: "billTypeName", title: "订单类型名称" },
-    //   { key: "oaDemandNo", title: "OA需求单号" },
-    //   { key: "code", title: "订单编号" },
-    //   { key: "billDate", title: "订单日期" },
-    //   { key: "supplier", title: "供应商" },
-    //   { key: "supplierName", title: "供应商名称" },
-    //   { key: "paymentAgreement", title: "付款协议" },
-    //   { key: "finalType", title: "结算方式" },
-    //   { key: "currency", title: "币种" },
-    //   { key: "currencyName", title: "币种名称" },
-    //   { key: "buyer", title: "采购员" },
-    //   { key: "buyerName", title: "采购员名称" },
-    //   { key: "puDept", title: "采购部门" },
-    //   { key: "puDeptName", title: "采购部门名称" },
-    //   { key: "customer", title: "收货客户" },
-    //   { key: "customerName", title: "收货客户名称" },
-    //   { key: "qty", title: "总数量" },
-    //   { key: "originalQty", title: "原始总数量" },
-    //   { key: "money", title: "价税合计" },
-    //   { key: "originalMoney", title: "原始总金额" },
-    //   { key: "notaxMoney", title: "无税金额" },
-    //   { key: "status", title: "单据状态" },
-    //   { key: "freezeCause", title: "冻结原因" },
-    //   { key: "isBack", title: "退货" },
-    //   { key: "isMarketing", title: "已协同生成销售订单" },
-    //   { key: "isMarketingSource", title: "由销售订单协同生成" },
-    //   { key: "warehouse", title: "WMS入库仓库" },
-    //   { key: "warehouseName", title: "WMS入库仓库名称" },
-    //   { key: "goodsAllocation", title: "货位" },
-    //   { key: "goodsAllocationName", title: "货位名称" },
-    //   { key: "isSendSrm", title: "是否同步SRM" },
-    //   { key: "isInvoice", title: "发票标识" },
-    //   { key: "supplierOrderNo", title: "供应商订单号" },
-    //   { key: "rebateMoney", title: "订单使用返利金额" },
-    //   { key: "deductionMoney", title: "订单抵扣余款金额" },
-    //   { key: "address", title: "收货地址" },
-    //   { key: "contacts", title: "收货联系人" },
-    //   { key: "customerDept", title: "客户部门" },
-    //   { key: "customerDeptName", title: "客户部门名称" },
-    //   { key: "supplierContacts", title: "供应商业务联系人" },
-    //   { key: "supplierContactsName", title: "供应商业务联系人名称" },
-    //   { key: "isUrgency", title: "紧急程度" },
-    //   { key: "isSendWms", title: "已同步WMS" },
-    //   { key: "agent", title: "代理人" },
-    //   { key: "agentName", title: "代理人名称" },
-    //   { key: "isClose", title: "最终关闭" },
-    //   { key: "closeTime", title: "最终关闭日期" },
-    //   { key: "applyPaymentMoney", title: "累计付款申请金额" },
-    //   { key: "paymentMoney", title: "累计付款金额" },
-    //   { key: "invoiceMoney", title: "发票金额" },
-    //   { key: "supplierPersonal", title: "供应商业务员" },
-    //   { key: "supplierPersonalName", title: "供应商业务员名称" },
-    //   { key: "isDeliver", title: "是否发货" },
-    //   { key: "retReason", title: "退换原因" },
-    //   { key: "processType", title: "处理方式" },
-    //   { key: "isEnd", title: "整单关闭标识" },
-    //   { key: "projectNow", title: "在建工程项目" },
-    //   { key: "operatingItems", title: "经营性项目" },
-    //   { key: "isArrivalReson", title: "到货超期原因" },
-    //   { key: "midOrderNo", title: "中台采购订单号" },
-    //   { key: "marketingCode", title: "销售订单号" },
-    //   { key: "isArrival", title: "到货超期" },
-    //   // { key: "tenantId", title: "租户号" },
-    //   // { key: "revision", title: "乐观锁" },
-    //   { key: "createByName", title: "创建人名称" },
-    //   { key: "updateByName", title: "更新人名称" },
-    //   // { key: "delFlag", title: "删除标记" },
-    //   { key: "flowId", title: "OA流程ID" },
-    //   { key: "approver", title: "审批人" },
-    //   { key: "approverFinishTime", title: "审批时间" },
-    //   { key: "approveTime", title: "提交时间" },
-
-    // ];
-    // const initColumns = () =>
-    //   columns.map((column) => {
-    //     const clearable = column.clearable || true;
-    //     if (column.type === "InputNumber") {
-    //       return {
-    //         ...column,
-    //         clearable,
-    //         config: { controlsPosition: "right" },
-    //       };
-    //     }
-    //     if (column.type === "DatePicker") {
-    //       return {
-    //         ...column,
-    //         clearable,
-    //         config: { type: "date" },
-    //       };
-    //     }
-    //     return {
-    //       ...column,
-    //       clearable,
-    //     };
-    //   });
-    // const initParams = () => arr2Obj(initColumns(), "key", "value");
-    // const tabColumns = [
-    //   {
-    //     title: '物料信息',
-    //     key: 'first',
-    //     tableColumns: [
-    //       // { key: "id", title: "主键" },
-    //       { key: "rowNo", title: "行号" },
-    //       { key: "orderId", title: "采购订单ID" },
-    //       { key: "material", title: "物料" },
-    //       { key: "materialName", title: "物料名称" },
-    //       { key: "materialCode", title: "物料编码" },
-    //       { key: "materialClassify", title: "物料分类" },
-    //       { key: "materialManufacturersCode", title: "厂家物料编码" },
-    //       { key: "specification", title: "规格" },
-    //       { key: "model", title: "型号" },
-    //       { key: "isMedcine", title: "医药物料" },
-    //       { key: "manufacturer", title: "生产厂家代理人" },
-    //       { key: "isDrug", title: "物料药品属性" },
-    //       { key: "unit", title: "单位" },
-    //       { key: "qty", title: "数量" },
-    //       { key: "taxPrice", title: "含税单价" },
-    //       { key: "money", title: "价税合计" },
-    //       { key: "tax", title: "税率" },
-    //       { key: "taxDeductMoneya", title: "折扣金额" },
-    //       { key: "arrivalQty", title: "已到货数量" },
-    //       { key: "unarrivedQty", title: "未到货数量" },
-    //       { key: "notaxMoney", title: "无税金额" },
-    //       { key: "priceSource", title: "价格目录ID" },
-    //       { key: "isStorage", title: "入库关闭" },
-    //       { key: "isInvoice", title: "开票关闭" },
-    //       { key: "isArrival", title: "到货关闭" },
-    //       { key: "isPayment", title: "付款关闭" },
-    //       { key: "isGift", title: "赠品" },
-    //       { key: "warehouse", title: "收货仓库" },
-    //       { key: "place", title: "收货地点" },
-    //       { key: "address", title: "收货地址" },
-    //       { key: "productBatch", title: "产品批号" },
-    //       { key: "manufactureDate", title: "生产日期" },
-    //       { key: "efficacyLoseDate", title: "有效期至/失效日期" },
-    //       { key: "approvalNumber", title: "批准文号" },
-    //       { key: "registration", title: "注册证号" },
-    //       { key: "storageCondition", title: "存储条件" },
-    //       { key: "carriageCondition", title: "运输条件" },
-    //       { key: "isBatchLock", title: "批号锁定标识" },
-    //       { key: "isReplenishment", title: "补单标识" },
-    //       { key: "isUrgency", title: "紧急标识" },
-    //       { key: "originalQty", title: "原始数量" },
-    //       { key: "originalMoney", title: "原始金额" },
-    //       { key: "directProductBatch", title: "直运产品批号" },
-    //       { key: "discountRule", title: "折扣规则编码" },
-    //       { key: "reservedQty", title: "预留数量" },
-    //       { key: "reservedPeriod", title: "预留周期" },
-    //       { key: "taxDeductClassify", title: "扣税类别" },
-    //       { key: "exchangeRate", title: "折本汇率" },
-    //       { key: "source", title: "上游单据号" },
-    //       { key: "sourceId", title: "上游单据ID" },
-    //       { key: "demandCode", title: "采购需求单号" },
-    //       { key: "arrivalDatePlan", title: "计划到货日期" },
-    //       { key: "priceType", title: "价格类型" },
-    //       { key: "isDistributionPrice", title: "配送价" },
-    //       // { key: "tenantId", title: "租户号" },
-    //       // { key: "revision", title: "乐观锁" },
-    //       { key: "createByName", title: "创建人名称" },
-    //       { key: "updateByName", title: "更新人名称" },
-    //       // { key: "delFlag", title: "删除标记" },
-    //       // { key: "materialClassifyOne", title: "物料一级分类" },
-    //       { key: "materialClassifyOneName", title: "物料一级分类名称" },
-    //       // { key: "materialClassifyTwo", title: "物料二级分类" },
-    //       { key: "materialClassifyTwoName", title: "物料二级分类名称" },
-    //       // { key: "materialClassifyThree", title: "物料三级分类" },
-    //       { key: "materialClassifyThreeName", title: "物料三级分类名称" },
-    //       // { key: "materialClassifyFour", title: "物料四级分类" },
-    //       { key: "materialClassifyFourName", title: "物料四级分类名称" },
-    //       { key: "price", title: "无税单价" }
-    //     ]
-    //   },
-    //   {
-    //     title: '执行结果',
-    //     key: 'second',
-    //     tableColumns: [
-    //       // { key: "id", title: "主键" },
-    //       { key: "orderId", title: "采购订单ID" },
-    //       { key: "rowno", title: "行号" },
-    //       { key: "material", title: "物料" },
-    //       { key: "materialName", title: "物料名称" },
-    //       { key: "specification", title: "规格" },
-    //       { key: "qty", title: "数量" },
-    //       { key: "stroageQty", title: "累计到货主数量" },
-    //       { key: "stockQty", title: "累计入库主数量" },
-    //       { key: "invoiceQty", title: "累计开票主数量" },
-    //       { key: "rollbackQty", title: "累计退货主数量" },
-    //       { key: "backStockQty", title: "累计退库主数量" },
-    //       { key: "floatQty", title: "未到货数量" },
-    //       // { key: "tenantId", title: "租户号" },
-    //       // { key: "revision", title: "乐观锁" },
-    //       { key: "createByName", title: "创建人名称" },
-    //       { key: "updateByName", title: "更新人名称" },
-    //       // { key: "delFlag", title: "删除标记" }
-    //     ]
-    //   },
-    // ];
-    // const initTabColumns = () => tabColumns;
     return {
       visible: false,
       columns: NewColumns,
@@ -239,13 +32,6 @@ export default {
 
       tabColumns: NewTabColumns,
       tabName: "puOrderItemList",
-      // tabTableDatas: {
-      //   first: [],
-      //   second: [],
-      //   // third: [],
-      //   // fourth: [],
-      //   // fifth: [],
-      // },
     };
   },
   computed: {},
@@ -254,11 +40,12 @@ export default {
     setVisible(prop) {
       this.visible = prop;
     },
-    //
+
+    //查询详情
     async fetchItem(prop) {
       try {
         this.loading = true;
-        const { code, msg, data } = await item(prop);
+        const { code, msg, data } = await orderApi.details(prop);
         if (code === 200) {
           this.params = data;
           this.$notify.success({ title: msg });
@@ -276,6 +63,7 @@ export default {
       this.setVisible(false);
       this.params = initParams(Columns);
     },
+    beforeOpen() { },
   },
   created() { },
   mounted() { },
@@ -318,6 +106,9 @@ export default {
                   :value="item.value">
                 </el-option>
               </el-select>
+              <el-checkbox v-else-if="column.type === 'Checkbox'" v-model="params[column.key]" true-label="Y"
+                false-label="N"></el-checkbox>
+
               <el-date-picker v-else-if="column.type === 'DatePicker'" v-model="params[column.key]"
                 :type="column.config.type" :placeholder="column.placeholder" :clearable="column.clearable"
                 :disabled="column.disabled" :readonly="column.readonly" :picker-options="column.pickerOptions"
@@ -370,9 +161,11 @@ export default {
                       <el-icon class="el-icon-thumb"></el-icon>
                     </template>
                   </el-input>
+                  <el-checkbox v-else-if="column.type === 'Checkbox'" v-model="params[column.key]" true-label="Y"
+                    false-label="N"></el-checkbox>
                 </template>
               </el-table-column>
-              <el-table-column fixed="right" label="操作" width="120">
+              <!-- <el-table-column fixed="right" label="操作" width="120">
                 <template slot-scope="scope">
                   <el-button @click.native.prevent="
                     delTableRow(params[tabName], scope.$index)
@@ -380,13 +173,13 @@ export default {
                     删行
                   </el-button>
                 </template>
-              </el-table-column>
+              </el-table-column> -->
             </el-table>
           </el-tab-pane>
         </el-tabs>
-        <el-row style="position: absolute; top: 20px; right: 20px">
+        <!-- <el-row style="position: absolute; top: 20px; right: 20px">
           <el-button size="mini" @click="addTableRow(params[tabName])">增行</el-button>
-        </el-row>
+        </el-row> -->
       </el-card>
     </el-form>
   </el-drawer>