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

物料申请单,维护物料类别加入校验

黄梓星 2 жил өмнө
parent
commit
af5df2f085

BIN
src/assets/images/homePage.png


+ 1 - 1
src/views/material/changeApply/add.vue

@@ -10,7 +10,7 @@
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :span="8">
             <el-col :span="8">
-              <el-form-item label="申请组织" prop="orgId">
+              <el-form-item label="所属组织" prop="orgId">
                 <el-input disabled v-model="basicForm.orgId"></el-input>
                 <el-input disabled v-model="basicForm.orgId"></el-input>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>

+ 94 - 64
src/views/material/requisition/add.vue

@@ -446,7 +446,8 @@
           <el-row :gutter="20">
           <el-row :gutter="20">
             <el-col :span="8">
             <el-col :span="8">
               <el-form-item label="物料申请人" prop="proposerId">
               <el-form-item label="物料申请人" prop="proposerId">
-                <el-input :disabled="disable" v-model="basicForm.proposerId"></el-input>
+                <el-input disabled v-model="this.$store.state.user.nickName"></el-input>
+                <el-input v-show="false" v-model="basicForm.proposerId"></el-input>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :span="8">
             <el-col :span="8">
@@ -547,6 +548,42 @@
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
           </el-row>
           </el-row>
+          <el-row style="margin-bottom: 12px;">
+          <span>物料类别</span>
+          </el-row>
+          <el-row style="margin-bottom: 12px;">
+            <el-button :disabled="disable" type="primary" size="small" plain @click="addLine">新增</el-button>
+            <el-button :disabled="disable" type="primary" size="small" plain @click="handleDelete">删除</el-button>
+            <!-- <el-button :disabled="disable || isControl" type="primary" size="small" plain @click="testsave">暂存</el-button> -->
+          </el-row>
+          <el-row>
+            <el-col :span="12">
+              <el-table 
+              :data="sysMaterialMedcineItemApply"
+              class="request-table"
+              @selection-change="handleSelectionChange"
+              >
+                <el-table-column type="selection" width="55" />
+                <el-table-column label="物料类别ID" align="center" prop="sort">
+                  <template slot-scope="scope">
+                    <el-input readonly v-model="scope.row.drugId">
+                      <!-- <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="chooseDrug"></el-button> -->
+                    </el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column label="物料类别code" align="center" prop="medicineCode">
+                  <template slot-scope="scope">
+                    <el-input readonly v-model="scope.row.drugCode"></el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column label="物料类别名称" align="center" prop="medicineName">
+                  <template slot-scope="scope">
+                    <el-input readonly v-model="scope.row.drugName"></el-input>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </el-col>
+          </el-row>
         </el-form>
         </el-form>
         </div>
         </div>
       </el-tab-pane>
       </el-tab-pane>
@@ -650,42 +687,7 @@
             </el-col>
             </el-col>
           </el-row>
           </el-row>
         </el-form>
         </el-form>
-        <el-row style="margin-bottom: 12px;">
-          <span>物料类别</span>
-        </el-row>
-        <el-row style="margin-bottom: 12px;">
-          <el-button :disabled="disable || isControl" type="primary" size="small" plain @click="addLine">新增</el-button>
-          <el-button :disabled="disable || isControl" type="primary" size="small" plain @click="handleDelete">删除</el-button>
-          <!-- <el-button :disabled="disable || isControl" type="primary" size="small" plain @click="testsave">暂存</el-button> -->
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-table 
-            :data="sysMaterialMedcineItemApply"
-            class="request-table"
-            @selection-change="handleSelectionChange"
-            >
-              <el-table-column type="selection" width="55" />
-              <el-table-column label="物料类别ID" align="center" prop="sort">
-                <template slot-scope="scope">
-                  <el-input readonly v-model="scope.row.drugId">
-                    <!-- <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="chooseDrug"></el-button> -->
-                  </el-input>
-                </template>
-              </el-table-column>
-              <el-table-column label="物料类别code" align="center" prop="medicineCode">
-                <template slot-scope="scope">
-                  <el-input readonly v-model="scope.row.drugCode"></el-input>
-                </template>
-              </el-table-column>
-              <el-table-column label="物料类别名称" align="center" prop="medicineName">
-                <template slot-scope="scope">
-                  <el-input readonly v-model="scope.row.drugName"></el-input>
-                </template>
-              </el-table-column>
-            </el-table>
-          </el-col>
-        </el-row>
+
       </el-tab-pane>
       </el-tab-pane>
 
 
       <el-tab-pane label="单据信息" name="fourth">
       <el-tab-pane label="单据信息" name="fourth">
@@ -1080,6 +1082,7 @@ export default {
       // alert('详情页面:')
       // alert('详情页面:')
       console.log('页面状态',this.pageStu)
       console.log('页面状态',this.pageStu)
       console.log('数据', this.row)
       console.log('数据', this.row)
+      console.log('取VUEX里面的数据:', this.$store.state.user.name)
       this.getDetails(this.row)
       this.getDetails(this.row)
       // 生产厂家代理人用于回显
       // 生产厂家代理人用于回显
       if (this.row.manufacturerId) {
       if (this.row.manufacturerId) {
@@ -1306,61 +1309,88 @@ export default {
     },
     },
     save() {
     save() {
       if(this.pageStu == 'edit') {
       if(this.pageStu == 'edit') {
+        // 申请人取默认值 
+        this.basicForm.proposerId = this.$store.state.user.name
         let sparams = {...this.basicForm, ...{status: 0}}
         let sparams = {...this.basicForm, ...{status: 0}}
         sparams.sysMaterialMedcineApply = this.basicForm2
         sparams.sysMaterialMedcineApply = this.basicForm2
         sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
         sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
         console.log('提交参数', sparams)
         console.log('提交参数', sparams)
         this.$refs['basic'].validate((valid) => {
         this.$refs['basic'].validate((valid) => {
           if (valid) {
           if (valid) {
-            editReq(sparams).then(res => {
-              if(res.code === 200) {
-                this.$message({
-                  message: res.msg,
-                  type: 'success'
-                });
-                this.back()
-              }
-            })
+            if (this.sysMaterialMedcineItemApply.length !== 0) {
+              editReq(sparams).then(res => {
+                if(res.code === 200) {
+                  this.$message({
+                    message: res.msg,
+                    type: 'success'
+                  });
+                  this.back()
+                }
+              })
+            } else {
+              this.$message({
+                message: '请维护物料类别后再提交',
+                type: 'warning'
+              });
+            }
           }
           }
         })
         })
       } else {
       } else {
         // alert('保存传status:0')
         // alert('保存传status:0')
+        // 申请人取默认值 
+        this.basicForm.proposerId = this.$store.state.user.name
         let sparams = {...this.basicForm, ...{status: 0}}
         let sparams = {...this.basicForm, ...{status: 0}}
         sparams.sysMaterialMedcineApply = this.basicForm2
         sparams.sysMaterialMedcineApply = this.basicForm2
         sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
         sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
         console.log('保存参数', sparams)
         console.log('保存参数', sparams)
         this.$refs['basic'].validate((valid) => {
         this.$refs['basic'].validate((valid) => {
           if(valid) {
           if(valid) {
-            addReq(sparams).then(res => {
-              if(res.code === 200) {
-                this.$message({
-                  message: res.msg,
-                  type: 'success'
-                });
-                this.back()
-              }
-            })
+            if (this.sysMaterialMedcineItemApply.length !== 0) {
+              addReq(sparams).then(res => {
+                if(res.code === 200) {
+                  this.$message({
+                    message: res.msg,
+                    type: 'success'
+                  });
+                  this.back()
+                }
+              })
+            } else {
+              this.$message({
+                message: '请维护物料类别后再提交',
+                type: 'warning'
+              });
+            }
           }
           }
         })
         })
       }
       }
     },
     },
     submit() {
     submit() {
       // alert('提交传status:1')
       // alert('提交传status:1')
+      // 申请人取默认值 
+      this.basicForm.proposerId = this.$store.state.user.name
       let sparams = {...this.basicForm, ...{status: 1}}
       let sparams = {...this.basicForm, ...{status: 1}}
       sparams.sysMaterialMedcineApply = this.basicForm2
       sparams.sysMaterialMedcineApply = this.basicForm2
       sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
       sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
       console.log('提交参数', sparams)
       console.log('提交参数', sparams)
       this.$refs['basic'].validate((valid) => {
       this.$refs['basic'].validate((valid) => {
         if(valid) {
         if(valid) {
-          editReq(sparams).then(res => {
-            if(res.code === 200) {
-              this.$message({
-                message: res.msg,
-                type: 'success'
-              });
-              this.back()
-            }
-          })
+          if (this.sysMaterialMedcineItemApply.length !== 0) {
+            editReq(sparams).then(res => {
+              if(res.code === 200) {
+                this.$message({
+                  message: res.msg,
+                  type: 'success'
+                });
+                this.back()
+              }
+            })
+          } else {
+            this.$message({
+              message: '请维护物料类别后再提交',
+              type: 'warning'
+            }); 
+          }
         }
         }
       })
       })
     },
     },