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

ibizdev提交

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