浏览代码

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!90
黄梓星 2 年之前
父节点
当前提交
761a540ffc

+ 1 - 1
src/api/business/purchase/contract.js

@@ -79,7 +79,7 @@ export function TABLELIST(params, name) {
 
 export function TABLEADD(data, name) {
   return request({
-    url: `${switchUrl(name)}/add`,
+    url: `${switchUrl(name)}`,
     method: "POST",
     data: data,
   });

+ 0 - 7
src/components/computed-input/index.vue

@@ -1,11 +1,4 @@
 <template>
-  <!-- <el-input
-    v-model="value"
-    readonly
-    :size="size"
-    :placeholder="placeholder"
-    style="width: 100%"
-  ></el-input> -->
   <span>{{ value || "- -" }}</span>
 </template>
 

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

@@ -29,4 +29,12 @@ export default [
     type: "Input",
     search: true,
   },
+  {
+    key: "registrationNo",
+    title: "注册证号",
+    type: "ComputedInput",
+    computed: (prop) => {
+      return prop.materialMedcine.registrationNo;
+    },
+  },
 ];

+ 53 - 36
src/components/popover-select/index.vue

@@ -1,5 +1,6 @@
 <script>
 import { REFER } from "./api/index";
+import deepCopy from "@gby/deep-copy";
 export default {
   name: "PopoverSelect",
   props: {
@@ -92,6 +93,7 @@ export default {
       },
       data: [],
       selectData: [],
+      lastSelectData: [],
     };
   },
   computed: {
@@ -108,23 +110,25 @@ export default {
   watch: {
     "$props.value": {
       handler: function (newProp) {
-        if (!newProp) this.selectData = [];
+        if (!newProp) this.lastSelectData = [];
       },
       immediate: true,
     },
   },
   methods: {
+    //
+    emitChange(prop) {
+      const { type, source, multiple } = this.$props;
+      this.$emit("change", multiple ? prop : prop[0], source, type);
+    },
     // open dialog
     async open() {
       this.visible = true;
       await this.useReset();
-      console.log("open", this.selectData);
     },
     // hide dialog
     async hide() {
       this.visible = false;
-      // this.$emit("input", []);
-      console.log("hide", this.selectData);
     },
     // fetch list
     async fetchList(prop, page) {
@@ -141,11 +145,12 @@ export default {
         }
       } catch (err) {
         //
+        console.error(err);
       } finally {
         this.loading = false;
       }
     },
-    // reset list
+    // reset
     async useReset() {
       const { type, source, queryParams } = this.$props;
       this.model = {
@@ -156,53 +161,64 @@ export default {
       };
       await this.fetchList(this.model, this.page);
     },
-    // query list
+    // query
     async useQuery() {
       await this.fetchList(this.model, this.page);
     },
+    // cancel
+    useCancel(prop) {
+      const { multiple } = this.$props;
+      this.useUpdate(multiple ? prop : prop[0]);
+      this.hide();
+    },
     // confirm
-    async useConfirm(prop) {
+    useConfirm(prop) {
       const { multiple } = this.$props;
-      await this.hide();
-      await this.useUpdate(multiple ? prop : prop[0]);
+      this.useUpdate(multiple ? prop : prop[0]);
+      this.emitChange(this.selectData);
+      this.lastSelectData = deepCopy(this.selectData);
+      this.hide();
     },
-    // delete tag
+    // delete
     useDelete(prop) {
       this.selectData.splice(prop, 1);
       this.useUpdate(this.selectData);
+      this.emitChange(this.selectData);
+      this.lastSelectData = deepCopy(this.selectData);
     },
     // update
     useUpdate(prop) {
-      const { source, multiple, valueKey, dataMapping, type } = this.$props;
-      // update v-model
-      const vModel = multiple
-        ? prop.map((item) => item[valueKey])
-        : prop[valueKey];
-      this.$emit("input", vModel);
+      const { source, multiple, valueKey, dataMapping } = this.$props;
       // update data mapping
-      for (let key in dataMapping) {
-        source[key] = prop[dataMapping[key]];
+      if (multiple) {
+        const vModel = prop.map((item) => item[valueKey]);
+        this.$emit("input", vModel);
+      } else {
+        const vModel = prop[valueKey];
+        this.$emit("input", vModel);
+        for (let key in dataMapping) {
+          source[key] = prop[dataMapping[key]];
+        }
+        this.$emit("update:source", source);
       }
-      this.$emit("update:source", source);
-      // emit change
-      this.$emit("change", prop, type, source);
     },
     // row click
-    rowClick(prop) {
+    onceClick(prop) {
       const { multiple } = this.$props;
       // 单选
       if (!multiple) this.$refs.multipleTable.clearSelection();
       [prop].forEach((row) => this.$refs.multipleTable.toggleRowSelection(row));
     },
     // row double click
-    // async rowDblclick(prop) {
-    //   const { multiple } = this.$props;
-    //   if (!multiple) await this.useConfirm([prop]);
-    // },
+    doubleClick(prop) {
+      const { multiple } = this.$props;
+      if (!multiple) this.useConfirm([prop]);
+    },
     // selection change
     selectionChange(prop) {
-      this.selectData = prop;
-      console.log("selectionChange", prop);
+      if (prop && prop.length) {
+        this.selectData = prop;
+      }
     },
   },
   created() {},
@@ -234,7 +250,6 @@ export default {
       :close-on-click-modal="false"
       :close-on-press-escape="false"
       append-to-body
-      @close="hide"
     >
       <el-form
         v-loading="loading"
@@ -261,8 +276,8 @@ export default {
           height="45vh"
           highlight-current-row
           style="width: 100%; margin-bottom: 20px"
-          @row-click="rowClick"
-          @row-dblclick="useConfirm([$event])"
+          @row-click="onceClick"
+          @row-dblclick="doubleClick"
           @selection-change="selectionChange"
         >
           <el-table-column
@@ -301,7 +316,9 @@ export default {
         />
       </el-form>
       <div style="margin-top: 20px; text-align: right">
-        <el-button :size="size" @click="hide"> 取 消 </el-button>
+        <el-button :size="size" @click="useCancel(lastSelectData)">
+          取 消
+        </el-button>
         <el-button :size="size" @click="useConfirm(selectData)">
           确 定
         </el-button>
@@ -317,7 +334,7 @@ export default {
         overflow: hidden;
       "
     >
-      <div v-if="multiple && selectData.length">
+      <div v-if="multiple && lastSelectData.length">
         <el-popover
           :offset="-10"
           :width="width"
@@ -328,10 +345,10 @@ export default {
           placement="bottom-start"
         >
           <el-tag slot="reference" :size="size" style="margin-right: 10px">
-            + {{ selectData.length }}
+            + {{ lastSelectData.length }}
           </el-tag>
           <el-tag
-            v-for="(tag, index) in selectData"
+            v-for="(tag, index) in lastSelectData"
             :size="size"
             hit
             closable
@@ -339,7 +356,7 @@ export default {
               display: 'flex',
               justifyContent: 'space-between',
               alignItems: 'center',
-              margin: selectData.length - 1 === index ? '0' : '0 0 5px 0',
+              margin: lastSelectData.length - 1 === index ? '0' : '0 0 5px 0',
             }"
             @close="useDelete(index)"
           >

+ 40 - 23
src/components/popover-tree-select/index.vue

@@ -1,5 +1,6 @@
 <script>
 import { REFER } from "./api/index";
+import deepCopy from "@gby/deep-copy";
 export default {
   name: "PopoverTreeSelect",
   props: {
@@ -75,6 +76,7 @@ export default {
       },
       data: [],
       selectData: [],
+      lastSelectData: [],
       defaultProps: {
         label: "name",
         children: "children",
@@ -95,12 +97,17 @@ export default {
   watch: {
     "$props.value": {
       handler: function (newProp) {
-        if (!newProp) this.selectData = [];
+        if (!newProp) this.lastSelectData = [];
       },
       immediate: true,
     },
   },
   methods: {
+    //
+    emitChange(prop) {
+      const { type, source, multiple } = this.$props;
+      this.$emit("change", multiple ? prop : prop[0], source, type);
+    },
     // open dialog
     async open() {
       this.visible = true;
@@ -114,7 +121,7 @@ export default {
     async fetchList(prop) {
       try {
         this.loading = true;
-        const { code, rows, total } = await REFER(prop);
+        const { code, rows } = await REFER(prop);
         if (code === 200) {
           this.data = rows;
         }
@@ -141,43 +148,53 @@ export default {
     async useQuery() {
       await this.fetchList(this.model);
     },
+    // cancel
+    useCancel(prop) {
+      const { multiple } = this.$props;
+      this.useUpdate(multiple ? prop : prop[0]);
+      this.hide();
+    },
     // confirm
-    async useConfirm(prop) {
+    useConfirm(prop) {
       const { multiple } = this.$props;
-      await this.hide();
-      await this.useUpdate(multiple ? prop : prop[0]);
+      this.useUpdate(multiple ? prop : prop[0]);
+      this.emitChange(this.selectData);
+      this.lastSelectData = deepCopy(this.selectData);
+      this.hide();
     },
     // delete tag
     useDelete(prop) {
       this.selectData.splice(prop, 1);
       this.useUpdate(this.selectData);
+      this.emitChange(this.selectData);
+      this.lastSelectData = deepCopy(this.selectData);
     },
     // update
     useUpdate(prop) {
       const { source, multiple, valueKey, dataMapping, type } = this.$props;
-      // update v-model
-      const vModel = multiple
-        ? prop.map((item) => item[valueKey])
-        : prop[valueKey];
-      this.$emit("input", vModel);
       // update data mapping
-      for (let key in dataMapping) {
-        source[key] = prop[dataMapping[key]];
+      if (multiple) {
+        const vModel = prop.map((item) => item[valueKey]);
+        this.$emit("input", vModel);
+      } else {
+        const vModel = prop[valueKey];
+        this.$emit("input", vModel);
+        for (let key in dataMapping) {
+          source[key] = prop[dataMapping[key]];
+        }
+        this.$emit("update:source", source);
       }
-      this.$emit("update:source", source);
-      // emit change
-      this.$emit("change", prop, type, source);
     },
     // click select row data
-    handleSelect(data) {
-      this.selectData = [data];
+    onceSelect(prop) {
+      if (prop) this.selectData = [prop];
     },
     // double click select row data and confirm
-    handleDoubleClickSelect(row) {
-      this.useConfirm([row]);
+    doubleSelect(prop) {
+      this.useConfirm([prop]);
     },
     // multiple select row data
-    handleMultipleSelect(prop, data) {
+    selectionChange(prop, data) {
       if (prop) {
         this.selectData.push(data);
       } else {
@@ -249,7 +266,7 @@ export default {
           <el-checkbox
             v-model="data.checked"
             @click.native.stop
-            @change="handleMultipleSelect($event, data)"
+            @change="selectionChange($event, data)"
             style="margin: 0 5px 0 0"
           >
           </el-checkbox>
@@ -267,8 +284,8 @@ export default {
           <div slot-scope="{ node, data }">
             <el-radio
               :label="data.code"
-              @click.native.stop="handleSelect(data)"
-              @dblclick.native.stop="handleDoubleClickSelect(data)"
+              @click.native.stop="onceSelect(data)"
+              @dblclick.native.stop="doubleSelect(data)"
               style="margin: 0 5px 0 0"
             >
               {{ data.name }}

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

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

+ 14 - 2
src/views/purchase/DemandSummary/index.vue

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

+ 12 - 1
src/views/purchase/PurchaseDemandList/add.vue

@@ -42,7 +42,7 @@
 
          <el-col :span="1.5">
             <el-form-item label="需求客户" prop="customer" :rules="{ required: true, message: '请选择需求客户', trigger: 'blur' }">
-              <el-select clearable size="small" v-model="basicForm.customer" :disabled="sonDisable" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
+              <el-select clearable size="small" v-model="basicForm.customer" :disabled="sonDisable" @clear="cleanCustomer" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
                 <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -1018,6 +1018,17 @@ export default {
         this.basicForm.puDemandItemList[index].additionalSupplier = null
       }
     },
+    // 清除需求客户将明细行内也清空
+    cleanCustomer() {
+      this.basicForm.customer = ''
+      this.basicForm.customerName = ''
+      if (this.basicForm.puDemandItemList.length !== 0) {
+        this.basicForm.puDemandItemList.forEach(item => {
+          item.demandCustomerName = ''
+          item.demandCustomer = ''
+        })
+      }
+    },
   }
 }
 </script>

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

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

+ 46 - 7
src/views/purchase/contract/add/index.vue

@@ -1,7 +1,12 @@
 <script>
 import { Columns, TabColumns } from "../column";
 import { REFER } from "@/components/popover-select/api";
-import { ADD, CODE } from "@/api/business/purchase/contract";
+import {
+  ADD,
+  CODE,
+  TABLEADD,
+  TABLEROMOVE,
+} from "@/api/business/purchase/contract";
 import { initDicts, initRules, initParams } from "@/utils/init";
 
 export default {
@@ -112,8 +117,37 @@ export default {
       this.params[prop].push(initParams(tab.tableColumns));
     },
     //
-    rowDelete(prop, index) {
-      prop.splice(index, 1);
+    async rowDelete(prop, { row: { id }, $index }) {
+      if (id) {
+        try {
+          this.loading = true;
+          const { code } = await TABLEROMOVE(id, prop);
+          if (code === 200) {
+            this.fetchTable(this.params.code, prop);
+          }
+        } catch (err) {
+          // catch
+        } finally {
+          // finally
+          this.loading = false;
+        }
+      } else {
+        this.params[prop].splice($index, 1);
+      }
+    },
+    //
+    async rowSubmit(prop, { row }) {
+      try {
+        this.loading = true;
+        const { code } = this.params;
+        await TABLEADD({ ...row, contractId: code }, prop);
+      } catch (err) {
+        // catch
+        console.error(err);
+      } finally {
+        // finally
+        this.loading = false;
+      }
     },
     //
     submit(prop) {
@@ -331,7 +365,7 @@ export default {
                   <span v-else> {{ scope.row[cColumn.key] }}</span>
                 </template>
               </el-table-column>
-              <el-table-column fixed="right" label="操作" width="75">
+              <el-table-column fixed="right" label="操作" width="100">
                 <template slot="header" slot-scope="scope">
                   <el-button
                     circle
@@ -344,11 +378,16 @@ export default {
                 <template slot-scope="scope">
                   <el-button
                     circle
+                    icon="el-icon-check"
+                    :size="size"
+                    @click.native.prevent="rowSubmit(tabName, scope)"
+                  >
+                  </el-button>
+                  <el-button
+                    circle
                     icon="el-icon-minus"
                     :size="size"
-                    @click.native.prevent="
-                      rowDelete(params[tabName], scope.$index)
-                    "
+                    @click.native.prevent="rowDelete(tabName, scope)"
                   >
                   </el-button>
                 </template>

+ 29 - 26
src/views/purchase/contract/edit/index.vue

@@ -53,22 +53,23 @@ export default {
           this.tabColumns = TabColumns;
         }
         this.tabName = this.tabColumns[0].key;
+        this.fetchTable(this.params.code, this.tabName);
       },
       immediate: true,
     },
-    "params.contractItemList": {
-      handler: function (newProp, oldProp) {
-        console.log(newProp, oldProp);
-        if (newProp.length === oldProp.length) {
-          const index = newProp.findIndex(
-            (item, index) =>
-              JSON.stringify(item) === JSON.stringify(oldProp[index])
-          );
-          console.log(index);
-        }
-      },
-      deep: true,
-    },
+    // "params.contractItemList": {
+    //   handler: function (newProp, oldProp) {
+    //     console.log(newProp, oldProp);
+    //     if (newProp.length === oldProp.length) {
+    //       const index = newProp.findIndex(
+    //         (item, index) =>
+    //           JSON.stringify(item) === JSON.stringify(oldProp[index])
+    //       );
+    //       console.log(index);
+    //     }
+    //   },
+    //   deep: true,
+    // },
   },
   methods: {
     //
@@ -89,8 +90,6 @@ export default {
         const { code, data } = await ITEM(prop);
         if (code === 200) {
           this.params = data;
-          this.tabName = this.tabColumns[0].key;
-          this.fetchTable(this.params.code, this.tabName);
         }
       } catch (err) {
         // catch
@@ -145,18 +144,22 @@ export default {
       this.params[prop].push(initParams(tab.tableColumns));
     },
     //
-    async rowDelete(prop, { row: { id } }) {
-      try {
-        this.loading = true;
-        const { code } = await TABLEROMOVE(id, prop);
-        if (code === 200) {
-          this.fetchTable(this.params.code, this.tabName);
+    async rowDelete(prop, { row: { id }, $index }) {
+      if (id) {
+        try {
+          this.loading = true;
+          const { code } = await TABLEROMOVE(id, prop);
+          if (code === 200) {
+            this.fetchTable(this.params.code, prop);
+          }
+        } catch (err) {
+          // catch
+        } finally {
+          // finally
+          this.loading = false;
         }
-      } catch (err) {
-        // catch
-      } finally {
-        // finally
-        this.loading = false;
+      } else {
+        this.params[prop].splice($index, 1);
       }
     },
     //

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

@@ -1,5 +1,6 @@
 export const TableColumns = [
   { key: "code", title: "订单生成单号", width: 250 },
+  { key: "demandCode", title: "需求单号", width: 250 },
   { key: "materialCode", title: "物料编码" },
   { key: "materialName", title: "物料名称" },
   // { key: "material", title: "物料" },
@@ -7,10 +8,10 @@ export const TableColumns = [
   { key: "manufacturerName", title: "生产厂家" },
   { key: "puQty", title: "采购数量" },
   {
-    key: "priceinputType",
+    key: "priceType",
     title: "价格类型",
     inputType: "Select",
-    referName: "sys_price_inputType",
+    referName: "sys_price_type",
   },
   { key: "puUnitName", title: "采购单位" },
   // { key: "id", title: "主键" },

+ 2 - 0
src/views/purchase/task/first-direct/column.js

@@ -12,6 +12,8 @@ export const TableColumns = [
   { key: "tax", title: "税率" },
   { key: "taxFreePrice", title: "无税单价" },
   { key: "taxPrice", title: "主含税单价" },
+  { key: "executeQty", title: "已执行数量" },
+  { key: "residueQty", title: "未执行数量" },
   {
     key: "purchaseQuantity",
     title: "本次采购数量",

+ 16 - 16
src/views/purchase/task/index.vue

@@ -36,11 +36,7 @@ export default {
     async fetchList(prop, page) {
       try {
         this.loading = true;
-        const { pageNum, pageSize } = page;
-        const { code, rows, total } = await LIST(
-          { ...prop },
-          { pageNum, pageSize }
-        );
+        const { code, rows, total } = await LIST(prop, page);
         if (code === 200) {
           this.tableData = rows;
           this.page.total = total;
@@ -56,6 +52,7 @@ export default {
     },
     // 查 询
     useQuery(prop, page) {
+      const { pageNum, pageSize } = page;
       const { date, documentsCodes } = prop;
       prop.endDate = date[1];
       prop.startDate = date[0];
@@ -63,13 +60,8 @@ export default {
         ? documentsCodes.split(",")
         : undefined;
       this.fetchList(
-        {
-          ...prop,
-          isAsc: "desc",
-          date: undefined,
-          orderByColumn: "createTime",
-        },
-        page
+        { ...prop, date: undefined },
+        { pageNum, pageSize, isAsc: "desc", orderByColumn: "createTime" }
       );
     },
     // 重 置
@@ -80,7 +72,16 @@ export default {
     },
     // 选 择
     useSelect(prop) {
-      this.selectData = prop;
+      if (prop && prop.length) {
+        // const lastIndex = prop.length - 1;
+        // const { status } = prop[lastIndex];
+        // if (status === "1") {
+        //   this.selectData.splice(lastIndex, 1);
+        // } else {
+        this.selectData = prop;
+        // }
+      }
+      console.log(this.selectData);
     },
     // 行 关
     async useClose(prop) {
@@ -206,7 +207,6 @@ export default {
               :readonly="column.readonly"
               :value-key="column.valueKey"
               :placeholder="column.placeholder"
-              :data-mapping="column.dataMapping"
               @change="useQuery(params, page)"
               @keyup.enter.native="useQuery(params, page)"
             >
@@ -218,11 +218,11 @@ export default {
               :title="column.title"
               :type="column.referName"
               :multiple="column.multiple"
-              :show-key="column.showKey"
               :value-key="column.valueKey"
               :placeholder="column.placeholder"
-              :data-mapping="column.dataMapping"
               :query-params="column.queryParams"
+              @change="useQuery(params, page)"
+              @keyup.enter.native="useQuery(params, page)"
             >
             </dr-popover-tree-select>
           </el-form-item>

+ 13 - 3
src/views/purchase/transferOrder/add.vue

@@ -621,6 +621,7 @@ export default {
       sonDisable: this.disable,
       basicForm: {
         deliveryInventoryOrg: '',
+        deliveryInventoryOrgCode: '',
         deliveryInventoryOrgName: '',
         billType: '',
         code: '',
@@ -644,6 +645,7 @@ export default {
         customer: '',
         customerName: '',
         deliveryWarehouse: '',
+        deliveryWarehouseCode: '',
         deliveryWarehouseName: '',
         storageWarehouse: '',
         storageWarehouseName: '',
@@ -808,6 +810,9 @@ export default {
         if (type == 'WAREHOUSE_PARAM' && title == '调出仓库') {
           this.chuHouseOptions = res.rows
         }
+        if (type == 'UNIT_PARAM') {
+          this.materialInfo[this.tableIndex].unitCode = res.rows[0].code
+        }
       })
     },
     addLine() {
@@ -823,6 +828,7 @@ export default {
         originPlaceName: null,
         model: null,
         unit: null,
+        unitCode: null,
         unitName: null,
         deliveryWarehouseName: null,
         qty: null,
@@ -875,6 +881,7 @@ export default {
       if (this.referCondition.title == '调出库存组织') {
         this.chuOrgOptions = selection
         this.basicForm.deliveryInventoryOrg = selection[0].id
+        this.basicForm.deliveryInventoryOrgCode = selection[0].code
         this.basicForm.deliveryInventoryOrgName = selection[0].name
       }
       if (this.referCondition.title == '调入库存组织') {
@@ -913,6 +920,7 @@ export default {
       if (this.referCondition.title == '调出仓库') {
         this.chuHouseOptions = selection
         this.basicForm.deliveryWarehouse = selection[0].id
+        this.basicForm.deliveryWarehouseCode = selection[0].code
         this.basicForm.deliveryWarehouseName = selection[0].name
       }
       if (this.referCondition.title == '调出货位') {
@@ -960,14 +968,16 @@ export default {
       this.materialInfo[this.tableIndex].manufacturer = selection[0].manufacturerIdName
       this.materialInfo[this.tableIndex].marketingApprovalPersonal = selection[0].registrant
       this.materialInfo[this.tableIndex].production = selection[0].productionPermit
+      // 根据物料单位id查询单位code
+      this.reBackRefer('UNIT_PARAM', selection[0].unitId)
     },
     // 明细行选择批次号
     chooseBatch(index) {
       this.tableIndex = index
-      this.referConditionMx.orgCode = this.basicForm.deliveryInventoryOrg
+      this.referConditionMx.orgCode = this.basicForm.deliveryInventoryOrgCode
       this.referConditionMx.materialCode = this.materialInfo[this.tableIndex].material
-      this.referConditionMx.unitCode = this.materialInfo[this.tableIndex].unit
-      this.referConditionMx.warehouseCode = this.basicForm.deliveryWarehouse
+      this.referConditionMx.unitCode = this.materialInfo[this.tableIndex].unitCode
+      this.referConditionMx.warehouseCode = this.basicForm.deliveryWarehouseCode
       this.$refs.batchRefer.init(this.referConditionMx)
     },
     selectBatch(selection) {