提交 3f82079a 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 5a305e7e
......@@ -157,6 +157,7 @@ export default class AppIndexViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
this.viewparams = {};
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
......@@ -249,6 +250,7 @@ export default class AppIndexViewBase extends Vue {
* @memberof AppIndexViewBase
*/
private parseViewParam(): void {
this.context = {};
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......
......@@ -239,6 +239,7 @@ export default class IBZDictEditViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
this.viewparams = {};
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
......@@ -385,6 +386,7 @@ export default class IBZDictEditViewBase extends Vue {
* @memberof IBZDictEditViewBase
*/
private parseViewParam(): void {
this.context = {};
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......
......@@ -261,6 +261,7 @@ export default class IBZDictGridViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
this.viewparams = {};
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
......@@ -411,6 +412,7 @@ export default class IBZDictGridViewBase extends Vue {
* @memberof IBZDictGridViewBase
*/
private parseViewParam(): void {
this.context = {};
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......
......@@ -239,6 +239,7 @@ export default class IBZDictItemEditViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
this.viewparams = {};
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
......@@ -385,6 +386,7 @@ export default class IBZDictItemEditViewBase extends Vue {
* @memberof IBZDictItemEditViewBase
*/
private parseViewParam(): void {
this.context = {};
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......
......@@ -261,6 +261,7 @@ export default class IBZDictItemGridViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
this.viewparams = {};
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
......@@ -411,6 +412,7 @@ export default class IBZDictItemGridViewBase extends Vue {
* @memberof IBZDictItemGridViewBase
*/
private parseViewParam(): void {
this.context = {};
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......
......@@ -172,19 +172,7 @@ export default class ControlService {
// }
item[dataitem.name] = val;
});
if (isCreate) {
if(!item.srfuf){
Object.assign(item, {
srfuf: '0'
});
}
} else {
if(!item.srfuf){
Object.assign(item, {
srfuf: '1'
});
}
}
item.srfuf = data.srfuf ? data.srfuf : (isCreate ? "0" : "1");
return item;
}
......
......@@ -646,7 +646,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
let dataInfo = '';
_datas.forEach((record: any, index: number) => {
let srfmajortext = record.srfmajortext;
let srfmajortext = record.dictname;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
......
......@@ -251,8 +251,6 @@ export default class MainService extends ControlService {
@Errorlog
public loadDraft(action: string, context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
//仿真主键数据
data.dictid = Util.createUUID();
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
......@@ -265,8 +263,10 @@ export default class MainService extends ControlService {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:'0'});
//仿真主键数据
response.data.ibzdict = Util.createUUID();
}
this.handleResponse(action, response);
this.handleResponse(action, response, true);
this.mergeDefaults(response);
resolve(response);
}).catch(response => {
......
......@@ -716,7 +716,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
let dataInfo = '';
_datas.forEach((record: any, index: number) => {
let srfmajortext = record.srfmajortext;
let srfmajortext = record.itemname;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
......
......@@ -251,8 +251,6 @@ export default class MainService extends ControlService {
@Errorlog
public loadDraft(action: string, context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
//仿真主键数据
data.itemid = Util.createUUID();
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
......@@ -265,8 +263,10 @@ export default class MainService extends ControlService {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:'0'});
//仿真主键数据
response.data.ibzdictitem = Util.createUUID();
}
this.handleResponse(action, response);
this.handleResponse(action, response, true);
this.mergeDefaults(response);
resolve(response);
}).catch(response => {
......
......@@ -91,9 +91,8 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
@Override
@Transactional
public boolean remove(String key) {
boolean ret = removeById(key);
if(!ret) return ret;
return ret ;
if(!removeById(key)) return false;
return true ;
}
@Override
......@@ -104,10 +103,10 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
@Override
@Transactional
public boolean create(IBZDictItem et) {
boolean ret = this.retBool(this.baseMapper.insert(et));
if(!ret) return ret;
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getItemid()),et);
return ret ;
return true ;
}
@Override
......@@ -118,13 +117,10 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
@Override
@Transactional
public boolean update(IBZDictItem et) {
boolean ret = update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictitemid",et.getItemid()));
if(!ret) return ret;
IBZDictItem newet=get(et.getItemid());
CachedBeanCopier.copy(newet,et);
return ret ;
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictitemid",et.getItemid())))
return false;
CachedBeanCopier.copy(get(et.getItemid()),et);
return true ;
}
@Override
......@@ -133,13 +129,44 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
}
List<IBZDictItem> selectByDictid(String dictid) {
@Override
public List<IBZDictItem> selectByDictid(String dictid) {
return baseMapper.selectByDictid(dictid);
}
void saveByDictid(String dictid,List<IBZDictItem>) ;
@Override
public void saveByDictid(String dictid,List<IBZDictItem> list) {
if(list==null)
return;
Set<String> delIds=new HashSet<String>();
List<IBZDictItem> _update=new ArrayList<IBZDictItem>();
List<IBZDictItem> _create=new ArrayList<IBZDictItem>();
for(IBZDictItem before:selectByDictid(dictid)){
delIds.add(before.getItemid());
}
for(IBZDictItem sub:list) {
sub.setDictid(dictid);
if(ObjectUtils.isEmpty(sub.getItemid()))
sub.setItemid((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getItemid())) {
delIds.remove(sub.getItemid());
_update.add(sub);
}
else
_create.add(sub);
}
if(_update.size()>0)
this.updateBatch(_update,500);
if(_create.size()>0)
this.createBatch(_create,500);
if(delIds.size()>0)
this.removeBatch(delIds,500);
}
void removeByDictid(String dictid) ;
@Override
public void removeByDictid(String dictid) {
this.remove(new QueryWrapper<IBZDictItem>().eq("ibzdictid",dictid));
}
/**
......
......@@ -60,18 +60,10 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
@Override
@Transactional
public boolean create(IBZDict et) {
boolean ret = this.retBool(this.baseMapper.insert(et));
if(!ret) return ret;
//嵌套[字典项目]
if(!ObjectUtils.isEmpty(et.getItems())){
for (cn.ibizlab.core.dict.domain.IBZDictItem sub: et.getItems()) {
sub.setDictid(et.getDictid());
}
ibzdictitemService.createBatch(et.getItems(),500) ;
}
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getDictid()),et);
return ret ;
return true ;
}
@Override
......@@ -92,34 +84,10 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
@Override
@Transactional
public boolean update(IBZDict et) {
boolean ret = update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictid",et.getDictid()));
if(!ret) return ret;
//嵌套[字典项目]
Set _items=new HashSet();
if(!ObjectUtils.isEmpty(et.getItems())){
for (cn.ibizlab.core.dict.domain.IBZDictItem sub: et.getItems()) {
sub.setDictid(et.getDictid());
if(ObjectUtils.isEmpty(sub.getItemid()))
sub.setItemid((String)sub.getDefaultKey(true));
_items.add(sub.getItemid());
}
ibzdictitemService.saveBatch(et.getItems(),500) ;
}
IBZDict newet=get(et.getDictid());
//删除多余的嵌套[字典项目]
if(_items.size()>0&&(!ObjectUtils.isEmpty(et.getItems()))){
List<String> ids=new ArrayList<String>();
for (cn.ibizlab.core.dict.domain.IBZDictItem sub: et.getItems()) {
if(!_items.contains(sub.getItemid()))
ids.add(sub.getItemid());
}
if(ids.size()>0)
ibzdictitemService.removeBatch(ids,500) ;
}
CachedBeanCopier.copy(newet,et);
return ret ;
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictid",et.getDictid())))
return false;
CachedBeanCopier.copy(get(et.getDictid()),et);
return true ;
}
@Override
......@@ -130,18 +98,9 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
@Override
@Transactional
public boolean remove(String key) {
IBZDict et = get(key);
//嵌套[字典项目]
if(!ObjectUtils.isEmpty(et.getItems())){
List<String> ids=new ArrayList<String>();
for (cn.ibizlab.core.dict.domain.IBZDictItem sub: et.getItems()) {
ids.add(sub.getItemid());
}
ibzdictitemService.removeBatch(ids,500) ;
}
boolean ret = removeById(key);
if(!ret) return ret;
return ret ;
ibzdictitemService.ByDictid(key) ;
if(!removeById(key)) return false;
return true ;
}
@Override
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册