Преглед на файлове

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!61
黄梓星 преди 2 години
родител
ревизия
40371546d7

+ 31 - 96
src/components/popover-select/index.vue

@@ -127,6 +127,7 @@ export default {
     },
     // fetch list
     async fetchList(prop, page) {
+      console.log(prop, 'prop------------');
       try {
         this.loading = true;
         const { pageNum, pageSize } = page;
@@ -198,7 +199,7 @@ export default {
     },
     // update
     update(prop) {
-      const { source, multiple, valueKey, dataMapping } = this.$props;
+      const { source, multiple, valueKey, dataMapping, type } = this.$props;
       // update v-model
       const vModel = multiple
         ? prop.map((item) => item[valueKey])
@@ -210,92 +211,42 @@ export default {
       }
       this.$emit("update:source", source);
       // emit change
-      this.$emit("change", prop, source);
+      this.$emit("change", prop, source, type,);
     },
   },
-  created() {},
-  mounted() {},
-  destroyed() {},
+  created() { },
+  mounted() { },
+  destroyed() { },
 };
 </script>
 <template>
   <div>
-    <el-input
-      v-model="innerValue"
-      :size="size"
-      :disabled="disabled"
-      :readonly="readonly"
-      :clearable="clearable"
-      :placeholder="placeholder"
-    >
-      <el-button
-        :disabled="disabled"
-        slot="append"
-        icon="el-icon-search"
-        @click="open"
-      ></el-button>
+    <el-input v-model="innerValue" :size="size" :disabled="disabled" :readonly="readonly" :clearable="clearable"
+      :placeholder="placeholder">
+      <el-button :disabled="disabled" slot="append" icon="el-icon-search" @click="open"></el-button>
     </el-input>
-    <el-dialog
-      :title="`${title}(${multiple ? '多选' : '单选'})`"
-      :width="width"
-      :visible.sync="visible"
-      :close-on-click-modal="false"
-      :close-on-press-escape="false"
-      append-to-body
-      @close="hide"
-    >
-      <el-form
-        v-loading="loading"
-        :size="size"
-        :inline="true"
-        :model="model"
-        @submit.native.prevent
-      >
+    <el-dialog :title="`${title}(${multiple ? '多选' : '单选'})`" :width="width" :visible.sync="visible"
+      :close-on-click-modal="false" :close-on-press-escape="false" append-to-body @close="hide">
+      <el-form v-loading="loading" :size="size" :inline="true" :model="model" @submit.native.prevent>
         <el-form-item prop="search">
-          <el-input
-            v-model="model.search"
-            @change="queryList"
-            @keydown.enter="queryList"
-          >
+          <el-input v-model="model.search" @change="queryList" @keydown.enter="queryList">
           </el-input>
         </el-form-item>
         <el-form-item>
           <el-button icon="el-icon-refresh" @click="resetList"></el-button>
         </el-form-item>
-        <el-table
-          ref="multipleTable"
-          :data="data"
-          :size="size"
-          height="45vh"
-          highlight-current-row
-          style="width: 100%; margin-bottom: 20px"
-          @row-click="rowClick"
-          @row-dblclick="rowDblclick"
-          @selection-change="selectionChange"
-        >
+        <el-table ref="multipleTable" :data="data" :size="size" height="45vh" highlight-current-row
+          style="width: 100%; margin-bottom: 20px" @row-click="rowClick" @row-dblclick="rowDblclick"
+          @selection-change="selectionChange">
           <el-table-column width="55" type="selection" align="center">
           </el-table-column>
-          <el-table-column
-            v-for="(column, index) in TableColumnTemp"
-            :key="index"
-            :prop="column.key"
-            :label="column.title"
-            :width="column.width"
-            show-overflow-tooltip
-          >
+          <el-table-column v-for="(column, index) in TableColumnTemp" :key="index" :prop="column.key"
+            :label="column.title" :width="column.width" show-overflow-tooltip>
           </el-table-column>
         </el-table>
-        <el-pagination
-          :layout="layout"
-          :total="page.total"
-          :page-sizes="pageSizes"
-          :small="size === 'mini'"
-          :page-size="page.pageSize"
-          :current-page="page.pageNum"
-          background
-          @size-change="pageSizeChange"
-          @current-change="pageNumberChange"
-        >
+        <el-pagination :layout="layout" :total="page.total" :page-sizes="pageSizes" :small="size === 'mini'"
+          :page-size="page.pageSize" :current-page="page.pageNum" background @size-change="pageSizeChange"
+          @current-change="pageNumberChange">
         </el-pagination>
       </el-form>
       <div style="margin-top: 20px; text-align: right">
@@ -303,42 +254,26 @@ export default {
         <el-button :size="size" @click="confirm(selectData)"> 确 定 </el-button>
       </div>
     </el-dialog>
-    <div
-      style="
+    <div style="
         position: absolute;
         left: 10px;
         top: 50%;
         transform: translateY(-50%);
         padding-right: 30px;
         overflow: hidden;
-      "
-    >
+      ">
       <div v-if="multiple && selectData.length">
-        <el-popover
-          :offset="-10"
-          :width="width"
-          :visible-arrow="false"
-          title=""
-          content=""
-          trigger="click"
-          placement="bottom-start"
-        >
+        <el-popover :offset="-10" :width="width" :visible-arrow="false" title="" content="" trigger="click"
+          placement="bottom-start">
           <el-tag slot="reference" :size="size" style="margin-right: 10px">
             + {{ selectData.length }}
           </el-tag>
-          <el-tag
-            v-for="(tag, index) in selectData"
-            :size="size"
-            hit
-            closable
-            :style="{
-              display: 'flex',
-              justifyContent: 'space-between',
-              alignItems: 'center',
-              margin: selectData.length - 1 === index ? '0' : '0 0 5px 0',
-            }"
-            @close="deleteTag(index)"
-          >
+          <el-tag v-for="(tag, index) in selectData" :size="size" hit closable :style="{
+            display: 'flex',
+            justifyContent: 'space-between',
+            alignItems: 'center',
+            margin: selectData.length - 1 === index ? '0' : '0 0 5px 0',
+          }" @close="deleteTag(index)">
             {{ tag.name }}
           </el-tag>
         </el-popover>

+ 21 - 17
src/views/purchase/PurchaseDemandList/add.vue

@@ -597,22 +597,26 @@ export default {
       }
     },
     async save() {
-      if(this.sonPageStu == 'add') {
-        await this.handleData()
-        await addDemand(this.basicForm).then(res => {
-          console.log(333)
-          if (res.code === 200) {
-            this.$modal.msgSuccess("保存成功");
-            this.back()
-          }
-        })
-      } else if (this.sonPageStu == 'edit') {
-        editDemand(this.basicForm).then(res => {
-          if (res.code === 200) {
-            this.$modal.msgSuccess("编辑成功");
-            this.back()
-          }
-        })
+      if(this.basicForm.puDemandItemList.length !== 0) {
+        if(this.sonPageStu == 'add') {
+          await this.handleData()
+          await addDemand(this.basicForm).then(res => {
+            console.log(333)
+            if (res.code === 200) {
+              this.$modal.msgSuccess("保存成功");
+              this.back()
+            }
+          })
+        } else if (this.sonPageStu == 'edit') {
+          editDemand(this.basicForm).then(res => {
+            if (res.code === 200) {
+              this.$modal.msgSuccess("编辑成功");
+              this.back()
+            }
+          })
+        }
+      } else {
+        this.$modal.msgWarning("明细信息不能为空!");
       }
     },
     submit() {
@@ -725,7 +729,7 @@ export default {
         updateBy: null,
         updateByName: null,
         updateTime: null,
-        delFlag: null,
+        delFlag: 0,
         // 新增字段
         model: null,
         storageCondition: null,

+ 151 - 152
src/views/purchase/purchase-order/add/column.js

@@ -1,109 +1,111 @@
 export const Columns = [
   {
-    key: "puOrg",
+    key: "puOrgName",
     title: "采购组织",
     inputType: "PopoverSelect",
     valueKey: "id",
-    showKey:'name',
     referName: "ORG_PARAM",
     dataMapping: {
-      // puOrg: "id",
+      puOrg: "id",
       puOrgName: "name",
     },
     queryParams: () => ({}),
     require: true,
   },
   {
-    key: "billTypeName",
+    key: "billType",
     title: "订单类型",
     inputType: "Select",
     referName: "sys_order_type", // 字典名
   },
-  // { key: "billTypeName", title: "订单类型名称", },
-  { key: "oaDemandNo", title: "OA需求单号", type: "Input", },
-  { key: "code", title: "订单编号", type: "Input", },
+  { key: "oaDemandNo", title: "OA需求单号", inputType: "Input", },
+  { key: "code", title: "订单编号", inputType: "Input", },
   {
     key: "billDate",
     title: "订单日期",
     inputType: "DatePicker",
-    type: "date",
     valueFormat: "yyyy-MM-dd",
     width: 200,
   },
   {
-    key: "supplier",
+    key: "supplierName",
     title: "供应商",
     inputType: "PopoverSelect",
     valueKey: "id",
     referName: "SUPPLIER_PARAM",
     dataMapping: {
-      // supplier: "id",
+      supplier: "id",
       supplierName: "name",
     },
     queryParams: () => ({}),
     require: true,
   },
   {
-    key: "paymentAgreement",
+    key: "paymentAgreementName",
     title: "付款协议",
     inputType: "PopoverSelect",
     valueKey: "id",
     referName: "PAYAGREEMENT_PARAM",
     dataMapping: {
+      paymentAgreement: 'id',
       paymentAgreementName: 'name'
     },
     queryParams: () => ({}),
 
   },
   {
-    key: "finalType",
+    key: "finalTypeName",
     title: "结算方式",
     inputType: "PopoverSelect",
     valueKey: "id",
     referName: "BALATYPE_PARAM",
     dataMapping: {
+      finalType: 'id',
       finalTypeName: 'name'
     },
     queryParams: () => ({}),
   },
   {
-    key: "currency",
+    key: "currencyName",
     title: "币种",
     inputType: "PopoverSelect",
     valueKey: "id",
     referName: "CURRENCY_PARAM",
     dataMapping: {
+      currency: 'id',
       currencyName: 'name'
     },
     queryParams: () => ({}),
 
   },
   {
-    key: "buyer",
+    key: "buyerName",
     title: "采购员",
     inputType: "PopoverSelect",
     valueKey: "id",
     referName: "CONTACTS_PARAM",
     dataMapping: {
+      buyer: 'id',
       buyerName: 'name'
     },
     queryParams: () => ({}),
     require: true,
   },
   {
-    key: "puDept",
+    key: "puDeptName",
     title: "采购部门",
     inputType: "PopoverSelect",
     valueKey: "id",
     referName: "DEPT_PARAM",
     dataMapping: {
+      puDept: 'id',
       puDeptName: 'name'
     },
     queryParams: () => ({}),
     require: true,
   },
   {
-    key: "customer",
+    key: "customerName",
     title: "收货客户",
     inputType: "PopoverSelect",
     width: 200,
@@ -111,6 +113,7 @@ export const Columns = [
     valueKey: "id",
     referName: "CUSTOMER_PARAM",
     dataMapping: {
+      customer: 'id',
       customerName: 'name'
     },
     queryParams: () => ({}),
@@ -118,197 +121,192 @@ export const Columns = [
   {
     key: "qty",
     title: "总数量",
-    type: "InputNumber",
+    inputType: "InputNumber",
     config: { controlsPosition: "right" },
   },
   {
     key: "originalQty",
     title: "原始总数量",
-    type: "InputNumber",
+    inputType: "InputNumber",
     config: { controlsPosition: "right" },
   },
-  { key: "money", title: "价税合计", type: "Input", },
-  { key: "originalMoney", title: "原始总金额", type: "Input", },
-  { key: "notaxMoney", title: "无税金额", type: "Input", },
+  { key: "money", title: "价税合计", inputType: "Input", },
+  { key: "originalMoney", title: "原始总金额", inputType: "Input", },
+  { key: "notaxMoney", title: "无税金额", inputType: "Input", },
   {
     key: "status",
     title: "单据状态",
     inputType: "Select",
     referName: "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: "freezeCause", title: "冻结原因", inputType: "Checkbox", },
+  { key: "isBack", title: "退货", inputType: "Input", inputType: "Checkbox", },
+  { key: "isMarketing", title: "已协同生成销售订单", inputType: "Checkbox", },
+  { key: "isMarketingSource", title: "由销售订单协同生成", inputType: "Checkbox", },
   {
-    key: "warehouse",
+    key: "warehouseName",
     title: "WMS入库仓库", // 收货仓库
     inputType: "PopoverSelect",
     require: true,
     valueKey: "id",
     referName: "WAREHOUSE_PARAM",
     dataMapping: {
+      warehouse: 'id',
       warehouseName: 'name'
     },
     queryParams: () => ({}),
   },
   {
-    key: "goodsAllocation",
+    key: "goodsAllocationName",
     title: "货位",
     inputType: "PopoverSelect",
     require: true,
     valueKey: "id",
     referName: "ALLOCATION_PARAM",
     dataMapping: {
+      goodsAllocation: 'id',
       goodsAllocationName: 'name'
     },
-    queryParams: () => ({
-      pkOrg: 'puOrg',
+    queryParams: (params) => ({
+      pkOrg: params.puOrg,
     }),
-
-    // config: {
-    //   componentName: "ALLOCATION_PARAM",
-    //   dataMapping: {
-    //     goodsAllocation: "code",
-    //     goodsAllocationName: "name",
-    //   },
-    //   queryParams: {
-    //     pkOrg: 'puOrg',
-    //   }
-    // },
     width: 200,
   },
-  { key: "isSendSrm", title: "是否同步SRM", type: "Checkbox", },
-  { key: "isInvoice", title: "发票标识", type: "Checkbox", },
-  { key: "supplierOrderNo", title: "供应商订单号", type: "Input", },
-  { key: "rebateMoney", title: "订单使用返利金额", type: "Input", },
-  { key: "deductionMoney", title: "订单抵扣余款金额", type: "Input", },
-  { key: "address", title: "收货地址", type: "Input", },
-  { key: "contacts", title: "收货联系人", type: "Input", },
+  { key: "isSendSrm", title: "是否同步SRM", inputType: "Checkbox", },
+  { key: "isInvoice", title: "发票标识", inputType: "Checkbox", },
+  { key: "supplierOrderNo", title: "供应商订单号", inputType: "Input", },
+  { key: "rebateMoney", title: "订单使用返利金额", inputType: "Input", },
+  { key: "deductionMoney", title: "订单抵扣余款金额", inputType: "Input", },
+  { key: "address", title: "收货地址", inputType: "Input", },
+  { key: "contacts", title: "收货联系人", inputType: "Input", },
   {
-    key: "customerDept",
+    key: "customerDeptName",
     title: "客户部门",
     inputType: "PopoverSelect",
     width: 200,
     valueKey: "id",
     referName: "CUSTOMERDEPT_PARAM",
     dataMapping: {
+      customerDept: 'id',
       customerDeptName: 'name'
     },
     queryParams: () => ({}),
 
   },
   {
-    key: "supplierContacts",
+    key: "supplierContactsName",
     title: "供应商业务联系人",
     inputType: "PopoverSelect",
     require: true,
     valueKey: "id",
     referName: "SUPPLIERCONTACTS_PARAM",
     dataMapping: {
+      supplierContacts: 'id',
       supplierContactsName: 'name'
     },
     queryParams: () => ({}),
     width: 200,
   },
-  { key: "isUrgency", title: "紧急程度", type: "Checkbox", },
-  { key: "isSendWms", title: "已同步WMS", type: "Checkbox", },
-  // { key: "agent", title: "代理人", type: "Input", }, // 建议删除
+  { key: "isUrgency", title: "紧急程度", inputType: "Checkbox", },
+  { key: "isSendWms", title: "已同步WMS", inputType: "Checkbox", },
+  // { key: "agent", title: "代理人", inputType: "Input", }, // 建议删除
   // { key: "agentName", title: "代理人名称", },
-  { key: "isClose", title: "最终关闭", type: "Checkbox", },
+  { key: "isClose", title: "最终关闭", inputType: "Checkbox", },
   {
     key: "closeTime",
     title: "最终关闭日期",
     inputType: "DatePicker",
-    type: "date",
     valueFormat: "yyyy-MM-dd",
   },
-  { key: "applyPaymentMoney", title: "累计付款申请金额", type: "Input", },
-  { key: "paymentMoney", title: "累计付款金额", type: "Input", },
-  { key: "invoiceMoney", title: "发票金额", type: "Input", },
+  { key: "applyPaymentMoney", title: "累计付款申请金额", inputType: "Input", },
+  { key: "paymentMoney", title: "累计付款金额", inputType: "Input", },
+  { key: "invoiceMoney", title: "发票金额", inputType: "Input", },
   {
-    key: "supplierPersonal",
+    key: "supplierPersonalName",
     title: "供应商业务员",
     inputType: "PopoverSelect",
     valueKey: "id",
     referName: "SUPPLIERCONTACTS_PARAM",
     dataMapping: {
+      supplierPersonal: 'id',
       supplierPersonalName: 'name'
     },
     queryParams: () => ({}),
     require: true,
   },
-  { key: "isDeliver", title: "是否发货", type: "Checkbox", },
+  { key: "isDeliver", title: "是否发货", inputType: "Checkbox", },
   {
-    key: "retReason",
+    key: "retReasonName",
     title: "退换原因",
     inputType: "PopoverSelect",
     require: true,
     valueKey: "id",
     referName: "RETREASON_PARAM",
     dataMapping: {
+      retReason: 'id',
       retReasonName: 'name'
     },
     queryParams: () => ({}),
   },
   {
-    key: "processType",
+    key: "processTypeName",
     title: "处理方式",
     inputType: "PopoverSelect",
     require: true,
     valueKey: "id",
     referName: "PROCESSTYPE_PARAM",
     dataMapping: {
+      processType: 'id',
       processTypeName: 'name'
     },
     queryParams: () => ({}),
   },
-  { key: "isEnd", title: "整单关闭标识", type: "Input", },
+  { key: "isEnd", title: "整单关闭标识", inputType: "Input", },
   {
-    key: "projectNow",
+    key: "projectNowName",
     title: "在建工程项目",
     inputType: "PopoverSelect",
     require: true,
     valueKey: "id",
     referName: "PROJECT_PARAM",
     dataMapping: {
+      projectNow: 'id',
       projectNowName: 'name'
     },
     queryParams: () => ({}),
   },
   {
-    key: "operatingItems",
+    key: "operatingItemsName",
     title: "经营性项目",
     inputType: "PopoverSelect",
     require: true,
     valueKey: "id",
     referName: "OPERATING_PARAM",
     dataMapping: {
+      operatingItems: 'id',
       operatingItemsName: 'name'
     },
     queryParams: () => ({}),
 
   },
-  { key: "isArrivalReson", title: "到货超期原因", type: "Input", },
-  { key: "midOrderNo", title: "中台采购订单号", type: "Input", },
-  { key: "marketingCode", title: "销售订单号", type: "Input", },
-  { key: "isArrival", title: "到货超期", type: "Checkbox", },
-  { key: "createByName", title: "创建人名称", type: "Input", },
-  { key: "updateByName", title: "更新人名称", type: "Input", },
-  { key: "flowId", title: "OA流程ID", type: "Input", },
-  { key: "approver", title: "审批人", type: "Input", },
+  { key: "isArrivalReson", title: "到货超期原因", inputType: "Input", },
+  { key: "midOrderNo", title: "中台采购订单号", inputType: "Input", },
+  { key: "marketingCode", title: "销售订单号", inputType: "Input", },
+  { key: "isArrival", title: "到货超期", inputType: "Checkbox", },
+  { key: "createByName", title: "创建人名称", inputType: "Input", },
+  { key: "updateByName", title: "更新人名称", inputType: "Input", },
+  { key: "flowId", title: "OA流程ID", inputType: "Input", },
+  { key: "approver", title: "审批人", inputType: "Input", },
   {
     key: "approverFinishTime",
     title: "审批时间",
     inputType: "DatePicker",
-    type: "date",
     valueFormat: "yyyy-MM-dd",
   },
   {
     key: "approveTime",
     title: "提交时间",
     inputType: "DatePicker",
-    type: "date",
     valueFormat: "yyyy-MM-dd",
   },
 
@@ -321,9 +319,9 @@ export const TabColumns = [
     title: '物料信息',
     key: 'puOrderItemList',
     tableColumns: [
-      { key: "rowNo", title: "行号", type: "Input", },
-      { key: "orderId", title: "采购订单ID", type: "Input", width: 180 },
-      // {key: "material",title: "物料",type: "Input",   },
+      { key: "rowNo", title: "行号", inputType: "Input", },
+      { key: "orderId", title: "采购订单ID", inputType: "Input", width: 180 },
+      // {key: "material",title: "物料",inputType: "Input",   },
       {
         key: "materialName",
         title: "物料",
@@ -331,60 +329,61 @@ export const TabColumns = [
         width: 180,
         valueKey: "id",
         referName: "MATERIAL_PARAM",
-        queryParams: () => ({}),
         dataMapping: {
           material: "id",
           materialName: "name",
           materialCode: "code",
         },
+        queryParams: () => ({}),
       },
       {
         key: "materialCode",
         title: "物料编码",
-        type: "Input",
+        inputType: "Input",
         width: 180,
       },
-      { key: "materialClassify", title: "物料分类", type: "Input", width: 180 },
-      { key: "materialManufacturersCode", title: "厂家物料编码", type: "Input", width: 180 },
-      { key: "specification", title: "规格", type: "Input", width: 180 },
-      { key: "model", title: "型号", type: "Input", },
-      { key: "isMedcine", title: "医药物料", type: "Input", width: 180 },
-      { key: "manufacturer", title: "生产厂家代理人", type: "Input", width: 180 },
-      { key: "isDrug", title: "物料药品属性", type: "Input", width: 180 },
-      { key: "unit", title: "单位", type: "Input", },
-      { key: "qty", title: "数量", type: "Input", },
-      { key: "taxPrice", title: "含税单价", type: "Input", },
-      { key: "money", title: "价税合计", type: "Input", },
-      { key: "tax", title: "税率", type: "Input", },
-      { key: "taxDeductMoneya", title: "折扣金额", type: "Input", },
-      { key: "arrivalQty", title: "已到货数量", type: "Input", },
-      { key: "unarrivedQty", title: "未到货数量", type: "Input", },
-      { key: "notaxMoney", title: "无税金额", type: "Input", },
-      { key: "priceSource", title: "价格目录ID", type: "Input", },
-      { key: "isStorage", title: "入库关闭", type: "Input", },
-      { key: "isInvoice", title: "开票关闭", type: "Input", },
-      { key: "isArrival", title: "到货关闭", type: "Input", },
-      { key: "isPayment", title: "付款关闭", type: "Input", },
-      { key: "isGift", title: "赠品", type: "Input", width: 180 },
+      { key: "materialClassify", title: "物料分类", inputType: "Input", width: 180 },
+      { key: "materialManufacturersCode", title: "厂家物料编码", inputType: "Input", width: 180 },
+      { key: "specification", title: "规格", inputType: "Input", width: 180 },
+      { key: "model", title: "型号", inputType: "Input", },
+      { key: "isMedcine", title: "医药物料", inputType: "Input", width: 180 },
+      { key: "manufacturer", title: "生产厂家代理人", inputType: "Input", width: 180 },
+      { key: "isDrug", title: "物料药品属性", inputType: "Input", width: 180 },
+      { key: "unit", title: "单位", inputType: "Input", },
+      { key: "qty", title: "数量", inputType: "Input", },
+      { key: "taxPrice", title: "含税单价", inputType: "Input", },
+      { key: "money", title: "价税合计", inputType: "Input", },
+      { key: "tax", title: "税率", inputType: "Input", },
+      { key: "taxDeductMoneya", title: "折扣金额", inputType: "Input", },
+      { key: "arrivalQty", title: "已到货数量", inputType: "Input", },
+      { key: "unarrivedQty", title: "未到货数量", inputType: "Input", },
+      { key: "notaxMoney", title: "无税金额", inputType: "Input", },
+      { key: "priceSource", title: "价格目录ID", inputType: "Input", },
+      { key: "isStorage", title: "入库关闭", inputType: "Input", },
+      { key: "isInvoice", title: "开票关闭", inputType: "Input", },
+      { key: "isArrival", title: "到货关闭", inputType: "Input", },
+      { key: "isPayment", title: "付款关闭", inputType: "Input", },
+      { key: "isGift", title: "赠品", inputType: "Input", width: 180 },
       {
-        key: "warehouse",
+        key: "warehouseName",
         title: "收货仓库", //WMS入库仓库
         inputType: "PopoverSelect",
         valueKey: "id",
         referName: "WAREHOUSE_PARAM",
         dataMapping: {
+          warehouse: 'id',
           warehouseName: 'name'
         },
         queryParams: () => ({}),
         width: 200,
       },
-      { key: "place", title: "收货地点", type: "Input", width: 180 },
-      { key: "address", title: "收货地址", type: "Input", width: 180 },
-      { key: "productBatch", title: "产品批号", type: "Input", width: 180 },
-      { key: "manufactureDate", title: "生产日期", type: "Input", width: 180 },
-      { key: "efficacyLoseDate", title: "有效期至/失效日期", type: "Input", width: 180 },
-      { key: "approvalNumber", title: "批准文号", type: "Input", width: 180 },
-      { key: "registration", title: "注册证号", type: "Input", width: 180 },
+      { key: "place", title: "收货地点", inputType: "Input", width: 180 },
+      { key: "address", title: "收货地址", inputType: "Input", width: 180 },
+      { key: "productBatch", title: "产品批号", inputType: "Input", width: 180 },
+      { key: "manufactureDate", title: "生产日期", inputType: "Input", width: 180 },
+      { key: "efficacyLoseDate", title: "有效期至/失效日期", inputType: "Input", width: 180 },
+      { key: "approvalNumber", title: "批准文号", inputType: "Input", width: 180 },
+      { key: "registration", title: "注册证号", inputType: "Input", width: 180 },
 
       {
         key: "storageCondition",
@@ -398,71 +397,71 @@ export const TabColumns = [
         title: "运输条件",
         inputType: "Select",
         referName: "sys_conditions_carriage", // 字典名
-
         width: 180
       },
 
-      { key: "isBatchLock", title: "批号锁定标识", type: "Input", },
-      { key: "isReplenishment", title: "补单标识", type: "Input", },
-      { key: "isUrgency", title: "紧急标识", type: "Input", },
-      { key: "originalQty", title: "原始数量", type: "Input", },
-      { key: "originalMoney", title: "原始金额", type: "Input", },
-      { key: "directProductBatch", title: "直运产品批号", type: "Input", width: 180 },
-      { key: "discountRule", title: "折扣规则编码", type: "Input", width: 180 },
-      { key: "reservedQty", title: "预留数量", type: "Input", },
-      { key: "reservedPeriod", title: "预留周期", type: "Input", },
-      { key: "taxDeductClassify", title: "扣税类别", type: "Input", },
-      { key: "exchangeRate", title: "折本汇率", type: "Input", },
-      { key: "source", title: "上游单据号", type: "Input", width: 180 },
-      { key: "sourceId", title: "上游单据ID", type: "Input", width: 180 },
-      { key: "demandCode", title: "采购需求单号", type: "Input", width: 180 },
-      { key: "arrivalDatePlan", title: "计划到货日期", type: "Input", width: 180 },
+      { key: "isBatchLock", title: "批号锁定标识", inputType: "Input", },
+      { key: "isReplenishment", title: "补单标识", inputType: "Input", },
+      { key: "isUrgency", title: "紧急标识", inputType: "Input", },
+      { key: "originalQty", title: "原始数量", inputType: "Input", },
+      { key: "originalMoney", title: "原始金额", inputType: "Input", },
+      { key: "directProductBatch", title: "直运产品批号", inputType: "Input", width: 180 },
+      { key: "discountRule", title: "折扣规则编码", inputType: "Input", width: 180 },
+      { key: "reservedQty", title: "预留数量", inputType: "Input", },
+      { key: "reservedPeriod", title: "预留周期", inputType: "Input", },
+      { key: "taxDeductClassify", title: "扣税类别", inputType: "Input", },
+      { key: "exchangeRate", title: "折本汇率", inputType: "Input", },
+      { key: "source", title: "上游单据号", inputType: "Input", width: 180 },
+      { key: "sourceId", title: "上游单据ID", inputType: "Input", width: 180 },
+      { key: "demandCode", title: "采购需求单号", inputType: "Input", width: 180 },
+      { key: "arrivalDatePlan", title: "计划到货日期", inputType: "Input", width: 180 },
       {
         key: "priceType",
         title: "价格类型",
         inputType: "Select",
         referName: "sys_price_type", // 字典名
+        width: 180,
       },
-      { key: "isDistributionPrice", title: "配送价", type: "Input", },
-      { key: "createByName", title: "创建人名称", type: "Input", },
-      { key: "updateByName", title: "更新人名称", type: "Input", },
-      { key: "materialClassifyOneName", title: "物料一级分类名称", type: "Input", width: 180 },
-      { key: "materialClassifyTwoName", title: "物料二级分类名称", type: "Input", width: 180 },
-      { key: "materialClassifyThreeName", title: "物料三级分类名称", type: "Input", width: 180 },
-      { key: "materialClassifyFourName", title: "物料四级分类名称", type: "Input", width: 180 },
-      { key: "price", title: "无税单价", type: "Input", }
+      { key: "isDistributionPrice", title: "配送价", inputType: "Input", },
+      { key: "createByName", title: "创建人名称", inputType: "Input", },
+      { key: "updateByName", title: "更新人名称", inputType: "Input", },
+      { key: "materialClassifyOneName", title: "物料一级分类名称", inputType: "Input", width: 180 },
+      { key: "materialClassifyTwoName", title: "物料二级分类名称", inputType: "Input", width: 180 },
+      { key: "materialClassifyThreeName", title: "物料三级分类名称", inputType: "Input", width: 180 },
+      { key: "materialClassifyFourName", title: "物料四级分类名称", inputType: "Input", width: 180 },
+      { key: "price", title: "无税单价", inputType: "Input", }
     ]
   },
   {
     title: '执行结果',
     key: 'puOrderExecuteList',
     tableColumns: [
-      { key: "orderId", title: "采购订单ID", type: "Input", width: 180 },
-      { key: "rowno", title: "行号", type: "Input", },
+      { key: "orderId", title: "采购订单ID", inputType: "Input", width: 180 },
+      { key: "rowno", title: "行号", inputType: "Input", },
       {
         key: "materialName",
         title: "物料",
         inputType: "PopoverSelect",
-        config: {
-          componentName: "MATERIAL_PARAM",
-          dataMapping: {
-            material: "id",
-            materialName: "name",
-            materialCode: "code",
-          },
+        valueKey: "id",
+        referName: "MATERIAL_PARAM",
+        dataMapping: {
+          material: "id",
+          materialName: "name",
+          materialCode: "code",
         },
+        queryParams: () => ({}),
         width: 180
       },
-      { key: "specification", title: "规格", type: "Input", },
-      { key: "qty", title: "数量", type: "Input", },
-      { key: "stroageQty", title: "累计到货主数量", type: "Input", width: 120 },
-      { key: "stockQty", title: "累计入库主数量", type: "Input", width: 120 },
-      { key: "invoiceQty", title: "累计开票主数量", type: "Input", width: 120 },
-      { key: "rollbackQty", title: "累计退货主数量", type: "Input", width: 120 },
-      { key: "backStockQty", title: "累计退库主数量", type: "Input", width: 120 },
-      { key: "floatQty", title: "未到货数量", type: "Input", width: 120 },
-      { key: "createByName", title: "创建人名称", type: "Input", width: 120 },
-      { key: "updateByName", title: "更新人名称", type: "Input", width: 120 },
+      { key: "specification", title: "规格", inputType: "Input", },
+      { key: "qty", title: "数量", inputType: "Input", },
+      { key: "stroageQty", title: "累计到货主数量", inputType: "Input", width: 120 },
+      { key: "stockQty", title: "累计入库主数量", inputType: "Input", width: 120 },
+      { key: "invoiceQty", title: "累计开票主数量", inputType: "Input", width: 120 },
+      { key: "rollbackQty", title: "累计退货主数量", inputType: "Input", width: 120 },
+      { key: "backStockQty", title: "累计退库主数量", inputType: "Input", width: 120 },
+      { key: "floatQty", title: "未到货数量", inputType: "Input", width: 120 },
+      { key: "createByName", title: "创建人名称", inputType: "Input", width: 120 },
+      { key: "updateByName", title: "更新人名称", inputType: "Input", width: 120 },
     ]
   },
 ];

+ 79 - 45
src/views/purchase/purchase-order/add/index.vue

@@ -43,6 +43,7 @@ export default {
   watch: {
     "params.puOrderItemList": {
       handler(nVal, oVal) {
+        console.log(nVal, 'nVal', oVal, 'oVal');
         this.handleSynchronousMaterial("puOrderItemList", "puOrderExecuteList");
       },
       deep: true,
@@ -53,20 +54,27 @@ export default {
       },
       deep: true,
     },
-    "params.puOrgName": {
+    "params": {
       handler(nVal, oVal) {
-        console.log(nVal, 'nVal', oVal, 'oVal');
-        for (const key in this.params) {
-          if (Array.isArray(this.params[key])) {
-            this.params[key] = [];
-          }
-          else if (key != 'puOrg' && key != 'puOrgName'
-            && key != 'buyer' && key != 'buyerName'
-            && key != 'puDept' && key != 'puDeptName') {
-            this.params[key] = '';
+
+
+        // 组织变化
+        if (nVal.puOrg != oVal.puOrg) {
+          console.log(nVal.puOrg, 'nVal.puOrg', oVal.puOrg, 'oVal.puOrg');
+          for (const key in this.params) {
+            if (Array.isArray(this.params[key])) {
+              this.params[key] = [];
+            }
+            else if (key != 'puOrg' && key != 'puOrgName'
+              && key != 'buyer' && key != 'buyerName'
+              && key != 'puDept' && key != 'puDeptName'
+              && key != 'status') {
+              this.params[key] = '';
+            }
+            else { }
           }
-          else { }
         }
+
       },
       deep: true,
     }
@@ -80,6 +88,7 @@ export default {
       this.params.buyerName = nickName;
       this.params.puDept = deptId;
       this.params.puDeptName = deptName;
+      this.params.status = '0';
 
     },
     setVisible(prop) {
@@ -102,7 +111,6 @@ export default {
 
           // 是否完成询价,新增明细行需默认明细为false
           rowData['whetherCompleteInquiry'] = false;
-          console.log(rowData, 'rowData*******************');
 
           this.params[key].push(rowData);
         }
@@ -124,11 +132,25 @@ export default {
     },
     // 同步子表物料
     handleSynchronousMaterial(key1, key2) {
+      let _this = this;
       // this.params[key1]-- -> this.params[key2]
       this.params[key1] && this.params[key1].forEach((item, index) => {
-        this.params[key2][index].material = item.material;
-        this.params[key2][index].materialName = item.materialName;
-        this.params[key2][index].materialCode = item.materialCode;
+
+        for (const key in item) {
+
+          if (key in _this.params[key2][index]) {
+
+            if (key == 'material' || key == 'materialName' || key == 'materialCode') {
+              _this.params[key2][index].material = item.material;
+              _this.params[key2][index].materialName = item.materialName;
+              _this.params[key2][index].materialCode = item.materialCode;
+            } else {
+
+              _this.params[key2][index][key] = item[key];
+            }
+          }
+        }
+
       });
     },
     // 取消
@@ -194,24 +216,34 @@ export default {
       //   }
       // });
     },
-    handleReferChange(val, source) {
+    // 子表参照改变之后
+    handleReferChange(val, source, type) {
       console.log(val, 'val');
       console.log(source, 'source');
-      let parmas = {
-        ...this.params
+      console.log(type, 'type');
+
+      // 触发物料参照
+      if (type == 'MATERIAL_PARAM' && source.qty && source.qty != '') {
+
+        this.handleGetPrice();
+      }
+    },
+
+    // 子表input
+    handleInputChange(row, type) {
+      console.log(type, 'type');
+      // 物料数量变化----询价
+      if (type == 'qty' && row.material) {
+        this.handleGetPrice();
       }
-      console.log(parmas, 'parmas---------------');
-      this.handleGetPrice(parmas);
     },
     // 询价 getPrice
-    async handleGetPrice(data) {
+    async handleGetPrice() {
       try {
         // let { puOrg, priceType, customer, assignSupplier, material, } = data;
-        await orderApi.getPrice(data).then(res => {
-          console.log(res, 'res------------------');
-        })
+        let { code, data } = await orderApi.getPrice({ ...this.params })
         if (code == 200) {
-
+          this.params = data;
         }
       } catch (error) {
 
@@ -255,21 +287,21 @@ export default {
           <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"
+              <el-input v-if="column.inputType === 'Input'" v-model="params[column.key]" :placeholder="column.placeholder"
                 :clearable="column.clearable" :disabled="column.disabled" style="width: 100%">
               </el-input>
               <dr-popover-select v-if="column.inputType === 'PopoverSelect'" v-model="params[column.key]"
-                :value-key="column.valueKey" :show-key="column.showKey" :source.sync="params" :title="column.title"
-                :type="column.referName" :multiple="column.multiple" :placeholder="column.placeholder"
-                :data-mapping="column.dataMapping" :query-params="column.queryParams(params)">
+                :value-key="column.valueKey" :source.sync="params" :title="column.title" :type="column.referName"
+                :multiple="column.multiple" :placeholder="column.placeholder" :data-mapping="column.dataMapping"
+                :query-params="column.queryParams(params)">
               </dr-popover-select>
 
-              <el-input v-if="column.type === 'Textarea'" v-model="params[column.key]" type="textarea"
+              <el-input v-if="column.inputType === '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]"
+              <el-input-number v-if="column.inputType === '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>
@@ -279,8 +311,8 @@ export default {
                   :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"
+              <el-select v-if="column.inputType === '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>
@@ -292,10 +324,11 @@ export default {
                 :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
                 :picker-options="column.pickerOptions" style="width: 100%">
               </el-date-picker>
-              <el-checkbox v-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>
+              <el-checkbox v-if="column.inputType === 'Checkbox'" v-model="params[column.key]" true-label="Y"
+                false-label="N">
+              </el-checkbox>
+              <el-upload v-if="column.inputType === '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>
@@ -324,24 +357,25 @@ export default {
                   <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]"
+                  <el-input v-if="cColumn.inputType === 'Input'" v-model="scope.row[cColumn.key]"
                     :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
-                    size="mini" style="width: 100%"></el-input>
+                    size="mini" style="width: 100%" @change="handleInputChange(scope.row, cColumn.key)">
+                  </el-input>
 
                   <!--  -->
                   <dr-popover-select v-if="cColumn.inputType === 'PopoverSelect'" v-model="scope.row[cColumn.key]"
                     :source.sync="scope.row" :title="cColumn.title" :value-key="cColumn.valueKey"
-                    :show-key="cColumn.showKey" :type="cColumn.referName" :multiple="cColumn.multiple"
-                    :placeholder="cColumn.placeholder" :data-mapping="cColumn.dataMapping"
-                    :query-params="cColumn.queryParams(scope.row)" @change="handleReferChange">
+                    :type="cColumn.referName" :multiple="cColumn.multiple" :placeholder="cColumn.placeholder"
+                    :data-mapping="cColumn.dataMapping" :query-params="cColumn.queryParams(scope.row)"
+                    @change="handleReferChange" size="mini">
                   </dr-popover-select>
 
-                  <el-input-number v-if="cColumn.type === 'InputNumber'" v-model="scope.row[cColumn.key]"
+                  <el-input-number v-if="cColumn.inputType === '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-select v-if="cColumn.inputType === 'Select'" v-model="scope.row[cColumn.key]"
+                  <el-select v-if="cColumn.inputType === 'Select'" v-model="scope.row[cColumn.key]" size="mini"
                     :disabled="cColumn.disabled" :clearable="cColumn.clearable" :placeholder="cColumn.placeholder"
                     style="width: 100%">
                     <el-option v-for="item in dict.type[cColumn.referName]" :key="item.value" :label="item.label"
@@ -350,7 +384,7 @@ export default {
                   </el-select>
 
 
-                  <el-checkbox v-if="cColumn.type === 'Checkbox'" v-model="scope.row[cColumn.key]" true-label="Y"
+                  <el-checkbox v-if="cColumn.inputType === 'Checkbox'" v-model="scope.row[cColumn.key]" true-label="Y"
                     false-label="N">
                   </el-checkbox>
 

+ 30 - 5
src/views/purchase/purchase-order/column.js

@@ -2,7 +2,12 @@ export const TableColumns = [
   // { key: "id", title: "主键" },
   // { key: "puOrg", title: "采购组织" },
   { key: "puOrgName", title: "采购组织名称", search: true, type: "Input" },
-  { key: "billTypeName", title: "订单类型" },
+  {
+    key: "billType",
+    title: "订单类型",
+    inputType: "Select",
+    referName: "sys_order_type",
+  },
   { key: "code", title: "订单编号", search: true, type: "Input" },
   { key: "billDate", title: "订单日期" },
   // { key: "supplier", title: "供应商" },
@@ -60,7 +65,12 @@ export const TableColumns = [
   { key: "createTime", title: "制单日期/创建时间" },
   { key: "remark", title: "备注" },
   { key: "updateTime", title: "最后修改时间" },
-  { key: "status", title: "单据状态" },
+  {
+    key: "status",
+    title: "单据状态",
+    inputType: "Select",
+    referName: "sys_status", // 字典名
+  },
   { key: "oaDemandNo", title: "OA需求单号" },
   { key: "address", title: "收货地址" },
   { key: "contacts", title: "收获联系人" },
@@ -115,8 +125,18 @@ export const TabColumns = [
       { key: "efficacyLoseDate", title: "有效期至/失效日期", width: 180 },
       { key: "approvalNumber", title: "批准文号", width: 180 },
       { key: "registration", title: "注册证号", width: 180 },
-      { key: "storageCondition", title: "存储条件" },
-      { key: "carriageCondition", title: "运输条件" },
+      {
+        key: "storageCondition",
+        title: "存储条件",
+        inputType: "Select",
+        referName: "sys_storage_condition", // 字典名
+      },
+      {
+        key: "carriageCondition",
+        title: "运输条件",
+        inputType: "Select",
+        referName: "sys_conditions_carriage", // 字典名
+      },
       { key: "isBatchLock", title: "批号锁定标识" },
       { key: "isReplenishment", title: "补单标识" },
       { key: "isUrgency", title: "紧急标识" },
@@ -132,7 +152,12 @@ export const TabColumns = [
       { key: "sourceId", title: "上游单据ID", width: 180 },
       { key: "demandCode", title: "采购需求单号", width: 180 },
       { key: "arrivalDatePlan", title: "计划到货日期", width: 180 },
-      { key: "priceType", title: "价格类型" },
+      {
+        key: "priceType",
+        title: "价格类型",
+        inputType: "Select",
+        referName: "sys_price_type", // 字典名
+      },
       { key: "isDistributionPrice", title: "配送价" },
       // { key: "tenantId", title: "租户号" },
       // { key: "revision", title: "乐观锁" },

+ 23 - 19
src/views/purchase/purchase-order/edit/index.vue

@@ -204,19 +204,19 @@ export default {
         <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"
+              <el-input v-if="column.inputType === 'Input'" v-model="params[column.key]" :placeholder="column.placeholder"
                 :clearable="column.clearable" :disabled="column.disabled" style="width: 100%">
               </el-input>
-              <dr-popover-select v-if="column.inputType === 'PopoverSelect'" v-model="params[column.key]"
-                :value-key="column.valueKey" :show-key="column.showKey" :source.sync="params" :title="column.title"
-                :type="column.referName" :multiple="column.multiple" :placeholder="column.placeholder"
-                :data-mapping="column.dataMapping" :query-params="column.queryParams(params)">
+              <dr-popover-select v-if="column.inputType === 'PopoverSelect'" v-model="params[column.key]" size="mini"
+                :value-key="column.valueKey" :source.sync="params" :title="column.title" :type="column.referName"
+                :multiple="column.multiple" :placeholder="column.placeholder" :data-mapping="column.dataMapping"
+                :query-params="column.queryParams(params)">
               </dr-popover-select>
-              <el-input v-if="column.type === 'Textarea'" v-model="params[column.key]" type="textarea"
+              <el-input v-if="column.inputType === '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]"
+              <el-input-number v-if="column.inputType === '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>
@@ -226,7 +226,7 @@ export default {
                   :value="item.value">
                 </el-option>
               </el-select>
-              <el-select v-if="column.type === 'TagSelect'" v-model="params[column.key]" multiple clearable collapse-tags
+              <el-select v-if="column.inputType === 'TagSelect'" v-model="params[column.key]" multiple clearable collapse-tags
                 :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
                 style="width: 100%">
                 <template #prefix>
@@ -239,10 +239,10 @@ export default {
                 :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
                 :picker-options="column.pickerOptions" style="width: 100%">
               </el-date-picker>
-              <el-checkbox v-if="column.type === 'Checkbox'" v-model="params[column.key]" :disabled="column.disabled"
+              <el-checkbox v-if="column.inputType === 'Checkbox'" v-model="params[column.key]" :disabled="column.disabled"
                 true-label="Y" false-label="N">
               </el-checkbox>
-              <el-upload v-if="column.type === 'Upload'" :file-list="params[column.key]" :disabled="column.disabled" drag
+              <el-upload v-if="column.inputType === '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">
@@ -273,20 +273,24 @@ export default {
               <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]"
+
+                  <span v-if="!cColumn.inputType">
+                    {{ scope.row[cColumn.key] }}
+                  </span>
+
+                  <el-input v-if="cColumn.inputType === 'Input'" v-model="scope.row[cColumn.key]"
                     :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
                     :size="size" style="width: 100%">
                   </el-input>
+
                   <dr-popover-select v-if="cColumn.inputType === 'PopoverSelect'" v-model="scope.row[cColumn.key]"
                     :source.sync="scope.row" :title="cColumn.title" :value-key="cColumn.valueKey"
-                    :show-key="cColumn.showKey" :type="cColumn.referName" :multiple="cColumn.multiple"
-                    :placeholder="cColumn.placeholder" :data-mapping="cColumn.dataMapping"
-                    :query-params="cColumn.queryParams(scope.row)" @change="handleReferChange">
+                    :type="cColumn.referName" :multiple="cColumn.multiple" :placeholder="cColumn.placeholder"
+                    :data-mapping="cColumn.dataMapping" :query-params="cColumn.queryParams(scope.row)" size="mini"
+                    @change="handleReferChange">
                   </dr-popover-select>
 
-                  <el-select v-if="cColumn.inputType === 'Select'" v-model="scope.row[cColumn.key]"
+                  <el-select v-if="cColumn.inputType === 'Select'" v-model="scope.row[cColumn.key]" size="mini"
                     :disabled="cColumn.disabled" :clearable="cColumn.clearable" :placeholder="cColumn.placeholder"
                     style="width: 100%">
                     <el-option v-for="item in dict.type[cColumn.referName]" :key="item.value" :label="item.label"
@@ -294,10 +298,10 @@ export default {
                     </el-option>
                   </el-select>
 
-                  <el-checkbox v-if="cColumn.type === 'Checkbox'" v-model="scope.row[cColumn.key]" true-label="Y"
+                  <el-checkbox v-if="cColumn.inputType === 'Checkbox'" v-model="scope.row[cColumn.key]" true-label="Y"
                     false-label="N">
                   </el-checkbox>
-                  <el-input-number v-if="cColumn.type === 'InputNumber'" v-model="scope.row[cColumn.key]"
+                  <el-input-number v-if="cColumn.inputType === '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>

+ 36 - 140
src/views/purchase/purchase-order/index.vue

@@ -2,116 +2,36 @@
 <script>
 import { TableColumns, SearchColumns, TabColumns } from "./column";
 import orderApi from "@/api/business/purchase/purchase-order";
-import { initPage, initLayout, initPageSizes, initParams } from "@/utils/init";
+import {
+  initPage,
+  initLayout,
+  initPageSizes,
+  initParams,
+  initColumns,
+  initDicts,
+} from "@/utils/init";
+
+const NewColumns = initColumns(TableColumns);
+const NewTabColumns = TabColumns.map((element) => ({
+  ...element,
+  tableColumns: initColumns(element.tableColumns),
+}));
+// 
+const SelectColumns = NewColumns.filter(column => column.inputType === 'Select')
+NewTabColumns.forEach(column => {
+  SelectColumns.push(...column.tableColumns.filter(cColumn => cColumn.inputType === 'Select'))
+});
+console.log(SelectColumns, 'SelectColumns------------');
+
 export default {
   name: "PuchaseOrder",
+  dicts: initDicts(SelectColumns),
   components: {
     AddDrawer: () => import('./add/index.vue'),
     SeeDrawer: () => import('./see/index.vue'),
     EditDrawer: () => import('./edit/index.vue'),
   },
   data() {
-
-    // const tabColumns = [
-    //   {
-    //     title: '物料信息',
-    //     key: 'first',
-    //     tableColumns: [
-    //       { 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 {
       loading: false,
@@ -141,14 +61,6 @@ export default {
         : this.searchColumns;
     },
   },
-  //   watch: {
-  //     $route: {
-  //       handler: function (route) {
-  //         this.redirect = route.query && route.query.redirect;
-  //       },
-  //       immediate: true,
-  //     },
-  //   },
   created() {
     this.fetchList(this.params, this.page);
     console.log("Vue", this);
@@ -301,29 +213,6 @@ export default {
       this.checkedList = selection;
       console.log(this.checkedList, 'this.checkedList');
     },
-    // 判断状态
-    judgeStatus(status) {
-      // 单据状态0=自由态,1=审批中,2=已审核,3=已驳回
-      let statusName = '';
-      switch (status) {
-        case '0':
-          statusName = '自由态';
-          break;
-        case '1':
-          statusName = '审批中';
-          break;
-        case '2':
-          statusName = '已审核';
-          break;
-        case '3':
-          statusName = '已驳回';
-          break;
-        default:
-          break;
-      }
-
-      return statusName;
-    },
 
   },
 };
@@ -388,14 +277,13 @@ export default {
       highlight-current-row style="width: 100%; margin: 20px 0 0 0" @select="handleSelect" height="450">
       <el-table-column type="selection" width="45"></el-table-column>
       <el-table-column type="index" width="50" label="序号"></el-table-column>
-      <el-table-column v-for="(column, index) in tableColumns" :key="index" :label="column.title"
+      <el-table-column v-for="(column, index) in tableColumns" :key="index" :prop="column.key" :label="column.title"
         :width="column.width || 180" :show-overflow-tooltip="column.showOverflowTooltip || true">
-
         <template slot-scope="scope">
-          {{ column.key == 'status' ? judgeStatus(scope.row[column.key]) : scope.row[column.key] }}
+          <dict-tag v-if="column.referName" size="small" :value="scope.row[column.key]"
+            :options="dict.type[column.referName]" />
+          <span v-else>{{ scope.row[column.key] }}</span>
         </template>
-
-
       </el-table-column>
       <el-table-column fixed="right" label="操作" width="120">
         <template slot-scope="scope">
@@ -421,9 +309,17 @@ export default {
       <el-tab-pane v-for="(column, index) in tabColumns" :key="index" :label="column.title" :name="column.key">
         <el-table :data="tabTableDatas[column.key]" style="width: 100%" highlight-current-row
           :height="tabTableDatas[column.key].length ? 300 : 100">
+
           <el-table-column type="index" width="50" label="序号"></el-table-column>
-          <el-table-column v-for="(cColumn, cIndex) in column.tableColumns" :key="cIndex" :prop="cColumn.key"
-            :label="cColumn.title" :width="cColumn.width || 100" show-overflow-tooltip>
+
+          <el-table-column v-for="(cColumn, cIndex)  in column.tableColumns" :key="cIndex" :prop="cColumn.key"
+            :label="cColumn.title" :width="cColumn.width || 180"
+            :show-overflow-tooltip="cColumn.showOverflowTooltip || true">
+            <template slot-scope="scope">
+              <dict-tag v-if="cColumn.referName" size="small" :value="scope.row[cColumn.key]"
+                :options="dict.type[cColumn.referName]" />
+              <span v-else>{{ scope.row[cColumn.key] }}</span>
+            </template>
           </el-table-column>
         </el-table>
       </el-tab-pane>

+ 72 - 57
src/views/purchase/purchase-order/see/index.vue

@@ -9,19 +9,21 @@ import {
 import { Columns, TabColumns } from "../add/column";
 import orderApi from "@/api/business/purchase/purchase-order";
 
-const NewColumns = initColumns(Columns, { disabled: true, readonly: true });
+const NewColumns = initColumns(Columns);
 const NewTabColumns = TabColumns.map((element) => ({
   ...element,
-  tableColumns: initColumns(element.tableColumns, {
-    disabled: true,
-    readonly: true,
-  }),
+  tableColumns: initColumns(element.tableColumns),
 }));
+// 
+const SelectColumns = NewColumns.filter(column => column.inputType === 'Select')
+NewTabColumns.forEach(column => {
+  SelectColumns.push(...column.tableColumns.filter(cColumn => cColumn.inputType === 'Select'))
+});
 
 
 export default {
   name: "SeePurchaseOrderDrawer",
-  dicts: initDicts(NewColumns),
+  dicts: initDicts(SelectColumns),
   data() {
     return {
       visible: false,
@@ -95,31 +97,48 @@ export default {
         <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 === 'Textarea'" v-model="params[column.key]" type="textarea"
-                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
-                :readonly="column.readonly" style="width: 100%"></el-input>
-              <el-input-number v-else-if="column.type === 'InputNumber'" v-model="params[column.key]"
+
+              <el-input v-if="column.inputType === 'Input'" v-model="params[column.key]" :placeholder="column.placeholder"
+                :clearable="column.clearable" readonly style="width: 100%">
+              </el-input>
+              <dr-popover-select v-if="column.inputType === 'PopoverSelect'" v-model="params[column.key]" disabled
+                :value-key="column.valueKey" :source.sync="params" :title="column.title" :type="column.referName"
+                :multiple="column.multiple" :placeholder="column.placeholder" :data-mapping="column.dataMapping"
+                :query-params="column.queryParams(params)">
+              </dr-popover-select>
+
+              <el-input v-if="column.inputType === 'Textarea'" v-model="params[column.key]" type="textarea"
+                :placeholder="column.placeholder" :clearable="column.clearable" readonly style="width: 100%">
+              </el-input>
+
+              <el-input-number v-if="column.inputType === 'InputNumber'" v-model="params[column.key]"
                 :controls-position="column.config.controlsPosition" :placeholder="column.placeholder"
-                :clearable="column.clearable" :disabled="column.disabled" :readonly="column.readonly"
-                style="width: 100%"></el-input-number>
-              <el-select v-else-if="column.type === 'Select'" v-model="params[column.key]"
-                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
-                :readonly="column.readonly" style="width: 100%">
-                <el-option v-for="item in dict.type[column.config.optionsName]" :key="item.value" :label="item.label"
+                :clearable="column.clearable" disabled style="width: 100%">
+              </el-input-number>
+              <el-select v-if="column.inputType === 'Select'" v-model="params[column.key]" disabled size="mini"
+                :clearable="column.clearable" :placeholder="column.placeholder" style="width: 100%">
+                <el-option v-for="item in dict.type[column.referName]" :key="item.value" :label="item.label"
                   :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" :disabled="column.disabled" :readonly="column.readonly">
-              </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"
+              <el-select v-if="column.inputType === 'TagSelect'" v-model="params[column.key]" multiple clearable
+                collapse-tags :placeholder="column.placeholder" :clearable="column.clearable" 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.inputType === 'DatePicker'" v-model="params[column.key]" :type="column.type"
+                :placeholder="column.placeholder" :clearable="column.clearable" readonly
+                :picker-options="column.pickerOptions" style="width: 100%">
               </el-date-picker>
-              <el-upload v-else-if="column.type === 'Upload'" :file-list="params[column.key]" :disabled="column.disabled"
-                :readonly="column.readonly" drag action="https://jsonplaceholder.typicode.com/posts/" multiple>
+              <el-checkbox v-if="column.inputType === 'Checkbox'" v-model="params[column.key]" disabled true-label="Y"
+                false-label="N">
+              </el-checkbox>
+              <el-upload v-if="column.inputType === 'Upload'" :file-list="params[column.key]" disabled drag
+                action="https://jsonplaceholder.typicode.com/posts/" multiple>
                 <i class="el-icon-upload"></i>
                 <div class="el-upload__text">
                   将文件拖到此处,或<em>点击上传</em>
@@ -128,9 +147,6 @@ export default {
                   只能上传jpg/png文件,且不超过500kb
                 </div>
               </el-upload>
-              <el-input v-else v-model="params[column.key]" :placeholder="column.placeholder"
-                :clearable="column.clearable" :disabled="column.disabled" :readonly="column.readonly"
-                style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
@@ -145,46 +161,45 @@ export default {
           <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">
+                :label="cColumn.title" :width="cColumn.width || 80">
                 <template slot-scope="scope">
                   <el-tag v-if="cColumn.key === 'index'">
                     {{ scope.$index + 1 }}
                   </el-tag>
-                  <el-input v-if="cColumn.type === 'Input'" v-model="scope.row[cColumn.key]"
-                    :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
-                    :readonly="cColumn.readonly" size="mini" style="width: 100%"></el-input>
-                  <el-input-number v-if="cColumn.type === 'InputNumber'" v-model="scope.row[cColumn.key]"
+                  <el-input v-if="cColumn.inputType === 'Input'" v-model="scope.row[cColumn.key]"
+                    :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" readonly size="mini"
+                    style="width: 100%"></el-input>
+
+                  <!--  -->
+                  <dr-popover-select v-if="cColumn.inputType === 'PopoverSelect'" v-model="scope.row[cColumn.key]"
+                    :source.sync="scope.row" :title="cColumn.title" :value-key="cColumn.valueKey" disabled
+                    :type="cColumn.referName" :multiple="cColumn.multiple" :placeholder="cColumn.placeholder"
+                    :data-mapping="cColumn.dataMapping" :query-params="cColumn.queryParams(scope.row)" size="mini">
+                  </dr-popover-select>
+
+                  <el-input-number v-if="cColumn.inputType === 'InputNumber'" v-model="scope.row[cColumn.key]"
                     :controls-position="cColumn.config.controlsPosition" :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable" :disabled="cColumn.disabled" :readonly="cColumn.readonly" 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="cColumn.disabled"
-                    :readonly="cColumn.readonly" style="width: 100%; cursor: pointer"
-                    @click.native.stop="openAsyncInputDialog(column, params)">
-                    <template #suffix>
-                      <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"
-                    :disabled="cColumn.disabled" false-label="N"></el-checkbox>
+                    :clearable="cColumn.clearable" disabled size="mini" style="width: 100%">
+                  </el-input-number>
+
+                  <el-select v-if="cColumn.inputType === 'Select'" v-model="scope.row[cColumn.key]" disabled size="mini"
+                    :clearable="cColumn.clearable" :placeholder="cColumn.placeholder" style="width: 100%">
+                    <el-option v-for="item in dict.type[cColumn.referName]" :key="item.value" :label="item.label"
+                      :value="item.value">
+                    </el-option>
+                  </el-select>
+
+                  <el-checkbox v-if="cColumn.inputType === 'Checkbox'" v-model="scope.row[cColumn.key]" disabled
+                    true-label="Y" false-label="N">
+                  </el-checkbox>
+
                 </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="mini" @click="addTableRow(params[tabName])">增行</el-button>
-        </el-row> -->
       </el-card>
+
     </el-form>
   </el-drawer>
 </template>