Browse Source

库存明细

shish 1 year ago
parent
commit
eaaeda3878
1 changed files with 45 additions and 18 deletions
  1. 45 18
      ghs/src/views/item/list.vue

+ 45 - 18
ghs/src/views/item/list.vue

@@ -120,10 +120,19 @@
         <el-button type="primary" size="mini" @click="$util.pageTo({url: '/item/import'})">批量添加花材</el-button>
       </template>
 
-		<template #slot-addNew-goods-btn>
-			<el-button type="primary" size="mini" @click="replaceBtnFn(0)">新增</el-button>
-		</template>
-	
+	<template #slot-addNew-goods-btn>
+		<el-button type="primary" size="mini" @click="replaceBtnFn(0)">新增</el-button>
+	</template>
+
+	<template #slot-option-area>
+		<el-input v-model="search" placeholder="搜索花材" size="mini" style="width:160px;" :clearable="true" ref="itemSearchRef" @input="changeSearch()" @focus="clearSearch()"></el-input>
+		<el-radio-group v-model="hasStock" @change="changeHasStock" style="padding-top:6px;margin-left:10px;">
+			<el-radio label="-1">全部</el-radio>
+			<el-radio label="0">没库存</el-radio>
+			<el-radio label="1">有库存</el-radio>
+		</el-radio-group>
+	</template>
+
     </x-crud>
     <item-list-layer :show.sync="showItemModal" :classId.sync="classId" :className.sync="className" @confirm="selectItemFn" @cancel="showItemModal = false">
     </item-list-layer>
@@ -247,6 +256,7 @@ export default {
   data () {
     return {
 		app: null,
+		hasStock:'-1',
 		sortLink: '',
 		operateData: {},
 		statusOption: [
@@ -378,15 +388,42 @@ export default {
 		itemClassList: [],
 		unitList: [],
 		currentItemId: 0,
-		itemData:{}
+		itemData:{},
+		search:''
     };
   },
   computed: {
   },
   mounted() {
-    this.init();
+    this.init()
+
+    this.$nextTick(() => {
+      this.$refs.itemSearchRef.focus()
+    })
+
   },
   methods: {
+	changeHasStock(e){
+		this.hasStock = e
+		this.goRefresh()
+	},
+	clearSearch(){
+		this.search=''
+		this.changeSearch()
+	},
+	changeSearch(){
+      let that = this
+      if(this.T != null){
+        clearTimeout(this.T)
+      }
+      this.T = setTimeout(function(){
+        that.goRefresh()
+      },650)			
+	},
+	goRefresh(){
+		let that = this
+		that.app.refresh({ classId: that.classId,status:that.status,delStatus:that.delStatus,showPage:1,name:that.search,hasStock:that.hasStock})
+	},
 	getStockList(item){
 		this.itemData = {id:item.id,name:item.name}
 		setTimeout(() => {
@@ -651,23 +688,13 @@ export default {
             },
             layout: ['slot-modify']
           }
-        })
-        .set('dict', {
-          search: {
-            keyWord: 'name'
-          },
-        })
-        .set('search', {
-          key: {
-            placeholder: '输字母搜索'
-          }
         })
 		.set('pagination', {
 			size: 50
 		})
-        .set('layout', [['slot-tabs'],['search-key','flex1', 'slot-addNew-goods-btn','slot-add-goods-btn','slot-download-price-btn', 'refresh-btn'],
+        .set('layout', [['slot-tabs'],['slot-option-area','flex1', 'slot-addNew-goods-btn','slot-add-goods-btn','slot-download-price-btn', 'refresh-btn'],
 		['data-table'],['flex1', 'pagination']]).done();
-		app.refresh({ classId: this.classId,status:this.status,delStatus:this.delStatus,showPage: 1});
+		app.refresh({ classId: this.classId,status:this.status,delStatus:this.delStatus,showPage: 1,name:this.search,hasStock:this.hasStock});
     },
     uploadSuccess() {
 		console.log('valid',this.$refs['replaceForm'].validateField('cover'))