|
@@ -1,10 +1,11 @@
|
|
<template>
|
|
<template>
|
|
- <vxe-modal v-model="value" id="myModa" :width="width?width+'px':'80%'" :height="height?height+'px':'80%'" min-width="460" min-height="320" show-zoom resize storage transfer>
|
|
|
|
|
|
+ <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"
|
|
|
|
+ show-zoom resize transfer show-footer @confirm="confirm">
|
|
<template #title>
|
|
<template #title>
|
|
<span>选择商品</span>
|
|
<span>选择商品</span>
|
|
</template>
|
|
</template>
|
|
<template #default>
|
|
<template #default>
|
|
- <module-view :propConfig="config" ref="view" />
|
|
|
|
|
|
+ <module-view :propConfig="config" ref="view" @pagination="getList" @search="getList" @resert="getList" @clickHandle="clickHandle" />
|
|
</template>
|
|
</template>
|
|
</vxe-modal>
|
|
</vxe-modal>
|
|
</template>
|
|
</template>
|
|
@@ -14,6 +15,9 @@ import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
@Component
|
|
@Component
|
|
export default class ProductDialog extends Vue {
|
|
export default class ProductDialog extends Vue {
|
|
value=false
|
|
value=false
|
|
|
|
+ time:any;
|
|
|
|
+ timeNum = 0;
|
|
|
|
+ data:Array<any>=[]
|
|
|
|
|
|
@Prop()
|
|
@Prop()
|
|
width?:number
|
|
width?:number
|
|
@@ -29,12 +33,88 @@ export default class ProductDialog extends Vue {
|
|
columns:[
|
|
columns:[
|
|
[{
|
|
[{
|
|
span:6,
|
|
span:6,
|
|
- label:'创建时间',
|
|
|
|
- prop:'created',
|
|
|
|
- component:'by-date-picker',
|
|
|
|
|
|
+ label:'名称',
|
|
|
|
+ prop:'name',
|
|
|
|
+ component:'by-input',
|
|
compConfig:{
|
|
compConfig:{
|
|
- format:'yyyy-MM-dd',
|
|
|
|
- type:'datetime'
|
|
|
|
|
|
+ attr:{
|
|
|
|
+ placeholder:'请输入名称'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },{
|
|
|
|
+ span:6,
|
|
|
|
+ label:'简称',
|
|
|
|
+ prop:'short_name',
|
|
|
|
+ component:'by-input',
|
|
|
|
+ compConfig:{
|
|
|
|
+ attr:{
|
|
|
|
+ placeholder:'请输入简称'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },{
|
|
|
|
+ span:6,
|
|
|
|
+ label:'财务编号',
|
|
|
|
+ prop:'accounting_code',
|
|
|
|
+ component:'by-input',
|
|
|
|
+ compConfig:{
|
|
|
|
+ attr:{
|
|
|
|
+ placeholder:'请输入财务编号'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },{
|
|
|
|
+ span:6,
|
|
|
|
+ label:'国际码',
|
|
|
|
+ prop:'ns_code',
|
|
|
|
+ component:'by-input',
|
|
|
|
+ compConfig:{
|
|
|
|
+ attr:{
|
|
|
|
+ placeholder:'请输入国际码'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }],
|
|
|
|
+ [{
|
|
|
|
+ span:6,
|
|
|
|
+ label:'单位',
|
|
|
|
+ prop:'unit',
|
|
|
|
+ component:'by-input',
|
|
|
|
+ compConfig:{
|
|
|
|
+ attr:{
|
|
|
|
+ placeholder:'请输入单位'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },{
|
|
|
|
+ span:6,
|
|
|
|
+ label:'保质期(天)',
|
|
|
|
+ prop:'shelf_life',
|
|
|
|
+ component:'by-input',
|
|
|
|
+ compConfig:{
|
|
|
|
+ attr:{
|
|
|
|
+ placeholder:'请输入保质期'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },{
|
|
|
|
+ span:6,
|
|
|
|
+ label:'库存',
|
|
|
|
+ prop:'stock',
|
|
|
|
+ component:'by-input',
|
|
|
|
+ compConfig:{
|
|
|
|
+ attr:{
|
|
|
|
+ placeholder:'请输入库存'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },{
|
|
|
|
+ span:6,
|
|
|
|
+ label:'品牌',
|
|
|
|
+ prop:'brand_id',
|
|
|
|
+ component:'by-select',
|
|
|
|
+ compConfig:{
|
|
|
|
+ attr:{
|
|
|
|
+ label:'name',
|
|
|
|
+ value:'id',
|
|
|
|
+ placeholder:'请选择品牌',
|
|
|
|
+ clearable:true,
|
|
|
|
+ data:this.getBrandData()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}]
|
|
}]
|
|
]
|
|
]
|
|
@@ -53,7 +133,7 @@ export default class ProductDialog extends Vue {
|
|
checkbox:true
|
|
checkbox:true
|
|
},
|
|
},
|
|
columns:[{
|
|
columns:[{
|
|
- title:'物料名称',
|
|
|
|
|
|
+ title:'名称',
|
|
field:'name',
|
|
field:'name',
|
|
width:150
|
|
width:150
|
|
},{
|
|
},{
|
|
@@ -72,27 +152,105 @@ export default class ProductDialog extends Vue {
|
|
},{
|
|
},{
|
|
title:'市场价格(统一售价)',
|
|
title:'市场价格(统一售价)',
|
|
field:'mark_price'
|
|
field:'mark_price'
|
|
|
|
+ },{
|
|
|
|
+ title:'单位',
|
|
|
|
+ field:'unit'
|
|
|
|
+ },{
|
|
|
|
+ title:'重量',
|
|
|
|
+ field:'weight'
|
|
|
|
+ },{
|
|
|
|
+ title:'保质期(天)',
|
|
|
|
+ field:'shelf_life'
|
|
|
|
+ },{
|
|
|
|
+ title:'库存',
|
|
|
|
+ field:'stock'
|
|
}]
|
|
}]
|
|
},
|
|
},
|
|
// request:{
|
|
// request:{
|
|
// url:'/system/maindataMaterial/page'
|
|
// url:'/system/maindataMaterial/page'
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
|
|
+ brandData:Array<any>=[]
|
|
|
|
+
|
|
|
|
+ getBrandData(){
|
|
|
|
+ return this.brandData;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ clickHandle(n:string){
|
|
|
|
+ if(n == 'onRefresh'){
|
|
|
|
+ this.getList()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
setShow(v:boolean){
|
|
setShow(v:boolean){
|
|
this.value = v;
|
|
this.value = v;
|
|
}
|
|
}
|
|
|
|
|
|
created(){
|
|
created(){
|
|
- this.getList();
|
|
|
|
|
|
+ this.getBrand()
|
|
|
|
+ }
|
|
|
|
+ mounted(){}
|
|
|
|
+ //获取品牌数据
|
|
|
|
+ getBrand(){
|
|
|
|
+ (this as any).$request({
|
|
|
|
+ url: '/maindata/maindataMaterialBrand/page',
|
|
|
|
+ method: 'get',
|
|
|
|
+ params:{
|
|
|
|
+ pageNo:1,
|
|
|
|
+ pageSize:1000
|
|
|
|
+ }
|
|
|
|
+ }).then((res:any) => {
|
|
|
|
+ if(res.data.records){
|
|
|
|
+ this.brandData = res.data.records;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ //确定
|
|
|
|
+ confirm(){
|
|
|
|
+ let data:Array<any>=this.getSelectdata();
|
|
|
|
+ this.$emit('confirm',data);
|
|
|
|
+ }
|
|
|
|
+ //获取已选中表格数据
|
|
|
|
+ getSelectdata(){
|
|
|
|
+ let data:Array<any>=[];
|
|
|
|
+ if(this.$refs.view){
|
|
|
|
+ data = (this.$refs.view as any).getSelectData()
|
|
|
|
+ }
|
|
|
|
+ return data;
|
|
|
|
+ }
|
|
|
|
+ //显示弹窗
|
|
|
|
+ show(){
|
|
|
|
+ if(this.data.length ==0){
|
|
|
|
+ this.time =setInterval(()=>{
|
|
|
|
+ this.getList()
|
|
|
|
+ },500)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
getList(){
|
|
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({
|
|
(this as any).$request({
|
|
url: '/maindata/maindataMaterial/page',
|
|
url: '/maindata/maindataMaterial/page',
|
|
method: 'get',
|
|
method: 'get',
|
|
|
|
+ params:query
|
|
}).then((res:any) => {
|
|
}).then((res:any) => {
|
|
- console.log('/maindataMaterial/page',res);
|
|
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|