Merge remote-tracking branch 'origin/master'

master
夜笙歌 3 months ago
commit c1104a21ff

@ -26,4 +26,14 @@ public interface RemoteFileService
*/ */
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file); public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
/**
*
*
* @param file
* @return
*/
@PostMapping(value = "/upload2SharePath", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysFile> upload2SharePath(@RequestPart(value = "file") MultipartFile file);
} }

@ -30,6 +30,11 @@ public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileServ
{ {
return R.fail("上传文件失败:" + throwable.getMessage()); return R.fail("上传文件失败:" + throwable.getMessage());
} }
@Override
public R<SysFile> upload2SharePath(MultipartFile file) {
return R.fail("上传文件到共享文件夹失败:" + throwable.getMessage());
}
}; };
} }
} }

@ -45,4 +45,27 @@ public class SysFileController
return R.fail(e.getMessage()); return R.fail(e.getMessage());
} }
} }
/**
*
*/
@PostMapping("upload2SharePath")
public R<SysFile> upload2SharePath(MultipartFile file)
{
try
{
// 上传并返回访问地址
String url = sysFileService.uploadFile2SharePath(file);
SysFile sysFile = new SysFile();
sysFile.setName(FileUtils.getName(url));
sysFile.setUrl(url);
return R.ok(sysFile);
}
catch (Exception e)
{
log.error("上传文件到共享文件夹失败", e);
return R.fail(e.getMessage());
}
}
} }

@ -43,4 +43,9 @@ public class FastDfsSysFileServiceImpl implements ISysFileService
IoUtils.closeQuietly(inputStream); IoUtils.closeQuietly(inputStream);
return domain + "/" + storePath.getFullPath(); return domain + "/" + storePath.getFullPath();
} }
@Override
public String uploadFile2SharePath(MultipartFile file) throws Exception {
return null;
}
} }

@ -17,4 +17,13 @@ public interface ISysFileService
* @throws Exception * @throws Exception
*/ */
public String uploadFile(MultipartFile file) throws Exception; public String uploadFile(MultipartFile file) throws Exception;
/**
*
*
* @param file
* @return 访
* @throws Exception
*/
public String uploadFile2SharePath(MultipartFile file) throws Exception;
} }

@ -33,6 +33,19 @@ public class LocalSysFileServiceImpl implements ISysFileService
@Value("${file.path}") @Value("${file.path}")
private String localFilePath; private String localFilePath;
/**
*
*/
@Value("${file.sharePath}")
public String shareFilePath;
/**
*
*/
@Value("${file.sharePrefix}")
public String shareFilePrefix;
/** /**
* *
* *
@ -47,4 +60,21 @@ public class LocalSysFileServiceImpl implements ISysFileService
String url = domain + localFilePrefix + name; String url = domain + localFilePrefix + name;
return url; return url;
} }
/**
*
*
* @param file
* @return 访
* @throws Exception
*/
@Override
public String uploadFile2SharePath(MultipartFile file) throws Exception
{
String name = FileUploadUtils.upload(shareFilePath, file);
String url = domain + shareFilePrefix + name;
return url;
}
} }

@ -46,4 +46,9 @@ public class MinioSysFileServiceImpl implements ISysFileService
IoUtils.closeQuietly(inputStream); IoUtils.closeQuietly(inputStream);
return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName;
} }
@Override
public String uploadFile2SharePath(MultipartFile file) throws Exception {
return null;
}
} }

@ -3,6 +3,7 @@ package com.hw.mes.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.domain.R; import com.hw.common.core.domain.R;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.UUID; import com.hw.common.core.utils.uuid.UUID;
@ -30,8 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
*/ */
@RestController @RestController
@RequestMapping("/baseAttachInfo") @RequestMapping("/baseAttachInfo")
public class MesBaseAttachInfoController extends BaseController public class MesBaseAttachInfoController extends BaseController {
{
@Autowired @Autowired
private IMesBaseAttachInfoService mesBaseAttachInfoService; private IMesBaseAttachInfoService mesBaseAttachInfoService;
@ -43,8 +43,7 @@ public class MesBaseAttachInfoController extends BaseController
*/ */
@RequiresPermissions("mes:baseAttachInfo:list") @RequiresPermissions("mes:baseAttachInfo:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(MesBaseAttachInfo mesBaseAttachInfo) public TableDataInfo list(MesBaseAttachInfo mesBaseAttachInfo) {
{
startPage(); startPage();
List<MesBaseAttachInfo> list = mesBaseAttachInfoService.selectMesBaseAttachInfoList(mesBaseAttachInfo); List<MesBaseAttachInfo> list = mesBaseAttachInfoService.selectMesBaseAttachInfoList(mesBaseAttachInfo);
return getDataTable(list); return getDataTable(list);
@ -56,8 +55,7 @@ public class MesBaseAttachInfoController extends BaseController
@RequiresPermissions("mes:baseAttachInfo:export") @RequiresPermissions("mes:baseAttachInfo:export")
@Log(title = "附件信息", businessType = BusinessType.EXPORT) @Log(title = "附件信息", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, MesBaseAttachInfo mesBaseAttachInfo) public void export(HttpServletResponse response, MesBaseAttachInfo mesBaseAttachInfo) {
{
List<MesBaseAttachInfo> list = mesBaseAttachInfoService.selectMesBaseAttachInfoList(mesBaseAttachInfo); List<MesBaseAttachInfo> list = mesBaseAttachInfoService.selectMesBaseAttachInfoList(mesBaseAttachInfo);
ExcelUtil<MesBaseAttachInfo> util = new ExcelUtil<MesBaseAttachInfo>(MesBaseAttachInfo.class); ExcelUtil<MesBaseAttachInfo> util = new ExcelUtil<MesBaseAttachInfo>(MesBaseAttachInfo.class);
util.exportExcel(response, list, "附件信息数据"); util.exportExcel(response, list, "附件信息数据");
@ -68,8 +66,7 @@ public class MesBaseAttachInfoController extends BaseController
*/ */
@RequiresPermissions("mes:baseAttachInfo:query") @RequiresPermissions("mes:baseAttachInfo:query")
@GetMapping(value = "/{attachId}") @GetMapping(value = "/{attachId}")
public AjaxResult getInfo(@PathVariable("attachId") Long attachId) public AjaxResult getInfo(@PathVariable("attachId") Long attachId) {
{
return success(mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachId(attachId)); return success(mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachId(attachId));
} }
@ -79,8 +76,7 @@ public class MesBaseAttachInfoController extends BaseController
@RequiresPermissions("mes:baseAttachInfo:add") @RequiresPermissions("mes:baseAttachInfo:add")
@Log(title = "附件信息", businessType = BusinessType.INSERT) @Log(title = "附件信息", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody MesBaseAttachInfo mesBaseAttachInfo) public AjaxResult add(@RequestBody MesBaseAttachInfo mesBaseAttachInfo) {
{
return toAjax(mesBaseAttachInfoService.insertMesBaseAttachInfo(mesBaseAttachInfo)); return toAjax(mesBaseAttachInfoService.insertMesBaseAttachInfo(mesBaseAttachInfo));
} }
@ -90,8 +86,7 @@ public class MesBaseAttachInfoController extends BaseController
@RequiresPermissions("mes:baseAttachInfo:edit") @RequiresPermissions("mes:baseAttachInfo:edit")
@Log(title = "附件信息", businessType = BusinessType.UPDATE) @Log(title = "附件信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody MesBaseAttachInfo mesBaseAttachInfo) public AjaxResult edit(@RequestBody MesBaseAttachInfo mesBaseAttachInfo) {
{
return toAjax(mesBaseAttachInfoService.updateMesBaseAttachInfo(mesBaseAttachInfo)); return toAjax(mesBaseAttachInfoService.updateMesBaseAttachInfo(mesBaseAttachInfo));
} }
@ -101,25 +96,28 @@ public class MesBaseAttachInfoController extends BaseController
@RequiresPermissions("mes:baseAttachInfo:remove") @RequiresPermissions("mes:baseAttachInfo:remove")
@Log(title = "附件信息", businessType = BusinessType.DELETE) @Log(title = "附件信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{attachIds}") @DeleteMapping("/{attachIds}")
public AjaxResult remove(@PathVariable Long[] attachIds) public AjaxResult remove(@PathVariable Long[] attachIds) {
{
return toAjax(mesBaseAttachInfoService.deleteMesBaseAttachInfoByAttachIds(attachIds)); return toAjax(mesBaseAttachInfoService.deleteMesBaseAttachInfoByAttachIds(attachIds));
} }
/** /**
* MES * MES
*
* @param file * @param file
* @param processId * @param processId
* @param attachType * @param attachType
* @return * @return
*/ */
@PostMapping(value = "/drawingFileUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/drawingFileUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public AjaxResult drawingFileUpload(@RequestPart(value = "file") MultipartFile file, Long processId, String attachType){ public AjaxResult drawingFileUpload(@RequestPart(value = "file") MultipartFile file, Long processId, String attachType) {
if (!file.isEmpty()) if (!file.isEmpty()) {
{
R<SysFile> fileResult = null; R<SysFile> fileResult = null;
try { try {
if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)) {
fileResult = remoteFileService.upload2SharePath(file);
} else {
fileResult = remoteFileService.upload(file); fileResult = remoteFileService.upload(file);
}
} catch (Exception e) { } catch (Exception e) {
return error("文件服务异常,请联系管理员"); return error("文件服务异常,请联系管理员");
} }

@ -192,7 +192,7 @@
icon="el-icon-search" icon="el-icon-search"
size="mini" size="mini"
type="success" type="success"
@click="handleSOP(scope.row)" @click="handleSop(scope.row)"
v-if="scope.row.processType !== PROCESS_TYPE.AUTO && scope.row.children != null && scope.row.children !== undefined" v-if="scope.row.processType !== PROCESS_TYPE.AUTO && scope.row.children != null && scope.row.children !== undefined"
>SOP >SOP
</el-button> </el-button>
@ -242,9 +242,9 @@
single single
ref="drawingUpload" ref="drawingUpload"
list-type="picture-card" list-type="picture-card"
action="uploadImgUrl" action="uploadDrawingUrl"
:auto-upload="true" :auto-upload="true"
:limit="limit" :limit="drawingLimit"
:headers="headers" :headers="headers"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
:http-request="httpRequest" :http-request="httpRequest"
@ -275,7 +275,7 @@
</span> </span>
<span <span
class="el-upload-list__item-delete" class="el-upload-list__item-delete"
@click="handleRemove(file)" @click="handleRemoveDrawing(file)"
> >
<i class="el-icon-delete"></i> <i class="el-icon-delete"></i>
</span> </span>
@ -306,7 +306,7 @@
list-type="picture-card" list-type="picture-card"
action="uploadImgUrl" action="uploadImgUrl"
:auto-upload="true" :auto-upload="true"
:limit="limit" :limit="sopLimit"
:headers="headers" :headers="headers"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
:http-request="httpSopRequest" :http-request="httpSopRequest"
@ -337,7 +337,7 @@
</span> </span>
<span <span
class="el-upload-list__item-delete" class="el-upload-list__item-delete"
@click="handleRemove(file)" @click="handleRemoveSop(file)"
> >
<i class="el-icon-delete"></i> <i class="el-icon-delete"></i>
</span> </span>
@ -423,15 +423,22 @@ export default {
}, },
props: { props: {
value: [String, Object, Array, Number], value: [String, Object, Array, Number],
// // sop
limit: { sopLimit: {
type: Number,
default: 10,
},
//
drawingLimit: {
type: Number, type: Number,
default: 3, default: 10,
}, },
// (MB)
// (K)
fileSize: { fileSize: {
type: Number, type: Number,
default: 5, default: 500000,
}, },
// , ['png', 'jpg', 'jpeg'] // , ['png', 'jpg', 'jpeg']
fileType: { fileType: {
@ -456,6 +463,7 @@ export default {
checkedMesProductPlanList: [], checkedMesProductPlanList: [],
// //
uploadImgUrl: process.env.VUE_APP_BASE_API, uploadImgUrl: process.env.VUE_APP_BASE_API,
uploadDrawingUrl: process.env.VUE_APP_BASE_API + "/file/upload2SharePath",
// name // name
activeName: "columnInfo", activeName: "columnInfo",
// //
@ -509,15 +517,19 @@ export default {
// Sop // Sop
groupSopFile: {}, groupSopFile: {},
// Sop // Sop
groupSopFileList: [], groupSopFileList: {},
// SOP
uploadSopList: [],
// //
groupAttachFile: {}, groupAttachFile: {},
// //
groupAttachFileList: [], groupAttachFileList: {},
// //
uploadAttachList: [], uploadAttachList: {},
// SOP
uploadSopList: [], previewSopFlag: {},//SOP
previewDrawingFlag: {},//
//- //-
addProductPlanObject: {}, addProductPlanObject: {},
headers: { headers: {
@ -768,10 +780,10 @@ export default {
if (processUser.userId && processUser.userId !== '') { if (processUser.userId && processUser.userId !== '') {
toUpdatedProductPlan.userId = processUser.userId; toUpdatedProductPlan.userId = processUser.userId;
if(processUser.planBeginTime && processUser.planBeginTime!=='' && if (processUser.planBeginTime && processUser.planBeginTime !== '' &&
processUser.planEndTime && processUser.planEndTime!=='' && processUser.planEndTime && processUser.planEndTime !== '' &&
processUser.planBeginTime >= processUser.planEndTime){ processUser.planBeginTime >= processUser.planEndTime) {
this.$modal.msgError("序号"+(parseInt(e.index)+1)+":计划开始时间须小于计划结束时间"); this.$modal.msgError("序号" + (parseInt(e.index) + 1) + ":计划开始时间须小于计划结束时间");
return; return;
} }
toUpdatedProductPlan.planBeginTime = processUser.planBeginTime; toUpdatedProductPlan.planBeginTime = processUser.planBeginTime;
@ -802,11 +814,11 @@ export default {
return; return;
} }
if(e.firstFlag && e.firstFlag==="1"){// if (e.firstFlag && e.firstFlag === "1") {//
let dispatchAmount = e.dispatchAmount; let dispatchAmount = e.dispatchAmount;
const numericAmount = parseInt(dispatchAmount, 10); const numericAmount = parseInt(dispatchAmount, 10);
if (!this.isPositiveInteger(numericAmount) || numericAmount <= 0) { if (!this.isPositiveInteger(numericAmount) || numericAmount <= 0) {
this.$modal.msgError( "派工数量须为大于等于0的正整数"); this.$modal.msgError("派工数量须为大于等于0的正整数");
return; return;
} }
@ -1045,11 +1057,13 @@ export default {
window.open(file.url); window.open(file.url);
}, },
/** 查看图纸 */ /** 查看图纸 */
handleDrawing(row) { handleDrawing(row) {
this.fileList = []; this.fileList = [];
this.uploadAttachList = []; if (row.oldRowFlag && (!this.previewDrawingFlag[row.dispatchCode + "-" + row.processId]
if (row.oldRowFlag) { || this.previewDrawingFlag[row.dispatchCode + "-" + row.processId] !== "1")) {
this.previewDrawingFlag[row.dispatchCode + "-" + row.processId] = "1";
getDispatchDrawingList(row.dispatchCode, row.processId).then(res => { getDispatchDrawingList(row.dispatchCode, row.processId).then(res => {
let attachList = res.data; let attachList = res.data;
attachList.forEach(e => { attachList.forEach(e => {
@ -1057,52 +1071,36 @@ export default {
previewFile.url = e.attachPath; previewFile.url = e.attachPath;
previewFile.name = e.attachName; previewFile.name = e.attachName;
this.fileList.push(previewFile); this.fileList.push(previewFile);
this.uploadAttachList.push(e.attachId);
})
})
}
this.groupAttachFileList.forEach(e => { let groupAttachFile = {};
if (e.dispatchCode === row.dispatchCode && e.processId === row.processId) { groupAttachFile.dispatchCode = row.dispatchCode;
let previewFile = {}; groupAttachFile.processId = row.processId;
previewFile.url = e.attachPath; groupAttachFile.attachId = e.attachId;
previewFile.name = e.attachName; groupAttachFile.attachPath = e.attachPath;
this.fileList.push(previewFile); groupAttachFile.attachName = e.attachName;
this.uploadAttachList.push(e.attachId); let groupAttachFileList = this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
} this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = groupAttachFileList ? this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
}) this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(groupAttachFile);
this.addProductPlanObject = row;
this.blueprintModel = true; let uploadAttachList = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
}, this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = uploadAttachList ? this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(e.attachId);
/** 查看SOP附件 */
handleSOP(row) {
this.fileList = [];
this.uploadSopList = [];
if (row.oldRowFlag) {
getDispatchSOPAttachList(row.dispatchCode, row.processId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
this.uploadSopList.push(e.attachId);
}) })
}) })
} } else {
if (this.groupAttachFileList[row.dispatchCode + "-" + row.processId]) {
this.groupSopFileList.forEach(e => { this.groupAttachFileList[row.dispatchCode + "-" + row.processId].forEach(e => {
if (e.dispatchCode === row.dispatchCode && e.processId === row.processId) {
let previewFile = {}; let previewFile = {};
previewFile.url = e.attachPath; previewFile.url = e.attachPath;
previewFile.name = e.attachName; previewFile.name = e.attachName;
this.fileList.push(previewFile); this.fileList.push(previewFile);
this.uploadSopList.push(e.attachId);
}
}) })
}
}
this.addProductPlanObject = row; this.addProductPlanObject = row;
this.sopViewModel = true; this.blueprintModel = true;
}, },
// //
@ -1112,28 +1110,14 @@ export default {
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId) { && mesProductPlan.processId === this.addProductPlanObject.processId) {
this.mesProductPlanList[i].attachId = this.uploadAttachList.join(","); this.mesProductPlanList[i].attachId = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].join(",");
} }
} }
this.uploadAttachList = []; // this.uploadAttachList = [];
this.addProductPlanObject = null; this.addProductPlanObject = null;
this.blueprintModel = false; this.blueprintModel = false;
}, },
//SOP
sopFileUploadSubmit() {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
let mesProductPlan = this.mesProductPlanList[i];
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId) {
this.mesProductPlanList[i].sopId = this.uploadSopList.join(",");
}
}
this.uploadSopList = [];
this.addProductPlanObject = null;
this.sopViewModel = false;
},
// //
httpRequest(file) { httpRequest(file) {
@ -1145,6 +1129,10 @@ export default {
formData.append("attachType", "1"); formData.append("attachType", "1");
uploadFile(formData).then( uploadFile(formData).then(
(res) => { (res) => {
let uploadAttachList = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = uploadAttachList ? this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(res.attachId);
// //
let groupAttachFile = {}; let groupAttachFile = {};
groupAttachFile.dispatchCode = this.addProductPlanObject.dispatchCode; groupAttachFile.dispatchCode = this.addProductPlanObject.dispatchCode;
@ -1152,8 +1140,9 @@ export default {
groupAttachFile.attachId = res.attachId; groupAttachFile.attachId = res.attachId;
groupAttachFile.attachPath = res.imgUrl; groupAttachFile.attachPath = res.imgUrl;
groupAttachFile.attachName = res.fileName; groupAttachFile.attachName = res.fileName;
this.groupAttachFileList.push(groupAttachFile); let groupAttachFileList = this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.uploadAttachList.push(res.attachId); this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = groupAttachFileList ? this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(groupAttachFile);
}, (err) => { }, (err) => {
this.$refs.drawingUpload.clearFiles(); // this.$refs.drawingUpload.clearFiles(); //
this.$modal.closeLoading(); this.$modal.closeLoading();
@ -1161,17 +1150,110 @@ export default {
); );
}, },
//
handleRemoveDrawing(file) {
let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file);
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
// this.uploadAttachList.splice(index, 1);
// this.fileList.splice(index, 1);
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
let num = 0;
arrPic.map((item) => {
if (item.uid === file.uid) {
arrPic.splice(num, 1);
}
num++;
});
},
/** 查看sop */
handleSop(row) {
this.fileList = [];
if (row.oldRowFlag && (!this.previewSopFlag[row.dispatchCode + "-" + row.processId]
|| this.previewSopFlag[row.dispatchCode + "-" + row.processId] !== "1")) {
this.previewSopFlag[row.dispatchCode + "-" + row.processId] = "1";
getDispatchSOPAttachList(row.dispatchCode, row.processId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
let groupSopFile = {};
groupSopFile.dispatchCode = row.dispatchCode;
groupSopFile.processId = row.processId;
groupSopFile.attachId = e.attachId;
groupSopFile.attachPath = e.attachPath;
groupSopFile.attachName = e.attachName;
let groupSopFileList = this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = groupSopFileList ? this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(groupSopFile);
let uploadSopList = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = uploadSopList ? this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(e.attachId);
//SOP })
})
} else {
if (this.groupSopFileList[row.dispatchCode + "-" + row.processId]) {
this.groupSopFileList[row.dispatchCode + "-" + row.processId].forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
})
}
}
this.addProductPlanObject = row;
this.sopViewModel = true;
},
//sop
sopFileUploadSubmit() {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
let mesProductPlan = this.mesProductPlanList[i];
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId) {
this.mesProductPlanList[i].sopId = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].join(",");
}
}
// this.uploadAttachList = [];
this.addProductPlanObject = null;
this.sopViewModel = false;
},
//Sop
httpSopRequest(file) { httpSopRequest(file) {
// //
const fileData = file.file; const fileData = file.file;
const formData = new FormData(); const formData = new FormData();
formData.append("file", fileData); formData.append("file", fileData);
formData.append("processId", this.addProductPlanObject.processId); formData.append("processId", this.addProductPlanObject.processId);
formData.append("attachType", "1"); formData.append("attachType", "2");
uploadFile(formData).then( uploadFile(formData).then(
(res) => { (res) => {
let uploadSopList = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = uploadSopList ? this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(res.attachId);
// //
let groupSopFile = {}; let groupSopFile = {};
groupSopFile.dispatchCode = this.addProductPlanObject.dispatchCode; groupSopFile.dispatchCode = this.addProductPlanObject.dispatchCode;
@ -1179,8 +1261,9 @@ export default {
groupSopFile.attachId = res.attachId; groupSopFile.attachId = res.attachId;
groupSopFile.attachPath = res.imgUrl; groupSopFile.attachPath = res.imgUrl;
groupSopFile.attachName = res.fileName; groupSopFile.attachName = res.fileName;
this.groupSopFileList.push(groupSopFile); let groupSopFileList = this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.uploadSopList.push(res.attachId); this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = groupSopFileList ? this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(groupSopFile);
}, (err) => { }, (err) => {
this.$refs.drawingUpload.clearFiles(); // this.$refs.drawingUpload.clearFiles(); //
this.$modal.closeLoading(); this.$modal.closeLoading();
@ -1188,21 +1271,12 @@ export default {
); );
}, },
//
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = [];
this.number = 0;
this.form.monitorPic = this.fileList[0];
this.$modal.closeLoading();
}
},
// //
handleRemove(file) { handleRemoveSop(file) {
let arrPic = this.$refs.drawingUpload.uploadFiles; let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file); let index = arrPic.indexOf(file);
this.uploadList.splice(index, 1); this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
let num = 0; let num = 0;
arrPic.map((item) => { arrPic.map((item) => {
if (item.uid === file.uid) { if (item.uid === file.uid) {
@ -1211,6 +1285,11 @@ export default {
num++; num++;
}); });
}, },
// loading // loading
handleBeforeUpload(file) { handleBeforeUpload(file) {
// let isImg = false; // let isImg = false;

Loading…
Cancel
Save