소스 검색

物料申请单-保存并提交功能

002390 1 년 전
부모
커밋
1fc6eb6a8c
2개의 변경된 파일71개의 추가작업 그리고 5개의 파일을 삭제
  1. 9 0
      src/api/requisition/basic.js
  2. 62 5
      src/views/material/requisition/add.vue

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

@@ -167,4 +167,13 @@ export function oaBack(data) {
     method: "POST",
     data: data,
   });
+}
+
+//收回
+export function saveAndToOa(data) {
+  return request({
+    url: `/system/apply/material/saveAndToOa`,
+    method: "POST",
+    data: data,
+  });
 }

+ 62 - 5
src/views/material/requisition/add.vue

@@ -3,17 +3,28 @@
 
     <el-row type="flex" justify="end" style="margin-bottom: 16px;">
       <el-col :span="1.5">
-        <el-button type="primary" :size="size" plain @click="save"
-                   v-if="pageStu == 'add' || pageStu == 'edit' || pageStu ==='copy' ">保存
+        <el-button
+          v-if="pageStu == 'add' || pageStu == 'edit' || pageStu ==='copy' "
+          type="primary" 
+          :size="size" 
+          @click="save"
+        >保存
+        </el-button>
+        <el-button 
+          v-if="pageStu == 'add' || pageStu ==='copy' || (pageStu == 'edit' && (row.status == '0' || row.status == '3')) "
+          type="primary" 
+          :size="size" 
+          @click="saveAndSubmit"
+        >保存并提交
         </el-button>
       </el-col>
       <el-col :span="1.5" style="margin: 0 10px;">
-        <el-button type="primary" :size="size" plain @click="submit"
+        <el-button type="primary" :size="size" @click="submit"
                    v-if="pageStu == 'check' && (row.status == '0' || row.status == '3')">提交
         </el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button type="primary" :size="size" plain @click="back">返回</el-button>
+        <el-button :size="size" @click="back">返回</el-button>
       </el-col>
     </el-row>
     
@@ -715,7 +726,7 @@
 
   import midpack from '@/components/PopDialog/midPack.vue'
 
-  import {addReq, getReqDetail, editReq} from '@/api/requisition/basic'
+  import {addReq, getReqDetail, editReq,saveAndToOa} from '@/api/requisition/basic'
   // 调用物料分类详情接口用于数据回显
   import {getDetail} from '@/api/classify/basic';
   // 生产厂商/代理人调用用于回显
@@ -1452,6 +1463,52 @@
           // })
         }
       },
+      // 保存并提交
+      saveAndSubmit(){
+
+        if (!this.basicForm.proposerId) {
+            this.basicForm.proposerId = this.$store.state.user.name
+          }
+          // let sparams = {...this.basicForm, ...{status: 0}}
+          let sparams = {...this.basicForm}
+          sparams.sysMaterialMedcineApply = this.basicForm2;
+          sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply;
+          console.log('保存并提交', sparams)
+
+          const form1 = new Promise((resolve, reject) => {
+            this.$refs['basic'].validate(valid => {
+              if (valid) resolve()
+            })
+          })
+          const form2 = new Promise((resolve, reject) => {
+            this.$refs['basic2'].validate(valid => {
+              if (valid) resolve()
+            })
+          })
+
+          // Promise.all([form1, form2]).then(() => {
+            if (this.basicForm.isMedicine == '0' 
+                && this.sysMaterialMedcineItemApply.length == 0 
+                // && this.basicForm.oneClass !== "资产费用&7"
+                ) {
+              this.$modal.notifyWarning("医药物料需要维护物料类别!");
+
+            } else {
+              this.$modal.loading("保存中...");
+              saveAndToOa(sparams).then(res => {
+                if (res.code === 200) {
+                  this.$message({
+                    message: res.msg,
+                    type: 'success'
+                  });
+                  this.$modal.closeLoading();
+                  this.back()
+                }
+              }).catch(err => {
+                this.$modal.closeLoading();
+              })
+            }
+      },
       submit() {
         // alert('提交传status:1')
         if (!this.basicForm.proposerId) {