见习之星考核过程(上传文件)
This commit is contained in:
parent
b54aa4397f
commit
77d127f37b
@ -3,6 +3,8 @@ package com.ruoyi.web.controller.jxzxkhgl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.jxzxkhgl.domain.TsbzJxzxkhgcwjsj;
|
||||||
|
import com.ruoyi.jxzxkhgl.service.ITsbzJxzxkhgcwjsjService;
|
||||||
import com.ruoyi.web.controller.common.SchoolCommonController;
|
import com.ruoyi.web.controller.common.SchoolCommonController;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -36,6 +38,8 @@ public class TsbzJxzxkhgcsjController extends BaseController {
|
|||||||
private ITsbzJxzxkhgcsjService tsbzJxzxkhgcsjService;
|
private ITsbzJxzxkhgcsjService tsbzJxzxkhgcsjService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SchoolCommonController schoolCommonController;
|
private SchoolCommonController schoolCommonController;
|
||||||
|
@Autowired
|
||||||
|
private ITsbzJxzxkhgcwjsjService tsbzJxzxkhgcwjsjService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询考核过程数据列表
|
* 查询考核过程数据列表
|
||||||
@ -80,8 +84,27 @@ public class TsbzJxzxkhgcsjController extends BaseController {
|
|||||||
@Log(title = "考核过程数据", businessType = BusinessType.INSERT)
|
@Log(title = "考核过程数据", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody TsbzJxzxkhgcsj tsbzJxzxkhgcsj) {
|
public AjaxResult add(@RequestBody TsbzJxzxkhgcsj tsbzJxzxkhgcsj) {
|
||||||
tsbzJxzxkhgcsj.setId(schoolCommonController.getUuid());
|
String uuid = schoolCommonController.getUuid();
|
||||||
|
tsbzJxzxkhgcsj.setId(uuid);
|
||||||
tsbzJxzxkhgcsj.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
|
tsbzJxzxkhgcsj.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||||
|
|
||||||
|
String filePaths = tsbzJxzxkhgcsj.getFilepath();
|
||||||
|
String fileNames = tsbzJxzxkhgcsj.getFilename();
|
||||||
|
if (!schoolCommonController.isStringEmpty(filePaths) && !schoolCommonController.isStringEmpty(fileNames)) {
|
||||||
|
String[] strArrFilePath = filePaths.split(";");
|
||||||
|
String[] strArrFileName = fileNames.split(";");
|
||||||
|
TsbzJxzxkhgcwjsj tsbzJxzxkhgcwjsj = null;
|
||||||
|
for (int i = 0; i < strArrFilePath.length; i++) {
|
||||||
|
tsbzJxzxkhgcwjsj = new TsbzJxzxkhgcwjsj();
|
||||||
|
tsbzJxzxkhgcwjsj.setFilepath(strArrFilePath[i]);
|
||||||
|
tsbzJxzxkhgcwjsj.setFilename(strArrFileName[i]);
|
||||||
|
tsbzJxzxkhgcwjsj.setGcid(uuid);
|
||||||
|
tsbzJxzxkhgcwjsj.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||||
|
|
||||||
|
tsbzJxzxkhgcwjsjService.insertTsbzJxzxkhgcwjsj(tsbzJxzxkhgcwjsj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return toAjax(tsbzJxzxkhgcsjService.insertTsbzJxzxkhgcsj(tsbzJxzxkhgcsj));
|
return toAjax(tsbzJxzxkhgcsjService.insertTsbzJxzxkhgcsj(tsbzJxzxkhgcsj));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +115,27 @@ public class TsbzJxzxkhgcsjController extends BaseController {
|
|||||||
@Log(title = "考核过程数据", businessType = BusinessType.UPDATE)
|
@Log(title = "考核过程数据", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody TsbzJxzxkhgcsj tsbzJxzxkhgcsj) {
|
public AjaxResult edit(@RequestBody TsbzJxzxkhgcsj tsbzJxzxkhgcsj) {
|
||||||
|
//1先清空文件数据;
|
||||||
|
String[] tmp = new String[1];
|
||||||
|
tmp[0] = tsbzJxzxkhgcsj.getId();
|
||||||
|
tsbzJxzxkhgcwjsjService.deleteTsbzJxzxkhgcwjsjByGcIds(tmp);
|
||||||
|
|
||||||
|
//2再重新创建;
|
||||||
|
String filePaths = tsbzJxzxkhgcsj.getFilepath();
|
||||||
|
String fileNames = tsbzJxzxkhgcsj.getFilename();
|
||||||
|
if (!schoolCommonController.isStringEmpty(filePaths) && !schoolCommonController.isStringEmpty(fileNames)) {
|
||||||
|
String[] strArrFilePath = filePaths.split(";");
|
||||||
|
String[] strArrFileName = fileNames.split(";");
|
||||||
|
TsbzJxzxkhgcwjsj tsbzJxzxkhgcwjsj = null;
|
||||||
|
for (int i = 0; i < strArrFilePath.length; i++) {
|
||||||
|
tsbzJxzxkhgcwjsj = new TsbzJxzxkhgcwjsj();
|
||||||
|
tsbzJxzxkhgcwjsj.setFilepath(strArrFilePath[i]);
|
||||||
|
tsbzJxzxkhgcwjsj.setFilename(strArrFileName[i]);
|
||||||
|
tsbzJxzxkhgcwjsj.setGcid(tsbzJxzxkhgcsj.getId());
|
||||||
|
tsbzJxzxkhgcwjsj.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||||
|
tsbzJxzxkhgcwjsjService.insertTsbzJxzxkhgcwjsj(tsbzJxzxkhgcwjsj);
|
||||||
|
}
|
||||||
|
}
|
||||||
return toAjax(tsbzJxzxkhgcsjService.updateTsbzJxzxkhgcsj(tsbzJxzxkhgcsj));
|
return toAjax(tsbzJxzxkhgcsjService.updateTsbzJxzxkhgcsj(tsbzJxzxkhgcsj));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +146,9 @@ public class TsbzJxzxkhgcsjController extends BaseController {
|
|||||||
@Log(title = "考核过程数据", businessType = BusinessType.DELETE)
|
@Log(title = "考核过程数据", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable String[] ids) {
|
public AjaxResult remove(@PathVariable String[] ids) {
|
||||||
|
//清空考核数据先清空文件数据
|
||||||
|
tsbzJxzxkhgcwjsjService.deleteTsbzJxzxkhgcwjsjByGcIds(ids);
|
||||||
|
|
||||||
return toAjax(tsbzJxzxkhgcsjService.deleteTsbzJxzxkhgcsjByIds(ids));
|
return toAjax(tsbzJxzxkhgcsjService.deleteTsbzJxzxkhgcsjByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,18 @@ public class TsbzJxzxkhgcsj extends BaseEntity {
|
|||||||
@Excel(name = "创建人")
|
@Excel(name = "创建人")
|
||||||
private Long createuserid;
|
private Long createuserid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "文件名称")
|
||||||
|
private String filename;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
@Excel(name = "文件路径")
|
||||||
|
private String filepath;
|
||||||
|
|
||||||
private TsbzJxzxkhzbx tsbzJxzxkhzbx;
|
private TsbzJxzxkhzbx tsbzJxzxkhzbx;
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
@ -93,6 +105,22 @@ public class TsbzJxzxkhgcsj extends BaseEntity {
|
|||||||
this.tsbzJxzxkhzbx = tsbzJxzxkhzbx;
|
this.tsbzJxzxkhzbx = tsbzJxzxkhzbx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFilename(String filename) {
|
||||||
|
this.filename = filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilename() {
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilepath(String filepath) {
|
||||||
|
this.filepath = filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilepath() {
|
||||||
|
return filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@ -104,6 +132,8 @@ public class TsbzJxzxkhgcsj extends BaseEntity {
|
|||||||
.append("createuserid", getCreateuserid())
|
.append("createuserid", getCreateuserid())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("tsbzJxzxkhzbx", getTsbzJxzxkhzbx())
|
.append("tsbzJxzxkhzbx", getTsbzJxzxkhzbx())
|
||||||
|
.append("filename", getFilename())
|
||||||
|
.append("filepath", getFilepath())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,4 +58,12 @@ public interface TsbzJxzxkhgcwjsjMapper {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteTsbzJxzxkhgcwjsjByIds(Long[] ids);
|
public int deleteTsbzJxzxkhgcwjsjByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除考核过程文件数据
|
||||||
|
*
|
||||||
|
* @param gcids 需要删除的考核过程文件数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteTsbzJxzxkhgcwjsjByGcIds(String[] gcids);
|
||||||
}
|
}
|
||||||
|
@ -58,4 +58,12 @@ public interface ITsbzJxzxkhgcwjsjService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteTsbzJxzxkhgcwjsjById(Long id);
|
public int deleteTsbzJxzxkhgcwjsjById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除考核过程文件数据
|
||||||
|
*
|
||||||
|
* @param gcids 需要删除的考核过程文件数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteTsbzJxzxkhgcwjsjByGcIds(String[] gcids);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,16 @@ public class TsbzJxzxkhgcwjsjServiceImpl implements ITsbzJxzxkhgcwjsjService {
|
|||||||
return tsbzJxzxkhgcwjsjMapper.deleteTsbzJxzxkhgcwjsjByIds(ids);
|
return tsbzJxzxkhgcwjsjMapper.deleteTsbzJxzxkhgcwjsjByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除考核过程文件数据
|
||||||
|
*
|
||||||
|
* @param gcids 需要删除的考核过程文件数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteTsbzJxzxkhgcwjsjByGcIds(String[] gcids) {
|
||||||
|
return tsbzJxzxkhgcwjsjMapper.deleteTsbzJxzxkhgcwjsjByGcIds(gcids);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除考核过程文件数据信息
|
* 删除考核过程文件数据信息
|
||||||
*
|
*
|
||||||
|
@ -73,4 +73,11 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteTsbzJxzxkhgcwjsjByGcIds" parameterType="String">
|
||||||
|
delete from tsbz_jxzxkhgcwjsj where gcid in
|
||||||
|
<foreach item="gcid" collection="array" open="(" separator="," close=")">
|
||||||
|
#{gcid}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -112,8 +112,8 @@
|
|||||||
<el-form-item label="内容" prop="content">
|
<el-form-item label="内容" prop="content">
|
||||||
<el-input v-model="form.content" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.content" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选择文件" prop="fileurl">
|
<el-form-item label="选择文件" prop="filepath">
|
||||||
<el-input v-model="form.fileurl" v-if="false" />
|
<el-input v-model="form.filepath" v-if="false" />
|
||||||
<el-upload
|
<el-upload
|
||||||
class="upload-demo"
|
class="upload-demo"
|
||||||
:action="uploadFileUrl"
|
:action="uploadFileUrl"
|
||||||
@ -121,7 +121,7 @@
|
|||||||
:on-preview="handlePreview"
|
:on-preview="handlePreview"
|
||||||
:on-remove="handleRemove"
|
:on-remove="handleRemove"
|
||||||
:before-remove="beforeRemove"
|
:before-remove="beforeRemove"
|
||||||
:limit="1"
|
:limit="filecount"
|
||||||
:on-exceed="handleExceed"
|
:on-exceed="handleExceed"
|
||||||
:file-list="fileList"
|
:file-list="fileList"
|
||||||
:on-success="handleAvatarSuccess"
|
:on-success="handleAvatarSuccess"
|
||||||
@ -154,6 +154,7 @@ export default {
|
|||||||
name: "Jxzxkhgcsj",
|
name: "Jxzxkhgcsj",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
filecount: 1,
|
||||||
khnr: "",
|
khnr: "",
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
@ -210,17 +211,23 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleAvatarSuccess(res, file) {
|
handleAvatarSuccess(res, file) {
|
||||||
//console.log(res);
|
//console.log(res, file);
|
||||||
if (res.code == "200") {
|
if (res.code == "200") {
|
||||||
this.form.fileurl = res.fileName;
|
this.form.filepath = this.form.filepath + res.fileName + ";";
|
||||||
|
this.form.filename = this.form.filename + file.name + ";";
|
||||||
} else {
|
} else {
|
||||||
this.msgError(res.msg);
|
this.msgError(res.msg);
|
||||||
}
|
}
|
||||||
|
//console.log(this.form.filepath, this.form.filename);
|
||||||
},
|
},
|
||||||
handleRemove(file, fileList) {
|
handleRemove(file, fileList) {
|
||||||
//console.log(file, fileList);
|
//console.log(file, fileList);
|
||||||
if (file.response.code == "200") {
|
if (file.response.code == "200") {
|
||||||
this.form.fileurl = "";
|
this.form.filepath = this.form.filepath.replace(
|
||||||
|
file.response.fileName + ";",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
this.form.filename = this.form.filename.replace(file.name + ";", "");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handlePreview(file) {
|
handlePreview(file) {
|
||||||
@ -228,9 +235,11 @@ export default {
|
|||||||
},
|
},
|
||||||
handleExceed(files, fileList) {
|
handleExceed(files, fileList) {
|
||||||
this.$message.warning(
|
this.$message.warning(
|
||||||
`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
|
`当前限制选择 ` +
|
||||||
files.length + fileList.length
|
this.filecount +
|
||||||
} 个文件`
|
` 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
|
||||||
|
files.length + fileList.length
|
||||||
|
} 个文件`
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
beforeRemove(file, fileList) {
|
beforeRemove(file, fileList) {
|
||||||
@ -280,6 +289,8 @@ export default {
|
|||||||
createuserid: null,
|
createuserid: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
khnr: null,
|
khnr: null,
|
||||||
|
filepath: "",
|
||||||
|
filename: "",
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
this.fileList = [];
|
this.fileList = [];
|
||||||
@ -304,7 +315,8 @@ export default {
|
|||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids;
|
const id = row.id || this.ids;
|
||||||
//console.log("id:" + row.tsbzJxzxkhzbx.khnr);
|
//console.log("tjsl:" + row.tsbzJxzxkhzbx.tjsl);
|
||||||
|
this.filecount = row.tsbzJxzxkhzbx.tjsl;
|
||||||
|
|
||||||
if (id != "") {
|
if (id != "") {
|
||||||
getJxzxkhgcsj(id).then((response) => {
|
getJxzxkhgcsj(id).then((response) => {
|
||||||
@ -350,6 +362,11 @@ export default {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
|
console.log(ids);
|
||||||
|
if (ids.length <= 0) {
|
||||||
|
this.msgError("数据已清空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$confirm("是否确认清空考核过程数据的数据项?", "警告", {
|
this.$confirm("是否确认清空考核过程数据的数据项?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user