Răsfoiți Sursa

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

黄梓星 2 ani în urmă
părinte
comite
19ec643ff5

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

@@ -26,7 +26,7 @@ export const FormColumns = [
     require: true,
   },
   {
-    key: "supplierCode",
+    key: "supplier",
     title: "供应商编码",
     inputType: "Input",
     disabled: true,
@@ -46,7 +46,7 @@ export const FormColumns = [
     require: true,
   },
   {
-    key: "puOrgCode",
+    key: "puOrg",
     title: "采购组织编码",
     inputType: "Input",
     disabled: true,
@@ -65,7 +65,7 @@ export const FormColumns = [
     require: true,
   },
   {
-    key: "currencyCode",
+    key: "currency",
     title: "币种编码",
     inputType: "Input",
     disabled: true,
@@ -108,7 +108,7 @@ export const FormColumns = [
     require: true,
   },
   {
-    key: "puDeptCode",
+    key: "puDept",
     title: "采购部门编码",
     inputType: "Input",
     disabled: true,
@@ -411,7 +411,7 @@ export const TabColumns = [
           orgName: "name",
         },
       },
-      { title: "组织编码", key: "orgCode" },
+      { title: "组织编码", key: "org" },
       // { title: "组织ID", key: "org" },
       {
         title: "创建人名称",

+ 3 - 1
src/views/purchase/apply/add/index.vue

@@ -4,6 +4,7 @@ import useData from "../hooks/data";
 import useDicts from "../hooks/dicts";
 import useWatch from "../hooks/watch";
 import useMethods from "../hooks/function";
+import { initParams } from "@/utils/init";
 import { ITEM, SAVE } from "@/api/business/purchase/apply";
 const { watchPuOrgName } = useWatch();
 
@@ -85,7 +86,8 @@ export default {
     async useRowAdd(prop) {
       const {
         $notify,
-        params: { tabColumns, puOrgName, supplierName },
+        tabColumns,
+        params: { puOrgName, supplierName },
       } = this;
       if (!supplierName) {
         return $notify.info("请选择供应商");

+ 25 - 23
src/views/purchase/apply/delete/index.vue

@@ -11,30 +11,32 @@ export default {
   methods: {
     //
     open(prop) {
-      return this.$confirm("是否删除数据项?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "info",
-      })
-        .then(async () => {
-          try {
-            // try
-            const ids = prop.map((item) => item.id).join(",");
-            const { msg, code } = await REMOVE(ids);
-            if (code === 200) {
-              this.$emit("success");
-              this.$notify.success(msg);
-            }
-          } catch (err) {
-            // catch
-            console.error(err);
-          } finally {
-            // finally
-          }
+      return new Promise((resolve, reject) => {
+        this.$confirm("是否删除数据项?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "info",
         })
-        .catch((err) => {
-          console.error(err);
-        });
+          .then(async () => {
+            try {
+              // try
+              const ids = prop.map((item) => item.id).join(",");
+              const { msg, code } = await REMOVE(ids);
+              if (code === 200) {
+                resolve(true);
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              reject(false);
+              console.error(err);
+            } finally {
+              // finally
+            }
+          })
+          .catch(() => reject(false));
+      });
     },
   },
   created() {},

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

@@ -4,6 +4,7 @@ import useData from "../hooks/data";
 import useDicts from "../hooks/dicts";
 import useWatch from "../hooks/watch";
 import useMethods from "../hooks/function";
+import { initParams } from "@/utils/init";
 import { ITEM, SAVE } from "@/api/business/purchase/apply";
 const { watchPuOrgName, watchPriceApplyOrgs, watchPriceApplyItems } =
   useWatch();
@@ -92,7 +93,8 @@ export default {
     async useRowAdd(prop) {
       const {
         $notify,
-        params: { tabColumns, puOrgName, supplierName },
+        tabColumns,
+        params: { puOrgName, supplierName },
       } = this;
       if (!supplierName) {
         return $notify.info("请选择供应商");

+ 0 - 3
src/views/purchase/apply/see/index.vue

@@ -2,7 +2,6 @@
 import Column from "../add/column";
 import useData from "../hooks/data";
 import useDicts from "../hooks/dicts";
-import useMethods from "../hooks/function";
 import { ITEM } from "@/api/business/purchase/apply";
 
 export default {
@@ -49,8 +48,6 @@ export default {
     //
     async hide() {
       this.visible = false;
-      this.params = this.resetParams();
-      this.tabName = this.tabColumns[0].key;
     },
     //
     async useDelete(prop) {

+ 25 - 23
src/views/purchase/apply/submit/index.vue

@@ -11,30 +11,32 @@ export default {
   methods: {
     //
     open(prop) {
-      return this.$confirm("是否提交审核数据项?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "info",
-      })
-        .then(async () => {
-          try {
-            // try
-            const ids = prop.map((item) => item.id).join(",");
-            const { msg, code } = await SUBMIT(ids);
-            if (code === 200) {
-              this.$emit("success");
-              this.$notify.success(msg);
-            }
-          } catch (err) {
-            // catch
-            console.error(err);
-          } finally {
-            // finally
-          }
+      return new Promise((resolve, reject) => {
+        this.$confirm("是否提交审核数据项?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "info",
         })
-        .catch((err) => {
-          console.error(err);
-        });
+          .then(async () => {
+            try {
+              // try
+              const ids = prop.map((item) => item.id).join(",");
+              const { msg, code } = await SUBMIT(ids);
+              if (code === 200) {
+                resolve(true);
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              reject(false);
+              console.error(err);
+            } finally {
+              // finally
+            }
+          })
+          .catch(() => reject(false));
+      });
     },
   },
   created() {},

+ 25 - 23
src/views/purchase/catalogue/enable/index.vue

@@ -11,30 +11,32 @@ export default {
   methods: {
     //
     open(prop, status) {
-      return this.$confirm("是否启停数据项?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "info",
-      })
-        .then(async () => {
-          try {
-            // try
-            const ids = prop.map((item) => item.id);
-            const { msg, code } = await ENABLE({ ids, enableStatus: status });
-            if (code === 200) {
-              this.$emit("success");
-              this.$notify.success(msg);
-            }
-          } catch (err) {
-            // catch
-            console.error(err);
-          } finally {
-            // finally
-          }
+      return new Promise((resolve, reject) => {
+        this.$confirm("是否启停数据项?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "info",
         })
-        .catch((err) => {
-          console.error(err);
-        });
+          .then(async () => {
+            try {
+              // try
+              const ids = prop.map((item) => item.id);
+              const { msg, code } = await ENABLE({ ids, enableStatus: status });
+              if (code === 200) {
+                resolve(true);
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              reject(false);
+              console.error(err);
+            } finally {
+              // finally
+            }
+          })
+          .catch(() => reject(false));
+      });
     },
   },
   created() {},

+ 0 - 32
src/views/purchase/catalogue/hooks/function.js

@@ -1,32 +0,0 @@
-import { ITEM } from "@/api/business/purchase/catalogue";
-
-export default function useMethods() {
-  const fetchItem = async ({ _this, prop }) => {
-    try {
-      // try
-      _this.loading = true;
-      const { code, data } = await ITEM(prop);
-      if (code === 200) {
-        _this.params = data;
-      }
-    } catch (err) {
-      // catch
-      console.error(err);
-    } finally {
-      // finally
-      _this.loading = false;
-    }
-  };
-  const open = ({ _this }) => {
-    _this.visible = true;
-  };
-  const hide = ({ _this }) => {
-    _this.visible = false;
-  };
-
-  return {
-    open,
-    hide,
-    fetchItem,
-  };
-}

+ 25 - 23
src/views/purchase/catalogue/invalid/index.vue

@@ -11,30 +11,32 @@ export default {
   methods: {
     //
     open(prop) {
-      return this.$confirm("是否失效数据项?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "info",
-      })
-        .then(async () => {
-          try {
-            // try
-            const ids = prop.map((item) => item.id);
-            const { msg, code } = await INVALID({ ids });
-            if (code === 200) {
-              this.$emit("success");
-              this.$notify.success(msg);
-            }
-          } catch (err) {
-            // catch
-            console.error(err);
-          } finally {
-            // finally
-          }
+      return new Promise((resolve, reject) => {
+        this.$confirm("是否失效数据项?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "info",
         })
-        .catch((err) => {
-          console.error(err);
-        });
+          .then(async () => {
+            try {
+              // try
+              const ids = prop.map((item) => item.id);
+              const { msg, code } = await INVALID({ ids });
+              if (code === 200) {
+                resolve(true);
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              reject(false);
+              console.error(err);
+            } finally {
+              // finally
+            }
+          })
+          .catch(() => reject(false));
+      });
     },
   },
   created() {},

+ 47 - 31
src/views/purchase/catalogue/see/index.vue

@@ -2,7 +2,7 @@
 import Column from "../column";
 import useData from "../hooks/data";
 import useDicts from "../hooks/dicts";
-import useMethods from "../hooks/function";
+import { ITEM } from "@/api/business/purchase/catalogue";
 
 export default {
   name: "SeeDrawer",
@@ -15,44 +15,59 @@ export default {
     };
   },
   computed: {
-    hasPowerEnable: function () {
-      return this.$parent.$parent.hasPowerEnable;
-    },
-    hasPowerInvalid: function () {
-      return this.$parent.$parent.hasPowerInvalid;
+    root: function () {
+      return this.$parent.$parent;
     },
   },
   watch: {},
   methods: {
     //
+    async fetchItem(prop) {
+      try {
+        // try
+        this.loading = true;
+        const { code, data } = await ITEM(prop);
+        if (code === 200) {
+          this.params = data;
+          return true;
+        } else {
+          return false;
+        }
+      } catch (err) {
+        // catch
+        console.error(err);
+      } finally {
+        // finally
+        this.loading = false;
+      }
+    },
+    //
     async open(prop) {
-      const { open, fetchItem } = useMethods();
-      await open({ _this: this });
-      await fetchItem({ _this: this, prop });
+      this.visible = await this.fetchItem(prop);
     },
     //
     async hide() {
-      const { hide } = useMethods();
-      await hide({ _this: this });
+      this.visible = false;
     },
     //
     async useInvalid(prop) {
-      const { useInvalid } = this.$parent.$parent;
-      await useInvalid(prop).then(() => {
-        const [{ id }] = prop;
-        const { fetchItem } = useMethods();
-        fetchItem({ _this: this, prop: id });
-      });
+      await this.root
+        .useInvalid(prop)
+        .then(() => {
+          this.fetchItem(this.params.id);
+        })
+        .catch(() => {});
     },
     //
     async useEnable(prop) {
-      const [{ id, enableStatus }] = prop;
-      const { useEnable } = this.$parent.$parent;
+      const [{ enableStatus }] = prop;
       const status = enableStatus === "2" ? "0" : "2";
-      await useEnable(prop, status).then(() => {
-        const { fetchItem } = useMethods();
-        fetchItem({ _this: this, prop: id });
-      });
+      await this.root
+        .useEnable(prop, status)
+        .then(() => {
+          this.fetchItem(this.params.id);
+        })
+        .catch(() => {});
     },
   },
   created() {},
@@ -70,14 +85,8 @@ export default {
     <template slot="title">
       <span>{{ title }}</span>
       <span>
-        <el-button
-          :size="size"
-          circle
-          icon="el-icon-close"
-          @click="hide"
-        ></el-button>
         <el-tooltip
-          v-if="hasPowerInvalid([params])"
+          v-if="root.hasPowerInvalid([params])"
           effect="dark"
           content="失 效"
           placement="bottom-end"
@@ -90,7 +99,7 @@ export default {
           ></el-button>
         </el-tooltip>
         <el-tooltip
-          v-if="hasPowerEnable([params])"
+          v-if="root.hasPowerEnable([params])"
           effect="dark"
           :content="params.enableStatus === '2' ? '启 用' : '停 用'"
           placement="bottom-end"
@@ -102,6 +111,13 @@ export default {
             @click="useEnable([params])"
           ></el-button>
         </el-tooltip>
+        <el-button
+          :size="size"
+          circle
+          type="danger"
+          icon="el-icon-close"
+          @click="hide"
+        ></el-button>
       </span>
     </template>
     <el-descriptions :size="size" :column="column" border style="margin: 10px">

+ 25 - 21
src/views/purchase/task/close/index.vue

@@ -10,28 +10,32 @@ export default {
   methods: {
     //
     open(prop) {
-      this.$confirm("是否关闭数据项?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "info",
-      })
-        .then(async () => {
-          try {
-            this.loading = true;
-            const { demandItemId } = prop;
-            const { code } = await SHUTDOWN(demandItemId);
-            if (code === 200) {
-              this.$emit("success");
-            }
-          } catch (err) {
-            // catch
-          } finally {
-            // finally
-          }
+      return new Promise((resolve, reject) => {
+        this.$confirm("是否关闭数据项?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "info",
         })
-        .catch((err) => {
-          console.error(err);
-        });
+          .then(async () => {
+            try {
+              this.loading = true;
+              const { demandItemId } = prop;
+              const { code } = await SHUTDOWN(demandItemId);
+              if (code === 200) {
+                resolve(true);
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              reject(false);
+              console.error(err);
+            } finally {
+              // finally
+            }
+          })
+          .catch(() => reject(false));
+      });
     },
   },
   created() {},

+ 6 - 6
src/views/purchase/task/see/index.vue

@@ -21,11 +21,6 @@ export default {
   computed: {},
   watch: {},
   methods: {
-    //
-    open(prop) {
-      this.visible = true;
-      this.fetchItem(prop);
-    },
     // 查 询
     async fetchItem(prop) {
       try {
@@ -33,8 +28,9 @@ export default {
         const { code, data } = await ITEM(prop);
         if (code === 200) {
           this.params = data;
+          return true;
         } else {
-          this.$notify.warning({ title: msg });
+          return false;
         }
       } catch (err) {
         // catch
@@ -43,6 +39,10 @@ export default {
         this.loading = false;
       }
     },
+    //
+    open(prop) {
+      this.visible = this.fetchItem(prop);
+    },
   },
   created() {},
   mounted() {},