|
@@ -18,9 +18,11 @@
|
|
|
</div>
|
|
|
<el-table
|
|
|
class="search-table order-table"
|
|
|
- :data="tableList"
|
|
|
+ :data="tableObj[typeValue]"
|
|
|
border
|
|
|
style="width: 672px"
|
|
|
+ :key="typeValue"
|
|
|
+ v-loading="tableLoading"
|
|
|
:max-height="tableHeight">
|
|
|
<el-table-column
|
|
|
type="index"
|
|
@@ -132,6 +134,8 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
tableHeight: "", // 表格高度
|
|
|
+ tableObj: {},
|
|
|
+ tableLoading: false
|
|
|
}
|
|
|
},
|
|
|
//计算属性 类似于data概念
|
|
@@ -154,26 +158,38 @@ export default {
|
|
|
},
|
|
|
// 提交表单
|
|
|
onSubmit(){
|
|
|
+ let _this = this
|
|
|
this.loading = true
|
|
|
let MethodName = "/OrgServer/Manager/ReservationPriceManager/SaveReservationPriceList";
|
|
|
- let table = JSON.parse(JSON.stringify(this.tableList))
|
|
|
- table.forEach(item => {
|
|
|
- item.comb_count = item.comb_count ? item.comb_count * 1 : 1
|
|
|
- item.price = item.price * 1
|
|
|
- });
|
|
|
- let data = {
|
|
|
- goods_type: 2,
|
|
|
- goods_study_phase: this.typeValue,
|
|
|
- reservation_price_list: table
|
|
|
- }
|
|
|
- getLogin(MethodName, data)
|
|
|
- .then((res) => {
|
|
|
- this.loading = false
|
|
|
- if(res.status===1){
|
|
|
- this.$message.success("保存成功")
|
|
|
- }
|
|
|
- }).catch((res) =>{
|
|
|
- this.loading = false
|
|
|
+ let index = 0
|
|
|
+ Object.getOwnPropertyNames(_this.tableObj).forEach(function(key){
|
|
|
+ // if(_this.tableObj&&_this.tableObj[key]&&_this.tableObj[key].length>0){
|
|
|
+ let table = _this.tableObj[key].length>0?JSON.parse(JSON.stringify(_this.tableObj[key])):[]
|
|
|
+ table.forEach(item => {
|
|
|
+ item.comb_count = item.comb_count ? item.comb_count * 1 : 1
|
|
|
+ item.price = item.price * 1
|
|
|
+ });
|
|
|
+ let data = {
|
|
|
+ goods_type: 2,
|
|
|
+ goods_study_phase: key*1,
|
|
|
+ reservation_price_list: table
|
|
|
+ }
|
|
|
+ getLogin(MethodName, data)
|
|
|
+ .then((res) => {
|
|
|
+ // this.loading = false
|
|
|
+ if(res.status===1){
|
|
|
+ index ++
|
|
|
+ if(index===Object.keys(_this.tableObj).length+1){
|
|
|
+ _this.$message.success("保存成功")
|
|
|
+ _this.loading = false
|
|
|
+ }
|
|
|
+ // this.$message.success("保存成功")
|
|
|
+ }
|
|
|
+ }).catch((res) =>{
|
|
|
+ _this.loading = false
|
|
|
+ })
|
|
|
+ // }
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
// 取消 恢复到修改前状态
|
|
@@ -182,17 +198,24 @@ export default {
|
|
|
},
|
|
|
// 得到配置信息
|
|
|
getInfo(){
|
|
|
+ if(this.tableObj[this.typeValue]&&this.tableObj[this.typeValue].length>0){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.tableLoading = true
|
|
|
let MethodName = "/OrgServer/Manager/ReservationPriceManager/GetReservationPriceList";
|
|
|
getLogin(MethodName, {
|
|
|
goods_type: 2,
|
|
|
goods_study_phase: this.typeValue
|
|
|
})
|
|
|
.then((res) => {
|
|
|
+ this.tableLoading = false
|
|
|
if(res.status===1){
|
|
|
this.tableList = res.reservation_price_list
|
|
|
+ this.tableObj[this.typeValue] = res.reservation_price_list
|
|
|
+ this.$forceUpdate()
|
|
|
}
|
|
|
}).catch((res) =>{
|
|
|
-
|
|
|
+ this.tableLoading = false
|
|
|
})
|
|
|
},
|
|
|
//计算table高度(动态设置table高度)
|
|
@@ -210,8 +233,8 @@ export default {
|
|
|
},
|
|
|
tableLength(type){
|
|
|
if(type=='-'){
|
|
|
- if(this.tableList.length>1){
|
|
|
- this.tableList.splice(this.tableList.length-1,1)
|
|
|
+ if(this.tableObj[this.typeValue].length>1){
|
|
|
+ this.tableObj[this.typeValue].splice(this.tableObj[this.typeValue].length-1,1)
|
|
|
}else{
|
|
|
this.$message.warning('最少须保留一行')
|
|
|
}
|
|
@@ -223,14 +246,22 @@ export default {
|
|
|
shelve_date: '',
|
|
|
price: ''
|
|
|
}
|
|
|
- this.tableList.push(obj)
|
|
|
+ this.tableObj[this.typeValue].push(obj)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
- this.getInfo()
|
|
|
+ let timer = setInterval(() => {
|
|
|
+ if(this.$studyType&&this.$studyType.length>0){
|
|
|
+ this.$studyType.forEach(item=>{
|
|
|
+ this.tableObj[item.study_phase] = []
|
|
|
+ })
|
|
|
+ this.getInfo()
|
|
|
+ clearInterval(timer);
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
this.getTableHeight();
|
|
|
},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|