002201 2 years ago
parent
commit
3e55e1069c

+ 2 - 2
src/views/purchase/apply/add/column.js

@@ -177,9 +177,9 @@ export const TabColumns = [
         referName: "MATERIAL_PARAM",
         dataMapping: {
           material: "id",
+          unit: "unitId",
           materialCode: "code",
           materialName: "name",
-          puUnit: "unitIdName",
           specification: "specification",
           manufacturer: "manufacturerIdName",
         },
@@ -204,7 +204,7 @@ export const TabColumns = [
         width: 200,
         referName: "UNIT_PARAM",
         dataMapping: {
-          puUnit: "name",
+          unit: "name",
         },
       },
       {

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

@@ -2,8 +2,9 @@
 import Column from "./column";
 import useData from "../hooks/data";
 import useDicts from "../hooks/dicts";
-import useTable from "../hooks/table-function";
 import useMethods from "../hooks/function";
+import useTable from "../hooks/table-function";
+import { SAVE } from "@/api/business/purchase/apply";
 
 export default {
   name: "AddDrawer",
@@ -30,14 +31,17 @@ export default {
     },
     //
     async open(prop) {
-      const { open, fetchItem } = useMethods();
-      await open({ _this: this });
-      if (prop) await fetchItem({ _this: this, prop });
+      this.visible = true;
+      this.tabName = this.tabColumns[0].key;
+      if (prop) {
+        const { fetchItem } = useMethods();
+        this.params = await fetchItem({ _this: this, prop });
+      }
     },
     //
     async hide() {
-      const { hide } = useMethods();
-      await hide({ _this: this });
+      this.visible = false;
+      this.params = this.resetParams();
     },
     //
     async useRowAdd(prop) {
@@ -51,8 +55,48 @@ export default {
     },
     //
     async useSubmit(prop) {
-      const { add } = useMethods();
-      await add({ _this: this, prop });
+      this.$refs[prop].validate(async (valid) => {
+        if (valid) {
+          try {
+            // try
+            const {
+              priceApplyOrgs: _priceApplyOrgs,
+              priceApplyItems: _priceApplyItems,
+            } = this.params;
+            const id = undefined;
+            const priceApplyOrgs = _priceApplyOrgs.map((item) => ({
+              ...item,
+              id: undefined,
+              applyId: undefined,
+            }));
+            const priceApplyItems = _priceApplyItems.map((item) => ({
+              ...item,
+              id: undefined,
+              applyId: undefined,
+            }));
+            const params = {
+              ...this.params,
+              id,
+              priceApplyOrgs,
+              priceApplyItems,
+            };
+            const { msg, code } = await SAVE(params);
+            if (code === 200) {
+              this.hide();
+              this.$emit("success");
+              this.$notify.success(msg);
+            }
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+            this.loading = false;
+          }
+        } else {
+          return false;
+        }
+      });
     },
   },
   created() {},

+ 1 - 1
src/views/purchase/apply/delete/index.vue

@@ -11,7 +11,7 @@ export default {
   methods: {
     //
     open(prop) {
-      this.$confirm("是否删除数据项?", "提示", {
+      return this.$confirm("是否删除数据项?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "info",

+ 30 - 8
src/views/purchase/apply/edit/index.vue

@@ -2,8 +2,9 @@
 import Column from "./column";
 import useData from "../hooks/data";
 import useDicts from "../hooks/dicts";
-import useTable from "../hooks/table-function";
 import useMethods from "../hooks/function";
+import useTable from "../hooks/table-function";
+import { SAVE } from "@/api/business/purchase/apply";
 
 export default {
   name: "EditDrawer",
@@ -46,14 +47,15 @@ export default {
     },
     //
     async open(prop) {
-      const { open, fetchItem } = useMethods();
-      await open({ _this: this });
-      if (prop) await fetchItem({ _this: this, prop });
+      this.visible = true;
+      this.tabName = this.tabColumns[0].key;
+      const { fetchItem } = useMethods();
+      this.params = await fetchItem({ _this: this, prop });
     },
     //
     async hide() {
-      const { hide } = useMethods();
-      await hide({ _this: this });
+      this.visible = false;
+      this.params = this.resetParams();
     },
     //
     async useRowAdd(prop) {
@@ -67,8 +69,28 @@ export default {
     },
     //
     async useSubmit(prop) {
-      const { edit } = useMethods();
-      await edit({ _this: this, prop });
+      this.$refs[prop].validate(async (valid) => {
+        if (valid) {
+          try {
+            // try
+            const params = { ...this.params };
+            const { msg, code } = await SAVE(params);
+            if (code === 200) {
+              this.hide();
+              this.$emit("success");
+              this.$notify.success(msg);
+            }
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+            this.loading = false;
+          }
+        } else {
+          return false;
+        }
+      });
     },
   },
   created() {},

+ 6 - 0
src/views/purchase/apply/hooks/data.js

@@ -13,6 +13,11 @@ export default function useData(prop) {
     priceApplyItems: [],
     ...initParams(FormColumns),
   };
+  const resetParams = () => ({
+    priceApplyOrgs: [],
+    priceApplyItems: [],
+    ...initParams(FormColumns),
+  });
   const tabColumns = TabColumns;
   const tabName = "priceApplyItems";
   return {
@@ -25,5 +30,6 @@ export default function useData(prop) {
     params,
     tabColumns,
     tabName,
+    resetParams,
   };
 }

+ 2 - 82
src/views/purchase/apply/hooks/function.js

@@ -1,6 +1,6 @@
 import { REFER } from "@/components/popover-select/api";
 import { EXIST } from "@/api/business/purchase/catalogue";
-import { SAVE, ITEM } from "@/api/business/purchase/apply";
+import {  ITEM } from "@/api/business/purchase/apply";
 
 export default function useMethods() {
   const fetchItem = async ({ _this, prop }) => {
@@ -9,7 +9,7 @@ export default function useMethods() {
       _this.loading = true;
       const { code, data } = await ITEM(prop);
       if (code === 200) {
-        _this.params = data;
+        return data;
       }
     } catch (err) {
       // catch
@@ -50,7 +50,6 @@ export default function useMethods() {
           source.recentlyPrice = recentlyPrice;
           source.isApprovalFirst = isApprovalFirst;
           source.isPriceAdjustment = isPriceAdjustment;
-// _this.$u
         }
       } catch (err) {
         // catch
@@ -61,87 +60,8 @@ export default function useMethods() {
       }
     }
   };
-  const open = ({ _this }) => {
-    _this.visible = true;
-    _this.tabName = _this.tabColumns[0].key;
-  };
-  const hide = ({ _this }) => {
-    _this.visible = false;
-  };
-  const add = ({ _this, prop }) => {
-    _this.$refs[prop].validate(async (valid) => {
-      if (valid) {
-        try {
-          // try
-          const {
-            priceApplyOrgs: _priceApplyOrgs,
-            priceApplyItems: _priceApplyItems,
-          } = _this.params;
-          const id = undefined;
-          const priceApplyOrgs = _priceApplyOrgs.map((item) => ({
-            ...item,
-            id: undefined,
-            applyId: undefined,
-          }));
-          const priceApplyItems = _priceApplyItems.map((item) => ({
-            ...item,
-            id: undefined,
-            applyId: undefined,
-          }));
-          const { msg, code } = await SAVE({
-            ..._this.params,
-            id,
-            priceApplyOrgs,
-            priceApplyItems,
-          });
-          if (code === 200) {
-            _this.hide();
-            _this.$emit("success");
-            _this.$notify.success(msg);
-          }
-        } catch (err) {
-          // catch
-          console.error(err);
-        } finally {
-          // finally
-          _this.loading = false;
-        }
-      } else {
-        return false;
-      }
-    });
-  };
-  const edit = ({ _this, prop }) => {
-    _this.$refs[prop].validate(async (valid) => {
-      if (valid) {
-        try {
-          // try
-          const { msg, code } = await SAVE({
-            ..._this.params,
-          });
-          if (code === 200) {
-            _this.hide();
-            _this.$emit("success");
-            _this.$notify.success(msg);
-          }
-        } catch (err) {
-          // catch
-          console.error(err);
-        } finally {
-          // finally
-          _this.loading = false;
-        }
-      } else {
-        return false;
-      }
-    });
-  };
 
   return {
-    open,
-    hide,
-    add,
-    edit,
     fetchItem,
     fetchRefer,
   };

+ 23 - 6
src/views/purchase/apply/see/index.vue

@@ -26,19 +26,23 @@ export default {
   methods: {
     //
     async open(prop) {
-      const { open, fetchItem } = useMethods();
-      await open({ _this: this });
-      await fetchItem({ _this: this, prop });
+      this.visible = true;
+      this.tabName = this.tabColumns[0].key;
+      const { fetchItem } = useMethods();
+      this.params = await fetchItem({ _this: this, prop });
     },
     //
     async hide() {
-      const { hide } = useMethods();
-      await hide({ _this: this });
+      this.visible = false;
+    },
+    //
+    async useDelete(prop) {
+      const { useDelete } = this.$parent.$parent;
+      await useDelete(prop).then(() => this.hide());
     },
     //
     async useCopy(prop) {
       const { useCopy } = this.$parent.$parent;
-      await this.hide();
       await useCopy(prop);
     },
     //
@@ -80,6 +84,19 @@ export default {
         <el-tooltip
           class="item"
           effect="dark"
+          content="删 除"
+          placement="bottom-end"
+        >
+          <el-button
+            :size="size"
+            circle
+            icon="el-icon-delete"
+            @click="useDelete([params])"
+          ></el-button>
+        </el-tooltip>
+        <el-tooltip
+          class="item"
+          effect="dark"
           content="复 制"
           placement="bottom-end"
         >

+ 8 - 1
src/views/purchase/catalogue/column.js

@@ -106,7 +106,14 @@ export const SearchColumns = [
     },
   },
   { key: "source", title: "来源单据编号", inputType: "Input" },
-  { key: "material", title: "物料编码", inputType: "Input" },
+  {
+    key: "material",
+    title: "物料编码",
+    inputType: "PopoverSelect",
+    width: 200,
+    referName: "MATERIAL_PARAM",
+    valueKey: "code",
+  },
   {
     key: "status",
     title: "有效状态",

+ 0 - 4
src/views/purchase/contract/add/column.js

@@ -426,7 +426,6 @@ export const TabColumns = [
           customerName: "name",
         },
       },
-      { title: "备注", key: "remark", inputType: "Input", width: 200 },
     ],
   },
   {
@@ -438,7 +437,6 @@ export const TabColumns = [
       { title: "条款内容", key: "content", inputType: "Input" },
       { title: "变量序号", key: "variableRowno" },
       { title: "变量内容", key: "variableContent", inputType: "Input" },
-      { title: "备注", key: "remark", inputType: "Input" },
     ],
   },
   {
@@ -453,7 +451,6 @@ export const TabColumns = [
         inputType: "InputNumber",
         width: 200,
       },
-      { title: "备注", key: "remark", inputType: "Input" },
     ],
   },
   {
@@ -500,7 +497,6 @@ export const TabColumns = [
           paymentMeans: "name",
         },
       },
-      { title: "备注", key: "remark", inputType: "Input", width: 200 },
       {
         title: "需进度确认",
         key: "schedule",

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

@@ -36,7 +36,7 @@ export const TableColumns = [
   },
   // { key: "currency", title: "币种" },
   { key: "currencyName", title: "币种" },
-  { key: "billYpe", title: "交易类型" },
+  // { key: "billYpe", title: "交易类型" },
   { key: "source", title: "需求来源" },
   // { key: "customer", title: "收货客户" },
   { key: "customerName", title: "收货客户" },

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

@@ -65,7 +65,7 @@ export default {
         if (code === 200) {
           this.hide();
           this.$emit("success");
-          this.$notify.success({ title: msg, duration: 0 });
+          this.$notify.success({ title: msg, duration: 3000 });
         }
       } catch (err) {
         // catch