|
|
|
@ -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;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|