Commit bc63325f authored by 赵啸非's avatar 赵啸非

添加级联删除事项材料

parent 6fb8f5cc
......@@ -136,6 +136,7 @@ export default {
matterName: "", // 事项名称
deptName: "", // 部门名称
deptId: "", // 部门id
deptCode: "", // 部门编码
},
fileUrlFileList: [],
templatePathFileList: [],
......
......@@ -32,15 +32,15 @@
<el-select
size="small"
ref="myselected"
v-model="form.deptId"
v-model="form.deptCode"
placeholder="请选择部门"
@change="handleChange"
>
<el-option
v-for="v in departmentList"
:key="v.id"
:key="v.deptNumber"
:label="v.name"
:value="v.id"
:value="v.deptNumber"
></el-option>
</el-select>
</el-form-item>
......@@ -85,8 +85,8 @@ export default {
matterName: "", // 事项简称
deptId: "", // 部门id
matterNo: "", // 事项编号
siteId: local.getLocal("sampleSiteId")
? local.getLocal("sampleSiteId")
siteId: local.getLocal("writeSiteId")
? local.getLocal("writeSiteId")
: "",
source: 0,
deptName: "",
......@@ -151,7 +151,7 @@ export default {
this.Visible = false;
},
handleChange(val) {
let name = this.departmentList.find((v) => v.id === val).name;
let name = this.departmentList.find((v) => v.deptNumber === val).name;
this.form.deptName = name;
console.log(this.form.deptName);
},
......
......@@ -15,6 +15,14 @@ import com.mortals.xhx.module.matter.model.MatterDatumEntity;
*/
public interface MatterDatumService extends ICRUDService<MatterDatumEntity, Long> {
/**
* 添加材料到公共库
* @param pubIds
* @param matterId
* @param siteId
* @param context
* @return
*/
Rest<String> addPubdatum(Long[] pubIds,Long matterId,Long siteId, Context context);
/**
......
......@@ -90,12 +90,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
@Override
protected void saveAfter(MatterDatumEntity entity, Context context) throws AppException {
int count = this.count(new MatterDatumQuery().matterId(entity.getMatterId()), context);
MatterEntity matterEntity = matterService.get(entity.getMatterId(), context);
if (!ObjectUtils.isEmpty(matterEntity)) {
matterEntity.setDatumCount(count);
matterService.update(matterEntity, context);
}
statDatumCount(context, entity);
addPubdatum(entity, context);
super.saveAfter(entity, context);
}
......@@ -125,18 +120,32 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
MatterDatumEntity matterDatumEntity = this.get(id, context);
int iRet = this.dao.delete(id);
this.removeAfter(id, context, iRet);
statDatumCount(context, matterDatumEntity);
return iRet;
}
@Override
public int remove(Long[] ids, Context context) throws AppException {
this.removeBefore(ids, context);
if(ids==null||ids.length==0) return 0;
MatterDatumEntity matterDatumEntity = this.get(ids[0], context);
int iRet = this.dao.delete(ids);
this.removeAfter(ids, context, iRet);
statDatumCount(context, matterDatumEntity);
return iRet;
}
private void statDatumCount(Context context, MatterDatumEntity matterDatumEntity) {
int count = this.count(new MatterDatumQuery().matterId(matterDatumEntity.getMatterId()), context);
MatterEntity matterEntity = matterService.get(matterDatumEntity.getMatterId(), context);
if (!ObjectUtils.isEmpty(matterEntity)) {
matterEntity.setDatumCount(count);
matterService.update(matterEntity, context);
}
return iRet;
}
@Override
protected void saveBefore(MatterDatumEntity entity, Context context) throws AppException {
if (StringUtils.isEmpty(entity.getSamplePath())) {
throw new AppException("样表地址不能为空");
}
......
......@@ -56,7 +56,6 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@Override
protected void doListBefore(MatterEntity query, Map<String, Object> model, Context context) throws AppException {
if (StringUtils.isNotEmpty(query.getMatterName())) {
query.setMatterName("%".concat(query.getMatterName()).concat("%"));
}
......@@ -99,14 +98,14 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@RequestMapping(value = {"recommend"},method = {RequestMethod.POST, RequestMethod.GET})
public String recommend(Long id) {
Map<String, Object> model = new HashMap();
int code = 1;
int code = VALUE_RESULT_SUCCESS;
String busiDesc = "推荐or取消推荐" + this.getModuleDesc();
try {
Rest<String> rest = this.service.recommend(id, getContext());
model.put("message_info", rest.getMsg());
this.recordSysLog(this.request, rest.getMsg());
} catch (Exception e) {
code = -1;
code = VALUE_RESULT_FAILURE;
this.doException(this.request, busiDesc, model, e);
}
......
......@@ -94,14 +94,14 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
@RequestMapping(value = {"recommend"}, method = {RequestMethod.POST, RequestMethod.GET})
public String recommend(Long id, Long siteId) {
Map<String, Object> model = new HashMap();
int code = 1;
int code = VALUE_RESULT_SUCCESS;
String busiDesc = "推荐or取消推荐" + this.getModuleDesc();
try {
Rest<String> rest = this.service.recommend(id, siteId, getContext());
model.put("message_info", rest.getMsg());
this.recordSysLog(this.request, rest.getMsg());
} catch (Exception e) {
code = -1;
code = VALUE_RESULT_FAILURE;
this.doException(this.request, busiDesc, model, e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment