Parcourir la source

物料变更单-新增保存并提交功能

002390 il y a 1 an
Parent
commit
b5bca5b66b

+ 9 - 0
src/api/changeApply/basic.js

@@ -123,3 +123,12 @@ export function importInner(data) {
     data: data
   })
 }
+
+// 保存并提交
+export function saveAndSubmit(data) {
+  return request({
+    url: `/material/change/saveAndSubmit`,
+    method: 'post',
+    data: data,
+  })
+}

+ 3 - 1
src/api/material/basic.js

@@ -441,6 +441,8 @@ export function exportMartial(data) {
     responseType: 'blob'
   })
 }
+
+
 export default {
   // 查询
   materialList,
@@ -496,5 +498,5 @@ export default {
   saveVersions,
 
   //导出
-  exportMartial
+  exportMartial,
 }

+ 76 - 2
src/views/material/changeApply/add/index.vue

@@ -7,6 +7,7 @@ import {
   getChangeDetails,
   editChangeList,
   importInner,
+  saveAndSubmit,
 } from "@/api/changeApply/basic";
 
 export default {
@@ -203,7 +204,7 @@ export default {
       });
     },
     //
-    async useSubmit(prop) {
+    async useSave(prop) {
       let params = _.cloneDeep(this.params);
 
       this.handleSubmitValidate(prop, async () => {
@@ -225,6 +226,72 @@ export default {
         // await;
       });
     },
+    // 保存并提交
+    async useSubmit(prop) {
+      let params = _.cloneDeep(this.params);
+      console.log(params, "params");
+      this.handleSubmitValidate(prop, async () => {
+        try {
+          this.loading = true;
+          const { code, msg } = await saveAndSubmit({
+            ...params,
+            isInventory: "Y",
+          });
+
+          if (code == 200) {
+            this.hide();
+            this.$notify.success({
+              title: msg,
+            });
+          } else if (code == 10000) {
+            this.$alert(
+              "<div style='overflow: auto;overflow-x: hidden;max-height: 65vh;padding: 10px 20px 0;'>" +
+                msg +
+                "</div>",
+              "提示",
+              {
+                showCancelButton: true,
+                dangerouslyUseHTMLString: true,
+                confirmButtonText: "确认",
+                cancelButtonText: "取消",
+                beforeClose: async (action, instance, done) => {
+                  if (action === "confirm") {
+                    instance.confirmButtonLoading = true;
+                    instance.confirmButtonText = "执行中...";
+                    try {
+                      const { code, msg } = await saveAndSubmit({
+                        ...params,
+                        isInventory: "N",
+                      });
+                      if (code == 200) {
+                        done();
+                        this.hide();
+                        this.$notify.success({
+                          message: msg,
+                        });
+                      }
+                    } catch (error) {
+                      instance.confirmButtonText = "确认";
+                    } finally {
+                      instance.confirmButtonLoading = false;
+                    }
+                  } else {
+                    done();
+                    this.$notify.warning({
+                      message:
+                        "不允许修改【批号及库存状态管理】或【是否序列号管理】",
+                    });
+                  }
+                },
+              }
+            );
+          }
+        } catch (error) {
+        } finally {
+          this.loading = false;
+        }
+      });
+    },
 
     async handelImport(fileList) {
       try {
@@ -325,8 +392,15 @@ export default {
           type="primary"
           :size="$attrs.size"
           :loading="loading"
+          @click="useSave('superForm')"
+          >保 存</el-button
+        >
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
           @click="useSubmit('superForm')"
-          >确 认</el-button
+          >保存并提交</el-button
         >
         <el-button :size="$attrs.size" :loading="loading" @click="hide"
           >取 消</el-button

+ 1 - 1
src/views/material/changeApply/columns.js

@@ -19,7 +19,7 @@ export default function useColumns() {
     //   item: { key: "materialName", title: "物料名称" },
     //   attr: {},
     // },
-    { item: { key: "approverName", title: "最后审批人" }, attr: {} },
+    { item: { key: "approverName", title: "最后审批人",width:150, }, attr: {} },
     { item: { key: "approvalTime", title: "最后审核时间" }, attr: {} },
     { item: { key: "createByName", title: "创建人" ,width:150, }, attr: {} },
     { item: { key: "createTime", title: "创建时间" }, attr: {} },

+ 2 - 2
vue.config.js

@@ -37,7 +37,7 @@ module.exports = {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
         // target: `http://172.16.100.107:8080/drp-admin`, //测试
-        target: `http://test-sy.derom.com/drp-admin`, //测试
+        // target: `http://test-sy.derom.com/drp-admin`, //测试
         // target: `http://release-sy.derom.com/drp-admin`, //预发
         // target: `http://sy.derom.com/drp-admin`, //生产
         // target: `http://172.16.63.202:8000/drp-admin`, // D本地
@@ -45,7 +45,7 @@ module.exports = {
         // target: `http://172.16.13.152:8000/drp-admin`, //豪哥本地
         // target: `http://172.16.13.47:8000/drp-admin`, //这是一个美女的本地
         // target: `http://172.16.13.21:8000/drp-admin`, //CKF本地
-        // target: `http://172.16.61.99:8000/drp-admin`, //lz's localhost
+        target: `http://172.16.61.99:8000/drp-admin`, //lz's localhost
         //  target: `http://127.0.0.1:8000/drp-admin`,
         changeOrigin: true,
         pathRewrite: {