shish 5 лет назад
Родитель
Сommit
b8d4f79467
1 измененных файлов с 32 добавлено и 14 удалено
  1. 32 14
      ghs/src/views/item/list.vue

+ 32 - 14
ghs/src/views/item/list.vue

@@ -144,6 +144,19 @@
         <el-button type="primary" size="mini" @click="replaceBtnFn(0)">新增</el-button>
       </template>
 
+
+	<template #slot-status>
+	<el-select v-model="status" placeholder="状态" style="width: 160px;" size="mini" @change="changedStatus">
+		<el-option
+		v-for="statusItem in statusOption"
+		:key="statusItem.value"
+		:label="statusItem.label"
+		:value="statusItem.value">
+		</el-option>
+	</el-select>
+	</template>
+		
+
     </x-crud>
     <item-list-layer :show.sync="showItemModal" :classId.sync="classId" :className.sync="className" @confirm="selectItemFn" @cancel="showItemModal = false">
     </item-list-layer>
@@ -280,6 +293,16 @@ export default {
 		app: null,
 		sortLink: '',
 		operateData: {},
+		statusOption: [{
+          value: '0',
+          label: '全部'
+        },{
+          value: '1',
+          label: '上架'
+        }, {
+          value: '2',
+          label: '下架'
+        }],
 		tabIndex: '0',
 		tabsData: [
 		{
@@ -288,6 +311,7 @@ export default {
 		}
 		],
 		selects: {},
+		status:'',
 		sort: {
 		status: false
 		},
@@ -380,6 +404,10 @@ export default {
     this.init();
   },
   methods: {
+	  changedStatus(status){
+		this.status = status
+		this.app.refresh({ classId: this.classId,status:this.status,showPage: 1});
+	  },
 	  //自动填写拼音
 	  fillName(event){
 		this.$service.product.py({ name: event }).then(res => {
@@ -408,7 +436,6 @@ export default {
         param.push(newObj)
       })
       param = JSON.stringify(param)
-      console.log(param)
       this.$service.item.batchAdd({ data: param }).then(res => {
         this.$message.success('操作成功!');
         this.showItemModal = false
@@ -483,8 +510,6 @@ export default {
 				}
 			}
 		})
-
-
     },
     tabClick (tab, e) {
       this.app.refresh({ classId: this.classId });
@@ -618,25 +643,18 @@ export default {
 		.set('pagination', {
 			size: 50
 		})
-        .set('layout', [
-          ['slot-tabs'],
-			['search-key'],
-          ['flex1', 'slot-addNew-goods-btn','slot-add-goods-btn', 'refresh-btn'],
-          ['data-table'],
-          ['flex1', 'pagination']
-        ])
+        .set('layout', [['slot-tabs'],['slot-status'],['search-key'],['flex1', 'slot-addNew-goods-btn','slot-add-goods-btn', 'refresh-btn'],['data-table'],['flex1', 'pagination']])
 		  .on('refresh', async (params, { next }) => {
 			  // 继续执行刷新
 			  let  asset  = await next(params);
 			  console.log(asset,'-------')
 		  })
         .done();
-      app.refresh({ classId: this.classId});
-      app.refresh({ showPage: 1, pageSize: 50, });
+      app.refresh({ classId: this.classId,status:this.status,showPage: 1});
     },
     uploadSuccess() {
-			console.log('valid',this.$refs['replaceForm'].validateField('cover'))
-		},
+		console.log('valid',this.$refs['replaceForm'].validateField('cover'))
+	},
     refresh (params) {
       this.app.refresh(params);
     },