配置保存优化,修复分类选择bug

This commit is contained in:
张乐
2020-09-17 16:09:44 +08:00
parent a39c541012
commit b2801f344e
5 changed files with 63 additions and 25 deletions

View File

@@ -12,7 +12,7 @@
<el-input v-model="editPram.url" placeholder="URL" />
</el-form-item>
<el-form-item label="父级" v-if="biztype.value!==3">
<el-cascader v-model="editPram.pid" :options="parentOptions" :props="categoryProps" style="width:100%" />
<el-cascader v-model="editPram.pid" :options="biztype.value === 5 ? allTreeList : parentOptions" :props="categoryProps" style="width:100%" />
</el-form-item>
<el-form-item label="菜单图标" v-if="biztype.value===5">
<el-input placeholder="请选择菜单图标" v-model="editPram.extra">
@@ -126,8 +126,8 @@ export default {
this.$emit('hideEditDialog')
},
initEditData() {
this.addTreeListLabelForCasCard(this.allTreeList, 'child')
this.parentOptions = this.allTreeList
this.parentOptions = [...this.allTreeList]
this.addTreeListLabelForCasCard(this.parentOptions, 'child')
if (this.isCreate !== 1) {
const { id } = this.prent
this.editPram.pid = id
@@ -146,7 +146,7 @@ export default {
addTreeListLabelForCasCard(arr, child) {
arr.forEach((o,i) => {
if (o.child && o.child.length) {
o.disabled = true
// o.disabled = true
o.child.forEach((j) => {
j.disabled = true
})

View File

@@ -168,7 +168,7 @@
<el-dropdown-item @click.native="onOrderDetails(scope.row.id)">订单详情</el-dropdown-item>
<el-dropdown-item @click.native="onOrderLog(scope.row.id)">订单记录</el-dropdown-item>
<el-dropdown-item @click.native="onOrderMark(scope.row)">订单备注</el-dropdown-item>
<el-dropdown-item v-show="scope.row.status === -1" @click.native="onOrderRefuse(scope.row)">拒绝退款</el-dropdown-item>
<el-dropdown-item v-show="scope.row.statusStr.key === 'refunding'" @click.native="onOrderRefuse(scope.row)">拒绝退款</el-dropdown-item>
<el-dropdown-item v-show="scope.row.statusStr.key === 'refunding' && ((parseFloat(scope.row.payPrice) > parseFloat(scope.row.refundPrice) || (scope.row.payPrice == 0 && [0,1].indexOf(scope.row.refundStatus) !== -1)))" @click.native="onOrderRefund(scope.row)">立即退款</el-dropdown-item>
<el-dropdown-item @click.native="handleDelete(scope.row, scope.$index)">删除订单</el-dropdown-item>
</el-dropdown-menu>

View File

@@ -9,7 +9,7 @@
<div class="title">用户信息</div>
<div class="acea-row">
<div class="description-term">用户昵称{{orderDatalist.user?orderDatalist.user.nickname:orderDatalist.realName}}</div>
<div class="description-term">绑定电话{{orderDatalist.user.phone}}</div>
<div class="description-term">绑定电话{{orderDatalist.user.phone ? orderDatalist.user.phone : '无'}}</div>
</div>
<el-divider></el-divider>
<div class="title">{{orderDatalist.statusStr.key === 'toBeWrittenOff'?'提货信息': '收货信息'}}</div>

View File

@@ -1,17 +1,17 @@
package com.zbkj.crmeb.system.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 配置表
@@ -57,7 +57,7 @@ public class SystemConfig implements Serializable {
private String value;
@ApiModelProperty(value = "是否隐藏")
private Boolean status;
private Boolean status = false;
@ApiModelProperty(value = "创建时间")
private Date createTime;

View File

@@ -129,7 +129,9 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
//检测form表单并且返回需要添加的数据
systemFormTempService.checkForm(systemFormCheckRequest);
List<SystemConfig> systemConfigList = new ArrayList<>();
List<SystemConfig> systemConfigSaveList = new ArrayList<>();
List<SystemConfig> systemConfigUpdateList = new ArrayList<>();
List<SystemConfig> systemConfigDeleteList = new ArrayList<>();
//批量添加
for (SystemFormItemCheckRequest systemFormItemCheckRequest : systemFormCheckRequest.getFields()) {
@@ -141,29 +143,65 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
//去掉图片域名之后没有数据则说明当前数据就是图片域名
value = systemFormItemCheckRequest.getValue();
}
SystemConfig data = selectByName(systemFormItemCheckRequest.getName());
systemConfig.setValue(value);
systemConfig.setFormId(systemFormCheckRequest.getId());
systemConfig.setTitle(systemFormItemCheckRequest.getTitle());
systemConfigList.add(systemConfig);
if(null == data){
systemConfigSaveList.add(systemConfig);
}else{
systemConfig.setId(data.getId());
systemConfigUpdateList.add(systemConfig);
}
}
//修改之前的数据
updateStatusByFormId(systemFormCheckRequest.getId());
//拿到之前form下的所有数据
List<SystemConfig> formDataList = selectByFormId(systemFormCheckRequest.getId());
saveBatch(systemConfigList);
//添加或者更新数据
saveBatch(systemConfigSaveList);
saveOrUpdateBatch(systemConfigUpdateList);
//删除之前隐藏的数据
deleteStatusByFormId(systemFormCheckRequest.getId());
List<SystemConfig> forAsyncPram = systemConfigList.stream().map(e -> {
e.setStatus(true);
return e;
}).collect(Collectors.toList());
async(forAsyncPram);
//所有需要修改的数据
systemConfigSaveList.addAll(systemConfigUpdateList);
List<String> collectNameList = systemConfigSaveList.stream().map(SystemConfig::getName).collect(Collectors.toList());
//删除老的数据且不在新form提交的数据
if(null != formDataList && formDataList.size() > 0){
for (SystemConfig systemConfig : formDataList) {
if(!collectNameList.contains(systemConfig.getName())){
systemConfig.setStatus(true);
systemConfigDeleteList.add(systemConfig);
}
}
}
if(systemConfigDeleteList.size() > 0){
dao.deleteBatchIds(systemConfigDeleteList.stream().map(SystemConfig::getId).collect(Collectors.toList()));
}
systemConfigDeleteList.addAll(systemConfigSaveList);
async(systemConfigDeleteList);
return true;
}
private List<SystemConfig> selectByFormId(Integer formId) {
LambdaQueryWrapper<SystemConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SystemConfig::getFormId, formId);
return dao.selectList(lambdaQueryWrapper);
}
private SystemConfig selectByName(String value) {
LambdaQueryWrapper<SystemConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SystemConfig::getName, value).eq(SystemConfig::getStatus, false);
return dao.selectOne(lambdaQueryWrapper);
}
/**
@@ -291,13 +329,13 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
* @since 2020-04-16
*/
private void async(List<SystemConfig> systemConfigList){
if (!asyncConfig) {
if (!asyncConfig && systemConfigList.size() < 1) {
//如果配置没有开启
return;
}
for (SystemConfig systemConfig : systemConfigList) {
if(systemConfig.getStatus()){
if(null != systemConfig.getStatus() && systemConfig.getStatus()){
//隐藏之后删除redis的数据
deleteRedis(systemConfig.getName());
continue;