change - 添加生产派工时上传图纸页面(预览、删除、下载)与后台逻辑

master
yinq 9 months ago
parent 8e3cd2d2da
commit 4c34612a58

@ -1,19 +1,16 @@
package com.hw.mes.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.common.core.domain.R;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.UUID;
import com.hw.system.api.RemoteFileService;
import com.hw.system.api.domain.SysFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
@ -23,6 +20,7 @@ import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
@ -37,6 +35,9 @@ public class MesBaseAttachInfoController extends BaseController
@Autowired
private IMesBaseAttachInfoService mesBaseAttachInfoService;
@Autowired
private RemoteFileService remoteFileService;
/**
*
*/
@ -80,7 +81,6 @@ public class MesBaseAttachInfoController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody MesBaseAttachInfo mesBaseAttachInfo)
{
mesBaseAttachInfo.setCreateBy(SecurityUtils.getLoginUser().getUsername());
return toAjax(mesBaseAttachInfoService.insertMesBaseAttachInfo(mesBaseAttachInfo));
}
@ -92,7 +92,6 @@ public class MesBaseAttachInfoController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody MesBaseAttachInfo mesBaseAttachInfo)
{
mesBaseAttachInfo.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
return toAjax(mesBaseAttachInfoService.updateMesBaseAttachInfo(mesBaseAttachInfo));
}
@ -106,4 +105,40 @@ public class MesBaseAttachInfoController extends BaseController
{
return toAjax(mesBaseAttachInfoService.deleteMesBaseAttachInfoByAttachIds(attachIds));
}
/**
* MES
* @param file
* @return AjaxResult
*/
@PostMapping(value = "/drawingFileUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public AjaxResult drawingFileUpload(@RequestPart(value = "file") MultipartFile file, Long processId){
if (!file.isEmpty())
{
R<SysFile> fileResult = null;
try {
fileResult = remoteFileService.upload(file);
} catch (Exception e) {
return error("文件服务异常,请联系管理员");
}
String url = fileResult.getData().getUrl();
String name = fileResult.getData().getName();
MesBaseAttachInfo info = new MesBaseAttachInfo();
info.setAttachCode(UUID.fastUUID().toString());
info.setAttachName(name);
info.setAttachType("1");
// String fixedString = "/statics";
// url = url.substring(url.indexOf(fixedString) + fixedString.length());
info.setAttachPath(url);
info.setProcessId(processId);
int attachId = mesBaseAttachInfoService.insertMesBaseAttachInfo(info);
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", url);
ajax.put("attachId", attachId);
ajax.put("fileName", name);
return ajax;
}
return error("上传图片异常,请联系管理员");
}
}

@ -138,4 +138,15 @@ public class MesProductPlanController extends BaseController
return toAjax(mesProductPlanService.orderAddMesProductPlanList(mesProductPlanList));
}
/**
* List
* @param planId
* @return
*/
@GetMapping(value = "/drawingList/{planId}")
public AjaxResult getDispatchDrawingList(@PathVariable("planId") Long planId)
{
return success(mesProductPlanService.getDispatchDrawingList(planId));
}
}

@ -32,7 +32,7 @@ public class MesBaseAttachInfo extends BaseEntity {
private String attachName;
/**
*
* 1-2-SOP9-
*/
@Excel(name = "附件类别")
private String attachType;

@ -32,8 +32,8 @@ public class MesProductPlan extends BaseEntity
@Excel(name = "生产工单编号")
private String orderCode;
/** 工单编号 */
@Excel(name = "工单编号")
/** 计划编号 */
@Excel(name = "计划编号")
private String planCode;
/** 派工单号;主要为顺序生产时,获取上一工序的派工单是否完成,每次派工生成的派工单号相同,不同次派工的派工单号不能相同 */

@ -27,6 +27,7 @@ public interface MesBaseAttachInfoMapper
*/
public List<MesBaseAttachInfo> selectMesBaseAttachInfoList(MesBaseAttachInfo mesBaseAttachInfo);
/**
*
*
@ -58,4 +59,12 @@ public interface MesBaseAttachInfoMapper
* @return
*/
public int deleteMesBaseAttachInfoByAttachIds(Long[] attachIds);
/**
*
*
* @param attachIds
* @return
*/
public List<MesBaseAttachInfo> selectMesBaseAttachInfoByAttachIds(Long[] attachIds);
}

@ -58,4 +58,11 @@ public interface IMesBaseAttachInfoService
* @return
*/
public int deleteMesBaseAttachInfoByAttachId(Long attachId);
/**
*
* @param attachIds
* @return
*/
public List<MesBaseAttachInfo> selectMesBaseAttachInfoByAttachIds(Long[] attachIds);
}

@ -1,6 +1,8 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.domain.MesProductPlan;
/**
@ -82,4 +84,12 @@ public interface IMesProductPlanService
* @return
*/
public int orderAddMesProductPlanList(List<MesProductPlan> mesProductPlanList);
/**
* List
* @param planId
* @return
*/
public List<MesBaseAttachInfo> getDispatchDrawingList(Long planId);
}

@ -45,6 +45,18 @@ public class MesBaseAttachInfoServiceImpl implements IMesBaseAttachInfoService
return mesBaseAttachInfoMapper.selectMesBaseAttachInfoList(mesBaseAttachInfo);
}
/**
*
*
* @param attachIds
* @return
*/
@Override
public List<MesBaseAttachInfo> selectMesBaseAttachInfoByAttachIds(Long[] attachIds)
{
return mesBaseAttachInfoMapper.selectMesBaseAttachInfoByAttachIds(attachIds);
}
/**
*
*
@ -56,7 +68,8 @@ public class MesBaseAttachInfoServiceImpl implements IMesBaseAttachInfoService
{
mesBaseAttachInfo.setCreateBy(SecurityUtils.getUsername());
mesBaseAttachInfo.setCreateTime(DateUtils.getNowDate());
return mesBaseAttachInfoMapper.insertMesBaseAttachInfo(mesBaseAttachInfo);
mesBaseAttachInfoMapper.insertMesBaseAttachInfo(mesBaseAttachInfo);
return mesBaseAttachInfo.getAttachId().intValue();
}
/**

@ -1,14 +1,20 @@
package com.hw.mes.service.impl;
import java.util.Arrays;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.service.IMesBaseAttachInfoService;
import com.hw.mes.service.IMesProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.mes.domain.MesProductPlanDetail;
@ -23,14 +29,16 @@ import com.hw.mes.service.IMesProductPlanService;
* @date 2024-02-21
*/
@Service
public class MesProductPlanServiceImpl implements IMesProductPlanService
{
public class MesProductPlanServiceImpl implements IMesProductPlanService {
@Autowired
private MesProductPlanMapper mesProductPlanMapper;
@Autowired
private IMesProductOrderService mesProductOrderService;
@Autowired
private IMesBaseAttachInfoService mesBaseAttachInfoService;
/**
*
*
@ -38,8 +46,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
* @return
*/
@Override
public MesProductPlan selectMesProductPlanByPlanId(Long planId)
{
public MesProductPlan selectMesProductPlanByPlanId(Long planId) {
return mesProductPlanMapper.selectMesProductPlanByPlanId(planId);
}
@ -50,8 +57,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
* @return
*/
@Override
public List<MesProductPlan> selectMesProductPlanList(MesProductPlan mesProductPlan)
{
public List<MesProductPlan> selectMesProductPlanList(MesProductPlan mesProductPlan) {
return mesProductPlanMapper.selectMesProductPlanList(mesProductPlan);
}
@ -63,8 +69,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
*/
@Transactional
@Override
public int insertMesProductPlan(MesProductPlan mesProductPlan)
{
public int insertMesProductPlan(MesProductPlan mesProductPlan) {
mesProductPlan.setCreateBy(SecurityUtils.getUsername());
mesProductPlan.setCreateTime(DateUtils.getNowDate());
mesProductPlan.setPlanCode(Seq.getId(Seq.planCodeSeqType, Seq.planCodeCode));
@ -86,8 +91,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
*/
@Transactional
@Override
public int updateMesProductPlan(MesProductPlan mesProductPlan)
{
public int updateMesProductPlan(MesProductPlan mesProductPlan) {
mesProductPlan.setUpdateBy(SecurityUtils.getUsername());
mesProductPlan.setUpdateTime(DateUtils.getNowDate());
mesProductPlanMapper.deleteMesProductPlanDetailByPlanId(mesProductPlan.getPlanId());
@ -103,8 +107,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
*/
@Transactional
@Override
public int deleteMesProductPlanByPlanIds(Long[] planIds)
{
public int deleteMesProductPlanByPlanIds(Long[] planIds) {
mesProductPlanMapper.deleteMesProductPlanDetailByPlanIds(planIds);
return mesProductPlanMapper.deleteMesProductPlanByPlanIds(planIds);
}
@ -117,8 +120,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
*/
@Transactional
@Override
public int deleteMesProductPlanByPlanId(Long planId)
{
public int deleteMesProductPlanByPlanId(Long planId) {
mesProductPlanMapper.deleteMesProductPlanDetailByPlanId(planId);
return mesProductPlanMapper.deleteMesProductPlanByPlanId(planId);
}
@ -128,20 +130,16 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
*
* @param mesProductPlan
*/
public void insertMesProductPlanDetail(MesProductPlan mesProductPlan)
{
public void insertMesProductPlanDetail(MesProductPlan mesProductPlan) {
List<MesProductPlanDetail> mesProductPlanDetailList = mesProductPlan.getMesProductPlanDetailList();
Long planId = mesProductPlan.getPlanId();
if (StringUtils.isNotNull(mesProductPlanDetailList))
{
if (StringUtils.isNotNull(mesProductPlanDetailList)) {
List<MesProductPlanDetail> list = new ArrayList<>();
for (MesProductPlanDetail mesProductPlanDetail : mesProductPlanDetailList)
{
for (MesProductPlanDetail mesProductPlanDetail : mesProductPlanDetailList) {
mesProductPlanDetail.setPlanId(planId);
list.add(mesProductPlanDetail);
}
if (list.size() > 0)
{
if (list.size() > 0) {
mesProductPlanMapper.batchMesProductPlanDetail(list);
}
}
@ -149,6 +147,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
/**
*
*
* @return
*/
@Override
@ -158,6 +157,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
/**
* List
*
* @param mesProductPlanList
* @return
*/
@ -169,6 +169,29 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
return 1;
}
/**
* List
*
* @param planId
* @return
*/
@Override
public List<MesBaseAttachInfo> getDispatchDrawingList(Long planId) {
MesProductPlan mesProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(planId);
if (StringUtils.isEmpty(mesProductPlan.getAttachId())) {
return new ArrayList<>();
}
try {
Long[] attachIds = Arrays.stream(mesProductPlan.getAttachId().split(","))
.map(String::trim)
.map(Long::parseLong)
.toArray(Long[]::new);
return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(attachIds);
} catch (Exception e) {
return new ArrayList<>();
}
}
/**
* Join product_orderbase_material
*
@ -176,8 +199,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
* @return
*/
@Override
public List<MesProductPlan> selectMesProductPlanJoinList(MesProductPlan mesProductPlan)
{
public List<MesProductPlan> selectMesProductPlanJoinList(MesProductPlan mesProductPlan) {
Long stationId = SecurityUtils.getStationd();
System.out.println("stationId: " + stationId);
return mesProductPlanMapper.selectMesProductPlanJoinList(mesProductPlan);

@ -114,4 +114,12 @@
#{attachId}
</foreach>
</delete>
<select id="selectMesBaseAttachInfoByAttachIds" parameterType="Long" resultMap="MesBaseAttachInfoResult">
<include refid="selectMesBaseAttachInfoVo"/>
where attach_id in
<foreach item="attachId" collection="array" open="(" separator="," close=")">
#{attachId}
</foreach>
</select>
</mapper>

@ -68,3 +68,23 @@ export function getProductPlan(query) {
params: query
})
}
export function uploadFile(data) {
return request({
url: '/mes/baseAttachInfo/drawingFileUpload',
method: 'post',
timeout: 1000000,//超时时间需要设置的较大,否则容易上传失败
headers: {
'Content-Type': 'multipart/form-data'//文件上传需要设置该参数
},
data
})
}
// 获取生产派工图纸List列表
export function getDispatchDrawingList(planId) {
return request({
url: '/mes/productplan/drawingList/' + planId,
method: 'get'
})
}

@ -53,28 +53,28 @@
v-hasPermi="['mes:baseAttachInfo:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:baseAttachInfo:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:baseAttachInfo:remove']"
>删除</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['mes:baseAttachInfo:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['mes:baseAttachInfo:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
@ -114,24 +114,24 @@
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:baseAttachInfo:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:baseAttachInfo:remove']"
>删除</el-button>
</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['mes:baseAttachInfo:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['mes:baseAttachInfo:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination
@ -272,7 +272,7 @@ export default {
attachId: null,
attachCode: null,
attachName: null,
attachType: null,
attachType: '1',
attachPath: null,
processId: null,
activeFlag: null,

@ -117,11 +117,18 @@
width="30%"
@before-close="blueprintModel = false">
<el-upload
ref="upload"
single
ref="drawingUpload"
list-type="picture-card"
action="uploadImgUrl"
:auto-upload="true"
action="http://localhost:7080/dev-api/file/upload"
multiple
list-type="picture-card">
:limit="limit"
:headers="headers"
:before-upload="handleBeforeUpload"
:http-request="httpRequest"
:on-exceed="handleExceed"
:file-list="fileList"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{file}">
<img
@ -146,7 +153,7 @@
</span>
<span
class="el-upload-list__item-delete"
@click="$refs.upload.handleRemove(file)"
@click="handleRemove(file)"
>
<i class="el-icon-delete"></i>
</span>
@ -154,12 +161,28 @@
</div>
</el-upload>
<span slot="footer" class="dialog-footer">
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="isShowTip">
请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b></template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
的文件
</div>
<el-button type="primary" @click="drawingFileUploadSubmit"> </el-button>
<el-button @click="blueprintModel = false"> </el-button>
<el-button type="primary" @click="blueprintModel = false"> </el-button>
</span>
</span>
</el-dialog>
<el-dialog :visible.sync="pictureDetailModel">
<img :src="dialogImageUrl" alt="" width="100%">
<el-dialog
:visible.sync="pictureDetailModel"
title="图纸预览"
width="800"
append-to-body
>
<img
:src="dialogImageUrl"
style="display: block; max-width: 100%; margin: 0 auto"
/>
</el-dialog>
</div>
@ -167,17 +190,50 @@
<script>
import {getProductOrder} from "@//api/mes/productOrder";
import {getDispatchCode, getProductPlan, orderAddMesProductPlanList} from "@//api/mes/productplan";
import {
getDispatchCode, getDispatchDrawingList,
getProductPlan,
orderAddMesProductPlanList,
updateProductplan,
uploadFile
} from "@//api/mes/productplan";
import {getStationByRouteId} from "@//api/mes/baseRoute";
import {getToken} from "@//utils/auth";
export default {
name: "productPlanEdit",
dicts: ['active_flag', 'product_status'],
dicts: ['product_status'],
props: {
value: [String, Object, Array, Number],
//
limit: {
type: Number,
default: 3,
},
// (MB)
fileSize: {
type: Number,
default: 5,
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["png", "jpg", "jpeg"],
},
//
isShowTip: {
type: Boolean,
default: true
}
},
data() {
return {
blueprintModel: false,
pictureDetailModel: false,
//
dialogImageUrl: '',
//
uploadImgUrl: process.env.VUE_APP_BASE_API,
// name
activeName: "columnInfo",
//
@ -186,8 +242,6 @@ export default {
tables: [],
//
columns: [],
//
productplanList: [],
//
mesProductPlanList: [],
//
@ -221,6 +275,15 @@ export default {
{required: true, message: "是否标识不能为空", trigger: "change"}
],
},
//
fileList: [],
//
uploadList: [],
//-
addProductPlanObject: {},
headers: {
Authorization: "Bearer " + getToken(),
},
};
},
created() {
@ -243,8 +306,7 @@ export default {
isAssetTypeAnImage(ext) {
let suffix = ext.lastIndexOf(".");
let name = ext.substr(suffix + 1);
return [
'png', 'jpg', 'jpeg'].includes(name.toLowerCase())
return ['png', 'jpg', 'jpeg'].includes(name.toLowerCase())
},
/** 提交按钮 */
submitForm() {
@ -286,29 +348,39 @@ export default {
this.$modal.msgSuccess(res.msg);
this.close();
});
}
,
},
/** 生产计划明细序号 */
rowMesProductPlanIndex({row, rowIndex}) {
row.index = rowIndex + 1;
}
,
},
/** 复选框选中数据 */
handleMesProductPlanSelectionChange(selection) {
this.checkedMesProductPlan = selection.map(item => item.index)
}
,
},
/** 关闭按钮 */
close() {
const obj = {path: "/mes/plan/productOrder", query: {t: Date.now(), pageNum: this.$route.query.pageNum}};
this.$tab.closeOpenPage(obj);
}
,
},
/** 查看图纸 */
handleDrawing(row) {
this.blueprintModel = true
}
,
this.fileList = [];
this.uploadList = [];
if (row.planId != null){
getDispatchDrawingList(row.planId).then(res =>{
let attachList = res.data;
attachList.forEach(e =>{
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
this.uploadList.push(e.attachId);
})
})
}
this.addProductPlanObject = row;
this.blueprintModel = true;
},
/** 生产计划添加按钮操作 */
handleAddMesProductPlan() {
let dispatchCode = "";
@ -353,47 +425,120 @@ export default {
})
})
})
}
,
},
isPositiveInteger(value) {
// 使
return /^[1-9]\d*$/.test(value);
}
,
/** 生产计划明细删除按钮操作 */
handleDeleteMesProductPlan() {
if (this.checkedMesProductPlan.length == 0) {
this.$modal.msgError("请先选择要删除的生产计划明细数据");
} else {
const mesProductPlanList = this.mesProductPlanList;
const checkedMesProductPlan = this.checkedMesProductPlan;
this.mesProductPlanList = mesProductPlanList.filter(function (item) {
return checkedMesProductPlan.indexOf(item.index) == -1
});
}
},
//
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.pictureDetailModel = true;
}
,
},
//
handleDownload(file) {
console.log(file);
}
window.open(file.url);
},
//
drawingFileUploadSubmit() {
// false=true=
if (this.addProductPlanObject.oldRowFlag) {
updateProductplan({
planId: this.addProductPlanObject.planId,
attachId: this.uploadList.join(","),
}).then(res => {
this.$modal.msgSuccess("上传图纸成功!");
}
)
} else {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
if (this.mesProductPlanList[i].index === this.addProductPlanObject.index) {
this.mesProductPlanList[i].attachId = this.uploadList.join(",");
}
}
}
this.uploadList = [];
this.addProductPlanObject = null;
this.blueprintModel = false;
},
//
httpRequest(file) {
//
const fileData = file.file;
const formData = new FormData();
formData.append("file", fileData);
formData.append("processId", this.addProductPlanObject.processId);
uploadFile(formData).then(
(res) => {
//
this.uploadList.push(res.attachId);
}, (err) => {
this.$refs.drawingUpload.clearFiles(); //
this.$modal.closeLoading();
}
);
},
//
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) {
let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file);
this.uploadList.splice(index, 1);
let num = 0;
arrPic.map((item) => {
if (item.uid === file.uid) {
arrPic.splice(num, 1);
}
num++;
});
},
// loading
handleBeforeUpload(file) {
// let isImg = false;
// if (this.fileType.length) {
// let fileExtension = "";
// if (file.name.lastIndexOf(".") > -1) {
// fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
// }
// isImg = this.fileType.some(type => {
// if (file.type.indexOf(type) > -1) return true;
// if (fileExtension && fileExtension.indexOf(type) > -1) return true;
// return false;
// });
// } else {
// isImg = file.type.indexOf("image") > -1;
// }
//
// if (!isImg) {
// this.$modal.msgError(`, ${this.fileType.join("/")}!`);
// return false;
// }
// if (this.fileSize) {
// const isLt = file.size / 1024 / 1024 < this.fileSize;
// if (!isLt) {
// this.$modal.msgError(` ${this.fileSize} MB!`);
// return false;
// }
// }
// this.$modal.loading("...");
// this.number++;
},
//
handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} !`);
},
},
mounted() {
const el = this.$refs.dragTable.$el.querySelectorAll(".el-table__body-wrapper > table > tbody")[0];
// const sortable = Sortable.create(el, {
// handle: ".allowDrag",
// onEnd: evt => {
// const targetRow = this.columns.splice(evt.oldIndex, 1)[0];
// this.columns.splice(evt.newIndex, 0, targetRow);
// for (let index in this.columns) {
// this.columns[index].sort = parseInt(index) + 1;
// }
// }
// });
}
}
;

Loading…
Cancel
Save