002201 há 2 anos atrás
pai
commit
92024a3615

+ 35 - 18
src/views/purchase/apply/add/column.js

@@ -173,20 +173,28 @@ export const TabColumns = [
         title: "物料名称",
         key: "materialName",
         inputType: "PopoverSelect",
-        width: 200,
+        width: 300,
         referName: "MATERIAL_PARAM",
         dataMapping: {
+          model: "model",
           material: "id",
-          unit: "unitId",
           materialCode: "code",
           materialName: "name",
+          unitName: "unitIdName",
+          puUnitName: "unitIdName",
           specification: "specification",
-          manufacturer: "manufacturerIdName",
+          manufacturer: "manufacturerId",
+          manufacturerName: "manufacturerIdName",
         },
+        require: true,
       },
       { title: "物料编码", key: "materialCode" },
       {
         title: "生产厂家",
+        key: "manufacturerName",
+      },
+      {
+        title: "生产厂家编码",
         key: "manufacturer",
       },
       {
@@ -201,10 +209,11 @@ export const TabColumns = [
         title: "单位名称",
         key: "unitName",
         inputType: "PopoverSelect",
-        width: 200,
+        width: 300,
         referName: "UNIT_PARAM",
         dataMapping: {
-          unit: "name",
+          unit: "code",
+          unitName: "name",
         },
       },
       {
@@ -215,10 +224,11 @@ export const TabColumns = [
         title: "采购单位名称",
         key: "puUnitName",
         inputType: "PopoverSelect",
-        width: 200,
+        width: 300,
         referName: "UNIT_PARAM",
         dataMapping: {
-          puUnit: "name",
+          puUnit: "code",
+          puUnitName: "name",
         },
       },
       {
@@ -229,7 +239,8 @@ export const TabColumns = [
         title: "采购换算率",
         key: "conversionRate",
         inputType: "InputNumber",
-        width: 200,
+        width: 300,
+        require: true,
       },
       {
         title: "税率%",
@@ -239,25 +250,28 @@ export const TabColumns = [
         dataMapping: {
           tax: "ntaxrate",
         },
-        width: 200,
+        width: 300,
+        require: true,
       },
       {
         title: "含税单价",
         key: "taxPrice",
         inputType: "InputNumber",
-        width: 200,
+        width: 300,
+        require: true,
       },
       {
         title: "无税单价",
-        key: "taxFreePrice",
+        key: "price",
         inputType: "ComputedInput",
-        width: 200,
+        width: 300,
         computed: (prop) => {
           const { tax, taxPrice } = prop;
           const newTax = Number(tax) / 100;
-          const taxFreePrice = (taxPrice / (1 + newTax)).toFixed(8);
-          return taxFreePrice === "NaN" ? null : taxFreePrice;
+          const price = (taxPrice / (1 + newTax)).toFixed(8);
+          return price === "NaN" ? null : price;
         },
+        require: true,
       },
       {
         key: "currencyName",
@@ -279,6 +293,7 @@ export const TabColumns = [
         inputType: "DatePicker",
         valueFormat: "yyyy-MM-dd",
         value: new Date(),
+        require: true,
       },
       {
         key: "periodEnd",
@@ -290,12 +305,13 @@ export const TabColumns = [
             return time.getTime() < Date.now() + 3600 * 1000 * 24 * 365;
           },
         },
+        require: true,
       },
       {
         title: "客户名称",
         key: "customerName",
         inputType: "PopoverSelect",
-        width: 200,
+        width: 300,
         referName: "CUSTOMER_PARAM",
         dataMapping: {
           customer: "code",
@@ -313,14 +329,14 @@ export const TabColumns = [
       {
         title: "首次报批",
         key: "isApprovalFirst",
-        width: 200,
+        width: 300,
         inputType: "Select",
         referName: "is_effective",
       },
       {
         title: "价格调整",
         key: "isPriceAdjustment",
-        width: 200,
+        width: 300,
         inputType: "Select",
         referName: "is_effective",
       },
@@ -333,9 +349,10 @@ export const TabColumns = [
       {
         title: "配送价",
         key: "isDistributionPrice",
-        width: 200,
+        width: 300,
         inputType: "Select",
         referName: "is_effective",
+        require: true,
       },
       {
         title: "创建人名称",

+ 18 - 0
src/views/purchase/apply/add/index.vue

@@ -18,6 +18,24 @@ export default {
   },
   computed: {},
   watch: {
+    "params.puOrg": {
+      handler: function (newProp, oldProp) {
+        if (oldProp) {
+          this.params.priceApplyOrgs = this.params.priceApplyOrgs.filter(
+            (item) => item.org !== oldProp
+          );
+        }
+        if (newProp) {
+          const { puOrg: org, puOrgName: orgName } = this.params;
+          this.params.priceApplyOrgs.push({
+            org,
+            orgName,
+            createByName: undefined,
+            updateByName: undefined,
+          });
+        }
+      },
+    },
     "params.priceApplyItems": {
       handler: function () {},
       deep: true,

+ 67 - 34
src/views/purchase/apply/hooks/function.js

@@ -1,6 +1,55 @@
 import { REFER } from "@/components/popover-select/api";
 import { EXIST } from "@/api/business/purchase/catalogue";
-import {  ITEM } from "@/api/business/purchase/apply";
+import { ITEM } from "@/api/business/purchase/apply";
+
+const fetchTax = async (prop) => {
+  try {
+    // try
+    const { code, rows } = await REFER({
+      search: prop,
+      type: "TAX_RATE_PARAM",
+    });
+    if (code === 200) {
+      return rows[0] || {};
+    }
+  } catch (err) {
+    // catch
+    console.error(err);
+  } finally {
+    // finally
+  }
+};
+
+const fetchUnit = async (prop) => {
+  try {
+    // try
+    const { code, rows } = await REFER({
+      search: prop,
+      type: "UNIT_PARAM",
+    });
+    if (code === 200) {
+      return rows[0] || {};
+    }
+  } catch (err) {
+    // catch
+    console.error(err);
+  } finally {
+    // finally
+  }
+};
+
+const fetchExist = async (prop) => {
+  try {
+    // try
+    const { code, data } = await EXIST(prop);
+    if (code === 200) return data;
+  } catch (err) {
+    // catch
+    console.error(err);
+  } finally {
+    // finally
+  }
+};
 
 export default function useMethods() {
   const fetchItem = async ({ _this, prop }) => {
@@ -20,44 +69,28 @@ export default function useMethods() {
     }
   };
   const fetchRefer = async ({ _this, prop, type, source }) => {
-    const { rateCode } = prop;
     if (type === "MATERIAL_PARAM") {
-      try {
-        // try
-        _this.loading = true;
-        // task 1
-        const { code, rows } = await REFER({
-          search: rateCode,
-          type: "TAX_RATE_PARAM",
-        });
-        if (code === 200) {
-          const [{ ntaxrate }] = rows;
-          source.tax = ntaxrate === "0E-8" ? "0.00000000" : ntaxrate;
-        }
-        // task 2
-        const { materialCode } = source;
-        const { puOrg, customer, supplier } = _this.params;
-        const {
-          code: code2,
-          data: { recentlyPrice, isApprovalFirst, isPriceAdjustment },
-        } = await EXIST({
-          puOrg,
-          customer,
-          supplier,
-          materialCode,
-        });
-        if (code2 === 200) {
+      const { puOrg, customer, supplier } = _this.params;
+      const { rateCode, unitIdName, code: materialCode } = prop;
+      // task 1
+      fetchTax(rateCode).then(({ ntaxrate }) => {
+        source.tax = ntaxrate === "0E-8" ? "0.00000000" : ntaxrate;
+      });
+      // task 2
+      fetchUnit(unitIdName).then(({ code, name }) => {
+        source.unit = code;
+        source.unitName = name;
+        source.puUnit = code;
+        source.puUnitName = name;
+      });
+      // task 3
+      fetchExist({ puOrg, customer, supplier, materialCode }).then(
+        ({ recentlyPrice, isApprovalFirst, isPriceAdjustment }) => {
           source.recentlyPrice = recentlyPrice;
           source.isApprovalFirst = isApprovalFirst;
           source.isPriceAdjustment = isPriceAdjustment;
         }
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        _this.loading = false;
-      }
+      );
     }
   };
 

+ 37 - 0
src/views/purchase/catalogue/export/index.vue

@@ -0,0 +1,37 @@
+<script>
+import { EXPORT } from "@/api/business/purchase/catalogue";
+
+export default {
+  name: "ExportDialog",
+  data() {
+    return {};
+  },
+  computed: {},
+  watch: {},
+  methods: {
+    //
+    open(prop, page) {
+      this.$confirm("是否确认导出所有数据项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+      })
+        .then(async () => {
+          const { pageNum, pageSize } = page;
+          this.download(
+            "pu/price/catalogue/export",
+            { ...prop, pageNum, pageSize },
+            `catalogue_${new Date().getTime()}.xlsx`
+          );
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<template></template>

+ 10 - 0
src/views/purchase/catalogue/index.vue

@@ -9,6 +9,7 @@ export default {
     SeeModel: () => import("./see/index.vue"),
     InvalidModel: () => import("./invalid/index.vue"),
     EnableModel: () => import("./enable/index.vue"),
+    ExportModel: () => import("./export/index.vue"),
   },
   data() {
     return {
@@ -105,6 +106,11 @@ export default {
         return !!prop.length;
       }
     },
+    // 导 出
+    async useExport(prop, page) {
+      const { open } = this.$refs.ExportModel;
+      await open(prop, page);
+    },
   },
 };
 </script>
@@ -121,6 +127,7 @@ export default {
     :body-style="{ padding: 0 }"
   >
     <see-model ref="SeeModel"></see-model>
+    <export-model ref="ExportModel"></export-model>
     <invalid-model
       ref="InvalidModel"
       @success="useQuery(params, page)"
@@ -199,6 +206,9 @@ export default {
         查 询
       </el-button>
       <el-button :size="size" @click="useReset"> 重 置 </el-button>
+      <el-button :size="size" @click="useExport(params, page)">
+        导 出
+      </el-button>
       <el-button
         v-show="hasPowerInvalid(selectData)"
         :size="size"

+ 8 - 5
src/views/purchase/task/first-direct/index.vue

@@ -37,6 +37,7 @@ export default {
         const { code, data } = await FIRSTDIRECT(prop);
         if (code === 200) {
           this.data = data;
+          console.log(this.data);
           return true;
         } else {
           return false;
@@ -74,7 +75,9 @@ export default {
       }
     },
   },
-  created() {},
+  created() {
+    console.log("tableColumns", this.tableColumns);
+  },
   mounted() {},
   destroyed() {},
 };
@@ -134,10 +137,10 @@ export default {
           :prop="cItem.key"
           :label="cItem.title"
           :fixed="cItem.fixed"
-          :width="cItem.width || 180"
+          :width="cItem.width || 200"
           show-overflow-tooltip
         >
-          <template slot-scope="scope">
+          <!-- <template slot-scope="scope">
             <el-input-number
               v-if="cItem.inputType === 'InputNumber'"
               v-model="scope.row[cItem.key]"
@@ -172,8 +175,8 @@ export default {
               :value="scope.row[cItem.key]"
               :options="dict.type[cItem.referName]"
             />
-            <span v-else>{{ scope.row[cItem.key] }}</span>
-          </template>
+            <span v-else>1{{ scope.row[cItem.key] }}</span>
+          </template> -->
         </el-table-column>
       </el-table>
     </div>

+ 2 - 4
src/views/purchase/task/index.vue

@@ -61,10 +61,8 @@ export default {
     // 查 询
     async useQuery(prop, page) {
       const { pageNum, pageSize } = page;
-      const {
-        date: [startDate, endDate],
-        documentsCodes: code,
-      } = prop;
+      const { date, documentsCodes: code } = prop;
+      const [startDate, endDate] = date || [];
       const documentsCodes = code
         ? code.replace(/\s*/g, "").replaceAll(",", ",")
         : undefined;

+ 17 - 1
src/views/purchase/task/see/index.vue

@@ -50,7 +50,23 @@ export default {
 };
 </script>
 <template>
-  <el-drawer :visible.sync="visible" :size="width" :title="title">
+  <el-drawer
+    :size="width"
+    :title="title"
+    :show-close="false"
+    :visible.sync="visible"
+  >
+    <template slot="title">
+      <span>{{ title }}</span>
+      <span>
+        <el-button
+          :size="size"
+          circle
+          icon="el-icon-close"
+          @click="visible = false"
+        ></el-button>
+      </span>
+    </template>
     <el-descriptions :size="size" :column="column" border style="margin: 10px">
       <el-descriptions-item
         v-if="params[column.key]"

+ 2 - 2
vue.config.js

@@ -43,10 +43,10 @@ module.exports = {
         // target: `http://172.16.63.202:8000/drp-admin`, // D本地
         // target: `http://172.16.62.241:8000/drp-admin`, //笑寒本地
         // target: `http://172.16.13.152:8000/drp-admin`, //豪哥本地
-        // target: `http://172.16.13.47:8000/drp-admin`, //这是一个美女的本地
+        target: `http://172.16.13.47:8000/drp-admin`, //这是一个美女的本地
         // target: `http://172.16.13.113:8000/drp-admin`, //DWT本地
         // target: `http://172.16.13.77:8000/drp-admin`, //TQ本地
-        target: `http://172.16.13.21:8000/drp-admin`, // 雪豹的本地
+        // target: `http://172.16.13.21:8000/drp-admin`, // 雪豹的本地
         changeOrigin: true,
         pathRewrite: {
           ["^" + process.env.VUE_APP_BASE_API]: "",