Browse Source

编码器-增加计量单位组/对计量单位进行限制

jingbb 7 months ago
parent
commit
16816a0351

+ 5 - 4
src/views/production/Popup/unitPopup.vue

@@ -138,9 +138,10 @@
                     this.handleCancel()
                 }
             },
-            getData(data){
+            getData(data,code){
                 this.loading = true 
                 this.queryParam.Org = data
+                this.queryParam.UOMClass = code
                 this.selectedRowKeys = []
                 this.selectedRows = []
                 getAction('/production/safetyStock/selectUnit',this.queryParam).then(res=>{
@@ -161,17 +162,17 @@
             },
             searchQuery(){
                 this.queryParam.pageNo = 1
-                this.getData(this.queryParam.Org)
+                this.getData(this.queryParam.Org,this.queryParam.UOMClass)
             },
             searchReset(){
                 this.queryParam.name = ''
                 this.queryParam.code = ''
-                this.getData(this.queryParam.Org)
+                this.getData(this.queryParam.Org,this.queryParam.UOMClass)
             },
             handleTableChange(pagination, filters, sorter) {
                 this.queryParam.pageNo = pagination.current
                 this.queryParam.pageSize = pagination.pageSize
-                this.getData()
+                this.getData(this.queryParam.Org,this.queryParam.UOMClass)
             },
             onSelectChange(selectedRowKeys, selectionRows) {
               this.selectedRowKeys = selectedRowKeys;

+ 3 - 1
src/views/production/safetyStock/encoderList.vue

@@ -310,7 +310,8 @@
             addList(){
                 this.$refs.AddEncoder.visible = true
                 this.$refs.AddEncoder.defaultMethod='add'
-                this.$refs.AddEncoder.getOptionUnit()
+                // this.$refs.AddEncoder.getOptionUnit()
+                this.$refs.AddEncoder.getOptionUnitArr()
             },
             //编辑
             editList(){
@@ -328,6 +329,7 @@
                 this.$refs.AddEncoder.visible=true
                 this.$refs.AddEncoder.defaultMethod='edit'
                 this.$refs.AddEncoder.getEditData(this.selectedRowKeys[0])
+                this.$refs.AddEncoder.getOptionUnitArr()
               }
             },
             handleUploadChange({ file, fileList }){

+ 49 - 16
src/views/production/safetyStock/modules/AddEncoder.vue

@@ -30,6 +30,13 @@
                       </a-select>
                   </a-form-model-item>
                 </a-col>
+                <a-col :md="8" :sm="24" >
+                  <a-form-model-item label="计量单位组" prop='uomName' >
+                     <a-select style="width:100%;"  v-model="form.uomName" @change="changeUnitArr">
+                          <a-select-option v-for="(val,index) in unitArrOptions" allowClear :key="index" :value="val.name">{{ val.name }}</a-select-option>
+                      </a-select>
+                  </a-form-model-item>
+                </a-col>
                 <a-col :md="8" :sm="24" >
                   <a-form-model-item label="料品主单位" prop='unit' >
                     <a-input-search placeholder="请输入" readonly v-model="form.unit" @search="searchUnit('unit')"></a-input-search>
@@ -101,7 +108,8 @@
             form:{},
             loading:false,
             defaultMethod:'add',
-            unitOptions:[],
+            // unitOptions:[],
+            unitArrOptions:[],
             rules:{
               inventoryName: [
                 { required: true, trigger: 'blur' },
@@ -138,11 +146,21 @@
                 this.form = {}
                 this.visible=false
                 this.defaultMethod='add'
+                this.unitArrOptions = []
             },
-            getOptionUnit(){
-                getAction('/production/safetyStock/selectUnit').then((res) => {
+            // getOptionUnit(){
+            //     getAction('/production/safetyStock/selectUnit').then((res) => {
+            //       if (res.success) {
+            //        this.unitOptions = res.result
+            //       } else {
+            //         this.$message.error(res.message);
+            //       }
+            //     })
+            // },
+            getOptionUnitArr(){
+              getAction('/production/safetyStock/selectEnumValue').then((res) => {
                   if (res.success) {
-                   this.unitOptions = res.result
+                   this.unitArrOptions = res.result
                   } else {
                     this.$message.error(res.message);
                   }
@@ -213,14 +231,29 @@
                 this.$refs.ClassNamePopup.getData()
             },
             searchUnit(data){
+              if(this.form.uomCode==''||!this.form.uomCode){
+                this.$message.warning("请先选择计量单位组")
+              }else{
                 this.$refs.unitPopup.visible = true
-                this.$refs.unitPopup.getData()
+                this.$refs.unitPopup.getData('',this.form.uomCode)
                 this.$refs.unitPopup.whatUnit = data
+              }
             },
-            changeUnit(data){
-                this.unitOptions.map(item=>{
-                    if(item.Name==data){
-                        this.form.unitId = item.ID
+            // changeUnit(data){
+            //     this.unitOptions.map(item=>{
+            //         if(item.Name==data){
+            //             this.form.unitId = item.ID
+            //         }
+            //     })
+            // },
+            changeUnitArr(data){
+              this.unitArrOptions.map(item=>{
+                    if(item.name==data){
+                        this.form.uomCode = item.code
+                        this.form.unit=''
+                        this.form.unitId=''
+                        this.form.auxiliaryUnit=''
+                        this.form.auxiliaryUnitId=''
                     }
                 })
             },
@@ -233,13 +266,13 @@
                 this.rules.rate[0].required = false
               }
             },
-            changeAuxiliaryUnit(data){
-                this.unitOptions.map(item=>{
-                    if(item.Name==data){
-                        this.form.auxiliaryUnitId = item.ID
-                    }
-                })
-            }
+            // changeAuxiliaryUnit(data){
+            //     this.unitOptions.map(item=>{
+            //         if(item.Name==data){
+            //             this.form.auxiliaryUnitId = item.ID
+            //         }
+            //     })
+            // }
 
         }
       }