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

添加级联删除事项材料

parent 6fb8f5cc
...@@ -136,6 +136,7 @@ export default { ...@@ -136,6 +136,7 @@ export default {
matterName: "", // 事项名称 matterName: "", // 事项名称
deptName: "", // 部门名称 deptName: "", // 部门名称
deptId: "", // 部门id deptId: "", // 部门id
deptCode: "", // 部门编码
}, },
fileUrlFileList: [], fileUrlFileList: [],
templatePathFileList: [], templatePathFileList: [],
......
<template> <template>
<div> <div>
<el-dialog <el-dialog
:title="title" :title="title"
:visible.sync="Visible" :visible.sync="Visible"
width="30%" width="30%"
@close="handleClose" @close="handleClose"
> >
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="事项简称" prop="matterName"> <el-form-item label="事项简称" prop="matterName">
<el-input <el-input
size="small" size="small"
v-model="form.matterName" v-model="form.matterName"
placeholder="请输入事项简称" placeholder="请输入事项简称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="事项全称" prop="matterFullName"> <el-form-item label="事项全称" prop="matterFullName">
<el-input <el-input
size="small" size="small"
v-model="form.matterFullName" v-model="form.matterFullName"
placeholder="请输入事项全称" placeholder="请输入事项全称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="事项编号" prop="matterNo"> <el-form-item label="事项编号" prop="matterNo">
<el-input <el-input
size="small" size="small"
v-model="form.matterNo" v-model="form.matterNo"
placeholder="请输入事项编号" placeholder="请输入事项编号"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="选择部门" prop="deptId"> <el-form-item label="选择部门" prop="deptId">
<el-select <el-select
size="small" size="small"
ref="myselected" ref="myselected"
v-model="form.deptId" v-model="form.deptCode"
placeholder="请选择部门" placeholder="请选择部门"
@change="handleChange" @change="handleChange"
> >
<el-option <el-option
v-for="v in departmentList" v-for="v in departmentList"
:key="v.id" :key="v.deptNumber"
:label="v.name" :label="v.name"
:value="v.id" :value="v.deptNumber"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="handleOk" <el-button size="small" type="primary" @click="handleOk"
>确 定</el-button >确 定</el-button
> >
<el-button size="small" @click="handleRest">重 置</el-button> <el-button size="small" @click="handleRest">重 置</el-button>
</span> </span>
...@@ -85,9 +85,9 @@ export default { ...@@ -85,9 +85,9 @@ export default {
matterName: "", // 事项简称 matterName: "", // 事项简称
deptId: "", // 部门id deptId: "", // 部门id
matterNo: "", // 事项编号 matterNo: "", // 事项编号
siteId: local.getLocal("sampleSiteId") siteId: local.getLocal("writeSiteId")
? local.getLocal("sampleSiteId") ? local.getLocal("writeSiteId")
: "", : "",
source: 0, source: 0,
deptName: "", deptName: "",
}, },
...@@ -151,7 +151,7 @@ export default { ...@@ -151,7 +151,7 @@ export default {
this.Visible = false; this.Visible = false;
}, },
handleChange(val) { 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; this.form.deptName = name;
console.log(this.form.deptName); console.log(this.form.deptName);
}, },
......
...@@ -15,6 +15,14 @@ import com.mortals.xhx.module.matter.model.MatterDatumEntity; ...@@ -15,6 +15,14 @@ import com.mortals.xhx.module.matter.model.MatterDatumEntity;
*/ */
public interface MatterDatumService extends ICRUDService<MatterDatumEntity, Long> { 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); Rest<String> addPubdatum(Long[] pubIds,Long matterId,Long siteId, Context context);
/** /**
......
...@@ -90,12 +90,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD ...@@ -90,12 +90,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
@Override @Override
protected void saveAfter(MatterDatumEntity entity, Context context) throws AppException { protected void saveAfter(MatterDatumEntity entity, Context context) throws AppException {
int count = this.count(new MatterDatumQuery().matterId(entity.getMatterId()), context); statDatumCount(context, entity);
MatterEntity matterEntity = matterService.get(entity.getMatterId(), context);
if (!ObjectUtils.isEmpty(matterEntity)) {
matterEntity.setDatumCount(count);
matterService.update(matterEntity, context);
}
addPubdatum(entity, context); addPubdatum(entity, context);
super.saveAfter(entity, context); super.saveAfter(entity, context);
} }
...@@ -125,18 +120,32 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD ...@@ -125,18 +120,32 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
MatterDatumEntity matterDatumEntity = this.get(id, context); MatterDatumEntity matterDatumEntity = this.get(id, context);
int iRet = this.dao.delete(id); int iRet = this.dao.delete(id);
this.removeAfter(id, context, iRet); 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); int count = this.count(new MatterDatumQuery().matterId(matterDatumEntity.getMatterId()), context);
MatterEntity matterEntity = matterService.get(matterDatumEntity.getMatterId(), context); MatterEntity matterEntity = matterService.get(matterDatumEntity.getMatterId(), context);
if (!ObjectUtils.isEmpty(matterEntity)) { if (!ObjectUtils.isEmpty(matterEntity)) {
matterEntity.setDatumCount(count); matterEntity.setDatumCount(count);
matterService.update(matterEntity, context); matterService.update(matterEntity, context);
} }
return iRet;
} }
@Override @Override
protected void saveBefore(MatterDatumEntity entity, Context context) throws AppException { protected void saveBefore(MatterDatumEntity entity, Context context) throws AppException {
if (StringUtils.isEmpty(entity.getSamplePath())) { if (StringUtils.isEmpty(entity.getSamplePath())) {
throw new AppException("样表地址不能为空"); throw new AppException("样表地址不能为空");
} }
......
...@@ -56,7 +56,6 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -56,7 +56,6 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@Override @Override
protected void doListBefore(MatterEntity query, Map<String, Object> model, Context context) throws AppException { protected void doListBefore(MatterEntity query, Map<String, Object> model, Context context) throws AppException {
if (StringUtils.isNotEmpty(query.getMatterName())) { if (StringUtils.isNotEmpty(query.getMatterName())) {
query.setMatterName("%".concat(query.getMatterName()).concat("%")); query.setMatterName("%".concat(query.getMatterName()).concat("%"));
} }
...@@ -99,14 +98,14 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -99,14 +98,14 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@RequestMapping(value = {"recommend"},method = {RequestMethod.POST, RequestMethod.GET}) @RequestMapping(value = {"recommend"},method = {RequestMethod.POST, RequestMethod.GET})
public String recommend(Long id) { public String recommend(Long id) {
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
int code = 1; int code = VALUE_RESULT_SUCCESS;
String busiDesc = "推荐or取消推荐" + this.getModuleDesc(); String busiDesc = "推荐or取消推荐" + this.getModuleDesc();
try { try {
Rest<String> rest = this.service.recommend(id, getContext()); Rest<String> rest = this.service.recommend(id, getContext());
model.put("message_info", rest.getMsg()); model.put("message_info", rest.getMsg());
this.recordSysLog(this.request, rest.getMsg()); this.recordSysLog(this.request, rest.getMsg());
} catch (Exception e) { } catch (Exception e) {
code = -1; code = VALUE_RESULT_FAILURE;
this.doException(this.request, busiDesc, model, e); this.doException(this.request, busiDesc, model, e);
} }
......
...@@ -94,14 +94,14 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat ...@@ -94,14 +94,14 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
@RequestMapping(value = {"recommend"}, method = {RequestMethod.POST, RequestMethod.GET}) @RequestMapping(value = {"recommend"}, method = {RequestMethod.POST, RequestMethod.GET})
public String recommend(Long id, Long siteId) { public String recommend(Long id, Long siteId) {
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
int code = 1; int code = VALUE_RESULT_SUCCESS;
String busiDesc = "推荐or取消推荐" + this.getModuleDesc(); String busiDesc = "推荐or取消推荐" + this.getModuleDesc();
try { try {
Rest<String> rest = this.service.recommend(id, siteId, getContext()); Rest<String> rest = this.service.recommend(id, siteId, getContext());
model.put("message_info", rest.getMsg()); model.put("message_info", rest.getMsg());
this.recordSysLog(this.request, rest.getMsg()); this.recordSysLog(this.request, rest.getMsg());
} catch (Exception e) { } catch (Exception e) {
code = -1; code = VALUE_RESULT_FAILURE;
this.doException(this.request, busiDesc, model, e); 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