jf 5 år sedan
förälder
incheckning
2ca74ec17f
1 ändrade filer med 85 tillägg och 17 borttagningar
  1. 85 17
      ghs/src/views/item/list.vue

+ 85 - 17
ghs/src/views/item/list.vue

@@ -38,7 +38,7 @@
         <div class="set-sort">
         <div class="set-sort">
           <span>排序</span>
           <span>排序</span>
           <el-button v-if="!sort.status" icon="el-icon-edit-outline" size="small" type="text" @click="showSort" class="show"></el-button>
           <el-button v-if="!sort.status" icon="el-icon-edit-outline" size="small" type="text" @click="showSort" class="show"></el-button>
-          <el-button class="hide" v-else size="mini" @click="hideSort" type="primary">完成</el-button>
+          <el-button class="hide" v-else size="mini" @click="hideSort('inTurn')" type="primary">完成</el-button>
         </div>
         </div>
       </template>
       </template>
 
 
@@ -54,7 +54,7 @@
 			<div class="set-sort">
 			<div class="set-sort">
 				<span>每扎成本价</span>
 				<span>每扎成本价</span>
 				<el-button v-if="!costPrice" icon="el-icon-edit-outline" size="small" type="text" @click="showCost" class="show"></el-button>
 				<el-button v-if="!costPrice" icon="el-icon-edit-outline" size="small" type="text" @click="showCost" class="show"></el-button>
-				<el-button class="hide" v-else size="mini" @click="hideSort" type="primary">完成</el-button>
+				<el-button class="hide" v-else size="mini" @click="hideSort('cost')" type="primary">完成</el-button>
 			</div>
 			</div>
 		</template>
 		</template>
 		<template #table-column-cost="{scope}">
 		<template #table-column-cost="{scope}">
@@ -66,18 +66,31 @@
 				<span>每扎加价</span>
 				<span>每扎加价</span>
 				<el-button v-if="!canAddPrice" icon="el-icon-edit-outline" size="small" type="text" @click="showAddPrice" class="show"></el-button>
 				<el-button v-if="!canAddPrice" icon="el-icon-edit-outline" size="small" type="text" @click="showAddPrice" class="show"></el-button>
 				<el-button class="hide" v-if="canAddPrice"  size="mini" @click="changeAllSort(scope)" type="primary">批</el-button>
 				<el-button class="hide" v-if="canAddPrice"  size="mini" @click="changeAllSort(scope)" type="primary">批</el-button>
-				<el-button class="hide" v-if="canAddPrice"  size="mini" @click="hideSort" type="primary">完成</el-button>
+				<el-button class="hide" v-if="canAddPrice"  size="mini" @click="hideSort('addPrice')" type="primary">完成</el-button>
 			</div>
 			</div>
 		</template>
 		</template>
       	<template #table-column-addPrice="{scope}">
       	<template #table-column-addPrice="{scope}">
         <span v-if="!canAddPrice">{{ scope.row.addPrice }}</span>
         <span v-if="!canAddPrice">{{ scope.row.addPrice }}</span>
         <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.addPrice" @blur="changeSort(scope.row, 'addPrice')" ></el-input>
         <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.addPrice" @blur="changeSort(scope.row, 'addPrice')" ></el-input>
       </template>
       </template>
+
+		<template #table-header-ratio="{scope}">
+			<div class="set-sort">
+				<span>单位比</span>
+				<el-button v-if="!canAddRatio" icon="el-icon-edit-outline" size="small" type="text" @click="showAddRatio" class="show"></el-button>
+				<el-button class="hide" v-if="canAddRatio"  size="mini" @click="hideSort('ratio')" type="primary">完成</el-button>
+			</div>
+		</template>
+      	<template #table-column-ratio="{scope}">
+        <span v-if="!canAddRatio">{{ scope.row.ratio }}</span>
+        <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.ratio" @blur="changeSort(scope.row, 'ratio')" ></el-input>
+      </template>
+
 	  	<template #table-header-weight>
 	  	<template #table-header-weight>
 		<div class="set-sort">
 		<div class="set-sort">
 			<span>重量(公斤)</span>
 			<span>重量(公斤)</span>
 			<el-button v-if="!costWeight" icon="el-icon-edit-outline" size="small" type="text" @click="showWeight" class="show"></el-button>
 			<el-button v-if="!costWeight" icon="el-icon-edit-outline" size="small" type="text" @click="showWeight" class="show"></el-button>
-			<el-button class="hide" v-else size="mini" @click="hideSort" type="primary">完成</el-button>
+			<el-button class="hide" v-else size="mini" @click="hideSort('weight')" type="primary">完成</el-button>
 		</div>
 		</div>
 	  </template>
 	  </template>
 		<template #table-column-weight="{scope}">
 		<template #table-column-weight="{scope}">
@@ -238,6 +251,7 @@ export default {
         status: false
         status: false
       },
       },
       canAddPrice:false,
       canAddPrice:false,
+	  canAddRatio:false,
       costPrice: false,
       costPrice: false,
 	  costWeight: false,
 	  costWeight: false,
       classId: 0,
       classId: 0,
@@ -513,7 +527,7 @@ export default {
         })
         })
         .set('dict', {
         .set('dict', {
           search: {
           search: {
-            keyWord: 'goodsName'
+            keyWord: 'name'
           },
           },
         })
         })
         .set('search', {
         .set('search', {
@@ -523,13 +537,19 @@ export default {
         })
         })
         .set('layout', [
         .set('layout', [
           ['slot-tabs'],
           ['slot-tabs'],
+			['search-key'],
           ['flex1', 'slot-addNew-goods-btn','slot-add-goods-btn', 'refresh-btn'],
           ['flex1', 'slot-addNew-goods-btn','slot-add-goods-btn', 'refresh-btn'],
           ['data-table'],
           ['data-table'],
           ['flex1', 'pagination']
           ['flex1', 'pagination']
         ])
         ])
+		  .on('refresh', async (params, { next }) => {
+			  // 继续执行刷新
+			  let  asset  = await next(params);
+			  console.log(asset,'-------')
+		  })
         .done();
         .done();
       app.refresh({ classId: this.classId});
       app.refresh({ classId: this.classId});
-      app.refresh({ showPage: 1, });
+      app.refresh({ showPage: 1, pageSize: 50, });
     },
     },
     uploadSuccess() {
     uploadSuccess() {
 			console.log(this.$refs['replaceForm'].validateField('cover'))
 			console.log(this.$refs['replaceForm'].validateField('cover'))
@@ -540,22 +560,55 @@ export default {
     showAddPrice(){
     showAddPrice(){
       this.initData = []
       this.initData = []
        this.canAddPrice = true
        this.canAddPrice = true
+		this.sort.status = false;
+		this.costPrice = false;
+		this.canAddRatio = false;
+		this.costWeight = false;
+    },
+    showAddRatio(){
+      this.initData = []
+       this.canAddRatio = true
+		this.sort.status = false;
+		this.costPrice = false;
+		this.canAddPrice = false;
+		this.costWeight = false;
     },
     },
   	showWeight(){
   	showWeight(){
       this.initData = []
       this.initData = []
        this.costWeight = true
        this.costWeight = true
+		this.sort.status = false;
+		this.costPrice = false;
+		this.canAddPrice = false;
+		this.canAddRatio = false;
     },
     },
     showSort (e) {
     showSort (e) {
-      this.initData = []
-      this.sort.status = true;
+      	this.initData = []
+		this.sort.status = true;
+		this.costPrice = false;
+		this.canAddPrice = false;
+		this.canAddRatio = false;
+		this.costWeight = false;
     },
     },
 
 
-    hideSort (e) {
+    hideSort (type) {
       if(this.$util.isEmpty(this.initData)){
       if(this.$util.isEmpty(this.initData)){
-        this.sort.status = false;
-        this.canAddPrice = false
-        this.costPrice = false
-        this.costWeight = false
+      	switch (type) {
+			case 'inTurn':
+				this.sort.status = false;
+			break;
+			case 'cost':
+				this.costPrice = false;
+			break;
+			case 'addPrice':
+				this.canAddPrice = false;
+			break;
+			case 'ratio':
+				this.canAddRatio = false;
+			break;
+			case 'weight':
+				this.costWeight = false;
+			break;
+		}
         return;
         return;
       }
       }
       this.dataList.form.data = JSON.stringify(this.initData)
       this.dataList.form.data = JSON.stringify(this.initData)
@@ -563,10 +616,23 @@ export default {
         console.log(res)
         console.log(res)
         this.$message.success('保存成功!');
         this.$message.success('保存成功!');
       }).catch(err => {console.log(err)})
       }).catch(err => {console.log(err)})
-      this.sort.status = false;
-      this.canAddPrice = false
-      this.costPrice = false
-      this.costWeight = false
+		switch (type) {
+			case 'inTurn':
+				this.sort.status = false;
+				break;
+			case 'cost':
+				this.costPrice = false;
+				break;
+			case 'addPrice':
+				this.canAddPrice = false;
+				break;
+			case 'ratio':
+				this.canAddRatio = false;
+				break;
+			case 'weight':
+				this.costWeight = false;
+				break;
+		}
     },
     },
     replaceBtnFn(id) {
     replaceBtnFn(id) {
 		this.getAllClass()
 		this.getAllClass()
@@ -663,6 +729,8 @@ export default {
         obj.cost  = d.cost 
         obj.cost  = d.cost 
       }else if(type == 'weight') {
       }else if(type == 'weight') {
         obj.weight  = d.weight
         obj.weight  = d.weight
+      }else if(type == 'ratio') {
+        obj.ratio  = d.ratio
       }
       }
       this.initData.push(obj)
       this.initData.push(obj)
     }
     }