add deelte cdr

This commit is contained in:
Shaun Chyxion 2021-03-28 23:41:31 +08:00
parent 76bc40bbc9
commit e9de50a667
8 changed files with 40 additions and 64 deletions

View File

@ -10,6 +10,7 @@ import java.util.function.BiFunction;
import me.chyxion.tigon.mybatis.Search;
import com.wacai.tigon.model.ViewModel;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.NotNull;
import com.pudonghot.yo.util.PhoneNumberUtils;
import com.wacai.tigon.web.annotation.ListApi;
import com.wacai.tigon.web.controller.ArgQuery;
@ -26,6 +27,8 @@ import com.wacai.tigon.web.controller.BaseQueryController;
import org.springframework.validation.annotation.Validated;
import com.pudonghot.yo.cms.service.CallDetailRecordService;
import com.pudonghot.yo.cellphone.privacy.NumberPrivacyUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import static com.pudonghot.yo.model.domain.CallDetailRecord.*;
@ -122,6 +125,14 @@ public class CallDetailRecordController
return ((CallDetailRecordService) queryService).accountReport(form.copy(new ReqCallDetailRecordAccountReport()));
}
@PostMapping("/delete")
public void delete(
@NotNull
@RequestParam("id")
final Integer id) {
((CallDetailRecordService) queryService).delete(id);
}
/**
* {@inheritDoc}
*/

View File

@ -1,17 +1,17 @@
package com.pudonghot.yo.cms.service;
import java.util.List;
import com.wacai.tigon.service.BaseQueryService;
import com.wacai.tigon.service.BaseDeleteService;
import com.pudonghot.yo.model.domain.CallDetailRecord;
import com.pudonghot.yo.model.dbobject.CallDetailReport;
import com.pudonghot.yo.model.request.ReqCallDetailRecordAccountReport;
import com.wacai.tigon.service.BaseQueryService;
import com.pudonghot.yo.model.domain.CallDetailRecord;
import java.util.List;
/**
* @author Donghuang
* @date Oct 21, 2020 21:10:19
*/
public interface CallDetailRecordService extends BaseQueryService<Integer, CallDetailRecord> {
public interface CallDetailRecordService extends BaseQueryService<Integer, CallDetailRecord>, BaseDeleteService<Integer> {
/**
* account report

View File

@ -7,7 +7,7 @@ import com.pudonghot.yo.model.domain.CallDetailRecord;
import com.pudonghot.yo.mapper.CallDetailRecordMapper;
import com.pudonghot.yo.model.dbobject.CallDetailReport;
import com.pudonghot.yo.cms.service.CallDetailRecordService;
import com.wacai.tigon.service.support.BaseQueryServiceSupport;
import com.wacai.tigon.service.support.BaseCrudServiceSupport;
import com.pudonghot.yo.model.request.ReqCallDetailRecordAccountReport;
/**
@ -17,7 +17,7 @@ import com.pudonghot.yo.model.request.ReqCallDetailRecordAccountReport;
@Slf4j
@Service
public class CallDetailRecordServiceImpl
extends BaseQueryServiceSupport<Integer, CallDetailRecord, CallDetailRecordMapper>
extends BaseCrudServiceSupport<Integer, CallDetailRecord, CallDetailRecordMapper>
implements CallDetailRecordService{
/**

View File

@ -1,35 +0,0 @@
import Ember from 'ember';
import BaseComponent from './basic-component';
export default BaseComponent.extend({
tagName: 'a',
attributeBindings: ['title'],
'data-rel': 'tooltip',
enabled: Ember.computed.alias('model.active'),
title: 'Delete',
'icon-size-class': 'bigger-120',
didReceiveAttrs() {
let me = this;
me._super(...arguments);
if (me.get('icon-only')) {
me.set('icon-size-class', 'bigger-130');
me.set('classNameBindings', ['red']);
}
else {
me.set('classNameBindings',
['btn-danger',
'icon-only::btn',
'icon-only::btn-xs']);
}
},
click() {
let me = this;
me.dialog.confirm('确认要删除吗?', () => {
me.get('service').del(me.get('model')).then(() => {
me.get('route.controller.model.data').removeObject(me.get('model'));
me.decrementProperty('route.controller.model.total');
});
});
}
});

View File

@ -12,10 +12,9 @@ export default BasicComponent.extend({
'icon-size-class': 'bigger-120',
'data-rel': 'tooltip',
'data-original-title': alias('title'),
'operate-reason': false,
'icon-only': alias('iconOnly'),
didReceiveAttrs() {
let me = this;
const me = this;
if (me.get('icon-only')) {
me.set('icon-size-class', 'bigger-130');
me.set('classNameBindings', ['red']);
@ -28,25 +27,14 @@ export default BasicComponent.extend({
}
},
click() {
let me = this;
if (me.get('operate-reason')) {
me.get('dialog').prompt('请输入删除原因(必填)', reason => {
const model = me.get('model');
me.get('service').del(model).then(() => {
me.get('operationLog').createLog(
me.get('routeName'), '删除', model, reason);
me.get('route.controller.model.data').removeObject(model);
});
});
}
else {
const me = this;
me.get('dialog').confirm('确认要删除吗?', () => {
const model = me.get('model');
me.get('dialog').confirm('确认要删除吗?', () => {
me.get('service').del(model).then(() => {
me.get('route.controller.model.data').removeObject(model);
me.decrementProperty('route.controller.model.total');
});
me.get('service').del(model).then(() => {
me.get('route.controller.model.data').removeObject(model);
me.decrementProperty('route.controller.model.total');
me.get('message').alert('删除成功');
});
}
});
}
});

View File

@ -120,6 +120,12 @@
<th>
录音
</th>
{{#has-perm 'PERM_VIEW_CALL_DETAIL_RECORD_DELETE'}}
<th>
<i class="ace-icon fa fa-cogs bigger-110 hidden-480"></i>
管理
</th>
{{/has-perm}}
</tr>
</thead>
<tbody>
@ -176,6 +182,13 @@
</a>
{{/if}}
</td>
{{#has-perm 'PERM_VIEW_CALL_DETAIL_RECORD_DELETE'}}
<td>
<div class="btn-group">
{{delete-button model=it}}
</div>
</td>
{{/has-perm}}
</tr>
{{/each}}
</tbody>

View File

@ -1 +0,0 @@
<i class="{{get this 'icon-size-class'}} ace-icon fa fa-trash-o"></i>

View File

@ -1 +1 @@
<i class="{{iconSizeClass}} ace-icon fa fa-trash-o"></i>
<i class="{{icon-size-class}} ace-icon fa fa-trash-o"></i>