Эх сурвалжийг харах

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

002390 1 жил өмнө
parent
commit
4d7fbb79c5

+ 4 - 4
src/views/purchase/PurchaseDemandList/index.vue

@@ -207,10 +207,10 @@
           >
           >
           <template slot-scope="scope">
           <template slot-scope="scope">
             <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
             <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
-            <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3'" @click="edit(scope.row)">编辑</el-button>
-            <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3'" @click="commit(scope.row)">提交</el-button>
-            <el-button type="text" size="mini" v-if="scope.row.status == '1' && scope.row.flowId" @click="reback(scope.row)">收回</el-button>
-            <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3'" @click="deleteids(scope.row)">删除</el-button>
+            <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '9'" @click="edit(scope.row)">编辑</el-button>
+            <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '9'" @click="commit(scope.row)">提交</el-button>
+            <!-- <el-button type="text" size="mini" v-if="scope.row.status == '1' && scope.row.flowId" @click="reback(scope.row)">收回</el-button> -->
+            <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '9'" @click="deleteids(scope.row)">删除</el-button>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
         </el-table>
         </el-table>

+ 26 - 8
src/views/purchase/apply/add/index.vue

@@ -86,8 +86,16 @@
           const {
           const {
             recentlyPrice = "0",
             recentlyPrice = "0",
             isApprovalFirst = "N",
             isApprovalFirst = "N",
-            purchasequantity
-          } = await fetchExist({puOrg, customer, supplier, materialCode, customerName: "", priceType: prop.row.priceType});
+            purchasequantity,
+            recentlyPriceDate
+          } = await fetchExist({
+            puOrg,
+            customer,
+            supplier,
+            materialCode,
+            customerName: "",
+            priceType: prop.row.priceType
+          });
           this.loading = false;
           this.loading = false;
           await this.onRowAdd(this.tabName, {
           await this.onRowAdd(this.tabName, {
             ...item,
             ...item,
@@ -102,6 +110,7 @@
             puUnitName: puUnitName,
             puUnitName: puUnitName,
             recentlyPrice,
             recentlyPrice,
             isApprovalFirst,
             isApprovalFirst,
+            recentlyPriceDate: recentlyPriceDate,
             yPurchaseQuantity: purchasequantity,
             yPurchaseQuantity: purchasequantity,
             tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
             tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
             createByName: createByName,
             createByName: createByName,
@@ -110,7 +119,7 @@
           });
           });
         }
         }
       },
       },
-      // 
+      //
       async changeCustomerName(prop) {
       async changeCustomerName(prop) {
         console.log("prop", prop)
         console.log("prop", prop)
         const {
         const {
@@ -123,11 +132,20 @@
         const {
         const {
           recentlyPrice,
           recentlyPrice,
           isApprovalFirst,
           isApprovalFirst,
-          purchasequantity
-          } = await fetchExist({puOrg, supplier, materialCode: prop.row.materialCode, customer:prop.row.customer,customerName: prop.row.customerName, priceType: prop.row.priceType});
-          prop.row.yPurchaseQuantity = purchasequantity
-          prop.row.recentlyPrice = recentlyPrice
-          prop.row.isApprovalFirst = isApprovalFirst
+          purchasequantity,
+          recentlyPriceDate
+        } = await fetchExist({
+          puOrg,
+          supplier,
+          materialCode: prop.row.materialCode,
+          customer: prop.row.customer,
+          customerName: prop.row.customerName,
+          priceType: prop.row.priceType
+        });
+        prop.row.yPurchaseQuantity = purchasequantity
+        prop.row.recentlyPrice = recentlyPrice
+        prop.row.isApprovalFirst = isApprovalFirst
+        prop.row.recentlyPriceDate = recentlyPriceDate
       },
       },
       //
       //
       async onOpen() {
       async onOpen() {

+ 2 - 2
src/views/purchase/apply/columns.js

@@ -22,7 +22,7 @@ export default function useColumns() {
     { item: { key: "createByName", title: "创建人", width: 100 }, attr: {} },
     { item: { key: "createByName", title: "创建人", width: 100 }, attr: {} },
     {
     {
       item: { key: "isEffective", title: "是否已推价格", width: 100 },
       item: { key: "isEffective", title: "是否已推价格", width: 100 },
-      attr: { is: "el-dict-tag", dictName: "is_effective", width: 100 },
+      attr: { is: "el-dict-tag", dictName: "is_effective"},
     },
     },
     {
     {
       item: { key: "approveTime", title: "单据申请日期", width: 100 },
       item: { key: "approveTime", title: "单据申请日期", width: 100 },
@@ -30,7 +30,7 @@ export default function useColumns() {
     },
     },
     {
     {
       item: { key: "sourceType", title: "来源单据类型", width: 100 },
       item: { key: "sourceType", title: "来源单据类型", width: 100 },
-      attr: { is: "el-dict-tag", dictName: "price_source", width: 100 },
+      attr: { is: "el-dict-tag", dictName: "price_source" },
     },
     },
   ].map(({ item, attr }) => ({
   ].map(({ item, attr }) => ({
     attr,
     attr,

+ 245 - 230
src/views/purchase/apply/copy/index.vue

@@ -1,132 +1,135 @@
 <script>
 <script>
-import useColumns from "./columns";
-import { EXIST } from "@/api/business/purchase/catalogue";
-import { ITEM, SAVE } from "@/api/business/purchase/apply";
-import { tax, unit, currency } from "@/components/popover-select-v2/fetch";
+  import useColumns from "./columns";
+  import {EXIST} from "@/api/business/purchase/catalogue";
+  import {ITEM, SAVE} from "@/api/business/purchase/apply";
+  import {tax, unit, currency} from "@/components/popover-select-v2/fetch";
 
 
-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
-  }
-};
+  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 {
-  name: "CopyDrawer",
-  props: {
-    dict: {
-      type: Object,
+  export default {
+    name: "CopyDrawer",
+    props: {
+      dict: {
+        type: Object,
+      },
+      selectData: {
+        type: [Array],
+        require: true,
+      },
     },
     },
-    selectData: {
-      type: [Array],
-      require: true,
+    components: {
+      ElSuperForm: () => import("@/components/super-form/index.vue"),
+      ElSuperTable: () => import("@/components/super-table/index.vue"),
+      ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+    },
+    data() {
+      const {
+        TabColumns,
+        TableColumns,
+        TabColumns: [
+          {
+            item: {key: tabName},
+          },
+        ],
+      } = useColumns();
+      const rules = this.$init.rules([...TabColumns, ...TableColumns]);
+      const params = this.$init.params([...TabColumns, ...TableColumns]);
+      return {
+        title: "复 制",
+        width: "100%",
+        visible: false,
+        loading: false,
+        rules: rules,
+        params: params,
+        tabName: tabName,
+        TabColumns: TabColumns,
+        TableColumns: TableColumns,
+      };
     },
     },
-  },
-  components: {
-    ElSuperForm: () => import("@/components/super-form/index.vue"),
-    ElSuperTable: () => import("@/components/super-table/index.vue"),
-    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
-  },
-  data() {
-    const {
-      TabColumns,
-      TableColumns,
-      TabColumns: [
-        {
-          item: { key: tabName },
+    computed: {
+      disabled: {
+        get() {
+          const {
+            selectData: {length},
+          } = this.$props;
+          if (length !== 1) {
+            return true;
+          }
+        },
+        set() {
         },
         },
-      ],
-    } = useColumns();
-    const rules = this.$init.rules([...TabColumns, ...TableColumns]);
-    const params = this.$init.params([...TabColumns, ...TableColumns]);
-    return {
-      title: "复 制",
-      width: "100%",
-      visible: false,
-      loading: false,
-      rules: rules,
-      params: params,
-      tabName: tabName,
-      TabColumns: TabColumns,
-      TableColumns: TableColumns,
-    };
-  },
-  computed: {
-    disabled: {
-      get() {
-        const {
-          selectData: { length },
-        } = this.$props;
-        if (length !== 1) {
-          return true;
-        }
       },
       },
-      set() {},
     },
     },
-  },
-  watch: {},
-  methods: {
-    //
-    async changeMaterialName(prop) {
-      const { selectData } = prop;
-      const {
-        puOrg,
-        customer,
-        supplier,
-        currency,
-        currencyCode,
-        currencyName,
-      } = this.params;
-      const { nickName: createByName } = this.$store.state.user;
-      if (selectData.length) {
-        this.params[this.tabName].splice(-1);
-      }
-      for (const item of selectData) {
-        this.loading = true;
-        const { tax: taxName, unitName, code: materialCode } = item;
-        // task 1
-        const { ntaxrate } = await tax(taxName);
-        // task 2
+    watch: {},
+    methods: {
+      //
+      async changeMaterialName(prop) {
+        const {selectData} = prop;
         const {
         const {
-          id: puUnit,
-          code: puUnitCode,
-          name: puUnitName,
-        } = await unit(unitName);
-        // task 3
-        const {
-          recentlyPrice = "0",
-          isApprovalFirst = "N",
-          purchasequantity
-        } = await fetchExist({ puOrg, customer, supplier, materialCode, priceType: prop.row.priceType });
-        this.loading = false;
-        await this.onRowAdd(this.tabName, {
-          ...item,
-          currency: currency,
-          currencyCode: currencyCode,
-          currencyName: currencyName,
-          unit: puUnit,
-          unitCode: puUnitCode,
-          unitName: puUnitName,
-          puUnit: puUnit,
-          puUnitCode: puUnitCode,
-          puUnitName: puUnitName,
-          recentlyPrice,
-          isApprovalFirst,
-          yPurchaseQuantity: purchasequantity,
-          tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
-          createByName: createByName,
-          updateByName: createByName,
-          id: null,
-        });
-      }
-    },
-      // 
+          puOrg,
+          customer,
+          supplier,
+          currency,
+          currencyCode,
+          currencyName,
+        } = this.params;
+        const {nickName: createByName} = this.$store.state.user;
+        if (selectData.length) {
+          this.params[this.tabName].splice(-1);
+        }
+        for (const item of selectData) {
+          this.loading = true;
+          const {tax: taxName, unitName, code: materialCode} = item;
+          // task 1
+          const {ntaxrate} = await tax(taxName);
+          // task 2
+          const {
+            id: puUnit,
+            code: puUnitCode,
+            name: puUnitName,
+          } = await unit(unitName);
+          // task 3
+          const {
+            recentlyPrice = "0",
+            isApprovalFirst = "N",
+            purchasequantity,
+            recentlyPriceDate
+          } = await fetchExist({puOrg, customer, supplier, materialCode, priceType: prop.row.priceType});
+          this.loading = false;
+          await this.onRowAdd(this.tabName, {
+            ...item,
+            currency: currency,
+            currencyCode: currencyCode,
+            currencyName: currencyName,
+            unit: puUnit,
+            unitCode: puUnitCode,
+            unitName: puUnitName,
+            puUnit: puUnit,
+            puUnitCode: puUnitCode,
+            puUnitName: puUnitName,
+            recentlyPrice,
+            recentlyPriceDate: recentlyPriceDate,
+            isApprovalFirst,
+            yPurchaseQuantity: purchasequantity,
+            tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
+            createByName: createByName,
+            updateByName: createByName,
+            id: null,
+          });
+        }
+      },
+      //
       async changeCustomerName(prop) {
       async changeCustomerName(prop) {
         console.log("prop", prop)
         console.log("prop", prop)
         const {
         const {
@@ -139,124 +142,136 @@ export default {
         const {
         const {
           recentlyPrice,
           recentlyPrice,
           isApprovalFirst,
           isApprovalFirst,
-          purchasequantity
-          } = await fetchExist({puOrg, supplier, materialCode: prop.row.materialCode, customer:prop.row.customer,customerName: prop.row.customerName, priceType: prop.row.priceType});
-          prop.row.yPurchaseQuantity = purchasequantity
-          prop.row.recentlyPrice = recentlyPrice
-          prop.row.isApprovalFirst = isApprovalFirst
+          purchasequantity,
+          recentlyPriceDate
+        } = await fetchExist({
+          puOrg,
+          supplier,
+          materialCode: prop.row.materialCode,
+          customer: prop.row.customer,
+          customerName: prop.row.customerName,
+          priceType: prop.row.priceType
+        });
+        prop.row.yPurchaseQuantity = purchasequantity
+        prop.row.recentlyPrice = recentlyPrice
+        prop.row.isApprovalFirst = isApprovalFirst
+        prop.row.recentlyPriceDate = recentlyPriceDate
       },
       },
-    //
-    async fetchItem(prop) {
-      try {
-        // try
-        this.loading = true;
-        const { tabName, TabColumns } = this;
-        const { TableColumns } = TabColumns.find(
-          ({ item: { key } }) => key === tabName
-        );
-        console.log('看看prop', prop)
-        const { code, data } = await ITEM(prop, true);
-        if (code === 200) {
-          this.params = data;
-          this.params.priceApplyItems = data.priceApplyItems.map((item) => ({
-            ...this.$init.params(TableColumns),
-            ...item,
-            id: null,
-          }));
-          this.params.id = null;
-        } else {
+      //
+      async fetchItem(prop) {
+        try {
+          // try
+          this.loading = true;
+          const {tabName, TabColumns} = this;
+          const {TableColumns} = TabColumns.find(
+            ({item: {key}}) => key === tabName
+          );
+          console.log('看看prop', prop)
+          const {code, data} = await ITEM(prop, true);
+          if (code === 200) {
+            this.params = data;
+            this.params.priceApplyItems = data.priceApplyItems.map((item) => ({
+              ...this.$init.params(TableColumns),
+              ...item,
+              id: null,
+            }));
+            this.params.id = null;
+          } else {
+            this.visible = false;
+          }
+        } catch (err) {
+          // catch
+          console.error(err);
           this.visible = false;
           this.visible = false;
+        } finally {
+          // finally
+          this.loading = false;
         }
         }
-      } catch (err) {
-        // catch
-        console.error(err);
+      },
+      //
+      async onOpen() {
+        this.visible = true;
+        const {
+          selectData: [{id}],
+        } = this.$props;
+        this.params.id = null;
+        this.params.createBy = null;
+        this.params.priceCode = null;
+        this.params.createByName = null;
+        this.params.effectiveDate = null;
+        this.params.priceApplyOrgs = [];
+        this.params.priceApplyItems = this.params.priceApplyItems.map((item) => ({
+          ...item,
+          id: null,
+          applyId: null,
+          createByName: null,
+          updateByName: null,
+          delFlag: 0,
+        }));
+        await this.fetchItem(id);
+      },
+      //
+      async onHide() {
+        const {TabColumns, TableColumns} = useColumns();
         this.visible = false;
         this.visible = false;
-      } finally {
-        // finally
-        this.loading = false;
-      }
-    },
-    //
-    async onOpen() {
-      this.visible = true;
-      const {
-        selectData: [{ id }],
-      } = this.$props;
-      this.params.id = null;
-      this.params.createBy = null;
-      this.params.priceCode = null;
-      this.params.createByName = null;
-      this.params.effectiveDate = null;
-      this.params.priceApplyOrgs = [];
-      this.params.priceApplyItems = this.params.priceApplyItems.map((item) => ({
-        ...item,
-        id: null,
-        applyId: null,
-        createByName: null,
-        updateByName: null,
-        delFlag: 0,
-      }));
-      await this.fetchItem(id);
-    },
-    //
-    async onHide() {
-      const { TabColumns, TableColumns } = useColumns();
-      this.visible = false;
-      this.params = this.$init.params([...TabColumns, ...TableColumns]);
-      this.$emit("success");
+        this.params = this.$init.params([...TabColumns, ...TableColumns]);
+        this.$emit("success");
+      },
+      //
+      async onRowAdd(prop, pushParams = {}) {
+        this.$refs.superForm.validate(async (valid) => {
+          if (valid) {
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            this.params[prop].push({
+              delFlag: "0",
+              ...this.$init.params(TableColumns),
+              ...pushParams,
+            });
+          }
+        });
+      },
+      //
+      async onRowRemove(prop, scope) {
+        const {$index} = scope;
+        this.params[prop].splice($index, 1);
+      },
+      //
+      async useSubmit(prop) {
+        this.$refs[prop].validate(async (valid) => {
+          console.log(this.params);
+          if (valid) {
+            try {
+              this.loading = true;
+              this.params.priceApplyOrgs = [];
+              const {msg, code} = await SAVE(this.params);
+              if (code === 200) {
+                this.onHide();
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              console.error(err);
+            } finally {
+              // finally
+              this.loading = false;
+            }
+          } else {
+            return false;
+          }
+        });
+      },
     },
     },
-    //
-    async onRowAdd(prop, pushParams = {}) {
-      this.$refs.superForm.validate(async (valid) => {
-        if (valid) {
-          const { TabColumns } = this;
-          const { TableColumns } = TabColumns.find(
-            ({ item: { key } }) => key === prop
-          );
-          this.params[prop].push({
-            delFlag: "0",
-            ...this.$init.params(TableColumns),
-            ...pushParams,
-          });
-        }
-      });
+    created() {
     },
     },
-    //
-    async onRowRemove(prop, scope) {
-      const { $index } = scope;
-      this.params[prop].splice($index, 1);
+    mounted() {
     },
     },
-    //
-    async useSubmit(prop) {
-      this.$refs[prop].validate(async (valid) => {
-        console.log(this.params);
-        if (valid) {
-          try {
-            this.loading = true;
-            this.params.priceApplyOrgs = [];
-            const { msg, code } = await SAVE(this.params);
-            if (code === 200) {
-              this.onHide();
-              this.$emit("success");
-              this.$notify.success(msg);
-            }
-          } catch (err) {
-            // catch
-            console.error(err);
-          } finally {
-            // finally
-            this.loading = false;
-          }
-        } else {
-          return false;
-        }
-      });
+    destroyed() {
     },
     },
-  },
-  created() {},
-  mounted() {},
-  destroyed() {},
-};
+  };
 </script>
 </script>
 <template>
 <template>
   <el-button
   <el-button

+ 7 - 3
src/views/purchase/apply/edit/index.vue

@@ -131,7 +131,8 @@
           const {
           const {
             recentlyPrice = "0",
             recentlyPrice = "0",
             isApprovalFirst = "N",
             isApprovalFirst = "N",
-            purchasequantity
+            purchasequantity,
+            recentlyPriceDate
           } = await fetchExist({puOrg, customer, supplier, materialCode, customerName: "",priceType: prop.row.priceType});
           } = await fetchExist({puOrg, customer, supplier, materialCode, customerName: "",priceType: prop.row.priceType});
           this.loading = false;
           this.loading = false;
           await this.onRowAdd(this.tabName, {
           await this.onRowAdd(this.tabName, {
@@ -147,6 +148,7 @@
             puUnitName: puUnitName,
             puUnitName: puUnitName,
             recentlyPrice,
             recentlyPrice,
             isApprovalFirst,
             isApprovalFirst,
+            recentlyPriceDate: recentlyPriceDate,
             yPurchaseQuantity: purchasequantity,
             yPurchaseQuantity: purchasequantity,
             tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
             tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
             createByName: createByName,
             createByName: createByName,
@@ -155,7 +157,7 @@
           });
           });
         }
         }
       },
       },
-      // 
+      //
       async changeCustomerName(prop) {
       async changeCustomerName(prop) {
         console.log("prop", prop)
         console.log("prop", prop)
         const {
         const {
@@ -168,11 +170,13 @@
         const {
         const {
           recentlyPrice,
           recentlyPrice,
           isApprovalFirst,
           isApprovalFirst,
-          purchasequantity
+          purchasequantity,
+          recentlyPriceDate
           } = await fetchExist({puOrg, supplier, materialCode: prop.row.materialCode, customer:prop.row.customer,customerName: prop.row.customerName, priceType: prop.row.priceType});
           } = await fetchExist({puOrg, supplier, materialCode: prop.row.materialCode, customer:prop.row.customer,customerName: prop.row.customerName, priceType: prop.row.priceType});
           prop.row.yPurchaseQuantity = purchasequantity
           prop.row.yPurchaseQuantity = purchasequantity
           prop.row.recentlyPrice = recentlyPrice
           prop.row.recentlyPrice = recentlyPrice
           prop.row.isApprovalFirst = isApprovalFirst
           prop.row.isApprovalFirst = isApprovalFirst
+          prop.row.recentlyPriceDate = recentlyPriceDate
       },
       },
       //
       //
       async fetchItem(prop) {
       async fetchItem(prop) {

+ 14 - 0
src/views/purchase/apply/index.vue

@@ -171,6 +171,10 @@
         this.upload.title = "文件导入"
         this.upload.title = "文件导入"
         this.upload.open = true
         this.upload.open = true
       },
       },
+      // 收回
+      reback(row) {
+        console.log(row)
+      },
     },
     },
   };
   };
 </script>
 </script>
@@ -257,6 +261,16 @@
       @row-select="useSelect"
       @row-select="useSelect"
       @pagination="useQuery(params, page)"
       @pagination="useQuery(params, page)"
     >
     >
+      <el-table-column
+        fixed="right"
+        label="操作"
+        align="center"
+        width="100"
+        >
+        <template slot-scope="scope">
+          <!-- <el-button type="text" size="mini" v-if="scope.row.status == '1' && scope.row.flowId" @click="reback(scope.row)">收回</el-button> -->
+        </template>
+      </el-table-column>
     </el-super-table>
     </el-super-table>
     <!-- 文件导入对话框 -->
     <!-- 文件导入对话框 -->
     <el-dialog title="文件导入" :visible.sync="upload.open" width="400px">
     <el-dialog title="文件导入" :visible.sync="upload.open" width="400px">