ymy 2 år sedan
förälder
incheckning
45cc0d7527

+ 8 - 2
src/benyun/compVue/ModuleViewHandle.ts

@@ -25,8 +25,14 @@ export default class ModuleViewHandle extends VueViews{
 
   //获取查询值
   getQuery(){
-    let query:any = (this.$refs[this.searchID] as any).getValue();
-    const page:any = (this.$refs[this.tableID] as any).getPage();
+    let query:any = {};
+    let page:any = {};
+    if(this.$refs[this.searchID]){
+      query = (this.$refs[this.searchID] as any).getValue();
+    }
+    if(this.$refs[this.tableID]){
+      page = (this.$refs[this.tableID] as any).getPage();
+    }
     query.pageNo = page.pageNo;
     query.pageSize = page.pageSize;
     return query;

+ 11 - 0
src/benyun/components/byDialog/byDialog.vue

@@ -0,0 +1,11 @@
+<template>
+  <div></div>
+</template>
+
+<script lang="ts">
+
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 6 - 5
src/benyun/components/byTable/byTable.vue

@@ -3,7 +3,6 @@
     <vxe-table
       ref="table"
       :data="value"
-      row-id="key_Id"
       :size="attrs.size?attrs.size:'small'"
       resizable
       :height="attrs.height"
@@ -121,6 +120,7 @@ interface Page{
 @Component
 export default class ByTable extends VueViews {
   value:Array<any>=[];
+  key_id="_X_ROW_KEY"
   page = {
     pageNo: 1, //当前页
     pageSize: 20, //每页条数
@@ -181,8 +181,9 @@ export default class ByTable extends VueViews {
   //操作列点击操作
   pluginClick(config:any,row:any){
     if(config?.event?.click){
-      delete row.key_Id;
-      config.event.click(row)
+      let data = (this as any).$lodash.cloneDeep(row)
+      delete data[this.key_id];
+      config.event.click(data)
     }
   }
 
@@ -198,7 +199,7 @@ export default class ByTable extends VueViews {
       }
     }
     for(let item of data){
-      delete item.key_Id;
+      delete item[this.key_id];
     }
     return data
   }
@@ -210,7 +211,7 @@ export default class ByTable extends VueViews {
   getValue(){
     let d = (this as any).$lodash.cloneDeep(this.value);
     for(let item of d){
-      delete item.key_Id;
+      delete item[this.key_id];
     }
     return d;
   }

+ 35 - 21
src/components/productDialog/productDialog.vue

@@ -1,5 +1,5 @@
 <template>
-  <vxe-modal v-model="value" id="myModa" :width="width?width+'px':'80%'" @show="show" :height="height?height+'px':'80%'" min-width="500" min-height="400" 
+  <vxe-modal v-model="value" id="productDialogModal" :width="width?width+'px':'80%'" @show="show" :height="height?height+'px':'80%'" min-width="500" min-height="400" 
   show-zoom resize transfer show-footer  @confirm="confirm">
     <template #title>
       <span>选择商品</span>
@@ -38,6 +38,7 @@ export default class ProductDialog extends Vue {
           component:'by-input',
           compConfig:{
             attr:{
+              clearable:true,
               placeholder:'请输入名称'
             }
           }
@@ -48,6 +49,7 @@ export default class ProductDialog extends Vue {
           component:'by-input',
           compConfig:{
             attr:{
+              clearable:true,
               placeholder:'请输入简称'
             } 
           }
@@ -58,6 +60,7 @@ export default class ProductDialog extends Vue {
           component:'by-input',
           compConfig:{
             attr:{
+              clearable:true,
               placeholder:'请输入财务编号'
             }
           }
@@ -68,6 +71,7 @@ export default class ProductDialog extends Vue {
           component:'by-input',
           compConfig:{
             attr:{
+              clearable:true,
               placeholder:'请输入国际码'
             }
           }
@@ -79,41 +83,50 @@ export default class ProductDialog extends Vue {
           component:'by-input',
           compConfig:{
             attr:{
+              clearable:true,
               placeholder:'请输入单位'
             }
           }
         },{
           span:6,
-          label:'保质期(天)',
-          prop:'shelf_life',
-          component:'by-input',
-          compConfig:{
-            attr:{
-              placeholder:'请输入保质期'
-            }
-          }
-        },{
-          span:6,
-          label:'库存',
-          prop:'stock',
-          component:'by-input',
+          label:'品牌',
+          prop:'brand_id',
+          component:'by-select',
           compConfig:{
             attr:{
-              placeholder:'请输入库存'
+              label:'name',
+              value:'id',
+              placeholder:'请选择品牌',
+              clearable:true
+            },
+            request:{
+              url:'/maindata/maindataMaterialBrand/page',
+              method:'get',
+              params:{
+                pageNo:1,
+                pageSize:1000
+              }
             }
           }
         },{
           span:6,
-          label:'品牌',
-          prop:'brand_id',
+          label:'分类',
+          prop:'categoryId',
           component:'by-select',
           compConfig:{
             attr:{
               label:'name',
               value:'id',
-              placeholder:'请选择品牌',
-              clearable:true,
-              data:this.getBrandData()
+              placeholder:'请选择分类',
+              clearable:true
+            },
+            request:{
+              url:'/maindata/maindataMaterialCategory/page',
+              method:'get',
+              params:{
+                pageNo:1,
+                pageSize:1000
+              }
             }
           }
         }]
@@ -187,7 +200,7 @@ export default class ProductDialog extends Vue {
   }
 
   created(){
-    this.getBrand()
+    // this.getBrand()
   }
   mounted(){}
   //获取品牌数据
@@ -216,6 +229,7 @@ export default class ProductDialog extends Vue {
     if(this.$refs.view){
       data = (this.$refs.view as any).getSelectData()
     }
+    console.log(data);
     return data;
   }
   //显示弹窗

+ 80 - 5
src/components/productStore/productStore.vue

@@ -1,9 +1,22 @@
 <template>
-  <div class="input-number">
-    <el-input-number v-model="num" @change="handleChange" :min="1" size="small"></el-input-number>
-    <siv class="icon" title="库存信息">
-      <i class="el-icon-question"></i>
-    </siv>
+  <div class="productStore">
+    <div class="input-number">
+      <el-input-number v-model="num" @change="handleChange" :min="1" size="small"></el-input-number>
+      <el-tooltip class="item" effect="dark" content="库存信息" placement="bottom-start">
+        <div class="icon" @click="value = true">
+          <i class="el-icon-question"></i>
+        </div>
+      </el-tooltip>
+    </div>
+    <vxe-modal v-model="value" id="productStoreModal" width="80%" height="80%"  @show="show" min-width="460" min-height="320" 
+    show-zoom resize transfer show-footer>
+      <template #title>
+        <span>查看库存</span>
+      </template>
+      <template #default>
+        <module-view :propConfig="config" ref="view" @pagination="getList" />
+      </template>
+    </vxe-modal>
   </div>
 </template>
 
@@ -12,6 +25,65 @@ import { Component, Prop, Vue, Watch } from "vue-property-decorator";
 @Component
 export default class ProductStore extends Vue {
   num:number=1;
+  value=false
+  time:any;
+  timeNum = 0;
+  data:Array<any>=[]
+  config:any={
+    table:{
+      attr:{
+        size:'mini',
+        seq:true,
+        align:'center',
+        checkbox:true
+      },
+      columns:[{
+        title:'名称',
+        field:'name'
+      },{
+        title:'坐标',
+        field:'coordinate'
+      },{
+        title:'地址',
+        field:'address'
+      }]
+    }
+  }
+  //显示弹窗
+  show(){
+    if(this.data.length ==0){
+      this.time =setInterval(()=>{
+        this.getList()
+      },500) 
+    }
+  }
+  getList(){
+    if(!this.$refs.view){
+      if(this.timeNum > 5){
+        clearInterval(this.time)
+      }
+      this.timeNum ++;
+      return
+    }
+    clearInterval(this.time)
+    let query = (this.$refs.view as any).getQuery();
+    (this as any).$request({
+      url: '/maindata/maindataStorehouse/page',
+      method: 'get',
+      params:query
+    }).then((res:any) => {
+      if(res.data.records){
+        (this.$refs.view as any).setTableValue(res.data.records);
+        this.data = res.data.records;
+        let page={
+          pageNo: res.data.current, //当前页
+          pageSize: res.data.size, //每页条数
+          total: res.data.total //总条数
+        };
+        (this.$refs.view as any).setPage(page)
+      }
+    })
+  }
   handleChange(v:number){
 
   }
@@ -26,5 +98,8 @@ export default class ProductStore extends Vue {
     cursor: pointer;
     margin-left: 8px;
   }
+  .el-icon-question{
+    color: #666;
+  }
 }
 </style>

+ 4 - 7
src/components/warehouseDialog/warehouseDialog.vue

@@ -1,5 +1,5 @@
 <template>
-  <vxe-modal v-model="value" id="myModa" :width="width?width+'px':'80%'" :height="height?height+'px':'80%'"  @show="show" min-width="460" min-height="320" 
+  <vxe-modal v-model="value" id="warehouseDialogModal" :width="width?width+'px':'80%'" :height="height?height+'px':'80%'"  @show="show" min-width="460" min-height="320" 
   show-zoom resize transfer show-footer @confirm="confirm">
     <template #title>
       <span>选择仓库</span>
@@ -92,7 +92,7 @@ export default class WarehouseDialog extends Vue {
         size:'mini',
         seq:true,
         align:'center',
-        checkbox:true
+        radio:true
       },
       columns:[{
         title:'名称',
@@ -104,10 +104,7 @@ export default class WarehouseDialog extends Vue {
         title:'地址',
         field:'address'
       }]
-    },
-    // request:{
-    //   url:'/system/maindataMaterial/page'
-    // }
+    }
   }
 
   mounted(){}
@@ -154,7 +151,7 @@ export default class WarehouseDialog extends Vue {
       params:query
     }).then((res:any) => {
       if(res.data.records){
-        (this.$refs.view as any).setTableValue(res.records);
+        (this.$refs.view as any).setTableValue(res.data.records);
         this.data = res.data.records;
         let page={
           pageNo: res.data.current, //当前页

+ 2 - 1
src/main.ts

@@ -36,7 +36,8 @@ import productDialog from './components/productDialog/productDialog.vue'
 Vue.component('productDialog', productDialog);
 import warehouseDialog from './components/warehouseDialog/warehouseDialog.vue'
 Vue.component('warehouseDialog', warehouseDialog);
-
+import productStore from './components/productStore/productStore.vue'
+Vue.component('productStore', productStore);
 
 Vue.use(Element, {
   size: Cookies.get('size') || 'medium' // set element-ui default size

+ 6 - 1
src/views/demo/dialogDemo.vue

@@ -4,6 +4,9 @@
     <el-button @click="showWarehouse">仓库弹窗</el-button>
     <productDialog ref="product" />
     <warehouseDialog ref="warehouse" />
+    <div class="productStore">
+      <productStore />
+    </div>
   </div>
 </template>
 
@@ -22,5 +25,7 @@ export default class DialogDemo extends Vue {
 </script>
 
 <style lang="scss" scoped>
-
+.productStore{
+  padding-top: 16px;
+}
 </style>