浏览代码

货代10.9

caojunjie 1 年之前
父节点
当前提交
cbbb47a501

+ 8 - 4
src/components/iosbasic-data/searchquery.vue

@@ -40,7 +40,7 @@
              </div>
             <span slot="footer" class="dialog-footer">
                 <el-button @click="corpVisible = false">取 消</el-button>
-                <el-button type="primary" >确 定</el-button>
+                <el-button type="primary" @click="confirm">确 定</el-button>
             </span>
         </el-dialog>
     </div>
@@ -103,8 +103,8 @@
         },
         methods:{
             // 下拉change
-            corpChange(row) {
-                console.log(row,100)
+            corpChange(value) {
+                this.$emit('corpChange',value)
             },
             /* 远程模糊查询操作用户 */
             remoteMethod(name) {
@@ -118,7 +118,11 @@
             refreshData(){
                 this.$emit('remoteMethod')
             },
-
+            // 弹窗确认事件
+            confirm(){
+                this.corpVisible = false
+                // this.$emit('')
+            },
 
         }
     }

+ 23 - 9
src/views/iosBasicData/bcommodity/index.vue

@@ -38,18 +38,15 @@
       </template>
 
         <template slot="unitNoForm">
-            <search-query :datalist="unitNoData"
+            <search-query ref="SearchQuery"
+                          :datalist="unitNoData"
                           title="计量单位"
                           :filterable="true"
                           :clearable="true"
                           :remote="true"
-                          :forParameter="{
-                              key:'id',
-                              label:'cnName',
-                              value:'id'
-                          }"
-                          @remoteMethod="getBunitsListfun" >
-                <bunits></bunits>
+                          :forParameter="{key:'id',label:'cnName',value:'cnName'}"
+                          @remoteMethod="getBunitsListfun" @corpChange="corpChange" >
+                <bunits @selectionChange="selectionBunits"></bunits>
             </search-query>
         </template>
 
@@ -256,11 +253,23 @@
     methods: {
         // 获取计算单位数据
         getBunitsListfun(cnName){
-            console.log(cnName)
             getBunitsList(1, 10,{cnName}).then(res=>{
                 this.unitNoData = res.data.data.records
             })
         },
+        // 计量单位选中的回调
+        corpChange(value){
+            this.form.unitNo = value
+            // for(let item of this.unitNoData) {
+            //     if (item.id == value) {
+            //         this.form.unitNo = item.cnName
+            //     }
+            // }
+        },
+        // 表格组件抛出的选择数据
+        selectionBunits(list){
+            console.log(list,271)
+        },
       rowSave(row, done, loading) {
         bcommoditySubmit(row).then(() => {
           this.onLoad(this.page);
@@ -330,6 +339,11 @@
         if (["edit", "view"].includes(type)) {
           bcommodityDetail(this.form.id).then(res => {
             this.form = res.data.data;
+            // 获取插槽数据
+            this.$nextTick(()=>{
+               console.log(this.$refs.SearchQuery.selectValue)
+               this.$refs.SearchQuery.selectValue = this.form.unitNo
+            })
           });
         }
         done();

+ 2 - 0
src/views/iosBasicData/bunits/index.vue

@@ -363,6 +363,8 @@
       },
       selectionChange(list) {
         this.selectionList = list;
+        // 选择的数据抛出
+        this.$emit('selectionChange',list)
       },
       selectionClear() {
         this.selectionList = [];