|
|
@@ -28,14 +28,14 @@
|
|
|
|
|
|
<template #table-column-inTurn="{scope}">
|
|
|
<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
|
- <el-input style="width:50%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeSort(scope.row, 'inTurn')" ></el-input>
|
|
|
+ <el-input style="width:50%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeValue(scope.row, 'inTurn')" ></el-input>
|
|
|
</template>
|
|
|
|
|
|
<template #table-header-inTurn>
|
|
|
<div class="set-sort">
|
|
|
<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 class="hide" v-else size="mini" @click="hideSort('inTurn')" type="primary">完成</el-button>
|
|
|
+ <el-button class="hide" v-else size="mini" @click="commitChange('inTurn')" type="primary">完成</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -49,48 +49,48 @@
|
|
|
<div class="set-sort">
|
|
|
<span>每扎成本价</span>
|
|
|
<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('cost')" type="primary">完成</el-button>
|
|
|
+ <el-button class="hide" v-else size="mini" @click="commitChange('cost')" type="primary">完成</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #table-column-cost="{scope}">
|
|
|
<span v-if="!costPrice">{{ scope.row.cost }}</span>
|
|
|
- <el-input style="width:50%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.cost" @blur="changeSort(scope.row, 'cost')" ></el-input>
|
|
|
+ <el-input style="width:50%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.cost" @blur="changeValue(scope.row, 'cost')" ></el-input>
|
|
|
</template>
|
|
|
<template #table-header-addPrice="{scope}">
|
|
|
<div class="set-sort">
|
|
|
<span>每扎加价</span>
|
|
|
<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="hideSort('addPrice')" type="primary">完成</el-button>
|
|
|
+ <el-button class="hide" v-if="canAddPrice" size="mini" @click="commitChange('addPrice')" type="primary">完成</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #table-column-addPrice="{scope}">
|
|
|
<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="changeValue(scope.row, 'addPrice')" ></el-input>
|
|
|
</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>
|
|
|
+ <el-button class="hide" v-if="canAddRatio" size="mini" @click="commitChange('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>
|
|
|
+ <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.ratio" @blur="changeValue(scope.row, 'ratio')" ></el-input>
|
|
|
</template>
|
|
|
|
|
|
<template #table-header-weight>
|
|
|
<div class="set-sort">
|
|
|
<span>重量(公斤)</span>
|
|
|
<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('weight')" type="primary">完成</el-button>
|
|
|
+ <el-button class="hide" v-else size="mini" @click="commitChange('weight')" type="primary">完成</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #table-column-weight="{scope}">
|
|
|
<span v-if="!costWeight">{{ scope.row.weight }}</span>
|
|
|
- <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.weight" @blur="changeSort(scope.row, 'weight')"></el-input>
|
|
|
+ <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.weight" @blur="changeValue(scope.row, 'weight')"></el-input>
|
|
|
</template>
|
|
|
<template #table-column-delStatus="{scope}">
|
|
|
<span>{{ scope.row.delStatus==0?'上架':'下架' }}</span>
|
|
|
@@ -621,7 +621,7 @@ export default {
|
|
|
this.costWeight = false;
|
|
|
},
|
|
|
|
|
|
- hideSort (type) {
|
|
|
+ commitChange (type) {
|
|
|
if(this.$util.isEmpty(this.initData)){
|
|
|
switch (type) {
|
|
|
case 'inTurn':
|
|
|
@@ -646,6 +646,7 @@ export default {
|
|
|
this.$service.product.productBatchUpdate(this.dataList.form).then(res => {
|
|
|
console.log(res)
|
|
|
this.$message.success('保存成功!');
|
|
|
+ this.app.refresh()
|
|
|
}).catch(err => {console.log(err)})
|
|
|
switch (type) {
|
|
|
case 'inTurn':
|
|
|
@@ -754,48 +755,42 @@ export default {
|
|
|
ele.addPrice = batchAddPrice
|
|
|
this.initData.push({id:ele.id,addPrice:ele.addPrice})
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
- this.dialogFormVisible = false;
|
|
|
- // data[0].cost = 999
|
|
|
+ this.dialogFormVisible = false;
|
|
|
},
|
|
|
//批量改价
|
|
|
batchAlterFun(){
|
|
|
if(this.batchAlter=='') return;
|
|
|
this.dataList.form.type = 'addPrice'
|
|
|
- // batchAlter
|
|
|
let data = this.$refs['xCrud'].table.data;
|
|
|
data.forEach((ele)=>{
|
|
|
ele.addPrice = this.batchAlter
|
|
|
this.initData.push({id:ele.id,addPrice:this.batchAlter})
|
|
|
})
|
|
|
this.dialogFormVisible = false
|
|
|
- // console.log(this.$refs['xCrud'].table.data,'1111');
|
|
|
},
|
|
|
changeAllSort(e){
|
|
|
- this.batchAlter='';
|
|
|
- this.batchAddPrice='';
|
|
|
- this.dialogFormVisible = true;
|
|
|
-
|
|
|
+ this.batchAlter='';
|
|
|
+ this.batchAddPrice='';
|
|
|
+ this.dialogFormVisible = true;
|
|
|
},
|
|
|
- changeSort (d, type) {
|
|
|
- this.dataList.form.type = type
|
|
|
- let obj = {
|
|
|
- id: d.id,
|
|
|
- }
|
|
|
- if(type == 'inTurn') {
|
|
|
- obj.inTurn = d.inTurn
|
|
|
- } else if(type == 'addPrice') {
|
|
|
- obj.addPrice = d.addPrice
|
|
|
- } else if(type == 'cost') {
|
|
|
- obj.cost = d.cost
|
|
|
- }else if(type == 'weight') {
|
|
|
- obj.weight = d.weight
|
|
|
- }else if(type == 'ratio') {
|
|
|
- obj.ratio = d.ratio
|
|
|
- }
|
|
|
- this.initData.push(obj)
|
|
|
- }
|
|
|
+ changeValue (d, type) {
|
|
|
+ this.dataList.form.type = type
|
|
|
+ let obj = {
|
|
|
+ id: d.id,
|
|
|
+ }
|
|
|
+ if(type == 'inTurn') {
|
|
|
+ obj.inTurn = d.inTurn
|
|
|
+ } else if(type == 'addPrice') {
|
|
|
+ obj.addPrice = d.addPrice
|
|
|
+ } else if(type == 'cost') {
|
|
|
+ obj.cost = d.cost
|
|
|
+ }else if(type == 'weight') {
|
|
|
+ obj.weight = d.weight
|
|
|
+ }else if(type == 'ratio') {
|
|
|
+ obj.ratio = d.ratio
|
|
|
+ }
|
|
|
+ this.initData.push(obj)
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|