Ver código fonte

Merge remote-tracking branch 'origin/dev' into dev

shiy 1 ano atrás
pai
commit
f8e197a8a1

+ 19 - 0
src/api/business/purchase/purchase-order.js

@@ -118,6 +118,22 @@ const REFER = (data, params) => {
     params: params,
   });
 }
+// 获取入库数据
+const putInStorage = (data) =>{
+  return request({
+    url: "/pu/order/putInStorage",
+    method: "POST",
+    data: data,
+  });
+}
+// 获取入库数据
+const returnedGoods = (data) =>{
+  return request({
+    url: "/pu/order/returnedGoods",
+    method: "POST",
+    data: data,
+  });
+}
 
 export default {
   list,
@@ -133,5 +149,8 @@ export default {
   toNc,
   payRequest,
   REFER,
+  putInStorage,
+  returnedGoods,
+
 
 }

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

@@ -110,7 +110,7 @@
          </el-col>
 
          <el-col :span="1.5">
-            <el-form-item label="业务类型">
+            <el-form-item label="业务类型" prop="billType" :rules="{ required: true, message: '请选择业务类型', trigger: 'blur' }">
               <el-select clearable v-model="basicForm.billType" @change="changeBillType" :disabled="sonDisable" size="mini" style="width: 200px">
                 <el-option v-for=" dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
                 </el-option>

+ 5 - 2
src/views/purchase/apply/index.vue

@@ -144,9 +144,9 @@ export default {
     },
     // 明 细
     async useSee(prop) {
-      const { id, $index } = prop;
+      const { $index } = prop;
       const { open } = this.$refs.SeeModel;
-      await open(id, $index, this.page);
+      await open($index);
     },
     // 审 核
     async useSubmit(prop, done) {
@@ -239,6 +239,7 @@ export default {
       </el-button>
     </el-row>
     <el-table
+      v-if="tableData.length"
       :size="size"
       :data="tableData"
       highlight-current-row
@@ -287,7 +288,9 @@ export default {
         </template>
       </el-table-column>
     </el-table>
+    <el-empty v-else :image-size="200"></el-empty>
     <pagination
+      v-if="tableData.length"
       :total="page.total"
       :page.sync="page.pageNum"
       :limit.sync="page.pageSize"

+ 35 - 38
src/views/purchase/apply/see/index.vue

@@ -1,7 +1,7 @@
 <script>
 import Column from "../add/column";
 import useData from "../hooks/data";
-import { ITEM } from "@/api/business/purchase/apply";
+import { ITEM, LIST } from "@/api/business/purchase/apply";
 
 export default {
   name: "SeeDrawer",
@@ -9,31 +9,45 @@ export default {
     return {
       column: 3,
       title: "明 细",
-      lastPage: {},
       ...useData(Column),
     };
   },
+  props: {
+    // v-model
+    value: {
+      type: Boolean,
+      require: true,
+    },
+  },
   computed: {
-    root: function () {
-      return this.$parent.$parent;
+    $father: {
+      get() {
+        return this.$parent.$parent;
+      },
     },
     $dicts: {
-      get: function () {
-        return this.$parent.$parent.$dicts;
+      get() {
+        return this.$father.$dicts;
       },
     },
   },
   watch: {},
   methods: {
     //
-    async fetchItem(prop, index) {
+    async fetchItem(prop) {
       try {
         // try
         this.loading = true;
-        const { code, data } = await ITEM(prop);
+        const { params } = this.$father;
+        const {
+          code,
+          total,
+          rows: [data],
+        } = await LIST({ ...params }, { pageNum: prop, pageSize: 1 });
         if (code === 200) {
           this.params = data;
-          this.params.$index = index;
+          this.params.$index = prop;
+          this.params.$total = total;
           return true;
         } else {
           return false;
@@ -47,33 +61,16 @@ export default {
       }
     },
     //
-    async open(prop, index, page) {
-      this.lastPage = { ...page };
-      this.visible = await this.fetchItem(prop, index);
+    async open(prop) {
+      this.visible = await this.fetchItem(prop);
     },
     //
     async hide() {
       this.visible = false;
-      const { params, fetchList } = this.root;
-      fetchList(params, this.lastPage);
-    },
-    //
-    async useQueryLast(prop) {
-      const { params, fetchList } = this.root;
-      if (prop >= 1) {
-        const [row] = await fetchList(params, { pageSize: 1, pageNum: prop });
-        this.params = row;
-      }
-    },
-    //
-    async useQueryPrev(prop) {
-      const { params, fetchList } = this.root;
-      const [row] = await fetchList(params, { pageSize: 1, pageNum: prop });
-      this.params = row;
     },
     //
     async useDelete(prop) {
-      await this.root
+      await this.$father
         .useDelete(prop)
         .then(() => {
           this.hide();
@@ -82,10 +79,10 @@ export default {
     },
     //
     async useSubmit(prop) {
-      await this.root
+      await this.$father
         .useSubmit(prop)
         .then(() => {
-          this.fetchItem(this.params.id);
+          this.hide();
         })
         .catch(() => {});
     },
@@ -111,16 +108,16 @@ export default {
             :disabled="params.$index === 1"
             circle
             icon="el-icon-top"
-            @click="useQueryLast(params.$index - 1)"
+            @click="fetchItem(params.$index - 1)"
           ></el-button>
         </el-tooltip>
         <el-tooltip effect="dark" content="下一页" placement="bottom-end">
           <el-button
             :size="size"
-            :disabled="params.$index === root.page.total"
+            :disabled="params.$index === params.$total"
             circle
             icon="el-icon-bottom"
-            @click="useQueryPrev(params.$index + 1)"
+            @click="fetchItem(params.$index + 1)"
           ></el-button>
         </el-tooltip>
         <el-tooltip effect="dark" content="删 除" placement="bottom-end">
@@ -136,11 +133,11 @@ export default {
             :size="size"
             circle
             icon="el-icon-document-copy"
-            @click="root.useCopy([params])"
+            @click="$father.useCopy([params])"
           ></el-button>
         </el-tooltip>
-        <!-- v-if="root.hasPowerEdit([params])" -->
         <el-tooltip
+          v-if="$father.hasPowerEdit([params])"
           effect="dark"
           content="编 辑"
           placement="bottom-end"
@@ -149,11 +146,11 @@ export default {
             :size="size"
             circle
             icon="el-icon-edit"
-            @click="root.useEdit([params])"
+            @click="$father.useEdit([params])"
           ></el-button>
         </el-tooltip>
         <el-tooltip
-          v-if="root.hasPowerSubmit([params])"
+          v-if="$father.hasPowerSubmit([params])"
           effect="dark"
           content="审 核"
           placement="bottom-end"

+ 1 - 1
src/views/purchase/purchase-order/add/index.vue

@@ -1,6 +1,6 @@
 <script>
 import orderApi from "@/api/business/purchase/purchase-order";
-import { initColumns, initDicts, initRules, initParams } from "@/utils/init";
+import { initColumns, initDicts, initRules, initParams } from "@/utils/init/index.js";
 import { Columns, TabColumns } from "./column";
 
 const NewColumns = initColumns(Columns);

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

@@ -1,7 +1,7 @@
 import {
   initColumns,
   initDicts,
-} from "@/utils/init";
+} from "@/utils/init/index.js";
 
 export const TableColumns = [
   // { key: "puOrg", title: "采购组织" },

+ 1 - 1
src/views/purchase/purchase-order/edit/index.vue

@@ -1,7 +1,7 @@
 <script>
 import { editColumns, editTabColumns, forbidden, SelectColumns } from "./initColumn";
 import orderApi from "@/api/business/purchase/purchase-order";
-import {  initDicts, initRules, initParams } from "@/utils/init";
+import {  initDicts, initRules, initParams } from "@/utils/init/index.js";
 
 export default {
   name: "EditPurchaseOrderDrawer",

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

@@ -1,5 +1,5 @@
 import { Columns, TabColumns } from "../add/column";
-import { initColumns, initParams } from "@/utils/init";
+import { initColumns, initParams } from "@/utils/init/index.js";
 import deepCopy from "@gby/deep-copy";
 // import {deepCopy} from "../dist/deep-copy.es"
 

+ 16 - 2
src/views/purchase/purchase-order/index.vue

@@ -6,7 +6,7 @@ import {
   initPage,
   initParams,
   initDicts,
-} from "@/utils/init";
+} from "@/utils/init/index.js";
 
 
 export default {
@@ -360,6 +360,15 @@ export default {
       }
       
     },
+    // 退货
+    handlePurchaseReturn(){
+      console.log(this.checkedList,'1111111111111');
+      // let {id:puOrderId} = ;
+      let puOrderId = Number(this.checkedList[0].id);
+      orderApi.putInStorage({puOrderId}).then(res=>{
+        console.log(res,'res---------------');
+      })
+    },
     // 主表Select框
     handleSelect(selection, row) {
 
@@ -375,6 +384,7 @@ export default {
 
       console.log(this.checkedTabList, 'this.checkedTabList');
     },
+    // 保留两位小数,补位
     keepTwoDecimalStr(num) {
       if(num){
           const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
@@ -526,7 +536,11 @@ export default {
         </el-button-group>
 
         <el-button-group style="margin-left: 10px">
-          <!-- <el-button size="mini">采购退货</el-button> -->
+          <!-- <el-button size="mini" 
+            :disabled="!(checkedList.length == 1 && checkedList[0].deliveryStatus == '0')"
+            :key="checkedList.length"
+            @click="handlePurchaseReturn"
+          >采购退货</el-button> -->
           <el-button size="mini" @click="handlePaymentRequest">付款申请</el-button>
 
           <!-- <el-button size="mini">附件管理</el-button>

+ 63 - 0
src/views/purchase/purchase-order/purchaseReturn/column.js

@@ -0,0 +1,63 @@
+export const TableColumns = [
+  {key:"pkOrg",title:"库存组织"},
+  {key:"orgName",title:"组织名称"},
+  {key:"approver",title:"签字人"},
+  {key:"billmaker",title:"制单人"},
+  {key:"cbizid",title:"采购员"},
+  {key:"cbizName",title:"采购员名称"},
+  {key:"cdptvid",title:"采购部门"},
+  {key:"cdptName",title:"部门名称"},
+  {key:"cwarehouseName",title:"仓库名称"},
+  {key:"cwarehouseid",title:"仓库id"},
+  {key:"cwhsmanagerid",title:"库管员"},
+  {key:"cwhsmanagerName",title:"库管员名称"},
+  {key:"dbilldate",title:"单据日期"},
+  {key:"dmakedate",title:"制单日期"},
+  {key:"freplenishflag",title:"退库"},
+  {key:"modifiedtime",title:"最后修改时间"},
+  {key:"modifier",title:"最后修改人"},
+  {key:"ntotalnum",title:"总数量"},
+  {key:"taudittime",title:"签字日期"},
+  {key:"vbillcode",title:"单据日期"},
+  {key:"project",title:"项目"},
+  {key:"goodsWarehouse",title:"收货仓库"},
+  {key:"shippingAddress",title:"收货地址"},
+  {key:"customerDept",title:"客户部门"},
+  {key:"degreeEmergency",title:"紧急程度"},
+  {key:"agent",title:"代理人"},
+  {key:"syncSrm",title:"是否同步SRM"},
+  {key:"modeProcess",title:"处理方式"},
+  {key:"receivingContact",title:"收货联系人"},
+  {key:"vnote",title:"备注"},
+  {key:"vreturnreason",title:"退货原因"},
+  {key:"billtypeName",title:"出入库类型名称"},
+  {key:"drpOrderCode",title:"drp订单编号"},
+  
+];
+
+// {key:"ncProcurementWarehouseDetailModels",title:"入库单明细"}
+export const DetailColumns =[
+  {key:"materialCode",title:"物料编码"},
+  {key:"materialName",title:"物料名称"},
+  {key:"materialSpec",title:"物料规格"},
+  {key:"materialType",title:"物料型号"},
+  {key:"unitName",title:"计量单位名称"},
+  {key:"udi",title:"udi"},
+  {key:"vlotno",title:"批次号"},
+  {key:"registrationNum",title:"注册证号"},
+  {key:"vapprovalNumber",title:"批准文号"},
+  {key:"vchangerate",title:"换算率"},
+  {key:"dbizdate",title:"入库日期"},
+  {key:"dprodate",title:"生产日期"},
+  {key:"vinvalidDate",title:"有效期至"},
+  {key:"flargess",title:"赠品"},
+  {key:"nassistnum",title:"实收数量"},
+  {key:"nnum",title:"实收主数量"},
+  {key:"nshouldassistNum",title:"应收数量"},
+  {key:"nshouldNum",title:"应收主数量"},
+  {key:"receivingCustomer",title:"收货客户"},
+  {key:"wmsRowNum",title:"WMS行号"},
+  {key:"agent",title:"代理人"},
+  {key:"vsourcebillCode",title:"来源单据号"},
+  {key:"vsourceRowno",title:"来源单据行号"}
+];

+ 250 - 0
src/views/purchase/purchase-order/purchaseReturn/index.vue

@@ -0,0 +1,250 @@
+<!-- 采购退货 -->
+<template>
+
+  <el-drawer 
+    direction="btt" 
+    size="100%" 
+    :with-header="false" 
+    :visible.sync="visible" 
+    @open="beforeOpen"
+    @close="$emit('close')"
+    v-loading="loading"
+  >
+    <el-form 
+      size="mini" 
+      label-position="right" 
+      label-width="140px" 
+      :model="params" 
+      :rules="rules"
+      ref="orderSeeForm" 
+    >
+      <el-card :body-style="{
+        padding: '20px',
+        display: 'flex',
+        'flex-wrap': 'wrap',
+      }" style="margin: 10px">
+        <div slot="header" style="
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+          ">
+          <h3>查看</h3>
+          <div style="text-align: right">
+            <el-button size="mini" @click="handleRefresh">刷新</el-button>
+           
+            <el-button size="mini" @click="handleCancel">取 消</el-button>
+          </div>
+        </div>
+        <el-row style="display:flex; flex-wrap: wrap;">
+          <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.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"
+              ></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.controlsPosition" 
+                :placeholder="column.placeholder"
+                :clearable="column.clearable" 
+                :precision="column.precision"
+                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-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-checkbox v-if="column.inputType === 'Checkbox'" 
+                v-model="params[column.key]" 
+                disabled 
+                true-label="Y"
+                false-label="N"
+              ></el-checkbox>
+              <file-upload-center v-if="column.inputType === 'Upload'" 
+                v-model="params[column.key]"
+                :file-type="column.fileType" 
+                :disabled="true"
+              ></file-upload-center>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-card>
+      <el-card :body-style="{
+        padding: '20px',
+        display: 'flex',
+        'flex-wrap': 'wrap',
+        position: 'relative',
+      }" style="margin: 10px">
+        <el-tabs v-model="tabName" style="width: 100%">
+          <el-tab-pane 
+            v-for="(column, index) in tabColumns" 
+            :key="index" 
+            :label="column.title" 
+            :name="column.key"
+          >
+            <el-table :data="params[column.key]" style="width: 100%">
+              <el-table-column 
+                v-for="(cColumn, cIndex) in column.tableColumns" 
+                :key="cIndex" 
+                :prop="cColumn.key"
+                :label="cColumn.title" 
+                :width="cColumn.width || 80"
+              >
+                <template slot-scope="scope">
+                  <el-tag v-if="cColumn.key === 'index'">
+                    {{ scope.$index + 1 }}
+                  </el-tag>
+                  <el-input v-if="cColumn.inputType === 'Input'" 
+                    v-model="scope.row[cColumn.key]"
+                    :placeholder="cColumn.placeholder" 
+                    :clearable="cColumn.clearable" 
+                    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" 
+                    size="mini"
+                  ></dr-popover-select>
+
+                  <el-input-number v-if="cColumn.inputType === 'InputNumber'" 
+                    v-model="scope.row[cColumn.key]"
+                    :precision="cColumn.precision"
+                    :controls-position="cColumn.controlsPosition" 
+                    :placeholder="cColumn.placeholder"
+                    :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>
+          </el-tab-pane>
+        </el-tabs>
+      </el-card>
+
+    </el-form>
+  </el-drawer>
+
+</template>
+
+<script>
+export default{
+  name:'purchaseReturn',
+
+  data(){
+    return {
+      visible: false,
+      loading:false,
+    }
+  },
+  methods:{
+    beforeOpen(){}
+  }
+}
+</script>

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

@@ -5,7 +5,7 @@ import {
   initDicts,
   initRules,
   initParams,
-} from "@/utils/init";
+} from "@/utils/init/index.js";
 import { Columns, TabColumns } from "../add/column";
 import orderApi from "@/api/business/purchase/purchase-order";
 

+ 81 - 49
src/views/purchase/task/first-direct/column.js

@@ -1,56 +1,88 @@
 export const TableColumns = [
-  // { key: "supplier", title: "供应商" },
-  { key: "supplierName", title: "供应商" },
-  // { key: "puOrg", title: "采购组织" },
-  { key: "puOrgName", title: "采购组织" },
-  // { key: "customer", title: "客户" },
-  { key: "customerName", title: "客户" },
-  {
-    key: "priceType",
-    title: "价格类型",
-    inputType: "Select",
-    referName: "sys_price_type",
-  },
-  // {
-  //   key: "isDistribution",
-  //   title: "配送价",
-  //   inputType: "Select",
-  //   referName: "sys_yes_no",
-  // },
-  { key: "effectiveDate", title: "价格生效日期" },
-  { key: "endDate", title: "价格失效日期" },
-  {
-    key: "newTax",
-    title: "税率",
-    inputType: "ComputedInput",
-    width: 200,
-    computed: (prop) => {
-      const { tax } = prop;
-      return tax.toFixed(6) + "%";
+  {
+    item: { key: "supplierName", title: "供应商" },
+    attr: {},
+  },
+  {
+    item: { key: "puOrgName", title: "采购组织" },
+    attr: {},
+  },
+  {
+    item: { key: "customerName", title: "客户" },
+    attr: {},
+  },
+  {
+    item: { key: "priceType", title: "价格类型" },
+    attr: { component: "dict-tag", dictName: "sys_price_type" },
+  },
+  {
+    item: { key: "effectiveDate", title: "价格生效日期" },
+    attr: {},
+  },
+  {
+    item: { key: "endDate", title: "价格失效日期" },
+    attr: {},
+  },
+  {
+    item: { key: "newTax", title: "税率" },
+    attr: {
+      component: "dr-computed-input",
+      formatter: (prop) => {
+        const { tax } = prop;
+        return (tax * 1).toFixed(6) + "%";
+      },
+    },
+  },
+  {
+    item: { key: "taxFreePrice", title: "无税单价" },
+    attr: {
+      component: "dr-computed-input",
+      formatter: (prop) => {
+        const { taxFreePrice } = prop;
+        return (taxFreePrice * 1).toFixed(6);
+      },
+    },
+  },
+  {
+    item: { key: "taxPrice", title: "主含税单价" },
+    attr: {
+      component: "dr-computed-input",
+      formatter: (prop) => {
+        const { taxPrice } = prop;
+        return (taxPrice * 1).toFixed(6);
+      },
     },
   },
-  { key: "taxFreePrice", title: "无税单价" },
-  { key: "taxPrice", title: "主含税单价" },
-  {
-    key: "purchaseQuantity",
-    title: "本次采购数量",
-    inputType: "InputNumber",
-    width: 300,
-    min: (prop) => 0,
-    max: (prop) => prop.puQty - (prop.executeQty || 0),
-    controlsPosition: "right",
-  },
-  {
-    key: "arrivalDatePlan",
-    title: "计划到货日期",
-    inputType: "DatePicker",
-    valueFormat: "yyyy-MM-dd",
-    width: 300,
-    pickerOptions: {
-      disabledDate(time) {
-        return time.getTime() < Date.now();
+  {
+    item: { key: "purchaseQuantity", title: "本次采购数量" },
+    attr: {
+      component: "el-input-number",
+      min: () => 0,
+      max: (prop) => {
+        return prop.puQty - (prop.executeQty || 0);
       },
+      controlsPosition: "right",
+    },
+  },
+  {
+    item: { key: "arrivalDatePlan", title: "计划到货日期" },
+    attr: {
+      component: "el-date-picker",
+      valueFormat: "yyyy-MM-dd",
+      width: 300,
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() < Date.now();
+        },
+      },
+    },
+  },
+  {
+    item: { key: "note", title: "备注" },
+    attr: {
+      component: "el-input",
+      autosize: true,
+      type: "textarea",
     },
   },
-  { key: "note", title: "备注", inputType: "Textarea", width: 300 },
 ];

+ 39 - 31
src/views/purchase/task/first-direct/index.vue

@@ -1,10 +1,8 @@
 <script>
 import { TableColumns } from "./column";
-import { initDicts, initColumns } from "@/utils/init";
 import { FIRSTDIRECT, ADD } from "@/api/business/purchase/task";
 export default {
   name: "FirstDirectPurchaseDrawer",
-  dicts: initDicts(TableColumns),
   components: {},
   data() {
     return {
@@ -14,11 +12,17 @@ export default {
       column: 3,
       visible: false,
       loading: false,
-      tableColumns: initColumns(TableColumns),
+      tableColumns: TableColumns,
       data: [],
     };
   },
-  computed: {},
+  computed: {
+    $dicts: {
+      get: function () {
+        return this.$parent.$parent.$dicts;
+      },
+    },
+  },
   watch: {},
   methods: {
     //
@@ -36,7 +40,14 @@ export default {
         this.loading = true;
         const { code, data } = await FIRSTDIRECT(prop);
         if (code === 200) {
-          this.data = data;
+          this.data = data.map((item) => ({
+            ...item,
+            orderPriceVos: item.orderPriceVos.map((cItem) => ({
+              ...item,
+              ...cItem,
+            })),
+          }));
+          console.log("this.data", this.data);
           return true;
         } else {
           return false;
@@ -136,56 +147,53 @@ export default {
         <el-table-column
           v-for="(cItem, cIndex) in tableColumns"
           :key="cIndex"
-          :prop="cItem.key"
-          :label="cItem.title"
-          :fixed="cItem.fixed"
-          :width="cItem.width || 200"
+          :prop="cItem.item.key"
+          :label="cItem.item.title"
+          :fixed="cItem.item.fixed"
+          :width="cItem.item.width || 250"
           show-overflow-tooltip
         >
           <template slot-scope="scope">
             <el-input-number
-              v-if="cItem.inputType === 'InputNumber'"
-              v-model="scope.row[cItem.key]"
+              v-if="cItem.attr.component === 'el-input-number'"
+              v-model="scope.row[cItem.item.key]"
               :size="size"
-              :min="cItem.min(item)"
-              :max="cItem.max(item)"
-              :placeholder="cItem.placeholder"
-              :controls-position="cItem.controlsPosition"
+              :min="cItem.attr.min(item)"
+              :max="cItem.attr.max(item)"
+              :controls-position="cItem.attr.controlsPosition"
               style="width: 90%"
             ></el-input-number>
             <el-date-picker
-              v-else-if="cItem.inputType === 'DatePicker'"
-              v-model="scope.row[cItem.key]"
+              v-else-if="cItem.attr.component === 'el-date-picker'"
+              v-model="scope.row[cItem.item.key]"
               :size="size"
-              :type="cItem.type"
-              :placeholder="cItem.placeholder"
-              :value-format="cItem.valueFormat"
-              :picker-options="cItem.pickerOptions"
+              :type="cItem.attr.type"
+              :value-format="cItem.attr.valueFormat"
+              :picker-options="cItem.attr.pickerOptions"
               style="width: 90%"
             ></el-date-picker>
             <el-input
-              v-else-if="cItem.inputType === 'Textarea'"
-              v-model="scope.row[cItem.key]"
+              v-else-if="cItem.attr.component === 'el-input'"
+              v-model="scope.row[cItem.item.key]"
               :size="size"
               autosize
               type="textarea"
               style="width: 90%"
             ></el-input>
             <dr-computed-input
-              v-else-if="cItem.inputType === 'ComputedInput'"
-              v-model="scope.row[cItem.key]"
+              v-else-if="cItem.attr.component === 'dr-computed-input'"
+              v-model="scope.row[cItem.item.key]"
               :source="scope.row"
-              :computed="cItem.computed"
-              :placeholder="cItem.placeholder"
+              :formatter="cItem.attr.formatter"
               style="width: 100%"
             ></dr-computed-input>
             <dict-tag
-              v-else-if="cItem.inputType === 'Select'"
+              v-else-if="cItem.attr.component === 'dict-tag'"
               :size="size"
-              :value="scope.row[cItem.key]"
-              :options="dict.type[cItem.referName]"
+              :value="scope.row[cItem.item.key]"
+              :options="$dicts[cItem.attr.dictName]"
             />
-            <span v-else>{{ scope.row[cItem.key] }}</span>
+            <span v-else>{{ scope.row[cItem.item.key] }}</span>
           </template>
         </el-table-column>
       </el-table>

+ 10 - 37
src/views/purchase/task/index.vue

@@ -1,34 +1,7 @@
 <script>
 import { LIST } from "@/api/business/purchase/task";
 import { TableColumns, SearchColumns } from "./column";
-
-const initParams = (prop, key = "key", value = "value") => {
-  // get params
-  const object1 = Object.fromEntries(
-    prop.map(({ item, attr }) => [item[key], attr[value]])
-  );
-  // get mapping params
-  const object2 = {};
-  prop
-    .filter((item) => item.attr.dataMapping)
-    .map(({ attr: { dataMapping } }) => {
-      for (let key in dataMapping) {
-        object2[key] = null;
-      }
-    });
-  return { ...object1, ...object2 };
-};
-
-// 初始化字典
-const initDicts = (prop) => {
-  return Array.from(
-    new Set(
-      prop
-        .filter((item) => item.attr.dictName)
-        .map((item) => item.attr.dictName)
-    )
-  );
-};
+import { initParams, initDicts } from "@/utils/init.js";
 
 export default {
   name: "PuchaseTask",
@@ -56,14 +29,14 @@ export default {
       page: { pageNum: 1, pageSize: 10, total: 0 },
     };
   },
-  computed: {},
-  watch: {},
-  provide() {
-    return {
-      initParams,
-      $dicts: () => this.dict.type,
-    };
+  computed: {
+    $dicts: {
+      get: function () {
+        return this.dict.type;
+      },
+    },
   },
+  watch: {},
   created() {
     this.params.status = "0";
     this.useQuery(this.params, this.page);
@@ -222,7 +195,7 @@ export default {
             >
               <template v-if="column.attr.dictName">
                 <el-option
-                  v-for="item in dict.type[column.attr.dictName]"
+                  v-for="item in $dicts[column.attr.dictName]"
                   :key="item.value"
                   :label="item.label"
                   :value="item.value"
@@ -300,7 +273,7 @@ export default {
             v-if="column.attr.dictName"
             :size="size"
             :value="scope.row[column.item.key]"
-            :options="dict.type[column.attr.dictName]"
+            :options="$dicts[column.attr.dictName]"
           />
           <component is="span" v-else>{{
             scope.row[column.item.key]

+ 12 - 7
src/views/purchase/task/see/index.vue

@@ -1,10 +1,9 @@
 <script>
-import { TableColumns as Columns } from "../column";
+import { TableColumns } from "../column";
 import { ITEM } from "@/api/business/purchase/task";
 export default {
   name: "SeeDialog",
   components: {},
-  inject: ["$dicts", "initParams"],
   data() {
     return {
       size: "mini",
@@ -13,11 +12,17 @@ export default {
       column: 3,
       visible: false,
       loading: false,
-      columns: Columns,
+      columns: TableColumns,
       params: {},
     };
   },
-  computed: {},
+  computed: {
+    $dicts: {
+      get: function () {
+        return this.$parent.$parent.$dicts;
+      },
+    },
+  },
   watch: {},
   methods: {
     // 查 询
@@ -39,8 +44,8 @@ export default {
       }
     },
     //
-    open(prop) {
-      this.visible = this.fetchItem(prop);
+    async open(prop) {
+      this.visible = await this.fetchItem(prop);
     },
   },
   created() {},
@@ -78,7 +83,7 @@ export default {
           v-if="column.attr.dictName"
           :size="size"
           :value="params[column.item.key]"
-          :options="$dicts()[column.attr.dictName]"
+          :options="$dicts[column.attr.dictName]"
         />
         <span v-else>{{ params[column.item.key] }}</span>
       </el-descriptions-item>