update 生产派工删除冗余代码

master
yinq 5 months ago
parent 02cf70aed5
commit 092337719d

@ -191,35 +191,6 @@
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="100">
<template #default="scope">
<el-button
icon="el-icon-search"
size="small"
type="primary"
@click="handleDrawing(scope.row)"
v-if=" scope.row.userId != null"
>图纸
</el-button>
<el-button
icon="el-icon-search"
size="small"
type="success"
@click="handleSop(scope.row)"
v-if=" scope.row.userId != null"
>SOP
</el-button>
<el-button
icon="el-icon-lock"
size="small"
type="primary"
@click="handleApplyRawOutstock(scope.row)"
v-if="scope.row.processType === PROCESS_TYPE.AUTO && scope.row.planId!=null && scope.row.planId!==''
&& scope.row.planStatus !== PLAN_STATUS.FINISHED
&& form.orderStatus!==ORDER_STATUS.FINISHED && form.orderStatus!==ORDER_STATUS.RECALLED && form.orderStatus!==ORDER_STATUS.DELETED"
>投料
</el-button>
<el-button
icon="el-icon-delete"
size="small"
@ -229,7 +200,6 @@
:disabled="(scope.row.planStatus !== PLAN_STATUS.TO_DISPATCH && scope.row.planStatus !== PLAN_STATUS.DISPATCHED) || form.orderStatus===ORDER_STATUS.FINISHED || form.orderStatus===ORDER_STATUS.RECALLED || form.orderStatus===ORDER_STATUS.DELETED"
>删除
</el-button>
</template>
</el-table-column>
@ -246,231 +216,26 @@
</el-form-item>
</el-form>
</el-card>
<el-dialog
:visible.sync="blueprintModel"
title="上传图纸"
width="30%"
@before-close="blueprintModel = false">
<el-form ref="form">
<el-form-item label="选择BOM图纸">
<el-select v-model="materialBomAttachIdList" placeholder="请选择选择BOM图纸" multiple filterable :clearable="false"
:disabled="(addProductPlanObject.planStatus !== PLAN_STATUS.DISPATCHED)">
<el-option
v-for="item in attachInfoList"
:key="item.attachId"
:label="item.attachName"
:value="item.attachId"
:disabled="isOptionDisabled(item.attachId)"
></el-option>
</el-select>
</el-form-item>
</el-form>
<el-upload
single
ref="drawingUpload"
list-type="picture-card"
action="uploadDrawingUrl"
:auto-upload="true"
:limit="drawingLimit"
: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
v-if="isAssetTypeAnImage(file.name)"
:alt="file.name"
:src="file.url" class="el-upload-list__item-thumbnail"
>
<span v-else>{{ file.name }}</span>
<span class="el-upload-list__item-actions">
<span
v-if="isAssetTypeAnImage(file.name)"
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in"></i>
</span>
<span
class="el-upload-list__item-delete"
@click="handleDownload(file)"
>
<i class="el-icon-download"></i>
</span>
<span
class="el-upload-list__item-delete"
@click="handleRemoveDrawing(file)"
v-if="addProductPlanObject.planStatus === PLAN_STATUS.DISPATCHED"
>
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
<span slot="footer" class="dialog-footer">
<!-- 上传提示 -->
<el-button type="primary" @click="drawingFileUploadSubmit"> </el-button>
<el-button @click="blueprintModel = false"> </el-button>
</span>
</el-dialog>
<el-dialog
:visible.sync="sopViewModel"
title="上传SOP附件"
width="30%"
@before-close="sopViewModel = false">
<el-form ref="form">
<el-form-item label="选择BOM的SOP">
<el-select v-model="materialBomAttachIdList" placeholder="请选择选择BOM的SOP" multiple filterable :clearable="false"
:disabled="(addProductPlanObject.planStatus !== PLAN_STATUS.DISPATCHED)">
<el-option
v-for="item in attachInfoList"
:key="item.attachId"
:label="item.attachName"
:value="item.attachId"
:disabled="isOptionDisabled(item.attachId)"
></el-option>
</el-select>
</el-form-item>
</el-form>
<el-upload
single
ref="drawingUpload"
list-type="picture-card"
action="uploadImgUrl"
:auto-upload="true"
:limit="sopLimit"
:headers="headers"
:before-upload="handleBeforeUpload"
:http-request="httpSopRequest"
:on-exceed="handleExceed"
:file-list="fileList"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{file}">
<img
v-if="isAssetTypeAnImage(file.name)"
:alt="file.name"
:src="file.url" class="el-upload-list__item-thumbnail"
>
<span v-else>{{ file.name }}</span>
<span class="el-upload-list__item-actions">
<span
v-if="isAssetTypeAnImage(file.name)"
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in"></i>
</span>
<span
class="el-upload-list__item-delete"
@click="handleDownload(file)"
>
<i class="el-icon-download"></i>
</span>
<span
class="el-upload-list__item-delete"
@click="handleRemoveSop(file)"
v-if="addProductPlanObject.planStatus === PLAN_STATUS.DISPATCHED"
>
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
<span slot="footer" class="dialog-footer">
<!-- 上传提示 -->
<!-- <div class="el-upload__tip" slot="tip" v-if="isShowTip">-->
<!-- 请上传-->
<!-- <template v-if="sopFileSize"> <b style="color: #f56c6c">{{ sopFileSize }}MB</b></template>-->
<!-- <template v-if="sopFileType"> <b style="color: #f56c6c">{{ sopFileType.join("/") }}</b></template>-->
<!-- 的文件-->
<!-- </div>-->
<el-button type="primary" @click="sopFileUploadSubmit"> </el-button>
<el-button @click="sopViewModel = false"> </el-button>
</span>
</el-dialog>
<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>
<!-- 投料信息对话框 -->
<el-dialog title="投料" :visible.sync="applyRawOutstockOpen" append-to-body>
<apply-raw-outstock ref="applyRawOutstockRef" :defineData="productPlanData"
v-if="applyRawOutstockOpen"></apply-raw-outstock>
</el-dialog>
</div>
</template>
<script>
// import {getProductOrder} from "@//api/mes/productOrder";
// import {
// deleteProductPlansByDispatchCode,
// getDispatchCode,
// selectProductPlans,
// checkAddMesProductPlanList,
// orderAddMesProductPlanList,
// getBaseRouteProcesses,
// getProcessUsers,
// uploadFile, getAttachInfoList
// } from "@//api/mes/productplan";
// import {getConfigKey} from "@//api/system/config"
// import {deepClone} from "@//utils/index";
// import {getToken} from "@//utils/auth";
// import {getBomAttachInfo, listMaterialBom} from "@/api/mes/materialBom";
// import {listMaterialinfo} from "@/api/mes/materialinfo";
import { getOrderInfo } from "@/api/mes/orderInfo";
import { getBaseRouteProcesses, getDispatchCode,} from '@/api/mes/planInfo';
import { getBaseRouteProcesses, getDispatchCode, selectProductPlans } from '@/api/mes/planInfo';
import { getProdBaseProcessUserList } from '@/api/mes/prodBaseProcessUser';
import { getPlanInfo, getPlanInfoList, updatePlanInfo, addPlanInfo, delPlanInfo, listPlanInfo,selectProductPlans } from '@/api/mes/planInfo'
import { getStationInfoList } from '@/api/mes/baseStationInfo';
import { getProdLineList } from '@/api/mes/baseProdLineInfo';
import { getBaseRouteList } from '@/api/mes/baseRoute';
import { getProcessInfoList } from '@/api/mes/baseProcessInfo';
let id = 0
let deepSearch = (arr, target) => {
let results = []
arr.forEach(element => {
console.log(element)
id = Math.max(id, element.id)
if (element.id === target) {
results.push(element)
} else if (Array.isArray(element.children)) {
results = results.concat(deepSearch(element.children, target))
}
// if (Array.isArray(element.children)) {
// results = results.concat(deepSearch(element.children, target))
// } else if (element.id === target) {
// results.push(element)
// }
})
return results
}
export default {
name: "productPlanEdit",
dicts: ['plan_status', 'product_status', 'mes_dispatch_flag'],
provide() {
return {
closeRawOutstockDialog: this.closeRawOutstockDialog,
}
},
props: {
value: [String, Object, Array, Number],
// sop
@ -478,12 +243,6 @@ export default {
type: Number,
default: 20,
},
//
drawingLimit: {
type: Number,
default: 20,
},
//
isShowTip: {
type: Boolean,
@ -500,9 +259,6 @@ export default {
//
single: true,
checkedMesProductPlanList: [],
//
uploadImgUrl: import.meta.env.VUE_APP_BASE_API,
uploadDrawingUrl: import.meta.env.VUE_APP_BASE_API + "/file/upload2SharePath",
// name
activeName: "columnInfo",
//
@ -515,8 +271,6 @@ export default {
mesProductPlanList: [],
//ID
toDeletedPlanIds: [],
applyRawOutstockOpen: false,
productPlanData: {},
//
info: {},
@ -629,13 +383,6 @@ export default {
materialBomAttachIdList: [],
};
},
watch: {
'materialBomAttachIdList': {
handler(newVal, oldVal) {
this.updateAttachInfoByBom(newVal, oldVal);
},
}
},
created() {
this.fetchOrderInfo();
},
@ -653,53 +400,7 @@ export default {
}
}
},
getConfigValues(){
//
getConfigKey("mes.drawing.allowedExtension").then(res => {
if(res.msg){
this.drawingFileType = res.msg.split(",");
}
});
getConfigKey("mes.drawing.maxSize").then(res => {
if(res.msg){
this.drawingFileSize = res.msg;
}
});
getConfigKey("mes.sop.allowedExtension").then(res => {
if(res.msg){
this.sopFileType = res.msg.split(",");
}
});
getConfigKey("mes.sop.maxSize").then(res => {
if (res.msg) {
this.sopFileSize = res.msg;
}
});
},
/* getProcessUsers(productOrderId) {
getProdBaseProcessUserList(this.form.dispatchId).then(res => {
res.data.forEach(processUser => {
if (!this.processUsers[processUser.processId]) {
this.processUsers[processUser.processId] = [];
}
this.processUsers[processUser.processId].push(processUser);
});
selectProductPlans({productOrderId: productOrderId}).then(res => {
this.groupProductPlans(res.data)
// res.data.forEach(e => {
// // false=true=
// e.oldRowFlag = true;
// this.mesProductPlanList.push(e);
// })
})
});
},*/
async getProcessJoin(productOrderId) {
const routeId = this.form.dispatchId;
const processId = this.form.processId;
@ -834,58 +535,6 @@ export default {
})
},
addProcessUser(scope) {
let finishStatus = this.PLAN_STATUS.FINISHED
const filterPlanList = this.mesProductPlanList.filter(function (item) {
return scope.row.dispatchCode + "-" + scope.row.processId === item.dispatchCode + "-" + item.processId
&& item.planStatus !== finishStatus;
})
if (filterPlanList.length <= 0) {
this.$modal.msgError("此工序已经完成,不能添加");
return;
}
let data = deepSearch(this.mesProductPlanList, scope.row.id)?.[0]
let id = this.id + 1
this.id += 1;
if (Array.isArray(data.children)) {
this.$set(data.children, data.children.length, {
id: id,
dispatchCode: scope.row.dispatchCode,
processId: scope.row.processId,
productionTime: scope.row.productionTime,
materialBomId: scope.row.materialBomId,
planStatus: this.PLAN_STATUS.DISPATCHED,
userId: null
})
} else {
this.$set(data, 'children', [
{
id: id,
dispatchCode: scope.row.dispatchCode,
processId: scope.row.processId,
productionTime: scope.row.productionTime,
materialBomId: scope.row.materialBomId,
planStatus: this.PLAN_STATUS.DISPATCHED,
userId: null,
}
])
}
this.id += 1
// this.show = false
// this.show = true
},
isAssetTypeAnImage(ext) {
let suffix = ext.lastIndexOf(".");
let name = ext.substr(suffix + 1);
return ['png', 'jpg', 'jpeg'].includes(name.toLowerCase())
},
/** 提交按钮 */
submitForm() {
// let dataList = this.mesProductPlanList.filter(plan => !plan.oldRowFlag);
@ -1092,22 +741,24 @@ export default {
}).catch(() => {
});
},
/** 生产计划明细序号 */
rowMesProductPlanIndex({row, rowIndex}) {
row.index = rowIndex + 1;
},
/** 复选框选中数据 */
handleMesProductPlanSelectionChange(selection) {
this.checkedMesProductPlanList = selection
this.single = selection.length !== 1
},
/** 关闭按钮 */
close() {
const obj = {path: "/mes/plan/productOrder", query: {t: Date.now(), queryParams: this.$route.query.queryParams}};
const obj = {path: "/mes/prod/orderInfo", query: {t: Date.now(), queryParams: this.queryParams}};
this.$tab.closeOpenPage(obj);
},
/** 生产计划添加按钮操作 */
async handleAddMesProductPlan() {
let dispatchCode = "";
@ -1198,314 +849,6 @@ export default {
// 使
return /^[0-9]\d*$/.test(value);
},
//
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.pictureDetailModel = true;
},
//
handleDownload(file) {
window.open(file.url);
},
/** 查看图纸 */
handleDrawing(row) {
this.fileList = [];
if (row.planId != null && (!this.previewDrawingFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId]
|| this.previewDrawingFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId] !== "1")) {
this.previewDrawingFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId] = "1";
getAttachInfoList(this.ATTACH_TYPE.DRAWING, row.dispatchCode, row.processId, row.userId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
let groupAttachFile = {};
groupAttachFile.dispatchCode = row.dispatchCode;
groupAttachFile.processId = row.processId;
groupAttachFile.attachId = e.attachId;
groupAttachFile.attachPath = e.attachPath;
groupAttachFile.attachName = e.attachName;
let groupAttachFileList = this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupAttachFileList ? this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupAttachFile);
let uploadAttachList = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadAttachList ? this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(e.attachId);
})
})
} else {
if (this.groupAttachFileList[row.dispatchCode + "-" + row.processId + "-" + row.userId]) {
this.groupAttachFileList[row.dispatchCode + "-" + row.processId + "-" + row.userId].forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
})
}
}
this.addProductPlanObject = row;
this.materialBomAttachIdList = [];
getBomAttachInfo(this.ATTACH_TYPE.DRAWING, this.addProductPlanObject.materialBomId).then(response => {
this.attachInfoList = response.data;
for (let e of this.fileList) {
let attachInfo = this.attachInfoList.find(item => item.attachPath === e.url);
if (attachInfo != null){
this.materialBomAttachIdList.push(attachInfo.attachId);
}
}
this.blueprintModel = true;
});
},
//
drawingFileUploadSubmit() {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
let mesProductPlan = this.mesProductPlanList[i];
for (let child of mesProductPlan.children) {
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId
&& child.userId === this.addProductPlanObject.userId) {
child.attachId = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].join(",");
}
}
}
// this.uploadAttachList = [];
this.addProductPlanObject = {};
this.blueprintModel = false;
},
//
httpRequest(file) {
//
const fileData = file.file;
const formData = new FormData();
formData.append("file", fileData);
formData.append("processId", this.addProductPlanObject.processId);
formData.append("attachType", this.ATTACH_TYPE.DRAWING);
uploadFile(formData).then(
(res) => {
let uploadAttachList = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadAttachList ? this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(res.attachId);
//
let groupAttachFile = {};
groupAttachFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupAttachFile.processId = this.addProductPlanObject.processId;
groupAttachFile.attachId = res.attachId;
groupAttachFile.attachPath = res.imgUrl;
groupAttachFile.attachName = res.fileName;
let groupAttachFileList = this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupAttachFileList ? this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupAttachFile);
this.$modal.closeLoading();
}, (err) => {
this.$refs.drawingUpload.clearFiles(); //
this.$modal.closeLoading();
}
);
},
//
handleRemoveDrawing(file) {
let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file);
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].splice(index, 1);
// this.uploadAttachList.splice(index, 1);
this.fileList.splice(index, 1);
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].splice(index, 1);
let num = 0;
arrPic.map((item) => {
if (item.uid === file.uid) {
arrPic.splice(num, 1);
}
num++;
});
let attachInfo = this.attachInfoList.find(item => item.attachPath === file.url);
if (attachInfo != null){
this.materialBomAttachIdList = this.materialBomAttachIdList.filter(item => item !== attachInfo.attachId);
}
},
/** 查看sop */
handleSop(row) {
this.fileList = [];
if (row.planId != null && (!this.previewSopFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId]
|| this.previewSopFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId] !== "1")) {
this.previewSopFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId] = "1";
getAttachInfoList(this.ATTACH_TYPE.SOP, row.dispatchCode, row.processId, row.userId).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.addProductPlanObject.userId];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupSopFileList ? this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupSopFile);
let uploadSopList = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadSopList ? this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(e.attachId);
})
})
} else {
if (this.groupSopFileList[row.dispatchCode + "-" + row.processId + "-" + row.userId]) {
this.groupSopFileList[row.dispatchCode + "-" + row.processId + "-" + row.userId].forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
})
}
}
this.addProductPlanObject = row;
this.materialBomAttachIdList = [];
getBomAttachInfo(this.ATTACH_TYPE.SOP, this.addProductPlanObject.materialBomId).then(response => {
this.attachInfoList = response.data;
for (let e of this.fileList) {
let attachInfo = this.attachInfoList.find(item => item.attachPath === e.url);
if (attachInfo != null){
this.materialBomAttachIdList.push(attachInfo.attachId);
}
}
this.sopViewModel = true;
});
},
//sop
sopFileUploadSubmit() {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
let mesProductPlan = this.mesProductPlanList[i];
for (let child of mesProductPlan.children) {
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId
&& child.userId === this.addProductPlanObject.userId) {
child.sopId = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].join(",");
}
}
}
// this.uploadAttachList = [];
this.addProductPlanObject = {};
this.sopViewModel = false;
},
//Sop
httpSopRequest(file) {
//
const fileData = file.file;
const formData = new FormData();
formData.append("file", fileData);
formData.append("processId", this.addProductPlanObject.processId);
formData.append("attachType", this.ATTACH_TYPE.SOP);
uploadFile(formData).then(
(res) => {
let uploadSopList = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadSopList ? this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(res.attachId);
//
let groupSopFile = {};
groupSopFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupSopFile.processId = this.addProductPlanObject.processId;
groupSopFile.attachId = res.attachId;
groupSopFile.attachPath = res.imgUrl;
groupSopFile.attachName = res.fileName;
let groupSopFileList = this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupSopFileList ? this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupSopFile);
this.$modal.closeLoading();
}, (err) => {
this.$refs.drawingUpload.clearFiles(); //
this.$modal.closeLoading();
}
);
},
//
handleRemoveSop(file) {
let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file);
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].splice(index, 1);
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].splice(index, 1);
this.fileList.splice(index, 1);
let num = 0;
arrPic.map((item) => {
if (item.uid === file.uid) {
arrPic.splice(num, 1);
}
num++;
});
let attachInfo = this.attachInfoList.find(item => item.attachPath === file.url);
if (attachInfo != null){
this.materialBomAttachIdList = this.materialBomAttachIdList.filter(item => item !== attachInfo.attachId);
}
},
// loading
handleBeforeUpload(file) {
let fileType, fileSize;
if (this.sopViewModel) {
fileType = this.sopFileType;
fileSize = this.sopFileSize;
} else if (this.blueprintModel) {
fileType = this.drawingFileType;
fileSize = this.drawingFileSize;
}
let isImg = false;
if (fileType.length) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
}
isImg = 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(`文件格式不正确, 请上传${fileType.join("/")}格式文件!`);
return false;
}
if (fileSize) {
const isLt = file.size / 1024 / 1024 < fileSize;
if (!isLt) {
this.$modal.msgError(`上传文件大小不能超过 ${fileSize} MB!`);
return false;
}
}
this.$modal.loading("正在上传文件,请稍候...");
this.number++;
},
//
handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} !`);
},
handleDeleteDispatchUser(row) {
this.mesProductPlanList.forEach(mesProductPlan => {
@ -1514,77 +857,8 @@ export default {
if (row.planId != null && row.planId !== '') {
this.toDeletedPlanIds.push(row.planId);
}
},
handleApplyRawOutstock(row) {
if (row.processType === this.PROCESS_TYPE.AUTO) {
this.applyRawOutstockOpen = true;
this.productPlanData.planCode = row.planCode;
this.productPlanData.planId = row.planId;
this.productPlanData.dispatchAmount = row.dispatchAmount;
this.productPlanData.saleOrderId = this.form.saleOrderId;
this.productPlanData.materialBomId = this.form.materialBomId;
}
},
closeRawOutstockDialog() {
this.applyRawOutstockOpen = false;
},
//BOMSOP
updateAttachInfoByBom(newVal, oldVal) {
if (newVal.length === 0) {
return
}
let result = [];
let targetAttachIds = newVal.filter(item => !oldVal.includes(item));
for (let targetAttachId of targetAttachIds) {
result.push(this.attachInfoList.find(item => item.attachId === targetAttachId));
}
console.log("result:",result);
let isDrawing = this.blueprintModel;
//
if (isDrawing) {
for (let e of result) {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
let groupAttachFile = {};
groupAttachFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupAttachFile.processId = this.addProductPlanObject.processId;
groupAttachFile.attachId = e.attachId;
groupAttachFile.attachPath = e.attachPath;
groupAttachFile.attachName = e.attachName;
let groupAttachFileList = this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupAttachFileList ? this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupAttachFile);
let uploadAttachList = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadAttachList ? this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(e.attachId);
}
} else {
//SOP
for (let e of result) {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
let groupSopFile = {};
groupSopFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupSopFile.processId = this.addProductPlanObject.processId;
groupSopFile.attachId = e.attachId;
groupSopFile.attachPath = e.attachPath;
groupSopFile.attachName = e.attachName;
let groupSopFileList = this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupSopFileList ? this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupSopFile);
let uploadSopList = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadSopList ? this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(e.attachId);
}
}
},
isOptionDisabled(attachId) {
//
@ -1622,7 +896,6 @@ export default {
}
},
}
;
onMounted(() => {

Loading…
Cancel
Save